diff --git a/test/A.cpp b/test/A.cpp index 332505ff..7a8033f4 100644 --- a/test/A.cpp +++ b/test/A.cpp @@ -11,9 +11,12 @@ #include #include // rand() #include // size_t -#include + #include +#if BOOST_CXX_VERSION > 199711L // only include floating point if C++ version >= C++11 +#include +#endif #if defined(BOOST_NO_STDC_NAMESPACE) namespace std{ using ::rand; @@ -148,11 +151,14 @@ A::operator==(const A &rhs) const { return false; if(v != rhs.v) return false; - if(std::abs( boost::math::float_distance(w, rhs.w)) > 1) - return false; - if(std::abs( boost::math::float_distance(x, rhs.x)) > 1) - return false; + #if BOOST_CXX_VERSION > 199711L // only include floating point if C++ version >= C++11 + if(std::abs( boost::math::float_distance(w, rhs.w)) > 1) + return false; + if(std::abs( boost::math::float_distance(x, rhs.x)) > 1) + return false; + #endif if(0 != y.compare(rhs.y)) + return false; #ifndef BOOST_NO_STD_WSTRING if(0 != z.compare(rhs.z)) diff --git a/test/test_complex.cpp b/test/test_complex.cpp index 7caca871..6ba5618a 100644 --- a/test/test_complex.cpp +++ b/test/test_complex.cpp @@ -15,7 +15,9 @@ #include // remove #include #include +#if BOOST_CXX_VERSION > 199711L // only include floating point if C++ version >= C++11 #include +#endif #if defined(BOOST_NO_STDC_NAMESPACE) #include @@ -66,14 +68,16 @@ int test_main( int /* argc */, char* /* argv */[] ) ia >> boost::serialization::make_nvp("adoublecomplex", b1); } - std::cerr << "a.real()-a1a.real() distance = " << std::abs( boost::math::float_distance(a.real(), a1.real())) << std::endl; - BOOST_CHECK(std::abs(boost::math::float_distance(a.real(), a1.real())) < 2); - std::cerr << "a.imag() - a1a.imag() distance = " << std::abs( boost::math::float_distance(a.imag(), a1.imag())) << std::endl; - BOOST_CHECK(std::abs(boost::math::float_distance(a.imag(), a1.imag())) < 2); - std::cerr << "b.real() - b1.real() distance = " << std::abs( boost::math::float_distance(b.real(), b1.real())) << std::endl; - BOOST_CHECK(std::abs(boost::math::float_distance(b.real(), b1.real())) < 2); - std::cerr << "b.imag() - b1.imag() distance = " << std::abs( boost::math::float_distance(b.imag(), b1.imag())) << std::endl; - BOOST_CHECK(std::abs(boost::math::float_distance(b.imag(), b1.imag())) < 2); + #if BOOST_CXX_VERSION > 199711L // only include floating point if C++ version >= C++11 + std::cerr << "a.real()-a1a.real() distance = " << std::abs( boost::math::float_distance(a.real(), a1.real())) << std::endl; + BOOST_CHECK(std::abs(boost::math::float_distance(a.real(), a1.real())) < 2); + std::cerr << "a.imag() - a1a.imag() distance = " << std::abs( boost::math::float_distance(a.imag(), a1.imag())) << std::endl; + BOOST_CHECK(std::abs(boost::math::float_distance(a.imag(), a1.imag())) < 2); + std::cerr << "b.real() - b1.real() distance = " << std::abs( boost::math::float_distance(b.real(), b1.real())) << std::endl; + BOOST_CHECK(std::abs(boost::math::float_distance(b.real(), b1.real())) < 2); + std::cerr << "b.imag() - b1.imag() distance = " << std::abs( boost::math::float_distance(b.imag(), b1.imag())) << std::endl; + BOOST_CHECK(std::abs(boost::math::float_distance(b.imag(), b1.imag())) < 2); + #endif std::remove(testfile); return EXIT_SUCCESS; diff --git a/test/test_non_default_ctor.cpp b/test/test_non_default_ctor.cpp index 33780ce8..e2450503 100644 --- a/test/test_non_default_ctor.cpp +++ b/test/test_non_default_ctor.cpp @@ -19,8 +19,9 @@ #include #include #include +#if BOOST_CXX_VERSION > 199711L // only include floating point if C++ version >= C++11 #include - +#endif #if defined(BOOST_NO_STDC_NAMESPACE) namespace std{ using ::rand; @@ -99,12 +100,14 @@ bool A::operator==(const A &rhs) const && t == rhs.t && u == rhs.u && v == rhs.v - && std::abs( boost::math::float_distance(w, rhs.w)) < 2 - && std::abs( boost::math::float_distance(x, rhs.x)) < 2 - ; + #if BOOST_CXX_VERSION > 199711L // only include floating point if C++ version >= C++11 + && std::abs( boost::math::float_distance(w, rhs.w)) < 2 + && std::abs( boost::math::float_distance(x, rhs.x)) < 2 + #endif + ; } -bool A::operator<(const A &rhs) const + bool A::operator<(const A &rhs) const { if(! (s == rhs.s) ) return s < rhs.s; @@ -114,10 +117,12 @@ bool A::operator<(const A &rhs) const return t < rhs.u; if(! (v == rhs.v) ) return t < rhs.v; - if(std::abs( boost::math::float_distance(w, rhs.w)) > 1) - return false; - if(std::abs( boost::math::float_distance(x, rhs.x)) > 1) - return false; + #if BOOST_CXX_VERSION > 199711L // only include floating point if C++ version >= C++11 + if(std::abs( boost::math::float_distance(w, rhs.w)) > 1) + return false; + if(std::abs( boost::math::float_distance(x, rhs.x)) > 1) + return false; + #endif return false; } diff --git a/test/test_non_intrusive.cpp b/test/test_non_intrusive.cpp index b3c3536c..c1d8a746 100644 --- a/test/test_non_intrusive.cpp +++ b/test/test_non_intrusive.cpp @@ -18,7 +18,9 @@ #include #include #include +#if BOOST_CXX_VERSION > 199711L // only include floating point if C++ version >= C++11 #include +#endif #if defined(BOOST_NO_STDC_NAMESPACE) namespace std{ @@ -67,8 +69,10 @@ bool A::operator==(const A &rhs) const && t == rhs.t && u == rhs.u && v == rhs.v - && std::abs( boost::math::float_distance(w, rhs.w)) < 2 - && std::abs( boost::math::float_distance(x, rhs.x)) < 2 + #if BOOST_CXX_VERSION > 199711L // only include floating point if C++ version >= C++11 + && std::abs( boost::math::float_distance(w, rhs.w)) < 2 + && std::abs( boost::math::float_distance(x, rhs.x)) < 2 + #endif ; } @@ -82,10 +86,12 @@ bool A::operator<(const A &rhs) const return t < rhs.u; if(! (v == rhs.v) ) return t < rhs.v; - if(std::abs( boost::math::float_distance(w, rhs.w)) > 1) - return false; - if(std::abs( boost::math::float_distance(x, rhs.x)) > 1) - return false; + #if BOOST_CXX_VERSION > 199711L // only include floating point if C++ version >= C++11 + if(std::abs( boost::math::float_distance(w, rhs.w)) > 1) + return false; + if(std::abs( boost::math::float_distance(x, rhs.x)) > 1) + return false; + #endif return false; } diff --git a/test/test_simple_class.cpp b/test/test_simple_class.cpp index 41c8cb21..ac0c19f7 100644 --- a/test/test_simple_class.cpp +++ b/test/test_simple_class.cpp @@ -14,9 +14,11 @@ #include // remove #include #include -#include #include +#if BOOST_CXX_VERSION > 199711L // only include floating point if C++ version >= C++11 +#include +#endif #if defined(BOOST_NO_STDC_NAMESPACE) namespace std{ @@ -51,8 +53,10 @@ bool A::check_equal(const A &rhs) const BOOST_CHECK_EQUAL(u, rhs.u); BOOST_CHECK_EQUAL(v, rhs.v); BOOST_CHECK_EQUAL(l, rhs.l); - BOOST_CHECK(std::abs( boost::math::float_distance(w, rhs.w)) < 2); - BOOST_CHECK(std::abs( boost::math::float_distance(x, rhs.x)) < 2); + #if BOOST_CXX_VERSION > 199711L // only include floating point if C++ version >= C++11 + BOOST_CHECK(std::abs( boost::math::float_distance(w, rhs.w)) < 2); + BOOST_CHECK(std::abs( boost::math::float_distance(x, rhs.x)) < 2); + #endif BOOST_CHECK(!(0 != y.compare(rhs.y))); #ifndef BOOST_NO_STD_WSTRING BOOST_CHECK(!(0 != z.compare(rhs.z))); diff --git a/test/test_variant.cpp b/test/test_variant.cpp index dcf91d13..8154b3bf 100644 --- a/test/test_variant.cpp +++ b/test/test_variant.cpp @@ -18,8 +18,12 @@ #include // NULL #include // remove #include + #include -#include // float_distance +#if BOOST_CXX_VERSION > 199711L // only include floating point if C++ version >= C++11 +#include +#endif + #if defined(BOOST_NO_STDC_NAMESPACE) namespace std{ using ::remove; @@ -77,11 +81,19 @@ public: bool operator()( const float & lhs, const float & rhs ) const { - return std::abs( boost::math::float_distance(lhs, rhs)) < 2; + #if BOOST_CXX_VERSION > 199711L // only include floating point if C++ version >= C++11 + return std::abs( boost::math::float_distance(w, rhs.w) ) < 2; + #else + return true; + #endif } bool operator()( const double & lhs, const double & rhs ) const { - return std::abs( boost::math::float_distance(lhs, rhs)) < 2; + #if BOOST_CXX_VERSION > 199711L // only include floating point if C++ version >= C++11 + return std::abs( boost::math::float_distance(w, rhs.w) ) < 2; + #else + return true; + #endif } };