Files
h2g2/tests/test_vogon.py
seppedl 679639df9f Wire game transitions end-to-end, add Guide lookup, add 79 tests
Transitions:
- Add I-HOUSEWRECK (tick 20) and I-VOGONS (tick 50) timed events to
  earth.py, queued at startup in main.py
- I-VOGONS demolishes Earth and moves player to Vogon Hold
- Fix airlock→Dark transition to call Dark room M-ENTER handler
- Fix dream-restore to support multiple callbacks (list instead of single)
- Add state.finish() call to RAMP for endgame victory

Guide system:
- Add 16-entry lookup database to GUIDE object (space, towel, vogons,
  poetry, beast, babel fish, earth, magrathea, marvin, etc.)
- "consult guide about X" now returns relevant entry text

Tests (79 passing):
- test_engine.py (14): containment, flags, articles, clock mechanics
- test_parser.py (20): directions, compound verbs, prepositions, synonyms
- test_earth.py (21): full opening sequence, puzzles, navigation
- test_vogon.py (4): room existence, Hold first-visit sequence
- test_dark.py (7): inventory clearing, dream dispatch, probabilities
- conftest.py: shared game fixture and send() helper

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 22:04:22 +02:00

45 lines
1.3 KiB
Python

"""Tests for the Vogon ship section."""
from tests.conftest import send
def test_hold_exists(game):
"""Verify the Hold room was registered."""
state, _, _ = game
hold = state.world.get_room("HOLD")
assert hold is not None
assert hold.id == "HOLD"
def test_hold_first_visit(game):
"""Test that the Hold's first-visit M-END sequence gives peanuts and score."""
state, _, loop = game
hold = state.world.get_room("HOLD")
state.here = hold
state.protagonist.move_to(hold)
state.lying_down = False
# The first-visit logic is in M-END, not M-ENTER
if hold.action:
hold.action(state, "M-END")
text = state.output.flush()
# Should mention waking up and give peanuts
assert len(text) > 0
assert state.score >= 8
peanuts = state.world.get("PEANUTS")
assert peanuts.parent is state.protagonist
def test_airlock_room_exists(game):
"""Verify the Airlock room was registered."""
state, _, _ = game
airlock = state.world.get_room("AIRLOCK")
assert airlock is not None
assert airlock.id == "AIRLOCK"
def test_captains_quarters_exists(game):
"""Verify the Captain's Quarters room was registered."""
state, _, _ = game
quarters = state.world.get_room("CAPTAINS-QUARTERS")
assert quarters is not None