Commit 5199016b by Marcus Winter

base_cpp: fixed codesonar warning

parent f1752cf2
...@@ -56,6 +56,7 @@ void LogTest::Test() { ...@@ -56,6 +56,7 @@ void LogTest::Test() {
logged_message = null; logged_message = null;
Log::Trace("chn", test_msg); Log::Trace("chn", test_msg);
#ifdef EMBB_DEBUG #ifdef EMBB_DEBUG
PT_ASSERT_NE(logged_message, null);
PT_EXPECT(0 == strcmp(logged_message, "[chn] - [TRACE] hello")); PT_EXPECT(0 == strcmp(logged_message, "[chn] - [TRACE] hello"));
#else #else
PT_EXPECT_EQ(null, logged_message); PT_EXPECT_EQ(null, logged_message);
...@@ -63,15 +64,18 @@ void LogTest::Test() { ...@@ -63,15 +64,18 @@ void LogTest::Test() {
logged_message = null; logged_message = null;
Log::Info("chn", test_msg); Log::Info("chn", test_msg);
#ifdef EMBB_DEBUG #ifdef EMBB_DEBUG
PT_ASSERT_NE(logged_message, null);
PT_EXPECT(0 == strcmp(logged_message, "[chn] - [INFO ] hello")); PT_EXPECT(0 == strcmp(logged_message, "[chn] - [INFO ] hello"));
#else #else
PT_EXPECT_EQ(null, logged_message); PT_EXPECT_EQ(null, logged_message);
#endif #endif
logged_message = null; logged_message = null;
Log::Warning("chn", test_msg); Log::Warning("chn", test_msg);
PT_ASSERT_NE(logged_message, null);
PT_EXPECT(0 == strcmp(logged_message, "[chn] - [WARN ] hello")); PT_EXPECT(0 == strcmp(logged_message, "[chn] - [WARN ] hello"));
logged_message = null; logged_message = null;
Log::Error("chn", test_msg); Log::Error("chn", test_msg);
PT_ASSERT_NE(logged_message, null);
PT_EXPECT(0 == strcmp(logged_message, "[chn] - [ERROR] hello")); PT_EXPECT(0 == strcmp(logged_message, "[chn] - [ERROR] hello"));
Log::SetLogLevel(EMBB_LOG_LEVEL_INFO); Log::SetLogLevel(EMBB_LOG_LEVEL_INFO);
...@@ -81,15 +85,18 @@ void LogTest::Test() { ...@@ -81,15 +85,18 @@ void LogTest::Test() {
logged_message = null; logged_message = null;
Log::Info("chn", test_msg); Log::Info("chn", test_msg);
#ifdef EMBB_DEBUG #ifdef EMBB_DEBUG
PT_ASSERT_NE(logged_message, null);
PT_EXPECT(0 == strcmp(logged_message, "[chn] - [INFO ] hello")); PT_EXPECT(0 == strcmp(logged_message, "[chn] - [INFO ] hello"));
#else #else
PT_EXPECT_EQ(null, logged_message); PT_EXPECT_EQ(null, logged_message);
#endif #endif
logged_message = null; logged_message = null;
Log::Warning("chn", test_msg); Log::Warning("chn", test_msg);
PT_ASSERT_NE(logged_message, null);
PT_EXPECT(0 == strcmp(logged_message, "[chn] - [WARN ] hello")); PT_EXPECT(0 == strcmp(logged_message, "[chn] - [WARN ] hello"));
logged_message = null; logged_message = null;
Log::Error("chn", test_msg); Log::Error("chn", test_msg);
PT_ASSERT_NE(logged_message, null);
PT_EXPECT(0 == strcmp(logged_message, "[chn] - [ERROR] hello")); PT_EXPECT(0 == strcmp(logged_message, "[chn] - [ERROR] hello"));
Log::SetLogLevel(EMBB_LOG_LEVEL_WARNING); Log::SetLogLevel(EMBB_LOG_LEVEL_WARNING);
...@@ -101,9 +108,11 @@ void LogTest::Test() { ...@@ -101,9 +108,11 @@ void LogTest::Test() {
PT_EXPECT_EQ(null, logged_message); PT_EXPECT_EQ(null, logged_message);
logged_message = null; logged_message = null;
Log::Warning("chn", test_msg); Log::Warning("chn", test_msg);
PT_ASSERT_NE(logged_message, null);
PT_EXPECT(0 == strcmp(logged_message, "[chn] - [WARN ] hello")); PT_EXPECT(0 == strcmp(logged_message, "[chn] - [WARN ] hello"));
logged_message = null; logged_message = null;
Log::Error("chn", test_msg); Log::Error("chn", test_msg);
PT_ASSERT_NE(logged_message, null);
PT_EXPECT(0 == strcmp(logged_message, "[chn] - [ERROR] hello")); PT_EXPECT(0 == strcmp(logged_message, "[chn] - [ERROR] hello"));
Log::SetLogLevel(EMBB_LOG_LEVEL_ERROR); Log::SetLogLevel(EMBB_LOG_LEVEL_ERROR);
...@@ -118,6 +127,7 @@ void LogTest::Test() { ...@@ -118,6 +127,7 @@ void LogTest::Test() {
PT_EXPECT_EQ(null, logged_message); PT_EXPECT_EQ(null, logged_message);
logged_message = null; logged_message = null;
Log::Error("chn", test_msg); Log::Error("chn", test_msg);
PT_ASSERT_NE(logged_message, null);
PT_EXPECT(0 == strcmp(logged_message, "[chn] - [ERROR] hello")); PT_EXPECT(0 == strcmp(logged_message, "[chn] - [ERROR] hello"));
Log::SetLogLevel(EMBB_LOG_LEVEL_NONE); Log::SetLogLevel(EMBB_LOG_LEVEL_NONE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment