blob: ec064e8c5f8133a0b8ded7b12082d7f57f024b59 [file] [log] [blame]
// Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package types
type (
// vomdata config types
ConvertGroup struct{ Name string; PrimaryType typeobject; Values []any }
VomdataStruct struct{
EncodeDecodeData map[byte][]any // map from min required VOM version to test values
CompatData map[string][]typeobject
ConvertData map[string][]ConvertGroup
}
// Named Types
NBool bool
NString string
NByteSlice []byte
NByteArray [4]byte
NByte byte
NUint16 uint16
NUint32 uint32
NUint64 uint64
NInt8 int8
NInt16 int16
NInt32 int32
NInt64 int64
NFloat32 float32
NFloat64 float64
NArray2Uint64 [2]uint64
NListUint64 []uint64
NSetUint64 set[uint64]
NMapUint64String map[uint64]string
NStruct struct {
A bool
B string
C int64
}
NEnum enum{ A; B; C }
NUnion union{ A bool; B string; C int64 }
// Nested Custom Types
MBool NBool
MStruct struct {
A bool
B NBool
C MBool
D ?NStruct
E typeobject
F any
}
MList []NListUint64
MMap map[NFloat32]NListUint64
MByteSlice []byte
MInt8Slice []int8
// Recursive Type Definitions
RecA []RecA
RecX []RecY
RecY []RecX
Rec1 []Rec2
Rec2 []Rec3
Rec3 []Rec4
Rec4 []Rec1
RecStruct struct {
A ?RecStruct
}
Rec1234 struct {
R1 Rec1
R2 Rec2
R3 Rec3
R4 Rec4
}
Rec1234A struct {
A []Rec1234A
Rec1234 []Rec1234
}
Rec1234B struct {
B []Rec1234B
Rec1234 []Rec1234
}
Rec1234All struct {
A Rec1234A
B Rec1234B
}
// Additional types for compatibility and conversion checks
ListString []string
Array3String [3]string
Array4String [4]string
AbcStruct struct {
A bool
B string
C int64
}
AdeStruct struct {
A bool
D any
E typeobject
}
XyzStruct struct {
X bool
Y MBool
Z string
}
YzStruct struct {
Y NBool
Z NString
}
ZStruct struct {
Z string
}
MapOnlyStruct struct {
Key1 int64
Key2 uint32
}
StructOnlyMap map[string]uint64
MapSetStruct struct {
Feat bool
Tire bool
Eel bool
}
SetStructMap map[string]bool
MapStructSet set[string]
SetOnlyMap map[float64]bool
SometimesSetMap map[float64]any
MapOnlySet set[float64]
SetOnlyA set[bool]
SetOnlyA2 set[NBool]
SetOnlyB set[int16]
SetOnlyB2 set[NInt16]
MapOnlyA map[uint32]uint32
MapOnlyA2 map[int64]float64
MapOnlyB map[bool]string
MapOnlyB2 map[NBool]NString
BdeUnion union{ B string; D any; E typeobject }
BrieEnum enum{ Glee; Brie; Three }
BeanEnum enum{ Bean }
FoodEnum enum{ Bean; Brie; Cherry }
StructAny struct {
Any any
}
StructMap struct {
Map map[int64]int64
}
// Since the encoding changes if struct fields are zero values,
// test each of the kinds in a struct both as zero and non-zero values.
StructManyTypes struct {
Bool bool
AByte byte
Int16 int16
Int32 int32
Int64 int64
Uint16 uint16
Uint32 uint32
Uint64 uint64
String string
Bytes []byte
Float32 float32
Float64 float64
FoodEnum FoodEnum
NEnum NEnum
NListUint64 NListUint64
NByteArray NByteArray
NArray2Uint64 NArray2Uint64
NSetUint64 NSetUint64
NMapUint64String NMapUint64String
NStruct NStruct
NUnion NUnion
TypeObject typeobject
}
AnySlice []any
LargeMessageType struct {
Payload []byte
Next ?LargeMessageType
}
LargeAnyMessageType struct {
Payload any
Next ?LargeAnyMessageType
}
)