Skip to content

Add value-band parsing tests for MacroParser#43

Open
anagnorisis2peripeteia wants to merge 1 commit into
hbashton:mainfrom
anagnorisis2peripeteia:tests/macroparser-coverage
Open

Add value-band parsing tests for MacroParser#43
anagnorisis2peripeteia wants to merge 1 commit into
hbashton:mainfrom
anagnorisis2peripeteia:tests/macroparser-coverage

Conversation

@anagnorisis2peripeteia

@anagnorisis2peripeteia anagnorisis2peripeteia commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

A follow-up to #37. MacroParser.ParseStep maps an int to a macro step across four value bands — key/button, wait, rumble, lightbar — but the existing MacroParserTests only assert step types on one fixed macro. The generated step names and the band boundaries aren't checked, so the string formatting and threshold arithmetic go unasserted.

This adds five tests:

  • CheckBandParsingTypesAndNames — one macro that hits every band, asserting ActType/OutputType and the exact output name for each step (e.g. Wait 500 ms, Reset Lightbar, Lightbar Color: 100,200,50, and an A Button press→release pair to exercise the keydown tracking).
  • CheckKeyButtonBoundary — 255 → Key, 256 → Button (the value <= 255 split).
  • CheckWaitBoundary — 300 → Wait 0 ms (the exact wait threshold).
  • CheckLoadMacroIsIdempotent — a second LoadMacro() is a no-op.
  • CheckGetMacroStringsMatchesStepsGetMacroStrings() lines up with MacroSteps.

Test-only; no behaviour change.


Local review history: https://gist.github.com/38216573a8983d1689a92a8e209e92e6

Proof manifest

Fault-injection proof (test-only PR): off-by-one'd the wait-band arithmetic (value - 300 -> value - 299) identically on base and this branch. Base + fault: suite passes (fault missed). This branch + fault: CheckBandParsingTypesAndNames fails (fault caught). Clean branch: suite passes.

Manifest + raw run outputs: https://gist.github.com/anagnorisis2peripeteia/0a3f4b5f50141ffc8a670a77f412c55b

Cover each ParseStep output band (wait, key/button press-release, rumble,
lightbar) with ActType/OutputType and output-name assertions, plus the
key/button (255/256) and wait (300) threshold boundaries, LoadMacro
idempotence, and GetMacroStrings alignment with MacroSteps.

Motivated by mutation testing (issue hbashton#37): MacroParser.cs scored 21%
with the name-formatting and band-boundary logic largely unasserted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant