mirror of
https://github.com/saymrwulf/uhd.git
synced 2026-05-16 21:10:10 +00:00
We've been having issues with moving locations of Boost headers for this function, and it's simple enough to implement ourselves.
26 lines
586 B
C++
26 lines
586 B
C++
//
|
|
// Copyright 2014 Ettus Research LLC
|
|
// Copyright 2018 Ettus Research, a National Instruments Company
|
|
//
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
//
|
|
|
|
#include <uhd/utils/math.hpp>
|
|
#include <boost/test/unit_test.hpp>
|
|
|
|
BOOST_AUTO_TEST_CASE(test_lcm)
|
|
{
|
|
BOOST_CHECK_EQUAL(uhd::math::lcm<int>(2, 3), 6);
|
|
}
|
|
|
|
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);
|
|
}
|