MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / utest_assert

Function utest_assert

components/utilities/utest/utest.c:444–467  ·  view source on GitHub ↗

* utest_assert - assert function * * @param value - assert value * @param file - file name * @param line - line number * @param func - function name * @param msg - assert message * * @return - RT_TRUE: assert success; RT_FALSE: assert failed */

Source from the content-addressed store, hash-verified

442* @return - RT_TRUE: assert success; RT_FALSE: assert failed
443*/
444rt_bool_t utest_assert(int value, const char *file, int line, const char *func, const char *msg)
445{
446 rt_bool_t rst = RT_FALSE;
447
448 if (!(value))
449 {
450 local_utest.error = UTEST_FAILED;
451 local_utest.failed_num ++;
452 LOG_E("[ ASSERT ] [ unit ] at (%s); func: (%s:%d); msg: (%s)", file_basename(file), func, line, msg);
453 rst = RT_FALSE;
454 }
455 else
456 {
457 if (utest_log_lv == UTEST_LOG_ALL)
458 {
459 LOG_D("[ OK ] [ unit ] (%s:%d) is passed", func, line);
460 }
461 local_utest.error = UTEST_PASSED;
462 local_utest.passed_num ++;
463 rst = RT_TRUE;
464 }
465
466 return rst;
467}
468
469void utest_assert_string(const char *a, const char *b, rt_bool_t equal, const char *file, int line, const char *func, const char *msg)
470{

Callers 2

utest_assert_stringFunction · 0.85
utest_assert_bufFunction · 0.85

Calls 1

file_basenameFunction · 0.85

Tested by

no test coverage detected