Skip to content

feat(instrumenter): add FloorDivision mutator (#5642)#6087

Open
baer wants to merge 1 commit into
stryker-mutator:masterfrom
baer:feat/floor-division-mutator
Open

feat(instrumenter): add FloorDivision mutator (#5642)#6087
baer wants to merge 1 commit into
stryker-mutator:masterfrom
baer:feat/floor-division-mutator

Conversation

@baer

@baer baer commented Jul 2, 2026

Copy link
Copy Markdown

Adds a FloorDivision mutator that swaps between modulo and floor division, as requested in #5642.

  • a % bMath.floor(a / b)
  • Math.floor(a / b)a % b
  • Math.trunc(a / b)a % b

The forward direction only emits Math.floor, not Math.trunc — the two differ only for negative operands, so a second forward mutant would be near-redundant. The reverse direction accepts both so existing floor/trunc code gets mutated either way.

Closes #5642

Implements bidirectional mutation between modulo and floor division:
- Forward: `a % b` → `Math.floor(a / b)`
- Reverse: `Math.floor(x / y)` or `Math.trunc(x / y)` → `x % y`

Updates the benchmark-big.ts perf test expected mutant count from 933
to 942, reflecting 9 new mutants introduced by this mutator (+7 from
`%` operators and +2 from `Math.floor(x / y)` calls in that fixture).
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.

Mutate between modulo and floor division

1 participant