diff options
| author | Christoph Berg <myon@debian.org> | 2018-12-19 23:01:50 +0100 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2018-12-19 23:01:50 +0100 |
| commit | 5c60c77adff9a54fd5f94f9915b22ccd8c4c5a3b (patch) | |
| tree | 410fa358a5f73260a579b4d669730f319a4d2609 /boost/libs/math/test/test_rationals.cpp | |
| parent | 6c82050de806dcdafaed0077400a6c3396a4a159 (diff) | |
| parent | e0737c56c1e384e05064a0c6e1ac46979371041b (diff) | |
Update upstream source from tag 'upstream/2.0.0+repack'
Update to upstream version '2.0.0+repack'
with Debian dir 55dbb3a6a7eb189e187dd79f732623ca0b56116d
Diffstat (limited to 'boost/libs/math/test/test_rationals.cpp')
| -rw-r--r-- | boost/libs/math/test/test_rationals.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/boost/libs/math/test/test_rationals.cpp b/boost/libs/math/test/test_rationals.cpp new file mode 100644 index 00000000..b6f3c3a5 --- /dev/null +++ b/boost/libs/math/test/test_rationals.cpp @@ -0,0 +1,48 @@ +// (C) Copyright John Maddock 2006. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include <boost/math/concepts/real_concept.hpp> +#define BOOST_TEST_MAIN +#include <boost/test/unit_test.hpp> +#include <boost/test/floating_point_comparison.hpp> +#include <boost/array.hpp> +#include <boost/math/tools/rational.hpp> +#include <iostream> + +template <class T, class U> +void do_test_spots(T, U); + +template <class T> +void test_spots(T t, const char* n) +{ + std::cout << "Testing basic sanity checks for type " << n << std::endl; + do_test_spots(t, int(0)); + do_test_spots(t, unsigned(0)); +#ifdef BOOST_HAS_LONG_LONG + do_test_spots(t, (boost::ulong_long_type)(0)); +#endif + do_test_spots(t, float(0)); + do_test_spots(t, T(0)); +} + +BOOST_AUTO_TEST_CASE( test_main ) +{ + test_spots(0.0F, "float"); + test_spots(0.0, "double"); +#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS + test_spots(0.0L, "long double"); +#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS + test_spots(boost::math::concepts::real_concept(0.1), "real_concept"); +#endif +#else + std::cout << "<note>The long double tests have been disabled on this platform " + "either because the long double overloads of the usual math functions are " + "not available at all, or because they are too inaccurate for these tests " + "to pass.</note>" << std::endl; +#endif + +} + + |
