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 compile_and_link_test()16void compile_and_link_test() 17 { 18 check_result<float>(boost::math::factorial<float>(u)); 19 check_result<double>(boost::math::factorial<double>(u)); 20 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS 21 check_result<long double>(boost::math::factorial<long double>(u)); 22 #endif 23 24 check_result<float>(boost::math::double_factorial<float>(u)); 25 check_result<double>(boost::math::double_factorial<double>(u)); 26 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS 27 check_result<long double>(boost::math::double_factorial<long double>(u)); 28 #endif 29 30 check_result<float>(boost::math::rising_factorial<float>(f, i)); 31 check_result<double>(boost::math::rising_factorial<double>(d, i)); 32 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS 33 check_result<long double>(boost::math::rising_factorial<long double>(l, i)); 34 #endif 35 36 check_result<float>(boost::math::falling_factorial<float>(f, u)); 37 check_result<double>(boost::math::falling_factorial<double>(d, u)); 38 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS 39 check_result<long double>(boost::math::falling_factorial<long double>(l, u)); 40 #endif 41 42 // 43 // Add constexpr tests here: 44 // 45 #ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES 46 constexpr float ce_f = boost::math::unchecked_factorial<float>(2); 47 constexpr double ce_d = boost::math::unchecked_factorial<double>(2); 48 constexpr long double ce_l = boost::math::unchecked_factorial<long double>(2); 49 check_result<float>(ce_f); 50 check_result<double>(ce_d); 51 check_result<long double>(ce_l); 52 #ifdef BOOST_MATH_USE_FLOAT128 53 constexpr __float128 ce_q = boost::math::unchecked_factorial<__float128>(2); 54 check_result<__float128>(ce_q); 55 #endif 56 #endif 57 } 58 59