fixed tests and renamed to_short_str
This commit is contained in:
parent
1d9e2304be
commit
95de24e4f6
@ -99,7 +99,7 @@ inline const char *to_c_str(spdlog::level::level_enum l)
|
||||
return level_names[l];
|
||||
}
|
||||
|
||||
inline const char *to_short_str(spdlog::level::level_enum l)
|
||||
inline const char *to_short_c_str(spdlog::level::level_enum l)
|
||||
{
|
||||
return short_level_names[l];
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ class short_level_formatter : public flag_formatter
|
||||
{
|
||||
void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
|
||||
{
|
||||
fmt_helper::append_c_str(level::to_short_str(msg.level), dest);
|
||||
fmt_helper::append_c_str(level::to_short_c_str(msg.level), dest);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -42,26 +42,26 @@ TEST_CASE("log_levels", "[log_levels]")
|
||||
REQUIRE(log_info("Hello", spdlog::level::trace) == "Hello");
|
||||
}
|
||||
|
||||
TEST_CASE("to_str", "[convert_to_str]")
|
||||
TEST_CASE("to_c_str", "[convert_to_c_str]")
|
||||
{
|
||||
REQUIRE(std::string(spdlog::level::to_str(spdlog::level::trace)) == "trace");
|
||||
REQUIRE(std::string(spdlog::level::to_str(spdlog::level::debug)) == "debug");
|
||||
REQUIRE(std::string(spdlog::level::to_str(spdlog::level::info)) == "info");
|
||||
REQUIRE(std::string(spdlog::level::to_str(spdlog::level::warn)) == "warning");
|
||||
REQUIRE(std::string(spdlog::level::to_str(spdlog::level::err)) == "error");
|
||||
REQUIRE(std::string(spdlog::level::to_str(spdlog::level::critical)) == "critical");
|
||||
REQUIRE(std::string(spdlog::level::to_str(spdlog::level::off)) == "off");
|
||||
REQUIRE(std::string(spdlog::level::to_c_str(spdlog::level::trace)) == "trace");
|
||||
REQUIRE(std::string(spdlog::level::to_c_str(spdlog::level::debug)) == "debug");
|
||||
REQUIRE(std::string(spdlog::level::to_c_str(spdlog::level::info)) == "info");
|
||||
REQUIRE(std::string(spdlog::level::to_c_str(spdlog::level::warn)) == "warning");
|
||||
REQUIRE(std::string(spdlog::level::to_c_str(spdlog::level::err)) == "error");
|
||||
REQUIRE(std::string(spdlog::level::to_c_str(spdlog::level::critical)) == "critical");
|
||||
REQUIRE(std::string(spdlog::level::to_c_str(spdlog::level::off)) == "off");
|
||||
}
|
||||
|
||||
TEST_CASE("to_short_str", "[convert_to_short_str]")
|
||||
TEST_CASE("to_short_c_str", "[convert_to_short_c_str]")
|
||||
{
|
||||
REQUIRE(std::string(spdlog::level::to_short_str(spdlog::level::trace)) == "T");
|
||||
REQUIRE(std::string(spdlog::level::to_short_str(spdlog::level::debug)) == "D");
|
||||
REQUIRE(std::string(spdlog::level::to_short_str(spdlog::level::info)) == "I");
|
||||
REQUIRE(std::string(spdlog::level::to_short_str(spdlog::level::warn)) == "W");
|
||||
REQUIRE(std::string(spdlog::level::to_short_str(spdlog::level::err)) == "E");
|
||||
REQUIRE(std::string(spdlog::level::to_short_str(spdlog::level::critical)) == "C");
|
||||
REQUIRE(std::string(spdlog::level::to_short_str(spdlog::level::off)) == "O");
|
||||
REQUIRE(std::string(spdlog::level::to_short_c_str(spdlog::level::trace)) == "T");
|
||||
REQUIRE(std::string(spdlog::level::to_short_c_str(spdlog::level::debug)) == "D");
|
||||
REQUIRE(std::string(spdlog::level::to_short_c_str(spdlog::level::info)) == "I");
|
||||
REQUIRE(std::string(spdlog::level::to_short_c_str(spdlog::level::warn)) == "W");
|
||||
REQUIRE(std::string(spdlog::level::to_short_c_str(spdlog::level::err)) == "E");
|
||||
REQUIRE(std::string(spdlog::level::to_short_c_str(spdlog::level::critical)) == "C");
|
||||
REQUIRE(std::string(spdlog::level::to_short_c_str(spdlog::level::off)) == "O");
|
||||
}
|
||||
|
||||
TEST_CASE("to_level_enum", "[convert_to_level_enum]")
|
||||
|
Loading…
Reference in New Issue
Block a user