use of com.googlecode.dex2jar.ir.stmt.UnopStmt in project dex2jar by pxb1988.
the class ConstTransformerTest method test04.
@Test
public void test04() {
IrMethod jm = new IrMethod();
Local a = nLocal("a");
Local b = nLocal("b");
Local p = nLocal("p");
jm.locals.add(a);
jm.locals.add(b);
jm.locals.add(p);
jm.stmts.add(nAssign(a, nString(new String("a String"))));
jm.stmts.add(nAssign(b, nString(new String("a String"))));
jm.stmts.add(nAssign(p, Exprs.nPhi(a, b)));
UnopStmt retStmt = nReturn(p);
jm.stmts.add(retStmt);
new ConstTransformer().transform(jm);
Assert.assertTrue(jm.locals.size() == 3);
Assert.assertTrue(jm.stmts.getSize() == 4);
Assert.assertEquals(VT.CONSTANT, retStmt.op.vt);
}
use of com.googlecode.dex2jar.ir.stmt.UnopStmt in project dex2jar by pxb1988.
the class ConstTransformerTest method test00.
@Test
public void test00() {
IrMethod jm = new IrMethod();
Local a = nLocal("a");
jm.locals.add(a);
jm.stmts.add(nAssign(a, nString("a String")));
UnopStmt retStmt = nReturn(a);
jm.stmts.add(retStmt);
new ConstTransformer().transform(jm);
Assert.assertTrue(jm.locals.size() == 1);
Assert.assertTrue(jm.stmts.getSize() == 2);
Assert.assertEquals("a String", ((Constant) retStmt.op.trim()).value);
}
use of com.googlecode.dex2jar.ir.stmt.UnopStmt in project dex2jar by pxb1988.
the class ConstTransformerTest method test01.
@Test
public void test01() {
// local in phi
IrMethod jm = new IrMethod();
Local a = nLocal("a");
Local p = nLocal("p");
jm.locals.add(a);
jm.locals.add(p);
jm.stmts.add(nAssign(a, nString("a String")));
jm.stmts.add(nAssign(p, Exprs.nPhi(a)));
UnopStmt retStmt = nReturn(p);
jm.stmts.add(retStmt);
new ConstTransformer().transform(jm);
Assert.assertTrue(jm.locals.size() == 2);
Assert.assertTrue(jm.stmts.getSize() == 3);
Assert.assertEquals("a String", ((Constant) retStmt.op.trim()).value);
}
use of com.googlecode.dex2jar.ir.stmt.UnopStmt in project dex2jar by pxb1988.
the class ConstTransformerTest method test02.
@Test
public void test02() {
// test local loop
IrMethod jm = new IrMethod();
Local a = nLocal("a");
Local p = nLocal("p");
Local q = nLocal("q");
jm.locals.add(a);
jm.locals.add(p);
jm.locals.add(q);
jm.stmts.add(nAssign(a, nString("a String")));
jm.stmts.add(nAssign(p, Exprs.nPhi(a, q)));
jm.stmts.add(nAssign(q, Exprs.nPhi(p)));
UnopStmt retStmt = nReturn(q);
jm.stmts.add(retStmt);
new ConstTransformer().transform(jm);
Assert.assertTrue(jm.locals.size() == 3);
Assert.assertTrue(jm.stmts.getSize() == 4);
Assert.assertEquals("a String", ((Constant) retStmt.op.trim()).value);
}
use of com.googlecode.dex2jar.ir.stmt.UnopStmt in project dex2jar by pxb1988.
the class TypeTransformerTest method test1Const.
@Test
public void test1Const() {
initMethod(true, "F");
Local b = addLocal("b");
AssignStmt st1 = addStmt(nAssign(b, nInt(0)));
UnopStmt st3 = addStmt(nReturn(b));
transform();
Assert.assertEquals("", b.valueType, "F");
}
Aggregations