coherent_derived_unit and custom prefixes support added

This commit is contained in:
Mateusz Pusz
2019-10-17 10:16:44 +02:00
parent 9a9abca81d
commit 3e30c779a6
29 changed files with 261 additions and 115 deletions
+11 -5
View File
@@ -39,25 +39,31 @@ TEST_CASE("operator<< on a quantity", "[text][ostream]")
{
SECTION("integral representation")
{
stream << 16sq_m;
REQUIRE(stream.str() == "16 m^2");
stream << 60W;
REQUIRE(stream.str() == "60 W");
}
SECTION("floating-point representation")
{
stream << 72.5kmph;
REQUIRE(stream.str() == "72.5 km/h");
stream << 72.5kJ;
REQUIRE(stream.str() == "72.5 kJ");
}
}
SECTION("quantity with a predefined dimension but unknown unit")
{
SECTION("unit::ratio as an SI prefix")
SECTION("unit::ratio as an SI prefix for a dimension with a special symbol")
{
stream << 4.N * 2cm;
REQUIRE(stream.str() == "8 cJ");
}
SECTION("unit::ratio for a dimension without a special symbol")
{
stream << 2.cm * 2m * 2m;
REQUIRE(stream.str() == "8 [1/100]m^3");
}
SECTION("unit::ratio::num != 1 && unit::ratio::den == 1")
{
stream << 4 * 2min / (2s * 2s);