Beispiel #1
0
        public void Test_filter_dataMod()
        {
            // Arrange
            int[]   seq          = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
            int     prime        = 7;
            dataMod objLARGE     = new dataMod(prime, seq);
            dataMod objSMALL     = new dataMod(prime, seq);
            dataMod objNullLARGE = new dataMod(prime);
            dataMod objNullSMALL = new dataMod(prime);

            int[] expectedLARGE     = new int[] { 9, 10, 11 };
            int[] expectedSMALL     = new int[] { 0, 1, 2, 3, 4, 5 };
            int[] expectedNullLARGE = new int[] { 7 };
            int[] expectedNullSMALL = new int[] { 7 };
            // Act
            objSMALL.switchMode();
            objNullSMALL.switchMode();
            int[] resultLARGE     = objLARGE.filter();
            int[] resultSMALL     = objSMALL.filter();
            int[] resultNullLARGE = objNullLARGE.filter();
            int[] resultNullSMALL = objNullSMALL.filter();
            // Assert
            CollectionAssert.AreEqual(resultLARGE, expectedLARGE);
            CollectionAssert.AreEqual(resultSMALL, expectedSMALL);
            CollectionAssert.AreEqual(resultNullLARGE, expectedNullLARGE);
            CollectionAssert.AreEqual(resultNullSMALL, expectedNullSMALL);
        }
Beispiel #2
0
        public void Test_dataMod_FilterSmallMode()
        {
            // Arrange
            dataMod d = new dataMod(13);

            int[] testArray = new int[6] {
                8, 24, 30, 31, 6, 11
            };
            int[] assertArray = new int[4] {
                7, 1, 5, 1
            };

            // Act
            d.scramble(testArray); // NOTE: All prime numbers will be replaced with '2' before updating
            int[] dFilter = d.filter();

            // Assert
            CollectionAssert.AreEqual(dFilter, assertArray);
        }