blob: 45c14a775ab19d5a7475728eec67ebb4305cc96a [file] [log] [blame]
// Copyright 2021 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
success("TableNoFields") {
value = StructTableNoFields{
t: TableNoFields{},
},
bytes = {
v1, v2 = [
0x00, 0x00, 0x00, 0x00, // Table_NoFields.vector<envelope>.size
0x00, 0x00, 0x00, 0x00, // [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // Table_NoFields.vector<envelope>.presence
0xFF, 0xFF, 0xFF, 0xFF, // [cont.]
],
},
}
success("TableTwoReservedFields") {
value = StructTableTwoReservedFields{
t: TableTwoReservedFields{},
},
bytes = {
v1, v2 = [
0x00, 0x00, 0x00, 0x00, // Table_TwoReservedFields.vector<envelope>.size
0x00, 0x00, 0x00, 0x00, // [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // Table_TwoReservedFields.vector<envelope>.presence
0xFF, 0xFF, 0xFF, 0xFF, // [cont.]
],
},
}
success("TableStructWithReservedSandwich") {
value = TableStructWithReservedSandwichStruct{
table: TableStructWithReservedSandwich{
s1: StructSize3Align1{
three_bytes: [0x09, 0x0a, 0x0b],
},
s2: StructSize3Align1{
three_bytes: [0x19, 0x1a, 0x1b],
},
},
},
bytes = {
v1 = [
0x03, 0x00, 0x00, 0x00, // TableStructWithReservedSandwich.vector<envelope>.size
0x00, 0x00, 0x00, 0x00, // [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // TableStructWithReservedSandwich.vector<envelope>.presence
0xFF, 0xFF, 0xFF, 0xFF, // [cont.]
0x00, 0x00, 0x00, 0x00, // vector<envelope>[0].num_bytes 0x10
0x00, 0x00, 0x00, 0x00, // vector<envelope>[0].num_handles
0x00, 0x00, 0x00, 0x00, // vector<envelope>[0].presence
0x00, 0x00, 0x00, 0x00, // vector<envelope>[0].presence [cont.]
0x08, 0x00, 0x00, 0x00, // vector<envelope>[1].num_bytes 0x20
0x00, 0x00, 0x00, 0x00, // vector<envelope>[1].num_handles
0xFF, 0xFF, 0xFF, 0xFF, // vector<envelope>[1].presence
0xFF, 0xFF, 0xFF, 0xFF, // vector<envelope>[1].presence [cont.]
0x08, 0x00, 0x00, 0x00, // vector<envelope>[2].num_bytes 0x30
0x00, 0x00, 0x00, 0x00, // vector<envelope>[2].num_handles
0xFF, 0xFF, 0xFF, 0xFF, // vector<envelope>[2].presence
0xFF, 0xFF, 0xFF, 0xFF, // vector<envelope>[2].presence [cont.]
0x09, 0x0A, 0x0B, 0x00, // StructSize3Alignment1 data (3 bytes) + padding (1 byte) 0x40
0x00, 0x00, 0x00, 0x00, // StructSize3Alignment1 padding [cont.]
0x19, 0x1A, 0x1B, 0x00, // StructSize3Alignment1 data (3 bytes) + padding (1 byte)
0x00, 0x00, 0x00, 0x00, // StructSize3Alignment1 padding [cont.]
],
v2 = [
0x03, 0x00, 0x00, 0x00, // vector<envelope>.size
0x00, 0x00, 0x00, 0x00, // [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // TableStructWithReservedSandwich.vector<envelope>.presence
0xFF, 0xFF, 0xFF, 0xFF, // [cont.]
0x00, 0x00, 0x00, 0x00, // vector<envelope>[0].num_bytes
0x00, 0x00, 0x00, 0x00, // vector<envelope>[0].num_handles
0x09, 0x0A, 0x0B, 0x00, // vector<envelope>[1].value
0x00, 0x00, 0x01, 0x00, // vector<envelope>[1].num_handles, vector<envelope>[1].inlined
0x19, 0x1A, 0x1B, 0x00, // vector<envelope>[2].value
0x00, 0x00, 0x01, 0x00, // vector<envelope>[2].num_handles, vector<envelope>[2].inlined
],
},
}
success("TableStructWithUint32Sandwich") {
value = TableStructWithUint32SandwichStruct{
table: TableStructWithUint32Sandwich{
i: 0x04030201,
s1: StructSize3Align1{
three_bytes: [0x09, 0x0a, 0x0b],
},
s2: StructSize3Align1{
three_bytes: [0x19, 0x1a, 0x1b],
},
i2: 0x0d0c0b0a,
},
},
bytes = {
v1 = [
0x04, 0x00, 0x00, 0x00, // TableStructWithUint32Sandwich.vector<envelope>.size
0x00, 0x00, 0x00, 0x00, // [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // TableStructWithUint32Sandwich.vector<envelope>.presence
0xFF, 0xFF, 0xFF, 0xFF, // [cont.]
0x08, 0x00, 0x00, 0x00, // vector<envelope>[0].num_bytes 0x10
0x00, 0x00, 0x00, 0x00, // vector<envelope>[0].num_handles
0xFF, 0xFF, 0xFF, 0xFF, // vector<envelope>[0].presence
0xFF, 0xFF, 0xFF, 0xFF, // vector<envelope>[0].presence [cont.]
0x08, 0x00, 0x00, 0x00, // vector<envelope>[1].num_bytes 0x20
0x00, 0x00, 0x00, 0x00, // vector<envelope>[1].num_handles
0xFF, 0xFF, 0xFF, 0xFF, // vector<envelope>[1].presence
0xFF, 0xFF, 0xFF, 0xFF, // vector<envelope>[1].presence [cont.]
0x08, 0x00, 0x00, 0x00, // vector<envelope>[2].num_bytes 0x30
0x00, 0x00, 0x00, 0x00, // vector<envelope>[2].num_handles
0xFF, 0xFF, 0xFF, 0xFF, // vector<envelope>[2].presence
0xFF, 0xFF, 0xFF, 0xFF, // vector<envelope>[2].presence [cont.]
0x08, 0x00, 0x00, 0x00, // vector<envelope>[3].num_bytes 0x40
0x00, 0x00, 0x00, 0x00, // vector<envelope>[3].num_handles
0xFF, 0xFF, 0xFF, 0xFF, // vector<envelope>[3].presence
0xFF, 0xFF, 0xFF, 0xFF, // vector<envelope>[3].presence [cont.]
0x01, 0x02, 0x03, 0x04, // i 0x50
0x00, 0x00, 0x00, 0x00, // i padding
0x09, 0x0A, 0x0B, 0x00, // StructSize3Alignment1 data (3 bytes) + padding (1 byte)
0x00, 0x00, 0x00, 0x00, // StructSize3Alignment1 padding [cont.]
0x19, 0x1A, 0x1B, 0x00, // StructSize3Alignment1 data (3 bytes) + padding (1 byte) 0x60
0x00, 0x00, 0x00, 0x00, // StructSize3Alignment1 padding [cont.]
0x0A, 0x0B, 0x0C, 0x0D, // i2
0x00, 0x00, 0x00, 0x00, // i2 padding
],
v2 = [
0x04, 0x00, 0x00, 0x00, // TableStructWithUint32Sandwich.vector<envelope>.size
0x00, 0x00, 0x00, 0x00, // [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // TableStructWithUint32Sandwich.vector<envelope>.presence
0xFF, 0xFF, 0xFF, 0xFF, // [cont.]
0x01, 0x02, 0x03, 0x04, // vector<envelope>[0].inlined_value
0x00, 0x00, 0x01, 0x00, // vector<envelope>[0].num_handles, vector<envelope>[0].inline_flag
0x09, 0x0A, 0x0B, 0x00, // vector<envelope>[1].inlined_value
0x00, 0x00, 0x01, 0x00, // vector<envelope>[1].num_handles, vector<envelope>[1].inline_flag
0x19, 0x1A, 0x1B, 0x00, // vector<envelope>[2].inlined_value
0x00, 0x00, 0x01, 0x00, // vector<envelope>[2].num_handles, vector<envelope>[1].inline_flag
0x0A, 0x0B, 0x0C, 0x0D, // vector<envelope>[3].inlined_value
0x00, 0x00, 0x01, 0x00, // vector<envelope>[3].num_handles, vector<envelope>[1].inline_flag
],
},
}
success("TableUnionWithVectorReservedSandwich") {
value = TableUnionWithVectorReservedSandwichStruct{
table: TableUnionWithVectorReservedSandwich{
uv: UnionWithVector{
s: "hello",
},
},
},
bytes = {
v1 = [
0x02, 0x00, 0x00, 0x00, // Table_UnionWithVector_ReservedSandwich.vector<envelope>.size
0x00, 0x00, 0x00, 0x00, // [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // Table_UnionWithVector_ReservedSandwich.vector<envelope>.presence
0xFF, 0xFF, 0xFF, 0xFF, // [cont.]
0x00, 0x00, 0x00, 0x00, // vector<envelope>[0].num_bytes 0x10
0x00, 0x00, 0x00, 0x00, // vector<envelope>[0].num_handles
0x00, 0x00, 0x00, 0x00, // vector<envelope>[0].presence (absent)
0x00, 0x00, 0x00, 0x00, // vector<envelope>[0].presence (absent) [cont.]
0x30, 0x00, 0x00, 0x00, // vector<envelope>[1].num_bytes 0x20
0x00, 0x00, 0x00, 0x00, // vector<envelope>[1].num_handles
0xFF, 0xFF, 0xFF, 0xFF, // vector<envelope>[1].presence
0xFF, 0xFF, 0xFF, 0xFF, // vector<envelope>[1].presence [cont.]
0x03, 0x00, 0x00, 0x00, // UnionWithVector.tag (string) 0x30
0x00, 0x00, 0x00, 0x00, // UnionWithVector.tag padding
0x18, 0x00, 0x00, 0x00, // UnionWithVector.num_bytes
0x00, 0x00, 0x00, 0x00, // UnionWithVector.num_handles
0xFF, 0xFF, 0xFF, 0xFF, // UnionWithVector.presence
0xFF, 0xFF, 0xFF, 0xFF, // UnionWithVector.presence [cont.]
0x05, 0x00, 0x00, 0x00, // string.size
0x00, 0x00, 0x00, 0x00, // string.size [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // string.presence 0x40
0xFF, 0xFF, 0xFF, 0xFF, // string.presence [cont.]
0x68, 0x65, 0x6c, 0x6c, // "hello" 0x50
0x6f, 0x00, 0x00, 0x00, // "hello" [cont.] and padding
],
v2 = [
0x02, 0x00, 0x00, 0x00, // Table_UnionWithVector_ReservedSandwich.vector<envelope>.size
0x00, 0x00, 0x00, 0x00, // [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // Table_UnionWithVector_ReservedSandwich.vector<envelope>.presence
0xFF, 0xFF, 0xFF, 0xFF, // [cont.]
0x00, 0x00, 0x00, 0x00, // vector<envelope>[0].num_bytes
0x00, 0x00, 0x00, 0x00, // vector<envelope>[0].num_handles
0x28, 0x00, 0x00, 0x00, // vector<envelope>[1].num_bytes
0x00, 0x00, 0x00, 0x00, // vector<envelope>[1].num_handles
0x03, 0x00, 0x00, 0x00, // UnionWithVector.tag (string)
0x00, 0x00, 0x00, 0x00, // UnionWithVector.tag padding
0x18, 0x00, 0x00, 0x00, // UnionWithVector.num_bytes
0x00, 0x00, 0x00, 0x00, // UnionWithVector.num_handles
0x05, 0x00, 0x00, 0x00, // string.size
0x00, 0x00, 0x00, 0x00, // string.size [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // string.presence
0xFF, 0xFF, 0xFF, 0xFF, // string.presence [cont.]
0x68, 0x65, 0x6c, 0x6c, // "hello"
0x6f, 0x00, 0x00, 0x00, // "hello" [cont.] and padding
],
},
}
success("TableUnionWithVectorStructSandwich") {
value = TableUnionWithVectorStructSandwichStruct{
table: TableUnionWithVectorStructSandwich{
s1: StructSize3Align1{
three_bytes: [0x01, 0x02, 0x03],
},
uv: UnionWithVector{
s: "hello",
},
s2: StructSize3Align1{
three_bytes: [0x04, 0x05, 0x06],
},
},
},
bytes = {
v1 = [
0x03, 0x00, 0x00, 0x00, // Table_UnionWithVector_StructSandwich.vector<envelope>.size
0x00, 0x00, 0x00, 0x00, // [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // Table_UnionWithVector_StructSandwich.vector<envelope>.presence
0xFF, 0xFF, 0xFF, 0xFF, // [cont.]
0x08, 0x00, 0x00, 0x00, // vector<envelope>[0].num_bytes 0x10
0x00, 0x00, 0x00, 0x00, // vector<envelope>[0].num_handles
0xFF, 0xFF, 0xFF, 0xFF, // vector<envelope>[0].presence
0xFF, 0xFF, 0xFF, 0xFF, // vector<envelope>[0].presence [cont.]
0x30, 0x00, 0x00, 0x00, // vector<envelope>[1].num_bytes 0x20
0x00, 0x00, 0x00, 0x00, // vector<envelope>[1].num_handles
0xFF, 0xFF, 0xFF, 0xFF, // vector<envelope>[1].presence
0xFF, 0xFF, 0xFF, 0xFF, // vector<envelope>[1].presence [cont.]
0x08, 0x00, 0x00, 0x00, // vector<envelope>[2].num_bytes 0x30
0x00, 0x00, 0x00, 0x00, // vector<envelope>[2].num_handles
0xFF, 0xFF, 0xFF, 0xFF, // vector<envelope>[2].presence
0xFF, 0xFF, 0xFF, 0xFF, // vector<envelope>[2].presence [cont.]
0x01, 0x02, 0x03, 0x00, // s1.three_bytes and padding 0x40
0x00, 0x00, 0x00, 0x00, // s1 padding
0x03, 0x00, 0x00, 0x00, // UnionWithVector.xunion.ordinal (string)
0x00, 0x00, 0x00, 0x00, // UnionWithVector.xunion.padding
0x18, 0x00, 0x00, 0x00, // UnionWithVector.xunion.envelope.size 0x50
0x00, 0x00, 0x00, 0x00, // UnionWithVector.xunion.envelope.size [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // UnionWithVector.xunion.envelope.presence
0xFF, 0xFF, 0xFF, 0xFF, // UnionWithVector.xunion.envelope.presence [cont.]
0x05, 0x00, 0x00, 0x00, // string.size 0x60
0x00, 0x00, 0x00, 0x00, // string.size [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // string.presence
0xFF, 0xFF, 0xFF, 0xFF, // string.presence [cont.]
0x68, 0x65, 0x6c, 0x6c, // "hello" 0x70
0x6f, 0x00, 0x00, 0x00, // "hello" [cont.] and padding
0x04, 0x05, 0x06, 0x00, // s2.three_bytes and padding 0x80
0x00, 0x00, 0x00, 0x00, // s2 padding
],
v2 = [
0x03, 0x00, 0x00, 0x00, // Table_UnionWithVector_StructSandwich.vector<envelope>.size
0x00, 0x00, 0x00, 0x00, // [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // Table_UnionWithVector_StructSandwich.vector<envelope>.presence
0xFF, 0xFF, 0xFF, 0xFF, // [cont.]
0x01, 0x02, 0x03, 0x00, // vector<envelope>[0].num_bytes 0x10
0x00, 0x00, 0x01, 0x00, // vector<envelope>[0].num_handles
0x28, 0x00, 0x00, 0x00, // vector<envelope>[1].num_bytes 0x20
0x00, 0x00, 0x00, 0x00, // vector<envelope>[1].num_handles
0x04, 0x05, 0x06, 0x00, // vector<envelope>[2].num_bytes 0x30
0x00, 0x00, 0x01, 0x00, // vector<envelope>[2].num_handles
0x03, 0x00, 0x00, 0x00, // UnionWithVector.xunion.ordinal (string)
0x00, 0x00, 0x00, 0x00, // UnionWithVector.xunion.padding
0x18, 0x00, 0x00, 0x00, // UnionWithVector.xunion.envelope.size 0x50
0x00, 0x00, 0x00, 0x00, // UnionWithVector.xunion.envelope.size [cont.]
0x05, 0x00, 0x00, 0x00, // string.size 0x60
0x00, 0x00, 0x00, 0x00, // string.size [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // string.presence
0xFF, 0xFF, 0xFF, 0xFF, // string.presence [cont.]
0x68, 0x65, 0x6c, 0x6c, // "hello" 0x70
0x6f, 0x00, 0x00, 0x00, // "hello" [cont.] and padding
],
},
}
success("ArrayStruct") {
value = ArrayStruct{
unions: [
StringUnion{
s: "one",
},
StringUnion{
s: "two",
},
StringUnion{
s: "three",
},
],
optional_unions: [
StringUnion{
s: "four",
},
StringUnion{
s: "five",
},
StringUnion{
s: "six",
},
],
},
bytes = {
v1 = [
0x02, 0x00, 0x00, 0x00, // unions[0].tag 0x00
0x00, 0x00, 0x00, 0x00, // unions[0].tag (padding)
0x18, 0x00, 0x00, 0x00, // unions[0].envelope.num_bytes
0x00, 0x00, 0x00, 0x00, // unions[0].envelope.num_handles
0xFF, 0xFF, 0xFF, 0xFF, // unions[0].presence 0x10
0xFF, 0xFF, 0xFF, 0xFF, // unions[0].presence [cont.]
0x02, 0x00, 0x00, 0x00, // unions[1].tag
0x00, 0x00, 0x00, 0x00, // unions[1].tag (padding)
0x18, 0x00, 0x00, 0x00, // unions[1].envelope.num_bytes 0x20
0x00, 0x00, 0x00, 0x00, // unions[1].envelope.num_handles
0xFF, 0xFF, 0xFF, 0xFF, // unions[1].presence
0xFF, 0xFF, 0xFF, 0xFF, // unions[1].presence [cont.]
0x02, 0x00, 0x00, 0x00, // unions[2].tag 0x30
0x00, 0x00, 0x00, 0x00, // unions[2].tag (padding)
0x18, 0x00, 0x00, 0x00, // unions[2].envelope.num_bytes
0x00, 0x00, 0x00, 0x00, // unions[2].envelope.num_handles
0xFF, 0xFF, 0xFF, 0xFF, // unions[2].presence 0x40
0xFF, 0xFF, 0xFF, 0xFF, // unions[2].presence [cont.]
0x02, 0x00, 0x00, 0x00, // optional_unions[0].tag
0x00, 0x00, 0x00, 0x00, // optional_unions[0].tag (padding)
0x18, 0x00, 0x00, 0x00, // optional_unions[0].envelope.num_bytes 0x50
0x00, 0x00, 0x00, 0x00, // optional_unions[0].envelope.num_handles
0xFF, 0xFF, 0xFF, 0xFF, // optional_unions[0].presence
0xFF, 0xFF, 0xFF, 0xFF, // optional_unions[0].presence [cont.]
0x02, 0x00, 0x00, 0x00, // optional_unions[1].tag 0x60
0x00, 0x00, 0x00, 0x00, // optional_unions[1].tag (padding)
0x18, 0x00, 0x00, 0x00, // optional_unions[1].envelope.num_bytes
0x00, 0x00, 0x00, 0x00, // optional_unions[1].envelope.num_handles
0xFF, 0xFF, 0xFF, 0xFF, // optional_unions[1].presence 0x70
0xFF, 0xFF, 0xFF, 0xFF, // optional_unions[1].presence [cont.]
0x02, 0x00, 0x00, 0x00, // optional_unions[2].tag
0x00, 0x00, 0x00, 0x00, // optional_unions[2].tag (padding)
0x18, 0x00, 0x00, 0x00, // optional_unions[2].envelope.num_bytes 0x80
0x00, 0x00, 0x00, 0x00, // optional_unions[2].envelope.num_handles
0xFF, 0xFF, 0xFF, 0xFF, // optional_unions[2].presence
0xFF, 0xFF, 0xFF, 0xFF, // optional_unions[2].presence [cont.]
0x03, 0x00, 0x00, 0x00, // unions[0] data: StringUnion.s.size 0x90
0x00, 0x00, 0x00, 0x00, // unions[0] data: StringUnion.s.size [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // unions[0] data: StringUnion.s.presence
0xFF, 0xFF, 0xFF, 0xFF, // unions[0] data: StringUnion.s.presence [cont.]
0x6F, 0x6E, 0x65, 0x00, // unions[0].s data ("one")
0x00, 0x00, 0x00, 0x00, // unions[0].s data: StringUnion.s data padding
0x03, 0x00, 0x00, 0x00, // unions[1] data: StringUnion.s.size
0x00, 0x00, 0x00, 0x00, // unions[1] data: StringUnion.s.size [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // unions[1] data: StringUnion.s.presence 0xb0
0xFF, 0xFF, 0xFF, 0xFF, // unions[1] data: StringUnion.s.presence [cont.]
0x74, 0x77, 0x6F, 0x00, // unions[1].s data ("two")
0x00, 0x00, 0x00, 0x00, // unions[1].s data padding
0x05, 0x00, 0x00, 0x00, // unions[2] data: StringUnion.s.size 0xc0
0x00, 0x00, 0x00, 0x00, // unions[2] data: StringUnion.s.size [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // unions[2] data: StringUnion.s.presence
0xFF, 0xFF, 0xFF, 0xFF, // unions[2] data: StringUnion.s.presence [cont.]
0x74, 0x68, 0x72, 0x65, // unions[2].s data ("three") 0xd0
0x65, 0x00, 0x00, 0x00, // unions[2].s data padding
0x04, 0x00, 0x00, 0x00, // optional_unions[0] data: StringUnion.s.size
0x00, 0x00, 0x00, 0x00, // optional_unions[0] data: StringUnion.s.size [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // optional_unions[0] data: StringUnion.s.presence 0xe0
0xFF, 0xFF, 0xFF, 0xFF, // optional_unions[0] data: StringUnion.s.presence [cont.]
0x66, 0x6F, 0x75, 0x72, // optional_unions[0].s data ("four")
0x00, 0x00, 0x00, 0x00, // optional_unions[0].s data padding
0x04, 0x00, 0x00, 0x00, // optional_unions[1] data: StringUnion.s.size 0xf0
0x00, 0x00, 0x00, 0x00, // optional_unions[1] data: StringUnion.s.size [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // optional_unions[1] data: StringUnion.s.presence
0xFF, 0xFF, 0xFF, 0xFF, // optional_unions[1] data: StringUnion.s.presence [cont.]
0x66, 0x69, 0x76, 0x65, // optional_unions[1].s data ("five")
0x00, 0x00, 0x00, 0x00, // optional_unions[1].s data padding
0x03, 0x00, 0x00, 0x00, // optional_unions[2] data: StringUnion.s.size
0x00, 0x00, 0x00, 0x00, // optional_unions[2] data: StringUnion.s.size [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // optional_unions[2] data: StringUnion.s.presence
0xFF, 0xFF, 0xFF, 0xFF, // optional_unions[2] data: StringUnion.s.presence [cont.]
0x73, 0x69, 0x78, 0x00, // optional_unions[2].s data ("six")
0x00, 0x00, 0x00, 0x00, // optional_unions[2].s data padding
],
v2 = [
0x02, 0x00, 0x00, 0x00, // unions[0].tag 0x00
0x00, 0x00, 0x00, 0x00, // unions[0].tag (padding)
0x18, 0x00, 0x00, 0x00, // unions[0].envelope.num_bytes
0x00, 0x00, 0x00, 0x00, // unions[0].envelope.num_handles
0x02, 0x00, 0x00, 0x00, // unions[1].tag
0x00, 0x00, 0x00, 0x00, // unions[1].tag (padding)
0x18, 0x00, 0x00, 0x00, // unions[1].envelope.num_bytes 0x20
0x00, 0x00, 0x00, 0x00, // unions[1].envelope.num_handles
0x02, 0x00, 0x00, 0x00, // unions[2].tag 0x30
0x00, 0x00, 0x00, 0x00, // unions[2].tag (padding)
0x18, 0x00, 0x00, 0x00, // unions[2].envelope.num_bytes
0x00, 0x00, 0x00, 0x00, // unions[2].envelope.num_handles
0x02, 0x00, 0x00, 0x00, // optional_unions[0].tag
0x00, 0x00, 0x00, 0x00, // optional_unions[0].tag (padding)
0x18, 0x00, 0x00, 0x00, // optional_unions[0].envelope.num_bytes 0x50
0x00, 0x00, 0x00, 0x00, // optional_unions[0].envelope.num_handles
0x02, 0x00, 0x00, 0x00, // optional_unions[1].tag 0x60
0x00, 0x00, 0x00, 0x00, // optional_unions[1].tag (padding)
0x18, 0x00, 0x00, 0x00, // optional_unions[1].envelope.num_bytes
0x00, 0x00, 0x00, 0x00, // optional_unions[1].envelope.num_handles
0x02, 0x00, 0x00, 0x00, // optional_unions[2].tag
0x00, 0x00, 0x00, 0x00, // optional_unions[2].tag (padding)
0x18, 0x00, 0x00, 0x00, // optional_unions[2].envelope.num_bytes 0x80
0x00, 0x00, 0x00, 0x00, // optional_unions[2].envelope.num_handles
0x03, 0x00, 0x00, 0x00, // unions[0] data: StringUnion.s.size 0x90
0x00, 0x00, 0x00, 0x00, // unions[0] data: StringUnion.s.size [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // unions[0] data: StringUnion.s.presence
0xFF, 0xFF, 0xFF, 0xFF, // unions[0] data: StringUnion.s.presence [cont.]
0x6F, 0x6E, 0x65, 0x00, // unions[0].s data ("one")
0x00, 0x00, 0x00, 0x00, // unions[0].s data: StringUnion.s data padding
0x03, 0x00, 0x00, 0x00, // unions[1] data: StringUnion.s.size
0x00, 0x00, 0x00, 0x00, // unions[1] data: StringUnion.s.size [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // unions[1] data: StringUnion.s.presence 0xb0
0xFF, 0xFF, 0xFF, 0xFF, // unions[1] data: StringUnion.s.presence [cont.]
0x74, 0x77, 0x6F, 0x00, // unions[1].s data ("two")
0x00, 0x00, 0x00, 0x00, // unions[1].s data padding
0x05, 0x00, 0x00, 0x00, // unions[2] data: StringUnion.s.size 0xc0
0x00, 0x00, 0x00, 0x00, // unions[2] data: StringUnion.s.size [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // unions[2] data: StringUnion.s.presence
0xFF, 0xFF, 0xFF, 0xFF, // unions[2] data: StringUnion.s.presence [cont.]
0x74, 0x68, 0x72, 0x65, // unions[2].s data ("three") 0xd0
0x65, 0x00, 0x00, 0x00, // unions[2].s data padding
0x04, 0x00, 0x00, 0x00, // optional_unions[0] data: StringUnion.s.size
0x00, 0x00, 0x00, 0x00, // optional_unions[0] data: StringUnion.s.size [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // optional_unions[0] data: StringUnion.s.presence 0xe0
0xFF, 0xFF, 0xFF, 0xFF, // optional_unions[0] data: StringUnion.s.presence [cont.]
0x66, 0x6F, 0x75, 0x72, // optional_unions[0].s data ("four")
0x00, 0x00, 0x00, 0x00, // optional_unions[0].s data padding
0x04, 0x00, 0x00, 0x00, // optional_unions[1] data: StringUnion.s.size 0xf0
0x00, 0x00, 0x00, 0x00, // optional_unions[1] data: StringUnion.s.size [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // optional_unions[1] data: StringUnion.s.presence
0xFF, 0xFF, 0xFF, 0xFF, // optional_unions[1] data: StringUnion.s.presence [cont.]
0x66, 0x69, 0x76, 0x65, // optional_unions[1].s data ("five")
0x00, 0x00, 0x00, 0x00, // optional_unions[1].s data padding
0x03, 0x00, 0x00, 0x00, // optional_unions[2] data: StringUnion.s.size
0x00, 0x00, 0x00, 0x00, // optional_unions[2] data: StringUnion.s.size [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // optional_unions[2] data: StringUnion.s.presence
0xFF, 0xFF, 0xFF, 0xFF, // optional_unions[2] data: StringUnion.s.presence [cont.]
0x73, 0x69, 0x78, 0x00, // optional_unions[2].s data ("six")
0x00, 0x00, 0x00, 0x00, // optional_unions[2].s data padding
],
},
}
success("TransformerEmptyStruct") {
value = TransformerEmptyStruct{},
bytes = {
v1, v2 = [
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
],
},
}
success("EmptyStructUnion") {
value = EmptyStructUnionStruct{
u: EmptyStructUnion{
es: TransformerEmptyStruct{},
},
},
bytes = {
v1 = [
0x02, 0x00, 0x00, 0x00, // 0x00
0x00, 0x00, 0x00, 0x00, //
0x08, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xFF, 0xFF, 0xFF, 0xFF, // 0x10
0xFF, 0xFF, 0xFF, 0xFF, //
0x00, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
],
v2 = [
0x02, 0x00, 0x00, 0x00, // 0x00
0x00, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, // num bytes
0x00, 0x00, 0x01, 0x00, // num_handles, inlined
],
},
}
success("NoCodingTablesStressor") {
value = NoCodingTablesStressor{
f1: 0x1111111111111111,
f2: 0x2222222222222222,
u1: UnionSize36Align4{
variant: [
0x33, 0x33, 0x33, 0x33,
0x33, 0x33, 0x33, 0x33,
0x33, 0x33, 0x33, 0x33,
0x33, 0x33, 0x33, 0x33,
0x33, 0x33, 0x33, 0x33,
0x33, 0x33, 0x33, 0x33,
0x33, 0x33, 0x33, 0x33,
0x33, 0x33, 0x33, 0x33,
],
},
f3: 0x4444444444444444,
f4: 0x5555555555555555,
u2: UnionSize36Align4{
variant: [
0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66,
],
},
f5: 0x7777777777777777,
f6: 0x8888888888888888,
u3: UnionSize36Align4{
variant: [
0x99, 0x99, 0x99, 0x99,
0x99, 0x99, 0x99, 0x99,
0x99, 0x99, 0x99, 0x99,
0x99, 0x99, 0x99, 0x99,
0x99, 0x99, 0x99, 0x99,
0x99, 0x99, 0x99, 0x99,
0x99, 0x99, 0x99, 0x99,
0x99, 0x99, 0x99, 0x99,
],
},
f7: 0xaaaaaaaaaaaaaaaa,
p1: Size8Align8{
data: 0xeeeeeeeeeeeeeeee,
},
f8: 0xbbbbbbbbbbbbbbbb,
p2: Size8Align8{
data: 0xeeeeeeeeeeeeeeee,
},
f9: 0xdddddddddddddddd,
},
bytes = {
v1 = [
0x11, 0x11, 0x11, 0x11, // 0x00
0x11, 0x11, 0x11, 0x11, //
0x22, 0x22, 0x22, 0x22, //
0x22, 0x22, 0x22, 0x22, //
0x04, 0x00, 0x00, 0x00, // 0x10
0x00, 0x00, 0x00, 0x00, //
0x20, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, // 0x20
0xff, 0xff, 0xff, 0xff, //
0x44, 0x44, 0x44, 0x44, //
0x44, 0x44, 0x44, 0x44, //
0x55, 0x55, 0x55, 0x55, // 0x30
0x55, 0x55, 0x55, 0x55, //
0x04, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0x20, 0x00, 0x00, 0x00, // 0x40
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
0x77, 0x77, 0x77, 0x77, // 0x50
0x77, 0x77, 0x77, 0x77, //
0x88, 0x88, 0x88, 0x88, //
0x88, 0x88, 0x88, 0x88, //
0x04, 0x00, 0x00, 0x00, // 0x60
0x00, 0x00, 0x00, 0x00, //
0x20, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, // 0x70
0xff, 0xff, 0xff, 0xff, //
0xaa, 0xaa, 0xaa, 0xaa, //
0xaa, 0xaa, 0xaa, 0xaa, //
0xff, 0xff, 0xff, 0xff, // 0x80
0xff, 0xff, 0xff, 0xff, //
0xbb, 0xbb, 0xbb, 0xbb, //
0xbb, 0xbb, 0xbb, 0xbb, //
0xff, 0xff, 0xff, 0xff, // 0x90
0xff, 0xff, 0xff, 0xff, //
0xdd, 0xdd, 0xdd, 0xdd, //
0xdd, 0xdd, 0xdd, 0xdd, //
// out-of-line
0x33, 0x33, 0x33, 0x33, // 0xa0
0x33, 0x33, 0x33, 0x33, //
0x33, 0x33, 0x33, 0x33, //
0x33, 0x33, 0x33, 0x33, //
0x33, 0x33, 0x33, 0x33, // 0xb0
0x33, 0x33, 0x33, 0x33, //
0x33, 0x33, 0x33, 0x33, //
0x33, 0x33, 0x33, 0x33, //
0x66, 0x66, 0x66, 0x66, // 0xc0
0x66, 0x66, 0x66, 0x66, //
0x66, 0x66, 0x66, 0x66, //
0x66, 0x66, 0x66, 0x66, //
0x66, 0x66, 0x66, 0x66, // 0xd0
0x66, 0x66, 0x66, 0x66, //
0x66, 0x66, 0x66, 0x66, //
0x66, 0x66, 0x66, 0x66, //
0x99, 0x99, 0x99, 0x99, // 0xe0
0x99, 0x99, 0x99, 0x99, //
0x99, 0x99, 0x99, 0x99, //
0x99, 0x99, 0x99, 0x99, //
0x99, 0x99, 0x99, 0x99, // 0xf0
0x99, 0x99, 0x99, 0x99, //
0x99, 0x99, 0x99, 0x99, //
0x99, 0x99, 0x99, 0x99, //
0xee, 0xee, 0xee, 0xee, // 0x100
0xee, 0xee, 0xee, 0xee, //
0xee, 0xee, 0xee, 0xee, //
0xee, 0xee, 0xee, 0xee, //
],
v2 = [
0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11,
0x22, 0x22, 0x22, 0x22,
0x22, 0x22, 0x22, 0x22,
0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x20, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x44, 0x44, 0x44, 0x44,
0x44, 0x44, 0x44, 0x44,
0x55, 0x55, 0x55, 0x55,
0x55, 0x55, 0x55, 0x55,
0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x20, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x77, 0x77, 0x77, 0x77,
0x77, 0x77, 0x77, 0x77,
0x88, 0x88, 0x88, 0x88,
0x88, 0x88, 0x88, 0x88,
0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x20, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0xaa, 0xaa, 0xaa, 0xaa,
0xaa, 0xaa, 0xaa, 0xaa,
0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff,
0xbb, 0xbb, 0xbb, 0xbb,
0xbb, 0xbb, 0xbb, 0xbb,
0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff,
0xdd, 0xdd, 0xdd, 0xdd,
0xdd, 0xdd, 0xdd, 0xdd,
// out-of-line
0x33, 0x33, 0x33, 0x33,
0x33, 0x33, 0x33, 0x33,
0x33, 0x33, 0x33, 0x33,
0x33, 0x33, 0x33, 0x33,
0x33, 0x33, 0x33, 0x33,
0x33, 0x33, 0x33, 0x33,
0x33, 0x33, 0x33, 0x33,
0x33, 0x33, 0x33, 0x33,
0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66,
0x99, 0x99, 0x99, 0x99,
0x99, 0x99, 0x99, 0x99,
0x99, 0x99, 0x99, 0x99,
0x99, 0x99, 0x99, 0x99,
0x99, 0x99, 0x99, 0x99,
0x99, 0x99, 0x99, 0x99,
0x99, 0x99, 0x99, 0x99,
0x99, 0x99, 0x99, 0x99,
0xee, 0xee, 0xee, 0xee,
0xee, 0xee, 0xee, 0xee,
0xee, 0xee, 0xee, 0xee,
0xee, 0xee, 0xee, 0xee,
],
},
}
success("OutOfLineSandwich1Case1") {
value = OutOfLineSandwich1{
before: "soft migrations rock!",
v: [
Sandwich1{
before: 0x04030201,
the_union: UnionSize8Align4{
variant: 0x0c0b0a09,
},
after: 0x08070605,
},
],
after: "hard transitions suck!",
},
bytes = {
v1 = [
0x15, 0x00, 0x00, 0x00, // vector<uint8>.size (start of OutOfLineSandwich1.before)
0x00, 0x00, 0x00, 0x00, // vector<uint8>.size [cont.]
0xff, 0xff, 0xff, 0xff, // vector<uint8>.presence
0xff, 0xff, 0xff, 0xff, // vector<uint8>.presence [cont.]
0x01, 0x00, 0x00, 0x00, // vector<Sandwich1>.size (start of OutOfLineSandwich1.v)
0x00, 0x00, 0x00, 0x00, // vector<Sandwich1>.size [cont.]
0xff, 0xff, 0xff, 0xff, // vector<Sandwich1>.presence
0xff, 0xff, 0xff, 0xff, // vector<Sandwich1>.presence [cont.]
0x16, 0x00, 0x00, 0x00, // vector<uint8>.size (start of OutOfLineSandwich1.after)
0x00, 0x00, 0x00, 0x00, // vector<uint8>.size [cont.]
0xff, 0xff, 0xff, 0xff, // vector<uint8>.presence
0xff, 0xff, 0xff, 0xff, // vector<uint8>.presence [cont.]
0x73, 0x6f, 0x66, 0x74, // vector<uint8>.data ("soft migrations rock!")
0x20, 0x6d, 0x69, 0x67, // vector<uint8>.data [cont.]
0x72, 0x61, 0x74, 0x69, // vector<uint8>.data [cont.]
0x6f, 0x6e, 0x73, 0x20, // vector<uint8>.data [cont.]
0x72, 0x6f, 0x63, 0x6b, // vector<uint8>.data [cont.]
0x21, 0x00, 0x00, 0x00, // vector<uint8>.data [cont.] + padding
// vector<Sandwich1>[0]:
0x01, 0x02, 0x03, 0x04, // Sandwich1.before
0x00, 0x00, 0x00, 0x00, // Sandwich1.before (padding)
0x03, 0x00, 0x00, 0x00, // UnionSize8Aligned4.tag, i.e. Sandwich1.the_union
0x00, 0x00, 0x00, 0x00, // UnionSize8Aligned4.padding
0x08, 0x00, 0x00, 0x00, // UnionSize8Aligned4.env.num_bytes
0x00, 0x00, 0x00, 0x00, // UnionSize8Aligned4.env.num_handle
0xff, 0xff, 0xff, 0xff, // UnionSize8Aligned4.env.presence
0xff, 0xff, 0xff, 0xff, // UnionSize8Aligned4.presence [cont.]
0x05, 0x06, 0x07, 0x08, // Sandwich1.after
0x00, 0x00, 0x00, 0x00, // Sandwich1.after (padding)
0x09, 0x0a, 0x0b, 0x0c, // UnionSize8Aligned4.data, i.e. Sandwich1.the_union.data
0x00, 0x00, 0x00, 0x00, // UnionSize8Aligned4.data (padding)
0x68, 0x61, 0x72, 0x64, // vector<uint8>.data ("hard transitions suck!")
0x20, 0x74, 0x72, 0x61, // vector<uint8>.data [cont.]
0x6e, 0x73, 0x69, 0x74, // vector<uint8>.data [cont.]
0x69, 0x6f, 0x6e, 0x73, // vector<uint8>.data [cont.]
0x20, 0x73, 0x75, 0x63, // vector<uint8>.data [cont.]
0x6b, 0x21, 0x00, 0x00, // vector<uint8>.data [cont.] + padding
],
v2 = [
0x15, 0x00, 0x00, 0x00, // vector<uint8>.size (start of OutOfLineSandwich1.before)
0x00, 0x00, 0x00, 0x00, // vector<uint8>.size [cont.]
0xff, 0xff, 0xff, 0xff, // vector<uint8>.presence
0xff, 0xff, 0xff, 0xff, // vector<uint8>.presence [cont.]
0x01, 0x00, 0x00, 0x00, // vector<Sandwich1>.size (start of OutOfLineSandwich1.v)
0x00, 0x00, 0x00, 0x00, // vector<Sandwich1>.size [cont.]
0xff, 0xff, 0xff, 0xff, // vector<Sandwich1>.presence
0xff, 0xff, 0xff, 0xff, // vector<Sandwich1>.presence [cont.]
0x16, 0x00, 0x00, 0x00, // vector<uint8>.size (start of OutOfLineSandwich1.after)
0x00, 0x00, 0x00, 0x00, // vector<uint8>.size [cont.]
0xff, 0xff, 0xff, 0xff, // vector<uint8>.presence
0xff, 0xff, 0xff, 0xff, // vector<uint8>.presence [cont.]
0x73, 0x6f, 0x66, 0x74, // vector<uint8>.data ("soft migrations rock!")
0x20, 0x6d, 0x69, 0x67, // vector<uint8>.data [cont.]
0x72, 0x61, 0x74, 0x69, // vector<uint8>.data [cont.]
0x6f, 0x6e, 0x73, 0x20, // vector<uint8>.data [cont.]
0x72, 0x6f, 0x63, 0x6b, // vector<uint8>.data [cont.]
0x21, 0x00, 0x00, 0x00, // vector<uint8>.data [cont.] + padding
// vector<Sandwich1>[0]:
0x01, 0x02, 0x03, 0x04, // Sandwich1.before
0x00, 0x00, 0x00, 0x00, // Sandwich1.before (padding)
0x03, 0x00, 0x00, 0x00, // UnionSize8Aligned4.tag, i.e. Sandwich1.the_union
0x00, 0x00, 0x00, 0x00, // UnionSize8Aligned4.padding
0x09, 0x0a, 0x0b, 0x0c, // UnionSize8Aligned4.env.num_bytes
0x00, 0x00, 0x01, 0x00, // UnionSize8Aligned4.env.num_handle, UnionSize8Aligned4.env.inlined
0x05, 0x06, 0x07, 0x08, // Sandwich1.after
0x00, 0x00, 0x00, 0x00, // Sandwich1.after (padding)
0x68, 0x61, 0x72, 0x64, // vector<uint8>.data ("hard transitions suck!")
0x20, 0x74, 0x72, 0x61, // vector<uint8>.data [cont.]
0x6e, 0x73, 0x69, 0x74, // vector<uint8>.data [cont.]
0x69, 0x6f, 0x6e, 0x73, // vector<uint8>.data [cont.]
0x20, 0x73, 0x75, 0x63, // vector<uint8>.data [cont.]
0x6b, 0x21, 0x00, 0x00, // vector<uint8>.data [cont.] + padding
],
},
}
success("OutOfLineSandwich1WithOptUnionPresent") {
value = OutOfLineSandwich1WithOptUnion{
before: "soft migrations rock!",
v: [
Sandwich1WithOptUnion{
before: 0x04030201,
opt_union: UnionSize8Align4{
variant: 0x0c0b0a09,
},
after: 0x08070605,
},
],
after: "hard transitions suck!",
},
bytes = {
v1 = [
0x15, 0x00, 0x00, 0x00, // vector<uint8>.size (start of OutOfLineSandwich1.before)
0x00, 0x00, 0x00, 0x00, // vector<uint8>.size [cont.]
0xff, 0xff, 0xff, 0xff, // vector<uint8>.presence
0xff, 0xff, 0xff, 0xff, // vector<uint8>.presence [cont.]
0x01, 0x00, 0x00, 0x00, // vector<Sandwich1>.size (start of OutOfLineSandwich1.v)
0x00, 0x00, 0x00, 0x00, // vector<Sandwich1>.size [cont.]
0xff, 0xff, 0xff, 0xff, // vector<Sandwich1>.presence
0xff, 0xff, 0xff, 0xff, // vector<Sandwich1>.presence [cont.]
0x16, 0x00, 0x00, 0x00, // vector<uint8>.size (start of OutOfLineSandwich1.after)
0x00, 0x00, 0x00, 0x00, // vector<uint8>.size [cont.]
0xff, 0xff, 0xff, 0xff, // vector<uint8>.presence
0xff, 0xff, 0xff, 0xff, // vector<uint8>.presence [cont.]
0x73, 0x6f, 0x66, 0x74, // vector<uint8>.data ("soft migrations rock!")
0x20, 0x6d, 0x69, 0x67, // vector<uint8>.data [cont.]
0x72, 0x61, 0x74, 0x69, // vector<uint8>.data [cont.]
0x6f, 0x6e, 0x73, 0x20, // vector<uint8>.data [cont.]
0x72, 0x6f, 0x63, 0x6b, // vector<uint8>.data [cont.]
0x21, 0x00, 0x00, 0x00, // vector<uint8>.data [cont.] + padding
// vector<Sandwich1>[0]:
0x01, 0x02, 0x03, 0x04, // Sandwich1WithOptUnion.before
0x00, 0x00, 0x00, 0x00, // Sandwich1WithOptUnion.before (padding)
0x03, 0x00, 0x00, 0x00, // UnionSize8Aligned4.tag, i.e. Sandwich1WithOptUnion.union
0x00, 0x00, 0x00, 0x00, // UnionSize8Aligned4.padding
0x08, 0x00, 0x00, 0x00, // UnionSize8Aligned4.env.num_bytes
0x00, 0x00, 0x00, 0x00, // UnionSize8Aligned4.env.num_handle
0xff, 0xff, 0xff, 0xff, // UnionSize8Aligned4.env.presence (present)
0xff, 0xff, 0xff, 0xff, // UnionSize8Aligned4.presence (present) [cont.]
0x05, 0x06, 0x07, 0x08, // Sandwich1WithOptUnion.after
0x00, 0x00, 0x00, 0x00, // Sandwich1WithOptUnion.after (padding)
0x09, 0x0a, 0x0b, 0x0c, // UnionSize8Aligned4.data, i.e. Sandwich1WithOptUnion.union.data
0x00, 0x00, 0x00, 0x00, // UnionSize8Aligned4.data (padding)
0x68, 0x61, 0x72, 0x64, // vector<uint8>.data ("hard transitions suck!")
0x20, 0x74, 0x72, 0x61, // vector<uint8>.data [cont.]
0x6e, 0x73, 0x69, 0x74, // vector<uint8>.data [cont.]
0x69, 0x6f, 0x6e, 0x73, // vector<uint8>.data [cont.]
0x20, 0x73, 0x75, 0x63, // vector<uint8>.data [cont.]
0x6b, 0x21, 0x00, 0x00, // vector<uint8>.data [cont.] + padding
],
v2 = [
0x15, 0x00, 0x00, 0x00, // vector<uint8>.size (start of OutOfLineSandwich1.before)
0x00, 0x00, 0x00, 0x00, // vector<uint8>.size [cont.]
0xff, 0xff, 0xff, 0xff, // vector<uint8>.presence
0xff, 0xff, 0xff, 0xff, // vector<uint8>.presence [cont.]
0x01, 0x00, 0x00, 0x00, // vector<Sandwich1>.size (start of OutOfLineSandwich1.v)
0x00, 0x00, 0x00, 0x00, // vector<Sandwich1>.size [cont.]
0xff, 0xff, 0xff, 0xff, // vector<Sandwich1>.presence
0xff, 0xff, 0xff, 0xff, // vector<Sandwich1>.presence [cont.]
0x16, 0x00, 0x00, 0x00, // vector<uint8>.size (start of OutOfLineSandwich1.after)
0x00, 0x00, 0x00, 0x00, // vector<uint8>.size [cont.]
0xff, 0xff, 0xff, 0xff, // vector<uint8>.presence
0xff, 0xff, 0xff, 0xff, // vector<uint8>.presence [cont.]
0x73, 0x6f, 0x66, 0x74, // vector<uint8>.data ("soft migrations rock!")
0x20, 0x6d, 0x69, 0x67, // vector<uint8>.data [cont.]
0x72, 0x61, 0x74, 0x69, // vector<uint8>.data [cont.]
0x6f, 0x6e, 0x73, 0x20, // vector<uint8>.data [cont.]
0x72, 0x6f, 0x63, 0x6b, // vector<uint8>.data [cont.]
0x21, 0x00, 0x00, 0x00, // vector<uint8>.data [cont.] + padding
// vector<Sandwich1>[0]:
0x01, 0x02, 0x03, 0x04, // Sandwich1WithOptUnion.before
0x00, 0x00, 0x00, 0x00, // Sandwich1WithOptUnion.before (padding)
0x03, 0x00, 0x00, 0x00, // UnionSize8Aligned4.tag, i.e. Sandwich1WithOptUnion.union
0x00, 0x00, 0x00, 0x00, // UnionSize8Aligned4.padding
0x09, 0x0a, 0x0b, 0x0c, // UnionSize8Aligned4.env.num_bytes
0x00, 0x00, 0x01, 0x00, // UnionSize8Aligned4.env.num_handle, UnionSize8Aligned4.env.inlined
0x05, 0x06, 0x07, 0x08, // Sandwich1WithOptUnion.after
0x00, 0x00, 0x00, 0x00, // Sandwich1WithOptUnion.after (padding)
0x68, 0x61, 0x72, 0x64, // vector<uint8>.data ("hard transitions suck!")
0x20, 0x74, 0x72, 0x61, // vector<uint8>.data [cont.]
0x6e, 0x73, 0x69, 0x74, // vector<uint8>.data [cont.]
0x69, 0x6f, 0x6e, 0x73, // vector<uint8>.data [cont.]
0x20, 0x73, 0x75, 0x63, // vector<uint8>.data [cont.]
0x6b, 0x21, 0x00, 0x00, // vector<uint8>.data [cont.] + padding
],
},
}
success("OutOfLineSandwich1WithOptUnionAbsent") {
value = OutOfLineSandwich1WithOptUnion{
before: "soft migrations rock!",
v: [
Sandwich1WithOptUnion{
before: 0x04030201,
after: 0x08070605,
},
],
after: "hard transitions suck!",
},
bytes = {
v1 = [
0x15, 0x00, 0x00, 0x00, // vector<uint8>.size (start of OutOfLineSandwich1.before)
0x00, 0x00, 0x00, 0x00, // vector<uint8>.size [cont.]
0xff, 0xff, 0xff, 0xff, // vector<uint8>.presence
0xff, 0xff, 0xff, 0xff, // vector<uint8>.presence [cont.]
0x01, 0x00, 0x00, 0x00, // vector<Sandwich1>.size (start of OutOfLineSandwich1.v)
0x00, 0x00, 0x00, 0x00, // vector<Sandwich1>.size [cont.]
0xff, 0xff, 0xff, 0xff, // vector<Sandwich1>.presence
0xff, 0xff, 0xff, 0xff, // vector<Sandwich1>.presence [cont.]
0x16, 0x00, 0x00, 0x00, // vector<uint8>.size (start of OutOfLineSandwich1.after)
0x00, 0x00, 0x00, 0x00, // vector<uint8>.size [cont.]
0xff, 0xff, 0xff, 0xff, // vector<uint8>.presence
0xff, 0xff, 0xff, 0xff, // vector<uint8>.presence [cont.]
0x73, 0x6f, 0x66, 0x74, // vector<uint8>.data ("soft migrations rock!")
0x20, 0x6d, 0x69, 0x67, // vector<uint8>.data [cont.]
0x72, 0x61, 0x74, 0x69, // vector<uint8>.data [cont.]
0x6f, 0x6e, 0x73, 0x20, // vector<uint8>.data [cont.]
0x72, 0x6f, 0x63, 0x6b, // vector<uint8>.data [cont.]
0x21, 0x00, 0x00, 0x00, // vector<uint8>.data [cont.] + padding
// vector<Sandwich1>[0]:
0x01, 0x02, 0x03, 0x04, // Sandwich1WithOptUnion.before
0x00, 0x00, 0x00, 0x00, // Sandwich1WithOptUnion.before (padding)
0x00, 0x00, 0x00, 0x00, // UnionSize8Aligned4.tag, i.e. Sandwich1WithOptUnion.opt_union
0x00, 0x00, 0x00, 0x00, // UnionSize8Aligned4.padding
0x00, 0x00, 0x00, 0x00, // UnionSize8Aligned4.env.num_bytes
0x00, 0x00, 0x00, 0x00, // UnionSize8Aligned4.env.num_handle
0x00, 0x00, 0x00, 0x00, // UnionSize8Aligned4.env.presence (absent)
0x00, 0x00, 0x00, 0x00, // UnionSize8Aligned4.env.presence (preabsentsent) [cont.]
0x05, 0x06, 0x07, 0x08, // Sandwich1WithOptUnion.after
0x00, 0x00, 0x00, 0x00, // Sandwich1WithOptUnion.after (padding)
0x68, 0x61, 0x72, 0x64, // vector<uint8>.data ("hard transitions suck!")
0x20, 0x74, 0x72, 0x61, // vector<uint8>.data [cont.]
0x6e, 0x73, 0x69, 0x74, // vector<uint8>.data [cont.]
0x69, 0x6f, 0x6e, 0x73, // vector<uint8>.data [cont.]
0x20, 0x73, 0x75, 0x63, // vector<uint8>.data [cont.]
0x6b, 0x21, 0x00, 0x00, // vector<uint8>.data [cont.] + padding
],
v2 = [
0x15, 0x00, 0x00, 0x00, // vector<uint8>.size (start of OutOfLineSandwich1.before)
0x00, 0x00, 0x00, 0x00, // vector<uint8>.size [cont.]
0xff, 0xff, 0xff, 0xff, // vector<uint8>.presence
0xff, 0xff, 0xff, 0xff, // vector<uint8>.presence [cont.]
0x01, 0x00, 0x00, 0x00, // vector<Sandwich1>.size (start of OutOfLineSandwich1.v)
0x00, 0x00, 0x00, 0x00, // vector<Sandwich1>.size [cont.]
0xff, 0xff, 0xff, 0xff, // vector<Sandwich1>.presence
0xff, 0xff, 0xff, 0xff, // vector<Sandwich1>.presence [cont.]
0x16, 0x00, 0x00, 0x00, // vector<uint8>.size (start of OutOfLineSandwich1.after)
0x00, 0x00, 0x00, 0x00, // vector<uint8>.size [cont.]
0xff, 0xff, 0xff, 0xff, // vector<uint8>.presence
0xff, 0xff, 0xff, 0xff, // vector<uint8>.presence [cont.]
0x73, 0x6f, 0x66, 0x74, // vector<uint8>.data ("soft migrations rock!")
0x20, 0x6d, 0x69, 0x67, // vector<uint8>.data [cont.]
0x72, 0x61, 0x74, 0x69, // vector<uint8>.data [cont.]
0x6f, 0x6e, 0x73, 0x20, // vector<uint8>.data [cont.]
0x72, 0x6f, 0x63, 0x6b, // vector<uint8>.data [cont.]
0x21, 0x00, 0x00, 0x00, // vector<uint8>.data [cont.] + padding
// vector<Sandwich1>[0]:
0x01, 0x02, 0x03, 0x04, // Sandwich1WithOptUnion.before
0x00, 0x00, 0x00, 0x00, // Sandwich1WithOptUnion.before (padding)
0x00, 0x00, 0x00, 0x00, // UnionSize8Aligned4.tag, i.e. Sandwich1WithOptUnion.opt_union
0x00, 0x00, 0x00, 0x00, // UnionSize8Aligned4.padding
0x00, 0x00, 0x00, 0x00, // UnionSize8Aligned4.env.num_bytes
0x00, 0x00, 0x00, 0x00, // UnionSize8Aligned4.env.num_handle
0x05, 0x06, 0x07, 0x08, // Sandwich1WithOptUnion.after
0x00, 0x00, 0x00, 0x00, // Sandwich1WithOptUnion.after (padding)
0x68, 0x61, 0x72, 0x64, // vector<uint8>.data ("hard transitions suck!")
0x20, 0x74, 0x72, 0x61, // vector<uint8>.data [cont.]
0x6e, 0x73, 0x69, 0x74, // vector<uint8>.data [cont.]
0x69, 0x6f, 0x6e, 0x73, // vector<uint8>.data [cont.]
0x20, 0x73, 0x75, 0x63, // vector<uint8>.data [cont.]
0x6b, 0x21, 0x00, 0x00, // vector<uint8>.data [cont.] + padding
],
},
}
success("Regression4") {
value = Regression4{
f1: 1,
f2: 2,
s1: StructSize3Align1{
three_bytes: [0x09, 0x0A, 0x0B],
},
f3: 3,
f4: 4,
f5: 5,
f6: 6,
},
bytes = {
v1, v2 = [
0x01, 0x00, 0x00, 0x00, // f1 (uint8) and padding
0x02, 0x00, 0x00, 0x00, // f2 (uint32)
0x09, 0x0A, 0x0B, 0x03, // StructSize3Alignment1 data (3 bytes) + f3 (uint8)
0x04, 0x00, 0x00, 0x00, // f4 (uint16), f4 padding
0x05, 0x00, 0x00, 0x00, // f5 (uint64)
0x00, 0x00, 0x00, 0x00, // f5
0x06, 0x00, 0x00, 0x00, // f6 (uint8) and padding
0x00, 0x00, 0x00, 0x00, // f6 padding
],
},
}
success("Regression5Enums") {
value = Regression5{
f1: 1,
f2: 0x3231302f,
f3: 0x08,
f4: 0x1615,
f5: 0x64636261605f5e5d,
f6: 0x08,
},
bytes = {
v1, v2 = [
0x01, 0x00, 0x00, 0x00, // f1 (uint8) + padding
0x2f, 0x30, 0x31, 0x32, // f2 (uint32 enum)
0x08, 0x00, 0x15, 0x16, // f3 (uint8 enum) + padding + f4 (uint16)
0x00, 0x00, 0x00, 0x00, // padding
0x5d, 0x5e, 0x5f, 0x60, // f5 (uint64)
0x61, 0x62, 0x63, 0x64, // f5 (uint64) [cont.]
0x08, 0x00, 0x00, 0x00, // f6 (uint8) + padding
0x00, 0x00, 0x00, 0x00, // padding
],
},
}
success("Regression6Bits") {
value = Regression6{
f1: 1,
f2: 0x30000003,
f3: 0x08,
f4: 0x1615,
f5: 0x64636261605f5e5d,
f6: 0x08,
},
bytes = {
v1, v2 = [
0x01, 0x00, 0x00, 0x00, // f1 (uint8) + padding
0x03, 0x00, 0x00, 0x30, // f2 (uint32 bits)
0x08, 0x00, 0x15, 0x16, // f3 (uint8 bits) + padding + f4 (uint16)
0x00, 0x00, 0x00, 0x00, // padding
0x5d, 0x5e, 0x5f, 0x60, // f5 (uint64)
0x61, 0x62, 0x63, 0x64, // f5 (uint64) [cont.]
0x08, 0x00, 0x00, 0x00, // f6 (uint8) + padding
0x00, 0x00, 0x00, 0x00, // padding
],
},
}
success("Regression7TableUnionXUnion") {
value = Regression7TableUnionXUnion{
value: TableOfUnionThenXUnionThenTableThenXUnionThenUnion{
member: UnionOfXUnionThenTableThenXUnionThenUnion{
variant: XUnionOfTableThenXUnionThenUnion{
variant: TableOfXUnionThenUnion{
member: XUnionOfUnion{
variant: UnionAtTheBottom{
tiny: 8,
},
},
},
},
},
},
},
bytes = {
v1 = [
// 0: TableOfUnionThenXUnionThenTableThenXUnionThenUnion header
0x03, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
// 16: TableOfUnionThenXUnionThenTableThenXUnionThenUnion env1
0x00, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
// 32: TableOfUnionThenXUnionThenTableThenXUnionThenUnion env2
0x00, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
// 48: TableOfUnionThenXUnionThenTableThenXUnionThenUnion env3
0x98, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
// 64: UnionOfXUnionThenTableThenXUnionThenUnion-as-xunion header
0x03, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0x80, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
// 88: XUnionOfTableThenXUnionThenUnion header
0x01, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0x68, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
// 112: TableOfXUnionThenUnion header
0x02, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
// 128: TableOfXUnionThenUnion env1
0x00, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
// 146: TableOfXUnionThenUnion env2
0x38, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
// 172: XUnionOfUnion header
0x01, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0x20, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
// 196: UnionAtTheBottom-as-xunion header
0x03, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0x08, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
// 220: UnionAtTheBottom-as-xunion data (tiny)
0x08, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
],
},
}
success("Regression8OptUnionSize12Aligned4") {
value = Regression8OptUnionSize12Align4{
opt_union1: UnionSize12Align4{
variant: [0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6],
},
opt_union3: UnionSize12Align4{
variant: [0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6],
},
},
bytes = {
v1 = [
// 0: opt_union1, UnionSize12Aligned4-as-xunion present
0x04, 0x00, 0x00, 0x00, // ordinal
0x00, 0x00, 0x00, 0x00, // padding
0x08, 0x00, 0x00, 0x00, // num_bytes
0x00, 0x00, 0x00, 0x00, // num_handles
0xff, 0xff, 0xff, 0xff, // present
0xff, 0xff, 0xff, 0xff, // present (cont.)
// 24: opt_union2, UnionSize12Aligned4-as-xunion absent
0x00, 0x00, 0x00, 0x00, // ordinal
0x00, 0x00, 0x00, 0x00, // padding
0x00, 0x00, 0x00, 0x00, // num_bytes
0x00, 0x00, 0x00, 0x00, // num_handles
0x00, 0x00, 0x00, 0x00, // absent
0x00, 0x00, 0x00, 0x00, // absent (cont.)
// 48: opt_union3, UnionSize12Aligned4-as-xunion present
0x04, 0x00, 0x00, 0x00, // ordinal
0x00, 0x00, 0x00, 0x00, // padding
0x08, 0x00, 0x00, 0x00, // num_bytes
0x00, 0x00, 0x00, 0x00, // num_handles
0xff, 0xff, 0xff, 0xff, // present
0xff, 0xff, 0xff, 0xff, // present (cont.)
// 72: opt_union1.data
0xa1, 0xa2, 0xa3, 0xa4, // array<uint8>:6
0xa5, 0xa6, 0x00, 0x00, // array<uint8>:6 (cont.) + padding
// 80: opt_union2.data
0xb1, 0xb2, 0xb3, 0xb4, // array<uint8>:6
0xb5, 0xb6, 0x00, 0x00, // array<uint8>:6 (cont.) + padding
],
v2 = [
// 0: opt_union1, UnionSize12Aligned4-as-xunion present
0x04, 0x00, 0x00, 0x00, // ordinal
0x00, 0x00, 0x00, 0x00, // padding
0x08, 0x00, 0x00, 0x00, // num_bytes
0x00, 0x00, 0x00, 0x00, // num_handles
// 24: opt_union2, UnionSize12Aligned4-as-xunion absent
0x00, 0x00, 0x00, 0x00, // ordinal
0x00, 0x00, 0x00, 0x00, // padding
0x00, 0x00, 0x00, 0x00, // num_bytes
0x00, 0x00, 0x00, 0x00, // num_handles
// 48: opt_union3, UnionSize12Aligned4-as-xunion present
0x04, 0x00, 0x00, 0x00, // ordinal
0x00, 0x00, 0x00, 0x00, // padding
0x08, 0x00, 0x00, 0x00, // num_bytes
0x00, 0x00, 0x00, 0x00, // num_handles
// 72: opt_union1.data
0xa1, 0xa2, 0xa3, 0xa4, // array<uint8>:6
0xa5, 0xa6, 0x00, 0x00, // array<uint8>:6 (cont.) + padding
// 80: opt_union2.data
0xb1, 0xb2, 0xb3, 0xb4, // array<uint8>:6
0xb5, 0xb6, 0x00, 0x00, // array<uint8>:6 (cont.) + padding
],
},
}
success("Regression8VectorOfOptUnionSize12Aligned4") {
value = Regression8VectorOfOptUnionSize12Align4{
value: [
null,
UnionSize12Align4{
variant: [0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6],
},
null,
UnionSize12Align4{
variant: [0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6],
},
null,
],
},
bytes = {
v1 = [
// 0: vector header
0x05, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
// 16: vector[0] UnionSize12Aligned4-as-xunion absent
0x00, 0x00, 0x00, 0x00, // ordinal
0x00, 0x00, 0x00, 0x00, // padding
0x00, 0x00, 0x00, 0x00, // num_bytes
0x00, 0x00, 0x00, 0x00, // num_handles
0x00, 0x00, 0x00, 0x00, // absent
0x00, 0x00, 0x00, 0x00, // absent (cont.)
// 40: vector[1] UnionSize12Aligned4-as-xunion present
0x04, 0x00, 0x00, 0x00, // ordinal
0x00, 0x00, 0x00, 0x00, // padding
0x08, 0x00, 0x00, 0x00, // num_bytes
0x00, 0x00, 0x00, 0x00, // num_handles
0xff, 0xff, 0xff, 0xff, // present
0xff, 0xff, 0xff, 0xff, // present (cont.)
// 64: vector[2] UnionSize12Aligned4-as-xunion absent
0x00, 0x00, 0x00, 0x00, // ordinal
0x00, 0x00, 0x00, 0x00, // padding
0x00, 0x00, 0x00, 0x00, // num_bytes
0x00, 0x00, 0x00, 0x00, // num_handles
0x00, 0x00, 0x00, 0x00, // absent
0x00, 0x00, 0x00, 0x00, // absent (cont.)
// 88: vector[3] UnionSize12Aligned4-as-xunion present
0x04, 0x00, 0x00, 0x00, // ordinal
0x00, 0x00, 0x00, 0x00, // padding
0x08, 0x00, 0x00, 0x00, // num_bytes
0x00, 0x00, 0x00, 0x00, // num_handles
0xff, 0xff, 0xff, 0xff, // present
0xff, 0xff, 0xff, 0xff, // present (cont.)
// 112: vector[4] UnionSize12Aligned4-as-xunion absent
0x00, 0x00, 0x00, 0x00, // ordinal
0x00, 0x00, 0x00, 0x00, // padding
0x00, 0x00, 0x00, 0x00, // num_bytes
0x00, 0x00, 0x00, 0x00, // num_handles
0x00, 0x00, 0x00, 0x00, // absent
0x00, 0x00, 0x00, 0x00, // absent (cont.)
// 136: vector[1].data
0xa1, 0xa2, 0xa3, 0xa4, // array<uint8>:6
0xa5, 0xa6, 0x00, 0x00, // array<uint8>:6 (cont.) + padding
// 144: vector[2].data
0xb1, 0xb2, 0xb3, 0xb4, // array<uint8>:6
0xb5, 0xb6, 0x00, 0x00, // array<uint8>:6 (cont.) + padding
],
v2 = [
// 0: vector header
0x05, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
// 16: vector[0] UnionSize12Aligned4-as-xunion absent
0x00, 0x00, 0x00, 0x00, // ordinal
0x00, 0x00, 0x00, 0x00, // padding
0x00, 0x00, 0x00, 0x00, // num_bytes
0x00, 0x00, 0x00, 0x00, // num_handles
// 40: vector[1] UnionSize12Aligned4-as-xunion present
0x04, 0x00, 0x00, 0x00, // ordinal
0x00, 0x00, 0x00, 0x00, // padding
0x08, 0x00, 0x00, 0x00, // num_bytes
0x00, 0x00, 0x00, 0x00, // num_handles
// 64: vector[2] UnionSize12Aligned4-as-xunion absent
0x00, 0x00, 0x00, 0x00, // ordinal
0x00, 0x00, 0x00, 0x00, // padding
0x00, 0x00, 0x00, 0x00, // num_bytes
0x00, 0x00, 0x00, 0x00, // num_handles
// 88: vector[3] UnionSize12Aligned4-as-xunion present
0x04, 0x00, 0x00, 0x00, // ordinal
0x00, 0x00, 0x00, 0x00, // padding
0x08, 0x00, 0x00, 0x00, // num_bytes
0x00, 0x00, 0x00, 0x00, // num_handles
// 112: vector[4] UnionSize12Aligned4-as-xunion absent
0x00, 0x00, 0x00, 0x00, // ordinal
0x00, 0x00, 0x00, 0x00, // padding
0x00, 0x00, 0x00, 0x00, // num_bytes
0x00, 0x00, 0x00, 0x00, // num_handles
// 136: vector[1].data
0xa1, 0xa2, 0xa3, 0xa4, // array<uint8>:6
0xa5, 0xa6, 0x00, 0x00, // array<uint8>:6 (cont.) + padding
// 144: vector[2].data
0xb1, 0xb2, 0xb3, 0xb4, // array<uint8>:6
0xb5, 0xb6, 0x00, 0x00, // array<uint8>:6 (cont.) + padding
],
},
}
success("Regression8TableWithUnionSize12Aligned4") {
value = Regression8TableWithUnionSize12Align4{
value: TableWithUnionSize12Align4{
before: 0xaa,
member: UnionSize12Align4{
variant: [0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6],
},
after: 0xbb,
},
},
bytes = {
v1 = [
// 0: TableWithUnionSize12Aligned4 header
0x05, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
// 16: TableWithUnionSize12Aligned4 env1
0x08, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
// 32: TableWithUnionSize12Aligned4 env2
0x00, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
// 48: TableWithUnionSize12Aligned4 env3
0x20, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
// 64: TableWithUnionSize12Aligned4 env4
0x00, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
// 80: TableWithUnionSize12Aligned4 env5
0x08, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
// 96: env1.data, uint8 before
0xaa, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
// 104: env3.data, UnionSize12Aligned4-as-xunion
0x04, 0x00, 0x00, 0x00, // ordinal
0x00, 0x00, 0x00, 0x00, // padding
0x08, 0x00, 0x00, 0x00, // num_bytes
0x00, 0x00, 0x00, 0x00, // num_handles
0xff, 0xff, 0xff, 0xff, // presence
0xff, 0xff, 0xff, 0xff, // presence (cont.)
// UnionSize12Aligned4-as-xunion.data
0xb1, 0xb2, 0xb3, 0xb4, // array<uint8>:6
0xb5, 0xb6, 0x00, 0x00, // array<uint8>:6 (cont.) + padding
// 120: env5.data, uint8 after
0xbb, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
],
v2 = [
// 0: TableWithUnionSize12Aligned4 header
0x05, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
// 16: TableWithUnionSize12Aligned4 env1
0xaa, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x01, 0x00, //
// 24: TableWithUnionSize12Aligned4 env2
0x00, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
// 32: TableWithUnionSize12Aligned4 env3
0x18, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
// 40: TableWithUnionSize12Aligned4 env4
0x00, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
// 48: TableWithUnionSize12Aligned4 env5
0xbb, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x01, 0x00, //
// 56: env3.data, UnionSize12Aligned4-as-xunion
0x04, 0x00, 0x00, 0x00, // ordinal
0x00, 0x00, 0x00, 0x00, // padding
0x08, 0x00, 0x00, 0x00, // num_bytes
0x00, 0x00, 0x00, 0x00, // num_handles
// 72: UnionSize12Aligned4-as-xunion.data
0xb1, 0xb2, 0xb3, 0xb4, // array<uint8>:6
0xb5, 0xb6, 0x00, 0x00, // array<uint8>:6 (cont.) + padding
],
},
}
success("Regression9Response") {
value = Regression9Message{
header: TransactionHeader{
tx_id: 1,
flags: [1, 0, 0],
magic_number: 1,
ordinal: 0x56cbc96900000000,
},
body: Regression9Result{
ok: Regression9Value{
u: StringBoolUnion{
s: "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
},
nullable_u: StringBoolUnion{
b: false,
},
},
},
},
bytes = {
v1 = [
0x01, 0x00, 0x00, 0x00, // txn header
0x01, 0x00, 0x00, 0x01, //
0x00, 0x00, 0x00, 0x00, //
0x69, 0xc9, 0xcb, 0x56, //
// 16: result union xunion header
0x01, 0x00, 0x00, 0x00, // ordinal (success)
0x00, 0x00, 0x00, 0x00, //
0x68, 0x00, 0x00, 0x00, // num bytes
0x00, 0x00, 0x00, 0x00, // num handles
0xff, 0xff, 0xff, 0xff, // presence
0xff, 0xff, 0xff, 0xff, //
// 40: Unions.u xunion header
0x01, 0x00, 0x00, 0x00, // ordinal
0x00, 0x00, 0x00, 0x00, //
0x30, 0x00, 0x00, 0x00, // num bytes
0x00, 0x00, 0x00, 0x00, // num handles
0xff, 0xff, 0xff, 0xff, // presence
0xff, 0xff, 0xff, 0xff, //
// 64: Unions.nullable_u xunion header
0x02, 0x00, 0x00, 0x00, // ordinal
0x00, 0x00, 0x00, 0x00, //
0x08, 0x00, 0x00, 0x00, // num bytes
0x00, 0x00, 0x00, 0x00, // num handles
0xff, 0xff, 0xff, 0xff, // presence
0xff, 0xff, 0xff, 0xff, //
// 88: Unions.u.s vector header
0x20, 0x00, 0x00, 0x00, // num bytes
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, // presence
0xff, 0xff, 0xff, 0xff, //
// 104: Unions.u.s.data
0x41, 0x41, 0x41, 0x41, //
0x41, 0x41, 0x41, 0x41, //
0x41, 0x41, 0x41, 0x41, //
0x41, 0x41, 0x41, 0x41, //
0x41, 0x41, 0x41, 0x41, //
0x41, 0x41, 0x41, 0x41, //
0x41, 0x41, 0x41, 0x41, //
0x41, 0x41, 0x41, 0x41, //
// 136: Unions.nullable_u.data
0x00, 0x00, 0x00, 0x00, // false
0x00, 0x00, 0x00, 0x00, // padding
],
v2 = [
0x01, 0x00, 0x00, 0x00, // txn header
0x01, 0x00, 0x00, 0x01, //
0x00, 0x00, 0x00, 0x00, //
0x69, 0xc9, 0xcb, 0x56, //
// 16: result union xunion header
0x01, 0x00, 0x00, 0x00, // ordinal (success)
0x00, 0x00, 0x00, 0x00, //
0x50, 0x00, 0x00, 0x00, // num bytes
0x00, 0x00, 0x00, 0x00, // num handles
// 40: Unions.u xunion header
0x01, 0x00, 0x00, 0x00, // ordinal
0x00, 0x00, 0x00, 0x00, //
0x30, 0x00, 0x00, 0x00, // num bytes
0x00, 0x00, 0x00, 0x00, // num handles
// 64: Unions.nullable_u xunion header
0x02, 0x00, 0x00, 0x00, // ordinal
0x00, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, // num bytes
0x00, 0x00, 0x01, 0x00, // num handles, inlined
// 88: Unions.u.s vector header
0x20, 0x00, 0x00, 0x00, // num bytes
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, // presence
0xff, 0xff, 0xff, 0xff, //
// 104: Unions.u.s.data
0x41, 0x41, 0x41, 0x41, //
0x41, 0x41, 0x41, 0x41, //
0x41, 0x41, 0x41, 0x41, //
0x41, 0x41, 0x41, 0x41, //
0x41, 0x41, 0x41, 0x41, //
0x41, 0x41, 0x41, 0x41, //
0x41, 0x41, 0x41, 0x41, //
0x41, 0x41, 0x41, 0x41, //
],
},
}
success("Sandwich4Align8") {
value = Sandwich4Align8{
sandwich4: Sandwich4{
before: 0x04030201,
the_union: UnionSize36Align4{
variant: [
0xa0, 0xa1, 0xa2, 0xa3,
0xa4, 0xa5, 0xa6, 0xa7,
0xa8, 0xa9, 0xaa, 0xab,
0xac, 0xad, 0xae, 0xaf,
0xb0, 0xb1, 0xb2, 0xb3,
0xb4, 0xb5, 0xb6, 0xb7,
0xb8, 0xb9, 0xba, 0xbb,
0xbc, 0xbd, 0xbe, 0xbf,
],
},
after: 0x08070605,
},
alignment8_enforcement: 0x100f0e0d0c0b0a09,
},
bytes = {
v1 = [
0x01, 0x02, 0x03, 0x04, // Sandwich4.before 0x00
0x00, 0x00, 0x00, 0x00, // Sandwich4.before (padding)
0x04, 0x00, 0x00, 0x00, // UnionSize36Align4.tag, i.e. Sandwich4.the_union
0x00, 0x00, 0x00, 0x00, // UnionSize36Align4.tag (padding)
0x20, 0x00, 0x00, 0x00, // UnionSize36Align4.env.num_bytes 0x10
0x00, 0x00, 0x00, 0x00, // UnionSize36Align4.env.num_handle
0xff, 0xff, 0xff, 0xff, // UnionSize36Align4.env.presence
0xff, 0xff, 0xff, 0xff, // UnionSize36Align4.env.presence [cont.]
0x05, 0x06, 0x07, 0x08, // Sandwich4.after 0x20
0x00, 0x00, 0x00, 0x00, // Sandwich4.after (padding)
0x09, 0x0a, 0x0b, 0x0c, // alignment8_enforcement
0x0d, 0x0e, 0x0f, 0x10, // alignment8_enforcement
0xa0, 0xa1, 0xa2, 0xa3, // UnionSize36Align4.data, i.e. Sandwich4.the_union.data 0x30
0xa4, 0xa5, 0xa6, 0xa7, // UnionSize36Align4.data [cont.]
0xa8, 0xa9, 0xaa, 0xab, // UnionSize36Align4.data [cont.]
0xac, 0xad, 0xae, 0xaf, // UnionSize36Align4.data [cont.]
0xb0, 0xb1, 0xb2, 0xb3, // UnionSize36Align4.data [cont.] 0x40
0xb4, 0xb5, 0xb6, 0xb7, // UnionSize36Align4.data [cont.]
0xb8, 0xb9, 0xba, 0xbb, // UnionSize36Align4.data [cont.]
0xbc, 0xbd, 0xbe, 0xbf, // UnionSize36Align4.data [cont.]
],
v2 = [
0x01, 0x02, 0x03, 0x04, // Sandwich4.before 0x00
0x00, 0x00, 0x00, 0x00, // Sandwich4.before (padding)
0x04, 0x00, 0x00, 0x00, // UnionSize36Align4.tag, i.e. Sandwich4.the_union
0x00, 0x00, 0x00, 0x00, // UnionSize36Align4.tag (padding)
0x20, 0x00, 0x00, 0x00, // UnionSize36Align4.env.num_bytes 0x10
0x00, 0x00, 0x00, 0x00, // UnionSize36Align4.env.num_handle
0x05, 0x06, 0x07, 0x08, // Sandwich4.after 0x20
0x00, 0x00, 0x00, 0x00, // Sandwich4.after (padding)
0x09, 0x0a, 0x0b, 0x0c, // alignment8_enforcement
0x0d, 0x0e, 0x0f, 0x10, // alignment8_enforcement
0xa0, 0xa1, 0xa2, 0xa3, // UnionSize36Align4.data, i.e. Sandwich4.the_union.data 0x30
0xa4, 0xa5, 0xa6, 0xa7, // UnionSize36Align4.data [cont.]
0xa8, 0xa9, 0xaa, 0xab, // UnionSize36Align4.data [cont.]
0xac, 0xad, 0xae, 0xaf, // UnionSize36Align4.data [cont.]
0xb0, 0xb1, 0xb2, 0xb3, // UnionSize36Align4.data [cont.] 0x40
0xb4, 0xb5, 0xb6, 0xb7, // UnionSize36Align4.data [cont.]
0xb8, 0xb9, 0xba, 0xbb, // UnionSize36Align4.data [cont.]
0xbc, 0xbd, 0xbe, 0xbf, // UnionSize36Align4.data [cont.]
],
},
}
success("Sandwich4Align8WithPointer") {
value = Sandwich4Align8WithPointer{
sandwich4: Sandwich4{
before: 0x04030201,
the_union: UnionSize36Align4{
variant: [
0xa0, 0xa1, 0xa2, 0xa3,
0xa4, 0xa5, 0xa6, 0xa7,
0xa8, 0xa9, 0xaa, 0xab,
0xac, 0xad, 0xae, 0xaf,
0xb0, 0xb1, 0xb2, 0xb3,
0xb4, 0xb5, 0xb6, 0xb7,
0xb8, 0xb9, 0xba, 0xbb,
0xbc, 0xbd, 0xbe, 0xbf,
],
},
after: 0x08070605,
},
alignment8_enforcement: Size8Align8{
data: 0x100f0e0d0c0b0a09,
},
},
bytes = {
v1 = [
0x01, 0x02, 0x03, 0x04, // Sandwich4.before 0x00
0x00, 0x00, 0x00, 0x00, // Sandwich4.before (padding)
0x04, 0x00, 0x00, 0x00, // UnionSize36Alignment4.tag, i.e. Sandwich4.the_union
0x00, 0x00, 0x00, 0x00, // UnionSize36Alignment4.tag (padding)
0x20, 0x00, 0x00, 0x00, // UnionSize36Alignment4.env.num_bytes 0x10
0x00, 0x00, 0x00, 0x00, // UnionSize36Alignment4.env.num_handle
0xff, 0xff, 0xff, 0xff, // UnionSize36Alignment4.env.presence
0xff, 0xff, 0xff, 0xff, // UnionSize36Alignment4.env.presence [cont.]
0x05, 0x06, 0x07, 0x08, // Sandwich4.after 0x20
0x00, 0x00, 0x00, 0x00, // Sandwich4.after (padding)
0xff, 0xff, 0xff, 0xff, // alignment8_enforcement presence
0xff, 0xff, 0xff, 0xff, //
0xa0, 0xa1, 0xa2, 0xa3, // UnionSize36Alignment4.data, i.e. Sandwich4.the_union.data 0x30
0xa4, 0xa5, 0xa6, 0xa7, // UnionSize36Alignment4.data [cont.]
0xa8, 0xa9, 0xaa, 0xab, // UnionSize36Alignment4.data [cont.]
0xac, 0xad, 0xae, 0xaf, // UnionSize36Alignment4.data [cont.]
0xb0, 0xb1, 0xb2, 0xb3, // UnionSize36Alignment4.data [cont.] 0x40
0xb4, 0xb5, 0xb6, 0xb7, // UnionSize36Alignment4.data [cont.]
0xb8, 0xb9, 0xba, 0xbb, // UnionSize36Alignment4.data [cont.]
0xbc, 0xbd, 0xbe, 0xbf, // UnionSize36Alignment4.data [cont.]
0x09, 0x0a, 0x0b, 0x0c, // alignment8_enforcement 0x50
0x0d, 0x0e, 0x0f, 0x10, // alignment8_enforcement
],
v2 = [
0x01, 0x02, 0x03, 0x04, // Sandwich4.before 0x00
0x00, 0x00, 0x00, 0x00, // Sandwich4.before (padding)
0x04, 0x00, 0x00, 0x00, // UnionSize36Alignment4.tag, i.e. Sandwich4.the_union
0x00, 0x00, 0x00, 0x00, // UnionSize36Alignment4.tag (padding)
0x20, 0x00, 0x00, 0x00, // UnionSize36Alignment4.env.num_bytes 0x10
0x00, 0x00, 0x00, 0x00, // UnionSize36Alignment4.env.num_handle
0x05, 0x06, 0x07, 0x08, // Sandwich4.after 0x20
0x00, 0x00, 0x00, 0x00, // Sandwich4.after (padding)
0xff, 0xff, 0xff, 0xff, // alignment8_enforcement presence
0xff, 0xff, 0xff, 0xff, //
0xa0, 0xa1, 0xa2, 0xa3, // UnionSize36Alignment4.data, i.e. Sandwich4.the_union.data 0x30
0xa4, 0xa5, 0xa6, 0xa7, // UnionSize36Alignment4.data [cont.]
0xa8, 0xa9, 0xaa, 0xab, // UnionSize36Alignment4.data [cont.]
0xac, 0xad, 0xae, 0xaf, // UnionSize36Alignment4.data [cont.]
0xb0, 0xb1, 0xb2, 0xb3, // UnionSize36Alignment4.data [cont.] 0x40
0xb4, 0xb5, 0xb6, 0xb7, // UnionSize36Alignment4.data [cont.]
0xb8, 0xb9, 0xba, 0xbb, // UnionSize36Alignment4.data [cont.]
0xbc, 0xbd, 0xbe, 0xbf, // UnionSize36Alignment4.data [cont.]
0x09, 0x0a, 0x0b, 0x0c, // alignment8_enforcement 0x50
0x0d, 0x0e, 0x0f, 0x10, // alignment8_enforcement
],
},
}
success("Sandwich8Case1") {
value = Sandwich8{
before: 0x04030201,
union_of_union: UnionOfUnion{
size8align4: UnionSize8Align4{
variant: 0x0c0b0a09,
},
},
after: 0x08070605,
},
bytes = {
v1 = [
0x01, 0x02, 0x03, 0x04, // Sandwich8.before
0x00, 0x00, 0x00, 0x00, // Sandwich8.before (padding)
0x02, 0x00, 0x00, 0x00, // Sandwich8.UnionOfUnion.ordinal
0x00, 0x00, 0x00, 0x00, // Sandwich8.UnionOfUnion.padding
0x20, 0x00, 0x00, 0x00, // Sandwich8.UnionOfUnion.env.num_bytes
0x00, 0x00, 0x00, 0x00, // Sandwich8.UnionOfUnion.env.num_handle
0xff, 0xff, 0xff, 0xff, // Sandwich8.UnionOfUnion.env.presence
0xff, 0xff, 0xff, 0xff, // Sandwich8.UnionOfUnion.env.presence [cont.]
0x05, 0x06, 0x07, 0x08, // Sandwich8.after
0x00, 0x00, 0x00, 0x00, // Sandwich8.after (padding)
0x03, 0x00, 0x00, 0x00, // UnionOfUnion.UnionSize8Aligned4.ordinal
0x00, 0x00, 0x00, 0x00, // UnionOfUnion.UnionSize8Aligned4.padding
0x08, 0x00, 0x00, 0x00, // UnionOfUnion.UnionSize8Aligned4.env.num_bytes
0x00, 0x00, 0x00, 0x00, // UnionOfUnion.UnionSize8Aligned4.env.num_handle
0xff, 0xff, 0xff, 0xff, // UnionOfUnion.UnionSize8Aligned4.env.presence
0xff, 0xff, 0xff, 0xff, // UnionOfUnion.UnionSize8Aligned4.env.presence [cont.]
0x09, 0x0a, 0x0b, 0x0c, // UnionOfUnion.UnionSize8Aligned4.data
0x00, 0x00, 0x00, 0x00, // UnionOfUnion.UnionSize8Aligned4.data (padding)
],
v2 = [
0x01, 0x02, 0x03, 0x04, // Sandwich8.before
0x00, 0x00, 0x00, 0x00, // Sandwich8.before (padding)
0x02, 0x00, 0x00, 0x00, // Sandwich8.UnionOfUnion.ordinal
0x00, 0x00, 0x00, 0x00, // Sandwich8.UnionOfUnion.padding
0x10, 0x00, 0x00, 0x00, // Sandwich8.UnionOfUnion.env.num_bytes
0x00, 0x00, 0x00, 0x00, // Sandwich8.UnionOfUnion.env.num_handle
0x05, 0x06, 0x07, 0x08, // Sandwich8.after
0x00, 0x00, 0x00, 0x00, // Sandwich8.after (padding)
0x03, 0x00, 0x00, 0x00, // UnionOfUnion.UnionSize8Aligned4.ordinal
0x00, 0x00, 0x00, 0x00, // UnionOfUnion.UnionSize8Aligned4.padding
0x09, 0x0a, 0x0b, 0x0c, // UnionOfUnion.UnionSize8Aligned4.env.num_bytes
0x00, 0x00, 0x01, 0x00, // UnionOfUnion.UnionSize8Aligned4.env.num_handle
],
},
}
success("Sandwich9Case1") {
value = Sandwich9{
before: 0x0201,
the_union: UnionWithVectorOfVectors{
v: [[
StructSize3Align1{
three_bytes: [0x10, 0x11, 0x12],
},
StructSize3Align1{
three_bytes: [0x13, 0x14, 0x15],
},
]],
},
after: 0x1211,
},
bytes = {
v1 = [
0x01, 0x02, 0x00, 0x00, // before
0x00, 0x00, 0x00, 0x00, //
0x01, 0x00, 0x00, 0x00, // xunion tag
0x00, 0x00, 0x00, 0x00, //
0x40, 0x00, 0x00, 0x00, // xunion size
0x00, 0x00, 0x00, 0x00, //
0xFF, 0xFF, 0xFF, 0xFF, // xunion presence
0xFF, 0xFF, 0xFF, 0xFF, //
0x11, 0x12, 0x00, 0x00, // after
0x00, 0x00, 0x00, 0x00, //
0x01, 0x00, 0x00, 0x00, // outer vector size
0x00, 0x00, 0x00, 0x00, //
0xFF, 0xFF, 0xFF, 0xFF, // outer vector presence
0xFF, 0xFF, 0xFF, 0xFF, //
0x02, 0x00, 0x00, 0x00, // inner vector size
0x00, 0x00, 0x00, 0x00, //
0xFF, 0xFF, 0xFF, 0xFF, // inner vector presence
0xFF, 0xFF, 0xFF, 0xFF, //
0xFF, 0xFF, 0xFF, 0xFF, // pointer 1 present
0xFF, 0xFF, 0xFF, 0xFF, //
0xFF, 0xFF, 0xFF, 0xFF, // pointer 2 present
0xFF, 0xFF, 0xFF, 0xFF, //
0x10, 0x11, 0x12, 0x00, // pointer 1 data
0x00, 0x00, 0x00, 0x00, //
0x13, 0x14, 0x15, 0x00, // pointer 2 data
0x00, 0x00, 0x00, 0x00, //
],
v2 = [
0x01, 0x02, 0x00, 0x00, // before
0x00, 0x00, 0x00, 0x00, //
0x01, 0x00, 0x00, 0x00, // xunion tag
0x00, 0x00, 0x00, 0x00, //
0x40, 0x00, 0x00, 0x00, // xunion size
0x00, 0x00, 0x00, 0x00, //
0x11, 0x12, 0x00, 0x00, // after
0x00, 0x00, 0x00, 0x00, //
0x01, 0x00, 0x00, 0x00, // outer vector size
0x00, 0x00, 0x00, 0x00, //
0xFF, 0xFF, 0xFF, 0xFF, // outer vector presence
0xFF, 0xFF, 0xFF, 0xFF, //
0x02, 0x00, 0x00, 0x00, // inner vector size
0x00, 0x00, 0x00, 0x00, //
0xFF, 0xFF, 0xFF, 0xFF, // inner vector presence
0xFF, 0xFF, 0xFF, 0xFF, //
0xFF, 0xFF, 0xFF, 0xFF, // pointer 1 present
0xFF, 0xFF, 0xFF, 0xFF, //
0xFF, 0xFF, 0xFF, 0xFF, // pointer 2 present
0xFF, 0xFF, 0xFF, 0xFF, //
0x10, 0x11, 0x12, 0x00, // pointer 1 data
0x00, 0x00, 0x00, 0x00, //
0x13, 0x14, 0x15, 0x00, // pointer 2 data
0x00, 0x00, 0x00, 0x00, //
],
},
}
success("SimpleTableArrayStruct") {
value = SimpleTableArrayStruct{
the_array: [
TransformerSimpleTable{
value: 0xA3A2A1A0,
},
TransformerSimpleTable{
value: 0xB3B2B1B0,
},
],
},
bytes = {
v1 = [
0x01, 0x00, 0x00, 0x00, // 0x00
0x00, 0x00, 0x00, 0x00, //
0xFF, 0xFF, 0xFF, 0xFF, //
0xFF, 0xFF, 0xFF, 0xFF, //
0x01, 0x00, 0x00, 0x00, // 0x10
0x00, 0x00, 0x00, 0x00, //
0xFF, 0xFF, 0xFF, 0xFF, //
0xFF, 0xFF, 0xFF, 0xFF, //
0x08, 0x00, 0x00, 0x00, // 0x20
0x00, 0x00, 0x00, 0x00, //
0xFF, 0xFF, 0xFF, 0xFF, //
0xFF, 0xFF, 0xFF, 0xFF, //
0xA0, 0xA1, 0xa2, 0xa3, // 0x30
0x00, 0x00, 0x00, 0x00, //
0x08, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xFF, 0xFF, 0xFF, 0xFF, // 0x40
0xFF, 0xFF, 0xFF, 0xFF, //
0xB0, 0xB1, 0xB2, 0xB3, //
0x00, 0x00, 0x00, 0x00, //
],
v2 = [
// table[0]
0x01, 0x00, 0x00, 0x00, // 0x00
0x00, 0x00, 0x00, 0x00, //
0xFF, 0xFF, 0xFF, 0xFF, //
0xFF, 0xFF, 0xFF, 0xFF, //
// table[1]
0x01, 0x00, 0x00, 0x00, // 0x10
0x00, 0x00, 0x00, 0x00, //
0xFF, 0xFF, 0xFF, 0xFF, //
0xFF, 0xFF, 0xFF, 0xFF, //
0xA0, 0xA1, 0xa2, 0xa3, // 0x20
0x00, 0x00, 0x01, 0x00, //
0xB0, 0xB1, 0xB2, 0xB3, //
0x00, 0x00, 0x01, 0x00, //
],
},
}
success("StringUnionVector") {
value = StringUnionVector{
the_vector: [
StringUnion{
s: "hello",
},
StringUnion{
u8: 0xaa,
},
StringUnion{
u8: 0xbb,
},
],
},
bytes = {
v1 = [
0x03, 0x00, 0x00, 0x00, // 0x00
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
0x02, 0x00, 0x00, 0x00, // 0x10
0x00, 0x00, 0x00, 0x00, //
0x18, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, // 0x20
0xff, 0xff, 0xff, 0xff, //
0x03, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0x08, 0x00, 0x00, 0x00, // 0x30
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
0x03, 0x00, 0x00, 0x00, // 0x40
0x00, 0x00, 0x00, 0x00, //
0x08, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, // 0x50
0xff, 0xff, 0xff, 0xff, //
0x05, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, // 0x60
0xff, 0xff, 0xff, 0xff, //
0x68, 0x65, 0x6c, 0x6c, //
0x6f, 0x00, 0x00, 0x00, //
0xaa, 0x00, 0x00, 0x00, // 0x70
0x00, 0x00, 0x00, 0x00, //
0xbb, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
],
v2 = [
0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff,
0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x18, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0xaa, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00,
0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0xbb, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00,
0x05, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff,
0x68, 0x65, 0x6c, 0x6c,
0x6f, 0x00, 0x00, 0x00,
],
},
}
success("StringUnionStructWrapperResponse") {
value = StringUnionStructWrapperResponse{
header: TransactionHeader{
tx_id: 0,
flags: [1, 0, 0],
magic_number: 1,
ordinal: 0x32a0322500000000,
},
body: StringUnionStructWrapper{
sus: StringUnionStruct{
u: StringBoolUnion{
s: "hello",
},
nullable_u: StringBoolUnion{
b: true,
},
},
},
},
bytes = {
v1 = [
0x00, 0x00, 0x00, 0x00, // 0x00
0x01, 0x00, 0x00, 0x01, //
0x00, 0x00, 0x00, 0x00, //
0x25, 0x32, 0xa0, 0x32, //
0x01, 0x00, 0x00, 0x00, // 0x10
0x00, 0x00, 0x00, 0x00, //
0x18, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, // 0x20
0xff, 0xff, 0xff, 0xff, //
0x02, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0x08, 0x00, 0x00, 0x00, // 0x30
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
0x05, 0x00, 0x00, 0x00, // 0x40
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
0x68, 0x65, 0x6c, 0x6c, // 0x50
0x6f, 0x00, 0x00, 0x00, //
0x01, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
],
v2 = [
// Transactional header
0x00, 0x00, 0x00, 0x00, //
0x01, 0x00, 0x00, 0x01, //
0x00, 0x00, 0x00, 0x00, //
0x25, 0x32, 0xa0, 0x32, //
// u
0x01, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0x18, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
// nullable_u
0x02, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0x01, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x01, 0x00, //
// u:string body
0x05, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
0x68, 0x65, 0x6c, 0x6c, //
0x6f, 0x00, 0x00, 0x00, //
],
},
}
success("RegressionNoUnionLauncherCreateComponentRequest") {
value = CreateComponentRequest{
launch_info: LaunchInfo{
url: "fuchsia-pkg://fuchsia.com/fidl_compatibility_test_server_rust_write_xunion#meta/fidl_compatibility_test_server_rust_write_xunion.cmx",
// TODO(fxbug.dev/36441): Support handles in GIDL.
directory_request: 0xffffffff,
},
controller: 0xffffffff,
},
bytes = {
v1, v2 = [
0x84, 0x00, 0x00, 0x00, // begin LaunchInfo: component_url (string size 0x84)
0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, // component_url (string present)
0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00, // |vector<string>? arguments| size 0
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, // |vector<string>? arguments| absent
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, // |struct FileDescriptor? out| absent
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, // |struct FileDescriptor? err| absent
0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, // |handle<channel>?| directory_request present
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, // |struct FlatNamespace?| absent
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, // |struct ServiceList?| absent
0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, // |request<ComponentController>? controller| present
0x00, 0x00, 0x00, 0x00,
0x66, 0x75, 0x63, 0x68, // begin out-of-line of |component_url|
0x73, 0x69, 0x61, 0x2D,
0x70, 0x6B, 0x67, 0x3A,
0x2F, 0x2F, 0x66, 0x75,
0x63, 0x68, 0x73, 0x69,
0x61, 0x2E, 0x63, 0x6F,
0x6D, 0x2F, 0x66, 0x69,
0x64, 0x6C, 0x5F, 0x63,
0x6F, 0x6D, 0x70, 0x61,
0x74, 0x69, 0x62, 0x69,
0x6C, 0x69, 0x74, 0x79,
0x5F, 0x74, 0x65, 0x73,
0x74, 0x5F, 0x73, 0x65,
0x72, 0x76, 0x65, 0x72,
0x5F, 0x72, 0x75, 0x73,
0x74, 0x5F, 0x77, 0x72,
0x69, 0x74, 0x65, 0x5F,
0x78, 0x75, 0x6E, 0x69,
0x6F, 0x6E, 0x23, 0x6D,
0x65, 0x74, 0x61, 0x2F,
0x66, 0x69, 0x64, 0x6C,
0x5F, 0x63, 0x6F, 0x6D,
0x70, 0x61, 0x74, 0x69,
0x62, 0x69, 0x6C, 0x69,
0x74, 0x79, 0x5F, 0x74,
0x65, 0x73, 0x74, 0x5F,
0x73, 0x65, 0x72, 0x76,
0x65, 0x72, 0x5F, 0x72,
0x75, 0x73, 0x74, 0x5F,
0x77, 0x72, 0x69, 0x74,
0x65, 0x5F, 0x78, 0x75,
0x6E, 0x69, 0x6F, 0x6E,
0x2E, 0x63, 0x6D, 0x78,
0x00, 0x00, 0x00, 0x00,
],
},
}
success("CompatTable") {
value = CompatTable{
value: CompatTableValue{
union_member: CompatUnion{b: true},
array_member: [0x5129679d, 0x9491b48e, 0x93d21b51],
table_member: CompatTableString{s: "AB"},
xunion_member: CompatXUnion{s: "CD"},
},
empty: "",
},
bytes = {
v1 = [
// 0: table header (in AllTypeTable)
0x04, 0x00, 0x00, 0x00, // vector num elements
0x00, 0x00, 0x00, 0x00, // (cont.)
0xff, 0xff, 0xff, 0xff, // vector presence
0xff, 0xff, 0xff, 0xff, // (cont.)
// 16: empty string (in AllTypeTable)
0x00, 0x00, 0x00, 0x00, // vector num elemetns
0x00, 0x00, 0x00, 0x00, // (cont.)
0xff, 0xff, 0xff, 0xff, // vector presence
0xff, 0xff, 0xff, 0xff, // (cont.)
// 32: env1 header
0x20, 0x00, 0x00, 0x00, // envelope num bytes
0x00, 0x00, 0x00, 0x00, // envelope num handles
0xff, 0xff, 0xff, 0xff, // envelope presence
0xff, 0xff, 0xff, 0xff, // (cont.)
// 48: env2 header
0x10, 0x00, 0x00, 0x00, // envelope num bytes
0x00, 0x00, 0x00, 0x00, // envelope num handles
0xff, 0xff, 0xff, 0xff, // envelope presence
0xff, 0xff, 0xff, 0xff, // (cont.)
// 64: env3 header
0x38, 0x00, 0x00, 0x00, // envelope num bytes
0x00, 0x00, 0x00, 0x00, // envelope num handles
0xff, 0xff, 0xff, 0xff, // envelope presence
0xff, 0xff, 0xff, 0xff, // (cont.)
// 80: env4 header
0x30, 0x00, 0x00, 0x00, // envelope num bytes
0x00, 0x00, 0x00, 0x00, // envelope num handles
0xff, 0xff, 0xff, 0xff, // envelope presence
0xff, 0xff, 0xff, 0xff, // (cont.)
// 96: env1.data, union-as-xunion header
0x02, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0x08, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
// 120: union-as-xunion data
0x01, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
// 128: env2.data, array[3] of uint32
0x9d, 0x67, 0x29, 0x51, //
0x8e, 0xb4, 0x91, 0x94, //
0x51, 0x1b, 0xd2, 0x93, //
0x00, 0x00, 0x00, 0x00, //
// 144: env3.data, table header
0x01, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
// 160: env3.data.table env1
0x18, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
// 176: string header in table of env3.data
0x02, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
// 192: string data in table of env3.data (2 chars)
0x41, 0x42, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
// 200: env4.data, xunion
0x01, 0x00, 0x00, 0x00, // explicit ordinal
0x00, 0x00, 0x00, 0x00, //
0x18, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
// 224: string header (xunion.data)
0x02, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
// 240: string.data (xunion.data cont.)
0x43, 0x44, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
],
v2 = [
// 0: table header (in AllTypeTable)
0x04, 0x00, 0x00, 0x00, // vector num elements
0x00, 0x00, 0x00, 0x00, // (cont.)
0xff, 0xff, 0xff, 0xff, // vector presence
0xff, 0xff, 0xff, 0xff, // (cont.)
// 16: empty string (in AllTypeTable)
0x00, 0x00, 0x00, 0x00, // vector num elemetns
0x00, 0x00, 0x00, 0x00, // (cont.)
0xff, 0xff, 0xff, 0xff, // vector presence
0xff, 0xff, 0xff, 0xff, // (cont.)
// 32: env1 header
0x10, 0x00, 0x00, 0x00, // envelope num bytes
0x00, 0x00, 0x00, 0x00, // envelope num handles
// 40: env2 header
0x10, 0x00, 0x00, 0x00, // envelope num bytes
0x00, 0x00, 0x00, 0x00, // envelope num handles
// 48: env3 header
0x30, 0x00, 0x00, 0x00, // envelope num bytes
0x00, 0x00, 0x00, 0x00, // envelope num handles
// 56: env4 header
0x28, 0x00, 0x00, 0x00, // envelope num bytes
0x00, 0x00, 0x00, 0x00, // envelope num handles
// 64: env1.data, union-as-xunion header
0x02, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0x01, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x01, 0x00, //
// 80: env2.data, array[3] of uint32
0x9d, 0x67, 0x29, 0x51, //
0x8e, 0xb4, 0x91, 0x94, //
0x51, 0x1b, 0xd2, 0x93, //
0x00, 0x00, 0x00, 0x00, //
// 96: env3.data, table header
0x01, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
// 104: env3.data.table env1
0x18, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
// 112: string header in table of env3.data
0x02, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
// 128: string data in table of env3.data (2 chars)
0x41, 0x42, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
// 136: env4.data, xunion
0x01, 0x00, 0x00, 0x00, // explicit ordinal
0x00, 0x00, 0x00, 0x00, //
0x18, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
// 152: string header (xunion.data)
0x02, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, //
0xff, 0xff, 0xff, 0xff, //
// 168: string.data (xunion.data cont.)
0x43, 0x44, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
],
},
}
success("MixedFields") {
value = MixedFieldsMessage{
header: TransactionHeader{
tx_id: 0xf3f2f1f0,
flags: [0xf4, 0xf5, 0xf6],
magic_number: 0xf7,
ordinal: 0xfffefdfcfbfaf9f8,
},
body: MixedFieldsBody{
before: 0x04030201,
first_union: UnionSize8Align4{
variant: 0x0c0b0a09,
},
middle_start: 0x0b0a,
middle_end: 0x0102030405060708,
second_union: UnionSize8Align4{
variant: 0xc0b0a090,
},
after: 0x08070605,
},
},
bytes = {
v1 = [
0xf0, 0xf1, 0xf2, 0xf3, // Fake transaction header
0xf4, 0xf5, 0xf6, 0xf7, // [cont.]
0xf8, 0xf9, 0xfa, 0xfb, // [cont.]
0xfc, 0xfd, 0xfe, 0xff, // [cont.]
0x01, 0x02, 0x03, 0x04, // before
0x00, 0x00, 0x00, 0x00, // before (padding)
0x03, 0x00, 0x00, 0x00, // UnionSize8Align4.tag
0x00, 0x00, 0x00, 0x00, // UnionSize8Align4.padding
0x08, 0x00, 0x00, 0x00, // UnionSize8Align4.env.num_bytes
0x00, 0x00, 0x00, 0x00, // UnionSize8Align4.env.num_handle
0xff, 0xff, 0xff, 0xff, // UnionSize8Align4.env.presence
0xff, 0xff, 0xff, 0xff, // UnionSize8Align4.presence [cont.]
0x0a, 0x0b, 0x00, 0x00, // middle_start
0x00, 0x00, 0x00, 0x00, // middle_start (padding)
0x08, 0x07, 0x06, 0x05, // middle_end
0x04, 0x03, 0x02, 0x01, // middle_end
0x03, 0x00, 0x00, 0x00, // UnionSize8Align4.tag
0x00, 0x00, 0x00, 0x00, // UnionSize8Align4.padding
0x08, 0x00, 0x00, 0x00, // UnionSize8Align4.env.num_bytes
0x00, 0x00, 0x00, 0x00, // UnionSize8Align4.env.num_handle
0xff, 0xff, 0xff, 0xff, // UnionSize8Align4.env.presence
0xff, 0xff, 0xff, 0xff, // UnionSize8Align4.presence [cont.]
0x05, 0x06, 0x07, 0x08, // after
0x00, 0x00, 0x00, 0x00, // after (padding)
0x09, 0x0a, 0x0b, 0x0c, // UnionSize8Align4.data, i.e. Sandwich1.the_union.data
0x00, 0x00, 0x00, 0x00, // UnionSize8Align4.data (padding)
0x90, 0xa0, 0xb0, 0xc0, // UnionSize8Align4.data, i.e. Sandwich1.the_union.data
0x00, 0x00, 0x00, 0x00, // UnionSize8Align4.data (padding)
],
v2 = [
0xf0, 0xf1, 0xf2, 0xf3, // Fake transaction header
0xf4, 0xf5, 0xf6, 0xf7, // [cont.]
0xf8, 0xf9, 0xfa, 0xfb, // [cont.]
0xfc, 0xfd, 0xfe, 0xff, // [cont.]
0x01, 0x02, 0x03, 0x04, // before
0x00, 0x00, 0x00, 0x00, // before (padding)
0x03, 0x00, 0x00, 0x00, // UnionSize8Align4.tag
0x00, 0x00, 0x00, 0x00, // UnionSize8Align4.padding
0x09, 0x0a, 0x0b, 0x0c, // UnionSize8Align4.env.num_bytes
0x00, 0x00, 0x01, 0x00, // UnionSize8Align4.env.num_handle
0x0a, 0x0b, 0x00, 0x00, // middle_start
0x00, 0x00, 0x00, 0x00, // middle_start (padding)
0x08, 0x07, 0x06, 0x05, // middle_end
0x04, 0x03, 0x02, 0x01, // middle_end
0x03, 0x00, 0x00, 0x00, // UnionSize8Align4.tag
0x00, 0x00, 0x00, 0x00, // UnionSize8Align4.padding
0x90, 0xa0, 0xb0, 0xc0, // UnionSize8Align4.env.num_bytes
0x00, 0x00, 0x01, 0x00, // UnionSize8Align4.env.num_handle
0x05, 0x06, 0x07, 0x08, // after
0x00, 0x00, 0x00, 0x00, // after (padding)
],
},
}
success("UnionOfTable") {
value = StructOfUnionOfTable{
u: UnionOfTable{
t: SimpleTable{
x: 0x1122334455667788,
},
},
},
bytes = {
v1 = [
0x01, 0x00, 0x00, 0x00, // union ordinal
0x00, 0x00, 0x00, 0x00, // union ordinal (cont.)
0x28, 0x00, 0x00, 0x00, // union size
0x00, 0x00, 0x00, 0x00, // union handle count
0xFF, 0xFF, 0xFF, 0xFF, // union presence
0xFF, 0xFF, 0xFF, 0xFF, // union presence (cont.)
0x01, 0x00, 0x00, 0x00, // vector<envelope> count
0x00, 0x00, 0x00, 0x00, // vector<envelope> count (cont.)
0xFF, 0xFF, 0xFF, 0xFF, // vector<envelope> presence
0xFF, 0xFF, 0xFF, 0xFF, // vector<envelope> presence (cont.)
0x08, 0x00, 0x00, 0x00, // envelope size
0x00, 0x00, 0x00, 0x00, // envelope handle count
0xFF, 0xFF, 0xFF, 0xFF, // envelope presence
0xFF, 0xFF, 0xFF, 0xFF, // envelope presence (cont.)
0x88, 0x77, 0x66, 0x55, // table.i value
0x44, 0x33, 0x22, 0x11, // table.i value (cont.)
],
v2 = [
0x01, 0x00, 0x00, 0x00, // union ordinal
0x00, 0x00, 0x00, 0x00, // union ordinal (cont.)
0x20, 0x00, 0x00, 0x00, // union size
0x00, 0x00, 0x00, 0x00, // union handle count
0x01, 0x00, 0x00, 0x00, // vector<envelope> count
0x00, 0x00, 0x00, 0x00, // vector<envelope> count (cont.)
0xFF, 0xFF, 0xFF, 0xFF, // vector<envelope> presence
0xFF, 0xFF, 0xFF, 0xFF, // vector<envelope> presence (cont.)
0x08, 0x00, 0x00, 0x00, // envelope size
0x00, 0x00, 0x00, 0x00, // envelope handle count
0x88, 0x77, 0x66, 0x55, // table.i value
0x44, 0x33, 0x22, 0x11, // table.i value (cont.)
],
},
}
// The coding tables skip table fields that are reserved rather than including
// all fields in order.
// This test is designed to detect misimplementations of accesses to coding
// tables that directly index into them, rather than iterating over the
// fields that are present.
// To be useful for checking this, the union value needs to be a "special"
// value that can't be treated as an unknown value. Here, a union was chosen
// because it is "special" in the context of the V1 <-> V2 migration.
success("TableWithReservedFieldThenUnion") {
value = TableWithReservedFieldThenUnionStruct{
t: TableWithReservedFieldThenUnion{
uv: UnionSize8Align4{
variant: 123,
},
},
},
bytes = {
v1 = [
num(2):8, // Table length
repeat(0xff):8, // Table presence
num(0):4, num(0):4, // Table field 1 (absent)
repeat(0x00):8,
num(32):4, num(0):4, // Table field 2 (present)
repeat(0xff):8,
num(3):8, // Union ordinal
num(8):4, num(0):4, // Union envelope (present)
repeat(0xff):8,
num(123):8, // Union variant value
],
v2 = [
num(2):8, // Table length
repeat(0xff):8, // Table presence
num(0):4, num(0):2, num(0):2, // Table field 1 (absent)
num(16):4, num(0):2, num(0):2, // Table field 2 (present)
num(3):8, // Union ordinal
num(123):4, num(0):2, num(1):2, // Union variant value in envelope
],
},
}