From 50450701edc3df31aacf3ffd68d7b43158cd8155 Mon Sep 17 00:00:00 2001 From: MayaTheShy Date: Sat, 8 Nov 2025 19:18:53 -0500 Subject: [PATCH] feat: add TestHarness for domain discovery JSON parsing and protocol signature validation --- tests/TestHarness.cpp | 101 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 tests/TestHarness.cpp diff --git a/tests/TestHarness.cpp b/tests/TestHarness.cpp new file mode 100644 index 0000000..24b291e --- /dev/null +++ b/tests/TestHarness.cpp @@ -0,0 +1,101 @@ +#include +#include +#include +#include + +#include "../src/NLPacketCodec.hpp" +#include "../src/DomainDiscovery.hpp" + +static std::string hexOf(const std::vector& v) { + static const char* hexd = "0123456789abcdef"; + std::string out; out.resize(v.size()*2); + for (size_t i=0;i>4)&0xF]; out[2*i+1]=hexd[v[i]&0xF]; } + return out; +} + +static std::string b64Of(const std::vector& in){ + static const char* tbl = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + std::string out; out.reserve(((in.size()+2)/3)*4); + size_t i=0; while(i>(18-k*6))&0x3F; out.push_back(tbl[idx]); } + for(int k=0;k