"""Tests for tools/awc_markers.py, built from synthetic AWC data only (no game files). python -I tests/test_awc_markers.py """ import contextlib import errno import io import json import os from pathlib import Path import struct import subprocess import sys import tempfile import unittest from unittest import mock ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) TOOL = os.path.join(ROOT, "tools", "awc_markers.py") sys.path.insert(0, os.path.dirname(TOOL)) import awc_markers # noqa: E402 import report_paths # noqa: E402 TRACK, TICK, SPAN = 0x11111111, 0x22222222, 0x33333333 # made-up type hashes NAME_A, NAME_B = 0x84000001, 0xB0000002 # made-up value hashes (not sensible floats) def event(typ, value, time, flags=0): """One 16-byte event; a float value is stored as f32, an int as the raw u32.""" bits = value if isinstance(value, int) else struct.unpack("