Austin Schuh | 3e95e5d | 2019-09-20 00:08:54 -0700 | [diff] [blame] | 1 | namespace aos.testing; |
| 2 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 3 | enum 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 | |
Austin Schuh | 3e95e5d | 2019-09-20 00:08:54 -0700 | [diff] [blame] | 24 | table Location { |
| 25 | name:string; |
| 26 | type:string; |
| 27 | frequency:int; |
| 28 | max_size:int; |
| 29 | } |
| 30 | |
| 31 | table Map { |
| 32 | match:Location; |
| 33 | rename:Location; |
| 34 | } |
| 35 | |
| 36 | table Application { |
| 37 | name:string; |
Austin Schuh | 09d7ffa | 2019-10-03 23:43:34 -0700 | [diff] [blame] | 38 | priority:int; |
Austin Schuh | 3e95e5d | 2019-09-20 00:08:54 -0700 | [diff] [blame] | 39 | maps:[Map]; |
| 40 | } |
| 41 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 42 | table VectorOfStrings { |
| 43 | str:[string]; |
| 44 | } |
| 45 | |
| 46 | table VectorOfVectorOfString { |
| 47 | v:[VectorOfStrings]; |
| 48 | } |
| 49 | |
Tyler Chatow | 5e369a4 | 2019-11-23 11:57:31 -0800 | [diff] [blame] | 50 | struct FooStructNested { |
| 51 | foo_byte:byte; |
| 52 | } |
| 53 | |
| 54 | struct FooStruct { |
| 55 | foo_byte:byte; |
| 56 | nested_struct:FooStructNested; |
| 57 | } |
| 58 | |
| 59 | struct StructEnum { |
| 60 | foo_enum:BaseType; |
| 61 | } |
| 62 | |
Austin Schuh | 3e95e5d | 2019-09-20 00:08:54 -0700 | [diff] [blame] | 63 | table Configuration { |
| 64 | locations:[Location] (id: 0); |
| 65 | maps:[Map] (id: 1); |
Austin Schuh | 09d7ffa | 2019-10-03 23:43:34 -0700 | [diff] [blame] | 66 | apps:[Application] (id: 2); |
Austin Schuh | 3e95e5d | 2019-09-20 00:08:54 -0700 | [diff] [blame] | 67 | imports:[string] (id: 3); |
| 68 | |
| 69 | // 8 bit: byte ubyte bool |
| 70 | // 16 bit: short ushort |
| 71 | // 32 bit: int uint float |
| 72 | // 64 bit: long ulong double |
| 73 | |
| 74 | // Simple values. |
| 75 | foo_byte:byte (id: 4); |
| 76 | foo_ubyte:ubyte (id: 5); |
| 77 | foo_bool:bool (id: 6); |
| 78 | |
| 79 | foo_short:short (id: 7); |
| 80 | foo_ushort:ushort (id: 8); |
| 81 | |
| 82 | foo_int:int (id: 9); |
| 83 | foo_uint:uint (id: 10); |
| 84 | |
| 85 | foo_long:long (id: 11); |
| 86 | foo_ulong:ulong (id: 12); |
| 87 | |
| 88 | foo_float:float (id: 13); |
| 89 | foo_double:double (id: 14); |
| 90 | |
| 91 | foo_string:string (id: 15); |
| 92 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 93 | foo_enum:BaseType (id: 16); |
| 94 | foo_enum_default:BaseType = None (id: 17); |
| 95 | |
Austin Schuh | 3e95e5d | 2019-09-20 00:08:54 -0700 | [diff] [blame] | 96 | // Test vectors now. |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 97 | vector_foo_byte:[byte] (id: 18); |
| 98 | vector_foo_ubyte:[ubyte] (id: 19); |
| 99 | vector_foo_bool:[bool] (id: 20); |
Austin Schuh | 3e95e5d | 2019-09-20 00:08:54 -0700 | [diff] [blame] | 100 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 101 | vector_foo_short:[short] (id: 21); |
| 102 | vector_foo_ushort:[ushort] (id: 22); |
Austin Schuh | 3e95e5d | 2019-09-20 00:08:54 -0700 | [diff] [blame] | 103 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 104 | vector_foo_int:[int] (id: 23); |
| 105 | vector_foo_uint:[uint] (id: 24); |
Austin Schuh | 3e95e5d | 2019-09-20 00:08:54 -0700 | [diff] [blame] | 106 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 107 | vector_foo_long:[long] (id: 25); |
| 108 | vector_foo_ulong:[ulong] (id: 26); |
Austin Schuh | 3e95e5d | 2019-09-20 00:08:54 -0700 | [diff] [blame] | 109 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 110 | vector_foo_float:[float] (id: 27); |
| 111 | vector_foo_double:[double] (id: 28); |
Austin Schuh | 3e95e5d | 2019-09-20 00:08:54 -0700 | [diff] [blame] | 112 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 113 | vector_foo_string:[string] (id: 29); |
| 114 | |
| 115 | vector_foo_enum:[BaseType] (id: 30); |
Austin Schuh | 3e95e5d | 2019-09-20 00:08:54 -0700 | [diff] [blame] | 116 | |
| 117 | // And a simple nested application. |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 118 | single_application:Application (id: 31); |
Austin Schuh | 09d7ffa | 2019-10-03 23:43:34 -0700 | [diff] [blame] | 119 | |
| 120 | // And nest this object to get some crazy coverage. |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 121 | nested_config:Configuration (id: 32); |
| 122 | |
| 123 | vov:VectorOfVectorOfString (id: 33); |
Tyler Chatow | 5e369a4 | 2019-11-23 11:57:31 -0800 | [diff] [blame] | 124 | |
| 125 | foo_struct:FooStruct (id: 34); |
| 126 | vector_foo_struct:[FooStruct] (id: 35); |
| 127 | foo_struct_enum:StructEnum (id: 36); |
Austin Schuh | 3e95e5d | 2019-09-20 00:08:54 -0700 | [diff] [blame] | 128 | } |
| 129 | |
| 130 | root_type Configuration; |