forked from mpusz/mp-units
test: tests for printing of a symbol of a dimensionless unit with the ratio = 1
This commit is contained in:
@@ -234,6 +234,18 @@ TEST_CASE("operator<< on a quantity", "[text][ostream][fmt]")
|
||||
|
||||
SECTION("fmt with format {:%Q %q} on a quantity") { CHECK(MP_UNITS_STD_FMT::format("{:%Q %q}", q) == os.str()); }
|
||||
}
|
||||
|
||||
SECTION("radians")
|
||||
{
|
||||
const auto q = 42 * rad;
|
||||
os << q;
|
||||
|
||||
SECTION("iostream") { CHECK(os.str() == "42 rad"); }
|
||||
|
||||
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("no space before unit symbol")
|
||||
|
@@ -161,6 +161,9 @@ static_assert(unit_symbol(pow<1, 2>(metre)) == "m^(1/2)");
|
||||
static_assert(unit_symbol(pow<3, 5>(metre)) == "m^(3/5)");
|
||||
static_assert(unit_symbol(pow<1, 2>(metre / second)) == "m^(1/2)/s^(1/2)");
|
||||
|
||||
// dimensionless unit
|
||||
static_assert(unit_symbol(radian) == "rad");
|
||||
|
||||
// Physical constants
|
||||
static_assert(unit_symbol(si2019::speed_of_light_in_vacuum) == "c");
|
||||
static_assert(unit_symbol(gram * standard_gravity * si2019::speed_of_light_in_vacuum) == "c g g₀");
|
||||
|
Reference in New Issue
Block a user