mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-02 20:04:27 +02:00
refactor: more unit tests refactored
This commit is contained in:
@@ -26,8 +26,11 @@ find_package(Catch2 3 CONFIG REQUIRED)
|
|||||||
|
|
||||||
add_executable(
|
add_executable(
|
||||||
unit_tests_runtime
|
unit_tests_runtime
|
||||||
# math_test.cpp
|
distribution_test.cpp
|
||||||
magnitude_test.cpp # fmt_test.cpp fmt_units_test.cpp distribution_test.cpp
|
fmt_test.cpp
|
||||||
|
|
||||||
|
# fmt_units_test.cpp
|
||||||
|
math_test.cpp
|
||||||
)
|
)
|
||||||
target_link_libraries(unit_tests_runtime PRIVATE mp-units::mp-units Catch2::Catch2WithMain)
|
target_link_libraries(unit_tests_runtime PRIVATE mp-units::mp-units Catch2::Catch2WithMain)
|
||||||
|
|
||||||
|
@@ -30,7 +30,7 @@ template<Quantity T>
|
|||||||
struct AlmostEqualsMatcher : Catch::Matchers::MatcherGenericBase {
|
struct AlmostEqualsMatcher : Catch::Matchers::MatcherGenericBase {
|
||||||
AlmostEqualsMatcher(const T& target) : target_{target} {}
|
AlmostEqualsMatcher(const T& target) : target_{target} {}
|
||||||
|
|
||||||
template<QuantityEquivalentTo<T> U>
|
template<std::convertible_to<T> U>
|
||||||
requires std::same_as<typename T::rep, typename U::rep> && treat_as_floating_point<typename T::rep> bool
|
requires std::same_as<typename T::rep, typename U::rep> && treat_as_floating_point<typename T::rep> bool
|
||||||
match(const U& other) const
|
match(const U& other) const
|
||||||
{
|
{
|
||||||
|
@@ -22,61 +22,64 @@
|
|||||||
|
|
||||||
#include "almost_equals.h"
|
#include "almost_equals.h"
|
||||||
#include <catch2/catch_all.hpp>
|
#include <catch2/catch_all.hpp>
|
||||||
#include <units/isq/si/area.h>
|
#include <units/isq/space_and_time.h>
|
||||||
#include <units/isq/si/cgs/length.h>
|
|
||||||
#include <units/isq/si/length.h>
|
|
||||||
#include <units/isq/si/time.h>
|
|
||||||
#include <units/isq/si/volume.h>
|
|
||||||
#include <units/math.h>
|
#include <units/math.h>
|
||||||
#include <units/quantity_io.h>
|
#include <units/quantity_io.h>
|
||||||
|
#include <units/si/unit_symbols.h>
|
||||||
|
#include <units/si/units.h>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
using namespace units;
|
using namespace units;
|
||||||
using namespace units::isq;
|
using namespace units::si::unit_symbols;
|
||||||
using namespace units::isq::si::literals;
|
|
||||||
|
|
||||||
// classical
|
// classical
|
||||||
|
|
||||||
TEST_CASE("'pow<N>()' on quantity changes the value and the dimension accordingly", "[math][pow]")
|
TEST_CASE("'pow<N>()' on quantity changes the value and the dimension accordingly", "[math][pow]")
|
||||||
{
|
{
|
||||||
SECTION("'pow<0>(q)' returns '1'") { CHECK(pow<0>(2_q_m) == 1); }
|
SECTION("'pow<0>(q)' returns '1'") { CHECK(pow<0>(2 * isq::length[m]) == 1); }
|
||||||
|
|
||||||
SECTION("'pow<1>(q)' returns 'q'") { CHECK(pow<1>(2_q_m) == 2_q_m); }
|
SECTION("'pow<1>(q)' returns 'q'") { CHECK(pow<1>(2 * isq::length[m]) == 2 * isq::length[m]); }
|
||||||
|
|
||||||
SECTION("'pow<2>(q)' squares both the value and a dimension") { CHECK(pow<2>(2_q_m) == 4_q_m2); }
|
SECTION("'pow<2>(q)' squares both the value and a dimension")
|
||||||
|
{
|
||||||
|
CHECK(pow<2>(2 * isq::length[m]) == 4 * isq::area[m2]);
|
||||||
|
}
|
||||||
|
|
||||||
SECTION("'pow<3>(q)' cubes both the value and a dimension") { CHECK(pow<3>(2_q_m) == 8_q_m3); }
|
SECTION("'pow<3>(q)' cubes both the value and a dimension")
|
||||||
|
{
|
||||||
|
CHECK(pow<3>(2 * isq::length[m]) == 8 * isq::volume[m3]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("'sqrt()' on quantity changes the value and the dimension accordingly", "[math][sqrt]")
|
TEST_CASE("'sqrt()' on quantity changes the value and the dimension accordingly", "[math][sqrt]")
|
||||||
{
|
{
|
||||||
REQUIRE(sqrt(4_q_m2) == 2_q_m);
|
REQUIRE(sqrt(4 * isq::area[m2]) == 2 * isq::length[m]);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("'cbrt()' on quantity changes the value and the dimension accordingly", "[math][cbrt]")
|
TEST_CASE("'cbrt()' on quantity changes the value and the dimension accordingly", "[math][cbrt]")
|
||||||
{
|
{
|
||||||
REQUIRE(cbrt(8_q_m3) == 2_q_m);
|
REQUIRE(cbrt(8 * isq::volume[m3]) == 2 * isq::length[m]);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("'pow<Num, Den>()' on quantity changes the value and the dimension accordingly", "[math][pow]")
|
TEST_CASE("'pow<Num, Den>()' on quantity changes the value and the dimension accordingly", "[math][pow]")
|
||||||
{
|
{
|
||||||
REQUIRE(pow<1, 4>(16_q_m2) == sqrt(4_q_m));
|
REQUIRE(pow<1, 4>(16 * isq::area[m2]) == sqrt(4 * isq::length[m]));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("absolute functions on quantity returns the absolute value", "[math][abs][fabs]")
|
TEST_CASE("absolute functions on quantity returns the absolute value", "[math][abs][fabs]")
|
||||||
{
|
{
|
||||||
SECTION("'abs()' on a negative quantity returns the abs")
|
SECTION("'abs()' on a negative quantity returns the abs")
|
||||||
{
|
{
|
||||||
SECTION("integral representation") { REQUIRE(abs(-1_q_m) == 1_q_m); }
|
SECTION("integral representation") { REQUIRE(abs(-1 * isq::length[m]) == 1 * isq::length[m]); }
|
||||||
|
|
||||||
SECTION("floating-point representation") { REQUIRE(abs(-1._q_m) == 1_q_m); }
|
SECTION("floating-point representation") { REQUIRE(abs(-1. * isq::length[m]) == 1 * isq::length[m]); }
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("'abs()' on a positive quantity returns the abs")
|
SECTION("'abs()' on a positive quantity returns the abs")
|
||||||
{
|
{
|
||||||
SECTION("integral representation") { REQUIRE(abs(1_q_m) == 1_q_m); }
|
SECTION("integral representation") { REQUIRE(abs(1 * isq::length[m]) == 1 * isq::length[m]); }
|
||||||
|
|
||||||
SECTION("floating-point representation") { REQUIRE(abs(1._q_m) == 1_q_m); }
|
SECTION("floating-point representation") { REQUIRE(abs(1. * isq::length[m]) == 1 * isq::length[m]); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,303 +87,219 @@ TEST_CASE("numeric_limits functions", "[limits]")
|
|||||||
{
|
{
|
||||||
SECTION("'epsilon' works as expected using default floating type")
|
SECTION("'epsilon' works as expected using default floating type")
|
||||||
{
|
{
|
||||||
REQUIRE(epsilon<decltype(1._q_m)>().number() == std::numeric_limits<decltype(1._q_m)::rep>::epsilon());
|
REQUIRE(epsilon<double>(isq::length[m]).number() ==
|
||||||
|
std::numeric_limits<decltype(1. * isq::length[m])::rep>::epsilon());
|
||||||
}
|
}
|
||||||
SECTION("'epsilon' works as expected using integers")
|
SECTION("'epsilon' works as expected using integers")
|
||||||
{
|
{
|
||||||
REQUIRE(epsilon<decltype(1_q_m)>().number() == std::numeric_limits<decltype(1_q_m)::rep>::epsilon());
|
REQUIRE(epsilon<int>(isq::length[m]).number() == std::numeric_limits<decltype(1 * isq::length[m])::rep>::epsilon());
|
||||||
}
|
|
||||||
SECTION("'epsilon' works as expected using mixed Rep types")
|
|
||||||
{
|
|
||||||
REQUIRE(epsilon<decltype(1_q_m)>().number() != std::numeric_limits<decltype(1._q_m)::rep>::epsilon());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("floor functions", "[floor]")
|
TEST_CASE("floor functions", "[floor]")
|
||||||
{
|
{
|
||||||
SECTION("floor 1 second with target unit second should be 1 second") { REQUIRE(floor<si::second>(1_q_s) == 1_q_s); }
|
SECTION("floor 1 second with target unit second should be 1 second")
|
||||||
|
{
|
||||||
|
REQUIRE(floor<si::second>(1 * isq::time[s]) == 1 * isq::time[s]);
|
||||||
|
}
|
||||||
SECTION("floor 1000 milliseconds with target unit second should be 1 second")
|
SECTION("floor 1000 milliseconds with target unit second should be 1 second")
|
||||||
{
|
{
|
||||||
REQUIRE(floor<si::second>(1000_q_ms) == 1_q_s);
|
REQUIRE(floor<si::second>(1000 * isq::time[ms]) == 1 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("floor 1001 milliseconds with target unit second should be 1 second")
|
SECTION("floor 1001 milliseconds with target unit second should be 1 second")
|
||||||
{
|
{
|
||||||
REQUIRE(floor<si::second>(1001_q_ms) == 1_q_s);
|
REQUIRE(floor<si::second>(1001 * isq::time[ms]) == 1 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("floor 1999 milliseconds with target unit second should be 1 second")
|
SECTION("floor 1999 milliseconds with target unit second should be 1 second")
|
||||||
{
|
{
|
||||||
REQUIRE(floor<si::second>(1999_q_ms) == 1_q_s);
|
REQUIRE(floor<si::second>(1999 * isq::time[ms]) == 1 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("floor -1000 milliseconds with target unit second should be -1 second")
|
SECTION("floor -1000 milliseconds with target unit second should be -1 second")
|
||||||
{
|
{
|
||||||
REQUIRE(floor<si::second>(-1000_q_ms) == -1_q_s);
|
REQUIRE(floor<si::second>(-1000 * isq::time[ms]) == -1 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("floor -999 milliseconds with target unit second should be -1 second")
|
SECTION("floor -999 milliseconds with target unit second should be -1 second")
|
||||||
{
|
{
|
||||||
REQUIRE(floor<si::second>(-999_q_ms) == -1_q_s);
|
REQUIRE(floor<si::second>(-999 * isq::time[ms]) == -1 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("floor 1.3 seconds with target unit second should be 1 second")
|
SECTION("floor 1.3 seconds with target unit second should be 1 second")
|
||||||
{
|
{
|
||||||
REQUIRE(floor<si::second>(1.3_q_s) == 1_q_s);
|
REQUIRE(floor<si::second>(1.3 * isq::time[s]) == 1 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("floor -1.3 seconds with target unit second should be -2 seconds")
|
SECTION("floor -1.3 seconds with target unit second should be -2 seconds")
|
||||||
{
|
{
|
||||||
REQUIRE(floor<si::second>(-1.3_q_s) == -2_q_s);
|
REQUIRE(floor<si::second>(-1.3 * isq::time[s]) == -2 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("floor 1001. milliseconds with target unit second should be 1 second")
|
SECTION("floor 1001. milliseconds with target unit second should be 1 second")
|
||||||
{
|
{
|
||||||
REQUIRE(floor<si::second>(1001._q_ms) == 1_q_s);
|
REQUIRE(floor<si::second>(1001. * isq::time[ms]) == 1 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("floor 1999. milliseconds with target unit second should be 1 second")
|
SECTION("floor 1999. milliseconds with target unit second should be 1 second")
|
||||||
{
|
{
|
||||||
REQUIRE(floor<si::second>(1999._q_ms) == 1_q_s);
|
REQUIRE(floor<si::second>(1999. * isq::time[ms]) == 1 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("floor -1000. milliseconds with target unit second should be -1 second")
|
SECTION("floor -1000. milliseconds with target unit second should be -1 second")
|
||||||
{
|
{
|
||||||
REQUIRE(floor<si::second>(-1000._q_ms) == -1_q_s);
|
REQUIRE(floor<si::second>(-1000. * isq::time[ms]) == -1 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("floor -999. milliseconds with target unit second should be -1 second")
|
SECTION("floor -999. milliseconds with target unit second should be -1 second")
|
||||||
{
|
{
|
||||||
REQUIRE(floor<si::second>(-999._q_ms) == -1_q_s);
|
REQUIRE(floor<si::second>(-999. * isq::time[ms]) == -1 * isq::time[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());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO Add tests for `N`, `kN` and `kg * m / s2` i `kg * km / s2`
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("ceil functions", "[ceil]")
|
TEST_CASE("ceil functions", "[ceil]")
|
||||||
{
|
{
|
||||||
SECTION("ceil 1 second with target unit second should be 1 second") { REQUIRE(ceil<si::second>(1_q_s) == 1_q_s); }
|
SECTION("ceil 1 second with target unit second should be 1 second")
|
||||||
|
{
|
||||||
|
REQUIRE(ceil<si::second>(1 * isq::time[s]) == 1 * isq::time[s]);
|
||||||
|
}
|
||||||
SECTION("ceil 1000 milliseconds with target unit second should be 1 second")
|
SECTION("ceil 1000 milliseconds with target unit second should be 1 second")
|
||||||
{
|
{
|
||||||
REQUIRE(ceil<si::second>(1000_q_ms) == 1_q_s);
|
REQUIRE(ceil<si::second>(1000 * isq::time[ms]) == 1 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("ceil 1001 milliseconds with target unit second should be 2 seconds")
|
SECTION("ceil 1001 milliseconds with target unit second should be 2 seconds")
|
||||||
{
|
{
|
||||||
REQUIRE(ceil<si::second>(1001_q_ms) == 2_q_s);
|
REQUIRE(ceil<si::second>(1001 * isq::time[ms]) == 2 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("ceil 1999 milliseconds with target unit second should be 2 seconds")
|
SECTION("ceil 1999 milliseconds with target unit second should be 2 seconds")
|
||||||
{
|
{
|
||||||
REQUIRE(ceil<si::second>(1999_q_ms) == 2_q_s);
|
REQUIRE(ceil<si::second>(1999 * isq::time[ms]) == 2 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("ceil -1000 milliseconds with target unit second should be -1 second")
|
SECTION("ceil -1000 milliseconds with target unit second should be -1 second")
|
||||||
{
|
{
|
||||||
REQUIRE(ceil<si::second>(-1000_q_ms) == -1_q_s);
|
REQUIRE(ceil<si::second>(-1000 * isq::time[ms]) == -1 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("ceil -999 milliseconds with target unit second should be 0 seconds")
|
SECTION("ceil -999 milliseconds with target unit second should be 0 seconds")
|
||||||
{
|
{
|
||||||
REQUIRE(ceil<si::second>(-999_q_ms) == 0_q_s);
|
REQUIRE(ceil<si::second>(-999 * isq::time[ms]) == 0 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("ceil 1.3 seconds with target unit second should be 2 seconds")
|
SECTION("ceil 1.3 seconds with target unit second should be 2 seconds")
|
||||||
{
|
{
|
||||||
REQUIRE(ceil<si::second>(1.3_q_s) == 2_q_s);
|
REQUIRE(ceil<si::second>(1.3 * isq::time[s]) == 2 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("ceil -1.3 seconds with target unit second should be -1 second")
|
SECTION("ceil -1.3 seconds with target unit second should be -1 second")
|
||||||
{
|
{
|
||||||
REQUIRE(ceil<si::second>(-1.3_q_s) == -1_q_s);
|
REQUIRE(ceil<si::second>(-1.3 * isq::time[s]) == -1 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("ceil 1001. milliseconds with target unit second should be 2 seconds")
|
SECTION("ceil 1001. milliseconds with target unit second should be 2 seconds")
|
||||||
{
|
{
|
||||||
REQUIRE(ceil<si::second>(1001._q_ms) == 2_q_s);
|
REQUIRE(ceil<si::second>(1001. * isq::time[ms]) == 2 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("ceil 1999. milliseconds with target unit second should be 2 seconds")
|
SECTION("ceil 1999. milliseconds with target unit second should be 2 seconds")
|
||||||
{
|
{
|
||||||
REQUIRE(ceil<si::second>(1999._q_ms) == 2_q_s);
|
REQUIRE(ceil<si::second>(1999. * isq::time[ms]) == 2 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("ceil -1000. milliseconds with target unit second should be -1 second")
|
SECTION("ceil -1000. milliseconds with target unit second should be -1 second")
|
||||||
{
|
{
|
||||||
REQUIRE(ceil<si::second>(-1000._q_ms) == -1_q_s);
|
REQUIRE(ceil<si::second>(-1000. * isq::time[ms]) == -1 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("ceil -999. milliseconds with target unit second should be 0 seconds")
|
SECTION("ceil -999. milliseconds with target unit second should be 0 seconds")
|
||||||
{
|
{
|
||||||
REQUIRE(ceil<si::second>(-999._q_ms) == 0_q_s);
|
REQUIRE(ceil<si::second>(-999. * isq::time[ms]) == 0 * isq::time[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());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("round functions", "[round]")
|
TEST_CASE("round functions", "[round]")
|
||||||
{
|
{
|
||||||
SECTION("round 1 second with target unit second should be 1 second") { REQUIRE(round<si::second>(1_q_s) == 1_q_s); }
|
SECTION("round 1 second with target unit second should be 1 second")
|
||||||
|
{
|
||||||
|
REQUIRE(round<si::second>(1 * isq::time[s]) == 1 * isq::time[s]);
|
||||||
|
}
|
||||||
SECTION("round 1000 milliseconds with target unit second should be 1 second")
|
SECTION("round 1000 milliseconds with target unit second should be 1 second")
|
||||||
{
|
{
|
||||||
REQUIRE(round<si::second>(1000_q_ms) == 1_q_s);
|
REQUIRE(round<si::second>(1000 * isq::time[ms]) == 1 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("round 1001 milliseconds with target unit second should be 1 second")
|
SECTION("round 1001 milliseconds with target unit second should be 1 second")
|
||||||
{
|
{
|
||||||
REQUIRE(round<si::second>(1001_q_ms) == 1_q_s);
|
REQUIRE(round<si::second>(1001 * isq::time[ms]) == 1 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("round 1499 milliseconds with target unit second should be 1 second")
|
SECTION("round 1499 milliseconds with target unit second should be 1 second")
|
||||||
{
|
{
|
||||||
REQUIRE(round<si::second>(1499_q_ms) == 1_q_s);
|
REQUIRE(round<si::second>(1499 * isq::time[ms]) == 1 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("round 1500 milliseconds with target unit second should be 2 seconds")
|
SECTION("round 1500 milliseconds with target unit second should be 2 seconds")
|
||||||
{
|
{
|
||||||
REQUIRE(round<si::second>(1500_q_ms) == 2_q_s);
|
REQUIRE(round<si::second>(1500 * isq::time[ms]) == 2 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("round 1999 milliseconds with target unit second should be 2 seconds")
|
SECTION("round 1999 milliseconds with target unit second should be 2 seconds")
|
||||||
{
|
{
|
||||||
REQUIRE(round<si::second>(1999_q_ms) == 2_q_s);
|
REQUIRE(round<si::second>(1999 * isq::time[ms]) == 2 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("round -1000 milliseconds with target unit second should be -1 second")
|
SECTION("round -1000 milliseconds with target unit second should be -1 second")
|
||||||
{
|
{
|
||||||
REQUIRE(round<si::second>(-1000_q_ms) == -1_q_s);
|
REQUIRE(round<si::second>(-1000 * isq::time[ms]) == -1 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("round -1001 milliseconds with target unit second should be -1 second")
|
SECTION("round -1001 milliseconds with target unit second should be -1 second")
|
||||||
{
|
{
|
||||||
REQUIRE(round<si::second>(-1001_q_ms) == -1_q_s);
|
REQUIRE(round<si::second>(-1001 * isq::time[ms]) == -1 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("round -1499 milliseconds with target unit second should be -1 second")
|
SECTION("round -1499 milliseconds with target unit second should be -1 second")
|
||||||
{
|
{
|
||||||
REQUIRE(round<si::second>(-1499_q_ms) == -1_q_s);
|
REQUIRE(round<si::second>(-1499 * isq::time[ms]) == -1 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("round -1500 milliseconds with target unit second should be -2 seconds")
|
SECTION("round -1500 milliseconds with target unit second should be -2 seconds")
|
||||||
{
|
{
|
||||||
REQUIRE(round<si::second>(-1500_q_ms) == -2_q_s);
|
REQUIRE(round<si::second>(-1500 * isq::time[ms]) == -2 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("round -1999 milliseconds with target unit second should be -2 seconds")
|
SECTION("round -1999 milliseconds with target unit second should be -2 seconds")
|
||||||
{
|
{
|
||||||
REQUIRE(round<si::second>(-1999_q_ms) == -2_q_s);
|
REQUIRE(round<si::second>(-1999 * isq::time[ms]) == -2 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("round 1000. milliseconds with target unit second should be 1 second")
|
SECTION("round 1000. milliseconds with target unit second should be 1 second")
|
||||||
{
|
{
|
||||||
REQUIRE(round<si::second>(1000._q_ms) == 1_q_s);
|
REQUIRE(round<si::second>(1000. * isq::time[ms]) == 1 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("round 1001. milliseconds with target unit second should be 1 second")
|
SECTION("round 1001. milliseconds with target unit second should be 1 second")
|
||||||
{
|
{
|
||||||
REQUIRE(round<si::second>(1001._q_ms) == 1_q_s);
|
REQUIRE(round<si::second>(1001. * isq::time[ms]) == 1 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("round 1499. milliseconds with target unit second should be 1 second")
|
SECTION("round 1499. milliseconds with target unit second should be 1 second")
|
||||||
{
|
{
|
||||||
REQUIRE(round<si::second>(1499._q_ms) == 1_q_s);
|
REQUIRE(round<si::second>(1499. * isq::time[ms]) == 1 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("round 1500. milliseconds with target unit second should be 2 seconds")
|
SECTION("round 1500. milliseconds with target unit second should be 2 seconds")
|
||||||
{
|
{
|
||||||
REQUIRE(round<si::second>(1500._q_ms) == 2_q_s);
|
REQUIRE(round<si::second>(1500. * isq::time[ms]) == 2 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("round 1999. milliseconds with target unit second should be 2 seconds")
|
SECTION("round 1999. milliseconds with target unit second should be 2 seconds")
|
||||||
{
|
{
|
||||||
REQUIRE(round<si::second>(1999._q_ms) == 2_q_s);
|
REQUIRE(round<si::second>(1999. * isq::time[ms]) == 2 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("round -1000. milliseconds with target unit second should be -1 second")
|
SECTION("round -1000. milliseconds with target unit second should be -1 second")
|
||||||
{
|
{
|
||||||
REQUIRE(round<si::second>(-1000._q_ms) == -1_q_s);
|
REQUIRE(round<si::second>(-1000. * isq::time[ms]) == -1 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("round -1001. milliseconds with target unit second should be -1 second")
|
SECTION("round -1001. milliseconds with target unit second should be -1 second")
|
||||||
{
|
{
|
||||||
REQUIRE(round<si::second>(-1001._q_ms) == -1_q_s);
|
REQUIRE(round<si::second>(-1001. * isq::time[ms]) == -1 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("round -1499. milliseconds with target unit second should be -1 second")
|
SECTION("round -1499. milliseconds with target unit second should be -1 second")
|
||||||
{
|
{
|
||||||
REQUIRE(round<si::second>(-1499._q_ms) == -1_q_s);
|
REQUIRE(round<si::second>(-1499. * isq::time[ms]) == -1 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("round -1500. milliseconds with target unit second should be -2 seconds")
|
SECTION("round -1500. milliseconds with target unit second should be -2 seconds")
|
||||||
{
|
{
|
||||||
REQUIRE(round<si::second>(-1500._q_ms) == -2_q_s);
|
REQUIRE(round<si::second>(-1500. * isq::time[ms]) == -2 * isq::time[s]);
|
||||||
}
|
}
|
||||||
SECTION("round -1999. milliseconds with target unit second should be -2 seconds")
|
SECTION("round -1999. milliseconds with target unit second should be -2 seconds")
|
||||||
{
|
{
|
||||||
REQUIRE(round<si::second>(-1999._q_ms) == -2_q_s);
|
REQUIRE(round<si::second>(-1999. * isq::time[ms]) == -2 * isq::time[s]);
|
||||||
}
|
|
||||||
SECTION("round 1 second with target quantity with unit type second should be 1 second")
|
|
||||||
{
|
|
||||||
using showtime = si::time<si::second, int>;
|
|
||||||
REQUIRE(round<showtime>(showtime::one()) == showtime::one());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("hypot functions", "[hypot]")
|
TEST_CASE("hypot functions", "[hypot]")
|
||||||
{
|
{
|
||||||
using namespace units::aliases::isq::si;
|
|
||||||
|
|
||||||
SECTION("hypot should work on the same quantities")
|
SECTION("hypot should work on the same quantities")
|
||||||
{
|
{
|
||||||
REQUIRE(hypot(km<>(3.), km<>(4.)) == km<>(5.));
|
REQUIRE(hypot(3. * isq::length[km], 4. * isq::length[km]) == 5. * isq::length[km]);
|
||||||
REQUIRE(hypot(km<>(2.), km<>(3.), km<>(6.)) == km<>(7.));
|
REQUIRE(hypot(2. * isq::length[km], 3. * isq::length[km], 6. * isq::length[km]) == 7. * isq::length[km]);
|
||||||
}
|
}
|
||||||
SECTION("hypot should work with different units of the same dimension")
|
SECTION("hypot should work with different units of the same dimension")
|
||||||
{
|
{
|
||||||
REQUIRE(hypot(km<>(3.), m<>(4000.)) == km<>(5.));
|
REQUIRE(hypot(3. * isq::length[km], 4000. * isq::length[m]) == 5. * isq::length[km]);
|
||||||
REQUIRE(hypot(km<>(2.), m<>(3000.), km<>(6.)) == km<>(7.));
|
REQUIRE(hypot(2. * isq::length[km], 3000. * isq::length[m], 6. * isq::length[km]) == 7. * isq::length[km]);
|
||||||
}
|
|
||||||
SECTION("hypot should work with different but equivalent dimensions")
|
|
||||||
{
|
|
||||||
REQUIRE(hypot(km<>(3.), cgs::length::cm<>(400'000.)) == km<>(5.));
|
|
||||||
REQUIRE(hypot(km<>(2.), cgs::length::cm<>(300'000.), km<>(6.)) == km<>(7.));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("trigonometric functions", "[trig]")
|
|
||||||
{
|
|
||||||
using namespace units::aliases;
|
|
||||||
|
|
||||||
SECTION("sin")
|
|
||||||
{
|
|
||||||
REQUIRE_THAT(sin(deg<>(0.)), AlmostEquals(quantity{0.}));
|
|
||||||
REQUIRE_THAT(sin(deg<>(90.)), AlmostEquals(quantity{1.}));
|
|
||||||
REQUIRE_THAT(sin(deg<>(180.)), AlmostEquals(quantity{0.}));
|
|
||||||
REQUIRE_THAT(sin(deg<>(270.)), AlmostEquals(quantity{-1.}));
|
|
||||||
|
|
||||||
REQUIRE_THAT(sin(grad<>(0.)), AlmostEquals(quantity{0.}));
|
|
||||||
REQUIRE_THAT(sin(grad<>(100.)), AlmostEquals(quantity{1.}));
|
|
||||||
REQUIRE_THAT(sin(grad<>(200.)), AlmostEquals(quantity{0.}));
|
|
||||||
REQUIRE_THAT(sin(grad<>(300.)), AlmostEquals(quantity{-1.}));
|
|
||||||
}
|
|
||||||
|
|
||||||
SECTION("cos")
|
|
||||||
{
|
|
||||||
REQUIRE_THAT(cos(deg<>(0.)), AlmostEquals(quantity{1.}));
|
|
||||||
REQUIRE_THAT(cos(deg<>(90.)), AlmostEquals(quantity{0.}));
|
|
||||||
REQUIRE_THAT(cos(deg<>(180.)), AlmostEquals(quantity{-1.}));
|
|
||||||
REQUIRE_THAT(cos(deg<>(270.)), AlmostEquals(quantity{0.}));
|
|
||||||
|
|
||||||
REQUIRE_THAT(cos(grad<>(0.)), AlmostEquals(quantity{1.}));
|
|
||||||
REQUIRE_THAT(cos(grad<>(100.)), AlmostEquals(quantity{0.}));
|
|
||||||
REQUIRE_THAT(cos(grad<>(200.)), AlmostEquals(quantity{-1.}));
|
|
||||||
REQUIRE_THAT(cos(grad<>(300.)), AlmostEquals(quantity{0.}));
|
|
||||||
}
|
|
||||||
|
|
||||||
SECTION("tan")
|
|
||||||
{
|
|
||||||
REQUIRE_THAT(tan(deg<>(0.)), AlmostEquals(quantity{0.}));
|
|
||||||
REQUIRE_THAT(tan(deg<>(45.)), AlmostEquals(quantity{1.}));
|
|
||||||
REQUIRE_THAT(tan(deg<>(135.)), AlmostEquals(quantity{-1.}));
|
|
||||||
REQUIRE_THAT(tan(deg<>(180.)), AlmostEquals(quantity{0.}));
|
|
||||||
|
|
||||||
REQUIRE_THAT(tan(grad<>(0.)), AlmostEquals(quantity{0.}));
|
|
||||||
REQUIRE_THAT(tan(grad<>(50.)), AlmostEquals(quantity{1.}));
|
|
||||||
REQUIRE_THAT(tan(grad<>(150.)), AlmostEquals(quantity{-1.}));
|
|
||||||
REQUIRE_THAT(tan(grad<>(200.)), AlmostEquals(quantity{0.}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("inverse trigonometric functions", "[inv trig]")
|
|
||||||
{
|
|
||||||
using namespace units::aliases;
|
|
||||||
|
|
||||||
SECTION("asin")
|
|
||||||
{
|
|
||||||
REQUIRE_THAT(asin(quantity{-1.}), AlmostEquals(deg<>(-90.)));
|
|
||||||
REQUIRE_THAT(asin(quantity{0.}), AlmostEquals(deg<>(0.)));
|
|
||||||
REQUIRE_THAT(asin(quantity{1.}), AlmostEquals(deg<>(90.)));
|
|
||||||
}
|
|
||||||
|
|
||||||
SECTION("acos")
|
|
||||||
{
|
|
||||||
REQUIRE_THAT(asin(quantity{-1.}), AlmostEquals(deg<>(-90.)));
|
|
||||||
REQUIRE_THAT(asin(quantity{0.}), AlmostEquals(deg<>(0.)));
|
|
||||||
REQUIRE_THAT(asin(quantity{1.}), AlmostEquals(deg<>(90.)));
|
|
||||||
}
|
|
||||||
|
|
||||||
SECTION("atan")
|
|
||||||
{
|
|
||||||
REQUIRE_THAT(atan(quantity{-1.}), AlmostEquals(deg<>(-45.)));
|
|
||||||
REQUIRE_THAT(atan(quantity{0.}), AlmostEquals(deg<>(0.)));
|
|
||||||
REQUIRE_THAT(atan(quantity{1.}), AlmostEquals(deg<>(45.)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -160,7 +160,7 @@ concept invalid_operations = requires {
|
|||||||
requires !requires { 1 * time[second] * t; };
|
requires !requires { 1 * time[second] * t; };
|
||||||
requires !requires { 1 * time[second] == t; };
|
requires !requires { 1 * time[second] == t; };
|
||||||
requires !requires { 1 * time[second] < t; };
|
requires !requires { 1 * time[second] < t; };
|
||||||
};
|
};
|
||||||
static_assert(invalid_operations<time>);
|
static_assert(invalid_operations<time>);
|
||||||
|
|
||||||
// comparisons of the same dimensions
|
// comparisons of the same dimensions
|
||||||
@@ -174,15 +174,15 @@ static_assert(1 / time != frequency);
|
|||||||
static_assert(interconvertible(1 / time, frequency));
|
static_assert(interconvertible(1 / time, frequency));
|
||||||
static_assert(1 / frequency == time);
|
static_assert(1 / frequency == time);
|
||||||
static_assert(frequency * time == dimension_one);
|
static_assert(frequency * time == dimension_one);
|
||||||
static_assert(is_of_type<detail::common_dimension(1 / time, frequency), frequency_>);
|
static_assert(is_of_type<common_dimension(1 / time, frequency), frequency_>);
|
||||||
static_assert(is_of_type<detail::common_dimension(frequency, 1 / time), frequency_>);
|
static_assert(is_of_type<common_dimension(frequency, 1 / time), frequency_>);
|
||||||
|
|
||||||
static_assert(length * length != area);
|
static_assert(length * length != area);
|
||||||
static_assert(interconvertible(length * length, area));
|
static_assert(interconvertible(length * length, area));
|
||||||
static_assert(length * length != volume);
|
static_assert(length * length != volume);
|
||||||
static_assert(area / length == length);
|
static_assert(area / length == length);
|
||||||
static_assert(is_of_type<detail::common_dimension(length* length, area), area_>);
|
static_assert(is_of_type<common_dimension(length* length, area), area_>);
|
||||||
static_assert(is_of_type<detail::common_dimension(area, length* length), area_>);
|
static_assert(is_of_type<common_dimension(area, length* length), area_>);
|
||||||
|
|
||||||
static_assert(length * length * length != volume);
|
static_assert(length * length * length != volume);
|
||||||
static_assert(area * length != volume);
|
static_assert(area * length != volume);
|
||||||
@@ -197,9 +197,9 @@ static_assert(length * time != speed);
|
|||||||
static_assert(length / time / time != speed);
|
static_assert(length / time / time != speed);
|
||||||
static_assert(length / speed == time);
|
static_assert(length / speed == time);
|
||||||
static_assert(speed * time == length);
|
static_assert(speed * time == length);
|
||||||
static_assert(is_of_type<detail::common_dimension(length / time, speed), speed_>);
|
static_assert(is_of_type<common_dimension(length / time, speed), speed_>);
|
||||||
static_assert(is_of_type<detail::common_dimension(speed, length / time), speed_>);
|
static_assert(is_of_type<common_dimension(speed, length / time), speed_>);
|
||||||
static_assert(is_of_type<detail::common_dimension(length / time, length / time), decltype(length / time)>);
|
static_assert(is_of_type<common_dimension(length / time, length / time), decltype(length / time)>);
|
||||||
|
|
||||||
static_assert(length / time / time != acceleration);
|
static_assert(length / time / time != acceleration);
|
||||||
static_assert(length / (time * time) != acceleration);
|
static_assert(length / (time * time) != acceleration);
|
||||||
@@ -212,8 +212,8 @@ static_assert(acceleration / speed != frequency);
|
|||||||
// comparison of convertible named dimensions
|
// comparison of convertible named dimensions
|
||||||
static_assert(velocity != speed);
|
static_assert(velocity != speed);
|
||||||
static_assert(interconvertible(speed, velocity));
|
static_assert(interconvertible(speed, velocity));
|
||||||
static_assert(is_of_type<detail::common_dimension(velocity, speed), velocity_>);
|
static_assert(is_of_type<common_dimension(velocity, speed), velocity_>);
|
||||||
static_assert(is_of_type<detail::common_dimension(speed, velocity), velocity_>);
|
static_assert(is_of_type<common_dimension(speed, velocity), velocity_>);
|
||||||
|
|
||||||
// comparison of convertible unnamed dimensions
|
// comparison of convertible unnamed dimensions
|
||||||
static_assert(is_of_type<mass * acceleration, derived_dimension<length_, mass_, per<units::power<time_, 2>>>>);
|
static_assert(is_of_type<mass * acceleration, derived_dimension<length_, mass_, per<units::power<time_, 2>>>>);
|
||||||
@@ -233,7 +233,7 @@ template<auto T1, auto T2>
|
|||||||
concept no_common_type = requires {
|
concept no_common_type = requires {
|
||||||
requires !requires { typename std::common_type_t<decltype(T1), decltype(T2)>; };
|
requires !requires { typename std::common_type_t<decltype(T1), decltype(T2)>; };
|
||||||
requires !requires { typename std::common_type_t<decltype(T2), decltype(T1)>; };
|
requires !requires { typename std::common_type_t<decltype(T2), decltype(T1)>; };
|
||||||
};
|
};
|
||||||
static_assert(no_common_type<energy, torque>);
|
static_assert(no_common_type<energy, torque>);
|
||||||
|
|
||||||
static_assert(frequency != action);
|
static_assert(frequency != action);
|
||||||
|
@@ -123,7 +123,6 @@ concept invalid_operations = requires {
|
|||||||
requires !requires { s - 2; };
|
requires !requires { s - 2; };
|
||||||
requires !requires { 2 - s; };
|
requires !requires { 2 - s; };
|
||||||
requires !requires { s - s; };
|
requires !requires { s - s; };
|
||||||
requires !requires { s == s; };
|
|
||||||
requires !requires { s < s; };
|
requires !requires { s < s; };
|
||||||
requires !requires { s + 1 * time[second]; };
|
requires !requires { s + 1 * time[second]; };
|
||||||
requires !requires { s - 1 * time[second]; };
|
requires !requires { s - 1 * time[second]; };
|
||||||
@@ -137,7 +136,7 @@ concept invalid_operations = requires {
|
|||||||
requires !requires { 1 * time[second] / s; };
|
requires !requires { 1 * time[second] / s; };
|
||||||
requires !requires { 1 * time[second] == s; };
|
requires !requires { 1 * time[second] == s; };
|
||||||
requires !requires { 1 * time[second] < s; };
|
requires !requires { 1 * time[second] < s; };
|
||||||
};
|
};
|
||||||
static_assert(invalid_operations<time[second]>);
|
static_assert(invalid_operations<time[second]>);
|
||||||
|
|
||||||
static_assert(
|
static_assert(
|
||||||
|
@@ -427,7 +427,7 @@ concept invalid_operations = requires {
|
|||||||
requires !requires { 1 * time[second] * s; };
|
requires !requires { 1 * time[second] * s; };
|
||||||
requires !requires { 1 * time[second] == s; };
|
requires !requires { 1 * time[second] == s; };
|
||||||
requires !requires { 1 * time[second] < s; };
|
requires !requires { 1 * time[second] < s; };
|
||||||
};
|
};
|
||||||
static_assert(invalid_operations<second>);
|
static_assert(invalid_operations<second>);
|
||||||
|
|
||||||
// comparisons of the same units
|
// comparisons of the same units
|
||||||
@@ -503,35 +503,35 @@ static_assert(
|
|||||||
is_of_type<pow<2>(mag<3600>* second), scaled_unit<mag<3600> * mag<3600>, derived_unit<power<second_, 2>>>>);
|
is_of_type<pow<2>(mag<3600>* second), scaled_unit<mag<3600> * mag<3600>, derived_unit<power<second_, 2>>>>);
|
||||||
|
|
||||||
// common_type
|
// common_type
|
||||||
static_assert(is_of_type<detail::common_unit(gram, gram), gram_>);
|
static_assert(is_of_type<common_unit(gram, gram), gram_>);
|
||||||
static_assert(is_of_type<detail::common_unit(kilogram, kilogram), kilogram_>);
|
static_assert(is_of_type<common_unit(kilogram, kilogram), kilogram_>);
|
||||||
static_assert(is_of_type<detail::common_unit(si::kilo<gram>, kilogram), kilogram_>);
|
static_assert(is_of_type<common_unit(si::kilo<gram>, kilogram), kilogram_>);
|
||||||
static_assert(is_of_type<detail::common_unit(kilogram, si::kilo<gram>), kilogram_>);
|
static_assert(is_of_type<common_unit(kilogram, si::kilo<gram>), kilogram_>);
|
||||||
static_assert(is_of_type<detail::common_unit(mag<1000>* gram, kilogram), kilogram_>);
|
static_assert(is_of_type<common_unit(mag<1000>* gram, kilogram), kilogram_>);
|
||||||
static_assert(is_of_type<detail::common_unit(kilogram, mag<1000>* gram), kilogram_>);
|
static_assert(is_of_type<common_unit(kilogram, mag<1000>* gram), kilogram_>);
|
||||||
static_assert(is_of_type<detail::common_unit(1 / second, hertz), hertz_>);
|
static_assert(is_of_type<common_unit(1 / second, hertz), hertz_>);
|
||||||
static_assert(is_of_type<detail::common_unit(hertz, 1 / second), hertz_>);
|
static_assert(is_of_type<common_unit(hertz, 1 / second), hertz_>);
|
||||||
static_assert(is_of_type<detail::common_unit(gram, kilogram), gram_>);
|
static_assert(is_of_type<common_unit(gram, kilogram), gram_>);
|
||||||
static_assert(is_of_type<detail::common_unit(kilogram, gram), gram_>);
|
static_assert(is_of_type<common_unit(kilogram, gram), gram_>);
|
||||||
static_assert(is_of_type<detail::common_unit(second, hour), second_>);
|
static_assert(is_of_type<common_unit(second, hour), second_>);
|
||||||
static_assert(is_of_type<detail::common_unit(hour, second), second_>);
|
static_assert(is_of_type<common_unit(hour, second), second_>);
|
||||||
static_assert(is_of_type<detail::common_unit(minute, hour), minute_>);
|
static_assert(is_of_type<common_unit(minute, hour), minute_>);
|
||||||
static_assert(is_of_type<detail::common_unit(hour, minute), minute_>);
|
static_assert(is_of_type<common_unit(hour, minute), minute_>);
|
||||||
static_assert(
|
static_assert(
|
||||||
is_of_type<detail::common_unit(si::kilo<metre>, si::milli<metre>), std::remove_const_t<decltype(si::milli<metre>)>>);
|
is_of_type<common_unit(si::kilo<metre>, si::milli<metre>), std::remove_const_t<decltype(si::milli<metre>)>>);
|
||||||
static_assert(
|
static_assert(
|
||||||
is_of_type<detail::common_unit(si::milli<metre>, si::kilo<metre>), std::remove_const_t<decltype(si::milli<metre>)>>);
|
is_of_type<common_unit(si::milli<metre>, si::kilo<metre>), std::remove_const_t<decltype(si::milli<metre>)>>);
|
||||||
static_assert(is_of_type<detail::common_unit(yard, mile), yard_>);
|
static_assert(is_of_type<common_unit(yard, mile), yard_>);
|
||||||
static_assert(is_of_type<detail::common_unit(mile, yard), yard_>);
|
static_assert(is_of_type<common_unit(mile, yard), yard_>);
|
||||||
// TODO The below have long/unreadable magnitude types
|
// TODO The below have long/unreadable magnitude types
|
||||||
static_assert(is_of_type<detail::common_unit(kilometre / hour, metre / second),
|
static_assert(is_of_type<common_unit(kilometre / hour, metre / second),
|
||||||
scaled_unit<mag<ratio{1, 18}>, derived_unit<metre_, per<second_>>>>);
|
scaled_unit<mag<ratio{1, 18}>, derived_unit<metre_, per<second_>>>>);
|
||||||
static_assert(is_of_type<detail::common_unit(metre / second, kilometre / hour),
|
static_assert(is_of_type<common_unit(metre / second, kilometre / hour),
|
||||||
scaled_unit<mag<ratio{1, 18}>, derived_unit<metre_, per<second_>>>>);
|
scaled_unit<mag<ratio{1, 18}>, derived_unit<metre_, per<second_>>>>);
|
||||||
static_assert(is_of_type<detail::common_unit(kilometre, mile), scaled_unit<mag<ratio{8, 125}>, metre_>>);
|
static_assert(is_of_type<common_unit(kilometre, mile), scaled_unit<mag<ratio{8, 125}>, metre_>>);
|
||||||
static_assert(is_of_type<detail::common_unit(mile, kilometre), scaled_unit<mag<ratio{8, 125}>, metre_>>);
|
static_assert(is_of_type<common_unit(mile, kilometre), scaled_unit<mag<ratio{8, 125}>, metre_>>);
|
||||||
static_assert(
|
static_assert(
|
||||||
is_of_type<detail::common_unit(speed_of_light_in_vacuum_unit, metre / second), derived_unit<metre_, per<second_>>>);
|
is_of_type<common_unit(speed_of_light_in_vacuum_unit, metre / second), derived_unit<metre_, per<second_>>>);
|
||||||
|
|
||||||
// unit symbols
|
// unit symbols
|
||||||
#ifdef __cpp_lib_constexpr_string
|
#ifdef __cpp_lib_constexpr_string
|
||||||
|
Reference in New Issue
Block a user