| // Copyright 2018 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 fidl.test.misc; |
| |
| bits Uint32Bits : uint32 { |
| ONE = 0x1; |
| TWO = 0x2; |
| }; |
| |
| strict bits StrictBits : uint8 { |
| B = 2; |
| D = 4; |
| E = 8; |
| }; |
| |
| /// The members should be kept in sync with those in [`StrictBits`], as we have |
| /// tests parameterized on both bits types. |
| flexible bits FlexibleBits : uint8 { |
| B = 2; |
| D = 4; |
| E = 8; |
| }; |
| |
| struct Int64Struct { |
| int64 x; |
| }; |
| |
| struct HasOptionalFieldStruct { |
| Int64Struct? x; |
| }; |
| |
| struct Has2OptionalFieldStruct { |
| Int64Struct? x; |
| Int64Struct? y; |
| }; |
| |
| struct Empty { |
| }; |
| |
| flexible union XUnionContainingEmptyStruct { |
| 1: Empty empty; |
| }; |
| |
| struct EmptyStructSandwich { |
| string before; |
| Empty e; |
| string after; |
| }; |
| |
| union SimpleUnion { |
| 1: int32 i32; |
| 2: int64 i64; |
| 3: Int64Struct s; |
| 4: uint64 reserved_ordinal_3; |
| 5: string str; |
| }; |
| |
| table SimpleTable { |
| 1: int64 x; |
| 2: reserved; |
| 3: reserved; |
| 4: reserved; |
| 5: int64 y; |
| }; |
| |
| // A variant of SimpleTable that has just the first few fields. |
| // Think of this as an older variant of that type! |
| table OlderSimpleTable { |
| 1: int64 x; |
| 2: reserved; |
| }; |
| |
| // A variant of SimpleTable that has some additional new fields. |
| // Think of this as an newer variant of that type! |
| table NewerSimpleTable { |
| 1: int64 x; |
| 2: reserved; |
| 3: reserved; |
| 4: reserved; |
| 5: int64 y; |
| 6: int64 z; |
| 7: reserved; |
| }; |
| |
| table ComplexTable { |
| 1: SimpleTable simple; |
| 2: SampleXUnion u; |
| 3: vector<string> strings; |
| }; |
| |
| flexible union SampleXUnion { |
| 1: int32 i; |
| 2: SimpleUnion su; |
| 3: SimpleTable st; |
| }; |
| |
| struct SampleXUnionInStruct { |
| SampleXUnion xu; |
| }; |
| |
| struct InlineXUnionInStruct { |
| string before; |
| SampleXUnion xu; |
| string after; |
| }; |
| |
| struct OptionalXUnionInStruct { |
| string before; |
| SampleXUnion? xu; |
| string after; |
| }; |
| |
| table XUnionInTable { |
| 1: string before; |
| 2: SampleXUnion xu; |
| 3: string after; |
| }; |
| |
| table PrimitiveArrayInTable { |
| 1: string before; |
| 2: array<int32>:9 arr; |
| 3: string after; |
| }; |
| |
| strict enum StrictEnum { |
| MEMBER_A = 23; |
| MEMBER_B = 34; |
| MEMBER_C = 45; |
| }; |
| |
| flexible enum FlexibleEnum { |
| MEMBER_A = 23; |
| MEMBER_B = 34; |
| MEMBER_C = 45; |
| [Unknown] MEMBER_CUSTOM_UNKNOWN = 89; |
| }; |
| |
| struct VariousDefaults { |
| int64 int64_with_default = 5; |
| string string_with_default = "stuff"; |
| StrictEnum strict_enum_with_default = StrictEnum.MEMBER_B; |
| FlexibleEnum flexible_enum_with_default = FlexibleEnum.MEMBER_B; |
| bool bool_with_default = true; |
| }; |
| |
| protocol Echo { |
| EchoString(string? value) -> (string? response); |
| }; |