Skip to content

test: cover RNG-consuming cs/cf meta-expression threshold #100#112

Merged
edloidas merged 1 commit into
masterfrom
issue-100
Apr 29, 2026
Merged

test: cover RNG-consuming cs/cf meta-expression threshold #100#112
edloidas merged 1 commit into
masterfrom
issue-100

Conversation

@edloidas
Copy link
Copy Markdown
Owner

Added regression coverage for RNG-consuming cs/cf threshold meta-expressions in evaluator.test.ts. The documented draw order in evalCritThreshold (target pool first, then threshold meta) and the corresponding worked example in .claude/rules/rng.md were untested — only literal-threshold forms (4d20cs>=(17+2)) were covered, so a future refactor reordering nextInt calls inside the crit-threshold path would have passed CI.

  • Added 4d20cs>=(1d2+17) test asserting pool draws [20, 19, 18, 5] before the 1d2 threshold die [2], threshold resolves to 19, and cs>=19 flags the first two dice critical.
  • Added 4d20cs>=(1d4) sanity variant with a distinct RNG sequence to avoid one-off coincidence.
  • Added 4d20cf<=(1d3) mirror test pinning the same draw-order contract for cf.
  • Each test asserts the threshold meta die surfaces in result.rolls[0] tagged meta + dropped, matching the SuccessCount meta-threshold pattern at line 2262.

Closes #100

Drafted with AI assistance

Added `4d20cs>=(1d2+17)`, `4d20cs>=(1d4)`, and `4d20cf<=(1d3)` tests in `evaluator.test.ts`.
Pinned the documented draw order: target pool resolves before threshold meta-expression.
Asserted threshold meta dice surface in `result.rolls` tagged `meta` and `dropped`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@edloidas edloidas self-assigned this Apr 29, 2026
@edloidas edloidas merged commit db25beb into master Apr 29, 2026
10 checks passed
@edloidas edloidas deleted the issue-100 branch April 29, 2026 20:58
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.

test: cover RNG-consuming cs/cf meta-expression threshold

1 participant