| // 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("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) |
| ], |
| v2 = [ |
| 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.value |
| 0x00, 0x00, 0x01, 0x00, // UnionSize8Aligned4.env.num_handle, UnionSize8Aligned4.env.inlined |
| |
| 0x05, 0x06, 0x07, 0x08, // Sandwich1.after |
| 0x00, 0x00, 0x00, 0x00, // Sandwich1.after (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) |
| ], |
| 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, // 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.value |
| 0x00, 0x00, 0x01, 0x00, // UnionSize8Aligned4.env.num_handle, UnionSize8Aligned4.env.inlined |
| |
| 0x05, 0x06, 0x07, 0x08, // Sandwich1.after |
| 0x00, 0x00, 0x00, 0x00, // Sandwich1.after (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) |
| ], |
| v2 = [ |
| 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.value |
| 0x00, 0x00, 0x01, 0x00, // UnionSize8Aligned4.env.num_handle, UnionSize8Aligned4.env.inlined |
| |
| 0x05, 0x06, 0x07, 0x08, // Sandwich1WithOptUnion.after |
| 0x00, 0x00, 0x00, 0x00, // Sandwich1WithOptUnion.after (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) |
| ], |
| v2 = [ |
| 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) |
| ], |
| }, |
| } |
| |
| 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 |
| ], |
| v2 = [ |
| 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 |
| |
| 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("StructSize16Align8_randomly_generated") { |
| value = StructSize16Align8{ |
| f1: 8119191415388800797, |
| f2: 3921240220962863111, |
| }, |
| bytes = { |
| v1, v2 = [ |
| num(8119191415388800797):8, // f1 |
| num(3921240220962863111):8, // f2 |
| ], |
| }, |
| } |
| |
| 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.] |
| ], |
| v2 = [ |
| 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 |
| |
| 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.] |
| ], |
| v2 = [ |
| 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 |
| |
| 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.] |
| ], |
| v2 = [ |
| 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 |
| |
| 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) |
| ], |
| v2 = [ |
| 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 |
| 0x10, 0x00, 0x00, 0x00, // Sandwich5.UnionOfUnion.env.num_bytes |
| 0x00, 0x00, 0x00, 0x00, // Sandwich5.UnionOfUnion.env.num_handle |
| |
| 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 |
| 0x09, 0x0a, 0x0b, 0x0c, // UnionOfUnion.UnionSize8Aligned4.env.value |
| 0x00, 0x00, 0x01, 0x00, // UnionOfUnion.UnionSize8Aligned4.env.num_handle, UnionOfUnion.UnionSize8Aligned4.env.inlined |
| ], |
| }, |
| } |
| |
| 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) |
| ], |
| 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, // Sandwich5.before |
| 0x00, 0x00, 0x00, 0x00, // Sandwich5.before (padding) |
| |
| 0x02, 0x00, 0x00, 0x00, // Sandwich5.UnionOfUnion.ordinal |
| 0x00, 0x00, 0x00, 0x00, // Sandwich5.UnionOfUnion.padding |
| 0x10, 0x00, 0x00, 0x00, // Sandwich5.UnionOfUnion.env.num_bytes |
| 0x00, 0x00, 0x00, 0x00, // Sandwich5.UnionOfUnion.env.num_handle |
| |
| 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 |
| 0x09, 0x0a, 0x0b, 0x0c, // UnionOfUnion.UnionSize8Aligned4.env.num_bytes |
| 0x00, 0x00, 0x01, 0x00, // UnionOfUnion.UnionSize8Aligned4.env.num_handle, UnionOfUnion.UnionSize8Aligned4.env.inlined |
| ], |
| }, |
| } |
| |
| 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.] |
| ], |
| v2 = [ |
| 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 |
| 0x20, 0x00, 0x00, 0x00, // Sandwich5.UnionOfUnion.env.num_bytes |
| 0x00, 0x00, 0x00, 0x00, // Sandwich5.UnionOfUnion.env.num_handle |
| |
| 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 |
| |
| 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.] |
| ], |
| 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, // Sandwich5.before |
| 0x00, 0x00, 0x00, 0x00, // Sandwich5.before (padding) |
| |
| 0x05, 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 |
| |
| 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 |
| |
| 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("StructSize3Align2_randomly_generated") { |
| value = StructSize3Align2{ |
| f1: 8940, |
| f2: 203, |
| }, |
| bytes = { |
| v1, v2 = [ |
| num(8940):2, // f1 |
| 203, // f2 |
| padding:5, |
| ], |
| }, |
| } |
| |
| 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 |
| ], |
| v2 = [ |
| 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 |
| |
| 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.] |
| ], |
| v2 = [ |
| 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 |
| |
| 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 |
| ], |
| v2 = [ |
| 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 |
| |
| 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) |
| ], |
| v2 = [ |
| 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 |
| |
| 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) |
| ], |
| v2 = [ |
| 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 |
| |
| 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) |
| ], |
| v2 = [ |
| 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 |
| |
| 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 |
| ], |
| v2 = [ |
| 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 |
| |
| 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 |
| ], |
| v2 = [ |
| 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 |
| |
| 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) |
| ], |
| v2 = [ |
| 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) |
| 0x20, 0x00, 0x00, 0x00, // UnionWithVector.env.num_bytes |
| 0x00, 0x00, 0x00, 0x00, // UnionWithVector.env.num_handle |
| |
| 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) |
| 0x09, 0x0a, 0x0b, 0x0c, // UnionSize8Align4.env.num_bytes |
| 0x00, 0x00, 0x01, 0x00, // UnionSize8Align4.env.num_handle, UnionSize8Align4.env.inlined |
| ], |
| }, |
| } |
| |
| 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) |
| ], |
| v2 = [ |
| 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 |
| 0x09, 0x0a, 0x0b, 0x0c, // UnionSize8Aligned4.env.value |
| 0x00, 0x00, 0x01, 0x00, // UnionSize8Aligned4.env.num_handle, UnionSize8Aligned4.env.inlined |
| 0x05, 0x06, 0x07, 0x08, // Sandwich1.after |
| 0x00, 0x00, 0x00, 0x00, // Sandwich1.after (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) |
| ], |
| v2 = [ |
| 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 |
| 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) |
| ], |
| }, |
| } |
| |
| success("Sandwich7Case2") { |
| value = Sandwich7{ |
| before: 0x14131211, |
| after: 0x24232221, |
| }, |
| bytes = { |
| v1, v2 = [ |
| 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, v2 = [ |
| 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, v2 = [ |
| 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, v2 = [ |
| 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, v2 = [ |
| 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, v2 = [ |
| 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, v2 = [ |
| 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("Size5Alignment4_randomly_generated") { |
| value = Size5Alignment4{ |
| four: 1063731487, |
| one: 225, |
| }, |
| bytes = { |
| v1, v2 = [ |
| num(1063731487):4, // four |
| 225, // one |
| padding:3, |
| ], |
| }, |
| } |
| |
| success("Size5Alignment4Array") { |
| value = Size5Alignment4Array{ |
| a: [ |
| Size5Alignment4{ |
| four: 0x04030201, |
| one: 0x05, |
| }, |
| Size5Alignment4{ |
| four: 0x09080706, |
| one: 0x0a, |
| }, |
| Size5Alignment4{ |
| four: 0x0e0d0c0b, |
| one: 0x0f, |
| }, |
| ], |
| }, |
| bytes = { |
| v1, v2 = [ |
| 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, v2 = [ |
| 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, v2 = [ |
| 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 |
| ], |
| }, |
| } |