Files
Viano-Core/tests/clientless/test_adventure_retry_policy.py
T
Nico 0173a434f4 Improve AdventureBot recruitment, world presence and performance
Manage Arthoran as a persistent level-60 tank profile, add Worgen forms and mounts, enable PvP and recruit through native LFG with preparation actions and player invitations.

Reduce repeated route and flight-planning work, bound failed-travel retries and add runtime timing diagnostics. Include 86 passing tests and measurements with 110 online bots.
2026-10-29 01:36:35 +01:00

25 lines
1.1 KiB
Python

"""Population retry spacing is bounded and increases only after failures."""
from pathlib import Path
import subprocess,tempfile
root=Path(__file__).resolve().parents[2]
code=r'''
#include "AdventureBehaviorPolicy.h"
#include <cassert>
#include <limits>
int main(){using AdventureBehaviorPolicy::TravelRetryMs;
assert(TravelRetryMs(1,0)==2000&&TravelRetryMs(2,0)==4000);
assert(TravelRetryMs(3,0)==8000&&TravelRetryMs(4,0)==16000);
assert(TravelRetryMs(5,0)==30000&&TravelRetryMs(1000,1000)==30000);
assert(TravelRetryMs(std::numeric_limits<unsigned>::max(),1000)==30000);
assert(TravelRetryMs(1,1000)==3000&&TravelRetryMs(1,10000)==3000);
for(unsigned count=1;count<100;++count)for(unsigned jitter=0;jitter<=1000;jitter+=25){
auto value=TravelRetryMs(count,jitter);assert(value>=2000&&value<=30000);
}
}
'''
with tempfile.TemporaryDirectory() as d:
p=Path(d);(p/'test.cpp').write_text(code)
subprocess.run(['c++','-std=c++17','-I'+str(root/'src/server/game/World'),str(p/'test.cpp'),'-o',str(p/'test')],check=True)
subprocess.run([str(p/'test')],check=True)
print('Travel failures: exponential/jittered retry spacing, strict 30s bound and overflow safety passed')