[Boost-bugs] [Boost C++ Libraries] #11854: Add fixture support in BOOST_DATA_TEST_CASE

Subject: [Boost-bugs] [Boost C++ Libraries] #11854: Add fixture support in BOOST_DATA_TEST_CASE
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-12-18 15:45:15


#11854: Add fixture support in BOOST_DATA_TEST_CASE
------------------------------+---------------------
 Reporter: mikhail@… | Owner: rogeeff
     Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: test
  Version: Boost 1.59.0 | Severity: Problem
 Keywords: |
------------------------------+---------------------
 Now BOOST_DATA_TEST_CASE doesn't support test fixture at all. There is the
 ability to support this:
 {{{
 #define BOOST_FIXTURE_DATA_TEST_CASE_IMPL( arity, test_name, F, dataset,
 params ) \
 struct test_name : public F {
 \
     template<BOOST_PP_ENUM_PARAMS(arity, typename Arg)>
 \
     static void test_method( BOOST_DATA_TEST_CASE_PARAMS( params ) )
 \
     {
 \
         BOOST_TEST_CHECKPOINT('"' << #test_name << "\" fixture entry.");
 \
         test_name t;
 \
         BOOST_TEST_CHECKPOINT('"' << #test_name << "\" entry.");
 \
         BOOST_TEST_CONTEXT( ""
 \
             BOOST_PP_SEQ_FOR_EACH(BOOST_DATA_TEST_CONTEXT, _, params))
 \
         t._impl(BOOST_PP_SEQ_ENUM(params));
 \
         BOOST_TEST_CHECKPOINT('"' << #test_name << "\" exit.");
 \
     }
 \
 private:
 \
     template<BOOST_PP_ENUM_PARAMS(arity, typename Arg)>
 \
     void _impl(BOOST_DATA_TEST_CASE_PARAMS( params ));
 \
 };
 \
 \
 BOOST_AUTO_TU_REGISTRAR( test_name )(
 \
     boost::unit_test::data::ds_detail::make_test_case_gen<test_name>(
 \
           BOOST_STRINGIZE( test_name ),
 \
           __FILE__, __LINE__,
 \
           boost::unit_test::data::make(dataset) ),
 \
     boost::unit_test::decorator::collector::instance() );
 \
 \
 template<BOOST_PP_ENUM_PARAMS(arity, typename Arg)>
 \
 void test_name::_impl( BOOST_DATA_TEST_CASE_PARAMS( params ) )
 \
 /**/

 #define BOOST_AUTO_DATA_TEST_CASE_WITH_PARAMS( test_name, dataset, ... )
 \
     BOOST_FIXTURE_DATA_TEST_CASE_IMPL(
 BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), \
                                test_name, BOOST_AUTO_TEST_CASE_FIXTURE,
 dataset, \
                                BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__) )
 \
 /**/
 #define BOOST_AUTO_DATA_TEST_CASE_NO_PARAMS( test_name, dataset ) \
     BOOST_AUTO_DATA_TEST_CASE_WITH_PARAMS( test_name, dataset, sample ) \
 /**/

 #if BOOST_PP_VARIADICS_MSVC

 #define BOOST_AUTO_DATA_TEST_CASE( ... )
 \
     BOOST_PP_CAT(
 \
     BOOST_PP_IIF(BOOST_PP_EQUAL(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__),2),
 \
                      BOOST_AUTO_DATA_TEST_CASE_NO_PARAMS,
 \
                      BOOST_AUTO_DATA_TEST_CASE_WITH_PARAMS) (__VA_ARGS__),
 ) \
 /**/
 #else

 #define BOOST_AUTO_DATA_TEST_CASE( ... )
 \
     BOOST_PP_IIF(BOOST_PP_EQUAL(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__),2),
 \
                      BOOST_AUTO_DATA_TEST_CASE_NO_PARAMS,
 \
                      BOOST_AUTO_DATA_TEST_CASE_WITH_PARAMS) (__VA_ARGS__)
 \
 /**/
 #endif
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11854>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:19 UTC