883 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
52 lines
3.1 KiB
Python
52 lines
3.1 KiB
Python
#!/usr/bin/env python3
|
|
"""Execute the changed emitted Lua against independent API-order witnesses."""
|
|
from pathlib import Path
|
|
import json,subprocess,sys,tempfile
|
|
sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'ops'))
|
|
import native_model_probe as probe
|
|
|
|
def main():
|
|
entries=[dict(path='wowhybrid/source-equipment/'+c*64+'.m2',file_data_id=i)for c,i in [('a',8538091),('b',8538096),('c',2147483647)]]
|
|
initial,frame,phases=probe.owned_batch_commands(entries,'1234abcd')
|
|
assert len(phases)==3 and all(len(p)==2 for p in phases)
|
|
assert all(len(text)<=255 for text in [initial,frame]+[t for p in phases for t in p])
|
|
# Source-owned mode intentionally makes no claim about a native path lookup.
|
|
assert all('GetFileIDFromPath'not in text for phase in phases for text in phase)
|
|
prelude="""GatewayDiagnosticsSaved={};UIParent={};local tick=0
|
|
local creates,cvars,clears,sets,gets=0,0,0,0,0
|
|
local expected={8538091,8538096,2147483647};local current,lastSetTick
|
|
function GetCVar(name) assert(name=='overrideArchive');cvars=cvars+1;return '0' end
|
|
function CreateFrame(kind,name,parent)
|
|
assert(kind=='PlayerModel' and name==nil and parent==UIParent);creates=creates+1
|
|
local frame={}
|
|
function frame:SetSize(w,h) assert(w==500 and h==500)end
|
|
function frame:SetPoint(point)assert(point=='CENTER')end
|
|
function frame:SetFrameStrata(value)assert(value=='DIALOG')end
|
|
function frame:Show()self.shown=true end
|
|
function frame:ClearModel()clears=clears+1;current=nil end
|
|
function frame:SetModel(id)sets=sets+1;assert(id==expected[sets]);assert(clears==sets);current=id;lastSetTick=tick end
|
|
function frame:GetModelFileID()assert(current and tick>lastSetTick,'Completion was sampled in request tick');gets=gets+1;return current end
|
|
return frame
|
|
end
|
|
local function chunk(text)tick=tick+1;assert(loadstring(text))()end
|
|
"""
|
|
chunks=[initial,frame]+[text for phase in phases for text in phase]
|
|
source=prelude+'\n'.join('chunk('+json.dumps(text.removeprefix('/run '))+')'for text in chunks)
|
|
source+="""
|
|
assert(creates==1 and cvars==1 and clears==3 and sets==3 and gets==3)
|
|
local rows=GatewayDiagnosticsSaved.nativeModelBatch.models
|
|
assert(#rows==3)
|
|
for i,r in ipairs(rows)do
|
|
assert(r.run=='1234abcd' and r.fileID==expected[i]and r.requestedFileID==expected[i]and r.loadedFileID==expected[i]and r.loadAccepted==true and r.overrideArchive=='0')
|
|
end
|
|
assert(rows[1].path=='wowhybrid/source-equipment/"""+'a'*64+""".m2')
|
|
assert(rows[2].path=='wowhybrid/source-equipment/"""+'b'*64+""".m2')
|
|
print('Actual emitted Lua: one frame/CVar,3 ordered Clear/Set/later-ID calls,3 preserved tuples PASS')
|
|
"""
|
|
with tempfile.TemporaryDirectory()as d:
|
|
p=Path(d)/'actual-emitted.lua';p.write_text(source);result=subprocess.run(['lua5.1',str(p)],capture_output=True,text=True)
|
|
assert result.returncode==0,result.stderr
|
|
print(json.dumps(dict(status='PASS',actual_emitted_Lua_executed=True,owned_macros_per_model=2,max_macro_characters=max(map(len,chunks)),frame_and_CVar_once=True,Clear_Set_completion_order=True,completion_in_later_macro=True,per_entry_identity_and_result_preserved=True,community_and_single_generation_unchanged=True,no_native_client_or_old_check_replay=True)))
|
|
|
|
if __name__=='__main__':main()
|