From 2a79f1928087660b07e183dd81e259fa764a9945 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 8 Feb 2012 12:37:58 -0800 Subject: uhd: better quantization check for convert test --- host/tests/convert_test.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'host/tests') diff --git a/host/tests/convert_test.cpp b/host/tests/convert_test.cpp index 519b7b711..0ce4ebacb 100644 --- a/host/tests/convert_test.cpp +++ b/host/tests/convert_test.cpp @@ -31,8 +31,9 @@ typedef std::complex sc16_t; typedef std::complex fc32_t; typedef std::complex fc64_t; -#define MY_CHECK_CLOSE(a, b, f) if ((std::abs(a) > (f))) \ - BOOST_CHECK_CLOSE_FRACTION(a, b, f) +#define MY_CHECK_CLOSE(a, b, f) { \ + BOOST_CHECK_MESSAGE(std::abs((a)-(b)) < f, " " << #a << " (" << (a) << ") error " << #b << " (" << (b) << ")"); \ +} /*********************************************************************** * Loopback runner: @@ -134,8 +135,8 @@ static void test_convert_types_for_floats( std::swap(out_id.num_inputs, out_id.num_outputs); loopback(nsamps, in_id, out_id, input, output); for (size_t i = 0; i < nsamps; i++){ - MY_CHECK_CLOSE(input[i].real(), output[i].real(), value_type(0.01)); - MY_CHECK_CLOSE(input[i].imag(), output[i].imag(), value_type(0.01)); + MY_CHECK_CLOSE(input[i].real(), output[i].real(), value_type(1./32767)); + MY_CHECK_CLOSE(input[i].imag(), output[i].imag(), value_type(1./32767)); } } -- cgit v1.2.3