Beispiel #1
0
        public void NullComparatorNegativeTest()
        {
            JaggedArraySortingClass.MyComparator comp = null;

            Assert.Throws <ArgumentNullException>(() => JaggedArraySortingClass.BubbleSortWithComparator(actualArray1, comp, ascending: true));
            Assert.Throws <ArgumentNullException>(() => JaggedArraySortingClass.BubbleSortWithComparator(actualArray1, comp, ascending: false));
        }
Beispiel #2
0
        public void NullParameterNegativeTest()
        {
            JaggedArraySortingClass.MyComparator comp = new MinRowValueComparator().Compare;

            Assert.Throws <ArgumentNullException>(() => JaggedArraySortingClass.BubbleSortWithComparator(null, comp, ascending: true));
            Assert.Throws <ArgumentNullException>(() => JaggedArraySortingClass.BubbleSortWithComparator(null, comp, ascending: false));
        }
Beispiel #3
0
        public void EmptyArrayNegativeTest()
        {
            JaggedArraySortingClass.MyComparator comp = new MinRowValueComparator().Compare;

            Assert.Throws <ArgumentException>(() => JaggedArraySortingClass.BubbleSortWithComparator(new int[][] { }, comp, ascending: true));
            Assert.Throws <ArgumentException>(() => JaggedArraySortingClass.BubbleSortWithComparator(new int[][] { }, comp, ascending: false));
        }
Beispiel #4
0
        public void RowSumAscendingSort()
        {
            JaggedArraySortingClass.MyComparator comp = new RowSumComparator().Compare;

            JaggedArraySortingClass.BubbleSortWithComparator(actualArray1, comp, true);
            Assert.AreEqual(expectedArray1, actualArray1);

            JaggedArraySortingClass.BubbleSortWithComparator(actualArray2, comp, true);
            Assert.AreEqual(expectedArrayForSumAscendingSort, actualArray2);
        }
Beispiel #5
0
        public void RowMaxValueDescendingSort()
        {
            JaggedArraySortingClass.MyComparator comp = new MaxRowValueComparator().Compare;

            JaggedArraySortingClass.BubbleSortWithComparator(actualArray1, comp, false);
            Assert.AreEqual(expectedArray1, actualArray1);

            JaggedArraySortingClass.BubbleSortWithComparator(actualArray2, comp, false);
            Assert.AreEqual(expectedArrayForMaxValueDescendingSort, actualArray2);
        }