883 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
36 lines
2.6 KiB
C++
36 lines
2.6 KiB
C++
// Production packet consumer, socket-free. Existing Source world/ACK grammar.
|
|
#define LOCAL_FIXTURE_TELEPORT_TEST
|
|
#include "../tools/local_fixture_praxis_teleport.cpp"
|
|
#include <bit>
|
|
#include <fstream>
|
|
using namespace fixture;
|
|
static void check(bool v){if(!v)throw Error("scoped admin lifecycle assertion");}
|
|
template<class F>static bool refuses(F f){try{f();return false;}catch(const Error&){return true;}}
|
|
static Bytes world(const WorldLocation& w){Bytes b;le(b,w.map,4);for(auto f:w.position)le(b,std::bit_cast<uint32_t>(f),4);return b;}
|
|
static LegacyPacket self(const WorldLocation& w,uint64_t guid=admin_guid){
|
|
Bytes b;le(b,1,4);le(b,0,1);le(b,2,1);le(b,3,1);le(b,guid&255,1);le(b,(guid>>8)&255,1);le(b,4,1);le(b,0x40,1);
|
|
for(auto f:w.position){le(b,std::bit_cast<uint32_t>(f),4);}le(b,0,1);return {0xa9,b};
|
|
}
|
|
static LegacyPacket pending(uint32_t map){Bytes b;le(b,map,4);return {0x3f,b};}
|
|
int main(int argc,char** argv){try{
|
|
check(argc==3);std::ifstream f(argv[1],std::ios::binary),g(argv[2],std::ios::binary);check(bool(f)&&bool(g));
|
|
Bytes recorded_pending{std::istreambuf_iterator<char>(f),{}},recorded_new{std::istreambuf_iterator<char>(g),{}};
|
|
auto captured=turtle_login_world(recorded_new);
|
|
WorldLocation origin{1,{10,20,30,0.75f}};if(captured.map==1)origin.map=0;
|
|
Lifecycle s;check(!s.feed({0x236,world(origin)}));
|
|
check(refuses([&]{s.begin(captured);}));check(!s.feed(self(origin,target_guid))&&!s.ready);
|
|
check(!s.feed(self(origin))&&s.ready);s.begin(captured);
|
|
check(!s.feed({0x3f,recorded_pending}));check(s.feed({0x3e,recorded_new}));
|
|
check(s.acknowledgements==1&&!s.ready);
|
|
check(refuses([&]{s.feed({0x3e,recorded_new});}));check(s.acknowledgements==1);
|
|
check(refuses([&]{s.begin(origin);}));check(!s.feed(self(captured))&&s.ready);
|
|
s.begin(origin);check(!s.feed(pending(origin.map)));check(s.feed({0x3e,world(origin)}));check(!s.feed(self(origin))&&s.ready);
|
|
check(s.acknowledgements==2&&same_xyz(*s.current,origin));
|
|
Lifecycle bad;bad.feed({0x236,world(origin)});bad.feed(self(origin));bad.begin(captured);
|
|
check(refuses([&]{bad.feed(pending(captured.map+1));}));check(bad.acknowledgements==0);
|
|
Lifecycle unmatched;unmatched.feed({0x236,world(origin)});unmatched.feed(self(origin));
|
|
check(refuses([&]{unmatched.feed({0x3e,recorded_new});}));check(unmatched.acknowledgements==0);
|
|
std::cout<<"PASS captured Source3F/3E, one ACK, self-create readiness, wrong identity/map, duplicate refusal and origin restoration\n";
|
|
return 0;
|
|
}catch(const std::exception&){std::cerr<<"Scoped admin lifecycle fixture failed; private inputs omitted\n";return 1;}}
|