mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-31 19:04:27 +02:00
feat: do not print space between a number and percent
or per_mille
This commit is contained in:
@@ -836,6 +836,11 @@ constexpr Out unit_symbol_impl(Out out, const derived_unit<Expr...>&, unit_symbo
|
|||||||
template<Unit auto U>
|
template<Unit auto U>
|
||||||
inline constexpr bool space_before_unit_symbol = true;
|
inline constexpr bool space_before_unit_symbol = true;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
inline constexpr bool space_before_unit_symbol<percent> = false;
|
||||||
|
template<>
|
||||||
|
inline constexpr bool space_before_unit_symbol<per_mille> = false;
|
||||||
|
|
||||||
template<typename CharT = char, std::output_iterator<CharT> Out, Unit U>
|
template<typename CharT = char, std::output_iterator<CharT> Out, Unit U>
|
||||||
constexpr Out unit_symbol_to(Out out, U u, unit_symbol_formatting fmt = unit_symbol_formatting{})
|
constexpr Out unit_symbol_to(Out out, U u, unit_symbol_formatting fmt = unit_symbol_formatting{})
|
||||||
{
|
{
|
||||||
|
@@ -237,7 +237,7 @@ TEST_CASE("operator<< on a quantity", "[text][ostream][fmt]")
|
|||||||
|
|
||||||
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()); }
|
||||||
|
|
||||||
SECTION("fmt with format {:%Q %q} on a quantity") { CHECK(MP_UNITS_STD_FMT::format("{:%Q %q}", q) == os.str()); }
|
SECTION("fmt with format {:%Q %q} on a quantity") { CHECK(MP_UNITS_STD_FMT::format("{:%Q %q}", q) == "15 %"); }
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("radians")
|
SECTION("radians")
|
||||||
|
Reference in New Issue
Block a user