lumbda/wasm/tests
russell@unturf.com 7ea65dba21
parity probe: cross-tier corpus + fix python remainder + asm modulo
New: wasm/tests/parity-cross-tier.mjs runs the parity-corpus.mjs (216
test cases tagged by whitepaper section / R7RS concept) against three
tiers — native python (reference), c-wasm, asm-wasm — and fails on any
unknown divergence. Known gaps live in KNOWN_DIVERGE so the table stays
green while the bignum / call/cc / etc. work proceeds.

Wired into `make wasm-test` so a regression against any spec claim gets
caught before merge.

Bugs caught and fixed:
  - python remainder: was `signed_a % signed_b * sign(a)`, which double-
    applied the sign of a (python's % floors) — gave -3 for (-17, 5)
    instead of the R7RS-correct -2. Now uses abs() on both sides.
  - asm-wasm modulo: was i32.rem_s (truncated, remainder semantics)
    where R7RS modulo wants sign of divisor. Added the "if rem and
    divisor disagree on sign, add divisor" branch.

Cross-tier numbers after fix:
  216 passing
    3 known diverge: expt-2-100, expt-3-50, big-arith — all asm-wasm
      (no bignums on the asm tier yet; whitepaper §2.1 claim still open)
    0 fail

REPL layout: body is now the scroll container, prompt-bar is
position:fixed at the viewport bottom so it doesn't get pushed off
screen by a long transcript. Empty space above the prompt on a fresh
session reads like a terminal.

All other tests still pass: 20 unit, 8 integration, 11 functional.
2026-06-14 15:21:19 -04:00
..
functional-cross.mjs playground+repl: bend dispatch from WASM + 1.33 zoom + free-form runner 2026-06-14 13:05:06 -04:00
functional.mjs wat tier: rationals — (/ 67 7) → 67/7 + arithmetic + reader + printer 2026-06-14 15:11:36 -04:00
integration.mjs playground+repl: bend dispatch from WASM + 1.33 zoom + free-form runner 2026-06-14 13:05:06 -04:00
parity-corpus.mjs parity probe: cross-tier corpus + fix python remainder + asm modulo 2026-06-14 15:21:19 -04:00
parity-cross-tier.mjs parity probe: cross-tier corpus + fix python remainder + asm modulo 2026-06-14 15:21:19 -04:00
unit.mjs playground+repl: bend dispatch from WASM + 1.33 zoom + free-form runner 2026-06-14 13:05:06 -04:00