def test_completeness(self, a, b, c): solutions = set(base_solution_linear(a, b, c)) for x in range(c + 1): for y in range(c - a * x): if a * x + b * y == c: assert ( x, y) in solutions, "Missing solution {!r},{!r}".format( x, y)
def test_error(self, a, b, c): with pytest.raises(ValueError): next(base_solution_linear(a, b, c))
def test_uniqueness(self, a, b, c): solutions = list(base_solution_linear(a, b, c)) assert is_unique_list(solutions), "Duplicate solution found"
def test_correctness(self, a, b, c): for x, y in base_solution_linear(a, b, c): assert x >= 0 assert y >= 0 assert a * x + b * y == c, "Invalid solution {!r},{!r}".format( x, y)