Example #1
0
		public void TrashStackTrace()	
		{
			TypeDefinition type = DoGetType("Cases");
			MethodDefinition method = type.Methods.GetMethod("TrashStackTrace")[0];

			TypedInstructionCollection instructions = new TypedInstructionCollection(new SymbolTable(), method);			
			Log.DebugLine((ControlFlowGraph) null, "-----------------------------------"); 
			Log.DebugLine((ControlFlowGraph) null, "{0:F}", instructions);
			
			ControlFlowGraph graph = new ControlFlowGraph(instructions);
			Assert.AreEqual(2, graph.Roots.Length);
			Log.DebugLine((ControlFlowGraph) null, "Root 1:\n{0:T}", graph.Roots[0]);
			Log.DebugLine((ControlFlowGraph) null, "Root 2:\n{0:T}", graph.Roots[1]);
		}	
Example #2
0
		public void ZNestedFinally()	
		{
			TypeDefinition type = DoGetType("Cases");
			MethodDefinition method = type.Methods.GetMethod("NestedFinally")[0];

			TypedInstructionCollection instructions = new TypedInstructionCollection(new SymbolTable(), method);			
			Log.DebugLine((ControlFlowGraph) null, "-----------------------------------"); 
			Log.DebugLine((ControlFlowGraph) null, "{0:F}", instructions);
			
			ControlFlowGraph graph = new ControlFlowGraph(instructions);
			Assert.AreEqual(2, graph.Roots.Length);
		}
Example #3
0
		public void Linear()	
		{
			TypeDefinition type = DoGetType("Cases");
			MethodDefinition method = type.Methods.GetMethod("Linear")[0];

			TypedInstructionCollection instructions = new TypedInstructionCollection(new SymbolTable(), method);			
			Log.DebugLine((ControlFlowGraph) null, "-----------------------------------"); 
			Log.DebugLine((ControlFlowGraph) null, "{0:F}", instructions);
			
			ControlFlowGraph graph = new ControlFlowGraph(instructions);
			Assert.AreEqual(1, graph.Roots.Length);
			Log.DebugLine((ControlFlowGraph) null, "\n{0:T}", graph.Roots[0]);
			Assert.AreEqual(1, graph.Length);

			Assert.AreEqual(0, graph.Roots[0].First.Index);
			Assert.AreEqual(instructions.Length - 1, graph.Roots[0].Last.Index);
		}