Add value-band parsing tests for MacroParser#43
Open
anagnorisis2peripeteia wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A follow-up to #37.
MacroParser.ParseStepmaps an int to a macro step across four value bands — key/button, wait, rumble, lightbar — but the existingMacroParserTestsonly 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, assertingActType/OutputTypeand the exact output name for each step (e.g.Wait 500 ms,Reset Lightbar,Lightbar Color: 100,200,50, and anA Buttonpress→release pair to exercise the keydown tracking).CheckKeyButtonBoundary— 255 →Key, 256 →Button(thevalue <= 255split).CheckWaitBoundary— 300 →Wait 0 ms(the exact wait threshold).CheckLoadMacroIsIdempotent— a secondLoadMacro()is a no-op.CheckGetMacroStringsMatchesSteps—GetMacroStrings()lines up withMacroSteps.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:CheckBandParsingTypesAndNamesfails (fault caught). Clean branch: suite passes.Manifest + raw run outputs: https://gist.github.com/anagnorisis2peripeteia/0a3f4b5f50141ffc8a670a77f412c55b