Skip to content

Commit d025bad

Browse files
author
Harry Coureau
committed
test: separate Q10 obstacle and historical trace assertions
1 parent 0e43387 commit d025bad

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

‎tests/map/test_b01_q10_map_parser.py‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -590,19 +590,27 @@ def test_clean_record_parser_rejects_other_packet_kinds(marker: bytes) -> None:
590590

591591

592592
@pytest.mark.parametrize("marker", [b"\x01\x01", b"\x03\x01", b"\x04\x01"])
593-
def test_obstacle_tables_preserve_signed_coordinates_and_following_trace(marker: bytes) -> None:
594-
"""Complete counted tables retain their own coordinates and path boundary."""
593+
def test_obstacle_tables_preserve_signed_coordinates(marker: bytes) -> None:
594+
"""Complete counted tables retain signed coordinates for every map kind."""
595595
payload = _map_detail_payload(marker, [(10, -20)])
596596
offset = len(FIXTURE.read_bytes()) + len(_carpet_tail(8, 6, bytes(48)))
597597
tables = b"\x02" + struct.pack(">hhhh", 250, -300, -32768, 32767) + b"\x01" + struct.pack(">hh", -40, 50)
598598
payload = payload[:offset] + tables + payload[offset + 2 :]
599599
packet = parse_map_packet(payload)
600600
assert packet.obstacles == [Q10Obstacle(250, -300), Q10Obstacle(-32768, 32767)]
601601
assert packet.skip_cleaning_points == [Q10Point(-40, 50)]
602-
if marker == b"\x03\x01":
603-
detail = parse_clean_record_detail(payload)
604-
assert detail.trace is not None
605-
assert detail.trace.points == [Q10Point(10, -20)]
602+
603+
604+
def test_nonempty_obstacle_tables_preserve_historical_trace_boundary() -> None:
605+
"""Historical points start after the complete obstacle and skip tables."""
606+
payload = _map_detail_payload(b"\x03\x01", [(10, -20)])
607+
offset = len(FIXTURE.read_bytes()) + len(_carpet_tail(8, 6, bytes(48)))
608+
tables = b"\x01" + struct.pack(">hh", 250, -300) + b"\x01" + struct.pack(">hh", -40, 50)
609+
detail = parse_clean_record_detail(payload[:offset] + tables + payload[offset + 2 :])
610+
assert detail.map.obstacles == [Q10Obstacle(250, -300)]
611+
assert detail.map.skip_cleaning_points == [Q10Point(-40, 50)]
612+
assert detail.trace is not None
613+
assert detail.trace.points == [Q10Point(10, -20)]
606614

607615

608616
@pytest.mark.parametrize("table", [b"", b"\x02\x00\x01\x00\x02", b"\x00", b"\x00\x02\x00\x01\x00\x02"])

0 commit comments

Comments
 (0)