X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftimer%2Ftest%2Frun-ff.c;fp=ccan%2Ftimer%2Ftest%2Frun-ff.c;h=c40e3b104d92744587af0ae74a6db9125933ab67;hp=0000000000000000000000000000000000000000;hb=606cca7b0ed5236d1df1c4436ca79db6e3fd5321;hpb=c289035bc960c7316208133cc44bf6f968498613 diff --git a/ccan/timer/test/run-ff.c b/ccan/timer/test/run-ff.c new file mode 100644 index 00000000..c40e3b10 --- /dev/null +++ b/ccan/timer/test/run-ff.c @@ -0,0 +1,27 @@ +#include +/* Include the C files directly. */ +#include +#include + +int main(void) +{ + struct timers timers; + struct timer t; + struct list_head expired; + + /* This is how many tests you plan to run */ + plan_tests(3); + + timers_init(&timers, time_from_usec(1364726722653919ULL)); + timer_add(&timers, &t, time_from_usec(1364726722703919ULL)); + timers_expire(&timers, time_from_usec(1364726722653920ULL), &expired); + ok1(list_empty(&expired)); + timers_expire(&timers, time_from_usec(1364726725454187ULL), &expired); + ok1(!list_empty(&expired)); + ok1(list_top(&expired, struct timer, list) == &t); + + timers_cleanup(&timers); + + /* This exits depending on whether all tests passed */ + return exit_status(); +}