Feat: Overloads for floor and ceil accepting quantities (#314)

* feat: overloads for floor and ceil accepting quantities

* require same type for dim and rep

* be specific for msvc
This commit is contained in:
Markus Hofbauer
2021-11-15 12:23:28 +01:00
committed by GitHub
parent 3f28b55ab1
commit 50b9050d6b
3 changed files with 48 additions and 0 deletions
+8
View File
@@ -148,6 +148,10 @@ TEST_CASE("floor functions", "[floor]")
SECTION ("floor -999. milliseconds with target unit second should be -1 second") {
REQUIRE(floor<si::second>(-999._q_ms) == -1_q_s);
}
SECTION ("floor 1 second with target quantity with unit type second should be 1 second") {
using showtime = si::time<si::second, int>;
REQUIRE(floor<showtime>(showtime::one()) == showtime::one());
}
}
TEST_CASE("ceil functions", "[ceil]")
@@ -189,6 +193,10 @@ TEST_CASE("ceil functions", "[ceil]")
SECTION ("ceil -999. milliseconds with target unit second should be 0 seconds") {
REQUIRE(ceil<si::second>(-999._q_ms) == 0_q_s);
}
SECTION ("ceil 1 second with target quantity with unit type second should be 1 second") {
using showtime = si::time<si::second, int>;
REQUIRE(ceil<showtime>(showtime::one()) == showtime::one());
}
}
TEMPLATE_TEST_CASE_SIG("pow<N>() implementation exponentiates values to power N", "[math][pow][exp]",