static void DoIt() { Guid id = Guid.NewGuid(); List <int> MyItemsToSort = new List <int>(NUMS_NUM_NUMS); foreach (var suit in Enum.GetValues(typeof(TestTypes))) { //var suit = SetTestType(); System.Console.WriteLine(String.Format("Testing with sort type : {0}", suit)); MOBsSuperSort <int> sorting = new MOBsSuperSort <int>(PrintList); sorting.WriteSessionIdToFile(id, suit.ToString()); //v1 sort test Fill(MyItemsToSort, (int)suit); sorting.SortWithoutRecursionv1(MyItemsToSort); TestList(MyItemsToSort, "Search V1"); //Now test v2 Fill(MyItemsToSort, (int)suit); sorting.SortWithoutRecursionv2(MyItemsToSort); TestList(MyItemsToSort, "Search V2"); //Now test the built in one Fill(MyItemsToSort, (int)suit); sorting.SortWithoutRecursionv3(MyItemsToSort); TestList(MyItemsToSort, "Search V3"); } }
static void JustTestThisSoftware() { List <int> MyItemsToSort = new List <int>(NUMS_NUM_NUMS); TestAlgorithmFill(ref MyItemsToSort); MOBsSuperSort <int> sorting = new MOBsSuperSort <int>(false); sorting.SortWithoutRecursionv2(MyItemsToSort); TestList(MyItemsToSort, "Search V1"); }
static void Main(string[] args) { ReadSettings(); //JustTestThisSoftware(); MOBsSuperSort <int> .DeleteOldTextFile(); for (int count = 0; count < NUMBER_ITERATIONS; count++) { System.Console.WriteLine(String.Format("About to test. Iteration : {0}", (count + 1))); DoIt(); } MOBsSuperSort <int> .DisplayResults(); System.Console.WriteLine("Press any key to quit"); System.Console.ReadKey(); }
static void TestList(List <int> MyItemsToSort, String searchType) { //Now test to see if it worked List <int> PerfectList = new List <int>(MyItemsToSort); PerfectList.Sort(); IEnumerable <Tuple <int, int> > bothList = PerfectList.Zip(MyItemsToSort, Tuple.Create <int, int>); foreach (var f in bothList) { if (f.Item1 != f.Item2) { MOBsSuperSort <int> .WriteToFile(String.Format("The list {2} was not sorted properly ! Found the value {0} and it should have been a {1}", f.Item1, f.Item2, searchType)); return; } } MOBsSuperSort <int> .WriteToFile("The " + searchType + " list was sorted properly ! "); }