blob: e66ec4aa0a073feac236a36de025ddf697fef2eb [file] [log] [blame]
Austin Schuh3e95e5d2019-09-20 00:08:54 -07001namespace aos.testing;
2
Alex Perrycb7da4b2019-08-28 19:35:56 -07003enum BaseType : byte {
4 None,
5 UType,
6 Bool,
7 Byte,
8 UByte,
9 Short,
10 UShort,
11 Int,
12 UInt,
13 Long,
14 ULong,
15 Float,
16 Double,
17 String,
18 Vector,
19 Obj, // Used for tables & structs.
20 Union,
21 Array
22}
23
Brian Silverman5c710412021-02-09 19:09:32 -080024enum NonConsecutive : int {
25 Zero = 0,
26 Big = 10000000,
27}
28
Austin Schuh3e95e5d2019-09-20 00:08:54 -070029table Location {
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080030 name:string (id: 0);
31 type:string (id: 1);
32 frequency:int (id: 2);
33 max_size:int (id: 3);
Austin Schuh3e95e5d2019-09-20 00:08:54 -070034}
35
36table Map {
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080037 match:Location (id: 0);
38 rename:Location (id: 1);
Austin Schuh3e95e5d2019-09-20 00:08:54 -070039}
40
41table Application {
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080042 name:string (id: 0);
43 priority:int (id: 1);
44 maps:[Map] (id: 2);
45 long_thingy:uint64 (id: 3);
Austin Schuh3e95e5d2019-09-20 00:08:54 -070046}
47
Alex Perrycb7da4b2019-08-28 19:35:56 -070048table VectorOfStrings {
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080049 str:[string] (id: 0);
Alex Perrycb7da4b2019-08-28 19:35:56 -070050}
51
52table VectorOfVectorOfString {
Ravago Jonesfb6a7a52020-11-14 13:47:46 -080053 v:[VectorOfStrings] (id: 0);
Alex Perrycb7da4b2019-08-28 19:35:56 -070054}
55
Tyler Chatow5e369a42019-11-23 11:57:31 -080056struct FooStructNested {
57 foo_byte:byte;
58}
59
60struct FooStruct {
61 foo_byte:byte;
62 nested_struct:FooStructNested;
63}
64
James Kuszmaul768c4682023-10-12 21:07:16 -070065struct ScalarSweepStruct {
66 foo_float:float;
67 foo_double:double;
68 foo_int32:int32;
69 foo_uint32:uint32;
70 foo_int64:int64;
71 foo_uint64:uint64;
72}
73
Tyler Chatow5e369a42019-11-23 11:57:31 -080074struct StructEnum {
75 foo_enum:BaseType;
76}
77
Austin Schuh3e95e5d2019-09-20 00:08:54 -070078table Configuration {
79 locations:[Location] (id: 0);
80 maps:[Map] (id: 1);
Austin Schuh09d7ffa2019-10-03 23:43:34 -070081 apps:[Application] (id: 2);
Austin Schuh3e95e5d2019-09-20 00:08:54 -070082 imports:[string] (id: 3);
83
84 // 8 bit: byte ubyte bool
85 // 16 bit: short ushort
86 // 32 bit: int uint float
87 // 64 bit: long ulong double
88
89 // Simple values.
90 foo_byte:byte (id: 4);
91 foo_ubyte:ubyte (id: 5);
92 foo_bool:bool (id: 6);
93
94 foo_short:short (id: 7);
95 foo_ushort:ushort (id: 8);
96
97 foo_int:int (id: 9);
98 foo_uint:uint (id: 10);
99
100 foo_long:long (id: 11);
101 foo_ulong:ulong (id: 12);
102
103 foo_float:float (id: 13);
104 foo_double:double (id: 14);
105
106 foo_string:string (id: 15);
107
Alex Perrycb7da4b2019-08-28 19:35:56 -0700108 foo_enum:BaseType (id: 16);
109 foo_enum_default:BaseType = None (id: 17);
110
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700111 // Test vectors now.
Alex Perrycb7da4b2019-08-28 19:35:56 -0700112 vector_foo_byte:[byte] (id: 18);
113 vector_foo_ubyte:[ubyte] (id: 19);
114 vector_foo_bool:[bool] (id: 20);
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700115
Alex Perrycb7da4b2019-08-28 19:35:56 -0700116 vector_foo_short:[short] (id: 21);
117 vector_foo_ushort:[ushort] (id: 22);
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700118
Alex Perrycb7da4b2019-08-28 19:35:56 -0700119 vector_foo_int:[int] (id: 23);
120 vector_foo_uint:[uint] (id: 24);
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700121
Alex Perrycb7da4b2019-08-28 19:35:56 -0700122 vector_foo_long:[long] (id: 25);
123 vector_foo_ulong:[ulong] (id: 26);
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700124
Alex Perrycb7da4b2019-08-28 19:35:56 -0700125 vector_foo_float:[float] (id: 27);
126 vector_foo_double:[double] (id: 28);
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700127
Alex Perrycb7da4b2019-08-28 19:35:56 -0700128 vector_foo_string:[string] (id: 29);
129
130 vector_foo_enum:[BaseType] (id: 30);
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700131
132 // And a simple nested application.
Alex Perrycb7da4b2019-08-28 19:35:56 -0700133 single_application:Application (id: 31);
Austin Schuh09d7ffa2019-10-03 23:43:34 -0700134
135 // And nest this object to get some crazy coverage.
Alex Perrycb7da4b2019-08-28 19:35:56 -0700136 nested_config:Configuration (id: 32);
137
138 vov:VectorOfVectorOfString (id: 33);
Tyler Chatow5e369a42019-11-23 11:57:31 -0800139
140 foo_struct:FooStruct (id: 34);
141 vector_foo_struct:[FooStruct] (id: 35);
142 foo_struct_enum:StructEnum (id: 36);
James Kuszmaul768c4682023-10-12 21:07:16 -0700143 foo_struct_scalars:ScalarSweepStruct (id: 37);
144 vector_foo_struct_scalars:[ScalarSweepStruct] (id: 38);
Brian Silverman5c710412021-02-09 19:09:32 -0800145
James Kuszmaul768c4682023-10-12 21:07:16 -0700146 foo_enum_nonconsecutive:NonConsecutive (id: 39);
147 foo_enum_nonconsecutive_default:NonConsecutive = Big (id: 40);
Austin Schuh3e95e5d2019-09-20 00:08:54 -0700148}
149
150root_type Configuration;