Validate independent packed addons and complete physical mortar salvos

This commit is contained in:
2026-09-19 11:42:13 +02:00
parent 7c53b4bb81
commit dfd7cc49e2
532 changed files with 63902 additions and 96 deletions
+30 -1
View File
@@ -82,6 +82,32 @@ int main(){
assert(unauthorized.Poll(0)==S::FAILED && !unauthorized.m_Resolved);
}
''')
# Execute the production classification helper and its actual delivered-report
# lookup. The freshness adapter supplies only the report/time boundary; no
# inventory retry, reservation release or native firing is modeled here.
system_path=r/'ERR_MortarSystem.c'
classification='\n'.join(body(system_path,signature) for signature in ['ERR_HQReport Latest(', 'string ContactFailure(', 'string SupplyFailure('])
classification=classification.replace('ERR_HQReport Latest(', 'Report* Latest(').replace('ERR_MortarBattery battery','Battery* battery').replace('battery.Report','battery->Report').replace('ERR_MortarPrediction.Fresh','Prediction::Fresh').replace('return null;', 'return nullptr;').replace('string ', 'std::string ')
run('''#include <cassert>
#include <string>
struct Report {float observed=1000;bool valid=true;};
struct Battery {struct Report* Report=nullptr;};
struct Prediction {static bool Fresh(Report* report,float now){return report&&report->valid&&now>=report->observed&&now-report->observed<=60000;}};
struct System {
'''+classification+'''};
int main(){
System system;Battery battery;
assert(system.SupplyFailure(&battery,20000)=="no delivered target report");
Report report;battery.Report=&report;
assert(system.SupplyFailure(&battery,61000)=="next native load lacks confirmed physical gunner ammunition");
assert(system.SupplyFailure(&battery,61001)=="delivered target report expired or invalid");
assert(system.SupplyFailure(&battery,999)=="delivered target report expired or invalid");
report.valid=false;assert(system.SupplyFailure(&battery,20000)=="delivered target report expired or invalid");
report.valid=true;report.observed=20000;
assert(system.SupplyFailure(&battery,30000)=="next native load lacks confirmed physical gunner ammunition");
assert(battery.Report==&report&&report.observed==20000); // classification cannot retimestamp or replace a report
}
''')
# Source contract checks constrain integration that cannot run without the engine.
b=battery.read_text();sys=(r/'ERR_MortarSystem.c').read_text();f=(r/'ERR_MortarFiring.c').read_text();rd=readiness.read_text();tr=transfer.read_text()
update=body(battery,'void Update(float now)')
@@ -96,6 +122,9 @@ assert 'm_AttemptedShells.Insert(item)' in b and 'm_AttemptedShells.Contains(ite
assert 'm_Transfer.CapturedOrder() == OrderId' in b
assert 'battery.PendingSupplyReport' in sys and 'supply == ERR_MortarSupplyState.PENDING) return;' in sys
shoot=f[f.index('modded class SCR_AIStaticArtilleryBehavior_ShootingLogic'):]
assert shoot.index('battery.SupplyState(')<shoot.index('super.EOnTaskSimulate(')
assert shoot.index('battery.SupplyState(') < shoot.index('supply == ERR_MortarSupplyState.PENDING') < shoot.index('supply == ERR_MortarSupplyState.FAILED') < shoot.index('system.SupplyFailure(battery, now)') < shoot.index('super.EOnTaskSimulate(')
assert 'system.Withhold(battery, system.SupplyFailure(battery, now))' in shoot
supply_state=body(battery,'ERR_MortarSupplyState SupplyState(')
assert supply_state.index('m_Transfer.Poll(now)') < supply_state.index('if (!SupplyAuthorized(now))')
assert shoot.count('super.EOnTaskSimulate(')==1 and 'battery.SupplyGunner()' not in shoot
print('PASS: actual startup/generation/ownership/timeout/callback policies and native-counter wait; integration preserves one-shot allocation and pending-crew cancellation')