annotate DEPENDENCIES/generic/include/boost/test/unit_test_suite.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 // (C) Copyright Gennadiy Rozental 2001-2008.
Chris@16 2 // Distributed under the Boost Software License, Version 1.0.
Chris@16 3 // (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 4 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 5
Chris@16 6 // See http://www.boost.org/libs/test for the library home page.
Chris@16 7 //
Chris@16 8 // File : $RCSfile$
Chris@16 9 //
Chris@101 10 // Version : $Revision$
Chris@16 11 //
Chris@16 12 // Description : defines Unit Test Framework public API
Chris@16 13 // ***************************************************************************
Chris@16 14
Chris@16 15 #ifndef BOOST_TEST_UNIT_TEST_SUITE_HPP_071894GER
Chris@16 16 #define BOOST_TEST_UNIT_TEST_SUITE_HPP_071894GER
Chris@16 17
Chris@16 18 // Boost.Test
Chris@16 19 #include <boost/test/unit_test_suite_impl.hpp>
Chris@16 20 #include <boost/test/framework.hpp>
Chris@16 21
Chris@16 22 //____________________________________________________________________________//
Chris@16 23
Chris@16 24 // ************************************************************************** //
Chris@16 25 // ************** Non-auto (explicit) test case interface ************** //
Chris@16 26 // ************************************************************************** //
Chris@16 27
Chris@16 28 #define BOOST_TEST_CASE( test_function ) \
Chris@16 29 boost::unit_test::make_test_case( boost::unit_test::callback0<>(test_function), BOOST_TEST_STRINGIZE( test_function ) )
Chris@16 30 #define BOOST_CLASS_TEST_CASE( test_function, tc_instance ) \
Chris@16 31 boost::unit_test::make_test_case((test_function), BOOST_TEST_STRINGIZE( test_function ), tc_instance )
Chris@16 32
Chris@16 33 // ************************************************************************** //
Chris@16 34 // ************** BOOST_TEST_SUITE ************** //
Chris@16 35 // ************************************************************************** //
Chris@16 36
Chris@16 37 #define BOOST_TEST_SUITE( testsuite_name ) \
Chris@16 38 ( new boost::unit_test::test_suite( testsuite_name ) )
Chris@16 39
Chris@16 40 // ************************************************************************** //
Chris@16 41 // ************** BOOST_AUTO_TEST_SUITE ************** //
Chris@16 42 // ************************************************************************** //
Chris@16 43
Chris@16 44 #define BOOST_AUTO_TEST_SUITE( suite_name ) \
Chris@16 45 namespace suite_name { \
Chris@16 46 BOOST_AUTO_TU_REGISTRAR( suite_name )( BOOST_STRINGIZE( suite_name ) ); \
Chris@16 47 /**/
Chris@16 48
Chris@16 49 // ************************************************************************** //
Chris@16 50 // ************** BOOST_FIXTURE_TEST_SUITE ************** //
Chris@16 51 // ************************************************************************** //
Chris@16 52
Chris@16 53 #define BOOST_FIXTURE_TEST_SUITE( suite_name, F ) \
Chris@16 54 BOOST_AUTO_TEST_SUITE( suite_name ) \
Chris@16 55 typedef F BOOST_AUTO_TEST_CASE_FIXTURE; \
Chris@16 56 /**/
Chris@16 57
Chris@16 58 // ************************************************************************** //
Chris@16 59 // ************** BOOST_AUTO_TEST_SUITE_END ************** //
Chris@16 60 // ************************************************************************** //
Chris@16 61
Chris@16 62 #define BOOST_AUTO_TEST_SUITE_END() \
Chris@16 63 BOOST_AUTO_TU_REGISTRAR( BOOST_JOIN( end_suite, __LINE__ ) )( 1 ); \
Chris@16 64 } \
Chris@16 65 /**/
Chris@16 66
Chris@16 67 // ************************************************************************** //
Chris@16 68 // ************** BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES ************** //
Chris@16 69 // ************************************************************************** //
Chris@16 70
Chris@16 71 #define BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES( test_name, n ) \
Chris@16 72 struct BOOST_AUTO_TC_UNIQUE_ID( test_name ); \
Chris@16 73 \
Chris@16 74 static struct BOOST_JOIN( test_name, _exp_fail_num_spec ) \
Chris@16 75 : boost::unit_test::ut_detail:: \
Chris@16 76 auto_tc_exp_fail<BOOST_AUTO_TC_UNIQUE_ID( test_name ) > \
Chris@16 77 { \
Chris@16 78 BOOST_JOIN( test_name, _exp_fail_num_spec )() \
Chris@16 79 : boost::unit_test::ut_detail:: \
Chris@16 80 auto_tc_exp_fail<BOOST_AUTO_TC_UNIQUE_ID( test_name ) >( n ) \
Chris@16 81 {} \
Chris@16 82 } BOOST_JOIN( test_name, _exp_fail_num_spec_inst ); \
Chris@16 83 \
Chris@16 84 /**/
Chris@16 85
Chris@16 86 // ************************************************************************** //
Chris@16 87 // ************** BOOST_FIXTURE_TEST_CASE ************** //
Chris@16 88 // ************************************************************************** //
Chris@16 89
Chris@16 90 #define BOOST_FIXTURE_TEST_CASE( test_name, F ) \
Chris@16 91 struct test_name : public F { void test_method(); }; \
Chris@16 92 \
Chris@16 93 static void BOOST_AUTO_TC_INVOKER( test_name )() \
Chris@16 94 { \
Chris@16 95 test_name t; \
Chris@16 96 t.test_method(); \
Chris@16 97 } \
Chris@16 98 \
Chris@16 99 struct BOOST_AUTO_TC_UNIQUE_ID( test_name ) {}; \
Chris@16 100 \
Chris@16 101 BOOST_AUTO_TU_REGISTRAR( test_name )( \
Chris@16 102 boost::unit_test::make_test_case( \
Chris@16 103 &BOOST_AUTO_TC_INVOKER( test_name ), #test_name ), \
Chris@16 104 boost::unit_test::ut_detail::auto_tc_exp_fail< \
Chris@16 105 BOOST_AUTO_TC_UNIQUE_ID( test_name )>::instance()->value() ); \
Chris@16 106 \
Chris@16 107 void test_name::test_method() \
Chris@16 108 /**/
Chris@16 109
Chris@16 110 // ************************************************************************** //
Chris@16 111 // ************** BOOST_AUTO_TEST_CASE ************** //
Chris@16 112 // ************************************************************************** //
Chris@16 113
Chris@16 114 #define BOOST_AUTO_TEST_CASE( test_name ) \
Chris@16 115 BOOST_FIXTURE_TEST_CASE( test_name, BOOST_AUTO_TEST_CASE_FIXTURE )
Chris@16 116 /**/
Chris@16 117
Chris@16 118 // ************************************************************************** //
Chris@16 119 // ************** BOOST_FIXTURE_TEST_CASE_TEMPLATE ************** //
Chris@16 120 // ************************************************************************** //
Chris@16 121
Chris@16 122 #define BOOST_FIXTURE_TEST_CASE_TEMPLATE( test_name, type_name, TL, F ) \
Chris@16 123 template<typename type_name> \
Chris@16 124 struct test_name : public F \
Chris@16 125 { void test_method(); }; \
Chris@16 126 \
Chris@16 127 struct BOOST_AUTO_TC_INVOKER( test_name ) { \
Chris@16 128 template<typename TestType> \
Chris@16 129 static void run( boost::type<TestType>* = 0 ) \
Chris@16 130 { \
Chris@16 131 test_name<TestType> t; \
Chris@16 132 t.test_method(); \
Chris@16 133 } \
Chris@16 134 }; \
Chris@16 135 \
Chris@16 136 BOOST_AUTO_TU_REGISTRAR( test_name )( \
Chris@16 137 boost::unit_test::ut_detail::template_test_case_gen< \
Chris@16 138 BOOST_AUTO_TC_INVOKER( test_name ),TL >( \
Chris@16 139 BOOST_STRINGIZE( test_name ) ) ); \
Chris@16 140 \
Chris@16 141 template<typename type_name> \
Chris@16 142 void test_name<type_name>::test_method() \
Chris@16 143 /**/
Chris@16 144
Chris@16 145 // ************************************************************************** //
Chris@16 146 // ************** BOOST_AUTO_TEST_CASE_TEMPLATE ************** //
Chris@16 147 // ************************************************************************** //
Chris@16 148
Chris@16 149 #define BOOST_AUTO_TEST_CASE_TEMPLATE( test_name, type_name, TL ) \
Chris@16 150 BOOST_FIXTURE_TEST_CASE_TEMPLATE( test_name, type_name, TL, BOOST_AUTO_TEST_CASE_FIXTURE )
Chris@16 151
Chris@16 152 // ************************************************************************** //
Chris@16 153 // ************** BOOST_TEST_CASE_TEMPLATE ************** //
Chris@16 154 // ************************************************************************** //
Chris@16 155
Chris@16 156 #define BOOST_TEST_CASE_TEMPLATE( name, typelist ) \
Chris@16 157 boost::unit_test::ut_detail::template_test_case_gen<name,typelist >( \
Chris@16 158 BOOST_TEST_STRINGIZE( name ) ) \
Chris@16 159 /**/
Chris@16 160
Chris@16 161 // ************************************************************************** //
Chris@16 162 // ************** BOOST_TEST_CASE_TEMPLATE_FUNCTION ************** //
Chris@16 163 // ************************************************************************** //
Chris@16 164
Chris@16 165 #define BOOST_TEST_CASE_TEMPLATE_FUNCTION( name, type_name ) \
Chris@16 166 template<typename type_name> \
Chris@16 167 void BOOST_JOIN( name, _impl )( boost::type<type_name>* ); \
Chris@16 168 \
Chris@16 169 struct name { \
Chris@16 170 template<typename TestType> \
Chris@16 171 static void run( boost::type<TestType>* frwrd = 0 ) \
Chris@16 172 { \
Chris@16 173 BOOST_JOIN( name, _impl )( frwrd ); \
Chris@16 174 } \
Chris@16 175 }; \
Chris@16 176 \
Chris@16 177 template<typename type_name> \
Chris@16 178 void BOOST_JOIN( name, _impl )( boost::type<type_name>* ) \
Chris@16 179 /**/
Chris@16 180
Chris@16 181 // ************************************************************************** //
Chris@16 182 // ************** BOOST_GLOBAL_FIXURE ************** //
Chris@16 183 // ************************************************************************** //
Chris@16 184
Chris@16 185 #define BOOST_GLOBAL_FIXTURE( F ) \
Chris@16 186 static boost::unit_test::ut_detail::global_fixture_impl<F> BOOST_JOIN( gf_, F ) ; \
Chris@16 187 /**/
Chris@16 188
Chris@16 189 // ************************************************************************** //
Chris@16 190 // ************** BOOST_AUTO_TEST_CASE_FIXTURE ************** //
Chris@16 191 // ************************************************************************** //
Chris@16 192
Chris@16 193 namespace boost { namespace unit_test { namespace ut_detail {
Chris@16 194
Chris@16 195 struct nil_t {};
Chris@16 196
Chris@16 197 } // namespace ut_detail
Chris@16 198 } // unit_test
Chris@16 199 } // namespace boost
Chris@16 200
Chris@16 201 // Intentionally is in global namespace, so that FIXURE_TEST_SUITE can reset it in user code.
Chris@16 202 typedef ::boost::unit_test::ut_detail::nil_t BOOST_AUTO_TEST_CASE_FIXTURE;
Chris@16 203
Chris@16 204 // ************************************************************************** //
Chris@16 205 // ************** Auto registration facility helper macros ************** //
Chris@16 206 // ************************************************************************** //
Chris@16 207
Chris@16 208 #define BOOST_AUTO_TU_REGISTRAR( test_name ) \
Chris@16 209 static boost::unit_test::ut_detail::auto_test_unit_registrar BOOST_JOIN( BOOST_JOIN( test_name, _registrar ), __LINE__ )
Chris@16 210 #define BOOST_AUTO_TC_INVOKER( test_name ) BOOST_JOIN( test_name, _invoker )
Chris@16 211 #define BOOST_AUTO_TC_UNIQUE_ID( test_name ) BOOST_JOIN( test_name, _id )
Chris@16 212
Chris@16 213 // ************************************************************************** //
Chris@16 214 // ************** BOOST_TEST_MAIN ************** //
Chris@16 215 // ************************************************************************** //
Chris@16 216
Chris@16 217 #if defined(BOOST_TEST_MAIN)
Chris@16 218
Chris@16 219 #ifdef BOOST_TEST_ALTERNATIVE_INIT_API
Chris@16 220 bool init_unit_test() {
Chris@16 221 #else
Chris@16 222 ::boost::unit_test::test_suite*
Chris@16 223 init_unit_test_suite( int, char* [] ) {
Chris@16 224 #endif
Chris@16 225
Chris@16 226 #ifdef BOOST_TEST_MODULE
Chris@16 227 using namespace ::boost::unit_test;
Chris@16 228 assign_op( framework::master_test_suite().p_name.value, BOOST_TEST_STRINGIZE( BOOST_TEST_MODULE ).trim( "\"" ), 0 );
Chris@16 229
Chris@16 230 #endif
Chris@16 231
Chris@16 232 #ifdef BOOST_TEST_ALTERNATIVE_INIT_API
Chris@16 233 return true;
Chris@16 234 }
Chris@16 235 #else
Chris@16 236 return 0;
Chris@16 237 }
Chris@16 238 #endif
Chris@16 239
Chris@16 240 #endif
Chris@16 241
Chris@16 242 //____________________________________________________________________________//
Chris@16 243
Chris@16 244 #endif // BOOST_TEST_UNIT_TEST_SUITE_HPP_071894GER
Chris@16 245