test_jacobi_zeta.cpp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. // Copyright John Maddock 2015
  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_jacobi_zeta.hpp"
  7. //
  8. // DESCRIPTION:
  9. // ~~~~~~~~~~~~
  10. //
  11. // This file tests the Elliptic Integral D[phi|k].
  12. // There are two sets of tests, spot
  13. // tests which compare our results with selected values computed
  14. // using the online special function calculator at
  15. // functions.wolfram.com, while the bulk of the accuracy tests
  16. // use values generated with NTL::RR at 1000-bit precision
  17. // and our generic versions of these functions.
  18. //
  19. // Note that when this file is first run on a new platform many of
  20. // these tests will fail: the default accuracy is 1 epsilon which
  21. // is too tight for most platforms. In this situation you will
  22. // need to cast a human eye over the error rates reported and make
  23. // a judgement as to whether they are acceptable. Either way please
  24. // report the results to the Boost mailing list. Acceptable rates of
  25. // error are marked up below as a series of regular expressions that
  26. // identify the compiler/stdlib/platform/data-type/test-data/test-function
  27. // along with the maximum expected peek and RMS mean errors for that
  28. // test.
  29. //
  30. void expected_results()
  31. {
  32. //
  33. // Define the max and mean errors expected for
  34. // various compilers and platforms.
  35. //
  36. const char* largest_type;
  37. #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
  38. if(boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
  39. {
  40. largest_type = "(long\\s+)?double";
  41. }
  42. else
  43. {
  44. largest_type = "long double";
  45. }
  46. #else
  47. largest_type = "(long\\s+)?double";
  48. #endif
  49. //
  50. // Catch all cases come last:
  51. //
  52. add_expected_result(
  53. ".*", // compiler
  54. ".*", // stdlib
  55. ".*", // platform
  56. largest_type, // test type(s)
  57. ".*", // test data group
  58. ".*", 15, 6); // test function
  59. add_expected_result(
  60. ".*", // compiler
  61. ".*", // stdlib
  62. ".*", // platform
  63. "real_concept", // test type(s)
  64. ".*", // test data group
  65. ".*", 15, 6); // test function
  66. //
  67. // Finish off by printing out the compiler/stdlib/platform names,
  68. // we do this to make it easier to mark up expected error rates.
  69. //
  70. std::cout << "Tests run with " << BOOST_COMPILER << ", "
  71. << BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl;
  72. }
  73. BOOST_AUTO_TEST_CASE( test_main )
  74. {
  75. expected_results();
  76. BOOST_MATH_CONTROL_FP;
  77. #ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
  78. test_spots(0.0F, "float");
  79. #endif
  80. test_spots(0.0, "double");
  81. #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
  82. test_spots(0.0L, "long double");
  83. #ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
  84. test_spots(boost::math::concepts::real_concept(0), "real_concept");
  85. #endif
  86. #else
  87. std::cout << "<note>The long double tests have been disabled on this platform "
  88. "either because the long double overloads of the usual math functions are "
  89. "not available at all, or because they are too inaccurate for these tests "
  90. "to pass.</note>" << std::endl;
  91. #endif
  92. }