mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-28 17:19:34 +08:00
Switch to vformat_to
Drive-by: reduce the amount of occurences of #ifdef SPDLOG_USE_STD_FORMAT
This commit is contained in:
@@ -3,17 +3,14 @@
|
||||
#include "spdlog/details/fmt_helper.h"
|
||||
|
||||
using spdlog::memory_buf_t;
|
||||
using spdlog::details::fmt_helper::to_string_view;
|
||||
|
||||
void test_pad2(int n, const char *expected)
|
||||
{
|
||||
memory_buf_t buf;
|
||||
spdlog::details::fmt_helper::pad2(n, buf);
|
||||
|
||||
#ifdef SPDLOG_USE_STD_FORMAT
|
||||
REQUIRE(buf == expected);
|
||||
#else
|
||||
REQUIRE(fmt::to_string(buf) == expected);
|
||||
#endif
|
||||
REQUIRE(to_string_view(buf) == expected);
|
||||
}
|
||||
|
||||
void test_pad3(uint32_t n, const char *expected)
|
||||
@@ -21,11 +18,7 @@ void test_pad3(uint32_t n, const char *expected)
|
||||
memory_buf_t buf;
|
||||
spdlog::details::fmt_helper::pad3(n, buf);
|
||||
|
||||
#ifdef SPDLOG_USE_STD_FORMAT
|
||||
REQUIRE(buf == expected);
|
||||
#else
|
||||
REQUIRE(fmt::to_string(buf) == expected);
|
||||
#endif
|
||||
REQUIRE(to_string_view(buf) == expected);
|
||||
}
|
||||
|
||||
void test_pad6(std::size_t n, const char *expected)
|
||||
@@ -33,11 +26,7 @@ void test_pad6(std::size_t n, const char *expected)
|
||||
memory_buf_t buf;
|
||||
spdlog::details::fmt_helper::pad6(n, buf);
|
||||
|
||||
#ifdef SPDLOG_USE_STD_FORMAT
|
||||
REQUIRE(buf == expected);
|
||||
#else
|
||||
REQUIRE(fmt::to_string(buf) == expected);
|
||||
#endif
|
||||
REQUIRE(to_string_view(buf) == expected);
|
||||
}
|
||||
|
||||
void test_pad9(std::size_t n, const char *expected)
|
||||
@@ -45,11 +34,7 @@ void test_pad9(std::size_t n, const char *expected)
|
||||
memory_buf_t buf;
|
||||
spdlog::details::fmt_helper::pad9(n, buf);
|
||||
|
||||
#ifdef SPDLOG_USE_STD_FORMAT
|
||||
REQUIRE(buf == expected);
|
||||
#else
|
||||
REQUIRE(fmt::to_string(buf) == expected);
|
||||
#endif
|
||||
REQUIRE(to_string_view(buf) == expected);
|
||||
}
|
||||
|
||||
TEST_CASE("pad2", "[fmt_helper]")
|
||||
|
Reference in New Issue
Block a user