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