Skip to content

Commit

Permalink
add ut for easylog severity (#442)
Browse files Browse the repository at this point in the history
  • Loading branch information
qicosmos authored Sep 4, 2023
1 parent 990069e commit d16f0d6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/easylog/tests/test_easylog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ std::string get_last_line(const std::string& filename) {
return last_line;
}

TEST_CASE("test severity") {
CHECK(easylog::severity_str(easylog::Severity::WARN) ==
easylog::severity_str(easylog::Severity::WARNING));
CHECK(easylog::severity_str(easylog::Severity::CRITICAL) ==
easylog::severity_str(easylog::Severity::FATAL));
}

TEST_CASE("test basic") {
std::string filename = "easylog.txt";
std::filesystem::remove(filename);
Expand Down Expand Up @@ -88,7 +95,9 @@ TEST_CASE("test basic") {
std::string::npos);

ELOG(WARN) << "warn";
CHECK(get_last_line(filename).find("WARNING") != std::string::npos);
ELOG(WARNING) << "warning";
CHECK(get_last_line(filename).find("WARNING") != std::string::npos);

ELOG(INFO) << "test log";
easylog::flush();
Expand Down

0 comments on commit d16f0d6

Please sign in to comment.