use of net.runelite.asm.attributes.code.instructions.IAnd in project runelite by runelite.
the class ExprArgOrderTest method test6.
@Test
public void test6() {
ClassGroup group = ClassGroupFactory.generateGroup();
Code code = group.findClass("test").findMethod("func").getCode();
Instructions ins = code.getInstructions();
code.setMaxStack(2);
// vars[0] = 3
Instruction[] prepareVariables = { new LDC(ins, 3), new IStore(ins, 0) };
for (Instruction i : prepareVariables) {
ins.addInstruction(i);
}
Label label = new Label(ins);
/*
iconst_0
ldc 8388608
iload_3
iadd
ldc -16777216
iand
if_icmpeq LABEL0x49
*/
Instruction[] body = { new LDC(ins, 0), new LDC(ins, 8388608), new ILoad(ins, 0), new IAdd(ins), new LDC(ins, -16777216), new IAnd(ins), // 8
new IfICmpEq(ins, label), label, new VReturn(ins) };
for (Instruction i : body) {
ins.addInstruction(i);
}
ExprArgOrder exprArgOrder = new ExprArgOrder();
exprArgOrder.run(group);
List<Instruction> instructions = ins.getInstructions();
assertEquals(ILOAD, instructions.get(2).getType());
assertEquals(LDC, instructions.get(3).getType());
assertEquals(IADD, instructions.get(4).getType());
assertEquals(LDC, instructions.get(5).getType());
assertEquals(IAND, instructions.get(6).getType());
assertEquals(LDC, instructions.get(7).getType());
assertEquals(IF_ICMPEQ, instructions.get(8).getType());
}
Aggregations