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
7b14e322
Commit
7b14e322
authored
Dec 24, 2018
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: improve test checks
parent
21acaa8d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
7 deletions
+25
-7
AType.java
jadx-core/src/main/java/jadx/core/dex/attributes/AType.java
+3
-3
IntegrationTest.java
jadx-core/src/test/java/jadx/tests/api/IntegrationTest.java
+22
-4
No files found.
jadx-core/src/main/java/jadx/core/dex/attributes/AType.java
View file @
7b14e322
...
...
@@ -36,9 +36,9 @@ public class AType<T extends IAttribute> {
public
static
final
AType
<
AttrList
<
LoopInfo
>>
LOOP
=
new
AType
<>();
public
static
final
AType
<
AttrList
<
EdgeInsnAttr
>>
EDGE_INSN
=
new
AType
<>();
public
static
final
AType
<
AttrList
<
JadxError
>>
JADX_ERROR
=
new
AType
<>();
public
static
final
AType
<
AttrList
<
JadxWarn
>>
JADX_WARN
=
new
AType
<>();
public
static
final
AType
<
AttrList
<
String
>>
COMMENTS
=
new
AType
<>();
public
static
final
AType
<
AttrList
<
JadxError
>>
JADX_ERROR
=
new
AType
<>();
// code failed to decompile completely
public
static
final
AType
<
AttrList
<
JadxWarn
>>
JADX_WARN
=
new
AType
<>();
// mark code as inconsistent (code can be viewed)
public
static
final
AType
<
AttrList
<
String
>>
COMMENTS
=
new
AType
<>();
// any additional info about decompilation
public
static
final
AType
<
ExcHandlerAttr
>
EXC_HANDLER
=
new
AType
<>();
public
static
final
AType
<
CatchAttr
>
CATCH_BLOCK
=
new
AType
<>();
...
...
jadx-core/src/test/java/jadx/tests/api/IntegrationTest.java
View file @
7b14e322
...
...
@@ -22,6 +22,8 @@ import jadx.core.ProcessClass;
import
jadx.core.codegen.CodeGen
;
import
jadx.core.dex.attributes.AFlag
;
import
jadx.core.dex.attributes.AType
;
import
jadx.core.dex.attributes.AttrList
;
import
jadx.core.dex.attributes.IAttributeNode
;
import
jadx.core.dex.nodes.ClassNode
;
import
jadx.core.dex.nodes.MethodNode
;
import
jadx.core.dex.nodes.RootNode
;
...
...
@@ -40,6 +42,7 @@ import static org.hamcrest.Matchers.empty;
import
static
org
.
hamcrest
.
Matchers
.
is
;
import
static
org
.
hamcrest
.
Matchers
.
not
;
import
static
org
.
hamcrest
.
Matchers
.
notNullValue
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertThat
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
...
...
@@ -176,15 +179,30 @@ public abstract class IntegrationTest extends TestUtils {
}
protected
static
void
checkCode
(
ClassNode
cls
)
{
assertTrue
(
"Inconsistent cls: "
+
cls
,
!
cls
.
contains
(
AFlag
.
INCONSISTENT_CODE
)
&&
!
cls
.
contains
(
AType
.
JADX_ERROR
));
assertFalse
(
"Inconsistent cls: "
+
cls
,
hasErrors
(
cls
));
for
(
MethodNode
mthNode
:
cls
.
getMethods
())
{
assertTrue
(
"Inconsistent method: "
+
mthNode
,
!
mthNode
.
contains
(
AFlag
.
INCONSISTENT_CODE
)
&&
!
mthNode
.
contains
(
AType
.
JADX_ERROR
));
assertFalse
(
"Method with problems: "
+
mthNode
,
hasErrors
(
mthNode
));
}
assertThat
(
cls
.
getCode
().
toString
(),
not
(
containsString
(
"inconsistent"
)));
}
private
static
boolean
hasErrors
(
IAttributeNode
node
)
{
if
(
node
.
contains
(
AFlag
.
INCONSISTENT_CODE
)
||
node
.
contains
(
AType
.
JADX_ERROR
)
||
node
.
contains
(
AType
.
JADX_WARN
))
{
return
true
;
}
AttrList
<
String
>
commentsAttr
=
node
.
get
(
AType
.
COMMENTS
);
if
(
commentsAttr
!=
null
)
{
for
(
String
comment
:
commentsAttr
.
getList
())
{
if
(
comment
.
contains
(
"JADX WARN"
))
{
return
true
;
}
}
}
return
false
;
}
private
void
runAutoCheck
(
String
clsName
)
{
try
{
// run 'check' method from original class
...
...
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