mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-31 19:04:27 +02:00
fix: according to ISO 80000-16 %
should always be prefixed with space
This commit is contained in:
@@ -756,10 +756,6 @@ constexpr bool space_before_unit_symbol = true;
|
|||||||
|
|
||||||
template<>
|
template<>
|
||||||
MP_UNITS_INLINE constexpr bool space_before_unit_symbol<one> = false;
|
MP_UNITS_INLINE constexpr bool space_before_unit_symbol<one> = false;
|
||||||
template<>
|
|
||||||
MP_UNITS_INLINE constexpr bool space_before_unit_symbol<percent> = false;
|
|
||||||
template<>
|
|
||||||
MP_UNITS_INLINE constexpr bool space_before_unit_symbol<per_mille> = false;
|
|
||||||
|
|
||||||
// get_unit_symbol
|
// get_unit_symbol
|
||||||
|
|
||||||
|
@@ -252,9 +252,7 @@ TEST_CASE("operator<< on a quantity", "[text][ostream][fmt]")
|
|||||||
constexpr auto q = value_cast<percent>(15. * isq::length[m] / (100. * isq::length[m]));
|
constexpr auto q = value_cast<percent>(15. * isq::length[m] / (100. * isq::length[m]));
|
||||||
os << q;
|
os << q;
|
||||||
|
|
||||||
static_assert(!space_before_unit_symbol<get_unit(q.reference)>);
|
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()); }
|
SECTION("fmt with default format {} on a quantity") { CHECK(MP_UNITS_STD_FMT::format("{}", q) == os.str()); }
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user