Game tests: every known build's hash is one identify() can match #303
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/303"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by SkippySteve on 2026-11-24T02:11:08Z.
KNOWN_BUILDSis matched against the hex BLAKE3 thatrun.rscomputes for the executable. An entry with a typo, a truncated hash, stray whitespace or a duplicate would compile fine and simply never identify the build it names.victory-game/src/lib.rshas no tests today.This adds a test module (tests only, no behaviour change):
known_builds_are_well_formed: each entry has a label, its hash is 64 lowercase hex digits (the formblake3::Hash::to_hexwrites), and no label or hash appears twice.every_known_build_is_identified_by_its_hash:identify()finds each build by its own hash, in lower or upper case.unknown_hashes_are_not_identified: the BLAKE3 of empty input, an empty string and non-hex text identify nothing.The list is empty on
main, so the first two guard future entries. To check they bite, I temporarily added an entry with an uppercase hash;known_builds_are_well_formedfailed as expected.No game files or new dependencies; it runs on every host.
Tested on Linux:
cargo test -p victory-game: 5 passedcargo clippy -p victory-game --all-targets -- -D warnings: cleancargo fmt -p victory-game -- --check: cleanImported from Marvisak/VIctory. Originally posted by SkippySteve on 2026-11-24T02:32:35Z.
Superseded by #273, which now carries this commit (KNOWN_BUILDS tests) alongside the other victory-game fix.
Pull request closed