Skip to content

Commit 5a1dba5

Browse files
Extend Logs tests caused by formatting changes
Codcov prefers to have patch config to be not lower than the rest of repository. The file has not been formatted properly before so there are changes not related to the censoring Relates-To: NLAM-140 Signed-off-by: Rustam Gamidov <[email protected]>
1 parent fb8b524 commit 5a1dba5

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

olp-cpp-sdk-core/tests/logging/LogTest.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ TEST(LogTest, Levels) {
7373
EXPECT_FALSE(
7474
olp::logging::Log::isEnabled(olp::logging::Level::Debug, "test2"));
7575

76+
olp::logging::Log::clearLevel("");
77+
EXPECT_EQ(olp::logging::Level::Debug, olp::logging::Log::getLevel("test1"));
78+
EXPECT_EQ(olp::porting::none, olp::logging::Log::getLevel("test2"));
79+
EXPECT_TRUE(
80+
olp::logging::Log::isEnabled(olp::logging::Level::Warning, "test2"));
81+
EXPECT_FALSE(
82+
olp::logging::Log::isEnabled(olp::logging::Level::Debug, "test2"));
83+
7684
olp::logging::Log::clearLevels();
7785
EXPECT_EQ(olp::porting::none, olp::logging::Log::getLevel("test1"));
7886
EXPECT_EQ(olp::porting::none, olp::logging::Log::getLevel("test2"));
@@ -662,6 +670,22 @@ TEST(LogTest, LogLevelOff) {
662670
++index;
663671
}
664672

673+
TEST(LogTest, IsEnabled_ReturnsFalse_WhenLogLevelOff_) {
674+
auto appender = std::make_shared<testing::MockAppender>();
675+
olp::logging::Configuration configuration;
676+
configuration.addAppender(appender);
677+
EXPECT_TRUE(olp::logging::Log::configure(configuration));
678+
679+
EXPECT_FALSE(olp::logging::Log::isEnabled(olp::logging::Level::Off));
680+
olp::logging::Log::setLevel(olp::logging::Level::Off);
681+
EXPECT_FALSE(olp::logging::Log::isEnabled(olp::logging::Level::Off));
682+
683+
constexpr auto tag = "random tag";
684+
EXPECT_FALSE(olp::logging::Log::isEnabled(olp::logging::Level::Off, tag));
685+
olp::logging::Log::setLevel(olp::logging::Level::Off, tag);
686+
EXPECT_FALSE(olp::logging::Log::isEnabled(olp::logging::Level::Off, tag));
687+
}
688+
665689
TEST(LogTest, ReConfigure) {
666690
auto appender1 = std::make_shared<testing::MockAppender>();
667691
auto appender2 = std::make_shared<testing::MockAppender>();

0 commit comments

Comments
 (0)