Boost logo

Boost Users :

From: Oliver Schoenborn (oliver.schoenborn_at_[hidden])
Date: 2005-04-14 21:27:57


This is the same as last
(http://article.gmane.org/gmane.comp.lib.boost.user/10508) except that it
fixes a problem that would prevent a multi-unit auto unit test to run (i.e.
if one of the test files did NOT have a BOOST_AUTO_TEST_MAIN).

$ diff -u boost_1_32_0/boost/test/auto_unit_test.hpp
patches/boost-1_32/boost/test/auto_unit_test.hpp
--- /home/oschoenborn/downloads/boost_1_32_0/boost/test/auto_unit_test.hpp
Mon Jul 19 09:12:40 2004
+++ /c/Boost/include/boost-1_32/boost/test/auto_unit_test.hpp Thu Apr 7
16:16:19 2005
@@ -19,6 +19,17 @@
 // Boost.Test
 #include <boost/test/unit_test.hpp>
 
+#define BOOST_AUTO_TEST_SUITE_DEFAULT_NAME "Auto Unit Test"
+#ifdef BOOST_AUTO_TEST_MAIN
+ #ifndef BOOST_AUTO_TEST_SUITE_NAME
+ #define BOOST_AUTO_TEST_SUITE_NAME suiteName(BOOST_AUTO_TEST_MAIN)
+ #endif
+#else
+ #ifndef BOOST_AUTO_TEST_SUITE_NAME
+ #define BOOST_AUTO_TEST_SUITE_NAME BOOST_AUTO_TEST_SUITE_DEFAULT_NAME
+ #endif
+#endif
+
 //
**************************************************************************
//
 // ************** auto_unit_test_registrar
************** //
 //
**************************************************************************
//
@@ -27,10 +38,17 @@
 namespace unit_test {
 namespace ut_detail {
 
+inline const char*
+suiteName(const char* name = NULL)
+{
+ return name ? name : BOOST_AUTO_TEST_SUITE_DEFAULT_NAME;
+}
+
 inline boost::unit_test::test_suite*
 auto_unit_test_suite()
 {
- static boost::unit_test::test_suite* inst = BOOST_TEST_SUITE( "Auto
Unit Test" );
+ static boost::unit_test::test_suite* inst
+ = BOOST_TEST_SUITE( BOOST_AUTO_TEST_SUITE_NAME );
 
     return inst;
 }


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net