blob: 55da8a4e7c6d3ec69c0d12df73a3f24f0c4253de [file] [log] [blame]
// 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 fidl.llcpp.types.test;
struct CopyableStruct {
int32 x;
};
struct MoveOnlyStruct {
handle? h;
};
/// Verifies that user code can manipulate these union payloads.
union TestUnion {
1: int32 primitive;
2: CopyableStruct copyable;
3: MoveOnlyStruct move_only;
};
flexible union TestXUnion {
1: int32 primitive;
2: CopyableStruct copyable;
3: handle h;
};
union TestStrictXUnion {
1: int32 primitive;
2: CopyableStruct copyable;
};
/// Verifies that user code can manipulate these bits.
///
/// We use a uint8 since most bitwise operations will cast their operands to
/// int, and therefore special casting is required to properly compile.
bits SampleBits : uint8 {
B = 2;
D = 4;
E = 8;
};
/// Verifies that user code can build and access tables.
table SampleTable {
1: uint8 x;
2: uint8 y;
3: vector<CopyableStruct> vector_of_struct;
};
/// Verifies that an empty table compiles.
table SampleEmptyTable {
};
protocol TestInterface {
TestMethod(TestUnion u) -> (TestUnion u);
};
/// Verifies that method argument types don't conflict with user-defined types.
struct FooRequest {
int32 bar;
};
struct FooResponse {
int32 bar;
};
protocol Baz {
Foo(FooRequest req) -> (FooResponse res);
};