Formats: add 7 invariant unit tests for xma/tables.rs #1205

Manually merged
github merged 1 commit from gh-pr/1205/head into gh-pr/1205/base 2026-11-26 04:23:37 +00:00
Owner

@⁠geiyiliyabumo on GitHub · 2026-11-24 16:25 UTC · original
geiyiliyabumo:test/formats-xma-tables → main · +259 −0 · 1 files · 1 commits · merged 2026-11-25 21:50 UTC

Summary

Closes #1075

Full verification details and change notes are documented in #1075 (commit d3867e6, based on main ffe310e).

 crates/victory-formats/src/xma/tables.rs | 259 +++++++++++++++++++++++++++++++
 1 file changed, 259 insertions(+)

Verification (Windows 11 x64 MSVC)

  • rustfmt --edition 2024 --check on edited files: PASS
  • cargo xtask policy: PASS (zero game files/data)
  • cargo clippy --all-targets --locked -- -D warnings (default + --features diagnostics where applicable): PASS
  • Targeted & crate unit/GPU tests: PASS

AI-assisted; synthetic tests only, no game files.

**@⁠geiyiliyabumo** on GitHub · 2026-11-24 16:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/1205) `geiyiliyabumo:test/formats-xma-tables` → `main` · +259 −0 · 1 files · 1 commits · merged 2026-11-25 21:50 UTC ### Summary Closes #1075 Full verification details and change notes are documented in #1075 (commit `d3867e6`, based on `main` `ffe310e`). ```text crates/victory-formats/src/xma/tables.rs | 259 +++++++++++++++++++++++++++++++ 1 file changed, 259 insertions(+) ``` ### Verification (Windows 11 x64 MSVC) - `rustfmt --edition 2024 --check` on edited files: **PASS** - `cargo xtask policy`: **PASS** (zero game files/data) - `cargo clippy --all-targets --locked -- -D warnings` (default + `--features diagnostics` where applicable): **PASS** - Targeted & crate unit/GPU tests: **PASS** *AI-assisted; synthetic tests only, no game files.*
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:23:36 +00:00
github manually merged commit d3867e6899 into gh-pr/1205/base 2026-11-26 04:23:37 +00:00
Author
Owner

@⁠Zipettte on GitHub · 2026-11-24 18:00 UTC · original

Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at d3867e6: cargo test -p victory-formats passes, 30 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

**@⁠Zipettte** on GitHub · 2026-11-24 18:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/1205#issuecomment-7140013672) Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at d3867e6: `cargo test -p victory-formats` passes, 30 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:19 UTC · original

Automated triage for the maintainers.

Merge candidate.

This adds a test module to crates/victory-formats/src/xma/tables.rs and adds #[rustfmt::skip] to the table literals. No table values change. The useful checks:

  • Every Vlc that codes() builds is a complete prefix code: the code lengths tile the 32-bit space exactly. Without this, a mistyped length would leave words that decode to the wrong symbol through Vlc::read's partition_point(..) - 1.
  • The lookup at each code's block boundaries decodes to the right symbol and length.
  • Symbol tables are permutations of their indices, and the run/level tables match them in length.
  • The -60 and -1 biases used in codes() are covered.
  • CRITICAL_FREQ has MAX_BANDS - 1 strictly ascending edges.

The private items the tests use (Bits, Vlc, codes, consumed, FRAME_SAMPLES, MAX_BANDS) all exist in xma.rs. The "canonical" assertion holds by construction in Vlc::new, but the completeness and permutation checks protect the data.

CI: not run on this head. The PR reports cargo test -p victory-formats passing on Windows.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/1205#issuecomment-7149437880) <!-- victory-triage v1 head=d3867e6899df5a4174e8204c468c5b7da2f317af verdict=merge-candidate at=2026-11-25T01:19:53Z --> Automated triage for the maintainers. **Merge candidate.** This adds a test module to `crates/victory-formats/src/xma/tables.rs` and adds `#[rustfmt::skip]` to the table literals. No table values change. The useful checks: - Every `Vlc` that `codes()` builds is a complete prefix code: the code lengths tile the 32-bit space exactly. Without this, a mistyped length would leave words that decode to the wrong symbol through `Vlc::read`'s `partition_point(..) - 1`. - The lookup at each code's block boundaries decodes to the right symbol and length. - Symbol tables are permutations of their indices, and the run/level tables match them in length. - The -60 and -1 biases used in `codes()` are covered. - `CRITICAL_FREQ` has `MAX_BANDS - 1` strictly ascending edges. The private items the tests use (`Bits`, `Vlc`, `codes`, `consumed`, `FRAME_SAMPLES`, `MAX_BANDS`) all exist in `xma.rs`. The "canonical" assertion holds by construction in `Vlc::new`, but the completeness and permutation checks protect the data. CI: not run on this head. The PR reports `cargo test -p victory-formats` passing on Windows. --- _Generated by [Claude Code](https://claude.ai/code)_
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1205
No description provided.