Q-W2v: split VST god-modules — editor 8 face-axis TUs (+pure layout hoist), processor 3 TUs, component_state_io codec split (extension drops the voice engine), zone_params.h, core/wire putLE; formats frozen, 61/61 green

This commit is contained in:
2026-07-29 10:56:09 -04:00
parent 9d5783453c
commit ea86f540b8
37 changed files with 6202 additions and 5352 deletions
+52
View File
@@ -9,9 +9,12 @@
// reference-bound std::string — the Cursor never outlives its buffer.
#include "../src/core/wire/wire.h"
#include "../src/core/wire/bytes.h" // putLE / ByteReader — the ONE LE byte codec (Q-W2v, T4-20)
#include <cstdint>
#include <cstdio>
#include <string>
#include <vector>
using namespace reasampler;
using namespace reasampler::wire;
@@ -173,7 +176,56 @@ static void testParseUnsignedDecimal() {
CHECK(!wire::parseUnsignedDecimal(std::string(40, '9'), v)); // long run cannot wrap
}
// --- core/wire/bytes.h — the LE byte codec (Q-W2v, T4-20) --------------------
// putLE emits exactly the bytes the retired hand-rolled putU32le/putU64le emitted
// (LSB first, fixed width) — the FROZEN wire byte order.
static void testPutLEExactBytes() {
std::vector<std::uint8_t> out;
wire::putLE(out, static_cast<std::uint32_t>(0x0403'0201u));
CHECK(out.size() == 4);
CHECK(out[0] == 0x01 && out[1] == 0x02 && out[2] == 0x03 && out[3] == 0x04);
out.clear();
wire::putLE(out, static_cast<std::uint64_t>(0x0807'0605'0403'0201ull));
CHECK(out.size() == 8);
CHECK(out[0] == 0x01 && out[7] == 0x08);
}
// ByteReader round-trips putLE output, and the double bit-cast is lossless.
static void testByteReaderRoundTrip() {
std::vector<std::uint8_t> out;
wire::putLE(out, static_cast<std::uint32_t>(7));
wire::putLE(out, static_cast<std::uint64_t>(wire::doubleToBits(-2.5)));
wire::putLE(out, static_cast<std::uint8_t>(0xAB));
wire::putLE(out,
static_cast<std::uint64_t>(static_cast<std::int64_t>(-42))); // i64 image
wire::ByteReader r(out);
CHECK(r.peekU32() == 7);
CHECK(r.u32() == 7);
CHECK(wire::bitsToDouble(r.u64()) == -2.5);
CHECK(r.u8() == 0xAB);
CHECK(r.i64() == -42);
CHECK(r.ok);
}
// Truncation latches ok=false and every subsequent read yields zero/empty —
// the partial-parse contract every codec consumer leans on.
static void testByteReaderLatchesOnTruncation() {
std::vector<std::uint8_t> out;
wire::putLE(out, static_cast<std::uint32_t>(9));
out.pop_back(); // truncate mid-u32
wire::ByteReader r(out);
CHECK(r.u32() == 0);
CHECK(!r.ok);
CHECK(r.u8() == 0); // latched: even an in-bounds width now fails
CHECK(r.str(1).empty());
CHECK(r.peekU32() == 0);
}
int main() {
testPutLEExactBytes();
testByteReaderRoundTrip();
testByteReaderLatchesOnTruncation();
testPutFieldExactBytes();
testFieldRoundTripIncludingSeparators();
testLiteralMismatchFails();