aboutsummaryrefslogtreecommitdiffstats
path: root/host/tests/math_test.cpp
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2021-08-31 11:46:39 +0200
committerAaron Rossetto <aaron.rossetto@ni.com>2021-10-19 12:21:33 -0700
commit91c10b66c23178e27bbff0e9173570c63e342736 (patch)
treeb9839cd72aa7ed2aaab52738b0610f81a5c8ac91 /host/tests/math_test.cpp
parent692a588723ec77b62179b70e17eb157ef1b4ea31 (diff)
downloaduhd-91c10b66c23178e27bbff0e9173570c63e342736.tar.gz
uhd-91c10b66c23178e27bbff0e9173570c63e342736.tar.bz2
uhd-91c10b66c23178e27bbff0e9173570c63e342736.zip
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.
Diffstat (limited to 'host/tests/math_test.cpp')
-rw-r--r--host/tests/math_test.cpp7
1 files changed, 7 insertions, 0 deletions
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<int>(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);
+}