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.
This commit is contained in:
Dash committed 2026-10-17 19:53:51 +02:00
1 parent c169102c32
commit d1d7c2d9df
2 files changed
+8 -10

No files matched your search

+2 -4
View File
@@ -130,7 +130,7 @@ def test_export_of_unplayed_character() -> None:
assert player.task is None # exported a copy 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: def test_round_trip_keeps_playing_identically(ticks: int) -> None:
original = played(ticks) original = played(ticks)
copy, _warnings = import_game( 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) assert bridge.snapshot(copy) == bridge.snapshot(original.player)
resumed = Simulation(copy, DATA) resumed = Simulation(copy, DATA)
assert bridge.run(resumed, 10**8, 2000) == bridge.run( assert bridge.run(resumed, 10**8, 500) == bridge.run(original, 10**8, 500)
original, 10**8, 2000
)
def test_files_round_trip(tmp_path: Path) -> None: def test_files_round_trip(tmp_path: Path) -> None:
+6 -6
View File
@@ -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 # Play both from the same character and generator state, 100 ms per
# tick, and compare the whole state, generator included, each time a # tick, and compare the whole state, generator included, each time a
# task completes. # task completes.
tasks = 10000 tasks = 3000
ticks = 100 * tasks * 1000 ticks = 100 * tasks * 1000
spec = bridge.make_spec(seed, race, class_) spec = bridge.make_spec(seed, race, class_)
(theirs,) = bridge.run_harness( (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 # (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) @pytest.mark.parametrize("tasks,ticks", SAVE_POINTS)
@@ -176,12 +176,12 @@ def test_import_from_upstream_plays_on_identically(
(text, theirs) = bridge.run_harness( (text, theirs) = bridge.run_harness(
[ [
{"cmd": "encode", "game": game}, {"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) player, warnings = import_game(decode(text), DATA)
assert warnings == [] 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) assert_same_games(ours, theirs)
@@ -195,7 +195,7 @@ def test_export_to_upstream_plays_on_identically(
text = encode(export_game(simulation.player, DATA)) text = encode(export_game(simulation.player, DATA))
(game,) = bridge.run_harness([{"cmd": "decode", "text": text}]) (game,) = bridge.run_harness([{"cmd": "decode", "text": text}])
(theirs,) = bridge.run_harness( (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) assert_same_games(ours, theirs)