From b3d0a91d36392fc3b1daf4ba20a378c343b90654 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Mon, 6 Jul 2015 03:41:14 -0400 Subject: [PATCH] fix tests - do not use pow(int, int) - fix unify_pretty_function() - replace typenames --- tests/base/functions_12.cc | 2 +- tests/base/number_traits_complex.cc | 12 +++++++++++- tests/tests.h | 3 ++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/tests/base/functions_12.cc b/tests/base/functions_12.cc index 8cfbcf1f9e..92b33a989d 100644 --- a/tests/base/functions_12.cc +++ b/tests/base/functions_12.cc @@ -32,7 +32,7 @@ void check() std::vector coeffs(n_mon); for (unsigned int i = 0; i < n_mon; ++i) - coeffs[i] = std::pow(-1,i)*(i+1); + coeffs[i] = std::pow(-1.0,i)*(i+1); Functions::Polynomial poly(exponents, coeffs); diff --git a/tests/base/number_traits_complex.cc b/tests/base/number_traits_complex.cc index 61ee16f875..8119975055 100644 --- a/tests/base/number_traits_complex.cc +++ b/tests/base/number_traits_complex.cc @@ -23,11 +23,21 @@ #include #include +// replace type names found on MAC OS +std::string cleanup_type(std::string &in) +{ + std::string ret = in; + ret = Utilities::replace_in_string(ret, "NSt3__17complexIfEE", "St7complexIfE"); + ret = Utilities::replace_in_string(ret, "NSt3__17complexIdEE", "St7complexIdE"); + return ret; +} + template void check (const number &x) { - deallog << "typeid(x).name() = " << typeid(x).name() + deallog << "typeid(x).name() = " + << cleanup_type(typeid(x).name()) << std::endl; deallog << "typeid(NumberTraits::real_type).name() = " diff --git a/tests/tests.h b/tests/tests.h index 5b3a6d4619..ddbb108279 100644 --- a/tests/tests.h +++ b/tests/tests.h @@ -145,8 +145,9 @@ void sort_file_contents (const std::string &filename) std::string unify_pretty_function (const std::string &text) { std::string t=text; - t=Utilities::replace_in_string(t, " &", "& "); + t=Utilities::replace_in_string(t, " &", " & "); t=Utilities::replace_in_string(t, " & ,", "&,"); + t=Utilities::replace_in_string(t, " & )", "&)"); t=Utilities::replace_in_string(t, " & ", "& "); t=Utilities::replace_in_string(t, "virtual ", ""); return t; -- 2.39.5