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

22 lines
1.3 KiB
Python

import sys,tempfile
from pathlib import Path
sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'ops'))
from spell_result_profile import enum,generate,ROOT
with tempfile.TemporaryDirectory() as directory:
path=Path(directory)/'enum.h'
path.write_text('enum SpellCastResult { SPELL_FAILED_FIRST=0x0, SPELL_FAILED_NEXT, SPELL_CAST_OK=SPELL_FAILED_FIRST };')
values,digest=enum(path);assert values=={'SPELL_FAILED_FIRST':0,'SPELL_FAILED_NEXT':1,'SPELL_CAST_OK':0} and len(digest)==64
for body in ('A=1 << 3','A=__import__("os")','A=UNKNOWN','A=0,A=1'):
path.write_text('enum SpellCastResult {'+body+'};')
try:enum(path)
except (ValueError,KeyError):pass
else:raise AssertionError('Unreviewed enum expression accepted')
# Verify actual reference derivation where available; portable builds retain the
# committed header and source-hash manifest, never a dependency on game files.
from spell_result_profile import TURTLE,FOREVER
if TURTLE.exists() and FOREVER.exists():
header,report=generate()
assert header==(ROOT/'include/gateway/spell_result_profile.hpp').read_text()
assert report==(ROOT/'docs/evidence/data/spell-result-profile.json').read_text()
print('Explicit/implicit/aliased enum values, unsafe expression rejection, duplicate rejection and available source/profile consistency passed.')