Build independent base gameplay and source-bound native verification
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
"""Execute the production presentation-state policy; no network claim."""
|
||||
from policy_harness import ROOT, body, run
|
||||
source=ROOT/'addons/core/Scripts/Game/ERR/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')
|
||||
Reference in New Issue
Block a user