Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / math / test / test_ldouble_simple.cpp
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 //
8 // This file verifies that certain core functions are always
9 // available, even when long double support is patchy at best
10 // and BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS is defined.
11 //
12 #define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
13 #define BOOST_TEST_MAIN
14 #include <boost/test/unit_test.hpp> // Boost.Test
15 #include <boost/math/special_functions/sign.hpp>
16 #include <boost/math/special_functions/fpclassify.hpp>
17
18 BOOST_AUTO_TEST_CASE( test_main )
19 {
20    BOOST_CHECK_EQUAL((boost::math::signbit)(1.0L), 0.0L);
21    BOOST_CHECK((boost::math::signbit)(-1.0L) != 0);
22    BOOST_CHECK_EQUAL((boost::math::sign)(1.0L), 1.0L);
23    BOOST_CHECK_EQUAL((boost::math::sign)(-1.0L), -1.0L);
24    BOOST_CHECK_EQUAL((boost::math::changesign)(1.0L), -1.0L);
25    BOOST_CHECK_EQUAL((boost::math::changesign)(-1.0L), 1.0L);
26
27    BOOST_CHECK_EQUAL((boost::math::fpclassify)(1.0L), (int)FP_NORMAL);
28    BOOST_CHECK_EQUAL((boost::math::isnan)(1.0L), false);
29    BOOST_CHECK_EQUAL((boost::math::isinf)(1.0L), false);
30    BOOST_CHECK_EQUAL((boost::math::isnormal)(1.0L), true);
31    BOOST_CHECK_EQUAL((boost::math::isfinite)(1.0L), true);
32 } // BOOST_AUTO_TEST_CASE( test_main )
33