From a96c34c17ae3ef5f3f3faf73145c28d4f614b3f6 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Mon, 19 Dec 2022 12:49:15 +0100 Subject: [PATCH] fix: `exp()` implementation fixed --- src/core/include/units/math.h | 2 +- test/unit_test/runtime/math_test.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/include/units/math.h b/src/core/include/units/math.h index 1add7346..56818c10 100644 --- a/src/core/include/units/math.h +++ b/src/core/include/units/math.h @@ -106,7 +106,7 @@ template * @param q Quantity being the base of the operation * @return Quantity The value of the same quantity type */ -template Q, typename Rep> +template Q> [[nodiscard]] inline Q exp(const Q& q) requires requires { exp(q.number()); } || requires { std::exp(q.number()); } { diff --git a/test/unit_test/runtime/math_test.cpp b/test/unit_test/runtime/math_test.cpp index 06b18525..3ed98f6d 100644 --- a/test/unit_test/runtime/math_test.cpp +++ b/test/unit_test/runtime/math_test.cpp @@ -66,6 +66,8 @@ TEST_CASE("'pow()' on quantity changes the value and the dimension acc REQUIRE(pow<1, 4>(16 * isq::area[m2]) == sqrt(4 * isq::length[m])); } +// TODO add tests for exp() + TEST_CASE("absolute functions on quantity returns the absolute value", "[math][abs][fabs]") { SECTION("'abs()' on a negative quantity returns the abs")