One of the problems (of a sorts) I’ve been having with my series on Rust Solvers is that, for each input puzzle, I need a way to save one or more ‘known good’ solutions so that when I change and add new functionality, I can verify that I’ve either not changed the solution or found another valid one.
Integration tests as it were.
So far, I’d been building this into each solution. While this worked perfectly fine, it’s a bit annoying to copy and paste to each binary, and then have to edit each test case with the answers.
An example run
Enter: testit:
# First run, without --db/--save for previous runs
$ testit \
--command "./target/release/golf-peaks" \
--files "data/golf-peaks/**/*.txt" \
--timeout 60
data/golf-peaks/1-1.txt: New success:
1-↗
===
data/golf-peaks/1-10.txt: New success:
1-↘ 3-↙ 2-↘
===
...
data/golf-peaks/9-8.txt: New success:
1/3-↘ 1/2-↖ 1/↗ 2/1-↖ 1/1-↗
===
data/golf-peaks/9-9.txt: New success:
1-↗ 1/↘ 1-↘ 4-↗ 3-↘ 1/1-↗
===
data/golf-peaks/Credits.txt: New success:
4-↖ 5-↗ 3-↗ 6-↘
===
Summary:
Successes: 121 (121 new)
Failures: 0
Timeouts: 0
# Later runs
$ testit \
--command "./target/release/golf-peaks" \
--files "data/golf-peaks/**/*.txt" \
--timeout 60 \
--db testit/golf-peaks.json \
--save
Summary:
Successes: 121 (0 new)
Failures: 0
Timeouts: 0
Pretty cool, I do think. 😄