blob: fc876fbb93d6b5bc140da1885334aff42f807e76 [file] [log] [blame]
// Copyright 2019 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("Sandwich1Case1") {
value = Sandwich1 {
before: 0x04030201,
the_union: UnionSize8Align4 {
variant: 0x0c0b0a09,
},
after: 0x08070605,
},
bytes = {
v1 = [
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)
],
},
}
success("Sandwich1Case1WithHdr") {
value = Sandwich1Message {
header: TransactionHeader {
tx_id: 0xf3f2f1f0,
flags: [0xf4, 0xf5, 0xf6],
magic_number: 0xf7,
ordinal: 0xfffefdfcfbfaf9f8,
},
body: Sandwich1 {
before: 0x04030201,
the_union: UnionSize8Align4 {
variant: 0x0c0b0a09,
},
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, // 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)
],
},
}
success("Sandwich1WithOptUnionPresent") {
value = Sandwich1WithOptUnion {
before: 0x04030201,
opt_union: UnionSize8Align4 {
variant: 0x0c0b0a09,
},
after: 0x08070605,
},
bytes = {
v1 = [
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)
],
},
}
success("Sandwich1WithOptUnionAbsent") {
value = Sandwich1WithOptUnion {
before: 0x04030201,
after: 0x08070605,
},
bytes = {
v1 = [
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 (absent) [cont.]
0x05, 0x06, 0x07, 0x08, // Sandwich1WithOptUnion.after
0x00, 0x00, 0x00, 0x00, // Sandwich1WithOptUnion.after (padding)
],
},
}
success("Sandwich2Case1") {
value = Sandwich2 {
before: 0x04030201,
the_union: UnionSize12Align4 {
variant: [0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5],
},
after: 0x08070605,
},
bytes = {
v1 = [
0x01, 0x02, 0x03, 0x04, // Sandwich2.before
0x00, 0x00, 0x00, 0x00, // Sandwich2.before (padding)
0x04, 0x00, 0x00, 0x00, // UnionSize16Aligned4.tag, i.e. Sandwich2.the_union
0x00, 0x00, 0x00, 0x00, // UnionSize16Aligned4.padding
0x08, 0x00, 0x00, 0x00, // UnionSize16Aligned4.env.num_bytes
0x00, 0x00, 0x00, 0x00, // UnionSize16Aligned4.env.num_handle
0xff, 0xff, 0xff, 0xff, // UnionSize16Aligned4.env.presence
0xff, 0xff, 0xff, 0xff, // UnionSize16Aligned4.env.presence [cont.]
0x05, 0x06, 0x07, 0x08, // Sandwich2.after
0x00, 0x00, 0x00, 0x00, // Sandwich2.after (padding)
0xa0, 0xa1, 0xa2, 0xa3, // UnionSize16Aligned4.data, i.e. Sandwich2.the_union.data
0xa4, 0xa5, 0x00, 0x00, // UnionSize16Aligned4.data [cont.] and padding
],
},
}
success("Sandwich3Case1") {
value = Sandwich3 {
before: 0x04030201,
the_union: UnionSize24Align8 {
variant: StructSize16Align8 {
f1: 0xa7a6a5a4a3a2a1a0,
f2: 0xafaeadacabaaa9a8,
},
},
after: 0x08070605,
},
bytes = {
v1 = [
0x01, 0x02, 0x03, 0x04, // Sandwich3.before
0x00, 0x00, 0x00, 0x00, // Sandwich3.before (padding)
0x04, 0x00, 0x00, 0x00, // UnionSize24Alignement8.tag, i.e. Sandwich2.the_union
0x00, 0x00, 0x00, 0x00, // UnionSize24Alignement8.padding
0x10, 0x00, 0x00, 0x00, // UnionSize24Alignement8.env.num_bytes
0x00, 0x00, 0x00, 0x00, // UnionSize24Alignement8.env.num_handle
0xff, 0xff, 0xff, 0xff, // UnionSize24Alignement8.env.presence
0xff, 0xff, 0xff, 0xff, // UnionSize24Alignement8.env.presence [cont.]
0x05, 0x06, 0x07, 0x08, // Sandwich3.after
0x00, 0x00, 0x00, 0x00, // Sandwich3.after (padding)
0xa0, 0xa1, 0xa2, 0xa3, // UnionSize24Alignement8.data, i.e Sandwich2.the_union.data
0xa4, 0xa5, 0xa6, 0xa7, // UnionSize24Alignement8.data [cont.]
0xa8, 0xa9, 0xaa, 0xab, // UnionSize24Alignement8.data [cont.]
0xac, 0xad, 0xae, 0xaf, // UnionSize24Alignement8.data [cont.]
],
},
}
success("Sandwich4Case1") {
value = 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,
},
bytes = {
v1 = [
0x01, 0x02, 0x03, 0x04, // Sandwich4.before
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
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
0x00, 0x00, 0x00, 0x00, // Sandwich4.after (padding)
0xa0, 0xa1, 0xa2, 0xa3, // UnionSize36Align4.data, i.e. Sandwich4.the_union.data
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.]
0xb4, 0xb5, 0xb6, 0xb7, // UnionSize36Align4.data [cont.]
0xb8, 0xb9, 0xba, 0xbb, // UnionSize36Align4.data [cont.]
0xbc, 0xbd, 0xbe, 0xbf, // UnionSize36Align4.data [cont.]
],
},
}
success("Sandwich4Case1WithHdr") {
value = Sandwich4Message {
header: TransactionHeader {
tx_id: 0,
flags: [0, 0, 0],
magic_number: 0,
ordinal: 0,
},
body: 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,
},
},
bytes = {
v1 = [
0x00, 0x00, 0x00, 0x00, // Fake transaction header 0x00
0x00, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, //
0x01, 0x02, 0x03, 0x04, // Sandwich4.before 0x10
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 0x20
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 0x30
0x00, 0x00, 0x00, 0x00, // Sandwich4.after (padding)
0xa0, 0xa1, 0xa2, 0xa3, // UnionSize36Alignment4.data, i.e. Sandwich4.the_union.data
0xa4, 0xa5, 0xa6, 0xa7, // UnionSize36Alignment4.data [cont.]
0xa8, 0xa9, 0xaa, 0xab, // UnionSize36Alignment4.data [cont.] 0x40
0xac, 0xad, 0xae, 0xaf, // UnionSize36Alignment4.data [cont.]
0xb0, 0xb1, 0xb2, 0xb3, // UnionSize36Alignment4.data [cont.]
0xb4, 0xb5, 0xb6, 0xb7, // UnionSize36Alignment4.data [cont.]
0xb8, 0xb9, 0xba, 0xbb, // UnionSize36Alignment4.data [cont.] 0x50
0xbc, 0xbd, 0xbe, 0xbf, // UnionSize36Alignment4.data [cont.]
],
},
}
success("Sandwich5Case1") {
value = Sandwich5 {
before: 0x04030201,
union_of_union: UnionOfUnion {
size8align4: UnionSize8Align4 {
variant: 0x0c0b0a09,
},
},
after: 0x08070605,
},
bytes = {
v1 = [
0x01, 0x02, 0x03, 0x04, // Sandwich5.before
0x00, 0x00, 0x00, 0x00, // Sandwich5.before (padding)
0x02, 0x00, 0x00, 0x00, // Sandwich5.UnionOfUnion.ordinal
0x00, 0x00, 0x00, 0x00, // Sandwich5.UnionOfUnion.padding
0x20, 0x00, 0x00, 0x00, // Sandwich5.UnionOfUnion.env.num_bytes
0x00, 0x00, 0x00, 0x00, // Sandwich5.UnionOfUnion.env.num_handle
0xff, 0xff, 0xff, 0xff, // Sandwich5.UnionOfUnion.env.presence
0xff, 0xff, 0xff, 0xff, // Sandwich5.UnionOfUnion.env.presence [cont.]
0x05, 0x06, 0x07, 0x08, // Sandwich5.after
0x00, 0x00, 0x00, 0x00, // Sandwich5.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)
],
},
}
success("Sandwich5Case1WithHdr") {
value = Sandwich5Message {
header: TransactionHeader {
tx_id: 0xf3f2f1f0,
flags: [0xf4, 0xf5, 0xf6],
magic_number: 0xf7,
ordinal: 0xfffefdfcfbfaf9f8,
},
body: Sandwich5 {
before: 0x04030201,
union_of_union: UnionOfUnion {
size8align4: UnionSize8Align4 {
variant: 0x0c0b0a09,
},
},
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, // Sandwich5.before
0x00, 0x00, 0x00, 0x00, // Sandwich5.before (padding)
0x02, 0x00, 0x00, 0x00, // Sandwich5.UnionOfUnion.ordinal
0x00, 0x00, 0x00, 0x00, // Sandwich5.UnionOfUnion.padding
0x20, 0x00, 0x00, 0x00, // Sandwich5.UnionOfUnion.env.num_bytes
0x00, 0x00, 0x00, 0x00, // Sandwich5.UnionOfUnion.env.num_handle
0xff, 0xff, 0xff, 0xff, // Sandwich5.UnionOfUnion.env.presence
0xff, 0xff, 0xff, 0xff, // Sandwich5.UnionOfUnion.env.presence [cont.]
0x05, 0x06, 0x07, 0x08, // Sandwich5.after
0x00, 0x00, 0x00, 0x00, // Sandwich5.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)
],
},
}
success("Sandwich5Case2") {
value = Sandwich5 {
before: 0x04030201,
union_of_union: UnionOfUnion {
size24align8: UnionSize24Align8 {
variant: StructSize16Align8 {
f1: 0xa7a6a5a4a3a2a1a0,
f2: 0xafaeadacabaaa9a8,
},
},
},
after: 0x08070605,
},
bytes = {
v1 = [
0x01, 0x02, 0x03, 0x04, // Sandwich5.before
0x00, 0x00, 0x00, 0x00, // Sandwich5.before (padding)
0x05, 0x00, 0x00, 0x00, // Sandwich5.UnionOfUnion.ordinal
0x00, 0x00, 0x00, 0x00, // Sandwich5.UnionOfUnion.padding
0x28, 0x00, 0x00, 0x00, // Sandwich5.UnionOfUnion.env.num_bytes
0x00, 0x00, 0x00, 0x00, // Sandwich5.UnionOfUnion.env.num_handle
0xff, 0xff, 0xff, 0xff, // Sandwich5.UnionOfUnion.env.presence
0xff, 0xff, 0xff, 0xff, // Sandwich5.UnionOfUnion.env.presence [cont.]
0x05, 0x06, 0x07, 0x08, // Sandwich5.after
0x00, 0x00, 0x00, 0x00, // Sandwich5.after (padding)
0x04, 0x00, 0x00, 0x00, // UnionOfUnion.UnionSize24Align8.ordinal
0x00, 0x00, 0x00, 0x00, // UnionOfUnion.UnionSize24Align8.padding
0x10, 0x00, 0x00, 0x00, // UnionOfUnion.UnionSize24Align8.env.num_bytes
0x00, 0x00, 0x00, 0x00, // UnionOfUnion.UnionSize24Align8.env.num_handle
0xff, 0xff, 0xff, 0xff, // UnionOfUnion.UnionSize24Align8.env.presence
0xff, 0xff, 0xff, 0xff, // UnionOfUnion.UnionSize24Align8.env.presence [cont.]
0xa0, 0xa1, 0xa2, 0xa3, // UnionOfUnion.UnionSize24Align8.data
0xa4, 0xa5, 0xa6, 0xa7, // UnionOfUnion.UnionSize24Align8.data [cont.]
0xa8, 0xa9, 0xaa, 0xab, // UnionOfUnion.UnionSize24Align8.data [cont.]
0xac, 0xad, 0xae, 0xaf, // UnionOfUnion.UnionSize24Align8.data [cont.]
],
},
}
success("Sandwich5Case2WithHdr") {
value = Sandwich5Message {
header: TransactionHeader {
tx_id: 0xf3f2f1f0,
flags: [0xf4, 0xf5, 0xf6],
magic_number: 0xf7,
ordinal: 0xfffefdfcfbfaf9f8,
},
body: Sandwich5 {
before: 0x04030201,
union_of_union: UnionOfUnion {
size24align8: UnionSize24Align8 {
variant: StructSize16Align8 {
f1: 0xa7a6a5a4a3a2a1a0,
f2: 0xafaeadacabaaa9a8,
},
},
},
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, // Sandwich5.before
0x00, 0x00, 0x00, 0x00, // Sandwich5.before (padding)
0x05, 0x00, 0x00, 0x00, // Sandwich5.UnionOfUnion.ordinal
0x00, 0x00, 0x00, 0x00, // Sandwich5.UnionOfUnion.padding
0x28, 0x00, 0x00, 0x00, // Sandwich5.UnionOfUnion.env.num_bytes
0x00, 0x00, 0x00, 0x00, // Sandwich5.UnionOfUnion.env.num_handle
0xff, 0xff, 0xff, 0xff, // Sandwich5.UnionOfUnion.env.presence
0xff, 0xff, 0xff, 0xff, // Sandwich5.UnionOfUnion.env.presence [cont.]
0x05, 0x06, 0x07, 0x08, // Sandwich5.after
0x00, 0x00, 0x00, 0x00, // Sandwich5.after (padding)
0x04, 0x00, 0x00, 0x00, // UnionOfUnion.UnionSize24Alignment8.ordinal
0x00, 0x00, 0x00, 0x00, // UnionOfUnion.UnionSize24Alignment8.padding
0x10, 0x00, 0x00, 0x00, // UnionOfUnion.UnionSize24Alignment8.env.num_bytes
0x00, 0x00, 0x00, 0x00, // UnionOfUnion.UnionSize24Alignment8.env.num_handle
0xff, 0xff, 0xff, 0xff, // UnionOfUnion.UnionSize24Alignment8.env.presence
0xff, 0xff, 0xff, 0xff, // UnionOfUnion.UnionSize24Alignment8.env.presence [cont.]
0xa0, 0xa1, 0xa2, 0xa3, // UnionOfUnion.UnionSize24Alignment8.data
0xa4, 0xa5, 0xa6, 0xa7, // UnionOfUnion.UnionSize24Alignment8.data [cont.]
0xa8, 0xa9, 0xaa, 0xab, // UnionOfUnion.UnionSize24Alignment8.data [cont.]
0xac, 0xad, 0xae, 0xaf, // UnionOfUnion.UnionSize24Alignment8.data [cont.]
],
},
}
success("Sandwich6Case1") {
value = Sandwich6 {
before: 0x04030201,
the_union: UnionWithVector {
vector_of_uint8: [
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5
],
},
after: 0x08070605,
},
bytes = {
v1 = [
0x01, 0x02, 0x03, 0x04, // Sandwich6.before
0x00, 0x00, 0x00, 0x00, // Sandwich6.before (padding)
0x02, 0x00, 0x00, 0x00, // UnionWithVector.ordinal (start of Sandwich6.the_union)
0x00, 0x00, 0x00, 0x00, // UnionWithVector.ordinal (padding)
0x18, 0x00, 0x00, 0x00, // UnionWithVector.env.num_bytes
0x00, 0x00, 0x00, 0x00, // UnionWithVector.env.num_handle
0xff, 0xff, 0xff, 0xff, // UnionWithVector.env.presence
0xff, 0xff, 0xff, 0xff, // UnionWithVector.env.presence [cont.]
0x05, 0x06, 0x07, 0x08, // Sandwich6.after
0x00, 0x00, 0x00, 0x00, // Sandwich6.after (padding)
0x06, 0x00, 0x00, 0x00, // vector<uint8>.size, i.e. Sandwich6.the_union.data
0x00, 0x00, 0x00, 0x00, // vector<uint8>.size [cont.]
0xff, 0xff, 0xff, 0xff, // vector<uint8>.presence
0xff, 0xff, 0xff, 0xff, // vector<uint8>.presence [cont.]
0xa0, 0xa1, 0xa2, 0xa3, // vector<uint8>.data
0xa4, 0xa5, 0x00, 0x00, // vector<uint8>.data [cont.] + padding
],
},
}
success("Sandwich6Case1AbsentVector") {
value = Sandwich6 {
before: 0x04030201,
the_union: UnionWithVector {
vector_of_uint8: []
},
after: 0x08070605,
},
bytes = {
v1 = [
0x01, 0x02, 0x03, 0x04, // Sandwich6.before
0x00, 0x00, 0x00, 0x00, // Sandwich6.before (padding)
0x02, 0x00, 0x00, 0x00, // UnionWithVector.ordinal (start of Sandwich6.the_union)
0x00, 0x00, 0x00, 0x00, // UnionWithVector.ordinal (padding)
0x10, 0x00, 0x00, 0x00, // UnionWithVector.env.num_bytes
0x00, 0x00, 0x00, 0x00, // UnionWithVector.env.num_handle
0xff, 0xff, 0xff, 0xff, // UnionWithVector.env.presence
0xff, 0xff, 0xff, 0xff, // UnionWithVector.env.presence [cont.]
0x05, 0x06, 0x07, 0x08, // Sandwich6.after
0x00, 0x00, 0x00, 0x00, // Sandwich6.after (padding)
0x00, 0x00, 0x00, 0x00, // vector<uint8>.size, i.e. Sandwich6.the_union.data
0x00, 0x00, 0x00, 0x00, // vector<uint8>.size [cont.]
0xff, 0xff, 0xff, 0xff, // vector<uint8>.presence
0xff, 0xff, 0xff, 0xff, // vector<uint8>.presence [cont.]
],
},
}
success("Sandwich6Case2") {
value = Sandwich6 {
before: 0x04030201,
the_union: UnionWithVector {
s: "soft migrations rock!",
},
after: 0x08070605,
},
bytes = {
v1 = [
0x01, 0x02, 0x03, 0x04, // Sandwich6.before
0x00, 0x00, 0x00, 0x00, // Sandwich6.before (padding)
0x03, 0x00, 0x00, 0x00, // UnionWithVector.ordinal (start of Sandwich6.the_union)
0x00, 0x00, 0x00, 0x00, // UnionWithVector.ordinal (padding)
0x28, 0x00, 0x00, 0x00, // UnionWithVector.env.num_bytes
0x00, 0x00, 0x00, 0x00, // UnionWithVector.env.num_handle
0xff, 0xff, 0xff, 0xff, // UnionWithVector.env.presence
0xff, 0xff, 0xff, 0xff, // UnionWithVector.env.presence [cont.]
0x05, 0x06, 0x07, 0x08, // Sandwich6.after
0x00, 0x00, 0x00, 0x00, // Sandwich6.after (padding)
0x15, 0x00, 0x00, 0x00, // vector<uint8>.size (21), i.e. Sandwich6.the_union.data
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
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
],
},
}
success("Sandwich6Case3") {
value = Sandwich6 {
before: 0x04030201,
the_union: UnionWithVector {
vector_s3_a1: [
StructSize3Align1 {
three_bytes: [0x73, 0x6f, 0x66]
},
StructSize3Align1 {
three_bytes: [0x20, 0x6d, 0x69]
},
StructSize3Align1 {
three_bytes: [0x72, 0x61, 0x74]
},
],
},
after: 0x08070605,
},
bytes = {
v1 = [
0x01, 0x02, 0x03, 0x04, // Sandwich6.before
0x00, 0x00, 0x00, 0x00, // Sandwich6.before (padding)
0x04, 0x00, 0x00, 0x00, // UnionWithVector.ordinal (start of Sandwich6.the_union)
0x00, 0x00, 0x00, 0x00, // UnionWithVector.ordinal (padding)
0x20, 0x00, 0x00, 0x00, // UnionWithVector.env.num_bytes
0x00, 0x00, 0x00, 0x00, // UnionWithVector.env.num_handle
0xff, 0xff, 0xff, 0xff, // UnionWithVector.env.presence
0xff, 0xff, 0xff, 0xff, // UnionWithVector.env.presence [cont.]
0x05, 0x06, 0x07, 0x08, // Sandwich6.after
0x00, 0x00, 0x00, 0x00, // Sandwich6.after (padding)
0x03, 0x00, 0x00, 0x00, // vector<struct>.size (21), i.e. Sandwich6.the_union.data
0x00, 0x00, 0x00, 0x00, // vector<struct>.size [cont.]
0xff, 0xff, 0xff, 0xff, // vector<struct>.presence
0xff, 0xff, 0xff, 0xff, // vector<struct>.presence [cont.]
0x73, 0x6f, 0x66, 0x20, // StructSize3Align1 (element #1 & start of element #2)
0x6d, 0x69, 0x72, 0x61, // StructSize3Align1 (element #2 [cont.] & start of element #3)
0x74, 0x00, 0x00, 0x00, // StructSize3Align1 (element #3 [cont.d])
0x00, 0x00, 0x00, 0x00, // (padding)
],
},
}
success("Sandwich6Case4") {
value = Sandwich6 {
before: 0x04030201,
the_union: UnionWithVector {
vector_s3_a2: [
StructSize3Align2 {
f1: 0x6f73,
f2: 0x66,
},
StructSize3Align2 {
f1: 0x6d20,
f2: 0x69,
},
StructSize3Align2 {
f1: 0x6172,
f2: 0x74,
},
],
},
after: 0x08070605,
},
bytes = {
v1 = [
0x01, 0x02, 0x03, 0x04, // Sandwich6.before
0x00, 0x00, 0x00, 0x00, // Sandwich6.before (padding)
0x05, 0x00, 0x00, 0x00, // UnionWithVector.ordinal (start of Sandwich6.the_union)
0x00, 0x00, 0x00, 0x00, // UnionWithVector.ordinal (padding)
0x20, 0x00, 0x00, 0x00, // UnionWithVector.env.num_bytes
0x00, 0x00, 0x00, 0x00, // UnionWithVector.env.num_handle
0xff, 0xff, 0xff, 0xff, // UnionWithVector.env.presence
0xff, 0xff, 0xff, 0xff, // UnionWithVector.env.presence [cont.]
0x05, 0x06, 0x07, 0x08, // Sandwich6.after
0x00, 0x00, 0x00, 0x00, // Sandwich6.after (padding)
0x03, 0x00, 0x00, 0x00, // vector<struct>.size (21), i.e. Sandwich6.the_union.data
0x00, 0x00, 0x00, 0x00, // vector<struct>.size [cont.]
0xff, 0xff, 0xff, 0xff, // vector<struct>.presence
0xff, 0xff, 0xff, 0xff, // vector<struct>.presence [cont.]
0x73, 0x6f, 0x66, 0x00, // StructSize3Align2 (start of vector<struct>.data)
0x20, 0x6d, 0x69, 0x00, // StructSize3Align2 (element #2)
0x72, 0x61, 0x74, 0x00, // StructSize3Align2 (element #3)
0x00, 0x00, 0x00, 0x00, // (padding)
],
},
}
success("Sandwich6Case5") {
value = Sandwich6 {
before: 0x04030201,
the_union: UnionWithVector {
// TODO(fxbug.dev/36441): Support handles in GIDL.
handles: [
0xffffffff,
0xffffffff,
0xffffffff,
],
},
after: 0x08070605,
},
bytes = {
v1 = [
0x01, 0x02, 0x03, 0x04, // Sandwich6.before
0x00, 0x00, 0x00, 0x00, // Sandwich6.before (padding)
0x06, 0x00, 0x00, 0x00, // UnionWithVector.ordinal (start of Sandwich6.the_union)
0x00, 0x00, 0x00, 0x00, // UnionWithVector.ordinal (padding)
0x20, 0x00, 0x00, 0x00, // UnionWithVector.env.num_bytes
0x00, 0x00, 0x00, 0x00, // UnionWithVector.env.num_handle
0xff, 0xff, 0xff, 0xff, // UnionWithVector.env.presence
0xff, 0xff, 0xff, 0xff, // UnionWithVector.env.presence [cont.]
0x05, 0x06, 0x07, 0x08, // Sandwich6.after
0x00, 0x00, 0x00, 0x00, // Sandwich6.after (padding)
0x03, 0x00, 0x00, 0x00, // vector<handle>.size, i.e. Sandwich6.the_union.data
0x00, 0x00, 0x00, 0x00, // vector<handle>.size [cont.]
0xff, 0xff, 0xff, 0xff, // vector<handle>.presence
0xff, 0xff, 0xff, 0xff, // vector<handle>.presence [cont.]
0xff, 0xff, 0xff, 0xff, // vector<handle>.data
0xff, 0xff, 0xff, 0xff, // vector<handle>.data
0xff, 0xff, 0xff, 0xff, // vector<handle>.data
0x00, 0x00, 0x00, 0x00, // vector<handle>.data (padding)
],
},
}
success("Sandwich6Case6") {
value = Sandwich6 {
before: 0x04030201,
the_union: UnionWithVector {
array_s3_a1: [
StructSize3Align1 {
three_bytes: [
0xa1, 0xa2, 0xa3,
],
},
StructSize3Align1 {
three_bytes: [
0xa4, 0xa5, 0xa6,
],
},
],
},
after: 0x08070605,
},
bytes = {
v1 = [
0x01, 0x02, 0x03, 0x04, // Sandwich6.before
0x00, 0x00, 0x00, 0x00, // Sandwich6.before (padding)
0x07, 0x00, 0x00, 0x00, // UnionWithVector.ordinal (start of Sandwich6.the_union)
0x00, 0x00, 0x00, 0x00, // UnionWithVector.ordinal (padding)
0x08, 0x00, 0x00, 0x00, // UnionWithVector.env.num_bytes
0x00, 0x00, 0x00, 0x00, // UnionWithVector.env.num_handle
0xff, 0xff, 0xff, 0xff, // UnionWithVector.env.presence
0xff, 0xff, 0xff, 0xff, // UnionWithVector.env.presence [cont.]
0x05, 0x06, 0x07, 0x08, // Sandwich6.after
0x00, 0x00, 0x00, 0x00, // Sandwich6.after (padding)
0xa1, 0xa2, 0xa3, 0xa4, // array<StructSize3Align1>:2, i.e. Sandwich6.the_union.data
0xa5, 0xa6, 0x00, 0x00, // array<StructSize3Align1>:2
],
},
}
success("Sandwich6Case7") {
value = Sandwich6 {
before: 0x04030201,
the_union: UnionWithVector {
array_s3_a2: [
StructSize3Align2 {
f1: 0xa2a1,
f2: 0xa3,
},
StructSize3Align2 {
f1: 0xa5a4,
f2: 0xa6,
},
],
},
after: 0x08070605,
},
bytes = {
v1 = [
0x01, 0x02, 0x03, 0x04, // Sandwich6.before
0x00, 0x00, 0x00, 0x00, // Sandwich6.before (padding)
0x08, 0x00, 0x00, 0x00, // UnionWithVector.ordinal (start of Sandwich6.the_union)
0x00, 0x00, 0x00, 0x00, // UnionWithVector.ordinal (padding)
0x08, 0x00, 0x00, 0x00, // UnionWithVector.env.num_bytes
0x00, 0x00, 0x00, 0x00, // UnionWithVector.env.num_handle
0xff, 0xff, 0xff, 0xff, // UnionWithVector.env.presence
0xff, 0xff, 0xff, 0xff, // UnionWithVector.env.presence [cont.]
0x05, 0x06, 0x07, 0x08, // Sandwich6.after
0x00, 0x00, 0x00, 0x00, // Sandwich6.after (padding)
0xa1, 0xa2, 0xa3, 0x00, // array<StructSize3Align2>:2, i.e. Sandwich6.the_union.data
0xa4, 0xa5, 0xa6, 0x00, // array<StructSize3Align2>:2
],
},
}
success("Sandwich6Case8") {
value = Sandwich6 {
before: 0x04030201,
the_union: UnionWithVector {
vector_union: [
UnionSize8Align4 {
variant: 0x0c0b0a09,
},
],
},
after: 0x08070605,
},
bytes = {
v1 = [
0x01, 0x02, 0x03, 0x04, // Sandwich6.before
0x00, 0x00, 0x00, 0x00, // Sandwich6.before (padding)
0x09, 0x00, 0x00, 0x00, // UnionWithVector.ordinal (start of Sandwich6.the_union)
0x00, 0x00, 0x00, 0x00, // UnionWithVector.ordinal (padding)
0x30, 0x00, 0x00, 0x00, // UnionWithVector.env.num_bytes
0x00, 0x00, 0x00, 0x00, // UnionWithVector.env.num_handle
0xff, 0xff, 0xff, 0xff, // UnionWithVector.env.presence
0xff, 0xff, 0xff, 0xff, // UnionWithVector.env.presence [cont.]
0x05, 0x06, 0x07, 0x08, // Sandwich6.after
0x00, 0x00, 0x00, 0x00, // Sandwich6.after (padding)
0x01, 0x00, 0x00, 0x00, // vector<UnionSize8Align4>.size (start of Sandwich6.the_union.data)
0x00, 0x00, 0x00, 0x00, // vector<UnionSize8Align4>.size [cont.]
0xff, 0xff, 0xff, 0xff, // vector<UnionSize8Align4>.presence
0xff, 0xff, 0xff, 0xff, // vector<UnionSize8Align4>.presence [cont.]
0x03, 0x00, 0x00, 0x00, // UnionSize8Align4.ordinal (first element, outer vector)
0x00, 0x00, 0x00, 0x00, // UnionSize8Align4.ordinal (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.env.presence [cont.]
0x09, 0x0a, 0x0b, 0x0c, // UnionSize8Align4.data, i.e. Sandwich1.the_union.data
0x00, 0x00, 0x00, 0x00, // UnionSize8Align4.data (padding)
],
},
}
success("Sandwich7Case1") {
value = Sandwich7 {
before: 0x14131211,
opt_sandwich1: Sandwich1 {
before: 0x04030201,
the_union: UnionSize8Align4 {
variant: 0x0c0b0a09,
},
after: 0x08070605,
},
after: 0x24232221,
},
bytes = {
v1 = [
0x11, 0x12, 0x13, 0x14, // Sandwich7.before
0x00, 0x00, 0x00, 0x00, // Sandwich7.before (padding)
0xff, 0xff, 0xff, 0xff, // Sandwich7.opt_sandwich1.presence
0xff, 0xff, 0xff, 0xff, // Sandwich7.opt_sandwich1.presence [cont.]
0x21, 0x22, 0x23, 0x24, // Sandwich7.after
0x00, 0x00, 0x00, 0x00, // Sandwich7.after (padding)
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)
],
},
}
success("Sandwich7Case1WithHdr") {
value = Sandwich7Message {
header: TransactionHeader {
tx_id: 0xf3f2f1f0,
flags: [0xf4, 0xf5, 0xf6],
magic_number: 0xf7,
ordinal: 0xfffefdfcfbfaf9f8,
},
body: Sandwich7 {
before: 0x14131211,
opt_sandwich1: Sandwich1 {
before: 0x04030201,
the_union: UnionSize8Align4 {
variant: 0x0c0b0a09,
},
after: 0x08070605,
},
after: 0x24232221,
},
},
bytes = {
v1 = [
0xf0, 0xf1, 0xf2, 0xf3, // Fake transaction header
0xf4, 0xf5, 0xf6, 0xf7, // [cont.]
0xf8, 0xf9, 0xfa, 0xfb, // [cont.]
0xfc, 0xfd, 0xfe, 0xff, // [cont.]
0x11, 0x12, 0x13, 0x14, // Sandwich7.before
0x00, 0x00, 0x00, 0x00, // Sandwich7.before (padding)
0xff, 0xff, 0xff, 0xff, // Sandwich7.opt_sandwich1.presence
0xff, 0xff, 0xff, 0xff, // Sandwich7.opt_sandwich1.presence [cont.]
0x21, 0x22, 0x23, 0x24, // Sandwich7.after
0x00, 0x00, 0x00, 0x00, // Sandwich7.after (padding)
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)
],
},
}
success("Sandwich7Case2") {
value = Sandwich7 {
before: 0x14131211,
after: 0x24232221,
},
bytes = {
v1 = [
0x11, 0x12, 0x13, 0x14, // Sandwich7.before
0x00, 0x00, 0x00, 0x00, // Sandwich7.before (padding)
0x00, 0x00, 0x00, 0x00, // Sandwich7.opt_sandwich1.absence
0x00, 0x00, 0x00, 0x00, // Sandwich7.opt_sandwich1.absence [cont.]
0x21, 0x22, 0x23, 0x24, // Sandwich7.after
0x00, 0x00, 0x00, 0x00, // Sandwich7.after (padding)
],
},
}
success("Sandwich7Case2WithHdr") {
value = Sandwich7Message {
header: TransactionHeader {
tx_id: 0xf3f2f1f0,
flags: [0xf4, 0xf5, 0xf6],
magic_number: 0xf7,
ordinal: 0xfffefdfcfbfaf9f8,
},
body: Sandwich7 {
before: 0x14131211,
after: 0x24232221,
},
},
bytes = {
v1 = [
0xf0, 0xf1, 0xf2, 0xf3, // Fake transaction header
0xf4, 0xf5, 0xf6, 0xf7, // [cont.]
0xf8, 0xf9, 0xfa, 0xfb, // [cont.]
0xfc, 0xfd, 0xfe, 0xff, // [cont.]
0x11, 0x12, 0x13, 0x14, // Sandwich7.before
0x00, 0x00, 0x00, 0x00, // Sandwich7.before (padding)
0x00, 0x00, 0x00, 0x00, // Sandwich7.opt_sandwich1.preabsentsence
0x00, 0x00, 0x00, 0x00, // Sandwich7.opt_sandwich1.absence [cont.]
0x21, 0x22, 0x23, 0x24, // Sandwich7.after
0x00, 0x00, 0x00, 0x00, // Sandwich7.after (padding)
],
},
}
success("Regression1") {
value = Regression1 {
f1: 0x01,
f2: 0x02,
f3: 0x03,
f4: 0x04,
f5: 0x05,
f6: 0x06,
},
bytes = {
v1 = [
0x01, 0x00, 0x00, 0x00, // f1 and padding
0x02, 0x00, 0x00, 0x00, // f2 and padding
0x03, 0x00, 0x04, 0x00, // f3, f3 padding and f4
0x00, 0x00, 0x00, 0x00, // f4 padding
0x05, 0x00, 0x00, 0x00, // f5
0x00, 0x00, 0x00, 0x00, // f5
0x06, 0x00, 0x00, 0x00, // f6 and padding
0x00, 0x00, 0x00, 0x00, // f6 padding
],
},
}
success("Regression2") {
value = Regression2 {
head: Regression1 {
f1: 0x01,
f2: 0x02,
f3: 0x03,
f4: 0x04,
f5: 0x05,
f6: 0x06,
},
f7: 0x07,
},
bytes = {
v1 = [
0x01, 0x00, 0x00, 0x00, // f1 and padding
0x02, 0x00, 0x00, 0x00, // f2 and padding
0x03, 0x00, 0x04, 0x00, // f3, f3 padding and f4
0x00, 0x00, 0x00, 0x00, // f4 padding
0x05, 0x00, 0x00, 0x00, // f5
0x00, 0x00, 0x00, 0x00, // f5
0x06, 0x00, 0x00, 0x00, // f6 and padding
0x00, 0x00, 0x00, 0x00, // f6 padding
0x07, 0x00, 0x00, 0x00, // f7 and padding
0x00, 0x00, 0x00, 0x00, // f7 padding
],
},
}
success("Regression3Absent") {
value = Regression3 {
},
bytes = {
v1 = [
0x00, 0x00, 0x00, 0x00, // opt_value.absence
0x00, 0x00, 0x00, 0x00, // opt_value.absence [cont.]
],
},
}
success("Regression3Present") {
value = Regression3 {
opt_value: Regression2 {
head: Regression1 {
f1: 0x01,
f2: 0x02,
f3: 0x03,
f4: 0x04,
f5: 0x05,
f6: 0x06,
},
f7: 0x07,
},
},
bytes = {
v1 = [
0xFF, 0xFF, 0xFF, 0xFF, // opt_value.presence
0xFF, 0xFF, 0xFF, 0xFF, // opt_value.presence [cont.]
0x01, 0x00, 0x00, 0x00, // f1 and padding
0x02, 0x00, 0x00, 0x00, // f2 and padding
0x03, 0x00, 0x04, 0x00, // f3, f3 padding and f4
0x00, 0x00, 0x00, 0x00, // f4 padding
0x05, 0x00, 0x00, 0x00, // f5
0x00, 0x00, 0x00, 0x00, // f5
0x06, 0x00, 0x00, 0x00, // f6 and padding
0x00, 0x00, 0x00, 0x00, // f6 padding
0x07, 0x00, 0x00, 0x00, // f7 and padding
0x00, 0x00, 0x00, 0x00, // f7 padding
],
},
}
success("Size5Alignment1Array") {
value = Size5Alignment1Array {
a: [
Size5Alignment1 {
data: [0x01, 0x02, 0x03, 0x04, 0x05],
},
Size5Alignment1 {
data: [0x06, 0x07, 0x08, 0x09, 0x0a],
},
Size5Alignment1 {
data: [0x0b, 0x0c, 0x0d, 0x0e, 0x0f],
},
],
},
bytes = {
v1 = [
0x01, 0x02, 0x03, 0x04, // a.data[0]
0x05, 0x06, 0x07, 0x08, // a.data[0] & a.data[1]
0x09, 0x0a, 0x0b, 0x0c, // a.data[1] & a.data[2]
0x0d, 0x0e, 0x0f, 0x00, // a.data[2] & padding
],
},
}
success("Size5Alignment4Array") {
value = Size5Alignment4Array {
a: [
Size5Alignment4 {
four: 0x04030201,
one: 0x05,
},
Size5Alignment4 {
four: 0x09080706,
one: 0x0a,
},
Size5Alignment4 {
four: 0x0e0d0c0b,
one: 0x0f,
},
],
},
bytes = {
v1 = [
0x01, 0x02, 0x03, 0x04, // a[0].four
0x05, 0x00, 0x00, 0x00, // a[0].one + padding
0x06, 0x07, 0x08, 0x09, // a[1].four
0x0a, 0x00, 0x00, 0x00, // a[1].one + padding
0x0b, 0x0c, 0x0d, 0x0e, // a[2].four
0x0f, 0x00, 0x00, 0x00, // a[2].one + padding
],
},
}
success("Size5Alignment1Vector") {
value = Size5Alignment1Vector {
v: [
Size5Alignment1 {
data: [0x01, 0x02, 0x03, 0x04, 0x05],
},
Size5Alignment1 {
data: [0x06, 0x07, 0x08, 0x09, 0x0a],
},
],
},
bytes = {
v1 = [
0x02, 0x00, 0x00, 0x00, // v.size
0x00, 0x00, 0x00, 0x00, // v.size [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // v.presence
0xFF, 0xFF, 0xFF, 0xFF, // v.presence [cont.]
0x01, 0x02, 0x03, 0x04, // v[0].a.data
0x05, 0x06, 0x07, 0x08, // v[0].a.data [cont.] & v[1].a.data
0x09, 0x0a, 0x00, 0x00, // v[1].a.data [cont.] & padding
0x00, 0x00, 0x00, 0x00, // padding for top-level struct
],
},
}
success("Size5Alignment4Vector") {
value = Size5Alignment4Vector {
v: [
Size5Alignment4 {
four: 0x04030201,
one: 0x05,
},
Size5Alignment4 {
four: 0x09080706,
one: 0x0a,
},
],
},
bytes = {
v1 = [
0x02, 0x00, 0x00, 0x00, // v.size
0x00, 0x00, 0x00, 0x00, // v.size [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // v.presence
0xFF, 0xFF, 0xFF, 0xFF, // v.presence [cont.]
0x01, 0x02, 0x03, 0x04, // a[0].four
0x05, 0x00, 0x00, 0x00, // a[0].one + padding
0x06, 0x07, 0x08, 0x09, // a[1].four
0x0a, 0x00, 0x00, 0x00, // a[1].one + padding
],
},
}
success("Table_NoFields") {
// TODO(fxbug.dev/40782): Fix encoding bug in LLCPP.
bindings_denylist = [llcpp],
value = Struct_Table_NoFields {
t: Table_NoFields {},
},
bytes = {
v1 = [
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("Table_TwoReservedFields") {
// TODO(fxbug.dev/40782): Fix encoding bug in LLCPP.
bindings_denylist = [llcpp],
value = Struct_Table_TwoReservedFields {
t: Table_TwoReservedFields {},
},
bytes = {
v1 = [
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("Table_StructWithReservedSandwich") {
value = Table_StructWithReservedSandwichStruct {
table: Table_StructWithReservedSandwich {
s1: StructSize3Align1 {
three_bytes: [ 0x09, 0x0a, 0x0b ]
},
s2: StructSize3Align1 {
three_bytes: [ 0x19, 0x1a, 0x1b ]
},
}
},
bytes = {
v1 = [
0x03, 0x00, 0x00, 0x00, // Table_StructWithReservedSandwich.vector<envelope>.size
0x00, 0x00, 0x00, 0x00, // [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // Table_StructWithReservedSandwich.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.]
],
},
}
success("Table_StructWithUint32Sandwich") {
value = Table_StructWithUint32SandwichStruct {
table: Table_StructWithUint32Sandwich {
i: 0x04030201,
s1: StructSize3Align1 {
three_bytes: [ 0x09, 0x0a, 0x0b ]
},
s2: StructSize3Align1 {
three_bytes: [ 0x19, 0x1a, 0x1b ]
},
i2: 0x0d0c0b0a,
}
},
bytes = {
v1 = [
0x04, 0x00, 0x00, 0x00, // Table_StructWithUint32Sandwich.vector<envelope>.size
0x00, 0x00, 0x00, 0x00, // [cont.]
0xFF, 0xFF, 0xFF, 0xFF, // Table_StructWithUint32Sandwich.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
],
},
}
success("Table_UnionWithVector_ReservedSandwich") {
value = Table_UnionWithVector_ReservedSandwichStruct {
table: Table_UnionWithVector_ReservedSandwich {
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
],
},
}
success("Table_UnionWithVector_StructSandwich") {
value = Table_UnionWithVector_StructSandwichStruct {
table: Table_UnionWithVector_StructSandwich {
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
],
},
}
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
],
},
}
success("TransformerEmptyStruct") {
value = TransformerEmptyStruct {},
bytes = {
v1 = [
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, //
],
},
}
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, //
],
},
}
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
],
},
}
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
],
},
}
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
],
},
}
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 = [
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 = [
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 = [
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
],
},
}
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
],
},
}
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, //
],
},
}
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
],
},
}
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.]
],
},
}
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
],
},
}
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)
],
},
}
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, //
],
},
}
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, //
],
},
}
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, //
],
},
}
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, //
],
},
}
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 = [
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, //
],
},
}
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)
],
},
}
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.)
],
},
}