blob: 86fce2c41c9ce533927e6d2f383d25a4b17f47f2 [file] [log] [blame]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// 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(
'3ByteObjectAlignmentInStruct',
ThreeByteInStruct(
elem1: ThreeByte(elem1: 0x1, elem2: 0x2, elem3: 0x3),
elem2: ThreeByte(elem1: 0x4, elem2: 0x5, elem3: 0x6),
elem3: ThreeByte(elem1: 0x7, elem2: 0x8, elem3: 0x9)),
kThreeByteInStruct_Type,
Uint8List.fromList([
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, //
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'5ByteObjectAlignmentInStruct',
FiveByteInStruct(
elem1: FiveByte(elem1: 0x1020304, elem2: 0x5),
elem2: FiveByte(elem1: 0x6070809, elem2: 0xa),
elem3: FiveByte(elem1: 0xb0c0d0e, elem2: 0xf)),
kFiveByteInStruct_Type,
Uint8List.fromList([
0x04, 0x03, 0x02, 0x01, 0x05, 0x00, 0x00, 0x00, //
0x09, 0x08, 0x07, 0x06, 0x0a, 0x00, 0x00, 0x00, //
0x0e, 0x0d, 0x0c, 0x0b, 0x0f, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'3ByteObjectAlignmentInVector',
ThreeByteInVector(elems: [
ThreeByte(elem1: 0x1, elem2: 0x2, elem3: 0x3),
ThreeByte(elem1: 0x4, elem2: 0x5, elem3: 0x6),
ThreeByte(elem1: 0x7, elem2: 0x8, elem3: 0x9)
]),
kThreeByteInVector_Type,
Uint8List.fromList([
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, //
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'5ByteObjectAlignmentInVector',
FiveByteInVector(elems: [
FiveByte(elem1: 0x1020304, elem2: 0x5),
FiveByte(elem1: 0x6070809, elem2: 0xa),
FiveByte(elem1: 0xb0c0d0e, elem2: 0xf)
]),
kFiveByteInVector_Type,
Uint8List.fromList([
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x04, 0x03, 0x02, 0x01, 0x05, 0x00, 0x00, 0x00, //
0x09, 0x08, 0x07, 0x06, 0x0a, 0x00, 0x00, 0x00, //
0x0e, 0x0d, 0x0c, 0x0b, 0x0f, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'3ByteObjectAlignmentInArray',
ThreeByteInArray(elems: [
ThreeByte(elem1: 0x1, elem2: 0x2, elem3: 0x3),
ThreeByte(elem1: 0x4, elem2: 0x5, elem3: 0x6),
ThreeByte(elem1: 0x7, elem2: 0x8, elem3: 0x9)
]),
kThreeByteInArray_Type,
Uint8List.fromList([
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, //
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'5ByteObjectAlignmentInArray',
FiveByteInArray(elems: [
FiveByte(elem1: 0x1020304, elem2: 0x5),
FiveByte(elem1: 0x6070809, elem2: 0xa),
FiveByte(elem1: 0xb0c0d0e, elem2: 0xf)
]),
kFiveByteInArray_Type,
Uint8List.fromList([
0x04, 0x03, 0x02, 0x01, 0x05, 0x00, 0x00, 0x00, //
0x09, 0x08, 0x07, 0x06, 0x0a, 0x00, 0x00, 0x00, //
0x0e, 0x0d, 0x0c, 0x0b, 0x0f, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'EmptyStruct',
EmptyStruct(),
kEmptyStruct_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'EmptyStructSandwich',
EmptyStructSandwich(
before: 'before', es: EmptyStruct(), after: 'after'),
kEmptyStructSandwich_Type,
Uint8List.fromList([
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x00, 0x00, //
0x61, 0x66, 0x74, 0x65, 0x72, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'Uint8Uint16Uint32Uint64',
Uint8Uint16Uint32Uint64(
f1: 0x1, f2: 0x203, f3: 0x4050607, f4: 0x8090a0b0c0d0e0f),
kUint8Uint16Uint32Uint64_Type,
Uint8List.fromList([
0x01, 0x00, 0x03, 0x02, 0x07, 0x06, 0x05, 0x04, //
0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, //
]));
EncodeSuccessCase.run(
'Uint64Uint32Uint16Uint8',
Uint64Uint32Uint16Uint8(
f1: 0x8090a0b0c0d0e0f, f2: 0x4050607, f3: 0x203, f4: 0x1),
kUint64Uint32Uint16Uint8_Type,
Uint8List.fromList([
0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, //
0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, //
]));
EncodeSuccessCase.run(
'SimpleTableEmpty',
StructOfSimpleTable(table: SimpleTable()),
kStructOfSimpleTable_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
]));
EncodeSuccessCase.run(
'SimpleTableXAndY',
StructOfSimpleTable(table: SimpleTable(x: 0x2a, y: 0x43)),
kStructOfSimpleTable_Type,
Uint8List.fromList([
0x05, 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, //
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, //
0x00, 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, //
0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'SimpleTableJustY',
StructOfSimpleTable(table: SimpleTable(y: 0x43)),
kStructOfSimpleTable_Type,
Uint8List.fromList([
0x05, 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, //
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
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, //
0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'TableWithStringAndVectorNoVectorContent',
StructOfTableWithStringAndVector(
table: TableWithStringAndVector(foo: 'hello', bar: 0x1b)),
kStructOfTableWithStringAndVector_Type,
Uint8List.fromList([
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x18, 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, //
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x00, 0x00, 0x00, //
0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'SimpleTableThenUint64',
SimpleTableThenUint64(
table: SimpleTable(x: 0x2a, y: 0x43), number: 0xdeadbeefdeadbeef),
kSimpleTableThenUint64_Type,
Uint8List.fromList([
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, //
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, //
0x00, 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, //
0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'InlineXUnionInStruct',
TestInlineXUnionInStruct(
before: 'before',
xu: SampleXUnion.withU(0xdeadbeef),
after: 'after'),
kTestInlineXUnionInStruct_Type,
Uint8List.fromList([
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0xb2, 0x56, 0x9c, 0x38, 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, //
0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x00, 0x00, //
0xef, 0xbe, 0xad, 0xde, 0x00, 0x00, 0x00, 0x00, //
0x61, 0x66, 0x74, 0x65, 0x72, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'OptionalXUnionInStructAbsent',
TestOptionalXUnionInStruct(before: 'before', after: 'after'),
kTestOptionalXUnionInStruct_Type,
Uint8List.fromList([
0x06, 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, //
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x00, 0x00, //
0x61, 0x66, 0x74, 0x65, 0x72, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'OptionalXUnionInStructPresent',
TestOptionalXUnionInStruct(
before: 'before',
xu: SampleXUnion.withU(0xdeadbeef),
after: 'after'),
kTestOptionalXUnionInStruct_Type,
Uint8List.fromList([
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0xb2, 0x56, 0x9c, 0x38, 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, //
0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x00, 0x00, //
0xef, 0xbe, 0xad, 0xde, 0x00, 0x00, 0x00, 0x00, //
0x61, 0x66, 0x74, 0x65, 0x72, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'XUnionInTableXUnionAbsent',
TestXUnionInTable(
value: XUnionInTable(before: 'before', after: 'after')),
kTestXUnionInTable_Type,
Uint8List.fromList([
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x18, 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, //
0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x00, 0x00, //
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x61, 0x66, 0x74, 0x65, 0x72, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'XUnionInTableXUnionPresent',
TestXUnionInTable(
value: XUnionInTable(
before: 'before',
xu: SampleXUnion.withU(0xdeadbeef),
after: 'after')),
kTestXUnionInTable_Type,
Uint8List.fromList([
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x00, 0x00, //
0xb2, 0x56, 0x9c, 0x38, 0x00, 0x00, 0x00, 0x00, //
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0xef, 0xbe, 0xad, 0xde, 0x00, 0x00, 0x00, 0x00, //
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x61, 0x66, 0x74, 0x65, 0x72, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'StrictXUnion',
TestStrictXUnionInStruct(xu: SampleStrictXUnion.withU(0xdeadbeef)),
kTestStrictXUnionInStruct_Type,
Uint8List.fromList([
0x72, 0xea, 0xe2, 0x08, 0x00, 0x00, 0x00, 0x00, //
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0xef, 0xbe, 0xad, 0xde, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'AddEthernetDeviceRequest',
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, //
0x01, 0x00, 0x00, 0x00, 0x01, 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, //
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, //
]));
EncodeSuccessCase.run(
'FileGetAttrResponse',
FileGetAttrResponse(
s: 0x7eadbeaf,
attributes: NodeAttributes(
mode: 0x962381a4,
id: 0x1,
contentSize: 0xe7,
storageSize: 0xe7,
linkCount: 0x1,
creationTime: 0x8877665544332211,
modificationTime: 0xffeeddccbbaa99)),
kFileGetAttrResponse_Type,
Uint8List.fromList([
0xaf, 0xbe, 0xad, 0x7e, 0x00, 0x00, 0x00, 0x00, //
0xa4, 0x81, 0x23, 0x96, 0x00, 0x00, 0x00, 0x00, //
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xe7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xe7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, //
0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, //
]));
EncodeSuccessCase.run(
'Optionals',
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, //
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0x00, 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(
'Arrays',
StructWithArrays(arrInt: Int32List.fromList([0x1, 0x2]), arrString: [
'a',
'b'
], arrNullableString: [
'c',
null
], arrStruct: [
StructWithInt(x: 0x1),
StructWithInt(x: 0x2)
], arrNullableStruct: [
null,
StructWithInt(x: 0x1020304)
], arrArrInt: [
Int32List.fromList([0x1, 0x2, 0x3]),
Int32List.fromList([0x4, 0x5, 0x6])
]),
kStructWithArrays_Type,
Uint8List.fromList([
0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, //
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, //
0x01, 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, //
0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, //
0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, //
0x05, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, //
0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0x04, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'Vectors',
StructWithVectors(
vecEmpty: Int32List.fromList([]),
vecInt: Int32List.fromList([0x1, 0x2]),
vecString: [
'a',
'b'
],
vecNullableString: [
null,
'c',
null
],
vecStruct: [
StructWithInt(x: 0x1)
],
vecNullableStruct: [
null,
null,
StructWithInt(x: 0x2)
],
vecVecInt: [
Int32List.fromList([0x1, 0x2]),
Int32List.fromList([0x3])
]),
kStructWithVectors_Type,
Uint8List.fromList([
0x00, 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, //
0x02, 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, //
0x01, 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, //
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, //
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, //
0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0x01, 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, //
0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0x01, 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, 0xff, 0xff, 0xff, 0xff, //
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0x02, 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, //
0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, //
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'BoolTrue',
MyBool(value: true),
kMyBool_Type,
Uint8List.fromList([
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'BoolFalse',
MyBool(value: false),
kMyBool_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'ByteZero',
MyByte(value: 0x0),
kMyByte_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'Byte255',
MyByte(value: 0xff),
kMyByte_Type,
Uint8List.fromList([
0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'Int8Min',
MyInt8(value: -128),
kMyInt8_Type,
Uint8List.fromList([
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'Int8Zero',
MyInt8(value: 0x0),
kMyInt8_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'Int8Max',
MyInt8(value: 0x7f),
kMyInt8_Type,
Uint8List.fromList([
0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'Int16Min',
MyInt16(value: -32768),
kMyInt16_Type,
Uint8List.fromList([
0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'Int16Zero',
MyInt16(value: 0x0),
kMyInt16_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'Int16Max',
MyInt16(value: 0x7fff),
kMyInt16_Type,
Uint8List.fromList([
0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'Int32Min',
MyInt32(value: -2147483648),
kMyInt32_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'Int32Zero',
MyInt32(value: 0x0),
kMyInt32_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'Int32Max',
MyInt32(value: 0x7fffffff),
kMyInt32_Type,
Uint8List.fromList([
0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'Int64Min',
MyInt64(value: -9223372036854775808),
kMyInt64_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, //
]));
EncodeSuccessCase.run(
'Int64Zero',
MyInt64(value: 0x0),
kMyInt64_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'Int64Max',
MyInt64(value: 0x7fffffffffffffff),
kMyInt64_Type,
Uint8List.fromList([
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, //
]));
EncodeSuccessCase.run(
'Uint8Zero',
MyUint8(value: 0x0),
kMyUint8_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'Uint8Max',
MyUint8(value: 0xff),
kMyUint8_Type,
Uint8List.fromList([
0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'Uint16Zero',
MyUint16(value: 0x0),
kMyUint16_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'Uint16Max',
MyUint16(value: 0xffff),
kMyUint16_Type,
Uint8List.fromList([
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'Uint32Zero',
MyUint32(value: 0x0),
kMyUint32_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'Uint32Max',
MyUint32(value: 0xffffffff),
kMyUint32_Type,
Uint8List.fromList([
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'Uint64Zero',
MyUint64(value: 0x0),
kMyUint64_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'Uint64Max',
MyUint64(value: 0xffffffffffffffff),
kMyUint64_Type,
Uint8List.fromList([
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
]));
EncodeSuccessCase.run(
'Float32Zero',
MyFloat32(value: 0),
kMyFloat32_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'Float32One',
MyFloat32(value: 1),
kMyFloat32_Type,
Uint8List.fromList([
0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'Float32MinusOne',
MyFloat32(value: -1),
kMyFloat32_Type,
Uint8List.fromList([
0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'Float32Max',
MyFloat32(value: 3.4028234663852886e+38),
kMyFloat32_Type,
Uint8List.fromList([
0xff, 0xff, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'Float64Zero',
MyFloat64(value: 0),
kMyFloat64_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
EncodeSuccessCase.run(
'Float64One',
MyFloat64(value: 1),
kMyFloat64_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, //
]));
EncodeSuccessCase.run(
'Float64MinusOne',
MyFloat64(value: -1),
kMyFloat64_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xbf, //
]));
EncodeSuccessCase.run(
'Float64Max',
MyFloat64(value: 1.7976931348623157e+308),
kMyFloat64_Type,
Uint8List.fromList([
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x7f, //
]));
});
group('decode success cases', () {
DecodeSuccessCase.run(
'3ByteObjectAlignmentInStruct',
ThreeByteInStruct(
elem1: ThreeByte(elem1: 0x1, elem2: 0x2, elem3: 0x3),
elem2: ThreeByte(elem1: 0x4, elem2: 0x5, elem3: 0x6),
elem3: ThreeByte(elem1: 0x7, elem2: 0x8, elem3: 0x9)),
kThreeByteInStruct_Type,
Uint8List.fromList([
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, //
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'5ByteObjectAlignmentInStruct',
FiveByteInStruct(
elem1: FiveByte(elem1: 0x1020304, elem2: 0x5),
elem2: FiveByte(elem1: 0x6070809, elem2: 0xa),
elem3: FiveByte(elem1: 0xb0c0d0e, elem2: 0xf)),
kFiveByteInStruct_Type,
Uint8List.fromList([
0x04, 0x03, 0x02, 0x01, 0x05, 0x00, 0x00, 0x00, //
0x09, 0x08, 0x07, 0x06, 0x0a, 0x00, 0x00, 0x00, //
0x0e, 0x0d, 0x0c, 0x0b, 0x0f, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'3ByteObjectAlignmentInVector',
ThreeByteInVector(elems: [
ThreeByte(elem1: 0x1, elem2: 0x2, elem3: 0x3),
ThreeByte(elem1: 0x4, elem2: 0x5, elem3: 0x6),
ThreeByte(elem1: 0x7, elem2: 0x8, elem3: 0x9)
]),
kThreeByteInVector_Type,
Uint8List.fromList([
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, //
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'5ByteObjectAlignmentInVector',
FiveByteInVector(elems: [
FiveByte(elem1: 0x1020304, elem2: 0x5),
FiveByte(elem1: 0x6070809, elem2: 0xa),
FiveByte(elem1: 0xb0c0d0e, elem2: 0xf)
]),
kFiveByteInVector_Type,
Uint8List.fromList([
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x04, 0x03, 0x02, 0x01, 0x05, 0x00, 0x00, 0x00, //
0x09, 0x08, 0x07, 0x06, 0x0a, 0x00, 0x00, 0x00, //
0x0e, 0x0d, 0x0c, 0x0b, 0x0f, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'3ByteObjectAlignmentInArray',
ThreeByteInArray(elems: [
ThreeByte(elem1: 0x1, elem2: 0x2, elem3: 0x3),
ThreeByte(elem1: 0x4, elem2: 0x5, elem3: 0x6),
ThreeByte(elem1: 0x7, elem2: 0x8, elem3: 0x9)
]),
kThreeByteInArray_Type,
Uint8List.fromList([
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, //
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'5ByteObjectAlignmentInArray',
FiveByteInArray(elems: [
FiveByte(elem1: 0x1020304, elem2: 0x5),
FiveByte(elem1: 0x6070809, elem2: 0xa),
FiveByte(elem1: 0xb0c0d0e, elem2: 0xf)
]),
kFiveByteInArray_Type,
Uint8List.fromList([
0x04, 0x03, 0x02, 0x01, 0x05, 0x00, 0x00, 0x00, //
0x09, 0x08, 0x07, 0x06, 0x0a, 0x00, 0x00, 0x00, //
0x0e, 0x0d, 0x0c, 0x0b, 0x0f, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'EmptyStruct',
EmptyStruct(),
kEmptyStruct_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'EmptyStructSandwich',
EmptyStructSandwich(
before: 'before', es: EmptyStruct(), after: 'after'),
kEmptyStructSandwich_Type,
Uint8List.fromList([
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x00, 0x00, //
0x61, 0x66, 0x74, 0x65, 0x72, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'Uint8Uint16Uint32Uint64',
Uint8Uint16Uint32Uint64(
f1: 0x1, f2: 0x203, f3: 0x4050607, f4: 0x8090a0b0c0d0e0f),
kUint8Uint16Uint32Uint64_Type,
Uint8List.fromList([
0x01, 0x00, 0x03, 0x02, 0x07, 0x06, 0x05, 0x04, //
0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, //
]));
DecodeSuccessCase.run(
'Uint64Uint32Uint16Uint8',
Uint64Uint32Uint16Uint8(
f1: 0x8090a0b0c0d0e0f, f2: 0x4050607, f3: 0x203, f4: 0x1),
kUint64Uint32Uint16Uint8_Type,
Uint8List.fromList([
0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, //
0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, //
]));
DecodeSuccessCase.run(
'SimpleTableEmpty',
StructOfSimpleTable(table: SimpleTable()),
kStructOfSimpleTable_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
]));
DecodeSuccessCase.run(
'SimpleTableXAndY',
StructOfSimpleTable(table: SimpleTable(x: 0x2a, y: 0x43)),
kStructOfSimpleTable_Type,
Uint8List.fromList([
0x05, 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, //
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, //
0x00, 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, //
0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'SimpleTableJustY',
StructOfSimpleTable(table: SimpleTable(y: 0x43)),
kStructOfSimpleTable_Type,
Uint8List.fromList([
0x05, 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, //
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
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, //
0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'TableWithStringAndVectorNoVectorContent',
StructOfTableWithStringAndVector(
table: TableWithStringAndVector(foo: 'hello', bar: 0x1b)),
kStructOfTableWithStringAndVector_Type,
Uint8List.fromList([
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x18, 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, //
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x00, 0x00, 0x00, //
0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'SimpleTableThenUint64',
SimpleTableThenUint64(
table: SimpleTable(x: 0x2a, y: 0x43), number: 0xdeadbeefdeadbeef),
kSimpleTableThenUint64_Type,
Uint8List.fromList([
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, //
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, //
0x00, 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, //
0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'InlineXUnionInStruct',
TestInlineXUnionInStruct(
before: 'before',
xu: SampleXUnion.withU(0xdeadbeef),
after: 'after'),
kTestInlineXUnionInStruct_Type,
Uint8List.fromList([
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0xb2, 0x56, 0x9c, 0x38, 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, //
0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x00, 0x00, //
0xef, 0xbe, 0xad, 0xde, 0x00, 0x00, 0x00, 0x00, //
0x61, 0x66, 0x74, 0x65, 0x72, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'OptionalXUnionInStructAbsent',
TestOptionalXUnionInStruct(before: 'before', after: 'after'),
kTestOptionalXUnionInStruct_Type,
Uint8List.fromList([
0x06, 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, //
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x00, 0x00, //
0x61, 0x66, 0x74, 0x65, 0x72, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'OptionalXUnionInStructPresent',
TestOptionalXUnionInStruct(
before: 'before',
xu: SampleXUnion.withU(0xdeadbeef),
after: 'after'),
kTestOptionalXUnionInStruct_Type,
Uint8List.fromList([
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0xb2, 0x56, 0x9c, 0x38, 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, //
0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x00, 0x00, //
0xef, 0xbe, 0xad, 0xde, 0x00, 0x00, 0x00, 0x00, //
0x61, 0x66, 0x74, 0x65, 0x72, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'XUnionInTableXUnionAbsent',
TestXUnionInTable(
value: XUnionInTable(before: 'before', after: 'after')),
kTestXUnionInTable_Type,
Uint8List.fromList([
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x18, 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, //
0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x00, 0x00, //
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x61, 0x66, 0x74, 0x65, 0x72, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'XUnionInTableXUnionPresent',
TestXUnionInTable(
value: XUnionInTable(
before: 'before',
xu: SampleXUnion.withU(0xdeadbeef),
after: 'after')),
kTestXUnionInTable_Type,
Uint8List.fromList([
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x00, 0x00, //
0xb2, 0x56, 0x9c, 0x38, 0x00, 0x00, 0x00, 0x00, //
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0xef, 0xbe, 0xad, 0xde, 0x00, 0x00, 0x00, 0x00, //
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x61, 0x66, 0x74, 0x65, 0x72, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'StrictXUnion',
TestStrictXUnionInStruct(xu: SampleStrictXUnion.withU(0xdeadbeef)),
kTestStrictXUnionInStruct_Type,
Uint8List.fromList([
0x72, 0xea, 0xe2, 0x08, 0x00, 0x00, 0x00, 0x00, //
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0xef, 0xbe, 0xad, 0xde, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'AddEthernetDeviceRequest',
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, //
0x01, 0x00, 0x00, 0x00, 0x01, 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, //
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, //
]));
DecodeSuccessCase.run(
'FileGetAttrResponse',
FileGetAttrResponse(
s: 0x7eadbeaf,
attributes: NodeAttributes(
mode: 0x962381a4,
id: 0x1,
contentSize: 0xe7,
storageSize: 0xe7,
linkCount: 0x1,
creationTime: 0x8877665544332211,
modificationTime: 0xffeeddccbbaa99)),
kFileGetAttrResponse_Type,
Uint8List.fromList([
0xaf, 0xbe, 0xad, 0x7e, 0x00, 0x00, 0x00, 0x00, //
0xa4, 0x81, 0x23, 0x96, 0x00, 0x00, 0x00, 0x00, //
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xe7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xe7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, //
0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00, //
]));
DecodeSuccessCase.run(
'Optionals',
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, //
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0x00, 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(
'Arrays',
StructWithArrays(arrInt: Int32List.fromList([0x1, 0x2]), arrString: [
'a',
'b'
], arrNullableString: [
'c',
null
], arrStruct: [
StructWithInt(x: 0x1),
StructWithInt(x: 0x2)
], arrNullableStruct: [
null,
StructWithInt(x: 0x1020304)
], arrArrInt: [
Int32List.fromList([0x1, 0x2, 0x3]),
Int32List.fromList([0x4, 0x5, 0x6])
]),
kStructWithArrays_Type,
Uint8List.fromList([
0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, //
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, //
0x01, 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, //
0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, //
0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, //
0x05, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, //
0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0x04, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'Vectors',
StructWithVectors(
vecEmpty: Int32List.fromList([]),
vecInt: Int32List.fromList([0x1, 0x2]),
vecString: [
'a',
'b'
],
vecNullableString: [
null,
'c',
null
],
vecStruct: [
StructWithInt(x: 0x1)
],
vecNullableStruct: [
null,
null,
StructWithInt(x: 0x2)
],
vecVecInt: [
Int32List.fromList([0x1, 0x2]),
Int32List.fromList([0x3])
]),
kStructWithVectors_Type,
Uint8List.fromList([
0x00, 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, //
0x02, 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, //
0x01, 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, //
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, //
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, //
0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0x01, 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, //
0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0x01, 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, 0xff, 0xff, 0xff, 0xff, //
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0x02, 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, //
0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, //
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'BoolTrue',
MyBool(value: true),
kMyBool_Type,
Uint8List.fromList([
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'BoolFalse',
MyBool(value: false),
kMyBool_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'ByteZero',
MyByte(value: 0x0),
kMyByte_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'Byte255',
MyByte(value: 0xff),
kMyByte_Type,
Uint8List.fromList([
0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'Int8Min',
MyInt8(value: -128),
kMyInt8_Type,
Uint8List.fromList([
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'Int8Zero',
MyInt8(value: 0x0),
kMyInt8_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'Int8Max',
MyInt8(value: 0x7f),
kMyInt8_Type,
Uint8List.fromList([
0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'Int16Min',
MyInt16(value: -32768),
kMyInt16_Type,
Uint8List.fromList([
0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'Int16Zero',
MyInt16(value: 0x0),
kMyInt16_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'Int16Max',
MyInt16(value: 0x7fff),
kMyInt16_Type,
Uint8List.fromList([
0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'Int32Min',
MyInt32(value: -2147483648),
kMyInt32_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'Int32Zero',
MyInt32(value: 0x0),
kMyInt32_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'Int32Max',
MyInt32(value: 0x7fffffff),
kMyInt32_Type,
Uint8List.fromList([
0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'Int64Min',
MyInt64(value: -9223372036854775808),
kMyInt64_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, //
]));
DecodeSuccessCase.run(
'Int64Zero',
MyInt64(value: 0x0),
kMyInt64_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'Int64Max',
MyInt64(value: 0x7fffffffffffffff),
kMyInt64_Type,
Uint8List.fromList([
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, //
]));
DecodeSuccessCase.run(
'Uint8Zero',
MyUint8(value: 0x0),
kMyUint8_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'Uint8Max',
MyUint8(value: 0xff),
kMyUint8_Type,
Uint8List.fromList([
0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'Uint16Zero',
MyUint16(value: 0x0),
kMyUint16_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'Uint16Max',
MyUint16(value: 0xffff),
kMyUint16_Type,
Uint8List.fromList([
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'Uint32Zero',
MyUint32(value: 0x0),
kMyUint32_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'Uint32Max',
MyUint32(value: 0xffffffff),
kMyUint32_Type,
Uint8List.fromList([
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'Uint64Zero',
MyUint64(value: 0x0),
kMyUint64_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'Uint64Max',
MyUint64(value: 0xffffffffffffffff),
kMyUint64_Type,
Uint8List.fromList([
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //
]));
DecodeSuccessCase.run(
'Float32Zero',
MyFloat32(value: 0),
kMyFloat32_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'Float32One',
MyFloat32(value: 1),
kMyFloat32_Type,
Uint8List.fromList([
0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'Float32MinusOne',
MyFloat32(value: -1),
kMyFloat32_Type,
Uint8List.fromList([
0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'Float32Max',
MyFloat32(value: 3.4028234663852886e+38),
kMyFloat32_Type,
Uint8List.fromList([
0xff, 0xff, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'Float64Zero',
MyFloat64(value: 0),
kMyFloat64_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]));
DecodeSuccessCase.run(
'Float64One',
MyFloat64(value: 1),
kMyFloat64_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, //
]));
DecodeSuccessCase.run(
'Float64MinusOne',
MyFloat64(value: -1),
kMyFloat64_Type,
Uint8List.fromList([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xbf, //
]));
DecodeSuccessCase.run(
'Float64Max',
MyFloat64(value: 1.7976931348623157e+308),
kMyFloat64_Type,
Uint8List.fromList([
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x7f, //
]));
});
group('encode failure cases', () {
EncodeFailureCase.run(
'StringExceedsLimit',
Length2StringWrapper(length2String: 'abc'),
kLength2StringWrapper_Type,
fidl.FidlErrorCode.fidlStringTooLong);
});
group('decode failure cases', () {
DecodeFailureCase.run(
'NonEmptyStringWithNullPtrBody',
kStringWrapper_Type,
Uint8List.fromList([
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
]),
fidl.FidlErrorCode.fidlNonNullableTypeWithNullValue);
});
});
}