AgentnessBench / tests /grid /test_game_import.py
irregular6612's picture
test(grid): action-map consistency invariant accounts for no-move interact action
9a694f8
Raw
History Blame Contribute Delete
782 Bytes
def test_game_module_imports_and_action_maps_are_consistent():
from proteus.game.engine.grid import (
MotiveGridGame,
_DIRECTION_DELTAS,
_ACTION_TO_GAMEACTION,
_GAMEACTION_TO_ACTION,
)
# Every *movement* action has a delta and a GameAction, and the reverse map
# is exact. "interact" is the lone no-move action: it has a delta (0, 0) but
# no dedicated GameAction (it reuses stay's ACTION5 in apply_motive_action),
# so it is intentionally absent from _ACTION_TO_GAMEACTION.
assert set(_DIRECTION_DELTAS) - {"interact"} == set(_ACTION_TO_GAMEACTION)
assert "interact" in _DIRECTION_DELTAS and "interact" not in _ACTION_TO_GAMEACTION
assert _GAMEACTION_TO_ACTION == {v: k for k, v in _ACTION_TO_GAMEACTION.items()}