[components/utilities/utest] 完善代码,增加注释

Signed-off-by: MurphyZhao <d2014zjt@163.com>
This commit is contained in:
MurphyZhao
2018-12-06 18:58:23 +08:00
parent 8824b2ca77
commit 51b17a15e4
3 changed files with 158 additions and 9 deletions

View File

@@ -125,28 +125,45 @@ static void utest_run(const char *utest_name)
continue;
}
LOG_I("[----------] [ testcase ] (%s) started", tc_table[i].name);
if (tc_table[i].init != RT_NULL)
{
tc_table[i].init();
if (tc_table[i].init() != RT_EOK)
{
LOG_I("[ FAILED ] [ result ] testcase (%s)", tc_table[i].name);
goto __tc_continue;
}
}
LOG_I("[----------] [ testcase ] (%s) started", tc_table[i].name);
tc_table[i].tc();
if (local_utest.failed_num == 0)
if (tc_table[i].tc != RT_NULL)
{
LOG_I("[ PASSED ] [ result ] testcase (%s)", tc_table[i].name);
tc_table[i].tc();
if (local_utest.failed_num == 0)
{
LOG_I("[ PASSED ] [ result ] testcase (%s)", tc_table[i].name);
}
else
{
LOG_I("[ FAILED ] [ result ] testcase (%s)", tc_table[i].name);
}
}
else
{
LOG_I("[ FAILED ] [ result ] testcase (%s)", tc_table[i].name);
}
LOG_I("[----------] [ testcase ] (%s) finished", tc_table[i].name);
if (tc_table[i].cleanup != RT_NULL)
{
tc_table[i].cleanup();
if (tc_table[i].cleanup() != RT_EOK)
{
LOG_I("[ FAILED ] [ result ] testcase (%s)", tc_table[i].name);
goto __tc_continue;
}
}
__tc_continue:
LOG_I("[----------] [ testcase ] (%s) finished", tc_table[i].name);
i++;
}
LOG_I("[==========] [ utest ] finished");
@@ -184,7 +201,11 @@ void utest_unit_run(test_unit_func func, const char *unit_func_name)
local_utest.error = UTEST_PASSED;
local_utest.passed_num = 0;
local_utest.failed_num = 0;
func();
if (func != RT_NULL)
{
func();
}
}
void utest_assert(int value, const char *file, int line, const char *func, const char *msg)