Build independent base gameplay and source-bound native verification
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
from policy_harness import ROOT, body, run
|
||||
import re
|
||||
source = body(ROOT/'addons/core/Scripts/Game/ERR/ERR_CasualtyGroundSupport.c', 'static bool SupportHit(')
|
||||
source = re.sub(r'(?<![\w.])(\d+\.\d+)(?![\w.])', r'\1f', source)
|
||||
run('#include <cassert>\n' + source + '''
|
||||
int main() {
|
||||
assert(SupportHit(0,1,false,false));
|
||||
assert(SupportHit(0.999,0.85,false,false));
|
||||
assert(!SupportHit(1,1,false,false)); // no hit is no support
|
||||
assert(!SupportHit(-0.01,1,false,false));
|
||||
assert(!SupportHit(0.5,0.849,false,false));
|
||||
assert(!SupportHit(0.5,-1,false,false));
|
||||
assert(!SupportHit(0.5,1,true,false)); // own landing gear cannot support itself
|
||||
assert(!SupportHit(0.5,1,false,true)); // player/vehicle is not static parking support
|
||||
}
|
||||
''')
|
||||
print('PASS: actual short-cast hit, upward support normal, no self support and no dynamic support')
|
||||
Reference in New Issue
Block a user