sf_factorials_incl_test.cpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright John Maddock 2006.
  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. //
  6. // Basic sanity check that header <boost/math/special_functions/factorials.hpp>
  7. // #includes all the files that it needs to.
  8. //
  9. #include <boost/math/special_functions/factorials.hpp>
  10. //
  11. // Note this header includes no other headers, this is
  12. // important if this test is to be meaningful:
  13. //
  14. #include "test_compile_result.hpp"
  15. void compile_and_link_test()
  16. {
  17. check_result<float>(boost::math::factorial<float>(u));
  18. check_result<double>(boost::math::factorial<double>(u));
  19. #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
  20. check_result<long double>(boost::math::factorial<long double>(u));
  21. #endif
  22. check_result<float>(boost::math::double_factorial<float>(u));
  23. check_result<double>(boost::math::double_factorial<double>(u));
  24. #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
  25. check_result<long double>(boost::math::double_factorial<long double>(u));
  26. #endif
  27. check_result<float>(boost::math::rising_factorial<float>(f, i));
  28. check_result<double>(boost::math::rising_factorial<double>(d, i));
  29. #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
  30. check_result<long double>(boost::math::rising_factorial<long double>(l, i));
  31. #endif
  32. check_result<float>(boost::math::falling_factorial<float>(f, u));
  33. check_result<double>(boost::math::falling_factorial<double>(d, u));
  34. #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
  35. check_result<long double>(boost::math::falling_factorial<long double>(l, u));
  36. #endif
  37. //
  38. // Add constexpr tests here:
  39. //
  40. #ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES
  41. constexpr float ce_f = boost::math::unchecked_factorial<float>(2);
  42. constexpr double ce_d = boost::math::unchecked_factorial<double>(2);
  43. constexpr long double ce_l = boost::math::unchecked_factorial<long double>(2);
  44. check_result<float>(ce_f);
  45. check_result<double>(ce_d);
  46. check_result<long double>(ce_l);
  47. #ifdef BOOST_MATH_USE_FLOAT128
  48. constexpr __float128 ce_q = boost::math::unchecked_factorial<__float128>(2);
  49. check_result<__float128>(ce_q);
  50. #endif
  51. #endif
  52. }