Include the current addon, terrain integrations, tools, regression tests and recorded development evidence.
13 lines
3.6 KiB
Python
13 lines
3.6 KiB
Python
from pathlib import Path
|
|
import os,subprocess,json,hashlib,difflib
|
|
b=Path('/tmp/erri-random-radius-tests-0504');src=Path('/tmp/erri-random-radius-source-0504/addons/core/Scripts/Game/ERR/40_Chat/ERR_NativeRandomRadiusTrace.c');test=b/'tests/test_native_random_radius_trace.py';text=src.read_text();sha=lambda p:hashlib.sha256(p.read_bytes()).hexdigest();env=dict(os.environ,PYTHONPATH='/home/jakub/devel/escapistsrereintroduced/tests');results={}
|
|
mutations={'disabled-gate':('return s_Enabled && s_Count < 16;','return s_Count < 16;'),'exclusion-branch':('else if (iterationCount > 0 && randomSphereRadius == 0)','else if (randomSphereRadius == 0)'),'recoil-uniform':('return super.RandomVectorSphere(min, max, uniform);','return super.RandomVectorSphere(min, max, !uniform);')}
|
|
for name,(old,new) in mutations.items():
|
|
assert text.count(old)==1;file=b/(name+'.c');file.write_text(text.replace(old,new));env['ERR_NATIVE_RANDOM_RADIUS_SOURCE']=str(file);r=subprocess.run(['python3',str(test)],env=env,capture_output=True,text=True);log=r.stdout+r.stderr;(b/(name+'-red.log')).write_text(log)
|
|
assert r.returncode!=0 and 'Assertion' in log and 'died with' in log and "['g++'" not in log,(name,log)
|
|
results[name]={'exit':r.returncode,'compiled_then_runtime_assertion_failed':True,'log_sha256':sha(b/(name+'-red.log'))}
|
|
env['ERR_NATIVE_RANDOM_RADIUS_SOURCE']=str(src);r=subprocess.run(['python3',str(test)],env=env,capture_output=True,text=True);(b/'green.log').write_text(r.stdout+r.stderr);assert r.returncode==0,r.stderr
|
|
(b/'fix.patch').write_text(''.join(difflib.unified_diff([],test.read_text().splitlines(True),fromfile='/dev/null',tofile='b/tests/test_native_random_radius_trace.py')))
|
|
v={'complete':True,'verdict':'Five actual wrappers/helper pass transparency and bounded diagnostic contract; no source blocker found.','source_sha256':sha(src),'test_sha256':sha(test),'patch_sha256':sha(b/'fix.patch'),'green_log_sha256':sha(b/'green.log'),'mutations':results,'actual_methods':'Complete helper and all five modded wrapper method bodies extracted from supplied source. Native superclass methods and API boundaries are doubles.','coverage':['CLI opt-in cached once; missing/0/true/empty/2 disabled. Disabled and cap-exhausted paths perform no extra actor/input/node-stack reads.','Point uses fields after its exact single superclass invocation and logs only SUCCESS with both zero; return/output preserved across SUCCESS/FAIL/RUNNING.','Look uses controlled body and input and logs exactly distance*tangent==0, without altering native result/output or arguments.','Combat uses0.1*distance diagnostic but forwards exact distance/center/result.','WithExclude exact direct versus iterative branching,0/negative iteration loop skips,nonzero tiny exclusion direct radius,unchanged outarg and return on failure.','Recoil forwards exact min/max/uniform and result; only two zero vector lengths log; no fabricated node owner.','All wrappers call superclass exactly once, shared16 witnesses/stack dumps, node stack captured only on actual permitted AI witness.'],'limits':['Offline syntax-adapted wrapper execution only; installed native superclass/RNG behavior, engine hook compatibility and caller attribution require parent-owned diagnostic native run.','No native error suppressed, no radius clamp, no extra RNG draw, no proof yet of which caller produced prior zero-radius error.'],'command':'PYTHONPATH=/home/jakub/devel/escapistsrereintroduced/tests ERR_NATIVE_RANDOM_RADIUS_SOURCE='+str(src)+' python3 '+str(test)}
|
|
(b/'review.json').write_text(json.dumps(v,indent=2)+'\n');print(json.dumps({'source_sha256':sha(src),'test_sha256':sha(test),'patch_sha256':sha(b/'fix.patch'),'review_sha256':sha(b/'review.json')},indent=2))
|