From ca29ea563e6bc55e0c47f693c817fea54c6a33c5 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Tue, 2 Feb 2021 19:35:15 +0000 Subject: [PATCH] catch bad_alloc exceptions in wavelet tests. See https://github.com/boostorg/math/issues/515. --- test/daubechies_wavelet_test.cpp | 17 ++++++++++++----- test/wavelet_transform_test.cpp | 21 ++++++++++++++------- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/test/daubechies_wavelet_test.cpp b/test/daubechies_wavelet_test.cpp index 2b16d76b9..3059111b2 100644 --- a/test/daubechies_wavelet_test.cpp +++ b/test/daubechies_wavelet_test.cpp @@ -120,12 +120,19 @@ void test_quadratures() int main() { #ifndef __MINGW32__ - test_exact_value(); + try + { + test_exact_value(); - boost::hana::for_each(std::make_index_sequence<17>(), [&](auto i){ - test_quadratures(); - test_quadratures(); - }); + boost::hana::for_each(std::make_index_sequence<17>(), [&](auto i) { + test_quadratures(); + test_quadratures(); + }); + } + catch (std::bad_alloc) + { + // not much we can do about this, this test uses lots of memory! + } #endif return boost::math::test::report_errors(); } diff --git a/test/wavelet_transform_test.cpp b/test/wavelet_transform_test.cpp index d1751ed9f..b3484b49d 100644 --- a/test/wavelet_transform_test.cpp +++ b/test/wavelet_transform_test.cpp @@ -132,12 +132,19 @@ void test_wavelet_transform() int main() { - test_wavelet_transform(); - test_wavelet_transform(); - test_wavelet_transform(); - // All these tests pass, but the compilation takes too long on CI: - //boost::hana::for_each(std::make_index_sequence<17>(), [&](auto i) { - // test_wavelet_transform(); - //}); + try{ + test_wavelet_transform(); + test_wavelet_transform(); + test_wavelet_transform(); + // All these tests pass, but the compilation takes too long on CI: + //boost::hana::for_each(std::make_index_sequence<17>(), [&](auto i) { + // test_wavelet_transform(); + //}); + } + catch (std::bad_alloc) + { + // not much we can do about this, this test uses lots of memory! + } + return boost::math::test::report_errors(); }