提交 1e7546f4 编写于 作者: S Skylot

update tests

上级 7742d341
package jadx.tests;
import jadx.core.utils.StringUtils;
import junit.framework.TestCase;
public class StringUtilsTest extends TestCase {
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class StringUtilsTest {
@Test
public void testUnescape() {
unescapeTest("\n", "\\n");
unescapeTest("\t", "\\t");
......
......@@ -4,10 +4,12 @@ import jadx.core.clsp.ClspGraph;
import jadx.core.dex.instructions.args.ArgType;
import jadx.core.dex.instructions.args.PrimitiveType;
import jadx.core.utils.exceptions.DecodeException;
import junit.framework.TestCase;
import java.io.IOException;
import org.junit.Before;
import org.junit.Test;
import static jadx.core.dex.instructions.args.ArgType.BOOLEAN;
import static jadx.core.dex.instructions.args.ArgType.CHAR;
import static jadx.core.dex.instructions.args.ArgType.INT;
......@@ -19,18 +21,21 @@ import static jadx.core.dex.instructions.args.ArgType.UNKNOWN_OBJECT;
import static jadx.core.dex.instructions.args.ArgType.genericType;
import static jadx.core.dex.instructions.args.ArgType.object;
import static jadx.core.dex.instructions.args.ArgType.unknown;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
public class TypeMergeTest extends TestCase {
public class TypeMergeTest {
private void initClsp() throws IOException, DecodeException {
@Before
public void initClsp() throws IOException, DecodeException {
ClspGraph clsp = new ClspGraph();
clsp.load();
ArgType.setClsp(clsp);
}
@Test
public void testMerge() throws IOException, DecodeException {
initClsp();
first(INT, INT);
first(BOOLEAN, INT);
reject(INT, LONG);
......
......@@ -9,7 +9,7 @@ public class TestEnum extends AbstractTest {
public enum Direction {
NORTH, SOUTH, EAST, WEST
};
}
private static int three = 3;
......@@ -25,7 +25,7 @@ public class TestEnum extends AbstractTest {
public int getNum() {
return num;
}
};
}
public enum Operation {
PLUS {
......@@ -101,11 +101,28 @@ public class TestEnum extends AbstractTest {
public enum Singleton {
INSTANCE;
public String test(String arg) {
return arg.concat("test");
}
}
public String testEnumSwitch(final Direction color) {
String d;
switch (color) {
case NORTH:
d = "N";
break;
case SOUTH:
d = "S";
break;
default:
d = "<>";
break;
}
return d;
}
@Override
public boolean testRun() throws Exception {
Direction d = Direction.EAST;
......
......@@ -37,15 +37,6 @@ public class TestInvoke extends AbstractTest {
return s;
}
/* TODO
public TestInvoke testConstructor(int flag) {
if (getF() == flag)
return new TestInvoke(flag);
else
return this;
}
*/
@Override
public boolean testRun() throws Exception {
TestInvoke inv = new TestInvoke();
......@@ -58,7 +49,6 @@ public class TestInvoke extends AbstractTest {
assertTrue(inv.testVarArgs("a", "2", "III"));
assertTrue(inv.testVarArgs2("a".toCharArray(), new char[] { '1', '2' }).equals("a12"));
// assertTrue(testConstructor(f) != this);
return true;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册