diff options
author | Paul Adenot <[email protected]> | 2016-03-24 16:41:49 +0100 |
---|---|---|
committer | Paul Adenot <[email protected]> | 2016-03-24 16:41:49 +0100 |
commit | 80356a005db1a5a6cf01fd76f8f337f6b4119997 (patch) | |
tree | 7b764dc11d79ed2d32072937b45adbedfb5434c8 /test/test_resampler.cpp | |
parent | 2e1b6fb870b59aa8221857fe401c9e7eb679c016 (diff) | |
download | cubeb-80356a005db1a5a6cf01fd76f8f337f6b4119997.tar.gz cubeb-80356a005db1a5a6cf01fd76f8f337f6b4119997.zip |
Enable asserts in test_resampler.cpp.
Diffstat (limited to 'test/test_resampler.cpp')
-rw-r--r-- | test/test_resampler.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/test/test_resampler.cpp b/test/test_resampler.cpp index ba27b2a..2412146 100644 --- a/test/test_resampler.cpp +++ b/test/test_resampler.cpp @@ -5,6 +5,9 @@ * accompanying file LICENSE for details. */ +#ifdef NDEBUG +#undef NDEBUG +#endif #include "config.h" #include "cubeb_resampler_internal.h" #include <assert.h> @@ -222,7 +225,7 @@ void test_resampler_one_way(uint32_t channels, uint32_t source_rate, uint32_t ta // compare, taking the latency into account bool fuzzy_equal = true; for (uint32_t i = resampler.latency() + 1; i < expected.length(); i++) { - float diff = abs(expected.data()[i] - destination.data()[i]); + float diff = fabs(expected.data()[i] - destination.data()[i]); if (diff > epsilon<T>(resampling_ratio)) { fprintf(stderr, "divergence at %d: %f %f (delta %f)\n", i, expected.data()[i], destination.data()[i], diff); fuzzy_equal = false; @@ -307,10 +310,10 @@ bool array_fuzzy_equal(const auto_array<T>& lhs, const auto_array<T>& rhs, T eps uint32_t len = std::min(lhs.length(), rhs.length()); for (uint32_t i = 0; i < len; i++) { - if (abs(lhs.at(i) - rhs.at(i)) > epsi) { + if (fabs(lhs.at(i) - rhs.at(i)) > epsi) { std::cout << "not fuzzy equal at index: " << i << " lhs: " << lhs.at(i) << " rhs: " << rhs.at(i) - << " delta: " << abs(lhs.at(i) - rhs.at(i)) + << " delta: " << fabs(lhs.at(i) - rhs.at(i)) << " epsilon: "<< epsi << std::endl; return false; } @@ -377,7 +380,7 @@ void test_resampler_duplex(uint32_t input_channels, uint32_t output_channels, output_buffer.data(), output_array_frame_count); /* handle leftover input */ - if (input_array_frame_count != input_consumed) { + if (input_array_frame_count != static_cast<uint32_t>(input_consumed)) { leftover_input_frames = input_array_frame_count - input_consumed; input_buffer.pop(nullptr, leftover_input_frames * input_channels); } else { |