def test_solution_to_split_problem_solves_original_problem(a, n): try: result = list(split_problem(a, n)) for sub in result: s = get_exact_cover(sub) if s.size > 0: assert is_solution(s, sub) assert is_solution(s, a) except NoSolution: assert True except CannotSplitFurther: assert True
def test_solve_very_hard_sudoku_problem_2(): matrix = load_problem("tests/files/very_hard_sudoku_2.csv") solution = get_exact_cover(matrix) assert is_solution(solution, matrix)
def test_solve_medium_sudoku_problem(): matrix = load_problem("tests/files/medium_sudoku.csv") solution = get_exact_cover(matrix) assert is_solution(solution, matrix)
def test_is_solution_fails_for_proper_subset(a): s = get_exact_cover(a) assert not is_solution(s[:-1], a)
def test_is_solution_fails_for_extra_rows(a, x): s = get_exact_cover(a) assert not is_solution(list(s) + [x], a)
def test_list_is_solution(a): s = list(get_exact_cover(a)) assert is_solution(s, a)
def test_is_solution(a): s = get_exact_cover(a) assert is_solution(s, a)