from pathlib import Path P=Path('/tmp/erri-launcher-resupply-1140');R=Path('/home/jakub/devel/escapistsrereintroduced') for name in ['test_mounted_supply_integration.py','test_hq_multiconvoy_supply.py']: src=R/'tests'/name;s=src.read_text();(P/'baseline/tests'/name).write_text(s) if name=='test_mounted_supply_integration.py':s=s.replace('struct Service{HQ*','struct Service{bool m_LauncherTrip=false;HQ*') else: s=s.replace("'mineRecipient','m_Watch'", "'mineRecipient','launcherRecipient','m_Watch'") s=s.replace('bool infantry=true,', 'int launcherCalls=0,launcherAccepted=0;bool launcher=false;bool infantry=true,') s=s.replace(' bool TryPlanMines(',''' bool TryPlanLauncher(Unit*r,Unit*,Entry*d,Entry*s,float){launcherCalls++;if(!launcher||r!=recipient||d!=demand||s!=donorReport||!d||!s)return false;launcherAccepted++;state=2;return true;} bool TryPlanMines(''') s=s.replace('int main(){','''int main(){ {Fixture f;f.first.infantry=false;f.first.launcher=true;f.first.mines=true;f.hq.PlanResupply(100);assert(f.first.launcherAccepted==1&&f.first.mineCalls==0&&f.second.calls==0);} {Fixture f;f.first.launcher=true;f.hq.PlanResupply(100);assert(f.first.accepted==1&&f.first.launcherCalls==0);} {Fixture f;f.first.infantry=false;f.first.mounted=true;f.first.launcher=true;f.hq.PlanResupply(100);assert(f.first.mountedAccepted==1&&f.first.launcherCalls==0);} ''') (P/'tests'/name).write_text(s)