Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r49864 - trunk/boost/test
From: gennadiy.rozental_at_[hidden]
Date: 2008-11-21 17:36:08


Author: rogeeff
Date: 2008-11-21 17:36:07 EST (Fri, 21 Nov 2008)
New Revision: 49864
URL: http://svn.boost.org/trac/boost/changeset/49864

Log:
test_case_template.hpp deprecated
Text files modified:
   trunk/boost/test/test_case_template.hpp | 147 ---------------------------------------
   trunk/boost/test/unit_test_suite.hpp | 30 +++++++
   trunk/boost/test/unit_test_suite_impl.hpp | 80 +++++++++++++++++++++
   3 files changed, 111 insertions(+), 146 deletions(-)

Modified: trunk/boost/test/test_case_template.hpp
==============================================================================
--- trunk/boost/test/test_case_template.hpp (original)
+++ trunk/boost/test/test_case_template.hpp 2008-11-21 17:36:07 EST (Fri, 21 Nov 2008)
@@ -9,150 +9,7 @@
 //
 // Version : $Revision$
 //
-// Description : implements support for test cases templates instantiated with
-// sequence of test types
+// Description : deprecated
 // ***************************************************************************
 
-#ifndef BOOST_TEST_TEST_CASE_TEMPLATE_HPP_071894GER
-#define BOOST_TEST_TEST_CASE_TEMPLATE_HPP_071894GER
-
-// Boost.Test
-#include <boost/test/detail/config.hpp>
-#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
-
-// Boost
-#include <boost/mpl/for_each.hpp>
-#include <boost/mpl/identity.hpp>
-#include <boost/type.hpp>
-#include <boost/type_traits/is_const.hpp>
-
-// STL
-#include <typeinfo>
-#include <list>
-
-#include <boost/test/detail/suppress_warnings.hpp>
-
-//____________________________________________________________________________//
-
-#define BOOST_TEST_CASE_TEMPLATE( name, typelist ) \
- boost::unit_test::ut_detail::template_test_case_gen<name,typelist >( \
- BOOST_TEST_STRINGIZE( name ) ) \
-/**/
-
-//____________________________________________________________________________//
-
-#define BOOST_TEST_CASE_TEMPLATE_FUNCTION( name, type_name ) \
-template<typename type_name> \
-void BOOST_JOIN( name, _impl )( boost::type<type_name>* ); \
- \
-struct name { \
- template<typename TestType> \
- static void run( boost::type<TestType>* frwrd = 0 ) \
- { \
- BOOST_JOIN( name, _impl )( frwrd ); \
- } \
-}; \
- \
-template<typename type_name> \
-void BOOST_JOIN( name, _impl )( boost::type<type_name>* ) \
-/**/
-
-//____________________________________________________________________________//
-
-namespace boost {
-
-namespace unit_test {
-
-namespace ut_detail {
-
-// ************************************************************************** //
-// ************** test_case_template_invoker ************** //
-// ************************************************************************** //
-
-template<typename TestCaseTemplate,typename TestType>
-class test_case_template_invoker {
-public:
- void operator()() { TestCaseTemplate::run( (boost::type<TestType>*)0 ); }
-};
-
-//____________________________________________________________________________//
-
-// ************************************************************************** //
-// ************** generate_test_case_4_type ************** //
-// ************************************************************************** //
-
-template<typename Generator,typename TestCaseTemplate>
-struct generate_test_case_4_type {
- explicit generate_test_case_4_type( const_string tc_name, Generator& G )
- : m_test_case_name( tc_name )
- , m_holder( G )
- {}
-
- template<typename TestType>
- void operator()( mpl::identity<TestType> )
- {
- std::string full_name;
- assign_op( full_name, m_test_case_name, 0 );
- full_name += '<';
- full_name += typeid(TestType).name();
- if( boost::is_const<TestType>::value )
- full_name += " const";
- full_name += '>';
-
- m_holder.m_test_cases.push_back(
- new test_case( full_name, test_case_template_invoker<TestCaseTemplate,TestType>() ) );
- }
-
-private:
- // Data members
- const_string m_test_case_name;
- Generator& m_holder;
-};
-
-// ************************************************************************** //
-// ************** test_case_template ************** //
-// ************************************************************************** //
-
-class test_unit;
-
-template<typename TestCaseTemplate,typename TestTypesList>
-class template_test_case_gen : public test_unit_generator {
-public:
- // Constructor
- template_test_case_gen( const_string tc_name )
- {
- typedef generate_test_case_4_type<template_test_case_gen<TestCaseTemplate,TestTypesList>,
- TestCaseTemplate
- > single_test_gen;
- mpl::for_each<TestTypesList,mpl::make_identity<mpl::_> >( single_test_gen( tc_name, *this ) );
- }
-
- test_unit* next() const
- {
- if( m_test_cases.empty() )
- return 0;
-
- test_unit* res = m_test_cases.front();
- m_test_cases.pop_front();
-
- return res;
- }
-
- // Data members
- mutable std::list<test_unit*> m_test_cases;
-};
-
-//____________________________________________________________________________//
-
-} // namespace ut_detail
-
-} // unit_test
-
-} // namespace boost
-
-//____________________________________________________________________________//
-
-#include <boost/test/detail/enable_warnings.hpp>
-
-#endif // BOOST_TEST_TEST_CASE_TEMPLATE_HPP_071894GER
-
+#include <boost/test/unit_test.hpp>
\ No newline at end of file

Modified: trunk/boost/test/unit_test_suite.hpp
==============================================================================
--- trunk/boost/test/unit_test_suite.hpp (original)
+++ trunk/boost/test/unit_test_suite.hpp 2008-11-21 17:36:07 EST (Fri, 21 Nov 2008)
@@ -17,7 +17,6 @@
 
 // Boost.Test
 #include <boost/test/unit_test_suite_impl.hpp>
-#include <boost/test/test_case_template.hpp>
 #include <boost/test/framework.hpp>
 
 //____________________________________________________________________________//
@@ -144,6 +143,35 @@
 /**/
 
 // ************************************************************************** //
+// ************** BOOST_TEST_CASE_TEMPLATE ************** //
+// ************************************************************************** //
+
+#define BOOST_TEST_CASE_TEMPLATE( name, typelist ) \
+ boost::unit_test::ut_detail::template_test_case_gen<name,typelist >( \
+ BOOST_TEST_STRINGIZE( name ) ) \
+/**/
+
+// ************************************************************************** //
+// ************** BOOST_TEST_CASE_TEMPLATE_FUNCTION ************** //
+// ************************************************************************** //
+
+#define BOOST_TEST_CASE_TEMPLATE_FUNCTION( name, type_name ) \
+template<typename type_name> \
+void BOOST_JOIN( name, _impl )( boost::type<type_name>* ); \
+ \
+struct name { \
+ template<typename TestType> \
+ static void run( boost::type<TestType>* frwrd = 0 ) \
+ { \
+ BOOST_JOIN( name, _impl )( frwrd ); \
+ } \
+}; \
+ \
+template<typename type_name> \
+void BOOST_JOIN( name, _impl )( boost::type<type_name>* ) \
+/**/
+
+// ************************************************************************** //
 // ************** BOOST_GLOBAL_FIXURE ************** //
 // ************************************************************************** //
 

Modified: trunk/boost/test/unit_test_suite_impl.hpp
==============================================================================
--- trunk/boost/test/unit_test_suite_impl.hpp (original)
+++ trunk/boost/test/unit_test_suite_impl.hpp 2008-11-21 17:36:07 EST (Fri, 21 Nov 2008)
@@ -26,8 +26,13 @@
 
 // Boost
 #include <boost/shared_ptr.hpp>
+#include <boost/mpl/for_each.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/type.hpp>
+#include <boost/type_traits/is_const.hpp>
 
 // STL
+#include <typeinfo> // for typeid
 #include <string> // for std::string
 #include <list> // for std::list
 #include <vector> // for std::vector
@@ -342,6 +347,81 @@
     F* m_fixure;
 };
 
+// ************************************************************************** //
+// ************** test_case_template_invoker ************** //
+// ************************************************************************** //
+
+template<typename TestCaseTemplate,typename TestType>
+class test_case_template_invoker {
+public:
+ void operator()() { TestCaseTemplate::run( (boost::type<TestType>*)0 ); }
+};
+
+// ************************************************************************** //
+// ************** generate_test_case_4_type ************** //
+// ************************************************************************** //
+
+template<typename Generator,typename TestCaseTemplate>
+struct generate_test_case_4_type {
+ explicit generate_test_case_4_type( const_string tc_name, Generator& G )
+ : m_test_case_name( tc_name )
+ , m_holder( G )
+ {}
+
+ template<typename TestType>
+ void operator()( mpl::identity<TestType> )
+ {
+ std::string full_name;
+ assign_op( full_name, m_test_case_name, 0 );
+ full_name += '<';
+ full_name += typeid(TestType).name();
+ if( boost::is_const<TestType>::value )
+ full_name += " const";
+ full_name += '>';
+
+ m_holder.m_test_cases.push_back(
+ new test_case( full_name, test_case_template_invoker<TestCaseTemplate,TestType>() ) );
+ }
+
+private:
+ // Data members
+ const_string m_test_case_name;
+ Generator& m_holder;
+};
+
+// ************************************************************************** //
+// ************** test_case_template ************** //
+// ************************************************************************** //
+
+template<typename TestCaseTemplate,typename TestTypesList>
+class template_test_case_gen : public test_unit_generator {
+public:
+ // Constructor
+ template_test_case_gen( const_string tc_name )
+ {
+ typedef generate_test_case_4_type<template_test_case_gen<TestCaseTemplate,TestTypesList>,
+ TestCaseTemplate
+ > single_test_gen;
+ mpl::for_each<TestTypesList,mpl::make_identity<mpl::_> >( single_test_gen( tc_name, *this ) );
+ }
+
+ virtual test_unit* next() const
+ {
+ if( m_test_cases.empty() )
+ return 0;
+
+ test_unit* res = m_test_cases.front();
+ m_test_cases.pop_front();
+
+ return res;
+ }
+
+ // Data members
+ mutable std::list<test_unit*> m_test_cases;
+};
+
+//____________________________________________________________________________//
+
 } // namespace ut_detail
 
 } // unit_test


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