|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r81109 - trunk/libs/test/test
From: gennadiy.rozental_at_[hidden]
Date: 2012-10-29 16:27:11
Author: rogeeff
Date: 2012-10-29 16:27:10 EDT (Mon, 29 Oct 2012)
New Revision: 81109
URL: http://svn.boost.org/trac/boost/changeset/81109
Log:
BOOST_CHECKA test case filled in
Text files modified:
trunk/libs/test/test/test_tools_test.cpp | 54 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 54 insertions(+), 0 deletions(-)
Modified: trunk/libs/test/test/test_tools_test.cpp
==============================================================================
--- trunk/libs/test/test/test_tools_test.cpp (original)
+++ trunk/libs/test/test/test_tools_test.cpp 2012-10-29 16:27:10 EDT (Mon, 29 Oct 2012)
@@ -639,9 +639,63 @@
//____________________________________________________________________________//
+class FooType {
+public:
+ FooType& operator*() { return *this; }
+ operator bool() const { return false; }
+ int operator&() { return 10; }
+};
+
TEST_CASE( test_BOOST_CHECKA )
{
+ unit_test_log.set_threshold_level( log_successful_tests );
+
BOOST_CHECKA( true );
+ BOOST_CHECKA( false );
+
+ bool_convertible bc;
+ BOOST_CHECKA( bc );
+
+ int i = 1;
+ BOOST_CHECKA( i == 2 );
+ BOOST_CHECKA( i != 1 );
+ BOOST_CHECKA( i > 2 );
+ BOOST_CHECKA( i < 1 );
+ BOOST_CHECKA( i <= 0 );
+ BOOST_CHECKA( i >= 5 );
+
+ int j = 2;
+ BOOST_CHECKA( i+j >= 5 );
+ BOOST_CHECKA( j-i == 2 );
+
+ int* p = &i;
+ BOOST_CHECKA( *p == 2 );
+ BOOST_CHECKA( j-*p == 0 );
+
+ BOOST_CHECKA(( i > 5, true ));
+
+ FooType F;
+
+ BOOST_CHECKA( FooType() );
+ BOOST_CHECKA( *F );
+ BOOST_CHECKA( **F );
+ BOOST_CHECKA( ***F );
+ BOOST_CHECKA( &F > 100 );
+ BOOST_CHECKA( &*F > 100 );
+
+ BOOST_CHECKA( (i == 1) & (j == 1) );
+ BOOST_CHECKA( (i == 2) | (j == 1) );
+
+ BOOST_CHECKA(( i == 1 && j == 1 ));
+ BOOST_CHECKA(( i == 2 || j == 1 ));
+
+ std::cout << MACROV() << std::endl;
+ std::cout << MACROV(q) << std::endl;
+ std::cout << MACROV(q,w) << std::endl;
+ // Does not work
+ // BOOST_CHECKA( i == 1 && j == 1 );
+ // BOOST_CHECKA( i == 2 || j == 1 );
+ // BOOST_CHECKA( i > 5 ? false : true );
}
//____________________________________________________________________________//
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