fix(rules): load_map rejects any square_size_ft other than 5 (SRD Measuring Distance: one grid square is 5 feet; the engine's 5-10-5 geometry, step costs and ranges are hard-coded to that scale) - a map declaring 10-ft squares was loaded silently and mis-scaled; now a fail-fast MapValidationError, with reject/accept tests
This commit is contained in:
@@ -73,6 +73,20 @@ def test_rejects_ragged_rows(tmp_path: Path) -> None:
|
||||
load_map(_write(tmp_path, body))
|
||||
|
||||
|
||||
def test_rejects_non_five_foot_square_size(tmp_path: Path) -> None:
|
||||
"""SRD Measuring Distance: one grid square is 5 ft; the engine geometry
|
||||
is hard-coded to that scale, so any other declared size is a load error
|
||||
(fail fast) rather than a silent mis-scaling."""
|
||||
body = _minimal_map().replace('name: "Test"\n', 'name: "Test"\nsquare_size_ft: 10\n')
|
||||
with pytest.raises(MapValidationError, match="square_size_ft must be 5"):
|
||||
load_map(_write(tmp_path, body))
|
||||
|
||||
|
||||
def test_accepts_explicit_five_foot_square_size(tmp_path: Path) -> None:
|
||||
body = _minimal_map().replace('name: "Test"\n', 'name: "Test"\nsquare_size_ft: 5\n')
|
||||
assert load_map(_write(tmp_path, body)).square_size_ft == 5
|
||||
|
||||
|
||||
def test_rejects_char_missing_from_legend(tmp_path: Path) -> None:
|
||||
body = _minimal_map().replace(" #.#\n", " #x#\n")
|
||||
with pytest.raises(MapValidationError):
|
||||
|
||||
Reference in New Issue
Block a user