| 479 | } |
| 480 | |
| 481 | static bool test_plan_hook_contains(yyjson_val *root, const char *agent, const char *path) { |
| 482 | yyjson_val *items = root ? yyjson_obj_get(root, "hooks_planned") : NULL; |
| 483 | if (!items || !yyjson_is_arr(items)) { |
| 484 | return false; |
| 485 | } |
| 486 | size_t index; |
| 487 | size_t count; |
| 488 | yyjson_val *item; |
| 489 | yyjson_arr_foreach(items, index, count, item) { |
| 490 | yyjson_val *agent_value = yyjson_obj_get(item, "agent"); |
| 491 | yyjson_val *path_value = yyjson_obj_get(item, "path"); |
| 492 | const char *planned_agent = |
| 493 | agent_value && yyjson_is_str(agent_value) ? yyjson_get_str(agent_value) : NULL; |
| 494 | const char *planned_path = |
| 495 | path_value && yyjson_is_str(path_value) ? yyjson_get_str(path_value) : NULL; |
| 496 | if (planned_agent && planned_path && strcmp(planned_agent, agent) == 0 && |
| 497 | strcmp(planned_path, path) == 0) { |
| 498 | return true; |
| 499 | } |
| 500 | } |
| 501 | return false; |
| 502 | } |
| 503 | |
| 504 | static bool test_plan_has_hook_for_agent(yyjson_val *root, const char *agent) { |
| 505 | yyjson_val *items = root ? yyjson_obj_get(root, "hooks_planned") : NULL; |