From de6ed8df8b270e3d158d5550823ede30a6d90939 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Fri, 26 Jul 2024 12:09:47 -0700 Subject: [PATCH] Test alignment --- test/format-test.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/format-test.cc b/test/format-test.cc index 0c9cba61..a018b9f7 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -471,6 +471,12 @@ TEST(memory_buffer_test, max_size_allocator_overflow) { EXPECT_THROW(buffer.resize(161), std::exception); } +TEST(format_test, digits2_alignment) { + auto p = + fmt::detail::bit_cast(fmt::detail::digits2(0)); + EXPECT_EQ(p % 2, 0); +} + TEST(format_test, exception_from_lib) { EXPECT_THROW_MSG(fmt::report_error("test"), format_error, "test"); } @@ -1066,7 +1072,7 @@ TEST(format_test, precision) { EXPECT_EQ(fmt::format("{0:.6}", "123456\xad"), "123456"); } -TEST(xchar_test, utf8_precision) { +TEST(format_test, utf8_precision) { auto result = fmt::format("{:.4}", "caf\u00e9s"); // cafés EXPECT_EQ(fmt::detail::compute_width(result), 4); EXPECT_EQ(result, "caf\u00e9");