mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-01 03:14:29 +02:00
refactor: 💥 ascii
-> portable
, unicode
-> utf8
, 'A' -> 'P'
This commit is contained in:
@@ -443,7 +443,7 @@ TEST_CASE("Unit formatting should use proper text encoding")
|
||||
CHECK(MP_UNITS_STD_FMT::format("{}", m / s2) == "m/s²");
|
||||
}
|
||||
|
||||
SECTION("ASCII text output")
|
||||
SECTION("Portable text output")
|
||||
{
|
||||
CHECK(MP_UNITS_STD_FMT::format("{:A}", km / h) == "km/h");
|
||||
CHECK(MP_UNITS_STD_FMT::format("{:A}", si::kilo<si::ohm>) == "kohm");
|
||||
@@ -618,7 +618,7 @@ TEST_CASE("more then one modifier of the same kind should throw", "[text][fmt][e
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("half_high_dot separator requested for ASCII encoding should throw", "[text][fmt][exception]")
|
||||
TEST_CASE("half_high_dot separator requested for portable encoding should throw", "[text][fmt][exception]")
|
||||
{
|
||||
REQUIRE_THROWS_MATCHES(MP_UNITS_STD_FMT::vformat("{:dAa}", MP_UNITS_STD_FMT::make_format_args(m)),
|
||||
MP_UNITS_STD_FMT::format_error,
|
||||
@@ -1037,9 +1037,9 @@ TEST_CASE("unit_symbol", "[text]")
|
||||
CHECK(os.str() == "m/s²");
|
||||
}
|
||||
|
||||
SECTION("ASCII mode")
|
||||
SECTION("Portable mode")
|
||||
{
|
||||
os << unit_symbol<unit_symbol_formatting{.encoding = ascii}>(m / s2);
|
||||
os << unit_symbol<unit_symbol_formatting{.encoding = portable}>(m / s2);
|
||||
CHECK(os.str() == "m/s^2");
|
||||
}
|
||||
|
||||
@@ -1068,9 +1068,9 @@ TEST_CASE("dimension_symbol", "[text]")
|
||||
CHECK(os.str() == "L²MT⁻³");
|
||||
}
|
||||
|
||||
SECTION("ASCII mode")
|
||||
SECTION("Portable mode")
|
||||
{
|
||||
os << dimension_symbol<dimension_symbol_formatting{.encoding = ascii}>(isq::power.dimension);
|
||||
os << dimension_symbol<dimension_symbol_formatting{.encoding = portable}>(isq::power.dimension);
|
||||
CHECK(os.str() == "L^2MT^-3");
|
||||
}
|
||||
}
|
||||
|
@@ -39,14 +39,14 @@ static_assert(dimension_symbol(dimension_one) == "1");
|
||||
// base dimensions
|
||||
static_assert(dimension_symbol(isq::dim_length) == "L");
|
||||
static_assert(dimension_symbol(isq::dim_thermodynamic_temperature) == "Θ");
|
||||
static_assert(dimension_symbol<dimension_symbol_formatting{.encoding = ascii}>(isq::dim_thermodynamic_temperature) ==
|
||||
static_assert(dimension_symbol<dimension_symbol_formatting{.encoding = portable}>(isq::dim_thermodynamic_temperature) ==
|
||||
"O");
|
||||
|
||||
// derived dimensions
|
||||
static_assert(dimension_symbol(isq::speed.dimension) == "LT⁻¹");
|
||||
static_assert(dimension_symbol<dimension_symbol_formatting{.encoding = ascii}>(isq::speed.dimension) == "LT^-1");
|
||||
static_assert(dimension_symbol<dimension_symbol_formatting{.encoding = portable}>(isq::speed.dimension) == "LT^-1");
|
||||
static_assert(dimension_symbol(isq::power.dimension) == "L²MT⁻³");
|
||||
static_assert(dimension_symbol<dimension_symbol_formatting{.encoding = ascii}>(isq::power.dimension) == "L^2MT^-3");
|
||||
static_assert(dimension_symbol<dimension_symbol_formatting{.encoding = portable}>(isq::power.dimension) == "L^2MT^-3");
|
||||
|
||||
static_assert(dimension_symbol(pow<123>(isq::dim_length)) == "L¹²³");
|
||||
static_assert(dimension_symbol(pow<1, 2>(isq::dim_length)) == "L^(1/2)");
|
||||
|
@@ -37,26 +37,26 @@ static_assert(sym1 <= 'b');
|
||||
static_assert(sym1 <= 'c');
|
||||
static_assert(sym1 >= 'b');
|
||||
static_assert(sym1 >= 'a');
|
||||
static_assert(sym1.unicode() == u8"b");
|
||||
static_assert(sym1.ascii() == "b");
|
||||
static_assert(sym1.utf8() == u8"b");
|
||||
static_assert(sym1.portable() == "b");
|
||||
|
||||
constexpr symbol_text sym3("ab");
|
||||
static_assert(sym3.unicode() == u8"ab");
|
||||
static_assert(sym3.ascii() == "ab");
|
||||
static_assert(sym3.utf8() == u8"ab");
|
||||
static_assert(sym3.portable() == "ab");
|
||||
|
||||
constexpr basic_fixed_string txt1("bc");
|
||||
constexpr symbol_text sym4(txt1);
|
||||
static_assert(sym4.unicode() == u8"bc");
|
||||
static_assert(sym4.ascii() == "bc");
|
||||
static_assert(sym4.utf8() == u8"bc");
|
||||
static_assert(sym4.portable() == "bc");
|
||||
|
||||
constexpr symbol_text sym5(u8"bc", "de");
|
||||
static_assert(sym5.unicode() == u8"bc");
|
||||
static_assert(sym5.ascii() == "de");
|
||||
static_assert(sym5.utf8() == u8"bc");
|
||||
static_assert(sym5.portable() == "de");
|
||||
|
||||
constexpr basic_fixed_string txt2("de");
|
||||
constexpr symbol_text sym6(sym4.unicode(), txt2);
|
||||
static_assert(sym6.unicode() == u8"bc");
|
||||
static_assert(sym6.ascii() == "de");
|
||||
constexpr symbol_text sym6(sym4.utf8(), txt2);
|
||||
static_assert(sym6.utf8() == u8"bc");
|
||||
static_assert(sym6.portable() == "de");
|
||||
|
||||
static_assert(sym6 == symbol_text(u8"bc", "de"));
|
||||
static_assert(sym6 != symbol_text(u8"fg", "hi"));
|
||||
|
@@ -48,59 +48,59 @@ static_assert(unit_symbol(metre) == "m");
|
||||
static_assert(unit_symbol(second) == "s");
|
||||
static_assert(unit_symbol(joule) == "J");
|
||||
static_assert(unit_symbol(degree_Celsius) == "\u2103");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(degree_Celsius) == "`C");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(degree_Celsius) == "`C");
|
||||
static_assert(unit_symbol(kilogram) == "kg");
|
||||
static_assert(unit_symbol(hour) == "h");
|
||||
|
||||
// prefixed units
|
||||
static_assert(unit_symbol(quecto<ohm>) == "qΩ");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(quecto<ohm>) == "qohm");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(quecto<ohm>) == "qohm");
|
||||
static_assert(unit_symbol(ronto<ohm>) == "rΩ");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(ronto<ohm>) == "rohm");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(ronto<ohm>) == "rohm");
|
||||
static_assert(unit_symbol(yocto<ohm>) == "yΩ");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(yocto<ohm>) == "yohm");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(yocto<ohm>) == "yohm");
|
||||
static_assert(unit_symbol(zepto<ohm>) == "zΩ");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(zepto<ohm>) == "zohm");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(zepto<ohm>) == "zohm");
|
||||
static_assert(unit_symbol(atto<ohm>) == "aΩ");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(atto<ohm>) == "aohm");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(atto<ohm>) == "aohm");
|
||||
static_assert(unit_symbol(femto<ohm>) == "fΩ");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(femto<ohm>) == "fohm");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(femto<ohm>) == "fohm");
|
||||
static_assert(unit_symbol(pico<ohm>) == "pΩ");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(pico<ohm>) == "pohm");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(pico<ohm>) == "pohm");
|
||||
static_assert(unit_symbol(nano<ohm>) == "nΩ");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(nano<ohm>) == "nohm");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(nano<ohm>) == "nohm");
|
||||
static_assert(unit_symbol(micro<ohm>) == "µΩ");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(micro<ohm>) == "uohm");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(micro<ohm>) == "uohm");
|
||||
static_assert(unit_symbol(milli<ohm>) == "mΩ");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(milli<ohm>) == "mohm");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(milli<ohm>) == "mohm");
|
||||
static_assert(unit_symbol(centi<ohm>) == "cΩ");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(centi<ohm>) == "cohm");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(centi<ohm>) == "cohm");
|
||||
static_assert(unit_symbol(deci<ohm>) == "dΩ");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(deci<ohm>) == "dohm");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(deci<ohm>) == "dohm");
|
||||
static_assert(unit_symbol(deca<ohm>) == "daΩ");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(deca<ohm>) == "daohm");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(deca<ohm>) == "daohm");
|
||||
static_assert(unit_symbol(hecto<ohm>) == "hΩ");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(hecto<ohm>) == "hohm");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(hecto<ohm>) == "hohm");
|
||||
static_assert(unit_symbol(kilo<ohm>) == "kΩ");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(kilo<ohm>) == "kohm");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(kilo<ohm>) == "kohm");
|
||||
static_assert(unit_symbol(mega<ohm>) == "MΩ");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(mega<ohm>) == "Mohm");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(mega<ohm>) == "Mohm");
|
||||
static_assert(unit_symbol(giga<ohm>) == "GΩ");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(giga<ohm>) == "Gohm");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(giga<ohm>) == "Gohm");
|
||||
static_assert(unit_symbol(tera<ohm>) == "TΩ");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(tera<ohm>) == "Tohm");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(tera<ohm>) == "Tohm");
|
||||
static_assert(unit_symbol(peta<ohm>) == "PΩ");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(peta<ohm>) == "Pohm");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(peta<ohm>) == "Pohm");
|
||||
static_assert(unit_symbol(exa<ohm>) == "EΩ");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(exa<ohm>) == "Eohm");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(exa<ohm>) == "Eohm");
|
||||
static_assert(unit_symbol(zetta<ohm>) == "ZΩ");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(zetta<ohm>) == "Zohm");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(zetta<ohm>) == "Zohm");
|
||||
static_assert(unit_symbol(yotta<ohm>) == "YΩ");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(yotta<ohm>) == "Yohm");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(yotta<ohm>) == "Yohm");
|
||||
static_assert(unit_symbol(ronna<ohm>) == "RΩ");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(ronna<ohm>) == "Rohm");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(ronna<ohm>) == "Rohm");
|
||||
static_assert(unit_symbol(quetta<ohm>) == "QΩ");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(quetta<ohm>) == "Qohm");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(quetta<ohm>) == "Qohm");
|
||||
|
||||
static_assert(unit_symbol(kibi<bit>) == "Kibit");
|
||||
static_assert(unit_symbol(mebi<bit>) == "Mibit");
|
||||
@@ -113,13 +113,13 @@ static_assert(unit_symbol(yobi<bit>) == "Yibit");
|
||||
|
||||
// scaled units
|
||||
static_assert(unit_symbol(mag<100> * metre) == "[100 m]");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(mag<100> * metre) == "[100 m]");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(mag<100> * metre) == "[100 m]");
|
||||
static_assert(unit_symbol(mag<1000> * metre) == "[10³ m]");
|
||||
static_assert(unit_symbol(mag_power<10, 3> * metre) == "[10³ m]");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(mag<1000> * metre) == "[10^3 m]");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(mag<1000> * metre) == "[10^3 m]");
|
||||
static_assert(unit_symbol(mag<6000> * metre) == "[6 × 10³ m]");
|
||||
static_assert(unit_symbol(mag<6> * mag_power<10, 3> * metre) == "[6 × 10³ m]");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(mag<6000> * metre) == "[6 x 10^3 m]");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(mag<6000> * metre) == "[6 x 10^3 m]");
|
||||
static_assert(unit_symbol(mag<10600> * metre) == "[10600 m]");
|
||||
static_assert(unit_symbol(mag<60> * second) == "[60 s]");
|
||||
static_assert(unit_symbol(mag_ratio<1, 18> * metre / second) == "[1/18 m]/s");
|
||||
@@ -128,18 +128,18 @@ static_assert(unit_symbol(mag_ratio<1, 1800> * metre / second) == "[1/1800 m]/s"
|
||||
static_assert(unit_symbol(mag_ratio<1, 1800> * (metre / second)) == "[1/1800 m/s]");
|
||||
static_assert(unit_symbol(mag_ratio<1, 18000> * metre / second) == "[1/18 × 10⁻³ m]/s");
|
||||
static_assert(unit_symbol(mag_ratio<1, 18000> * (metre / second)) == "[1/18 × 10⁻³ m/s]");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(mag_ratio<1, 18000> * metre / second) == "[1/18 x 10^-3 m]/s");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(mag_ratio<1, 18000> * (metre / second)) == "[1/18 x 10^-3 m/s]");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(mag_ratio<1, 18000> * metre / second) == "[1/18 x 10^-3 m]/s");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(mag_ratio<1, 18000> * (metre / second)) == "[1/18 x 10^-3 m/s]");
|
||||
|
||||
// TODO implement all the below
|
||||
// static_assert(unit_symbol(mag_power<2, 1, 2> * one) == "[2^(1/2)]");
|
||||
// static_assert(unit_symbol<usf{.encoding = ascii}>(mag_power<2, 1, 2> * one) == "[2^(1/2)]");
|
||||
// static_assert(unit_symbol<usf{.encoding = portable}>(mag_power<2, 1, 2> * one) == "[2^(1/2)]");
|
||||
// static_assert(unit_symbol(mag_power<2, 1, 2> * m) == "[2^(1/2) m]");
|
||||
// static_assert(unit_symbol<usf{.encoding = ascii}>(mag_power<2, 1, 2> * m) == "[2^(1/2) m]");
|
||||
// static_assert(unit_symbol<usf{.encoding = portable}>(mag_power<2, 1, 2> * m) == "[2^(1/2) m]");
|
||||
// static_assert(unit_symbol(mag<1> / mag_power<2, 1, 2> * one) == "[1/2^(1/2)]");
|
||||
// static_assert(unit_symbol<usf{.encoding = ascii}>(mag<1> / mag_power<2, 1, 2> * one) == "[1/2^(1/2)]");
|
||||
// static_assert(unit_symbol<usf{.encoding = portable}>(mag<1> / mag_power<2, 1, 2> * one) == "[1/2^(1/2)]");
|
||||
// static_assert(unit_symbol(mag<1> / mag_power<2, 1, 2> * m) == "[1/2^(1/2) m]");
|
||||
// static_assert(unit_symbol<usf{.encoding = ascii}>(mag<1> / mag_power<2, 1, 2> * m) == "[1/2^(1/2) m]");
|
||||
// static_assert(unit_symbol<usf{.encoding = portable}>(mag<1> / mag_power<2, 1, 2> * m) == "[1/2^(1/2) m]");
|
||||
|
||||
// magnitude constants
|
||||
#if defined MP_UNITS_COMP_CLANG || MP_UNITS_COMP_CLANG < 18
|
||||
@@ -151,47 +151,47 @@ inline constexpr struct e final : mag_constant<"e", std::numbers::e_v<long doubl
|
||||
} e;
|
||||
|
||||
static_assert(unit_symbol(mag<pi> * one) == "[𝜋]");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(mag<pi> * one) == "[pi]");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(mag<pi> * one) == "[pi]");
|
||||
static_assert(unit_symbol(mag<pi> * metre) == "[𝜋 m]");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(mag<pi> * metre) == "[pi m]");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(mag<pi> * metre) == "[pi m]");
|
||||
static_assert(unit_symbol(mag<2> * mag<pi> * metre) == "[2 𝜋 m]");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(mag<2> * mag<pi> * metre) == "[2 pi m]");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(mag<2> * mag<pi> * metre) == "[2 pi m]");
|
||||
static_assert(unit_symbol<usf{.separator = half_high_dot}>(mag<2> * mag<pi> * metre) == "[2⋅𝜋 m]");
|
||||
|
||||
static_assert(unit_symbol(mag<1> / mag<pi> * one) == "[1/𝜋]");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(mag<1> / mag<pi> * one) == "[1/pi]");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(mag<1> / mag<pi> * one) == "[1/pi]");
|
||||
static_assert(unit_symbol<usf{.solidus = never}>(mag<1> / mag<pi> * one) == "[𝜋⁻¹]");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii, .solidus = never}>(mag<1> / mag<pi> * one) == "[pi^-1]");
|
||||
static_assert(unit_symbol<usf{.encoding = portable, .solidus = never}>(mag<1> / mag<pi> * one) == "[pi^-1]");
|
||||
|
||||
static_assert(unit_symbol(mag<1> / mag<pi> * metre) == "[1/𝜋 m]");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(mag<1> / mag<pi> * metre) == "[1/pi m]");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(mag<1> / mag<pi> * metre) == "[1/pi m]");
|
||||
static_assert(unit_symbol<usf{.solidus = never}>(mag<1> / mag<pi> * metre) == "[𝜋⁻¹ m]");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii, .solidus = never}>(mag<1> / mag<pi> * metre) == "[pi^-1 m]");
|
||||
static_assert(unit_symbol<usf{.encoding = portable, .solidus = never}>(mag<1> / mag<pi> * metre) == "[pi^-1 m]");
|
||||
|
||||
static_assert(unit_symbol(mag<2> / mag<pi> * metre) == "[2/𝜋 m]");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(mag<2> / mag<pi> * metre) == "[2/pi m]");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(mag<2> / mag<pi> * metre) == "[2/pi m]");
|
||||
static_assert(unit_symbol<usf{.solidus = never}>(mag<2> / mag<pi> * metre) == "[2 𝜋⁻¹ m]");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii, .solidus = never}>(mag<2> / mag<pi> * metre) == "[2 pi^-1 m]");
|
||||
static_assert(unit_symbol<usf{.encoding = portable, .solidus = never}>(mag<2> / mag<pi> * metre) == "[2 pi^-1 m]");
|
||||
static_assert(unit_symbol<usf{.solidus = never, .separator = half_high_dot}>(mag<2> / mag<pi> * metre) == "[2⋅𝜋⁻¹ m]");
|
||||
|
||||
static_assert(unit_symbol(mag<1> / (mag<2> * mag<pi>)*metre) == "[2⁻¹ 𝜋⁻¹ m]");
|
||||
static_assert(unit_symbol<usf{.solidus = always}>(mag<1> / (mag<2> * mag<pi>)*metre) == "[1/(2 𝜋) m]");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii, .solidus = always}>(mag<1> / (mag<2> * mag<pi>)*metre) ==
|
||||
static_assert(unit_symbol<usf{.encoding = portable, .solidus = always}>(mag<1> / (mag<2> * mag<pi>)*metre) ==
|
||||
"[1/(2 pi) m]");
|
||||
static_assert(unit_symbol(mag_ratio<1, 2> / mag<pi> * metre) == "[2⁻¹ 𝜋⁻¹ m]");
|
||||
static_assert(unit_symbol<usf{.solidus = always}>(mag_ratio<1, 2> / mag<pi> * metre) == "[1/(2 𝜋) m]");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii, .solidus = always}>(mag_ratio<1, 2> / mag<pi> * metre) ==
|
||||
static_assert(unit_symbol<usf{.encoding = portable, .solidus = always}>(mag_ratio<1, 2> / mag<pi> * metre) ==
|
||||
"[1/(2 pi) m]");
|
||||
static_assert(unit_symbol(mag_ratio<1, 2> * mag<pi> * metre) == "[𝜋/2 m]");
|
||||
|
||||
static_assert(unit_symbol(mag_power<pi, 2> * one) == "[𝜋²]");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(mag_power<pi, 2> * one) == "[pi^2]");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(mag_power<pi, 2> * one) == "[pi^2]");
|
||||
static_assert(unit_symbol(mag_power<pi, 1, 2> * metre) == "[𝜋^(1/2) m]");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(mag_power<pi, 1, 2> * metre) == "[pi^(1/2) m]");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(mag_power<pi, 1, 2> * metre) == "[pi^(1/2) m]");
|
||||
|
||||
static_assert(unit_symbol(mag<pi> * mag<e> * one) == "[e 𝜋]");
|
||||
static_assert(unit_symbol(mag<e> * mag<pi> * one) == "[e 𝜋]");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(mag<pi> * mag<e> * one) == "[e pi]");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(mag<pi> * mag<e> * one) == "[e pi]");
|
||||
static_assert(unit_symbol(mag<pi> / mag<e> * one) == "[𝜋/e]");
|
||||
static_assert(unit_symbol(mag<1> / mag<e> * mag<pi> * one) == "[𝜋/e]");
|
||||
static_assert(unit_symbol<usf{.solidus = never}>(mag<pi> / mag<e> * one) == "[𝜋 e⁻¹]");
|
||||
@@ -216,49 +216,51 @@ static_assert(unit_symbol(get_common_unit(radian, degree)) == "EQUIV{[1/𝜋°],
|
||||
static_assert(unit_symbol(one) == ""); // NOLINT(readability-container-size-empty)
|
||||
static_assert(unit_symbol(percent) == "%");
|
||||
static_assert(unit_symbol(per_mille) == "‰");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(per_mille) == "%o");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(per_mille) == "%o");
|
||||
static_assert(unit_symbol(parts_per_million) == "ppm");
|
||||
static_assert(unit_symbol(square(metre)) == "m²");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(square(metre)) == "m^2");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(square(metre)) == "m^2");
|
||||
static_assert(unit_symbol(cubic(metre)) == "m³");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(cubic(metre)) == "m^3");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(cubic(metre)) == "m^3");
|
||||
static_assert(unit_symbol(kilo<metre> * metre) == "km m");
|
||||
static_assert(unit_symbol<usf{.separator = half_high_dot}>(kilo<metre> * metre) == "km⋅m");
|
||||
static_assert(unit_symbol(metre / metre) == ""); // NOLINT(readability-container-size-empty)
|
||||
static_assert(unit_symbol(kilo<metre> / metre) == "km/m");
|
||||
static_assert(unit_symbol<usf{.solidus = never}>(kilo<metre> / metre) == "km m⁻¹");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii, .solidus = never}>(kilo<metre> / metre) == "km m^-1");
|
||||
static_assert(unit_symbol<usf{.encoding = portable, .solidus = never}>(kilo<metre> / metre) == "km m^-1");
|
||||
static_assert(unit_symbol(metre / second) == "m/s");
|
||||
static_assert(unit_symbol<usf{.solidus = always}>(metre / second) == "m/s");
|
||||
static_assert(unit_symbol<usf{.solidus = never}>(metre / second) == "m s⁻¹");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii, .solidus = never}>(metre / second) == "m s^-1");
|
||||
static_assert(unit_symbol<usf{.encoding = portable, .solidus = never}>(metre / second) == "m s^-1");
|
||||
static_assert(unit_symbol<usf{.solidus = never, .separator = half_high_dot}>(metre / second) == "m⋅s⁻¹");
|
||||
static_assert(unit_symbol(metre / square(second)) == "m/s²");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(metre / square(second)) == "m/s^2");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(metre / square(second)) == "m/s^2");
|
||||
static_assert(unit_symbol<usf{.solidus = always}>(metre / square(second)) == "m/s²");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii, .solidus = always}>(metre / square(second)) == "m/s^2");
|
||||
static_assert(unit_symbol<usf{.encoding = portable, .solidus = always}>(metre / square(second)) == "m/s^2");
|
||||
static_assert(unit_symbol<usf{.solidus = never}>(metre / square(second)) == "m s⁻²");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii, .solidus = never}>(metre / square(second)) == "m s^-2");
|
||||
static_assert(unit_symbol<usf{.encoding = portable, .solidus = never}>(metre / square(second)) == "m s^-2");
|
||||
static_assert(unit_symbol<usf{.solidus = never, .separator = half_high_dot}>(metre / square(second)) == "m⋅s⁻²");
|
||||
static_assert(unit_symbol(kilogram * metre / square(second)) == "kg m/s²");
|
||||
static_assert(unit_symbol<usf{.separator = half_high_dot}>(kilogram * metre / square(second)) == "kg⋅m/s²");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(kilogram * metre / square(second)) == "kg m/s^2");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(kilogram * metre / square(second)) == "kg m/s^2");
|
||||
static_assert(unit_symbol<usf{.solidus = always}>(kilogram * metre / square(second)) == "kg m/s²");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii, .solidus = always}>(kilogram * metre / square(second)) == "kg m/s^2");
|
||||
static_assert(unit_symbol<usf{.encoding = portable, .solidus = always}>(kilogram * metre / square(second)) ==
|
||||
"kg m/s^2");
|
||||
static_assert(unit_symbol<usf{.solidus = never}>(kilogram * metre / square(second)) == "kg m s⁻²");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii, .solidus = never}>(kilogram * metre / square(second)) == "kg m s^-2");
|
||||
static_assert(unit_symbol<usf{.encoding = portable, .solidus = never}>(kilogram * metre / square(second)) ==
|
||||
"kg m s^-2");
|
||||
static_assert(unit_symbol<usf{.solidus = never, .separator = half_high_dot}>(kilogram * metre / square(second)) ==
|
||||
"kg⋅m⋅s⁻²");
|
||||
static_assert(unit_symbol(one / metre / square(second)) == "m⁻¹ s⁻²");
|
||||
static_assert(unit_symbol<usf{.solidus = always}>(one / metre / square(second)) == "1/(m s²)");
|
||||
static_assert(unit_symbol(kilogram / metre / square(second)) == "kg m⁻¹ s⁻²");
|
||||
static_assert(unit_symbol<usf{.separator = half_high_dot}>(kilogram / metre / square(second)) == "kg⋅m⁻¹⋅s⁻²");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii}>(kilogram / metre / square(second)) == "kg m^-1 s^-2");
|
||||
static_assert(unit_symbol<usf{.encoding = portable}>(kilogram / metre / square(second)) == "kg m^-1 s^-2");
|
||||
static_assert(unit_symbol<usf{.solidus = always}>(kilogram / metre / square(second)) == "kg/(m s²)");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii, .solidus = always}>(kilogram / metre / square(second)) ==
|
||||
static_assert(unit_symbol<usf{.encoding = portable, .solidus = always}>(kilogram / metre / square(second)) ==
|
||||
"kg/(m s^2)");
|
||||
static_assert(unit_symbol<usf{.solidus = never}>(kilogram / metre / square(second)) == "kg m⁻¹ s⁻²");
|
||||
static_assert(unit_symbol<usf{.encoding = ascii, .solidus = never}>(kilogram / metre / square(second)) ==
|
||||
static_assert(unit_symbol<usf{.encoding = portable, .solidus = never}>(kilogram / metre / square(second)) ==
|
||||
"kg m^-1 s^-2");
|
||||
static_assert(unit_symbol<usf{.solidus = never, .separator = half_high_dot}>(kilogram / metre / square(second)) ==
|
||||
"kg⋅m⁻¹⋅s⁻²");
|
||||
|
Reference in New Issue
Block a user