diff options
author | Josh Blum <josh@joshknows.com> | 2010-06-08 14:55:57 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-06-08 14:55:57 -0700 |
commit | 37cf8a77e86de2d9247738ed6ce7b2534e66e2f8 (patch) | |
tree | 312a25a36a98c3bf73c684633567c010108c5010 /host/test | |
parent | 6c8aab3937f1f8904126b0b398f178b494ff9583 (diff) | |
download | uhd-37cf8a77e86de2d9247738ed6ce7b2534e66e2f8.tar.gz uhd-37cf8a77e86de2d9247738ed6ce7b2534e66e2f8.tar.bz2 uhd-37cf8a77e86de2d9247738ed6ce7b2534e66e2f8.zip |
float casts to remove msvc warnings
Diffstat (limited to 'host/test')
-rw-r--r-- | host/test/convert_types_test.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/host/test/convert_types_test.cpp b/host/test/convert_types_test.cpp index 096da441b..1587be57f 100644 --- a/host/test/convert_types_test.cpp +++ b/host/test/convert_types_test.cpp @@ -84,10 +84,12 @@ typedef std::complex<float> fc32_t; BOOST_CHECK_CLOSE(a1.real(), a2.real(), p); \ BOOST_CHECK_CLOSE(a1.imag(), a2.imag(), p); +static const float tolerance = float(0.1); + BOOST_AUTO_TEST_CASE(test_convert_types_be_fc32){ fc32_t in_fc32[] = { - fc32_t(0, -0.2), fc32_t(0.03, -0.16), - fc32_t(1.0, .45), fc32_t(0.09, 0) + fc32_t(float(0), float(-0.2)), fc32_t(float(0.03), float(-0.16)), + fc32_t(float(1.0), float(.45)), fc32_t(float(0.09), float(0)) }, out_fc32[4]; io_type_t io_type(io_type_t::COMPLEX_FLOAT32); @@ -97,16 +99,16 @@ BOOST_AUTO_TEST_CASE(test_convert_types_be_fc32){ loopback<fc32_t, boost::uint32_t, 4>(io_type, otw_type, in_fc32, out_fc32); - BOOST_CHECK_CLOSE_COMPLEX(in_fc32[0], out_fc32[0], 0.1); - BOOST_CHECK_CLOSE_COMPLEX(in_fc32[1], out_fc32[1], 0.1); - BOOST_CHECK_CLOSE_COMPLEX(in_fc32[2], out_fc32[2], 0.1); - BOOST_CHECK_CLOSE_COMPLEX(in_fc32[3], out_fc32[3], 0.1); + BOOST_CHECK_CLOSE_COMPLEX(in_fc32[0], out_fc32[0], tolerance); + BOOST_CHECK_CLOSE_COMPLEX(in_fc32[1], out_fc32[1], tolerance); + BOOST_CHECK_CLOSE_COMPLEX(in_fc32[2], out_fc32[2], tolerance); + BOOST_CHECK_CLOSE_COMPLEX(in_fc32[3], out_fc32[3], tolerance); } BOOST_AUTO_TEST_CASE(test_convert_types_le_fc32){ fc32_t in_fc32[] = { - fc32_t(0, -0.2), fc32_t(0.03, -0.16), - fc32_t(1.0, .45), fc32_t(0.09, 0) + fc32_t(float(0), float(-0.2)), fc32_t(float(0.03), float(-0.16)), + fc32_t(float(1.0), float(.45)), fc32_t(float(0.09), float(0)) }, out_fc32[4]; io_type_t io_type(io_type_t::COMPLEX_FLOAT32); @@ -116,8 +118,8 @@ BOOST_AUTO_TEST_CASE(test_convert_types_le_fc32){ loopback<fc32_t, boost::uint32_t, 4>(io_type, otw_type, in_fc32, out_fc32); - BOOST_CHECK_CLOSE_COMPLEX(in_fc32[0], out_fc32[0], 0.1); - BOOST_CHECK_CLOSE_COMPLEX(in_fc32[1], out_fc32[1], 0.1); - BOOST_CHECK_CLOSE_COMPLEX(in_fc32[2], out_fc32[2], 0.1); - BOOST_CHECK_CLOSE_COMPLEX(in_fc32[3], out_fc32[3], 0.1); + BOOST_CHECK_CLOSE_COMPLEX(in_fc32[0], out_fc32[0], tolerance); + BOOST_CHECK_CLOSE_COMPLEX(in_fc32[1], out_fc32[1], tolerance); + BOOST_CHECK_CLOSE_COMPLEX(in_fc32[2], out_fc32[2], tolerance); + BOOST_CHECK_CLOSE_COMPLEX(in_fc32[3], out_fc32[3], tolerance); } |