From 91c10b66c23178e27bbff0e9173570c63e342736 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Tue, 31 Aug 2021 11:46:39 +0200 Subject: uhd: math: Add a sign() function We've been having issues with moving locations of Boost headers for this function, and it's simple enough to implement ourselves. --- host/tests/math_test.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'host/tests') diff --git a/host/tests/math_test.cpp b/host/tests/math_test.cpp index c1b6793bb..1fb01f5c1 100644 --- a/host/tests/math_test.cpp +++ b/host/tests/math_test.cpp @@ -17,3 +17,10 @@ BOOST_AUTO_TEST_CASE(test_gcd) { BOOST_CHECK_EQUAL(uhd::math::gcd(6, 15), 3); } + +BOOST_AUTO_TEST_CASE(test_sign) +{ + BOOST_CHECK_EQUAL(uhd::math::sign(2.3), +1); + BOOST_CHECK_EQUAL(uhd::math::sign(-2.3), -1); + BOOST_CHECK_EQUAL(uhd::math::sign(0.0), 0); +} -- cgit v1.2.3