Expand description
rtce-testkit — golden-fixture harness for rtce and its consumer
games.
This crate carries no test logic of its own; it’s the small set of
house rules every rtce-based game’s test suite is expected to share,
inherited from diablo4-calc’s M1 milestone:
- Golden fixtures live in JSON files, one case per file.
for_each_fixturewalks a directory, parses each*.jsonas aserde_json::Value, and hands it to your callback in sorted-by-name order (deterministic test output, deterministic diffs). - An empty suite is a bug, not a pass. If the fixture directory is
missing or yields zero
*.jsonfiles,for_each_fixturepanics instead of silently iterating zero times — a typo’d path or an accidentally-emptied directory must fail loudly, never look like “all fixtures passed.” - Every fixture is provenance-tagged. Each JSON file must carry a
nameand asourcekey (where the expected number came from — a hand-worked calculation, an in-game screenshot, another calculator) so a reviewer can trace any pinned number back to its origin. - Comparisons are relative-tolerance, not exact-float.
assert_closecomparesactualagainstexpectedwithin a relative tolerance, because floating-point pipelines rarely reproduce bit-for-bit across platforms/optimization levels.
Depend on this crate as a dev-dependency; use for_each_fixture to
drive your golden-fixture tests and assert_close to check each
result.
Functions§
- assert_
close - Relative-tolerance assertion with a context message.
- for_
each_ fixture - Invoke
f(name, json)for every*.jsonfixture indir, sorted by file name. PANICS if the directory holds no fixtures (or is missing) — the empty-glob rule.