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
66421be9
Commit
66421be9
authored
Mar 22, 2019
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: add tests for some known issues
parent
9695291e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
118 additions
and
0 deletions
+118
-0
TestCastInOverloadedInvoke.java
.../tests/integration/invoke/TestCastInOverloadedInvoke.java
+67
-0
TestSynchronizedInEndlessLoop.java
...ests/integration/loops/TestSynchronizedInEndlessLoop.java
+51
-0
No files found.
jadx-core/src/test/java/jadx/tests/integration/invoke/TestCastInOverloadedInvoke.java
0 → 100644
View file @
66421be9
package
jadx
.
tests
.
integration
.
invoke
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.extension.ExtendWith
;
import
jadx.NotYetImplemented
;
import
jadx.NotYetImplementedExtension
;
import
jadx.core.dex.nodes.ClassNode
;
import
jadx.tests.api.IntegrationTest
;
import
static
jadx
.
tests
.
api
.
utils
.
JadxMatchers
.
containsOne
;
import
static
org
.
hamcrest
.
MatcherAssert
.
assertThat
;
import
static
org
.
hamcrest
.
Matchers
.
is
;
@ExtendWith
(
NotYetImplementedExtension
.
class
)
public
class
TestCastInOverloadedInvoke
extends
IntegrationTest
{
public
static
class
TestCls
{
int
c
=
0
;
public
void
test
()
{
call
(
new
ArrayList
<>());
call
((
List
<
String
>)
new
ArrayList
<
String
>());
}
public
void
test2
(
Object
obj
)
{
if
(
obj
instanceof
String
)
{
call
((
String
)
obj
);
}
}
public
void
call
(
String
str
)
{
c
+=
1
;
}
public
void
call
(
List
<
String
>
list
)
{
c
+=
2
;
}
public
void
call
(
ArrayList
<
String
>
list
)
{
c
+=
4
;
}
public
void
check
()
{
test
();
assertThat
(
c
,
is
(
2
+
4
));
c
=
0
;
test2
(
"str"
);
assertThat
(
c
,
is
(
1
));
}
}
@Test
@NotYetImplemented
public
void
test
()
{
ClassNode
cls
=
getClassNode
(
TestCls
.
class
);
String
code
=
cls
.
getCode
().
toString
();
assertThat
(
code
,
containsOne
(
"call(new ArrayList<>());"
));
assertThat
(
code
,
containsOne
(
"call((List<String>) new ArrayList<String>());"
));
assertThat
(
code
,
containsOne
(
"call((String) obj);"
));
}
}
jadx-core/src/test/java/jadx/tests/integration/loops/TestSynchronizedInEndlessLoop.java
0 → 100644
View file @
66421be9
package
jadx
.
tests
.
integration
.
loops
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.extension.ExtendWith
;
import
jadx.NotYetImplemented
;
import
jadx.NotYetImplementedExtension
;
import
jadx.core.dex.nodes.ClassNode
;
import
jadx.tests.api.IntegrationTest
;
import
static
jadx
.
tests
.
api
.
utils
.
JadxMatchers
.
containsOne
;
import
static
org
.
hamcrest
.
MatcherAssert
.
assertThat
;
@ExtendWith
(
NotYetImplementedExtension
.
class
)
public
class
TestSynchronizedInEndlessLoop
extends
IntegrationTest
{
public
static
class
TestCls
{
int
f
=
5
;
int
test
()
{
while
(
true
)
{
synchronized
(
this
)
{
if
(
f
>
7
)
{
return
7
;
}
else
if
(
f
<
3
)
{
return
3
;
}
}
try
{
f
++;
Thread
.
sleep
(
100
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
}
}
}
@Test
@NotYetImplemented
public
void
test
()
{
ClassNode
cls
=
getClassNode
(
TestCls
.
class
);
String
code
=
cls
.
getCode
().
toString
();
assertThat
(
code
,
containsOne
(
"synchronized (this) {"
));
assertThat
(
code
,
containsOne
(
"try {"
));
assertThat
(
code
,
containsOne
(
"f++;"
));
assertThat
(
code
,
containsOne
(
"Thread.sleep(100);"
));
assertThat
(
code
,
containsOne
(
"} catch (Exception e) {"
));
}
}
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