X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Fecoli_test.c;h=1e98c652f4e092ed5f574f087d98efa4a02ad2a4;hb=499318ae3ca1322044b62814bb8891fc26d641fe;hp=fb4b1febf916888d21ec8db43d8f1cff1469aa5a;hpb=139916ef3060ed731bc50ea9b619cc265213588c;p=protos%2Flibecoli.git diff --git a/lib/ecoli_test.c b/lib/ecoli_test.c index fb4b1fe..1e98c65 100644 --- a/lib/ecoli_test.c +++ b/lib/ecoli_test.c @@ -101,7 +101,6 @@ out: int ec_test_check_complete(struct ec_node *tk, ...) { struct ec_completed *c = NULL; - struct ec_completed_item *item; struct ec_strvec *vec = NULL; const char *s, *expected; int ret = 0; @@ -131,17 +130,23 @@ int ec_test_check_complete(struct ec_node *tk, ...) goto out; } + /* for each expected completion, check it is there */ for (s = va_arg(ap, const char *); s != EC_NODE_ENDLIST; s = va_arg(ap, const char *)) { + struct ec_completed_iter *iter; + const struct ec_completed_match *item; + if (s == NULL) { ret = -1; goto out; } count++; - TAILQ_FOREACH(item, &c->items, next) { - /* only check matching completions */ + + /* only check matching completions */ + iter = ec_completed_iter(c, EC_MATCH); + while ((item = ec_completed_iter_next(iter)) != NULL) { if (item->add != NULL && strcmp(item->add, s) == 0) break; } @@ -151,17 +156,20 @@ int ec_test_check_complete(struct ec_node *tk, ...) "completion <%s> not in list\n", s); ret = -1; } + ec_completed_iter_free(iter); } + /* check if we have more completions (or less) than expected */ if (count != ec_completed_count(c, EC_MATCH)) { ec_log(EC_LOG_ERR, "nb_completion (%d) does not match (%d)\n", count, ec_completed_count(c, EC_MATCH)); ec_completed_dump(stdout, c); ret = -1; - } - + } else + ec_completed_dump(stdout, c); //XXX + /* check the expected smallest start */ expected = va_arg(ap, const char *); s = ec_completed_smallest_start(c); if (strcmp(s, expected)) {