Exemplo n.º 1
0
        public void TestChangeToFirstNonVisitedCell()
        {
            int[,] array = new int[,]
            {
                {1, 0, 3},
                {4, 5, 2},
                {7, 8, 9}
            };

            bool[,] visited = new bool[,]
            {
                {true, false, true},
                {true, true, true},
                {true, true, true}
            };

            SquareMatrix m = new SquareMatrix(3);
            m.Board = array;
            m.VisitedCells = visited;
            m.Pointer.Row = 2;
            m.Pointer.Column = 2;

            if (!m.HasEmptyCellAroundCursor())
            {
                m.SetCursorToFirstNonVisitedCell();
            }

            Assert.AreEqual(0, m.Pointer.Row);
            Assert.AreEqual(1, m.Pointer.Column);
        }
Exemplo n.º 2
0
        public void TestHasEmptyCell()
        {
            int[,] array = new int[,]
            {
                {1, 2, 3},
                {4, 5, 0},
                {7, 8, 9}
            };

            SquareMatrix m = new SquareMatrix(3);
            m.Board = array;

            Assert.AreEqual(false, m.HasEmptyCellAroundCursor());

            m.Pointer.MoveCursor();

            Assert.AreEqual(true, m.HasEmptyCellAroundCursor());
        }