diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-07-06 14:04:17 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-07-07 13:42:48 -0700 |
commit | 38723f62183227068dc3163278cd7d2de8c01218 (patch) | |
tree | 7d97eaf962006efe5395ae93691df11b2b30dbb0 /host | |
parent | 6ff5cd4f8c92b43b2a38d292d1e2dc046696eb1f (diff) | |
download | uhd-38723f62183227068dc3163278cd7d2de8c01218.tar.gz uhd-38723f62183227068dc3163278cd7d2de8c01218.tar.bz2 uhd-38723f62183227068dc3163278cd7d2de8c01218.zip |
converters: Added some tolerance for floating point-based tests to account for acceptable rounding
Diffstat (limited to 'host')
-rw-r--r-- | host/tests/convert_test.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/host/tests/convert_test.cpp b/host/tests/convert_test.cpp index dd04dcafc..cd31a7846 100644 --- a/host/tests/convert_test.cpp +++ b/host/tests/convert_test.cpp @@ -551,7 +551,10 @@ static void test_convert_types_fc32( std::swap(out_id.input_format, out_id.output_format); std::swap(out_id.num_inputs, out_id.num_outputs); loopback(nsamps, in_id, out_id, input, output); - BOOST_CHECK_EQUAL_COLLECTIONS(input.begin(), input.end(), output.begin(), output.end()); + for (size_t i = 0; i < nsamps; i++){ + MY_CHECK_CLOSE(input[i].real(), output[i].real(), float(1./(1 << 16))); + MY_CHECK_CLOSE(input[i].imag(), output[i].imag(), float(1./(1 << 16))); + } } BOOST_AUTO_TEST_CASE(test_convert_types_fc32_and_fc32){ @@ -589,7 +592,9 @@ static void test_convert_types_f32( std::swap(out_id.input_format, out_id.output_format); std::swap(out_id.num_inputs, out_id.num_outputs); loopback(nsamps, in_id, out_id, input, output); - BOOST_CHECK_EQUAL_COLLECTIONS(input.begin(), input.end(), output.begin(), output.end()); + for (size_t i = 0; i < nsamps; i++){ + MY_CHECK_CLOSE(input[i], output[i], float(1./(1 << 16))); + } } BOOST_AUTO_TEST_CASE(test_convert_types_f32_and_f32){ |