]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/test/test_rationals.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / math / test / test_rationals.cpp
1 // (C) Copyright John Maddock 2006.
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
6 #include <boost/math/concepts/real_concept.hpp>
7 #define BOOST_TEST_MAIN
8 #include <boost/test/unit_test.hpp>
9 #include <boost/test/floating_point_comparison.hpp>
10 #include <boost/array.hpp>
11 #include <boost/math/tools/rational.hpp>
12 #include <iostream>
13
14 template <class T, class U>
15 void do_test_spots(T, U);
16
17 template <class T>
18 void test_spots(T t, const char* n)
19 {
20 std::cout << "Testing basic sanity checks for type " << n << std::endl;
21 do_test_spots(t, int(0));
22 do_test_spots(t, unsigned(0));
23 #ifdef BOOST_HAS_LONG_LONG
24 do_test_spots(t, (boost::ulong_long_type)(0));
25 #endif
26 do_test_spots(t, float(0));
27 do_test_spots(t, T(0));
28 }
29
30 BOOST_AUTO_TEST_CASE( test_main )
31 {
32 test_spots(0.0F, "float");
33 test_spots(0.0, "double");
34 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
35 test_spots(0.0L, "long double");
36 #ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
37 test_spots(boost::math::concepts::real_concept(0.1), "real_concept");
38 #endif
39 #else
40 std::cout << "<note>The long double tests have been disabled on this platform "
41 "either because the long double overloads of the usual math functions are "
42 "not available at all, or because they are too inaccurate for these tests "
43 "to pass.</note>" << std::endl;
44 #endif
45
46 }
47
48