diff --git a/test/unit_test/runtime/math_test.cpp b/test/unit_test/runtime/math_test.cpp index d74c93ef..22464106 100644 --- a/test/unit_test/runtime/math_test.cpp +++ b/test/unit_test/runtime/math_test.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -30,7 +31,7 @@ using namespace units; using namespace units::isq; -using namespace units::isq::si; +using namespace units::isq::si::literals; // classical @@ -363,3 +364,21 @@ TEMPLATE_PRODUCT_TEST_CASE_SIG("detail::iroot()", "[math][pow][iroot]", (std: ROOT_TEST_CASE(CompileRoot) ROOT_TEST_CASE(RuntimeRoot) + +TEST_CASE("hypot functions", "[hypot]") +{ + using namespace units::aliases::isq::si; + + SECTION("hypot of 3 kilometres with 4 kilometres should be 5 kilometres") + { + REQUIRE(hypot(km<>(3.), km<>(4.)) == km<>(5.)); + } + SECTION("hypot should work with different units of the same dimension") + { + REQUIRE(hypot(km<>(3.), m<>(4000.)) == km<>(5.)); + } + SECTION("hypot should work with different but equivalent dimensions") + { + REQUIRE(hypot(km<>(3.), cgs::length::cm<>(400'000.)) == km<>(5.)); + } +}