Beispiel #1
0
        public void Returns_Equivalent_Array_For_Single_Element_Input()
        {
            var sorter = new MergeSorter();

            int[] actual = sorter.Sort(new int[] { 42 });

            actual.Should().BeEquivalentTo(new int[] { 42 });
        }
Beispiel #2
0
        public void Returns_Empty_Array_When_Empty_Or_Null_One_Is_Specified(int[] input)
        {
            var sorter = new MergeSorter();

            int[] actual = sorter.Sort(input);

            actual.Should().BeEquivalentTo(new int[] { });
        }
Beispiel #3
0
        public void Returns_Array_Sorted_By_Asc_For_Input_With_Duplicates()
        {
            var sorter = new MergeSorter();

            int[] actual = sorter.Sort(new int[] { 11, 1, 5, 8, 8, 8, 8, 8, 3, 8, 2, 8, 8, 11, 8, });

            actual.Should().BeEquivalentTo(new int[] { 1, 2, 3, 5, 8, 8, 8, 8, 8, 8, 8, 8, 8, 11, 11 });
            actual.Should().BeInAscendingOrder();
        }
Beispiel #4
0
        public void Returns_Array_Sorted_By_Asc_For_Array_Where_All_Elements_Are_The_Same()
        {
            var sorter = new MergeSorter();

            int[] actual = sorter.Sort(new int[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 });

            actual.Should().BeEquivalentTo(new int[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 });
            actual.Should().BeInAscendingOrder();
        }
Beispiel #5
0
        public void Returns_Array_Sorted_By_Asc()
        {
            var sorter = new MergeSorter();

            int[] actual = sorter.Sort(new int[] { 1, 5, 3, 8, 2, 11 });

            actual.Should().BeEquivalentTo(new int[] { 1, 2, 3, 5, 8, 11 });
            actual.Should().BeInAscendingOrder();
        }
Beispiel #6
0
        public void Returns_Copy_Of_Input_Array()
        {
            var sorter = new MergeSorter();

            var input = new int[] { 1, 5 };

            int[] actual = sorter.Sort(input);

            actual.Should().NotBeNull();
            Assert.NotSame(input, actual);
        }