"""Static MMAP proof cache isolation, failure handling and bounded lifetime.""" from pathlib import Path import subprocess,tempfile root=Path(__file__).resolve().parents[2] code=r''' #include "ClientlessGraphProbeCache.h" #include #include int main(){ ClientlessGraphProbeCache c;auto key=c.MakeKey(0,1,1,2,3,4,5,6); assert(!c.Find(key));c.Record(key,false,10,0,10);assert(!c.Find(key)); c.Record(key,true,10,2,10);assert(!c.Find(key)); c.Record(key,true,std::numeric_limits::infinity(),0,10);assert(!c.Find(key)); c.Record(key,true,10,0,9);assert(c.Find(key)&&c.Find(key)->Length==10); assert(!c.Find(c.MakeKey(1,1,1,2,3,4,5,6))); // map isolation assert(!c.Find(c.MakeKey(0,2,1,2,3,4,5,6))); // instance isolation assert(!c.Find(c.MakeKey(0,1,4,5,6,1,2,3))); // directed connection assert(!c.Find(c.MakeKey(0,1,1.0000001f,2,3,4,5,6))); // exact coordinates c.Clear();assert(!c.Find(key)&&c.Size()==0); for(unsigned i=0;i<32769;++i)c.Record(c.MakeKey(i,1,1,2,3,4,5,6),true,10,0,9); assert(c.Size()==1&&c.Find(c.MakeKey(32768,1,1,2,3,4,5,6))); } ''' with tempfile.TemporaryDirectory() as d: p=Path(d);(p/'test.cpp').write_text(code) subprocess.run(['c++','-std=c++17','-I'+str(root/'src/server/game/World'),str(p/'test.cpp'),'-o',str(p/'test')],check=True) subprocess.run([str(p/'test')],check=True) print('Graph probe cache: exact directed/map/instance keys, successful geometry only, invalidation and bounded storage passed')