예제 #1
0
        public void Test5()
        {
            var sort   = new NaiveTplParallelMergeMergeSort();
            var array  = new[] { 4, 3, 0, 4, 2 };
            var result = sort.Sort(array);

            Assert.AreEqual(new[] { 0, 2, 3, 4, 4 }, result);
        }
예제 #2
0
        public void Test3()
        {
            var sort   = new NaiveTplParallelMergeMergeSort();
            var array  = new[] { 2, -9, 1 };
            var result = sort.Sort(array);

            Assert.AreEqual(new[] { -9, 1, 2 }, result);
        }
예제 #3
0
        public void GeneratedTest()
        {
            var arrays = new ArrayGenerator(100, 1000, 1).GenerateTestArrays();
            var sort   = new NaiveTplParallelMergeMergeSort();

            foreach (var array in arrays)
            {
                var result = sort.Sort(array);
                var ls     = result.ToList();
                ls.Sort();
                var expectedResult = ls.ToArray();
                Assert.AreEqual(expectedResult, result);
            }
        }