public static int Main(String [] args) { Console.WriteLine("Test should return with ExitCode 100 ..."); GCStress obj= new GCStress(); if (obj.RunTest()) { Console.WriteLine("Test Passed"); return 100; } Console.WriteLine("Test Failed"); return 1; }
public static int Main(String [] args) { Console.WriteLine("Test should return with ExitCode 100 ..."); GCStress obj = new GCStress(); if (obj.RunTest()) { Console.WriteLine("Test Passed"); return(100); } Console.WriteLine("Test Failed"); return(1); }
public bool RunTest() { GCStress garbage; GCStress head = null; GCStress tail = null; GCStress walker; int stressCount = 0; int stressCount2 = 0; for (int i=0; i<1500000; i++) { byte[] x = new byte [(i %1111)]; if ((i%100) == 0) { garbage = new GCStress(); garbage.data = x; stressCount += x.Length; if (head == null) { head = garbage; } else { tail.next = garbage; } tail = garbage; } } walker = head; while (walker != null) { if (walker.data != null) { stressCount2 += walker.data.Length; } walker = walker.next; } Console.WriteLine ("Stress count: {0} {1}", stressCount, stressCount2); return (stressCount == stressCount2); }
public bool RunTest() { GCStress garbage; GCStress head = null; GCStress tail = null; GCStress walker; int stressCount = 0; int stressCount2 = 0; for (int i = 0; i < 1500000; i++) { byte[] x = new byte [(i % 1111)]; if ((i % 100) == 0) { garbage = new GCStress(); garbage.data = x; stressCount += x.Length; if (head == null) { head = garbage; } else { tail.next = garbage; } tail = garbage; } } walker = head; while (walker != null) { if (walker.data != null) { stressCount2 += walker.data.Length; } walker = walker.next; } Console.WriteLine("Stress count: {0} {1}", stressCount, stressCount2); return(stressCount == stressCount2); }