"""Unit tests for tools/address_guard.py parity with runtime/src/address_guard.h. Standard library only; no GPU, no LLVM, no game files. """ import contextlib import io import os import struct import sys import unittest ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) TOOLS = os.path.join(ROOT, "tools") if TOOLS not in sys.path: sys.path.insert(0, TOOLS) import address_guard as ag # noqa: E402 GIB = 1 << 30 LIMIT = ag.RESERVED_END class AddressGuardOracleTest(unittest.TestCase): def test_header_layout_and_last_module(self): raw_default = ag.header(LIMIT, 0x100000) self.assertEqual(len(raw_default), 64) self.assertEqual(struct.unpack("