Files
EscapistsReintroduced/tests/test_radio_feedback_policy.py
jakub cab998fb64 Combine Workshop addon and fix prison startup
Merge owned systems into one addon while preserving resource identities. Gate player admission on the replicated prison scene, restore the original framed door, and hold enemy AI until escape. Correct scenario branding and author metadata, include publishing assets, and retain regression and native verification evidence.
2026-09-20 16:42:52 +02:00

37 lines
1.8 KiB
Python

"""Execute the production presentation-state policy; no network claim."""
from policy_harness import ROOT, body, run
source=ROOT/'addons/core/Scripts/Game/ERR/00_Core/ERR_RadioFeedback.c'
function=body(source,'static ERR_RadioFeedback Next(').replace('ERR_RadioFeedback.', 'ERR_RadioFeedback::')
run('''#include <cassert>
enum class ERR_RadioFeedback {INACTIVE, WAITING, TRANSMITTING, INTERRUPTED};
'''+function+'''
int main() {
using S=ERR_RadioFeedback;
const S emptyExpected[]={S::WAITING,S::WAITING,S::INTERRUPTED,S::INTERRUPTED};
for (int previous=0;previous<4;++previous) {
S state=static_cast<S>(previous);
// Terminal/new-round state always clears; stale occupancy cannot resurrect it.
assert(Next(state,false,false)==S::INACTIVE);
assert(Next(state,false,true)==S::INACTIVE);
assert(Next(state,true,true)==S::TRANSMITTING);
assert(Next(state,true,false)==emptyExpected[previous]);
}
S state=Next(S::INACTIVE,true,false);
assert(state==S::WAITING);
for (int sample=0;sample<100;++sample) state=Next(state,true,false);
assert(state==S::WAITING); // initial wait is not an interruption
state=Next(state,true,true);
assert(state==S::TRANSMITTING);
state=Next(state,true,false);
assert(state==S::INTERRUPTED);
for (int sample=0;sample<100;++sample) state=Next(state,true,false);
assert(state==S::INTERRUPTED); // do not alternate guide messages while empty
state=Next(state,true,true);
assert(state==S::TRANSMITTING);
state=Next(state,false,true);
assert(state==S::INACTIVE);
assert(Next(state,true,false)==S::WAITING); // fresh round has no stale interruption
}
''')
print('PASS: actual radio feedback policy, initial wait, interruption persistence, resumption and terminal/new-round reset')