示例#1
0
        public void StringsWithSpacesQuickSortTest()
        {
            // Arrange parameters
            string[] unsortedAlphabetArray = { "aaaa bbbb", "bbbb aaaa", "aaaa aaaa", "bbbb bbbb" };
            string[] sortedAlphabetArray   = { "aaaa aaaa", "aaaa bbbb", "bbbb aaaa", "bbbb bbbb" };

            // QuickSort
            NameSorter.QuickSort(unsortedAlphabetArray, 0, unsortedAlphabetArray.Length - 1);

            // Assert
            CollectionAssert.AreEqual(unsortedAlphabetArray, sortedAlphabetArray);
        }
示例#2
0
        public void AlphanumericCharactersQuickSortTest()
        {
            // Arrange parameters
            string[] unsortedAlphabetArray = { "a1c3", "1337", "33d3", "9cd3" };
            string[] sortedAlphabetArray   = { "1337", "33d3", "9cd3", "a1c3" };

            // QuickSort
            NameSorter.QuickSort(unsortedAlphabetArray, 0, unsortedAlphabetArray.Length - 1);

            // Assert
            CollectionAssert.AreEqual(unsortedAlphabetArray, sortedAlphabetArray);
        }
示例#3
0
        public void DuplicateCaseAlphabetCharacterQuickSortTest()
        {
            // Arrange parameters
            string[] unsortedAlphabetArray = { "aaaa", "bbbb", "bbbb", "aaaa" };
            string[] sortedAlphabetArray   = { "aaaa", "aaaa", "bbbb", "bbbb" };

            // QuickSort
            NameSorter.QuickSort(unsortedAlphabetArray, 0, unsortedAlphabetArray.Length - 1);

            // Assert
            CollectionAssert.AreEqual(unsortedAlphabetArray, sortedAlphabetArray);
        }
示例#4
0
        public void NumericCharacterQuickSortTest()
        {
            // Arrange parameters
            string[] unsortedAlphabetArray = { "3333", "1111", "2222", "0000" };
            string[] sortedAlphabetArray   = { "0000", "1111", "2222", "3333" };

            // QuickSort
            NameSorter.QuickSort(unsortedAlphabetArray, 0, unsortedAlphabetArray.Length - 1);

            // Assert
            CollectionAssert.AreEqual(unsortedAlphabetArray, sortedAlphabetArray);
        }
示例#5
0
        public void IncorrectlySortedQuickSortTest()
        {
            // Arrange parameters
            string[] unsortedAlphabetArray          = { "dddd", "cccc", "bbbb", "aaaa" };
            string[] incorrectlySortedAlphabetArray = { "aaaa", "bbbb", "dddd", "cccc" };

            // QuickSort
            NameSorter.QuickSort(unsortedAlphabetArray, 0, unsortedAlphabetArray.Length - 1);

            // Assert
            CollectionAssert.AreNotEqual(unsortedAlphabetArray, incorrectlySortedAlphabetArray);
        }