コード例 #1
0
        public void SearchMatrixTest_NotExist_GreaterThanLast()
        {
            var input = new int[, ]
            {
                { 1, 3, 5, 7 },
                { 10, 11, 16, 20 },
                { 23, 30, 34, 50 }
            };

            var solution = new _074_SearchA2DMatrix();
            var result   = solution.SearchMatrix(input, 51);

            Assert.IsFalse(result);
        }
コード例 #2
0
        public void SearchMatrixTest_Exist_FirstRow()
        {
            var input = new int[, ]
            {
                { 1, 3, 5, 7 },
                { 10, 11, 16, 20 },
                { 23, 30, 34, 50 }
            };

            var solution = new _074_SearchA2DMatrix();
            var result   = solution.SearchMatrix(input, 3);

            Assert.IsTrue(result);
        }
コード例 #3
0
        public void SearchMatrixTest_NotExist_LessThanFirst()
        {
            var input = new int[][]
            {
                new int[] { 1, 3, 5, 7 },
                new int[] { 10, 11, 16, 20 },
                new int[] { 23, 30, 34, 50 }
            };

            var solution = new _074_SearchA2DMatrix();
            var result   = solution.SearchMatrix(input, 0);

            Assert.IsFalse(result);
        }
コード例 #4
0
        public void SearchMatrixTest_Exist_FirstColumn()
        {
            var input = new int[][]
            {
                new int[] { 1, 3, 5, 7 },
                new int[] { 10, 11, 16, 20 },
                new int[] { 23, 30, 34, 50 }
            };

            var solution = new _074_SearchA2DMatrix();
            var result   = solution.SearchMatrix(input, 10);

            Assert.IsTrue(result);
        }
コード例 #5
0
        public void SearchMatrixTest_NotExist_GreaterThanFirstRow()
        {
            var input = new int[,]
            {
                {  1,  3,  5,  7 },
                { 10, 11, 16, 20 },
                { 23, 30, 34, 50 }
            };

            var solution = new _074_SearchA2DMatrix();
            var result = solution.SearchMatrix(input, 8);

            Assert.IsFalse(result);
        }
コード例 #6
0
        public void SearchMatrixTest_Exist_MidRow()
        {
            var input = new int[,]
            {
                {  1,  3,  5,  7 },
                { 10, 11, 16, 20 },
                { 23, 30, 34, 50 }
            };

            var solution = new _074_SearchA2DMatrix();
            var result = solution.SearchMatrix(input, 11);

            Assert.IsTrue(result);
        }