public void Test_ImperativeSort() { var input = Utility.Generate(10_0000).ToArray(); var sorted = Library.qsort(ListModule.OfSeq(input)).ToArray(); var sorted2 = new Revise_QuickSort().ImperativeQuickSort(input); CollectionAssert.AreEqual(sorted2, sorted); }
public void Test_ImperativeSort_4Elements() { var input = new[] { 4, 3, 2, 1 }; var actual = new Revise_QuickSort().ImperativeQuickSort(input); var expected = input.OrderBy(x => x).ToArray(); CollectionAssert.AreEqual( actual, expected, $"Expected [{string.Join(",", expected)}] got [{string.Join(",", actual)}]"); }