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

    Assert.assertEquals(
        Collections.singleton((WriteInstruction) program.get(0)), program.getUnusedAssignments());
  }
예제 #2
0
  @Test
  public void unreachable() {
    Program program = new SimpleProgramBuilder().emitRet().emitNop().buildProgram();

    Assert.assertEquals(
        Collections.singleton(program.get(1)), program.getUnreachableInstructions());
  }
예제 #3
0
  @Test
  public void unitializedReads() {
    Program program = new SimpleProgramBuilder().emitRead("x").buildProgram();

    Assert.assertEquals(
        Collections.singleton((ReadInstruction) program.get(0)), program.getUninitializedReads());
  }
예제 #4
0
  @Test
  public void expectedReturns() {
    Program program = new SimpleProgramBuilder().emitNop().buildProgram();

    Assert.assertEquals(Collections.singleton(program.get(0)), program.getExpectedReturns());
  }