From bad32330d4dc359cf2f84c52572402ad67d62fe1 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Wed, 4 Apr 2018 18:26:46 +0900 Subject: [PATCH] utest: add log tests Change-Id: I8bfe896c183a7bf2c0f6e87720a896ec8fba853e --- src/tbm_log.h | 1 + utests/ut_tbm_log.cpp | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/tbm_log.h b/src/tbm_log.h index c806e02..2d29dd8 100644 --- a/src/tbm_log.h +++ b/src/tbm_log.h @@ -60,6 +60,7 @@ void tbm_log_set_debug_level(int level); void tbm_log_set_assert_level(int level); void tbm_log_set_path(const char *path); void tbm_log_print(int level, const char *fmt, ...); +void tbm_log_print_stdout(int level, const char *fmt, ...); #define TBM_DBG(fmt, args...) \ do { \ diff --git a/utests/ut_tbm_log.cpp b/utests/ut_tbm_log.cpp index 2e76d21..3bc2227 100644 --- a/utests/ut_tbm_log.cpp +++ b/utests/ut_tbm_log.cpp @@ -87,3 +87,19 @@ TEST(TBMLog, logDlogUnknownLevel) tbm_log_print(UT_TBM_INVALID_VALUE, "utest"); } +TEST(TBMLog, logSetAssertLevel) +{ + tbm_log_enable_dlog(1); + tbm_log_set_assert_level(TBM_LOG_LEVEL_ERR); + tbm_log_set_assert_level(TBM_LOG_LEVEL_WRN); + tbm_log_set_assert_level(TBM_LOG_LEVEL_INFO); + tbm_log_set_assert_level(TBM_LOG_LEVEL_DBG); +} + +TEST(TBMLog, logPrintStdout) +{ + tbm_log_print_stdout(TBM_LOG_LEVEL_ERR, "utest"); + tbm_log_print_stdout(TBM_LOG_LEVEL_WRN, "utest"); + tbm_log_print_stdout(TBM_LOG_LEVEL_INFO, "utest"); + tbm_log_print_stdout(TBM_LOG_LEVEL_DBG, "utest"); +} \ No newline at end of file -- 2.7.4