blob: f34871d13d45cbdd57b50a4c7fed1a425a4dbd66 [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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
input: &v1,
bytes: []byte{
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
},
}.check(t)
}
{
v1 := conformance.MyFloat32{}
var v2 float32 = 0.000000
v1.Value = v2
encodeSuccessCase{
name: "Float32Zero",
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyFloat32{}
var v2 float32 = 1.000000
v1.Value = v2
encodeSuccessCase{
name: "Float32One",
input: &v1,
bytes: []byte{
0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyFloat32{}
var v2 float32 = -1.000000
v1.Value = v2
encodeSuccessCase{
name: "Float32MinusOne",
input: &v1,
bytes: []byte{
0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyFloat32{}
var v2 float32 = 340282346638528859811704183484516925440.000000
v1.Value = v2
encodeSuccessCase{
name: "Float32Max",
input: &v1,
bytes: []byte{
0xff, 0xff, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyFloat64{}
var v2 float64 = 0.000000
v1.Value = v2
encodeSuccessCase{
name: "Float64Zero",
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyFloat64{}
var v2 float64 = 1.000000
v1.Value = v2
encodeSuccessCase{
name: "Float64One",
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f,
},
}.check(t)
}
{
v1 := conformance.MyFloat64{}
var v2 float64 = -1.000000
v1.Value = v2
encodeSuccessCase{
name: "Float64MinusOne",
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xbf,
},
}.check(t)
}
{
v1 := conformance.MyFloat64{}
var v2 float64 = 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000
v1.Value = v2
encodeSuccessCase{
name: "Float64Max",
input: &v1,
bytes: []byte{
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x7f,
},
}.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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
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",
input: &v1,
bytes: []byte{
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
},
}.check(t)
}
{
v1 := conformance.MyFloat32{}
var v2 float32 = 0.000000
v1.Value = v2
decodeSuccessCase{
name: "Float32Zero",
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyFloat32{}
var v2 float32 = 1.000000
v1.Value = v2
decodeSuccessCase{
name: "Float32One",
input: &v1,
bytes: []byte{
0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyFloat32{}
var v2 float32 = -1.000000
v1.Value = v2
decodeSuccessCase{
name: "Float32MinusOne",
input: &v1,
bytes: []byte{
0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyFloat32{}
var v2 float32 = 340282346638528859811704183484516925440.000000
v1.Value = v2
decodeSuccessCase{
name: "Float32Max",
input: &v1,
bytes: []byte{
0xff, 0xff, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyFloat64{}
var v2 float64 = 0.000000
v1.Value = v2
decodeSuccessCase{
name: "Float64Zero",
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
}.check(t)
}
{
v1 := conformance.MyFloat64{}
var v2 float64 = 1.000000
v1.Value = v2
decodeSuccessCase{
name: "Float64One",
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f,
},
}.check(t)
}
{
v1 := conformance.MyFloat64{}
var v2 float64 = -1.000000
v1.Value = v2
decodeSuccessCase{
name: "Float64MinusOne",
input: &v1,
bytes: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xbf,
},
}.check(t)
}
{
v1 := conformance.MyFloat64{}
var v2 float64 = 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000
v1.Value = v2
decodeSuccessCase{
name: "Float64Max",
input: &v1,
bytes: []byte{
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x7f,
},
}.check(t)
}
}
func TestAllEncodeFailureCases(t *testing.T) {
{
v1 := conformance.TestStrictXUnionInStruct{}
v2 := conformance.SampleStrictXUnion{}
v1.Xu = v2
encodeFailureCase{
name: "StrictXUnion Field Not Set",
input: &v1,
code: fidl.ErrInvalidXUnionTag,
}.check(t)
}
{
v1 := conformance.Length2StringWrapper{}
v2 := "abc"
v1.Length2String = v2
encodeFailureCase{
name: "StringExceedsLimit",
input: &v1,
code: fidl.ErrStringTooLong,
}.check(t)
}
}
func TestAllDecodeFailureCases(t *testing.T) {
{
decodeFailureCase{
name: "StrictXUnion Field Unknown",
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",
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)
}
}