File Coverage

/usr/local/lib/perl5/site_perl/5.26.1/XS/libcatch.x/i/catch2/catch.hpp
Criterion Covered Total %
statement 35 47 74.4
branch 9 18 50.0
condition n/a
subroutine n/a
pod n/a
total 44 65 67.6


line stmt bran cond sub pod time code
1             /*
2             * Catch v2.13.4
3             * Generated: 2020-12-29 14:48:00.116107
4             * ----------------------------------------------------------
5             * This file has been merged from multiple headers. Please don't edit it directly
6             * Copyright (c) 2020 Two Blue Cubes Ltd. All rights reserved.
7             *
8             * Distributed under the Boost Software License, Version 1.0. (See accompanying
9             * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
10             */
11             #ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED
12             #define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED
13             // start catch.hpp
14              
15              
16             #define CATCH_VERSION_MAJOR 2
17             #define CATCH_VERSION_MINOR 13
18             #define CATCH_VERSION_PATCH 4
19              
20             #ifdef __clang__
21             # pragma clang system_header
22             #elif defined __GNUC__
23             # pragma GCC system_header
24             #endif
25              
26             // start catch_suppress_warnings.h
27              
28             #ifdef __clang__
29             # ifdef __ICC // icpc defines the __clang__ macro
30             # pragma warning(push)
31             # pragma warning(disable: 161 1682)
32             # else // __ICC
33             # pragma clang diagnostic push
34             # pragma clang diagnostic ignored "-Wpadded"
35             # pragma clang diagnostic ignored "-Wswitch-enum"
36             # pragma clang diagnostic ignored "-Wcovered-switch-default"
37             # endif
38             #elif defined __GNUC__
39             // Because REQUIREs trigger GCC's -Wparentheses, and because still
40             // supported version of g++ have only buggy support for _Pragmas,
41             // Wparentheses have to be suppressed globally.
42             # pragma GCC diagnostic ignored "-Wparentheses" // See #674 for details
43              
44             # pragma GCC diagnostic push
45             # pragma GCC diagnostic ignored "-Wunused-variable"
46             # pragma GCC diagnostic ignored "-Wpadded"
47             #endif
48             // end catch_suppress_warnings.h
49             #if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER)
50             # define CATCH_IMPL
51             # define CATCH_CONFIG_ALL_PARTS
52             #endif
53              
54             // In the impl file, we want to have access to all parts of the headers
55             // Can also be used to sanely support PCHs
56             #if defined(CATCH_CONFIG_ALL_PARTS)
57             # define CATCH_CONFIG_EXTERNAL_INTERFACES
58             # if defined(CATCH_CONFIG_DISABLE_MATCHERS)
59             # undef CATCH_CONFIG_DISABLE_MATCHERS
60             # endif
61             # if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER)
62             # define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
63             # endif
64             #endif
65              
66             #if !defined(CATCH_CONFIG_IMPL_ONLY)
67             // start catch_platform.h
68              
69             #ifdef __APPLE__
70             # include
71             # if TARGET_OS_OSX == 1
72             # define CATCH_PLATFORM_MAC
73             # elif TARGET_OS_IPHONE == 1
74             # define CATCH_PLATFORM_IPHONE
75             # endif
76              
77             #elif defined(linux) || defined(__linux) || defined(__linux__)
78             # define CATCH_PLATFORM_LINUX
79              
80             #elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) || defined(__MINGW32__)
81             # define CATCH_PLATFORM_WINDOWS
82             #endif
83              
84             // end catch_platform.h
85              
86             #ifdef CATCH_IMPL
87             # ifndef CLARA_CONFIG_MAIN
88             # define CLARA_CONFIG_MAIN_NOT_DEFINED
89             # define CLARA_CONFIG_MAIN
90             # endif
91             #endif
92              
93             // start catch_user_interfaces.h
94              
95             namespace Catch {
96             unsigned int rngSeed();
97             }
98              
99             // end catch_user_interfaces.h
100             // start catch_tag_alias_autoregistrar.h
101              
102             // start catch_common.h
103              
104             // start catch_compiler_capabilities.h
105              
106             // Detect a number of compiler features - by compiler
107             // The following features are defined:
108             //
109             // CATCH_CONFIG_COUNTER : is the __COUNTER__ macro supported?
110             // CATCH_CONFIG_WINDOWS_SEH : is Windows SEH supported?
111             // CATCH_CONFIG_POSIX_SIGNALS : are POSIX signals supported?
112             // CATCH_CONFIG_DISABLE_EXCEPTIONS : Are exceptions enabled?
113             // ****************
114             // Note to maintainers: if new toggles are added please document them
115             // in configuration.md, too
116             // ****************
117              
118             // In general each macro has a _NO_ form
119             // (e.g. CATCH_CONFIG_NO_POSIX_SIGNALS) which disables the feature.
120             // Many features, at point of detection, define an _INTERNAL_ macro, so they
121             // can be combined, en-mass, with the _NO_ forms later.
122              
123             #ifdef __cplusplus
124              
125             # if (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L)
126             # define CATCH_CPP14_OR_GREATER
127             # endif
128              
129             # if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
130             # define CATCH_CPP17_OR_GREATER
131             # endif
132              
133             #endif
134              
135             // We have to avoid both ICC and Clang, because they try to mask themselves
136             // as gcc, and we want only GCC in this block
137             #if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && !defined(__CUDACC__)
138             # define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic push" )
139             # define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic pop" )
140              
141             # define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__)
142              
143             #endif
144              
145             #if defined(__clang__)
146              
147             # define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic push" )
148             # define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic pop" )
149              
150             // As of this writing, IBM XL's implementation of __builtin_constant_p has a bug
151             // which results in calls to destructors being emitted for each temporary,
152             // without a matching initialization. In practice, this can result in something
153             // like `std::string::~string` being called on an uninitialized value.
154             //
155             // For example, this code will likely segfault under IBM XL:
156             // ```
157             // REQUIRE(std::string("12") + "34" == "1234")
158             // ```
159             //
160             // Therefore, `CATCH_INTERNAL_IGNORE_BUT_WARN` is not implemented.
161             # if !defined(__ibmxl__) && !defined(__CUDACC__)
162             # define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) /* NOLINT(cppcoreguidelines-pro-type-vararg, hicpp-vararg) */
163             # endif
164              
165             # define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
166             _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) \
167             _Pragma( "clang diagnostic ignored \"-Wglobal-constructors\"")
168              
169             # define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \
170             _Pragma( "clang diagnostic ignored \"-Wparentheses\"" )
171              
172             # define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \
173             _Pragma( "clang diagnostic ignored \"-Wunused-variable\"" )
174              
175             # define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \
176             _Pragma( "clang diagnostic ignored \"-Wgnu-zero-variadic-macro-arguments\"" )
177              
178             # define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \
179             _Pragma( "clang diagnostic ignored \"-Wunused-template\"" )
180              
181             #endif // __clang__
182              
183             ////////////////////////////////////////////////////////////////////////////////
184             // Assume that non-Windows platforms support posix signals by default
185             #if !defined(CATCH_PLATFORM_WINDOWS)
186             #define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS
187             #endif
188              
189             ////////////////////////////////////////////////////////////////////////////////
190             // We know some environments not to support full POSIX signals
191             #if defined(__CYGWIN__) || defined(__QNX__) || defined(__EMSCRIPTEN__) || defined(__DJGPP__)
192             #define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS
193             #endif
194              
195             #ifdef __OS400__
196             # define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS
197             # define CATCH_CONFIG_COLOUR_NONE
198             #endif
199              
200             ////////////////////////////////////////////////////////////////////////////////
201             // Android somehow still does not support std::to_string
202             #if defined(__ANDROID__)
203             # define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING
204             # define CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE
205             #endif
206              
207             ////////////////////////////////////////////////////////////////////////////////
208             // Not all Windows environments support SEH properly
209             #if defined(__MINGW32__)
210             # define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH
211             #endif
212              
213             ////////////////////////////////////////////////////////////////////////////////
214             // PS4
215             #if defined(__ORBIS__)
216             # define CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE
217             #endif
218              
219             ////////////////////////////////////////////////////////////////////////////////
220             // Cygwin
221             #ifdef __CYGWIN__
222              
223             // Required for some versions of Cygwin to declare gettimeofday
224             // see: http://stackoverflow.com/questions/36901803/gettimeofday-not-declared-in-this-scope-cygwin
225             # define _BSD_SOURCE
226             // some versions of cygwin (most) do not support std::to_string. Use the libstd check.
227             // https://gcc.gnu.org/onlinedocs/gcc-4.8.2/libstdc++/api/a01053_source.html line 2812-2813
228             # if !((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \
229             && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF))
230              
231             # define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING
232              
233             # endif
234             #endif // __CYGWIN__
235              
236             ////////////////////////////////////////////////////////////////////////////////
237             // Visual C++
238             #if defined(_MSC_VER)
239              
240             # define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma( warning(push) )
241             # define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION __pragma( warning(pop) )
242              
243             // Universal Windows platform does not support SEH
244             // Or console colours (or console at all...)
245             # if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
246             # define CATCH_CONFIG_COLOUR_NONE
247             # else
248             # define CATCH_INTERNAL_CONFIG_WINDOWS_SEH
249             # endif
250              
251             // MSVC traditional preprocessor needs some workaround for __VA_ARGS__
252             // _MSVC_TRADITIONAL == 0 means new conformant preprocessor
253             // _MSVC_TRADITIONAL == 1 means old traditional non-conformant preprocessor
254             # if !defined(__clang__) // Handle Clang masquerading for msvc
255             # if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL)
256             # define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
257             # endif // MSVC_TRADITIONAL
258             # endif // __clang__
259              
260             #endif // _MSC_VER
261              
262             #if defined(_REENTRANT) || defined(_MSC_VER)
263             // Enable async processing, as -pthread is specified or no additional linking is required
264             # define CATCH_INTERNAL_CONFIG_USE_ASYNC
265             #endif // _MSC_VER
266              
267             ////////////////////////////////////////////////////////////////////////////////
268             // Check if we are compiled with -fno-exceptions or equivalent
269             #if defined(__EXCEPTIONS) || defined(__cpp_exceptions) || defined(_CPPUNWIND)
270             # define CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED
271             #endif
272              
273             ////////////////////////////////////////////////////////////////////////////////
274             // DJGPP
275             #ifdef __DJGPP__
276             # define CATCH_INTERNAL_CONFIG_NO_WCHAR
277             #endif // __DJGPP__
278              
279             ////////////////////////////////////////////////////////////////////////////////
280             // Embarcadero C++Build
281             #if defined(__BORLANDC__)
282             #define CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN
283             #endif
284              
285             ////////////////////////////////////////////////////////////////////////////////
286              
287             // Use of __COUNTER__ is suppressed during code analysis in
288             // CLion/AppCode 2017.2.x and former, because __COUNTER__ is not properly
289             // handled by it.
290             // Otherwise all supported compilers support COUNTER macro,
291             // but user still might want to turn it off
292             #if ( !defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L )
293             #define CATCH_INTERNAL_CONFIG_COUNTER
294             #endif
295              
296             ////////////////////////////////////////////////////////////////////////////////
297              
298             // RTX is a special version of Windows that is real time.
299             // This means that it is detected as Windows, but does not provide
300             // the same set of capabilities as real Windows does.
301             #if defined(UNDER_RTSS) || defined(RTX64_BUILD)
302             #define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH
303             #define CATCH_INTERNAL_CONFIG_NO_ASYNC
304             #define CATCH_CONFIG_COLOUR_NONE
305             #endif
306              
307             #if !defined(_GLIBCXX_USE_C99_MATH_TR1)
308             #define CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER
309             #endif
310              
311             // Various stdlib support checks that require __has_include
312             #if defined(__has_include)
313             // Check if string_view is available and usable
314             #if __has_include() && defined(CATCH_CPP17_OR_GREATER)
315             # define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW
316             #endif
317              
318             // Check if optional is available and usable
319             # if __has_include() && defined(CATCH_CPP17_OR_GREATER)
320             # define CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL
321             # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER)
322              
323             // Check if byte is available and usable
324             # if __has_include() && defined(CATCH_CPP17_OR_GREATER)
325             # include
326             # if __cpp_lib_byte > 0
327             # define CATCH_INTERNAL_CONFIG_CPP17_BYTE
328             # endif
329             # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER)
330              
331             // Check if variant is available and usable
332             # if __has_include() && defined(CATCH_CPP17_OR_GREATER)
333             # if defined(__clang__) && (__clang_major__ < 8)
334             // work around clang bug with libstdc++ https://bugs.llvm.org/show_bug.cgi?id=31852
335             // fix should be in clang 8, workaround in libstdc++ 8.2
336             # include
337             # if defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9)
338             # define CATCH_CONFIG_NO_CPP17_VARIANT
339             # else
340             # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT
341             # endif // defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9)
342             # else
343             # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT
344             # endif // defined(__clang__) && (__clang_major__ < 8)
345             # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER)
346             #endif // defined(__has_include)
347              
348             #if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER)
349             # define CATCH_CONFIG_COUNTER
350             #endif
351             #if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH) && !defined(CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH)
352             # define CATCH_CONFIG_WINDOWS_SEH
353             #endif
354             // This is set by default, because we assume that unix compilers are posix-signal-compatible by default.
355             #if defined(CATCH_INTERNAL_CONFIG_POSIX_SIGNALS) && !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS)
356             # define CATCH_CONFIG_POSIX_SIGNALS
357             #endif
358             // This is set by default, because we assume that compilers with no wchar_t support are just rare exceptions.
359             #if !defined(CATCH_INTERNAL_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_WCHAR)
360             # define CATCH_CONFIG_WCHAR
361             #endif
362              
363             #if !defined(CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_CPP11_TO_STRING)
364             # define CATCH_CONFIG_CPP11_TO_STRING
365             #endif
366              
367             #if defined(CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_NO_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_CPP17_OPTIONAL)
368             # define CATCH_CONFIG_CPP17_OPTIONAL
369             #endif
370              
371             #if defined(CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_NO_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_CPP17_STRING_VIEW)
372             # define CATCH_CONFIG_CPP17_STRING_VIEW
373             #endif
374              
375             #if defined(CATCH_INTERNAL_CONFIG_CPP17_VARIANT) && !defined(CATCH_CONFIG_NO_CPP17_VARIANT) && !defined(CATCH_CONFIG_CPP17_VARIANT)
376             # define CATCH_CONFIG_CPP17_VARIANT
377             #endif
378              
379             #if defined(CATCH_INTERNAL_CONFIG_CPP17_BYTE) && !defined(CATCH_CONFIG_NO_CPP17_BYTE) && !defined(CATCH_CONFIG_CPP17_BYTE)
380             # define CATCH_CONFIG_CPP17_BYTE
381             #endif
382              
383             #if defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT)
384             # define CATCH_INTERNAL_CONFIG_NEW_CAPTURE
385             #endif
386              
387             #if defined(CATCH_INTERNAL_CONFIG_NEW_CAPTURE) && !defined(CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NEW_CAPTURE)
388             # define CATCH_CONFIG_NEW_CAPTURE
389             #endif
390              
391             #if !defined(CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
392             # define CATCH_CONFIG_DISABLE_EXCEPTIONS
393             #endif
394              
395             #if defined(CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_NO_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_POLYFILL_ISNAN)
396             # define CATCH_CONFIG_POLYFILL_ISNAN
397             #endif
398              
399             #if defined(CATCH_INTERNAL_CONFIG_USE_ASYNC) && !defined(CATCH_INTERNAL_CONFIG_NO_ASYNC) && !defined(CATCH_CONFIG_NO_USE_ASYNC) && !defined(CATCH_CONFIG_USE_ASYNC)
400             # define CATCH_CONFIG_USE_ASYNC
401             #endif
402              
403             #if defined(CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE) && !defined(CATCH_CONFIG_NO_ANDROID_LOGWRITE) && !defined(CATCH_CONFIG_ANDROID_LOGWRITE)
404             # define CATCH_CONFIG_ANDROID_LOGWRITE
405             #endif
406              
407             #if defined(CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_NO_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_GLOBAL_NEXTAFTER)
408             # define CATCH_CONFIG_GLOBAL_NEXTAFTER
409             #endif
410              
411             // Even if we do not think the compiler has that warning, we still have
412             // to provide a macro that can be used by the code.
413             #if !defined(CATCH_INTERNAL_START_WARNINGS_SUPPRESSION)
414             # define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION
415             #endif
416             #if !defined(CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION)
417             # define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
418             #endif
419             #if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS)
420             # define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS
421             #endif
422             #if !defined(CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS)
423             # define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
424             #endif
425             #if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS)
426             # define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS
427             #endif
428             #if !defined(CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS)
429             # define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS
430             #endif
431              
432             // The goal of this macro is to avoid evaluation of the arguments, but
433             // still have the compiler warn on problems inside...
434             #if !defined(CATCH_INTERNAL_IGNORE_BUT_WARN)
435             # define CATCH_INTERNAL_IGNORE_BUT_WARN(...)
436             #endif
437              
438             #if defined(__APPLE__) && defined(__apple_build_version__) && (__clang_major__ < 10)
439             # undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS
440             #elif defined(__clang__) && (__clang_major__ < 5)
441             # undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS
442             #endif
443              
444             #if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS)
445             # define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS
446             #endif
447              
448             #if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
449             #define CATCH_TRY if ((true))
450             #define CATCH_CATCH_ALL if ((false))
451             #define CATCH_CATCH_ANON(type) if ((false))
452             #else
453             #define CATCH_TRY try
454             #define CATCH_CATCH_ALL catch (...)
455             #define CATCH_CATCH_ANON(type) catch (type)
456             #endif
457              
458             #if defined(CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_NO_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR)
459             #define CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
460             #endif
461              
462             // end catch_compiler_capabilities.h
463             #define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line
464             #define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line )
465             #ifdef CATCH_CONFIG_COUNTER
466             # define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ )
467             #else
468             # define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ )
469             #endif
470              
471             #include
472             #include
473             #include
474              
475             // We need a dummy global operator<< so we can bring it into Catch namespace later
476             struct Catch_global_namespace_dummy {};
477             std::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy);
478              
479             namespace Catch {
480              
481             struct CaseSensitive { enum Choice {
482             Yes,
483             No
484             }; };
485              
486             class NonCopyable {
487             NonCopyable( NonCopyable const& ) = delete;
488             NonCopyable( NonCopyable && ) = delete;
489             NonCopyable& operator = ( NonCopyable const& ) = delete;
490             NonCopyable& operator = ( NonCopyable && ) = delete;
491              
492             protected:
493             NonCopyable();
494             virtual ~NonCopyable();
495             };
496              
497             struct SourceLineInfo {
498              
499             SourceLineInfo() = delete;
500 0           SourceLineInfo( char const* _file, std::size_t _line ) noexcept
501             : file( _file ),
502 0           line( _line )
503 0           {}
504              
505             SourceLineInfo( SourceLineInfo const& other ) = default;
506             SourceLineInfo& operator = ( SourceLineInfo const& ) = default;
507             SourceLineInfo( SourceLineInfo&& ) noexcept = default;
508             SourceLineInfo& operator = ( SourceLineInfo&& ) noexcept = default;
509              
510             bool empty() const noexcept { return file[0] == '\0'; }
511             bool operator == ( SourceLineInfo const& other ) const noexcept;
512             bool operator < ( SourceLineInfo const& other ) const noexcept;
513              
514             char const* file;
515             std::size_t line;
516             };
517              
518             std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info );
519              
520             // Bring in operator<< from global namespace into Catch namespace
521             // This is necessary because the overload of operator<< above makes
522             // lookup stop at namespace Catch
523             using ::operator<<;
524              
525             // Use this in variadic streaming macros to allow
526             // >> +StreamEndStop
527             // as well as
528             // >> stuff +StreamEndStop
529             struct StreamEndStop {
530             std::string operator+() const;
531             };
532             template
533             T const& operator + ( T const& value, StreamEndStop ) {
534             return value;
535             }
536             }
537              
538             #define CATCH_INTERNAL_LINEINFO \
539             ::Catch::SourceLineInfo( __FILE__, static_cast( __LINE__ ) )
540              
541             // end catch_common.h
542             namespace Catch {
543              
544             struct RegistrarForTagAliases {
545             RegistrarForTagAliases( char const* alias, char const* tag, SourceLineInfo const& lineInfo );
546             };
547              
548             } // end namespace Catch
549              
550             #define CATCH_REGISTER_TAG_ALIAS( alias, spec ) \
551             CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \
552             CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
553             namespace{ Catch::RegistrarForTagAliases INTERNAL_CATCH_UNIQUE_NAME( AutoRegisterTagAlias )( alias, spec, CATCH_INTERNAL_LINEINFO ); } \
554             CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
555              
556             // end catch_tag_alias_autoregistrar.h
557             // start catch_test_registry.h
558              
559             // start catch_interfaces_testcase.h
560              
561             #include
562              
563             namespace Catch {
564              
565             class TestSpec;
566              
567             struct ITestInvoker {
568             virtual void invoke () const = 0;
569             virtual ~ITestInvoker();
570             };
571              
572             class TestCase;
573             struct IConfig;
574              
575             struct ITestCaseRegistry {
576             virtual ~ITestCaseRegistry();
577             virtual std::vector const& getAllTests() const = 0;
578             virtual std::vector const& getAllTestsSorted( IConfig const& config ) const = 0;
579             };
580              
581             bool isThrowSafe( TestCase const& testCase, IConfig const& config );
582             bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config );
583             std::vector filterTests( std::vector const& testCases, TestSpec const& testSpec, IConfig const& config );
584             std::vector const& getAllTestCasesSorted( IConfig const& config );
585              
586             }
587              
588             // end catch_interfaces_testcase.h
589             // start catch_stringref.h
590              
591             #include
592             #include
593             #include
594             #include
595              
596             namespace Catch {
597              
598             /// A non-owning string class (similar to the forthcoming std::string_view)
599             /// Note that, because a StringRef may be a substring of another string,
600             /// it may not be null terminated.
601             class StringRef {
602             public:
603             using size_type = std::size_t;
604             using const_iterator = const char*;
605              
606             private:
607             static constexpr char const* const s_empty = "";
608              
609             char const* m_start = s_empty;
610             size_type m_size = 0;
611              
612             public: // construction
613 0           constexpr StringRef() noexcept = default;
614              
615             StringRef( char const* rawChars ) noexcept;
616              
617 0           constexpr StringRef( char const* rawChars, size_type size ) noexcept
618             : m_start( rawChars ),
619 0           m_size( size )
620 0           {}
621              
622             StringRef( std::string const& stdString ) noexcept
623             : m_start( stdString.c_str() ),
624             m_size( stdString.size() )
625             {}
626              
627             explicit operator std::string() const {
628             return std::string(m_start, m_size);
629             }
630              
631             public: // operators
632             auto operator == ( StringRef const& other ) const noexcept -> bool;
633             auto operator != (StringRef const& other) const noexcept -> bool {
634             return !(*this == other);
635             }
636              
637             auto operator[] ( size_type index ) const noexcept -> char {
638             assert(index < m_size);
639             return m_start[index];
640             }
641              
642             public: // named queries
643             constexpr auto empty() const noexcept -> bool {
644             return m_size == 0;
645             }
646             constexpr auto size() const noexcept -> size_type {
647             return m_size;
648             }
649              
650             // Returns the current start pointer. If the StringRef is not
651             // null-terminated, throws std::domain_exception
652             auto c_str() const -> char const*;
653              
654             public: // substrings and searches
655             // Returns a substring of [start, start + length).
656             // If start + length > size(), then the substring is [start, size()).
657             // If start > size(), then the substring is empty.
658             auto substr( size_type start, size_type length ) const noexcept -> StringRef;
659              
660             // Returns the current start pointer. May not be null-terminated.
661             auto data() const noexcept -> char const*;
662              
663             constexpr auto isNullTerminated() const noexcept -> bool {
664             return m_start[m_size] == '\0';
665             }
666              
667             public: // iterators
668             constexpr const_iterator begin() const { return m_start; }
669             constexpr const_iterator end() const { return m_start + m_size; }
670             };
671              
672             auto operator += ( std::string& lhs, StringRef const& sr ) -> std::string&;
673             auto operator << ( std::ostream& os, StringRef const& sr ) -> std::ostream&;
674              
675             constexpr auto operator "" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef {
676             return StringRef( rawChars, size );
677             }
678             } // namespace Catch
679              
680 50           constexpr auto operator "" _catch_sr( char const* rawChars, std::size_t size ) noexcept -> Catch::StringRef {
681 50           return Catch::StringRef( rawChars, size );
682             }
683              
684             // end catch_stringref.h
685             // start catch_preprocessor.hpp
686              
687              
688             #define CATCH_RECURSION_LEVEL0(...) __VA_ARGS__
689             #define CATCH_RECURSION_LEVEL1(...) CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(__VA_ARGS__)))
690             #define CATCH_RECURSION_LEVEL2(...) CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(__VA_ARGS__)))
691             #define CATCH_RECURSION_LEVEL3(...) CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(__VA_ARGS__)))
692             #define CATCH_RECURSION_LEVEL4(...) CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(__VA_ARGS__)))
693             #define CATCH_RECURSION_LEVEL5(...) CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(__VA_ARGS__)))
694              
695             #ifdef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
696             #define INTERNAL_CATCH_EXPAND_VARGS(...) __VA_ARGS__
697             // MSVC needs more evaluations
698             #define CATCH_RECURSION_LEVEL6(...) CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(__VA_ARGS__)))
699             #define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL6(CATCH_RECURSION_LEVEL6(__VA_ARGS__))
700             #else
701             #define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL5(__VA_ARGS__)
702             #endif
703              
704             #define CATCH_REC_END(...)
705             #define CATCH_REC_OUT
706              
707             #define CATCH_EMPTY()
708             #define CATCH_DEFER(id) id CATCH_EMPTY()
709              
710             #define CATCH_REC_GET_END2() 0, CATCH_REC_END
711             #define CATCH_REC_GET_END1(...) CATCH_REC_GET_END2
712             #define CATCH_REC_GET_END(...) CATCH_REC_GET_END1
713             #define CATCH_REC_NEXT0(test, next, ...) next CATCH_REC_OUT
714             #define CATCH_REC_NEXT1(test, next) CATCH_DEFER ( CATCH_REC_NEXT0 ) ( test, next, 0)
715             #define CATCH_REC_NEXT(test, next) CATCH_REC_NEXT1(CATCH_REC_GET_END test, next)
716              
717             #define CATCH_REC_LIST0(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ )
718             #define CATCH_REC_LIST1(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0) ) ( f, peek, __VA_ARGS__ )
719             #define CATCH_REC_LIST2(f, x, peek, ...) f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ )
720              
721             #define CATCH_REC_LIST0_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ )
722             #define CATCH_REC_LIST1_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0_UD) ) ( f, userdata, peek, __VA_ARGS__ )
723             #define CATCH_REC_LIST2_UD(f, userdata, x, peek, ...) f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ )
724              
725             // Applies the function macro `f` to each of the remaining parameters, inserts commas between the results,
726             // and passes userdata as the first parameter to each invocation,
727             // e.g. CATCH_REC_LIST_UD(f, x, a, b, c) evaluates to f(x, a), f(x, b), f(x, c)
728             #define CATCH_REC_LIST_UD(f, userdata, ...) CATCH_RECURSE(CATCH_REC_LIST2_UD(f, userdata, __VA_ARGS__, ()()(), ()()(), ()()(), 0))
729              
730             #define CATCH_REC_LIST(f, ...) CATCH_RECURSE(CATCH_REC_LIST2(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0))
731              
732             #define INTERNAL_CATCH_EXPAND1(param) INTERNAL_CATCH_EXPAND2(param)
733             #define INTERNAL_CATCH_EXPAND2(...) INTERNAL_CATCH_NO## __VA_ARGS__
734             #define INTERNAL_CATCH_DEF(...) INTERNAL_CATCH_DEF __VA_ARGS__
735             #define INTERNAL_CATCH_NOINTERNAL_CATCH_DEF
736             #define INTERNAL_CATCH_STRINGIZE(...) INTERNAL_CATCH_STRINGIZE2(__VA_ARGS__)
737             #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
738             #define INTERNAL_CATCH_STRINGIZE2(...) #__VA_ARGS__
739             #define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param))
740             #else
741             // MSVC is adding extra space and needs another indirection to expand INTERNAL_CATCH_NOINTERNAL_CATCH_DEF
742             #define INTERNAL_CATCH_STRINGIZE2(...) INTERNAL_CATCH_STRINGIZE3(__VA_ARGS__)
743             #define INTERNAL_CATCH_STRINGIZE3(...) #__VA_ARGS__
744             #define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) (INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) + 1)
745             #endif
746              
747             #define INTERNAL_CATCH_MAKE_NAMESPACE2(...) ns_##__VA_ARGS__
748             #define INTERNAL_CATCH_MAKE_NAMESPACE(name) INTERNAL_CATCH_MAKE_NAMESPACE2(name)
749              
750             #define INTERNAL_CATCH_REMOVE_PARENS(...) INTERNAL_CATCH_EXPAND1(INTERNAL_CATCH_DEF __VA_ARGS__)
751              
752             #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
753             #define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) decltype(get_wrapper())
754             #define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__))
755             #else
756             #define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) INTERNAL_CATCH_EXPAND_VARGS(decltype(get_wrapper()))
757             #define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__)))
758             #endif
759              
760             #define INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(...)\
761             CATCH_REC_LIST(INTERNAL_CATCH_MAKE_TYPE_LIST,__VA_ARGS__)
762              
763             #define INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_0) INTERNAL_CATCH_REMOVE_PARENS(_0)
764             #define INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_0, _1) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_1)
765             #define INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_0, _1, _2) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_1, _2)
766             #define INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_0, _1, _2, _3) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_1, _2, _3)
767             #define INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_0, _1, _2, _3, _4) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_1, _2, _3, _4)
768             #define INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_0, _1, _2, _3, _4, _5) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_1, _2, _3, _4, _5)
769             #define INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_0, _1, _2, _3, _4, _5, _6) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_1, _2, _3, _4, _5, _6)
770             #define INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_0, _1, _2, _3, _4, _5, _6, _7) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_1, _2, _3, _4, _5, _6, _7)
771             #define INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_1, _2, _3, _4, _5, _6, _7, _8)
772             #define INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9)
773             #define INTERNAL_CATCH_REMOVE_PARENS_11_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10)
774              
775             #define INTERNAL_CATCH_VA_NARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N
776              
777             #define INTERNAL_CATCH_TYPE_GEN\
778             template struct TypeList {};\
779             template\
780             constexpr auto get_wrapper() noexcept -> TypeList { return {}; }\
781             template class...> struct TemplateTypeList{};\
782             template class...Cs>\
783             constexpr auto get_wrapper() noexcept -> TemplateTypeList { return {}; }\
784             template\
785             struct append;\
786             template\
787             struct rewrap;\
788             template class, typename...>\
789             struct create;\
790             template class, typename>\
791             struct convert;\
792             \
793             template \
794             struct append { using type = T; };\
795             template< template class L1, typename...E1, template class L2, typename...E2, typename...Rest>\
796             struct append, L2, Rest...> { using type = typename append, Rest...>::type; };\
797             template< template class L1, typename...E1, typename...Rest>\
798             struct append, TypeList, Rest...> { using type = L1; };\
799             \
800             template< template class Container, template class List, typename...elems>\
801             struct rewrap, List> { using type = TypeList>; };\
802             template< template class Container, template class List, class...Elems, typename...Elements>\
803             struct rewrap, List, Elements...> { using type = typename append>, typename rewrap, Elements...>::type>::type; };\
804             \
805             template