• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/tools/roots.hpp>
7 // #includes all the files that it needs to.
8 //
9 #include <boost/math/tools/roots.hpp>
10 #include <boost/math/tools/tuple.hpp>
11 #include <utility> // for std::pair, our headers don't know what tuple type is to be used, we have to supply it.
12 //
13 // Note this header includes no other headers, this is
14 // important if this test is to be meaningful:
15 //
check_result_imp(std::pair<float,float>,std::pair<float,float>)16 inline void check_result_imp(std::pair<float, float>, std::pair<float, float>){}
check_result_imp(std::pair<double,double>,std::pair<double,double>)17 inline void check_result_imp(std::pair<double, double>, std::pair<double, double>){}
check_result_imp(std::pair<long double,long double>,std::pair<long double,long double>)18 inline void check_result_imp(std::pair<long double, long double>, std::pair<long double, long double>){}
19 
20 #include "test_compile_result.hpp"
21 
compile_and_link_test()22 void compile_and_link_test()
23 {
24    typedef double (*F)(double);
25    typedef std::pair<double, double> (*F2)(double);
26    typedef boost::math::tuple<double, double, double> (*F3)(double);
27    typedef boost::math::tools::eps_tolerance<double> Tol;
28    Tol tol(u);
29    boost::uintmax_t max_iter = 0;
30    F f = 0;
31    F2 f2 = 0;
32    F3 f3 = 0;
33 
34    check_result<std::pair<double, double> >(boost::math::tools::bisect<F, double, Tol>(f, d, d, tol, max_iter));
35    check_result<std::pair<double, double> >(boost::math::tools::bisect<F, double, Tol>(f, d, d, tol));
36    check_result<double>(boost::math::tools::newton_raphson_iterate<F2, double>(f2, d, d, d, i, max_iter));
37    check_result<double>(boost::math::tools::halley_iterate<F3, double>(f3, d, d, d, i, max_iter));
38    check_result<double>(boost::math::tools::schroder_iterate<F3, double>(f3, d, d, d, i, max_iter));
39 }
40 
41