| 146 | } |
| 147 | static bool pc_text(const char *a, const char *b) { return a && b && strcmp(a, b) == 0; } |
| 148 | static bool pc_role(const cbm_node_t *n, const char *role) { |
| 149 | if (!n || !n->properties_json) return false; |
| 150 | yyjson_doc *doc = yyjson_read(n->properties_json, strlen(n->properties_json), 0); |
| 151 | yyjson_val *root = doc ? yyjson_doc_get_root(doc) : NULL; |
| 152 | yyjson_val *value = yyjson_is_obj(root) ? yyjson_obj_get(root, "test_role") : NULL; |
| 153 | bool ok = yyjson_is_obj(root) && (role ? yyjson_is_str(value) && |
| 154 | pc_text(yyjson_get_str(value), role) : value == NULL); |
| 155 | yyjson_doc_free(doc); |
| 156 | return ok; |
| 157 | } |
| 158 | static bool pc_node(cbm_store_t *s, const char *qn, const char *name, const char *file, |
| 159 | const char *role, cbm_node_t *out) { |
| 160 | memset(out, 0, sizeof(*out)); |
no test coverage detected