public void SimpleExample() { var TAC = GenerateTAC( @" { a = b; a = c; } "); var optimizer = new DefUseOptimizer(TAC); optimizer.Run(); var expected = new List <string>() { "", "a = c" }; var actual = optimizer.TAC.Instructions.Select(instruction => instruction.ToString().Trim()); CollectionAssert.AreEqual(expected, actual); }
public void NothingToDelete() { var TAC = GenerateTAC( @" { a = b; b = c; c = x + y; } "); var optimizer = new DefUseOptimizer(TAC); optimizer.Run(); var expected = new List <string>() { "a = b", "b = c", "c = x + y" }; var actual = optimizer.TAC.Instructions.Select(instruction => instruction.ToString().Trim()); CollectionAssert.AreEqual(expected, actual); }