blob: 1e293e161ac988acdc0e9f78d7e487a66912276b [file] [log] [blame]
// Copyright 2020 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.measuretape;
using zx;
// 24 bytes + selected member size
type TopLevelUnion = strict resource union {
1: primitive8 uint64;
24: primitive4 uint32;
2: handle zx.Handle;
3: struct_with_string StructWithString;
4: struct_with_opt_string StructWithOptString;
5: table Table;
6: array_of_twelve_bytes array<byte, 12>;
7: array_of_three_strings array<string, 3>;
8: array_of_three_handles array<zx.Handle, 3>;
9: array_of_two_tables array<Table, 2>;
10: array_of_two_unions array<Union, 2>;
11: struct_with_two_arrays StructWithTwoArrays;
12: array_of_three_structs_with_one_handle array<StructWithOneHandle, 3>;
21: array_of_three_structs_with_two_handles array<StructWithTwoHandles, 3>;
13: vector_of_bytes vector<byte>;
14: vector_of_strings vector<string>;
15: vector_of_handles vector<zx.Handle>;
16: vector_of_tables vector<Table>;
17: vector_of_unions vector<Union>;
18: struct_with_two_vectors StructWithTwoVectors;
19: vector_of_structs_with_one_handle vector<StructWithOneHandle>;
20: vector_of_structs_with_two_handles vector<StructWithTwoHandles>;
22: flexible_union FlexibleUnion;
23: struct_with_a_vector StructWithAVector;
};
// 8 bytes (i.e. 4 bytes, aligned to 8)
type AnotherTopLevelThing = struct {
just_a_simple_example uint32;
};
// 16 bytes + FIDL_ALIGN(string length)
type StructWithString = struct {
string string;
};
// 16 bytes + FIDL_ALIGN(string length)
type StructWithOptString = struct {
opt_string string:optional;
};
// 16 bytes + max_set_ordinal * 16 + sum of all set member out of line data
type Table = resource table {
6: primitive8 uint64;
5: primitive4 uint32;
3: string string;
4: handle zx.Handle;
};
// 24 bytes + selected member out of line size
type Union = strict union {
1: primitive8 uint64;
2: primitive4 uint32;
};
type FlexibleUnion = flexible union {
1: primitive8 uint64;
};
// 64 bytes, i.e. 12 + 4 (padding) + 3 * 16
type StructWithTwoArrays = struct {
array_of_twelve_bytes array<byte, 12>;
array_of_three_strings array<string, 3>;
};
// 9 bytes
type StructWithOneHandle = resource struct {
tiny1 uint8;
vmo zx.Handle:VMO;
tiny2 uint8;
};
// 12 bytes
type StructWithTwoHandles = resource struct {
tiny1 uint8;
vmo1 zx.Handle:VMO;
vmo2 zx.Handle:VMO;
};
// 32 bytes
type StructWithTwoVectors = struct {
vector_of_bytes vector<byte>:optional;
vector_of_strings vector<string>:optional;
};
// 16 bytes
type StructWithAVector = struct {
vector_of_strings vector<string:3>:5;
};