Beispiel #1
0
        public void TestSpiralMatrix()
        {
            int[,] input =
            {
                { 1, 2, 3 },
                { 4, 5, 6 },
                { 7, 8, 9 }
            };

            var list = SpiralMatrix.SpiralOrder(input);

            string exp = "123698745";

            for (int i = 0; i < exp.Length; i++)
            {
                Assert.IsTrue(list[i] == int.Parse(exp[i].ToString()));
            }
        }
Beispiel #2
0
        public void TestSpiralMatrix3()
        {
            int[,] input =
            {
                { 2, 3 },
            };

            var list = SpiralMatrix.SpiralOrder(input);

            string exp = "23";

            for (int i = 0; i < exp.Length; i++)
            {
                Assert.IsTrue(list[i] == int.Parse(exp[i].ToString()));
            }

            Assert.IsTrue(list.Count == exp.Length);
        }