883 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
21 lines
869 B
C++
21 lines
869 B
C++
#include "gateway/pvp.hpp"
|
|
#include <cassert>
|
|
#include <iostream>
|
|
using namespace gateway;
|
|
int main(){
|
|
assert(source_set_pvp_request(Bytes{0x80})==Bytes{1});
|
|
assert(source_set_pvp_request(Bytes{0})==Bytes{0});
|
|
// Empty native SetPVP must never accidentally become Source's toggle.
|
|
for(const auto& bad:{Bytes{},Bytes{0,0},Bytes{0x80,0},Bytes{1},Bytes{0xff}}){
|
|
bool rejected=false;try{source_set_pvp_request(bad);}catch(const Error&){rejected=true;}
|
|
assert(rejected);
|
|
}
|
|
for(unsigned value=1;value<128;++value){
|
|
for(unsigned msb:{0u,128u}){
|
|
bool rejected=false;try{source_set_pvp_request(Bytes{uint8_t(value|msb)});}catch(const Error&){rejected=true;}
|
|
assert(rejected);
|
|
}
|
|
}
|
|
std::cout<<"PASS actual native explicit PvP enable/disable, strict padding/length, no accidental toggle\n";
|
|
}
|