diff --git a/tests/fixtures/minimate-bench-10-26-26-blastware/README.md b/tests/fixtures/minimate-bench-10-26-26-blastware/README.md index 54f2487..a951a4f 100644 --- a/tests/fixtures/minimate-bench-10-26-26-blastware/README.md +++ b/tests/fixtures/minimate-bench-10-26-26-blastware/README.md @@ -28,3 +28,15 @@ and every 02 / 03 / 04 / 10 byte DLE-escaped (748/748 re-encode byte-identically address; a walk is start, start+0x200, ... carrying into the page byte, then TERM at the next boundary for exactly the remainder. The first event's "metadata pages at 0x1002/0x1004" are its chunks at 0x0200 and 0x0400, escaped (`10 02 00`, `10 04 00`). + +## `blastware/`: the files Blastware wrote in that session (Brian) + +| file | event | crosses a page | +|---|---|---| +| `K441LTOF.ZI0` | 0 (`01110000`) | no | +| `K441LTOF.ZQ0` | 1 (`01118a2c`) | yes, into 0x12 | +| `K441LTOG.000` | 3 (`0112a0b6`) | yes, into 0x13 | +| `K441LTOG.0S0` | 7 (`0114b0b2`) | yes, into 0x15 | + +After the fix (887e75d), SFM's own live downloads of all 8 events were byte-identical to +Blastware's files (sha256), the 4 crossings included. diff --git a/tests/fixtures/minimate-bench-10-26-26-blastware/blastware/K441LTOF.ZI0 b/tests/fixtures/minimate-bench-10-26-26-blastware/blastware/K441LTOF.ZI0 new file mode 100644 index 0000000..8630f0f Binary files /dev/null and b/tests/fixtures/minimate-bench-10-26-26-blastware/blastware/K441LTOF.ZI0 differ diff --git a/tests/fixtures/minimate-bench-10-26-26-blastware/blastware/K441LTOF.ZQ0 b/tests/fixtures/minimate-bench-10-26-26-blastware/blastware/K441LTOF.ZQ0 new file mode 100644 index 0000000..ea8f8a5 Binary files /dev/null and b/tests/fixtures/minimate-bench-10-26-26-blastware/blastware/K441LTOF.ZQ0 differ diff --git a/tests/fixtures/minimate-bench-10-26-26-blastware/blastware/K441LTOG.000 b/tests/fixtures/minimate-bench-10-26-26-blastware/blastware/K441LTOG.000 new file mode 100644 index 0000000..25907f6 Binary files /dev/null and b/tests/fixtures/minimate-bench-10-26-26-blastware/blastware/K441LTOG.000 differ diff --git a/tests/fixtures/minimate-bench-10-26-26-blastware/blastware/K441LTOG.0S0 b/tests/fixtures/minimate-bench-10-26-26-blastware/blastware/K441LTOG.0S0 new file mode 100644 index 0000000..95816be Binary files /dev/null and b/tests/fixtures/minimate-bench-10-26-26-blastware/blastware/K441LTOG.0S0 differ diff --git a/tests/test_5a_blastware_walk.py b/tests/test_5a_blastware_walk.py index a043eaf..9dc5082 100644 --- a/tests/test_5a_blastware_walk.py +++ b/tests/test_5a_blastware_walk.py @@ -21,7 +21,8 @@ sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) import minimateplus.protocol as mp # noqa: E402 from minimate_replay import fast_clock # noqa: E402 -from minimateplus.blastware_file import extract_body_bytes # noqa: E402 +from minimateplus.blastware_file import extract_body_bytes, write_blastware_file # noqa: E402 +from minimateplus.models import Event # noqa: E402 from minimateplus.framing import S3FrameParser, build_5a_request, build_bw_frame, waveform_key_params # noqa: E402 from minimateplus.waveform_codec import STREAM_END_ID, decode_waveform_v2, walk_records # noqa: E402 @@ -152,3 +153,15 @@ def test_the_walk_sends_exactly_blastwares_requests_and_the_event_is_whole(key): assert body[recs[-1]["end"] + 4] == STREAM_END_ID dec = decode_waveform_v2(body) assert len({len(dec[c]) for c in ("Tran", "Vert", "Long")}) == 1 + + +@pytest.mark.parametrize("key,bw", [("01110000", "K441LTOF.ZI0"), ("01118a2c", "K441LTOF.ZQ0"), + ("0112a0b6", "K441LTOG.000"), ("0114b0b2", "K441LTOG.0S0")]) +def test_the_file_built_from_the_walk_is_blastwares_own(key, bw, tmp_path): + frames = mp.MiniMateProtocol(ByAddress()).read_bulk_waveform_stream( + bytes.fromhex(key), stop_after_metadata=False, include_terminator=True, strict=True) + ev = Event(index=0) + ev.timestamp = None # the builder takes the footer from the TERM frame + path = tmp_path / bw + write_blastware_file(ev, frames, path) + assert path.read_bytes() == (FIX / "blastware" / bw).read_bytes()