dist_find_scale_incl_test.cpp 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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/distributions/find_scale.hpp>
  7. // #includes all the files that it needs to.
  8. //
  9. #include <boost/math/distributions/find_scale.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. template <class T, class Policy = boost::math::policies::policy<> >
  16. class test_distribution
  17. {
  18. public:
  19. typedef T value_type;
  20. typedef Policy policy_type;
  21. test_distribution(){}
  22. };
  23. template <class T, class Policy>
  24. T quantile(const test_distribution<T, Policy>&, T)
  25. {
  26. return 0;
  27. }
  28. template <class T, class Policy>
  29. T quantile(const boost::math::complemented2_type<test_distribution<T, Policy>, T>&)
  30. {
  31. return 0;
  32. }
  33. namespace boost{ namespace math{ namespace tools{
  34. template <class T, class Policy> struct is_distribution<test_distribution<T, Policy> > : public mpl::true_{};
  35. template <class T, class Policy> struct is_scaled_distribution<test_distribution<T, Policy> > : public mpl::true_{};
  36. }}}
  37. void compile_and_link_test()
  38. {
  39. check_result<float>(boost::math::find_scale<test_distribution<float> >(f, f, f, boost::math::policies::policy<>()));
  40. check_result<double>(boost::math::find_scale<test_distribution<double> >(d, d, d, boost::math::policies::policy<>()));
  41. check_result<long double>(boost::math::find_scale<test_distribution<long double> >(l, l, l, boost::math::policies::policy<>()));
  42. check_result<float>(boost::math::find_scale<test_distribution<float> >(f, f, f));
  43. check_result<double>(boost::math::find_scale<test_distribution<double> >(d, d, d));
  44. check_result<long double>(boost::math::find_scale<test_distribution<long double> >(l, l, l));
  45. check_result<float>(boost::math::find_scale<test_distribution<float> >(boost::math::complement(f, f, f, boost::math::policies::policy<>())));
  46. check_result<double>(boost::math::find_scale<test_distribution<double> >(boost::math::complement(d, d, d, boost::math::policies::policy<>())));
  47. check_result<long double>(boost::math::find_scale<test_distribution<long double> >(boost::math::complement(l, l, l, boost::math::policies::policy<>())));
  48. check_result<float>(boost::math::find_scale<test_distribution<float> >(boost::math::complement(f, f, f)));
  49. check_result<double>(boost::math::find_scale<test_distribution<double> >(boost::math::complement(d, d, d)));
  50. check_result<long double>(boost::math::find_scale<test_distribution<long double> >(boost::math::complement(l, l, l)));
  51. }