Include the current addon, terrain integrations, tools, regression tests and recorded development evidence.
22 lines
1.2 KiB
Python
22 lines
1.2 KiB
Python
"""Execute production close-contact thresholds and crew eligibility rules."""
|
|
from policy_harness import ROOT, body, run
|
|
source=ROOT/'addons/core/Scripts/Game/ERR/10_AI/ERR_HunterCloseContact.c'
|
|
run('''#include <cassert>
|
|
#include <limits>
|
|
'''+body(source,'static bool Trigger(')+body(source,'static bool Dismount(')+'''
|
|
int main(){
|
|
assert(Trigger(80,500,3));assert(Trigger(0,0,0));
|
|
assert(!Trigger(80.01f,0,0));assert(!Trigger(20,500.01f,0));assert(!Trigger(20,0,3.01f));
|
|
assert(!Trigger(-1,0,0));assert(!Trigger(20,-1,0));assert(!Trigger(20,0,-1));
|
|
float bad=std::numeric_limits<float>::quiet_NaN();
|
|
assert(!Trigger(bad,0,0));assert(!Trigger(20,bad,0));assert(!Trigger(20,0,bad));
|
|
// Exhaustive crew eligibility: original conscious AI, owned group, in this UAZ,
|
|
// never players, transferred actors, unconscious crew, or the covering gunner.
|
|
for(int bits=0;bits<64;bits++){
|
|
bool original=bits&1,fit=bits&2,player=bits&4,same=bits&8,aboard=bits&16,turret=bits&32;
|
|
assert(Dismount(original,fit,player,same,aboard,turret)==(bits==27));
|
|
}
|
|
}
|
|
''')
|
|
print('PASS: close observed threat, low-speed boundary, invalid samples, and all 64 original-crew/gunner/player eligibility combinations')
|