aboutsummaryrefslogtreecommitdiffstats
path: root/host/tests/fp_compare_delta_test.cpp
diff options
context:
space:
mode:
authorAshish Chaudhari <ashish@ettus.com>2015-03-17 13:52:29 -0700
committerAshish Chaudhari <ashish@ettus.com>2015-03-17 13:52:29 -0700
commit6a34824ad10eaa2d2b642b959f278f6c4e326d6d (patch)
tree1aa582ee8e5cef716b59ec4deb3a8e5f4f532929 /host/tests/fp_compare_delta_test.cpp
parent5682321efa26bb97f5d0c37d8e9921fc11a9b923 (diff)
parent306b5243e12af0db493856ad8397abac9835db0c (diff)
downloaduhd-6a34824ad10eaa2d2b642b959f278f6c4e326d6d.tar.gz
uhd-6a34824ad10eaa2d2b642b959f278f6c4e326d6d.tar.bz2
uhd-6a34824ad10eaa2d2b642b959f278f6c4e326d6d.zip
Merge branch 'master' into ashish/vivado
Diffstat (limited to 'host/tests/fp_compare_delta_test.cpp')
-rw-r--r--host/tests/fp_compare_delta_test.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/host/tests/fp_compare_delta_test.cpp b/host/tests/fp_compare_delta_test.cpp
index 9b009a79d..36ff14756 100644
--- a/host/tests/fp_compare_delta_test.cpp
+++ b/host/tests/fp_compare_delta_test.cpp
@@ -101,8 +101,8 @@ BOOST_AUTO_TEST_CASE(double_equality_operators) {
BOOST_AUTO_TEST_CASE(float_inequality_operators) {
// Test inequality operator, which is based on equality operator
- fp_compare_delta<float> alpha = fp_compare_delta<float>(127.0);
- fp_compare_delta<float> beta = fp_compare_delta<float>(alpha._value + 1.19e-3);
+ fp_compare_delta<float> alpha = fp_compare_delta<float>(127.0f);
+ fp_compare_delta<float> beta = fp_compare_delta<float>(alpha._value + 1.19e-3f);
BOOST_CHECK(alpha != beta);
BOOST_CHECK(alpha != float(alpha._value + 1.19e-3));
@@ -119,17 +119,17 @@ BOOST_AUTO_TEST_CASE(double_inequality_operators) {
BOOST_AUTO_TEST_CASE(float_lessthan_operators) {
// Test less-than operator
- fp_compare_delta<float> alpha = fp_compare_delta<float>(274192.7);
- fp_compare_delta<float> beta = fp_compare_delta<float>(alpha._value - 0.2);
+ fp_compare_delta<float> alpha = fp_compare_delta<float>(274192.7f);
+ fp_compare_delta<float> beta = fp_compare_delta<float>(alpha._value - 0.2f);
BOOST_CHECK(beta < alpha);
BOOST_CHECK(float(alpha._value - 0.2) < alpha);
// Confirm false less-than case
- fp_compare_delta<float> charlie = fp_compare_delta<float>(alpha._value - 1.2);
+ fp_compare_delta<float> charlie = fp_compare_delta<float>(alpha._value - 1.2f);
BOOST_CHECK(not (alpha < charlie));
- BOOST_CHECK(not (alpha < float(alpha._value - 1.2)));
+ BOOST_CHECK(not (alpha < float(alpha._value - 1.2f)));
}
BOOST_AUTO_TEST_CASE(double_lessthan_operators) {
@@ -149,14 +149,14 @@ BOOST_AUTO_TEST_CASE(double_lessthan_operators) {
BOOST_AUTO_TEST_CASE(float_lessthanequals_operators) {
// Test that <= correctly reports for equal values
- fp_compare_delta<float> alpha = fp_compare_delta<float>(827.3);
+ fp_compare_delta<float> alpha = fp_compare_delta<float>(827.3f);
fp_compare_delta<float> beta = fp_compare_delta<float>(alpha._value);
BOOST_CHECK(alpha <= beta);
BOOST_CHECK(alpha <= float(alpha._value));
// Test that <= correctly reports for less-than values
- fp_compare_delta<float> charlie = fp_compare_delta<float>(alpha._value - 1.2);
+ fp_compare_delta<float> charlie = fp_compare_delta<float>(alpha._value - 1.2f);
BOOST_CHECK(charlie <= alpha);
BOOST_CHECK(float(alpha._value - 1.2) <= alpha);
@@ -179,14 +179,14 @@ BOOST_AUTO_TEST_CASE(double_lessthanequals_operators) {
BOOST_AUTO_TEST_CASE(float_greaterthan_operators) {
// Test basic greater-than functionality
- fp_compare_delta<float> alpha = fp_compare_delta<float>(98325.4);
- fp_compare_delta<float> beta = fp_compare_delta<float>(alpha._value + 0.15);
+ fp_compare_delta<float> alpha = fp_compare_delta<float>(98325.4f);
+ fp_compare_delta<float> beta = fp_compare_delta<float>(alpha._value + 0.15f);
BOOST_CHECK(beta > alpha);
BOOST_CHECK(float(alpha._value + 0.15) > alpha);
// Test false greater-than case
- fp_compare_delta<float> charlie = fp_compare_delta<float>(alpha._value + 1.2);
+ fp_compare_delta<float> charlie = fp_compare_delta<float>(alpha._value + 1.2f);
BOOST_CHECK(not (alpha > charlie));
BOOST_CHECK(not (alpha > float(alpha._value + 1.2)));
@@ -209,14 +209,14 @@ BOOST_AUTO_TEST_CASE(double_greaterthan_operators) {
BOOST_AUTO_TEST_CASE(float_greaterthanequals_operators) {
// Test that >= correctly reports for equal values
- fp_compare_delta<float> alpha = fp_compare_delta<float>(7834.89);
+ fp_compare_delta<float> alpha = fp_compare_delta<float>(7834.89f);
fp_compare_delta<float> beta = fp_compare_delta<float>(alpha._value);
BOOST_CHECK(alpha >= beta);
BOOST_CHECK(alpha >= float(alpha._value));
// Test that >= correctly reports for greater-than values
- fp_compare_delta<float> charlie = fp_compare_delta<float>(alpha._value + 4.8);
+ fp_compare_delta<float> charlie = fp_compare_delta<float>(alpha._value + 4.8f);
BOOST_CHECK(charlie >= alpha);
BOOST_CHECK(float(alpha._value + 4.8) >= alpha);
@@ -239,12 +239,12 @@ BOOST_AUTO_TEST_CASE(double_greaterthanequals_operators) {
BOOST_AUTO_TEST_CASE(frequency_compare_function) {
- BOOST_CHECK(uhd::math::frequencies_are_equal(6817333232, 6817333232));
- BOOST_CHECK(!uhd::math::frequencies_are_equal(6817333233, 6817333232));
+ BOOST_CHECK(uhd::math::frequencies_are_equal(6817333232.0, 6817333232.0));
+ BOOST_CHECK(!uhd::math::frequencies_are_equal(6817333233.0, 6817333232.0));
BOOST_CHECK(uhd::math::frequencies_are_equal(6817333232.1, 6817333232.1));
BOOST_CHECK(!uhd::math::frequencies_are_equal(6817333232.5, 6817333232.6));
BOOST_CHECK(uhd::math::frequencies_are_equal(16.8173332321e9, 16.8173332321e9));
BOOST_CHECK(!uhd::math::frequencies_are_equal(16.8173332322e9, 16.8173332321e9));
BOOST_CHECK(!uhd::math::frequencies_are_equal(5.0, 4.0));
- BOOST_CHECK(uhd::math::frequencies_are_equal(48750000, 48749999.9946));
+ BOOST_CHECK(uhd::math::frequencies_are_equal(48750000.0, 48749999.9946));
}