|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r53661 - trunk/libs/test/example
From: gennadiy.rozental_at_[hidden]
Date: 2009-06-06 02:47:08
Author: rogeeff
Date: 2009-06-06 02:47:06 EDT (Sat, 06 Jun 2009)
New Revision: 53661
URL: http://svn.boost.org/trac/boost/changeset/53661
Log:
examples of external main usage
Added:
trunk/libs/test/example/external_main_example_1.cpp (contents, props changed)
trunk/libs/test/example/external_main_example_2.cpp (contents, props changed)
trunk/libs/test/example/external_main_example_3.cpp (contents, props changed)
Text files modified:
trunk/libs/test/example/Jamfile.v2 | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
Modified: trunk/libs/test/example/Jamfile.v2
==============================================================================
--- trunk/libs/test/example/Jamfile.v2 (original)
+++ trunk/libs/test/example/Jamfile.v2 2009-06-06 02:47:06 EDT (Sat, 06 Jun 2009)
@@ -59,4 +59,8 @@
[ run named_param_example.cpp ]
[ run const_string_test.cpp ]
+
+ [ run-fail external_main_example_1.cpp unit_test_framework ]
+ [ run-fail external_main_example_2.cpp unit_test_framework ]
+ [ run-fail external_main_example_3.cpp ]
;
Added: trunk/libs/test/example/external_main_example_1.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/test/example/external_main_example_1.cpp 2009-06-06 02:47:06 EDT (Sat, 06 Jun 2009)
@@ -0,0 +1,43 @@
+#ifndef BOOST_TEST_DYN_LINK
+#define BOOST_TEST_DYN_LINK
+#endif
+#include <boost/test/unit_test.hpp>
+#include <boost/bind.hpp>
+using namespace boost::unit_test;
+
+//____________________________________________________________________________//
+
+void free_test_function( int i, int j )
+{
+ BOOST_CHECK_EQUAL( i, j );
+}
+
+//____________________________________________________________________________//
+
+bool
+init_function()
+{
+ framework::master_test_suite().
+ add( BOOST_TEST_CASE( boost::bind( &free_test_function, 1, 1 ) ) );
+ framework::master_test_suite().
+ add( BOOST_TEST_CASE( boost::bind( &free_test_function, 1, 2 ) ) );
+ framework::master_test_suite().
+ add( BOOST_TEST_CASE( boost::bind( &free_test_function, 2, 1 ) ) );
+
+ // do your own initialization here
+ // if it succesfull return true
+
+ // But, you CAN'T use testing tools here
+
+ return true;
+}
+
+//____________________________________________________________________________//
+
+int
+main( int argc, char* argv[] )
+{
+ return ::boost::unit_test::unit_test_main( &init_function, argc, argv );
+}
+
+//____________________________________________________________________________//
Added: trunk/libs/test/example/external_main_example_2.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/test/example/external_main_example_2.cpp 2009-06-06 02:47:06 EDT (Sat, 06 Jun 2009)
@@ -0,0 +1,40 @@
+#ifndef BOOST_TEST_DYN_LINK
+#define BOOST_TEST_DYN_LINK
+#endif
+#include <boost/test/unit_test.hpp>
+using namespace boost::unit_test;
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_SUITE( test_suite_1 )
+
+BOOST_AUTO_TEST_CASE( test_case_1 )
+{
+ BOOST_MESSAGE( "Testing is in progress" );
+
+ BOOST_CHECK( false );
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+//____________________________________________________________________________//
+
+bool
+init_function()
+{
+ // do your own initialization here
+ // if it succesfull return true
+
+ // But, you CAN'T use testing tools here
+ return true;
+}
+
+//____________________________________________________________________________//
+
+int
+main( int argc, char* argv[] )
+{
+ return ::boost::unit_test::unit_test_main( &init_function, argc, argv );
+}
+
+//____________________________________________________________________________//
Added: trunk/libs/test/example/external_main_example_3.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/test/example/external_main_example_3.cpp 2009-06-06 02:47:06 EDT (Sat, 06 Jun 2009)
@@ -0,0 +1,40 @@
+#define BOOST_TEST_NO_MAIN
+#define BOOST_TEST_ALTERNATIVE_INIT_API
+#include <boost/test/included/unit_test.hpp>
+using namespace boost::unit_test;
+
+//____________________________________________________________________________//
+
+BOOST_AUTO_TEST_SUITE( test_suite_1 )
+
+BOOST_AUTO_TEST_CASE( test_case_1 )
+{
+ BOOST_MESSAGE( "Testing is in progress" );
+
+ BOOST_CHECK( false );
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+//____________________________________________________________________________//
+
+bool
+init_function()
+{
+ // do your own initialization here
+ // if it succesfull return true
+
+ // But, you CAN'T use testing tools here
+ return true;
+}
+
+//____________________________________________________________________________//
+
+int
+main( int argc, char* argv[] )
+{
+ return ::boost::unit_test::unit_test_main( &init_function, argc, argv );
+}
+
+//____________________________________________________________________________//
+
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