| // Copyright 2016 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 vdltest |
| |
| // TODO(toddw): Add tests for longer cyclic chains, consult old vom tests for |
| // regression scenarios. |
| // TODO(toddw): Add multi-step wire types, e.g. |
| // NativeA <-> WireA |
| // NativeB <-> WireB |
| // type WireB struct { <-vdl go-> type WireB struct { |
| // A WireA A NativeA |
| // } } |
| |
| // FOR EACH TYPE ADDED OR UPDATED, CONSIDER ALSO UPDATING xtype_manual.vdl |
| // |
| // While the types in vtype_gen.vdl are automatically generated, the types in |
| // this file are created by-hand, to handle special cases. |
| |
| // VSelfCycle tests self-cyclic types. |
| type VSelfCycle struct { |
| Data int64 |
| Next ?VSelfCycle |
| } |
| |
| // VMutualCycleA tests mutually cyclic types A and B. |
| type VMutualCycleA struct { |
| Data int64 |
| B ?VMutualCycleB |
| } |
| |
| // VMutualCycleB tests mutually cyclic types A and B. |
| type VMutualCycleB struct { |
| Data int64 |
| A ?VMutualCycleA |
| } |
| |
| // The VWire* types are the wire types associated with native types. The native |
| // types are defined in vtype_native.go. |
| // |
| // The naming is such that VWire* <-> VNativeWire*, e.g. VWireBoolNString is |
| // the wire type associated with the VNativeWireBoolNString native type, where |
| // the wire type is bool, and the native type is string. |
| type ( |
| VWireBoolNBool bool |
| VWireBoolNString bool |
| VWireBoolNStruct bool |
| |
| VWireIntNInt int32 |
| VWireIntNString int32 |
| VWireIntNStruct int32 |
| |
| VWireStringNString string |
| VWireStringNStruct string |
| |
| VWireArrayNString [1]string |
| VWireArrayNStruct [1]string |
| |
| VWireListNString []string |
| VWireListNStruct []string |
| |
| VWireStructNString struct{ X string } |
| VWireStructNStruct struct{ X string } |
| VWireStructNArray struct{ X string } |
| VWireStructNSlice struct{ X string } |
| VWireStructNPointer struct{ X string } |
| VWireStructNIface struct{ X string } |
| |
| VWireUnionNString union{ X string } |
| VWireUnionNStruct union{ X string } |
| VWireUnionNArray union{ X string } |
| VWireUnionNSlice union{ X string } |
| VWireUnionNPointer union{ X string } |
| VWireUnionNIface union{ X string } |
| ) |
| |
| // VWireAll contains all wire types, which will be represented as native types |
| // in the generated code. |
| type VWireAll struct { |
| BoolNBool VWireBoolNBool |
| BoolNString VWireBoolNString |
| BoolNStruct VWireBoolNStruct |
| |
| IntNInt VWireIntNInt |
| IntNString VWireIntNString |
| IntNStruct VWireIntNStruct |
| |
| StringNString VWireStringNString |
| StringNStruct VWireStringNStruct |
| |
| ArrayNString VWireArrayNString |
| ArrayNStruct VWireArrayNStruct |
| |
| ListNString VWireListNString |
| ListNStruct VWireListNStruct |
| |
| StructNString VWireStructNString |
| StructNStruct VWireStructNStruct |
| StructNArray VWireStructNArray |
| StructNSlice VWireStructNSlice |
| StructNPointer VWireStructNPointer |
| StructNIface VWireStructNIface |
| |
| UnionNString VWireUnionNString |
| UnionNStruct VWireUnionNStruct |
| UnionNArray VWireUnionNArray |
| UnionNSlice VWireUnionNSlice |
| UnionNPointer VWireUnionNPointer |
| UnionNIface VWireUnionNIface |
| } |