blob: ba494c739036bdeafe2404947265dd925f995d45 [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.
// +build fuchsia
//
package fidl_test
import (
"reflect"
"testing"
"syscall/zx/fidl"
"syscall/zx/fidl/conformance"
)
func TestAllEncodeSuccessCases(t *testing.T) {
{
v1 := conformance.ThreeByteInStruct{}
v2 := conformance.ThreeByte{}
var v3 uint8 = 1
v2.Elem1 = v3
var v4 uint8 = 2
v2.Elem2 = v4
var v5 uint8 = 3
v2.Elem3 = v5
v1.Elem1 = v2
v6 := conformance.ThreeByte{}
var v7 uint8 = 4
v6.Elem1 = v7
var v8 uint8 = 5
v6.Elem2 = v8
var v9 uint8 = 6
v6.Elem3 = v9
v1.Elem2 = v6
v10 := conformance.ThreeByte{}
var v11 uint8 = 7
v10.Elem1 = v11
var v12 uint8 = 8
v10.Elem2 = v12
var v13 uint8 = 9
v10.Elem3 = v13
v1.Elem3 = v10
encodeSuccessCase{
name: "3ByteObjectAlignmentInStruct",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.FiveByteInStruct{}
v2 := conformance.FiveByte{}
var v3 uint32 = 16909060
v2.Elem1 = v3
var v4 uint8 = 5
v2.Elem2 = v4
v1.Elem1 = v2
v5 := conformance.FiveByte{}
var v6 uint32 = 101124105
v5.Elem1 = v6
var v7 uint8 = 10
v5.Elem2 = v7
v1.Elem2 = v5
v8 := conformance.FiveByte{}
var v9 uint32 = 185339150
v8.Elem1 = v9
var v10 uint8 = 15
v8.Elem2 = v10
v1.Elem3 = v8
encodeSuccessCase{
name: "5ByteObjectAlignmentInStruct",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x04, 0x03, 0x02, 0x01, 0x05, 0x00, 0x00, 0x00,
0x09, 0x08, 0x07, 0x06, 0x0a, 0x00, 0x00, 0x00,
0x0e, 0x0d, 0x0c, 0x0b, 0x0f, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.ThreeByteInVector{}
v2 := conformance.ThreeByte{}
var v3 uint8 = 1
v2.Elem1 = v3
var v4 uint8 = 2
v2.Elem2 = v4
var v5 uint8 = 3
v2.Elem3 = v5
v6 := conformance.ThreeByte{}
var v7 uint8 = 4
v6.Elem1 = v7
var v8 uint8 = 5
v6.Elem2 = v8
var v9 uint8 = 6
v6.Elem3 = v9
v10 := conformance.ThreeByte{}
var v11 uint8 = 7
v10.Elem1 = v11
var v12 uint8 = 8
v10.Elem2 = v12
var v13 uint8 = 9
v10.Elem3 = v13
v14 := []conformance.ThreeByte{v2, v6, v10}
v1.Elems = v14
encodeSuccessCase{
name: "3ByteObjectAlignmentInVector",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.FiveByteInVector{}
v2 := conformance.FiveByte{}
var v3 uint32 = 16909060
v2.Elem1 = v3
var v4 uint8 = 5
v2.Elem2 = v4
v5 := conformance.FiveByte{}
var v6 uint32 = 101124105
v5.Elem1 = v6
var v7 uint8 = 10
v5.Elem2 = v7
v8 := conformance.FiveByte{}
var v9 uint32 = 185339150
v8.Elem1 = v9
var v10 uint8 = 15
v8.Elem2 = v10
v11 := []conformance.FiveByte{v2, v5, v8}
v1.Elems = v11
encodeSuccessCase{
name: "5ByteObjectAlignmentInVector",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.ThreeByteInArray{}
v2 := conformance.ThreeByte{}
var v3 uint8 = 1
v2.Elem1 = v3
var v4 uint8 = 2
v2.Elem2 = v4
var v5 uint8 = 3
v2.Elem3 = v5
v6 := conformance.ThreeByte{}
var v7 uint8 = 4
v6.Elem1 = v7
var v8 uint8 = 5
v6.Elem2 = v8
var v9 uint8 = 6
v6.Elem3 = v9
v10 := conformance.ThreeByte{}
var v11 uint8 = 7
v10.Elem1 = v11
var v12 uint8 = 8
v10.Elem2 = v12
var v13 uint8 = 9
v10.Elem3 = v13
v14 := [3]conformance.ThreeByte{v2, v6, v10}
v1.Elems = v14
encodeSuccessCase{
name: "3ByteObjectAlignmentInArray",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.FiveByteInArray{}
v2 := conformance.FiveByte{}
var v3 uint32 = 16909060
v2.Elem1 = v3
var v4 uint8 = 5
v2.Elem2 = v4
v5 := conformance.FiveByte{}
var v6 uint32 = 101124105
v5.Elem1 = v6
var v7 uint8 = 10
v5.Elem2 = v7
v8 := conformance.FiveByte{}
var v9 uint32 = 185339150
v8.Elem1 = v9
var v10 uint8 = 15
v8.Elem2 = v10
v11 := [3]conformance.FiveByte{v2, v5, v8}
v1.Elems = v11
encodeSuccessCase{
name: "5ByteObjectAlignmentInArray",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x04, 0x03, 0x02, 0x01, 0x05, 0x00, 0x00, 0x00,
0x09, 0x08, 0x07, 0x06, 0x0a, 0x00, 0x00, 0x00,
0x0e, 0x0d, 0x0c, 0x0b, 0x0f, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.EmptyStruct{}
encodeSuccessCase{
name: "EmptyStruct",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.EmptyStructSandwich{}
v2 := "before"
v1.Before = v2
v3 := conformance.EmptyStruct{}
v1.Es = v3
v4 := "after"
v1.After = v4
encodeSuccessCase{
name: "EmptyStructSandwich",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Uint8Uint16Uint32Uint64{}
var v2 uint8 = 1
v1.F1 = v2
var v3 uint16 = 515
v1.F2 = v3
var v4 uint32 = 67438087
v1.F3 = v4
var v5 uint64 = 579005069656919567
v1.F4 = v5
encodeSuccessCase{
name: "Uint8Uint16Uint32Uint64",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x00, 0x03, 0x02, 0x07, 0x06, 0x05, 0x04,
0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
},
}.check(t)
}
{
v1 := conformance.Uint64Uint32Uint16Uint8{}
var v2 uint64 = 579005069656919567
v1.F1 = v2
var v3 uint32 = 67438087
v1.F2 = v3
var v4 uint16 = 515
v1.F3 = v4
var v5 uint8 = 1
v1.F4 = v5
encodeSuccessCase{
name: "Uint64Uint32Uint16Uint8",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00,
},
}.check(t)
}
{
v1 := conformance.StructOfSimpleTable{}
v2 := conformance.SimpleTable{}
v1.Table = v2
encodeSuccessCase{
name: "SimpleTableEmpty",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
},
}.check(t)
}
{
v1 := conformance.StructOfSimpleTable{}
v2 := conformance.SimpleTable{}
var v3 int64 = 42
v2.SetX(v3)
var v4 int64 = 67
v2.SetY(v4)
v1.Table = v2
encodeSuccessCase{
name: "SimpleTableXAndY",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.StructOfSimpleTable{}
v2 := conformance.SimpleTable{}
var v3 int64 = 67
v2.SetY(v3)
v1.Table = v2
encodeSuccessCase{
name: "SimpleTableJustY",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.StructOfTableWithStringAndVector{}
v2 := conformance.TableWithStringAndVector{}
v3 := "hello"
v2.SetFoo(v3)
var v4 int32 = 27
v2.SetBar(v4)
v1.Table = v2
encodeSuccessCase{
name: "TableWithStringAndVectorNoVectorContent",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.SimpleTableThenUint64{}
v2 := conformance.SimpleTable{}
var v3 int64 = 42
v2.SetX(v3)
var v4 int64 = 67
v2.SetY(v4)
v1.Table = v2
var v5 uint64 = 16045690984833335023
v1.Number = v5
encodeSuccessCase{
name: "SimpleTableThenUint64",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.TestInlineXUnionInStruct{}
v2 := "before"
v1.Before = v2
v3 := conformance.SampleXUnion{}
var v4 uint32 = 3735928559
v3.SetU(v4)
v1.Xu = v3
v5 := "after"
v1.After = v5
encodeSuccessCase{
name: "InlineXUnionInStruct",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.TestOptionalXUnionInStruct{}
v2 := "before"
v1.Before = v2
v3 := "after"
v1.After = v3
encodeSuccessCase{
name: "OptionalXUnionInStructAbsent",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.TestOptionalXUnionInStruct{}
v2 := "before"
v1.Before = v2
v3 := &conformance.SampleXUnion{}
var v4 uint32 = 3735928559
v3.SetU(v4)
v1.Xu = v3
v5 := "after"
v1.After = v5
encodeSuccessCase{
name: "OptionalXUnionInStructPresent",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.TestXUnionInTable{}
v2 := conformance.XUnionInTable{}
v3 := "before"
v2.SetBefore(v3)
v4 := "after"
v2.SetAfter(v4)
v1.Value = v2
encodeSuccessCase{
name: "XUnionInTableXUnionAbsent",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.TestXUnionInTable{}
v2 := conformance.XUnionInTable{}
v3 := "before"
v2.SetBefore(v3)
v4 := conformance.SampleXUnion{}
var v5 uint32 = 3735928559
v4.SetU(v5)
v2.SetXu(v4)
v6 := "after"
v2.SetAfter(v6)
v1.Value = v2
encodeSuccessCase{
name: "XUnionInTableXUnionPresent",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.TestStrictXUnionInStruct{}
v2 := conformance.SampleStrictXUnion{}
var v3 uint32 = 3735928559
v2.SetU(v3)
v1.Xu = v2
encodeSuccessCase{
name: "StrictXUnion",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.TestAddEthernetDeviceRequest{}
v2 := "@/dev/sys/pci/00:03.0/e1000/ethernet"
v1.TopologicalPath = v2
v3 := conformance.InterfaceConfig{}
v4 := "ethp0003"
v3.Name = v4
v5 := conformance.IpAddressConfig{}
v6 := true
v5.SetDhcp(v6)
v3.IpAddressConfig = v5
v1.Config = v3
var v7 uint32 = 4294967295
v1.ThisShouldBeAHandle = v7
encodeSuccessCase{
name: "AddEthernetDeviceRequest",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.FileGetAttrResponse{}
var v2 int32 = 2125315759
v1.S = v2
v3 := conformance.NodeAttributes{}
var v4 uint32 = 2518909348
v3.Mode = v4
var v5 uint64 = 1
v3.Id = v5
var v6 uint64 = 231
v3.ContentSize = v6
var v7 uint64 = 231
v3.StorageSize = v7
var v8 uint64 = 1
v3.LinkCount = v8
var v9 uint64 = 9833440827789222417
v3.CreationTime = v9
var v10 uint64 = 72038755451251353
v3.ModificationTime = v10
v1.Attributes = v3
encodeSuccessCase{
name: "FileGetAttrResponse",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.StructWithOptionals{}
v2 := conformance.EmptyStruct{}
v1.S = v2
v3 := &conformance.EmptyStruct{}
v1.S2 = v3
v4 := conformance.TableWithEmptyStruct{}
v5 := conformance.EmptyStruct{}
v4.SetS(v5)
v1.T = v4
v6 := conformance.XUnionWithEmptyStruct{}
v7 := conformance.EmptyStruct{}
v6.SetS(v7)
v1.Xu = v6
v8 := &conformance.XUnionWithEmptyStruct{}
v9 := conformance.EmptyStruct{}
v8.SetS(v9)
v1.Xu2 = v8
v10 := conformance.UnionWithEmptyStruct{}
v11 := conformance.EmptyStruct{}
v10.SetS(v11)
v1.U = v10
v12 := &conformance.UnionWithEmptyStruct{}
v13 := conformance.EmptyStruct{}
v12.SetS(v13)
v1.U2 = v12
encodeSuccessCase{
name: "Optionals",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.StructWithArrays{}
var v2 int32 = 1
var v3 int32 = 2
v4 := [2]int32{v2, v3}
v1.ArrInt = v4
v5 := "a"
v6 := "b"
v7 := [2]string{v5, v6}
v1.ArrString = v7
v8 := "c"
v9 := &v8
var v10 *string = nil
v11 := [2]*string{v9, v10}
v1.ArrNullableString = v11
v12 := conformance.StructWithInt{}
var v13 int32 = 1
v12.X = v13
v14 := conformance.StructWithInt{}
var v15 int32 = 2
v14.X = v15
v16 := [2]conformance.StructWithInt{v12, v14}
v1.ArrStruct = v16
var v17 *conformance.StructWithInt = nil
v18 := &conformance.StructWithInt{}
var v19 int32 = 16909060
v18.X = v19
v20 := [2]*conformance.StructWithInt{v17, v18}
v1.ArrNullableStruct = v20
var v21 int32 = 1
var v22 int32 = 2
var v23 int32 = 3
v24 := [3]int32{v21, v22, v23}
var v25 int32 = 4
var v26 int32 = 5
var v27 int32 = 6
v28 := [3]int32{v25, v26, v27}
v29 := [2][3]int32{v24, v28}
v1.ArrArrInt = v29
encodeSuccessCase{
name: "Arrays",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.StructWithVectors{}
v2 := []int32{}
v1.VecEmpty = v2
var v3 int32 = 1
var v4 int32 = 2
v5 := []int32{v3, v4}
v1.VecInt = v5
v6 := "a"
v7 := "b"
v8 := []string{v6, v7}
v1.VecString = v8
var v9 *string = nil
v10 := "c"
v11 := &v10
var v12 *string = nil
v13 := []*string{v9, v11, v12}
v1.VecNullableString = v13
v14 := conformance.StructWithInt{}
var v15 int32 = 1
v14.X = v15
v16 := []conformance.StructWithInt{v14}
v1.VecStruct = v16
var v17 *conformance.StructWithInt = nil
var v18 *conformance.StructWithInt = nil
v19 := &conformance.StructWithInt{}
var v20 int32 = 2
v19.X = v20
v21 := []*conformance.StructWithInt{v17, v18, v19}
v1.VecNullableStruct = v21
var v22 int32 = 1
var v23 int32 = 2
v24 := []int32{v22, v23}
var v25 int32 = 3
v26 := []int32{v25}
v27 := [][]int32{v24, v26}
v1.VecVecInt = v27
encodeSuccessCase{
name: "Vectors",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.MyBool{}
v2 := true
v1.Value = v2
encodeSuccessCase{
name: "BoolTrue",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyBool{}
v2 := false
v1.Value = v2
encodeSuccessCase{
name: "BoolFalse",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyByte{}
var v2 uint8 = 0
v1.Value = v2
encodeSuccessCase{
name: "ByteZero",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyByte{}
var v2 uint8 = 255
v1.Value = v2
encodeSuccessCase{
name: "Byte255",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyInt8{}
var v2 int8 = -128
v1.Value = v2
encodeSuccessCase{
name: "Int8Min",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyInt8{}
var v2 int8 = 0
v1.Value = v2
encodeSuccessCase{
name: "Int8Zero",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyInt8{}
var v2 int8 = 127
v1.Value = v2
encodeSuccessCase{
name: "Int8Max",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyInt16{}
var v2 int16 = -32768
v1.Value = v2
encodeSuccessCase{
name: "Int16Min",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyInt16{}
var v2 int16 = 0
v1.Value = v2
encodeSuccessCase{
name: "Int16Zero",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyInt16{}
var v2 int16 = 32767
v1.Value = v2
encodeSuccessCase{
name: "Int16Max",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyInt32{}
var v2 int32 = -2147483648
v1.Value = v2
encodeSuccessCase{
name: "Int32Min",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyInt32{}
var v2 int32 = 0
v1.Value = v2
encodeSuccessCase{
name: "Int32Zero",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyInt32{}
var v2 int32 = 2147483647
v1.Value = v2
encodeSuccessCase{
name: "Int32Max",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyInt64{}
var v2 int64 = -9223372036854775808
v1.Value = v2
encodeSuccessCase{
name: "Int64Min",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
},
}.check(t)
}
{
v1 := conformance.MyInt64{}
var v2 int64 = 0
v1.Value = v2
encodeSuccessCase{
name: "Int64Zero",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyInt64{}
var v2 int64 = 9223372036854775807
v1.Value = v2
encodeSuccessCase{
name: "Int64Max",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
},
}.check(t)
}
{
v1 := conformance.MyUint8{}
var v2 uint8 = 0
v1.Value = v2
encodeSuccessCase{
name: "Uint8Zero",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyUint8{}
var v2 uint8 = 255
v1.Value = v2
encodeSuccessCase{
name: "Uint8Max",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyUint16{}
var v2 uint16 = 0
v1.Value = v2
encodeSuccessCase{
name: "Uint16Zero",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyUint16{}
var v2 uint16 = 65535
v1.Value = v2
encodeSuccessCase{
name: "Uint16Max",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyUint32{}
var v2 uint32 = 0
v1.Value = v2
encodeSuccessCase{
name: "Uint32Zero",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyUint32{}
var v2 uint32 = 4294967295
v1.Value = v2
encodeSuccessCase{
name: "Uint32Max",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyUint64{}
var v2 uint64 = 0
v1.Value = v2
encodeSuccessCase{
name: "Uint64Zero",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyUint64{}
var v2 uint64 = 18446744073709551615
v1.Value = v2
encodeSuccessCase{
name: "Uint64Max",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
},
}.check(t)
}
{
v1 := conformance.MyFloat32{}
var v2 float32 = 0
v1.Value = v2
encodeSuccessCase{
name: "Float32Zero",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyFloat32{}
var v2 float32 = 1
v1.Value = v2
encodeSuccessCase{
name: "Float32One",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyFloat32{}
var v2 float32 = -1
v1.Value = v2
encodeSuccessCase{
name: "Float32MinusOne",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyFloat32{}
var v2 float32 = 3.4028234663852886e+38
v1.Value = v2
encodeSuccessCase{
name: "Float32Max",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0xff, 0xff, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyFloat64{}
var v2 float64 = 0
v1.Value = v2
encodeSuccessCase{
name: "Float64Zero",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyFloat64{}
var v2 float64 = 1
v1.Value = v2
encodeSuccessCase{
name: "Float64One",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f,
},
}.check(t)
}
{
v1 := conformance.MyFloat64{}
var v2 float64 = -1
v1.Value = v2
encodeSuccessCase{
name: "Float64MinusOne",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xbf,
},
}.check(t)
}
{
v1 := conformance.MyFloat64{}
var v2 float64 = 1.7976931348623157e+308
v1.Value = v2
encodeSuccessCase{
name: "Float64Max",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x7f,
},
}.check(t)
}
{
v1 := conformance.Sandwich1{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionSize8Align4{}
var v4 uint32 = 202050057
v3.SetVariant(v4)
v1.TheUnion = v3
var v5 uint32 = 134678021
v1.After = v5
encodeSuccessCase{
name: "Sandwich1Case1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x02, 0x00, 0x00, 0x00,
0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x07, 0x08,
},
}.check(t)
}
{
v1 := conformance.Sandwich1{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionSize8Align4{}
var v4 uint32 = 202050057
v3.SetVariant(v4)
v1.TheUnion = v3
var v5 uint32 = 134678021
v1.After = v5
encodeSuccessCase{
name: "Sandwich1Case1_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Sandwich2{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionSize12Align4{}
var v4 uint8 = 160
var v5 uint8 = 161
var v6 uint8 = 162
var v7 uint8 = 163
var v8 uint8 = 164
var v9 uint8 = 165
v10 := [6]uint8{v4, v5, v6, v7, v8, v9}
v3.SetVariant(v10)
v1.TheUnion = v3
var v11 uint32 = 134678021
v1.After = v11
encodeSuccessCase{
name: "Sandwich2Case1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x03, 0x00, 0x00, 0x00,
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0x00, 0x00,
0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.Sandwich2{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionSize12Align4{}
var v4 uint8 = 160
var v5 uint8 = 161
var v6 uint8 = 162
var v7 uint8 = 163
var v8 uint8 = 164
var v9 uint8 = 165
v10 := [6]uint8{v4, v5, v6, v7, v8, v9}
v3.SetVariant(v10)
v1.TheUnion = v3
var v11 uint32 = 134678021
v1.After = v11
encodeSuccessCase{
name: "Sandwich2Case1_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Sandwich3{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionSize24Align8{}
v4 := conformance.StructSize16Align8{}
var v5 uint64 = 12080525177006498208
v4.F1 = v5
var v6 uint64 = 12659246559711111592
v4.F2 = v6
v3.SetVariant(v4)
v1.TheUnion = v3
var v7 uint32 = 134678021
v1.After = v7
encodeSuccessCase{
name: "Sandwich3Case1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.Sandwich3{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionSize24Align8{}
v4 := conformance.StructSize16Align8{}
var v5 uint64 = 12080525177006498208
v4.F1 = v5
var v6 uint64 = 12659246559711111592
v4.F2 = v6
v3.SetVariant(v4)
v1.TheUnion = v3
var v7 uint32 = 134678021
v1.After = v7
encodeSuccessCase{
name: "Sandwich3Case1_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Sandwich4{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionSize36Align4{}
var v4 uint8 = 160
var v5 uint8 = 161
var v6 uint8 = 162
var v7 uint8 = 163
var v8 uint8 = 164
var v9 uint8 = 165
var v10 uint8 = 166
var v11 uint8 = 167
var v12 uint8 = 168
var v13 uint8 = 169
var v14 uint8 = 170
var v15 uint8 = 171
var v16 uint8 = 172
var v17 uint8 = 173
var v18 uint8 = 174
var v19 uint8 = 175
var v20 uint8 = 176
var v21 uint8 = 177
var v22 uint8 = 178
var v23 uint8 = 179
var v24 uint8 = 180
var v25 uint8 = 181
var v26 uint8 = 182
var v27 uint8 = 183
var v28 uint8 = 184
var v29 uint8 = 185
var v30 uint8 = 186
var v31 uint8 = 187
var v32 uint8 = 188
var v33 uint8 = 189
var v34 uint8 = 190
var v35 uint8 = 191
v36 := [32]uint8{v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35}
v3.SetVariant(v36)
v1.TheUnion = v3
var v37 uint32 = 134678021
v1.After = v37
encodeSuccessCase{
name: "Sandwich4Case1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x03, 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,
0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.Sandwich4{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionSize36Align4{}
var v4 uint8 = 160
var v5 uint8 = 161
var v6 uint8 = 162
var v7 uint8 = 163
var v8 uint8 = 164
var v9 uint8 = 165
var v10 uint8 = 166
var v11 uint8 = 167
var v12 uint8 = 168
var v13 uint8 = 169
var v14 uint8 = 170
var v15 uint8 = 171
var v16 uint8 = 172
var v17 uint8 = 173
var v18 uint8 = 174
var v19 uint8 = 175
var v20 uint8 = 176
var v21 uint8 = 177
var v22 uint8 = 178
var v23 uint8 = 179
var v24 uint8 = 180
var v25 uint8 = 181
var v26 uint8 = 182
var v27 uint8 = 183
var v28 uint8 = 184
var v29 uint8 = 185
var v30 uint8 = 186
var v31 uint8 = 187
var v32 uint8 = 188
var v33 uint8 = 189
var v34 uint8 = 190
var v35 uint8 = 191
v36 := [32]uint8{v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35}
v3.SetVariant(v36)
v1.TheUnion = v3
var v37 uint32 = 134678021
v1.After = v37
encodeSuccessCase{
name: "Sandwich4Case1_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Sandwich5{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionOfUnion{}
v4 := conformance.UnionSize8Align4{}
var v5 uint32 = 202050057
v4.SetVariant(v5)
v3.SetSize8align4(v4)
v1.UnionOfUnion = v3
var v6 uint32 = 134678021
v1.After = v6
encodeSuccessCase{
name: "Sandwich5Case1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x09, 0x0a, 0x0b, 0x0c,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.Sandwich5{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionOfUnion{}
v4 := conformance.UnionSize8Align4{}
var v5 uint32 = 202050057
v4.SetVariant(v5)
v3.SetSize8align4(v4)
v1.UnionOfUnion = v3
var v6 uint32 = 134678021
v1.After = v6
encodeSuccessCase{
name: "Sandwich5Case1_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Sandwich5{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionOfUnion{}
v4 := conformance.UnionSize24Align8{}
v5 := conformance.StructSize16Align8{}
var v6 uint64 = 12080525177006498208
v5.F1 = v6
var v7 uint64 = 12659246559711111592
v5.F2 = v7
v4.SetVariant(v5)
v3.SetSize24align8(v4)
v1.UnionOfUnion = v3
var v8 uint32 = 134678021
v1.After = v8
encodeSuccessCase{
name: "Sandwich5Case2",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.Sandwich5{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionOfUnion{}
v4 := conformance.UnionSize24Align8{}
v5 := conformance.StructSize16Align8{}
var v6 uint64 = 12080525177006498208
v5.F1 = v6
var v7 uint64 = 12659246559711111592
v5.F2 = v7
v4.SetVariant(v5)
v3.SetSize24align8(v4)
v1.UnionOfUnion = v3
var v8 uint32 = 134678021
v1.After = v8
encodeSuccessCase{
name: "Sandwich5Case2_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
var v4 uint8 = 160
var v5 uint8 = 161
var v6 uint8 = 162
var v7 uint8 = 163
var v8 uint8 = 164
var v9 uint8 = 165
v10 := []uint8{v4, v5, v6, v7, v8, v9}
v3.SetVectorOfUint8(v10)
v1.TheUnion = v3
var v11 uint32 = 134678021
v1.After = v11
encodeSuccessCase{
name: "Sandwich6Case1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06, 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,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
var v4 uint8 = 160
var v5 uint8 = 161
var v6 uint8 = 162
var v7 uint8 = 163
var v8 uint8 = 164
var v9 uint8 = 165
v10 := []uint8{v4, v5, v6, v7, v8, v9}
v3.SetVectorOfUint8(v10)
v1.TheUnion = v3
var v11 uint32 = 134678021
v1.After = v11
encodeSuccessCase{
name: "Sandwich6Case1_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
v4 := []uint8{}
v3.SetVectorOfUint8(v4)
v1.TheUnion = v3
var v5 uint32 = 134678021
v1.After = v5
encodeSuccessCase{
name: "Sandwich6Case1AbsentVector",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
v4 := []uint8{}
v3.SetVectorOfUint8(v4)
v1.TheUnion = v3
var v5 uint32 = 134678021
v1.After = v5
encodeSuccessCase{
name: "Sandwich6Case1AbsentVector_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
v4 := "soft migrations rock!"
v3.SetString(v4)
v1.TheUnion = v3
var v5 uint32 = 134678021
v1.After = v5
encodeSuccessCase{
name: "Sandwich6Case2",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00,
0x73, 0x6f, 0x66, 0x74, 0x20, 0x6d, 0x69, 0x67,
0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20,
0x72, 0x6f, 0x63, 0x6b, 0x21, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
v4 := "soft migrations rock!"
v3.SetString(v4)
v1.TheUnion = v3
var v5 uint32 = 134678021
v1.After = v5
encodeSuccessCase{
name: "Sandwich6Case2_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
v4 := conformance.StructSize3Align1{}
var v5 uint8 = 115
var v6 uint8 = 111
var v7 uint8 = 102
v8 := [3]uint8{v5, v6, v7}
v4.ThreeBytes = v8
v9 := conformance.StructSize3Align1{}
var v10 uint8 = 32
var v11 uint8 = 109
var v12 uint8 = 105
v13 := [3]uint8{v10, v11, v12}
v9.ThreeBytes = v13
v14 := conformance.StructSize3Align1{}
var v15 uint8 = 114
var v16 uint8 = 97
var v17 uint8 = 116
v18 := [3]uint8{v15, v16, v17}
v14.ThreeBytes = v18
v19 := []conformance.StructSize3Align1{v4, v9, v14}
v3.SetVectorS3A1(v19)
v1.TheUnion = v3
var v20 uint32 = 134678021
v1.After = v20
encodeSuccessCase{
name: "Sandwich6Case3",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00,
0x73, 0x6f, 0x66, 0x20, 0x6d, 0x69, 0x72, 0x61,
0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
v4 := conformance.StructSize3Align1{}
var v5 uint8 = 115
var v6 uint8 = 111
var v7 uint8 = 102
v8 := [3]uint8{v5, v6, v7}
v4.ThreeBytes = v8
v9 := conformance.StructSize3Align1{}
var v10 uint8 = 32
var v11 uint8 = 109
var v12 uint8 = 105
v13 := [3]uint8{v10, v11, v12}
v9.ThreeBytes = v13
v14 := conformance.StructSize3Align1{}
var v15 uint8 = 114
var v16 uint8 = 97
var v17 uint8 = 116
v18 := [3]uint8{v15, v16, v17}
v14.ThreeBytes = v18
v19 := []conformance.StructSize3Align1{v4, v9, v14}
v3.SetVectorS3A1(v19)
v1.TheUnion = v3
var v20 uint32 = 134678021
v1.After = v20
encodeSuccessCase{
name: "Sandwich6Case3_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
v4 := conformance.StructSize3Align2{}
var v5 uint16 = 28531
v4.F1 = v5
var v6 uint8 = 102
v4.F2 = v6
v7 := conformance.StructSize3Align2{}
var v8 uint16 = 27936
v7.F1 = v8
var v9 uint8 = 105
v7.F2 = v9
v10 := conformance.StructSize3Align2{}
var v11 uint16 = 24946
v10.F1 = v11
var v12 uint8 = 116
v10.F2 = v12
v13 := []conformance.StructSize3Align2{v4, v7, v10}
v3.SetVectorS3A2(v13)
v1.TheUnion = v3
var v14 uint32 = 134678021
v1.After = v14
encodeSuccessCase{
name: "Sandwich6Case4",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00,
0x73, 0x6f, 0x66, 0x00, 0x20, 0x6d, 0x69, 0x00,
0x72, 0x61, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
v4 := conformance.StructSize3Align2{}
var v5 uint16 = 28531
v4.F1 = v5
var v6 uint8 = 102
v4.F2 = v6
v7 := conformance.StructSize3Align2{}
var v8 uint16 = 27936
v7.F1 = v8
var v9 uint8 = 105
v7.F2 = v9
v10 := conformance.StructSize3Align2{}
var v11 uint16 = 24946
v10.F1 = v11
var v12 uint8 = 116
v10.F2 = v12
v13 := []conformance.StructSize3Align2{v4, v7, v10}
v3.SetVectorS3A2(v13)
v1.TheUnion = v3
var v14 uint32 = 134678021
v1.After = v14
encodeSuccessCase{
name: "Sandwich6Case4_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
var v4 uint32 = 4294967295
var v5 uint32 = 4294967295
var v6 uint32 = 4294967295
v7 := []uint32{v4, v5, v6}
v3.SetHandles(v7)
v1.TheUnion = v3
var v8 uint32 = 134678021
v1.After = v8
encodeSuccessCase{
name: "Sandwich6Case5",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 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,
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
var v4 uint32 = 4294967295
var v5 uint32 = 4294967295
var v6 uint32 = 4294967295
v7 := []uint32{v4, v5, v6}
v3.SetHandles(v7)
v1.TheUnion = v3
var v8 uint32 = 134678021
v1.After = v8
encodeSuccessCase{
name: "Sandwich6Case5_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
v4 := conformance.StructSize3Align1{}
var v5 uint8 = 161
var v6 uint8 = 162
var v7 uint8 = 163
v8 := [3]uint8{v5, v6, v7}
v4.ThreeBytes = v8
v9 := conformance.StructSize3Align1{}
var v10 uint8 = 164
var v11 uint8 = 165
var v12 uint8 = 166
v13 := [3]uint8{v10, v11, v12}
v9.ThreeBytes = v13
v14 := [2]conformance.StructSize3Align1{v4, v9}
v3.SetArrayS3A1(v14)
v1.TheUnion = v3
var v15 uint32 = 134678021
v1.After = v15
encodeSuccessCase{
name: "Sandwich6Case6",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
v4 := conformance.StructSize3Align1{}
var v5 uint8 = 161
var v6 uint8 = 162
var v7 uint8 = 163
v8 := [3]uint8{v5, v6, v7}
v4.ThreeBytes = v8
v9 := conformance.StructSize3Align1{}
var v10 uint8 = 164
var v11 uint8 = 165
var v12 uint8 = 166
v13 := [3]uint8{v10, v11, v12}
v9.ThreeBytes = v13
v14 := [2]conformance.StructSize3Align1{v4, v9}
v3.SetArrayS3A1(v14)
v1.TheUnion = v3
var v15 uint32 = 134678021
v1.After = v15
encodeSuccessCase{
name: "Sandwich6Case6_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
v4 := conformance.StructSize3Align2{}
var v5 uint16 = 41633
v4.F1 = v5
var v6 uint8 = 163
v4.F2 = v6
v7 := conformance.StructSize3Align2{}
var v8 uint16 = 42404
v7.F1 = v8
var v9 uint8 = 166
v7.F2 = v9
v10 := [2]conformance.StructSize3Align2{v4, v7}
v3.SetArrayS3A2(v10)
v1.TheUnion = v3
var v11 uint32 = 134678021
v1.After = v11
encodeSuccessCase{
name: "Sandwich6Case7",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00,
0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xa1, 0xa2, 0xa3, 0x00, 0xa4, 0xa5, 0xa6, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
v4 := conformance.StructSize3Align2{}
var v5 uint16 = 41633
v4.F1 = v5
var v6 uint8 = 163
v4.F2 = v6
v7 := conformance.StructSize3Align2{}
var v8 uint16 = 42404
v7.F1 = v8
var v9 uint8 = 166
v7.F2 = v9
v10 := [2]conformance.StructSize3Align2{v4, v7}
v3.SetArrayS3A2(v10)
v1.TheUnion = v3
var v11 uint32 = 134678021
v1.After = v11
encodeSuccessCase{
name: "Sandwich6Case7_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
v4 := conformance.UnionSize8Align4{}
var v5 uint32 = 202050057
v4.SetVariant(v5)
v6 := []conformance.UnionSize8Align4{v4}
v3.SetVectorUnion(v6)
v1.TheUnion = v3
var v7 uint32 = 134678021
v1.After = v7
encodeSuccessCase{
name: "Sandwich6Case8",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x09, 0x0a, 0x0b, 0x0c,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
v4 := conformance.UnionSize8Align4{}
var v5 uint32 = 202050057
v4.SetVariant(v5)
v6 := []conformance.UnionSize8Align4{v4}
v3.SetVectorUnion(v6)
v1.TheUnion = v3
var v7 uint32 = 134678021
v1.After = v7
encodeSuccessCase{
name: "Sandwich6Case8_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.TableStructWithReservedSandwichStruct{}
v2 := conformance.TableStructWithReservedSandwich{}
v3 := conformance.StructSize3Align1{}
var v4 uint8 = 9
var v5 uint8 = 10
var v6 uint8 = 11
v7 := [3]uint8{v4, v5, v6}
v3.ThreeBytes = v7
v2.SetS1(v3)
v8 := conformance.StructSize3Align1{}
var v9 uint8 = 25
var v10 uint8 = 26
var v11 uint8 = 27
v12 := [3]uint8{v9, v10, v11}
v8.ThreeBytes = v12
v2.SetS2(v8)
v1.Table = v2
encodeSuccessCase{
name: "Table_StructWithReservedSandwich",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.TableStructWithReservedSandwichStruct{}
v2 := conformance.TableStructWithReservedSandwich{}
v3 := conformance.StructSize3Align1{}
var v4 uint8 = 9
var v5 uint8 = 10
var v6 uint8 = 11
v7 := [3]uint8{v4, v5, v6}
v3.ThreeBytes = v7
v2.SetS1(v3)
v8 := conformance.StructSize3Align1{}
var v9 uint8 = 25
var v10 uint8 = 26
var v11 uint8 = 27
v12 := [3]uint8{v9, v10, v11}
v8.ThreeBytes = v12
v2.SetS2(v8)
v1.Table = v2
encodeSuccessCase{
name: "Table_StructWithReservedSandwich_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.TableStructWithUint32SandwichStruct{}
v2 := conformance.TableStructWithUint32Sandwich{}
var v3 uint32 = 67305985
v2.SetI(v3)
v4 := conformance.StructSize3Align1{}
var v5 uint8 = 9
var v6 uint8 = 10
var v7 uint8 = 11
v8 := [3]uint8{v5, v6, v7}
v4.ThreeBytes = v8
v2.SetS1(v4)
v9 := conformance.StructSize3Align1{}
var v10 uint8 = 25
var v11 uint8 = 26
var v12 uint8 = 27
v13 := [3]uint8{v10, v11, v12}
v9.ThreeBytes = v13
v2.SetS2(v9)
var v14 uint32 = 218893066
v2.SetI2(v14)
v1.Table = v2
encodeSuccessCase{
name: "Table_StructWithUint32Sandwich",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.TableStructWithUint32SandwichStruct{}
v2 := conformance.TableStructWithUint32Sandwich{}
var v3 uint32 = 67305985
v2.SetI(v3)
v4 := conformance.StructSize3Align1{}
var v5 uint8 = 9
var v6 uint8 = 10
var v7 uint8 = 11
v8 := [3]uint8{v5, v6, v7}
v4.ThreeBytes = v8
v2.SetS1(v4)
v9 := conformance.StructSize3Align1{}
var v10 uint8 = 25
var v11 uint8 = 26
var v12 uint8 = 27
v13 := [3]uint8{v10, v11, v12}
v9.ThreeBytes = v13
v2.SetS2(v9)
var v14 uint32 = 218893066
v2.SetI2(v14)
v1.Table = v2
encodeSuccessCase{
name: "Table_StructWithUint32Sandwich_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.TableUnionWithVectorReservedSandwichStruct{}
v2 := conformance.TableUnionWithVectorReservedSandwich{}
v3 := conformance.UnionWithVector{}
v4 := "hello"
v3.SetString(v4)
v2.SetUv(v3)
v1.Table = v2
encodeSuccessCase{
name: "Table_UnionWithVector_ReservedSandwich",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.TableUnionWithVectorReservedSandwichStruct{}
v2 := conformance.TableUnionWithVectorReservedSandwich{}
v3 := conformance.UnionWithVector{}
v4 := "hello"
v3.SetString(v4)
v2.SetUv(v3)
v1.Table = v2
encodeSuccessCase{
name: "Table_UnionWithVector_ReservedSandwich_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.TableUnionWithVectorStructSandwichStruct{}
v2 := conformance.TableUnionWithVectorStructSandwich{}
v3 := conformance.StructSize3Align1{}
var v4 uint8 = 1
var v5 uint8 = 2
var v6 uint8 = 3
v7 := [3]uint8{v4, v5, v6}
v3.ThreeBytes = v7
v2.SetS1(v3)
v8 := conformance.UnionWithVector{}
v9 := "hello"
v8.SetString(v9)
v2.SetUv(v8)
v10 := conformance.StructSize3Align1{}
var v11 uint8 = 4
var v12 uint8 = 5
var v13 uint8 = 6
v14 := [3]uint8{v11, v12, v13}
v10.ThreeBytes = v14
v2.SetS2(v10)
v1.Table = v2
encodeSuccessCase{
name: "Table_UnionWithVector_StructSandwich",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
0x20, 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,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x00, 0x00, 0x00,
0x04, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.TableUnionWithVectorStructSandwichStruct{}
v2 := conformance.TableUnionWithVectorStructSandwich{}
v3 := conformance.StructSize3Align1{}
var v4 uint8 = 1
var v5 uint8 = 2
var v6 uint8 = 3
v7 := [3]uint8{v4, v5, v6}
v3.ThreeBytes = v7
v2.SetS1(v3)
v8 := conformance.UnionWithVector{}
v9 := "hello"
v8.SetString(v9)
v2.SetUv(v8)
v10 := conformance.StructSize3Align1{}
var v11 uint8 = 4
var v12 uint8 = 5
var v13 uint8 = 6
v14 := [3]uint8{v11, v12, v13}
v10.ThreeBytes = v14
v2.SetS2(v10)
v1.Table = v2
encodeSuccessCase{
name: "Table_UnionWithVector_StructSandwich_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.XUnionWithStructStruct{}
v2 := conformance.XUnionWithStruct{}
v3 := conformance.StructSize3Align1{}
var v4 uint8 = 1
var v5 uint8 = 2
var v6 uint8 = 3
v7 := [3]uint8{v4, v5, v6}
v3.ThreeBytes = v7
v2.SetS(v3)
v1.Xu = v2
encodeSuccessCase{
name: "XUnionWithStruct",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.XUnionWithStructStruct{}
v2 := conformance.XUnionWithStruct{}
v3 := conformance.StructSize3Align1{}
var v4 uint8 = 1
var v5 uint8 = 2
var v6 uint8 = 3
v7 := [3]uint8{v4, v5, v6}
v3.ThreeBytes = v7
v2.SetS(v3)
v1.Xu = v2
encodeSuccessCase{
name: "XUnionWithStruct_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.ArrayStruct{}
v2 := conformance.StringUnion{}
v3 := "one"
v2.SetS(v3)
v4 := conformance.StringUnion{}
v5 := "two"
v4.SetS(v5)
v6 := conformance.StringUnion{}
v7 := "three"
v6.SetS(v7)
v8 := [3]conformance.StringUnion{v2, v4, v6}
v1.Unions = v8
v9 := &conformance.StringUnion{}
v10 := "four"
v9.SetS(v10)
v11 := &conformance.StringUnion{}
v12 := "five"
v11.SetS(v12)
v13 := &conformance.StringUnion{}
v14 := "six"
v13.SetS(v14)
v15 := [3]*conformance.StringUnion{v9, v11, v13}
v1.OptionalUnions = v15
encodeSuccessCase{
name: "ArrayStruct",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 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,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x6f, 0x6e, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
0x74, 0x77, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x00,
0x74, 0x68, 0x72, 0x65, 0x65, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 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,
0x01, 0x00, 0x00, 0x00, 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,
0x01, 0x00, 0x00, 0x00, 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,
},
}.check(t)
}
{
v1 := conformance.ArrayStruct{}
v2 := conformance.StringUnion{}
v3 := "one"
v2.SetS(v3)
v4 := conformance.StringUnion{}
v5 := "two"
v4.SetS(v5)
v6 := conformance.StringUnion{}
v7 := "three"
v6.SetS(v7)
v8 := [3]conformance.StringUnion{v2, v4, v6}
v1.Unions = v8
v9 := &conformance.StringUnion{}
v10 := "four"
v9.SetS(v10)
v11 := &conformance.StringUnion{}
v12 := "five"
v11.SetS(v12)
v13 := &conformance.StringUnion{}
v14 := "six"
v13.SetS(v14)
v15 := [3]*conformance.StringUnion{v9, v11, v13}
v1.OptionalUnions = v15
encodeSuccessCase{
name: "ArrayStruct_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Regression1{}
var v2 uint8 = 1
v1.F1 = v2
var v3 uint32 = 2
v1.F2 = v3
var v4 uint8 = 3
v1.F3 = v4
var v5 uint16 = 4
v1.F4 = v5
var v6 uint64 = 5
v1.F5 = v6
var v7 uint8 = 6
v1.F6 = v7
encodeSuccessCase{
name: "Regression1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Regression1{}
var v2 uint8 = 1
v1.F1 = v2
var v3 uint32 = 2
v1.F2 = v3
var v4 uint8 = 3
v1.F3 = v4
var v5 uint16 = 4
v1.F4 = v5
var v6 uint64 = 5
v1.F5 = v6
var v7 uint8 = 6
v1.F6 = v7
encodeSuccessCase{
name: "Regression1_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Regression2{}
v2 := conformance.Regression1{}
var v3 uint8 = 1
v2.F1 = v3
var v4 uint32 = 2
v2.F2 = v4
var v5 uint8 = 3
v2.F3 = v5
var v6 uint16 = 4
v2.F4 = v6
var v7 uint64 = 5
v2.F5 = v7
var v8 uint8 = 6
v2.F6 = v8
v1.Head = v2
var v9 uint8 = 7
v1.F7 = v9
encodeSuccessCase{
name: "Regression2",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Regression2{}
v2 := conformance.Regression1{}
var v3 uint8 = 1
v2.F1 = v3
var v4 uint32 = 2
v2.F2 = v4
var v5 uint8 = 3
v2.F3 = v5
var v6 uint16 = 4
v2.F4 = v6
var v7 uint64 = 5
v2.F5 = v7
var v8 uint8 = 6
v2.F6 = v8
v1.Head = v2
var v9 uint8 = 7
v1.F7 = v9
encodeSuccessCase{
name: "Regression2_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Regression3{}
encodeSuccessCase{
name: "Regression3Absent",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.Regression3{}
encodeSuccessCase{
name: "Regression3Absent_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.Regression3{}
v2 := &conformance.Regression2{}
v3 := conformance.Regression1{}
var v4 uint8 = 1
v3.F1 = v4
var v5 uint32 = 2
v3.F2 = v5
var v6 uint8 = 3
v3.F3 = v6
var v7 uint16 = 4
v3.F4 = v7
var v8 uint64 = 5
v3.F5 = v8
var v9 uint8 = 6
v3.F6 = v9
v2.Head = v3
var v10 uint8 = 7
v2.F7 = v10
v1.OptValue = v2
encodeSuccessCase{
name: "Regression3Present",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Regression3{}
v2 := &conformance.Regression2{}
v3 := conformance.Regression1{}
var v4 uint8 = 1
v3.F1 = v4
var v5 uint32 = 2
v3.F2 = v5
var v6 uint8 = 3
v3.F3 = v6
var v7 uint16 = 4
v3.F4 = v7
var v8 uint64 = 5
v3.F5 = v8
var v9 uint8 = 6
v3.F6 = v9
v2.Head = v3
var v10 uint8 = 7
v2.F7 = v10
v1.OptValue = v2
encodeSuccessCase{
name: "Regression3Present_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.UnionWithBoundStringStruct{}
v2 := conformance.UnionWithBoundString{}
v3 := "abcd"
v2.SetBoundFiveStr(v3)
v1.V = v2
encodeSuccessCase{
name: "UnionWithBoundString",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x61, 0x62, 0x63, 0x64, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.SingleVariantUnionStruct{}
v2 := conformance.SingleVariantUnion{}
var v3 uint32 = 42
v2.SetX(v3)
v1.U = v2
encodeSuccessCase{
name: "UnionMigration_SingleVariant",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.SingleVariantUnionStruct{}
v2 := conformance.SingleVariantUnion{}
var v3 uint32 = 42
v2.SetX(v3)
v1.U = v2
encodeSuccessCase{
name: "UnionMigration_SingleVariant_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.SandwichUnionSize8Alignment4{}
var v2 uint32 = 10
v1.Before = v2
v3 := conformance.UnionSize8Alignment4{}
var v4 uint32 = 4
v3.SetVariant(v4)
v1.Value = v3
var v5 uint32 = 20
v1.After = v5
encodeSuccessCase{
name: "UnionSize8Alignment4",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.SandwichUnionSize8Alignment4{}
var v2 uint32 = 10
v1.Before = v2
v3 := conformance.UnionSize8Alignment4{}
var v4 uint32 = 4
v3.SetVariant(v4)
v1.Value = v3
var v5 uint32 = 20
v1.After = v5
encodeSuccessCase{
name: "UnionSize8Alignment4_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
0x0a, 0x00, 0x00, 0x00, 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,
0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.SandwichUnionSize12Alignment4{}
var v2 uint32 = 10
v1.Before = v2
v3 := conformance.UnionSize12Alignment4{}
var v4 uint8 = 1
var v5 uint8 = 2
var v6 uint8 = 3
var v7 uint8 = 4
var v8 uint8 = 5
var v9 uint8 = 6
v10 := [6]uint8{v4, v5, v6, v7, v8, v9}
v3.SetVariant(v10)
v1.Value = v3
var v11 uint32 = 20
v1.After = v11
encodeSuccessCase{
name: "UnionSize12Alignment4",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x0a, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x00, 0x00,
0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.SandwichUnionSize12Alignment4{}
var v2 uint32 = 10
v1.Before = v2
v3 := conformance.UnionSize12Alignment4{}
var v4 uint8 = 1
var v5 uint8 = 2
var v6 uint8 = 3
var v7 uint8 = 4
var v8 uint8 = 5
var v9 uint8 = 6
v10 := [6]uint8{v4, v5, v6, v7, v8, v9}
v3.SetVariant(v10)
v1.Value = v3
var v11 uint32 = 20
v1.After = v11
encodeSuccessCase{
name: "UnionSize12Alignment4_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
0x0a, 0x00, 0x00, 0x00, 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,
0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.SandwichUnionSize24Alignment8{}
var v2 uint32 = 10
v1.Before = v2
v3 := conformance.UnionSize24Alignment8{}
v4 := conformance.StructSize16Alignment8{}
var v5 uint64 = 1
v4.F1 = v5
var v6 uint64 = 2
v4.F2 = v6
v3.SetVariant(v4)
v1.Value = v3
var v7 uint32 = 20
v1.After = v7
encodeSuccessCase{
name: "UnionSize24Alignment8",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.SandwichUnionSize24Alignment8{}
var v2 uint32 = 10
v1.Before = v2
v3 := conformance.UnionSize24Alignment8{}
v4 := conformance.StructSize16Alignment8{}
var v5 uint64 = 1
v4.F1 = v5
var v6 uint64 = 2
v4.F2 = v6
v3.SetVariant(v4)
v1.Value = v3
var v7 uint32 = 20
v1.After = v7
encodeSuccessCase{
name: "UnionSize24Alignment8_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
0x0a, 0x00, 0x00, 0x00, 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,
0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.SandwichUnionSize36Alignment4{}
var v2 uint32 = 10
v1.Before = v2
v3 := conformance.UnionSize36Alignment4{}
var v4 uint8 = 1
var v5 uint8 = 2
var v6 uint8 = 3
var v7 uint8 = 4
var v8 uint8 = 5
var v9 uint8 = 6
var v10 uint8 = 7
var v11 uint8 = 8
var v12 uint8 = 9
var v13 uint8 = 10
var v14 uint8 = 11
var v15 uint8 = 12
var v16 uint8 = 13
var v17 uint8 = 14
var v18 uint8 = 15
var v19 uint8 = 16
var v20 uint8 = 17
var v21 uint8 = 18
var v22 uint8 = 19
var v23 uint8 = 20
var v24 uint8 = 21
var v25 uint8 = 22
var v26 uint8 = 23
var v27 uint8 = 24
var v28 uint8 = 25
var v29 uint8 = 26
var v30 uint8 = 27
var v31 uint8 = 28
var v32 uint8 = 29
var v33 uint8 = 30
var v34 uint8 = 31
var v35 uint8 = 32
v36 := [32]uint8{v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35}
v3.SetVariant(v36)
v1.Value = v3
var v37 uint32 = 20
v1.After = v37
encodeSuccessCase{
name: "UnionSize36Alignment4",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x0a, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.SandwichUnionSize36Alignment4{}
var v2 uint32 = 10
v1.Before = v2
v3 := conformance.UnionSize36Alignment4{}
var v4 uint8 = 1
var v5 uint8 = 2
var v6 uint8 = 3
var v7 uint8 = 4
var v8 uint8 = 5
var v9 uint8 = 6
var v10 uint8 = 7
var v11 uint8 = 8
var v12 uint8 = 9
var v13 uint8 = 10
var v14 uint8 = 11
var v15 uint8 = 12
var v16 uint8 = 13
var v17 uint8 = 14
var v18 uint8 = 15
var v19 uint8 = 16
var v20 uint8 = 17
var v21 uint8 = 18
var v22 uint8 = 19
var v23 uint8 = 20
var v24 uint8 = 21
var v25 uint8 = 22
var v26 uint8 = 23
var v27 uint8 = 24
var v28 uint8 = 25
var v29 uint8 = 26
var v30 uint8 = 27
var v31 uint8 = 28
var v32 uint8 = 29
var v33 uint8 = 30
var v34 uint8 = 31
var v35 uint8 = 32
v36 := [32]uint8{v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35}
v3.SetVariant(v36)
v1.Value = v3
var v37 uint32 = 20
v1.After = v37
encodeSuccessCase{
name: "UnionSize36Alignment4_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
0x0a, 0x00, 0x00, 0x00, 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,
0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
},
}.check(t)
}
}
func TestAllDecodeSuccessCases(t *testing.T) {
{
v1 := conformance.ThreeByteInStruct{}
v2 := conformance.ThreeByte{}
var v3 uint8 = 1
v2.Elem1 = v3
var v4 uint8 = 2
v2.Elem2 = v4
var v5 uint8 = 3
v2.Elem3 = v5
v1.Elem1 = v2
v6 := conformance.ThreeByte{}
var v7 uint8 = 4
v6.Elem1 = v7
var v8 uint8 = 5
v6.Elem2 = v8
var v9 uint8 = 6
v6.Elem3 = v9
v1.Elem2 = v6
v10 := conformance.ThreeByte{}
var v11 uint8 = 7
v10.Elem1 = v11
var v12 uint8 = 8
v10.Elem2 = v12
var v13 uint8 = 9
v10.Elem3 = v13
v1.Elem3 = v10
decodeSuccessCase{
name: "3ByteObjectAlignmentInStruct",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.FiveByteInStruct{}
v2 := conformance.FiveByte{}
var v3 uint32 = 16909060
v2.Elem1 = v3
var v4 uint8 = 5
v2.Elem2 = v4
v1.Elem1 = v2
v5 := conformance.FiveByte{}
var v6 uint32 = 101124105
v5.Elem1 = v6
var v7 uint8 = 10
v5.Elem2 = v7
v1.Elem2 = v5
v8 := conformance.FiveByte{}
var v9 uint32 = 185339150
v8.Elem1 = v9
var v10 uint8 = 15
v8.Elem2 = v10
v1.Elem3 = v8
decodeSuccessCase{
name: "5ByteObjectAlignmentInStruct",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x04, 0x03, 0x02, 0x01, 0x05, 0x00, 0x00, 0x00,
0x09, 0x08, 0x07, 0x06, 0x0a, 0x00, 0x00, 0x00,
0x0e, 0x0d, 0x0c, 0x0b, 0x0f, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.ThreeByteInVector{}
v2 := conformance.ThreeByte{}
var v3 uint8 = 1
v2.Elem1 = v3
var v4 uint8 = 2
v2.Elem2 = v4
var v5 uint8 = 3
v2.Elem3 = v5
v6 := conformance.ThreeByte{}
var v7 uint8 = 4
v6.Elem1 = v7
var v8 uint8 = 5
v6.Elem2 = v8
var v9 uint8 = 6
v6.Elem3 = v9
v10 := conformance.ThreeByte{}
var v11 uint8 = 7
v10.Elem1 = v11
var v12 uint8 = 8
v10.Elem2 = v12
var v13 uint8 = 9
v10.Elem3 = v13
v14 := []conformance.ThreeByte{v2, v6, v10}
v1.Elems = v14
decodeSuccessCase{
name: "3ByteObjectAlignmentInVector",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.FiveByteInVector{}
v2 := conformance.FiveByte{}
var v3 uint32 = 16909060
v2.Elem1 = v3
var v4 uint8 = 5
v2.Elem2 = v4
v5 := conformance.FiveByte{}
var v6 uint32 = 101124105
v5.Elem1 = v6
var v7 uint8 = 10
v5.Elem2 = v7
v8 := conformance.FiveByte{}
var v9 uint32 = 185339150
v8.Elem1 = v9
var v10 uint8 = 15
v8.Elem2 = v10
v11 := []conformance.FiveByte{v2, v5, v8}
v1.Elems = v11
decodeSuccessCase{
name: "5ByteObjectAlignmentInVector",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.ThreeByteInArray{}
v2 := conformance.ThreeByte{}
var v3 uint8 = 1
v2.Elem1 = v3
var v4 uint8 = 2
v2.Elem2 = v4
var v5 uint8 = 3
v2.Elem3 = v5
v6 := conformance.ThreeByte{}
var v7 uint8 = 4
v6.Elem1 = v7
var v8 uint8 = 5
v6.Elem2 = v8
var v9 uint8 = 6
v6.Elem3 = v9
v10 := conformance.ThreeByte{}
var v11 uint8 = 7
v10.Elem1 = v11
var v12 uint8 = 8
v10.Elem2 = v12
var v13 uint8 = 9
v10.Elem3 = v13
v14 := [3]conformance.ThreeByte{v2, v6, v10}
v1.Elems = v14
decodeSuccessCase{
name: "3ByteObjectAlignmentInArray",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.FiveByteInArray{}
v2 := conformance.FiveByte{}
var v3 uint32 = 16909060
v2.Elem1 = v3
var v4 uint8 = 5
v2.Elem2 = v4
v5 := conformance.FiveByte{}
var v6 uint32 = 101124105
v5.Elem1 = v6
var v7 uint8 = 10
v5.Elem2 = v7
v8 := conformance.FiveByte{}
var v9 uint32 = 185339150
v8.Elem1 = v9
var v10 uint8 = 15
v8.Elem2 = v10
v11 := [3]conformance.FiveByte{v2, v5, v8}
v1.Elems = v11
decodeSuccessCase{
name: "5ByteObjectAlignmentInArray",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x04, 0x03, 0x02, 0x01, 0x05, 0x00, 0x00, 0x00,
0x09, 0x08, 0x07, 0x06, 0x0a, 0x00, 0x00, 0x00,
0x0e, 0x0d, 0x0c, 0x0b, 0x0f, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.EmptyStruct{}
decodeSuccessCase{
name: "EmptyStruct",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.EmptyStructSandwich{}
v2 := "before"
v1.Before = v2
v3 := conformance.EmptyStruct{}
v1.Es = v3
v4 := "after"
v1.After = v4
decodeSuccessCase{
name: "EmptyStructSandwich",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Uint8Uint16Uint32Uint64{}
var v2 uint8 = 1
v1.F1 = v2
var v3 uint16 = 515
v1.F2 = v3
var v4 uint32 = 67438087
v1.F3 = v4
var v5 uint64 = 579005069656919567
v1.F4 = v5
decodeSuccessCase{
name: "Uint8Uint16Uint32Uint64",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x00, 0x03, 0x02, 0x07, 0x06, 0x05, 0x04,
0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
},
}.check(t)
}
{
v1 := conformance.Uint64Uint32Uint16Uint8{}
var v2 uint64 = 579005069656919567
v1.F1 = v2
var v3 uint32 = 67438087
v1.F2 = v3
var v4 uint16 = 515
v1.F3 = v4
var v5 uint8 = 1
v1.F4 = v5
decodeSuccessCase{
name: "Uint64Uint32Uint16Uint8",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00,
},
}.check(t)
}
{
v1 := conformance.StructOfSimpleTable{}
v2 := conformance.SimpleTable{}
v1.Table = v2
decodeSuccessCase{
name: "SimpleTableEmpty",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
},
}.check(t)
}
{
v1 := conformance.StructOfSimpleTable{}
v2 := conformance.SimpleTable{}
var v3 int64 = 42
v2.SetX(v3)
var v4 int64 = 67
v2.SetY(v4)
v1.Table = v2
decodeSuccessCase{
name: "SimpleTableXAndY",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.StructOfSimpleTable{}
v2 := conformance.SimpleTable{}
var v3 int64 = 67
v2.SetY(v3)
v1.Table = v2
decodeSuccessCase{
name: "SimpleTableJustY",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.StructOfTableWithStringAndVector{}
v2 := conformance.TableWithStringAndVector{}
v3 := "hello"
v2.SetFoo(v3)
var v4 int32 = 27
v2.SetBar(v4)
v1.Table = v2
decodeSuccessCase{
name: "TableWithStringAndVectorNoVectorContent",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.SimpleTableThenUint64{}
v2 := conformance.SimpleTable{}
var v3 int64 = 42
v2.SetX(v3)
var v4 int64 = 67
v2.SetY(v4)
v1.Table = v2
var v5 uint64 = 16045690984833335023
v1.Number = v5
decodeSuccessCase{
name: "SimpleTableThenUint64",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.TestInlineXUnionInStruct{}
v2 := "before"
v1.Before = v2
v3 := conformance.SampleXUnion{}
var v4 uint32 = 3735928559
v3.SetU(v4)
v1.Xu = v3
v5 := "after"
v1.After = v5
decodeSuccessCase{
name: "InlineXUnionInStruct",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.TestOptionalXUnionInStruct{}
v2 := "before"
v1.Before = v2
v3 := "after"
v1.After = v3
decodeSuccessCase{
name: "OptionalXUnionInStructAbsent",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.TestOptionalXUnionInStruct{}
v2 := "before"
v1.Before = v2
v3 := &conformance.SampleXUnion{}
var v4 uint32 = 3735928559
v3.SetU(v4)
v1.Xu = v3
v5 := "after"
v1.After = v5
decodeSuccessCase{
name: "OptionalXUnionInStructPresent",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.TestXUnionInTable{}
v2 := conformance.XUnionInTable{}
v3 := "before"
v2.SetBefore(v3)
v4 := "after"
v2.SetAfter(v4)
v1.Value = v2
decodeSuccessCase{
name: "XUnionInTableXUnionAbsent",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.TestXUnionInTable{}
v2 := conformance.XUnionInTable{}
v3 := "before"
v2.SetBefore(v3)
v4 := conformance.SampleXUnion{}
var v5 uint32 = 3735928559
v4.SetU(v5)
v2.SetXu(v4)
v6 := "after"
v2.SetAfter(v6)
v1.Value = v2
decodeSuccessCase{
name: "XUnionInTableXUnionPresent",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.TestStrictXUnionInStruct{}
v2 := conformance.SampleStrictXUnion{}
var v3 uint32 = 3735928559
v2.SetU(v3)
v1.Xu = v2
decodeSuccessCase{
name: "StrictXUnion",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.TestAddEthernetDeviceRequest{}
v2 := "@/dev/sys/pci/00:03.0/e1000/ethernet"
v1.TopologicalPath = v2
v3 := conformance.InterfaceConfig{}
v4 := "ethp0003"
v3.Name = v4
v5 := conformance.IpAddressConfig{}
v6 := true
v5.SetDhcp(v6)
v3.IpAddressConfig = v5
v1.Config = v3
var v7 uint32 = 4294967295
v1.ThisShouldBeAHandle = v7
decodeSuccessCase{
name: "AddEthernetDeviceRequest",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.FileGetAttrResponse{}
var v2 int32 = 2125315759
v1.S = v2
v3 := conformance.NodeAttributes{}
var v4 uint32 = 2518909348
v3.Mode = v4
var v5 uint64 = 1
v3.Id = v5
var v6 uint64 = 231
v3.ContentSize = v6
var v7 uint64 = 231
v3.StorageSize = v7
var v8 uint64 = 1
v3.LinkCount = v8
var v9 uint64 = 9833440827789222417
v3.CreationTime = v9
var v10 uint64 = 72038755451251353
v3.ModificationTime = v10
v1.Attributes = v3
decodeSuccessCase{
name: "FileGetAttrResponse",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.StructWithOptionals{}
v2 := conformance.EmptyStruct{}
v1.S = v2
v3 := &conformance.EmptyStruct{}
v1.S2 = v3
v4 := conformance.TableWithEmptyStruct{}
v5 := conformance.EmptyStruct{}
v4.SetS(v5)
v1.T = v4
v6 := conformance.XUnionWithEmptyStruct{}
v7 := conformance.EmptyStruct{}
v6.SetS(v7)
v1.Xu = v6
v8 := &conformance.XUnionWithEmptyStruct{}
v9 := conformance.EmptyStruct{}
v8.SetS(v9)
v1.Xu2 = v8
v10 := conformance.UnionWithEmptyStruct{}
v11 := conformance.EmptyStruct{}
v10.SetS(v11)
v1.U = v10
v12 := &conformance.UnionWithEmptyStruct{}
v13 := conformance.EmptyStruct{}
v12.SetS(v13)
v1.U2 = v12
decodeSuccessCase{
name: "Optionals",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.StructWithArrays{}
var v2 int32 = 1
var v3 int32 = 2
v4 := [2]int32{v2, v3}
v1.ArrInt = v4
v5 := "a"
v6 := "b"
v7 := [2]string{v5, v6}
v1.ArrString = v7
v8 := "c"
v9 := &v8
var v10 *string = nil
v11 := [2]*string{v9, v10}
v1.ArrNullableString = v11
v12 := conformance.StructWithInt{}
var v13 int32 = 1
v12.X = v13
v14 := conformance.StructWithInt{}
var v15 int32 = 2
v14.X = v15
v16 := [2]conformance.StructWithInt{v12, v14}
v1.ArrStruct = v16
var v17 *conformance.StructWithInt = nil
v18 := &conformance.StructWithInt{}
var v19 int32 = 16909060
v18.X = v19
v20 := [2]*conformance.StructWithInt{v17, v18}
v1.ArrNullableStruct = v20
var v21 int32 = 1
var v22 int32 = 2
var v23 int32 = 3
v24 := [3]int32{v21, v22, v23}
var v25 int32 = 4
var v26 int32 = 5
var v27 int32 = 6
v28 := [3]int32{v25, v26, v27}
v29 := [2][3]int32{v24, v28}
v1.ArrArrInt = v29
decodeSuccessCase{
name: "Arrays",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.StructWithVectors{}
v2 := []int32{}
v1.VecEmpty = v2
var v3 int32 = 1
var v4 int32 = 2
v5 := []int32{v3, v4}
v1.VecInt = v5
v6 := "a"
v7 := "b"
v8 := []string{v6, v7}
v1.VecString = v8
var v9 *string = nil
v10 := "c"
v11 := &v10
var v12 *string = nil
v13 := []*string{v9, v11, v12}
v1.VecNullableString = v13
v14 := conformance.StructWithInt{}
var v15 int32 = 1
v14.X = v15
v16 := []conformance.StructWithInt{v14}
v1.VecStruct = v16
var v17 *conformance.StructWithInt = nil
var v18 *conformance.StructWithInt = nil
v19 := &conformance.StructWithInt{}
var v20 int32 = 2
v19.X = v20
v21 := []*conformance.StructWithInt{v17, v18, v19}
v1.VecNullableStruct = v21
var v22 int32 = 1
var v23 int32 = 2
v24 := []int32{v22, v23}
var v25 int32 = 3
v26 := []int32{v25}
v27 := [][]int32{v24, v26}
v1.VecVecInt = v27
decodeSuccessCase{
name: "Vectors",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.MyBool{}
v2 := true
v1.Value = v2
decodeSuccessCase{
name: "BoolTrue",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyBool{}
v2 := false
v1.Value = v2
decodeSuccessCase{
name: "BoolFalse",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyByte{}
var v2 uint8 = 0
v1.Value = v2
decodeSuccessCase{
name: "ByteZero",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyByte{}
var v2 uint8 = 255
v1.Value = v2
decodeSuccessCase{
name: "Byte255",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyInt8{}
var v2 int8 = -128
v1.Value = v2
decodeSuccessCase{
name: "Int8Min",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyInt8{}
var v2 int8 = 0
v1.Value = v2
decodeSuccessCase{
name: "Int8Zero",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyInt8{}
var v2 int8 = 127
v1.Value = v2
decodeSuccessCase{
name: "Int8Max",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyInt16{}
var v2 int16 = -32768
v1.Value = v2
decodeSuccessCase{
name: "Int16Min",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyInt16{}
var v2 int16 = 0
v1.Value = v2
decodeSuccessCase{
name: "Int16Zero",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyInt16{}
var v2 int16 = 32767
v1.Value = v2
decodeSuccessCase{
name: "Int16Max",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyInt32{}
var v2 int32 = -2147483648
v1.Value = v2
decodeSuccessCase{
name: "Int32Min",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyInt32{}
var v2 int32 = 0
v1.Value = v2
decodeSuccessCase{
name: "Int32Zero",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyInt32{}
var v2 int32 = 2147483647
v1.Value = v2
decodeSuccessCase{
name: "Int32Max",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyInt64{}
var v2 int64 = -9223372036854775808
v1.Value = v2
decodeSuccessCase{
name: "Int64Min",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
},
}.check(t)
}
{
v1 := conformance.MyInt64{}
var v2 int64 = 0
v1.Value = v2
decodeSuccessCase{
name: "Int64Zero",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyInt64{}
var v2 int64 = 9223372036854775807
v1.Value = v2
decodeSuccessCase{
name: "Int64Max",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
},
}.check(t)
}
{
v1 := conformance.MyUint8{}
var v2 uint8 = 0
v1.Value = v2
decodeSuccessCase{
name: "Uint8Zero",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyUint8{}
var v2 uint8 = 255
v1.Value = v2
decodeSuccessCase{
name: "Uint8Max",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyUint16{}
var v2 uint16 = 0
v1.Value = v2
decodeSuccessCase{
name: "Uint16Zero",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyUint16{}
var v2 uint16 = 65535
v1.Value = v2
decodeSuccessCase{
name: "Uint16Max",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyUint32{}
var v2 uint32 = 0
v1.Value = v2
decodeSuccessCase{
name: "Uint32Zero",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyUint32{}
var v2 uint32 = 4294967295
v1.Value = v2
decodeSuccessCase{
name: "Uint32Max",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyUint64{}
var v2 uint64 = 0
v1.Value = v2
decodeSuccessCase{
name: "Uint64Zero",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyUint64{}
var v2 uint64 = 18446744073709551615
v1.Value = v2
decodeSuccessCase{
name: "Uint64Max",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
},
}.check(t)
}
{
v1 := conformance.MyFloat32{}
var v2 float32 = 0
v1.Value = v2
decodeSuccessCase{
name: "Float32Zero",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyFloat32{}
var v2 float32 = 1
v1.Value = v2
decodeSuccessCase{
name: "Float32One",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyFloat32{}
var v2 float32 = -1
v1.Value = v2
decodeSuccessCase{
name: "Float32MinusOne",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyFloat32{}
var v2 float32 = 3.4028234663852886e+38
v1.Value = v2
decodeSuccessCase{
name: "Float32Max",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0xff, 0xff, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyFloat64{}
var v2 float64 = 0
v1.Value = v2
decodeSuccessCase{
name: "Float64Zero",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyFloat64{}
var v2 float64 = 1
v1.Value = v2
decodeSuccessCase{
name: "Float64One",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f,
},
}.check(t)
}
{
v1 := conformance.MyFloat64{}
var v2 float64 = -1
v1.Value = v2
decodeSuccessCase{
name: "Float64MinusOne",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xbf,
},
}.check(t)
}
{
v1 := conformance.MyFloat64{}
var v2 float64 = 1.7976931348623157e+308
v1.Value = v2
decodeSuccessCase{
name: "Float64Max",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x7f,
},
}.check(t)
}
{
v1 := conformance.Sandwich1{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionSize8Align4{}
var v4 uint32 = 202050057
v3.SetVariant(v4)
v1.TheUnion = v3
var v5 uint32 = 134678021
v1.After = v5
decodeSuccessCase{
name: "Sandwich1Case1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x02, 0x00, 0x00, 0x00,
0x09, 0x0a, 0x0b, 0x0c, 0x05, 0x06, 0x07, 0x08,
},
}.check(t)
}
{
v1 := conformance.Sandwich1{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionSize8Align4{}
var v4 uint32 = 202050057
v3.SetVariant(v4)
v1.TheUnion = v3
var v5 uint32 = 134678021
v1.After = v5
decodeSuccessCase{
name: "Sandwich1Case1_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Sandwich2{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionSize12Align4{}
var v4 uint8 = 160
var v5 uint8 = 161
var v6 uint8 = 162
var v7 uint8 = 163
var v8 uint8 = 164
var v9 uint8 = 165
v10 := [6]uint8{v4, v5, v6, v7, v8, v9}
v3.SetVariant(v10)
v1.TheUnion = v3
var v11 uint32 = 134678021
v1.After = v11
decodeSuccessCase{
name: "Sandwich2Case1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x03, 0x00, 0x00, 0x00,
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0x00, 0x00,
0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.Sandwich2{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionSize12Align4{}
var v4 uint8 = 160
var v5 uint8 = 161
var v6 uint8 = 162
var v7 uint8 = 163
var v8 uint8 = 164
var v9 uint8 = 165
v10 := [6]uint8{v4, v5, v6, v7, v8, v9}
v3.SetVariant(v10)
v1.TheUnion = v3
var v11 uint32 = 134678021
v1.After = v11
decodeSuccessCase{
name: "Sandwich2Case1_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Sandwich3{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionSize24Align8{}
v4 := conformance.StructSize16Align8{}
var v5 uint64 = 12080525177006498208
v4.F1 = v5
var v6 uint64 = 12659246559711111592
v4.F2 = v6
v3.SetVariant(v4)
v1.TheUnion = v3
var v7 uint32 = 134678021
v1.After = v7
decodeSuccessCase{
name: "Sandwich3Case1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.Sandwich3{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionSize24Align8{}
v4 := conformance.StructSize16Align8{}
var v5 uint64 = 12080525177006498208
v4.F1 = v5
var v6 uint64 = 12659246559711111592
v4.F2 = v6
v3.SetVariant(v4)
v1.TheUnion = v3
var v7 uint32 = 134678021
v1.After = v7
decodeSuccessCase{
name: "Sandwich3Case1_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Sandwich4{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionSize36Align4{}
var v4 uint8 = 160
var v5 uint8 = 161
var v6 uint8 = 162
var v7 uint8 = 163
var v8 uint8 = 164
var v9 uint8 = 165
var v10 uint8 = 166
var v11 uint8 = 167
var v12 uint8 = 168
var v13 uint8 = 169
var v14 uint8 = 170
var v15 uint8 = 171
var v16 uint8 = 172
var v17 uint8 = 173
var v18 uint8 = 174
var v19 uint8 = 175
var v20 uint8 = 176
var v21 uint8 = 177
var v22 uint8 = 178
var v23 uint8 = 179
var v24 uint8 = 180
var v25 uint8 = 181
var v26 uint8 = 182
var v27 uint8 = 183
var v28 uint8 = 184
var v29 uint8 = 185
var v30 uint8 = 186
var v31 uint8 = 187
var v32 uint8 = 188
var v33 uint8 = 189
var v34 uint8 = 190
var v35 uint8 = 191
v36 := [32]uint8{v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35}
v3.SetVariant(v36)
v1.TheUnion = v3
var v37 uint32 = 134678021
v1.After = v37
decodeSuccessCase{
name: "Sandwich4Case1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x03, 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,
0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.Sandwich4{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionSize36Align4{}
var v4 uint8 = 160
var v5 uint8 = 161
var v6 uint8 = 162
var v7 uint8 = 163
var v8 uint8 = 164
var v9 uint8 = 165
var v10 uint8 = 166
var v11 uint8 = 167
var v12 uint8 = 168
var v13 uint8 = 169
var v14 uint8 = 170
var v15 uint8 = 171
var v16 uint8 = 172
var v17 uint8 = 173
var v18 uint8 = 174
var v19 uint8 = 175
var v20 uint8 = 176
var v21 uint8 = 177
var v22 uint8 = 178
var v23 uint8 = 179
var v24 uint8 = 180
var v25 uint8 = 181
var v26 uint8 = 182
var v27 uint8 = 183
var v28 uint8 = 184
var v29 uint8 = 185
var v30 uint8 = 186
var v31 uint8 = 187
var v32 uint8 = 188
var v33 uint8 = 189
var v34 uint8 = 190
var v35 uint8 = 191
v36 := [32]uint8{v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35}
v3.SetVariant(v36)
v1.TheUnion = v3
var v37 uint32 = 134678021
v1.After = v37
decodeSuccessCase{
name: "Sandwich4Case1_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Sandwich5{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionOfUnion{}
v4 := conformance.UnionSize8Align4{}
var v5 uint32 = 202050057
v4.SetVariant(v5)
v3.SetSize8align4(v4)
v1.UnionOfUnion = v3
var v6 uint32 = 134678021
v1.After = v6
decodeSuccessCase{
name: "Sandwich5Case1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x09, 0x0a, 0x0b, 0x0c,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.Sandwich5{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionOfUnion{}
v4 := conformance.UnionSize8Align4{}
var v5 uint32 = 202050057
v4.SetVariant(v5)
v3.SetSize8align4(v4)
v1.UnionOfUnion = v3
var v6 uint32 = 134678021
v1.After = v6
decodeSuccessCase{
name: "Sandwich5Case1_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Sandwich5{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionOfUnion{}
v4 := conformance.UnionSize24Align8{}
v5 := conformance.StructSize16Align8{}
var v6 uint64 = 12080525177006498208
v5.F1 = v6
var v7 uint64 = 12659246559711111592
v5.F2 = v7
v4.SetVariant(v5)
v3.SetSize24align8(v4)
v1.UnionOfUnion = v3
var v8 uint32 = 134678021
v1.After = v8
decodeSuccessCase{
name: "Sandwich5Case2",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.Sandwich5{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionOfUnion{}
v4 := conformance.UnionSize24Align8{}
v5 := conformance.StructSize16Align8{}
var v6 uint64 = 12080525177006498208
v5.F1 = v6
var v7 uint64 = 12659246559711111592
v5.F2 = v7
v4.SetVariant(v5)
v3.SetSize24align8(v4)
v1.UnionOfUnion = v3
var v8 uint32 = 134678021
v1.After = v8
decodeSuccessCase{
name: "Sandwich5Case2_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
var v4 uint8 = 160
var v5 uint8 = 161
var v6 uint8 = 162
var v7 uint8 = 163
var v8 uint8 = 164
var v9 uint8 = 165
v10 := []uint8{v4, v5, v6, v7, v8, v9}
v3.SetVectorOfUint8(v10)
v1.TheUnion = v3
var v11 uint32 = 134678021
v1.After = v11
decodeSuccessCase{
name: "Sandwich6Case1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06, 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,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
var v4 uint8 = 160
var v5 uint8 = 161
var v6 uint8 = 162
var v7 uint8 = 163
var v8 uint8 = 164
var v9 uint8 = 165
v10 := []uint8{v4, v5, v6, v7, v8, v9}
v3.SetVectorOfUint8(v10)
v1.TheUnion = v3
var v11 uint32 = 134678021
v1.After = v11
decodeSuccessCase{
name: "Sandwich6Case1_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
v4 := []uint8{}
v3.SetVectorOfUint8(v4)
v1.TheUnion = v3
var v5 uint32 = 134678021
v1.After = v5
decodeSuccessCase{
name: "Sandwich6Case1AbsentVector",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
v4 := []uint8{}
v3.SetVectorOfUint8(v4)
v1.TheUnion = v3
var v5 uint32 = 134678021
v1.After = v5
decodeSuccessCase{
name: "Sandwich6Case1AbsentVector_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
v4 := "soft migrations rock!"
v3.SetString(v4)
v1.TheUnion = v3
var v5 uint32 = 134678021
v1.After = v5
decodeSuccessCase{
name: "Sandwich6Case2",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00,
0x73, 0x6f, 0x66, 0x74, 0x20, 0x6d, 0x69, 0x67,
0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20,
0x72, 0x6f, 0x63, 0x6b, 0x21, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
v4 := "soft migrations rock!"
v3.SetString(v4)
v1.TheUnion = v3
var v5 uint32 = 134678021
v1.After = v5
decodeSuccessCase{
name: "Sandwich6Case2_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
v4 := conformance.StructSize3Align1{}
var v5 uint8 = 115
var v6 uint8 = 111
var v7 uint8 = 102
v8 := [3]uint8{v5, v6, v7}
v4.ThreeBytes = v8
v9 := conformance.StructSize3Align1{}
var v10 uint8 = 32
var v11 uint8 = 109
var v12 uint8 = 105
v13 := [3]uint8{v10, v11, v12}
v9.ThreeBytes = v13
v14 := conformance.StructSize3Align1{}
var v15 uint8 = 114
var v16 uint8 = 97
var v17 uint8 = 116
v18 := [3]uint8{v15, v16, v17}
v14.ThreeBytes = v18
v19 := []conformance.StructSize3Align1{v4, v9, v14}
v3.SetVectorS3A1(v19)
v1.TheUnion = v3
var v20 uint32 = 134678021
v1.After = v20
decodeSuccessCase{
name: "Sandwich6Case3",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00,
0x73, 0x6f, 0x66, 0x20, 0x6d, 0x69, 0x72, 0x61,
0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
v4 := conformance.StructSize3Align1{}
var v5 uint8 = 115
var v6 uint8 = 111
var v7 uint8 = 102
v8 := [3]uint8{v5, v6, v7}
v4.ThreeBytes = v8
v9 := conformance.StructSize3Align1{}
var v10 uint8 = 32
var v11 uint8 = 109
var v12 uint8 = 105
v13 := [3]uint8{v10, v11, v12}
v9.ThreeBytes = v13
v14 := conformance.StructSize3Align1{}
var v15 uint8 = 114
var v16 uint8 = 97
var v17 uint8 = 116
v18 := [3]uint8{v15, v16, v17}
v14.ThreeBytes = v18
v19 := []conformance.StructSize3Align1{v4, v9, v14}
v3.SetVectorS3A1(v19)
v1.TheUnion = v3
var v20 uint32 = 134678021
v1.After = v20
decodeSuccessCase{
name: "Sandwich6Case3_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
v4 := conformance.StructSize3Align2{}
var v5 uint16 = 28531
v4.F1 = v5
var v6 uint8 = 102
v4.F2 = v6
v7 := conformance.StructSize3Align2{}
var v8 uint16 = 27936
v7.F1 = v8
var v9 uint8 = 105
v7.F2 = v9
v10 := conformance.StructSize3Align2{}
var v11 uint16 = 24946
v10.F1 = v11
var v12 uint8 = 116
v10.F2 = v12
v13 := []conformance.StructSize3Align2{v4, v7, v10}
v3.SetVectorS3A2(v13)
v1.TheUnion = v3
var v14 uint32 = 134678021
v1.After = v14
decodeSuccessCase{
name: "Sandwich6Case4",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00,
0x73, 0x6f, 0x66, 0x00, 0x20, 0x6d, 0x69, 0x00,
0x72, 0x61, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
v4 := conformance.StructSize3Align2{}
var v5 uint16 = 28531
v4.F1 = v5
var v6 uint8 = 102
v4.F2 = v6
v7 := conformance.StructSize3Align2{}
var v8 uint16 = 27936
v7.F1 = v8
var v9 uint8 = 105
v7.F2 = v9
v10 := conformance.StructSize3Align2{}
var v11 uint16 = 24946
v10.F1 = v11
var v12 uint8 = 116
v10.F2 = v12
v13 := []conformance.StructSize3Align2{v4, v7, v10}
v3.SetVectorS3A2(v13)
v1.TheUnion = v3
var v14 uint32 = 134678021
v1.After = v14
decodeSuccessCase{
name: "Sandwich6Case4_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
var v4 uint32 = 4294967295
var v5 uint32 = 4294967295
var v6 uint32 = 4294967295
v7 := []uint32{v4, v5, v6}
v3.SetHandles(v7)
v1.TheUnion = v3
var v8 uint32 = 134678021
v1.After = v8
decodeSuccessCase{
name: "Sandwich6Case5",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 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,
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
var v4 uint32 = 4294967295
var v5 uint32 = 4294967295
var v6 uint32 = 4294967295
v7 := []uint32{v4, v5, v6}
v3.SetHandles(v7)
v1.TheUnion = v3
var v8 uint32 = 134678021
v1.After = v8
decodeSuccessCase{
name: "Sandwich6Case5_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
v4 := conformance.StructSize3Align1{}
var v5 uint8 = 161
var v6 uint8 = 162
var v7 uint8 = 163
v8 := [3]uint8{v5, v6, v7}
v4.ThreeBytes = v8
v9 := conformance.StructSize3Align1{}
var v10 uint8 = 164
var v11 uint8 = 165
var v12 uint8 = 166
v13 := [3]uint8{v10, v11, v12}
v9.ThreeBytes = v13
v14 := [2]conformance.StructSize3Align1{v4, v9}
v3.SetArrayS3A1(v14)
v1.TheUnion = v3
var v15 uint32 = 134678021
v1.After = v15
decodeSuccessCase{
name: "Sandwich6Case6",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
v4 := conformance.StructSize3Align1{}
var v5 uint8 = 161
var v6 uint8 = 162
var v7 uint8 = 163
v8 := [3]uint8{v5, v6, v7}
v4.ThreeBytes = v8
v9 := conformance.StructSize3Align1{}
var v10 uint8 = 164
var v11 uint8 = 165
var v12 uint8 = 166
v13 := [3]uint8{v10, v11, v12}
v9.ThreeBytes = v13
v14 := [2]conformance.StructSize3Align1{v4, v9}
v3.SetArrayS3A1(v14)
v1.TheUnion = v3
var v15 uint32 = 134678021
v1.After = v15
decodeSuccessCase{
name: "Sandwich6Case6_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
v4 := conformance.StructSize3Align2{}
var v5 uint16 = 41633
v4.F1 = v5
var v6 uint8 = 163
v4.F2 = v6
v7 := conformance.StructSize3Align2{}
var v8 uint16 = 42404
v7.F1 = v8
var v9 uint8 = 166
v7.F2 = v9
v10 := [2]conformance.StructSize3Align2{v4, v7}
v3.SetArrayS3A2(v10)
v1.TheUnion = v3
var v11 uint32 = 134678021
v1.After = v11
decodeSuccessCase{
name: "Sandwich6Case7",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00,
0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xa1, 0xa2, 0xa3, 0x00, 0xa4, 0xa5, 0xa6, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
v4 := conformance.StructSize3Align2{}
var v5 uint16 = 41633
v4.F1 = v5
var v6 uint8 = 163
v4.F2 = v6
v7 := conformance.StructSize3Align2{}
var v8 uint16 = 42404
v7.F1 = v8
var v9 uint8 = 166
v7.F2 = v9
v10 := [2]conformance.StructSize3Align2{v4, v7}
v3.SetArrayS3A2(v10)
v1.TheUnion = v3
var v11 uint32 = 134678021
v1.After = v11
decodeSuccessCase{
name: "Sandwich6Case7_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
v4 := conformance.UnionSize8Align4{}
var v5 uint32 = 202050057
v4.SetVariant(v5)
v6 := []conformance.UnionSize8Align4{v4}
v3.SetVectorUnion(v6)
v1.TheUnion = v3
var v7 uint32 = 134678021
v1.After = v7
decodeSuccessCase{
name: "Sandwich6Case8",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x09, 0x0a, 0x0b, 0x0c,
},
}.check(t)
}
{
v1 := conformance.Sandwich6{}
var v2 uint32 = 67305985
v1.Before = v2
v3 := conformance.UnionWithVector{}
v4 := conformance.UnionSize8Align4{}
var v5 uint32 = 202050057
v4.SetVariant(v5)
v6 := []conformance.UnionSize8Align4{v4}
v3.SetVectorUnion(v6)
v1.TheUnion = v3
var v7 uint32 = 134678021
v1.After = v7
decodeSuccessCase{
name: "Sandwich6Case8_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.TableStructWithReservedSandwichStruct{}
v2 := conformance.TableStructWithReservedSandwich{}
v3 := conformance.StructSize3Align1{}
var v4 uint8 = 9
var v5 uint8 = 10
var v6 uint8 = 11
v7 := [3]uint8{v4, v5, v6}
v3.ThreeBytes = v7
v2.SetS1(v3)
v8 := conformance.StructSize3Align1{}
var v9 uint8 = 25
var v10 uint8 = 26
var v11 uint8 = 27
v12 := [3]uint8{v9, v10, v11}
v8.ThreeBytes = v12
v2.SetS2(v8)
v1.Table = v2
decodeSuccessCase{
name: "Table_StructWithReservedSandwich",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.TableStructWithReservedSandwichStruct{}
v2 := conformance.TableStructWithReservedSandwich{}
v3 := conformance.StructSize3Align1{}
var v4 uint8 = 9
var v5 uint8 = 10
var v6 uint8 = 11
v7 := [3]uint8{v4, v5, v6}
v3.ThreeBytes = v7
v2.SetS1(v3)
v8 := conformance.StructSize3Align1{}
var v9 uint8 = 25
var v10 uint8 = 26
var v11 uint8 = 27
v12 := [3]uint8{v9, v10, v11}
v8.ThreeBytes = v12
v2.SetS2(v8)
v1.Table = v2
decodeSuccessCase{
name: "Table_StructWithReservedSandwich_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.TableStructWithUint32SandwichStruct{}
v2 := conformance.TableStructWithUint32Sandwich{}
var v3 uint32 = 67305985
v2.SetI(v3)
v4 := conformance.StructSize3Align1{}
var v5 uint8 = 9
var v6 uint8 = 10
var v7 uint8 = 11
v8 := [3]uint8{v5, v6, v7}
v4.ThreeBytes = v8
v2.SetS1(v4)
v9 := conformance.StructSize3Align1{}
var v10 uint8 = 25
var v11 uint8 = 26
var v12 uint8 = 27
v13 := [3]uint8{v10, v11, v12}
v9.ThreeBytes = v13
v2.SetS2(v9)
var v14 uint32 = 218893066
v2.SetI2(v14)
v1.Table = v2
decodeSuccessCase{
name: "Table_StructWithUint32Sandwich",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.TableStructWithUint32SandwichStruct{}
v2 := conformance.TableStructWithUint32Sandwich{}
var v3 uint32 = 67305985
v2.SetI(v3)
v4 := conformance.StructSize3Align1{}
var v5 uint8 = 9
var v6 uint8 = 10
var v7 uint8 = 11
v8 := [3]uint8{v5, v6, v7}
v4.ThreeBytes = v8
v2.SetS1(v4)
v9 := conformance.StructSize3Align1{}
var v10 uint8 = 25
var v11 uint8 = 26
var v12 uint8 = 27
v13 := [3]uint8{v10, v11, v12}
v9.ThreeBytes = v13
v2.SetS2(v9)
var v14 uint32 = 218893066
v2.SetI2(v14)
v1.Table = v2
decodeSuccessCase{
name: "Table_StructWithUint32Sandwich_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.TableUnionWithVectorReservedSandwichStruct{}
v2 := conformance.TableUnionWithVectorReservedSandwich{}
v3 := conformance.UnionWithVector{}
v4 := "hello"
v3.SetString(v4)
v2.SetUv(v3)
v1.Table = v2
decodeSuccessCase{
name: "Table_UnionWithVector_ReservedSandwich",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.TableUnionWithVectorReservedSandwichStruct{}
v2 := conformance.TableUnionWithVectorReservedSandwich{}
v3 := conformance.UnionWithVector{}
v4 := "hello"
v3.SetString(v4)
v2.SetUv(v3)
v1.Table = v2
decodeSuccessCase{
name: "Table_UnionWithVector_ReservedSandwich_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.TableUnionWithVectorStructSandwichStruct{}
v2 := conformance.TableUnionWithVectorStructSandwich{}
v3 := conformance.StructSize3Align1{}
var v4 uint8 = 1
var v5 uint8 = 2
var v6 uint8 = 3
v7 := [3]uint8{v4, v5, v6}
v3.ThreeBytes = v7
v2.SetS1(v3)
v8 := conformance.UnionWithVector{}
v9 := "hello"
v8.SetString(v9)
v2.SetUv(v8)
v10 := conformance.StructSize3Align1{}
var v11 uint8 = 4
var v12 uint8 = 5
var v13 uint8 = 6
v14 := [3]uint8{v11, v12, v13}
v10.ThreeBytes = v14
v2.SetS2(v10)
v1.Table = v2
decodeSuccessCase{
name: "Table_UnionWithVector_StructSandwich",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
0x20, 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,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x00, 0x00, 0x00,
0x04, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.TableUnionWithVectorStructSandwichStruct{}
v2 := conformance.TableUnionWithVectorStructSandwich{}
v3 := conformance.StructSize3Align1{}
var v4 uint8 = 1
var v5 uint8 = 2
var v6 uint8 = 3
v7 := [3]uint8{v4, v5, v6}
v3.ThreeBytes = v7
v2.SetS1(v3)
v8 := conformance.UnionWithVector{}
v9 := "hello"
v8.SetString(v9)
v2.SetUv(v8)
v10 := conformance.StructSize3Align1{}
var v11 uint8 = 4
var v12 uint8 = 5
var v13 uint8 = 6
v14 := [3]uint8{v11, v12, v13}
v10.ThreeBytes = v14
v2.SetS2(v10)
v1.Table = v2
decodeSuccessCase{
name: "Table_UnionWithVector_StructSandwich_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.XUnionWithStructStruct{}
v2 := conformance.XUnionWithStruct{}
v3 := conformance.StructSize3Align1{}
var v4 uint8 = 1
var v5 uint8 = 2
var v6 uint8 = 3
v7 := [3]uint8{v4, v5, v6}
v3.ThreeBytes = v7
v2.SetS(v3)
v1.Xu = v2
decodeSuccessCase{
name: "XUnionWithStruct",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.XUnionWithStructStruct{}
v2 := conformance.XUnionWithStruct{}
v3 := conformance.StructSize3Align1{}
var v4 uint8 = 1
var v5 uint8 = 2
var v6 uint8 = 3
v7 := [3]uint8{v4, v5, v6}
v3.ThreeBytes = v7
v2.SetS(v3)
v1.Xu = v2
decodeSuccessCase{
name: "XUnionWithStruct_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.ArrayStruct{}
v2 := conformance.StringUnion{}
v3 := "one"
v2.SetS(v3)
v4 := conformance.StringUnion{}
v5 := "two"
v4.SetS(v5)
v6 := conformance.StringUnion{}
v7 := "three"
v6.SetS(v7)
v8 := [3]conformance.StringUnion{v2, v4, v6}
v1.Unions = v8
v9 := &conformance.StringUnion{}
v10 := "four"
v9.SetS(v10)
v11 := &conformance.StringUnion{}
v12 := "five"
v11.SetS(v12)
v13 := &conformance.StringUnion{}
v14 := "six"
v13.SetS(v14)
v15 := [3]*conformance.StringUnion{v9, v11, v13}
v1.OptionalUnions = v15
decodeSuccessCase{
name: "ArrayStruct",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 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,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x6f, 0x6e, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
0x74, 0x77, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x00,
0x74, 0x68, 0x72, 0x65, 0x65, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 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,
0x01, 0x00, 0x00, 0x00, 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,
0x01, 0x00, 0x00, 0x00, 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,
},
}.check(t)
}
{
v1 := conformance.ArrayStruct{}
v2 := conformance.StringUnion{}
v3 := "one"
v2.SetS(v3)
v4 := conformance.StringUnion{}
v5 := "two"
v4.SetS(v5)
v6 := conformance.StringUnion{}
v7 := "three"
v6.SetS(v7)
v8 := [3]conformance.StringUnion{v2, v4, v6}
v1.Unions = v8
v9 := &conformance.StringUnion{}
v10 := "four"
v9.SetS(v10)
v11 := &conformance.StringUnion{}
v12 := "five"
v11.SetS(v12)
v13 := &conformance.StringUnion{}
v14 := "six"
v13.SetS(v14)
v15 := [3]*conformance.StringUnion{v9, v11, v13}
v1.OptionalUnions = v15
decodeSuccessCase{
name: "ArrayStruct_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Regression1{}
var v2 uint8 = 1
v1.F1 = v2
var v3 uint32 = 2
v1.F2 = v3
var v4 uint8 = 3
v1.F3 = v4
var v5 uint16 = 4
v1.F4 = v5
var v6 uint64 = 5
v1.F5 = v6
var v7 uint8 = 6
v1.F6 = v7
decodeSuccessCase{
name: "Regression1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Regression1{}
var v2 uint8 = 1
v1.F1 = v2
var v3 uint32 = 2
v1.F2 = v3
var v4 uint8 = 3
v1.F3 = v4
var v5 uint16 = 4
v1.F4 = v5
var v6 uint64 = 5
v1.F5 = v6
var v7 uint8 = 6
v1.F6 = v7
decodeSuccessCase{
name: "Regression1_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Regression2{}
v2 := conformance.Regression1{}
var v3 uint8 = 1
v2.F1 = v3
var v4 uint32 = 2
v2.F2 = v4
var v5 uint8 = 3
v2.F3 = v5
var v6 uint16 = 4
v2.F4 = v6
var v7 uint64 = 5
v2.F5 = v7
var v8 uint8 = 6
v2.F6 = v8
v1.Head = v2
var v9 uint8 = 7
v1.F7 = v9
decodeSuccessCase{
name: "Regression2",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Regression2{}
v2 := conformance.Regression1{}
var v3 uint8 = 1
v2.F1 = v3
var v4 uint32 = 2
v2.F2 = v4
var v5 uint8 = 3
v2.F3 = v5
var v6 uint16 = 4
v2.F4 = v6
var v7 uint64 = 5
v2.F5 = v7
var v8 uint8 = 6
v2.F6 = v8
v1.Head = v2
var v9 uint8 = 7
v1.F7 = v9
decodeSuccessCase{
name: "Regression2_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Regression3{}
decodeSuccessCase{
name: "Regression3Absent",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.Regression3{}
decodeSuccessCase{
name: "Regression3Absent_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.Regression3{}
v2 := &conformance.Regression2{}
v3 := conformance.Regression1{}
var v4 uint8 = 1
v3.F1 = v4
var v5 uint32 = 2
v3.F2 = v5
var v6 uint8 = 3
v3.F3 = v6
var v7 uint16 = 4
v3.F4 = v7
var v8 uint64 = 5
v3.F5 = v8
var v9 uint8 = 6
v3.F6 = v9
v2.Head = v3
var v10 uint8 = 7
v2.F7 = v10
v1.OptValue = v2
decodeSuccessCase{
name: "Regression3Present",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.Regression3{}
v2 := &conformance.Regression2{}
v3 := conformance.Regression1{}
var v4 uint8 = 1
v3.F1 = v4
var v5 uint32 = 2
v3.F2 = v5
var v6 uint8 = 3
v3.F3 = v6
var v7 uint16 = 4
v3.F4 = v7
var v8 uint64 = 5
v3.F5 = v8
var v9 uint8 = 6
v3.F6 = v9
v2.Head = v3
var v10 uint8 = 7
v2.F7 = v10
v1.OptValue = v2
decodeSuccessCase{
name: "Regression3Present_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.UnionWithBoundStringStruct{}
v2 := conformance.UnionWithBoundString{}
v3 := "abcd"
v2.SetBoundFiveStr(v3)
v1.V = v2
decodeSuccessCase{
name: "UnionWithBoundString",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x61, 0x62, 0x63, 0x64, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.SingleVariantUnionStruct{}
v2 := conformance.SingleVariantUnion{}
var v3 uint32 = 42
v2.SetX(v3)
v1.U = v2
decodeSuccessCase{
name: "UnionMigration_SingleVariant",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.SingleVariantUnionStruct{}
v2 := conformance.SingleVariantUnion{}
var v3 uint32 = 42
v2.SetX(v3)
v1.U = v2
decodeSuccessCase{
name: "UnionMigration_SingleVariant_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
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,
},
}.check(t)
}
{
v1 := conformance.SandwichUnionSize8Alignment4{}
var v2 uint32 = 10
v1.Before = v2
v3 := conformance.UnionSize8Alignment4{}
var v4 uint32 = 4
v3.SetVariant(v4)
v1.Value = v3
var v5 uint32 = 20
v1.After = v5
decodeSuccessCase{
name: "UnionSize8Alignment4",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.SandwichUnionSize8Alignment4{}
var v2 uint32 = 10
v1.Before = v2
v3 := conformance.UnionSize8Alignment4{}
var v4 uint32 = 4
v3.SetVariant(v4)
v1.Value = v3
var v5 uint32 = 20
v1.After = v5
decodeSuccessCase{
name: "UnionSize8Alignment4_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
0x0a, 0x00, 0x00, 0x00, 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,
0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.SandwichUnionSize12Alignment4{}
var v2 uint32 = 10
v1.Before = v2
v3 := conformance.UnionSize12Alignment4{}
var v4 uint8 = 1
var v5 uint8 = 2
var v6 uint8 = 3
var v7 uint8 = 4
var v8 uint8 = 5
var v9 uint8 = 6
v10 := [6]uint8{v4, v5, v6, v7, v8, v9}
v3.SetVariant(v10)
v1.Value = v3
var v11 uint32 = 20
v1.After = v11
decodeSuccessCase{
name: "UnionSize12Alignment4",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x0a, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x00, 0x00,
0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.SandwichUnionSize12Alignment4{}
var v2 uint32 = 10
v1.Before = v2
v3 := conformance.UnionSize12Alignment4{}
var v4 uint8 = 1
var v5 uint8 = 2
var v6 uint8 = 3
var v7 uint8 = 4
var v8 uint8 = 5
var v9 uint8 = 6
v10 := [6]uint8{v4, v5, v6, v7, v8, v9}
v3.SetVariant(v10)
v1.Value = v3
var v11 uint32 = 20
v1.After = v11
decodeSuccessCase{
name: "UnionSize12Alignment4_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
0x0a, 0x00, 0x00, 0x00, 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,
0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.SandwichUnionSize24Alignment8{}
var v2 uint32 = 10
v1.Before = v2
v3 := conformance.UnionSize24Alignment8{}
v4 := conformance.StructSize16Alignment8{}
var v5 uint64 = 1
v4.F1 = v5
var v6 uint64 = 2
v4.F2 = v6
v3.SetVariant(v4)
v1.Value = v3
var v7 uint32 = 20
v1.After = v7
decodeSuccessCase{
name: "UnionSize24Alignment8",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.SandwichUnionSize24Alignment8{}
var v2 uint32 = 10
v1.Before = v2
v3 := conformance.UnionSize24Alignment8{}
v4 := conformance.StructSize16Alignment8{}
var v5 uint64 = 1
v4.F1 = v5
var v6 uint64 = 2
v4.F2 = v6
v3.SetVariant(v4)
v1.Value = v3
var v7 uint32 = 20
v1.After = v7
decodeSuccessCase{
name: "UnionSize24Alignment8_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
0x0a, 0x00, 0x00, 0x00, 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,
0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.SandwichUnionSize36Alignment4{}
var v2 uint32 = 10
v1.Before = v2
v3 := conformance.UnionSize36Alignment4{}
var v4 uint8 = 1
var v5 uint8 = 2
var v6 uint8 = 3
var v7 uint8 = 4
var v8 uint8 = 5
var v9 uint8 = 6
var v10 uint8 = 7
var v11 uint8 = 8
var v12 uint8 = 9
var v13 uint8 = 10
var v14 uint8 = 11
var v15 uint8 = 12
var v16 uint8 = 13
var v17 uint8 = 14
var v18 uint8 = 15
var v19 uint8 = 16
var v20 uint8 = 17
var v21 uint8 = 18
var v22 uint8 = 19
var v23 uint8 = 20
var v24 uint8 = 21
var v25 uint8 = 22
var v26 uint8 = 23
var v27 uint8 = 24
var v28 uint8 = 25
var v29 uint8 = 26
var v30 uint8 = 27
var v31 uint8 = 28
var v32 uint8 = 29
var v33 uint8 = 30
var v34 uint8 = 31
var v35 uint8 = 32
v36 := [32]uint8{v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35}
v3.SetVariant(v36)
v1.Value = v3
var v37 uint32 = 20
v1.After = v37
decodeSuccessCase{
name: "UnionSize36Alignment4",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
bytes: []byte{
0x0a, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.SandwichUnionSize36Alignment4{}
var v2 uint32 = 10
v1.Before = v2
v3 := conformance.UnionSize36Alignment4{}
var v4 uint8 = 1
var v5 uint8 = 2
var v6 uint8 = 3
var v7 uint8 = 4
var v8 uint8 = 5
var v9 uint8 = 6
var v10 uint8 = 7
var v11 uint8 = 8
var v12 uint8 = 9
var v13 uint8 = 10
var v14 uint8 = 11
var v15 uint8 = 12
var v16 uint8 = 13
var v17 uint8 = 14
var v18 uint8 = 15
var v19 uint8 = 16
var v20 uint8 = 17
var v21 uint8 = 18
var v22 uint8 = 19
var v23 uint8 = 20
var v24 uint8 = 21
var v25 uint8 = 22
var v26 uint8 = 23
var v27 uint8 = 24
var v28 uint8 = 25
var v29 uint8 = 26
var v30 uint8 = 27
var v31 uint8 = 28
var v32 uint8 = 29
var v33 uint8 = 30
var v34 uint8 = 31
var v35 uint8 = 32
v36 := [32]uint8{v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35}
v3.SetVariant(v36)
v1.Value = v3
var v37 uint32 = 20
v1.After = v37
decodeSuccessCase{
name: "UnionSize36Alignment4_v1",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: true,
EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
bytes: []byte{
0x0a, 0x00, 0x00, 0x00, 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,
0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
},
}.check(t)
}
}
func TestAllEncodeFailureCases(t *testing.T) {
{
v1 := conformance.TestStrictXUnionInStruct{}
v2 := conformance.SampleStrictXUnion{}
v1.Xu = v2
encodeFailureCase{
name: "StrictXUnion Field Not Set",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
code: fidl.ErrInvalidXUnionTag,
}.check(t)
}
{
v1 := conformance.Length2StringWrapper{}
v2 := "abc"
v1.Length2String = v2
encodeFailureCase{
name: "StringExceedsLimit",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
code: fidl.ErrStringTooLong,
}.check(t)
}
{
v1 := conformance.UnionWithBoundStringStruct{}
v2 := conformance.UnionWithBoundString{}
v3 := "abcdef"
v2.SetBoundFiveStr(v3)
v1.V = v2
encodeFailureCase{
name: "UnionWithBoundString_ExceedsBounds",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
input: &v1,
code: fidl.ErrStringTooLong,
}.check(t)
}
}
func TestAllDecodeFailureCases(t *testing.T) {
{
decodeFailureCase{
name: "StrictXUnion Field Unknown",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
valTyp: reflect.TypeOf((*conformance.TestStrictXUnionInStruct)(nil)),
bytes: []byte{
0x11, 0xba, 0x5e, 0xba, 0x00, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xde, 0xad, 0xbe, 0xef, 0x5c, 0xa1, 0xab, 0x1e,
},
code: fidl.ErrInvalidXUnionTag,
}.check(t)
}
{
decodeFailureCase{
name: "NonEmptyStringWithNullPtrBody",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
},
valTyp: reflect.TypeOf((*conformance.StringWrapper)(nil)),
bytes: []byte{
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
code: fidl.ErrUnexpectedNullRef,
}.check(t)
}
}