expint_i_data.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // (C) Copyright John Maddock 2007.
  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 <boost/math/special_functions/expint.hpp>
  6. #include <boost/math/constants/constants.hpp>
  7. #include <fstream>
  8. #include <boost/math/tools/test_data.hpp>
  9. #include "mp_t.hpp"
  10. using namespace boost::math::tools;
  11. int main()
  12. {
  13. parameter_info<mp_t> arg1;
  14. test_data<mp_t> data;
  15. mp_t (*f)(mp_t) = boost::math::expint;
  16. std::cout << "Welcome.\n"
  17. "This program will generate spot tests for the expint Ei function:\n"
  18. " expint(a)\n\n";
  19. bool cont;
  20. std::string line;
  21. do{
  22. get_user_parameter_info(arg1, "a");
  23. data.insert(f, arg1);
  24. std::cout << "Any more data [y/n]?";
  25. std::getline(std::cin, line);
  26. boost::algorithm::trim(line);
  27. cont = (line == "y");
  28. }while(cont);
  29. std::cout << "Enter name of test data file [default=expinti_data.ipp]";
  30. std::getline(std::cin, line);
  31. boost::algorithm::trim(line);
  32. if(line == "")
  33. line = "expinti_data.ipp";
  34. std::ofstream ofs(line.c_str());
  35. ofs << std::scientific << std::setprecision(40);
  36. write_code(ofs, data, "expinti_data");
  37. return 0;
  38. }