Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
J
jadx
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
jadx
Commits
3970fce5
Commit
3970fce5
authored
Apr 01, 2019
by
Ahmed Ashour
Committed by
skylot
Apr 01, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: use NYI instead of comment (PR #551)
parent
eda22724
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
22 deletions
+57
-22
TestArith.java
...src/test/java/jadx/tests/integration/arith/TestArith.java
+23
-6
TestArith2.java
...rc/test/java/jadx/tests/integration/arith/TestArith2.java
+14
-4
TestFieldIncrement3.java
...ava/jadx/tests/integration/arith/TestFieldIncrement3.java
+10
-10
TestConditions16.java
...a/jadx/tests/integration/conditions/TestConditions16.java
+10
-1
TestConditions8.java
...va/jadx/tests/integration/conditions/TestConditions8.java
+0
-1
No files found.
jadx-core/src/test/java/jadx/tests/integration/arith/TestArith.java
View file @
3970fce5
package
jadx
.
tests
.
integration
.
arith
;
import
static
org
.
hamcrest
.
MatcherAssert
.
assertThat
;
import
static
org
.
hamcrest
.
Matchers
.
containsString
;
import
org.junit.jupiter.api.Test
;
import
jadx.NotYetImplemented
;
import
jadx.core.dex.nodes.ClassNode
;
import
jadx.tests.api.IntegrationTest
;
...
...
@@ -28,10 +32,16 @@ public class TestArith extends IntegrationTest {
public
void
test
()
{
ClassNode
cls
=
getClassNode
(
TestCls
.
class
);
String
code
=
cls
.
getCode
().
toString
();
}
@Test
@NotYetImplemented
public
void
test2
()
{
ClassNode
cls
=
getClassNode
(
TestCls
.
class
);
String
code
=
cls
.
getCode
().
toString
();
// TODO: reduce code vars by name
// assertThat(code, containsString("a += 2;"));
// assertThat(code, containsString("a++;"));
assertThat
(
code
,
containsString
(
"a += 2;"
));
assertThat
(
code
,
containsString
(
"a++;"
));
}
@Test
...
...
@@ -39,9 +49,16 @@ public class TestArith extends IntegrationTest {
noDebugInfo
();
ClassNode
cls
=
getClassNode
(
TestCls
.
class
);
String
code
=
cls
.
getCode
().
toString
();
}
@Test
@NotYetImplemented
public
void
testNoDebug2
()
{
noDebugInfo
();
ClassNode
cls
=
getClassNode
(
TestCls
.
class
);
String
code
=
cls
.
getCode
().
toString
();
// TODO: simplify for variables without debug names
// assertThat(code, containsString("i += 2;"));
// assertThat(code, containsString("i++;"));
assertThat
(
code
,
containsString
(
"i += 2;"
));
assertThat
(
code
,
containsString
(
"i++;"
));
}
}
jadx-core/src/test/java/jadx/tests/integration/arith/TestArith2.java
View file @
3970fce5
package
jadx
.
tests
.
integration
.
arith
;
import
jadx.core.dex.nodes.ClassNode
;
import
jadx.tests.api.IntegrationTest
;
import
static
org
.
hamcrest
.
CoreMatchers
.
containsString
;
import
static
org
.
hamcrest
.
CoreMatchers
.
not
;
import
static
org
.
hamcrest
.
MatcherAssert
.
assertThat
;
import
org.junit.jupiter.api.Test
;
import
jadx.NotYetImplemented
;
import
jadx.core.dex.nodes.ClassNode
;
import
jadx.tests.api.IntegrationTest
;
public
class
TestArith2
extends
IntegrationTest
{
public
static
class
TestCls
{
...
...
@@ -20,13 +23,20 @@ public class TestArith2 extends IntegrationTest {
}
}
//
@Test
@Test
public
void
test
()
{
ClassNode
cls
=
getClassNode
(
TestCls
.
class
);
String
code
=
cls
.
getCode
().
toString
();
assertThat
(
code
,
containsString
(
"return (a + 2) * 3;"
));
assertThat
(
code
,
not
(
containsString
(
"a + 2 * 3"
)));
}
@Test
@NotYetImplemented
public
void
test2
()
{
ClassNode
cls
=
getClassNode
(
TestCls
.
class
);
String
code
=
cls
.
getCode
().
toString
();
assertThat
(
code
,
containsString
(
"return a + b + c;"
));
assertThat
(
code
,
not
(
containsString
(
"return (a + b) + c;"
)));
...
...
jadx-core/src/test/java/jadx/tests/integration/arith/TestFieldIncrement3.java
View file @
3970fce5
...
...
@@ -19,25 +19,25 @@ public class TestFieldIncrement3 extends IntegrationTest {
static
Vector2
directVect
=
new
Vector2
();
static
Vector2
newPos
=
new
Vector2
();
p
rivate
static
void
test
()
{
p
ublic
static
void
test
()
{
Random
rd
=
new
Random
();
int
direction
=
rd
.
nextInt
(
7
);
switch
(
direction
)
{
case
0
:
targetPos
.
x
=
(
float
)
(((
tileX
+
1
)
*
55
)
+
55
)
;
targetPos
.
y
=
(
float
)
(((
tileY
+
1
)
*
35
)
+
35
)
;
targetPos
.
x
=
(
(
tileX
+
1
)
*
55
)
+
55
;
targetPos
.
y
=
(
(
tileY
+
1
)
*
35
)
+
35
;
break
;
case
2
:
targetPos
.
x
=
(
float
)
(((
tileX
+
1
)
*
55
)
+
55
)
;
targetPos
.
y
=
(
float
)
(((
tileY
-
1
)
*
35
)
+
35
)
;
targetPos
.
x
=
(
(
tileX
+
1
)
*
55
)
+
55
;
targetPos
.
y
=
(
(
tileY
-
1
)
*
35
)
+
35
;
break
;
case
4
:
targetPos
.
x
=
(
float
)
(((
tileX
-
1
)
*
55
)
+
55
)
;
targetPos
.
y
=
(
float
)
(((
tileY
-
1
)
*
35
)
+
35
)
;
targetPos
.
x
=
(
(
tileX
-
1
)
*
55
)
+
55
;
targetPos
.
y
=
(
(
tileY
-
1
)
*
35
)
+
35
;
break
;
case
6
:
targetPos
.
x
=
(
float
)
(((
tileX
-
1
)
*
55
)
+
55
)
;
targetPos
.
y
=
(
float
)
(((
tileY
+
1
)
*
35
)
+
35
)
;
targetPos
.
x
=
(
(
tileX
-
1
)
*
55
)
+
55
;
targetPos
.
y
=
(
(
tileY
+
1
)
*
35
)
+
35
;
break
;
default
:
break
;
...
...
@@ -45,7 +45,7 @@ public class TestFieldIncrement3 extends IntegrationTest {
directVect
.
x
=
targetPos
.
x
-
newPos
.
x
;
directVect
.
y
=
targetPos
.
y
-
newPos
.
y
;
float
hPos
=
(
float
)
Math
.
sqrt
((
d
ouble
)
((
directVect
.
x
*
directVect
.
x
)
+
(
directVect
.
y
*
directVect
.
y
)
));
float
hPos
=
(
float
)
Math
.
sqrt
((
d
irectVect
.
x
*
directVect
.
x
)
+
(
directVect
.
y
*
directVect
.
y
));
directVect
.
x
/=
hPos
;
directVect
.
y
/=
hPos
;
}
...
...
jadx-core/src/test/java/jadx/tests/integration/conditions/TestConditions16.java
View file @
3970fce5
...
...
@@ -2,6 +2,7 @@ package jadx.tests.integration.conditions;
import
org.junit.jupiter.api.Test
;
import
jadx.NotYetImplemented
;
import
jadx.core.dex.nodes.ClassNode
;
import
jadx.tests.api.IntegrationTest
;
...
...
@@ -26,11 +27,19 @@ public class TestConditions16 extends IntegrationTest {
}
@Test
@NotYetImplemented
public
void
test
()
{
ClassNode
cls
=
getClassNode
(
TestCls
.
class
);
String
code
=
cls
.
getCode
().
toString
();
// assertThat(code, containsOne("return a < 0 || (b % 2 != 0 && a > 28) || b < 0;"));
assertThat
(
code
,
containsOne
(
"return a < 0 || (b % 2 != 0 && a > 28) || b < 0;"
));
}
@Test
public
void
test2
()
{
ClassNode
cls
=
getClassNode
(
TestCls
.
class
);
String
code
=
cls
.
getCode
().
toString
();
assertThat
(
code
,
containsOne
(
"return a < 0 || ((b % 2 != 0 && a > 28) || b < 0);"
));
}
}
jadx-core/src/test/java/jadx/tests/integration/conditions/TestConditions8.java
View file @
3970fce5
...
...
@@ -31,7 +31,6 @@ public class TestConditions8 extends IntegrationTest {
}
private
void
showMore
()
{
}
private
int
size
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment