Documentation
¶
Overview ¶
Package aminotest provides test helpers for verifying amino codec correctness across both the reflect-based codec and the genproto2 generated codec. Import from _test.go files in any package whose types are registered with amino.RegisterGenproto2Type.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertCodecParity ¶
AssertCodecParity verifies that v round-trips identically through both the reflect codec (MarshalReflect / UnmarshalReflect) and the genproto2 fast path (MarshalBinary2 / UnmarshalBinary2), with the two codecs agreeing on every wire byte and every decoded value.
Asserted invariants:
- Encoder parity: MarshalReflect(v) == MarshalBinary2(v).
- Size invariant: SizeBinary2(v) == len(MarshalBinary2(v)).
- Cross-decoder parity: UnmarshalReflect(bz) and UnmarshalBinary2(bz) produce deeply-equal values.
- Roundtrip fidelity: both decoded values reflect.DeepEqual to v. This is strict — test inputs must avoid touching memoized caches (e.g., don't call Commit.Hash() or MakeBlock() on the input, since those populate unexported fields that won't be set on a freshly decoded value and would spuriously fail DeepEqual).
v must be a non-nil pointer to a value whose type implements amino.PBMessager2 (i.e., a type registered with genproto2).
Types ¶
This section is empty.