Skip to content

Commit

Permalink
Add unit tests to show tag works
Browse files Browse the repository at this point in the history
Signed-off-by: Charlie Vigue <[email protected]>
  • Loading branch information
cvigue committed Jun 26, 2024
1 parent c7e1dce commit 62c9da1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ add_executable(coreUnitTests
test_route.cpp
test_reliable.cpp
test_splitlines.cpp
test_loggingmixin.cpp
test_statickey.cpp
test_streq.cpp
test_time.cpp
Expand Down
27 changes: 27 additions & 0 deletions test/unittests/test_loggingmixin.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

#include "test_common.h"

#include <openvpn/log/logger.hpp>

using namespace openvpn;
using namespace openvpn::logging;

TEST(LoggingMixin, is_shared)
{
auto lm1 = LoggingMixin<1>();
auto lm2 = LoggingMixin<1>();

EXPECT_EQ(lm1.log_level(), lm2.log_level());
lm1.set_log_level(lm1.log_level() + 1);
EXPECT_EQ(lm1.log_level(), lm2.log_level());
}

TEST(LoggingMixin, is_not_shared)
{
auto lm1 = LoggingMixin<1, 1, int>();
auto lm2 = LoggingMixin<1, 1, float>();

EXPECT_EQ(lm1.log_level(), lm2.log_level());
lm1.set_log_level(lm1.log_level() + 1);
EXPECT_NE(lm1.log_level(), lm2.log_level());
}

0 comments on commit 62c9da1

Please sign in to comment.