Пример #1
0
		public void ZFinally()	
		{
			TypeDefinition type = DoGetType("Cases");
			MethodDefinition method = type.Methods.GetMethod("Finally")[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(3, tracker.State(index).Value);
						
			index = DoGetIndex(instructions, "finally");
			Assert.AreEqual(2, tracker.State(index).Value);
			
			index = DoGetIndex(instructions, "last");
			Assert.AreEqual(2, tracker.State(index).Value);
		}
Пример #2
0
		public void DoWhile()	
		{
			TypeDefinition type = DoGetType("Cases");
			MethodDefinition method = type.Methods.GetMethod("DoWhile")[0];

			var instructions = new TypedInstructionCollection(new SymbolTable(), method);	
			var tracker = new V0.Tracker(instructions);
						
			int index = DoGetIndex(instructions, "first");
			Assert.IsFalse(tracker.State(index).HasValue);
			
			index = DoGetIndex(instructions, "second");
			Assert.AreEqual(2, tracker.State(index).Value);
						
			index = DoGetIndex(instructions, "last");
			Assert.IsFalse(tracker.State(index).HasValue);
		}