fml  0.1-0
Fused Matrix Library
catch.hpp
1 /*
2  * Catch v2.9.2
3  * Generated: 2019-08-08 13:35:12.279703
4  * ----------------------------------------------------------
5  * This file has been merged from multiple headers. Please don't edit it directly
6  * Copyright (c) 2019 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 9
18 #define CATCH_VERSION_PATCH 2
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 <TargetConditionals.h>
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_<feature name> 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 #if defined(CATCH_CPP17_OR_GREATER)
136 # define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
137 #endif
138 
139 #ifdef __clang__
140 
141 # define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
142  _Pragma( "clang diagnostic push" ) \
143  _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) \
144  _Pragma( "clang diagnostic ignored \"-Wglobal-constructors\"")
145 # define CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
146  _Pragma( "clang diagnostic pop" )
147 
148 # define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \
149  _Pragma( "clang diagnostic push" ) \
150  _Pragma( "clang diagnostic ignored \"-Wparentheses\"" )
151 # define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \
152  _Pragma( "clang diagnostic pop" )
153 
154 # define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \
155  _Pragma( "clang diagnostic push" ) \
156  _Pragma( "clang diagnostic ignored \"-Wunused-variable\"" )
157 # define CATCH_INTERNAL_UNSUPPRESS_UNUSED_WARNINGS \
158  _Pragma( "clang diagnostic pop" )
159 
160 # define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \
161  _Pragma( "clang diagnostic push" ) \
162  _Pragma( "clang diagnostic ignored \"-Wgnu-zero-variadic-macro-arguments\"" )
163 # define CATCH_INTERNAL_UNSUPPRESS_ZERO_VARIADIC_WARNINGS \
164  _Pragma( "clang diagnostic pop" )
165 
166 #endif // __clang__
167 
169 // Assume that non-Windows platforms support posix signals by default
170 #if !defined(CATCH_PLATFORM_WINDOWS)
171  #define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS
172 #endif
173 
175 // We know some environments not to support full POSIX signals
176 #if defined(__CYGWIN__) || defined(__QNX__) || defined(__EMSCRIPTEN__) || defined(__DJGPP__)
177  #define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS
178 #endif
179 
180 #ifdef __OS400__
181 # define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS
182 # define CATCH_CONFIG_COLOUR_NONE
183 #endif
184 
186 // Android somehow still does not support std::to_string
187 #if defined(__ANDROID__)
188 # define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING
189 #endif
190 
192 // Not all Windows environments support SEH properly
193 #if defined(__MINGW32__)
194 # define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH
195 #endif
196 
198 // PS4
199 #if defined(__ORBIS__)
200 # define CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE
201 #endif
202 
204 // Cygwin
205 #ifdef __CYGWIN__
206 
207 // Required for some versions of Cygwin to declare gettimeofday
208 // see: http://stackoverflow.com/questions/36901803/gettimeofday-not-declared-in-this-scope-cygwin
209 # define _BSD_SOURCE
210 // some versions of cygwin (most) do not support std::to_string. Use the libstd check.
211 // https://gcc.gnu.org/onlinedocs/gcc-4.8.2/libstdc++/api/a01053_source.html line 2812-2813
212 # if !((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \
213  && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF))
214 
215 # define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING
216 
217 # endif
218 #endif // __CYGWIN__
219 
221 // Visual C++
222 #ifdef _MSC_VER
223 
224 # if _MSC_VER >= 1900 // Visual Studio 2015 or newer
225 # define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
226 # endif
227 
228 // Universal Windows platform does not support SEH
229 // Or console colours (or console at all...)
230 # if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
231 # define CATCH_CONFIG_COLOUR_NONE
232 # else
233 # define CATCH_INTERNAL_CONFIG_WINDOWS_SEH
234 # endif
235 
236 // MSVC traditional preprocessor needs some workaround for __VA_ARGS__
237 // _MSVC_TRADITIONAL == 0 means new conformant preprocessor
238 // _MSVC_TRADITIONAL == 1 means old traditional non-conformant preprocessor
239 # if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL)
240 # define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
241 # endif
242 #endif // _MSC_VER
243 
244 #if defined(_REENTRANT) || defined(_MSC_VER)
245 // Enable async processing, as -pthread is specified or no additional linking is required
246 # define CATCH_INTERNAL_CONFIG_USE_ASYNC
247 #endif // _MSC_VER
248 
250 // Check if we are compiled with -fno-exceptions or equivalent
251 #if defined(__EXCEPTIONS) || defined(__cpp_exceptions) || defined(_CPPUNWIND)
252 # define CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED
253 #endif
254 
256 // DJGPP
257 #ifdef __DJGPP__
258 # define CATCH_INTERNAL_CONFIG_NO_WCHAR
259 #endif // __DJGPP__
260 
262 // Embarcadero C++Build
263 #if defined(__BORLANDC__)
264  #define CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN
265 #endif
266 
268 
269 // Use of __COUNTER__ is suppressed during code analysis in
270 // CLion/AppCode 2017.2.x and former, because __COUNTER__ is not properly
271 // handled by it.
272 // Otherwise all supported compilers support COUNTER macro,
273 // but user still might want to turn it off
274 #if ( !defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L )
275  #define CATCH_INTERNAL_CONFIG_COUNTER
276 #endif
277 
279 
280 // RTX is a special version of Windows that is real time.
281 // This means that it is detected as Windows, but does not provide
282 // the same set of capabilities as real Windows does.
283 #if defined(UNDER_RTSS) || defined(RTX64_BUILD)
284  #define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH
285  #define CATCH_INTERNAL_CONFIG_NO_ASYNC
286  #define CATCH_CONFIG_COLOUR_NONE
287 #endif
288 
290 // Check if string_view is available and usable
291 // The check is split apart to work around v140 (VS2015) preprocessor issue...
292 #if defined(__has_include)
293 #if __has_include(<string_view>) && defined(CATCH_CPP17_OR_GREATER)
294 # define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW
295 #endif
296 #endif
297 
299 // Check if optional is available and usable
300 #if defined(__has_include)
301 # if __has_include(<optional>) && defined(CATCH_CPP17_OR_GREATER)
302 # define CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL
303 # endif // __has_include(<optional>) && defined(CATCH_CPP17_OR_GREATER)
304 #endif // __has_include
305 
307 // Check if byte is available and usable
308 #if defined(__has_include)
309 # if __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER)
310 # define CATCH_INTERNAL_CONFIG_CPP17_BYTE
311 # endif // __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER)
312 #endif // __has_include
313 
315 // Check if variant is available and usable
316 #if defined(__has_include)
317 # if __has_include(<variant>) && defined(CATCH_CPP17_OR_GREATER)
318 # if defined(__clang__) && (__clang_major__ < 8)
319  // work around clang bug with libstdc++ https://bugs.llvm.org/show_bug.cgi?id=31852
320  // fix should be in clang 8, workaround in libstdc++ 8.2
321 # include <ciso646>
322 # if defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9)
323 # define CATCH_CONFIG_NO_CPP17_VARIANT
324 # else
325 # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT
326 # endif // defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9)
327 # else
328 # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT
329 # endif // defined(__clang__) && (__clang_major__ < 8)
330 # endif // __has_include(<variant>) && defined(CATCH_CPP17_OR_GREATER)
331 #endif // __has_include
332 
333 #if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER)
334 # define CATCH_CONFIG_COUNTER
335 #endif
336 #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)
337 # define CATCH_CONFIG_WINDOWS_SEH
338 #endif
339 // This is set by default, because we assume that unix compilers are posix-signal-compatible by default.
340 #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)
341 # define CATCH_CONFIG_POSIX_SIGNALS
342 #endif
343 // This is set by default, because we assume that compilers with no wchar_t support are just rare exceptions.
344 #if !defined(CATCH_INTERNAL_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_WCHAR)
345 # define CATCH_CONFIG_WCHAR
346 #endif
347 
348 #if !defined(CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_CPP11_TO_STRING)
349 # define CATCH_CONFIG_CPP11_TO_STRING
350 #endif
351 
352 #if defined(CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_NO_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_CPP17_OPTIONAL)
353 # define CATCH_CONFIG_CPP17_OPTIONAL
354 #endif
355 
356 #if defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) && !defined(CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS) && !defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
357 # define CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
358 #endif
359 
360 #if defined(CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_NO_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_CPP17_STRING_VIEW)
361 # define CATCH_CONFIG_CPP17_STRING_VIEW
362 #endif
363 
364 #if defined(CATCH_INTERNAL_CONFIG_CPP17_VARIANT) && !defined(CATCH_CONFIG_NO_CPP17_VARIANT) && !defined(CATCH_CONFIG_CPP17_VARIANT)
365 # define CATCH_CONFIG_CPP17_VARIANT
366 #endif
367 
368 #if defined(CATCH_INTERNAL_CONFIG_CPP17_BYTE) && !defined(CATCH_CONFIG_NO_CPP17_BYTE) && !defined(CATCH_CONFIG_CPP17_BYTE)
369 # define CATCH_CONFIG_CPP17_BYTE
370 #endif
371 
372 #if defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT)
373 # define CATCH_INTERNAL_CONFIG_NEW_CAPTURE
374 #endif
375 
376 #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)
377 # define CATCH_CONFIG_NEW_CAPTURE
378 #endif
379 
380 #if !defined(CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
381 # define CATCH_CONFIG_DISABLE_EXCEPTIONS
382 #endif
383 
384 #if defined(CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_NO_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_POLYFILL_ISNAN)
385 # define CATCH_CONFIG_POLYFILL_ISNAN
386 #endif
387 
388 #if defined(CATCH_INTERNAL_CONFIG_USE_ASYNC) && !defined(CATCH_INTERNAL_CONFIG_NO_ASYNC) && !defined(CATCH_CONFIG_NO_USE_ASYNC) && !defined(CATCH_CONFIG_USE_ASYNC)
389 # define CATCH_CONFIG_USE_ASYNC
390 #endif
391 
392 #if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS)
393 # define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS
394 # define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS
395 #endif
396 #if !defined(CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS)
397 # define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
398 # define CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS
399 #endif
400 #if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS)
401 # define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS
402 # define CATCH_INTERNAL_UNSUPPRESS_UNUSED_WARNINGS
403 #endif
404 #if !defined(CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS)
405 # define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS
406 # define CATCH_INTERNAL_UNSUPPRESS_ZERO_VARIADIC_WARNINGS
407 #endif
408 
409 #if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
410 #define CATCH_TRY if ((true))
411 #define CATCH_CATCH_ALL if ((false))
412 #define CATCH_CATCH_ANON(type) if ((false))
413 #else
414 #define CATCH_TRY try
415 #define CATCH_CATCH_ALL catch (...)
416 #define CATCH_CATCH_ANON(type) catch (type)
417 #endif
418 
419 #if defined(CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_NO_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR)
420 #define CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
421 #endif
422 
423 // end catch_compiler_capabilities.h
424 #define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line
425 #define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line )
426 #ifdef CATCH_CONFIG_COUNTER
427 # define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ )
428 #else
429 # define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ )
430 #endif
431 
432 #include <iosfwd>
433 #include <string>
434 #include <cstdint>
435 
436 // We need a dummy global operator<< so we can bring it into Catch namespace later
438 std::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy);
439 
440 namespace Catch {
441 
442  struct CaseSensitive { enum Choice {
443  Yes,
444  No
445  }; };
446 
447  class NonCopyable {
448  NonCopyable( NonCopyable const& ) = delete;
449  NonCopyable( NonCopyable && ) = delete;
450  NonCopyable& operator = ( NonCopyable const& ) = delete;
451  NonCopyable& operator = ( NonCopyable && ) = delete;
452 
453  protected:
454  NonCopyable();
455  virtual ~NonCopyable();
456  };
457 
458  struct SourceLineInfo {
459 
460  SourceLineInfo() = delete;
461  SourceLineInfo( char const* _file, std::size_t _line ) noexcept
462  : file( _file ),
463  line( _line )
464  {}
465 
466  SourceLineInfo( SourceLineInfo const& other ) = default;
467  SourceLineInfo& operator = ( SourceLineInfo const& ) = default;
468  SourceLineInfo( SourceLineInfo&& ) noexcept = default;
469  SourceLineInfo& operator = ( SourceLineInfo&& ) noexcept = default;
470 
471  bool empty() const noexcept;
472  bool operator == ( SourceLineInfo const& other ) const noexcept;
473  bool operator < ( SourceLineInfo const& other ) const noexcept;
474 
475  char const* file;
476  std::size_t line;
477  };
478 
479  std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info );
480 
481  // Bring in operator<< from global namespace into Catch namespace
482  // This is necessary because the overload of operator<< above makes
483  // lookup stop at namespace Catch
484  using ::operator<<;
485 
486  // Use this in variadic streaming macros to allow
487  // >> +StreamEndStop
488  // as well as
489  // >> stuff +StreamEndStop
490  struct StreamEndStop {
491  std::string operator+() const;
492  };
493  template<typename T>
494  T const& operator + ( T const& value, StreamEndStop ) {
495  return value;
496  }
497 }
498 
499 #define CATCH_INTERNAL_LINEINFO \
500  ::Catch::SourceLineInfo( __FILE__, static_cast<std::size_t>( __LINE__ ) )
501 
502 // end catch_common.h
503 namespace Catch {
504 
506  RegistrarForTagAliases( char const* alias, char const* tag, SourceLineInfo const& lineInfo );
507  };
508 
509 } // end namespace Catch
510 
511 #define CATCH_REGISTER_TAG_ALIAS( alias, spec ) \
512  CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
513  namespace{ Catch::RegistrarForTagAliases INTERNAL_CATCH_UNIQUE_NAME( AutoRegisterTagAlias )( alias, spec, CATCH_INTERNAL_LINEINFO ); } \
514  CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS
515 
516 // end catch_tag_alias_autoregistrar.h
517 // start catch_test_registry.h
518 
519 // start catch_interfaces_testcase.h
520 
521 #include <vector>
522 
523 namespace Catch {
524 
525  class TestSpec;
526 
527  struct ITestInvoker {
528  virtual void invoke () const = 0;
529  virtual ~ITestInvoker();
530  };
531 
532  class TestCase;
533  struct IConfig;
534 
536  virtual ~ITestCaseRegistry();
537  virtual std::vector<TestCase> const& getAllTests() const = 0;
538  virtual std::vector<TestCase> const& getAllTestsSorted( IConfig const& config ) const = 0;
539  };
540 
541  bool isThrowSafe( TestCase const& testCase, IConfig const& config );
542  bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config );
543  std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config );
544  std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config );
545 
546 }
547 
548 // end catch_interfaces_testcase.h
549 // start catch_stringref.h
550 
551 #include <cstddef>
552 #include <string>
553 #include <iosfwd>
554 
555 namespace Catch {
556 
564  class StringRef {
565  public:
566  using size_type = std::size_t;
567 
568  private:
569  friend struct StringRefTestAccess;
570 
571  char const* m_start;
572  size_type m_size;
573 
574  char* m_data = nullptr;
575 
576  void takeOwnership();
577 
578  static constexpr char const* const s_empty = "";
579 
580  public: // construction/ assignment
581  StringRef() noexcept
582  : StringRef( s_empty, 0 )
583  {}
584 
585  StringRef( StringRef const& other ) noexcept
586  : m_start( other.m_start ),
587  m_size( other.m_size )
588  {}
589 
590  StringRef( StringRef&& other ) noexcept
591  : m_start( other.m_start ),
592  m_size( other.m_size ),
593  m_data( other.m_data )
594  {
595  other.m_data = nullptr;
596  }
597 
598  StringRef( char const* rawChars ) noexcept;
599 
600  StringRef( char const* rawChars, size_type size ) noexcept
601  : m_start( rawChars ),
602  m_size( size )
603  {}
604 
605  StringRef( std::string const& stdString ) noexcept
606  : m_start( stdString.c_str() ),
607  m_size( stdString.size() )
608  {}
609 
610  ~StringRef() noexcept {
611  delete[] m_data;
612  }
613 
614  auto operator = ( StringRef const &other ) noexcept -> StringRef& {
615  delete[] m_data;
616  m_data = nullptr;
617  m_start = other.m_start;
618  m_size = other.m_size;
619  return *this;
620  }
621 
622  operator std::string() const;
623 
624  void swap( StringRef& other ) noexcept;
625 
626  public: // operators
627  auto operator == ( StringRef const& other ) const noexcept -> bool;
628  auto operator != ( StringRef const& other ) const noexcept -> bool;
629 
630  auto operator[] ( size_type index ) const noexcept -> char;
631 
632  public: // named queries
633  auto empty() const noexcept -> bool {
634  return m_size == 0;
635  }
636  auto size() const noexcept -> size_type {
637  return m_size;
638  }
639 
640  auto numberOfCharacters() const noexcept -> size_type;
641  auto c_str() const -> char const*;
642 
643  public: // substrings and searches
644  auto substr( size_type start, size_type size ) const noexcept -> StringRef;
645 
646  // Returns the current start pointer.
647  // Note that the pointer can change when if the StringRef is a substring
648  auto currentData() const noexcept -> char const*;
649 
650  private: // ownership queries - may not be consistent between calls
651  auto isOwned() const noexcept -> bool;
652  auto isSubstring() const noexcept -> bool;
653  };
654 
655  auto operator + ( StringRef const& lhs, StringRef const& rhs ) -> std::string;
656  auto operator + ( StringRef const& lhs, char const* rhs ) -> std::string;
657  auto operator + ( char const* lhs, StringRef const& rhs ) -> std::string;
658 
659  auto operator += ( std::string& lhs, StringRef const& sr ) -> std::string&;
660  auto operator << ( std::ostream& os, StringRef const& sr ) -> std::ostream&;
661 
662  inline auto operator "" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef {
663  return StringRef( rawChars, size );
664  }
665 
666 } // namespace Catch
667 
668 inline auto operator "" _catch_sr( char const* rawChars, std::size_t size ) noexcept -> Catch::StringRef {
669  return Catch::StringRef( rawChars, size );
670 }
671 
672 // end catch_stringref.h
673 // start catch_type_traits.hpp
674 
675 
676 #include <type_traits>
677 
678 namespace Catch{
679 
680 #ifdef CATCH_CPP17_OR_GREATER
681  template <typename...>
682  inline constexpr auto is_unique = std::true_type{};
683 
684  template <typename T, typename... Rest>
685  inline constexpr auto is_unique<T, Rest...> = std::bool_constant<
686  (!std::is_same_v<T, Rest> && ...) && is_unique<Rest...>
687  >{};
688 #else
689 
690 template <typename...>
691 struct is_unique : std::true_type{};
692 
693 template <typename T0, typename T1, typename... Rest>
694 struct is_unique<T0, T1, Rest...> : std::integral_constant
695 <bool,
696  !std::is_same<T0, T1>::value
697  && is_unique<T0, Rest...>::value
698  && is_unique<T1, Rest...>::value
699 >{};
700 
701 #endif
702 }
703 
704 // end catch_type_traits.hpp
705 // start catch_preprocessor.hpp
706 
707 
708 #define CATCH_RECURSION_LEVEL0(...) __VA_ARGS__
709 #define CATCH_RECURSION_LEVEL1(...) CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(__VA_ARGS__)))
710 #define CATCH_RECURSION_LEVEL2(...) CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(__VA_ARGS__)))
711 #define CATCH_RECURSION_LEVEL3(...) CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(__VA_ARGS__)))
712 #define CATCH_RECURSION_LEVEL4(...) CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(__VA_ARGS__)))
713 #define CATCH_RECURSION_LEVEL5(...) CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(__VA_ARGS__)))
714 
715 #ifdef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
716 #define INTERNAL_CATCH_EXPAND_VARGS(...) __VA_ARGS__
717 // MSVC needs more evaluations
718 #define CATCH_RECURSION_LEVEL6(...) CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(__VA_ARGS__)))
719 #define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL6(CATCH_RECURSION_LEVEL6(__VA_ARGS__))
720 #else
721 #define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL5(__VA_ARGS__)
722 #endif
723 
724 #define CATCH_REC_END(...)
725 #define CATCH_REC_OUT
726 
727 #define CATCH_EMPTY()
728 #define CATCH_DEFER(id) id CATCH_EMPTY()
729 
730 #define CATCH_REC_GET_END2() 0, CATCH_REC_END
731 #define CATCH_REC_GET_END1(...) CATCH_REC_GET_END2
732 #define CATCH_REC_GET_END(...) CATCH_REC_GET_END1
733 #define CATCH_REC_NEXT0(test, next, ...) next CATCH_REC_OUT
734 #define CATCH_REC_NEXT1(test, next) CATCH_DEFER ( CATCH_REC_NEXT0 ) ( test, next, 0)
735 #define CATCH_REC_NEXT(test, next) CATCH_REC_NEXT1(CATCH_REC_GET_END test, next)
736 
737 #define CATCH_REC_LIST0(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ )
738 #define CATCH_REC_LIST1(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0) ) ( f, peek, __VA_ARGS__ )
739 #define CATCH_REC_LIST2(f, x, peek, ...) f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ )
740 
741 #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__ )
742 #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__ )
743 #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__ )
744 
745 // Applies the function macro `f` to each of the remaining parameters, inserts commas between the results,
746 // and passes userdata as the first parameter to each invocation,
747 // e.g. CATCH_REC_LIST_UD(f, x, a, b, c) evaluates to f(x, a), f(x, b), f(x, c)
748 #define CATCH_REC_LIST_UD(f, userdata, ...) CATCH_RECURSE(CATCH_REC_LIST2_UD(f, userdata, __VA_ARGS__, ()()(), ()()(), ()()(), 0))
749 
750 #define CATCH_REC_LIST(f, ...) CATCH_RECURSE(CATCH_REC_LIST2(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0))
751 
752 #define INTERNAL_CATCH_EXPAND1(param) INTERNAL_CATCH_EXPAND2(param)
753 #define INTERNAL_CATCH_EXPAND2(...) INTERNAL_CATCH_NO## __VA_ARGS__
754 #define INTERNAL_CATCH_DEF(...) INTERNAL_CATCH_DEF __VA_ARGS__
755 #define INTERNAL_CATCH_NOINTERNAL_CATCH_DEF
756 #define INTERNAL_CATCH_STRINGIZE(...) INTERNAL_CATCH_STRINGIZE2(__VA_ARGS__)
757 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
758 #define INTERNAL_CATCH_STRINGIZE2(...) #__VA_ARGS__
759 #define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param))
760 #else
761 // MSVC is adding extra space and needs another indirection to expand INTERNAL_CATCH_NOINTERNAL_CATCH_DEF
762 #define INTERNAL_CATCH_STRINGIZE2(...) INTERNAL_CATCH_STRINGIZE3(__VA_ARGS__)
763 #define INTERNAL_CATCH_STRINGIZE3(...) #__VA_ARGS__
764 #define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) (INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) + 1)
765 #endif
766 
767 #define INTERNAL_CATCH_MAKE_NAMESPACE2(...) ns_##__VA_ARGS__
768 #define INTERNAL_CATCH_MAKE_NAMESPACE(name) INTERNAL_CATCH_MAKE_NAMESPACE2(name)
769 
770 #define INTERNAL_CATCH_REMOVE_PARENS(...) INTERNAL_CATCH_EXPAND1(INTERNAL_CATCH_DEF __VA_ARGS__)
771 
772 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
773 #define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS_GEN(__VA_ARGS__)>())
774 #define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__))
775 #else
776 #define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) INTERNAL_CATCH_EXPAND_VARGS(decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS_GEN(__VA_ARGS__)>()))
777 #define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__)))
778 #endif
779 
780 #define INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(...)\
781  CATCH_REC_LIST(INTERNAL_CATCH_MAKE_TYPE_LIST,__VA_ARGS__)
782 
783 #define INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_0) INTERNAL_CATCH_REMOVE_PARENS(_0)
784 #define INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_0, _1) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_1)
785 #define INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_0, _1, _2) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_1, _2)
786 #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)
787 #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)
788 #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)
789 #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, _4, _5, _6)
790 #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)
791 #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)
792 #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)
793 #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)
794 
795 #define INTERNAL_CATCH_VA_NARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N
796 
797 #define INTERNAL_CATCH_TYPE_GEN\
798  template<typename...> struct TypeList {};\
799  template<typename...Ts>\
800  constexpr auto get_wrapper() noexcept -> TypeList<Ts...> { return {}; }\
801  \
802  template<template<typename...> class L1, typename...E1, template<typename...> class L2, typename...E2> \
803  constexpr auto append(L1<E1...>, L2<E2...>) noexcept -> L1<E1...,E2...> { return {}; }\
804  template< template<typename...> class L1, typename...E1, template<typename...> class L2, typename...E2, typename...Rest>\
805  constexpr auto append(L1<E1...>, L2<E2...>, Rest...) noexcept -> decltype(append(L1<E1...,E2...>{}, Rest{}...)) { return {}; }\
806  template< template<typename...> class L1, typename...E1, typename...Rest>\
807  constexpr auto append(L1<E1...>, TypeList<mpl_::na>, Rest...) noexcept -> L1<E1...> { return {}; }\
808  \
809  template< template<typename...> class Container, template<typename...> class List, typename...elems>\
810  constexpr auto rewrap(List<elems...>) noexcept -> TypeList<Container<elems...>> { return {}; }\
811  template< template<typename...> class Container, template<typename...> class List, class...Elems, typename...Elements>\
812  constexpr auto rewrap(List<Elems...>,Elements...) noexcept -> decltype(append(TypeList<Container<Elems...>>{}, rewrap<Container>(Elements{}...))) { return {}; }\
813  \
814  template<template <typename...> class Final, template< typename...> class...Containers, typename...Types>\
815  constexpr auto create(TypeList<Types...>) noexcept -> decltype(append(Final<>{}, rewrap<Containers>(Types{}...)...)) { return {}; }\
816  template<template <typename...> class Final, template <typename...> class List, typename...Ts>\
817  constexpr auto convert(List<Ts...>) noexcept -> decltype(append(Final<>{},TypeList<Ts>{}...)) { return {}; }
818 
819 #define INTERNAL_CATCH_NTTP_1(signature, ...)\
820  template<INTERNAL_CATCH_REMOVE_PARENS(signature)> struct Nttp{};\
821  template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\
822  constexpr auto get_wrapper() noexcept -> Nttp<__VA_ARGS__> { return {}; } \
823  \
824  template< template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class Container, template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class List, INTERNAL_CATCH_REMOVE_PARENS(signature)>\
825  constexpr auto rewrap(List<__VA_ARGS__>) noexcept -> TypeList<Container<__VA_ARGS__>> { return {}; }\
826  template< template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class Container, template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class List, INTERNAL_CATCH_REMOVE_PARENS(signature), typename...Elements>\
827  constexpr auto rewrap(List<__VA_ARGS__>,Elements...elems) noexcept -> decltype(append(TypeList<Container<__VA_ARGS__>>{}, rewrap<Container>(elems...))) { return {}; }\
828  template<template <typename...> class Final, template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class...Containers, typename...Types>\
829  constexpr auto create(TypeList<Types...>) noexcept -> decltype(append(Final<>{}, rewrap<Containers>(Types{}...)...)) { return {}; }
830 
831 #define INTERNAL_CATCH_DECLARE_SIG_TEST0(TestName)
832 #define INTERNAL_CATCH_DECLARE_SIG_TEST1(TestName, signature)\
833  template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\
834  static void TestName()
835 #define INTERNAL_CATCH_DECLARE_SIG_TEST_X(TestName, signature, ...)\
836  template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\
837  static void TestName()
838 
839 #define INTERNAL_CATCH_DEFINE_SIG_TEST0(TestName)
840 #define INTERNAL_CATCH_DEFINE_SIG_TEST1(TestName, signature)\
841  template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\
842  static void TestName()
843 #define INTERNAL_CATCH_DEFINE_SIG_TEST_X(TestName, signature,...)\
844  template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\
845  static void TestName()
846 
847 #define INTERNAL_CATCH_NTTP_REGISTER0(TestFunc, signature)\
848  template<typename Type>\
849  void reg_test(TypeList<Type>, Catch::NameAndTags nameAndTags)\
850  {\
851  Catch::AutoReg( Catch::makeTestInvoker(&TestFunc<Type>), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), nameAndTags);\
852  }
853 
854 #define INTERNAL_CATCH_NTTP_REGISTER(TestFunc, signature, ...)\
855  template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\
856  void reg_test(Nttp<__VA_ARGS__>, Catch::NameAndTags nameAndTags)\
857  {\
858  Catch::AutoReg( Catch::makeTestInvoker(&TestFunc<__VA_ARGS__>), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), nameAndTags);\
859  }
860 
861 #define INTERNAL_CATCH_NTTP_REGISTER_METHOD0(TestName, signature, ...)\
862  template<typename Type>\
863  void reg_test(TypeList<Type>, Catch::StringRef className, Catch::NameAndTags nameAndTags)\
864  {\
865  Catch::AutoReg( Catch::makeTestInvoker(&TestName<Type>::test), CATCH_INTERNAL_LINEINFO, className, nameAndTags);\
866  }
867 
868 #define INTERNAL_CATCH_NTTP_REGISTER_METHOD(TestName, signature, ...)\
869  template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\
870  void reg_test(Nttp<__VA_ARGS__>, Catch::StringRef className, Catch::NameAndTags nameAndTags)\
871  {\
872  Catch::AutoReg( Catch::makeTestInvoker(&TestName<__VA_ARGS__>::test), CATCH_INTERNAL_LINEINFO, className, nameAndTags);\
873  }
874 
875 #define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD0(TestName, ClassName)
876 #define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD1(TestName, ClassName, signature)\
877  template<typename TestType> \
878  struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName)<TestType> { \
879  void test();\
880  }
881 
882 #define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X(TestName, ClassName, signature, ...)\
883  template<INTERNAL_CATCH_REMOVE_PARENS(signature)> \
884  struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName)<__VA_ARGS__> { \
885  void test();\
886  }
887 
888 #define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD0(TestName)
889 #define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD1(TestName, signature)\
890  template<typename TestType> \
891  void INTERNAL_CATCH_MAKE_NAMESPACE(TestName)::TestName<TestType>::test()
892 #define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X(TestName, signature, ...)\
893  template<INTERNAL_CATCH_REMOVE_PARENS(signature)> \
894  void INTERNAL_CATCH_MAKE_NAMESPACE(TestName)::TestName<__VA_ARGS__>::test()
895 
896 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
897 #define INTERNAL_CATCH_NTTP_0
898 #define INTERNAL_CATCH_NTTP_GEN(...) INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__),INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_0)
899 #define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD1, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD0)(TestName, __VA_ARGS__)
900 #define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD1, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD0)(TestName, ClassName, __VA_ARGS__)
901 #define INTERNAL_CATCH_NTTP_REG_METHOD_GEN(TestName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD0, INTERNAL_CATCH_NTTP_REGISTER_METHOD0)(TestName, __VA_ARGS__)
902 #define INTERNAL_CATCH_NTTP_REG_GEN(TestFunc, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER0, INTERNAL_CATCH_NTTP_REGISTER0)(TestFunc, __VA_ARGS__)
903 #define INTERNAL_CATCH_DEFINE_SIG_TEST(TestName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DEFINE_SIG_TEST1, INTERNAL_CATCH_DEFINE_SIG_TEST0)(TestName, __VA_ARGS__)
904 #define INTERNAL_CATCH_DECLARE_SIG_TEST(TestName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DECLARE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST1, INTERNAL_CATCH_DECLARE_SIG_TEST0)(TestName, __VA_ARGS__)
905 #define INTERNAL_CATCH_REMOVE_PARENS_GEN(...) INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_REMOVE_PARENS_11_ARG,INTERNAL_CATCH_REMOVE_PARENS_10_ARG,INTERNAL_CATCH_REMOVE_PARENS_9_ARG,INTERNAL_CATCH_REMOVE_PARENS_8_ARG,INTERNAL_CATCH_REMOVE_PARENS_7_ARG,INTERNAL_CATCH_REMOVE_PARENS_6_ARG,INTERNAL_CATCH_REMOVE_PARENS_5_ARG,INTERNAL_CATCH_REMOVE_PARENS_4_ARG,INTERNAL_CATCH_REMOVE_PARENS_3_ARG,INTERNAL_CATCH_REMOVE_PARENS_2_ARG,INTERNAL_CATCH_REMOVE_PARENS_1_ARG)(__VA_ARGS__)
906 #else
907 #define INTERNAL_CATCH_NTTP_0(signature)
908 #define INTERNAL_CATCH_NTTP_GEN(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1,INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_0)( __VA_ARGS__))
909 #define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD1, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD0)(TestName, __VA_ARGS__))
910 #define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD1, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD0)(TestName, ClassName, __VA_ARGS__))
911 #define INTERNAL_CATCH_NTTP_REG_METHOD_GEN(TestName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD0, INTERNAL_CATCH_NTTP_REGISTER_METHOD0)(TestName, __VA_ARGS__))
912 #define INTERNAL_CATCH_NTTP_REG_GEN(TestFunc, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER0, INTERNAL_CATCH_NTTP_REGISTER0)(TestFunc, __VA_ARGS__))
913 #define INTERNAL_CATCH_DEFINE_SIG_TEST(TestName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DEFINE_SIG_TEST1, INTERNAL_CATCH_DEFINE_SIG_TEST0)(TestName, __VA_ARGS__))
914 #define INTERNAL_CATCH_DECLARE_SIG_TEST(TestName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DECLARE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST1, INTERNAL_CATCH_DECLARE_SIG_TEST0)(TestName, __VA_ARGS__))
915 #define INTERNAL_CATCH_REMOVE_PARENS_GEN(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_REMOVE_PARENS_11_ARG,INTERNAL_CATCH_REMOVE_PARENS_10_ARG,INTERNAL_CATCH_REMOVE_PARENS_9_ARG,INTERNAL_CATCH_REMOVE_PARENS_8_ARG,INTERNAL_CATCH_REMOVE_PARENS_7_ARG,INTERNAL_CATCH_REMOVE_PARENS_6_ARG,INTERNAL_CATCH_REMOVE_PARENS_5_ARG,INTERNAL_CATCH_REMOVE_PARENS_4_ARG,INTERNAL_CATCH_REMOVE_PARENS_3_ARG,INTERNAL_CATCH_REMOVE_PARENS_2_ARG,INTERNAL_CATCH_REMOVE_PARENS_1_ARG)(__VA_ARGS__))
916 #endif
917 
918 // end catch_preprocessor.hpp
919 // start catch_meta.hpp
920 
921 
922 #include <type_traits>
923 
924 namespace Catch {
925 template<typename T>
926 struct always_false : std::false_type {};
927 
928 template <typename> struct true_given : std::true_type {};
930  template <typename Fun, typename... Args>
931  true_given<decltype(std::declval<Fun>()(std::declval<Args>()...))> static test(int);
932  template <typename...>
933  std::false_type static test(...);
934 };
935 
936 template <typename T>
937 struct is_callable;
938 
939 template <typename Fun, typename... Args>
940 struct is_callable<Fun(Args...)> : decltype(is_callable_tester::test<Fun, Args...>(0)) {};
941 
942 } // namespace Catch
943 
944 namespace mpl_{
945  struct na;
946 }
947 
948 // end catch_meta.hpp
949 namespace Catch {
950 
951 template<typename C>
953  void (C::*m_testAsMethod)();
954 public:
955  TestInvokerAsMethod( void (C::*testAsMethod)() ) noexcept : m_testAsMethod( testAsMethod ) {}
956 
957  void invoke() const override {
958  C obj;
959  (obj.*m_testAsMethod)();
960  }
961 };
962 
963 auto makeTestInvoker( void(*testAsFunction)() ) noexcept -> ITestInvoker*;
964 
965 template<typename C>
966 auto makeTestInvoker( void (C::*testAsMethod)() ) noexcept -> ITestInvoker* {
967  return new(std::nothrow) TestInvokerAsMethod<C>( testAsMethod );
968 }
969 
970 struct NameAndTags {
971  NameAndTags( StringRef const& name_ = StringRef(), StringRef const& tags_ = StringRef() ) noexcept;
972  StringRef name;
973  StringRef tags;
974 };
975 
977  AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept;
978  ~AutoReg();
979 };
980 
981 } // end namespace Catch
982 
983 #if defined(CATCH_CONFIG_DISABLE)
984  #define INTERNAL_CATCH_TESTCASE_NO_REGISTRATION( TestName, ... ) \
985  static void TestName()
986  #define INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION( TestName, ClassName, ... ) \
987  namespace{ \
988  struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) { \
989  void test(); \
990  }; \
991  } \
992  void TestName::test()
993  #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( TestName, TestFunc, Name, Tags, Signature, ... ) \
994  INTERNAL_CATCH_DEFINE_SIG_TEST(TestFunc, INTERNAL_CATCH_REMOVE_PARENS(Signature))
995  #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( TestNameClass, TestName, ClassName, Name, Tags, Signature, ... ) \
996  namespace{ \
997  namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) { \
998  INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, INTERNAL_CATCH_REMOVE_PARENS(Signature));\
999  } \
1000  } \
1001  INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature))
1002 
1003  #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1004  #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(Name, Tags, ...) \
1005  INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename TestType, __VA_ARGS__ )
1006  #else
1007  #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(Name, Tags, ...) \
1008  INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename TestType, __VA_ARGS__ ) )
1009  #endif
1010 
1011  #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1012  #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(Name, Tags, Signature, ...) \
1013  INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ )
1014  #else
1015  #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(Name, Tags, Signature, ...) \
1016  INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ ) )
1017  #endif
1018 
1019  #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1020  #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION( ClassName, Name, Tags,... ) \
1021  INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ )
1022  #else
1023  #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION( ClassName, Name, Tags,... ) \
1024  INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) )
1025  #endif
1026 
1027  #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1028  #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION( ClassName, Name, Tags, Signature, ... ) \
1029  INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ )
1030  #else
1031  #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION( ClassName, Name, Tags, Signature, ... ) \
1032  INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) )
1033  #endif
1034 #endif
1035 
1037  #define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \
1038  static void TestName(); \
1039  CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
1040  namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &TestName ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \
1041  CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
1042  static void TestName()
1043  #define INTERNAL_CATCH_TESTCASE( ... ) \
1044  INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), __VA_ARGS__ )
1045 
1047  #define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \
1048  CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
1049  namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &QualifiedMethod ), CATCH_INTERNAL_LINEINFO, "&" #QualifiedMethod, Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \
1050  CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS
1051 
1053  #define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\
1054  CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
1055  namespace{ \
1056  struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) { \
1057  void test(); \
1058  }; \
1059  Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( Catch::makeTestInvoker( &TestName::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \
1060  } \
1061  CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
1062  void TestName::test()
1063  #define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... ) \
1064  INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, __VA_ARGS__ )
1065 
1067  #define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \
1068  CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
1069  Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( Function ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \
1070  CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS
1071 
1073  #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_2(TestName, TestFunc, Name, Tags, Signature, ... )\
1074  CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
1075  CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \
1076  INTERNAL_CATCH_DECLARE_SIG_TEST(TestFunc, INTERNAL_CATCH_REMOVE_PARENS(Signature));\
1077  namespace {\
1078  namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){\
1079  INTERNAL_CATCH_TYPE_GEN\
1080  INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))\
1081  INTERNAL_CATCH_NTTP_REG_GEN(TestFunc,INTERNAL_CATCH_REMOVE_PARENS(Signature))\
1082  template<typename...Types> \
1083  struct TestName{\
1084  TestName(){\
1085  int index = 0; \
1086  constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\
1087  using expander = int[];\
1088  (void)expander{(reg_test(Types{}, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++, 0)... };/* NOLINT */ \
1089  }\
1090  };\
1091  static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
1092  TestName<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(__VA_ARGS__)>();\
1093  return 0;\
1094  }();\
1095  }\
1096  }\
1097  CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
1098  CATCH_INTERNAL_UNSUPPRESS_ZERO_VARIADIC_WARNINGS \
1099  INTERNAL_CATCH_DEFINE_SIG_TEST(TestFunc,INTERNAL_CATCH_REMOVE_PARENS(Signature))
1100 
1101 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1102  #define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \
1103  INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename TestType, __VA_ARGS__ )
1104 #else
1105  #define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \
1106  INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename TestType, __VA_ARGS__ ) )
1107 #endif
1108 
1109 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1110  #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG(Name, Tags, Signature, ...) \
1111  INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ )
1112 #else
1113  #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG(Name, Tags, Signature, ...) \
1114  INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ ) )
1115 #endif
1116 
1117  #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(TestName, TestFuncName, Name, Tags, Signature, TmplTypes, TypesList) \
1118  CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
1119  CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \
1120  template<typename TestType> static void TestFuncName(); \
1121  namespace {\
1122  namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) { \
1123  INTERNAL_CATCH_TYPE_GEN \
1124  INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature)) \
1125  template<typename... Types> \
1126  struct TestName { \
1127  void reg_tests() { \
1128  int index = 0; \
1129  using expander = int[]; \
1130  constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};\
1131  constexpr char const* types_list[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};\
1132  constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);\
1133  (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFuncName<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + "<" + std::string(types_list[index % num_types]) + ">", Tags } ), index++, 0)... };/* NOLINT */\
1134  } \
1135  }; \
1136  static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \
1137  using TestInit = decltype(create<TestName, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes)>(TypeList<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(INTERNAL_CATCH_REMOVE_PARENS(TypesList))>{})); \
1138  TestInit t; \
1139  t.reg_tests(); \
1140  return 0; \
1141  }(); \
1142  } \
1143  } \
1144  CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
1145  CATCH_INTERNAL_UNSUPPRESS_ZERO_VARIADIC_WARNINGS \
1146  template<typename TestType> \
1147  static void TestFuncName()
1148 
1149 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1150  #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE(Name, Tags, ...)\
1151  INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename T,__VA_ARGS__)
1152 #else
1153  #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE(Name, Tags, ...)\
1154  INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename T, __VA_ARGS__ ) )
1155 #endif
1156 
1157 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1158  #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG(Name, Tags, Signature, ...)\
1159  INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__)
1160 #else
1161  #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG(Name, Tags, Signature, ...)\
1162  INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ ) )
1163 #endif
1164 
1165  #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2(TestName, TestFunc, Name, Tags, TmplList)\
1166  CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
1167  template<typename TestType> static void TestFunc(); \
1168  namespace {\
1169  namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){\
1170  INTERNAL_CATCH_TYPE_GEN\
1171  template<typename... Types> \
1172  struct TestName { \
1173  void reg_tests() { \
1174  int index = 0; \
1175  using expander = int[]; \
1176  (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFunc<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + " - " + std::to_string(index), Tags } ), index++, 0)... };/* NOLINT */\
1177  } \
1178  };\
1179  static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \
1180  using TestInit = decltype(convert<TestName>(std::declval<TmplList>())); \
1181  TestInit t; \
1182  t.reg_tests(); \
1183  return 0; \
1184  }(); \
1185  }}\
1186  CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
1187  template<typename TestType> \
1188  static void TestFunc()
1189 
1190  #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE(Name, Tags, TmplList) \
1191  INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, TmplList )
1192 
1193  #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, Signature, ... ) \
1194  CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
1195  CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \
1196  namespace {\
1197  namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){ \
1198  INTERNAL_CATCH_TYPE_GEN\
1199  INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))\
1200  INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, INTERNAL_CATCH_REMOVE_PARENS(Signature));\
1201  INTERNAL_CATCH_NTTP_REG_METHOD_GEN(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature))\
1202  template<typename...Types> \
1203  struct TestNameClass{\
1204  TestNameClass(){\
1205  int index = 0; \
1206  constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\
1207  using expander = int[];\
1208  (void)expander{(reg_test(Types{}, #ClassName, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++, 0)... };/* NOLINT */ \
1209  }\
1210  };\
1211  static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
1212  TestNameClass<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(__VA_ARGS__)>();\
1213  return 0;\
1214  }();\
1215  }\
1216  }\
1217  CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS\
1218  CATCH_INTERNAL_UNSUPPRESS_ZERO_VARIADIC_WARNINGS\
1219  INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature))
1220 
1221 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1222  #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \
1223  INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ )
1224 #else
1225  #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \
1226  INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) )
1227 #endif
1228 
1229 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1230  #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... ) \
1231  INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ )
1232 #else
1233  #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... ) \
1234  INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) )
1235 #endif
1236 
1237  #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2(TestNameClass, TestName, ClassName, Name, Tags, Signature, TmplTypes, TypesList)\
1238  CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
1239  CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \
1240  template<typename TestType> \
1241  struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName <TestType>) { \
1242  void test();\
1243  };\
1244  namespace {\
1245  namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestNameClass) {\
1246  INTERNAL_CATCH_TYPE_GEN \
1247  INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))\
1248  template<typename...Types>\
1249  struct TestNameClass{\
1250  void reg_tests(){\
1251  int index = 0;\
1252  using expander = int[];\
1253  constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};\
1254  constexpr char const* types_list[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};\
1255  constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);\
1256  (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + "<" + std::string(types_list[index % num_types]) + ">", Tags } ), index++, 0)... };/* NOLINT */ \
1257  }\
1258  };\
1259  static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
1260  using TestInit = decltype(create<TestNameClass, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes)>(TypeList<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(INTERNAL_CATCH_REMOVE_PARENS(TypesList))>{}));\
1261  TestInit t;\
1262  t.reg_tests();\
1263  return 0;\
1264  }(); \
1265  }\
1266  }\
1267  CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
1268  CATCH_INTERNAL_UNSUPPRESS_ZERO_VARIADIC_WARNINGS \
1269  template<typename TestType> \
1270  void TestName<TestType>::test()
1271 
1272 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1273  #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( ClassName, Name, Tags, ... )\
1274  INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, typename T, __VA_ARGS__ )
1275 #else
1276  #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( ClassName, Name, Tags, ... )\
1277  INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, typename T,__VA_ARGS__ ) )
1278 #endif
1279 
1280 #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1281  #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... )\
1282  INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, Signature, __VA_ARGS__ )
1283 #else
1284  #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... )\
1285  INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, Signature,__VA_ARGS__ ) )
1286 #endif
1287 
1288  #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, TmplList) \
1289  CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
1290  template<typename TestType> \
1291  struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName <TestType>) { \
1292  void test();\
1293  };\
1294  namespace {\
1295  namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){ \
1296  INTERNAL_CATCH_TYPE_GEN\
1297  template<typename...Types>\
1298  struct TestNameClass{\
1299  void reg_tests(){\
1300  int index = 0;\
1301  using expander = int[];\
1302  (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + " - " + std::to_string(index), Tags } ), index++, 0)... };/* NOLINT */ \
1303  }\
1304  };\
1305  static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
1306  using TestInit = decltype(convert<TestNameClass>(std::declval<TmplList>()));\
1307  TestInit t;\
1308  t.reg_tests();\
1309  return 0;\
1310  }(); \
1311  }}\
1312  CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
1313  template<typename TestType> \
1314  void TestName<TestType>::test()
1315 
1316 #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD(ClassName, Name, Tags, TmplList) \
1317  INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, TmplList )
1318 
1319 // end catch_test_registry.h
1320 // start catch_capture.hpp
1321 
1322 // start catch_assertionhandler.h
1323 
1324 // start catch_assertioninfo.h
1325 
1326 // start catch_result_type.h
1327 
1328 namespace Catch {
1329 
1330  // ResultWas::OfType enum
1331  struct ResultWas { enum OfType {
1332  Unknown = -1,
1333  Ok = 0,
1334  Info = 1,
1335  Warning = 2,
1336 
1337  FailureBit = 0x10,
1338 
1339  ExpressionFailed = FailureBit | 1,
1340  ExplicitFailure = FailureBit | 2,
1341 
1342  Exception = 0x100 | FailureBit,
1343 
1344  ThrewException = Exception | 1,
1345  DidntThrowException = Exception | 2,
1346 
1347  FatalErrorCondition = 0x200 | FailureBit
1348 
1349  }; };
1350 
1351  bool isOk( ResultWas::OfType resultType );
1352  bool isJustInfo( int flags );
1353 
1354  // ResultDisposition::Flags enum
1355  struct ResultDisposition { enum Flags {
1356  Normal = 0x01,
1357 
1358  ContinueOnFailure = 0x02, // Failures fail test, but execution continues
1359  FalseTest = 0x04, // Prefix expression with !
1360  SuppressFail = 0x08 // Failures are reported but do not fail the test
1361  }; };
1362 
1363  ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs );
1364 
1365  bool shouldContinueOnFailure( int flags );
1366  inline bool isFalseTest( int flags ) { return ( flags & ResultDisposition::FalseTest ) != 0; }
1367  bool shouldSuppressFailure( int flags );
1368 
1369 } // end namespace Catch
1370 
1371 // end catch_result_type.h
1372 namespace Catch {
1373 
1375  {
1376  StringRef macroName;
1377  SourceLineInfo lineInfo;
1378  StringRef capturedExpression;
1379  ResultDisposition::Flags resultDisposition;
1380 
1381  // We want to delete this constructor but a compiler bug in 4.8 means
1382  // the struct is then treated as non-aggregate
1383  //AssertionInfo() = delete;
1384  };
1385 
1386 } // end namespace Catch
1387 
1388 // end catch_assertioninfo.h
1389 // start catch_decomposer.h
1390 
1391 // start catch_tostring.h
1392 
1393 #include <vector>
1394 #include <cstddef>
1395 #include <type_traits>
1396 #include <string>
1397 // start catch_stream.h
1398 
1399 #include <iosfwd>
1400 #include <cstddef>
1401 #include <ostream>
1402 
1403 namespace Catch {
1404 
1405  std::ostream& cout();
1406  std::ostream& cerr();
1407  std::ostream& clog();
1408 
1409  class StringRef;
1410 
1411  struct IStream {
1412  virtual ~IStream();
1413  virtual std::ostream& stream() const = 0;
1414  };
1415 
1416  auto makeStream( StringRef const &filename ) -> IStream const*;
1417 
1419  std::size_t m_index;
1420  std::ostream* m_oss;
1421  public:
1424 
1425  auto str() const -> std::string;
1426 
1427  template<typename T>
1428  auto operator << ( T const& value ) -> ReusableStringStream& {
1429  *m_oss << value;
1430  return *this;
1431  }
1432  auto get() -> std::ostream& { return *m_oss; }
1433  };
1434 }
1435 
1436 // end catch_stream.h
1437 // start catch_interfaces_enum_values_registry.h
1438 
1439 #include <vector>
1440 
1441 namespace Catch {
1442 
1443  namespace Detail {
1444  struct EnumInfo {
1445  StringRef m_name;
1446  std::vector<std::pair<int, std::string>> m_values;
1447 
1448  ~EnumInfo();
1449 
1450  StringRef lookup( int value ) const;
1451  };
1452  } // namespace Detail
1453 
1455  virtual ~IMutableEnumValuesRegistry();
1456 
1457  virtual Detail::EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::vector<int> const& values ) = 0;
1458 
1459  template<typename E>
1460  Detail::EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::initializer_list<E> values ) {
1461  std::vector<int> intValues;
1462  intValues.reserve( values.size() );
1463  for( auto enumValue : values )
1464  intValues.push_back( static_cast<int>( enumValue ) );
1465  return registerEnum( enumName, allEnums, intValues );
1466  }
1467  };
1468 
1469 } // Catch
1470 
1471 // end catch_interfaces_enum_values_registry.h
1472 
1473 #ifdef CATCH_CONFIG_CPP17_STRING_VIEW
1474 #include <string_view>
1475 #endif
1476 
1477 #ifdef __OBJC__
1478 // start catch_objc_arc.hpp
1479 
1480 #import <Foundation/Foundation.h>
1481 
1482 #ifdef __has_feature
1483 #define CATCH_ARC_ENABLED __has_feature(objc_arc)
1484 #else
1485 #define CATCH_ARC_ENABLED 0
1486 #endif
1487 
1488 void arcSafeRelease( NSObject* obj );
1489 id performOptionalSelector( id obj, SEL sel );
1490 
1491 #if !CATCH_ARC_ENABLED
1492 inline void arcSafeRelease( NSObject* obj ) {
1493  [obj release];
1494 }
1495 inline id performOptionalSelector( id obj, SEL sel ) {
1496  if( [obj respondsToSelector: sel] )
1497  return [obj performSelector: sel];
1498  return nil;
1499 }
1500 #define CATCH_UNSAFE_UNRETAINED
1501 #define CATCH_ARC_STRONG
1502 #else
1503 inline void arcSafeRelease( NSObject* ){}
1504 inline id performOptionalSelector( id obj, SEL sel ) {
1505 #ifdef __clang__
1506 #pragma clang diagnostic push
1507 #pragma clang diagnostic ignored "-Warc-performSelector-leaks"
1508 #endif
1509  if( [obj respondsToSelector: sel] )
1510  return [obj performSelector: sel];
1511 #ifdef __clang__
1512 #pragma clang diagnostic pop
1513 #endif
1514  return nil;
1515 }
1516 #define CATCH_UNSAFE_UNRETAINED __unsafe_unretained
1517 #define CATCH_ARC_STRONG __strong
1518 #endif
1519 
1520 // end catch_objc_arc.hpp
1521 #endif
1522 
1523 #ifdef _MSC_VER
1524 #pragma warning(push)
1525 #pragma warning(disable:4180) // We attempt to stream a function (address) by const&, which MSVC complains about but is harmless
1526 #endif
1527 
1528 namespace Catch {
1529  namespace Detail {
1530 
1531  extern const std::string unprintableString;
1532 
1533  std::string rawMemoryToString( const void *object, std::size_t size );
1534 
1535  template<typename T>
1536  std::string rawMemoryToString( const T& object ) {
1537  return rawMemoryToString( &object, sizeof(object) );
1538  }
1539 
1540  template<typename T>
1542  template<typename SS, typename TT>
1543  static auto test(int)
1544  -> decltype(std::declval<SS&>() << std::declval<TT>(), std::true_type());
1545 
1546  template<typename, typename>
1547  static auto test(...)->std::false_type;
1548 
1549  public:
1550  static const bool value = decltype(test<std::ostream, const T&>(0))::value;
1551  };
1552 
1553  template<typename E>
1554  std::string convertUnknownEnumToString( E e );
1555 
1556  template<typename T>
1557  typename std::enable_if<
1558  !std::is_enum<T>::value && !std::is_base_of<std::exception, T>::value,
1559  std::string>::type convertUnstreamable( T const& ) {
1560  return Detail::unprintableString;
1561  }
1562  template<typename T>
1563  typename std::enable_if<
1564  !std::is_enum<T>::value && std::is_base_of<std::exception, T>::value,
1565  std::string>::type convertUnstreamable(T const& ex) {
1566  return ex.what();
1567  }
1568 
1569  template<typename T>
1570  typename std::enable_if<
1571  std::is_enum<T>::value
1572  , std::string>::type convertUnstreamable( T const& value ) {
1573  return convertUnknownEnumToString( value );
1574  }
1575 
1576 #if defined(_MANAGED)
1577  template<typename T>
1579  std::string clrReferenceToString( T^ ref ) {
1580  if (ref == nullptr)
1581  return std::string("null");
1582  auto bytes = System::Text::Encoding::UTF8->GetBytes(ref->ToString());
1583  cli::pin_ptr<System::Byte> p = &bytes[0];
1584  return std::string(reinterpret_cast<char const *>(p), bytes->Length);
1585  }
1586 #endif
1587 
1588  } // namespace Detail
1589 
1590  // If we decide for C++14, change these to enable_if_ts
1591  template <typename T, typename = void>
1592  struct StringMaker {
1593  template <typename Fake = T>
1594  static
1595  typename std::enable_if<::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type
1596  convert(const Fake& value) {
1598  // NB: call using the function-like syntax to avoid ambiguity with
1599  // user-defined templated operator<< under clang.
1600  rss.operator<<(value);
1601  return rss.str();
1602  }
1603 
1604  template <typename Fake = T>
1605  static
1606  typename std::enable_if<!::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type
1607  convert( const Fake& value ) {
1608 #if !defined(CATCH_CONFIG_FALLBACK_STRINGIFIER)
1609  return Detail::convertUnstreamable(value);
1610 #else
1611  return CATCH_CONFIG_FALLBACK_STRINGIFIER(value);
1612 #endif
1613  }
1614  };
1615 
1616  namespace Detail {
1617 
1618  // This function dispatches all stringification requests inside of Catch.
1619  // Should be preferably called fully qualified, like ::Catch::Detail::stringify
1620  template <typename T>
1621  std::string stringify(const T& e) {
1622  return ::Catch::StringMaker<typename std::remove_cv<typename std::remove_reference<T>::type>::type>::convert(e);
1623  }
1624 
1625  template<typename E>
1626  std::string convertUnknownEnumToString( E e ) {
1627  return ::Catch::Detail::stringify(static_cast<typename std::underlying_type<E>::type>(e));
1628  }
1629 
1630 #if defined(_MANAGED)
1631  template <typename T>
1632  std::string stringify( T^ e ) {
1633  return ::Catch::StringMaker<T^>::convert(e);
1634  }
1635 #endif
1636 
1637  } // namespace Detail
1638 
1639  // Some predefined specializations
1640 
1641  template<>
1642  struct StringMaker<std::string> {
1643  static std::string convert(const std::string& str);
1644  };
1645 
1646 #ifdef CATCH_CONFIG_CPP17_STRING_VIEW
1647  template<>
1648  struct StringMaker<std::string_view> {
1649  static std::string convert(std::string_view str);
1650  };
1651 #endif
1652 
1653  template<>
1654  struct StringMaker<char const *> {
1655  static std::string convert(char const * str);
1656  };
1657  template<>
1658  struct StringMaker<char *> {
1659  static std::string convert(char * str);
1660  };
1661 
1662 #ifdef CATCH_CONFIG_WCHAR
1663  template<>
1664  struct StringMaker<std::wstring> {
1665  static std::string convert(const std::wstring& wstr);
1666  };
1667 
1668 # ifdef CATCH_CONFIG_CPP17_STRING_VIEW
1669  template<>
1670  struct StringMaker<std::wstring_view> {
1671  static std::string convert(std::wstring_view str);
1672  };
1673 # endif
1674 
1675  template<>
1676  struct StringMaker<wchar_t const *> {
1677  static std::string convert(wchar_t const * str);
1678  };
1679  template<>
1680  struct StringMaker<wchar_t *> {
1681  static std::string convert(wchar_t * str);
1682  };
1683 #endif
1684 
1685  // TBD: Should we use `strnlen` to ensure that we don't go out of the buffer,
1686  // while keeping string semantics?
1687  template<int SZ>
1688  struct StringMaker<char[SZ]> {
1689  static std::string convert(char const* str) {
1690  return ::Catch::Detail::stringify(std::string{ str });
1691  }
1692  };
1693  template<int SZ>
1694  struct StringMaker<signed char[SZ]> {
1695  static std::string convert(signed char const* str) {
1696  return ::Catch::Detail::stringify(std::string{ reinterpret_cast<char const *>(str) });
1697  }
1698  };
1699  template<int SZ>
1700  struct StringMaker<unsigned char[SZ]> {
1701  static std::string convert(unsigned char const* str) {
1702  return ::Catch::Detail::stringify(std::string{ reinterpret_cast<char const *>(str) });
1703  }
1704  };
1705 
1706 #if defined(CATCH_CONFIG_CPP17_BYTE)
1707  template<>
1708  struct StringMaker<std::byte> {
1709  static std::string convert(std::byte value);
1710  };
1711 #endif // defined(CATCH_CONFIG_CPP17_BYTE)
1712  template<>
1713  struct StringMaker<int> {
1714  static std::string convert(int value);
1715  };
1716  template<>
1717  struct StringMaker<long> {
1718  static std::string convert(long value);
1719  };
1720  template<>
1721  struct StringMaker<long long> {
1722  static std::string convert(long long value);
1723  };
1724  template<>
1725  struct StringMaker<unsigned int> {
1726  static std::string convert(unsigned int value);
1727  };
1728  template<>
1729  struct StringMaker<unsigned long> {
1730  static std::string convert(unsigned long value);
1731  };
1732  template<>
1733  struct StringMaker<unsigned long long> {
1734  static std::string convert(unsigned long long value);
1735  };
1736 
1737  template<>
1738  struct StringMaker<bool> {
1739  static std::string convert(bool b);
1740  };
1741 
1742  template<>
1743  struct StringMaker<char> {
1744  static std::string convert(char c);
1745  };
1746  template<>
1747  struct StringMaker<signed char> {
1748  static std::string convert(signed char c);
1749  };
1750  template<>
1751  struct StringMaker<unsigned char> {
1752  static std::string convert(unsigned char c);
1753  };
1754 
1755  template<>
1756  struct StringMaker<std::nullptr_t> {
1757  static std::string convert(std::nullptr_t);
1758  };
1759 
1760  template<>
1761  struct StringMaker<float> {
1762  static std::string convert(float value);
1763  static int precision;
1764  };
1765 
1766  template<>
1767  struct StringMaker<double> {
1768  static std::string convert(double value);
1769  static int precision;
1770  };
1771 
1772  template <typename T>
1773  struct StringMaker<T*> {
1774  template <typename U>
1775  static std::string convert(U* p) {
1776  if (p) {
1777  return ::Catch::Detail::rawMemoryToString(p);
1778  } else {
1779  return "nullptr";
1780  }
1781  }
1782  };
1783 
1784  template <typename R, typename C>
1785  struct StringMaker<R C::*> {
1786  static std::string convert(R C::* p) {
1787  if (p) {
1788  return ::Catch::Detail::rawMemoryToString(p);
1789  } else {
1790  return "nullptr";
1791  }
1792  }
1793  };
1794 
1795 #if defined(_MANAGED)
1796  template <typename T>
1797  struct StringMaker<T^> {
1798  static std::string convert( T^ ref ) {
1799  return ::Catch::Detail::clrReferenceToString(ref);
1800  }
1801  };
1802 #endif
1803 
1804  namespace Detail {
1805  template<typename InputIterator>
1806  std::string rangeToString(InputIterator first, InputIterator last) {
1808  rss << "{ ";
1809  if (first != last) {
1810  rss << ::Catch::Detail::stringify(*first);
1811  for (++first; first != last; ++first)
1812  rss << ", " << ::Catch::Detail::stringify(*first);
1813  }
1814  rss << " }";
1815  return rss.str();
1816  }
1817  }
1818 
1819 #ifdef __OBJC__
1820  template<>
1821  struct StringMaker<NSString*> {
1822  static std::string convert(NSString * nsstring) {
1823  if (!nsstring)
1824  return "nil";
1825  return std::string("@") + [nsstring UTF8String];
1826  }
1827  };
1828  template<>
1829  struct StringMaker<NSObject*> {
1830  static std::string convert(NSObject* nsObject) {
1831  return ::Catch::Detail::stringify([nsObject description]);
1832  }
1833 
1834  };
1835  namespace Detail {
1836  inline std::string stringify( NSString* nsstring ) {
1837  return StringMaker<NSString*>::convert( nsstring );
1838  }
1839 
1840  } // namespace Detail
1841 #endif // __OBJC__
1842 
1843 } // namespace Catch
1844 
1846 // Separate std-lib types stringification, so it can be selectively enabled
1847 // This means that we do not bring in
1848 
1849 #if defined(CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS)
1850 # define CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER
1851 # define CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER
1852 # define CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER
1853 # define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
1854 # define CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER
1855 #endif
1856 
1857 // Separate std::pair specialization
1858 #if defined(CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER)
1859 #include <utility>
1860 namespace Catch {
1861  template<typename T1, typename T2>
1862  struct StringMaker<std::pair<T1, T2> > {
1863  static std::string convert(const std::pair<T1, T2>& pair) {
1865  rss << "{ "
1866  << ::Catch::Detail::stringify(pair.first)
1867  << ", "
1868  << ::Catch::Detail::stringify(pair.second)
1869  << " }";
1870  return rss.str();
1871  }
1872  };
1873 }
1874 #endif // CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER
1875 
1876 #if defined(CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER) && defined(CATCH_CONFIG_CPP17_OPTIONAL)
1877 #include <optional>
1878 namespace Catch {
1879  template<typename T>
1880  struct StringMaker<std::optional<T> > {
1881  static std::string convert(const std::optional<T>& optional) {
1883  if (optional.has_value()) {
1884  rss << ::Catch::Detail::stringify(*optional);
1885  } else {
1886  rss << "{ }";
1887  }
1888  return rss.str();
1889  }
1890  };
1891 }
1892 #endif // CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER
1893 
1894 // Separate std::tuple specialization
1895 #if defined(CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER)
1896 #include <tuple>
1897 namespace Catch {
1898  namespace Detail {
1899  template<
1900  typename Tuple,
1901  std::size_t N = 0,
1902  bool = (N < std::tuple_size<Tuple>::value)
1903  >
1904  struct TupleElementPrinter {
1905  static void print(const Tuple& tuple, std::ostream& os) {
1906  os << (N ? ", " : " ")
1907  << ::Catch::Detail::stringify(std::get<N>(tuple));
1908  TupleElementPrinter<Tuple, N + 1>::print(tuple, os);
1909  }
1910  };
1911 
1912  template<
1913  typename Tuple,
1914  std::size_t N
1915  >
1916  struct TupleElementPrinter<Tuple, N, false> {
1917  static void print(const Tuple&, std::ostream&) {}
1918  };
1919 
1920  }
1921 
1922  template<typename ...Types>
1923  struct StringMaker<std::tuple<Types...>> {
1924  static std::string convert(const std::tuple<Types...>& tuple) {
1926  rss << '{';
1927  Detail::TupleElementPrinter<std::tuple<Types...>>::print(tuple, rss.get());
1928  rss << " }";
1929  return rss.str();
1930  }
1931  };
1932 }
1933 #endif // CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER
1934 
1935 #if defined(CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER) && defined(CATCH_CONFIG_CPP17_VARIANT)
1936 #include <variant>
1937 namespace Catch {
1938  template<>
1939  struct StringMaker<std::monostate> {
1940  static std::string convert(const std::monostate&) {
1941  return "{ }";
1942  }
1943  };
1944 
1945  template<typename... Elements>
1946  struct StringMaker<std::variant<Elements...>> {
1947  static std::string convert(const std::variant<Elements...>& variant) {
1948  if (variant.valueless_by_exception()) {
1949  return "{valueless variant}";
1950  } else {
1951  return std::visit(
1952  [](const auto& value) {
1953  return ::Catch::Detail::stringify(value);
1954  },
1955  variant
1956  );
1957  }
1958  }
1959  };
1960 }
1961 #endif // CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER
1962 
1963 namespace Catch {
1964  struct not_this_one {}; // Tag type for detecting which begin/ end are being selected
1965 
1966  // Import begin/ end from std here so they are considered alongside the fallback (...) overloads in this namespace
1967  using std::begin;
1968  using std::end;
1969 
1970  not_this_one begin( ... );
1971  not_this_one end( ... );
1972 
1973  template <typename T>
1974  struct is_range {
1975  static const bool value =
1976  !std::is_same<decltype(begin(std::declval<T>())), not_this_one>::value &&
1977  !std::is_same<decltype(end(std::declval<T>())), not_this_one>::value;
1978  };
1979 
1980 #if defined(_MANAGED) // Managed types are never ranges
1981  template <typename T>
1982  struct is_range<T^> {
1983  static const bool value = false;
1984  };
1985 #endif
1986 
1987  template<typename Range>
1988  std::string rangeToString( Range const& range ) {
1989  return ::Catch::Detail::rangeToString( begin( range ), end( range ) );
1990  }
1991 
1992  // Handle vector<bool> specially
1993  template<typename Allocator>
1994  std::string rangeToString( std::vector<bool, Allocator> const& v ) {
1996  rss << "{ ";
1997  bool first = true;
1998  for( bool b : v ) {
1999  if( first )
2000  first = false;
2001  else
2002  rss << ", ";
2003  rss << ::Catch::Detail::stringify( b );
2004  }
2005  rss << " }";
2006  return rss.str();
2007  }
2008 
2009  template<typename R>
2010  struct StringMaker<R, typename std::enable_if<is_range<R>::value && !::Catch::Detail::IsStreamInsertable<R>::value>::type> {
2011  static std::string convert( R const& range ) {
2012  return rangeToString( range );
2013  }
2014  };
2015 
2016  template <typename T, int SZ>
2017  struct StringMaker<T[SZ]> {
2018  static std::string convert(T const(&arr)[SZ]) {
2019  return rangeToString(arr);
2020  }
2021  };
2022 
2023 } // namespace Catch
2024 
2025 // Separate std::chrono::duration specialization
2026 #if defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER)
2027 #include <ctime>
2028 #include <ratio>
2029 #include <chrono>
2030 
2031 namespace Catch {
2032 
2033 template <class Ratio>
2034 struct ratio_string {
2035  static std::string symbol();
2036 };
2037 
2038 template <class Ratio>
2039 std::string ratio_string<Ratio>::symbol() {
2041  rss << '[' << Ratio::num << '/'
2042  << Ratio::den << ']';
2043  return rss.str();
2044 }
2045 template <>
2046 struct ratio_string<std::atto> {
2047  static std::string symbol();
2048 };
2049 template <>
2050 struct ratio_string<std::femto> {
2051  static std::string symbol();
2052 };
2053 template <>
2054 struct ratio_string<std::pico> {
2055  static std::string symbol();
2056 };
2057 template <>
2058 struct ratio_string<std::nano> {
2059  static std::string symbol();
2060 };
2061 template <>
2062 struct ratio_string<std::micro> {
2063  static std::string symbol();
2064 };
2065 template <>
2066 struct ratio_string<std::milli> {
2067  static std::string symbol();
2068 };
2069 
2071  // std::chrono::duration specializations
2072  template<typename Value, typename Ratio>
2073  struct StringMaker<std::chrono::duration<Value, Ratio>> {
2074  static std::string convert(std::chrono::duration<Value, Ratio> const& duration) {
2076  rss << duration.count() << ' ' << ratio_string<Ratio>::symbol() << 's';
2077  return rss.str();
2078  }
2079  };
2080  template<typename Value>
2081  struct StringMaker<std::chrono::duration<Value, std::ratio<1>>> {
2082  static std::string convert(std::chrono::duration<Value, std::ratio<1>> const& duration) {
2084  rss << duration.count() << " s";
2085  return rss.str();
2086  }
2087  };
2088  template<typename Value>
2089  struct StringMaker<std::chrono::duration<Value, std::ratio<60>>> {
2090  static std::string convert(std::chrono::duration<Value, std::ratio<60>> const& duration) {
2092  rss << duration.count() << " m";
2093  return rss.str();
2094  }
2095  };
2096  template<typename Value>
2097  struct StringMaker<std::chrono::duration<Value, std::ratio<3600>>> {
2098  static std::string convert(std::chrono::duration<Value, std::ratio<3600>> const& duration) {
2100  rss << duration.count() << " h";
2101  return rss.str();
2102  }
2103  };
2104 
2106  // std::chrono::time_point specialization
2107  // Generic time_point cannot be specialized, only std::chrono::time_point<system_clock>
2108  template<typename Clock, typename Duration>
2109  struct StringMaker<std::chrono::time_point<Clock, Duration>> {
2110  static std::string convert(std::chrono::time_point<Clock, Duration> const& time_point) {
2111  return ::Catch::Detail::stringify(time_point.time_since_epoch()) + " since epoch";
2112  }
2113  };
2114  // std::chrono::time_point<system_clock> specialization
2115  template<typename Duration>
2116  struct StringMaker<std::chrono::time_point<std::chrono::system_clock, Duration>> {
2117  static std::string convert(std::chrono::time_point<std::chrono::system_clock, Duration> const& time_point) {
2118  auto converted = std::chrono::system_clock::to_time_t(time_point);
2119 
2120 #ifdef _MSC_VER
2121  std::tm timeInfo = {};
2122  gmtime_s(&timeInfo, &converted);
2123 #else
2124  std::tm* timeInfo = std::gmtime(&converted);
2125 #endif
2126 
2127  auto const timeStampSize = sizeof("2017-01-16T17:06:45Z");
2128  char timeStamp[timeStampSize];
2129  const char * const fmt = "%Y-%m-%dT%H:%M:%SZ";
2130 
2131 #ifdef _MSC_VER
2132  std::strftime(timeStamp, timeStampSize, fmt, &timeInfo);
2133 #else
2134  std::strftime(timeStamp, timeStampSize, fmt, timeInfo);
2135 #endif
2136  return std::string(timeStamp);
2137  }
2138  };
2139 }
2140 #endif // CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
2141 
2142 #define INTERNAL_CATCH_REGISTER_ENUM( enumName, ... ) \
2143 namespace Catch { \
2144  template<> struct StringMaker<enumName> { \
2145  static std::string convert( enumName value ) { \
2146  static const auto& enumInfo = ::Catch::getMutableRegistryHub().getMutableEnumValuesRegistry().registerEnum( #enumName, #__VA_ARGS__, { __VA_ARGS__ } ); \
2147  return enumInfo.lookup( static_cast<int>( value ) ); \
2148  } \
2149  }; \
2150 }
2151 
2152 #define CATCH_REGISTER_ENUM( enumName, ... ) INTERNAL_CATCH_REGISTER_ENUM( enumName, __VA_ARGS__ )
2153 
2154 #ifdef _MSC_VER
2155 #pragma warning(pop)
2156 #endif
2157 
2158 // end catch_tostring.h
2159 #include <iosfwd>
2160 
2161 #ifdef _MSC_VER
2162 #pragma warning(push)
2163 #pragma warning(disable:4389) // '==' : signed/unsigned mismatch
2164 #pragma warning(disable:4018) // more "signed/unsigned mismatch"
2165 #pragma warning(disable:4312) // Converting int to T* using reinterpret_cast (issue on x64 platform)
2166 #pragma warning(disable:4180) // qualifier applied to function type has no meaning
2167 #pragma warning(disable:4800) // Forcing result to true or false
2168 #endif
2169 
2170 namespace Catch {
2171 
2173  auto isBinaryExpression() const -> bool { return m_isBinaryExpression; }
2174  auto getResult() const -> bool { return m_result; }
2175  virtual void streamReconstructedExpression( std::ostream &os ) const = 0;
2176 
2177  ITransientExpression( bool isBinaryExpression, bool result )
2178  : m_isBinaryExpression( isBinaryExpression ),
2179  m_result( result )
2180  {}
2181 
2182  // We don't actually need a virtual destructor, but many static analysers
2183  // complain if it's not here :-(
2184  virtual ~ITransientExpression();
2185 
2186  bool m_isBinaryExpression;
2187  bool m_result;
2188 
2189  };
2190 
2191  void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs );
2192 
2193  template<typename LhsT, typename RhsT>
2195  LhsT m_lhs;
2196  StringRef m_op;
2197  RhsT m_rhs;
2198 
2199  void streamReconstructedExpression( std::ostream &os ) const override {
2200  formatReconstructedExpression
2201  ( os, Catch::Detail::stringify( m_lhs ), m_op, Catch::Detail::stringify( m_rhs ) );
2202  }
2203 
2204  public:
2205  BinaryExpr( bool comparisonResult, LhsT lhs, StringRef op, RhsT rhs )
2206  : ITransientExpression{ true, comparisonResult },
2207  m_lhs( lhs ),
2208  m_op( op ),
2209  m_rhs( rhs )
2210  {}
2211 
2212  template<typename T>
2213  auto operator && ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {
2214  static_assert(always_false<T>::value,
2215  "chained comparisons are not supported inside assertions, "
2216  "wrap the expression inside parentheses, or decompose it");
2217  }
2218 
2219  template<typename T>
2220  auto operator || ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {
2221  static_assert(always_false<T>::value,
2222  "chained comparisons are not supported inside assertions, "
2223  "wrap the expression inside parentheses, or decompose it");
2224  }
2225 
2226  template<typename T>
2227  auto operator == ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {
2228  static_assert(always_false<T>::value,
2229  "chained comparisons are not supported inside assertions, "
2230  "wrap the expression inside parentheses, or decompose it");
2231  }
2232 
2233  template<typename T>
2234  auto operator != ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {
2235  static_assert(always_false<T>::value,
2236  "chained comparisons are not supported inside assertions, "
2237  "wrap the expression inside parentheses, or decompose it");
2238  }
2239 
2240  template<typename T>
2241  auto operator > ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {
2242  static_assert(always_false<T>::value,
2243  "chained comparisons are not supported inside assertions, "
2244  "wrap the expression inside parentheses, or decompose it");
2245  }
2246 
2247  template<typename T>
2248  auto operator < ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {
2249  static_assert(always_false<T>::value,
2250  "chained comparisons are not supported inside assertions, "
2251  "wrap the expression inside parentheses, or decompose it");
2252  }
2253 
2254  template<typename T>
2255  auto operator >= ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {
2256  static_assert(always_false<T>::value,
2257  "chained comparisons are not supported inside assertions, "
2258  "wrap the expression inside parentheses, or decompose it");
2259  }
2260 
2261  template<typename T>
2262  auto operator <= ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {
2263  static_assert(always_false<T>::value,
2264  "chained comparisons are not supported inside assertions, "
2265  "wrap the expression inside parentheses, or decompose it");
2266  }
2267  };
2268 
2269  template<typename LhsT>
2271  LhsT m_lhs;
2272 
2273  void streamReconstructedExpression( std::ostream &os ) const override {
2274  os << Catch::Detail::stringify( m_lhs );
2275  }
2276 
2277  public:
2278  explicit UnaryExpr( LhsT lhs )
2279  : ITransientExpression{ false, static_cast<bool>(lhs) },
2280  m_lhs( lhs )
2281  {}
2282  };
2283 
2284  // Specialised comparison functions to handle equality comparisons between ints and pointers (NULL deduces as an int)
2285  template<typename LhsT, typename RhsT>
2286  auto compareEqual( LhsT const& lhs, RhsT const& rhs ) -> bool { return static_cast<bool>(lhs == rhs); }
2287  template<typename T>
2288  auto compareEqual( T* const& lhs, int rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); }
2289  template<typename T>
2290  auto compareEqual( T* const& lhs, long rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); }
2291  template<typename T>
2292  auto compareEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; }
2293  template<typename T>
2294  auto compareEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; }
2295 
2296  template<typename LhsT, typename RhsT>
2297  auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return static_cast<bool>(lhs != rhs); }
2298  template<typename T>
2299  auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); }
2300  template<typename T>
2301  auto compareNotEqual( T* const& lhs, long rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); }
2302  template<typename T>
2303  auto compareNotEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) != rhs; }
2304  template<typename T>
2305  auto compareNotEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) != rhs; }
2306 
2307  template<typename LhsT>
2308  class ExprLhs {
2309  LhsT m_lhs;
2310  public:
2311  explicit ExprLhs( LhsT lhs ) : m_lhs( lhs ) {}
2312 
2313  template<typename RhsT>
2314  auto operator == ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
2315  return { compareEqual( m_lhs, rhs ), m_lhs, "==", rhs };
2316  }
2317  auto operator == ( bool rhs ) -> BinaryExpr<LhsT, bool> const {
2318  return { m_lhs == rhs, m_lhs, "==", rhs };
2319  }
2320 
2321  template<typename RhsT>
2322  auto operator != ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
2323  return { compareNotEqual( m_lhs, rhs ), m_lhs, "!=", rhs };
2324  }
2325  auto operator != ( bool rhs ) -> BinaryExpr<LhsT, bool> const {
2326  return { m_lhs != rhs, m_lhs, "!=", rhs };
2327  }
2328 
2329  template<typename RhsT>
2330  auto operator > ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
2331  return { static_cast<bool>(m_lhs > rhs), m_lhs, ">", rhs };
2332  }
2333  template<typename RhsT>
2334  auto operator < ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
2335  return { static_cast<bool>(m_lhs < rhs), m_lhs, "<", rhs };
2336  }
2337  template<typename RhsT>
2338  auto operator >= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
2339  return { static_cast<bool>(m_lhs >= rhs), m_lhs, ">=", rhs };
2340  }
2341  template<typename RhsT>
2342  auto operator <= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
2343  return { static_cast<bool>(m_lhs <= rhs), m_lhs, "<=", rhs };
2344  }
2345 
2346  template<typename RhsT>
2347  auto operator && ( RhsT const& ) -> BinaryExpr<LhsT, RhsT const&> const {
2348  static_assert(always_false<RhsT>::value,
2349  "operator&& is not supported inside assertions, "
2350  "wrap the expression inside parentheses, or decompose it");
2351  }
2352 
2353  template<typename RhsT>
2354  auto operator || ( RhsT const& ) -> BinaryExpr<LhsT, RhsT const&> const {
2355  static_assert(always_false<RhsT>::value,
2356  "operator|| is not supported inside assertions, "
2357  "wrap the expression inside parentheses, or decompose it");
2358  }
2359 
2360  auto makeUnaryExpr() const -> UnaryExpr<LhsT> {
2361  return UnaryExpr<LhsT>{ m_lhs };
2362  }
2363  };
2364 
2365  void handleExpression( ITransientExpression const& expr );
2366 
2367  template<typename T>
2368  void handleExpression( ExprLhs<T> const& expr ) {
2369  handleExpression( expr.makeUnaryExpr() );
2370  }
2371 
2372  struct Decomposer {
2373  template<typename T>
2374  auto operator <= ( T const& lhs ) -> ExprLhs<T const&> {
2375  return ExprLhs<T const&>{ lhs };
2376  }
2377 
2378  auto operator <=( bool value ) -> ExprLhs<bool> {
2379  return ExprLhs<bool>{ value };
2380  }
2381  };
2382 
2383 } // end namespace Catch
2384 
2385 #ifdef _MSC_VER
2386 #pragma warning(pop)
2387 #endif
2388 
2389 // end catch_decomposer.h
2390 // start catch_interfaces_capture.h
2391 
2392 #include <string>
2393 #include <chrono>
2394 
2395 namespace Catch {
2396 
2397  class AssertionResult;
2398  struct AssertionInfo;
2399  struct SectionInfo;
2400  struct SectionEndInfo;
2401  struct MessageInfo;
2402  struct MessageBuilder;
2403  struct Counts;
2404  struct AssertionReaction;
2405  struct SourceLineInfo;
2406 
2407  struct ITransientExpression;
2408  struct IGeneratorTracker;
2409 
2410 #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
2411  struct BenchmarkInfo;
2412  template <typename Duration = std::chrono::duration<double, std::nano>>
2413  struct BenchmarkStats;
2414 #endif // CATCH_CONFIG_ENABLE_BENCHMARKING
2415 
2417 
2418  virtual ~IResultCapture();
2419 
2420  virtual bool sectionStarted( SectionInfo const& sectionInfo,
2421  Counts& assertions ) = 0;
2422  virtual void sectionEnded( SectionEndInfo const& endInfo ) = 0;
2423  virtual void sectionEndedEarly( SectionEndInfo const& endInfo ) = 0;
2424 
2425  virtual auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& = 0;
2426 
2427 #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
2428  virtual void benchmarkPreparing( std::string const& name ) = 0;
2429  virtual void benchmarkStarting( BenchmarkInfo const& info ) = 0;
2430  virtual void benchmarkEnded( BenchmarkStats<> const& stats ) = 0;
2431  virtual void benchmarkFailed( std::string const& error ) = 0;
2432 #endif // CATCH_CONFIG_ENABLE_BENCHMARKING
2433 
2434  virtual void pushScopedMessage( MessageInfo const& message ) = 0;
2435  virtual void popScopedMessage( MessageInfo const& message ) = 0;
2436 
2437  virtual void emplaceUnscopedMessage( MessageBuilder const& builder ) = 0;
2438 
2439  virtual void handleFatalErrorCondition( StringRef message ) = 0;
2440 
2441  virtual void handleExpr
2442  ( AssertionInfo const& info,
2443  ITransientExpression const& expr,
2444  AssertionReaction& reaction ) = 0;
2445  virtual void handleMessage
2446  ( AssertionInfo const& info,
2447  ResultWas::OfType resultType,
2448  StringRef const& message,
2449  AssertionReaction& reaction ) = 0;
2450  virtual void handleUnexpectedExceptionNotThrown
2451  ( AssertionInfo const& info,
2452  AssertionReaction& reaction ) = 0;
2453  virtual void handleUnexpectedInflightException
2454  ( AssertionInfo const& info,
2455  std::string const& message,
2456  AssertionReaction& reaction ) = 0;
2457  virtual void handleIncomplete
2458  ( AssertionInfo const& info ) = 0;
2459  virtual void handleNonExpr
2460  ( AssertionInfo const &info,
2461  ResultWas::OfType resultType,
2462  AssertionReaction &reaction ) = 0;
2463 
2464  virtual bool lastAssertionPassed() = 0;
2465  virtual void assertionPassed() = 0;
2466 
2467  // Deprecated, do not use:
2468  virtual std::string getCurrentTestName() const = 0;
2469  virtual const AssertionResult* getLastResult() const = 0;
2470  virtual void exceptionEarlyReported() = 0;
2471  };
2472 
2473  IResultCapture& getResultCapture();
2474 }
2475 
2476 // end catch_interfaces_capture.h
2477 namespace Catch {
2478 
2480  struct AssertionResultData;
2481  struct IResultCapture;
2482  class RunContext;
2483 
2485  friend class AssertionHandler;
2486  friend struct AssertionStats;
2487  friend class RunContext;
2488 
2489  ITransientExpression const* m_transientExpression = nullptr;
2490  bool m_isNegated;
2491  public:
2492  LazyExpression( bool isNegated );
2493  LazyExpression( LazyExpression const& other );
2494  LazyExpression& operator = ( LazyExpression const& ) = delete;
2495 
2496  explicit operator bool() const;
2497 
2498  friend auto operator << ( std::ostream& os, LazyExpression const& lazyExpr ) -> std::ostream&;
2499  };
2500 
2502  bool shouldDebugBreak = false;
2503  bool shouldThrow = false;
2504  };
2505 
2507  AssertionInfo m_assertionInfo;
2508  AssertionReaction m_reaction;
2509  bool m_completed = false;
2510  IResultCapture& m_resultCapture;
2511 
2512  public:
2514  ( StringRef const& macroName,
2515  SourceLineInfo const& lineInfo,
2516  StringRef capturedExpression,
2517  ResultDisposition::Flags resultDisposition );
2518  ~AssertionHandler() {
2519  if ( !m_completed ) {
2520  m_resultCapture.handleIncomplete( m_assertionInfo );
2521  }
2522  }
2523 
2524  template<typename T>
2525  void handleExpr( ExprLhs<T> const& expr ) {
2526  handleExpr( expr.makeUnaryExpr() );
2527  }
2528  void handleExpr( ITransientExpression const& expr );
2529 
2530  void handleMessage(ResultWas::OfType resultType, StringRef const& message);
2531 
2532  void handleExceptionThrownAsExpected();
2533  void handleUnexpectedExceptionNotThrown();
2534  void handleExceptionNotThrownAsExpected();
2535  void handleThrowingCallSkipped();
2536  void handleUnexpectedInflightException();
2537 
2538  void complete();
2539  void setCompleted();
2540 
2541  // query
2542  auto allowThrows() const -> bool;
2543  };
2544 
2545  void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef const& matcherString );
2546 
2547 } // namespace Catch
2548 
2549 // end catch_assertionhandler.h
2550 // start catch_message.h
2551 
2552 #include <string>
2553 #include <vector>
2554 
2555 namespace Catch {
2556 
2557  struct MessageInfo {
2558  MessageInfo( StringRef const& _macroName,
2559  SourceLineInfo const& _lineInfo,
2560  ResultWas::OfType _type );
2561 
2562  StringRef macroName;
2563  std::string message;
2564  SourceLineInfo lineInfo;
2565  ResultWas::OfType type;
2566  unsigned int sequence;
2567 
2568  bool operator == ( MessageInfo const& other ) const;
2569  bool operator < ( MessageInfo const& other ) const;
2570  private:
2571  static unsigned int globalCount;
2572  };
2573 
2574  struct MessageStream {
2575 
2576  template<typename T>
2577  MessageStream& operator << ( T const& value ) {
2578  m_stream << value;
2579  return *this;
2580  }
2581 
2582  ReusableStringStream m_stream;
2583  };
2584 
2586  MessageBuilder( StringRef const& macroName,
2587  SourceLineInfo const& lineInfo,
2588  ResultWas::OfType type );
2589 
2590  template<typename T>
2591  MessageBuilder& operator << ( T const& value ) {
2592  m_stream << value;
2593  return *this;
2594  }
2595 
2596  MessageInfo m_info;
2597  };
2598 
2600  public:
2601  explicit ScopedMessage( MessageBuilder const& builder );
2602  ScopedMessage( ScopedMessage& duplicate ) = delete;
2603  ScopedMessage( ScopedMessage&& old );
2604  ~ScopedMessage();
2605 
2606  MessageInfo m_info;
2607  bool m_moved;
2608  };
2609 
2610  class Capturer {
2611  std::vector<MessageInfo> m_messages;
2612  IResultCapture& m_resultCapture = getResultCapture();
2613  size_t m_captured = 0;
2614  public:
2615  Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names );
2616  ~Capturer();
2617 
2618  void captureValue( size_t index, std::string const& value );
2619 
2620  template<typename T>
2621  void captureValues( size_t index, T const& value ) {
2622  captureValue( index, Catch::Detail::stringify( value ) );
2623  }
2624 
2625  template<typename T, typename... Ts>
2626  void captureValues( size_t index, T const& value, Ts const&... values ) {
2627  captureValue( index, Catch::Detail::stringify(value) );
2628  captureValues( index+1, values... );
2629  }
2630  };
2631 
2632 } // end namespace Catch
2633 
2634 // end catch_message.h
2635 #if !defined(CATCH_CONFIG_DISABLE)
2636 
2637 #if !defined(CATCH_CONFIG_DISABLE_STRINGIFICATION)
2638  #define CATCH_INTERNAL_STRINGIFY(...) #__VA_ARGS__
2639 #else
2640  #define CATCH_INTERNAL_STRINGIFY(...) "Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION"
2641 #endif
2642 
2643 #if defined(CATCH_CONFIG_FAST_COMPILE) || defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
2644 
2646 // Another way to speed-up compilation is to omit local try-catch for REQUIRE*
2647 // macros.
2648 #define INTERNAL_CATCH_TRY
2649 #define INTERNAL_CATCH_CATCH( capturer )
2650 
2651 #else // CATCH_CONFIG_FAST_COMPILE
2652 
2653 #define INTERNAL_CATCH_TRY try
2654 #define INTERNAL_CATCH_CATCH( handler ) catch(...) { handler.handleUnexpectedInflightException(); }
2655 
2656 #endif
2657 
2658 #define INTERNAL_CATCH_REACT( handler ) handler.complete();
2659 
2661 #define INTERNAL_CATCH_TEST( macroName, resultDisposition, ... ) \
2662  do { \
2663  Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \
2664  INTERNAL_CATCH_TRY { \
2665  CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \
2666  catchAssertionHandler.handleExpr( Catch::Decomposer() <= __VA_ARGS__ ); \
2667  CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \
2668  } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \
2669  INTERNAL_CATCH_REACT( catchAssertionHandler ) \
2670  } while( (void)0, (false) && static_cast<bool>( !!(__VA_ARGS__) ) ) // the expression here is never evaluated at runtime but it forces the compiler to give it a look
2671  // The double negation silences MSVC's C4800 warning, the static_cast forces short-circuit evaluation if the type has overloaded &&.
2672 
2674 #define INTERNAL_CATCH_IF( macroName, resultDisposition, ... ) \
2675  INTERNAL_CATCH_TEST( macroName, resultDisposition, __VA_ARGS__ ); \
2676  if( Catch::getResultCapture().lastAssertionPassed() )
2677 
2679 #define INTERNAL_CATCH_ELSE( macroName, resultDisposition, ... ) \
2680  INTERNAL_CATCH_TEST( macroName, resultDisposition, __VA_ARGS__ ); \
2681  if( !Catch::getResultCapture().lastAssertionPassed() )
2682 
2684 #define INTERNAL_CATCH_NO_THROW( macroName, resultDisposition, ... ) \
2685  do { \
2686  Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \
2687  try { \
2688  static_cast<void>(__VA_ARGS__); \
2689  catchAssertionHandler.handleExceptionNotThrownAsExpected(); \
2690  } \
2691  catch( ... ) { \
2692  catchAssertionHandler.handleUnexpectedInflightException(); \
2693  } \
2694  INTERNAL_CATCH_REACT( catchAssertionHandler ) \
2695  } while( false )
2696 
2698 #define INTERNAL_CATCH_THROWS( macroName, resultDisposition, ... ) \
2699  do { \
2700  Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition); \
2701  if( catchAssertionHandler.allowThrows() ) \
2702  try { \
2703  static_cast<void>(__VA_ARGS__); \
2704  catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \
2705  } \
2706  catch( ... ) { \
2707  catchAssertionHandler.handleExceptionThrownAsExpected(); \
2708  } \
2709  else \
2710  catchAssertionHandler.handleThrowingCallSkipped(); \
2711  INTERNAL_CATCH_REACT( catchAssertionHandler ) \
2712  } while( false )
2713 
2715 #define INTERNAL_CATCH_THROWS_AS( macroName, exceptionType, resultDisposition, expr ) \
2716  do { \
2717  Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(expr) ", " CATCH_INTERNAL_STRINGIFY(exceptionType), resultDisposition ); \
2718  if( catchAssertionHandler.allowThrows() ) \
2719  try { \
2720  static_cast<void>(expr); \
2721  catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \
2722  } \
2723  catch( exceptionType const& ) { \
2724  catchAssertionHandler.handleExceptionThrownAsExpected(); \
2725  } \
2726  catch( ... ) { \
2727  catchAssertionHandler.handleUnexpectedInflightException(); \
2728  } \
2729  else \
2730  catchAssertionHandler.handleThrowingCallSkipped(); \
2731  INTERNAL_CATCH_REACT( catchAssertionHandler ) \
2732  } while( false )
2733 
2735 #define INTERNAL_CATCH_MSG( macroName, messageType, resultDisposition, ... ) \
2736  do { \
2737  Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::StringRef(), resultDisposition ); \
2738  catchAssertionHandler.handleMessage( messageType, ( Catch::MessageStream() << __VA_ARGS__ + ::Catch::StreamEndStop() ).m_stream.str() ); \
2739  INTERNAL_CATCH_REACT( catchAssertionHandler ) \
2740  } while( false )
2741 
2743 #define INTERNAL_CATCH_CAPTURE( varName, macroName, ... ) \
2744  auto varName = Catch::Capturer( macroName, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info, #__VA_ARGS__ ); \
2745  varName.captureValues( 0, __VA_ARGS__ )
2746 
2748 #define INTERNAL_CATCH_INFO( macroName, log ) \
2749  Catch::ScopedMessage INTERNAL_CATCH_UNIQUE_NAME( scopedMessage )( Catch::MessageBuilder( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log );
2750 
2752 #define INTERNAL_CATCH_UNSCOPED_INFO( macroName, log ) \
2753  Catch::getResultCapture().emplaceUnscopedMessage( Catch::MessageBuilder( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log )
2754 
2756 // Although this is matcher-based, it can be used with just a string
2757 #define INTERNAL_CATCH_THROWS_STR_MATCHES( macroName, resultDisposition, matcher, ... ) \
2758  do { \
2759  Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \
2760  if( catchAssertionHandler.allowThrows() ) \
2761  try { \
2762  static_cast<void>(__VA_ARGS__); \
2763  catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \
2764  } \
2765  catch( ... ) { \
2766  Catch::handleExceptionMatchExpr( catchAssertionHandler, matcher, #matcher##_catch_sr ); \
2767  } \
2768  else \
2769  catchAssertionHandler.handleThrowingCallSkipped(); \
2770  INTERNAL_CATCH_REACT( catchAssertionHandler ) \
2771  } while( false )
2772 
2773 #endif // CATCH_CONFIG_DISABLE
2774 
2775 // end catch_capture.hpp
2776 // start catch_section.h
2777 
2778 // start catch_section_info.h
2779 
2780 // start catch_totals.h
2781 
2782 #include <cstddef>
2783 
2784 namespace Catch {
2785 
2786  struct Counts {
2787  Counts operator - ( Counts const& other ) const;
2788  Counts& operator += ( Counts const& other );
2789 
2790  std::size_t total() const;
2791  bool allPassed() const;
2792  bool allOk() const;
2793 
2794  std::size_t passed = 0;
2795  std::size_t failed = 0;
2796  std::size_t failedButOk = 0;
2797  };
2798 
2799  struct Totals {
2800 
2801  Totals operator - ( Totals const& other ) const;
2802  Totals& operator += ( Totals const& other );
2803 
2804  Totals delta( Totals const& prevTotals ) const;
2805 
2806  int error = 0;
2807  Counts assertions;
2808  Counts testCases;
2809  };
2810 }
2811 
2812 // end catch_totals.h
2813 #include <string>
2814 
2815 namespace Catch {
2816 
2817  struct SectionInfo {
2818  SectionInfo
2819  ( SourceLineInfo const& _lineInfo,
2820  std::string const& _name );
2821 
2822  // Deprecated
2823  SectionInfo
2824  ( SourceLineInfo const& _lineInfo,
2825  std::string const& _name,
2826  std::string const& ) : SectionInfo( _lineInfo, _name ) {}
2827 
2828  std::string name;
2829  std::string description; // !Deprecated: this will always be empty
2830  SourceLineInfo lineInfo;
2831  };
2832 
2834  SectionInfo sectionInfo;
2835  Counts prevAssertions;
2836  double durationInSeconds;
2837  };
2838 
2839 } // end namespace Catch
2840 
2841 // end catch_section_info.h
2842 // start catch_timer.h
2843 
2844 #include <cstdint>
2845 
2846 namespace Catch {
2847 
2848  auto getCurrentNanosecondsSinceEpoch() -> uint64_t;
2849  auto getEstimatedClockResolution() -> uint64_t;
2850 
2851  class Timer {
2852  uint64_t m_nanoseconds = 0;
2853  public:
2854  void start();
2855  auto getElapsedNanoseconds() const -> uint64_t;
2856  auto getElapsedMicroseconds() const -> uint64_t;
2857  auto getElapsedMilliseconds() const -> unsigned int;
2858  auto getElapsedSeconds() const -> double;
2859  };
2860 
2861 } // namespace Catch
2862 
2863 // end catch_timer.h
2864 #include <string>
2865 
2866 namespace Catch {
2867 
2869  public:
2870  Section( SectionInfo const& info );
2871  ~Section();
2872 
2873  // This indicates whether the section should be executed or not
2874  explicit operator bool() const;
2875 
2876  private:
2877  SectionInfo m_info;
2878 
2879  std::string m_name;
2880  Counts m_assertions;
2881  bool m_sectionIncluded;
2882  Timer m_timer;
2883  };
2884 
2885 } // end namespace Catch
2886 
2887 #define INTERNAL_CATCH_SECTION( ... ) \
2888  CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \
2889  if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) ) \
2890  CATCH_INTERNAL_UNSUPPRESS_UNUSED_WARNINGS
2891 
2892 #define INTERNAL_CATCH_DYNAMIC_SECTION( ... ) \
2893  CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \
2894  if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, (Catch::ReusableStringStream() << __VA_ARGS__).str() ) ) \
2895  CATCH_INTERNAL_UNSUPPRESS_UNUSED_WARNINGS
2896 
2897 // end catch_section.h
2898 // start catch_interfaces_exception.h
2899 
2900 // start catch_interfaces_registry_hub.h
2901 
2902 #include <string>
2903 #include <memory>
2904 
2905 namespace Catch {
2906 
2907  class TestCase;
2908  struct ITestCaseRegistry;
2910  struct IExceptionTranslator;
2911  struct IReporterRegistry;
2912  struct IReporterFactory;
2913  struct ITagAliasRegistry;
2915 
2916  class StartupExceptionRegistry;
2917 
2918  using IReporterFactoryPtr = std::shared_ptr<IReporterFactory>;
2919 
2920  struct IRegistryHub {
2921  virtual ~IRegistryHub();
2922 
2923  virtual IReporterRegistry const& getReporterRegistry() const = 0;
2924  virtual ITestCaseRegistry const& getTestCaseRegistry() const = 0;
2925  virtual ITagAliasRegistry const& getTagAliasRegistry() const = 0;
2926  virtual IExceptionTranslatorRegistry const& getExceptionTranslatorRegistry() const = 0;
2927 
2928  virtual StartupExceptionRegistry const& getStartupExceptionRegistry() const = 0;
2929  };
2930 
2932  virtual ~IMutableRegistryHub();
2933  virtual void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) = 0;
2934  virtual void registerListener( IReporterFactoryPtr const& factory ) = 0;
2935  virtual void registerTest( TestCase const& testInfo ) = 0;
2936  virtual void registerTranslator( const IExceptionTranslator* translator ) = 0;
2937  virtual void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) = 0;
2938  virtual void registerStartupException() noexcept = 0;
2939  virtual IMutableEnumValuesRegistry& getMutableEnumValuesRegistry() = 0;
2940  };
2941 
2942  IRegistryHub const& getRegistryHub();
2943  IMutableRegistryHub& getMutableRegistryHub();
2944  void cleanUp();
2945  std::string translateActiveException();
2946 
2947 }
2948 
2949 // end catch_interfaces_registry_hub.h
2950 #if defined(CATCH_CONFIG_DISABLE)
2951  #define INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( translatorName, signature) \
2952  static std::string translatorName( signature )
2953 #endif
2954 
2955 #include <exception>
2956 #include <string>
2957 #include <vector>
2958 
2959 namespace Catch {
2960  using exceptionTranslateFunction = std::string(*)();
2961 
2962  struct IExceptionTranslator;
2963  using ExceptionTranslators = std::vector<std::unique_ptr<IExceptionTranslator const>>;
2964 
2966  virtual ~IExceptionTranslator();
2967  virtual std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const = 0;
2968  };
2969 
2971  virtual ~IExceptionTranslatorRegistry();
2972 
2973  virtual std::string translateActiveException() const = 0;
2974  };
2975 
2977  template<typename T>
2978  class ExceptionTranslator : public IExceptionTranslator {
2979  public:
2980 
2981  ExceptionTranslator( std::string(*translateFunction)( T& ) )
2982  : m_translateFunction( translateFunction )
2983  {}
2984 
2985  std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const override {
2986  try {
2987  if( it == itEnd )
2988  std::rethrow_exception(std::current_exception());
2989  else
2990  return (*it)->translate( it+1, itEnd );
2991  }
2992  catch( T& ex ) {
2993  return m_translateFunction( ex );
2994  }
2995  }
2996 
2997  protected:
2998  std::string(*m_translateFunction)( T& );
2999  };
3000 
3001  public:
3002  template<typename T>
3003  ExceptionTranslatorRegistrar( std::string(*translateFunction)( T& ) ) {
3004  getMutableRegistryHub().registerTranslator
3005  ( new ExceptionTranslator<T>( translateFunction ) );
3006  }
3007  };
3008 }
3009 
3011 #define INTERNAL_CATCH_TRANSLATE_EXCEPTION2( translatorName, signature ) \
3012  static std::string translatorName( signature ); \
3013  CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
3014  namespace{ Catch::ExceptionTranslatorRegistrar INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionRegistrar )( &translatorName ); } \
3015  CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
3016  static std::string translatorName( signature )
3017 
3018 #define INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION2( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature )
3019 
3020 // end catch_interfaces_exception.h
3021 // start catch_approx.h
3022 
3023 #include <type_traits>
3024 
3025 namespace Catch {
3026 namespace Detail {
3027 
3028  class Approx {
3029  private:
3030  bool equalityComparisonImpl(double other) const;
3031  // Validates the new margin (margin >= 0)
3032  // out-of-line to avoid including stdexcept in the header
3033  void setMargin(double margin);
3034  // Validates the new epsilon (0 < epsilon < 1)
3035  // out-of-line to avoid including stdexcept in the header
3036  void setEpsilon(double epsilon);
3037 
3038  public:
3039  explicit Approx ( double value );
3040 
3041  static Approx custom();
3042 
3043  Approx operator-() const;
3044 
3045  template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3046  Approx operator()( T const& value ) {
3047  Approx approx( static_cast<double>(value) );
3048  approx.m_epsilon = m_epsilon;
3049  approx.m_margin = m_margin;
3050  approx.m_scale = m_scale;
3051  return approx;
3052  }
3053 
3054  template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3055  explicit Approx( T const& value ): Approx(static_cast<double>(value))
3056  {}
3057 
3058  template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3059  friend bool operator == ( const T& lhs, Approx const& rhs ) {
3060  auto lhs_v = static_cast<double>(lhs);
3061  return rhs.equalityComparisonImpl(lhs_v);
3062  }
3063 
3064  template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3065  friend bool operator == ( Approx const& lhs, const T& rhs ) {
3066  return operator==( rhs, lhs );
3067  }
3068 
3069  template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3070  friend bool operator != ( T const& lhs, Approx const& rhs ) {
3071  return !operator==( lhs, rhs );
3072  }
3073 
3074  template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3075  friend bool operator != ( Approx const& lhs, T const& rhs ) {
3076  return !operator==( rhs, lhs );
3077  }
3078 
3079  template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3080  friend bool operator <= ( T const& lhs, Approx const& rhs ) {
3081  return static_cast<double>(lhs) < rhs.m_value || lhs == rhs;
3082  }
3083 
3084  template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3085  friend bool operator <= ( Approx const& lhs, T const& rhs ) {
3086  return lhs.m_value < static_cast<double>(rhs) || lhs == rhs;
3087  }
3088 
3089  template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3090  friend bool operator >= ( T const& lhs, Approx const& rhs ) {
3091  return static_cast<double>(lhs) > rhs.m_value || lhs == rhs;
3092  }
3093 
3094  template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3095  friend bool operator >= ( Approx const& lhs, T const& rhs ) {
3096  return lhs.m_value > static_cast<double>(rhs) || lhs == rhs;
3097  }
3098 
3099  template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3100  Approx& epsilon( T const& newEpsilon ) {
3101  double epsilonAsDouble = static_cast<double>(newEpsilon);
3102  setEpsilon(epsilonAsDouble);
3103  return *this;
3104  }
3105 
3106  template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3107  Approx& margin( T const& newMargin ) {
3108  double marginAsDouble = static_cast<double>(newMargin);
3109  setMargin(marginAsDouble);
3110  return *this;
3111  }
3112 
3113  template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3114  Approx& scale( T const& newScale ) {
3115  m_scale = static_cast<double>(newScale);
3116  return *this;
3117  }
3118 
3119  std::string toString() const;
3120 
3121  private:
3122  double m_epsilon;
3123  double m_margin;
3124  double m_scale;
3125  double m_value;
3126  };
3127 } // end namespace Detail
3128 
3129 namespace literals {
3130  Detail::Approx operator "" _a(long double val);
3131  Detail::Approx operator "" _a(unsigned long long val);
3132 } // end namespace literals
3133 
3134 template<>
3136  static std::string convert(Catch::Detail::Approx const& value);
3137 };
3138 
3139 } // end namespace Catch
3140 
3141 // end catch_approx.h
3142 // start catch_string_manip.h
3143 
3144 #include <string>
3145 #include <iosfwd>
3146 #include <vector>
3147 
3148 namespace Catch {
3149 
3150  bool startsWith( std::string const& s, std::string const& prefix );
3151  bool startsWith( std::string const& s, char prefix );
3152  bool endsWith( std::string const& s, std::string const& suffix );
3153  bool endsWith( std::string const& s, char suffix );
3154  bool contains( std::string const& s, std::string const& infix );
3155  void toLowerInPlace( std::string& s );
3156  std::string toLower( std::string const& s );
3157  std::string trim( std::string const& str );
3158 
3159  // !!! Be aware, returns refs into original string - make sure original string outlives them
3160  std::vector<StringRef> splitStringRef( StringRef str, char delimiter );
3161  bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis );
3162 
3163  struct pluralise {
3164  pluralise( std::size_t count, std::string const& label );
3165 
3166  friend std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser );
3167 
3168  std::size_t m_count;
3169  std::string m_label;
3170  };
3171 }
3172 
3173 // end catch_string_manip.h
3174 #ifndef CATCH_CONFIG_DISABLE_MATCHERS
3175 // start catch_capture_matchers.h
3176 
3177 // start catch_matchers.h
3178 
3179 #include <string>
3180 #include <vector>
3181 
3182 namespace Catch {
3183 namespace Matchers {
3184  namespace Impl {
3185 
3186  template<typename ArgT> struct MatchAllOf;
3187  template<typename ArgT> struct MatchAnyOf;
3188  template<typename ArgT> struct MatchNotOf;
3189 
3191  public:
3192  MatcherUntypedBase() = default;
3193  MatcherUntypedBase ( MatcherUntypedBase const& ) = default;
3194  MatcherUntypedBase& operator = ( MatcherUntypedBase const& ) = delete;
3195  std::string toString() const;
3196 
3197  protected:
3198  virtual ~MatcherUntypedBase();
3199  virtual std::string describe() const = 0;
3200  mutable std::string m_cachedToString;
3201  };
3202 
3203 #ifdef __clang__
3204 # pragma clang diagnostic push
3205 # pragma clang diagnostic ignored "-Wnon-virtual-dtor"
3206 #endif
3207 
3208  template<typename ObjectT>
3209  struct MatcherMethod {
3210  virtual bool match( ObjectT const& arg ) const = 0;
3211  };
3212 
3213 #if defined(__OBJC__)
3214  // Hack to fix Catch GH issue #1661. Could use id for generic Object support.
3215  // use of const for Object pointers is very uncommon and under ARC it causes some kind of signature mismatch that breaks compilation
3216  template<>
3217  struct MatcherMethod<NSString*> {
3218  virtual bool match( NSString* arg ) const = 0;
3219  };
3220 #endif
3221 
3222 #ifdef __clang__
3223 # pragma clang diagnostic pop
3224 #endif
3225 
3226  template<typename T>
3228 
3229  MatchAllOf<T> operator && ( MatcherBase const& other ) const;
3230  MatchAnyOf<T> operator || ( MatcherBase const& other ) const;
3231  MatchNotOf<T> operator ! () const;
3232  };
3233 
3234  template<typename ArgT>
3235  struct MatchAllOf : MatcherBase<ArgT> {
3236  bool match( ArgT const& arg ) const override {
3237  for( auto matcher : m_matchers ) {
3238  if (!matcher->match(arg))
3239  return false;
3240  }
3241  return true;
3242  }
3243  std::string describe() const override {
3244  std::string description;
3245  description.reserve( 4 + m_matchers.size()*32 );
3246  description += "( ";
3247  bool first = true;
3248  for( auto matcher : m_matchers ) {
3249  if( first )
3250  first = false;
3251  else
3252  description += " and ";
3253  description += matcher->toString();
3254  }
3255  description += " )";
3256  return description;
3257  }
3258 
3259  MatchAllOf<ArgT>& operator && ( MatcherBase<ArgT> const& other ) {
3260  m_matchers.push_back( &other );
3261  return *this;
3262  }
3263 
3264  std::vector<MatcherBase<ArgT> const*> m_matchers;
3265  };
3266  template<typename ArgT>
3267  struct MatchAnyOf : MatcherBase<ArgT> {
3268 
3269  bool match( ArgT const& arg ) const override {
3270  for( auto matcher : m_matchers ) {
3271  if (matcher->match(arg))
3272  return true;
3273  }
3274  return false;
3275  }
3276  std::string describe() const override {
3277  std::string description;
3278  description.reserve( 4 + m_matchers.size()*32 );
3279  description += "( ";
3280  bool first = true;
3281  for( auto matcher : m_matchers ) {
3282  if( first )
3283  first = false;
3284  else
3285  description += " or ";
3286  description += matcher->toString();
3287  }
3288  description += " )";
3289  return description;
3290  }
3291 
3292  MatchAnyOf<ArgT>& operator || ( MatcherBase<ArgT> const& other ) {
3293  m_matchers.push_back( &other );
3294  return *this;
3295  }
3296 
3297  std::vector<MatcherBase<ArgT> const*> m_matchers;
3298  };
3299 
3300  template<typename ArgT>
3301  struct MatchNotOf : MatcherBase<ArgT> {
3302 
3303  MatchNotOf( MatcherBase<ArgT> const& underlyingMatcher ) : m_underlyingMatcher( underlyingMatcher ) {}
3304 
3305  bool match( ArgT const& arg ) const override {
3306  return !m_underlyingMatcher.match( arg );
3307  }
3308 
3309  std::string describe() const override {
3310  return "not " + m_underlyingMatcher.toString();
3311  }
3312  MatcherBase<ArgT> const& m_underlyingMatcher;
3313  };
3314 
3315  template<typename T>
3317  return MatchAllOf<T>() && *this && other;
3318  }
3319  template<typename T>
3321  return MatchAnyOf<T>() || *this || other;
3322  }
3323  template<typename T>
3325  return MatchNotOf<T>( *this );
3326  }
3327 
3328  } // namespace Impl
3329 
3330 } // namespace Matchers
3331 
3332 using namespace Matchers;
3334 
3335 } // namespace Catch
3336 
3337 // end catch_matchers.h
3338 // start catch_matchers_floating.h
3339 
3340 #include <type_traits>
3341 #include <cmath>
3342 
3343 namespace Catch {
3344 namespace Matchers {
3345 
3346  namespace Floating {
3347 
3348  enum class FloatingPointKind : uint8_t;
3349 
3350  struct WithinAbsMatcher : MatcherBase<double> {
3351  WithinAbsMatcher(double target, double margin);
3352  bool match(double const& matchee) const override;
3353  std::string describe() const override;
3354  private:
3355  double m_target;
3356  double m_margin;
3357  };
3358 
3359  struct WithinUlpsMatcher : MatcherBase<double> {
3360  WithinUlpsMatcher(double target, int ulps, FloatingPointKind baseType);
3361  bool match(double const& matchee) const override;
3362  std::string describe() const override;
3363  private:
3364  double m_target;
3365  int m_ulps;
3366  FloatingPointKind m_type;
3367  };
3368 
3369  } // namespace Floating
3370 
3371  // The following functions create the actual matcher objects.
3372  // This allows the types to be inferred
3373  Floating::WithinUlpsMatcher WithinULP(double target, int maxUlpDiff);
3374  Floating::WithinUlpsMatcher WithinULP(float target, int maxUlpDiff);
3375  Floating::WithinAbsMatcher WithinAbs(double target, double margin);
3376 
3377 } // namespace Matchers
3378 } // namespace Catch
3379 
3380 // end catch_matchers_floating.h
3381 // start catch_matchers_generic.hpp
3382 
3383 #include <functional>
3384 #include <string>
3385 
3386 namespace Catch {
3387 namespace Matchers {
3388 namespace Generic {
3389 
3390 namespace Detail {
3391  std::string finalizeDescription(const std::string& desc);
3392 }
3393 
3394 template <typename T>
3395 class PredicateMatcher : public MatcherBase<T> {
3396  std::function<bool(T const&)> m_predicate;
3397  std::string m_description;
3398 public:
3399 
3400  PredicateMatcher(std::function<bool(T const&)> const& elem, std::string const& descr)
3401  :m_predicate(std::move(elem)),
3402  m_description(Detail::finalizeDescription(descr))
3403  {}
3404 
3405  bool match( T const& item ) const override {
3406  return m_predicate(item);
3407  }
3408 
3409  std::string describe() const override {
3410  return m_description;
3411  }
3412 };
3413 
3414 } // namespace Generic
3415 
3416  // The following functions create the actual matcher objects.
3417  // The user has to explicitly specify type to the function, because
3418  // inferring std::function<bool(T const&)> is hard (but possible) and
3419  // requires a lot of TMP.
3420  template<typename T>
3421  Generic::PredicateMatcher<T> Predicate(std::function<bool(T const&)> const& predicate, std::string const& description = "") {
3422  return Generic::PredicateMatcher<T>(predicate,