"""Additional edge-case tests for tools/fssm_header.py.""" from __future__ import annotations import struct import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent.parent / "tools")) import fssm_header as fh def test_wave_size_handles_short_non_magic_and_wave32_flag(): assert fh.wave_size(b"FSSM" + b"\x00" * 16) is None non_magic = bytearray(0x100) assert fh.wave_size(bytes(non_magic)) is None w64 = bytearray(0x100) w64[0:4] = fh.MAGIC assert fh.wave_size(bytes(w64)) == 64 w32 = bytearray(0x100) w32[0:4] = fh.MAGIC struct.pack_into("