test_ripple.py 483 Bytes
import os

import pytest
from genres.ripple.ripple import solve_ripple
from genres.ripple.ripple_util import load_puzzle_and_solution

DATA_DIR = "tests/ripple/data"
PUZZLES = [f"ripple_{i}.txt" for i in range(5)]


@pytest.mark.parametrize("filename", PUZZLES)
@pytest.mark.timeout(10)
def test_ripple(filename: str):
    puzzle, solution = load_puzzle_and_solution(os.path.join(DATA_DIR, filename))
    actual_solution = solve_ripple(puzzle)
    assert actual_solution == solution