test_log1p_expm1.cpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // Copyright John Maddock 2006-15.
  2. // Copyright Paul A. Bristow 2007
  3. // Use, modification and distribution are subject to the
  4. // Boost Software License, Version 1.0. (See accompanying file
  5. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. #define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error
  7. #include "bindings.hpp"
  8. #include "../../test/log1p_expm1_test.hpp"
  9. #include <boost/math/special_functions/expm1.hpp>
  10. #include <boost/math/special_functions/log1p.hpp>
  11. #define BOOST_TEST_MAIN
  12. #include <boost/test/unit_test.hpp>
  13. BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(test_main, 10000);
  14. BOOST_AUTO_TEST_CASE(test_main)
  15. {
  16. BOOST_MATH_CONTROL_FP;
  17. error_stream_replacer rep;
  18. #ifdef TYPE_TO_TEST
  19. test(static_cast<TYPE_TO_TEST>(0), NAME_OF_TYPE_TO_TEST);
  20. #else
  21. bool test_float = false;
  22. bool test_double = false;
  23. bool test_long_double = false;
  24. if(std::numeric_limits<long double>::digits == std::numeric_limits<double>::digits)
  25. {
  26. //
  27. // Don't bother with long double, it's the same as double:
  28. //
  29. if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false)
  30. test_float = true;
  31. test_double = true;
  32. }
  33. else
  34. {
  35. if(BOOST_MATH_PROMOTE_FLOAT_POLICY == false)
  36. test_float = true;
  37. if(BOOST_MATH_PROMOTE_DOUBLE_POLICY == false)
  38. test_double = true;
  39. test_long_double = true;
  40. }
  41. #ifdef ALWAYS_TEST_DOUBLE
  42. test_double = true;
  43. #endif
  44. if(test_float)
  45. test(0.0f, "float");
  46. if(test_double)
  47. test(0.0, "double");
  48. if(test_long_double)
  49. test(0.0L, "long double");
  50. #ifdef BOOST_MATH_USE_FLOAT128
  51. //test(0.0Q, "__float128");
  52. #endif
  53. #endif
  54. }