mirror of
https://github.com/rr-/pq-cli.git
synced 2026-11-12 22:40:36 -07:00
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:
2 files changed
+8
-10
No files matched your search
+2
-4
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
Reference in new issue
Block a user