"""Actual native-fixture startup/deadline gate, engine boundaries doubled.""" import os,sys from pathlib import Path REPO=Path(os.environ.get('ERR_REPO','/home/jakub/devel/escapistsrereintroduced')) sys.path.insert(0,str(REPO/'tests')) from policy_harness import body,run p=Path(os.environ.get('ERR_MEMORY_PROBE_SOURCE',REPO/'addons/chat/Scripts/Game/ERR/ERR_NativeHQMemoryProbe.c')) s=body(p,'int Tick(ERR_HQ hq, float now)') # Execute the unchanged deadline/startup prefix; payload/native radio assertions # after this gate remain the full fixture's responsibility. s=s[:s.index(' if (!m_ValueChecked)')]+ ' }\n return 1;\n }' s=s.replace('ERR_HQ hq','ERR_HQ* hq').replace('hq.','hq->') run(r''' #include #include struct ERR_HQ{bool ready=true;bool ERR_ProbeSquadsReady(){return ready;}}; struct Probe{bool enabled=true,m_Mode=true,m_Failed=false,m_AutoChecked=false;int m_Step=0,automatic=0,checks=0;float m_Deadline=0;bool Enabled(){return enabled;}void Check(bool,std::string){checks++;m_Failed=true;}int AutomaticConvoy(ERR_HQ*){if(automatic==1)m_AutoChecked=true;return automatic;} METHOD }; int main(){ERR_HQ hq; Probe p;assert(p.Tick(&hq,1000)==0&&p.m_Deadline==151000);assert(p.Tick(&hq,130000)==0&&p.m_Deadline==151000);p.automatic=1;assert(p.Tick(&hq,145000)==1&&p.m_Deadline==265000);assert(p.Tick(&hq,200000)==1&&p.m_Deadline==265000);assert(p.Tick(&hq,265000)==1);assert(p.Tick(&hq,265001)==-1&&p.checks==1); Probe missing;assert(missing.Tick(&hq,0)==0);assert(missing.Tick(&hq,150001)==-1&&missing.checks==1); Probe refused;refused.Tick(&hq,0);refused.automatic=-1;assert(refused.Tick(&hq,40000)==-1&&refused.m_Deadline==150000&&!refused.m_AutoChecked); Probe unavailable;hq.ready=false;assert(unavailable.Tick(&hq,0)==0);assert(unavailable.Tick(&hq,150001)==-1);hq.ready=true; Probe invalid;invalid.enabled=false;assert(invalid.Tick(&hq,0)==-1&&invalid.m_Deadline==0); } '''.replace('METHOD',s)) smoke=Path(os.environ.get('ERR_SMOKE_SOURCE',REPO/'addons/chat/Scripts/Game/ERR/ERR_NativeSmoke.c')).read_text() assert 'if (m_ERRTestHQMemory) m_ERRSmokeDeadline = GetWorld().GetWorldTime() + 360000;' in smoke assert 'if (m_ERRTestHQBody) m_ERRSmokeDeadline = GetWorld().GetWorldTime() + 240000;' in smoke print('PASS: bounded150s startup followed by exactly one120s memory window; only HQ-memory outer deadline extended')