From 87b05b45f463a6b8b542987e05f3732aa533e809 Mon Sep 17 00:00:00 2001 From: kawa Date: Sat, 17 Oct 2026 10:53:27 +0200 Subject: [PATCH] Seed each Day-Care cartridge comparison from its own title [no-card] The six tests drew their cases from one generator shared by the file, so a test's inputs depended on which tests the worker had run before it: Chromium and WebKit, or a full run and a single test, compared different cases, and a failure could not be replayed by running that test alone. Co-Authored-By: Claude Opus 5.5 --- tests/reference-day-care.spec.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/reference-day-care.spec.ts b/tests/reference-day-care.spec.ts index 8ddfa17..8bfd886 100644 --- a/tests/reference-day-care.spec.ts +++ b/tests/reference-day-care.spec.ts @@ -190,8 +190,15 @@ test.describe("Day-Care routines against the cartridge", () => { ...extra, }); - // A small deterministic generator for the cases. - let seed = 0x5eed; + // A small deterministic generator for the cases, seeded by each test from + // its own title (FNV-1a): a test's cases are the same whichever tests ran + // before it in the worker, and in every browser. + let seed = 0; + test.beforeEach(({}, testInfo) => { + seed = 0x811c9dc5; + for (const character of testInfo.title) + seed = Math.imul(seed ^ character.charCodeAt(0), 0x01000193) >>> 0; + }); const next = (limit = 256) => { seed = (Math.imul(seed, 1664525) + 1013904223) >>> 0; return (seed >>> 8) % limit;