|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r70301 - trunk/libs/function/test
From: dnljms_at_[hidden]
Date: 2011-03-21 05:01:19
Author: danieljames
Date: 2011-03-21 05:01:18 EDT (Mon, 21 Mar 2011)
New Revision: 70301
URL: http://svn.boost.org/trac/boost/changeset/70301
Log:
Function: Extra member tests, to catch #4073.
Text files modified:
trunk/libs/function/test/mem_fun_cxx98.cpp | 16 +++++++++++-----
trunk/libs/function/test/mem_fun_portable.cpp | 16 +++++++++++-----
2 files changed, 22 insertions(+), 10 deletions(-)
Modified: trunk/libs/function/test/mem_fun_cxx98.cpp
==============================================================================
--- trunk/libs/function/test/mem_fun_cxx98.cpp (original)
+++ trunk/libs/function/test/mem_fun_cxx98.cpp 2011-03-21 05:01:18 EDT (Mon, 21 Mar 2011)
@@ -10,22 +10,28 @@
#include <boost/function.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <iostream>
#include <functional>
struct X {
int foo(int);
+ std::ostream& foo2(std::ostream&) const;
};
int X::foo(int x) { return -x; }
+std::ostream& X::foo2(std::ostream& x) const { return x; }
int main()
{
boost::function<int (X*, int)> f;
+ boost::function<std::ostream& (X*, std::ostream&)> f2;
-f = &X::foo;
-
-X x;
-f(&x, 5);
+ f = &X::foo;
+ f2 = &X::foo2;
- return 0;
+ X x;
+ BOOST_TEST(f(&x, 5) == -5);
+ BOOST_TEST(f2(&x, boost::ref(std::cout)) == std::cout);
+
+ return ::boost::report_errors();
}
Modified: trunk/libs/function/test/mem_fun_portable.cpp
==============================================================================
--- trunk/libs/function/test/mem_fun_portable.cpp (original)
+++ trunk/libs/function/test/mem_fun_portable.cpp 2011-03-21 05:01:18 EDT (Mon, 21 Mar 2011)
@@ -10,22 +10,28 @@
#include <boost/function.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <iostream>
#include <functional>
struct X {
int foo(int);
+ std::ostream& foo2(std::ostream&) const;
};
int X::foo(int x) { return -x; }
+std::ostream& X::foo2(std::ostream& x) const { return x; }
int main()
{
boost::function2<int, X*, int> f;
+ boost::function2<std::ostream&, X*, std::ostream&> f2;
-f = &X::foo;
-
-X x;
-f(&x, 5);
+ f = &X::foo;
+ f2 = &X::foo2;
- return 0;
+ X x;
+ BOOST_TEST(f(&x, 5) == -5);
+ BOOST_TEST(f2(&x, boost::ref(std::cout)) == std::cout);
+
+ return ::boost::report_errors();
}
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