ChaiScript / ChaiScript
1
/*
2
 *  Catch v2.13.6
3
 *  Generated: 2021-04-16 18:23:38.044268
4
 *  ----------------------------------------------------------
5
 *  This file has been merged from multiple headers. Please don't edit it directly
6
 *  Copyright (c) 2021 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
#define CATCH_VERSION_MAJOR 2
16
#define CATCH_VERSION_MINOR 13
17
#define CATCH_VERSION_PATCH 6
18

19
#ifdef __clang__
20
#pragma clang system_header
21
#elif defined __GNUC__
22
#pragma GCC system_header
23
#endif
24

25
// start catch_suppress_warnings.h
26

27
#ifdef __clang__
28
#ifdef __ICC // icpc defines the __clang__ macro
29
#pragma warning(push)
30
#pragma warning(disable : 161 1682)
31
#else // __ICC
32
#pragma clang diagnostic push
33
#pragma clang diagnostic ignored "-Wpadded"
34
#pragma clang diagnostic ignored "-Wswitch-enum"
35
#pragma clang diagnostic ignored "-Wcovered-switch-default"
36
#endif
37
#elif defined __GNUC__
38
// Because REQUIREs trigger GCC's -Wparentheses, and because still
39
// supported version of g++ have only buggy support for _Pragmas,
40
// Wparentheses have to be suppressed globally.
41
#pragma GCC diagnostic ignored "-Wparentheses" // See #674 for details
42

43
#pragma GCC diagnostic push
44
#pragma GCC diagnostic ignored "-Wunused-variable"
45
#pragma GCC diagnostic ignored "-Wpadded"
46
#endif
47
// end catch_suppress_warnings.h
48
#if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER)
49
#define CATCH_IMPL
50
#define CATCH_CONFIG_ALL_PARTS
51
#endif
52

53
// In the impl file, we want to have access to all parts of the headers
54
// Can also be used to sanely support PCHs
55
#if defined(CATCH_CONFIG_ALL_PARTS)
56
#define CATCH_CONFIG_EXTERNAL_INTERFACES
57
#if defined(CATCH_CONFIG_DISABLE_MATCHERS)
58
#undef CATCH_CONFIG_DISABLE_MATCHERS
59
#endif
60
#if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER)
61
#define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
62
#endif
63
#endif
64

65
#if !defined(CATCH_CONFIG_IMPL_ONLY)
66
// start catch_platform.h
67

68
// See e.g.:
69
// https://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-18.1/TargetConditionals.h.auto.html
70
#ifdef __APPLE__
71
#include <TargetConditionals.h>
72
#if (defined(TARGET_OS_OSX) && TARGET_OS_OSX == 1) || (defined(TARGET_OS_MAC) && TARGET_OS_MAC == 1)
73
#define CATCH_PLATFORM_MAC
74
#elif (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE == 1)
75
#define CATCH_PLATFORM_IPHONE
76
#endif
77

78
#elif defined(linux) || defined(__linux) || defined(__linux__)
79
#define CATCH_PLATFORM_LINUX
80

81
#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) || defined(__MINGW32__)
82
#define CATCH_PLATFORM_WINDOWS
83
#endif
84

85
// end catch_platform.h
86

87
#ifdef CATCH_IMPL
88
#ifndef CLARA_CONFIG_MAIN
89
#define CLARA_CONFIG_MAIN_NOT_DEFINED
90
#define CLARA_CONFIG_MAIN
91
#endif
92
#endif
93

94
// start catch_user_interfaces.h
95

96
namespace Catch {
97
  unsigned int rngSeed();
98
}
99

100
// end catch_user_interfaces.h
101
// start catch_tag_alias_autoregistrar.h
102

103
// start catch_common.h
104

105
// start catch_compiler_capabilities.h
106

107
// Detect a number of compiler features - by compiler
108
// The following features are defined:
109
//
110
// CATCH_CONFIG_COUNTER : is the __COUNTER__ macro supported?
111
// CATCH_CONFIG_WINDOWS_SEH : is Windows SEH supported?
112
// CATCH_CONFIG_POSIX_SIGNALS : are POSIX signals supported?
113
// CATCH_CONFIG_DISABLE_EXCEPTIONS : Are exceptions enabled?
114
// ****************
115
// Note to maintainers: if new toggles are added please document them
116
// in configuration.md, too
117
// ****************
118

119
// In general each macro has a _NO_<feature name> form
120
// (e.g. CATCH_CONFIG_NO_POSIX_SIGNALS) which disables the feature.
121
// Many features, at point of detection, define an _INTERNAL_ macro, so they
122
// can be combined, en-mass, with the _NO_ forms later.
123

124
#ifdef __cplusplus
125

126
#if (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L)
127
#define CATCH_CPP14_OR_GREATER
128
#endif
129

130
#if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
131
#define CATCH_CPP17_OR_GREATER
132
#endif
133

134
#endif
135

136
// Only GCC compiler should be used in this block, so other compilers trying to
137
// mask themselves as GCC should be ignored.
138
#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && !defined(__CUDACC__) && !defined(__LCC__)
139
#define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma("GCC diagnostic push")
140
#define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma("GCC diagnostic pop")
141

142
#define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__)
143

144
#endif
145

146
#if defined(__clang__)
147

148
#define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma("clang diagnostic push")
149
#define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma("clang diagnostic pop")
150

151
// As of this writing, IBM XL's implementation of __builtin_constant_p has a bug
152
// which results in calls to destructors being emitted for each temporary,
153
// without a matching initialization. In practice, this can result in something
154
// like `std::string::~string` being called on an uninitialized value.
155
//
156
// For example, this code will likely segfault under IBM XL:
157
// ```
158
// REQUIRE(std::string("12") + "34" == "1234")
159
// ```
160
//
161
// Therefore, `CATCH_INTERNAL_IGNORE_BUT_WARN` is not implemented.
162
#if !defined(__ibmxl__) && !defined(__CUDACC__)
163
#define CATCH_INTERNAL_IGNORE_BUT_WARN(...) \
164
  (void)__builtin_constant_p(__VA_ARGS__) /* NOLINT(cppcoreguidelines-pro-type-vararg, hicpp-vararg) */
165
#endif
166

167
#define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
168
  _Pragma("clang diagnostic ignored \"-Wexit-time-destructors\"") _Pragma("clang diagnostic ignored \"-Wglobal-constructors\"")
169

170
#define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS _Pragma("clang diagnostic ignored \"-Wparentheses\"")
171

172
#define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS _Pragma("clang diagnostic ignored \"-Wunused-variable\"")
173

174
#define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS _Pragma("clang diagnostic ignored \"-Wgnu-zero-variadic-macro-arguments\"")
175

176
#define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS _Pragma("clang diagnostic ignored \"-Wunused-template\"")
177

178
#endif // __clang__
179

180
////////////////////////////////////////////////////////////////////////////////
181
// Assume that non-Windows platforms support posix signals by default
182
#if !defined(CATCH_PLATFORM_WINDOWS)
183
#define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS
184
#endif
185

186
////////////////////////////////////////////////////////////////////////////////
187
// We know some environments not to support full POSIX signals
188
#if defined(__CYGWIN__) || defined(__QNX__) || defined(__EMSCRIPTEN__) || defined(__DJGPP__)
189
#define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS
190
#endif
191

192
#ifdef __OS400__
193
#define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS
194
#define CATCH_CONFIG_COLOUR_NONE
195
#endif
196

197
////////////////////////////////////////////////////////////////////////////////
198
// Android somehow still does not support std::to_string
199
#if defined(__ANDROID__)
200
#define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING
201
#define CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE
202
#endif
203

204
////////////////////////////////////////////////////////////////////////////////
205
// Not all Windows environments support SEH properly
206
#if defined(__MINGW32__)
207
#define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH
208
#endif
209

210
////////////////////////////////////////////////////////////////////////////////
211
// PS4
212
#if defined(__ORBIS__)
213
#define CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE
214
#endif
215

216
////////////////////////////////////////////////////////////////////////////////
217
// Cygwin
218
#ifdef __CYGWIN__
219

220
// Required for some versions of Cygwin to declare gettimeofday
221
// see: http://stackoverflow.com/questions/36901803/gettimeofday-not-declared-in-this-scope-cygwin
222
#define _BSD_SOURCE
223
// some versions of cygwin (most) do not support std::to_string. Use the libstd check.
224
// https://gcc.gnu.org/onlinedocs/gcc-4.8.2/libstdc++/api/a01053_source.html line 2812-2813
225
#if !((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF))
226

227
#define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING
228

229
#endif
230
#endif // __CYGWIN__
231

232
////////////////////////////////////////////////////////////////////////////////
233
// Visual C++
234
#if defined(_MSC_VER)
235

236
#define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma(warning(push))
237
#define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION __pragma(warning(pop))
238

239
// Universal Windows platform does not support SEH
240
// Or console colours (or console at all...)
241
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
242
#define CATCH_CONFIG_COLOUR_NONE
243
#else
244
#define CATCH_INTERNAL_CONFIG_WINDOWS_SEH
245
#endif
246

247
// MSVC traditional preprocessor needs some workaround for __VA_ARGS__
248
// _MSVC_TRADITIONAL == 0 means new conformant preprocessor
249
// _MSVC_TRADITIONAL == 1 means old traditional non-conformant preprocessor
250
#if !defined(__clang__) // Handle Clang masquerading for msvc
251
#if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL)
252
#define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
253
#endif // MSVC_TRADITIONAL
254
#endif // __clang__
255

256
#endif // _MSC_VER
257

258
#if defined(_REENTRANT) || defined(_MSC_VER)
259
// Enable async processing, as -pthread is specified or no additional linking is required
260
#define CATCH_INTERNAL_CONFIG_USE_ASYNC
261
#endif // _MSC_VER
262

263
////////////////////////////////////////////////////////////////////////////////
264
// Check if we are compiled with -fno-exceptions or equivalent
265
#if defined(__EXCEPTIONS) || defined(__cpp_exceptions) || defined(_CPPUNWIND)
266
#define CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED
267
#endif
268

269
////////////////////////////////////////////////////////////////////////////////
270
// DJGPP
271
#ifdef __DJGPP__
272
#define CATCH_INTERNAL_CONFIG_NO_WCHAR
273
#endif // __DJGPP__
274

275
////////////////////////////////////////////////////////////////////////////////
276
// Embarcadero C++Build
277
#if defined(__BORLANDC__)
278
#define CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN
279
#endif
280

281
////////////////////////////////////////////////////////////////////////////////
282

283
// Use of __COUNTER__ is suppressed during code analysis in
284
// CLion/AppCode 2017.2.x and former, because __COUNTER__ is not properly
285
// handled by it.
286
// Otherwise all supported compilers support COUNTER macro,
287
// but user still might want to turn it off
288
#if (!defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L)
289
#define CATCH_INTERNAL_CONFIG_COUNTER
290
#endif
291

292
////////////////////////////////////////////////////////////////////////////////
293

294
// RTX is a special version of Windows that is real time.
295
// This means that it is detected as Windows, but does not provide
296
// the same set of capabilities as real Windows does.
297
#if defined(UNDER_RTSS) || defined(RTX64_BUILD)
298
#define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH
299
#define CATCH_INTERNAL_CONFIG_NO_ASYNC
300
#define CATCH_CONFIG_COLOUR_NONE
301
#endif
302

303
#if !defined(_GLIBCXX_USE_C99_MATH_TR1)
304
#define CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER
305
#endif
306

307
// Various stdlib support checks that require __has_include
308
#if defined(__has_include)
309
// Check if string_view is available and usable
310
#if __has_include(<string_view>) && defined(CATCH_CPP17_OR_GREATER)
311
#define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW
312
#endif
313

314
// Check if optional is available and usable
315
#if __has_include(<optional>) && defined(CATCH_CPP17_OR_GREATER)
316
#define CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL
317
#endif // __has_include(<optional>) && defined(CATCH_CPP17_OR_GREATER)
318

319
// Check if byte is available and usable
320
#if __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER)
321
#include <cstddef>
322
#if __cpp_lib_byte > 0
323
#define CATCH_INTERNAL_CONFIG_CPP17_BYTE
324
#endif
325
#endif // __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER)
326

327
// Check if variant is available and usable
328
#if __has_include(<variant>) && defined(CATCH_CPP17_OR_GREATER)
329
#if defined(__clang__) && (__clang_major__ < 8)
330
// work around clang bug with libstdc++ https://bugs.llvm.org/show_bug.cgi?id=31852
331
// fix should be in clang 8, workaround in libstdc++ 8.2
332
#include <ciso646>
333
#if defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9)
334
#define CATCH_CONFIG_NO_CPP17_VARIANT
335
#else
336
#define CATCH_INTERNAL_CONFIG_CPP17_VARIANT
337
#endif // defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9)
338
#else
339
#define CATCH_INTERNAL_CONFIG_CPP17_VARIANT
340
#endif // defined(__clang__) && (__clang_major__ < 8)
341
#endif // __has_include(<variant>) && defined(CATCH_CPP17_OR_GREATER)
342
#endif // defined(__has_include)
343

344
#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER)
345
#define CATCH_CONFIG_COUNTER
346
#endif
347
#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH) \
348
    && !defined(CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH)
349
#define CATCH_CONFIG_WINDOWS_SEH
350
#endif
351
// This is set by default, because we assume that unix compilers are posix-signal-compatible by default.
352
#if defined(CATCH_INTERNAL_CONFIG_POSIX_SIGNALS) && !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) \
353
    && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS)
354
#define CATCH_CONFIG_POSIX_SIGNALS
355
#endif
356
// This is set by default, because we assume that compilers with no wchar_t support are just rare exceptions.
357
#if !defined(CATCH_INTERNAL_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_WCHAR)
358
#define CATCH_CONFIG_WCHAR
359
#endif
360

361
#if !defined(CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_NO_CPP11_TO_STRING) \
362
    && !defined(CATCH_CONFIG_CPP11_TO_STRING)
363
#define CATCH_CONFIG_CPP11_TO_STRING
364
#endif
365

366
#if defined(CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_NO_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_CPP17_OPTIONAL)
367
#define CATCH_CONFIG_CPP17_OPTIONAL
368
#endif
369

370
#if defined(CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_NO_CPP17_STRING_VIEW) \
371
    && !defined(CATCH_CONFIG_CPP17_STRING_VIEW)
372
#define CATCH_CONFIG_CPP17_STRING_VIEW
373
#endif
374

375
#if defined(CATCH_INTERNAL_CONFIG_CPP17_VARIANT) && !defined(CATCH_CONFIG_NO_CPP17_VARIANT) && !defined(CATCH_CONFIG_CPP17_VARIANT)
376
#define CATCH_CONFIG_CPP17_VARIANT
377
#endif
378

379
#if defined(CATCH_INTERNAL_CONFIG_CPP17_BYTE) && !defined(CATCH_CONFIG_NO_CPP17_BYTE) && !defined(CATCH_CONFIG_CPP17_BYTE)
380
#define CATCH_CONFIG_CPP17_BYTE
381
#endif
382

383
#if defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT)
384
#define CATCH_INTERNAL_CONFIG_NEW_CAPTURE
385
#endif
386

387
#if defined(CATCH_INTERNAL_CONFIG_NEW_CAPTURE) && !defined(CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE) \
388
    && !defined(CATCH_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NEW_CAPTURE)
389
#define CATCH_CONFIG_NEW_CAPTURE
390
#endif
391

392
#if !defined(CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
393
#define CATCH_CONFIG_DISABLE_EXCEPTIONS
394
#endif
395

396
#if defined(CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_NO_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_POLYFILL_ISNAN)
397
#define CATCH_CONFIG_POLYFILL_ISNAN
398
#endif
399

400
#if defined(CATCH_INTERNAL_CONFIG_USE_ASYNC) && !defined(CATCH_INTERNAL_CONFIG_NO_ASYNC) && !defined(CATCH_CONFIG_NO_USE_ASYNC) \
401
    && !defined(CATCH_CONFIG_USE_ASYNC)
402
#define CATCH_CONFIG_USE_ASYNC
403
#endif
404

405
#if defined(CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE) && !defined(CATCH_CONFIG_NO_ANDROID_LOGWRITE) \
406
    && !defined(CATCH_CONFIG_ANDROID_LOGWRITE)
407
#define CATCH_CONFIG_ANDROID_LOGWRITE
408
#endif
409

410
#if defined(CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_NO_GLOBAL_NEXTAFTER) \
411
    && !defined(CATCH_CONFIG_GLOBAL_NEXTAFTER)
412
#define CATCH_CONFIG_GLOBAL_NEXTAFTER
413
#endif
414

415
// Even if we do not think the compiler has that warning, we still have
416
// to provide a macro that can be used by the code.
417
#if !defined(CATCH_INTERNAL_START_WARNINGS_SUPPRESSION)
418
#define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION
419
#endif
420
#if !defined(CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION)
421
#define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
422
#endif
423
#if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS)
424
#define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS
425
#endif
426
#if !defined(CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS)
427
#define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
428
#endif
429
#if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS)
430
#define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS
431
#endif
432
#if !defined(CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS)
433
#define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS
434
#endif
435

436
// The goal of this macro is to avoid evaluation of the arguments, but
437
// still have the compiler warn on problems inside...
438
#if !defined(CATCH_INTERNAL_IGNORE_BUT_WARN)
439
#define CATCH_INTERNAL_IGNORE_BUT_WARN(...)
440
#endif
441

442
#if defined(__APPLE__) && defined(__apple_build_version__) && (__clang_major__ < 10)
443
#undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS
444
#elif defined(__clang__) && (__clang_major__ < 5)
445
#undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS
446
#endif
447

448
#if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS)
449
#define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS
450
#endif
451

452
#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
453
#define CATCH_TRY if ((true))
454
#define CATCH_CATCH_ALL if ((false))
455
#define CATCH_CATCH_ANON(type) if ((false))
456
#else
457
#define CATCH_TRY try
458
#define CATCH_CATCH_ALL catch (...)
459
#define CATCH_CATCH_ANON(type) catch (type)
460
#endif
461

462
#if defined(CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_NO_TRADITIONAL_MSVC_PREPROCESSOR) \
463
    && !defined(CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR)
464
#define CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
465
#endif
466

467
// end catch_compiler_capabilities.h
468
#define INTERNAL_CATCH_UNIQUE_NAME_LINE2(name, line) name##line
469
#define INTERNAL_CATCH_UNIQUE_NAME_LINE(name, line) INTERNAL_CATCH_UNIQUE_NAME_LINE2(name, line)
470
#ifdef CATCH_CONFIG_COUNTER
471
#define INTERNAL_CATCH_UNIQUE_NAME(name) INTERNAL_CATCH_UNIQUE_NAME_LINE(name, __COUNTER__)
472
#else
473
#define INTERNAL_CATCH_UNIQUE_NAME(name) INTERNAL_CATCH_UNIQUE_NAME_LINE(name, __LINE__)
474
#endif
475

476
#include <cstdint>
477
#include <iosfwd>
478
#include <string>
479

480
// We need a dummy global operator<< so we can bring it into Catch namespace later
481
struct Catch_global_namespace_dummy {
482
};
483
std::ostream &operator<<(std::ostream &, Catch_global_namespace_dummy);
484

485
namespace Catch {
486
  struct CaseSensitive {
487
    enum Choice {
488
      Yes,
489
      No
490
    };
491
  };
492

493 1
  class NonCopyable {
494
    NonCopyable(NonCopyable const &) = delete;
495
    NonCopyable(NonCopyable &&) = delete;
496
    NonCopyable &operator=(NonCopyable const &) = delete;
497
    NonCopyable &operator=(NonCopyable &&) = delete;
498

499
  protected:
500
    NonCopyable();
501
    virtual ~NonCopyable();
502
  };
503

504
  struct SourceLineInfo {
505
    SourceLineInfo() = delete;
506 1
    SourceLineInfo(char const *_file, std::size_t _line) noexcept
507 1
        : file(_file)
508 1
        , line(_line) {
509
    }
510

511
    SourceLineInfo(SourceLineInfo const &other) = default;
512
    SourceLineInfo &operator=(SourceLineInfo const &) = default;
513
    SourceLineInfo(SourceLineInfo &&) noexcept = default;
514
    SourceLineInfo &operator=(SourceLineInfo &&) noexcept = default;
515

516
    bool empty() const noexcept { return file[0] == '\0'; }
517
    bool operator==(SourceLineInfo const &other) const noexcept;
518
    bool operator<(SourceLineInfo const &other) const noexcept;
519

520
    char const *file;
521
    std::size_t line;
522
  };
523

524
  std::ostream &operator<<(std::ostream &os, SourceLineInfo const &info);
525

526
  // Bring in operator<< from global namespace into Catch namespace
527
  // This is necessary because the overload of operator<< above makes
528
  // lookup stop at namespace Catch
529
  using ::operator<<;
530

531
  // Use this in variadic streaming macros to allow
532
  //    >> +StreamEndStop
533
  // as well as
534
  //    >> stuff +StreamEndStop
535
  struct StreamEndStop {
536
    std::string operator+() const;
537
  };
538
  template<typename T>
539
  T const &operator+(T const &value, StreamEndStop) {
540
    return value;
541
  }
542
} // namespace Catch
543

544
#define CATCH_INTERNAL_LINEINFO ::Catch::SourceLineInfo(__FILE__, static_cast<std::size_t>(__LINE__))
545

546
// end catch_common.h
547
namespace Catch {
548
  struct RegistrarForTagAliases {
549
    RegistrarForTagAliases(char const *alias, char const *tag, SourceLineInfo const &lineInfo);
550
  };
551

552
} // end namespace Catch
553

554
#define CATCH_REGISTER_TAG_ALIAS(alias, spec)                                                                             \
555
  CATCH_INTERNAL_START_WARNINGS_SUPPRESSION                                                                               \
556
  CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS                                                                                \
557
  namespace {                                                                                                             \
558
    Catch::RegistrarForTagAliases INTERNAL_CATCH_UNIQUE_NAME(AutoRegisterTagAlias)(alias, spec, CATCH_INTERNAL_LINEINFO); \
559
  }                                                                                                                       \
560
  CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
561

562
// end catch_tag_alias_autoregistrar.h
563
// start catch_test_registry.h
564

565
// start catch_interfaces_testcase.h
566

567
#include <vector>
568

569
namespace Catch {
570
  class TestSpec;
571

572 1
  struct ITestInvoker {
573
    virtual void invoke() const = 0;
574
    virtual ~ITestInvoker();
575
  };
576

577
  class TestCase;
578
  struct IConfig;
579

580 1
  struct ITestCaseRegistry {
581
    virtual ~ITestCaseRegistry();
582
    virtual std::vector<TestCase> const &getAllTests() const = 0;
583
    virtual std::vector<TestCase> const &getAllTestsSorted(IConfig const &config) const = 0;
584
  };
585

586
  bool isThrowSafe(TestCase const &testCase, IConfig const &config);
587
  bool matchTest(TestCase const &testCase, TestSpec const &testSpec, IConfig const &config);
588
  std::vector<TestCase> filterTests(std::vector<TestCase> const &testCases, TestSpec const &testSpec, IConfig const &config);
589
  std::vector<TestCase> const &getAllTestCasesSorted(IConfig const &config);
590

591
} // namespace Catch
592

593
// end catch_interfaces_testcase.h
594
// start catch_stringref.h
595

596
#include <cassert>
597
#include <cstddef>
598
#include <iosfwd>
599
#include <string>
600

601
namespace Catch {
602
  /// A non-owning string class (similar to the forthcoming std::string_view)
603
  /// Note that, because a StringRef may be a substring of another string,
604
  /// it may not be null terminated.
605
  class StringRef {
606
  public:
607
    using size_type = std::size_t;
608
    using const_iterator = const char *;
609

610
  private:
611
    static constexpr char const *const s_empty = "";
612

613
    char const *m_start = s_empty;
614
    size_type m_size = 0;
615

616
  public: // construction
617 1
    constexpr StringRef() noexcept = default;
618

619
    StringRef(char const *rawChars) noexcept;
620

621 1
    constexpr StringRef(char const *rawChars, size_type size) noexcept
622 1
        : m_start(rawChars)
623 1
        , m_size(size) {
624
    }
625

626 1
    StringRef(std::string const &stdString) noexcept
627 1
        : m_start(stdString.c_str())
628 1
        , m_size(stdString.size()) {
629
    }
630

631 1
    explicit operator std::string() const { return std::string(m_start, m_size); }
632

633
  public: // operators
634
    auto operator==(StringRef const &other) const noexcept -> bool;
635
    auto operator!=(StringRef const &other) const noexcept -> bool { return !(*this == other); }
636

637 0
    auto operator[](size_type index) const noexcept -> char {
638 0
      assert(index < m_size);
639 0
      return m_start[index];
640
    }
641

642
  public: // named queries
643 1
    constexpr auto empty() const noexcept -> bool { return m_size == 0; }
644 0
    constexpr auto size() const noexcept -> size_type { return m_size; }
645

646
    // Returns the current start pointer. If the StringRef is not
647
    // null-terminated, throws std::domain_exception
648
    auto c_str() const -> char const *;
649

650
  public: // substrings and searches
651
    // Returns a substring of [start, start + length).
652
    // If start + length > size(), then the substring is [start, size()).
653
    // If start > size(), then the substring is empty.
654
    auto substr(size_type start, size_type length) const noexcept -> StringRef;
655

656
    // Returns the current start pointer. May not be null-terminated.
657
    auto data() const noexcept -> char const *;
658

659 0
    constexpr auto isNullTerminated() const noexcept -> bool { return m_start[m_size] == '\0'; }
660

661
  public: // iterators
662 1
    constexpr const_iterator begin() const { return m_start; }
663 1
    constexpr const_iterator end() const { return m_start + m_size; }
664
  };
665

666
  auto operator+=(std::string &lhs, StringRef const &sr) -> std::string &;
667
  auto operator<<(std::ostream &os, StringRef const &sr) -> std::ostream &;
668

669 1
  constexpr auto operator"" _sr(char const *rawChars, std::size_t size) noexcept -> StringRef {
670 1
    return StringRef(rawChars, size);
671
  }
672
} // namespace Catch
673

674 1
constexpr auto operator"" _catch_sr(char const *rawChars, std::size_t size) noexcept -> Catch::StringRef {
675 1
  return Catch::StringRef(rawChars, size);
676
}
677

678
// end catch_stringref.h
679
// start catch_preprocessor.hpp
680

681
#define CATCH_RECURSION_LEVEL0(...) __VA_ARGS__
682
#define CATCH_RECURSION_LEVEL1(...) CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(__VA_ARGS__)))
683
#define CATCH_RECURSION_LEVEL2(...) CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(__VA_ARGS__)))
684
#define CATCH_RECURSION_LEVEL3(...) CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(__VA_ARGS__)))
685
#define CATCH_RECURSION_LEVEL4(...) CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(__VA_ARGS__)))
686
#define CATCH_RECURSION_LEVEL5(...) CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(__VA_ARGS__)))
687

688
#ifdef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
689
#define INTERNAL_CATCH_EXPAND_VARGS(...) __VA_ARGS__
690
// MSVC needs more evaluations
691
#define CATCH_RECURSION_LEVEL6(...) CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(__VA_ARGS__)))
692
#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL6(CATCH_RECURSION_LEVEL6(__VA_ARGS__))
693
#else
694
#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL5(__VA_ARGS__)
695
#endif
696

697
#define CATCH_REC_END(...)
698
#define CATCH_REC_OUT
699

700
#define CATCH_EMPTY()
701
#define CATCH_DEFER(id) id CATCH_EMPTY()
702

703
#define CATCH_REC_GET_END2() 0, CATCH_REC_END
704
#define CATCH_REC_GET_END1(...) CATCH_REC_GET_END2
705
#define CATCH_REC_GET_END(...) CATCH_REC_GET_END1
706
#define CATCH_REC_NEXT0(test, next, ...) next CATCH_REC_OUT
707
#define CATCH_REC_NEXT1(test, next) \
708
  CATCH_DEFER(CATCH_REC_NEXT0)      \
709
  (test, next, 0)
710
#define CATCH_REC_NEXT(test, next) CATCH_REC_NEXT1(CATCH_REC_GET_END test, next)
711

712
#define CATCH_REC_LIST0(f, x, peek, ...) , f(x) CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST1))(f, peek, __VA_ARGS__)
713
#define CATCH_REC_LIST1(f, x, peek, ...) , f(x) CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST0))(f, peek, __VA_ARGS__)
714
#define CATCH_REC_LIST2(f, x, peek, ...) f(x) CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST1))(f, peek, __VA_ARGS__)
715

716
#define CATCH_REC_LIST0_UD(f, userdata, x, peek, ...) \
717
  , f(userdata, x) CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD))(f, userdata, peek, __VA_ARGS__)
718
#define CATCH_REC_LIST1_UD(f, userdata, x, peek, ...) \
719
  , f(userdata, x) CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST0_UD))(f, userdata, peek, __VA_ARGS__)
720
#define CATCH_REC_LIST2_UD(f, userdata, x, peek, ...) \
721
  f(userdata, x) CATCH_DEFER(CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD))(f, userdata, peek, __VA_ARGS__)
722

723
// Applies the function macro `f` to each of the remaining parameters, inserts commas between the results,
724
// and passes userdata as the first parameter to each invocation,
725
// e.g. CATCH_REC_LIST_UD(f, x, a, b, c) evaluates to f(x, a), f(x, b), f(x, c)
726
#define CATCH_REC_LIST_UD(f, userdata, ...) CATCH_RECURSE(CATCH_REC_LIST2_UD(f, userdata, __VA_ARGS__, ()()(), ()()(), ()()(), 0))
727

728
#define CATCH_REC_LIST(f, ...) CATCH_RECURSE(CATCH_REC_LIST2(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0))
729

730
#define INTERNAL_CATCH_EXPAND1(param) INTERNAL_CATCH_EXPAND2(param)
731
#define INTERNAL_CATCH_EXPAND2(...) INTERNAL_CATCH_NO##__VA_ARGS__
732
#define INTERNAL_CATCH_DEF(...) INTERNAL_CATCH_DEF __VA_ARGS__
733
#define INTERNAL_CATCH_NOINTERNAL_CATCH_DEF
734
#define INTERNAL_CATCH_STRINGIZE(...) INTERNAL_CATCH_STRINGIZE2(__VA_ARGS__)
735
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
736
#define INTERNAL_CATCH_STRINGIZE2(...) #__VA_ARGS__
737
#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param))
738
#else
739
// MSVC is adding extra space and needs another indirection to expand INTERNAL_CATCH_NOINTERNAL_CATCH_DEF
740
#define INTERNAL_CATCH_STRINGIZE2(...) INTERNAL_CATCH_STRINGIZE3(__VA_ARGS__)
741
#define INTERNAL_CATCH_STRINGIZE3(...) #__VA_ARGS__
742
#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) (INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) + 1)
743
#endif
744

745
#define INTERNAL_CATCH_MAKE_NAMESPACE2(...) ns_##__VA_ARGS__
746
#define INTERNAL_CATCH_MAKE_NAMESPACE(name) INTERNAL_CATCH_MAKE_NAMESPACE2(name)
747

748
#define INTERNAL_CATCH_REMOVE_PARENS(...) INTERNAL_CATCH_EXPAND1(INTERNAL_CATCH_DEF __VA_ARGS__)
749

750
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
751
#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS_GEN(__VA_ARGS__)>())
752
#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__))
753
#else
754
#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) \
755
  INTERNAL_CATCH_EXPAND_VARGS(decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS_GEN(__VA_ARGS__)>()))
756
#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) \
757
  INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__)))
758
#endif
759

760
#define INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(...) CATCH_REC_LIST(INTERNAL_CATCH_MAKE_TYPE_LIST, __VA_ARGS__)
761

762
#define INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_0) INTERNAL_CATCH_REMOVE_PARENS(_0)
763
#define INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_0, _1) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_1)
764
#define INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_0, _1, _2) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_1, _2)
765
#define INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_0, _1, _2, _3) \
766
  INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_1, _2, _3)
767
#define INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_0, _1, _2, _3, _4) \
768
  INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_1, _2, _3, _4)
769
#define INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_0, _1, _2, _3, _4, _5) \
770
  INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_1, _2, _3, _4, _5)
771
#define INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_0, _1, _2, _3, _4, _5, _6) \
772
  INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_1, _2, _3, _4, _5, _6)
773
#define INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_0, _1, _2, _3, _4, _5, _6, _7) \
774
  INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_1, _2, _3, _4, _5, _6, _7)
775
#define INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8) \
776
  INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_1, _2, _3, _4, _5, _6, _7, _8)
777
#define INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \
778
  INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9)
779
#define INTERNAL_CATCH_REMOVE_PARENS_11_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \
780
  INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10)
781

782
#define INTERNAL_CATCH_VA_NARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N
783

784
#define INTERNAL_CATCH_TYPE_GEN                                                                                                         \
785
  template<typename...>                                                                                                                 \
786
  struct TypeList {                                                                                                                     \
787
  };                                                                                                                                    \
788
  template<typename... Ts>                                                                                                              \
789
  constexpr auto get_wrapper() noexcept->TypeList<Ts...> {                                                                              \
790
    return {};                                                                                                                          \
791
  }                                                                                                                                     \
792
  template<template<typename...> class...>                                                                                              \
793
  struct TemplateTypeList {                                                                                                             \
794
  };                                                                                                                                    \
795
  template<template<typename...> class... Cs>                                                                                           \
796
  constexpr auto get_wrapper() noexcept->TemplateTypeList<Cs...> {                                                                      \
797
    return {};                                                                                                                          \
798
  }                                                                                                                                     \
799
  template<typename...>                                                                                                                 \
800
  struct append;                                                                                                                        \
801
  template<typename...>                                                                                                                 \
802
  struct rewrap;                                                                                                                        \
803
  template<template<typename...> class, typename...>                                                                                    \
804
  struct create;                                                                                                                        \
805
  template<template<typename...> class, typename>                                                                                       \
806
  struct convert;                                                                                                                       \
807
                                                                                                                                        \
808
  template<typename T>                                                                                                                  \
809
  struct append<T> {                                                                                                                    \
810
    using type = T;                                                                                                                     \
811
  };                                                                                                                                    \
812
  template<template<typename...> class L1, typename... E1, template<typename...> class L2, typename... E2, typename... Rest>            \
813
  struct append<L1<E1...>, L2<E2...>, Rest...> {                                                                                        \
814
    using type = typename append<L1<E1..., E2...>, Rest...>::type;                                                                      \
815
  };                                                                                                                                    \
816
  template<template<typename...> class L1, typename... E1, typename... Rest>                                                            \
817
  struct append<L1<E1...>, TypeList<mpl_::na>, Rest...> {                                                                               \
818
    using type = L1<E1...>;                                                                                                             \
819
  };                                                                                                                                    \
820
                                                                                                                                        \
821
  template<template<typename...> class Container, template<typename...> class List, typename... elems>                                  \
822
  struct rewrap<TemplateTypeList<Container>, List<elems...>> {                                                                          \
823
    using type = TypeList<Container<elems...>>;                                                                                         \
824
  };                                                                                                                                    \
825
  template<template<typename...> class Container, template<typename...> class List, class... Elems, typename... Elements>               \
826
  struct rewrap<TemplateTypeList<Container>, List<Elems...>, Elements...> {                                                             \
827
    using type = typename append<TypeList<Container<Elems...>>, typename rewrap<TemplateTypeList<Container>, Elements...>::type>::type; \
828
  };                                                                                                                                    \
829
                                                                                                                                        \
830
  template<template<typename...> class Final, template<typename...> class... Containers, typename... Types>                             \
831
  struct create<Final, TemplateTypeList<Containers...>, TypeList<Types...>> {                                                           \
832
    using type = typename append<Final<>, typename rewrap<TemplateTypeList<Containers>, Types...>::type...>::type;                      \
833
  };                                                                                                                                    \
834
  template<template<typename...> class Final, template<typename...> class List, typename... Ts>                                         \
835
  struct convert<Final, List<Ts...>> {                                                                                                  \
836
    using type = typename append<Final<>, TypeList<Ts>...>::type;                                                                       \
837
  };
838

839
#define INTERNAL_CATCH_NTTP_1(signature, ...)                                                                                           \
840
  template<INTERNAL_CATCH_REMOVE_PARENS(signature)>                                                                                     \
841
  struct Nttp {                                                                                                                         \
842
  };                                                                                                                                    \
843
  template<INTERNAL_CATCH_REMOVE_PARENS(signature)>                                                                                     \
844
  constexpr auto get_wrapper() noexcept->Nttp<__VA_ARGS__> {                                                                            \
845
    return {};                                                                                                                          \
846
  }                                                                                                                                     \
847
  template<template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class...>                                                                  \
848
  struct NttpTemplateTypeList {                                                                                                         \
849
  };                                                                                                                                    \
850
  template<template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class... Cs>                                                               \
851
  constexpr auto get_wrapper() noexcept->NttpTemplateTypeList<Cs...> {                                                                  \
852
    return {};                                                                                                                          \
853
  }                                                                                                                                     \
854
                                                                                                                                        \
855
  template<template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class Container,                                                           \
856
           template<INTERNAL_CATCH_REMOVE_PARENS(signature)>                                                                            \
857
           class List,                                                                                                                  \
858
           INTERNAL_CATCH_REMOVE_PARENS(signature)>                                                                                     \
859
  struct rewrap<NttpTemplateTypeList<Container>, List<__VA_ARGS__>> {                                                                   \
860
    using type = TypeList<Container<__VA_ARGS__>>;                                                                                      \
861
  };                                                                                                                                    \
862
  template<template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class Container,                                                           \
863
           template<INTERNAL_CATCH_REMOVE_PARENS(signature)>                                                                            \
864
           class List,                                                                                                                  \
865
           INTERNAL_CATCH_REMOVE_PARENS(signature),                                                                                     \
866
           typename... Elements>                                                                                                        \
867
  struct rewrap<NttpTemplateTypeList<Container>, List<__VA_ARGS__>, Elements...> {                                                      \
868
    using type =                                                                                                                        \
869
        typename append<TypeList<Container<__VA_ARGS__>>, typename rewrap<NttpTemplateTypeList<Container>, Elements...>::type>::type;   \
870
  };                                                                                                                                    \
871
  template<template<typename...> class Final, template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class... Containers, typename... Types> \
872
  struct create<Final, NttpTemplateTypeList<Containers...>, TypeList<Types...>> {                                                       \
873
    using type = typename append<Final<>, typename rewrap<NttpTemplateTypeList<Containers>, Types...>::type...>::type;                  \
874
  };
875

876
#define INTERNAL_CATCH_DECLARE_SIG_TEST0(TestName)
877
#define INTERNAL_CATCH_DECLARE_SIG_TEST1(TestName, signature) \
878
  template<INTERNAL_CATCH_REMOVE_PARENS(signature)>           \
879
  static void TestName()
880
#define INTERNAL_CATCH_DECLARE_SIG_TEST_X(TestName, signature, ...) \
881
  template<INTERNAL_CATCH_REMOVE_PARENS(signature)>                 \
882
  static void TestName()
883

884
#define INTERNAL_CATCH_DEFINE_SIG_TEST0(TestName)
885
#define INTERNAL_CATCH_DEFINE_SIG_TEST1(TestName, signature) \
886
  template<INTERNAL_CATCH_REMOVE_PARENS(signature)>          \
887
  static void TestName()
888
#define INTERNAL_CATCH_DEFINE_SIG_TEST_X(TestName, signature, ...) \
889
  template<INTERNAL_CATCH_REMOVE_PARENS(signature)>                \
890
  static void TestName()
891

892
#define INTERNAL_CATCH_NTTP_REGISTER0(TestFunc, signature)                                                             \
893
  template<typename Type>                                                                                              \
894
  void reg_test(TypeList<Type>, Catch::NameAndTags nameAndTags) {                                                      \
895
    Catch::AutoReg(Catch::makeTestInvoker(&TestFunc<Type>), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), nameAndTags); \
896
  }
897

898
#define INTERNAL_CATCH_NTTP_REGISTER(TestFunc, signature, ...)                                                                \
899
  template<INTERNAL_CATCH_REMOVE_PARENS(signature)>                                                                           \
900
  void reg_test(Nttp<__VA_ARGS__>, Catch::NameAndTags nameAndTags) {                                                          \
901
    Catch::AutoReg(Catch::makeTestInvoker(&TestFunc<__VA_ARGS__>), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), nameAndTags); \
902
  }
903

904
#define INTERNAL_CATCH_NTTP_REGISTER_METHOD0(TestName, signature, ...)                                              \
905
  template<typename Type>                                                                                           \
906
  void reg_test(TypeList<Type>, Catch::StringRef className, Catch::NameAndTags nameAndTags) {                       \
907
    Catch::AutoReg(Catch::makeTestInvoker(&TestName<Type>::test), CATCH_INTERNAL_LINEINFO, className, nameAndTags); \
908
  }
909

910
#define INTERNAL_CATCH_NTTP_REGISTER_METHOD(TestName, signature, ...)                                                      \
911
  template<INTERNAL_CATCH_REMOVE_PARENS(signature)>                                                                        \
912
  void reg_test(Nttp<__VA_ARGS__>, Catch::StringRef className, Catch::NameAndTags nameAndTags) {                           \
913
    Catch::AutoReg(Catch::makeTestInvoker(&TestName<__VA_ARGS__>::test), CATCH_INTERNAL_LINEINFO, className, nameAndTags); \
914
  }
915

916
#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD0(TestName, ClassName)
917
#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD1(TestName, ClassName, signature) \
918
  template<typename TestType>                                                   \
919
  struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName)<TestType> {         \
920
    void test();                                                                \
921
  }
922

923
#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X(TestName, ClassName, signature, ...) \
924
  template<INTERNAL_CATCH_REMOVE_PARENS(signature)>                                   \
925
  struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName)<__VA_ARGS__> {            \
926
    void test();                                                                      \
927
  }
928

929
#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD0(TestName)
930
#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD1(TestName, signature) \
931
  template<typename TestType>                                       \
932
  void INTERNAL_CATCH_MAKE_NAMESPACE(TestName)::TestName<TestType>::test()
933
#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X(TestName, signature, ...) \
934
  template<INTERNAL_CATCH_REMOVE_PARENS(signature)>                       \
935
  void INTERNAL_CATCH_MAKE_NAMESPACE(TestName)::TestName<__VA_ARGS__>::test()
936

937
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
938
#define INTERNAL_CATCH_NTTP_0
939
#define INTERNAL_CATCH_NTTP_GEN(...)                               \
940
  INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__,                        \
941
                               INTERNAL_CATCH_NTTP_1(__VA_ARGS__), \
942
                               INTERNAL_CATCH_NTTP_1(__VA_ARGS__), \
943
                               INTERNAL_CATCH_NTTP_1(__VA_ARGS__), \
944
                               INTERNAL_CATCH_NTTP_1(__VA_ARGS__), \
945
                               INTERNAL_CATCH_NTTP_1(__VA_ARGS__), \
946
                               INTERNAL_CATCH_NTTP_1(__VA_ARGS__), \
947
                               INTERNAL_CATCH_NTTP_1(__VA_ARGS__), \
948
                               INTERNAL_CATCH_NTTP_1(__VA_ARGS__), \
949
                               INTERNAL_CATCH_NTTP_1(__VA_ARGS__), \
950
                               INTERNAL_CATCH_NTTP_1(__VA_ARGS__), \
951
                               INTERNAL_CATCH_NTTP_0)
952
#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, ...)            \
953
  INTERNAL_CATCH_VA_NARGS_IMPL("dummy",                                 \
954
                               __VA_ARGS__,                             \
955
                               INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, \
956
                               INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, \
957
                               INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, \
958
                               INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, \
959
                               INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, \
960
                               INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, \
961
                               INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, \
962
                               INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, \
963
                               INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, \
964
                               INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD1,  \
965
                               INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD0)  \
966
  (TestName, __VA_ARGS__)
967
#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, ...) \
968
  INTERNAL_CATCH_VA_NARGS_IMPL("dummy",                                  \
969
                               __VA_ARGS__,                              \
970
                               INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, \
971
                               INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, \
972
                               INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, \
973
                               INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, \
974
                               INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, \
975
                               INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, \
976
                               INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, \
977
                               INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, \
978
                               INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, \
979
                               INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD1,  \
980
                               INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD0)  \
981
  (TestName, ClassName, __VA_ARGS__)
982
#define INTERNAL_CATCH_NTTP_REG_METHOD_GEN(TestName, ...)            \
983
  INTERNAL_CATCH_VA_NARGS_IMPL("dummy",                              \
984
                               __VA_ARGS__,                          \
985
                               INTERNAL_CATCH_NTTP_REGISTER_METHOD,  \
986
                               INTERNAL_CATCH_NTTP_REGISTER_METHOD,  \
987
                               INTERNAL_CATCH_NTTP_REGISTER_METHOD,  \
988
                               INTERNAL_CATCH_NTTP_REGISTER_METHOD,  \
989
                               INTERNAL_CATCH_NTTP_REGISTER_METHOD,  \
990
                               INTERNAL_CATCH_NTTP_REGISTER_METHOD,  \
991
                               INTERNAL_CATCH_NTTP_REGISTER_METHOD,  \
992
                               INTERNAL_CATCH_NTTP_REGISTER_METHOD,  \
993
                               INTERNAL_CATCH_NTTP_REGISTER_METHOD,  \
994
                               INTERNAL_CATCH_NTTP_REGISTER_METHOD0, \
995
                               INTERNAL_CATCH_NTTP_REGISTER_METHOD0) \
996
  (TestName, __VA_ARGS__)
997
#define INTERNAL_CATCH_NTTP_REG_GEN(TestFunc, ...)            \
998
  INTERNAL_CATCH_VA_NARGS_IMPL("dummy",                       \
999
                               __VA_ARGS__,                   \
1000
                               INTERNAL_CATCH_NTTP_REGISTER,  \
1001
                               INTERNAL_CATCH_NTTP_REGISTER,  \
1002
                               INTERNAL_CATCH_NTTP_REGISTER,  \
1003
                               INTERNAL_CATCH_NTTP_REGISTER,  \
1004
                               INTERNAL_CATCH_NTTP_REGISTER,  \
1005
                               INTERNAL_CATCH_NTTP_REGISTER,  \
1006
                               INTERNAL_CATCH_NTTP_REGISTER,  \
1007
                               INTERNAL_CATCH_NTTP_REGISTER,  \
1008
                               INTERNAL_CATCH_NTTP_REGISTER,  \
1009
                               INTERNAL_CATCH_NTTP_REGISTER0, \
1010
                               INTERNAL_CATCH_NTTP_REGISTER0) \
1011
  (TestFunc, __VA_ARGS__)
1012
#define INTERNAL_CATCH_DEFINE_SIG_TEST(TestName, ...)            \
1013
  INTERNAL_CATCH_VA_NARGS_IMPL("dummy",                          \
1014
                               __VA_ARGS__,                      \
1015
                               INTERNAL_CATCH_DEFINE_SIG_TEST_X, \
1016
                               INTERNAL_CATCH_DEFINE_SIG_TEST_X, \
1017
                               INTERNAL_CATCH_DEFINE_SIG_TEST_X, \
1018
                               INTERNAL_CATCH_DEFINE_SIG_TEST_X, \
1019
                               INTERNAL_CATCH_DEFINE_SIG_TEST_X, \
1020
                               INTERNAL_CATCH_DEFINE_SIG_TEST_X, \
1021
                               INTERNAL_CATCH_DEFINE_SIG_TEST_X, \
1022
                               INTERNAL_CATCH_DEFINE_SIG_TEST_X, \
1023
                               INTERNAL_CATCH_DEFINE_SIG_TEST_X, \
1024
                               INTERNAL_CATCH_DEFINE_SIG_TEST1,  \
1025
                               INTERNAL_CATCH_DEFINE_SIG_TEST0)  \
1026
  (TestName, __VA_ARGS__)
1027
#define INTERNAL_CATCH_DECLARE_SIG_TEST(TestName, ...)            \
1028
  INTERNAL_CATCH_VA_NARGS_IMPL("dummy",                           \
1029
                               __VA_ARGS__,                       \
1030
                               INTERNAL_CATCH_DECLARE_SIG_TEST_X, \
1031
                               INTERNAL_CATCH_DECLARE_SIG_TEST_X, \
1032
                               INTERNAL_CATCH_DECLARE_SIG_TEST_X, \
1033
                               INTERNAL_CATCH_DECLARE_SIG_TEST_X, \
1034
                               INTERNAL_CATCH_DECLARE_SIG_TEST_X, \
1035
                               INTERNAL_CATCH_DECLARE_SIG_TEST_X, \
1036
                               INTERNAL_CATCH_DEFINE_SIG_TEST_X,  \
1037
                               INTERNAL_CATCH_DECLARE_SIG_TEST_X, \
1038
                               INTERNAL_CATCH_DECLARE_SIG_TEST_X, \
1039
                               INTERNAL_CATCH_DECLARE_SIG_TEST1,  \
1040
                               INTERNAL_CATCH_DECLARE_SIG_TEST0)  \
1041
  (TestName, __VA_ARGS__)
1042
#define INTERNAL_CATCH_REMOVE_PARENS_GEN(...)                       \
1043
  INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__,                         \
1044
                               INTERNAL_CATCH_REMOVE_PARENS_11_ARG, \
1045
                               INTERNAL_CATCH_REMOVE_PARENS_10_ARG, \
1046
                               INTERNAL_CATCH_REMOVE_PARENS_9_ARG,  \
1047
                               INTERNAL_CATCH_REMOVE_PARENS_8_ARG,  \
1048
                               INTERNAL_CATCH_REMOVE_PARENS_7_ARG,  \
1049
                               INTERNAL_CATCH_REMOVE_PARENS_6_ARG,  \
1050
                               INTERNAL_CATCH_REMOVE_PARENS_5_ARG,  \
1051
                               INTERNAL_CATCH_REMOVE_PARENS_4_ARG,  \
1052
                               INTERNAL_CATCH_REMOVE_PARENS_3_ARG,  \
1053
                               INTERNAL_CATCH_REMOVE_PARENS_2_ARG,  \
1054
                               INTERNAL_CATCH_REMOVE_PARENS_1_ARG)  \
1055
  (__VA_ARGS__)
1056
#else
1057
#define INTERNAL_CATCH_NTTP_0(signature)
1058
#define INTERNAL_CATCH_NTTP_GEN(...)                                              \
1059
  INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__,           \
1060
                                                           INTERNAL_CATCH_NTTP_1, \
1061
                                                           INTERNAL_CATCH_NTTP_1, \
1062
                                                           INTERNAL_CATCH_NTTP_1, \
1063
                                                           INTERNAL_CATCH_NTTP_1, \
1064
                                                           INTERNAL_CATCH_NTTP_1, \
1065
                                                           INTERNAL_CATCH_NTTP_1, \
1066
                                                           INTERNAL_CATCH_NTTP_1, \
1067
                                                           INTERNAL_CATCH_NTTP_1, \
1068
                                                           INTERNAL_CATCH_NTTP_1, \
1069
                                                           INTERNAL_CATCH_NTTP_1, \
1070
                                                           INTERNAL_CATCH_NTTP_0)(__VA_ARGS__))
1071
#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, ...)                                        \
1072
  INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL("dummy",                                 \
1073
                                                           __VA_ARGS__,                             \
1074
                                                           INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, \
1075
                                                           INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, \
1076
                                                           INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, \
1077
                                                           INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, \
1078
                                                           INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, \
1079
                                                           INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, \
1080
                                                           INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, \
1081
                                                           INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, \
1082
                                                           INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, \
1083
                                                           INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD1,  \
1084
                                                           INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD0)(TestName, __VA_ARGS__))
1085
#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, ...)                             \
1086
  INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL("dummy",                                  \
1087
                                                           __VA_ARGS__,                              \
1088
                                                           INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, \
1089
                                                           INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, \
1090
                                                           INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, \
1091
                                                           INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, \
1092
                                                           INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, \
1093
                                                           INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, \
1094
                                                           INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, \
1095
                                                           INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, \
1096
                                                           INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, \
1097
                                                           INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD1,  \
1098
                                                           INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD0)(TestName, ClassName, __VA_ARGS__))
1099
#define INTERNAL_CATCH_NTTP_REG_METHOD_GEN(TestName, ...)                                        \
1100
  INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL("dummy",                              \
1101
                                                           __VA_ARGS__,                          \
1102
                                                           INTERNAL_CATCH_NTTP_REGISTER_METHOD,  \
1103
                                                           INTERNAL_CATCH_NTTP_REGISTER_METHOD,  \
1104
                                                           INTERNAL_CATCH_NTTP_REGISTER_METHOD,  \
1105
                                                           INTERNAL_CATCH_NTTP_REGISTER_METHOD,  \
1106
                                                           INTERNAL_CATCH_NTTP_REGISTER_METHOD,  \
1107
                                                           INTERNAL_CATCH_NTTP_REGISTER_METHOD,  \
1108
                                                           INTERNAL_CATCH_NTTP_REGISTER_METHOD,  \
1109
                                                           INTERNAL_CATCH_NTTP_REGISTER_METHOD,  \
1110
                                                           INTERNAL_CATCH_NTTP_REGISTER_METHOD,  \
1111
                                                           INTERNAL_CATCH_NTTP_REGISTER_METHOD0, \
1112
                                                           INTERNAL_CATCH_NTTP_REGISTER_METHOD0)(TestName, __VA_ARGS__))
1113
#define INTERNAL_CATCH_NTTP_REG_GEN(TestFunc, ...)                                        \
1114
  INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL("dummy",                       \
1115
                                                           __VA_ARGS__,                   \
1116
                                                           INTERNAL_CATCH_NTTP_REGISTER,  \
1117
                                                           INTERNAL_CATCH_NTTP_REGISTER,  \
1118
                                                           INTERNAL_CATCH_NTTP_REGISTER,  \
1119
                                                           INTERNAL_CATCH_NTTP_REGISTER,  \
1120
                                                           INTERNAL_CATCH_NTTP_REGISTER,  \
1121
                                                           INTERNAL_CATCH_NTTP_REGISTER,  \
1122
                                                           INTERNAL_CATCH_NTTP_REGISTER,  \
1123
                                                           INTERNAL_CATCH_NTTP_REGISTER,  \
1124
                                                           INTERNAL_CATCH_NTTP_REGISTER,  \
1125
                                                           INTERNAL_CATCH_NTTP_REGISTER0, \
1126
                                                           INTERNAL_CATCH_NTTP_REGISTER0)(TestFunc, __VA_ARGS__))
1127
#define INTERNAL_CATCH_DEFINE_SIG_TEST(TestName, ...)                                        \
1128
  INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL("dummy",                          \
1129
                                                           __VA_ARGS__,                      \
1130
                                                           INTERNAL_CATCH_DEFINE_SIG_TEST_X, \
1131
                                                           INTERNAL_CATCH_DEFINE_SIG_TEST_X, \
1132
                                                           INTERNAL_CATCH_DEFINE_SIG_TEST_X, \
1133
                                                           INTERNAL_CATCH_DEFINE_SIG_TEST_X, \
1134
                                                           INTERNAL_CATCH_DEFINE_SIG_TEST_X, \
1135
                                                           INTERNAL_CATCH_DEFINE_SIG_TEST_X, \
1136
                                                           INTERNAL_CATCH_DEFINE_SIG_TEST_X, \
1137
                                                           INTERNAL_CATCH_DEFINE_SIG_TEST_X, \
1138
                                                           INTERNAL_CATCH_DEFINE_SIG_TEST_X, \
1139
                                                           INTERNAL_CATCH_DEFINE_SIG_TEST1,  \
1140
                                                           INTERNAL_CATCH_DEFINE_SIG_TEST0)(TestName, __VA_ARGS__))
1141
#define INTERNAL_CATCH_DECLARE_SIG_TEST(TestName, ...)                                        \
1142
  INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL("dummy",                           \
1143
                                                           __VA_ARGS__,                       \
1144
                                                           INTERNAL_CATCH_DECLARE_SIG_TEST_X, \
1145
                                                           INTERNAL_CATCH_DECLARE_SIG_TEST_X, \
1146
                                                           INTERNAL_CATCH_DECLARE_SIG_TEST_X, \
1147
                                                           INTERNAL_CATCH_DECLARE_SIG_TEST_X, \
1148
                                                           INTERNAL_CATCH_DECLARE_SIG_TEST_X, \
1149
                                                           INTERNAL_CATCH_DECLARE_SIG_TEST_X, \
1150
                                                           INTERNAL_CATCH_DEFINE_SIG_TEST_X,  \
1151
                                                           INTERNAL_CATCH_DECLARE_SIG_TEST_X, \
1152
                                                           INTERNAL_CATCH_DECLARE_SIG_TEST_X, \
1153
                                                           INTERNAL_CATCH_DECLARE_SIG_TEST1,  \
1154
                                                           INTERNAL_CATCH_DECLARE_SIG_TEST0)(TestName, __VA_ARGS__))
1155
#define INTERNAL_CATCH_REMOVE_PARENS_GEN(...)                                                   \
1156
  INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__,                         \
1157
                                                           INTERNAL_CATCH_REMOVE_PARENS_11_ARG, \
1158
                                                           INTERNAL_CATCH_REMOVE_PARENS_10_ARG, \
1159
                                                           INTERNAL_CATCH_REMOVE_PARENS_9_ARG,  \
1160
                                                           INTERNAL_CATCH_REMOVE_PARENS_8_ARG,  \
1161
                                                           INTERNAL_CATCH_REMOVE_PARENS_7_ARG,  \
1162
                                                           INTERNAL_CATCH_REMOVE_PARENS_6_ARG,  \
1163
                                                           INTERNAL_CATCH_REMOVE_PARENS_5_ARG,  \
1164
                                                           INTERNAL_CATCH_REMOVE_PARENS_4_ARG,  \
1165
                                                           INTERNAL_CATCH_REMOVE_PARENS_3_ARG,  \
1166
                                                           INTERNAL_CATCH_REMOVE_PARENS_2_ARG,  \
1167
                                                           INTERNAL_CATCH_REMOVE_PARENS_1_ARG)(__VA_ARGS__))
1168
#endif
1169

1170
// end catch_preprocessor.hpp
1171
// start catch_meta.hpp
1172

1173
#include <type_traits>
1174

1175
namespace Catch {
1176
  template<typename T>
1177
  struct always_false : std::false_type {
1178
  };
1179

1180
  template<typename>
1181
  struct true_given : std::true_type {
1182
  };
1183
  struct is_callable_tester {
1184
    template<typename Fun, typename... Args>
1185
    true_given<decltype(std::declval<Fun>()(std::declval<Args>()...))> static test(int);
1186
    template<typename...>
1187
    std::false_type static test(...);
1188
  };
1189

1190
  template<typename T>
1191
  struct is_callable;
1192

1193
  template<typename Fun, typename... Args>
1194
  struct is_callable<Fun(Args...)> : decltype(is_callable_tester::test<Fun, Args...>(0)) {
1195
  };
1196

1197
#if defined(__cpp_lib_is_invocable) && __cpp_lib_is_invocable >= 201703
1198
  // std::result_of is deprecated in C++17 and removed in C++20. Hence, it is
1199
  // replaced with std::invoke_result here.
1200
  template<typename Func, typename... U>
1201
  using FunctionReturnType = std::remove_reference_t<std::remove_cv_t<std::invoke_result_t<Func, U...>>>;
1202
#else
1203
  // Keep ::type here because we still support C++11
1204
  template<typename Func, typename... U>
1205
  using FunctionReturnType = typename std::remove_reference<typename std::remove_cv<typename std::result_of<Func(U...)>::type>::type>::type;
1206
#endif
1207

1208
} // namespace Catch
1209

1210
namespace mpl_ {
1211
  struct na;
1212
}
1213

1214
// end catch_meta.hpp
1215
namespace Catch {
1216
  template<typename C>
1217
  class TestInvokerAsMethod : public ITestInvoker {
1218
    void (C::*m_testAsMethod)();
1219

1220
  public:
1221
    TestInvokerAsMethod(void (C::*testAsMethod)()) noexcept
1222
        : m_testAsMethod(testAsMethod) {
1223
    }
1224

1225
    void invoke() const override {
1226
      C obj;
1227
      (obj.*m_testAsMethod)();
1228
    }
1229
  };
1230

1231
  auto makeTestInvoker(void (*testAsFunction)()) noexcept -> ITestInvoker *;
1232

1233
  template<typename C>
1234
  auto makeTestInvoker(void (C::*testAsMethod)()) noexcept -> ITestInvoker * {
1235
    return new (std::nothrow) TestInvokerAsMethod<C>(testAsMethod);
1236
  }
1237

1238
  struct NameAndTags {
1239
    NameAndTags(StringRef const &name_ = StringRef(), StringRef const &tags_ = StringRef()) noexcept;
1240
    StringRef name;
1241
    StringRef tags;
1242
  };
1243

1244 1
  struct AutoReg : NonCopyable {
1245
    AutoReg(ITestInvoker *invoker, SourceLineInfo const &lineInfo, StringRef const &classOrMethod, NameAndTags const &nameAndTags) noexcept;
1246
    ~AutoReg();
1247
  };
1248

1249
} // end namespace Catch
1250

1251
#if defined(CATCH_CONFIG_DISABLE)
1252
#define INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(TestName, ...) static void TestName()
1253
#define INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(TestName, ClassName, ...) \
1254
  namespace {                                                                    \
1255
    struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) {                  \
1256
      void test();                                                               \
1257
    };                                                                           \
1258
  }                                                                              \
1259
  void TestName::test()
1260
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2(TestName, TestFunc, Name, Tags, Signature, ...) \
1261
  INTERNAL_CATCH_DEFINE_SIG_TEST(TestFunc, INTERNAL_CATCH_REMOVE_PARENS(Signature))
1262
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2(TestNameClass, TestName, ClassName, Name, Tags, Signature, ...) \
1263
  namespace {                                                                                                                      \
1264
    namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) {                                                                            \
1265
      INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, INTERNAL_CATCH_REMOVE_PARENS(Signature));                        \
1266
    }                                                                                                                              \
1267
  }                                                                                                                                \
1268
  INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature))
1269

1270
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1271
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(Name, Tags, ...)                                                         \
1272
  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____), \
1273
                                                      INTERNAL_CATCH_UNIQUE_NAME(                                                  \
1274
                                                          ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____),             \
1275
                                                      Name,                                                                        \
1276
                                                      Tags,                                                                        \
1277
                                                      typename TestType,                                                           \
1278
                                                      __VA_ARGS__)
1279
#else
1280
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(Name, Tags, ...)                    \
1281
  INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2(            \
1282
      INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____),            \
1283
      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____), \
1284
      Name,                                                                                   \
1285
      Tags,                                                                                   \
1286
      typename TestType,                                                                      \
1287
      __VA_ARGS__))
1288
#endif
1289

1290
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1291
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(Name, Tags, Signature, ...)                                          \
1292
  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____), \
1293
                                                      INTERNAL_CATCH_UNIQUE_NAME(                                                  \
1294
                                                          ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____),             \
1295
                                                      Name,                                                                        \
1296
                                                      Tags,                                                                        \
1297
                                                      Signature,                                                                   \
1298
                                                      __VA_ARGS__)
1299
#else
1300
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(Name, Tags, Signature, ...)     \
1301
  INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2(            \
1302
      INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____),            \
1303
      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____), \
1304
      Name,                                                                                   \
1305
      Tags,                                                                                   \
1306
      Signature,                                                                              \
1307
      __VA_ARGS__))
1308
#endif
1309

1310
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1311
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(ClassName, Name, Tags, ...)                                    \
1312
  INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2(INTERNAL_CATCH_UNIQUE_NAME(                                        \
1313
                                                                 ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____), \
1314
                                                             INTERNAL_CATCH_UNIQUE_NAME(                                        \
1315
                                                                 ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____),              \
1316
                                                             ClassName,                                                         \
1317
                                                             Name,                                                              \
1318
                                                             Tags,                                                              \
1319
                                                             typename T,                                                        \
1320
                                                             __VA_ARGS__)
1321
#else
1322
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(ClassName, Name, Tags, ...)    \
1323
  INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2(       \
1324
      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____), \
1325
      INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____),              \
1326
      ClassName,                                                                                \
1327
      Name,                                                                                     \
1328
      Tags,                                                                                     \
1329
      typename T,                                                                               \
1330
      __VA_ARGS__))
1331
#endif
1332

1333
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1334
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(ClassName, Name, Tags, Signature, ...)                     \
1335
  INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2(INTERNAL_CATCH_UNIQUE_NAME(                                        \
1336
                                                                 ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____), \
1337
                                                             INTERNAL_CATCH_UNIQUE_NAME(                                        \
1338
                                                                 ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____),              \
1339
                                                             ClassName,                                                         \
1340
                                                             Name,                                                              \
1341
                                                             Tags,                                                              \
1342
                                                             Signature,                                                         \
1343
                                                             __VA_ARGS__)
1344
#else
1345
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(ClassName, Name, Tags, Signature, ...) \
1346
  INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2(                   \
1347
      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____),             \
1348
      INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____),                          \
1349
      ClassName,                                                                                            \
1350
      Name,                                                                                                 \
1351
      Tags,                                                                                                 \
1352
      Signature,                                                                                            \
1353
      __VA_ARGS__))
1354
#endif
1355
#endif
1356

1357
///////////////////////////////////////////////////////////////////////////////
1358
#define INTERNAL_CATCH_TESTCASE2(TestName, ...)                                                 \
1359
  static void TestName();                                                                       \
1360
  CATCH_INTERNAL_START_WARNINGS_SUPPRESSION                                                     \
1361
  CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS                                                      \
1362
  namespace {                                                                                   \
1363
    Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME(autoRegistrar)(Catch::makeTestInvoker(&TestName), \
1364
                                                             CATCH_INTERNAL_LINEINFO,           \
1365
                                                             Catch::StringRef(),                \
1366
                                                             Catch::NameAndTags{__VA_ARGS__});  \
1367
  } /* NOLINT */                                                                                \
1368
  CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION                                                      \
1369
  static void TestName()
1370
#define INTERNAL_CATCH_TESTCASE(...) INTERNAL_CATCH_TESTCASE2(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____T_E_S_T____), __VA_ARGS__)
1371

1372
///////////////////////////////////////////////////////////////////////////////
1373
#define INTERNAL_CATCH_METHOD_AS_TEST_CASE(QualifiedMethod, ...)                                       \
1374
  CATCH_INTERNAL_START_WARNINGS_SUPPRESSION                                                            \
1375
  CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS                                                             \
1376
  namespace {                                                                                          \
1377
    Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME(autoRegistrar)(Catch::makeTestInvoker(&QualifiedMethod), \
1378
                                                             CATCH_INTERNAL_LINEINFO,                  \
1379
                                                             "&" #QualifiedMethod,                     \
1380
                                                             Catch::NameAndTags{__VA_ARGS__});         \
1381
  } /* NOLINT */                                                                                       \
1382
  CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
1383

1384
///////////////////////////////////////////////////////////////////////////////
1385
#define INTERNAL_CATCH_TEST_CASE_METHOD2(TestName, ClassName, ...)                                          \
1386
  CATCH_INTERNAL_START_WARNINGS_SUPPRESSION                                                                 \
1387
  CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS                                                                  \
1388
  namespace {                                                                                               \
1389
    struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) {                                             \
1390
      void test();                                                                                          \
1391
    };                                                                                                      \
1392
    Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME(autoRegistrar)(Catch::makeTestInvoker(&TestName::test),       \
1393
                                                             CATCH_INTERNAL_LINEINFO,                       \
1394
                                                             #ClassName,                                    \
1395
                                                             Catch::NameAndTags{__VA_ARGS__}); /* NOLINT */ \
1396
  }                                                                                                         \
1397
  CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION                                                                  \
1398
  void TestName::test()
1399
#define INTERNAL_CATCH_TEST_CASE_METHOD(ClassName, ...) \
1400
  INTERNAL_CATCH_TEST_CASE_METHOD2(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____T_E_S_T____), ClassName, __VA_ARGS__)
1401

1402
///////////////////////////////////////////////////////////////////////////////
1403
#define INTERNAL_CATCH_REGISTER_TESTCASE(Function, ...)                                                                                         \
1404
  CATCH_INTERNAL_START_WARNINGS_SUPPRESSION                                                                                                     \
1405
  CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS                                                                                                      \
1406
  Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME(                                                                                                    \
1407
      autoRegistrar)(Catch::makeTestInvoker(Function), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{__VA_ARGS__}); /* NOLINT \
1408
                                                                                                                                       */       \
1409
  CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
1410

1411
///////////////////////////////////////////////////////////////////////////////
1412
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_2(TestName, TestFunc, Name, Tags, Signature, ...)                                                 \
1413
  CATCH_INTERNAL_START_WARNINGS_SUPPRESSION                                                                                                 \
1414
  CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS                                                                                                  \
1415
  CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS                                                                                            \
1416
  CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS                                                                                          \
1417
  INTERNAL_CATCH_DECLARE_SIG_TEST(TestFunc, INTERNAL_CATCH_REMOVE_PARENS(Signature));                                                       \
1418
  namespace {                                                                                                                               \
1419
    namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) {                                                                                     \
1420
      INTERNAL_CATCH_TYPE_GEN                                                                                                               \
1421
      INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))                                                                      \
1422
      INTERNAL_CATCH_NTTP_REG_GEN(TestFunc, INTERNAL_CATCH_REMOVE_PARENS(Signature))                                                        \
1423
      template<typename... Types>                                                                                                           \
1424
      struct TestName {                                                                                                                     \
1425
        TestName() {                                                                                                                        \
1426
          int index = 0;                                                                                                                    \
1427
          constexpr char const *tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};                      \
1428
          using expander = int[];                                                                                                           \
1429
          (void)expander{(reg_test(Types{}, Catch::NameAndTags{Name " - " + std::string(tmpl_types[index]), Tags}), index++)...}; /* NOLINT \
1430
                                                                                                                                   */       \
1431
        }                                                                                                                                   \
1432
      };                                                                                                                                    \
1433
      static int INTERNAL_CATCH_UNIQUE_NAME(globalRegistrar) = []() {                                                                       \
1434
        TestName<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(__VA_ARGS__)>();                                                                 \
1435
        return 0;                                                                                                                           \
1436
      }();                                                                                                                                  \
1437
    }                                                                                                                                       \
1438
  }                                                                                                                                         \
1439
  CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION                                                                                                  \
1440
  INTERNAL_CATCH_DEFINE_SIG_TEST(TestFunc, INTERNAL_CATCH_REMOVE_PARENS(Signature))
1441

1442
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1443
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...)                                                                    \
1444
  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____),            \
1445
                                      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____), \
1446
                                      Name,                                                                                   \
1447
                                      Tags,                                                                                   \
1448
                                      typename TestType,                                                                      \
1449
                                      __VA_ARGS__)
1450
#else
1451
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...)                                                                        \
1452
  INTERNAL_CATCH_EXPAND_VARGS(                                                                                                    \
1453
      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____),            \
1454
                                          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____), \
1455
                                          Name,                                                                                   \
1456
                                          Tags,                                                                                   \
1457
                                          typename TestType,                                                                      \
1458
                                          __VA_ARGS__))
1459
#endif
1460

1461
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1462
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG(Name, Tags, Signature, ...)                                                     \
1463
  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____),            \
1464
                                      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____), \
1465
                                      Name,                                                                                   \
1466
                                      Tags,                                                                                   \
1467
                                      Signature,                                                                              \
1468
                                      __VA_ARGS__)
1469
#else
1470
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG(Name, Tags, Signature, ...)                                                         \
1471
  INTERNAL_CATCH_EXPAND_VARGS(                                                                                                    \
1472
      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____),            \
1473
                                          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____), \
1474
                                          Name,                                                                                   \
1475
                                          Tags,                                                                                   \
1476
                                          Signature,                                                                              \
1477
                                          __VA_ARGS__))
1478
#endif
1479

1480
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(TestName, TestFuncName, Name, Tags, Signature, TmplTypes, TypesList)          \
1481
  CATCH_INTERNAL_START_WARNINGS_SUPPRESSION                                                                                      \
1482
  CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS                                                                                       \
1483
  CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS                                                                                 \
1484
  CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS                                                                               \
1485
  template<typename TestType>                                                                                                    \
1486
  static void TestFuncName();                                                                                                    \
1487
  namespace {                                                                                                                    \
1488
    namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) {                                                                          \
1489
      INTERNAL_CATCH_TYPE_GEN                                                                                                    \
1490
      INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))                                                           \
1491
      template<typename... Types>                                                                                                \
1492
      struct TestName {                                                                                                          \
1493
        void reg_tests() {                                                                                                       \
1494
          int index = 0;                                                                                                         \
1495
          using expander = int[];                                                                                                \
1496
          constexpr char const *tmpl_types[]                                                                                     \
1497
              = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};              \
1498
          constexpr char const *types_list[]                                                                                     \
1499
              = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};              \
1500
          constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);                                                 \
1501
          (void)expander{(Catch::AutoReg(Catch::makeTestInvoker(&TestFuncName<Types>),                                           \
1502
                                         CATCH_INTERNAL_LINEINFO,                                                                \
1503
                                         Catch::StringRef(),                                                                     \
1504
                                         Catch::NameAndTags{Name " - " + std::string(tmpl_types[index / num_types]) + "<"        \
1505
                                                                + std::string(types_list[index % num_types]) + ">",              \
1506
                                                            Tags}),                                                              \
1507
                          index++)...}; /* NOLINT */                                                                             \
1508
        }                                                                                                                        \
1509
      };                                                                                                                         \
1510
      static int INTERNAL_CATCH_UNIQUE_NAME(globalRegistrar) = []() {                                                            \
1511
        using TestInit =                                                                                                         \
1512
            typename create<TestName,                                                                                            \
1513
                            decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS(TmplTypes)>()),                                    \
1514
                            TypeList<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(INTERNAL_CATCH_REMOVE_PARENS(TypesList))>>::type; \
1515
        TestInit t;                                                                                                              \
1516
        t.reg_tests();                                                                                                           \
1517
        return 0;                                                                                                                \
1518
      }();                                                                                                                       \
1519
    }                                                                                                                            \
1520
  }                                                                                                                              \
1521
  CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION                                                                                       \
1522
  template<typename TestType>                                                                                                    \
1523
  static void TestFuncName()
1524

1525
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1526
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE(Name, Tags, ...)                                                                   \
1527
  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____),            \
1528
                                             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____), \
1529
                                             Name,                                                                                   \
1530
                                             Tags,                                                                                   \
1531
                                             typename T,                                                                             \
1532
                                             __VA_ARGS__)
1533
#else
1534
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE(Name, Tags, ...)                                                                       \
1535
  INTERNAL_CATCH_EXPAND_VARGS(                                                                                                           \
1536
      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____),            \
1537
                                                 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____), \
1538
                                                 Name,                                                                                   \
1539
                                                 Tags,                                                                                   \
1540
                                                 typename T,                                                                             \
1541
                                                 __VA_ARGS__))
1542
#endif
1543

1544
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1545
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG(Name, Tags, Signature, ...)                                                    \
1546
  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____),            \
1547
                                             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____), \
1548
                                             Name,                                                                                   \
1549
                                             Tags,                                                                                   \
1550
                                             Signature,                                                                              \
1551
                                             __VA_ARGS__)
1552
#else
1553
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG(Name, Tags, Signature, ...)                                                        \
1554
  INTERNAL_CATCH_EXPAND_VARGS(                                                                                                           \
1555
      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____),            \
1556
                                                 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____), \
1557
                                                 Name,                                                                                   \
1558
                                                 Tags,                                                                                   \
1559
                                                 Signature,                                                                              \
1560
                                                 __VA_ARGS__))
1561
#endif
1562

1563
#define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2(TestName, TestFunc, Name, Tags, TmplList)                                       \
1564
  CATCH_INTERNAL_START_WARNINGS_SUPPRESSION                                                                                      \
1565
  CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS                                                                                       \
1566
  CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS                                                                               \
1567
  template<typename TestType>                                                                                                    \
1568
  static void TestFunc();                                                                                                        \
1569
  namespace {                                                                                                                    \
1570
    namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) {                                                                          \
1571
      INTERNAL_CATCH_TYPE_GEN                                                                                                    \
1572
      template<typename... Types>                                                                                                \
1573
      struct TestName {                                                                                                          \
1574
        void reg_tests() {                                                                                                       \
1575
          int index = 0;                                                                                                         \
1576
          using expander = int[];                                                                                                \
1577
          (void)expander{(Catch::AutoReg(Catch::makeTestInvoker(&TestFunc<Types>),                                               \
1578
                                         CATCH_INTERNAL_LINEINFO,                                                                \
1579
                                         Catch::StringRef(),                                                                     \
1580
                                         Catch::NameAndTags{Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + " - " \
1581
                                                                + std::to_string(index),                                         \
1582
                                                            Tags}),                                                              \
1583
                          index++)...}; /* NOLINT */                                                                             \
1584
        }                                                                                                                        \
1585
      };                                                                                                                         \
1586
      static int INTERNAL_CATCH_UNIQUE_NAME(globalRegistrar) = []() {                                                            \
1587
        using TestInit = typename convert<TestName, TmplList>::type;                                                             \
1588
        TestInit t;                                                                                                              \
1589
        t.reg_tests();                                                                                                           \
1590
        return 0;                                                                                                                \
1591
      }();                                                                                                                       \
1592
    }                                                                                                                            \
1593
  }                                                                                                                              \
1594
  CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION                                                                                       \
1595
  template<typename TestType>                                                                                                    \
1596
  static void TestFunc()
1597

1598
#define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE(Name, Tags, TmplList)                                                               \
1599
  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____),            \
1600
                                           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____), \
1601
                                           Name,                                                                                   \
1602
                                           Tags,                                                                                   \
1603
                                           TmplList)
1604

1605
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2(TestNameClass, TestName, ClassName, Name, Tags, Signature, ...)              \
1606
  CATCH_INTERNAL_START_WARNINGS_SUPPRESSION                                                                                     \
1607
  CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS                                                                                      \
1608
  CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS                                                                                \
1609
  CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS                                                                              \
1610
  namespace {                                                                                                                   \
1611
    namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) {                                                                         \
1612
      INTERNAL_CATCH_TYPE_GEN                                                                                                   \
1613
      INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))                                                          \
1614
      INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, INTERNAL_CATCH_REMOVE_PARENS(Signature));                     \
1615
      INTERNAL_CATCH_NTTP_REG_METHOD_GEN(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature))                                     \
1616
      template<typename... Types>                                                                                               \
1617
      struct TestNameClass {                                                                                                    \
1618
        TestNameClass() {                                                                                                       \
1619
          int index = 0;                                                                                                        \
1620
          constexpr char const *tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};          \
1621
          using expander = int[];                                                                                               \
1622
          (void)expander{(reg_test(Types{}, #ClassName, Catch::NameAndTags{Name " - " + std::string(tmpl_types[index]), Tags}), \
1623
                          index++)...}; /* NOLINT */                                                                            \
1624
        }                                                                                                                       \
1625
      };                                                                                                                        \
1626
      static int INTERNAL_CATCH_UNIQUE_NAME(globalRegistrar) = []() {                                                           \
1627
        TestNameClass<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(__VA_ARGS__)>();                                                \
1628
        return 0;                                                                                                               \
1629
      }();                                                                                                                      \
1630
    }                                                                                                                           \
1631
  }                                                                                                                             \
1632
  CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION                                                                                      \
1633
  INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature))
1634

1635
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1636
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD(ClassName, Name, Tags, ...)                                                           \
1637
  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____), \
1638
                                             INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____),              \
1639
                                             ClassName,                                                                                \
1640
                                             Name,                                                                                     \
1641
                                             Tags,                                                                                     \
1642
                                             typename T,                                                                               \
1643
                                             __VA_ARGS__)
1644
#else
1645
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD(ClassName, Name, Tags, ...)                                                               \
1646
  INTERNAL_CATCH_EXPAND_VARGS(                                                                                                             \
1647
      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____), \
1648
                                                 INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____),              \
1649
                                                 ClassName,                                                                                \
1650
                                                 Name,                                                                                     \
1651
                                                 Tags,                                                                                     \
1652
                                                 typename T,                                                                               \
1653
                                                 __VA_ARGS__))
1654
#endif
1655

1656
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1657
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG(ClassName, Name, Tags, Signature, ...)                                            \
1658
  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____), \
1659
                                             INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____),              \
1660
                                             ClassName,                                                                                \
1661
                                             Name,                                                                                     \
1662
                                             Tags,                                                                                     \
1663
                                             Signature,                                                                                \
1664
                                             __VA_ARGS__)
1665
#else
1666
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG(ClassName, Name, Tags, Signature, ...)                                                \
1667
  INTERNAL_CATCH_EXPAND_VARGS(                                                                                                             \
1668
      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____), \
1669
                                                 INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____),              \
1670
                                                 ClassName,                                                                                \
1671
                                                 Name,                                                                                     \
1672
                                                 Tags,                                                                                     \
1673
                                                 Signature,                                                                                \
1674
                                                 __VA_ARGS__))
1675
#endif
1676

1677
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2(TestNameClass, TestName, ClassName, Name, Tags, Signature, TmplTypes, TypesList) \
1678
  CATCH_INTERNAL_START_WARNINGS_SUPPRESSION                                                                                                 \
1679
  CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS                                                                                                  \
1680
  CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS                                                                                            \
1681
  CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS                                                                                          \
1682
  template<typename TestType>                                                                                                               \
1683
  struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName<TestType>) {                                                                     \
1684
    void test();                                                                                                                            \
1685
  };                                                                                                                                        \
1686
  namespace {                                                                                                                               \
1687
    namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestNameClass) {                                                                                \
1688
      INTERNAL_CATCH_TYPE_GEN                                                                                                               \
1689
      INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))                                                                      \
1690
      template<typename... Types>                                                                                                           \
1691
      struct TestNameClass {                                                                                                                \
1692
        void reg_tests() {                                                                                                                  \
1693
          int index = 0;                                                                                                                    \
1694
          using expander = int[];                                                                                                           \
1695
          constexpr char const *tmpl_types[]                                                                                                \
1696
              = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};                         \
1697
          constexpr char const *types_list[]                                                                                                \
1698
              = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};                         \
1699
          constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);                                                            \
1700
          (void)expander{(Catch::AutoReg(Catch::makeTestInvoker(&TestName<Types>::test),                                                    \
1701
                                         CATCH_INTERNAL_LINEINFO,                                                                           \
1702
                                         #ClassName,                                                                                        \
1703
                                         Catch::NameAndTags{Name " - " + std::string(tmpl_types[index / num_types]) + "<"                   \
1704
                                                                + std::string(types_list[index % num_types]) + ">",                         \
1705
                                                            Tags}),                                                                         \
1706
                          index++)...}; /* NOLINT */                                                                                        \
1707
        }                                                                                                                                   \
1708
      };                                                                                                                                    \
1709
      static int INTERNAL_CATCH_UNIQUE_NAME(globalRegistrar) = []() {                                                                       \
1710
        using TestInit =                                                                                                                    \
1711
            typename create<TestNameClass,                                                                                                  \
1712
                            decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS(TmplTypes)>()),                                               \
1713
                            TypeList<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(INTERNAL_CATCH_REMOVE_PARENS(TypesList))>>::type;            \
1714
        TestInit t;                                                                                                                         \
1715
        t.reg_tests();                                                                                                                      \
1716
        return 0;                                                                                                                           \
1717
      }();                                                                                                                                  \
1718
    }                                                                                                                                       \
1719
  }                                                                                                                                         \
1720
  CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION                                                                                                  \
1721
  template<typename TestType>                                                                                                               \
1722
  void TestName<TestType>::test()
1723

1724
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1725
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD(ClassName, Name, Tags, ...)                                              \
1726
  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____), \
1727
                                                     INTERNAL_CATCH_UNIQUE_NAME(                                                  \
1728
                                                         ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____),             \
1729
                                                     ClassName,                                                                   \
1730
                                                     Name,                                                                        \
1731
                                                     Tags,                                                                        \
1732
                                                     typename T,                                                                  \
1733
                                                     __VA_ARGS__)
1734
#else
1735
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD(ClassName, Name, Tags, ...)                                                  \
1736
  INTERNAL_CATCH_EXPAND_VARGS(                                                                                                        \
1737
      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____), \
1738
                                                         INTERNAL_CATCH_UNIQUE_NAME(                                                  \
1739
                                                             ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____),             \
1740
                                                         ClassName,                                                                   \
1741
                                                         Name,                                                                        \
1742
                                                         Tags,                                                                        \
1743
                                                         typename T,                                                                  \
1744
                                                         __VA_ARGS__))
1745
#endif
1746

1747
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
1748
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG(ClassName, Name, Tags, Signature, ...)                               \
1749
  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____), \
1750
                                                     INTERNAL_CATCH_UNIQUE_NAME(                                                  \
1751
                                                         ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____),             \
1752
                                                     ClassName,                                                                   \
1753
                                                     Name,                                                                        \
1754
                                                     Tags,                                                                        \
1755
                                                     Signature,                                                                   \
1756
                                                     __VA_ARGS__)
1757
#else
1758
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG(ClassName, Name, Tags, Signature, ...)                                   \
1759
  INTERNAL_CATCH_EXPAND_VARGS(                                                                                                        \
1760
      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____), \
1761
                                                         INTERNAL_CATCH_UNIQUE_NAME(                                                  \
1762
                                                             ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____),             \
1763
                                                         ClassName,                                                                   \
1764
                                                         Name,                                                                        \
1765
                                                         Tags,                                                                        \
1766
                                                         Signature,                                                                   \
1767
                                                         __VA_ARGS__))
1768
#endif
1769

1770
#define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD_2(TestNameClass, TestName, ClassName, Name, Tags, TmplList)                \
1771
  CATCH_INTERNAL_START_WARNINGS_SUPPRESSION                                                                                      \
1772
  CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS                                                                                       \
1773
  CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS                                                                               \
1774
  template<typename TestType>                                                                                                    \
1775
  struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName<TestType>) {                                                          \
1776
    void test();                                                                                                                 \
1777
  };                                                                                                                             \
1778
  namespace {                                                                                                                    \
1779
    namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) {                                                                          \
1780
      INTERNAL_CATCH_TYPE_GEN                                                                                                    \
1781
      template<typename... Types>                                                                                                \
1782
      struct TestNameClass {                                                                                                     \
1783
        void reg_tests() {                                                                                                       \
1784
          int index = 0;                                                                                                         \
1785
          using expander = int[];                                                                                                \
1786
          (void)expander{(Catch::AutoReg(Catch::makeTestInvoker(&TestName<Types>::test),                                         \
1787
                                         CATCH_INTERNAL_LINEINFO,                                                                \
1788
                                         #ClassName,                                                                             \
1789
                                         Catch::NameAndTags{Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + " - " \
1790
                                                                + std::to_string(index),                                         \
1791
                                                            Tags}),                                                              \
1792
                          index++)...}; /* NOLINT */                                                                             \
1793
        }                                                                                                                        \
1794
      };                                                                                                                         \
1795
      static int INTERNAL_CATCH_UNIQUE_NAME(globalRegistrar) = []() {                                                            \
1796
        using TestInit = typename convert<TestNameClass, TmplList>::type;                                                        \
1797
        TestInit t;                                                                                                              \
1798
        t.reg_tests();                                                                                                           \
1799
        return 0;                                                                                                                \
1800
      }();                                                                                                                       \
1801
    }                                                                                                                            \
1802
  }                                                                                                                              \
1803
  CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION                                                                                       \
1804
  template<typename TestType>                                                                                                    \
1805
  void TestName<TestType>::test()
1806

1807
#define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD(ClassName, Name, Tags, TmplList)                                                    \
1808
  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____),            \
1809
                                                  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____), \
1810
                                                  ClassName,                                                                              \
1811
                                                  Name,                                                                                   \
1812
                                                  Tags,                                                                                   \
1813
                                                  TmplList)
1814

1815
// end catch_test_registry.h
1816
// start catch_capture.hpp
1817

1818
// start catch_assertionhandler.h
1819

1820
// start catch_assertioninfo.h
1821

1822
// start catch_result_type.h
1823

1824
namespace Catch {
1825
  // ResultWas::OfType enum
1826
  struct ResultWas {
1827
    enum OfType {
1828
      Unknown = -1,
1829
      Ok = 0,
1830
      Info = 1,
1831
      Warning = 2,
1832

1833
      FailureBit = 0x10,
1834

1835
      ExpressionFailed = FailureBit | 1,
1836
      ExplicitFailure = FailureBit | 2,
1837

1838
      Exception = 0x100 | FailureBit,
1839

1840
      ThrewException = Exception | 1,
1841
      DidntThrowException = Exception | 2,
1842

1843
      FatalErrorCondition = 0x200 | FailureBit
1844

1845
    };
1846
  };
1847

1848
  bool isOk(ResultWas::OfType resultType);
1849
  bool isJustInfo(int flags);
1850

1851
  // ResultDisposition::Flags enum
1852
  struct ResultDisposition {
1853
    enum Flags {
1854
      Normal = 0x01,
1855

1856
      ContinueOnFailure = 0x02, // Failures fail test, but execution continues
1857
      FalseTest = 0x04, // Prefix expression with !
1858
      SuppressFail = 0x08 // Failures are reported but do not fail the test
1859
    };
1860
  };
1861

1862
  ResultDisposition::Flags operator|(ResultDisposition::Flags lhs, ResultDisposition::Flags rhs);
1863

1864
  bool shouldContinueOnFailure(int flags);
1865 1
  inline bool isFalseTest(int flags) {
1866 1
    return (flags & ResultDisposition::FalseTest) != 0;
1867
  }
1868
  bool shouldSuppressFailure(int flags);
1869

1870
} // end namespace Catch
1871

1872
// end catch_result_type.h
1873
namespace Catch {
1874
  struct AssertionInfo {
1875
    StringRef macroName;
1876
    SourceLineInfo lineInfo;
1877
    StringRef capturedExpression;
1878
    ResultDisposition::Flags resultDisposition;
1879

1880
    // We want to delete this constructor but a compiler bug in 4.8 means
1881
    // the struct is then treated as non-aggregate
1882
    // AssertionInfo() = delete;
1883
  };
1884

1885
} // end namespace Catch
1886

1887
// end catch_assertioninfo.h
1888
// start catch_decomposer.h
1889

1890
// start catch_tostring.h
1891

1892
#include <cstddef>
1893
#include <string>
1894
#include <type_traits>
1895
#include <vector>
1896
// start catch_stream.h
1897

1898
#include <cstddef>
1899
#include <iosfwd>
1900
#include <ostream>
1901

1902
namespace Catch {
1903
  std::ostream &cout();
1904
  std::ostream &cerr();
1905
  std::ostream &clog();
1906

1907
  class StringRef;
1908

1909 1
  struct IStream {
1910
    virtual ~IStream();
1911
    virtual std::ostream &stream() const = 0;
1912
  };
1913

1914
  auto makeStream(StringRef const &filename) -> IStream const *;
1915

1916
  class ReusableStringStream : NonCopyable {
1917
    std::size_t m_index;
1918
    std::ostream *m_oss;
1919

1920
  public:
1921
    ReusableStringStream();
1922
    ~ReusableStringStream();
1923

1924
    auto str() const -> std::string;
1925

1926
    template<typename T>
1927 1
    auto operator<<(T const &value) -> ReusableStringStream & {
1928 1
      *m_oss << value;
1929 1
      return *this;
1930
    }
1931 0
    auto get() -> std::ostream & { return *m_oss; }
1932
  };
1933
} // namespace Catch
1934

1935
// end catch_stream.h
1936
// start catch_interfaces_enum_values_registry.h
1937

1938
#include <vector>
1939

1940
namespace Catch {
1941
  namespace Detail {
1942
    struct EnumInfo {
1943
      StringRef m_name;
1944
      std::vector<std::pair<int, StringRef>> m_values;
1945

1946
      ~EnumInfo();
1947

1948
      StringRef lookup(int value) const;
1949
    };
1950
  } // namespace Detail
1951

1952
  struct IMutableEnumValuesRegistry {
1953
    virtual ~IMutableEnumValuesRegistry();
1954

1955
    virtual Detail::EnumInfo const &registerEnum(StringRef enumName, StringRef allEnums, std::vector<int> const &values) = 0;
1956

1957
    template<typename E>
1958
    Detail::EnumInfo const &registerEnum(StringRef enumName, StringRef allEnums, std::initializer_list<E> values) {
1959
      static_assert(sizeof(int) >= sizeof(E), "Cannot serialize enum to int");
1960
      std::vector<int> intValues;
1961
      intValues.reserve(values.size());
1962
      for (auto enumValue : values)
1963
        intValues.push_back(static_cast<int>(enumValue));
1964
      return registerEnum(enumName, allEnums, intValues);
1965
    }
1966
  };
1967

1968
} // namespace Catch
1969

1970
// end catch_interfaces_enum_values_registry.h
1971

1972
#ifdef CATCH_CONFIG_CPP17_STRING_VIEW
1973
#include <string_view>
1974
#endif
1975

1976
#ifdef __OBJC__
1977
// start catch_objc_arc.hpp
1978

1979
#import <Foundation/Foundation.h>
1980

1981
#ifdef __has_feature
1982
#define CATCH_ARC_ENABLED __has_feature(objc_arc)
1983
#else
1984
#define CATCH_ARC_ENABLED 0
1985
#endif
1986

1987
void arcSafeRelease(NSObject *obj);
1988
id performOptionalSelector(id obj, SEL sel);
1989

1990
#if !CATCH_ARC_ENABLED
1991
inline void arcSafeRelease(NSObject *obj) {
1992
  [obj release];
1993
}
1994
inline id performOptionalSelector(id obj, SEL sel) {
1995
  if ([obj respondsToSelector:sel])
1996
    return [obj performSelector:sel];
1997
  return nil;
1998
}
1999
#define CATCH_UNSAFE_UNRETAINED
2000
#define CATCH_ARC_STRONG
2001
#else
2002
inline void arcSafeRelease(NSObject *) {
2003
}
2004
inline id performOptionalSelector(id obj, SEL sel) {
2005
#ifdef __clang__
2006
#pragma clang diagnostic push
2007
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
2008
#endif
2009
  if ([obj respondsToSelector:sel])
2010
    return [obj performSelector:sel];
2011
#ifdef __clang__
2012
#pragma clang diagnostic pop
2013
#endif
2014
  return nil;
2015
}
2016
#define CATCH_UNSAFE_UNRETAINED __unsafe_unretained
2017
#define CATCH_ARC_STRONG __strong
2018
#endif
2019

2020
// end catch_objc_arc.hpp
2021
#endif
2022

2023
#ifdef _MSC_VER
2024
#pragma warning(push)
2025
#pragma warning(disable : 4180) // We attempt to stream a function (address) by const&, which MSVC complains about but is harmless
2026
#endif
2027

2028
namespace Catch {
2029
  namespace Detail {
2030
    extern const std::string unprintableString;
2031

2032
    std::string rawMemoryToString(const void *object, std::size_t size);
2033

2034
    template<typename T>
2035 0
    std::string rawMemoryToString(const T &object) {
2036 0
      return rawMemoryToString(&object, sizeof(object));
2037
    }
2038

2039
    template<typename T>
2040
    class IsStreamInsertable {
2041
      template<typename Stream, typename U>
2042
      static auto test(int) -> decltype(std::declval<Stream &>() << std::declval<U>(), std::true_type());
2043

2044
      template<typename, typename>
2045
      static auto test(...) -> std::false_type;
2046

2047
    public:
2048
      static const bool value = decltype(test<std::ostream, const T &>(0))::value;
2049
    };
2050

2051
    template<typename E>
2052
    std::string convertUnknownEnumToString(E e);
2053

2054
    template<typename T>
2055
    typename std::enable_if<!std::is_enum<T>::value && !std::is_base_of<std::exception, T>::value, std::string>::type convertUnstreamable(T const &) {
2056
      return Detail::unprintableString;
2057
    }
2058
    template<typename T>
2059
    typename std::enable_if<!std::is_enum<T>::value && std::is_base_of<std::exception, T>::value, std::string>::type convertUnstreamable(T const &ex) {
2060
      return ex.what();
2061
    }
2062

2063
    template<typename T>
2064
    typename std::enable_if<std::is_enum<T>::value, std::string>::type convertUnstreamable(T const &value) {
2065
      return convertUnknownEnumToString(value);
2066
    }
2067

2068
#if defined(_MANAGED)
2069
    //! Convert a CLR string to a utf8 std::string
2070
    template<typename T>
2071
    std::string clrReferenceToString(T ^ ref) {
2072
      if (ref == nullptr)
2073
        return std::string("null");
2074
      auto bytes = System::Text::Encoding::UTF8->GetBytes(ref->ToString());
2075
      cli::pin_ptr<System::Byte> p = &bytes[0];
2076
      return std::string(reinterpret_cast<char const *>(p), bytes->Length);
2077
    }
2078
#endif
2079

2080
  } // namespace Detail
2081

2082
  // If we decide for C++14, change these to enable_if_ts
2083
  template<typename T, typename = void>
2084
  struct StringMaker {
2085
    template<typename Fake = T>
2086 0
    static typename std::enable_if<::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type convert(const Fake &value) {
2087 0
      ReusableStringStream rss;
2088
      // NB: call using the function-like syntax to avoid ambiguity with
2089
      // user-defined templated operator<< under clang.
2090 0
      rss.operator<<(value);
2091 0
      return rss.str();
2092
    }
2093

2094
    template<typename Fake = T>
2095
    static typename std::enable_if<!::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type convert(const Fake &value) {
2096
#if !defined(CATCH_CONFIG_FALLBACK_STRINGIFIER)
2097
      return Detail::convertUnstreamable(value);
2098
#else
2099
      return CATCH_CONFIG_FALLBACK_STRINGIFIER(value);
2100
#endif
2101
    }
2102
  };
2103

2104
  namespace Detail {
2105
    // This function dispatches all stringification requests inside of Catch.
2106
    // Should be preferably called fully qualified, like ::Catch::Detail::stringify
2107
    template<typename T>
2108 0
    std::string stringify(const T &e) {
2109 0
      return ::Catch::StringMaker<typename std::remove_cv<typename std::remove_reference<T>::type>::type>::convert(e);
2110
    }
2111

2112
    template<typename E>
2113
    std::string convertUnknownEnumToString(E e) {
2114
      return ::Catch::Detail::stringify(static_cast<typename std::underlying_type<E>::type>(e));
2115
    }
2116

2117
#if defined(_MANAGED)
2118
    template<typename T>
2119
    std::string stringify(T ^ e) {
2120
      return ::Catch::StringMaker<T ^>::convert(e);
2121
    }
2122
#endif
2123

2124
  } // namespace Detail
2125

2126
  // Some predefined specializations
2127

2128
  template<>
2129
  struct StringMaker<std::string> {
2130
    static std::string convert(const std::string &str);
2131
  };
2132

2133
#ifdef CATCH_CONFIG_CPP17_STRING_VIEW
2134
  template<>
2135
  struct StringMaker<std::string_view> {
2136
    static std::string convert(std::string_view str);
2137
  };
2138
#endif
2139

2140
  template<>
2141
  struct StringMaker<char const *> {
2142
    static std::string convert(char const *str);
2143
  };
2144
  template<>
2145
  struct StringMaker<char *> {
2146
    static std::string convert(char *str);
2147
  };
2148

2149
#ifdef CATCH_CONFIG_WCHAR
2150
  template<>
2151
  struct StringMaker<std::wstring> {
2152
    static std::string convert(const std::wstring &wstr);
2153
  };
2154

2155
#ifdef CATCH_CONFIG_CPP17_STRING_VIEW
2156
  template<>
2157
  struct StringMaker<std::wstring_view> {
2158
    static std::string convert(std::wstring_view str);
2159
  };
2160
#endif
2161

2162
  template<>
2163
  struct StringMaker<wchar_t const *> {
2164
    static std::string convert(wchar_t const *str);
2165
  };
2166
  template<>
2167
  struct StringMaker<wchar_t *> {
2168
    static std::string convert(wchar_t *str);
2169
  };
2170
#endif
2171

2172
  // TBD: Should we use `strnlen` to ensure that we don't go out of the buffer,
2173
  //      while keeping string semantics?
2174
  template<int SZ>
2175
  struct StringMaker<char[SZ]> {
2176 0
    static std::string convert(char const *str) { return ::Catch::Detail::stringify(std::string{str}); }
2177
  };
2178
  template<int SZ>
2179
  struct StringMaker<signed char[SZ]> {
2180
    static std::string convert(signed char const *str) {
2181
      return ::Catch::Detail::stringify(std::string{reinterpret_cast<char const *>(str)});
2182
    }
2183
  };
2184
  template<int SZ>
2185
  struct StringMaker<unsigned char[SZ]> {
2186
    static std::string convert(unsigned char const *str) {
2187
      return ::Catch::Detail::stringify(std::string{reinterpret_cast<char const *>(str)});
2188
    }
2189
  };
2190

2191
#if defined(CATCH_CONFIG_CPP17_BYTE)
2192
  template<>
2193
  struct StringMaker<std::byte> {
2194
    static std::string convert(std::byte value);
2195
  };
2196
#endif // defined(CATCH_CONFIG_CPP17_BYTE)
2197
  template<>
2198
  struct StringMaker<int> {
2199
    static std::string convert(int value);
2200
  };
2201
  template<>
2202
  struct StringMaker<long> {
2203
    static std::string convert(long value);
2204
  };
2205
  template<>
2206
  struct StringMaker<long long> {
2207
    static std::string convert(long long value);
2208
  };
2209
  template<>
2210
  struct StringMaker<unsigned int> {
2211
    static std::string convert(unsigned int value);
2212
  };
2213
  template<>
2214
  struct StringMaker<unsigned long> {
2215
    static std::string convert(unsigned long value);
2216
  };
2217
  template<>
2218
  struct StringMaker<unsigned long long> {
2219
    static std::string convert(unsigned long long value);
2220
  };
2221

2222
  template<>
2223
  struct StringMaker<bool> {
2224
    static std::string convert(bool b);
2225
  };
2226

2227
  template<>
2228
  struct StringMaker<char> {
2229
    static std::string convert(char c);
2230
  };
2231
  template<>
2232
  struct StringMaker<signed char> {
2233
    static std::string convert(signed char c);
2234
  };
2235
  template<>
2236
  struct StringMaker<unsigned char> {
2237
    static std::string convert(unsigned char c);
2238
  };
2239

2240
  template<>
2241
  struct StringMaker<std::nullptr_t> {
2242
    static std::string convert(std::nullptr_t);
2243
  };
2244

2245
  template<>
2246
  struct StringMaker<float> {
2247
    static std::string convert(float value);
2248
    static int precision;
2249
  };
2250

2251
  template<>
2252
  struct StringMaker<double> {
2253
    static std::string convert(double value);
2254
    static int precision;
2255
  };
2256

2257
  template<typename T>
2258
  struct StringMaker<T *> {
2259
    template<typename U>
2260 0
    static std::string convert(U *p) {
2261 0
      if (p) {
2262 0
        return ::Catch::Detail::rawMemoryToString(p);
2263
      } else {
2264 0
        return "nullptr";
2265
      }
2266
    }
2267
  };
2268

2269
  template<typename R, typename C>
2270
  struct StringMaker<R C::*> {
2271
    static std::string convert(R C::*p) {
2272
      if (p) {
2273
        return ::Catch::Detail::rawMemoryToString(p);
2274
      } else {
2275
        return "nullptr";
2276
      }
2277
    }
2278
  };
2279

2280
#if defined(_MANAGED)
2281
  template<typename T>
2282
  struct StringMaker<T ^> {
2283
    static std::string convert(T ^ ref) { return ::Catch::Detail::clrReferenceToString(ref); }
2284
  };
2285
#endif
2286

2287
  namespace Detail {
2288
    template<typename InputIterator, typename Sentinel = InputIterator>
2289
    std::string rangeToString(InputIterator first, Sentinel last) {
2290
      ReusableStringStream rss;
2291
      rss << "{ ";
2292
      if (first != last) {
2293
        rss << ::Catch::Detail::stringify(*first);
2294
        for (++first; first != last; ++first)
2295
          rss << ", " << ::Catch::Detail::stringify(*first);
2296
      }
2297
      rss << " }";
2298
      return rss.str();
2299
    }
2300
  } // namespace Detail
2301

2302
#ifdef __OBJC__
2303
  template<>
2304
  struct StringMaker<NSString *> {
2305
    static std::string convert(NSString *nsstring) {
2306
      if (!nsstring)
2307
        return "nil";
2308
      return std::string("@") + [nsstring UTF8String];
2309
    }
2310
  };
2311
  template<>
2312
  struct StringMaker<NSObject *> {
2313
    static std::string convert(NSObject *nsObject) { return ::Catch::Detail::stringify([nsObject description]); }
2314
  };
2315
  namespace Detail {
2316
    inline std::string stringify(NSString *nsstring) {
2317
      return StringMaker<NSString *>::convert(nsstring);
2318
    }
2319

2320
  } // namespace Detail
2321
#endif // __OBJC__
2322

2323
} // namespace Catch
2324

2325
//////////////////////////////////////////////////////
2326
// Separate std-lib types stringification, so it can be selectively enabled
2327
// This means that we do not bring in
2328

2329
#if defined(CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS)
2330
#define CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER
2331
#define CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER
2332
#define CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER
2333
#define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
2334
#define CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER
2335
#endif
2336

2337
// Separate std::pair specialization
2338
#if defined(CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER)
2339
#include <utility>
2340
namespace Catch {
2341
  template<typename T1, typename T2>
2342
  struct StringMaker<std::pair<T1, T2>> {
2343
    static std::string convert(const std::pair<T1, T2> &pair) {
2344
      ReusableStringStream rss;
2345
      rss << "{ " << ::Catch::Detail::stringify(pair.first) << ", " << ::Catch::Detail::stringify(pair.second) << " }";
2346
      return rss.str();
2347
    }
2348
  };
2349
} // namespace Catch
2350
#endif // CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER
2351

2352
#if defined(CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER) && defined(CATCH_CONFIG_CPP17_OPTIONAL)
2353
#include <optional>
2354
namespace Catch {
2355
  template<typename T>
2356
  struct StringMaker<std::optional<T>> {
2357
    static std::string convert(const std::optional<T> &optional) {
2358
      ReusableStringStream rss;
2359
      if (optional.has_value()) {
2360
        rss << ::Catch::Detail::stringify(*optional);
2361
      } else {
2362
        rss << "{ }";
2363
      }
2364
      return rss.str();
2365
    }
2366
  };
2367
} // namespace Catch
2368
#endif // CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER
2369

2370
// Separate std::tuple specialization
2371
#if defined(CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER)
2372
#include <tuple>
2373
namespace Catch {
2374
  namespace Detail {
2375
    template<typename Tuple, std::size_t N = 0, bool = (N < std::tuple_size<Tuple>::value)>
2376
    struct TupleElementPrinter {
2377
      static void print(const Tuple &tuple, std::ostream &os) {
2378
        os << (N ? ", " : " ") << ::Catch::Detail::stringify(std::get<N>(tuple));
2379
        TupleElementPrinter<Tuple, N + 1>::print(tuple, os);
2380
      }
2381
    };
2382

2383
    template<typename Tuple, std::size_t N>
2384
    struct TupleElementPrinter<Tuple, N, false> {
2385
      static void print(const Tuple &, std::ostream &) {}
2386
    };
2387

2388
  } // namespace Detail
2389

2390
  template<typename... Types>
2391
  struct StringMaker<std::tuple<Types...>> {
2392
    static std::string convert(const std::tuple<Types...> &tuple) {
2393
      ReusableStringStream rss;
2394
      rss << '{';
2395
      Detail::TupleElementPrinter<std::tuple<Types...>>::print(tuple, rss.get());
2396
      rss << " }";
2397
      return rss.str();
2398
    }
2399
  };
2400
} // namespace Catch
2401
#endif // CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER
2402

2403
#if defined(CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER) && defined(CATCH_CONFIG_CPP17_VARIANT)
2404
#include <variant>
2405
namespace Catch {
2406
  template<>
2407
  struct StringMaker<std::monostate> {
2408
    static std::string convert(const std::monostate &) { return "{ }"; }
2409
  };
2410

2411
  template<typename... Elements>
2412
  struct StringMaker<std::variant<Elements...>> {
2413
    static std::string convert(const std::variant<Elements...> &variant) {
2414
      if (variant.valueless_by_exception()) {
2415
        return "{valueless variant}";
2416
      } else {
2417
        return std::visit([](const auto &value) { return ::Catch::Detail::stringify(value); }, variant);
2418
      }
2419
    }
2420
  };
2421
} // namespace Catch
2422
#endif // CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER
2423

2424
namespace Catch {
2425
  // Import begin/ end from std here
2426
  using std::begin;
2427
  using std::end;
2428

2429
  namespace detail {
2430
    template<typename...>
2431
    struct void_type {
2432
      using type = void;
2433
    };
2434

2435
    template<typename T, typename = void>
2436
    struct is_range_impl : std::false_type {
2437
    };
2438

2439
    template<typename T>
2440
    struct is_range_impl<T, typename void_type<decltype(begin(std::declval<T>()))>::type> : std::true_type {
2441
    };
2442
  } // namespace detail
2443

2444
  template<typename T>
2445
  struct is_range : detail::is_range_impl<T> {
2446
  };
2447

2448
#if defined(_MANAGED) // Managed types are never ranges
2449
  template<typename T>
2450
  struct is_range<T ^> {
2451
    static const bool value = false;
2452
  };
2453
#endif
2454

2455
  template<typename Range>
2456
  std::string rangeToString(Range const &range) {
2457
    return ::Catch::Detail::rangeToString(begin(range), end(range));
2458
  }
2459

2460
  // Handle vector<bool> specially
2461
  template<typename Allocator>
2462
  std::string rangeToString(std::vector<bool, Allocator> const &v) {
2463
    ReusableStringStream rss;
2464
    rss << "{ ";
2465
    bool first = true;
2466
    for (bool b : v) {
2467
      if (first)
2468
        first = false;
2469
      else
2470
        rss << ", ";
2471
      rss << ::Catch::Detail::stringify(b);
2472
    }
2473
    rss << " }";
2474
    return rss.str();
2475
  }
2476

2477
  template<typename R>
2478
  struct StringMaker<R, typename std::enable_if<is_range<R>::value && !::Catch::Detail::IsStreamInsertable<R>::value>::type> {
2479
    static std::string convert(R const &range) { return rangeToString(range); }
2480
  };
2481

2482
  template<typename T, int SZ>
2483
  struct StringMaker<T[SZ]> {
2484
    static std::string convert(T const (&arr)[SZ]) { return rangeToString(arr); }
2485
  };
2486

2487
} // namespace Catch
2488

2489
// Separate std::chrono::duration specialization
2490
#if defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER)
2491
#include <chrono>
2492
#include <ctime>
2493
#include <ratio>
2494

2495
namespace Catch {
2496
  template<class Ratio>
2497
  struct ratio_string {
2498
    static std::string symbol();
2499
  };
2500

2501
  template<class Ratio>
2502
  std::string ratio_string<Ratio>::symbol() {
2503
    Catch::ReusableStringStream rss;
2504
    rss << '[' << Ratio::num << '/' << Ratio::den << ']';
2505
    return rss.str();
2506
  }
2507
  template<>
2508
  struct ratio_string<std::atto> {
2509
    static std::string symbol();
2510
  };
2511
  template<>
2512
  struct ratio_string<std::femto> {
2513
    static std::string symbol();
2514
  };
2515
  template<>
2516
  struct ratio_string<std::pico> {
2517
    static std::string symbol();
2518
  };
2519
  template<>
2520
  struct ratio_string<std::nano> {
2521
    static std::string symbol();
2522
  };
2523
  template<>
2524
  struct ratio_string<std::micro> {
2525
    static std::string symbol();
2526
  };
2527
  template<>
2528
  struct ratio_string<std::milli> {
2529
    static std::string symbol();
2530
  };
2531

2532
  ////////////
2533
  // std::chrono::duration specializations
2534
  template<typename Value, typename Ratio>
2535
  struct StringMaker<std::chrono::duration<Value, Ratio>> {
2536
    static std::string convert(std::chrono::duration<Value, Ratio> const &duration) {
2537
      ReusableStringStream rss;
2538
      rss << duration.count() << ' ' << ratio_string<Ratio>::symbol() << 's';
2539
      return rss.str();
2540
    }
2541
  };
2542
  template<typename Value>
2543
  struct StringMaker<std::chrono::duration<Value, std::ratio<1>>> {
2544
    static std::string convert(std::chrono::duration<Value, std::ratio<1>> const &duration) {
2545
      ReusableStringStream rss;
2546
      rss << duration.count() << " s";
2547
      return rss.str();
2548
    }
2549
  };
2550
  template<typename Value>
2551
  struct StringMaker<std::chrono::duration<Value, std::ratio<60>>> {
2552
    static std::string convert(std::chrono::duration<Value, std::ratio<60>> const &duration) {
2553
      ReusableStringStream rss;
2554
      rss << duration.count() << " m";
2555
      return rss.str();
2556
    }
2557
  };
2558
  template<typename Value>
2559
  struct StringMaker<std::chrono::duration<Value, std::ratio<3600>>> {
2560
    static std::string convert(std::chrono::duration<Value, std::ratio<3600>> const &duration) {
2561
      ReusableStringStream rss;
2562
      rss << duration.count() << " h";
2563
      return rss.str();
2564
    }
2565
  };
2566

2567
  ////////////
2568
  // std::chrono::time_point specialization
2569
  // Generic time_point cannot be specialized, only std::chrono::time_point<system_clock>
2570
  template<typename Clock, typename Duration>
2571
  struct StringMaker<std::chrono::time_point<Clock, Duration>> {
2572
    static std::string convert(std::chrono::time_point<Clock, Duration> const &time_point) {
2573
      return ::Catch::Detail::stringify(time_point.time_since_epoch()) + " since epoch";
2574
    }
2575
  };
2576
  // std::chrono::time_point<system_clock> specialization
2577
  template<typename Duration>
2578
  struct StringMaker<std::chrono::time_point<std::chrono::system_clock, Duration>> {
2579
    static std::string convert(std::chrono::time_point<std::chrono::system_clock, Duration> const &time_point) {
2580
      auto converted = std::chrono::system_clock::to_time_t(time_point);
2581

2582
#ifdef _MSC_VER
2583
      std::tm timeInfo = {};
2584
      gmtime_s(&timeInfo, &converted);
2585
#else
2586
      std::tm *timeInfo = std::gmtime(&converted);
2587
#endif
2588

2589
      auto const timeStampSize = sizeof("2017-01-16T17:06:45Z");
2590
      char timeStamp[timeStampSize];
2591
      const char *const fmt = "%Y-%m-%dT%H:%M:%SZ";
2592

2593
#ifdef _MSC_VER
2594
      std::strftime(timeStamp, timeStampSize, fmt, &timeInfo);
2595
#else
2596
      std::strftime(timeStamp, timeStampSize, fmt, timeInfo);
2597
#endif
2598
      return std::string(timeStamp);
2599
    }
2600
  };
2601
} // namespace Catch
2602
#endif // CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
2603

2604
#define INTERNAL_CATCH_REGISTER_ENUM(enumName, ...)                                                                                 \
2605
  namespace Catch {                                                                                                                 \
2606
    template<>                                                                                                                      \
2607
    struct StringMaker<enumName> {                                                                                                  \
2608
      static std::string convert(enumName value) {                                                                                  \
2609
        static const auto &enumInfo                                                                                                 \
2610
            = ::Catch::getMutableRegistryHub().getMutableEnumValuesRegistry().registerEnum(#enumName, #__VA_ARGS__, {__VA_ARGS__}); \
2611
        return static_cast<std::string>(enumInfo.lookup(static_cast<int>(value)));                                                  \
2612
      }                                                                                                                             \
2613
    };                                                                                                                              \
2614
  }
2615

2616
#define CATCH_REGISTER_ENUM(enumName, ...) INTERNAL_CATCH_REGISTER_ENUM(enumName, __VA_ARGS__)
2617

2618
#ifdef _MSC_VER
2619
#pragma warning(pop)
2620
#endif
2621

2622
// end catch_tostring.h
2623
#include <iosfwd>
2624

2625
#ifdef _MSC_VER
2626
#pragma warning(push)
2627
#pragma warning(disable : 4389) // '==' : signed/unsigned mismatch
2628
#pragma warning(disable : 4018) // more "signed/unsigned mismatch"
2629
#pragma warning(disable : 4312) // Converting int to T* using reinterpret_cast (issue on x64 platform)
2630
#pragma warning(disable : 4180) // qualifier applied to function type has no meaning
2631
#pragma warning(disable : 4800) // Forcing result to true or false
2632
#endif
2633

2634
namespace Catch {
2635 1
  struct ITransientExpression {
2636 0
    auto isBinaryExpression() const -> bool { return m_isBinaryExpression; }
2637 1
    auto getResult() const -> bool { return m_result; }
2638
    virtual void streamReconstructedExpression(std::ostream &os) const = 0;
2639

2640 1
    ITransientExpression(bool isBinaryExpression, bool result)
2641 1
        : m_isBinaryExpression(isBinaryExpression)
2642 1
        , m_result(result) {
2643
    }
2644

2645
    // We don't actually need a virtual destructor, but many static analysers
2646
    // complain if it's not here :-(
2647
    virtual ~ITransientExpression();
2648

2649
    bool m_isBinaryExpression;
2650
    bool m_result;
2651
  };
2652

2653
  void formatReconstructedExpression(std::ostream &os, std::string const &lhs, StringRef op, std::string const &rhs);
2654

2655
  template<typename LhsT, typename RhsT>
2656
  class BinaryExpr : public ITransientExpression {
2657
    LhsT m_lhs;
2658
    StringRef m_op;
2659
    RhsT m_rhs;
2660

2661 0
    void streamReconstructedExpression(std::ostream &os) const override {
2662 0
      formatReconstructedExpression(os, Catch::Detail::stringify(m_lhs), m_op, Catch::Detail::stringify(m_rhs));
2663
    }
2664

2665
  public:
2666 1
    BinaryExpr(bool comparisonResult, LhsT lhs, StringRef op, RhsT rhs)
2667
        : ITransientExpression{true, comparisonResult}
2668
        , m_lhs(lhs)
2669
        , m_op(op)
2670 1
        , m_rhs(rhs) {
2671
    }
2672

2673
    template<typename T>
2674
    auto operator&&(T) const -> BinaryExpr<LhsT, RhsT const &> const {
2675
      static_assert(always_false<T>::value,
2676
                    "chained comparisons are not supported inside assertions, "
2677
                    "wrap the expression inside parentheses, or decompose it");
2678
    }
2679

2680
    template<typename T>
2681
    auto operator||(T) const -> BinaryExpr<LhsT, RhsT const &> const {
2682
      static_assert(always_false<T>::value,
2683
                    "chained comparisons are not supported inside assertions, "
2684
                    "wrap the expression inside parentheses, or decompose it");
2685
    }
2686

2687
    template<typename T>
2688
    auto operator==(T) const -> BinaryExpr<LhsT, RhsT const &> const {
2689
      static_assert(always_false<T>::value,
2690
                    "chained comparisons are not supported inside assertions, "
2691
                    "wrap the expression inside parentheses, or decompose it");
2692
    }
2693

2694
    template<typename T>
2695
    auto operator!=(T) const -> BinaryExpr<LhsT, RhsT const &> const {
2696
      static_assert(always_false<T>::value,
2697
                    "chained comparisons are not supported inside assertions, "
2698
                    "wrap the expression inside parentheses, or decompose it");
2699
    }
2700

2701
    template<typename T>
2702
    auto operator>(T) const -> BinaryExpr<LhsT, RhsT const &> const {
2703
      static_assert(always_false<T>::value,
2704
                    "chained comparisons are not supported inside assertions, "
2705
                    "wrap the expression inside parentheses, or decompose it");
2706
    }
2707

2708
    template<typename T>
2709
    auto operator<(T) const -> BinaryExpr<LhsT, RhsT const &> const {
2710
      static_assert(always_false<T>::value,
2711
                    "chained comparisons are not supported inside assertions, "
2712
                    "wrap the expression inside parentheses, or decompose it");
2713
    }
2714

2715
    template<typename T>
2716
    auto operator>=(T) const -> BinaryExpr<LhsT, RhsT const &> const {
2717
      static_assert(always_false<T>::value,
2718
                    "chained comparisons are not supported inside assertions, "
2719
                    "wrap the expression inside parentheses, or decompose it");
2720
    }
2721

2722
    template<typename T>
2723
    auto operator<=(T) const -> BinaryExpr<LhsT, RhsT const &> const {
2724
      static_assert(always_false<T>::value,
2725
                    "chained comparisons are not supported inside assertions, "
2726
                    "wrap the expression inside parentheses, or decompose it");
2727
    }
2728
  };
2729

2730
  template<typename LhsT>
2731
  class UnaryExpr : public ITransientExpression {
2732
    LhsT m_lhs;
2733

2734 0
    void streamReconstructedExpression(std::ostream &os) const override { os << Catch::Detail::stringify(m_lhs); }
2735

2736
  public:
2737 1
    explicit UnaryExpr(LhsT lhs)
2738
        : ITransientExpression{false, static_cast<bool>(lhs)}
2739 1
        , m_lhs(lhs) {
2740
    }
2741
  };
2742

2743
  // Specialised comparison functions to handle equality comparisons between ints and pointers (NULL deduces as an int)
2744
  template<typename LhsT, typename RhsT>
2745 1
  auto compareEqual(LhsT const &lhs, RhsT const &rhs) -> bool {
2746 1
    return static_cast<bool>(lhs == rhs);
2747
  }
2748
  template<typename T>
2749
  auto compareEqual(T *const &lhs, int rhs) -> bool {
2750
    return lhs == reinterpret_cast<void const *>(rhs);
2751
  }
2752
  template<typename T>
2753
  auto compareEqual(T *const &lhs, long rhs) -> bool {
2754
    return lhs == reinterpret_cast<void const *>(rhs);
2755
  }
2756
  template<typename T>
2757
  auto compareEqual(int lhs, T *const &rhs) -> bool {
2758
    return reinterpret_cast<void const *>(lhs) == rhs;
2759
  }
2760
  template<typename T>
2761
  auto compareEqual(long lhs, T *const &rhs) -> bool {
2762
    return reinterpret_cast<void const *>(lhs) == rhs;
2763
  }
2764

2765
  template<typename LhsT, typename RhsT>
2766
  auto compareNotEqual(LhsT const &lhs, RhsT &&rhs) -> bool {
2767
    return static_cast<bool>(lhs != rhs);
2768
  }
2769
  template<typename T>
2770
  auto compareNotEqual(T *const &lhs, int rhs) -> bool {
2771
    return lhs != reinterpret_cast<void const *>(rhs);
2772
  }
2773
  template<typename T>
2774
  auto compareNotEqual(T *const &lhs, long rhs) -> bool {
2775
    return lhs != reinterpret_cast<void const *>(rhs);
2776
  }
2777
  template<typename T>
2778
  auto compareNotEqual(int lhs, T *const &rhs) -> bool {
2779
    return reinterpret_cast<void const *>(lhs) != rhs;
2780
  }
2781
  template<typename T>
2782
  auto compareNotEqual(long lhs, T *const &rhs) -> bool {
2783
    return reinterpret_cast<void const *>(lhs) != rhs;
2784
  }
2785

2786
  template<typename LhsT>
2787
  class ExprLhs {
2788
    LhsT m_lhs;
2789

2790
  public:
2791 1
    explicit ExprLhs(LhsT lhs)
2792 1
        : m_lhs(lhs) {
2793
    }
2794

2795
    template<typename RhsT>
2796 1
    auto operator==(RhsT const &rhs) -> BinaryExpr<LhsT, RhsT const &> const {
2797 1
      return {compareEqual(m_lhs, rhs), m_lhs, "==", rhs};
2798
    }
2799 1
    auto operator==(bool rhs) -> BinaryExpr<LhsT, bool> const { return {m_lhs == rhs, m_lhs, "==", rhs}; }
2800

2801
    template<typename RhsT>
2802
    auto operator!=(RhsT const &rhs) -> BinaryExpr<LhsT, RhsT const &> const {
2803
      return {compareNotEqual(m_lhs, rhs), m_lhs, "!=", rhs};
2804
    }
2805
    auto operator!=(bool rhs) -> BinaryExpr<LhsT, bool> const { return {m_lhs != rhs, m_lhs, "!=", rhs}; }
2806

2807
    template<typename RhsT>
2808 1
    auto operator>(RhsT const &rhs) -> BinaryExpr<LhsT, RhsT const &> const {
2809 1
      return {static_cast<bool>(m_lhs > rhs), m_lhs, ">", rhs};
2810
    }
2811
    template<typename RhsT>
2812
    auto operator<(RhsT const &rhs) -> BinaryExpr<LhsT, RhsT const &> const {
2813
      return {static_cast<bool>(m_lhs < rhs), m_lhs, "<", rhs};
2814
    }
2815
    template<typename RhsT>
2816
    auto operator>=(RhsT const &rhs) -> BinaryExpr<LhsT, RhsT const &> const {
2817
      return {static_cast<bool>(m_lhs >= rhs), m_lhs, ">=", rhs};
2818
    }
2819
    template<typename RhsT>
2820
    auto operator<=(RhsT const &rhs) -> BinaryExpr<LhsT, RhsT const &> const {
2821
      return {static_cast<bool>(m_lhs <= rhs), m_lhs, "<=", rhs};
2822
    }
2823
    template<typename RhsT>
2824
    auto operator|(RhsT const &rhs) -> BinaryExpr<LhsT, RhsT const &> const {
2825
      return {static_cast<bool>(m_lhs | rhs), m_lhs, "|", rhs};
2826
    }
2827
    template<typename RhsT>
2828
    auto operator&(RhsT const &rhs) -> BinaryExpr<LhsT, RhsT const &> const {
2829
      return {static_cast<bool>(m_lhs & rhs), m_lhs, "&", rhs};
2830
    }
2831
    template<typename RhsT>
2832
    auto operator^(RhsT const &rhs) -> BinaryExpr<LhsT, RhsT const &> const {
2833
      return {static_cast<bool>(m_lhs ^ rhs), m_lhs, "^", rhs};
2834
    }
2835

2836
    template<typename RhsT>
2837
    auto operator&&(RhsT const &) -> BinaryExpr<LhsT, RhsT const &> const {
2838
      static_assert(always_false<RhsT>::value,
2839
                    "operator&& is not supported inside assertions, "
2840
                    "wrap the expression inside parentheses, or decompose it");
2841
    }
2842

2843
    template<typename RhsT>
2844
    auto operator||(RhsT const &) -> BinaryExpr<LhsT, RhsT const &> const {
2845
      static_assert(always_false<RhsT>::value,
2846
                    "operator|| is not supported inside assertions, "
2847
                    "wrap the expression inside parentheses, or decompose it");
2848
    }
2849

2850 1
    auto makeUnaryExpr() const -> UnaryExpr<LhsT> { return UnaryExpr<LhsT>{m_lhs}; }
2851
  };
2852

2853
  void handleExpression(ITransientExpression const &expr);
2854

2855
  template<typename T>
2856
  void handleExpression(ExprLhs<T> const &expr) {
2857
    handleExpression(expr.makeUnaryExpr());
2858
  }
2859

2860
  struct Decomposer {
2861
    template<typename T>
2862 1
    auto operator<=(T const &lhs) -> ExprLhs<T const &> {
2863 1
      return ExprLhs<T const &>{lhs};
2864
    }
2865

2866 1
    auto operator<=(bool value) -> ExprLhs<bool> { return ExprLhs<bool>{value}; }
2867
  };
2868

2869
} // end namespace Catch
2870

2871
#ifdef _MSC_VER
2872
#pragma warning(pop)
2873
#endif
2874

2875
// end catch_decomposer.h
2876
// start catch_interfaces_capture.h
2877

2878
#include <chrono>
2879
#include <string>
2880

2881
namespace Catch {
2882
  class AssertionResult;
2883
  struct AssertionInfo;
2884
  struct SectionInfo;
2885
  struct SectionEndInfo;
2886
  struct MessageInfo;
2887
  struct MessageBuilder;
2888
  struct Counts;
2889
  struct AssertionReaction;
2890
  struct SourceLineInfo;
2891

2892
  struct ITransientExpression;
2893
  struct IGeneratorTracker;
2894

2895
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
2896
  struct BenchmarkInfo;
2897
  template<typename Duration = std::chrono::duration<double, std::nano>>
2898
  struct BenchmarkStats;
2899
#endif // CATCH_CONFIG_ENABLE_BENCHMARKING
2900

2901 1
  struct IResultCapture {
2902
    virtual ~IResultCapture();
2903

2904
    virtual bool sectionStarted(SectionInfo const &sectionInfo, Counts &assertions) = 0;
2905
    virtual void sectionEnded(SectionEndInfo const &endInfo) = 0;
2906
    virtual void sectionEndedEarly(SectionEndInfo const &endInfo) = 0;
2907

2908
    virtual auto acquireGeneratorTracker(StringRef generatorName, SourceLineInfo const &lineInfo) -> IGeneratorTracker & = 0;
2909

2910
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
2911
    virtual void benchmarkPreparing(std::string const &name) = 0;
2912
    virtual void benchmarkStarting(BenchmarkInfo const &info) = 0;
2913
    virtual void benchmarkEnded(BenchmarkStats<> const &stats) = 0;
2914
    virtual void benchmarkFailed(std::string const &error) = 0;
2915
#endif // CATCH_CONFIG_ENABLE_BENCHMARKING
2916

2917
    virtual void pushScopedMessage(MessageInfo const &message) = 0;
2918
    virtual void popScopedMessage(MessageInfo const &message) = 0;
2919

2920
    virtual void emplaceUnscopedMessage(MessageBuilder const &builder) = 0;
2921

2922
    virtual void handleFatalErrorCondition(StringRef message) = 0;
2923

2924
    virtual void handleExpr(AssertionInfo const &info, ITransientExpression const &expr, AssertionReaction &reaction) = 0;
2925
    virtual void handleMessage(AssertionInfo const &info, ResultWas::OfType resultType, StringRef const &message, AssertionReaction &reaction)
2926
        = 0;
2927
    virtual void handleUnexpectedExceptionNotThrown(AssertionInfo const &info, AssertionReaction &reaction) = 0;
2928
    virtual void handleUnexpectedInflightException(AssertionInfo const &info, std::string const &message, AssertionReaction &reaction) = 0;
2929
    virtual void handleIncomplete(AssertionInfo const &info) = 0;
2930
    virtual void handleNonExpr(AssertionInfo const &info, ResultWas::OfType resultType, AssertionReaction &reaction) = 0;
2931

2932
    virtual bool lastAssertionPassed() = 0;
2933
    virtual void assertionPassed() = 0;
2934

2935
    // Deprecated, do not use:
2936
    virtual std::string getCurrentTestName() const = 0;
2937
    virtual const AssertionResult *getLastResult() const = 0;
2938
    virtual void exceptionEarlyReported() = 0;
2939
  };
2940

2941
  IResultCapture &getResultCapture();
2942
} // namespace Catch
2943

2944
// end catch_interfaces_capture.h
2945
namespace Catch {
2946
  struct TestFailureException {
2947
  };
2948
  struct AssertionResultData;
2949
  struct IResultCapture;
2950
  class RunContext;
2951

2952
  class LazyExpression {
2953
    friend class AssertionHandler;
2954
    friend struct AssertionStats;
2955
    friend class RunContext;
2956

2957
    ITransientExpression const *m_transientExpression = nullptr;
2958
    bool m_isNegated;
2959

2960
  public:
2961
    LazyExpression(bool isNegated);
2962
    LazyExpression(LazyExpression const &other);
2963
    LazyExpression &operator=(LazyExpression const &) = delete;
2964

2965
    explicit operator bool() const;
2966

2967
    friend auto operator<<(std::ostream &os, LazyExpression const &lazyExpr) -> std::ostream &;
2968
  };
2969

2970
  struct AssertionReaction {
2971
    bool shouldDebugBreak = false;
2972
    bool shouldThrow = false;
2973
  };
2974

2975
  class AssertionHandler {
2976
    AssertionInfo m_assertionInfo;
2977
    AssertionReaction m_reaction;
2978
    bool m_completed = false;
2979
    IResultCapture &m_resultCapture;
2980

2981
  public:
2982
    AssertionHandler(StringRef const &macroName,
2983
                     SourceLineInfo const &lineInfo,
2984
                     StringRef capturedExpression,
2985
                     ResultDisposition::Flags resultDisposition);
2986 1
    ~AssertionHandler() {
2987 1
      if (!m_completed) {
2988 0
        m_resultCapture.handleIncomplete(m_assertionInfo);
2989
      }
2990
    }
2991

2992
    template<typename T>
2993 1
    void handleExpr(ExprLhs<T> const &expr) {
2994 1
      handleExpr(expr.makeUnaryExpr());
2995
    }
2996
    void handleExpr(ITransientExpression const &expr);
2997

2998
    void handleMessage(ResultWas::OfType resultType, StringRef const &message);
2999

3000
    void handleExceptionThrownAsExpected();
3001
    void handleUnexpectedExceptionNotThrown();
3002
    void handleExceptionNotThrownAsExpected();
3003
    void handleThrowingCallSkipped();
3004
    void handleUnexpectedInflightException();
3005

3006
    void complete();
3007
    void setCompleted();
3008

3009
    // query
3010
    auto allowThrows() const -> bool;
3011
  };
3012

3013
  void handleExceptionMatchExpr(AssertionHandler &handler, std::string const &str, StringRef const &matcherString);
3014

3015
} // namespace Catch
3016

3017
// end catch_assertionhandler.h
3018
// start catch_message.h
3019

3020
#include <string>
3021
#include <vector>
3022

3023
namespace Catch {
3024
  struct MessageInfo {
3025
    MessageInfo(StringRef const &_macroName, SourceLineInfo const &_lineInfo, ResultWas::OfType _type);
3026

3027
    StringRef macroName;
3028
    std::string message;
3029
    SourceLineInfo lineInfo;
3030
    ResultWas::OfType type;
3031
    unsigned int sequence;
3032

3033
    bool operator==(MessageInfo const &other) const;
3034
    bool operator<(MessageInfo const &other) const;
3035

3036
  private:
3037
    static unsigned int globalCount;
3038
  };
3039

3040
  struct MessageStream {
3041
    template<typename T>
3042
    MessageStream &operator<<(T const &value) {
3043
      m_stream << value;
3044
      return *this;
3045
    }
3046

3047
    ReusableStringStream m_stream;
3048
  };
3049

3050
  struct MessageBuilder : MessageStream {
3051
    MessageBuilder(StringRef const &macroName, SourceLineInfo const &lineInfo, ResultWas::OfType type);
3052

3053
    template<typename T>
3054 0
    MessageBuilder &operator<<(T const &value) {
3055 0
      m_stream << value;
3056 0
      return *this;
3057
    }
3058

3059
    MessageInfo m_info;
3060
  };
3061

3062
  class ScopedMessage {
3063
  public:
3064
    explicit ScopedMessage(MessageBuilder const &builder);
3065
    ScopedMessage(ScopedMessage &duplicate) = delete;
3066
    ScopedMessage(ScopedMessage &&old);
3067
    ~ScopedMessage();
3068

3069
    MessageInfo m_info;
3070
    bool m_moved;
3071
  };
3072

3073
  class Capturer {
3074
    std::vector<MessageInfo> m_messages;
3075
    IResultCapture &m_resultCapture = getResultCapture();
3076
    size_t m_captured = 0;
3077

3078
  public:
3079
    Capturer(StringRef macroName, SourceLineInfo const &lineInfo, ResultWas::OfType resultType, StringRef names);
3080
    ~Capturer();
3081

3082
    void captureValue(size_t index, std::string const &value);
3083

3084
    template<typename T>
3085
    void captureValues(size_t index, T const &value) {
3086
      captureValue(index, Catch::Detail::stringify(value));
3087
    }
3088

3089
    template<typename T, typename... Ts>
3090
    void captureValues(size_t index, T const &value, Ts const &...values) {
3091
      captureValue(index, Catch::Detail::stringify(value));
3092
      captureValues(index + 1, values...);
3093
    }
3094
  };
3095

3096
} // end namespace Catch
3097

3098
// end catch_message.h
3099
#if !defined(CATCH_CONFIG_DISABLE)
3100

3101
#if !defined(CATCH_CONFIG_DISABLE_STRINGIFICATION)
3102
#define CATCH_INTERNAL_STRINGIFY(...) #__VA_ARGS__
3103
#else
3104
#define CATCH_INTERNAL_STRINGIFY(...) "Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION"
3105
#endif
3106

3107
#if defined(CATCH_CONFIG_FAST_COMPILE) || defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
3108

3109
///////////////////////////////////////////////////////////////////////////////
3110
// Another way to speed-up compilation is to omit local try-catch for REQUIRE*
3111
// macros.
3112
#define INTERNAL_CATCH_TRY
3113
#define INTERNAL_CATCH_CATCH(capturer)
3114

3115
#else // CATCH_CONFIG_FAST_COMPILE
3116

3117
#define INTERNAL_CATCH_TRY try
3118
#define INTERNAL_CATCH_CATCH(handler)            \
3119
  catch (...) {                                  \
3120
    handler.handleUnexpectedInflightException(); \
3121
  }
3122

3123
#endif
3124

3125
#define INTERNAL_CATCH_REACT(handler) handler.complete();
3126

3127
///////////////////////////////////////////////////////////////////////////////
3128
#define INTERNAL_CATCH_TEST(macroName, resultDisposition, ...)                           \
3129
  do {                                                                                   \
3130
    CATCH_INTERNAL_IGNORE_BUT_WARN(__VA_ARGS__);                                         \
3131
    Catch::AssertionHandler catchAssertionHandler(macroName##_catch_sr,                  \
3132
                                                  CATCH_INTERNAL_LINEINFO,               \
3133
                                                  CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), \
3134
                                                  resultDisposition);                    \
3135
    INTERNAL_CATCH_TRY {                                                                 \
3136
      CATCH_INTERNAL_START_WARNINGS_SUPPRESSION                                          \
3137
      CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS                                       \
3138
      catchAssertionHandler.handleExpr(Catch::Decomposer() <= __VA_ARGS__);              \
3139
      CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION                                           \
3140
    }                                                                                    \
3141
    INTERNAL_CATCH_CATCH(catchAssertionHandler)                                          \
3142
    INTERNAL_CATCH_REACT(catchAssertionHandler)                                          \
3143
  } while ((void)0, (false) && static_cast<bool>(!!(__VA_ARGS__)))
3144

3145
///////////////////////////////////////////////////////////////////////////////
3146
#define INTERNAL_CATCH_IF(macroName, resultDisposition, ...)      \
3147
  INTERNAL_CATCH_TEST(macroName, resultDisposition, __VA_ARGS__); \
3148
  if (Catch::getResultCapture().lastAssertionPassed())
3149

3150
///////////////////////////////////////////////////////////////////////////////
3151
#define INTERNAL_CATCH_ELSE(macroName, resultDisposition, ...)    \
3152
  INTERNAL_CATCH_TEST(macroName, resultDisposition, __VA_ARGS__); \
3153
  if (!Catch::getResultCapture().lastAssertionPassed())
3154

3155
///////////////////////////////////////////////////////////////////////////////
3156
#define INTERNAL_CATCH_NO_THROW(macroName, resultDisposition, ...)                       \
3157
  do {                                                                                   \
3158
    Catch::AssertionHandler catchAssertionHandler(macroName##_catch_sr,                  \
3159
                                                  CATCH_INTERNAL_LINEINFO,               \
3160
                                                  CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), \
3161
                                                  resultDisposition);                    \
3162
    try {                                                                                \
3163
      static_cast<void>(__VA_ARGS__);                                                    \
3164
      catchAssertionHandler.handleExceptionNotThrownAsExpected();                        \
3165
    } catch (...) {                                                                      \
3166
      catchAssertionHandler.handleUnexpectedInflightException();                         \
3167
    }                                                                                    \
3168
    INTERNAL_CATCH_REACT(catchAssertionHandler)                                          \
3169
  } while (false)
3170

3171
///////////////////////////////////////////////////////////////////////////////
3172
#define INTERNAL_CATCH_THROWS(macroName, resultDisposition, ...)                         \
3173
  do {                                                                                   \
3174
    Catch::AssertionHandler catchAssertionHandler(macroName##_catch_sr,                  \
3175
                                                  CATCH_INTERNAL_LINEINFO,               \
3176
                                                  CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), \
3177
                                                  resultDisposition);                    \
3178
    if (catchAssertionHandler.allowThrows())                                             \
3179
      try {                                                                              \
3180
        static_cast<void>(__VA_ARGS__);                                                  \
3181
        catchAssertionHandler.handleUnexpectedExceptionNotThrown();                      \
3182
      } catch (...) {                                                                    \
3183
        catchAssertionHandler.handleExceptionThrownAsExpected();                         \
3184
      }                                                                                  \
3185
    else                                                                                 \
3186
      catchAssertionHandler.handleThrowingCallSkipped();                                 \
3187
    INTERNAL_CATCH_REACT(catchAssertionHandler)                                          \
3188
  } while (false)
3189

3190
///////////////////////////////////////////////////////////////////////////////
3191
#define INTERNAL_CATCH_THROWS_AS(macroName, exceptionType, resultDisposition, expr)                                            \
3192
  do {                                                                                                                         \
3193
    Catch::AssertionHandler catchAssertionHandler(macroName##_catch_sr,                                                        \
3194
                                                  CATCH_INTERNAL_LINEINFO,                                                     \
3195
                                                  CATCH_INTERNAL_STRINGIFY(expr) ", " CATCH_INTERNAL_STRINGIFY(exceptionType), \
3196
                                                  resultDisposition);                                                          \
3197
    if (catchAssertionHandler.allowThrows())                                                                                   \
3198
      try {                                                                                                                    \
3199
        static_cast<void>(expr);                                                                                               \
3200
        catchAssertionHandler.handleUnexpectedExceptionNotThrown();                                                            \
3201
      } catch (exceptionType const &) {                                                                                        \
3202
        catchAssertionHandler.handleExceptionThrownAsExpected();                                                               \
3203
      } catch (...) {                                                                                                          \
3204
        catchAssertionHandler.handleUnexpectedInflightException();                                                             \
3205
      }                                                                                                                        \
3206
    else                                                                                                                       \
3207
      catchAssertionHandler.handleThrowingCallSkipped();                                                                       \
3208
    INTERNAL_CATCH_REACT(catchAssertionHandler)                                                                                \
3209
  } while (false)
3210

3211
///////////////////////////////////////////////////////////////////////////////
3212
#define INTERNAL_CATCH_MSG(macroName, messageType, resultDisposition, ...)                                                               \
3213
  do {                                                                                                                                   \
3214
    Catch::AssertionHandler catchAssertionHandler(macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::StringRef(), resultDisposition); \
3215
    catchAssertionHandler.handleMessage(messageType,                                                                                     \
3216
                                        (Catch::MessageStream() << __VA_ARGS__ + ::Catch::StreamEndStop()).m_stream.str());              \
3217
    INTERNAL_CATCH_REACT(catchAssertionHandler)                                                                                          \
3218
  } while (false)
3219

3220
///////////////////////////////////////////////////////////////////////////////
3221
#define INTERNAL_CATCH_CAPTURE(varName, macroName, ...)                                                     \
3222
  auto varName = Catch::Capturer(macroName, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info, #__VA_ARGS__); \
3223
  varName.captureValues(0, __VA_ARGS__)
3224

3225
///////////////////////////////////////////////////////////////////////////////
3226
#define INTERNAL_CATCH_INFO(macroName, log)                       \
3227
  Catch::ScopedMessage INTERNAL_CATCH_UNIQUE_NAME(scopedMessage)( \
3228
      Catch::MessageBuilder(macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info) << log);
3229

3230
///////////////////////////////////////////////////////////////////////////////
3231
#define INTERNAL_CATCH_UNSCOPED_INFO(macroName, log) \
3232
  Catch::getResultCapture().emplaceUnscopedMessage(  \
3233
      Catch::MessageBuilder(macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info) << log)
3234

3235
///////////////////////////////////////////////////////////////////////////////
3236
// Although this is matcher-based, it can be used with just a string
3237
#define INTERNAL_CATCH_THROWS_STR_MATCHES(macroName, resultDisposition, matcher, ...)                                           \
3238
  do {                                                                                                                          \
3239
    Catch::AssertionHandler catchAssertionHandler(macroName##_catch_sr,                                                         \
3240
                                                  CATCH_INTERNAL_LINEINFO,                                                      \
3241
                                                  CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) ", " CATCH_INTERNAL_STRINGIFY(matcher), \
3242
                                                  resultDisposition);                                                           \
3243
    if (catchAssertionHandler.allowThrows())                                                                                    \
3244
      try {                                                                                                                     \
3245
        static_cast<void>(__VA_ARGS__);                                                                                         \
3246
        catchAssertionHandler.handleUnexpectedExceptionNotThrown();                                                             \
3247
      } catch (...) {                                                                                                           \
3248
        Catch::handleExceptionMatchExpr(catchAssertionHandler, matcher, #matcher##_catch_sr);                                   \
3249
      }                                                                                                                         \
3250
    else                                                                                                                        \
3251
      catchAssertionHandler.handleThrowingCallSkipped();                                                                        \
3252
    INTERNAL_CATCH_REACT(catchAssertionHandler)                                                                                 \
3253
  } while (false)
3254

3255
#endif // CATCH_CONFIG_DISABLE
3256

3257
// end catch_capture.hpp
3258
// start catch_section.h
3259

3260
// start catch_section_info.h
3261

3262
// start catch_totals.h
3263

3264
#include <cstddef>
3265

3266
namespace Catch {
3267
  struct Counts {
3268
    Counts operator-(Counts const &other) const;
3269
    Counts &operator+=(Counts const &other);
3270

3271
    std::size_t total() const;
3272
    bool allPassed() const;
3273
    bool allOk() const;
3274

3275
    std::size_t passed = 0;
3276
    std::size_t failed = 0;
3277
    std::size_t failedButOk = 0;
3278
  };
3279

3280
  struct Totals {
3281
    Totals operator-(Totals const &other) const;
3282
    Totals &operator+=(Totals const &other);
3283

3284
    Totals delta(Totals const &prevTotals) const;
3285

3286
    int error = 0;
3287
    Counts assertions;
3288
    Counts testCases;
3289
  };
3290
} // namespace Catch
3291

3292
// end catch_totals.h
3293
#include <string>
3294

3295
namespace Catch {
3296
  struct SectionInfo {
3297
    SectionInfo(SourceLineInfo const &_lineInfo, std::string const &_name);
3298

3299
    // Deprecated
3300
    SectionInfo(SourceLineInfo const &_lineInfo, std::string const &_name, std::string const &)
3301
        : SectionInfo(_lineInfo, _name) {
3302
    }
3303

3304
    std::string name;
3305
    std::string description; // !Deprecated: this will always be empty
3306
    SourceLineInfo lineInfo;
3307
  };
3308

3309
  struct SectionEndInfo {
3310
    SectionInfo sectionInfo;
3311
    Counts prevAssertions;
3312
    double durationInSeconds;
3313
  };
3314

3315
} // end namespace Catch
3316

3317
// end catch_section_info.h
3318
// start catch_timer.h
3319

3320
#include <cstdint>
3321

3322
namespace Catch {
3323
  auto getCurrentNanosecondsSinceEpoch() -> uint64_t;
3324
  auto getEstimatedClockResolution() -> uint64_t;
3325

3326
  class Timer {
3327
    uint64_t m_nanoseconds = 0;
3328

3329
  public:
3330
    void start();
3331
    auto getElapsedNanoseconds() const -> uint64_t;
3332
    auto getElapsedMicroseconds() const -> uint64_t;
3333
    auto getElapsedMilliseconds() const -> unsigned int;
3334
    auto getElapsedSeconds() const -> double;
3335
  };
3336

3337
} // namespace Catch
3338

3339
// end catch_timer.h
3340
#include <string>
3341

3342
namespace Catch {
3343
  class Section : NonCopyable {
3344
  public:
3345
    Section(SectionInfo const &info);
3346
    ~Section();
3347

3348
    // This indicates whether the section should be executed or not
3349
    explicit operator bool() const;
3350

3351
  private:
3352
    SectionInfo m_info;
3353

3354
    std::string m_name;
3355
    Counts m_assertions;
3356
    bool m_sectionIncluded;
3357
    Timer m_timer;
3358
  };
3359

3360
} // end namespace Catch
3361

3362
#define INTERNAL_CATCH_SECTION(...)                                            \
3363
  CATCH_INTERNAL_START_WARNINGS_SUPPRESSION                                    \
3364
  CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS                                      \
3365
  if (Catch::Section const &INTERNAL_CATCH_UNIQUE_NAME(catch_internal_Section) \
3366
      = Catch::SectionInfo(CATCH_INTERNAL_LINEINFO, __VA_ARGS__))              \
3367
  CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
3368

3369
#define INTERNAL_CATCH_DYNAMIC_SECTION(...)                                                                \
3370
  CATCH_INTERNAL_START_WARNINGS_SUPPRESSION                                                                \
3371
  CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS                                                                  \
3372
  if (Catch::Section const &INTERNAL_CATCH_UNIQUE_NAME(catch_internal_Section)                             \
3373
      = Catch::SectionInfo(CATCH_INTERNAL_LINEINFO, (Catch::ReusableStringStream() << __VA_ARGS__).str())) \
3374
  CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
3375

3376
// end catch_section.h
3377
// start catch_interfaces_exception.h
3378

3379
// start catch_interfaces_registry_hub.h
3380

3381
#include <memory>
3382
#include <string>
3383

3384
namespace Catch {
3385
  class TestCase;
3386
  struct ITestCaseRegistry;
3387
  struct IExceptionTranslatorRegistry;
3388
  struct IExceptionTranslator;
3389
  struct IReporterRegistry;
3390
  struct IReporterFactory;
3391
  struct ITagAliasRegistry;
3392
  struct IMutableEnumValuesRegistry;
3393

3394
  class StartupExceptionRegistry;
3395

3396
  using IReporterFactoryPtr = std::shared_ptr<IReporterFactory>;
3397

3398 1
  struct IRegistryHub {
3399
    virtual ~IRegistryHub();
3400

3401
    virtual IReporterRegistry const &getReporterRegistry() const = 0;
3402
    virtual ITestCaseRegistry const &getTestCaseRegistry() const = 0;
3403
    virtual ITagAliasRegistry const &getTagAliasRegistry() const = 0;
3404
    virtual IExceptionTranslatorRegistry const &getExceptionTranslatorRegistry() const = 0;
3405

3406
    virtual StartupExceptionRegistry const &getStartupExceptionRegistry() const = 0;
3407
  };
3408

3409 1
  struct IMutableRegistryHub {
3410
    virtual ~IMutableRegistryHub();
3411
    virtual void registerReporter(std::string const &name, IReporterFactoryPtr const &factory) = 0;
3412
    virtual void registerListener(IReporterFactoryPtr const &factory) = 0;
3413
    virtual void registerTest(TestCase const &testInfo) = 0;
3414
    virtual void registerTranslator(const IExceptionTranslator *translator) = 0;
3415
    virtual void registerTagAlias(std::string const &alias, std::string const &tag, SourceLineInfo const &lineInfo) = 0;
3416
    virtual void registerStartupException() noexcept = 0;
3417
    virtual IMutableEnumValuesRegistry &getMutableEnumValuesRegistry() = 0;
3418
  };
3419

3420
  IRegistryHub const &getRegistryHub();
3421
  IMutableRegistryHub &getMutableRegistryHub();
3422
  void cleanUp();
3423
  std::string translateActiveException();
3424

3425
} // namespace Catch
3426

3427
// end catch_interfaces_registry_hub.h
3428
#if defined(CATCH_CONFIG_DISABLE)
3429
#define INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG(translatorName, signature) static std::string translatorName(signature)
3430
#endif
3431

3432
#include <exception>
3433
#include <string>
3434
#include <vector>
3435

3436
namespace Catch {
3437
  using exceptionTranslateFunction = std::string (*)();
3438

3439
  struct IExceptionTranslator;
3440
  using ExceptionTranslators = std::vector<std::unique_ptr<IExceptionTranslator const>>;
3441

3442 0
  struct IExceptionTranslator {
3443
    virtual ~IExceptionTranslator();
3444
    virtual std::string translate(ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd) const = 0;
3445
  };
3446

3447 1
  struct IExceptionTranslatorRegistry {
3448
    virtual ~IExceptionTranslatorRegistry();
3449

3450
    virtual std::string translateActiveException() const = 0;
3451
  };
3452

3453
  class ExceptionTranslatorRegistrar {
3454
    template<typename T>
3455
    class ExceptionTranslator : public IExceptionTranslator {
3456
    public:
3457
      ExceptionTranslator(std::string (*translateFunction)(T &))
3458
          : m_translateFunction(translateFunction) {
3459
      }
3460

3461
      std::string translate(ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd) const override {
3462
#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
3463
        return "";
3464
#else
3465
        try {
3466
          if (it == itEnd)
3467
            std::rethrow_exception(std::current_exception());
3468
          else
3469
            return (*it)->translate(it + 1, itEnd);
3470
        } catch (T &ex) {
3471
          return m_translateFunction(ex);
3472
        }
3473
#endif
3474
      }
3475

3476
    protected:
3477
      std::string (*m_translateFunction)(T &);
3478
    };
3479

3480
  public:
3481
    template<typename T>
3482
    ExceptionTranslatorRegistrar(std::string (*translateFunction)(T &)) {
3483
      getMutableRegistryHub().registerTranslator(new ExceptionTranslator<T>(translateFunction));
3484
    }
3485
  };
3486
} // namespace Catch
3487

3488
///////////////////////////////////////////////////////////////////////////////
3489
#define INTERNAL_CATCH_TRANSLATE_EXCEPTION2(translatorName, signature)                                                  \
3490
  static std::string translatorName(signature);                                                                         \
3491
  CATCH_INTERNAL_START_WARNINGS_SUPPRESSION                                                                             \
3492
  CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS                                                                              \
3493
  namespace {                                                                                                           \
3494
    Catch::ExceptionTranslatorRegistrar INTERNAL_CATCH_UNIQUE_NAME(catch_internal_ExceptionRegistrar)(&translatorName); \
3495
  }                                                                                                                     \
3496
  CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION                                                                              \
3497
  static std::string translatorName(signature)
3498

3499
#define INTERNAL_CATCH_TRANSLATE_EXCEPTION(signature) \
3500
  INTERNAL_CATCH_TRANSLATE_EXCEPTION2(INTERNAL_CATCH_UNIQUE_NAME(catch_internal_ExceptionTranslator), signature)
3501

3502
// end catch_interfaces_exception.h
3503
// start catch_approx.h
3504

3505
#include <type_traits>
3506

3507
namespace Catch {
3508
  namespace Detail {
3509
    class Approx {
3510
    private:
3511
      bool equalityComparisonImpl(double other) const;
3512
      // Validates the new margin (margin >= 0)
3513
      // out-of-line to avoid including stdexcept in the header
3514
      void setMargin(double margin);
3515
      // Validates the new epsilon (0 < epsilon < 1)
3516
      // out-of-line to avoid including stdexcept in the header
3517
      void setEpsilon(double epsilon);
3518

3519
    public:
3520
      explicit Approx(double value);
3521

3522
      static Approx custom();
3523

3524
      Approx operator-() const;
3525

3526
      template<typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3527
      Approx operator()(T const &value) {
3528
        Approx approx(static_cast<double>(value));
3529
        approx.m_epsilon = m_epsilon;
3530
        approx.m_margin = m_margin;
3531
        approx.m_scale = m_scale;
3532
        return approx;
3533
      }
3534

3535
      template<typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3536 0
      explicit Approx(T const &value)
3537 0
          : Approx(static_cast<double>(value)) {
3538
      }
3539

3540
      template<typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3541 1
      friend bool operator==(const T &lhs, Approx const &rhs) {
3542 1
        auto lhs_v = static_cast<double>(lhs);
3543 1
        return rhs.equalityComparisonImpl(lhs_v);
3544
      }
3545

3546
      template<typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3547
      friend bool operator==(Approx const &lhs, const T &rhs) {
3548
        return operator==(rhs, lhs);
3549
      }
3550

3551
      template<typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3552
      friend bool operator!=(T const &lhs, Approx const &rhs) {
3553
        return !operator==(lhs, rhs);
3554
      }
3555

3556
      template<typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3557
      friend bool operator!=(Approx const &lhs, T const &rhs) {
3558
        return !operator==(rhs, lhs);
3559
      }
3560

3561
      template<typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3562
      friend bool operator<=(T const &lhs, Approx const &rhs) {
3563
        return static_cast<double>(lhs) < rhs.m_value || lhs == rhs;
3564
      }
3565

3566
      template<typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3567
      friend bool operator<=(Approx const &lhs, T const &rhs) {
3568
        return lhs.m_value < static_cast<double>(rhs) || lhs == rhs;
3569
      }
3570

3571
      template<typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3572
      friend bool operator>=(T const &lhs, Approx const &rhs) {
3573
        return static_cast<double>(lhs) > rhs.m_value || lhs == rhs;
3574
      }
3575

3576
      template<typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3577
      friend bool operator>=(Approx const &lhs, T const &rhs) {
3578
        return lhs.m_value > static_cast<double>(rhs) || lhs == rhs;
3579
      }
3580

3581
      template<typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3582
      Approx &epsilon(T const &newEpsilon) {
3583
        double epsilonAsDouble = static_cast<double>(newEpsilon);
3584
        setEpsilon(epsilonAsDouble);
3585
        return *this;
3586
      }
3587

3588
      template<typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3589
      Approx &margin(T const &newMargin) {
3590
        double marginAsDouble = static_cast<double>(newMargin);
3591
        setMargin(marginAsDouble);
3592
        return *this;
3593
      }
3594

3595
      template<typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
3596
      Approx &scale(T const &newScale) {
3597
        m_scale = static_cast<double>(newScale);
3598
        return *this;
3599
      }
3600

3601
      std::string toString() const;
3602

3603
    private:
3604
      double m_epsilon;
3605
      double m_margin;
3606
      double m_scale;
3607
      double m_value;
3608
    };
3609
  } // end namespace Detail
3610

3611
  namespace literals {
3612
    Detail::Approx operator"" _a(long double val);
3613
    Detail::Approx operator"" _a(unsigned long long val);
3614
  } // end namespace literals
3615

3616
  template<>
3617
  struct StringMaker<Catch::Detail::Approx> {
3618
    static std::string convert(Catch::Detail::Approx const &value);
3619
  };
3620

3621
} // end namespace Catch
3622

3623
// end catch_approx.h
3624
// start catch_string_manip.h
3625

3626
#include <iosfwd>
3627
#include <string>
3628
#include <vector>
3629

3630
namespace Catch {
3631
  bool startsWith(std::string const &s, std::string const &prefix);
3632
  bool startsWith(std::string const &s, char prefix);
3633
  bool endsWith(std::string const &s, std::string const &suffix);
3634
  bool endsWith(std::string const &s, char suffix);
3635
  bool contains(std::string const &s, std::string const &infix);
3636
  void toLowerInPlace(std::string &s);
3637
  std::