| 18709 | } |
| 18710 | |
| 18711 | static bool compare_set_has(const yyjson_val *set, uint64_t total, uint64_t returned, |
| 18712 | bool truncated, const char *reason) { |
| 18713 | if (!set || !yyjson_is_obj(set)) { |
| 18714 | return false; |
| 18715 | } |
| 18716 | yyjson_val *items = yyjson_obj_get(set, "items"); |
| 18717 | yyjson_val *reasons = yyjson_obj_get(set, "truncation_reasons"); |
| 18718 | return items && yyjson_is_arr(items) && yyjson_arr_size(items) == returned && reasons && |
| 18719 | yyjson_is_arr(reasons) && yyjson_get_uint(yyjson_obj_get(set, "total")) == total && |
| 18720 | yyjson_get_uint(yyjson_obj_get(set, "returned")) == returned && |
| 18721 | yyjson_get_bool(yyjson_obj_get(set, "truncated")) == truncated && |
| 18722 | ((!reason && yyjson_arr_size(reasons) == 0) || |
| 18723 | (reason && yyjson_arr_size(reasons) == 1 && |
| 18724 | strcmp(yyjson_get_str(yyjson_arr_get(reasons, 0)), reason) == 0)); |
| 18725 | } |
| 18726 | |
| 18727 | TEST(tool_compare_graphs_streams_stable_deltas_issue525) { |
| 18728 | compare_graphs_fixture_t fixture; |