Beispiel #1
0
        public void SquareBlockConstraintFailureFullSquareBlockTest()
        {
            Sudoku sudoku = CreateTestSudoku();

            sudoku.SetValue(3, 3, 1).SetValue(4, 3, 4).SetValue(4, 4, 8).SetValue(4, 5, 9).SetValue(5, 5, 1);  // Two 1's
            SquareBlockConstraint constraint = new SquareBlockConstraint(3);
            bool result = constraint.Evaluate(sudoku, xCoord: 4, yCoord: 3);

            Assert.IsFalse(result);
        }
Beispiel #2
0
        public void SquareBlockConstraintFailTest()
        {
            Sudoku sudoku = CreateTestSudoku();

            sudoku.SetValue(4, 4, 7);  // Duplicate value in SquareBlock 1
            SquareBlockConstraint constraint = new SquareBlockConstraint(3);
            bool result = constraint.Evaluate(sudoku, xCoord: 4, yCoord: 3);

            Assert.IsFalse(result);
        }
Beispiel #3
0
        public void SquareBlockConstraintSuccessFullSquareBlockTest()
        {
            Sudoku sudoku = CreateTestSudoku();

            sudoku.SetValue(3, 3, 1).SetValue(4, 3, 4).SetValue(4, 4, 8).SetValue(4, 5, 9).SetValue(5, 5, 5);
            SquareBlockConstraint constraint = new SquareBlockConstraint(3);
            bool result = constraint.Evaluate(sudoku, xCoord: 4, yCoord: 3);

            Assert.IsTrue(result);
        }
Beispiel #4
0
        public void SquareBlockConstraintSuccessTest()
        {
            Sudoku sudoku = CreateTestSudoku();
            SquareBlockConstraint constraint = new SquareBlockConstraint(3);
            bool result = constraint.Evaluate(sudoku, xCoord: 0, yCoord: 2);

            Assert.IsTrue(result);
            result = constraint.Evaluate(sudoku, xCoord: 4, yCoord: 3);   // Center block
            Assert.IsTrue(result);
        }