1 /*
2  *  Created by Phil on 22/10/2010.
3  *  Copyright 2010 Two Blue Cubes Ltd
4  *
5  *  Distributed under the Boost Software License, Version 1.0. (See accompanying
6  *  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7  */
8 
9 #ifndef TWOBLUECUBES_CATCH_HPP_INCLUDED
10 #define TWOBLUECUBES_CATCH_HPP_INCLUDED
11 
12 #define CATCH_VERSION_MAJOR 2
13 #define CATCH_VERSION_MINOR 7
14 #define CATCH_VERSION_PATCH 0
15 
16 #ifdef __clang__
17 #    pragma clang system_header
18 #elif defined __GNUC__
19 #    pragma GCC system_header
20 #endif
21 
22 #include "internal/catch_suppress_warnings.h"
23 
24 #if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER)
25 #  define CATCH_IMPL
26 #  define CATCH_CONFIG_ALL_PARTS
27 #endif
28 
29 // In the impl file, we want to have access to all parts of the headers
30 // Can also be used to sanely support PCHs
31 #if defined(CATCH_CONFIG_ALL_PARTS)
32 #  define CATCH_CONFIG_EXTERNAL_INTERFACES
33 #  if defined(CATCH_CONFIG_DISABLE_MATCHERS)
34 #    undef CATCH_CONFIG_DISABLE_MATCHERS
35 #  endif
36 #  if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER)
37 #    define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
38 #  endif
39 #endif
40 
41 #if !defined(CATCH_CONFIG_IMPL_ONLY)
42 #include "internal/catch_platform.h"
43 
44 #ifdef CATCH_IMPL
45 #  ifndef CLARA_CONFIG_MAIN
46 #    define CLARA_CONFIG_MAIN_NOT_DEFINED
47 #    define CLARA_CONFIG_MAIN
48 #  endif
49 #endif
50 
51 #include "internal/catch_user_interfaces.h"
52 #include "internal/catch_tag_alias_autoregistrar.h"
53 #include "internal/catch_test_registry.h"
54 #include "internal/catch_capture.hpp"
55 #include "internal/catch_section.h"
56 #include "internal/catch_benchmark.h"
57 #include "internal/catch_interfaces_exception.h"
58 #include "internal/catch_approx.h"
59 #include "internal/catch_compiler_capabilities.h"
60 #include "internal/catch_string_manip.h"
61 
62 #ifndef CATCH_CONFIG_DISABLE_MATCHERS
63 #include "internal/catch_capture_matchers.h"
64 #endif
65 #include "internal/catch_generators.hpp"
66 #include "internal/catch_generators_generic.hpp"
67 #include "internal/catch_generators_specific.hpp"
68 
69 // These files are included here so the single_include script doesn't put them
70 // in the conditionally compiled sections
71 #include "internal/catch_test_case_info.h"
72 #include "internal/catch_interfaces_runner.h"
73 
74 #ifdef __OBJC__
75 #include "internal/catch_objc.hpp"
76 #endif
77 
78 #ifdef CATCH_CONFIG_EXTERNAL_INTERFACES
79 #include "internal/catch_external_interfaces.h"
80 #endif
81 
82 #endif // ! CATCH_CONFIG_IMPL_ONLY
83 
84 #ifdef CATCH_IMPL
85 #include "internal/catch_impl.hpp"
86 #endif
87 
88 #ifdef CATCH_CONFIG_MAIN
89 #include "internal/catch_default_main.hpp"
90 #endif
91 
92 #if !defined(CATCH_CONFIG_IMPL_ONLY)
93 
94 #ifdef CLARA_CONFIG_MAIN_NOT_DEFINED
95 #  undef CLARA_CONFIG_MAIN
96 #endif
97 
98 #if !defined(CATCH_CONFIG_DISABLE)
99 //////
100 // If this config identifier is defined then all CATCH macros are prefixed with CATCH_
101 #ifdef CATCH_CONFIG_PREFIX_ALL
102 
103 #define CATCH_REQUIRE( ... ) INTERNAL_CATCH_TEST( "CATCH_REQUIRE", Catch::ResultDisposition::Normal, __VA_ARGS__ )
104 #define CATCH_REQUIRE_FALSE( ... ) INTERNAL_CATCH_TEST( "CATCH_REQUIRE_FALSE", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )
105 
106 #define CATCH_REQUIRE_THROWS( ... ) INTERNAL_CATCH_THROWS( "CATCH_REQUIRE_THROWS", Catch::ResultDisposition::Normal, __VA_ARGS__ )
107 #define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CATCH_REQUIRE_THROWS_AS", exceptionType, Catch::ResultDisposition::Normal, expr )
108 #define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CATCH_REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr )
109 #if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
110 #define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CATCH_REQUIRE_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::Normal, matcher, expr )
111 #endif// CATCH_CONFIG_DISABLE_MATCHERS
112 #define CATCH_REQUIRE_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CATCH_REQUIRE_NOTHROW", Catch::ResultDisposition::Normal, __VA_ARGS__ )
113 
114 #define CATCH_CHECK( ... ) INTERNAL_CATCH_TEST( "CATCH_CHECK", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
115 #define CATCH_CHECK_FALSE( ... ) INTERNAL_CATCH_TEST( "CATCH_CHECK_FALSE", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )
116 #define CATCH_CHECKED_IF( ... ) INTERNAL_CATCH_IF( "CATCH_CHECKED_IF", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
117 #define CATCH_CHECKED_ELSE( ... ) INTERNAL_CATCH_ELSE( "CATCH_CHECKED_ELSE", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
118 #define CATCH_CHECK_NOFAIL( ... ) INTERNAL_CATCH_TEST( "CATCH_CHECK_NOFAIL", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ )
119 
120 #define CATCH_CHECK_THROWS( ... )  INTERNAL_CATCH_THROWS( "CATCH_CHECK_THROWS", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
121 #define CATCH_CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CATCH_CHECK_THROWS_AS", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr )
122 #define CATCH_CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CATCH_CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
123 #if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
124 #define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CATCH_CHECK_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
125 #endif // CATCH_CONFIG_DISABLE_MATCHERS
126 #define CATCH_CHECK_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CATCH_CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
127 
128 #if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
129 #define CATCH_CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CATCH_CHECK_THAT", matcher, Catch::ResultDisposition::ContinueOnFailure, arg )
130 
131 #define CATCH_REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CATCH_REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg )
132 #endif // CATCH_CONFIG_DISABLE_MATCHERS
133 
134 #define CATCH_INFO( msg ) INTERNAL_CATCH_INFO( "CATCH_INFO", msg )
135 #define CATCH_WARN( msg ) INTERNAL_CATCH_MSG( "CATCH_WARN", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg )
136 #define CATCH_CAPTURE( ... ) INTERNAL_CATCH_CAPTURE( INTERNAL_CATCH_UNIQUE_NAME(capturer), "CATCH_CAPTURE",__VA_ARGS__ )
137 
138 #define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )
139 #define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ )
140 #define CATCH_METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
141 #define CATCH_REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ )
142 #define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
143 #define CATCH_DYNAMIC_SECTION( ... ) INTERNAL_CATCH_DYNAMIC_SECTION( __VA_ARGS__ )
144 #define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ )
145 #define CATCH_FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
146 #define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( "CATCH_SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
147 
148 #define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE()
149 
150 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
151 #define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )
152 #define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
153 #define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ )
154 #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ )
155 #else
156 #define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) )
157 #define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) )
158 #define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ ) )
159 #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ ) )
160 #endif
161 
162 
163 #if !defined(CATCH_CONFIG_RUNTIME_STATIC_REQUIRE)
164 #define CATCH_STATIC_REQUIRE( ... )       static_assert(   __VA_ARGS__ ,      #__VA_ARGS__ );     CATCH_SUCCEED( #__VA_ARGS__ )
165 #define CATCH_STATIC_REQUIRE_FALSE( ... ) static_assert( !(__VA_ARGS__), "!(" #__VA_ARGS__ ")" ); CATCH_SUCCEED( #__VA_ARGS__ )
166 #else
167 #define CATCH_STATIC_REQUIRE( ... )       CATCH_REQUIRE( __VA_ARGS__ )
168 #define CATCH_STATIC_REQUIRE_FALSE( ... ) CATCH_REQUIRE_FALSE( __VA_ARGS__ )
169 #endif
170 
171 
172 // "BDD-style" convenience wrappers
173 #define CATCH_SCENARIO( ... ) CATCH_TEST_CASE( "Scenario: " __VA_ARGS__ )
174 #define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " __VA_ARGS__ )
175 #define CATCH_GIVEN( desc )     INTERNAL_CATCH_DYNAMIC_SECTION( "    Given: " << desc )
176 #define CATCH_AND_GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( "And given: " << desc )
177 #define CATCH_WHEN( desc )      INTERNAL_CATCH_DYNAMIC_SECTION( "     When: " << desc )
178 #define CATCH_AND_WHEN( desc )  INTERNAL_CATCH_DYNAMIC_SECTION( " And when: " << desc )
179 #define CATCH_THEN( desc )      INTERNAL_CATCH_DYNAMIC_SECTION( "     Then: " << desc )
180 #define CATCH_AND_THEN( desc )  INTERNAL_CATCH_DYNAMIC_SECTION( "      And: " << desc )
181 
182 // If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required
183 #else
184 
185 #define REQUIRE( ... ) INTERNAL_CATCH_TEST( "REQUIRE", Catch::ResultDisposition::Normal, __VA_ARGS__  )
186 #define REQUIRE_FALSE( ... ) INTERNAL_CATCH_TEST( "REQUIRE_FALSE", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )
187 
188 #define REQUIRE_THROWS( ... ) INTERNAL_CATCH_THROWS( "REQUIRE_THROWS", Catch::ResultDisposition::Normal, __VA_ARGS__ )
189 #define REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "REQUIRE_THROWS_AS", exceptionType, Catch::ResultDisposition::Normal, expr )
190 #define REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr )
191 #if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
192 #define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "REQUIRE_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::Normal, matcher, expr )
193 #endif // CATCH_CONFIG_DISABLE_MATCHERS
194 #define REQUIRE_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "REQUIRE_NOTHROW", Catch::ResultDisposition::Normal, __VA_ARGS__ )
195 
196 #define CHECK( ... ) INTERNAL_CATCH_TEST( "CHECK", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
197 #define CHECK_FALSE( ... ) INTERNAL_CATCH_TEST( "CHECK_FALSE", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )
198 #define CHECKED_IF( ... ) INTERNAL_CATCH_IF( "CHECKED_IF", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
199 #define CHECKED_ELSE( ... ) INTERNAL_CATCH_ELSE( "CHECKED_ELSE", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
200 #define CHECK_NOFAIL( ... ) INTERNAL_CATCH_TEST( "CHECK_NOFAIL", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ )
201 
202 #define CHECK_THROWS( ... )  INTERNAL_CATCH_THROWS( "CHECK_THROWS", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
203 #define CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CHECK_THROWS_AS", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr )
204 #define CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
205 #if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
206 #define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CHECK_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
207 #endif // CATCH_CONFIG_DISABLE_MATCHERS
208 #define CHECK_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
209 
210 
211 #if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
212 #define CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CHECK_THAT", matcher, Catch::ResultDisposition::ContinueOnFailure, arg )
213 
214 #define REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg )
215 #endif // CATCH_CONFIG_DISABLE_MATCHERS
216 
217 #define INFO( msg ) INTERNAL_CATCH_INFO( "INFO", msg )
218 #define UNSCOPED_INFO( msg ) INTERNAL_CATCH_UNSCOPED_INFO( "UNSCOPED_INFO", msg )
219 #define WARN( msg ) INTERNAL_CATCH_MSG( "WARN", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg )
220 #define CAPTURE( ... ) INTERNAL_CATCH_CAPTURE( INTERNAL_CATCH_UNIQUE_NAME(capturer), "CAPTURE",__VA_ARGS__ )
221 
222 #define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )
223 #define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ )
224 #define METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
225 #define REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ )
226 #define SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
227 #define DYNAMIC_SECTION( ... ) INTERNAL_CATCH_DYNAMIC_SECTION( __VA_ARGS__ )
228 #define FAIL( ... ) INTERNAL_CATCH_MSG( "FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ )
229 #define FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
230 #define SUCCEED( ... ) INTERNAL_CATCH_MSG( "SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
231 #define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE()
232 
233 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
234 #define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )
235 #define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
236 #define TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ )
237 #define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ )
238 #else
239 #define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) )
240 #define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) )
241 #define TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ ) )
242 #define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ ) )
243 #endif
244 
245 
246 #if !defined(CATCH_CONFIG_RUNTIME_STATIC_REQUIRE)
247 #define STATIC_REQUIRE( ... )       static_assert(   __VA_ARGS__,  #__VA_ARGS__ ); SUCCEED( #__VA_ARGS__ )
248 #define STATIC_REQUIRE_FALSE( ... ) static_assert( !(__VA_ARGS__), "!(" #__VA_ARGS__ ")" ); SUCCEED( "!(" #__VA_ARGS__ ")" )
249 #else
250 #define STATIC_REQUIRE( ... )       REQUIRE( __VA_ARGS__ )
251 #define STATIC_REQUIRE_FALSE( ... ) REQUIRE_FALSE( __VA_ARGS__ )
252 #endif
253 
254 #endif
255 
256 #define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature )
257 
258 // "BDD-style" convenience wrappers
259 #define SCENARIO( ... ) TEST_CASE( "Scenario: " __VA_ARGS__ )
260 #define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " __VA_ARGS__ )
261 
262 #define GIVEN( desc )     INTERNAL_CATCH_DYNAMIC_SECTION( "    Given: " << desc )
263 #define AND_GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( "And given: " << desc )
264 #define WHEN( desc )      INTERNAL_CATCH_DYNAMIC_SECTION( "     When: " << desc )
265 #define AND_WHEN( desc )  INTERNAL_CATCH_DYNAMIC_SECTION( " And when: " << desc )
266 #define THEN( desc )      INTERNAL_CATCH_DYNAMIC_SECTION( "     Then: " << desc )
267 #define AND_THEN( desc )  INTERNAL_CATCH_DYNAMIC_SECTION( "      And: " << desc )
268 
269 using Catch::Detail::Approx;
270 
271 #else // CATCH_CONFIG_DISABLE
272 
273 //////
274 // If this config identifier is defined then all CATCH macros are prefixed with CATCH_
275 #ifdef CATCH_CONFIG_PREFIX_ALL
276 
277 #define CATCH_REQUIRE( ... )        (void)(0)
278 #define CATCH_REQUIRE_FALSE( ... )  (void)(0)
279 
280 #define CATCH_REQUIRE_THROWS( ... ) (void)(0)
281 #define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0)
282 #define CATCH_REQUIRE_THROWS_WITH( expr, matcher )     (void)(0)
283 #if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
284 #define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
285 #endif// CATCH_CONFIG_DISABLE_MATCHERS
286 #define CATCH_REQUIRE_NOTHROW( ... ) (void)(0)
287 
288 #define CATCH_CHECK( ... )         (void)(0)
289 #define CATCH_CHECK_FALSE( ... )   (void)(0)
290 #define CATCH_CHECKED_IF( ... )    if (__VA_ARGS__)
291 #define CATCH_CHECKED_ELSE( ... )  if (!(__VA_ARGS__))
292 #define CATCH_CHECK_NOFAIL( ... )  (void)(0)
293 
294 #define CATCH_CHECK_THROWS( ... )  (void)(0)
295 #define CATCH_CHECK_THROWS_AS( expr, exceptionType ) (void)(0)
296 #define CATCH_CHECK_THROWS_WITH( expr, matcher )     (void)(0)
297 #if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
298 #define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
299 #endif // CATCH_CONFIG_DISABLE_MATCHERS
300 #define CATCH_CHECK_NOTHROW( ... ) (void)(0)
301 
302 #if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
303 #define CATCH_CHECK_THAT( arg, matcher )   (void)(0)
304 
305 #define CATCH_REQUIRE_THAT( arg, matcher ) (void)(0)
306 #endif // CATCH_CONFIG_DISABLE_MATCHERS
307 
308 #define CATCH_INFO( msg )    (void)(0)
309 #define CATCH_WARN( msg )    (void)(0)
310 #define CATCH_CAPTURE( msg ) (void)(0)
311 
312 #define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
313 #define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
314 #define CATCH_METHOD_AS_TEST_CASE( method, ... )
315 #define CATCH_REGISTER_TEST_CASE( Function, ... ) (void)(0)
316 #define CATCH_SECTION( ... )
317 #define CATCH_DYNAMIC_SECTION( ... )
318 #define CATCH_FAIL( ... ) (void)(0)
319 #define CATCH_FAIL_CHECK( ... ) (void)(0)
320 #define CATCH_SUCCEED( ... ) (void)(0)
321 
322 #define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
323 
324 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
325 #define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) )
326 #define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), className )
327 #define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )
328 #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
329 #else
330 #define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) ) )
331 #define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), className ) )
332 #define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )
333 #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
334 #endif
335 
336 // "BDD-style" convenience wrappers
337 #define CATCH_SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
338 #define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), className )
339 #define CATCH_GIVEN( desc )
340 #define CATCH_AND_GIVEN( desc )
341 #define CATCH_WHEN( desc )
342 #define CATCH_AND_WHEN( desc )
343 #define CATCH_THEN( desc )
344 #define CATCH_AND_THEN( desc )
345 
346 #define CATCH_STATIC_REQUIRE( ... )       (void)(0)
347 #define CATCH_STATIC_REQUIRE_FALSE( ... ) (void)(0)
348 
349 // If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required
350 #else
351 
352 #define REQUIRE( ... )       (void)(0)
353 #define REQUIRE_FALSE( ... ) (void)(0)
354 
355 #define REQUIRE_THROWS( ... ) (void)(0)
356 #define REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0)
357 #define REQUIRE_THROWS_WITH( expr, matcher ) (void)(0)
358 #if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
359 #define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
360 #endif // CATCH_CONFIG_DISABLE_MATCHERS
361 #define REQUIRE_NOTHROW( ... ) (void)(0)
362 
363 #define CHECK( ... ) (void)(0)
364 #define CHECK_FALSE( ... ) (void)(0)
365 #define CHECKED_IF( ... ) if (__VA_ARGS__)
366 #define CHECKED_ELSE( ... ) if (!(__VA_ARGS__))
367 #define CHECK_NOFAIL( ... ) (void)(0)
368 
369 #define CHECK_THROWS( ... )  (void)(0)
370 #define CHECK_THROWS_AS( expr, exceptionType ) (void)(0)
371 #define CHECK_THROWS_WITH( expr, matcher ) (void)(0)
372 #if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
373 #define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
374 #endif // CATCH_CONFIG_DISABLE_MATCHERS
375 #define CHECK_NOTHROW( ... ) (void)(0)
376 
377 
378 #if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
379 #define CHECK_THAT( arg, matcher ) (void)(0)
380 
381 #define REQUIRE_THAT( arg, matcher ) (void)(0)
382 #endif // CATCH_CONFIG_DISABLE_MATCHERS
383 
384 #define INFO( msg ) (void)(0)
385 #define WARN( msg ) (void)(0)
386 #define CAPTURE( msg ) (void)(0)
387 
388 #define TEST_CASE( ... )  INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
389 #define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
390 #define METHOD_AS_TEST_CASE( method, ... )
391 #define REGISTER_TEST_CASE( Function, ... ) (void)(0)
392 #define SECTION( ... )
393 #define DYNAMIC_SECTION( ... )
394 #define FAIL( ... ) (void)(0)
395 #define FAIL_CHECK( ... ) (void)(0)
396 #define SUCCEED( ... ) (void)(0)
397 #define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
398 
399 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
400 #define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) )
401 #define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), className )
402 #define TEMPLATE_PRODUCT_TEST_CASE( ... ) TEMPLATE_TEST_CASE( __VA_ARGS__ )
403 #define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
404 #else
405 #define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) ) )
406 #define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), className ) )
407 #define TEMPLATE_PRODUCT_TEST_CASE( ... ) TEMPLATE_TEST_CASE( __VA_ARGS__ )
408 #define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
409 #endif
410 
411 #define STATIC_REQUIRE( ... )       (void)(0)
412 #define STATIC_REQUIRE_FALSE( ... ) (void)(0)
413 
414 #endif
415 
416 #define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature )
417 
418 // "BDD-style" convenience wrappers
419 #define SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ) )
420 #define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), className )
421 
422 #define GIVEN( desc )
423 #define AND_GIVEN( desc )
424 #define WHEN( desc )
425 #define AND_WHEN( desc )
426 #define THEN( desc )
427 #define AND_THEN( desc )
428 
429 using Catch::Detail::Approx;
430 
431 
432 #endif
433 
434 #endif // ! CATCH_CONFIG_IMPL_ONLY
435 
436 #include "internal/catch_reenable_warnings.h"
437 
438 #endif // TWOBLUECUBES_CATCH_HPP_INCLUDED
439