Files
WoW-Hybrid-gateway/tests/native_target_state_probe_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

35 lines
1.5 KiB
Python

#!/usr/bin/env python3
"""Pure bounded diagnostic macro contract; no client, DB, or service access."""
from pathlib import Path
import shutil
import subprocess
import sys
sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'ops'))
from native_targeted_cast_test import TARGET_STATE_PROBE
assert TARGET_STATE_PROBE.startswith('/run ')
assert len(TARGET_STATE_PROBE)<255
lua=shutil.which('lua')
if lua:
# Execute only against these inert API stubs, including an unknown native
# targettarget. The diagnostic must retain nil as evidence, not invent it.
body='''local calls={};local lines={}
function print(...)lines[#lines+1]={...}end
function UnitGUID(unit)assert(unit=="targettarget");return nil end
function UnitIsUnit(a,b)assert(a=="targettarget" and b=="player");return nil end
function SendChatMessage(text,channel)assert(channel=="SAY");calls[#calls+1]=text end
'''+TARGET_STATE_PROBE[5:]+'''
assert(#calls==0 and #lines==0)
GWTargetStateProbe()
assert(#calls==2 and #lines==1)
assert(calls[1]==".debug fields show 16 uint")
assert(calls[2]==".debug fields show 17 uint")
assert(lines[1][1]=="GW targetstate" and lines[1][2]==nil and lines[1][3]==nil)
GWTargetStateProbe=nil;assert(GWTargetStateProbe==nil)
'''
subprocess.run([lua,'-'],input=body,text=True,check=True)
print('PASS: target-state helper is bounded, defers until invoked, reads original '
'targettarget and exact source fields16/17, and preserves unknown native state. '
'No actual client or source commands executed.')