Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74673 - trunk/libs/test/example
From: gennadiy.rozental_at_[hidden]
Date: 2011-10-03 16:21:33


Author: rogeeff
Date: 2011-10-03 16:21:32 EDT (Mon, 03 Oct 2011)
New Revision: 74673
URL: http://svn.boost.org/trac/boost/changeset/74673

Log:
new decorator example
Text files modified:
   trunk/libs/test/example/unit_test_example_04.cpp | 38 ++++++++++++++++++++++++++++++++++++++
   1 files changed, 38 insertions(+), 0 deletions(-)

Modified: trunk/libs/test/example/unit_test_example_04.cpp
==============================================================================
--- trunk/libs/test/example/unit_test_example_04.cpp (original)
+++ trunk/libs/test/example/unit_test_example_04.cpp 2011-10-03 16:21:32 EDT (Mon, 03 Oct 2011)
@@ -12,15 +12,29 @@
 
 //____________________________________________________________________________//
 
+struct suite_fixture {
+ suite_fixture() { BOOST_TEST_MESSAGE( "Running some test suite setup" ); }
+ ~suite_fixture() { BOOST_TEST_MESSAGE( "Running some test suite teardown" ); }
+};
+
 // automatically registered test cases could be organized in test suites
+BOOST_TEST_DECORATOR(
++ unittest::fixture<suite_fixture>()
+)
 BOOST_AUTO_TEST_SUITE( my_suite1 )
 
 BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(my_test1,1);
 
+void some_setup()
+{
+ BOOST_TEST_MESSAGE( "Running some extra setup" );
+}
+
 BOOST_TEST_DECORATOR(
 + unittest::label( "L1" )
 + unittest::label( "L2" )
 + unittest::description( "test suite description" )
++ unittest::fixture( &some_setup )
 )
 BOOST_AUTO_TEST_CASE( my_test1 )
 {
@@ -85,6 +99,30 @@
     BOOST_CHECK_EQUAL( i, 1 );
 }
 
+BOOST_TEST_DECORATOR(
+- unittest::enable_if( 100 < 50 )
+)
+BOOST_AUTO_TEST_CASE( my_test6 )
+{
+}
+
+BOOST_TEST_DECORATOR(
++ unittest::depends_on( "my_suite2/internal_suite/disabled_suite/my_test7" )
+)
+BOOST_AUTO_TEST_CASE( this_should_also_be_disabled )
+{
+}
+
+BOOST_TEST_DECORATOR(
+- unittest::disable_if( true )
+)
+BOOST_AUTO_TEST_SUITE( disabled_suite )
+
+BOOST_AUTO_TEST_CASE( my_test7 )
+{
+}
+BOOST_AUTO_TEST_SUITE_END()
+
 BOOST_AUTO_TEST_SUITE_END()
 
 BOOST_AUTO_TEST_SUITE_END()


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