"""Rung 1: SingleStepTests 65816, every file, a sample in the quick loop and all of it under -m slow. The readings applied (SH = $01, XH = YH = 0, the C1 and C2 masks, the C4 exclusion, WAI/STP's stopped-clock row) are tests/single_step.py's. """ import pytest from single_step import CORPUS, FETCH_HINT, corpus_present, excluded, load_cases, run_case pytestmark = pytest.mark.skipif(not corpus_present(), reason=FETCH_HINT) FILES = sorted(path.stem for path in CORPUS.glob("*.json")) if corpus_present() else [] SAMPLE = 100 def run_file(name: str, limit: int | None) -> None: opcode = int(name[:2], 16) failures = [] for case in load_cases(name)[:limit]: if excluded(opcode, case): continue problems = run_case(case) if problems: failures.append(f"{case['name']}: {problems[:4]}") assert not failures, f"{len(failures)} failing, first: {failures[:3]}" @pytest.mark.parametrize("name", FILES) def test_file_sample(name: str) -> None: run_file(name, SAMPLE) @pytest.mark.slow @pytest.mark.parametrize("name", FILES) def test_file_whole(name: str) -> None: run_file(name, None)