Boost logo

Boost-Commit :

From: john_at_[hidden]
Date: 2007-09-20 14:22:32


Author: johnmaddock
Date: 2007-09-20 14:22:32 EDT (Thu, 20 Sep 2007)
New Revision: 39422
URL: http://svn.boost.org/trac/boost/changeset/39422

Log:
Hopefully fixed test to make it compatible with earlier VC++ versions.
Added:
   sandbox/math_toolkit/libs/math/test/compile_test/test_compile_result.hpp (contents, props changed)
Text files modified:
   sandbox/math_toolkit/libs/math/test/compile_test/sf_beta_incl_test.cpp | 33 ++++++++++++++++++++-------------
   1 files changed, 20 insertions(+), 13 deletions(-)

Modified: sandbox/math_toolkit/libs/math/test/compile_test/sf_beta_incl_test.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/test/compile_test/sf_beta_incl_test.cpp (original)
+++ sandbox/math_toolkit/libs/math/test/compile_test/sf_beta_incl_test.cpp 2007-09-20 14:22:32 EDT (Thu, 20 Sep 2007)
@@ -7,20 +7,27 @@
 // #includes all the files that it needs to.
 //
 #include <boost/math/special_functions/beta.hpp>
+//
+// Note this header includes no other headers, this is
+// important if this test is to be meaningful:
+//
+#include "test_compile_result.hpp"
 
-template float boost::math::beta<float>(float, float);
-template double boost::math::beta<double>(double, double);
-template long double boost::math::beta<long double>(long double, long double);
-
-template float boost::math::ibeta<float>(float, float, float);
-template double boost::math::ibeta<double>(double, double, double);
-template long double boost::math::ibeta<long double>(long double, long double, long double);
+void check()
+{
+ check_result<float>(boost::math::beta<float, float>(f, f));
+ check_result<double>(boost::math::beta<double>(d, d));
+ check_result<long double>(boost::math::beta<long double>(l, l));
 
-template float boost::math::ibeta_inv<float>(float, float, float);
-template double boost::math::ibeta_inv<double>(double, double, double);
-template long double boost::math::ibeta_inv<long double>(long double, long double, long double);
+ check_result<float>(boost::math::ibeta<float>(f, f, f));
+ check_result<double>(boost::math::ibeta<double>(d, d, d));
+ check_result<long double>(boost::math::ibeta<long double>(l, l, l));
 
-template float boost::math::ibeta_inva<float>(float, float, float);
-template double boost::math::ibeta_inva<double>(double, double, double);
-template long double boost::math::ibeta_inva<long double>(long double, long double, long double);
+ check_result<float>(boost::math::ibeta_inv<float>(f, f, f));
+ check_result<double>(boost::math::ibeta_inv<double>(d, d, d));
+ check_result<long double>(boost::math::ibeta_inv<long double>(l, l, l));
 
+ check_result<float>(boost::math::ibeta_inva<float>(f, f, f));
+ check_result<double>(boost::math::ibeta_inva<double>(d, d, d));
+ check_result<long double>(boost::math::ibeta_inva<long double>(l, l, l));
+}

Added: sandbox/math_toolkit/libs/math/test/compile_test/test_compile_result.hpp
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/libs/math/test/compile_test/test_compile_result.hpp 2007-09-20 14:22:32 EDT (Thu, 20 Sep 2007)
@@ -0,0 +1,31 @@
+// Copyright John Maddock 2007.
+// 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)
+
+//
+// Note this header must NOT include any other headers, for its
+// use to be meaningful (because we use it in tests designed to
+// detect missing includes).
+//
+
+static const float f = 0;
+static const double d = 0;
+static const long double l = 0;
+
+template <class T>
+void check_result_imp(T, T){}
+
+template <class T1, class T2>
+void check_result_imp(T1, T2)
+{
+ typedef int static_assertion[sizeof(T1) == 0xFFFF];
+}
+
+template <class T1, class T2>
+void check_result(T2)
+{
+ T1 a = 0;
+ T2 b = 0;
+ return check_result_imp(a, b);
+}


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk