# HG changeset patch # User Thinker K.F. Li # Date 1290405179 -28800 # Node ID 1a3cc22ee1bdc2f753eba63757ba03e982eeed82 # Parent 7ccc094bdbe50368f27bb224d562a10037e45ce6 Fix testcase of animate.c for mb_timer_man_t diff -r 7ccc094bdbe5 -r 1a3cc22ee1bd include/mb_backend.h --- a/include/mb_backend.h Mon Nov 22 13:15:33 2010 +0800 +++ b/include/mb_backend.h Mon Nov 22 13:52:59 2010 +0800 @@ -140,5 +140,7 @@ (tm_man)->timeout((tm_man), (tmout), (cb), (data)) #define mb_timer_man_remove(tm_man, tm_hdl) \ (tm_man)->remove((tm_man), (tm_hdl)) +#define mb_timer_man_new(tm_fact) (tm_fact)->new() +#define mb_timer_man_free(tm_fact, tm_man) (tm_fact)->free(tm_man) #endif /* __MB_BACKEND_H_ */ diff -r 7ccc094bdbe5 -r 1a3cc22ee1bd include/mb_backend_utils.h --- a/include/mb_backend_utils.h Mon Nov 22 13:15:33 2010 +0800 +++ b/include/mb_backend_utils.h Mon Nov 22 13:52:59 2010 +0800 @@ -7,6 +7,6 @@ /*! \brief A facotry of timer manager implemented with mb_tman_t. */ extern mb_timer_factory_t tman_timer_factory; -extern mb_tman_t * tman_timer_man_get_tman(mb_timer_man_t *tm_man); +extern mb_tman_t *tman_timer_man_get_tman(mb_timer_man_t *tm_man); #endif /* __MB_BACKEND_UTILS_H_ */ diff -r 7ccc094bdbe5 -r 1a3cc22ee1bd src/animate.c --- a/src/animate.c Mon Nov 22 13:15:33 2010 +0800 +++ b/src/animate.c Mon Nov 22 13:52:59 2010 +0800 @@ -377,6 +377,7 @@ #ifdef UNITTEST +#include "mb_backend_utils.h" #include typedef struct _mb_dummy mb_dummy_t; @@ -444,13 +445,16 @@ mb_word_t *word; mb_action_t *acts[4]; mb_timer_man_t *timer_man; + mb_tman_t *tman; mb_timeval_t tv1, tv2, now, tmo_after; int logcnt = 0; int logs[256]; int r; - timer_man = mb_tman_new(); - CU_ASSERT(tman != NULL); + timer_man = mb_timer_man_new(&tman_timer_factory); + CU_ASSERT(timer_man != NULL); + + tman = tman_timer_man_get_tman(timer_man); progm = mb_progm_new(3, NULL); CU_ASSERT(progm != NULL); @@ -477,7 +481,7 @@ CU_ASSERT(acts[2] != NULL); MB_TIMEVAL_SET(&now, 0, 0); - mb_progm_start(progm, tman, &now); + mb_progm_start(progm, timer_man, &now); r = mb_tman_next_timeout(tman, &now, &tmo_after); CU_ASSERT(r == 0); @@ -543,7 +547,7 @@ CU_ASSERT(r == -1); mb_progm_free(progm); - mb_tman_free(tman); + mb_timer_man_free(&tman_timer_factory, timer_man); } CU_pSuite get_animate_suite(void) {