EclipseTAC tac = new EclipseTAC(m.resolveBinding());
PrefixExpression inc = (PrefixExpression) EclipseTACSimpleTestDriver.getLastStatementReturn(m).getExpression();
TACInstruction instr = tac.instruction(inc);
Assert.assertTrue(instr != null);
Assert.assertTrue(instr instanceof EclipseInstructionSequence);
LoadArrayInstruction load = (LoadArrayInstruction) tac.instruction(inc.getOperand());
EclipseInstructionSequence seq = (EclipseInstructionSequence) instr;
Assert.assertEquals(
"Wrong number of instructions in sequence: " + seq.getInstructions().length,
3, seq.getInstructions().length);
Assert.assertTrue(seq.getInstructions()[0] instanceof LoadLiteralInstruction);
Assert.assertTrue(seq.getInstructions()[1] instanceof BinaryOperation);
Assert.assertTrue(seq.getInstructions()[2] instanceof StoreArrayInstruction);
LoadLiteralInstruction one = (LoadLiteralInstruction) seq.getInstructions()[0];
BinaryOperation add = (BinaryOperation) seq.getInstructions()[1];
StoreArrayInstruction store = (StoreArrayInstruction) seq.getInstructions()[2];
Assert.assertEquals(load.getTarget(), add.getOperand1());
Assert.assertEquals(one.getTarget(), add.getOperand2());
Assert.assertEquals(add.getTarget(), store.getSourceOperand());
Assert.assertEquals(add.getTarget(), seq.getResultVariable());
Assert.assertFalse(add.getTarget().equals(load.getTarget()));
}