From 1f5542b44c7085dbcff6955fd45c6c286e90bb4f Mon Sep 17 00:00:00 2001 From: Pavol Droba Date: Mon, 18 Aug 2008 18:33:40 +0000 Subject: [PATCH] predicate test improvements [SVN r48199] --- string/test/predicate_test.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/string/test/predicate_test.cpp b/string/test/predicate_test.cpp index 3ee9141..43d7142 100644 --- a/string/test/predicate_test.cpp +++ b/string/test/predicate_test.cpp @@ -96,10 +96,28 @@ void predicate_test() } +template +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()