test_gamma.cpp 1.5 KB

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