Esempio n. 1
0
        public void MixedValueTest()
        {
            var r = new List <int[]>()
            {
                new int[] { -18, 6 },
                new int[] { -18, 7 },
                new int[] { -18, 8 },
                new int[] { -17, 6 },
                new int[] { -17, 8 },
                new int[] { -16, 6 },
                new int[] { -16, 7 },
                new int[] { -16, 8 },
            };
            var list = Challenge.cartesianNeighbor(-17, 7);

            Assert.AreEqual(r, Inspection.sortedList(list), "Wrong Answer with input x=-17, y=7");
        }
Esempio n. 2
0
        public void ZeroValueTest()
        {
            var r = new List <int[]>()
            {
                new int[] { -1, -1 },
                new int[] { -1, 0 },
                new int[] { -1, 1 },
                new int[] { 0, -1 },
                new int[] { 0, 1 },
                new int[] { 1, -1 },
                new int[] { 1, 0 },
                new int[] { 1, 1 },
            };
            var list = Challenge.cartesianNeighbor(0, 0);

            Assert.AreEqual(r, Inspection.sortedList(list), "Wrong Answer with input x=0, y=0");
        }
Esempio n. 3
0
        public void NegativeValueTest()
        {
            var r = new List <int[]>()
            {
                new int[] { -6, -6 },
                new int[] { -6, -5 },
                new int[] { -6, -4 },
                new int[] { -5, -6 },
                new int[] { -5, -4 },
                new int[] { -4, -6 },
                new int[] { -4, -5 },
                new int[] { -4, -4 },
            };
            var list = Challenge.cartesianNeighbor(-5, -5);

            Assert.AreEqual(r, Inspection.sortedList(list), "Wrong Answer with input x=-5, y=-5");
        }
Esempio n. 4
0
        public void ExampleTests()
        {
            var r = new List <int[]>()
            {
                new int[] { 1, 1 },
                new int[] { 1, 2 },
                new int[] { 1, 3 },
                new int[] { 2, 1 },
                new int[] { 2, 3 },
                new int[] { 3, 1 },
                new int[] { 3, 2 },
                new int[] { 3, 3 },
            };
            var list = Challenge.cartesianNeighbor(2, 2);

            Assert.AreEqual(r, Inspection.sortedList(list));
        }
Esempio n. 5
0
        public void RandomValueTest([Random(-100000, 100000, 10)] int x, [Random(-100000, 100000, 10)] int y)
        {
            var list = Challenge.cartesianNeighbor(x, y);

            Assert.AreEqual(Inspection.solution(x, y), Inspection.sortedList(list));
        }