Boost logo

Boost-Commit :

From: droba_at_[hidden]
Date: 2008-08-18 14:33:40


Author: pavol_droba
Date: 2008-08-18 14:33:40 EDT (Mon, 18 Aug 2008)
New Revision: 48199
URL: http://svn.boost.org/trac/boost/changeset/48199

Log:
predicate test improvements

Text files modified:
   trunk/libs/algorithm/string/test/predicate_test.cpp | 22 ++++++++++++++++++++--
   1 files changed, 20 insertions(+), 2 deletions(-)

Modified: trunk/libs/algorithm/string/test/predicate_test.cpp
==============================================================================
--- trunk/libs/algorithm/string/test/predicate_test.cpp (original)
+++ trunk/libs/algorithm/string/test/predicate_test.cpp 2008-08-18 14:33:40 EDT (Mon, 18 Aug 2008)
@@ -96,10 +96,28 @@
 
 }
 
+template<typename Pred, typename Input>
+void test_pred(const Pred& pred, const Input& input, bool bYes)
+{
+ // test assignment operator
+ Pred pred1=pred;
+ pred1=pred;
+ if(bYes)
+ {
+ BOOST_CHECK( all( input, pred ) );
+ BOOST_CHECK( all( input, pred1 ) );
+ }
+ else
+ {
+ BOOST_CHECK( !all( input, pred ) );
+ BOOST_CHECK( !all( input, pred1 ) );
+ }
+}
+
 #define TEST_CLASS( Pred, YesInput, NoInput )\
 {\
- BOOST_CHECK( all( string(YesInput), Pred ) );\
- BOOST_CHECK( !all( string(NoInput), Pred ) );\
+ test_pred(Pred, YesInput, true); \
+ test_pred(Pred, NoInput, false); \
 }
 
 void classification_test()


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