int ec_test_check_parse(struct ec_node *tk, int expected, ...)
{
- struct ec_parse *p;
+ struct ec_pnode *p;
struct ec_strvec *vec = NULL;
const char *s;
int ret = -1, match;
goto out;
for (s = va_arg(ap, const char *);
- s != EC_NODE_ENDLIST;
+ s != EC_VA_END;
s = va_arg(ap, const char *)) {
if (s == NULL)
goto out;
goto out;
}
- p = ec_node_parse_strvec(tk, vec);
+ p = ec_parse_strvec(tk, vec);
if (p == NULL) {
EC_LOG(EC_LOG_ERR, "parse is NULL\n");
}
- if (ec_parse_matches(p))
- match = ec_parse_len(p);
+ if (ec_pnode_matches(p))
+ match = ec_pnode_len(p);
else
match = -1;
if (expected == match) {
match, expected);
}
- ec_parse_free(p);
+ ec_pnode_free(p);
out:
ec_strvec_free(vec);
struct ec_strvec *vec = NULL;
const char *s;
int ret = 0;
- unsigned int count = 0;
+ size_t count = 0;
va_list ap;
va_start(ap, type);
goto out;
for (s = va_arg(ap, const char *);
- s != EC_NODE_ENDLIST;
+ s != EC_VA_END;
s = va_arg(ap, const char *)) {
if (s == NULL)
goto out;
goto out;
}
- c = ec_node_complete_strvec(tk, vec);
+ c = ec_complete_strvec(tk, vec);
if (c == NULL) {
ret = -1;
goto out;
/* for each expected completion, check it is there */
for (s = va_arg(ap, const char *);
- s != EC_NODE_ENDLIST;
+ s != EC_VA_END;
s = va_arg(ap, const char *)) {
- struct ec_comp_iter *iter;
- const struct ec_comp_item *item;
+ struct ec_comp_item *item;
if (s == NULL) {
ret = -1;
count++;
/* only check matching completions */
- iter = ec_comp_iter(c, type);
- while ((item = ec_comp_iter_next(iter)) != NULL) {
+ EC_COMP_FOREACH(item, c, type) {
const char *str = ec_comp_item_get_str(item);
if (str != NULL && strcmp(str, s) == 0)
break;
"completion <%s> not in list\n", s);
ret = -1;
}
- ec_comp_iter_free(iter);
}
/* check if we have more completions (or less) than expected */
if (count != ec_comp_count(c, type)) {
EC_LOG(EC_LOG_ERR,
- "nb_completion (%d) does not match (%d)\n",
+ "nb_completion (%zu) does not match (%zu)\n",
count, ec_comp_count(c, type));
ec_comp_dump(stdout, c);
ret = -1;