CDR2 Golden Vectors
42 golden vectors covering the full XCDR2 type system, published for independent spec compliance verification. Each vector is byte-stable and deterministic (verify mode by default, explicit regen via GOLDEN_REGEN=1).
Encoding: CDR2 Little-Endian (Encapsulation ID 0x000A), per OMG XTypes 1.3 Section 7.4.3.
Vector Catalog
| # | Vector | Type (CDR2) | Size | Category |
|---|---|---|---|---|
| 1 | primitive_u8 | uint8 | 5 B | Primitives |
| 2 | primitive_u16 | uint16 | 6 B | Primitives |
| 3 | primitive_u32 | uint32 | 8 B | Primitives |
| 4 | primitive_u64 | uint64 | 12 B | Primitives |
| 5 | primitive_i8 | int8 | 5 B | Primitives |
| 6 | primitive_i16 | int16 | 6 B | Primitives |
| 7 | primitive_i32 | int32 | 8 B | Primitives |
| 8 | primitive_i64 | int64 | 12 B | Primitives |
| 9 | primitive_f32 | float32 | 8 B | Primitives |
| 10 | primitive_f64 | float64 | 12 B | Primitives |
| 11 | primitive_bool_true | boolean | 5 B | Primitives |
| 12 | primitive_bool_false | boolean | 5 B | Primitives |
| 13 | edge_nan | float64 | 12 B | Edge Cases |
| 14 | edge_inf_pos | float64 | 12 B | Edge Cases |
| 15 | edge_inf_neg | float64 | 12 B | Edge Cases |
| 16 | edge_u64_max | uint64 | 12 B | Edge Cases |
| 17 | edge_i32_min | int32 | 8 B | Edge Cases |
| 18 | string_empty | string | 8 B | Strings |
| 19 | string_hello | string | 16 B | Strings |
| 20 | string_utf8 | string | varies | Strings |
| 21 | string_bounded_256 | bounded string | varies | Strings |
| 22 | seq_empty | sequence<uint32> | 8 B | Sequences |
| 23 | seq_u32 | sequence<uint32> | varies | Sequences |
| 24 | seq_f64 | sequence<float64> | varies | Sequences |
| 25 | seq_string | sequence<string> | varies | Sequences |
| 26 | seq_nested | sequence<sequence<uint32>> | varies | Sequences |
| 27 | map_empty | map<string, int32> | 8 B | Maps |
| 28 | map_sorted | map<string, int32> | varies | Maps |
| 29 | map_struct_value | map<string, struct> | varies | Maps |
| 30 | struct_point3d | struct Point3D | varies | Structs |
| 31 | struct_labelled | struct LabelledValue | varies | Structs |
| 32 | struct_nested | struct Segment | varies | Structs |
| 33 | bool_native_true | boolean (native) | 5 B | Native Booleans |
| 34 | bool_native_false | boolean (native) | 5 B | Native Booleans |
| 35 | char8_A | char8 | 5 B | char8 |
| 36 | char8_null | char8 | 5 B | char8 |
| 37 | array_u32_3 | uint32[3] | 16 B | Fixed-size Arrays |
| 38 | array_f64_2 | float64[2] | 20 B | Fixed-size Arrays |
| 39 | optional_some_u32 | Optional<uint32> | varies | Optional |
| 40 | optional_none | Optional<uint32> | varies | Optional |
| 41 | optional_some_string | Optional<string> | varies | Optional |
| 42 | btreemap_sorted | BTreeMap<string, int32> | varies | BTreeMap |
Type Coverage
| Category | Vectors | Types Covered |
|---|---|---|
| Primitives | 12 | i8, u8, i16, u16, i32, u32, i64, u64, f32, f64, bool true, bool false |
| Edge Cases | 5 | NaN, +Inf, -Inf, u64::MAX, i32::MIN |
| Strings | 4 | empty, ASCII, UTF-8, bounded 256 chars |
| Sequences | 5 | Vec<u32> empty/populated, Vec<f64>, Vec<String>, Vec<Vec<u32>> |
| Maps | 3 | empty, sorted string->i32, sorted string->struct |
| Structs | 3 | simple Point3D, LabelledValue, nested Segment |
| Native Booleans | 2 | true (0x01), false (0x00) |
| char8 | 2 | 'A', '\0' |
| Fixed-size Arrays | 2 | uint32[3], float64[2] |
| Optional | 3 | Some(u32), None, Some(string) |
| BTreeMap | 1 | deterministic string->i32 (wire-identical to sorted HashMap) |
Determinism Guarantees
- Sorted-key maps: All map vectors use
BTreeMapinternally to guarantee deterministic key ordering on the wire - Canonical NaN: IEEE 754 canonical NaN (
0x7FF8000000000000) used consistently - No HashMap in vectors: Only
BTreeMapto ensure byte-identical output across runs
How to Use
- Download the
.binfiles from the golden vectors directory - Serialize your own implementation's output for the same type and value
- Compare byte-for-byte against the golden vector
- Roundtrip: deserialize the golden
.binand re-serialize, output must match exactly
# Run HDDS golden vector tests
cd crates/hdds
cargo test golden
# Regenerate vectors (maintainers only)
GOLDEN_REGEN=1 cargo test golden
Each vector also has a .hex file with an annotated hex dump for manual inspection.
Downloads
Golden vectors are available in the HDDS source repository: