Multiply symbot in a printed unit changed to '⋅'

This commit is contained in:
Mateusz Pusz
2019-10-17 12:44:39 +02:00
parent 5def0c6b60
commit f147da202e
2 changed files with 7 additions and 7 deletions

View File

@@ -70,7 +70,7 @@ namespace units {
os << (first ? "1/" : "/"); os << (first ? "1/" : "/");
} }
else { else {
os << (first ? "" : "*"); os << (first ? "" : "");
} }
os << E::dimension::symbol; os << E::dimension::symbol;
if constexpr(E::den != 1) { if constexpr(E::den != 1) {

View File

@@ -88,13 +88,13 @@ TEST_CASE("operator<< on a quantity", "[text][ostream]")
SECTION("unit::ratio::num == 1 && unit::ratio::den == 1") SECTION("unit::ratio::num == 1 && unit::ratio::den == 1")
{ {
stream << 2s * 2m * 2kg; stream << 2s * 2m * 2kg;
REQUIRE(stream.str() == "8 m*kg*s"); REQUIRE(stream.str() == "8 mkgs");
} }
SECTION("unit::ratio as an SI prefix") SECTION("unit::ratio as an SI prefix")
{ {
stream << 4km * 2s; stream << 4km * 2s;
REQUIRE(stream.str() == "8 [1000]m*s"); REQUIRE(stream.str() == "8 [1000]ms");
} }
SECTION("unit::ratio::num != 1 && unit::ratio::den == 1") SECTION("unit::ratio::num != 1 && unit::ratio::den == 1")
@@ -112,25 +112,25 @@ TEST_CASE("operator<< on a quantity", "[text][ostream]")
SECTION("unit::ratio::num != 1 && unit::ratio::den != 1") SECTION("unit::ratio::num != 1 && unit::ratio::den != 1")
{ {
stream << 60.min / 2km; stream << 60.min / 2km;
REQUIRE(stream.str() == "30 [3/50]1/m*s"); REQUIRE(stream.str() == "30 [3/50]1/ms");
} }
SECTION("exp::num == 1 && exp::den == 1") SECTION("exp::num == 1 && exp::den == 1")
{ {
stream << 4m * 2s; stream << 4m * 2s;
REQUIRE(stream.str() == "8 m*s"); REQUIRE(stream.str() == "8 ms");
} }
SECTION("exp::num == 2 && exp::den == 1 for positive exponent") SECTION("exp::num == 2 && exp::den == 1 for positive exponent")
{ {
stream << 4m * 2s * 2s; stream << 4m * 2s * 2s;
REQUIRE(stream.str() == "16 m*s^2"); REQUIRE(stream.str() == "16 ms^2");
} }
SECTION("exp::num == 2 && exp::den == 1 for negative exponent (first dimension)") SECTION("exp::num == 2 && exp::den == 1 for negative exponent (first dimension)")
{ {
stream << 8.s / 2m / 2m; stream << 8.s / 2m / 2m;
REQUIRE(stream.str() == "2 1/m^2*s"); REQUIRE(stream.str() == "2 1/m^2s");
} }
SECTION("exp::num == 2 && exp::den == 1 for negative exponent (not first dimension)") SECTION("exp::num == 2 && exp::den == 1 for negative exponent (not first dimension)")