mirror of
https://github.com/revanced/smali.git
synced 2025-05-04 08:34:25 +02:00
- Added an "Assert" helper class to the junit tests, to allow easier testing of various types
- Changed the relevent tests to use the new Assert helper git-svn-id: https://smali.googlecode.com/svn/trunk@92 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
parent
b03e029611
commit
2b4a7ca201
@ -67,9 +67,8 @@
|
||||
|
||||
.line 2
|
||||
iget v0, v4, LFieldTest;->publicIntegerField:I
|
||||
int-to-long v0, v0
|
||||
const-wide/16 v2, 23
|
||||
invoke-static {v0, v1, v2, v3}, Lorg/junit/Assert;->assertEquals(JJ)V
|
||||
const/16 v1, 23
|
||||
invoke-static {v0, v1}, LAssert;->assertEquals(II)V
|
||||
|
||||
.line 3
|
||||
iget-object v0, p0, LFieldTest;->publicObjectField:Ljava/lang/Object;
|
||||
|
@ -9,21 +9,21 @@
|
||||
.end method
|
||||
|
||||
.method public test()V
|
||||
.registers 4
|
||||
.registers 2
|
||||
.annotation runtime Lorg/junit/Test;
|
||||
.end annotation
|
||||
|
||||
const v0, 0
|
||||
invoke-static {}, LSpecialInstructionPaddingTest;->paddingTest()I
|
||||
move-result v0
|
||||
int-to-long v0, v0
|
||||
|
||||
|
||||
const-wide/16 v2, 12
|
||||
|
||||
const/16 v1, 12
|
||||
|
||||
#the real test is that dalvik loaded and verified this class. This is
|
||||
#mostly just to make sure that the method was actually called
|
||||
invoke-static {v0, v1, v2, v3}, Lorg/junit/Assert;->assertEquals(JJ)V
|
||||
invoke-static {v0, v1}, LAssert;->assertEquals(II)V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
@ -64,5 +64,4 @@ PackedSwitch:
|
||||
Label12:
|
||||
Label13:
|
||||
.end packed-switch
|
||||
|
||||
.end method
|
41
src/test/smali/junit-tests/Util/Assert.smali
Normal file
41
src/test/smali/junit-tests/Util/Assert.smali
Normal file
@ -0,0 +1,41 @@
|
||||
.class public LAssert;
|
||||
.super Ljava/lang/Object;
|
||||
.source "Assert.smali"
|
||||
|
||||
#junit's Assert doesn't have an AssertEquals method for ints, only longs
|
||||
.method public static assertEquals(II)V
|
||||
.registers 4
|
||||
|
||||
int-to-long v0, p1
|
||||
int-to-long p0, p0
|
||||
|
||||
invoke-static {v0, v1, p0, p1}, Lorg/junit/Assert;->assertEquals(JJ)V
|
||||
return-void
|
||||
.end method
|
||||
|
||||
#junit's Assert doesn't have an AssertEquals method for floats, only doubles
|
||||
.method public static assertEquals(FF)V
|
||||
.registers 6
|
||||
|
||||
float-to-double v0, p0
|
||||
float-to-double v2, p1
|
||||
|
||||
const-wide v4, .00001
|
||||
|
||||
invoke-static/range {v0..v5}, Lorg/junit/Assert;->assertEquals(DDD)V
|
||||
return-void
|
||||
.end method
|
||||
|
||||
#convenience method that supplies a default "Delta" argument
|
||||
.method public static assertEquals(DD)V
|
||||
.registers 6
|
||||
|
||||
move-wide v0, p0
|
||||
move-wide v2, p2
|
||||
|
||||
const-wide v4, .00001
|
||||
|
||||
invoke-static/range {v0..v5}, Lorg/junit/Assert;->assertEquals(DDD)V
|
||||
|
||||
return-void
|
||||
.end method
|
Loading…
x
Reference in New Issue
Block a user