public void Linear() { TypeDefinition type = DoGetType("Cases"); MethodDefinition method = type.Methods.GetMethod("Linear")[0]; var instructions = new TypedInstructionCollection(new SymbolTable(), method); var tracker = new V0.Tracker(instructions); int index = DoGetIndex(instructions, "first"); Assert.AreEqual(0, tracker.State(index).Value); index = DoGetIndex(instructions, "second"); Assert.AreEqual(3, tracker.State(index).Value); }
public void Catch1() { TypeDefinition type = DoGetType("Cases"); MethodDefinition method = type.Methods.GetMethod("Catch1")[0]; var instructions = new TypedInstructionCollection(new SymbolTable(), method); var tracker = new V0.Tracker(instructions); int index = DoGetIndex(instructions, "first"); Assert.AreEqual(2, tracker.State(index).Value); index = DoGetIndex(instructions, "catch"); Assert.AreEqual(0, tracker.State(index).Value); index = DoGetIndex(instructions, "last"); Assert.IsFalse(tracker.State(index).HasValue); }
public void TwoIfs() { TypeDefinition type = DoGetType("Cases"); MethodDefinition method = type.Methods.GetMethod("TwoIfs")[0]; var instructions = new TypedInstructionCollection(new SymbolTable(), method); var tracker = new V0.Tracker(instructions); int index = DoGetIndex(instructions, "second"); Assert.AreEqual(2, tracker.State(index).Value); index = DoGetIndex(instructions, "third"); Assert.AreEqual(3, tracker.State(index).Value); index = DoGetIndex(instructions, "fourth"); Assert.IsFalse(tracker.State(index).HasValue); index = DoGetIndex(instructions, "fifth"); Assert.AreEqual(5, tracker.State(index).Value); index = DoGetIndex(instructions, "last"); Assert.IsFalse(tracker.State(index).HasValue); }