test_ldouble_simple.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. // Copyright John Maddock 2013.
  2. // Use, modification and distribution are subject to the
  3. // Boost Software License, Version 1.0.
  4. // (See accompanying file LICENSE_1_0.txt
  5. // or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // This file verifies that certain core functions are always
  8. // available, even when long double support is patchy at best
  9. // and BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS is defined.
  10. //
  11. #define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
  12. #define BOOST_TEST_MAIN
  13. #include <boost/test/unit_test.hpp> // Boost.Test
  14. #include <boost/math/special_functions/sign.hpp>
  15. #include <boost/math/special_functions/fpclassify.hpp>
  16. BOOST_AUTO_TEST_CASE( test_main )
  17. {
  18. BOOST_CHECK_EQUAL((boost::math::signbit)(1.0L), 0.0L);
  19. BOOST_CHECK((boost::math::signbit)(-1.0L) != 0);
  20. BOOST_CHECK_EQUAL((boost::math::sign)(1.0L), 1.0L);
  21. BOOST_CHECK_EQUAL((boost::math::sign)(-1.0L), -1.0L);
  22. BOOST_CHECK_EQUAL((boost::math::changesign)(1.0L), -1.0L);
  23. BOOST_CHECK_EQUAL((boost::math::changesign)(-1.0L), 1.0L);
  24. BOOST_CHECK_EQUAL((boost::math::fpclassify)(1.0L), (int)FP_NORMAL);
  25. BOOST_CHECK_EQUAL((boost::math::isnan)(1.0L), false);
  26. BOOST_CHECK_EQUAL((boost::math::isinf)(1.0L), false);
  27. BOOST_CHECK_EQUAL((boost::math::isnormal)(1.0L), true);
  28. BOOST_CHECK_EQUAL((boost::math::isfinite)(1.0L), true);
  29. } // BOOST_AUTO_TEST_CASE( test_main )