public static void Main() { Environment.ExitCode=1; Console.WriteLine("Test should pass with ExitCode 0"); Console.WriteLine("Building Graph with 100 vertices..."); Graph MyGraph = new Graph(100); // graph with 10 nodes MyGraph.BuildGraph(); MyGraph.CheckIfReachable(); Console.WriteLine("Deleting all vertices..."); MyGraph.DeleteVertex(); GC.Collect(); GC.WaitForPendingFinalizers(); Console.WriteLine("Done..."); }
public static void Main() { Graph.flag=false; Environment.ExitCode = 0; Console.WriteLine("Test should pass with ExitCode 0"); Console.WriteLine("Building Graph with 100 vertices..."); Graph MyGraph = new Graph(100); MyGraph.BuildGraph(); MyGraph.CheckIfReachable(); Console.WriteLine("Deleting all vertices..."); MyGraph.DeleteVertex(); GC.Collect(); GC.WaitForPendingFinalizers(); Vertex temp = MyGraph.ReturnVfirst(); GC.KeepAlive(temp); // will keep alive the graph till here Console.WriteLine("Done..."); Graph.flag=true; // to check if finalizers ran at shutdown or earlier }