求救:下面的程序怎么做单元测试? 大侠帮忙
被测函数如下:int HPTtmr_init(unsigned int ms_per_tick)
{
int err;
cbP = malloc(sizeof(t_wheel_cb));
if (cbP == NULL)
{
FPRINTF(ERR_COM_NO_MEM, ERR_CLASS_RECOV,
(BUF, "HPTtmr_init: no memory for wheel")); //FPRINTF为定义的宏
return FAILURE;
}
memset(cbP, 0, sizeof(t_wheel_cb));
cbP->ms_per_tick = ms_per_tick;
/* Register Help and Command procedures with the system debug dispatcher */
if ((err = dbg_link(HPT_TIMER_SHORT_NAME, HPTtmr_dbg_help, HPTtmr_dbg_cmd) != 0))
{
FPRINTF(ERR_COM_UNEXP_COND, ERR_CLASS_RECOV,
(BUF, "HPTtmr_init: dbg_link failed: err %d", err));
}
return SUCCESS;
}
如果想在测试程序中查看cbP->ms_per_tick的值,又应该怎么办呢? 本人新手,给说说思路也好,谢谢啦~ gdb 进去debug 没人回答,哎!天网哪里去了?
页:
[1]