Skip to content

Commit abb5d89

Browse files
author
blackhole-agent
committed
test: assert scaling ratio directly with epsilon floor
Addresses review feedback on #4040: the absolute-time fallback (Math.max(t1 * 3.5, 0.5)) could let superlinear behavior pass on fast runners when both timings were below 0.5s. Assert the t2/t1 ratio directly with a tiny epsilon floor to avoid divide-by-zero.
1 parent 3f0a750 commit abb5d89

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

test/unit/inlineTokens-masking.test.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,13 @@ describe('inlineTokens masking scaling', () => {
3434
const t1 = parseSeconds(footnoteShape(2000));
3535
const t2 = parseSeconds(footnoteShape(4000));
3636
// pre-fix this ratio is ~5+ (exponent > 2); linear growth is ~2.
37+
// Assert on the growth ratio directly (epsilon floor avoids divide-by-zero)
38+
// so the check stays sensitive on fast runners instead of falling back to
39+
// an absolute-time bound that can mask superlinear behavior.
40+
const ratio = t2 / Math.max(t1, 1e-4);
3741
assert.ok(
38-
t2 < Math.max(t1 * 3.5, 0.5),
39-
`superlinear growth suspected: ${t1.toFixed(3)}s -> ${t2.toFixed(3)}s`,
42+
ratio < 3.5,
43+
`superlinear growth suspected: ${t1.toFixed(3)}s -> ${t2.toFixed(3)}s (ratio ${ratio.toFixed(2)})`,
4044
);
4145
});
4246

0 commit comments

Comments
 (0)