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

34 lines
2.0 KiB
Python

#!/usr/bin/env python3
"""Pure prepared-combat preservation contract; no live client or DB access."""
from pathlib import Path
import sys
sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'ops'))
from native_targeted_cast_test import prepared_melee_invariants as valid
from native_targeted_cast_test import new_chase_stop
before='60\t5939\t0\t100000\t38'
assert valid(before,before,True)
assert valid(before,'60\t5300\t250\t100000\t38',True)
assert valid('60\t5300\t250\t100000\t38',before,True)
assert valid(before,'60\t0\t1000\t100000\t38',True) # Death is real state, never silently healed.
for after in ('59\t5300\t250\t100000\t38','60\t5300\t250\t99999\t38',
'60\t5300\t250\t100000\t39','60\t5300\t250\t100000\t54',
'60\t5300\t1001\t100000\t38','60\t4294967296\t0\t100000\t38',
'60\t5300\t0\t4294967296\t38','60\t5300\t0\t100000\t4294967296',
'60\t-1\t0\t100000\t38','60\tNaN\t0\t100000\t38',before+'\t0','',None):
assert not valid(before,after,True),after
assert not valid(before,before,False)
assert not valid(before,before,1)
assert not valid('60\t5939\t0\t100000\t55','60\t5300\t250\t100000\t55',True)
print('PASS: prepared melee permits genuine health/rage changes while preserving source level, money, normal-visible flags and inventory; malformed domains reject. No live operations.')
stop=dict(legacy_guid='123',id=7,facing=1,points=0,duration=0,start=[1.0,2.0,3.0],destination=[1.0,2.0,3.0])
assert new_chase_stop(stop,'123',{6}) is stop
assert new_chase_stop(stop,'123',{7}) is None
assert new_chase_stop(stop,'124',set()) is None
for changed in (dict(facing=0),dict(points=1),dict(duration=1),dict(id='7'),
dict(start=[1.0,2.0]),dict(destination=[1.0,2.0,4.0]),
dict(start=[float('nan'),2.0,3.0],destination=[float('nan'),2.0,3.0])):
assert new_chase_stop(dict(stop,**changed),'123',set()) is None
print('PASS: chase observation rejects foreign, prior, moving and malformed rows; only the exact actor new authoritative stop matches.')