@Test public void unusedAssignments() { Program program = new SimpleProgramBuilder().emitWrite("x").buildProgram(); Assert.assertEquals( Collections.singleton((WriteInstruction) program.get(0)), program.getUnusedAssignments()); }
@Test public void writeWithReadIsNotUnusedAssignment() { Program program = new SimpleProgramBuilder().emitWrite("x").emitRead("x").buildProgram(); Assert.assertTrue(program.getUnusedAssignments().isEmpty()); }