[gidl][go] Generate GIDL conformance tests for Go
This CL was generated with the following command:
fx exec $FUCHSIA_DIR/tools/fidl/gidl-conformance-suite/regen.sh
It updates conformance tests based on GIDL changes in fxr/321225.
Test: fx run-test go_fidl_tests -- -test.v
Bug: 36594
Change-Id: I9dde79fef42e48c9f5cf85139de2fa5c11729260
diff --git a/src/syscall/zx/fidl/conformance/impl.go b/src/syscall/zx/fidl/conformance/impl.go
index 1ed1cde..f0d1b56 100644
--- a/src/syscall/zx/fidl/conformance/impl.go
+++ b/src/syscall/zx/fidl/conformance/impl.go
@@ -2,12 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// GENERATED FILE: Do not edit!
-//
-// To rebuild this file, invoke third_party/go/regen-fidl.
+// Code generated by tools/fidl/gidl-conformance-suite/regen.sh; DO NOT EDIT.
// +build fuchsia
+//
+// Code generated by fidlgen; DO NOT EDIT.
+
package conformance
import (
@@ -15,144 +16,9 @@
_bindings "syscall/zx/fidl"
)
-type ThreeByte struct {
- _ struct{} `fidl2:"s,3,1"`
- Elem1 uint8
- Elem2 uint8
- Elem3 uint8
-}
-
-var _mThreeByte = _bindings.CreateLazyMarshaler(ThreeByte{})
-
-func (msg *ThreeByte) Marshaler() _bindings.Marshaler {
- return _mThreeByte
-}
-
-type FiveByte struct {
- _ struct{} `fidl2:"s,8,4"`
- Elem1 uint32
- Elem2 uint8
-}
-
-var _mFiveByte = _bindings.CreateLazyMarshaler(FiveByte{})
-
-func (msg *FiveByte) Marshaler() _bindings.Marshaler {
- return _mFiveByte
-}
-
-type ThreeByteInStruct struct {
- _ struct{} `fidl2:"s,9,1"`
- Elem1 ThreeByte
- Elem2 ThreeByte
- Elem3 ThreeByte
-}
-
-var _mThreeByteInStruct = _bindings.CreateLazyMarshaler(ThreeByteInStruct{})
-
-func (msg *ThreeByteInStruct) Marshaler() _bindings.Marshaler {
- return _mThreeByteInStruct
-}
-
-type FiveByteInStruct struct {
- _ struct{} `fidl2:"s,24,4"`
- Elem1 FiveByte
- Elem2 FiveByte
- Elem3 FiveByte
-}
-
-var _mFiveByteInStruct = _bindings.CreateLazyMarshaler(FiveByteInStruct{})
-
-func (msg *FiveByteInStruct) Marshaler() _bindings.Marshaler {
- return _mFiveByteInStruct
-}
-
-type ThreeByteInVector struct {
- _ struct{} `fidl2:"s,16,8"`
- Elems []ThreeByte
-}
-
-var _mThreeByteInVector = _bindings.CreateLazyMarshaler(ThreeByteInVector{})
-
-func (msg *ThreeByteInVector) Marshaler() _bindings.Marshaler {
- return _mThreeByteInVector
-}
-
-type FiveByteInVector struct {
- _ struct{} `fidl2:"s,16,8"`
- Elems []FiveByte
-}
-
-var _mFiveByteInVector = _bindings.CreateLazyMarshaler(FiveByteInVector{})
-
-func (msg *FiveByteInVector) Marshaler() _bindings.Marshaler {
- return _mFiveByteInVector
-}
-
-type ThreeByteInArray struct {
- _ struct{} `fidl2:"s,9,1"`
- Elems [3]ThreeByte
-}
-
-var _mThreeByteInArray = _bindings.CreateLazyMarshaler(ThreeByteInArray{})
-
-func (msg *ThreeByteInArray) Marshaler() _bindings.Marshaler {
- return _mThreeByteInArray
-}
-
-type FiveByteInArray struct {
- _ struct{} `fidl2:"s,24,4"`
- Elems [3]FiveByte
-}
-
-var _mFiveByteInArray = _bindings.CreateLazyMarshaler(FiveByteInArray{})
-
-func (msg *FiveByteInArray) Marshaler() _bindings.Marshaler {
- return _mFiveByteInArray
-}
-
-type StructWithInt struct {
- _ struct{} `fidl2:"s,4,4"`
- X int32
-}
-
-var _mStructWithInt = _bindings.CreateLazyMarshaler(StructWithInt{})
-
-func (msg *StructWithInt) Marshaler() _bindings.Marshaler {
- return _mStructWithInt
-}
-
-type StructWithArrays struct {
- _ struct{} `fidl2:"s,72,8"`
- ArrInt [2]int32
- ArrString [2]string
- ArrStruct [2]StructWithInt
- ArrArrInt [2][3]int32
-}
-
-var _mStructWithArrays = _bindings.CreateLazyMarshaler(StructWithArrays{})
-
-func (msg *StructWithArrays) Marshaler() _bindings.Marshaler {
- return _mStructWithArrays
-}
-
-type StructWithVectors struct {
- _ struct{} `fidl2:"s,80,8"`
- VecEmpty []int32
- VecInt []int32
- VecString []string
- VecStruct []StructWithInt
- VecVecInt [][]int32
-}
-
-var _mStructWithVectors = _bindings.CreateLazyMarshaler(StructWithVectors{})
-
-func (msg *StructWithVectors) Marshaler() _bindings.Marshaler {
- return _mStructWithVectors
-}
-
type TestXUnionInTable struct {
- _ struct{} `fidl2:"s,16,8"`
- Value XUnionInTable
+ _ struct{} `fidl2:"s,16,8"`
+ Value XUnionInTable `fidl:"0"`
}
var _mTestXUnionInTable = _bindings.CreateLazyMarshaler(TestXUnionInTable{})
@@ -162,9 +28,9 @@
}
type InterfaceConfig struct {
- _ struct{} `fidl2:"s,48,8"`
- Name string
- IpAddressConfig IpAddressConfig
+ _ struct{} `fidl2:"s,48,8"`
+ Name string `fidl:"0,"`
+ IpAddressConfig IpAddressConfig `fidl:"16"`
}
var _mInterfaceConfig = _bindings.CreateLazyMarshaler(InterfaceConfig{})
@@ -174,10 +40,10 @@
}
type TestAddEthernetDeviceRequest struct {
- _ struct{} `fidl2:"s,72,8"`
- TopologicalPath string
- Config InterfaceConfig
- ThisShouldBeAHandle uint32
+ _ struct{} `fidl2:"s,72,8"`
+ TopologicalPath string `fidl:"0,"`
+ Config InterfaceConfig `fidl:"16"`
+ ThisShouldBeAHandle uint32 `fidl:"64"`
}
var _mTestAddEthernetDeviceRequest = _bindings.CreateLazyMarshaler(TestAddEthernetDeviceRequest{})
@@ -188,13 +54,13 @@
type NodeAttributes struct {
_ struct{} `fidl2:"s,56,8"`
- Mode uint32
- Id uint64
- ContentSize uint64
- StorageSize uint64
- LinkCount uint64
- CreationTime uint64
- ModificationTime uint64
+ Mode uint32 `fidl:"0"`
+ Id uint64 `fidl:"8"`
+ ContentSize uint64 `fidl:"16"`
+ StorageSize uint64 `fidl:"24"`
+ LinkCount uint64 `fidl:"32"`
+ CreationTime uint64 `fidl:"40"`
+ ModificationTime uint64 `fidl:"48"`
}
var _mNodeAttributes = _bindings.CreateLazyMarshaler(NodeAttributes{})
@@ -204,9 +70,9 @@
}
type FileGetAttrResponse struct {
- _ struct{} `fidl2:"s,64,8"`
- S int32
- Attributes NodeAttributes
+ _ struct{} `fidl2:"s,64,8"`
+ S int32 `fidl:"0"`
+ Attributes NodeAttributes `fidl:"8"`
}
var _mFileGetAttrResponse = _bindings.CreateLazyMarshaler(FileGetAttrResponse{})
@@ -215,175 +81,48 @@
return _mFileGetAttrResponse
}
-type StructWithOptionals struct {
- _ struct{} `fidl2:"s,104,8"`
- S EmptyStruct
- S2 *EmptyStruct
- T TableWithEmptyStruct
- Xu XUnionWithEmptyStruct
- Xu2 *XUnionWithEmptyStruct
- U UnionWithEmptyStruct
- U2 *UnionWithEmptyStruct
+type StructWithInt struct {
+ _ struct{} `fidl2:"s,4,4"`
+ X int32 `fidl:"0"`
}
-var _mStructWithOptionals = _bindings.CreateLazyMarshaler(StructWithOptionals{})
+var _mStructWithInt = _bindings.CreateLazyMarshaler(StructWithInt{})
-func (msg *StructWithOptionals) Marshaler() _bindings.Marshaler {
- return _mStructWithOptionals
+func (msg *StructWithInt) Marshaler() _bindings.Marshaler {
+ return _mStructWithInt
}
-type MyBool struct {
- _ struct{} `fidl2:"s,1,1"`
- Value bool
+type StructWithArrays struct {
+ _ struct{} `fidl2:"s,120,8"`
+ ArrInt [2]int32 `fidl:"0"`
+ ArrString [2]string `fidl:"8,"`
+ ArrNullableString [2]*string `fidl:"40,"`
+ ArrStruct [2]StructWithInt `fidl:"72"`
+ ArrNullableStruct [2]*StructWithInt `fidl:"80"`
+ ArrArrInt [2][3]int32 `fidl:"96"`
}
-var _mMyBool = _bindings.CreateLazyMarshaler(MyBool{})
+var _mStructWithArrays = _bindings.CreateLazyMarshaler(StructWithArrays{})
-func (msg *MyBool) Marshaler() _bindings.Marshaler {
- return _mMyBool
+func (msg *StructWithArrays) Marshaler() _bindings.Marshaler {
+ return _mStructWithArrays
}
-type MyByte struct {
- _ struct{} `fidl2:"s,1,1"`
- Value uint8
+type StructWithVectors struct {
+ _ struct{} `fidl2:"s,112,8"`
+ VecEmpty []int32 `fidl:"0,"`
+ VecInt []int32 `fidl:"16,"`
+ VecString []string `fidl:"32,,"`
+ VecNullableString []*string `fidl:"48,,"`
+ VecStruct []StructWithInt `fidl:"64,"`
+ VecNullableStruct []*StructWithInt `fidl:"80,"`
+ VecVecInt [][]int32 `fidl:"96,,"`
}
-var _mMyByte = _bindings.CreateLazyMarshaler(MyByte{})
+var _mStructWithVectors = _bindings.CreateLazyMarshaler(StructWithVectors{})
-func (msg *MyByte) Marshaler() _bindings.Marshaler {
- return _mMyByte
-}
-
-type MyInt8 struct {
- _ struct{} `fidl2:"s,1,1"`
- Value int8
-}
-
-var _mMyInt8 = _bindings.CreateLazyMarshaler(MyInt8{})
-
-func (msg *MyInt8) Marshaler() _bindings.Marshaler {
- return _mMyInt8
-}
-
-type MyInt16 struct {
- _ struct{} `fidl2:"s,2,2"`
- Value int16
-}
-
-var _mMyInt16 = _bindings.CreateLazyMarshaler(MyInt16{})
-
-func (msg *MyInt16) Marshaler() _bindings.Marshaler {
- return _mMyInt16
-}
-
-type MyInt32 struct {
- _ struct{} `fidl2:"s,4,4"`
- Value int32
-}
-
-var _mMyInt32 = _bindings.CreateLazyMarshaler(MyInt32{})
-
-func (msg *MyInt32) Marshaler() _bindings.Marshaler {
- return _mMyInt32
-}
-
-type MyInt64 struct {
- _ struct{} `fidl2:"s,8,8"`
- Value int64
-}
-
-var _mMyInt64 = _bindings.CreateLazyMarshaler(MyInt64{})
-
-func (msg *MyInt64) Marshaler() _bindings.Marshaler {
- return _mMyInt64
-}
-
-type MyUint8 struct {
- _ struct{} `fidl2:"s,1,1"`
- Value uint8
-}
-
-var _mMyUint8 = _bindings.CreateLazyMarshaler(MyUint8{})
-
-func (msg *MyUint8) Marshaler() _bindings.Marshaler {
- return _mMyUint8
-}
-
-type MyUint16 struct {
- _ struct{} `fidl2:"s,2,2"`
- Value uint16
-}
-
-var _mMyUint16 = _bindings.CreateLazyMarshaler(MyUint16{})
-
-func (msg *MyUint16) Marshaler() _bindings.Marshaler {
- return _mMyUint16
-}
-
-type MyUint32 struct {
- _ struct{} `fidl2:"s,4,4"`
- Value uint32
-}
-
-var _mMyUint32 = _bindings.CreateLazyMarshaler(MyUint32{})
-
-func (msg *MyUint32) Marshaler() _bindings.Marshaler {
- return _mMyUint32
-}
-
-type MyUint64 struct {
- _ struct{} `fidl2:"s,8,8"`
- Value uint64
-}
-
-var _mMyUint64 = _bindings.CreateLazyMarshaler(MyUint64{})
-
-func (msg *MyUint64) Marshaler() _bindings.Marshaler {
- return _mMyUint64
-}
-
-type MyFloat32 struct {
- _ struct{} `fidl2:"s,4,4"`
- Value float32
-}
-
-var _mMyFloat32 = _bindings.CreateLazyMarshaler(MyFloat32{})
-
-func (msg *MyFloat32) Marshaler() _bindings.Marshaler {
- return _mMyFloat32
-}
-
-type MyFloat64 struct {
- _ struct{} `fidl2:"s,8,8"`
- Value float64
-}
-
-var _mMyFloat64 = _bindings.CreateLazyMarshaler(MyFloat64{})
-
-func (msg *MyFloat64) Marshaler() _bindings.Marshaler {
- return _mMyFloat64
-}
-
-type Length2StringWrapper struct {
- _ struct{} `fidl2:"s,16,8"`
- Length2String string `fidl:"2" fidl2:"2"`
-}
-
-var _mLength2StringWrapper = _bindings.CreateLazyMarshaler(Length2StringWrapper{})
-
-func (msg *Length2StringWrapper) Marshaler() _bindings.Marshaler {
- return _mLength2StringWrapper
-}
-
-type StringWrapper struct {
- _ struct{} `fidl2:"s,16,8"`
- Str string
-}
-
-var _mStringWrapper = _bindings.CreateLazyMarshaler(StringWrapper{})
-
-func (msg *StringWrapper) Marshaler() _bindings.Marshaler {
- return _mStringWrapper
+func (msg *StructWithVectors) Marshaler() _bindings.Marshaler {
+ return _mStructWithVectors
}
type EmptyStruct struct {
@@ -397,10 +136,10 @@
}
type EmptyStructSandwich struct {
- _ struct{} `fidl2:"s,40,8"`
- Before string
- Es EmptyStruct
- After string
+ _ struct{} `fidl2:"s,40,8"`
+ Before string `fidl:"0,"`
+ Es EmptyStruct `fidl:"16"`
+ After string `fidl:"24,"`
}
var _mEmptyStructSandwich = _bindings.CreateLazyMarshaler(EmptyStructSandwich{})
@@ -411,10 +150,10 @@
type Uint8Uint16Uint32Uint64 struct {
_ struct{} `fidl2:"s,16,8"`
- F1 uint8
- F2 uint16
- F3 uint32
- F4 uint64
+ F1 uint8 `fidl:"0"`
+ F2 uint16 `fidl:"2"`
+ F3 uint32 `fidl:"4"`
+ F4 uint64 `fidl:"8"`
}
var _mUint8Uint16Uint32Uint64 = _bindings.CreateLazyMarshaler(Uint8Uint16Uint32Uint64{})
@@ -425,10 +164,10 @@
type Uint64Uint32Uint16Uint8 struct {
_ struct{} `fidl2:"s,16,8"`
- F1 uint64
- F2 uint32
- F3 uint16
- F4 uint8
+ F1 uint64 `fidl:"0"`
+ F2 uint32 `fidl:"8"`
+ F3 uint16 `fidl:"12"`
+ F4 uint8 `fidl:"14"`
}
var _mUint64Uint32Uint16Uint8 = _bindings.CreateLazyMarshaler(Uint64Uint32Uint16Uint8{})
@@ -437,9 +176,31 @@
return _mUint64Uint32Uint16Uint8
}
+type Length2StringWrapper struct {
+ _ struct{} `fidl2:"s,16,8"`
+ Length2String string `fidl:"0,2" fidl2:"2"`
+}
+
+var _mLength2StringWrapper = _bindings.CreateLazyMarshaler(Length2StringWrapper{})
+
+func (msg *Length2StringWrapper) Marshaler() _bindings.Marshaler {
+ return _mLength2StringWrapper
+}
+
+type StringWrapper struct {
+ _ struct{} `fidl2:"s,16,8"`
+ Str string `fidl:"0,"`
+}
+
+var _mStringWrapper = _bindings.CreateLazyMarshaler(StringWrapper{})
+
+func (msg *StringWrapper) Marshaler() _bindings.Marshaler {
+ return _mStringWrapper
+}
+
type StructOfSimpleTable struct {
- _ struct{} `fidl2:"s,16,8"`
- Table SimpleTable
+ _ struct{} `fidl2:"s,16,8"`
+ Table SimpleTable `fidl:"0"`
}
var _mStructOfSimpleTable = _bindings.CreateLazyMarshaler(StructOfSimpleTable{})
@@ -449,9 +210,9 @@
}
type SimpleTableThenUint64 struct {
- _ struct{} `fidl2:"s,24,8"`
- Table SimpleTable
- Number uint64
+ _ struct{} `fidl2:"s,24,8"`
+ Table SimpleTable `fidl:"0"`
+ Number uint64 `fidl:"16"`
}
var _mSimpleTableThenUint64 = _bindings.CreateLazyMarshaler(SimpleTableThenUint64{})
@@ -461,8 +222,8 @@
}
type StructOfTableWithStringAndVector struct {
- _ struct{} `fidl2:"s,16,8"`
- Table TableWithStringAndVector
+ _ struct{} `fidl2:"s,16,8"`
+ Table TableWithStringAndVector `fidl:"0"`
}
var _mStructOfTableWithStringAndVector = _bindings.CreateLazyMarshaler(StructOfTableWithStringAndVector{})
@@ -471,9 +232,253 @@
return _mStructOfTableWithStringAndVector
}
+type ThreeByte struct {
+ _ struct{} `fidl2:"s,3,1"`
+ Elem1 uint8 `fidl:"0"`
+ Elem2 uint8 `fidl:"1"`
+ Elem3 uint8 `fidl:"2"`
+}
+
+var _mThreeByte = _bindings.CreateLazyMarshaler(ThreeByte{})
+
+func (msg *ThreeByte) Marshaler() _bindings.Marshaler {
+ return _mThreeByte
+}
+
+type FiveByte struct {
+ _ struct{} `fidl2:"s,8,4"`
+ Elem1 uint32 `fidl:"0"`
+ Elem2 uint8 `fidl:"4"`
+}
+
+var _mFiveByte = _bindings.CreateLazyMarshaler(FiveByte{})
+
+func (msg *FiveByte) Marshaler() _bindings.Marshaler {
+ return _mFiveByte
+}
+
+type ThreeByteInStruct struct {
+ _ struct{} `fidl2:"s,9,1"`
+ Elem1 ThreeByte `fidl:"0"`
+ Elem2 ThreeByte `fidl:"3"`
+ Elem3 ThreeByte `fidl:"6"`
+}
+
+var _mThreeByteInStruct = _bindings.CreateLazyMarshaler(ThreeByteInStruct{})
+
+func (msg *ThreeByteInStruct) Marshaler() _bindings.Marshaler {
+ return _mThreeByteInStruct
+}
+
+type FiveByteInStruct struct {
+ _ struct{} `fidl2:"s,24,4"`
+ Elem1 FiveByte `fidl:"0"`
+ Elem2 FiveByte `fidl:"8"`
+ Elem3 FiveByte `fidl:"16"`
+}
+
+var _mFiveByteInStruct = _bindings.CreateLazyMarshaler(FiveByteInStruct{})
+
+func (msg *FiveByteInStruct) Marshaler() _bindings.Marshaler {
+ return _mFiveByteInStruct
+}
+
+type ThreeByteInVector struct {
+ _ struct{} `fidl2:"s,16,8"`
+ Elems []ThreeByte `fidl:"0,"`
+}
+
+var _mThreeByteInVector = _bindings.CreateLazyMarshaler(ThreeByteInVector{})
+
+func (msg *ThreeByteInVector) Marshaler() _bindings.Marshaler {
+ return _mThreeByteInVector
+}
+
+type FiveByteInVector struct {
+ _ struct{} `fidl2:"s,16,8"`
+ Elems []FiveByte `fidl:"0,"`
+}
+
+var _mFiveByteInVector = _bindings.CreateLazyMarshaler(FiveByteInVector{})
+
+func (msg *FiveByteInVector) Marshaler() _bindings.Marshaler {
+ return _mFiveByteInVector
+}
+
+type ThreeByteInArray struct {
+ _ struct{} `fidl2:"s,9,1"`
+ Elems [3]ThreeByte `fidl:"0"`
+}
+
+var _mThreeByteInArray = _bindings.CreateLazyMarshaler(ThreeByteInArray{})
+
+func (msg *ThreeByteInArray) Marshaler() _bindings.Marshaler {
+ return _mThreeByteInArray
+}
+
+type FiveByteInArray struct {
+ _ struct{} `fidl2:"s,24,4"`
+ Elems [3]FiveByte `fidl:"0"`
+}
+
+var _mFiveByteInArray = _bindings.CreateLazyMarshaler(FiveByteInArray{})
+
+func (msg *FiveByteInArray) Marshaler() _bindings.Marshaler {
+ return _mFiveByteInArray
+}
+
+type MyBool struct {
+ _ struct{} `fidl2:"s,1,1"`
+ Value bool `fidl:"0"`
+}
+
+var _mMyBool = _bindings.CreateLazyMarshaler(MyBool{})
+
+func (msg *MyBool) Marshaler() _bindings.Marshaler {
+ return _mMyBool
+}
+
+type MyByte struct {
+ _ struct{} `fidl2:"s,1,1"`
+ Value uint8 `fidl:"0"`
+}
+
+var _mMyByte = _bindings.CreateLazyMarshaler(MyByte{})
+
+func (msg *MyByte) Marshaler() _bindings.Marshaler {
+ return _mMyByte
+}
+
+type MyInt8 struct {
+ _ struct{} `fidl2:"s,1,1"`
+ Value int8 `fidl:"0"`
+}
+
+var _mMyInt8 = _bindings.CreateLazyMarshaler(MyInt8{})
+
+func (msg *MyInt8) Marshaler() _bindings.Marshaler {
+ return _mMyInt8
+}
+
+type MyInt16 struct {
+ _ struct{} `fidl2:"s,2,2"`
+ Value int16 `fidl:"0"`
+}
+
+var _mMyInt16 = _bindings.CreateLazyMarshaler(MyInt16{})
+
+func (msg *MyInt16) Marshaler() _bindings.Marshaler {
+ return _mMyInt16
+}
+
+type MyInt32 struct {
+ _ struct{} `fidl2:"s,4,4"`
+ Value int32 `fidl:"0"`
+}
+
+var _mMyInt32 = _bindings.CreateLazyMarshaler(MyInt32{})
+
+func (msg *MyInt32) Marshaler() _bindings.Marshaler {
+ return _mMyInt32
+}
+
+type MyInt64 struct {
+ _ struct{} `fidl2:"s,8,8"`
+ Value int64 `fidl:"0"`
+}
+
+var _mMyInt64 = _bindings.CreateLazyMarshaler(MyInt64{})
+
+func (msg *MyInt64) Marshaler() _bindings.Marshaler {
+ return _mMyInt64
+}
+
+type MyUint8 struct {
+ _ struct{} `fidl2:"s,1,1"`
+ Value uint8 `fidl:"0"`
+}
+
+var _mMyUint8 = _bindings.CreateLazyMarshaler(MyUint8{})
+
+func (msg *MyUint8) Marshaler() _bindings.Marshaler {
+ return _mMyUint8
+}
+
+type MyUint16 struct {
+ _ struct{} `fidl2:"s,2,2"`
+ Value uint16 `fidl:"0"`
+}
+
+var _mMyUint16 = _bindings.CreateLazyMarshaler(MyUint16{})
+
+func (msg *MyUint16) Marshaler() _bindings.Marshaler {
+ return _mMyUint16
+}
+
+type MyUint32 struct {
+ _ struct{} `fidl2:"s,4,4"`
+ Value uint32 `fidl:"0"`
+}
+
+var _mMyUint32 = _bindings.CreateLazyMarshaler(MyUint32{})
+
+func (msg *MyUint32) Marshaler() _bindings.Marshaler {
+ return _mMyUint32
+}
+
+type MyUint64 struct {
+ _ struct{} `fidl2:"s,8,8"`
+ Value uint64 `fidl:"0"`
+}
+
+var _mMyUint64 = _bindings.CreateLazyMarshaler(MyUint64{})
+
+func (msg *MyUint64) Marshaler() _bindings.Marshaler {
+ return _mMyUint64
+}
+
+type MyFloat32 struct {
+ _ struct{} `fidl2:"s,4,4"`
+ Value float32 `fidl:"0"`
+}
+
+var _mMyFloat32 = _bindings.CreateLazyMarshaler(MyFloat32{})
+
+func (msg *MyFloat32) Marshaler() _bindings.Marshaler {
+ return _mMyFloat32
+}
+
+type MyFloat64 struct {
+ _ struct{} `fidl2:"s,8,8"`
+ Value float64 `fidl:"0"`
+}
+
+var _mMyFloat64 = _bindings.CreateLazyMarshaler(MyFloat64{})
+
+func (msg *MyFloat64) Marshaler() _bindings.Marshaler {
+ return _mMyFloat64
+}
+
+type StructWithOptionals struct {
+ _ struct{} `fidl2:"s,104,8"`
+ S EmptyStruct `fidl:"0"`
+ S2 *EmptyStruct `fidl:"8"`
+ T TableWithEmptyStruct `fidl:"16"`
+ Xu XUnionWithEmptyStruct `fidl:"32"`
+ Xu2 *XUnionWithEmptyStruct `fidl:"56"`
+ U UnionWithEmptyStruct `fidl:"80"`
+ U2 *UnionWithEmptyStruct `fidl:"96"`
+}
+
+var _mStructWithOptionals = _bindings.CreateLazyMarshaler(StructWithOptionals{})
+
+func (msg *StructWithOptionals) Marshaler() _bindings.Marshaler {
+ return _mStructWithOptionals
+}
+
type Int64Struct struct {
_ struct{} `fidl2:"s,8,8"`
- X int64
+ X int64 `fidl:"0"`
}
var _mInt64Struct = _bindings.CreateLazyMarshaler(Int64Struct{})
@@ -483,10 +488,10 @@
}
type TestInlineXUnionInStruct struct {
- _ struct{} `fidl2:"s,56,8"`
- Before string
- Xu SampleXUnion
- After string
+ _ struct{} `fidl2:"s,56,8"`
+ Before string `fidl:"0,"`
+ Xu SampleXUnion `fidl:"16"`
+ After string `fidl:"40,"`
}
var _mTestInlineXUnionInStruct = _bindings.CreateLazyMarshaler(TestInlineXUnionInStruct{})
@@ -496,10 +501,10 @@
}
type TestOptionalXUnionInStruct struct {
- _ struct{} `fidl2:"s,56,8"`
- Before string
- Xu *SampleXUnion
- After string
+ _ struct{} `fidl2:"s,56,8"`
+ Before string `fidl:"0,"`
+ Xu *SampleXUnion `fidl:"16"`
+ After string `fidl:"40,"`
}
var _mTestOptionalXUnionInStruct = _bindings.CreateLazyMarshaler(TestOptionalXUnionInStruct{})
@@ -509,8 +514,8 @@
}
type TestStrictXUnionInStruct struct {
- _ struct{} `fidl2:"s,24,8"`
- Xu SampleStrictXUnion
+ _ struct{} `fidl2:"s,24,8"`
+ Xu SampleStrictXUnion `fidl:"0"`
}
var _mTestStrictXUnionInStruct = _bindings.CreateLazyMarshaler(TestStrictXUnionInStruct{})
@@ -520,8 +525,8 @@
}
type TestFlexibleXUnionInStruct struct {
- _ struct{} `fidl2:"s,24,8"`
- Xu SampleXUnion
+ _ struct{} `fidl2:"s,24,8"`
+ Xu SampleXUnion `fidl:"0"`
}
var _mTestFlexibleXUnionInStruct = _bindings.CreateLazyMarshaler(TestFlexibleXUnionInStruct{})
@@ -932,36 +937,6 @@
u.AfterPresent = false
}
-type TableWithEmptyStruct struct {
- _ struct{} `fidl2:"t,16,8"`
- S EmptyStruct `fidl:"1" fidl2:"1"`
- SPresent bool
-}
-
-func (u *TableWithEmptyStruct) SetS(s EmptyStruct) {
- u.S = s
- u.SPresent = true
-}
-
-func (u *TableWithEmptyStruct) GetS() EmptyStruct {
- return u.S
-}
-
-func (u *TableWithEmptyStruct) GetSWithDefault(_default EmptyStruct) EmptyStruct {
- if !u.HasS() {
- return _default
- }
- return u.S
-}
-
-func (u *TableWithEmptyStruct) HasS() bool {
- return u.SPresent
-}
-
-func (u *TableWithEmptyStruct) ClearS() {
- u.SPresent = false
-}
-
type SimpleTable struct {
_ struct{} `fidl2:"t,16,8"`
X int64 `fidl:"1" fidl2:"1"`
@@ -1100,6 +1075,36 @@
u.BazPresent = false
}
+type TableWithEmptyStruct struct {
+ _ struct{} `fidl2:"t,16,8"`
+ S EmptyStruct `fidl:"1" fidl2:"1"`
+ SPresent bool
+}
+
+func (u *TableWithEmptyStruct) SetS(s EmptyStruct) {
+ u.S = s
+ u.SPresent = true
+}
+
+func (u *TableWithEmptyStruct) GetS() EmptyStruct {
+ return u.S
+}
+
+func (u *TableWithEmptyStruct) GetSWithDefault(_default EmptyStruct) EmptyStruct {
+ if !u.HasS() {
+ return _default
+ }
+ return u.S
+}
+
+func (u *TableWithEmptyStruct) HasS() bool {
+ return u.SPresent
+}
+
+func (u *TableWithEmptyStruct) ClearS() {
+ u.SPresent = false
+}
+
type EthernetDeviceInterface _bindings.ChannelProxy
type EthernetDevice interface {
diff --git a/src/syscall/zx/fidl/fidl_test/conformance_test.go b/src/syscall/zx/fidl/fidl_test/conformance_test.go
index b708559..f34871d 100644
--- a/src/syscall/zx/fidl/fidl_test/conformance_test.go
+++ b/src/syscall/zx/fidl/fidl_test/conformance_test.go
@@ -17,12 +17,219 @@
"syscall/zx/fidl/conformance"
)
-func TestAllSuccessCases(t *testing.T) {
+func TestAllEncodeSuccessCases(t *testing.T) {
{
- var v1 conformance.EmptyStruct
+ 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
- successCase{
+ 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{
@@ -32,15 +239,15 @@
}
{
- var v1 conformance.EmptyStructSandwich
+ v1 := conformance.EmptyStructSandwich{}
v2 := "before"
v1.Before = v2
- var v3 conformance.EmptyStruct
+ v3 := conformance.EmptyStruct{}
v1.Es = v3
v4 := "after"
v1.After = v4
- successCase{
+ encodeSuccessCase{
name: "EmptyStructSandwich",
input: &v1,
bytes: []byte{
@@ -56,7 +263,7 @@
}
{
- var v1 conformance.Uint8Uint16Uint32Uint64
+ v1 := conformance.Uint8Uint16Uint32Uint64{}
var v2 uint8 = 1
v1.F1 = v2
var v3 uint16 = 515
@@ -66,7 +273,7 @@
var v5 uint64 = 579005069656919567
v1.F4 = v5
- successCase{
+ encodeSuccessCase{
name: "Uint8Uint16Uint32Uint64",
input: &v1,
bytes: []byte{
@@ -77,7 +284,7 @@
}
{
- var v1 conformance.Uint64Uint32Uint16Uint8
+ v1 := conformance.Uint64Uint32Uint16Uint8{}
var v2 uint64 = 579005069656919567
v1.F1 = v2
var v3 uint32 = 67438087
@@ -87,7 +294,7 @@
var v5 uint8 = 1
v1.F4 = v5
- successCase{
+ encodeSuccessCase{
name: "Uint64Uint32Uint16Uint8",
input: &v1,
bytes: []byte{
@@ -98,11 +305,11 @@
}
{
- var v1 conformance.StructOfSimpleTable
- var v2 conformance.SimpleTable
+ v1 := conformance.StructOfSimpleTable{}
+ v2 := conformance.SimpleTable{}
v1.Table = v2
- successCase{
+ encodeSuccessCase{
name: "SimpleTableEmpty",
input: &v1,
bytes: []byte{
@@ -113,15 +320,15 @@
}
{
- var v1 conformance.StructOfSimpleTable
- var v2 conformance.SimpleTable
+ v1 := conformance.StructOfSimpleTable{}
+ v2 := conformance.SimpleTable{}
var v3 int64 = 42
v2.SetX(v3)
var v4 int64 = 67
v2.SetY(v4)
v1.Table = v2
- successCase{
+ encodeSuccessCase{
name: "SimpleTableXAndY",
input: &v1,
bytes: []byte{
@@ -144,13 +351,13 @@
}
{
- var v1 conformance.StructOfSimpleTable
- var v2 conformance.SimpleTable
+ v1 := conformance.StructOfSimpleTable{}
+ v2 := conformance.SimpleTable{}
var v3 int64 = 67
v2.SetY(v3)
v1.Table = v2
- successCase{
+ encodeSuccessCase{
name: "SimpleTableJustY",
input: &v1,
bytes: []byte{
@@ -172,15 +379,15 @@
}
{
- var v1 conformance.StructOfTableWithStringAndVector
- var v2 conformance.TableWithStringAndVector
+ v1 := conformance.StructOfTableWithStringAndVector{}
+ v2 := conformance.TableWithStringAndVector{}
v3 := "hello"
v2.SetFoo(v3)
var v4 int32 = 27
v2.SetBar(v4)
v1.Table = v2
- successCase{
+ encodeSuccessCase{
name: "TableWithStringAndVectorNoVectorContent",
input: &v1,
bytes: []byte{
@@ -199,8 +406,8 @@
}
{
- var v1 conformance.SimpleTableThenUint64
- var v2 conformance.SimpleTable
+ v1 := conformance.SimpleTableThenUint64{}
+ v2 := conformance.SimpleTable{}
var v3 int64 = 42
v2.SetX(v3)
var v4 int64 = 67
@@ -209,7 +416,7 @@
var v5 uint64 = 16045690984833335023
v1.Number = v5
- successCase{
+ encodeSuccessCase{
name: "SimpleTableThenUint64",
input: &v1,
bytes: []byte{
@@ -233,17 +440,17 @@
}
{
- var v1 conformance.TestInlineXUnionInStruct
+ v1 := conformance.TestInlineXUnionInStruct{}
v2 := "before"
v1.Before = v2
- var v3 conformance.SampleXUnion
+ v3 := conformance.SampleXUnion{}
var v4 uint32 = 3735928559
v3.SetU(v4)
v1.Xu = v3
v5 := "after"
v1.After = v5
- successCase{
+ encodeSuccessCase{
name: "InlineXUnionInStruct",
input: &v1,
bytes: []byte{
@@ -262,13 +469,13 @@
}
{
- var v1 conformance.TestOptionalXUnionInStruct
+ v1 := conformance.TestOptionalXUnionInStruct{}
v2 := "before"
v1.Before = v2
v3 := "after"
v1.After = v3
- successCase{
+ encodeSuccessCase{
name: "OptionalXUnionInStructAbsent",
input: &v1,
bytes: []byte{
@@ -286,17 +493,17 @@
}
{
- var v1 conformance.TestOptionalXUnionInStruct
+ v1 := conformance.TestOptionalXUnionInStruct{}
v2 := "before"
v1.Before = v2
- var v3 conformance.SampleXUnion
+ v3 := &conformance.SampleXUnion{}
var v4 uint32 = 3735928559
v3.SetU(v4)
- v1.Xu = &v3
+ v1.Xu = v3
v5 := "after"
v1.After = v5
- successCase{
+ encodeSuccessCase{
name: "OptionalXUnionInStructPresent",
input: &v1,
bytes: []byte{
@@ -315,15 +522,15 @@
}
{
- var v1 conformance.TestXUnionInTable
- var v2 conformance.XUnionInTable
+ v1 := conformance.TestXUnionInTable{}
+ v2 := conformance.XUnionInTable{}
v3 := "before"
v2.SetBefore(v3)
v4 := "after"
v2.SetAfter(v4)
v1.Value = v2
- successCase{
+ encodeSuccessCase{
name: "XUnionInTableXUnionAbsent",
input: &v1,
bytes: []byte{
@@ -346,11 +553,11 @@
}
{
- var v1 conformance.TestXUnionInTable
- var v2 conformance.XUnionInTable
+ v1 := conformance.TestXUnionInTable{}
+ v2 := conformance.XUnionInTable{}
v3 := "before"
v2.SetBefore(v3)
- var v4 conformance.SampleXUnion
+ v4 := conformance.SampleXUnion{}
var v5 uint32 = 3735928559
v4.SetU(v5)
v2.SetXu(v4)
@@ -358,7 +565,7 @@
v2.SetAfter(v6)
v1.Value = v2
- successCase{
+ encodeSuccessCase{
name: "XUnionInTableXUnionPresent",
input: &v1,
bytes: []byte{
@@ -385,13 +592,32 @@
}
{
- var v1 conformance.TestAddEthernetDeviceRequest
+ 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
- var v3 conformance.InterfaceConfig
+ v3 := conformance.InterfaceConfig{}
v4 := "ethp0003"
v3.Name = v4
- var v5 conformance.IpAddressConfig
+ v5 := conformance.IpAddressConfig{}
v6 := true
v5.SetDhcp(v6)
v3.IpAddressConfig = v5
@@ -399,7 +625,7 @@
var v7 uint32 = 4294967295
v1.ThisShouldBeAHandle = v7
- successCase{
+ encodeSuccessCase{
name: "AddEthernetDeviceRequest",
input: &v1,
bytes: []byte{
@@ -423,10 +649,10 @@
}
{
- var v1 conformance.FileGetAttrResponse
+ v1 := conformance.FileGetAttrResponse{}
var v2 int32 = 2125315759
v1.S = v2
- var v3 conformance.NodeAttributes
+ v3 := conformance.NodeAttributes{}
var v4 uint32 = 2518909348
v3.Mode = v4
var v5 uint64 = 1
@@ -443,7 +669,7 @@
v3.ModificationTime = v10
v1.Attributes = v3
- successCase{
+ encodeSuccessCase{
name: "FileGetAttrResponse",
input: &v1,
bytes: []byte{
@@ -460,33 +686,33 @@
}
{
- var v1 conformance.StructWithOptionals
- var v2 conformance.EmptyStruct
+ v1 := conformance.StructWithOptionals{}
+ v2 := conformance.EmptyStruct{}
v1.S = v2
- var v3 conformance.EmptyStruct
- v1.S2 = &v3
- var v4 conformance.TableWithEmptyStruct
- var v5 conformance.EmptyStruct
+ v3 := &conformance.EmptyStruct{}
+ v1.S2 = v3
+ v4 := conformance.TableWithEmptyStruct{}
+ v5 := conformance.EmptyStruct{}
v4.SetS(v5)
v1.T = v4
- var v6 conformance.XUnionWithEmptyStruct
- var v7 conformance.EmptyStruct
+ v6 := conformance.XUnionWithEmptyStruct{}
+ v7 := conformance.EmptyStruct{}
v6.SetS(v7)
v1.Xu = v6
- var v8 conformance.XUnionWithEmptyStruct
- var v9 conformance.EmptyStruct
+ v8 := &conformance.XUnionWithEmptyStruct{}
+ v9 := conformance.EmptyStruct{}
v8.SetS(v9)
- v1.Xu2 = &v8
- var v10 conformance.UnionWithEmptyStruct
- var v11 conformance.EmptyStruct
+ v1.Xu2 = v8
+ v10 := conformance.UnionWithEmptyStruct{}
+ v11 := conformance.EmptyStruct{}
v10.SetS(v11)
v1.U = v10
- var v12 conformance.UnionWithEmptyStruct
- var v13 conformance.EmptyStruct
+ v12 := &conformance.UnionWithEmptyStruct{}
+ v13 := conformance.EmptyStruct{}
v12.SetS(v13)
- v1.U2 = &v12
+ v1.U2 = v12
- successCase{
+ encodeSuccessCase{
name: "Optionals",
input: &v1,
bytes: []byte{
@@ -515,12 +741,1950 @@
}.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
-func TestAllEncodingFailureCases(t *testing.T) {
+ 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)
+ }
{
- var v1 conformance.Length2StringWrapper
+ 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
@@ -533,7 +2697,21 @@
}
-func TestAllDecodingFailureCases(t *testing.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{