test_expint.cpp 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. ///////////////////////////////////////////////////////////////
  2. // Copyright 2011 John Maddock. Distributed under the Boost
  3. // Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
  5. #include "setup.hpp"
  6. #include "table_type.hpp"
  7. #define TEST_UDT
  8. #include <boost/math/special_functions/math_fwd.hpp>
  9. #include "libs/math/test/test_expint.hpp"
  10. void expected_results()
  11. {
  12. //
  13. // Define the max and mean errors expected for
  14. // various compilers and platforms.
  15. //
  16. add_expected_result(
  17. ".*", // compiler
  18. ".*", // stdlib
  19. ".*", // platform
  20. ".*gmp_float<18>.*", // test type(s)
  21. ".*", // test data group
  22. ".*", 2500, 1500); // test function
  23. add_expected_result(
  24. ".*", // compiler
  25. ".*", // stdlib
  26. ".*", // platform
  27. ".*mpfr_float_backend<18>.*", // test type(s)
  28. ".*", // test data group
  29. ".*", 1000, 500); // test function
  30. add_expected_result(
  31. ".*", // compiler
  32. ".*", // stdlib
  33. ".*", // platform
  34. ".*gmp_float.*", // test type(s)
  35. ".*", // test data group
  36. ".*", 250, 100); // test function
  37. #ifdef BOOST_INTEL
  38. add_expected_result(
  39. ".*", // compiler
  40. ".*", // stdlib
  41. ".*", // platform
  42. "float128", // test type(s)
  43. ".*", // test data group
  44. ".*", 4500, 1000); // test function
  45. #endif
  46. add_expected_result(
  47. ".*", // compiler
  48. ".*", // stdlib
  49. ".*", // platform
  50. ".*cpp_bin_float.*", // test type(s)
  51. ".*", // test data group
  52. ".*", 5000, 2000); // test function
  53. add_expected_result(
  54. ".*", // compiler
  55. ".*", // stdlib
  56. ".*", // platform
  57. ".*", // test type(s)
  58. ".*", // test data group
  59. ".*", 250, 50); // test function
  60. //
  61. // Finish off by printing out the compiler/stdlib/platform names,
  62. // we do this to make it easier to mark up expected error rates.
  63. //
  64. std::cout << "Tests run with " << BOOST_COMPILER << ", "
  65. << BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl;
  66. }
  67. template <class T>
  68. void test(T t, const char* p)
  69. {
  70. test_expint(t, p);
  71. }
  72. BOOST_AUTO_TEST_CASE(test_main)
  73. {
  74. using namespace boost::multiprecision;
  75. expected_results();
  76. //
  77. // Test at:
  78. // 18 decimal digits: tests 80-bit long double approximations
  79. // 30 decimal digits: tests 128-bit long double approximations
  80. // 35 decimal digits: tests arbitrary precision code
  81. //
  82. ALL_TESTS
  83. }