From d1d7c2d9df0552ec239a334c08a1688372334172 Mon Sep 17 00:00:00 2001 From: Dash Date: Sat, 17 Oct 2026 19:53:51 +0200 Subject: [PATCH] tests: play shorter games when comparing The upstream games ran 10000 tasks and the .pqw comparisons 3000 or 2000 more. Differences so far showed within the first few tasks, so 3000, 1000 and 500 keep the tests sharp at a fraction of the time. Two .pqw save points that tested nothing new are dropped. --- tests/test_pqw.py | 6 ++---- tests/test_upstream.py | 12 ++++++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/tests/test_pqw.py b/tests/test_pqw.py index 06fdf05..e8db909 100644 --- a/tests/test_pqw.py +++ b/tests/test_pqw.py @@ -130,7 +130,7 @@ def test_export_of_unplayed_character() -> None: assert player.task is None # exported a copy -@pytest.mark.parametrize("ticks", [0, 1, 25, 3000, 40000, 123457]) +@pytest.mark.parametrize("ticks", [0, 25, 3000, 123457]) def test_round_trip_keeps_playing_identically(ticks: int) -> None: original = played(ticks) copy, _warnings = import_game( @@ -138,9 +138,7 @@ def test_round_trip_keeps_playing_identically(ticks: int) -> None: ) assert bridge.snapshot(copy) == bridge.snapshot(original.player) resumed = Simulation(copy, DATA) - assert bridge.run(resumed, 10**8, 2000) == bridge.run( - original, 10**8, 2000 - ) + assert bridge.run(resumed, 10**8, 500) == bridge.run(original, 10**8, 500) def test_files_round_trip(tmp_path: Path) -> None: diff --git a/tests/test_upstream.py b/tests/test_upstream.py index a0ccfc0..815f4e4 100644 --- a/tests/test_upstream.py +++ b/tests/test_upstream.py @@ -128,7 +128,7 @@ def test_game_matches_upstream(seed: str, race: str, class_: str) -> None: # Play both from the same character and generator state, 100 ms per # tick, and compare the whole state, generator included, each time a # task completes. - tasks = 10000 + tasks = 3000 ticks = 100 * tasks * 1000 spec = bridge.make_spec(seed, race, class_) (theirs,) = bridge.run_harness( @@ -162,7 +162,7 @@ def assert_same_games( # (tasks, ticks): stop right after a task, or in the middle of one -SAVE_POINTS = [(3000, 10**9), (10**9, 123457), (10**9, 1)] +SAVE_POINTS = [(1000, 10**9), (10**9, 123457), (10**9, 1)] @pytest.mark.parametrize("tasks,ticks", SAVE_POINTS) @@ -176,12 +176,12 @@ def test_import_from_upstream_plays_on_identically( (text, theirs) = bridge.run_harness( [ {"cmd": "encode", "game": game}, - {"cmd": "resume", "game": game, "ticks": 10**9, "tasks": 3000}, + {"cmd": "resume", "game": game, "ticks": 10**9, "tasks": 1000}, ] ) player, warnings = import_game(decode(text), DATA) assert warnings == [] - ours = bridge.run(Simulation(player, DATA), 10**9, 3000) + ours = bridge.run(Simulation(player, DATA), 10**9, 1000) assert_same_games(ours, theirs) @@ -195,7 +195,7 @@ def test_export_to_upstream_plays_on_identically( text = encode(export_game(simulation.player, DATA)) (game,) = bridge.run_harness([{"cmd": "decode", "text": text}]) (theirs,) = bridge.run_harness( - [{"cmd": "resume", "game": game, "ticks": 10**9, "tasks": 3000}] + [{"cmd": "resume", "game": game, "ticks": 10**9, "tasks": 1000}] ) - ours = bridge.run(simulation, 10**9, 3000) + ours = bridge.run(simulation, 10**9, 1000) assert_same_games(ours, theirs)