| // 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. |
| // |
| // Code generated by tools/fidl/gidl-conformance-suite/regen.sh; DO NOT EDIT. |
| |
| import 'dart:typed_data'; |
| |
| import 'package:test/test.dart'; |
| import 'package:fidl/fidl.dart' as fidl; |
| |
| import 'conformance_test_types.dart'; |
| import 'gidl.dart'; |
| |
| void main() { |
| group('conformance', () { |
| group('encode success cases', () { |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'AddEthernetDeviceRequest_v1', |
| TestAddEthernetDeviceRequest( |
| topologicalPath: '@/dev/sys/pci/00:03.0/e1000/ethernet', |
| config: InterfaceConfig( |
| name: 'ethp0003', |
| ipAddressConfig: IpAddressConfig.withDhcp(true)), |
| thisShouldBeAHandle: 0xffffffff), |
| kTestAddEthernetDeviceRequest_Type, |
| Uint8List.fromList([ |
| 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // |
| 0x40, 0x2f, 0x64, 0x65, 0x76, 0x2f, 0x73, 0x79, // |
| 0x73, 0x2f, 0x70, 0x63, 0x69, 0x2f, 0x30, 0x30, // |
| 0x3a, 0x30, 0x33, 0x2e, 0x30, 0x2f, 0x65, 0x31, // |
| 0x30, 0x30, 0x30, 0x2f, 0x65, 0x74, 0x68, 0x65, // |
| 0x72, 0x6e, 0x65, 0x74, 0x00, 0x00, 0x00, 0x00, // |
| 0x65, 0x74, 0x68, 0x70, 0x30, 0x30, 0x30, 0x33, // |
| 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Optionals_v1', |
| StructWithOptionals( |
| s: EmptyStruct(), |
| s2: EmptyStruct(), |
| t: TableWithEmptyStruct(s: EmptyStruct()), |
| xu: XUnionWithEmptyStruct.withS(EmptyStruct()), |
| xu2: XUnionWithEmptyStruct.withS(EmptyStruct()), |
| u: UnionWithEmptyStruct.withS(EmptyStruct()), |
| u2: UnionWithEmptyStruct.withS(EmptyStruct())), |
| kStructWithOptionals_Type, |
| Uint8List.fromList([ |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0xfe, 0xe0, 0x99, 0x74, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0xfe, 0xe0, 0x99, 0x74, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Sandwich1Case1_v1', |
| Sandwich1( |
| before: 0x4030201, |
| theUnion: UnionSize8Align4.withVariant(0xc0b0a09), |
| after: 0x8070605), |
| kSandwich1_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x09, 0x0a, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Sandwich1WithOptUnionPresent_v1', |
| Sandwich1WithOptUnion( |
| before: 0x4030201, |
| optUnion: UnionSize8Align4.withVariant(0xc0b0a09), |
| after: 0x8070605), |
| kSandwich1WithOptUnion_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x09, 0x0a, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Sandwich1WithOptUnionAbsent_v1', |
| Sandwich1WithOptUnion(before: 0x4030201, after: 0x8070605), |
| kSandwich1WithOptUnion_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Sandwich2Case1_v1', |
| Sandwich2( |
| before: 0x4030201, |
| theUnion: UnionSize12Align4.withVariant( |
| Uint8List.fromList([0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5])), |
| after: 0x8070605), |
| kSandwich2_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Sandwich3Case1_v1', |
| Sandwich3( |
| before: 0x4030201, |
| theUnion: UnionSize24Align8.withVariant(StructSize16Align8( |
| f1: 0xa7a6a5a4a3a2a1a0, f2: 0xafaeadacabaaa9a8)), |
| after: 0x8070605), |
| kSandwich3_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, // |
| 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Sandwich4Case1_v1', |
| Sandwich4( |
| before: 0x4030201, |
| theUnion: UnionSize36Align4.withVariant(Uint8List.fromList([ |
| 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: 0x8070605), |
| kSandwich4_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 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, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Sandwich5Case1_v1', |
| Sandwich5( |
| before: 0x4030201, |
| unionOfUnion: UnionOfUnion.withSize8align4( |
| UnionSize8Align4.withVariant(0xc0b0a09)), |
| after: 0x8070605), |
| kSandwich5_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x09, 0x0a, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Sandwich5Case2_v1', |
| Sandwich5( |
| before: 0x4030201, |
| unionOfUnion: UnionOfUnion.withSize24align8( |
| UnionSize24Align8.withVariant(StructSize16Align8( |
| f1: 0xa7a6a5a4a3a2a1a0, f2: 0xafaeadacabaaa9a8))), |
| after: 0x8070605), |
| kSandwich5_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, // |
| 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Sandwich6Case1_v1', |
| Sandwich6( |
| before: 0x4030201, |
| theUnion: UnionWithVector.withVectorOfUint8( |
| Uint8List.fromList([0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5])), |
| after: 0x8070605), |
| kSandwich6_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Sandwich6Case1AbsentVector_v1', |
| Sandwich6( |
| before: 0x4030201, |
| theUnion: |
| UnionWithVector.withVectorOfUint8(Uint8List.fromList([])), |
| after: 0x8070605), |
| kSandwich6_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Sandwich6Case2_v1', |
| Sandwich6( |
| before: 0x4030201, |
| theUnion: UnionWithVector.withS('soft migrations rock!'), |
| after: 0x8070605), |
| kSandwich6_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x73, 0x6f, 0x66, 0x74, 0x20, 0x6d, 0x69, 0x67, // |
| 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, // |
| 0x72, 0x6f, 0x63, 0x6b, 0x21, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Sandwich6Case3_v1', |
| Sandwich6( |
| before: 0x4030201, |
| theUnion: UnionWithVector.withVectorS3A1([ |
| StructSize3Align1( |
| threeBytes: Uint8List.fromList([0x73, 0x6f, 0x66])), |
| StructSize3Align1( |
| threeBytes: Uint8List.fromList([0x20, 0x6d, 0x69])), |
| StructSize3Align1( |
| threeBytes: Uint8List.fromList([0x72, 0x61, 0x74])) |
| ]), |
| after: 0x8070605), |
| kSandwich6_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x73, 0x6f, 0x66, 0x20, 0x6d, 0x69, 0x72, 0x61, // |
| 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Sandwich6Case4_v1', |
| Sandwich6( |
| before: 0x4030201, |
| theUnion: UnionWithVector.withVectorS3A2([ |
| StructSize3Align2(f1: 0x6f73, f2: 0x66), |
| StructSize3Align2(f1: 0x6d20, f2: 0x69), |
| StructSize3Align2(f1: 0x6172, f2: 0x74) |
| ]), |
| after: 0x8070605), |
| kSandwich6_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x73, 0x6f, 0x66, 0x00, 0x20, 0x6d, 0x69, 0x00, // |
| 0x72, 0x61, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Sandwich6Case5_v1', |
| Sandwich6( |
| before: 0x4030201, |
| theUnion: UnionWithVector.withHandles( |
| Uint32List.fromList([0xffffffff, 0xffffffff, 0xffffffff])), |
| after: 0x8070605), |
| kSandwich6_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Sandwich6Case6_v1', |
| Sandwich6( |
| before: 0x4030201, |
| theUnion: UnionWithVector.withArrayS3A1([ |
| StructSize3Align1( |
| threeBytes: Uint8List.fromList([0xa1, 0xa2, 0xa3])), |
| StructSize3Align1( |
| threeBytes: Uint8List.fromList([0xa4, 0xa5, 0xa6])) |
| ]), |
| after: 0x8070605), |
| kSandwich6_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Sandwich6Case7_v1', |
| Sandwich6( |
| before: 0x4030201, |
| theUnion: UnionWithVector.withArrayS3A2([ |
| StructSize3Align2(f1: 0xa2a1, f2: 0xa3), |
| StructSize3Align2(f1: 0xa5a4, f2: 0xa6) |
| ]), |
| after: 0x8070605), |
| kSandwich6_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0xa1, 0xa2, 0xa3, 0x00, 0xa4, 0xa5, 0xa6, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Sandwich6Case8_v1', |
| Sandwich6( |
| before: 0x4030201, |
| theUnion: UnionWithVector.withVectorUnion( |
| [UnionSize8Align4.withVariant(0xc0b0a09)]), |
| after: 0x8070605), |
| kSandwich6_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x09, 0x0a, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Sandwich7Case1_v1', |
| Sandwich7( |
| before: 0x14131211, |
| optSandwich1: Sandwich1( |
| before: 0x4030201, |
| theUnion: UnionSize8Align4.withVariant(0xc0b0a09), |
| after: 0x8070605), |
| after: 0x24232221), |
| kSandwich7_Type, |
| Uint8List.fromList([ |
| 0x11, 0x12, 0x13, 0x14, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x21, 0x22, 0x23, 0x24, 0x00, 0x00, 0x00, 0x00, // |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x09, 0x0a, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Sandwich7Case2_v1', |
| Sandwich7(before: 0x14131211, after: 0x24232221), |
| kSandwich7_Type, |
| Uint8List.fromList([ |
| 0x11, 0x12, 0x13, 0x14, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x21, 0x22, 0x23, 0x24, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Regression1_v1', |
| Regression1(f1: 0x1, f2: 0x2, f3: 0x3, f4: 0x4, f5: 0x5, f6: 0x6), |
| kRegression1_Type, |
| Uint8List.fromList([ |
| 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Regression2_v1', |
| Regression2( |
| head: Regression1( |
| f1: 0x1, f2: 0x2, f3: 0x3, f4: 0x4, f5: 0x5, f6: 0x6), |
| f7: 0x7), |
| kRegression2_Type, |
| Uint8List.fromList([ |
| 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Regression3Absent_v1', |
| Regression3(), |
| kRegression3_Type, |
| Uint8List.fromList([ |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Regression3Present_v1', |
| Regression3( |
| optValue: Regression2( |
| head: Regression1( |
| f1: 0x1, f2: 0x2, f3: 0x3, f4: 0x4, f5: 0x5, f6: 0x6), |
| f7: 0x7)), |
| kRegression3_Type, |
| Uint8List.fromList([ |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Size5Alignment1Array_v1', |
| Size5Alignment1Array(a: [ |
| Size5Alignment1( |
| data: Uint8List.fromList([0x1, 0x2, 0x3, 0x4, 0x5])), |
| Size5Alignment1( |
| data: Uint8List.fromList([0x6, 0x7, 0x8, 0x9, 0xa])), |
| Size5Alignment1(data: Uint8List.fromList([0xb, 0xc, 0xd, 0xe, 0xf])) |
| ]), |
| kSize5Alignment1Array_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, // |
| 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Size5Alignment4Array_v1', |
| Size5Alignment4Array(a: [ |
| Size5Alignment4(four: 0x4030201, one: 0x5), |
| Size5Alignment4(four: 0x9080706, one: 0xa), |
| Size5Alignment4(four: 0xe0d0c0b, one: 0xf) |
| ]), |
| kSize5Alignment4Array_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x05, 0x00, 0x00, 0x00, // |
| 0x06, 0x07, 0x08, 0x09, 0x0a, 0x00, 0x00, 0x00, // |
| 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Size5Alignment1Vector_v1', |
| Size5Alignment1Vector(v: [ |
| Size5Alignment1( |
| data: Uint8List.fromList([0x1, 0x2, 0x3, 0x4, 0x5])), |
| Size5Alignment1(data: Uint8List.fromList([0x6, 0x7, 0x8, 0x9, 0xa])) |
| ]), |
| kSize5Alignment1Vector_Type, |
| Uint8List.fromList([ |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, // |
| 0x09, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Size5Alignment4Vector_v1', |
| Size5Alignment4Vector(v: [ |
| Size5Alignment4(four: 0x4030201, one: 0x5), |
| Size5Alignment4(four: 0x9080706, one: 0xa) |
| ]), |
| kSize5Alignment4Vector_Type, |
| Uint8List.fromList([ |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x01, 0x02, 0x03, 0x04, 0x05, 0x00, 0x00, 0x00, // |
| 0x06, 0x07, 0x08, 0x09, 0x0a, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Table_StructWithReservedSandwich_v1', |
| TableStructWithReservedSandwichStruct( |
| table: TableStructWithReservedSandwich( |
| s1: StructSize3Align1( |
| threeBytes: Uint8List.fromList([0x9, 0xa, 0xb])), |
| s2: StructSize3Align1( |
| threeBytes: Uint8List.fromList([0x19, 0x1a, 0x1b])))), |
| kTable_StructWithReservedSandwichStruct_Type, |
| Uint8List.fromList([ |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x09, 0x0a, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x19, 0x1a, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Table_StructWithUint32Sandwich_v1', |
| TableStructWithUint32SandwichStruct( |
| table: TableStructWithUint32Sandwich( |
| i: 0x4030201, |
| s1: StructSize3Align1( |
| threeBytes: Uint8List.fromList([0x9, 0xa, 0xb])), |
| s2: StructSize3Align1( |
| threeBytes: Uint8List.fromList([0x19, 0x1a, 0x1b])), |
| i2: 0xd0c0b0a)), |
| kTable_StructWithUint32SandwichStruct_Type, |
| Uint8List.fromList([ |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x09, 0x0a, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x19, 0x1a, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x0a, 0x0b, 0x0c, 0x0d, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Table_UnionWithVector_ReservedSandwich_v1', |
| TableUnionWithVectorReservedSandwichStruct( |
| table: TableUnionWithVectorReservedSandwich( |
| uv: UnionWithVector.withS('hello'))), |
| kTable_UnionWithVector_ReservedSandwichStruct_Type, |
| Uint8List.fromList([ |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Table_UnionWithVector_StructSandwich_v1', |
| TableUnionWithVectorStructSandwichStruct( |
| table: TableUnionWithVectorStructSandwich( |
| s1: StructSize3Align1( |
| threeBytes: Uint8List.fromList([0x1, 0x2, 0x3])), |
| uv: UnionWithVector.withS('hello'), |
| s2: StructSize3Align1( |
| threeBytes: Uint8List.fromList([0x4, 0x5, 0x6])))), |
| kTable_UnionWithVector_StructSandwichStruct_Type, |
| Uint8List.fromList([ |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x01, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x00, 0x00, 0x00, // |
| 0x04, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'XUnionWithStruct_v1', |
| XUnionWithStructStruct( |
| xu: XUnionWithStruct.withS(StructSize3Align1( |
| threeBytes: Uint8List.fromList([0x1, 0x2, 0x3])))), |
| kXUnionWithStructStruct_Type, |
| Uint8List.fromList([ |
| 0x14, 0x5c, 0x3e, 0x19, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x01, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'ArrayStruct_v1', |
| ArrayStruct(unions: [ |
| StringUnion.withS('one'), |
| StringUnion.withS('two'), |
| StringUnion.withS('three') |
| ], optionalUnions: [ |
| StringUnion.withS('four'), |
| StringUnion.withS('five'), |
| StringUnion.withS('six') |
| ]), |
| kArrayStruct_Type, |
| Uint8List.fromList([ |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x6f, 0x6e, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x74, 0x77, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x74, 0x68, 0x72, 0x65, 0x65, 0x00, 0x00, 0x00, // |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x66, 0x6f, 0x75, 0x72, 0x00, 0x00, 0x00, 0x00, // |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x66, 0x69, 0x76, 0x65, 0x00, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x73, 0x69, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'TransformerEmptyStruct_v1', |
| TransformerEmptyStruct(), |
| kTransformerEmptyStruct_Type, |
| Uint8List.fromList([ |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'EmptyStructUnion_v1', |
| EmptyStructUnionStruct( |
| u: EmptyStructUnion.withEs(TransformerEmptyStruct())), |
| kEmptyStructUnionStruct_Type, |
| Uint8List.fromList([ |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'NoCodingTablesStressor_v1', |
| NoCodingTablesStressor( |
| f1: 0x1111111111111111, |
| f2: 0x2222222222222222, |
| u1: UnionSize36Align4.withVariant(Uint8List.fromList([ |
| 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.withVariant(Uint8List.fromList([ |
| 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.withVariant(Uint8List.fromList([ |
| 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), |
| kNoCodingTablesStressor_Type, |
| Uint8List.fromList([ |
| 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, // |
| 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, // |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, // |
| 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, // |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, // |
| 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, // |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, // |
| 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, // |
| 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, // |
| 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, // |
| 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, // |
| 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, // |
| 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, // |
| 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, // |
| 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, // |
| 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, // |
| 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, // |
| 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, // |
| 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, // |
| 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, // |
| 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'OutOfLineSandwich1Case1_v1', |
| OutOfLineSandwich1( |
| before: 'soft migrations rock!', |
| v: [ |
| Sandwich1( |
| before: 0x4030201, |
| theUnion: UnionSize8Align4.withVariant(0xc0b0a09), |
| after: 0x8070605) |
| ], |
| after: 'hard transitions suck!'), |
| kOutOfLineSandwich1_Type, |
| Uint8List.fromList([ |
| 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x73, 0x6f, 0x66, 0x74, 0x20, 0x6d, 0x69, 0x67, // |
| 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, // |
| 0x72, 0x6f, 0x63, 0x6b, 0x21, 0x00, 0x00, 0x00, // |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x09, 0x0a, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, // |
| 0x68, 0x61, 0x72, 0x64, 0x20, 0x74, 0x72, 0x61, // |
| 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, // |
| 0x20, 0x73, 0x75, 0x63, 0x6b, 0x21, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'OutOfLineSandwich1WithOptUnionPresent_v1', |
| OutOfLineSandwich1WithOptUnion( |
| before: 'soft migrations rock!', |
| v: [ |
| Sandwich1WithOptUnion( |
| before: 0x4030201, |
| optUnion: UnionSize8Align4.withVariant(0xc0b0a09), |
| after: 0x8070605) |
| ], |
| after: 'hard transitions suck!'), |
| kOutOfLineSandwich1WithOptUnion_Type, |
| Uint8List.fromList([ |
| 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x73, 0x6f, 0x66, 0x74, 0x20, 0x6d, 0x69, 0x67, // |
| 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, // |
| 0x72, 0x6f, 0x63, 0x6b, 0x21, 0x00, 0x00, 0x00, // |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x09, 0x0a, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, // |
| 0x68, 0x61, 0x72, 0x64, 0x20, 0x74, 0x72, 0x61, // |
| 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, // |
| 0x20, 0x73, 0x75, 0x63, 0x6b, 0x21, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'OutOfLineSandwich1WithOptUnionAbsent_v1', |
| OutOfLineSandwich1WithOptUnion( |
| before: 'soft migrations rock!', |
| v: [Sandwich1WithOptUnion(before: 0x4030201, after: 0x8070605)], |
| after: 'hard transitions suck!'), |
| kOutOfLineSandwich1WithOptUnion_Type, |
| Uint8List.fromList([ |
| 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x73, 0x6f, 0x66, 0x74, 0x20, 0x6d, 0x69, 0x67, // |
| 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, // |
| 0x72, 0x6f, 0x63, 0x6b, 0x21, 0x00, 0x00, 0x00, // |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x68, 0x61, 0x72, 0x64, 0x20, 0x74, 0x72, 0x61, // |
| 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, // |
| 0x20, 0x73, 0x75, 0x63, 0x6b, 0x21, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Regression4_v1', |
| Regression4( |
| f1: 0x1, |
| f2: 0x2, |
| s1: StructSize3Align1( |
| threeBytes: Uint8List.fromList([0x9, 0xa, 0xb])), |
| f3: 0x3, |
| f4: 0x4, |
| f5: 0x5, |
| f6: 0x6), |
| kRegression4_Type, |
| Uint8List.fromList([ |
| 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // |
| 0x09, 0x0a, 0x0b, 0x03, 0x04, 0x00, 0x00, 0x00, // |
| 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Sandwich4Align8_v1', |
| Sandwich4Align8( |
| sandwich4: Sandwich4( |
| before: 0x4030201, |
| theUnion: UnionSize36Align4.withVariant(Uint8List.fromList([ |
| 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: 0x8070605), |
| alignment8Enforcement: 0x100f0e0d0c0b0a09), |
| kSandwich4Align8_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, // |
| 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, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Sandwich4Align8WithPointer_v1', |
| Sandwich4Align8WithPointer( |
| sandwich4: Sandwich4( |
| before: 0x4030201, |
| theUnion: UnionSize36Align4.withVariant(Uint8List.fromList([ |
| 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: 0x8070605), |
| alignment8Enforcement: Size8Align8(data: 0x100f0e0d0c0b0a09)), |
| kSandwich4Align8WithPointer_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 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, // |
| 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Sandwich8Case1_v1', |
| Sandwich8( |
| before: 0x4030201, |
| unionOfUnion: UnionOfUnion.withSize8align4( |
| UnionSize8Align4.withVariant(0xc0b0a09)), |
| after: 0x8070605), |
| kSandwich8_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x09, 0x0a, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'Sandwich9Case1_v1', |
| Sandwich9( |
| before: 0x201, |
| theUnion: UnionWithVectorOfVectors.withV([ |
| [ |
| StructSize3Align1( |
| threeBytes: Uint8List.fromList([0x10, 0x11, 0x12])), |
| StructSize3Align1( |
| threeBytes: Uint8List.fromList([0x13, 0x14, 0x15])) |
| ] |
| ]), |
| after: 0x1211), |
| kSandwich9_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x11, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x10, 0x11, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x13, 0x14, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'SimpleTableArrayStruct_v1', |
| SimpleTableArrayStruct(theArray: [ |
| TransformerSimpleTable(value: 0xa3a2a1a0), |
| TransformerSimpleTable(value: 0xb3b2b1b0) |
| ]), |
| kSimpleTableArrayStruct_Type, |
| Uint8List.fromList([ |
| 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0xa0, 0xa1, 0xa2, 0xa3, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0xb0, 0xb1, 0xb2, 0xb3, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'StringUnionVector_v1', |
| StringUnionVector(theVector: [ |
| StringUnion.withS('hello'), |
| StringUnion.withU8(0xaa), |
| StringUnion.withU8(0xbb) |
| ]), |
| kStringUnionVector_Type, |
| Uint8List.fromList([ |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x00, 0x00, 0x00, // |
| 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xbb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'CreateComponentRequest_v1', |
| CreateComponentRequest( |
| launchInfo: LaunchInfo( |
| url: |
| 'fuchsia-pkg://fuchsia.com/fidl_compatibility_test_server_rust_write_xunion#meta/fidl_compatibility_test_server_rust_write_xunion.cmx', |
| directoryRequest: 0xffffffff), |
| controller: 0xffffffff), |
| kCreateComponentRequest_Type, |
| Uint8List.fromList([ |
| 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // |
| 0x66, 0x75, 0x63, 0x68, 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, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'UnionWithBoundString_v1', |
| UnionWithBoundStringStruct( |
| v: UnionWithBoundString.withBoundFiveStr('abcd')), |
| kUnionWithBoundStringStruct_Type, |
| Uint8List.fromList([ |
| 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x61, 0x62, 0x63, 0x64, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'UnionMigration_SingleVariant_v1', |
| SingleVariantUnionStruct(u: SingleVariantUnion.withX(0x2a)), |
| kSingleVariantUnionStruct_Type, |
| Uint8List.fromList([ |
| 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| EncodeSuccessCase.run( |
| Encoders.v1, |
| 'ReverseOrdinalUnion_v1', |
| ReverseOrdinalUnionStruct(u: ReverseOrdinalUnion.withX(0x2a)), |
| kReverseOrdinalUnionStruct_Type, |
| Uint8List.fromList([ |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| }); |
| |
| group('decode success cases', () { |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'AddEthernetDeviceRequest_v1', |
| TestAddEthernetDeviceRequest( |
| topologicalPath: '@/dev/sys/pci/00:03.0/e1000/ethernet', |
| config: InterfaceConfig( |
| name: 'ethp0003', |
| ipAddressConfig: IpAddressConfig.withDhcp(true)), |
| thisShouldBeAHandle: 0xffffffff), |
| kTestAddEthernetDeviceRequest_Type, |
| Uint8List.fromList([ |
| 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // |
| 0x40, 0x2f, 0x64, 0x65, 0x76, 0x2f, 0x73, 0x79, // |
| 0x73, 0x2f, 0x70, 0x63, 0x69, 0x2f, 0x30, 0x30, // |
| 0x3a, 0x30, 0x33, 0x2e, 0x30, 0x2f, 0x65, 0x31, // |
| 0x30, 0x30, 0x30, 0x2f, 0x65, 0x74, 0x68, 0x65, // |
| 0x72, 0x6e, 0x65, 0x74, 0x00, 0x00, 0x00, 0x00, // |
| 0x65, 0x74, 0x68, 0x70, 0x30, 0x30, 0x30, 0x33, // |
| 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Optionals_v1', |
| StructWithOptionals( |
| s: EmptyStruct(), |
| s2: EmptyStruct(), |
| t: TableWithEmptyStruct(s: EmptyStruct()), |
| xu: XUnionWithEmptyStruct.withS(EmptyStruct()), |
| xu2: XUnionWithEmptyStruct.withS(EmptyStruct()), |
| u: UnionWithEmptyStruct.withS(EmptyStruct()), |
| u2: UnionWithEmptyStruct.withS(EmptyStruct())), |
| kStructWithOptionals_Type, |
| Uint8List.fromList([ |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0xfe, 0xe0, 0x99, 0x74, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0xfe, 0xe0, 0x99, 0x74, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Sandwich1Case1_v1', |
| Sandwich1( |
| before: 0x4030201, |
| theUnion: UnionSize8Align4.withVariant(0xc0b0a09), |
| after: 0x8070605), |
| kSandwich1_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x09, 0x0a, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Sandwich1WithOptUnionPresent_v1', |
| Sandwich1WithOptUnion( |
| before: 0x4030201, |
| optUnion: UnionSize8Align4.withVariant(0xc0b0a09), |
| after: 0x8070605), |
| kSandwich1WithOptUnion_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x09, 0x0a, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Sandwich1WithOptUnionAbsent_v1', |
| Sandwich1WithOptUnion(before: 0x4030201, after: 0x8070605), |
| kSandwich1WithOptUnion_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Sandwich2Case1_v1', |
| Sandwich2( |
| before: 0x4030201, |
| theUnion: UnionSize12Align4.withVariant( |
| Uint8List.fromList([0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5])), |
| after: 0x8070605), |
| kSandwich2_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Sandwich3Case1_v1', |
| Sandwich3( |
| before: 0x4030201, |
| theUnion: UnionSize24Align8.withVariant(StructSize16Align8( |
| f1: 0xa7a6a5a4a3a2a1a0, f2: 0xafaeadacabaaa9a8)), |
| after: 0x8070605), |
| kSandwich3_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, // |
| 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Sandwich4Case1_v1', |
| Sandwich4( |
| before: 0x4030201, |
| theUnion: UnionSize36Align4.withVariant(Uint8List.fromList([ |
| 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: 0x8070605), |
| kSandwich4_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 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, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Sandwich5Case1_v1', |
| Sandwich5( |
| before: 0x4030201, |
| unionOfUnion: UnionOfUnion.withSize8align4( |
| UnionSize8Align4.withVariant(0xc0b0a09)), |
| after: 0x8070605), |
| kSandwich5_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x09, 0x0a, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Sandwich5Case2_v1', |
| Sandwich5( |
| before: 0x4030201, |
| unionOfUnion: UnionOfUnion.withSize24align8( |
| UnionSize24Align8.withVariant(StructSize16Align8( |
| f1: 0xa7a6a5a4a3a2a1a0, f2: 0xafaeadacabaaa9a8))), |
| after: 0x8070605), |
| kSandwich5_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, // |
| 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Sandwich6Case1_v1', |
| Sandwich6( |
| before: 0x4030201, |
| theUnion: UnionWithVector.withVectorOfUint8( |
| Uint8List.fromList([0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5])), |
| after: 0x8070605), |
| kSandwich6_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Sandwich6Case1AbsentVector_v1', |
| Sandwich6( |
| before: 0x4030201, |
| theUnion: |
| UnionWithVector.withVectorOfUint8(Uint8List.fromList([])), |
| after: 0x8070605), |
| kSandwich6_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Sandwich6Case2_v1', |
| Sandwich6( |
| before: 0x4030201, |
| theUnion: UnionWithVector.withS('soft migrations rock!'), |
| after: 0x8070605), |
| kSandwich6_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x73, 0x6f, 0x66, 0x74, 0x20, 0x6d, 0x69, 0x67, // |
| 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, // |
| 0x72, 0x6f, 0x63, 0x6b, 0x21, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Sandwich6Case3_v1', |
| Sandwich6( |
| before: 0x4030201, |
| theUnion: UnionWithVector.withVectorS3A1([ |
| StructSize3Align1( |
| threeBytes: Uint8List.fromList([0x73, 0x6f, 0x66])), |
| StructSize3Align1( |
| threeBytes: Uint8List.fromList([0x20, 0x6d, 0x69])), |
| StructSize3Align1( |
| threeBytes: Uint8List.fromList([0x72, 0x61, 0x74])) |
| ]), |
| after: 0x8070605), |
| kSandwich6_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x73, 0x6f, 0x66, 0x20, 0x6d, 0x69, 0x72, 0x61, // |
| 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Sandwich6Case4_v1', |
| Sandwich6( |
| before: 0x4030201, |
| theUnion: UnionWithVector.withVectorS3A2([ |
| StructSize3Align2(f1: 0x6f73, f2: 0x66), |
| StructSize3Align2(f1: 0x6d20, f2: 0x69), |
| StructSize3Align2(f1: 0x6172, f2: 0x74) |
| ]), |
| after: 0x8070605), |
| kSandwich6_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x73, 0x6f, 0x66, 0x00, 0x20, 0x6d, 0x69, 0x00, // |
| 0x72, 0x61, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Sandwich6Case5_v1', |
| Sandwich6( |
| before: 0x4030201, |
| theUnion: UnionWithVector.withHandles( |
| Uint32List.fromList([0xffffffff, 0xffffffff, 0xffffffff])), |
| after: 0x8070605), |
| kSandwich6_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Sandwich6Case6_v1', |
| Sandwich6( |
| before: 0x4030201, |
| theUnion: UnionWithVector.withArrayS3A1([ |
| StructSize3Align1( |
| threeBytes: Uint8List.fromList([0xa1, 0xa2, 0xa3])), |
| StructSize3Align1( |
| threeBytes: Uint8List.fromList([0xa4, 0xa5, 0xa6])) |
| ]), |
| after: 0x8070605), |
| kSandwich6_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Sandwich6Case7_v1', |
| Sandwich6( |
| before: 0x4030201, |
| theUnion: UnionWithVector.withArrayS3A2([ |
| StructSize3Align2(f1: 0xa2a1, f2: 0xa3), |
| StructSize3Align2(f1: 0xa5a4, f2: 0xa6) |
| ]), |
| after: 0x8070605), |
| kSandwich6_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0xa1, 0xa2, 0xa3, 0x00, 0xa4, 0xa5, 0xa6, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Sandwich6Case8_v1', |
| Sandwich6( |
| before: 0x4030201, |
| theUnion: UnionWithVector.withVectorUnion( |
| [UnionSize8Align4.withVariant(0xc0b0a09)]), |
| after: 0x8070605), |
| kSandwich6_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x09, 0x0a, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Sandwich7Case1_v1', |
| Sandwich7( |
| before: 0x14131211, |
| optSandwich1: Sandwich1( |
| before: 0x4030201, |
| theUnion: UnionSize8Align4.withVariant(0xc0b0a09), |
| after: 0x8070605), |
| after: 0x24232221), |
| kSandwich7_Type, |
| Uint8List.fromList([ |
| 0x11, 0x12, 0x13, 0x14, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x21, 0x22, 0x23, 0x24, 0x00, 0x00, 0x00, 0x00, // |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x09, 0x0a, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Sandwich7Case2_v1', |
| Sandwich7(before: 0x14131211, after: 0x24232221), |
| kSandwich7_Type, |
| Uint8List.fromList([ |
| 0x11, 0x12, 0x13, 0x14, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x21, 0x22, 0x23, 0x24, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Regression1_v1', |
| Regression1(f1: 0x1, f2: 0x2, f3: 0x3, f4: 0x4, f5: 0x5, f6: 0x6), |
| kRegression1_Type, |
| Uint8List.fromList([ |
| 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Regression2_v1', |
| Regression2( |
| head: Regression1( |
| f1: 0x1, f2: 0x2, f3: 0x3, f4: 0x4, f5: 0x5, f6: 0x6), |
| f7: 0x7), |
| kRegression2_Type, |
| Uint8List.fromList([ |
| 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Regression3Absent_v1', |
| Regression3(), |
| kRegression3_Type, |
| Uint8List.fromList([ |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Regression3Present_v1', |
| Regression3( |
| optValue: Regression2( |
| head: Regression1( |
| f1: 0x1, f2: 0x2, f3: 0x3, f4: 0x4, f5: 0x5, f6: 0x6), |
| f7: 0x7)), |
| kRegression3_Type, |
| Uint8List.fromList([ |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Size5Alignment1Array_v1', |
| Size5Alignment1Array(a: [ |
| Size5Alignment1( |
| data: Uint8List.fromList([0x1, 0x2, 0x3, 0x4, 0x5])), |
| Size5Alignment1( |
| data: Uint8List.fromList([0x6, 0x7, 0x8, 0x9, 0xa])), |
| Size5Alignment1(data: Uint8List.fromList([0xb, 0xc, 0xd, 0xe, 0xf])) |
| ]), |
| kSize5Alignment1Array_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, // |
| 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Size5Alignment4Array_v1', |
| Size5Alignment4Array(a: [ |
| Size5Alignment4(four: 0x4030201, one: 0x5), |
| Size5Alignment4(four: 0x9080706, one: 0xa), |
| Size5Alignment4(four: 0xe0d0c0b, one: 0xf) |
| ]), |
| kSize5Alignment4Array_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x05, 0x00, 0x00, 0x00, // |
| 0x06, 0x07, 0x08, 0x09, 0x0a, 0x00, 0x00, 0x00, // |
| 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Size5Alignment1Vector_v1', |
| Size5Alignment1Vector(v: [ |
| Size5Alignment1( |
| data: Uint8List.fromList([0x1, 0x2, 0x3, 0x4, 0x5])), |
| Size5Alignment1(data: Uint8List.fromList([0x6, 0x7, 0x8, 0x9, 0xa])) |
| ]), |
| kSize5Alignment1Vector_Type, |
| Uint8List.fromList([ |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, // |
| 0x09, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Size5Alignment4Vector_v1', |
| Size5Alignment4Vector(v: [ |
| Size5Alignment4(four: 0x4030201, one: 0x5), |
| Size5Alignment4(four: 0x9080706, one: 0xa) |
| ]), |
| kSize5Alignment4Vector_Type, |
| Uint8List.fromList([ |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x01, 0x02, 0x03, 0x04, 0x05, 0x00, 0x00, 0x00, // |
| 0x06, 0x07, 0x08, 0x09, 0x0a, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Table_StructWithReservedSandwich_v1', |
| TableStructWithReservedSandwichStruct( |
| table: TableStructWithReservedSandwich( |
| s1: StructSize3Align1( |
| threeBytes: Uint8List.fromList([0x9, 0xa, 0xb])), |
| s2: StructSize3Align1( |
| threeBytes: Uint8List.fromList([0x19, 0x1a, 0x1b])))), |
| kTable_StructWithReservedSandwichStruct_Type, |
| Uint8List.fromList([ |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x09, 0x0a, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x19, 0x1a, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Table_StructWithUint32Sandwich_v1', |
| TableStructWithUint32SandwichStruct( |
| table: TableStructWithUint32Sandwich( |
| i: 0x4030201, |
| s1: StructSize3Align1( |
| threeBytes: Uint8List.fromList([0x9, 0xa, 0xb])), |
| s2: StructSize3Align1( |
| threeBytes: Uint8List.fromList([0x19, 0x1a, 0x1b])), |
| i2: 0xd0c0b0a)), |
| kTable_StructWithUint32SandwichStruct_Type, |
| Uint8List.fromList([ |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x09, 0x0a, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x19, 0x1a, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x0a, 0x0b, 0x0c, 0x0d, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Table_UnionWithVector_ReservedSandwich_v1', |
| TableUnionWithVectorReservedSandwichStruct( |
| table: TableUnionWithVectorReservedSandwich( |
| uv: UnionWithVector.withS('hello'))), |
| kTable_UnionWithVector_ReservedSandwichStruct_Type, |
| Uint8List.fromList([ |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Table_UnionWithVector_StructSandwich_v1', |
| TableUnionWithVectorStructSandwichStruct( |
| table: TableUnionWithVectorStructSandwich( |
| s1: StructSize3Align1( |
| threeBytes: Uint8List.fromList([0x1, 0x2, 0x3])), |
| uv: UnionWithVector.withS('hello'), |
| s2: StructSize3Align1( |
| threeBytes: Uint8List.fromList([0x4, 0x5, 0x6])))), |
| kTable_UnionWithVector_StructSandwichStruct_Type, |
| Uint8List.fromList([ |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x01, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x00, 0x00, 0x00, // |
| 0x04, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'XUnionWithStruct_v1', |
| XUnionWithStructStruct( |
| xu: XUnionWithStruct.withS(StructSize3Align1( |
| threeBytes: Uint8List.fromList([0x1, 0x2, 0x3])))), |
| kXUnionWithStructStruct_Type, |
| Uint8List.fromList([ |
| 0x14, 0x5c, 0x3e, 0x19, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x01, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'ArrayStruct_v1', |
| ArrayStruct(unions: [ |
| StringUnion.withS('one'), |
| StringUnion.withS('two'), |
| StringUnion.withS('three') |
| ], optionalUnions: [ |
| StringUnion.withS('four'), |
| StringUnion.withS('five'), |
| StringUnion.withS('six') |
| ]), |
| kArrayStruct_Type, |
| Uint8List.fromList([ |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x6f, 0x6e, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x74, 0x77, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x74, 0x68, 0x72, 0x65, 0x65, 0x00, 0x00, 0x00, // |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x66, 0x6f, 0x75, 0x72, 0x00, 0x00, 0x00, 0x00, // |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x66, 0x69, 0x76, 0x65, 0x00, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x73, 0x69, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'TransformerEmptyStruct_v1', |
| TransformerEmptyStruct(), |
| kTransformerEmptyStruct_Type, |
| Uint8List.fromList([ |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'EmptyStructUnion_v1', |
| EmptyStructUnionStruct( |
| u: EmptyStructUnion.withEs(TransformerEmptyStruct())), |
| kEmptyStructUnionStruct_Type, |
| Uint8List.fromList([ |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'NoCodingTablesStressor_v1', |
| NoCodingTablesStressor( |
| f1: 0x1111111111111111, |
| f2: 0x2222222222222222, |
| u1: UnionSize36Align4.withVariant(Uint8List.fromList([ |
| 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.withVariant(Uint8List.fromList([ |
| 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.withVariant(Uint8List.fromList([ |
| 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), |
| kNoCodingTablesStressor_Type, |
| Uint8List.fromList([ |
| 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, // |
| 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, // |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, // |
| 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, // |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, // |
| 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, // |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, // |
| 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, // |
| 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, // |
| 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, // |
| 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, // |
| 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, // |
| 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, // |
| 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, // |
| 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, // |
| 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, // |
| 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, // |
| 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, // |
| 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, // |
| 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, // |
| 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'OutOfLineSandwich1Case1_v1', |
| OutOfLineSandwich1( |
| before: 'soft migrations rock!', |
| v: [ |
| Sandwich1( |
| before: 0x4030201, |
| theUnion: UnionSize8Align4.withVariant(0xc0b0a09), |
| after: 0x8070605) |
| ], |
| after: 'hard transitions suck!'), |
| kOutOfLineSandwich1_Type, |
| Uint8List.fromList([ |
| 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x73, 0x6f, 0x66, 0x74, 0x20, 0x6d, 0x69, 0x67, // |
| 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, // |
| 0x72, 0x6f, 0x63, 0x6b, 0x21, 0x00, 0x00, 0x00, // |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x09, 0x0a, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, // |
| 0x68, 0x61, 0x72, 0x64, 0x20, 0x74, 0x72, 0x61, // |
| 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, // |
| 0x20, 0x73, 0x75, 0x63, 0x6b, 0x21, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'OutOfLineSandwich1WithOptUnionPresent_v1', |
| OutOfLineSandwich1WithOptUnion( |
| before: 'soft migrations rock!', |
| v: [ |
| Sandwich1WithOptUnion( |
| before: 0x4030201, |
| optUnion: UnionSize8Align4.withVariant(0xc0b0a09), |
| after: 0x8070605) |
| ], |
| after: 'hard transitions suck!'), |
| kOutOfLineSandwich1WithOptUnion_Type, |
| Uint8List.fromList([ |
| 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x73, 0x6f, 0x66, 0x74, 0x20, 0x6d, 0x69, 0x67, // |
| 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, // |
| 0x72, 0x6f, 0x63, 0x6b, 0x21, 0x00, 0x00, 0x00, // |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x09, 0x0a, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, // |
| 0x68, 0x61, 0x72, 0x64, 0x20, 0x74, 0x72, 0x61, // |
| 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, // |
| 0x20, 0x73, 0x75, 0x63, 0x6b, 0x21, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'OutOfLineSandwich1WithOptUnionAbsent_v1', |
| OutOfLineSandwich1WithOptUnion( |
| before: 'soft migrations rock!', |
| v: [Sandwich1WithOptUnion(before: 0x4030201, after: 0x8070605)], |
| after: 'hard transitions suck!'), |
| kOutOfLineSandwich1WithOptUnion_Type, |
| Uint8List.fromList([ |
| 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x73, 0x6f, 0x66, 0x74, 0x20, 0x6d, 0x69, 0x67, // |
| 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, // |
| 0x72, 0x6f, 0x63, 0x6b, 0x21, 0x00, 0x00, 0x00, // |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x68, 0x61, 0x72, 0x64, 0x20, 0x74, 0x72, 0x61, // |
| 0x6e, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, // |
| 0x20, 0x73, 0x75, 0x63, 0x6b, 0x21, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Regression4_v1', |
| Regression4( |
| f1: 0x1, |
| f2: 0x2, |
| s1: StructSize3Align1( |
| threeBytes: Uint8List.fromList([0x9, 0xa, 0xb])), |
| f3: 0x3, |
| f4: 0x4, |
| f5: 0x5, |
| f6: 0x6), |
| kRegression4_Type, |
| Uint8List.fromList([ |
| 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // |
| 0x09, 0x0a, 0x0b, 0x03, 0x04, 0x00, 0x00, 0x00, // |
| 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Sandwich4Align8_v1', |
| Sandwich4Align8( |
| sandwich4: Sandwich4( |
| before: 0x4030201, |
| theUnion: UnionSize36Align4.withVariant(Uint8List.fromList([ |
| 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: 0x8070605), |
| alignment8Enforcement: 0x100f0e0d0c0b0a09), |
| kSandwich4Align8_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, // |
| 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, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Sandwich4Align8WithPointer_v1', |
| Sandwich4Align8WithPointer( |
| sandwich4: Sandwich4( |
| before: 0x4030201, |
| theUnion: UnionSize36Align4.withVariant(Uint8List.fromList([ |
| 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: 0x8070605), |
| alignment8Enforcement: Size8Align8(data: 0x100f0e0d0c0b0a09)), |
| kSandwich4Align8WithPointer_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 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, // |
| 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Sandwich8Case1_v1', |
| Sandwich8( |
| before: 0x4030201, |
| unionOfUnion: UnionOfUnion.withSize8align4( |
| UnionSize8Align4.withVariant(0xc0b0a09)), |
| after: 0x8070605), |
| kSandwich8_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, // |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x09, 0x0a, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'Sandwich9Case1_v1', |
| Sandwich9( |
| before: 0x201, |
| theUnion: UnionWithVectorOfVectors.withV([ |
| [ |
| StructSize3Align1( |
| threeBytes: Uint8List.fromList([0x10, 0x11, 0x12])), |
| StructSize3Align1( |
| threeBytes: Uint8List.fromList([0x13, 0x14, 0x15])) |
| ] |
| ]), |
| after: 0x1211), |
| kSandwich9_Type, |
| Uint8List.fromList([ |
| 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x11, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x10, 0x11, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x13, 0x14, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'SimpleTableArrayStruct_v1', |
| SimpleTableArrayStruct(theArray: [ |
| TransformerSimpleTable(value: 0xa3a2a1a0), |
| TransformerSimpleTable(value: 0xb3b2b1b0) |
| ]), |
| kSimpleTableArrayStruct_Type, |
| Uint8List.fromList([ |
| 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0xa0, 0xa1, 0xa2, 0xa3, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0xb0, 0xb1, 0xb2, 0xb3, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'StringUnionVector_v1', |
| StringUnionVector(theVector: [ |
| StringUnion.withS('hello'), |
| StringUnion.withU8(0xaa), |
| StringUnion.withU8(0xbb) |
| ]), |
| kStringUnionVector_Type, |
| Uint8List.fromList([ |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x00, 0x00, 0x00, // |
| 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xbb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'CreateComponentRequest_v1', |
| CreateComponentRequest( |
| launchInfo: LaunchInfo( |
| url: |
| 'fuchsia-pkg://fuchsia.com/fidl_compatibility_test_server_rust_write_xunion#meta/fidl_compatibility_test_server_rust_write_xunion.cmx', |
| directoryRequest: 0xffffffff), |
| controller: 0xffffffff), |
| kCreateComponentRequest_Type, |
| Uint8List.fromList([ |
| 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, // |
| 0x66, 0x75, 0x63, 0x68, 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, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'UnionWithBoundString_v1', |
| UnionWithBoundStringStruct( |
| v: UnionWithBoundString.withBoundFiveStr('abcd')), |
| kUnionWithBoundStringStruct_Type, |
| Uint8List.fromList([ |
| 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x61, 0x62, 0x63, 0x64, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'UnionMigration_SingleVariant_v1', |
| SingleVariantUnionStruct(u: SingleVariantUnion.withX(0x2a)), |
| kSingleVariantUnionStruct_Type, |
| Uint8List.fromList([ |
| 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| |
| DecodeSuccessCase.run( |
| Decoders.v1, |
| 'ReverseOrdinalUnion_v1', |
| ReverseOrdinalUnionStruct(u: ReverseOrdinalUnion.withX(0x2a)), |
| kReverseOrdinalUnionStruct_Type, |
| Uint8List.fromList([ |
| 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // |
| 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // |
| ])); |
| }); |
| |
| group('encode failure cases', () { |
| EncodeFailureCase.run( |
| Encoders.v1, |
| 'StringExceedsLimit_v1', |
| Length2StringWrapper(length2String: 'abc'), |
| kLength2StringWrapper_Type, |
| fidl.FidlErrorCode.fidlStringTooLong); |
| |
| EncodeFailureCase.run( |
| Encoders.v1, |
| 'UnionWithBoundString_ExceedsBounds_v1', |
| UnionWithBoundStringStruct( |
| v: UnionWithBoundString.withBoundFiveStr('abcdef')), |
| kUnionWithBoundStringStruct_Type, |
| fidl.FidlErrorCode.fidlStringTooLong); |
| }); |
| |
| group('decode failure cases', () {}); |
| }); |
| } |