Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / math / test / test_policy_sf.cpp
1 //  (C) Copyright John Maddock 2007.
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 #define BOOST_TEST_MAIN
7 #include <boost/test/unit_test.hpp>
8 #include <boost/test/tools/floating_point_comparison.hpp>
9 #include <boost/math/special_functions.hpp>
10
11 //
12 // DESCRIPTION:
13 // ~~~~~~~~~~~~
14 //
15 // This file provides very basic sanity checks for the special functions
16 // declared with BOOST_MATH_DECLARE_SPECIAL_FUNCTIONS, basically we
17 // just want to make sure that the inline forwarding functions do
18 // actually forward to the right function!!
19 //
20
21 namespace test{
22
23    typedef boost::math::policies::policy<> policy;
24
25    BOOST_MATH_DECLARE_SPECIAL_FUNCTIONS(policy)
26
27 }
28
29 #define TEST_POLICY_SF(call)\
30    BOOST_CHECK_EQUAL(boost::math::call , test::call)
31
32 //
33 // Prevent some macro conflicts just in case:
34 //
35 #undef fpclassify
36 #undef isnormal
37 #undef isinf
38 #undef isfinite
39 #undef isnan
40
41 BOOST_AUTO_TEST_CASE( test_main )
42 {
43    int i;
44    TEST_POLICY_SF(tgamma(3.0));
45    TEST_POLICY_SF(tgamma1pm1(0.25));
46    TEST_POLICY_SF(lgamma(50.0));
47    TEST_POLICY_SF(lgamma(50.0, &i));
48    TEST_POLICY_SF(digamma(12.0));
49    TEST_POLICY_SF(tgamma_ratio(12.0, 13.5));
50    TEST_POLICY_SF(tgamma_delta_ratio(100.0, 0.25));
51    TEST_POLICY_SF(factorial<double>(8));
52    TEST_POLICY_SF(unchecked_factorial<double>(3));
53    TEST_POLICY_SF(double_factorial<double>(5));
54    TEST_POLICY_SF(rising_factorial(20.5, 5));
55    TEST_POLICY_SF(falling_factorial(10.2, 7));
56    TEST_POLICY_SF(tgamma(12.0, 13.0));
57    TEST_POLICY_SF(tgamma_lower(12.0, 13.0));
58    TEST_POLICY_SF(gamma_p(12.0, 13.0));
59    TEST_POLICY_SF(gamma_q(12.0, 15.0));
60    TEST_POLICY_SF(gamma_p_inv(12.0, 0.25));
61    TEST_POLICY_SF(gamma_q_inv(15.0, 0.25));
62    TEST_POLICY_SF(gamma_p_inva(12.0, 0.25));
63    TEST_POLICY_SF(gamma_q_inva(12.0, 0.25));
64    TEST_POLICY_SF(erf(2.5));
65    TEST_POLICY_SF(erfc(2.5));
66    TEST_POLICY_SF(erf_inv(0.25));
67    TEST_POLICY_SF(erfc_inv(0.25));
68    TEST_POLICY_SF(beta(12.0, 15.0));
69    TEST_POLICY_SF(beta(12.0, 15.0, 0.25));
70    TEST_POLICY_SF(betac(12.0, 15.0, 0.25));
71    TEST_POLICY_SF(ibeta(12.0, 15.0, 0.25));
72    TEST_POLICY_SF(ibetac(12.0, 15.0, 0.25));
73    TEST_POLICY_SF(ibeta_inv(12.0, 15.0, 0.25));
74    TEST_POLICY_SF(ibetac_inv(12.0, 15.0, 0.25));
75    TEST_POLICY_SF(ibeta_inva(12.0, 0.75, 0.25));
76    TEST_POLICY_SF(ibetac_inva(12.0, 0.75, 0.25));
77    TEST_POLICY_SF(ibeta_invb(12.0, 0.75, 0.25));
78    TEST_POLICY_SF(ibetac_invb(12.0, 0.75, 0.25));
79    TEST_POLICY_SF(gamma_p_derivative(12.0, 15.0));
80    TEST_POLICY_SF(ibeta_derivative(12.0, 15.75, 0.25));
81    TEST_POLICY_SF(fpclassify(12.0));
82    TEST_POLICY_SF(isfinite(12.0));
83    TEST_POLICY_SF(isnormal(12.0));
84    TEST_POLICY_SF(isnan(12.0));
85    TEST_POLICY_SF(isinf(12.0));
86    TEST_POLICY_SF(log1p(0.0025));
87    TEST_POLICY_SF(expm1(0.0025));
88    TEST_POLICY_SF(cbrt(30.0));
89    TEST_POLICY_SF(sqrt1pm1(0.0025));
90    TEST_POLICY_SF(powm1(1.0025, 12.0));
91    TEST_POLICY_SF(legendre_p(5, 0.75));
92    TEST_POLICY_SF(legendre_p(7, 3, 0.75));
93    TEST_POLICY_SF(legendre_q(5, 0.75));
94    TEST_POLICY_SF(legendre_next(2, 0.25, 12.0, 5.0));
95    TEST_POLICY_SF(legendre_next(2, 2, 0.25, 12.0, 5.0));
96    TEST_POLICY_SF(laguerre(5, 12.2));
97    TEST_POLICY_SF(laguerre(7, 3, 5.0));
98    TEST_POLICY_SF(laguerre_next(2, 5.0, 12.0, 5.0));
99    TEST_POLICY_SF(laguerre_next(5, 3, 5.0, 20.0, 10.0));
100    TEST_POLICY_SF(hermite(1, 2.0));
101    TEST_POLICY_SF(hermite_next(2, 2.0, 3.0, 2.0));
102    TEST_POLICY_SF(spherical_harmonic_r(5, 4, 0.75, 0.25));
103    TEST_POLICY_SF(spherical_harmonic_i(5, 4, 0.75, 0.25));
104    TEST_POLICY_SF(ellint_1(0.25));
105    TEST_POLICY_SF(ellint_1(0.25, 0.75));
106    TEST_POLICY_SF(ellint_2(0.25));
107    TEST_POLICY_SF(ellint_2(0.25, 0.75));
108    TEST_POLICY_SF(ellint_3(0.25, 0.75));
109    TEST_POLICY_SF(ellint_3(0.25, 0.125, 0.75));
110    TEST_POLICY_SF(ellint_rc(3.0, 5.0));
111    TEST_POLICY_SF(ellint_rd(2.0, 3.0, 4.0));
112    TEST_POLICY_SF(ellint_rf(2.0, 3.0, 4.0));
113    TEST_POLICY_SF(ellint_rj(2.0, 3.0, 5.0, 0.25));
114    TEST_POLICY_SF(hypot(5.0, 3.0));
115    TEST_POLICY_SF(sinc_pi(3.0));
116    TEST_POLICY_SF(sinhc_pi(2.0));
117    TEST_POLICY_SF(asinh(12.0));
118    TEST_POLICY_SF(acosh(5.0));
119    TEST_POLICY_SF(atanh(0.75));
120    TEST_POLICY_SF(sin_pi(5.0));
121    TEST_POLICY_SF(cos_pi(6.0));
122    TEST_POLICY_SF(cyl_neumann(2.0, 5.0));
123    TEST_POLICY_SF(cyl_neumann(2, 5.0));
124    TEST_POLICY_SF(cyl_bessel_j(2.0, 5.0));
125    TEST_POLICY_SF(cyl_bessel_j(2, 5.0));
126    TEST_POLICY_SF(cyl_bessel_i(3.0, 5.0));
127    TEST_POLICY_SF(cyl_bessel_i(3, 5.0));
128    TEST_POLICY_SF(cyl_bessel_k(3.0, 5.0));
129    TEST_POLICY_SF(cyl_bessel_k(3, 5.0));
130    TEST_POLICY_SF(sph_bessel(3, 5.0));
131    TEST_POLICY_SF(sph_bessel(3, 5));
132    TEST_POLICY_SF(sph_neumann(3, 5.0));
133    TEST_POLICY_SF(sph_neumann(3, 5));
134    
135 }
136
137
138
139