コード例 #1
0
        public void Test1x1()
        {
            int[,] input = new int[1, 1] {
                { 187 }
            };
            var result = C01Q07.RotateMatrix(input, 1);

            int[,] expected = new int[1, 1] {
                { 187 }
            };
            Assert.Equal(expected, result);
        }
コード例 #2
0
        public void Test2x2()
        {
            int[,] input = new int[2, 2] {
                { 1, 2 },
                { 3, 4 }
            };
            var result = C01Q07.RotateMatrix(input, 2);

            int[,] expected = new int[2, 2] {
                { 3, 1 },
                { 4, 2 }
            };

            Assert.Equal(expected, result);
        }
コード例 #3
0
        public void Test3x3()
        {
            int[,] input = new int[3, 3] {
                { 1, 2, 3 },
                { 4, 5, 6 },
                { 7, 8, 9 }
            };
            var result = C01Q07.RotateMatrix(input, 3);

            int[,] expected = new int[3, 3] {
                { 7, 4, 1 },
                { 8, 5, 2 },
                { 9, 6, 3 }
            };
            Assert.Equal(expected, result);
        }
コード例 #4
0
        public void Test4x4()
        {
            int[,] input = new int[4, 4] {
                { 01, 02, 03, 04 },
                { 05, 06, 07, 08 },
                { 09, 10, 11, 12 },
                { 13, 14, 15, 16 }
            };
            var result = C01Q07.RotateMatrix(input, 4);

            int[,] expected = new int[4, 4] {
                { 13, 09, 05, 01 },
                { 14, 10, 06, 02 },
                { 15, 11, 07, 03 },
                { 16, 12, 08, 04 }
            };
            Assert.Equal(expected, result);
        }