X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fforeach%2Ftest%2Frun-nested.c;h=aa20437ec443e643f275502e31d70d544ffeec20;hp=17fa2f16667c5cc881b00aa21f7c8dbf2b478e00;hb=42b45378bfcc8db48e8811a114201c7a41c21420;hpb=dfe310e715cd4c33ada106007d8ae1242d9c7e94 diff --git a/ccan/foreach/test/run-nested.c b/ccan/foreach/test/run-nested.c index 17fa2f16..aa20437e 100644 --- a/ccan/foreach/test/run-nested.c +++ b/ccan/foreach/test/run-nested.c @@ -44,10 +44,10 @@ static int count_iters(void) int main(void) { - int i, j, sum; + int i, j, sum, max_iters; const char *istr, *jstr; - plan_tests(16); + plan_tests(13); sum = 0; foreach_int(i, 0, 1, 2, 3, 4) @@ -93,13 +93,15 @@ int main(void) diag("sum = %i\n", sum); diag("iters = %i\n", count_iters()); ok1(sum == 160); - ok1(count_iters() <= 2 + 2 + 5); /* 5 is max depth of recursion. */ sum = test_ptr_recursion("0"); diag("sum = %i\n", sum); diag("iters = %i\n", count_iters()); ok1(sum == 160); - ok1(count_iters() <= 2 + 2 + 5); + if (i == 0) + max_iters = count_iters(); + else + ok1(count_iters() <= max_iters); } return exit_status(); }