예제 #1
0
        public void TestNegative()
        {
            string[] array = new string[6];

            array[0] = "-1 -1 0 -9 -2 -2";
            array[1] = "-2 -1 -6 -8 -2 -5";
            array[2] = "-1 -1 -1 -2 -3 -4";
            array[3] = "-1 -9 -2 -4 -4 -5";
            array[4] = "-7 -3 -3 -2 -9 -9";
            array[5] = "-1 -3 -1 -2 -4 -5";

            Assert.AreEqual(-6, HourGlass.Solution(array));
        }
예제 #2
0
        public void TestOne()
        {
            string[] array = new string[6];

            array[0] = "1 1 1 0 0 0";
            array[1] = "0 1 0 0 0 0";
            array[2] = "1 1 1 0 0 0";
            array[3] = "0 0 2 4 4 0";
            array[4] = "0 0 0 2 0 0";
            array[5] = "0 0 1 2 4 0";

            Assert.AreEqual(19, HourGlass.Solution(array));
        }
예제 #3
0
        public void HourGlassTest1()
        {
            int expected = 19;

            int[][] test = { new int[] { 1, 1, 1, 0, 0, 0 },
                             new int[] { 0, 1, 0, 0, 0, 0 },
                             new int[] { 1, 1, 1, 0, 0, 0 },
                             new int[] { 0, 0, 2, 4, 4, 0 },
                             new int[] { 0, 0, 0, 2, 0, 0 },
                             new int[] { 0, 0, 1, 2, 4, 0 } };

            int actual = HourGlass.hourglassSum(test);

            Assert.Equal(expected, actual);
        }