test(victory-formats): pin the XMA Pro Huffman/level tables' invariants #615

Open
github-bot wants to merge 1 commit from github-bot/gh-611 into main AGit
Owner

@⁠AnastasisKon on GitHub · 2026-11-28 13:21 UTC · original
AnastasisKon:vibe/xma-tables-tests-1705ac → main · +52 −0 · 1 files · 1 commits · open

Test-only change: crates/victory-formats/src/xma/tables.rs held 16 constant tables (Huffman pairs, code lengths, run/level tables) with no tests.

What the tests pin

  • Every (symbol, code length) table — SCALE, SCALE_RL, COEF1, VEC2, VEC1, plus COEF0_SYMS/COEF0_LENS and VEC4_SYMS/VEC4_LENS zipped the way xma.rs consumes them — is a complete prefix code: walking the entries in code order with the same assignment xma::Vlc::new makes (code += 1 << (32 - len)) keeps every code in 32 bits, ends exactly at 1 << 32, has unique symbols and lengths in 1..=32.
  • CRITICAL_FREQ is strictly increasing.
  • Each run/level table matches its Huffman table's length, and all level values are finite.

Testing

  • cargo test -p victory-formats --lib xma::tables — 3 pass
  • cargo test -p victory-formats -p victory-hle -p victory -p victory-gpu -p xtask (host arm64) — all pass
  • cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings — clean
  • cargo xtask policy — 404 files ok

Checklist

  • One change, one PR
  • Branch vibe/xma-tables-tests-1705ac from upstream/main, pushed to my fork only
  • No game/GDK files, no dumps/logs in the repo
  • No AI attribution in the diff
**@⁠AnastasisKon** on GitHub · 2026-11-28 13:21 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/611) `AnastasisKon:vibe/xma-tables-tests-1705ac` → `main` · +52 −0 · 1 files · 1 commits · open Test-only change: `crates/victory-formats/src/xma/tables.rs` held 16 constant tables (Huffman pairs, code lengths, run/level tables) with no tests. ## What the tests pin - Every (symbol, code length) table — `SCALE`, `SCALE_RL`, `COEF1`, `VEC2`, `VEC1`, plus `COEF0_SYMS`/`COEF0_LENS` and `VEC4_SYMS`/`VEC4_LENS` zipped the way `xma.rs` consumes them — is a **complete prefix code**: walking the entries in code order with the same assignment `xma::Vlc::new` makes (`code += 1 << (32 - len)`) keeps every code in 32 bits, ends exactly at `1 << 32`, has unique symbols and lengths in 1..=32. - `CRITICAL_FREQ` is strictly increasing. - Each run/level table matches its Huffman table's length, and all level values are finite. ## Testing - [x] `cargo test -p victory-formats --lib xma::tables` — 3 pass - [x] `cargo test -p victory-formats -p victory-hle -p victory -p victory-gpu -p xtask` (host arm64) — all pass - [x] `cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings` — clean - [x] `cargo xtask policy` — 404 files ok ## Checklist - [x] One change, one PR - [x] Branch `vibe/xma-tables-tests-1705ac` from `upstream/main`, pushed to my fork only - [x] No game/GDK files, no dumps/logs in the repo - [x] No AI attribution in the diff
tables.rs held 16 constant tables with no tests. New tests assert the
properties xma::Vlc::new relies on: every (symbol, code length) table is
a complete prefix code (codes stay in 32 bits and fill the code space
exactly, symbols unique, lengths 1..=32), CRITICAL_FREQ is strictly
increasing, and each run/level table matches its Huffman table's length
with finite levels.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 13:34:31 +00:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/615/head:github-bot/gh-611'
git switch 'github-bot/gh-611'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-611'
git switch 'github-bot/gh-611'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-611'
git switch 'github-bot/gh-611'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-611'
git switch 'main'
git merge --squash 'github-bot/gh-611'
git switch 'main'
git merge --ff-only 'github-bot/gh-611'
git switch 'main'
git merge 'github-bot/gh-611'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.