test_trigamma.cpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // (C) Copyright John Maddock 2014.
  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. #include <pch_light.hpp>
  6. #include "test_trigamma.hpp"
  7. void expected_results()
  8. {
  9. //
  10. // Define the max and mean errors expected for
  11. // various compilers and platforms.
  12. //
  13. const char* largest_type;
  14. #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
  15. if(boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
  16. {
  17. largest_type = "(long\\s+)?double|real_concept";
  18. }
  19. else
  20. {
  21. largest_type = "long double|real_concept";
  22. }
  23. #else
  24. largest_type = "(long\\s+)?double|real_concept";
  25. #endif
  26. add_expected_result(
  27. ".*", // compiler
  28. ".*", // stdlib
  29. ".*", // platform
  30. largest_type, // test type(s)
  31. ".*", // test data group
  32. ".*", 20, 10); // test function
  33. //
  34. // Finish off by printing out the compiler/stdlib/platform names,
  35. // we do this to make it easier to mark up expected error rates.
  36. //
  37. std::cout << "Tests run with " << BOOST_COMPILER << ", "
  38. << BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl;
  39. }
  40. BOOST_AUTO_TEST_CASE( test_main )
  41. {
  42. expected_results();
  43. BOOST_MATH_CONTROL_FP;
  44. test_trigamma(0.0F, "float");
  45. test_trigamma(0.0, "double");
  46. #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
  47. test_trigamma(0.0L, "long double");
  48. test_trigamma(boost::math::concepts::real_concept(0.1), "real_concept");
  49. #endif
  50. }