Files
JIANT/tests/fx_rest_test.py
Claude a91b8dc8bd Copyright headers: name Juan Jiant on JIANT's own files that had only the SPDX line
Comment-only (the built image is byte-identical). 112 files written new for JIANT FM (GEN gen.c / gen_tables.c /
gen_track.c / song_dice.c, fugue.c, sing_ext.c, ui_euclid.c, ui_scene.c, the STEMS and probe Android apps, the video
tools, JIANT's tests and tools, web/emu/stems.js) carried "SPDX-License-Identifier: GPL-3.0-only" and no copyright
line: they now say "Copyright (C) 2026 Juan Ignacio Antonucci (Juan Jiant)". Checked against Felucca's fork base
like the previous commit; tests/fm6_env_compare.c (msfa envelope as ported in fm6_core.c) and web/emu/gen_bench.mjs
(lines of the emulator's test) are left out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KMHk6yH4XbP1xxHYKCo9Mh
2026-11-11 18:08:16 +00:00

23 lines
1.3 KiB
Python

#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-3.0-only
# Copyright (C) 2026 Juan Ignacio Antonucci (Juan Jiant)
# (cpu5) tests/fx_rest_test.c both ways: BIN_REST (fx.c as built) against BIN_REF (built with -DFX_REST_OFF): the same
# output until the gate shut (the hash), exact zeros through the rest both ways (the C checks), the rest engaged.
# python3 tests/fx_rest_test.py BIN_REST BIN_REF
import re, subprocess, sys
out = {}
for mode, b in (("rest", sys.argv[1]), ("reference", sys.argv[2])):
r = subprocess.run([b, mode], capture_output=True, text=True)
print(r.stdout.strip())
if r.returncode:
raise SystemExit(f"fx-rest: {mode} failed ({r.returncode})")
out[mode] = dict(re.findall(r"(\w+)=(\w+)", r.stdout))
if out["rest"]["gate_shut_at"] != out["reference"]["gate_shut_at"]:
raise SystemExit("fx-rest: the gate shut at different blocks")
if out["rest"]["pre_hash"] != out["reference"]["pre_hash"]:
raise SystemExit("fx-rest: the output differed before the rest")
r, f = int(out["rest"]["wake_peak"]), int(out["reference"]["wake_peak"])
if abs(r - f) > 512:
raise SystemExit(f"fx-rest: the wake's level differs ({r} vs {f})")
print("fx-rest: the same until the gate shuts, exact zeros through the rest both ways, the rest engaged, the wake at level PASS")