| // 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. |
| library test.conformance; |
| |
| using zx; |
| |
| type XUnionInTable = table { |
| 1: before string; |
| 2: xu SampleXUnion; |
| 3: after string; |
| }; |
| |
| type TestXUnionInTable = struct { |
| value XUnionInTable; |
| }; |
| |
| type IpAddressConfig = strict union { |
| 1: padding_size_24_align_4 array<uint32, 6>; |
| 2: dhcp bool; |
| }; |
| |
| type InterfaceConfig = struct { |
| name string; |
| ip_address_config IpAddressConfig; |
| }; |
| |
| type TestAddEthernetDeviceRequest = struct { |
| topological_path string; |
| config InterfaceConfig; |
| // TODO(fxbug.dev/7947): Use 'EthernetDevice device;' instead. |
| this_should_be_a_handle uint32; |
| }; |
| |
| type TestPackageResolverResolveRequest = resource struct { |
| package_url string; |
| selectors vector<string>; |
| update_policy UpdatePolicy; |
| // TODO(fxbug.dev/7947): Use 'EthernetDevice device;' instead. |
| this_should_be_a_handle uint32; |
| }; |
| |
| type UpdatePolicy = struct { |
| fetch_if_absent bool; |
| allow_old_versions bool; |
| }; |
| |
| type NodeAttributes = struct { |
| mode uint32; |
| id uint64; |
| content_size uint64; |
| storage_size uint64; |
| link_count uint64; |
| creation_time uint64; |
| modification_time uint64; |
| }; |
| |
| type FileGetAttrResponse = struct { |
| s zx.status; |
| attributes NodeAttributes; |
| }; |
| |
| type Int64Struct = struct { |
| x int64; |
| }; |
| |
| type SimpleUnion = strict union { |
| 1: i32 int32; |
| 2: i64 int64; |
| 3: s Int64Struct; |
| 4: str string; |
| }; |
| |
| type SampleXUnion = flexible union { |
| 1: u uint32; |
| 2: su SimpleUnion; |
| 3: st SimpleTable; |
| }; |
| |
| type SampleResourceXUnion = flexible resource union { |
| 1: u uint32; |
| 2: su SimpleUnion; |
| 3: st SimpleTable; |
| }; |
| |
| type SampleStrictXUnion = strict union { |
| 1: u uint32; |
| 2: su SimpleUnion; |
| 3: st SimpleTable; |
| }; |
| |
| type SampleStrictResourceXUnion = strict resource union { |
| 1: u uint32; |
| 2: su SimpleUnion; |
| 3: st SimpleTable; |
| }; |
| |
| type TestInlineXUnionInStruct = struct { |
| before string; |
| xu SampleXUnion; |
| after string; |
| }; |
| |
| type TestOptionalXUnionInStruct = struct { |
| before string; |
| xu SampleXUnion:optional; |
| after string; |
| }; |
| |
| type TestStrictXUnionInStruct = struct { |
| xu SampleStrictXUnion; |
| }; |
| |
| type TestStrictResourceXUnionInStruct = resource struct { |
| xu SampleStrictResourceXUnion; |
| }; |
| |
| type TestFlexibleXUnionInStruct = struct { |
| xu SampleXUnion; |
| }; |
| |
| type TestFlexibleResourceXUnionInStruct = resource struct { |
| xu SampleResourceXUnion; |
| }; |
| |
| type TestOptionalStrictXUnionInStruct = struct { |
| xu SampleStrictXUnion:optional; |
| }; |
| |
| type TestOptionalStrictResourceXUnionInStruct = resource struct { |
| xu SampleStrictResourceXUnion:optional; |
| }; |
| |
| type TestOptionalFlexibleXUnionInStruct = struct { |
| xu SampleXUnion:optional; |
| }; |
| |
| type TestOptionalFlexibleResourceXUnionInStruct = resource struct { |
| xu SampleResourceXUnion:optional; |
| }; |
| |
| type FidlvizDemo = resource struct { |
| f1 uint8; |
| f2 int8; |
| f3 uint16; |
| f4 uint32; |
| f5 uint64; |
| f6 uint8; |
| f7 uint8; |
| f8 uint16; |
| f9 float32; |
| f10 float64; |
| f11 bool; |
| f12 bool; |
| f13 string; |
| f14 string:optional; |
| f15 string; |
| f16 handle:optional; |
| f17 handle; |
| f18 array<uint8, 3>; |
| f19 vector<float64>; |
| f20 vector<uint8>:optional; |
| f21 vector<uint8>; |
| f22 FidlvizBits; |
| f23 FidlvizEnum; |
| f24 FidlvizStruct1; |
| f25 FidlvizStruct2; |
| f26 box<FidlvizStruct1>; |
| f27 box<FidlvizStruct2>; |
| f28 FidlvizTable; |
| f29 FidlvizTable; |
| f30 FidlvizUnion:optional; |
| f31 FidlvizUnion; |
| }; |
| |
| type FidlvizBits = strict bits : uint8 { |
| A = 1; |
| B = 2; |
| C = 4; |
| }; |
| |
| type FidlvizEnum = strict enum : uint8 { |
| A = 42; |
| }; |
| |
| type FidlvizStruct1 = struct {}; |
| |
| type FidlvizStruct2 = struct { |
| x uint64; |
| }; |
| |
| type FidlvizTable = table { |
| 1: f1 bool; |
| 2: reserved; |
| 3: f3 bool; |
| }; |
| |
| type FidlvizUnion = strict union { |
| 1: reserved; |
| 2: reserved; |
| 3: reserved; |
| 4: reserved; |
| 5: reserved; |
| 6: reserved; |
| 7: f7 string; |
| }; |