summaryrefslogtreecommitdiffstats
path: root/host/tests/convert_test.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2012-02-08 12:37:58 -0800
committerJosh Blum <josh@joshknows.com>2012-02-08 12:37:58 -0800
commit2a79f1928087660b07e183dd81e259fa764a9945 (patch)
tree6129d9f0fb2a5dc8383284ae2ba58b5b2fd09094 /host/tests/convert_test.cpp
parent893af3dc280a5d85be2a5beb266dba9bb538292c (diff)
downloaduhd-2a79f1928087660b07e183dd81e259fa764a9945.tar.gz
uhd-2a79f1928087660b07e183dd81e259fa764a9945.tar.bz2
uhd-2a79f1928087660b07e183dd81e259fa764a9945.zip
uhd: better quantization check for convert test
Diffstat (limited to 'host/tests/convert_test.cpp')
-rw-r--r--host/tests/convert_test.cpp9
1 files changed, 5 insertions, 4 deletions
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<boost::int16_t> sc16_t;
typedef std::complex<float> fc32_t;
typedef std::complex<double> 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));
}
}