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); }
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); }
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); }
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); }