Files
zeekay 6439541c91 Prove the two backends agree, on bytes neither of them wrote
Generating C++ is a claim. This runs it.

Both probes build the same cases from the same inputs — every type the dialect
has, plus the request and response envelopes the generated client and dispatch
produce — and print the hex; the two outputs are the same file. Then each
probe reads both probes' bytes with its own generated accessors, four
crossings, all agreeing. Then both read a corpus of real P-chain transactions
produced by the Go chain implementation, 134 vectors of which 44 are truncated
or malformed on purpose, and answer the same fields in the same places.

Neither probe decides anything: every value printed comes from a generated
accessor or a generated builder, so a disagreement between the probes is a
disagreement between the backends and nowhere else.

It earned its keep immediately. Five corpus vectors separated a Go [N]byte
accessor answering zeros from a C++ span answering empty, and the round trip
found the zero Object panicking in the Go runtime where C++ answered zero.
Both are fixed; neither was visible by reading.

list<T> carries a pointer and a count and nothing about elements — the dialect
cannot state a stride — so both languages agree on the count, which is all
either can say. That gap is in the dialect, in both backends at once.
2026-09-06 08:35:14 -07:00

34 lines
790 B
Plaintext

# Every type the schema dialect has, in one struct, so the two backends are
# compared on all of them at once: each field is written by both builders from
# the same input and read back by both readers from the same bytes.
#
# The offsets are hand-placed, as the dialect requires: @N is a byte offset.
package probe
type id16 = bytes_fixed[16]
struct Inner {
Tag u32 @0
Val u64 @4
}
struct Wide {
Flag bool @0
A8 u8 @1
A16 u16 @2
A32 u32 @4
A64 u64 @8
S8 i8 @16
S16 i16 @18
S32 i32 @20
S64 i64 @24
F32 f32 @32
F64 f64 @40
Id id16 @48
Name text @64
Blob bytes @72
Items list<u8> @80
Child Inner @88
}