Example #1
0
  @Test
  public void unusedAssignments() {
    Program program = new SimpleProgramBuilder().emitWrite("x").buildProgram();

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

    Assert.assertTrue(program.getUnusedAssignments().isEmpty());
  }