| 147 | } |
| 148 | |
| 149 | static bool td_conventions(cbm_test_declarations_t *declarations, yyjson_val *value) { |
| 150 | if (!yyjson_is_arr(value)) |
| 151 | return false; |
| 152 | size_t count = yyjson_arr_size(value); |
| 153 | if (count > INT_MAX || count > SIZE_MAX / sizeof(*declarations->items)) |
| 154 | return false; |
| 155 | if (!count) |
| 156 | return true; |
| 157 | declarations->items = |
| 158 | cbm_arena_calloc(&declarations->arena, count * sizeof(*declarations->items)); |
| 159 | if (!declarations->items) |
| 160 | return false; |
| 161 | size_t index, maximum; |
| 162 | yyjson_val *record; |
| 163 | yyjson_arr_foreach(value, index, maximum, record) { |
| 164 | if (!td_record(declarations, record, &declarations->items[index])) |
| 165 | return false; |
| 166 | } |
| 167 | declarations->count = (int)count; |
| 168 | return true; |
| 169 | } |
| 170 | |
| 171 | static bool td_presets(cbm_test_declarations_t *declarations, yyjson_val *value) { |
| 172 | static const char *const names[CBM_TEST_PRESET_COUNT] = { |
no test coverage detected