Files
WoW-Hybrid-gateway/tests/native_club_bootstrap_test.cpp
praxisandClaude Fable 5.2 7f2139d8d0 Offline test fixtures
883 files, from working commit b1a079a.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 01:32:48 +02:00

38 lines
2.3 KiB
C++

#include "club_bootstrap.h"
#include "club_service.hpp"
#include <iostream>
using namespace gateway;
using namespace gateway::club_wire;
static void require(bool ok,const char* why){if(!ok)throw Error(why);}
static void bootstrap(std::span<const uint8_t> bytes,uint32_t service,const Bytes& expected){
Reader r(bytes);require(r.le(4)==0,"bootstrap status");
require(r.le(8)==((uint64_t(service)<<32)|0x40000001),"original flagged subscribe method");
require(r.le(8)==0 && r.le(4)==0,"unasked bootstrap object/token must be zero");
require(r.le(4)==expected.size() && r.take(expected.size())==expected,"original empty bootstrap body");r.end();
}
static void check(uint32_t service,uint32_t method,const Bytes& expected,uint32_t status=0){
Call c;c.type=(uint64_t(service)<<32)|(0xc0000000u|method);c.object=41;c.token=0x10203040;
auto out=empty_social_response(c);require(out.has_value() && out->opcode==Response,"service response opcode");
Reader r(out->body);require(r.le(4)==status,"response status");require(r.le(8)==c.type,"full original method flags retained");
require(r.le(8)==1 && r.le(4)==c.token,"normal reply object/token contract");
require(r.le(4)==expected.size() && r.take(expected.size())==expected,"original empty reply body");r.end();
}
int main(){try{
bootstrap(gw_club_empty_friends_subscription,0x5869be8c,{});
bootstrap(gw_club_empty_block_subscription,0x8e8f5fb0,{0x0a,0});
// Original FriendsService.cpp explicitly sets continuation(0), even empty.
for(auto m:{3u,4u,5u})check(0x5869be8c,m,{0x10,0});
for(auto m:{1u,2u,6u,7u})check(0x5869be8c,m,{});
for(auto m:{3u,4u,5u,6u})check(0x138d200c,m,{});
for(auto m:{1u,2u,5u,6u,7u})check(0xfee1aa14,m,{});
check(0xfee1aa14,3,{0x10,0});
// No fake successful friend/invitation edits or delivered platform whisper.
for(unsigned m=8;m<=14;++m)check(0x5869be8c,m,{},0xbc7);
check(0xfee1aa14,4,{},0xbc7);
for(unsigned m=1;m<=7;++m)check(0x8e8f5fb0,m,{},0xbc7);
check(0x5869be8c,99,{},0xbc7);
Call guild;guild.type=uint64_t(Club)<<32|1;
require(!empty_social_response(guild),"must not intercept authoritative guild service");
std::cout<<"PASS original bootstrap envelopes, explicit empty continuations, reply identity and platform mutation refusal\n";
}catch(const std::exception& e){std::cerr<<e.what()<<'\n';return 1;}}