Files
WoW-Hybrid-gateway/tests/map1_materialized_cache_header_test.py
praxisandClaude Fable 5.2 7f2139d8d0 Offline test fixtures
883 files, from working commit b1a079a.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 01:32:48 +02:00

30 lines
1.9 KiB
Python

#!/usr/bin/env python3
"""Actual16B typed observer: no registry, bucket, node, file or native calls."""
import importlib.util,json,struct
from pathlib import Path
root=Path(__file__).resolve().parents[1]
spec=importlib.util.spec_from_file_location('engine_session_inspect',root/'ops/engine_session_inspect.py');m=importlib.util.module_from_spec(spec);spec.loader.exec_module(m)
def main():
calls=[]
def read(address,size):
assert (address,size)==(0x14603ac60+0x78,16)
calls.append((address,size));return struct.pack('<2Q',0,0)
empty=m.inspect_map1_materialized_cache_header(read)
assert len(calls)==1 and empty['record1_in_materialized_cache'] is False
assert empty['on_disk_or_hotfix_blob_absence_proven'] is False and empty['bucket_or_node_walk'] is False
def allocated(address,size):
assert (address,size)==(0x14603ac60+0x78,16)
return struct.pack('<2Q',128,0x200000)
held=m.inspect_map1_materialized_cache_header(allocated)
assert held['record1_in_materialized_cache'] is None and held['status']=='materialized-container-present-record1-lookup-held'
def unavailable(address,size):raise ValueError('Unreadable exact header')
assert m.inspect_map1_materialized_cache_header(unavailable)['status']=='header-mapping-held'
pinned=m.MAP_AREA_TYPED_DESCRIPTORS;m.MAP_AREA_TYPED_DESCRIPTORS=(('Map',123),)
calls.clear();assert m.inspect_map1_materialized_cache_header(read)['status']=='fixed-descriptor-pins-held' and calls==[]
m.MAP_AREA_TYPED_DESCRIPTORS=pinned
assert m.ENABLE_MAP1_RECORD_CACHE_HEADER_LOOKUP is False
print(json.dumps({'status':'PASS','one_exact16B_header_only':True,'no_registry_bucket_node_or_native_IO':True,'null_materialized_cache_not_blob_or_disk_absence':True,'nonnull_is_unknown_not_presence':True,'mapping_and_wrong_pin_refusal':True,'default_off':True}))
if __name__=='__main__':main()