From 51dc1d7469cecd7532f28275cbb5f4fae51ce274 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Thu, 3 Oct 2024 11:54:40 +0200 Subject: [PATCH] fix: according to ISO 80000-16 `%` should always be prefixed with space --- src/core/include/mp-units/framework/unit.h | 4 ---- test/runtime/fmt_test.cpp | 4 +--- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/core/include/mp-units/framework/unit.h b/src/core/include/mp-units/framework/unit.h index 1a8a69c7..e2140b06 100644 --- a/src/core/include/mp-units/framework/unit.h +++ b/src/core/include/mp-units/framework/unit.h @@ -756,10 +756,6 @@ constexpr bool space_before_unit_symbol = true; template<> MP_UNITS_INLINE constexpr bool space_before_unit_symbol = false; -template<> -MP_UNITS_INLINE constexpr bool space_before_unit_symbol = false; -template<> -MP_UNITS_INLINE constexpr bool space_before_unit_symbol = false; // get_unit_symbol diff --git a/test/runtime/fmt_test.cpp b/test/runtime/fmt_test.cpp index 5cf76786..a299d14a 100644 --- a/test/runtime/fmt_test.cpp +++ b/test/runtime/fmt_test.cpp @@ -252,9 +252,7 @@ TEST_CASE("operator<< on a quantity", "[text][ostream][fmt]") constexpr auto q = value_cast(15. * isq::length[m] / (100. * isq::length[m])); os << q; - static_assert(!space_before_unit_symbol); - - SECTION("iostream") { CHECK(os.str() == "15%"); } + SECTION("iostream") { CHECK(os.str() == "15 %"); } SECTION("fmt with default format {} on a quantity") { CHECK(MP_UNITS_STD_FMT::format("{}", q) == os.str()); }