X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftimer%2Ftest%2Frun-ff.c;h=49c6e3744c1e3e9991e9fea9db09f5ac2f3decdd;hb=c951c9d9d730ee021eb76e7d87301b0634e0147d;hp=0f398d55721075aa21182994c05edbb812245bab;hpb=daf9ee7d8e2b683ff05283beb1843611ad8c9e8a;p=ccan diff --git a/ccan/timer/test/run-ff.c b/ccan/timer/test/run-ff.c index 0f398d55..49c6e374 100644 --- a/ccan/timer/test/run-ff.c +++ b/ccan/timer/test/run-ff.c @@ -12,20 +12,18 @@ static struct timeabs timeabs_from_usec(unsigned long long usec) int main(void) { struct timers timers; - struct timer t; - struct list_head expired; + struct timer t, *expired; /* This is how many tests you plan to run */ plan_tests(3); timers_init(&timers, timeabs_from_usec(1364726722653919ULL)); + timer_init(&t); timer_add(&timers, &t, timeabs_from_usec(1364726722703919ULL)); - timers_expire(&timers, timeabs_from_usec(1364726722653920ULL), &expired); - ok1(list_empty(&expired)); - timers_expire(&timers, timeabs_from_usec(1364726725454187ULL), &expired); - ok1(!list_empty(&expired)); - ok1(list_top(&expired, struct timer, list) == &t); - + ok1(!timers_expire(&timers, timeabs_from_usec(1364726722653920ULL))); + expired = timers_expire(&timers, timeabs_from_usec(1364726725454187ULL)); + ok1(expired == &t); + ok1(!timers_expire(&timers, timeabs_from_usec(1364726725454187ULL))); timers_cleanup(&timers); /* This exits depending on whether all tests passed */