Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Give Catch3 its own build names and headers

Catch2 compatibility means the API tests are written in: the macros, such
as TEST_CASE and REQUIRE, and the Catch:: namespace. It does not mean
Catch2's build names or header paths. find_package(Catch2) found Catch3,
and a project using both frameworks met two packages, two sets of targets,
two Catch.cmake modules and two catch2/ header trees with the same names.

Build names:
- CMake: project and package Catch3, targets Catch3::Catch3 and
  Catch3::Catch3WithMain, libraries Catch3 and Catch3Main, options
  CATCH3_*, lib/cmake/Catch3 with Catch3Config, and pkg-config catch3 and
  catch3-with-main. The version is Catch3's, 0.3.0, compatible within a
  minor version.
- The CMake scripts are Catch3.cmake (catch3_discover_tests),
  Catch3AddTests.cmake and Catch3ShardTests.cmake
  (catch3_add_sharded_tests); the helpers they define at ctest time have a
  catch3_ prefix. ParseAndAddCatchTests.cmake, deprecated upstream, is gone.
- Bazel //:catch3 and //:catch3_main, Meson catch3 and catch3-with-main
  (with override_dependency), Xmake catch3 and catch3_main, Premake Catch3
  and Catch3WithMain. Visual Studio projects get GUIDs of their own.
- The Progmasoft::Catch3 target and package are gone: property testing
  and snapshots are part of Catch3::Catch3. Their sources now build with
  the library's warning flags, so property failures are built field by
  field (no missing initializers) and the default property name is a
  thread-local pointer to the name its scope owns (no global destructor).

Headers: the engine moved from src/catch2 to src/Progmasoft/Catch3 with
Progmasoft names, so <catch2/catch_test_macros.hpp> is
<Progmasoft/Catch3/TestMacros.hpp>, <catch2/matchers/catch_matchers_string.hpp>
is <Progmasoft/Catch3/Matchers/String.hpp>, and interface headers are named
after their interface, such as Interfaces/IConfig.hpp. Include guards
became #pragma once. The installed headers go to include/Progmasoft.
src/Progmasoft/Context.cpp is StrategyContext.cpp, so no two sources share
a file name.

tools/scripts/upstreamFiles.txt lists the files that come from Catch2.
The license check expects BSL-1.0 on them and Progmasoft's header on the
rest of src/Progmasoft; the convenience-header check, the amalgamation
script and the surrogate tests take the engine's headers from it. The
amalgamated files are regenerated. The header-guard workflow checks for
#pragma once instead of checkguard.

Documents, the README and the release notes describe the new names.
Commit
126dc333564cb72b5115d9a9242d66694694b6d0
Author
Leitwolf11 ·
Parents
13f81a480a93

Files · Download .tar.gz

Changes

 .github/workflows/linux-builds.yml                 |     8 +-
 .github/workflows/mac-builds.yml                   |     4 +-
 .github/workflows/mac-sanitizer-builds.yml         |     2 +-
 .github/workflows/validate-header-guards.yml       |    10 +-
 BUILD.bazel                                        |   123 +-
 ...Catch2Config.cmake.in => Catch3Config.cmake.in} |     4 +-
 CMake/CatchMiscFunctions.cmake                     |     4 +-
 CMake/catch2-with-main.pc.in                       |    10 -
 CMake/catch3-with-main.pc.in                       |    10 +
 CMake/{catch2.pc.in => catch3.pc.in}               |     6 +-
 CMakeLists.txt                                     |   112 +-
 CMakePresets.json                                  |    14 +-
 Doxyfile                                           |     2 +-
 README.md                                          |    18 +-
 benchmarks/CMakeLists.txt                          |     6 +-
 benchmarks/assertion_listener.cpp                  |     4 +-
 benchmarks/discover_tests/benchmark_discovery.py   |     4 +-
 benchmarks/discover_tests/copy_shim.cmake          |     2 +-
 benchmarks/only_include.cpp                        |     6 +-
 benchmarks/readme.md                               |    16 +-
 benchmarks/runtime_assertion_benches.cpp           |     4 +-
 .../{catch2_config.lua => catch3_config.lua}       |    26 +-
 docs/Readme.md                                     |    16 +-
 docs/assertions.md                                 |     2 +-
 docs/benchmarks.md                                 |     2 +-
 docs/ci-and-misc.md                                |     2 +-
 docs/cmake-integration.md                          |   230 +-
 docs/comparing-floating-point-numbers.md           |     6 +-
 docs/configuration.md                              |     2 +-
 docs/contributing.md                               |     2 +-
 docs/event-listeners.md                            |     6 +-
 docs/faq.md                                        |     8 +-
 docs/filtering-execution-path.md                   |     2 +-
 docs/generators.md                                 |    12 +-
 docs/limitations.md                                |     8 +-
 docs/list-of-examples.md                           |     2 +-
 docs/logging.md                                    |     2 +-
 docs/matchers.md                                   |    28 +-
 docs/migrate-v2-to-v3.md                           |    25 +-
 docs/other-macros.md                               |     2 +-
 docs/own-main.md                                   |     8 +-
 docs/progmasoft-catch3.md                          |    48 +-
 docs/progmasoft-properties.md                      |     5 +-
 docs/progmasoft-roadmap.md                         |    11 +-
 docs/progmasoft-runner.md                          |     4 +-
 docs/release-notes.md                              |    17 +-
 docs/reporter-events.md                            |     2 +-
 docs/skipping-passing-failing.md                   |     2 +-
 docs/test-cases-and-sections.md                    |    10 +-
 docs/test-fixtures.md                              |     2 +-
 docs/thread-safety.md                              |     2 +-
 docs/tostring.md                                   |     2 +-
 docs/tutorial.md                                   |     9 +-
 docs/usage-tips.md                                 |     6 +-
 docs/why-catch3.md                                 |    29 +-
 examples/010-TestCase.cpp                          |     2 +-
 examples/020-TestCase-1.cpp                        |     2 +-
 examples/020-TestCase-2.cpp                        |     2 +-
 examples/030-Asn-Require-Check.cpp                 |     2 +-
 examples/100-Fix-Section.cpp                       |     2 +-
 examples/110-Fix-ClassFixture.cpp                  |     2 +-
 examples/111-Fix-PersistentFixture.cpp             |     2 +-
 examples/120-Bdd-ScenarioGivenWhenThen.cpp         |     2 +-
 examples/210-Evt-EventListeners.cpp                |     8 +-
 examples/231-Cfg-OutputStreams.cpp                 |     2 +-
 examples/232-Cfg-CustomMain.cpp                    |     2 +-
 examples/300-Gen-OwnGenerator.cpp                  |     6 +-
 examples/301-Gen-MapTypeConversion.cpp             |     4 +-
 examples/302-Gen-Table.cpp                         |     4 +-
 examples/310-Gen-VariablesInGenerators.cpp         |     6 +-
 examples/311-Gen-CustomCapture.cpp                 |     6 +-
 examples/CMakeLists.txt                            |     6 +-
 extras/{Catch.cmake => Catch3.cmake}               |    46 +-
 .../{CatchAddTests.cmake => Catch3AddTests.cmake}  |    50 +-
 ...atchShardTests.cmake => Catch3ShardTests.cmake} |    10 +-
 ...dTestsImpl.cmake => Catch3ShardTestsImpl.cmake} |     0
 extras/ParseAndAddCatchTests.cmake                 |   250 -
 extras/catch_amalgamated.cpp                       |  9365 +++++-----
 extras/catch_amalgamated.hpp                       | 17671 +++++++++----------
 fuzzing/CMakeLists.txt                             |     2 +-
 fuzzing/build_fuzzers.sh                           |    12 +-
 fuzzing/fuzz_TestSpecParser.cpp                    |     4 +-
 meson.build                                        |     6 +-
 premake5.lua                                       |    53 +-
 requirements-header-guards.txt                     |     4 -
 src/CMakeLists.txt                                 |   652 +-
 src/Progmasoft/BUILD.bazel                         |   148 +-
 src/Progmasoft/Catch3.hpp                          |     2 +-
 src/Progmasoft/Catch3/All.hpp                      |   127 +
 .../Catch3/Approx.cpp}                             |     6 +-
 .../Catch3/Approx.hpp}                             |     6 +-
 .../Catch3/AssertionInfo.hpp}                      |    10 +-
 .../Catch3/AssertionResult.cpp}                    |     6 +-
 .../Catch3/AssertionResult.hpp}                    |    14 +-
 src/Progmasoft/Catch3/Assertions.hpp               |     6 +-
 src/Progmasoft/Catch3/Benchmark/All.hpp            |    44 +
 .../Catch3/Benchmark/Benchmark.cpp}                |     2 +-
 .../Catch3/Benchmark/Benchmark.hpp}                |    40 +-
 .../Catch3/Benchmark/Chronometer.cpp}              |     2 +-
 .../Catch3/Benchmark/Chronometer.hpp}              |    12 +-
 .../Catch3/Benchmark/Clock.hpp}                    |     4 +-
 .../Catch3/Benchmark/Constructor.hpp}              |     6 +-
 .../Catch3/Benchmark/Detail/Analyse.cpp}           |    12 +-
 .../Catch3/Benchmark/Detail/Analyse.hpp}           |     8 +-
 .../Catch3/Benchmark/Detail/BenchmarkFunction.cpp} |     2 +-
 .../Catch3/Benchmark/Detail/BenchmarkFunction.hpp} |    12 +-
 .../Catch3/Benchmark/Detail/BenchmarkStats.hpp}    |    12 +-
 .../Catch3/Benchmark/Detail/BenchmarkStatsFwd.hpp} |     4 +-
 .../Catch3/Benchmark/Detail/CompleteInvoke.hpp}    |     8 +-
 .../Catch3/Benchmark/Detail/EstimateClock.hpp}     |    16 +-
 .../Catch3/Benchmark/Detail/Measure.hpp}           |    10 +-
 .../Catch3/Benchmark/Detail/Repeat.hpp}            |     6 +-
 .../Catch3/Benchmark/Detail/RunForAtLeast.cpp}     |     4 +-
 .../Catch3/Benchmark/Detail/RunForAtLeast.hpp}     |    18 +-
 .../Catch3/Benchmark/Detail/Stats.cpp}             |    10 +-
 .../Catch3/Benchmark/Detail/Stats.hpp}             |     8 +-
 .../Catch3/Benchmark/Detail/Timing.hpp}            |     8 +-
 .../Catch3/Benchmark/Environment.hpp}              |     8 +-
 .../Catch3/Benchmark/Estimate.hpp}                 |     4 +-
 .../Catch3/Benchmark/ExecutionPlan.hpp}            |    16 +-
 .../Catch3/Benchmark/Optimizer.hpp}                |     6 +-
 .../Catch3/Benchmark/OutlierClassification.hpp}    |     5 +-
 .../Catch3/Benchmark/SampleAnalysis.hpp}           |    10 +-
 .../Catch3/CaseSensitive.hpp}                      |     4 +-
 .../Catch3/Config.cpp}                             |    10 +-
 .../Catch3/Config.hpp}                             |    18 +-
 .../Catch3/EngineVersion.cpp}                      |     2 +-
 .../Catch3/EngineVersion.hpp}                      |     4 +-
 .../Catch3/EngineVersionMacros.hpp}                |     4 +-
 .../Catch3/Generators/Adapters.hpp}                |    12 +-
 .../Catch3/Generators/All.hpp}                     |    16 +-
 .../Catch3/Generators/GeneratorException.cpp}      |     2 +-
 .../Catch3/Generators/GeneratorException.hpp}      |     4 +-
 .../Catch3/Generators/Generators.cpp}              |     4 +-
 .../Catch3/Generators/Generators.hpp}              |    18 +-
 .../Catch3/Generators/Random.cpp}                  |     4 +-
 .../Catch3/Generators/Random.hpp}                  |    14 +-
 .../Catch3/Generators/Range.hpp}                   |     6 +-
 .../Catch3/Generators/Throw.cpp}                   |     6 +-
 .../Catch3/Generators/Throw.hpp}                   |     4 +-
 .../Catch3/GetRandomSeed.cpp}                      |     6 +-
 .../Catch3/GetRandomSeed.hpp}                      |     4 +-
 src/Progmasoft/Catch3/Interfaces/All.hpp           |    34 +
 .../Catch3/Interfaces/EventListenerFactory.cpp}    |     2 +-
 .../Catch3/Interfaces/EventListenerFactory.hpp}    |     8 +-
 .../Catch3/Interfaces/IConfig.cpp}                 |     2 +-
 .../Catch3/Interfaces/IConfig.hpp}                 |     8 +-
 .../Catch3/Interfaces/IEventListener.cpp}          |     8 +-
 .../Catch3/Interfaces/IEventListener.hpp}          |    24 +-
 .../Catch3/Interfaces/IExceptionTranslator.cpp}    |     2 +-
 .../Catch3/Interfaces/IExceptionTranslator.hpp}    |     6 +-
 .../Catch3/Interfaces/IGeneratorTracker.cpp}       |     4 +-
 .../Catch3/Interfaces/IGeneratorTracker.hpp}       |     8 +-
 .../Catch3/Interfaces/IRegistryHub.cpp}            |     2 +-
 .../Catch3/Interfaces/IRegistryHub.hpp}            |     6 +-
 .../Catch3/Interfaces/IResultCapture.cpp}          |     4 +-
 .../Catch3/Interfaces/IResultCapture.hpp}          |    14 +-
 .../Catch3/Interfaces/ITagAliasRegistry.hpp}       |     4 +-
 .../Catch3/Interfaces/ITestCaseRegistry.cpp}       |     2 +-
 .../Catch3/Interfaces/ITestCaseRegistry.hpp}       |     4 +-
 .../Catch3/Interfaces/ITestInvoker.hpp}            |     4 +-
 .../Catch3/Internal/AssertionHandler.cpp}          |    18 +-
 .../Catch3/Internal/AssertionHandler.hpp}          |     8 +-
 .../Internal/CaseInsensitiveComparisons.cpp}       |     4 +-
 .../Internal/CaseInsensitiveComparisons.hpp}       |     6 +-
 .../Catch3/Internal/CompareTraits.hpp}             |     6 +-
 .../Catch3/Internal/CompilerCapabilities.hpp}      |     8 +-
 .../Catch3/Internal/ConfigAndroidLogWrite.hpp}     |     6 +-
 .../Catch3/Internal/ConfigCounter.hpp}             |     6 +-
 .../Catch3/Internal/ConfigPrefixMessages.hpp}      |     6 +-
 .../Internal/ConfigStaticAnalysisSupport.hpp}      |     6 +-
 .../Catch3/Internal/ConfigUncaughtExceptions.hpp}  |     6 +-
 .../Catch3/Internal/ConfigWchar.hpp}               |     6 +-
 .../Catch3/Internal/ContainerNonMembers.hpp}       |     6 +-
 .../Catch3/Internal/Context.cpp}                   |     4 +-
 .../Catch3/Internal/Context.hpp}                   |     6 +-
 .../Catch3/Internal/Debugger.cpp}                  |     8 +-
 .../Catch3/Internal/Debugger.hpp}                  |     6 +-
 .../Catch3/Internal/Decomposer.cpp}                |     2 +-
 .../Catch3/Internal/Decomposer.hpp}                |    16 +-
 .../Catch3/Internal/DeprecationMacro.hpp}          |     6 +-
 .../Catch3/Internal/Enforce.cpp}                   |     4 +-
 .../Catch3/Internal/Enforce.hpp}                   |    10 +-
 .../Catch3/Internal/EnumInfo.cpp}                  |     4 +-
 .../Catch3/Internal/EnumInfo.hpp}                  |     6 +-
 .../Catch3/Internal/ErrnoGuard.cpp}                |     2 +-
 .../Catch3/Internal/ErrnoGuard.hpp}                |     4 +-
 .../Internal/ExceptionTranslatorRegistry.cpp}      |    10 +-
 .../Internal/ExceptionTranslatorRegistry.hpp}      |     8 +-
 .../Catch3/Internal/FatalConditionHandler.cpp}     |    16 +-
 .../Catch3/Internal/FatalConditionHandler.hpp}     |     4 +-
 .../Catch3/Internal/FloatingPointHelpers.cpp}      |     2 +-
 .../Catch3/Internal/FloatingPointHelpers.hpp}      |     6 +-
 .../Catch3/Internal/GetEnv.cpp}                    |     6 +-
 .../Catch3/Internal/GetEnv.hpp}                    |     4 +-
 .../Catch3/Internal/IsPermutation.hpp}             |     4 +-
 .../Catch3/Internal/LazyExpr.cpp}                  |     4 +-
 .../Catch3/Internal/LazyExpr.hpp}                  |     4 +-
 .../Catch3/Internal/LeakDetector.cpp}              |     6 +-
 .../Catch3/Internal/LeakDetector.hpp}              |     4 +-
 .../Catch3/Internal/LifetimeBound.hpp}             |     4 +-
 .../Catch3/Internal/LogicalTraits.hpp}             |     4 +-
 .../Catch3/Internal/Main.cpp}                      |    10 +-
 .../Catch3/Internal/MessageInfo.cpp}               |     4 +-
 .../Catch3/Internal/MessageInfo.hpp}               |    12 +-
 .../Catch3/Internal/Meta.hpp}                      |     4 +-
 .../Catch3/Internal/MoveAndForward.hpp}            |     4 +-
 .../Catch3/Internal/NonCopyable.hpp}               |     4 +-
 .../Catch3/Internal/Optional.hpp}                  |     6 +-
 .../Catch3/Internal/OutputRedirect.cpp}            |    12 +-
 .../Catch3/Internal/OutputRedirect.hpp}            |     6 +-
 .../Catch3/Internal/ParseNumbers.cpp}              |     6 +-
 .../Catch3/Internal/ParseNumbers.hpp}              |     6 +-
 .../Catch3/Internal/PathFilter.hpp}                |     6 +-
 .../Catch3/Internal/Platform.hpp}                  |     4 +-
 .../Catch3/Internal/Polyfills.cpp}                 |     6 +-
 .../Catch3/Internal/Polyfills.hpp}                 |     4 +-
 .../Catch3/Internal/Preprocessor.hpp}              |     8 +-
 .../Internal/PreprocessorInternalStringify.hpp}    |     6 +-
 .../Catch3/Internal/PreprocessorRemoveParens.hpp}  |     4 +-
 .../Internal/RandomFloatingPointHelpers.hpp}       |     6 +-
 .../Catch3/Internal/RandomIntegerHelpers.hpp}      |     4 +-
 .../Catch3/Internal/RandomNumberGenerator.cpp}     |     2 +-
 .../Catch3/Internal/RandomNumberGenerator.hpp}     |     4 +-
 .../Catch3/Internal/RandomSeedGeneration.cpp}      |     6 +-
 .../Catch3/Internal/RandomSeedGeneration.hpp}      |     4 +-
 .../Catch3/Internal/ReporterRegistry.cpp}          |     6 +-
 .../Catch3/Internal/ReporterRegistry.hpp}          |     6 +-
 .../Catch3/Internal/ResultType.hpp}                |     4 +-
 .../Catch3/Internal/ReusableStringStream.cpp}      |     8 +-
 .../Catch3/Internal/ReusableStringStream.hpp}      |     6 +-
 .../Catch3/Internal/RunContext.cpp}                |    44 +-
 .../Catch3/Internal/RunContext.hpp}                |    32 +-
 .../Catch3/Internal/Section.cpp}                   |     8 +-
 .../Catch3/Internal/Section.hpp}                   |    18 +-
 .../Catch3/Internal/Singletons.cpp}                |     2 +-
 .../Catch3/Internal/Singletons.hpp}                |     4 +-
 .../Catch3/Internal/SourceLineInfo.cpp}            |     2 +-
 .../Catch3/Internal/SourceLineInfo.hpp}            |     4 +-
 .../Catch3/Internal/StartupExceptionRegistry.cpp}  |     6 +-
 .../Catch3/Internal/StartupExceptionRegistry.hpp}  |     4 +-
 .../Catch3/Internal/StdStreams.cpp}                |     4 +-
 .../Catch3/Internal/StdStreams.hpp}                |     5 +-
 .../Catch3/Internal/StreamEndStop.hpp}             |     6 +-
 .../Catch3/Internal/StringManip.cpp}               |     6 +-
 .../Catch3/Internal/StringManip.hpp}               |     8 +-
 .../Catch3/Internal/StringRef.cpp}                 |     2 +-
 .../Catch3/Internal/StringRef.hpp}                 |     6 +-
 .../Catch3/Internal/TagAliasRegistry.cpp}          |     8 +-
 .../Catch3/Internal/TagAliasRegistry.hpp}          |     8 +-
 .../Catch3/Internal/TemplateTestRegistry.hpp}      |    14 +-
 .../Catch3/Internal/TestCaseInfoHasher.cpp}        |     4 +-
 .../Catch3/Internal/TestCaseInfoHasher.hpp}        |     5 +-
 .../Catch3/Internal/TestCaseRegistryImpl.cpp}      |    18 +-
 .../Catch3/Internal/TestCaseRegistryImpl.hpp}      |    10 +-
 .../Catch3/Internal/TestCaseTracker.cpp}           |    10 +-
 .../Catch3/Internal/TestCaseTracker.hpp}           |    14 +-
 .../Catch3/Internal/TestFailureException.cpp}      |     6 +-
 .../Catch3/Internal/TestFailureException.hpp}      |     4 +-
 .../Catch3/Internal/TestMacroImpl.hpp}             |    16 +-
 .../Catch3/Internal/TestRegistry.cpp}              |    12 +-
 .../Catch3/Internal/TestRegistry.hpp}              |    22 +-
 .../Catch3/Internal/TestSpecParser.cpp}            |     8 +-
 .../Catch3/Internal/TestSpecParser.hpp}            |     6 +-
 .../Catch3/Internal/ThreadLocal.hpp}               |     6 +-
 .../Catch3/Internal/ThreadSupport.hpp}             |     8 +-
 .../Catch3/Internal/ToString.hpp}                  |     8 +-
 .../Catch3/Internal/UncaughtExceptions.cpp}        |     6 +-
 .../Catch3/Internal/UncaughtExceptions.hpp}        |     4 +-
 .../Internal/UniformFloatingPointDistribution.hpp} |     8 +-
 .../Internal/UniformIntegerDistribution.hpp}       |     6 +-
 .../Catch3/Internal/UniqueName.hpp}                |     8 +-
 .../Catch3/Internal/UniquePtr.hpp}                 |     6 +-
 .../Catch3/Internal/Unreachable.hpp}               |     4 +-
 .../Catch3/Internal/VoidType.hpp}                  |     4 +-
 .../Catch3/Internal/WildcardPattern.cpp}           |    10 +-
 .../Catch3/Internal/WildcardPattern.hpp}           |     8 +-
 .../Catch3/Internal/WindowsHProxy.hpp}             |     6 +-
 src/Progmasoft/Catch3/Matchers/All.hpp             |    34 +
 .../Catch3/Matchers/ContainerProperties.cpp}       |     4 +-
 .../Catch3/Matchers/ContainerProperties.hpp}       |    10 +-
 .../Catch3/Matchers/Contains.hpp}                  |     8 +-
 .../Catch3/Matchers/Exception.cpp}                 |     2 +-
 .../Catch3/Matchers/Exception.hpp}                 |     6 +-
 .../Catch3/Matchers/FloatingPoint.cpp}             |    12 +-
 .../Catch3/Matchers/FloatingPoint.hpp}             |     6 +-
 .../Catch3/Matchers/Internal/Impl.cpp}             |     8 +-
 .../Catch3/Matchers/Internal/Impl.hpp}             |    14 +-
 .../Catch3/Matchers/Matchers.cpp}                  |     2 +-
 .../Catch3/Matchers/Matchers.hpp}                  |    10 +-
 .../Catch3/Matchers/Predicate.cpp}                 |     2 +-
 .../Catch3/Matchers/Predicate.hpp}                 |    10 +-
 .../Catch3/Matchers/Quantifiers.cpp}               |     2 +-
 .../Catch3/Matchers/Quantifiers.hpp}               |     8 +-
 .../Catch3/Matchers/RangeEquals.hpp}               |     8 +-
 .../Catch3/Matchers/String.cpp}                    |    10 +-
 .../Catch3/Matchers/String.hpp}                    |    10 +-
 .../Catch3/Matchers/Templated.cpp}                 |     2 +-
 .../Catch3/Matchers/Templated.hpp}                 |    14 +-
 .../Catch3/Matchers/Vector.hpp}                    |     8 +-
 .../Catch3/Message.cpp}                            |     6 +-
 .../Catch3/Message.hpp}                            |    20 +-
 src/Progmasoft/Catch3/Property.hpp                 |    95 +-
 .../Catch3/RegistryHub.cpp}                        |    26 +-
 .../Catch3/Reporters/All.hpp}                      |    10 +-
 .../Catch3/Reporters/EventListener.cpp}            |     2 +-
 .../Catch3/Reporters/EventListener.hpp}            |     6 +-
 .../Catch3/Reporters/Multi.cpp}                    |     8 +-
 .../Catch3/Reporters/Multi.hpp}                    |     6 +-
 .../Catch3/Reporters/Registrars.cpp}               |     6 +-
 .../Catch3/Reporters/Registrars.hpp}               |    16 +-
 .../Catch3/SectionInfo.hpp}                        |    12 +-
 .../Catch3/Session.cpp}                            |    10 +-
 .../Catch3/Session.hpp}                            |     8 +-
 src/Progmasoft/Catch3/Strategy/Context.hpp         |    51 +-
 .../Catch3/TagAlias.hpp}                           |     6 +-
 .../Catch3/TagAliasAutoregistrar.cpp}              |     6 +-
 .../Catch3/TagAliasAutoregistrar.hpp}              |    10 +-
 .../Catch3/TemplateTestMacros.hpp}                 |    10 +-
 .../Catch3/TestCaseInfo.cpp}                       |    10 +-
 .../Catch3/TestCaseInfo.hpp}                       |    14 +-
 .../Catch3/TestMacros.hpp}                         |    18 +-
 .../Catch3/TestRunInfo.hpp}                        |     6 +-
 .../Catch3/TestSpec.cpp}                           |    12 +-
 .../Catch3/TestSpec.hpp}                           |     8 +-
 .../Catch3/Timer.cpp}                              |     2 +-
 .../Catch3/Timer.hpp}                              |     4 +-
 .../Catch3/ToString.cpp}                           |    10 +-
 .../Catch3/ToString.hpp}                           |    16 +-
 .../Catch3/Totals.cpp}                             |     2 +-
 .../Catch3/Totals.hpp}                             |     4 +-
 .../Catch3/TranslateException.cpp}                 |     4 +-
 .../Catch3/TranslateException.hpp}                 |    10 +-
 .../Catch3/UserConfig.hpp.in}                      |     4 +-
 src/Progmasoft/Catch3/meson.build                  |   394 +
 src/Progmasoft/ProgmasoftCatch3Config.cmake.in     |     7 -
 src/Progmasoft/Runner/Catalog.cpp                  |    12 +-
 src/Progmasoft/Runner/Catalog.hpp                  |     2 +-
 src/Progmasoft/Runner/Execution.cpp                |    24 +-
 src/Progmasoft/Runner/Runner.cpp                   |    18 +-
 .../{Context.cpp => StrategyContext.cpp}           |    15 +-
 src/Progmasoft/meson.build                         |    23 +-
 src/catch2/benchmark/catch_benchmark_all.hpp       |    46 -
 src/catch2/catch_all.hpp                           |   129 -
 src/catch2/interfaces/catch_interfaces_all.hpp     |    36 -
 src/catch2/matchers/catch_matchers_all.hpp         |    36 -
 src/catch2/meson.build                             |   384 -
 tests/BUILD.bazel                                  |    12 +-
 tests/CMakeLists.txt                               |    53 +-
 tests/ExtraTests/CMakeLists.txt                    |    64 +-
 tests/ExtraTests/X01-PrefixedMacros.cpp            |     6 +-
 tests/ExtraTests/X02-DisabledMacros.cpp            |     8 +-
 .../X03-DisabledExceptions-DefaultHandler.cpp      |     8 +-
 .../X04-DisabledExceptions-CustomHandler.cpp       |     2 +-
 tests/ExtraTests/X05-DeferredStaticChecks.cpp      |     4 +-
 .../X06-MixingClearedAndUnclearedMessages.cpp      |     2 +-
 tests/ExtraTests/X07-FastCompileMacros.cpp         |     2 +-
 tests/ExtraTests/X10-FallbackStringifier.cpp       |     2 +-
 tests/ExtraTests/X11-DisableStringification.cpp    |     2 +-
 tests/ExtraTests/X12-CustomDebugBreakMacro.cpp     |    26 -
 ...StartingEventGoesBeforeAssertionIsEvaluated.cpp |     8 +-
 tests/ExtraTests/X21-PartialTestCaseEvents.cpp     |    10 +-
 .../X24-ListenerStdoutCaptureInMultireporter.cpp   |     6 +-
 .../X25-ListenerCanAskForCapturedStdout.cpp        |     6 +-
 .../X27-CapturedStdoutInTestCaseEvents.cpp         |    10 +-
 .../X28-ListenersGetEventsBeforeReporters.cpp      |     6 +-
 tests/ExtraTests/X30-BazelReporter.cpp             |     2 +-
 tests/ExtraTests/X31-DuplicatedTestCases.cpp       |     2 +-
 .../X32-DuplicatedTestCasesDifferentTags.cpp       |     2 +-
 tests/ExtraTests/X33-DuplicatedTestCaseMethods.cpp |     2 +-
 ...-DuplicatedTestCaseMethodsDifferentFixtures.cpp |     2 +-
 .../X36-ReportingCrashWithJunitReporter.cpp        |     2 +-
 .../X37-ReportingInvalidTestCaseTags.cpp           |     2 +-
 tests/ExtraTests/X40-QuickExit.cpp                 |     2 +-
 tests/ExtraTests/X90-WindowsHeaderInclusion.cpp    |     2 +-
 tests/ExtraTests/X93-AllSkipped.cpp                |     2 +-
 tests/ExtraTests/X94-ThreadSafetyTests.cpp         |     2 +-
 tests/ExtraTests/X95-InfiniteGenerators.cpp        |     4 +-
 tests/Progmasoft/BUILD.bazel                       |     9 +-
 tests/Progmasoft/Results.tests.cpp                 |     2 +-
 tests/Progmasoft/Runner.tests.cpp                  |     4 +-
 tests/Progmasoft/RunnerAnalysis.tests.cpp          |     6 +-
 tests/Progmasoft/RunnerFixture.cpp                 |     2 +-
 tests/Progmasoft/RunnerFixtureClient.hpp           |     2 +-
 tests/Progmasoft/RunnerOptions.tests.cpp           |     6 +-
 tests/Progmasoft/RunnerOutput.tests.cpp            |     4 +-
 tests/Progmasoft/RunnerPlanner.tests.cpp           |     4 +-
 tests/Progmasoft/RunnerUnits.tests.cpp             |     4 +-
 .../IntrospectiveTests/Algorithms.tests.cpp        |     4 +-
 .../IntrospectiveTests/AssertionHandler.tests.cpp  |     2 +-
 .../SelfTest/IntrospectiveTests/Details.tests.cpp  |    10 +-
 .../IntrospectiveTests/FloatingPoint.tests.cpp     |     8 +-
 .../IntrospectiveTests/GeneratorsImpl.tests.cpp    |    14 +-
 .../SelfTest/IntrospectiveTests/Integer.tests.cpp  |     4 +-
 .../IntrospectiveTests/InternalBenchmark.tests.cpp |    16 +-
 tests/SelfTest/IntrospectiveTests/Parse.tests.cpp  |     4 +-
 .../IntrospectiveTests/PartTracker.tests.cpp       |     8 +-
 .../RandomNumberGeneration.tests.cpp               |    20 +-
 tests/SelfTest/IntrospectiveTests/String.tests.cpp |     4 +-
 .../IntrospectiveTests/StringManip.tests.cpp       |     6 +-
 tests/SelfTest/IntrospectiveTests/Tag.tests.cpp    |    10 +-
 .../TestCaseInfoHasher.tests.cpp                   |     6 +-
 .../SelfTest/IntrospectiveTests/TestSpec.tests.cpp |    18 +-
 .../IntrospectiveTests/TestSpecParser.tests.cpp    |    10 +-
 .../SelfTest/IntrospectiveTests/ToString.tests.cpp |    10 +-
 tests/SelfTest/IntrospectiveTests/Traits.tests.cpp |     4 +-
 .../IntrospectiveTests/UniquePtr.tests.cpp         |     4 +-
 tests/SelfTest/TestRegistrations.cpp               |    10 +-
 tests/SelfTest/TimingTests/Sleep.tests.cpp         |     2 +-
 tests/SelfTest/UsageTests/Approx.tests.cpp         |     4 +-
 tests/SelfTest/UsageTests/BDD.tests.cpp            |     2 +-
 tests/SelfTest/UsageTests/Benchmark.tests.cpp      |     8 +-
 tests/SelfTest/UsageTests/Class.tests.cpp          |     4 +-
 tests/SelfTest/UsageTests/Compilation.tests.cpp    |     6 +-
 tests/SelfTest/UsageTests/Condition.tests.cpp      |     4 +-
 tests/SelfTest/UsageTests/Decomposition.tests.cpp  |     2 +-
 tests/SelfTest/UsageTests/EnumToString.tests.cpp   |     6 +-
 tests/SelfTest/UsageTests/Exception.tests.cpp      |     6 +-
 tests/SelfTest/UsageTests/Generators.tests.cpp     |    10 +-
 tests/SelfTest/UsageTests/Matchers.tests.cpp       |    16 +-
 .../UsageTests/MatchersConstexpr.tests.cpp         |    14 +-
 tests/SelfTest/UsageTests/MatchersRanges.tests.cpp |    16 +-
 tests/SelfTest/UsageTests/Message.tests.cpp        |     2 +-
 tests/SelfTest/UsageTests/Misc.tests.cpp           |     8 +-
 tests/SelfTest/UsageTests/Skip.tests.cpp           |     4 +-
 tests/SelfTest/UsageTests/ToStringByte.tests.cpp   |     2 +-
 tests/SelfTest/UsageTests/ToStringChrono.tests.cpp |     2 +-
 .../SelfTest/UsageTests/ToStringGeneral.tests.cpp  |     2 +-
 .../SelfTest/UsageTests/ToStringOptional.tests.cpp |     2 +-
 tests/SelfTest/UsageTests/ToStringPair.tests.cpp   |     2 +-
 tests/SelfTest/UsageTests/ToStringTuple.tests.cpp  |     2 +-
 .../SelfTest/UsageTests/ToStringVariant.tests.cpp  |     2 +-
 tests/SelfTest/UsageTests/ToStringVector.tests.cpp |     2 +-
 tests/SelfTest/UsageTests/ToStringWhich.tests.cpp  |     2 +-
 tests/SelfTest/UsageTests/Tricky.tests.cpp         |     6 +-
 tests/SelfTest/UsageTests/VariadicMacros.tests.cpp |     2 +-
 tests/SelfTest/helpers/parse_test_spec.cpp         |     4 +-
 tests/SelfTest/helpers/parse_test_spec.hpp         |     2 +-
 tests/SelfTest/helpers/range_test_helpers.hpp      |     2 +-
 tests/TestScripts/ConfigureTestsCommon.py          |     2 +-
 tests/TestScripts/DiscoverTests/CMakeLists.txt     |     6 +-
 .../DiscoverTests/TestDecomposeJsonArray.cmake     |    28 +-
 .../DiscoverTests/TestPrepareCommandFragment.cmake |    28 +-
 tests/TestScripts/DiscoverTests/register-tests.cpp |     2 +-
 tests/TestScripts/testConfigureDisable.py          |     2 +-
 tests/meson.build                                  |     9 +-
 tools/scripts/checkConvenienceHeaders.py           |   140 +-
 tools/scripts/checkDuplicateFilenames.py           |    18 +-
 tools/scripts/checkLicense.py                      |    16 +-
 tools/scripts/generateAmalgamatedFiles.py          |    37 +-
 tools/scripts/releaseCommon.py                     |     6 +-
 tools/scripts/scriptCommon.py                      |     7 +
 tools/scripts/upstreamFiles.txt                    |   246 +
 xmake.lua                                          |    53 +-
 454 files changed, 16426 insertions(+), 17400 deletions(-)

diff --git a/.github/workflows/linux-builds.yml b/.github/workflows/linux-builds.yml
index c6d39cd6..0e398d82 100644
--- a/.github/workflows/linux-builds.yml
+++ b/.github/workflows/linux-builds.yml
@@ -40,8 +40,8 @@ jobs:
               -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
               -DCMAKE_CXX_COMPILER=clang++ \
               -DCMAKE_CXX_STANDARD=${{matrix.std}} \
-              -DCATCH_BUILD_EXAMPLES=ON \
-              -DCATCH_BUILD_EXTRA_TESTS=ON
+              -DCATCH3_BUILD_EXAMPLES=ON \
+              -DCATCH3_BUILD_EXTRA_TESTS=ON
 
     - name: Build
       run: cmake --build build
@@ -76,8 +76,8 @@ jobs:
               -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
               -DCMAKE_CXX_COMPILER=clang++ \
               -DCMAKE_CXX_STANDARD=${{matrix.std}} \
-              -DCATCH_BUILD_EXAMPLES=ON \
-              -DCATCH_BUILD_EXTRA_TESTS=ON
+              -DCATCH3_BUILD_EXAMPLES=ON \
+              -DCATCH3_BUILD_EXTRA_TESTS=ON
 
     - name: Build
       run: cmake --build build
diff --git a/.github/workflows/mac-builds.yml b/.github/workflows/mac-builds.yml
index 1bf131fb..503492e7 100644
--- a/.github/workflows/mac-builds.yml
+++ b/.github/workflows/mac-builds.yml
@@ -29,8 +29,8 @@ jobs:
         cmake --preset basic-tests -GNinja \
               -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
               -DCMAKE_CXX_STANDARD=${{matrix.std}} \
-              -DCATCH_BUILD_EXAMPLES=ON \
-              -DCATCH_BUILD_EXTRA_TESTS=ON
+              -DCATCH3_BUILD_EXAMPLES=ON \
+              -DCATCH3_BUILD_EXTRA_TESTS=ON
 
     - name: Build
       run: cmake --build build
diff --git a/.github/workflows/mac-sanitizer-builds.yml b/.github/workflows/mac-sanitizer-builds.yml
index 9aad456c..21de70fb 100644
--- a/.github/workflows/mac-sanitizer-builds.yml
+++ b/.github/workflows/mac-sanitizer-builds.yml
@@ -40,7 +40,7 @@ jobs:
         cmake --preset ${{matrix.preset}} -GNinja \
               -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
               -DCMAKE_CXX_STANDARD=${{matrix.std}} \
-              -DCATCH_BUILD_EXTRA_TESTS=ON
+              -DCATCH3_BUILD_EXTRA_TESTS=ON
 
     - name: Build
       run: cmake --build build
diff --git a/.github/workflows/validate-header-guards.yml b/.github/workflows/validate-header-guards.yml
index 930bbea6..c5f8a35d 100644
--- a/.github/workflows/validate-header-guards.yml
+++ b/.github/workflows/validate-header-guards.yml
@@ -20,14 +20,14 @@ jobs:
         uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
         with:
             python-version: '3.12'
-      - name: Install checkguard
-        run: python -m pip install --requirement requirements-header-guards.txt
 
-      - name: Check that include guards are properly named
+      # Every header is guarded with #pragma once, as the Progmasoft C++ Style
+      # asks; the amalgamation script relies on it.
+      - name: Check that every header starts its guard with pragma once
         run: |
-          wrong_files=$(checkguard -r src/catch2/ -p "name | append _INCLUDED | upper")
+          wrong_files=$(grep -rL --include='*.hpp' '^#pragma once' src/Progmasoft || true)
           if [[ $wrong_files ]]; then
-            echo "Files with wrong header guard:"
+            echo "Headers without #pragma once:"
             echo $wrong_files
             exit 1
           fi
diff --git a/BUILD.bazel b/BUILD.bazel
index fce4ad82..63af935d 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -1,15 +1,10 @@
-load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
-load("@rules_cc//cc:cc_library.bzl", "cc_library")
 load("@rules_license//rules:license.bzl", "license")
 
 package(
     default_applicable_licenses = [":license"],
 )
 
-exports_files([
-    "LICENSE.txt",
-    "src/catch2/catch_session.cpp",
-])
+exports_files(["LICENSE.txt"])
 
 license(
     name = "license",
@@ -17,116 +12,20 @@ license(
     license_text = "LICENSE.txt",
 )
 
-expand_template(
-    name = "catch_user_config",
-    out = "catch2/catch_user_config.hpp",
-    substitutions = {
-        "#cmakedefine CATCH_CONFIG_ANDROID_LOGWRITE": "",
-        "#cmakedefine CATCH_CONFIG_BAZEL_SUPPORT": "#define CATCH_CONFIG_BAZEL_SUPPORT",
-        "#cmakedefine CATCH_CONFIG_COLOUR_WIN32": "",
-        "#cmakedefine CATCH_CONFIG_COUNTER": "",
-        "#cmakedefine CATCH_CONFIG_CPP11_TO_STRING": "",
-        "#cmakedefine CATCH_CONFIG_CPP17_BYTE": "",
-        "#cmakedefine CATCH_CONFIG_CPP17_OPTIONAL": "",
-        "#cmakedefine CATCH_CONFIG_CPP17_STRING_VIEW": "",
-        "#cmakedefine CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS": "",
-        "#cmakedefine CATCH_CONFIG_CPP17_VARIANT": "",
-        "#cmakedefine CATCH_CONFIG_DEPRECATION_ANNOTATIONS": "",
-        "#cmakedefine CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER": "",
-        "#cmakedefine CATCH_CONFIG_DISABLE_EXCEPTIONS": "",
-        "#cmakedefine CATCH_CONFIG_DISABLE_STRINGIFICATION": "",
-        "#cmakedefine CATCH_CONFIG_DISABLE": "",
-        "#cmakedefine CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS": "",
-        "#cmakedefine CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER": "",
-        "#cmakedefine CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER": "",
-        "#cmakedefine CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER": "",
-        "#cmakedefine CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER": "",
-        "#cmakedefine CATCH_CONFIG_EXPERIMENTAL_REDIRECT": "",
-        "#cmakedefine CATCH_CONFIG_FALLBACK_STRINGIFIER @CATCH_CONFIG_FALLBACK_STRINGIFIER@": "",
-        "#cmakedefine CATCH_CONFIG_FAST_COMPILE": "",
-        "#cmakedefine CATCH_CONFIG_GETENV": "",
-        "#cmakedefine CATCH_CONFIG_GLOBAL_NEXTAFTER": "",
-        "#cmakedefine CATCH_CONFIG_NO_ANDROID_LOGWRITE": "",
-        "#cmakedefine CATCH_CONFIG_NO_COLOUR_WIN32": "",
-        "#cmakedefine CATCH_CONFIG_NO_COUNTER": "",
-        "#cmakedefine CATCH_CONFIG_NO_CPP11_TO_STRING": "",
-        "#cmakedefine CATCH_CONFIG_NO_CPP17_BYTE": "",
-        "#cmakedefine CATCH_CONFIG_NO_CPP17_OPTIONAL": "",
-        "#cmakedefine CATCH_CONFIG_NO_CPP17_STRING_VIEW": "",
-        "#cmakedefine CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS": "",
-        "#cmakedefine CATCH_CONFIG_NO_CPP17_VARIANT": "",
-        "#cmakedefine CATCH_CONFIG_NO_DEPRECATION_ANNOTATIONS": "",
-        "#cmakedefine CATCH_CONFIG_NO_GETENV": "",
-        "#cmakedefine CATCH_CONFIG_NO_GLOBAL_NEXTAFTER": "",
-        "#cmakedefine CATCH_CONFIG_NO_POSIX_SIGNALS": "",
-        "#cmakedefine CATCH_CONFIG_NO_USE_ASYNC": "",
-        "#cmakedefine CATCH_CONFIG_NO_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT": "",
-        "#cmakedefine CATCH_CONFIG_NO_WCHAR": "",
-        "#cmakedefine CATCH_CONFIG_NO_WINDOWS_SEH": "",
-        "#cmakedefine CATCH_CONFIG_NOSTDOUT": "",
-        "#cmakedefine CATCH_CONFIG_POSIX_SIGNALS": "",
-        "#cmakedefine CATCH_CONFIG_PREFIX_ALL": "",
-        "#cmakedefine CATCH_CONFIG_PREFIX_MESSAGES": "",
-        "#cmakedefine CATCH_CONFIG_SHARED_LIBRARY": "",
-        "#cmakedefine CATCH_CONFIG_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT": "",
-        "#cmakedefine CATCH_CONFIG_USE_ASYNC": "",
-        "#cmakedefine CATCH_CONFIG_WCHAR": "",
-        "#cmakedefine CATCH_CONFIG_WINDOWS_CRTDBG": "",
-        "#cmakedefine CATCH_CONFIG_WINDOWS_SEH": "",
-        "#cmakedefine CATCH_CONFIG_USE_BUILTIN_CONSTANT_P": "",
-        "#cmakedefine CATCH_CONFIG_NO_USE_BUILTIN_CONSTANT_P": "",
-        "#cmakedefine CATCH_CONFIG_THREAD_SAFE_ASSERTIONS": "",
-        "#cmakedefine CATCH_CONFIG_NO_THREAD_SAFE_ASSERTIONS": "",
-    },
-    template = "src/catch2/catch_user_config.hpp.in",
-)
-
-# Generated header library, modifies the include prefix to account for
-# generation path so that we can include <catch2/catch_user_config.hpp>
-# correctly.
-cc_library(
-    name = "catch2_generated",
-    hdrs = ["catch2/catch_user_config.hpp"],
-    include_prefix = ".",  # to manipulate -I of dependencies
-    visibility = ["//visibility:public"],
-)
-
-# Catch2's engine: everything but the entry points. The runner is in
-# //src/Progmasoft:runner.
-cc_library(
-    name = "catch2_core",
-    srcs = glob(
-        ["src/catch2/**/*.cpp"],
-        exclude = [
-            "src/catch2/internal/catch_main.cpp",
-            "src/catch2/catch_session.cpp",
-        ],
-    ),
-    hdrs = glob(["src/catch2/**/*.hpp"]),
-    includes = ["src/"],
-    linkstatic = True,
-    visibility = ["//src/Progmasoft:__pkg__"],
-    deps = [":catch2_generated"],
-)
+# The library is defined beside its sources; these are its public names.
 
-# Static library, without main: Catch2's engine with the Catch3 runner, which
-# replaced Catch2's session, command line and reporters.
-cc_library(
-    name = "catch2",
-    linkstatic = True,
+# Static library, without main: the Catch2-compatible engine, the Catch3
+# runner, which replaced Catch2's session, command line and reporters,
+# property testing and snapshots.
+alias(
+    name = "catch3",
+    actual = "//src/Progmasoft:catch3",
     visibility = ["//visibility:public"],
-    deps = [
-        ":catch2_core",
-        "//src/Progmasoft:runner",
-    ],
 )
 
 # Static library, with main.
-cc_library(
-    name = "catch2_main",
-    srcs = ["src/catch2/internal/catch_main.cpp"],
-    includes = ["src/"],
-    linkstatic = True,
+alias(
+    name = "catch3_main",
+    actual = "//src/Progmasoft:catch3_main",
     visibility = ["//visibility:public"],
-    deps = [":catch2"],
 )
diff --git a/CMake/Catch2Config.cmake.in b/CMake/Catch3Config.cmake.in
similarity index 64%
rename from CMake/Catch2Config.cmake.in
rename to CMake/Catch3Config.cmake.in
index 9268138a..82bbe8b3 100644
--- a/CMake/Catch2Config.cmake.in
+++ b/CMake/Catch3Config.cmake.in
@@ -1,9 +1,9 @@
 @PACKAGE_INIT@
 
 # Avoid repeatedly including the targets
-if(NOT TARGET Catch2::Catch2)
+if(NOT TARGET Catch3::Catch3)
   # Provide path for scripts
   list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
 
-  include(${CMAKE_CURRENT_LIST_DIR}/Catch2Targets.cmake)
+  include(${CMAKE_CURRENT_LIST_DIR}/Catch3Targets.cmake)
 endif()
diff --git a/CMake/CatchMiscFunctions.cmake b/CMake/CatchMiscFunctions.cmake
index d1cf5fc2..c3f2bc5a 100644
--- a/CMake/CatchMiscFunctions.cmake
+++ b/CMake/CatchMiscFunctions.cmake
@@ -29,7 +29,7 @@ function(add_warnings_to_targets targets)
       # Force MSVC to consider everything as encoded in utf-8
       target_compile_options(${target} PRIVATE /utf-8)
       # Enable Werror equivalent
-      if(CATCH_ENABLE_WERROR)
+      if(CATCH3_ENABLE_WERROR)
         target_compile_options(${target} PRIVATE /WX)
       endif()
 
@@ -102,7 +102,7 @@ function(add_warnings_to_targets targets)
       add_cxx_flag_if_supported_to_targets(${warning} "${targets}")
     endforeach()
 
-    if(CATCH_ENABLE_WERROR)
+    if(CATCH3_ENABLE_WERROR)
       foreach(target ${targets})
         # Enable Werror equivalent
         target_compile_options(${target} PRIVATE -Werror)
diff --git a/CMake/catch2-with-main.pc.in b/CMake/catch2-with-main.pc.in
deleted file mode 100644
index e20a28f9..00000000
--- a/CMake/catch2-with-main.pc.in
+++ /dev/null
@@ -1,10 +0,0 @@
-prefix=@CMAKE_INSTALL_PREFIX@
-libdir=${prefix}/@lib_dir@
-pkg_version=@Catch2_VERSION@
-
-Name: Catch2 with main function
-Description: A modern, C++-native test framework for C++14 and above (links in default main)
-URL: https://github.com/Progmasoft/catch3
-Version: ${pkg_version}
-Requires: catch2 = ${pkg_version}
-Libs: -L${libdir} -l@lib_name@
diff --git a/CMake/catch3-with-main.pc.in b/CMake/catch3-with-main.pc.in
new file mode 100644
index 00000000..5a16fe60
--- /dev/null
+++ b/CMake/catch3-with-main.pc.in
@@ -0,0 +1,10 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+libdir=${prefix}/@lib_dir@
+pkg_version=@Catch3_VERSION@
+
+Name: Catch3 with main function
+Description: Catch3 with its default main
+URL: https://github.com/Progmasoft/catch3
+Version: ${pkg_version}
+Requires: catch3 = ${pkg_version}
+Libs: -L${libdir} -l@lib_name@
diff --git a/CMake/catch2.pc.in b/CMake/catch3.pc.in
similarity index 61%
rename from CMake/catch2.pc.in
rename to CMake/catch3.pc.in
index 93886089..60f81e7f 100644
--- a/CMake/catch2.pc.in
+++ b/CMake/catch3.pc.in
@@ -3,9 +3,9 @@ exec_prefix=${prefix}
 includedir=${prefix}/@include_dir@
 libdir=${prefix}/@lib_dir@
 
-Name: Catch2
-Description: Catch3, Catch2's test API with its own runner; headers need C++14 and above
+Name: Catch3
+Description: A C++ test framework with a Catch2-compatible API; headers need C++14 and above
 URL: https://github.com/Progmasoft/catch3
-Version: @Catch2_VERSION@
+Version: @Catch3_VERSION@
 Cflags: -I${includedir}
 Libs: -L${libdir} -l@lib_name@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6510f62d..2bdb177b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,35 +10,37 @@ endif()
 
 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
 
-option(CATCH_INSTALL_DOCS "Install documentation alongside library" ON)
-option(CATCH_INSTALL_EXTRAS "Install extras (CMake scripts, debugger helpers) alongside library" ON)
-option(CATCH_DEVELOPMENT_BUILD "Build tests, enable warnings, enable Werror, etc" OFF)
-option(CATCH_ENABLE_REPRODUCIBLE_BUILD "Add compiler flags for improving build reproducibility" ON)
+option(CATCH3_INSTALL_DOCS "Install documentation alongside library" ON)
+option(CATCH3_INSTALL_EXTRAS "Install extras (CMake scripts, debugger helpers) alongside library" ON)
+option(CATCH3_DEVELOPMENT_BUILD "Build tests, enable warnings, enable Werror, etc" OFF)
+option(CATCH3_ENABLE_REPRODUCIBLE_BUILD "Add compiler flags for improving build reproducibility" ON)
 
 include(CMakeDependentOption)
-cmake_dependent_option(CATCH_BUILD_TESTING "Build the SelfTest project" ON "CATCH_DEVELOPMENT_BUILD" OFF)
-cmake_dependent_option(CATCH_BUILD_EXAMPLES "Build code examples" OFF "CATCH_DEVELOPMENT_BUILD" OFF)
-cmake_dependent_option(CATCH_BUILD_EXTRA_TESTS "Build extra tests" OFF "CATCH_DEVELOPMENT_BUILD" OFF)
-cmake_dependent_option(CATCH_BUILD_FUZZERS "Build fuzzers" OFF "CATCH_DEVELOPMENT_BUILD" OFF)
-cmake_dependent_option(CATCH_BUILD_BENCHMARKS "Build the benchmarks" OFF "CATCH_DEVELOPMENT_BUILD" OFF)
-cmake_dependent_option(CATCH_ENABLE_COVERAGE "Generate coverage for codecov.io" OFF "CATCH_DEVELOPMENT_BUILD" OFF)
-cmake_dependent_option(CATCH_ENABLE_WERROR "Enables Werror during build" ON "CATCH_DEVELOPMENT_BUILD" OFF)
-cmake_dependent_option(CATCH_BUILD_SURROGATES "Enable generating and building surrogate TUs for the main headers" OFF "CATCH_DEVELOPMENT_BUILD" OFF)
-cmake_dependent_option(CATCH_ENABLE_CONFIGURE_TESTS "Enable CMake configuration tests. WARNING: VERY EXPENSIVE" OFF "CATCH_DEVELOPMENT_BUILD" OFF)
-cmake_dependent_option(CATCH_ENABLE_CMAKE_HELPER_TESTS "Enable CMake helper tests. WARNING: VERY EXPENSIVE" OFF "CATCH_DEVELOPMENT_BUILD" OFF)
-
-# Catch2's build breaks if done in-tree. You probably should not build
-# things in tree anyway, but we can allow projects that include Catch2
+cmake_dependent_option(CATCH3_BUILD_TESTING "Build the SelfTest project" ON "CATCH3_DEVELOPMENT_BUILD" OFF)
+cmake_dependent_option(CATCH3_BUILD_EXAMPLES "Build code examples" OFF "CATCH3_DEVELOPMENT_BUILD" OFF)
+cmake_dependent_option(CATCH3_BUILD_EXTRA_TESTS "Build extra tests" OFF "CATCH3_DEVELOPMENT_BUILD" OFF)
+cmake_dependent_option(CATCH3_BUILD_FUZZERS "Build fuzzers" OFF "CATCH3_DEVELOPMENT_BUILD" OFF)
+cmake_dependent_option(CATCH3_BUILD_BENCHMARKS "Build the benchmarks" OFF "CATCH3_DEVELOPMENT_BUILD" OFF)
+cmake_dependent_option(CATCH3_ENABLE_COVERAGE "Generate coverage for codecov.io" OFF "CATCH3_DEVELOPMENT_BUILD" OFF)
+cmake_dependent_option(CATCH3_ENABLE_WERROR "Enables Werror during build" ON "CATCH3_DEVELOPMENT_BUILD" OFF)
+cmake_dependent_option(CATCH3_BUILD_SURROGATES "Enable generating and building surrogate TUs for the main headers" OFF "CATCH3_DEVELOPMENT_BUILD" OFF)
+cmake_dependent_option(CATCH3_ENABLE_CONFIGURE_TESTS "Enable CMake configuration tests. WARNING: VERY EXPENSIVE" OFF "CATCH3_DEVELOPMENT_BUILD" OFF)
+cmake_dependent_option(CATCH3_ENABLE_CMAKE_HELPER_TESTS "Enable CMake helper tests. WARNING: VERY EXPENSIVE" OFF "CATCH3_DEVELOPMENT_BUILD" OFF)
+
+# The build breaks if done in-tree. You probably should not build
+# things in tree anyway, but we can allow projects that include Catch3
 # as a subproject to build in-tree as long as it is not in our tree.
 if(CMAKE_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
   message(FATAL_ERROR "Building in-source is not supported! Create a build dir and remove ${CMAKE_SOURCE_DIR}/CMakeCache.txt")
 endif()
 
-project(Catch2
-  VERSION 3.16.1 # CML version placeholder, don't delete
+# The version is Catch3's; the Catch2 engine it is built on keeps its own in
+# CATCH_VERSION_MAJOR and the other macros of Progmasoft/Catch3/EngineVersionMacros.hpp.
+project(Catch3
+  VERSION 0.3.0
   LANGUAGES CXX
   HOMEPAGE_URL "https://github.com/Progmasoft/catch3"
-  DESCRIPTION "Catch2's test API with a parallel runner, property testing and snapshots."
+  DESCRIPTION "A C++ test framework with a Catch2-compatible API, a parallel runner, property testing and snapshots."
 )
 
 # Provide path for scripts. We first add path to the scripts we don't use,
@@ -54,37 +56,37 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake")
 include(GNUInstallDirs)
 include(CMakePackageConfigHelpers)
 include(CatchConfigOptions)
-if(CATCH_DEVELOPMENT_BUILD)
+if(CATCH3_DEVELOPMENT_BUILD)
   include(CTest)
 endif()
 
 # This variable is used in some subdirectories, so we need it here, rather
 # than later in the install block
-set(CATCH_CMAKE_CONFIG_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Catch2")
+set(CATCH3_CMAKE_CONFIG_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Catch3")
 
 # We have some Windows builds that test `wmain` entry point,
 # and we need this change to be present in all binaries that
 # are built during these tests, so this is required here, before
 # the subdirectories are added.
-if(CATCH_TEST_USE_WMAIN)
+if(CATCH3_TEST_USE_WMAIN)
   set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:wmainCRTStartup")
 endif()
 
 # Basic paths
 set(CATCH_DIR ${CMAKE_CURRENT_SOURCE_DIR})
-set(SOURCES_DIR ${CATCH_DIR}/src/catch2)
+set(SOURCES_DIR ${CATCH_DIR}/src/Progmasoft/Catch3)
 set(SELF_TEST_DIR ${CATCH_DIR}/tests/SelfTest)
 
 # We need to bring-in the variables defined there to this scope
 add_subdirectory(src)
 
-if (CATCH_BUILD_BENCHMARKS)
+if (CATCH3_BUILD_BENCHMARKS)
   set(CMAKE_FOLDER "benchmarks")
   add_subdirectory(benchmarks)
 endif()
 
 # Build tests only if requested
-if(BUILD_TESTING AND CATCH_BUILD_TESTING AND NOT_SUBPROJECT)
+if(BUILD_TESTING AND CATCH3_BUILD_TESTING AND NOT_SUBPROJECT)
   find_package(Python3 REQUIRED COMPONENTS Interpreter)
   if(NOT TARGET Python3::Interpreter)
     message(FATAL_ERROR "Python not found, but required for tests")
@@ -93,22 +95,22 @@ if(BUILD_TESTING AND CATCH_BUILD_TESTING AND NOT_SUBPROJECT)
   add_subdirectory(tests)
 endif()
 
-if(CATCH_BUILD_EXAMPLES)
+if(CATCH3_BUILD_EXAMPLES)
   set(CMAKE_FOLDER "Examples")
   add_subdirectory(examples)
 endif()
 
-if(CATCH_BUILD_EXTRA_TESTS)
+if(CATCH3_BUILD_EXTRA_TESTS)
   set(CMAKE_FOLDER "tests/ExtraTests")
   add_subdirectory(tests/ExtraTests)
 endif()
 
-if(CATCH_BUILD_FUZZERS)
+if(CATCH3_BUILD_FUZZERS)
   set(CMAKE_FOLDER "fuzzing")
   add_subdirectory(fuzzing)
 endif()
 
-if(CATCH_DEVELOPMENT_BUILD)
+if(CATCH3_DEVELOPMENT_BUILD)
   set(CATCH_ALL_TARGETS ${CATCH_IMPL_TARGETS} ${CATCH_TEST_TARGETS})
   add_warnings_to_targets("${CATCH_ALL_TARGETS}")
   # After we added the noreturn hint to FAIL and SKIP, Clang became
@@ -123,28 +125,28 @@ endif()
 # see https://github.com/catchorg/Catch2/issues/1373
 if(NOT_SUBPROJECT)
   configure_package_config_file(
-    ${CMAKE_CURRENT_LIST_DIR}/CMake/Catch2Config.cmake.in
-    ${CMAKE_CURRENT_BINARY_DIR}/Catch2Config.cmake
+    ${CMAKE_CURRENT_LIST_DIR}/CMake/Catch3Config.cmake.in
+    ${CMAKE_CURRENT_BINARY_DIR}/Catch3Config.cmake
     INSTALL_DESTINATION
-      ${CATCH_CMAKE_CONFIG_DESTINATION}
+      ${CATCH3_CMAKE_CONFIG_DESTINATION}
   )
 
   write_basic_package_version_file(
-    "${CMAKE_CURRENT_BINARY_DIR}/Catch2ConfigVersion.cmake"
+    "${CMAKE_CURRENT_BINARY_DIR}/Catch3ConfigVersion.cmake"
     COMPATIBILITY
-      SameMajorVersion
+      SameMinorVersion
   )
 
   install(
     FILES
-      "${CMAKE_CURRENT_BINARY_DIR}/Catch2Config.cmake"
-      "${CMAKE_CURRENT_BINARY_DIR}/Catch2ConfigVersion.cmake"
+      "${CMAKE_CURRENT_BINARY_DIR}/Catch3Config.cmake"
+      "${CMAKE_CURRENT_BINARY_DIR}/Catch3ConfigVersion.cmake"
     DESTINATION
-      ${CATCH_CMAKE_CONFIG_DESTINATION}
+      ${CATCH3_CMAKE_CONFIG_DESTINATION}
   )
 
   # Install documentation
-  if(CATCH_INSTALL_DOCS)
+  if(CATCH3_INSTALL_DOCS)
     install(
       DIRECTORY
         docs/
@@ -154,17 +156,17 @@ if(NOT_SUBPROJECT)
     )
   endif()
 
-  if(CATCH_INSTALL_EXTRAS)
+  if(CATCH3_INSTALL_EXTRAS)
     # Install CMake scripts
     install(
       FILES
         "extras/ParseAndAddCatchTests.cmake"
-        "extras/Catch.cmake"
-        "extras/CatchAddTests.cmake"
-        "extras/CatchShardTests.cmake"
-        "extras/CatchShardTestsImpl.cmake"
+        "extras/Catch3.cmake"
+        "extras/Catch3AddTests.cmake"
+        "extras/Catch3ShardTests.cmake"
+        "extras/Catch3ShardTestsImpl.cmake"
       DESTINATION
-        ${CATCH_CMAKE_CONFIG_DESTINATION}
+        ${CATCH3_CMAKE_CONFIG_DESTINATION}
     )
 
     # Install debugger helpers
@@ -173,14 +175,14 @@ if(NOT_SUBPROJECT)
         "extras/gdbinit"
         "extras/lldbinit"
       DESTINATION
-        ${CMAKE_INSTALL_DATAROOTDIR}/Catch2
+        ${CMAKE_INSTALL_DATAROOTDIR}/Catch3
     )
   endif()
 
   ## Provide some pkg-config integration
   set(PKGCONFIG_INSTALL_DIR
     "${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig"
-    CACHE PATH "Path where catch2.pc is installed"
+    CACHE PATH "Path where catch3.pc is installed"
   )
 
   # Generate the pkg-config files
@@ -195,9 +197,9 @@ if(NOT_SUBPROJECT)
     JOIN "\n"
       install_script
        "set(install_pkgconfdir \"${PKGCONFIG_INSTALL_DIR}\")"
-       "set(impl_pc_file \"${CMAKE_CURRENT_SOURCE_DIR}/CMake/catch2.pc.in\")"
-       "set(main_pc_file \"${CMAKE_CURRENT_SOURCE_DIR}/CMake/catch2-with-main.pc.in\")"
-       "set(Catch2_VERSION ${Catch2_VERSION})"
+       "set(impl_pc_file \"${CMAKE_CURRENT_SOURCE_DIR}/CMake/catch3.pc.in\")"
+       "set(main_pc_file \"${CMAKE_CURRENT_SOURCE_DIR}/CMake/catch3-with-main.pc.in\")"
+       "set(Catch3_VERSION ${Catch3_VERSION})"
        "set(include_dir \"${CMAKE_INSTALL_INCLUDEDIR}\")"
        "set(lib_dir \"${CMAKE_INSTALL_LIBDIR}\")"
        [[
@@ -207,24 +209,24 @@ if(NOT_SUBPROJECT)
            set(DESTDIR_PREFIX "$ENV{DESTDIR}")
          endif ()
          message(STATUS "PREFIX: ${DESTDIR_PREFIX}")
-         set(lib_name "$<TARGET_FILE_BASE_NAME:Catch2>")
+         set(lib_name "$<TARGET_FILE_BASE_NAME:Catch3>")
          configure_file(
            "${impl_pc_file}"
-           "${DESTDIR_PREFIX}${CMAKE_INSTALL_PREFIX}/${install_pkgconfdir}/catch2.pc"
+           "${DESTDIR_PREFIX}${CMAKE_INSTALL_PREFIX}/${install_pkgconfdir}/catch3.pc"
            @ONLY
          )
 
-         set(lib_name "$<TARGET_FILE_BASE_NAME:Catch2WithMain>")
+         set(lib_name "$<TARGET_FILE_BASE_NAME:Catch3WithMain>")
          configure_file(
            "${main_pc_file}"
-           "${DESTDIR_PREFIX}${CMAKE_INSTALL_PREFIX}/${install_pkgconfdir}/catch2-with-main.pc"
+           "${DESTDIR_PREFIX}${CMAKE_INSTALL_PREFIX}/${install_pkgconfdir}/catch3-with-main.pc"
            @ONLY
          )
        ]]
   )
   install(CODE "${install_script}")
 
-  set(CPACK_PACKAGE_CONTACT "https://github.com/catchorg/Catch2/")
+  set(CPACK_PACKAGE_CONTACT "support@progmasoft.com")
 
   include(CPack)
 endif()
diff --git a/CMakePresets.json b/CMakePresets.json
index ffc6e240..312b7a5f 100644
--- a/CMakePresets.json
+++ b/CMakePresets.json
@@ -11,7 +11,7 @@
                 "CMAKE_CXX_EXTENSIONS": "OFF",
                 "CMAKE_CXX_STANDARD_REQUIRED": "ON",
                 "CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
-                "CATCH_DEVELOPMENT_BUILD": "ON"
+                "CATCH3_DEVELOPMENT_BUILD": "ON"
             }
         },
         {
@@ -20,10 +20,10 @@
             "displayName": "Full development build",
             "description": "Enables development build with extended set of tests (still relatively cheap to build)",
             "cacheVariables": {
-                "CATCH_BUILD_EXAMPLES": "ON",
-                "CATCH_BUILD_EXTRA_TESTS": "ON",
-                "CATCH_BUILD_SURROGATES": "ON",
-                "CATCH_BUILD_BENCHMARKS": "ON"
+                "CATCH3_BUILD_EXAMPLES": "ON",
+                "CATCH3_BUILD_EXTRA_TESTS": "ON",
+                "CATCH3_BUILD_SURROGATES": "ON",
+                "CATCH3_BUILD_BENCHMARKS": "ON"
             }
         },
         {
@@ -32,8 +32,8 @@
             "displayName": "Full development build",
             "description": "Enables development build with examples and ALL tests",
             "cacheVariables": {
-                "CATCH_ENABLE_CONFIGURE_TESTS": "ON",
-                "CATCH_ENABLE_CMAKE_HELPER_TESTS": "ON"
+                "CATCH3_ENABLE_CONFIGURE_TESTS": "ON",
+                "CATCH3_ENABLE_CMAKE_HELPER_TESTS": "ON"
             }
         }
     ]   
diff --git a/Doxyfile b/Doxyfile
index 4d248a61..0ee44da5 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -934,7 +934,7 @@ WARN_LOGFILE           = doxygen.errors
 # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
 # Note: If this tag is empty the current directory is searched.
 
-INPUT                  = src/catch2
+INPUT                  = src/Progmasoft
 
 # This tag can be used to specify the character encoding of the source files
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
diff --git a/README.md b/README.md
index 9397daa6..bacde00d 100644
--- a/README.md
+++ b/README.md
@@ -76,20 +76,20 @@ The same suite is also available through the maintained CMake, Meson, Xmake,
 and Premake project files. Their setup details and toolchain requirements are
 in the [build guide](docs/progmasoft-catch3.md#build-quick-start).
 
-For a CMake consumer of the installed libraries:
+For a CMake consumer of the installed library:
 
 ```cmake
-find_package(Catch2 3.16 CONFIG REQUIRED)
-find_package(ProgmasoftCatch3 3.16 CONFIG REQUIRED)
+find_package(Catch3 0.3 CONFIG REQUIRED)
 
-target_link_libraries(MyTests PRIVATE
-    Progmasoft::Catch3
-    Catch2::Catch2WithMain)
+target_link_libraries(MyTests PRIVATE Catch3::Catch3WithMain)
 ```
 
-The Catch2 target supplies the Catch3 runner and `main`; link
-`Progmasoft::Catch3` for the compiled Catch3 additions. The two targets retain
-their separate language baselines and licensing boundaries.
+`Catch3::Catch3` is the library: the engine, the runner, property testing and
+snapshots; `Catch3::Catch3WithMain` adds the default `main`. Tests include
+`<Progmasoft/Catch3/TestMacros.hpp>` and the other `Progmasoft/Catch3/`
+headers. The library is built as C++20; code that includes only the engine's
+headers needs C++14. Catch3 and Catch2 can be installed side by side, as
+their package, target, header and pkg-config names differ.
 
 ## Documentation
 
diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt
index b5819c79..6ca9b2cf 100644
--- a/benchmarks/CMakeLists.txt
+++ b/benchmarks/CMakeLists.txt
@@ -13,9 +13,9 @@ add_executable(EmptyExecutable
   only_include.cpp
 )
 
-target_link_libraries(AssertionsFastPath PRIVATE Catch2::Catch2WithMain)
-target_link_libraries(AssertionsSlowPath PRIVATE Catch2::Catch2WithMain)
-target_link_libraries(EmptyExecutable PRIVATE Catch2::Catch2WithMain)
+target_link_libraries(AssertionsFastPath PRIVATE Catch3::Catch3WithMain)
+target_link_libraries(AssertionsSlowPath PRIVATE Catch3::Catch3WithMain)
+target_link_libraries(EmptyExecutable PRIVATE Catch3::Catch3WithMain)
 
 list(APPEND CATCH_TEST_TARGETS AssertionsFastPath AssertionsSlowPath EmptyExecutable)
 set(CATCH_TEST_TARGETS ${CATCH_TEST_TARGETS} PARENT_SCOPE)
diff --git a/benchmarks/assertion_listener.cpp b/benchmarks/assertion_listener.cpp
index 38399568..1b7d0cad 100644
--- a/benchmarks/assertion_listener.cpp
+++ b/benchmarks/assertion_listener.cpp
@@ -6,8 +6,8 @@
 
 // SPDX-License-Identifier: BSL-1.0
 
-#include <catch2/reporters/catch_reporter_event_listener.hpp>
-#include <catch2/reporters/catch_reporter_registrars.hpp>
+#include <Progmasoft/Catch3/Reporters/EventListener.hpp>
+#include <Progmasoft/Catch3/Reporters/Registrars.hpp>
 
 /**
  * Event listener that listens to all assertions, forcing assertion slow path
diff --git a/benchmarks/discover_tests/benchmark_discovery.py b/benchmarks/discover_tests/benchmark_discovery.py
index ea0c5229..6314e32b 100644
--- a/benchmarks/discover_tests/benchmark_discovery.py
+++ b/benchmarks/discover_tests/benchmark_discovery.py
@@ -152,12 +152,12 @@ def print_table(counts, tag_modes, results):
 
 def main():
     parser = argparse.ArgumentParser(
-        description="Benchmark the CMake-side cost of catch_discover_tests."
+        description="Benchmark the CMake-side cost of catch3_discover_tests."
     )
     parser.add_argument(
         "--script",
         required=True,
-        help="Path to the CatchAddTests.cmake to benchmark.",
+        help="Path to the Catch3AddTests.cmake to benchmark.",
     )
     args = parser.parse_args()
 
diff --git a/benchmarks/discover_tests/copy_shim.cmake b/benchmarks/discover_tests/copy_shim.cmake
index d1babc1b..d4243f1b 100644
--- a/benchmarks/discover_tests/copy_shim.cmake
+++ b/benchmarks/discover_tests/copy_shim.cmake
@@ -2,7 +2,7 @@
 
 # Fake Catch2 binary used by benchmark_discovery.py.
 #
-# catch_discover_tests_impl discovers tests by running
+# catch3_discover_tests_impl discovers tests by running
 #
 #     ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ... --list-tests --reporter json --out <file>
 #
diff --git a/benchmarks/only_include.cpp b/benchmarks/only_include.cpp
index d82cbcc3..660adf17 100644
--- a/benchmarks/only_include.cpp
+++ b/benchmarks/only_include.cpp
@@ -7,10 +7,10 @@
 // SPDX-License-Identifier: BSL-1.0
 
 /**\file 
- * "empty" include of catch_test_macros.hpp
+ * "empty" include of Progmasoft/Catch3/TestMacros.hpp
  * 
- * This file does only one thing: include `catch2/catch_test_macros.hpp`,
+ * This file does only one thing: include `Progmasoft/Catch3/TestMacros.hpp`,
  * so that we can measure the compilation cost of the header.
  */
 
-#include <catch2/catch_test_macros.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
diff --git a/benchmarks/readme.md b/benchmarks/readme.md
index 52d557c5..81152aaf 100644
--- a/benchmarks/readme.md
+++ b/benchmarks/readme.md
@@ -67,7 +67,7 @@ Catch2 is also important.
 
 ### Examples
 
-**Compare overhead of including `catch_test_macros.hpp`**
+**Compare overhead of including `Progmasoft/Catch3/TestMacros.hpp`**
 ```text
 hyperfine --warmup 2 --shell none --parameter-list version old,new '/usr/bin/c++  -I/home/xarn/benches/Catch2-{version}/src/catch2/.. -I/home/xarn/benches/Catch2-{version}/build-debug/generated-includes -g -o /dev/null -c /home/xarn/benches/Catch2-{version}/benchmarks/only_include.cpp'
 ```
@@ -83,18 +83,18 @@ TODO:
 
 ## Misc. benchmarks
 
-### `catch_discover_tests`
+### `catch3_discover_tests`
 
-The first JSON-based implementation of `catch_discover_tests` turned out
+The first JSON-based implementation of `catch3_discover_tests` turned out
 to have quadratic complexity in number of tests, which meant that registering
 say 1k test cases took ~4s , and it became unusably slow with larger
 test suites.
 
 To prevent backsliding, and enable future optimizations, there is now
-a benchmarking script for `catch_discover_tests` in the `discover_tests`
+a benchmarking script for `catch3_discover_tests` in the `discover_tests`
 directory.
 
-`discover_tests/benchmark_discovery.py` runs the real `catch_discover_tests`
+`discover_tests/benchmark_discovery.py` runs the real `catch3_discover_tests`
 implementation (through CMake script-mode) on a synthesized JSON listing
 (generated from `discover_tests/listing_template.json`) through an executor
 shim (`discover_tests/copy_shim.cmake`). This means it can run even without
@@ -107,11 +107,11 @@ it down to keep only ~10 entries.
 
 #### Examples
 
-**Benchmark the current `catch_discover_tests`, with and without tags-as-labels**
+**Benchmark the current `catch3_discover_tests`, with and without tags-as-labels**
 ```text
-./benchmarks/discover_tests/benchmark_discovery.py --script ./extras/CatchAddTests.cmake
+./benchmarks/discover_tests/benchmark_discovery.py --script ./extras/Catch3AddTests.cmake
 ```
 
 Note that 8k test cases is unrealistically high, but still useful to see scaling.
 Benchmark for single test case is useful to provide estimate of the flat
-overhead from using `catch_discover_tests` at all.
+overhead from using `catch3_discover_tests` at all.
diff --git a/benchmarks/runtime_assertion_benches.cpp b/benchmarks/runtime_assertion_benches.cpp
index 1202b0cd..3145707c 100644
--- a/benchmarks/runtime_assertion_benches.cpp
+++ b/benchmarks/runtime_assertion_benches.cpp
@@ -6,8 +6,8 @@
 
 // SPDX-License-Identifier: BSL-1.0
 
-#include <catch2/catch_test_macros.hpp>
-#include <catch2/matchers/catch_matchers_templated.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
+#include <Progmasoft/Catch3/Matchers/Templated.hpp>
 
 namespace {
 
diff --git a/buildsupport/catch2_config.lua b/buildsupport/catch3_config.lua
similarity index 55%
rename from buildsupport/catch2_config.lua
rename to buildsupport/catch3_config.lua
index 5067d247..8b3feec1 100644
--- a/buildsupport/catch2_config.lua
+++ b/buildsupport/catch3_config.lua
@@ -1,7 +1,8 @@
 -- Copyright (c) 2026 Progmasoft.
 -- SPDX-License-Identifier: MPL-2.0 WITH AdditionRef-Progmasoft-Exception-1.1
 
--- Materialize Catch2's checked-in CMake template for non-CMake build tools.
+-- Materialize the checked-in CMake template of the engine's configuration
+-- header for non-CMake build tools.
 -- Keeping the template as the source of truth avoids maintaining a second
 -- copy of upstream configuration declarations under a different license.
 local M = {}
@@ -19,34 +20,25 @@ local function write_file(file_path, contents)
     file:close()
 end
 
---- Generates the default Catch2 user configuration header under output_root.
---- The generated path is output_root/catch2/catch_user_config.hpp.
+--- Generates the default user configuration header under output_root.
+--- The generated path is output_root/Progmasoft/Catch3/UserConfig.hpp.
 function M.generate(output_root, repository_root)
-    local template_path = repository_root .. "/src/catch2/catch_user_config.hpp.in"
+    local template_path = repository_root .. "/src/Progmasoft/Catch3/UserConfig.hpp.in"
     local template = read_file(template_path)
 
-    -- Neither Xmake nor Premake interprets CMake's #cmakedefine directives.
-    -- All feature toggles stay at Catch2's defaults; the two value settings
-    -- match Catch2's own CMake defaults and the root Bazel configuration.
+    -- Neither Xmake nor Premake interprets CMake's #cmakedefine directives;
+    -- every feature toggle stays at its default.
     local configured = template:gsub(
         "#cmakedefine%s+([%w_]+)%s*([^\r\n]*)",
         function(name)
-            if name == "CATCH_CONFIG_DEFAULT_REPORTER" then
-                return '#define CATCH_CONFIG_DEFAULT_REPORTER "console"'
-            elseif name == "CATCH_CONFIG_CONSOLE_WIDTH" then
-                return "#define CATCH_CONFIG_CONSOLE_WIDTH 80"
-            end
             return "/* #undef " .. name .. " */"
         end
     )
-
-    configured = configured:gsub('"@CATCH_CONFIG_DEFAULT_REPORTER@"', '"console"')
-    configured = configured:gsub("@CATCH_CONFIG_CONSOLE_WIDTH@", "80")
     configured = configured:gsub("@CATCH_CONFIG_FALLBACK_STRINGIFIER@", "")
 
-    local output_dir = output_root .. "/catch2"
+    local output_dir = output_root .. "/Progmasoft/Catch3"
     os.mkdir(output_dir)
-    write_file(output_dir .. "/catch_user_config.hpp", configured)
+    write_file(output_dir .. "/UserConfig.hpp", configured)
 end
 
 -- Xmake imports call the module's main entry point; Premake can use generate.
diff --git a/docs/Readme.md b/docs/Readme.md
index 65268c99..18bdf927 100644
--- a/docs/Readme.md
+++ b/docs/Readme.md
@@ -6,14 +6,14 @@ Catch3 keeps Catch2's API for writing tests, runs them with
 extensions. Start with the [tutorial](tutorial.md#top), then read
 [the runner](progmasoft-runner.md#top), [what Catch3 adds](progmasoft-catch3.md),
 [native property testing](progmasoft-properties.md), [the roadmap](progmasoft-roadmap.md) and
-[why the two API families remain distinct](why-catch3.md). The compatibility
-pages below retain real `catch2/` include paths, `Catch2::` CMake targets,
-and upstream version history; renaming those would make examples incorrect.
-
-The Progmasoft extension API lives under `Progmasoft/Catch3/...` and the
-`Progmasoft::Catch3` namespace. Its built library is separate from the
-upstream-compatible engine. The compatibility pages are about the bundled
-engine, not a claim that Catch3 is an official Catch2 release.
+[why Catch3 exists](why-catch3.md).
+
+Every header is under `Progmasoft/Catch3/`, and the library is
+`Catch3::Catch3` (`find_package(Catch3)`, `//:catch3` in Bazel). The pages
+marked as compatibility references describe the test-writing API Catch3
+shares with Catch2: the macros and the `Catch::` namespace. Progmasoft's own
+API lives in the `Progmasoft::Catch3` namespace. Catch3 is not an official
+Catch2 release.
 
 ## Reference
 
diff --git a/docs/assertions.md b/docs/assertions.md
index 9cc8d0ed..3ac48f30 100644
--- a/docs/assertions.md
+++ b/docs/assertions.md
@@ -1,6 +1,6 @@
 <a id="top"></a>
 
-> **Catch3 compatibility reference:** This page describes the bundled Catch2-compatible API. Names such as `Catch2`, `catch2/`, and `Catch2::Catch2WithMain` remain where they are actual compatibility interfaces. See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
+> **Catch3 compatibility reference:** This page describes the test-writing API Catch3 shares with Catch2: the macros, such as `TEST_CASE` and `REQUIRE`, and the `Catch::` namespace keep Catch2's names. Headers and build names are Catch3's own (`<Progmasoft/Catch3/TestMacros.hpp>`, `find_package(Catch3)`, `Catch3::Catch3WithMain`). See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
 
 # Assertion Macros
 
diff --git a/docs/benchmarks.md b/docs/benchmarks.md
index bc1e19da..d970d7a1 100644
--- a/docs/benchmarks.md
+++ b/docs/benchmarks.md
@@ -1,6 +1,6 @@
 <a id="top"></a>
 
-> **Catch3 compatibility reference:** This page describes the bundled Catch2-compatible API. Names such as `Catch2`, `catch2/`, and `Catch2::Catch2WithMain` remain where they are actual compatibility interfaces. See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
+> **Catch3 compatibility reference:** This page describes the test-writing API Catch3 shares with Catch2: the macros, such as `TEST_CASE` and `REQUIRE`, and the `Catch::` namespace keep Catch2's names. Headers and build names are Catch3's own (`<Progmasoft/Catch3/TestMacros.hpp>`, `find_package(Catch3)`, `Catch3::Catch3WithMain`). See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
 
 # Authoring benchmarks
 
diff --git a/docs/ci-and-misc.md b/docs/ci-and-misc.md
index 9932ccbc..a899c69f 100644
--- a/docs/ci-and-misc.md
+++ b/docs/ci-and-misc.md
@@ -1,6 +1,6 @@
 <a id="top"></a>
 
-> **Catch3 compatibility reference:** This page describes the bundled Catch2-compatible API. Names such as `Catch2`, `catch2/`, and `Catch2::Catch2WithMain` remain where they are actual compatibility interfaces. See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
+> **Catch3 compatibility reference:** This page describes the test-writing API Catch3 shares with Catch2: the macros, such as `TEST_CASE` and `REQUIRE`, and the `Catch::` namespace keep Catch2's names. Headers and build names are Catch3's own (`<Progmasoft/Catch3/TestMacros.hpp>`, `find_package(Catch3)`, `Catch3::Catch3WithMain`). See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
 
 # Tooling integration (CI, test runners and so on)
 
diff --git a/docs/cmake-integration.md b/docs/cmake-integration.md
index d3d45dfe..01c9905a 100644
--- a/docs/cmake-integration.md
+++ b/docs/cmake-integration.md
@@ -1,6 +1,6 @@
 <a id="top"></a>
 
-> **Catch3 compatibility reference:** This page describes the bundled Catch2-compatible API. Names such as `Catch2`, `catch2/`, and `Catch2::Catch2WithMain` remain where they are actual compatibility interfaces. See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
+> **Catch3 compatibility reference:** This page describes the test-writing API Catch3 shares with Catch2: the macros, such as `TEST_CASE` and `REQUIRE`, and the `Catch::` namespace keep Catch2's names. Headers and build names are Catch3's own (`<Progmasoft/Catch3/TestMacros.hpp>`, `find_package(Catch3)`, `Catch3::Catch3WithMain`). See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
 
 # CMake integration
 
@@ -9,68 +9,61 @@
 [Automatic test registration](#automatic-test-registration)<br>
 [CMake project options](#cmake-project-options)<br>
 [`CATCH_CONFIG_*` customization options in CMake](#catch_config_-customization-options-in-cmake)<br>
-[Using Progmasoft Catch3 from a checkout](#using-progmasoft-catch3-from-a-checkout)<br>
+[Using Catch3 from a checkout](#using-catch3-from-a-checkout)<br>
 [Using an installed Catch3 package](#using-an-installed-catch3-package)<br>
-[Upstream Catch2 packages](#upstream-catch2-packages)<br>
+[Catch3 next to Catch2](#catch3-next-to-catch2)<br>
 
-Catch3 builds its Progmasoft C++20 extension library alongside the
-Catch2-compatible C++14 engine. CMake exposes both API families:
+Catch3's CMake package is `Catch3`. It exports two targets:
 
-1. `Progmasoft::Catch3` contains the new compiled extensions and depends on
-   `Catch2::Catch2`.
-2. `Catch2::Catch2WithMain` supplies the existing test runner and `main`.
-3. The bundled Catch2 scripts register `TEST_CASE`s with CTest.
+1. `Catch3::Catch3`, the library: the Catch2-compatible engine, the Catch3
+   runner, property testing and snapshots. It is built as C++20; code that
+   includes only the engine's headers needs C++14.
+2. `Catch3::Catch3WithMain`, the library with the default `main`.
 
-Do not use the upstream `catchorg/Catch2` checkout or its vcpkg/Bazel package
-when you need `Progmasoft::Catch3`; those packages do not contain this fork's
-extensions.
+`Catch3.cmake` registers each `TEST_CASE` with CTest.
 
 ## CMake targets
 
-The fork exports `Progmasoft::Catch3`, `Catch2::Catch2`, and
-`Catch2::Catch2WithMain`. Link the Progmasoft target when using extension
-headers; link `Catch2::Catch2WithMain` unless you provide a custom `main`.
-For a CMake-installed fork:
+Link `Catch3::Catch3WithMain` unless you provide a custom `main`. For an
+installed Catch3:
 
 ```cmake
-find_package(Catch2 3.16 CONFIG REQUIRED)
-find_package(ProgmasoftCatch3 3.16 CONFIG REQUIRED)
+find_package(Catch3 0.3 CONFIG REQUIRED)
 add_executable(tests test.cpp)
-target_link_libraries(tests PRIVATE Progmasoft::Catch3 Catch2::Catch2WithMain)
+target_link_libraries(tests PRIVATE Catch3::Catch3WithMain)
 
 add_executable(custom-main-tests test.cpp test-main.cpp)
-target_link_libraries(custom-main-tests PRIVATE Progmasoft::Catch3)
+target_link_libraries(custom-main-tests PRIVATE Catch3::Catch3)
 ```
 
-If the fork is checked out in `external/catch3`, build it as a subdirectory:
+If Catch3 is checked out in `external/catch3`, build it as a subdirectory:
 
 ```cmake
 add_subdirectory(external/catch3)
 add_executable(tests test.cpp)
-target_link_libraries(tests PRIVATE Progmasoft::Catch3 Catch2::Catch2WithMain)
+target_link_libraries(tests PRIVATE Catch3::Catch3WithMain)
 ```
 
 
 ## Automatic test registration
 
-Catch2's repository also contains three CMake scripts that help users
-with automatically registering their `TEST_CASE`s with CTest. They
-can be found in the `extras` folder, and are
+Catch3 also contains two CMake scripts that register `TEST_CASE`s with
+CTest. They are in the `extras` folder:
 
-1) `Catch.cmake` (and its dependency `CatchAddTests.cmake`)
-2) `ParseAndAddCatchTests.cmake` (deprecated)
-3) `CatchShardTests.cmake` (and its dependency `CatchShardTestsImpl.cmake`)
+1) `Catch3.cmake` (and its dependency `Catch3AddTests.cmake`)
+2) `Catch3ShardTests.cmake` (and its dependency `Catch3ShardTestsImpl.cmake`)
 
-If Catch2 has been installed in system, both of these can be used after
-doing `find_package(Catch2 REQUIRED)`. Otherwise you need to add them
-to your CMake module path.
+If Catch3 is installed, both can be used after `find_package(Catch3 REQUIRED)`.
+Otherwise add the `extras` folder to your CMake module path. Their names, and
+the names of the functions they define, start with `Catch3`/`catch3_`, so they
+do not meet Catch2's `Catch.cmake` in a project that uses both.
 
-<a id="catch_discover_tests"></a>
-### `Catch.cmake` and `CatchAddTests.cmake`
+<a id="catch3_discover_tests"></a>
+### `Catch3.cmake` and `Catch3AddTests.cmake`
 
-`Catch.cmake` provides function `catch_discover_tests` to get tests from
+`Catch3.cmake` provides function `catch3_discover_tests` to get tests from
 a target. This function works by running the resulting executable with
-`--list-test` flag, and then parsing the output to find all existing tests.
+`--list=json`, and then reading the listing to find all existing tests.
 
 #### Usage
 ```cmake
@@ -78,32 +71,32 @@ cmake_minimum_required(VERSION 3.16)
 
 project(baz LANGUAGES CXX VERSION 0.0.1)
 
-find_package(Catch2 REQUIRED)
+find_package(Catch3 REQUIRED)
 add_executable(tests test.cpp)
-target_link_libraries(tests PRIVATE Catch2::Catch2)
+target_link_libraries(tests PRIVATE Catch3::Catch3)
 
 include(CTest)
-include(Catch)
-catch_discover_tests(tests)
+include(Catch3)
+catch3_discover_tests(tests)
 ```
 
-When using `FetchContent`, `include(Catch)` will fail unless
+When using `FetchContent`, `include(Catch3)` will fail unless
 `CMAKE_MODULE_PATH` is explicitly updated to include the extras
 directory.
 
 ```cmake
 # ... FetchContent ...
 #
-list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras)
+list(APPEND CMAKE_MODULE_PATH ${catch3_SOURCE_DIR}/extras)
 include(CTest)
-include(Catch)
-catch_discover_tests(tests)
+include(Catch3)
+catch3_discover_tests(tests)
 ```
 
 #### Customization
-`catch_discover_tests` can be given several extra arguments:
+`catch3_discover_tests` can be given several extra arguments:
 ```cmake
-catch_discover_tests(target
+catch3_discover_tests(target
                      [TEST_SPEC arg1...]
                      [EXTRA_ARGS arg1...]
                      [WORKING_DIRECTORY dir]
@@ -142,7 +135,7 @@ option is not provided, the current binary directory is used.
 
 Specifies a _prefix_ to be added to the name of each discovered test case.
 This can be useful when the same test executable is being used in multiple
-calls to `catch_discover_tests()`, with different `TEST_SPEC` or `EXTRA_ARGS`.
+calls to `catch3_discover_tests()`, with different `TEST_SPEC` or `EXTRA_ARGS`.
 
 
 * `TEST_SUFFIX suffix`
@@ -154,14 +147,14 @@ Both `TEST_PREFIX` and `TEST_SUFFIX` can be specified at the same time.
 * `PROPERTIES name1 value1...`
 
 Specifies additional properties to be set on all tests discovered by this
-invocation of `catch_discover_tests`.
+invocation of `catch3_discover_tests`.
 
 
 * `TEST_LIST var`
 
 Make the list of tests available in the variable `var`, rather than the
 default `<target>_TESTS`.  This can be useful when the same test
-executable is being used in multiple calls to `catch_discover_tests()`.
+executable is being used in multiple calls to `catch3_discover_tests()`.
 Note that this variable is only available in CTest.
 
 * `REPORTER reporter`
@@ -196,12 +189,12 @@ For a value of `POST_BUILD` (default) test discovery is performed at build time.
 For a value of `PRE_TEST` test discovery is delayed until just prior to test
 execution (useful e.g. in cross-compilation environments).
 ``DISCOVERY_MODE`` defaults to the value of the
-``CMAKE_CATCH_DISCOVER_TESTS_DISCOVERY_MODE`` variable if it is not passed when
-calling ``catch_discover_tests``. This provides a mechanism for globally
+``CMAKE_CATCH3_DISCOVER_TESTS_DISCOVERY_MODE`` variable if it is not passed when
+calling ``catch3_discover_tests``. This provides a mechanism for globally
 selecting a preferred test discovery behavior.
 
 _Note that on Apple Silicon with the Xcode generator you must use `PRE_TEST`,
-e.g. `catch_discover_tests(tests DISCOVERY_MODE PRE_TEST)`. With the default
+e.g. `catch3_discover_tests(tests DISCOVERY_MODE PRE_TEST)`. With the default
 `POST_BUILD` mode the build fails with `Result: Subprocess killed`, because
 macOS on Apple Silicon refuses to run unsigned binaries and Xcode code-signs
 the test executable only **after** the post-build script that `POST_BUILD`
@@ -220,73 +213,10 @@ Skipped tests will be marked as failed instead.
 Add the tags from tests as labels to CTest.
 
 
-### `ParseAndAddCatchTests.cmake`
+### `Catch3ShardTests.cmake`
 
-⚠ This script is [deprecated](https://github.com/catchorg/Catch2/pull/2120)
-in Catch2 2.13.4 and superseded by the above approach using `catch_discover_tests`.
-See [#2092](https://github.com/catchorg/Catch2/issues/2092) for details.
-
-`ParseAndAddCatchTests` works by parsing all implementation files
-associated with the provided target, and registering them via CTest's
-`add_test`. This approach has some limitations, such as the fact that
-commented-out tests will be registered anyway. More serious, only a
-subset of the assertion macros currently available in Catch can be
-detected by this script and tests with any macros that cannot be
-parsed are *silently ignored*.
-
-
-#### Usage
-
-```cmake
-cmake_minimum_required(VERSION 3.16)
-
-project(baz LANGUAGES CXX VERSION 0.0.1)
-
-find_package(Catch2 REQUIRED)
-add_executable(tests test.cpp)
-target_link_libraries(tests PRIVATE Catch2::Catch2)
-
-include(CTest)
-include(ParseAndAddCatchTests)
-ParseAndAddCatchTests(tests)
-```
-
-
-#### Customization
-
-`ParseAndAddCatchTests` provides some customization points:
-* `PARSE_CATCH_TESTS_VERBOSE` -- When `ON`, the script prints debug
-messages. Defaults to `OFF`.
-* `PARSE_CATCH_TESTS_NO_HIDDEN_TESTS` -- When `ON`, hidden tests (tests
-tagged with either of `[.]` or `[.foo]`) will not be registered.
-Defaults to `OFF`.
-* `PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME` -- When `ON`, adds fixture
-class name to the test name in CTest. Defaults to `ON`.
-* `PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME` -- When `ON`, adds target
-name to the test name in CTest. Defaults to `ON`.
-* `PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS` -- When `ON`, adds test
-file to `CMAKE_CONFIGURE_DEPENDS`. This means that the CMake configuration
-step will be re-ran when the test files change, letting new tests be
-automatically discovered. Defaults to `OFF`.
-
-
-Optionally, one can specify a launching command to run tests by setting the
-variable `OptionalCatchTestLauncher` before calling `ParseAndAddCatchTests`. For
-instance to run some tests using `MPI` and other sequentially, one can write
-```cmake
-set(OptionalCatchTestLauncher ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${NUMPROC})
-ParseAndAddCatchTests(mpi_foo)
-unset(OptionalCatchTestLauncher)
-ParseAndAddCatchTests(bar)
-```
-
-
-### `CatchShardTests.cmake`
-
-> `CatchShardTests.cmake` was introduced in Catch2 3.1.0.
-
-`CatchShardTests.cmake` provides a function
-`catch_add_sharded_tests(TEST_BINARY)` that splits tests from `TEST_BINARY`
+`Catch3ShardTests.cmake` provides a function
+`catch3_add_sharded_tests(TEST_BINARY)` that splits tests from `TEST_BINARY`
 into multiple shards. The tests in each shard and their order is randomized,
 and the seed changes every invocation of CTest.
 
@@ -299,14 +229,14 @@ Currently there are 3 customization points for this script:
 Example usage:
 
 ```
-include(CatchShardTests)
+include(Catch3ShardTests)
 
-catch_add_sharded_tests(foo-tests
+catch3_add_sharded_tests(foo-tests
   SHARD_COUNT 4
   TEST_SPEC "A"
 )
 
-catch_add_sharded_tests(tests
+catch3_add_sharded_tests(tests
   SHARD_COUNT 8
   TEST_SPEC "B"
 )
@@ -318,53 +248,52 @@ from `foo-tests` test binary, filtered by a test spec.
 _Note that this script is currently a proof-of-concept for reseeding
 shards per CTest run, and thus does not support (nor does it currently
 aim to support) all customization points from
-[`catch_discover_tests`](#catch_discover_tests)._
+[`catch3_discover_tests`](#catch3_discover_tests)._
 
 
 ## CMake project options
 
-Catch2's CMake project also provides some options for other projects
+Catch3's CMake project also provides some options for other projects
 that consume it. These are:
 
 * `BUILD_TESTING` -- When `ON` and the project is not used as a subproject,
-Catch2's test binary will be built. Defaults to `ON`.
-* `CATCH_INSTALL_DOCS` -- When `ON`, Catch2's documentation will be
+Catch3's test binaries will be built. Defaults to `ON`.
+* `CATCH3_INSTALL_DOCS` -- When `ON`, Catch3's documentation will be
 included in the installation. Defaults to `ON`.
-* `CATCH_INSTALL_EXTRAS` -- When `ON`, Catch2's extras folder (the CMake
+* `CATCH3_INSTALL_EXTRAS` -- When `ON`, Catch3's extras folder (the CMake
 scripts mentioned above, debugger helpers) will be included in the
 installation. Defaults to `ON`.
-* `CATCH_DEVELOPMENT_BUILD` -- When `ON`, configures the build for development
-of Catch2. This means enabling test projects, warnings and so on.
+* `CATCH3_DEVELOPMENT_BUILD` -- When `ON`, configures the build for development
+of Catch3. This means enabling test projects, warnings and so on.
 Defaults to `OFF`.
 
 
-Enabling `CATCH_DEVELOPMENT_BUILD` also enables further configuration
+Enabling `CATCH3_DEVELOPMENT_BUILD` also enables further configuration
 customization options:
 
-* `CATCH_BUILD_TESTING` -- When `ON`, Catch2's SelfTest project will be
-built. Defaults to `ON`. Note that Catch2 also obeys `BUILD_TESTING` CMake
+* `CATCH3_BUILD_TESTING` -- When `ON`, Catch3's SelfTest project will be
+built. Defaults to `ON`. Note that Catch3 also obeys `BUILD_TESTING` CMake
 variable, so _both_ of them need to be `ON` for the SelfTest to be built,
 and either of them can be set to `OFF` to disable building SelfTest.
-* `CATCH_BUILD_EXAMPLES` -- When `ON`, Catch2's usage examples will be
+* `CATCH3_BUILD_EXAMPLES` -- When `ON`, Catch3's usage examples will be
 built. Defaults to `OFF`.
-* `CATCH_BUILD_EXTRA_TESTS` -- When `ON`, Catch2's extra tests will be
+* `CATCH3_BUILD_EXTRA_TESTS` -- When `ON`, Catch3's extra tests will be
 built. Defaults to `OFF`.
-* `CATCH_BUILD_FUZZERS` -- When `ON`, Catch2 fuzzing entry points will
+* `CATCH3_BUILD_FUZZERS` -- When `ON`, Catch3's fuzzing entry points will
 be built. Defaults to `OFF`.
-* `CATCH_ENABLE_WERROR` -- When `ON`, adds `-Werror` or equivalent flag
+* `CATCH3_ENABLE_WERROR` -- When `ON`, adds `-Werror` or equivalent flag
 to the compilation. Defaults to `ON`.
-* `CATCH_BUILD_SURROGATES` -- When `ON`, each header in Catch2 will be
+* `CATCH3_BUILD_SURROGATES` -- When `ON`, each header of the engine will be
 compiled separately to ensure that they are self-sufficient.
 Defaults to `OFF`.
 
 
 ## `CATCH_CONFIG_*` customization options in CMake
 
-> CMake support for `CATCH_CONFIG_*` options was introduced in Catch2 3.0.1
 
 Due to the new separate compilation model, all the options from the
 [Compile-time configuration docs](configuration.md#top) can also be set
-through Catch2's CMake. To set them, define the option you want as `ON`,
+through Catch3's CMake. To set them, define the option you want as `ON`,
 e.g. `-DCATCH_CONFIG_NOSTDOUT=ON`.
 
 Note that setting the option to `OFF` doesn't disable it. To force disable
@@ -383,27 +312,26 @@ To summarize the configuration option behaviour with an example:
 
 
 
-## Using Progmasoft Catch3 from a checkout
+## Using Catch3 from a checkout
 
 Clone [Progmasoft/catch3](https://github.com/Progmasoft/catch3) and use
-`add_subdirectory` as shown above. This builds the compatible runner and the
-compiled Progmasoft extension library together. Keep the fork at a reviewed
-commit or release tag in production builds.
+`add_subdirectory` as shown above. Keep it at a reviewed commit or release
+tag in production builds.
 
 ## Using an installed Catch3 package
 
-Configure and install the fork with CMake, then point `CMAKE_PREFIX_PATH` at
-the install prefix when consuming it. Both `Catch2` and
-`ProgmasoftCatch3` package configurations must come from the same Catch3
-build. Do not mix a separately installed upstream Catch2 library with this
-fork's extension library.
+Configure and install Catch3 with CMake, then point `CMAKE_PREFIX_PATH` at
+the install prefix and use `find_package(Catch3)`. The package installs
+`lib/cmake/Catch3`, the headers below `include/Progmasoft`, and the
+pkg-config files `catch3.pc` and `catch3-with-main.pc`.
 
-## Upstream Catch2 packages
+## Catch3 next to Catch2
 
-The upstream Catch2 vcpkg port and Bazel Central Registry module install only
-the compatibility engine. They do not provide `Progmasoft::Catch3`,
-`Progmasoft/Catch3.hpp`, snapshots, properties, or result/XML extensions.
-Use them only for applications that intentionally need the upstream API alone.
+Catch3 is not Catch2's package: `find_package(Catch2)` finds Catch2, and
+`find_package(Catch3)` finds Catch3. Their packages, targets, CMake scripts,
+headers and pkg-config files have different names, so both can be installed
+into the same prefix and used by different test binaries of one project. One
+test binary links one of them: both define the `Catch::` namespace.
 
 ---
 
diff --git a/docs/comparing-floating-point-numbers.md b/docs/comparing-floating-point-numbers.md
index 87401e15..4992e48b 100644
--- a/docs/comparing-floating-point-numbers.md
+++ b/docs/comparing-floating-point-numbers.md
@@ -1,6 +1,6 @@
 <a id="top"></a>
 
-> **Catch3 compatibility reference:** This page describes the bundled Catch2-compatible API. Names such as `Catch2`, `catch2/`, and `Catch2::Catch2WithMain` remain where they are actual compatibility interfaces. See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
+> **Catch3 compatibility reference:** This page describes the test-writing API Catch3 shares with Catch2: the macros, such as `TEST_CASE` and `REQUIRE`, and the `Catch::` namespace keep Catch2's names. Headers and build names are Catch3's own (`<Progmasoft/Catch3/TestMacros.hpp>`, `find_package(Catch3)`, `Catch3::Catch3WithMain`). See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
 
 # Comparing floating point numbers with Catch3's compatibility API
 
@@ -19,7 +19,7 @@ this blog post](https://codingnest.com/the-little-things-comparing-floating-poin
 ## Floating point matchers
 
 ```
-#include <catch2/matchers/catch_matchers_floating_point.hpp>
+#include <Progmasoft/Catch3/Matchers/FloatingPoint.hpp>
 ```
 
 [Matchers](matchers.md#top) are the preferred way of comparing floating
@@ -108,7 +108,7 @@ REQUIRE_THAT( -0.f, WithinULP( 0.f, 0 ) );
 ## `Approx`
 
 ```
-#include <catch2/catch_approx.hpp>
+#include <Progmasoft/Catch3/Approx.hpp>
 ```
 
 **We strongly recommend against using `Approx` when writing new code.**
diff --git a/docs/configuration.md b/docs/configuration.md
index 3650c69c..e149d562 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -1,6 +1,6 @@
 <a id="top"></a>
 
-> **Catch3 compatibility reference:** This page describes the bundled Catch2-compatible API. Names such as `Catch2`, `catch2/`, and `Catch2::Catch2WithMain` remain where they are actual compatibility interfaces. See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
+> **Catch3 compatibility reference:** This page describes the test-writing API Catch3 shares with Catch2: the macros, such as `TEST_CASE` and `REQUIRE`, and the `Catch::` namespace keep Catch2's names. Headers and build names are Catch3's own (`<Progmasoft/Catch3/TestMacros.hpp>`, `find_package(Catch3)`, `Catch3::Catch3WithMain`). See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
 
 # Compile-time configuration
 
diff --git a/docs/contributing.md b/docs/contributing.md
index ba8fe371..05c1f415 100644
--- a/docs/contributing.md
+++ b/docs/contributing.md
@@ -37,7 +37,7 @@ CMake builds every test, including the extra tests that check compile-time
 configurations:
 
 ```
-cmake --preset basic-tests -GNinja -DCATCH_BUILD_EXTRA_TESTS=ON -DCATCH_BUILD_EXAMPLES=ON
+cmake --preset basic-tests -GNinja -DCATCH3_BUILD_EXTRA_TESTS=ON -DCATCH3_BUILD_EXAMPLES=ON
 cmake --build build
 ctest --test-dir build -j
 ```
diff --git a/docs/event-listeners.md b/docs/event-listeners.md
index 01d25365..2a0c2357 100644
--- a/docs/event-listeners.md
+++ b/docs/event-listeners.md
@@ -1,6 +1,6 @@
 <a id="top"></a>
 
-> **Catch3 compatibility reference:** This page describes the bundled Catch2-compatible API. Names such as `Catch2`, `catch2/`, and `Catch2::Catch2WithMain` remain where they are actual compatibility interfaces. See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
+> **Catch3 compatibility reference:** This page describes the test-writing API Catch3 shares with Catch2: the macros, such as `TEST_CASE` and `REQUIRE`, and the `Catch::` namespace keep Catch2's names. Headers and build names are Catch3's own (`<Progmasoft/Catch3/TestMacros.hpp>`, `find_package(Catch3)`, `Catch3::Catch3WithMain`). See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
 
 # Event Listeners
 
@@ -26,8 +26,8 @@ about it and instantiates it before running tests.
 
 Example event listener:
 ```cpp
-#include <catch2/reporters/catch_reporter_event_listener.hpp>
-#include <catch2/reporters/catch_reporter_registrars.hpp>
+#include <Progmasoft/Catch3/Reporters/EventListener.hpp>
+#include <Progmasoft/Catch3/Reporters/Registrars.hpp>
 
 class testRunListener : public Catch::EventListenerBase {
 public:
diff --git a/docs/faq.md b/docs/faq.md
index f14bcb91..1ae93bca 100644
--- a/docs/faq.md
+++ b/docs/faq.md
@@ -1,6 +1,6 @@
 <a id="top"></a>
 
-> **Catch3 compatibility reference:** This page describes the bundled Catch2-compatible API. Names such as `Catch2`, `catch2/`, and `Catch2::Catch2WithMain` remain where they are actual compatibility interfaces. See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
+> **Catch3 compatibility reference:** This page describes the test-writing API Catch3 shares with Catch2: the macros, such as `TEST_CASE` and `REQUIRE`, and the `Catch::` namespace keep Catch2's names. Headers and build names are Catch3's own (`<Progmasoft/Catch3/TestMacros.hpp>`, `find_package(Catch3)`, `Catch3::Catch3WithMain`). See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
 
 # Frequently Asked Questions (FAQ)
 
@@ -13,7 +13,7 @@
 [Does Catch2 support running tests in parallel?](#does-catch2-support-running-tests-in-parallel)<br>
 [Can I compile Catch2 into a dynamic library?](#can-i-compile-catch2-into-a-dynamic-library)<br>
 [What repeatability guarantees does Catch2 provide?](#what-repeatability-guarantees-does-catch2-provide)<br>
-[My build cannot find `catch2/catch_user_config.hpp`, how can I fix it?](#my-build-cannot-find-catch2catch_user_confighpp-how-can-i-fix-it)<br>
+[My build cannot find `Progmasoft/Catch3/UserConfig.hpp`, how can I fix it?](#my-build-cannot-find-catch2catch_user_confighpp-how-can-i-fix-it)<br>
 
 
 ## How do I run global setup/teardown only if tests will be run?
@@ -101,9 +101,9 @@ ones given by your platform. **Important: `<random>`'s distributions
 are not specified to be repeatable across different platforms.**
 
 
-## My build cannot find `catch2/catch_user_config.hpp`, how can I fix it?
+## My build cannot find `Progmasoft/Catch3/UserConfig.hpp`, how can I fix it?
 
-`catch2/catch_user_config.hpp` is a generated header that contains user
+`Progmasoft/Catch3/UserConfig.hpp` is a generated header that contains user
 compile time configuration. It is generated by CMake/Meson/Bazel during
 build. If you are not using either of these, your three options are to
 
diff --git a/docs/filtering-execution-path.md b/docs/filtering-execution-path.md
index 17905049..44ee2c10 100644
--- a/docs/filtering-execution-path.md
+++ b/docs/filtering-execution-path.md
@@ -1,6 +1,6 @@
 <a id="top"></a>
 
-> **Catch3 compatibility reference:** This page describes the bundled Catch2-compatible API. Names such as `Catch2`, `catch2/`, and `Catch2::Catch2WithMain` remain where they are actual compatibility interfaces. See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
+> **Catch3 compatibility reference:** This page describes the test-writing API Catch3 shares with Catch2: the macros, such as `TEST_CASE` and `REQUIRE`, and the `Catch::` namespace keep Catch2's names. Headers and build names are Catch3's own (`<Progmasoft/Catch3/TestMacros.hpp>`, `find_package(Catch3)`, `Catch3::Catch3WithMain`). See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
 
 # How to run specific section/generator
 
diff --git a/docs/generators.md b/docs/generators.md
index 682743f5..b2d55287 100644
--- a/docs/generators.md
+++ b/docs/generators.md
@@ -1,6 +1,6 @@
 <a id="top"></a>
 
-> **Catch3 compatibility reference:** This page describes the bundled Catch2-compatible API. Names such as `Catch2`, `catch2/`, and `Catch2::Catch2WithMain` remain where they are actual compatibility interfaces. See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
+> **Catch3 compatibility reference:** This page describes the test-writing API Catch3 shares with Catch2: the macros, such as `TEST_CASE` and `REQUIRE`, and the `Catch::` namespace keep Catch2's names. Headers and build names are Catch3's own (`<Progmasoft/Catch3/TestMacros.hpp>`, `find_package(Catch3)`, `Catch3::Catch3WithMain`). See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
 
 # Data Generators
 
@@ -31,9 +31,9 @@ The "Generators" `TEST_CASE` will be entered 3 times, and the value of
 times at the same scope, in which case the result will be a cartesian
 product of all elements in the generators. This means that in the snippet
 below, the test case will be run 6 (2\*3) times. The `GENERATE` macro
-is defined in the `catch_generators.hpp` header, so compiling
+is defined in the `Progmasoft/Catch3/Generators/Generators.hpp` header, so compiling
 the code examples below also requires
-`#include <catch2/generators/catch_generators.hpp>`.
+`#include <Progmasoft/Catch3/Generators/Generators.hpp>`.
 
 ```cpp
 TEST_CASE("Generators") {
@@ -115,7 +115,7 @@ a test case,
 * 2 fundamental generators
   * `SingleValueGenerator<T>` -- contains only single element
   * `FixedValuesGenerator<T>` -- contains multiple elements
-* 6 generic generators that modify other generators (defined in `catch2/generators/catch_generators_adapters.hpp`)
+* 6 generic generators that modify other generators (defined in `Progmasoft/Catch3/Generators/Adapters.hpp`)
   * `FilterGenerator<T, Predicate>` -- filters out elements from a generator
   for which the predicate returns "false"
   * `TakeGenerator<T>` -- takes first `n` elements from a generator
@@ -124,10 +124,10 @@ a test case,
   on elements from a different generator
   * `ChunkGenerator<T>` -- returns chunks (inside `std::vector`) of n elements from a generator
   * `ConcatGenerator<T>` -- returns elements from multiple generators as if they were one
-* 2 random generators (defined in `catch2/generators/catch_generators_random.hpp`)
+* 2 random generators (defined in `Progmasoft/Catch3/Generators/Random.hpp`)
   * `RandomIntegerGenerator<Integral>` -- generates random Integrals from range
   * `RandomFloatGenerator<Float>` -- generates random Floats from range
-* 2 range generators (defined in `catch2/generators/catch_generators_range.hpp`)
+* 2 range generators (defined in `Progmasoft/Catch3/Generators/Range.hpp`)
   * `RangeGenerator<T>(first, last)` -- generates all values inside a `[first, last)` arithmetic range
   * `IteratorGenerator<T>` -- copies and returns values from an iterator range
 
diff --git a/docs/limitations.md b/docs/limitations.md
index 7bb9c79b..2de96030 100644
--- a/docs/limitations.md
+++ b/docs/limitations.md
@@ -1,6 +1,6 @@
 <a id="top"></a>
 
-> **Catch3 compatibility reference:** This page describes the bundled Catch2-compatible API. Names such as `Catch2`, `catch2/`, and `Catch2::Catch2WithMain` remain where they are actual compatibility interfaces. See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
+> **Catch3 compatibility reference:** This page describes the test-writing API Catch3 shares with Catch2: the macros, such as `TEST_CASE` and `REQUIRE`, and the `Catch::` namespace keep Catch2's names. Headers and build names are Catch3's own (`<Progmasoft/Catch3/TestMacros.hpp>`, `find_package(Catch3)`, `Catch3::Catch3WithMain`). See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
 
 # Known limitations
 
@@ -94,7 +94,7 @@ error when preprocessor attempts to stringize a raw string literal
 to trigger the compilation error:
 
 ```cpp
-#include <catch2/catch_test_macros.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
 
 TEST_CASE("test") {
     CHECK(std::string(R"("\)") == "\"\\");
@@ -106,7 +106,7 @@ of the original expression by defining `CATCH_CONFIG_DISABLE_STRINGIFICATION`,
 like so:
 ```cpp
 #define CATCH_CONFIG_DISABLE_STRINGIFICATION
-#include <catch2/catch_test_macros.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
 
 TEST_CASE("test") {
     CHECK(std::string(R"("\)") == "\"\\");
@@ -126,7 +126,7 @@ with expansion:
 ### Clang/G++ -- skipping leaf sections after an exception
 Some versions of `libc++` and `libstdc++` (or their runtimes) have a bug with `std::uncaught_exception()` getting stuck returning `true` after rethrow, even if there are no active exceptions. One such case is this snippet, which skipped the sections "a" and "b", when compiled against `libcxxrt` from the master branch
 ```cpp
-#include <catch2/catch_test_macros.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
 
 TEST_CASE("a") {
     CHECK_THROWS(throw 3);
diff --git a/docs/list-of-examples.md b/docs/list-of-examples.md
index 9da305a4..855d5462 100644
--- a/docs/list-of-examples.md
+++ b/docs/list-of-examples.md
@@ -1,6 +1,6 @@
 <a id="top"></a>
 
-> **Catch3 compatibility reference:** This page describes the bundled Catch2-compatible API. Names such as `Catch2`, `catch2/`, and `Catch2::Catch2WithMain` remain where they are actual compatibility interfaces. See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
+> **Catch3 compatibility reference:** This page describes the test-writing API Catch3 shares with Catch2: the macros, such as `TEST_CASE` and `REQUIRE`, and the `Catch::` namespace keep Catch2's names. Headers and build names are Catch3's own (`<Progmasoft/Catch3/TestMacros.hpp>`, `find_package(Catch3)`, `Catch3::Catch3WithMain`). See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
 
 # List of examples
 
diff --git a/docs/logging.md b/docs/logging.md
index fb9db1d2..fce89f02 100644
--- a/docs/logging.md
+++ b/docs/logging.md
@@ -1,6 +1,6 @@
 <a id="top"></a>
 
-> **Catch3 compatibility reference:** This page describes the bundled Catch2-compatible API. Names such as `Catch2`, `catch2/`, and `Catch2::Catch2WithMain` remain where they are actual compatibility interfaces. See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
+> **Catch3 compatibility reference:** This page describes the test-writing API Catch3 shares with Catch2: the macros, such as `TEST_CASE` and `REQUIRE`, and the `Catch::` namespace keep Catch2's names. Headers and build names are Catch3's own (`<Progmasoft/Catch3/TestMacros.hpp>`, `find_package(Catch3)`, `Catch3::Catch3WithMain`). See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
 
 # Logging macros
 
diff --git a/docs/matchers.md b/docs/matchers.md
index 222ea42e..9fcc738d 100644
--- a/docs/matchers.md
+++ b/docs/matchers.md
@@ -1,6 +1,6 @@
 <a id="top"></a>
 
-> **Catch3 compatibility reference:** This page describes the bundled Catch2-compatible API. Names such as `Catch2`, `catch2/`, and `Catch2::Catch2WithMain` remain where they are actual compatibility interfaces. See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
+> **Catch3 compatibility reference:** This page describes the test-writing API Catch3 shares with Catch2: the macros, such as `TEST_CASE` and `REQUIRE`, and the `Catch::` namespace keep Catch2's names. Headers and build names are Catch3's own (`<Progmasoft/Catch3/TestMacros.hpp>`, `find_package(Catch3)`, `Catch3::Catch3WithMain`). See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
 
 # Matchers
 
@@ -51,8 +51,8 @@ _both_ ends with the suffix "as a service" _and_ contains the string
 
 
 Both of the string matchers used in the examples above live in the
-`catch_matchers_string.hpp` header, so to compile the code above also
-requires `#include <catch2/matchers/catch_matchers_string.hpp>`.
+`Progmasoft/Catch3/Matchers/String.hpp` header, so to compile the code above also
+requires `#include <Progmasoft/Catch3/Matchers/String.hpp>`.
 
 ### Combining operators and lifetimes
 
@@ -130,7 +130,7 @@ the regex `"abc"` will not match input string `"abcd"`. To match
 The second argument sets whether the matching should be case-sensitive
 or not. By default, it is case-sensitive.
 
-> `std::string` matchers live in `catch2/matchers/catch_matchers_string.hpp`
+> `std::string` matchers live in `Progmasoft/Catch3/Matchers/String.hpp`
 
 
 ### Vector matchers
@@ -158,7 +158,7 @@ An example usage:
 This assertions will pass, because the elements given to the matchers
 are a permutation of the ones in `some_vec`.
 
-> vector matchers live in `catch2/matchers/catch_matchers_vector.hpp`
+> vector matchers live in `Progmasoft/Catch3/Matchers/Vector.hpp`
 
 
 ### Floating point matchers
@@ -206,7 +206,7 @@ REQUIRE_THAT("Hello olleH",
 );
 ```
 
-> the predicate matcher lives in `catch2/matchers/catch_matchers_predicate.hpp`
+> the predicate matcher lives in `Progmasoft/Catch3/Matchers/Predicate.hpp`
 
 
 The other miscellaneous matcher utility is exception matching.
@@ -227,7 +227,7 @@ and it checks that the `expr` throws an exception, that exception is derived
 from the `ExceptionType` type, and then `Matcher::match` is called on
 the caught exception.
 
-> `REQUIRE_THROWS_MATCHES` macro lives in `catch2/matchers/catch_matchers.hpp`
+> `REQUIRE_THROWS_MATCHES` macro lives in `Progmasoft/Catch3/Matchers/Matchers.hpp`
 
 For one-off checks you can use the `Predicate` matcher above, e.g.
 
@@ -261,7 +261,7 @@ REQUIRE_THROWS_MATCHES(throwsDerivedException(),  DerivedException,  Message("De
 REQUIRE_THROWS_MATCHES(throwsDerivedException(),  DerivedException,  MessageMatches(StartsWith("DerivedException")));
 ```
 
-> the exception message matchers live in `catch2/matchers/catch_matchers_exception.hpp`
+> the exception message matchers live in `Progmasoft/Catch3/Matchers/Exception.hpp`
 
 
 ### Generic range Matchers
@@ -357,8 +357,8 @@ a matcher that decides whether the provided argument is a number
 within certain range. We will call it `IsBetweenMatcher<T>`:
 
 ```c++
-#include <catch2/catch_test_macros.hpp>
-#include <catch2/matchers/catch_matchers.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
+#include <Progmasoft/Catch3/Matchers/Matchers.hpp>
 // ...
 
 
@@ -404,7 +404,7 @@ written using the new style, combining old style matchers should
 generally compile faster. Also note that you can combine old and new
 style matchers arbitrarily.
 
-> `MatcherBase` lives in `catch2/matchers/catch_matchers.hpp`
+> `MatcherBase` lives in `Progmasoft/Catch3/Matchers/Matchers.hpp`
 
 
 ## Writing custom matchers (new style)
@@ -426,8 +426,8 @@ can compare one range-like (something that responds to `begin` and
 `end`) object to another, like in the following example:
 
 ```cpp
-#include <catch2/catch_test_macros.hpp>
-#include <catch2/matchers/catch_matchers_templated.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
+#include <Progmasoft/Catch3/Matchers/Templated.hpp>
 // ...
 
 template<typename Range>
@@ -472,7 +472,7 @@ a new style matcher, combining new style matchers is more expensive
 in terms of compilation time. Also note that you can combine old style
 and new style matchers arbitrarily.
 
-> `MatcherGenericBase` lives in `catch2/matchers/catch_matchers_templated.hpp`
+> `MatcherGenericBase` lives in `Progmasoft/Catch3/Matchers/Templated.hpp`
 
 
 ## Constexpr matchers
diff --git a/docs/migrate-v2-to-v3.md b/docs/migrate-v2-to-v3.md
index 7255fdeb..91f65ac8 100644
--- a/docs/migrate-v2-to-v3.md
+++ b/docs/migrate-v2-to-v3.md
@@ -1,6 +1,6 @@
 <a id="top"></a>
 
-> **Catch3 compatibility reference:** This page describes the bundled Catch2-compatible API. Names such as `Catch2`, `catch2/`, and `Catch2::Catch2WithMain` remain where they are actual compatibility interfaces. See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
+> **Catch3 compatibility reference:** This page describes the test-writing API Catch3 shares with Catch2: the macros, such as `TEST_CASE` and `REQUIRE`, and the `Catch::` namespace keep Catch2's names. Headers and build names are Catch3's own (`<Progmasoft/Catch3/TestMacros.hpp>`, `find_package(Catch3)`, `Catch3::Catch3WithMain`). See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
 
 # Migrating from v2 to v3
 
@@ -35,7 +35,7 @@ this option._
 To migrate to v3, there are two basic approaches to do so.
 
 1. Use `catch_amalgamated.hpp` and `catch_amalgamated.cpp`.
-2. Build Catch2 as a proper (static) library, and move to piecewise headers
+2. Build Catch3 as a proper (static) library, and move to piecewise headers
 
 Doing 1 means downloading the [amalgamated header](../extras/catch_amalgamated.hpp)
 and the [amalgamated sources](../extras/catch_amalgamated.cpp) from `extras`,
@@ -52,30 +52,31 @@ However, we recommend doing 2, and taking extra time to migrate to v3
 properly. This lets you reap the benefits of significantly improved
 compilation times in the v3 version. The basic steps to do so are:
 
-1. Change your CMakeLists.txt to link against `Catch2WithMain` target if
-you use Catch2's default main. (If you do not, keep linking against
-the `Catch2` target.). If you use pkg-config, change `pkg-config catch2` to
-`pkg-config catch2-with-main`.
+1. Change your CMakeLists.txt to `find_package(Catch3)` and link against
+the `Catch3::Catch3WithMain` target if you use the default main, or against
+`Catch3::Catch3` if you do not. If you use pkg-config, use
+`pkg-config catch3-with-main` or `pkg-config catch3`.
 2. Delete TU with `CATCH_CONFIG_RUNNER` or `CATCH_CONFIG_MAIN` defined,
 as it is no longer needed.
-3. Change `#include <catch2/catch.hpp>` to `#include <catch2/catch_all.hpp>`
+3. Change `#include <catch2/catch.hpp>` to `#include <Progmasoft/Catch3/All.hpp>`,
+or better, to the headers you need, such as `<Progmasoft/Catch3/TestMacros.hpp>`
 4. Check that everything compiles. You might have to modify namespaces,
 or perform some other changes (see the
 [Things that can break during porting](#things-that-can-break-during-porting)
 section for the most common things).
-5. Start migrating your test TUs from including `<catch2/catch_all.hpp>`
+5. Start migrating your test TUs from including `<Progmasoft/Catch3/All.hpp>`
 to piecemeal includes. You will likely want to start by including
-`<catch2/catch_test_macros.hpp>`, and then go from there. (see
+`<Progmasoft/Catch3/TestMacros.hpp>`, and then go from there. (see
 [other notes](#other-notes) for further ideas)
 
 ## Other notes
 
-* The main test include is now `<catch2/catch_test_macros.hpp>`
+* The main test include is now `<Progmasoft/Catch3/TestMacros.hpp>`
 
 * Big "subparts" like Matchers, or Generators, have their own folder, and
 also their own "big header", so if you just want to include all matchers,
-you can include `<catch2/matchers/catch_matchers_all.hpp>`,
-or `<catch2/generators/catch_generators_all.hpp>`
+you can include `<Progmasoft/Catch3/Matchers/All.hpp>`,
+or `<Progmasoft/Catch3/Generators/All.hpp>`
 
 
 ## Things that can break during porting
diff --git a/docs/other-macros.md b/docs/other-macros.md
index e0c9dea6..d044fc4c 100644
--- a/docs/other-macros.md
+++ b/docs/other-macros.md
@@ -1,6 +1,6 @@
 <a id="top"></a>
 
-> **Catch3 compatibility reference:** This page describes the bundled Catch2-compatible API. Names such as `Catch2`, `catch2/`, and `Catch2::Catch2WithMain` remain where they are actual compatibility interfaces. See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
+> **Catch3 compatibility reference:** This page describes the test-writing API Catch3 shares with Catch2: the macros, such as `TEST_CASE` and `REQUIRE`, and the `Catch::` namespace keep Catch2's names. Headers and build names are Catch3's own (`<Progmasoft/Catch3/TestMacros.hpp>`, `find_package(Catch3)`, `Catch3::Catch3WithMain`). See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
 
 # Other macros
 
diff --git a/docs/own-main.md b/docs/own-main.md
index 3acfd3c2..8b93d559 100644
--- a/docs/own-main.md
+++ b/docs/own-main.md
@@ -7,9 +7,9 @@
 [Version detection](#version-detection)<br>
 
 The easiest way to use Catch3 is its own `main`: link against
-`Catch2::Catch2WithMain` (the [CMake target](cmake-integration.md#cmake-targets))
-or the `catch2-with-main` pkg-config file. To write your own `main`, link
-against `Catch2::Catch2` and hand the command line to the
+`Catch3::Catch3WithMain` (the [CMake target](cmake-integration.md#cmake-targets))
+or the `catch3-with-main` pkg-config file. To write your own `main`, link
+against `Catch3::Catch3` and hand the command line to the
 [Catch3 runner](progmasoft-runner.md#top).
 
 The runner starts the same binary again for its worker processes, with the
@@ -22,7 +22,7 @@ variable `CATCH3_WORKER` is set, which it is only in workers.
 ## Run the tests from your own main
 
 ```cpp
-#include <catch2/catch_session.hpp>
+#include <Progmasoft/Catch3/Session.hpp>
 
 int main( int argc, char* argv[] ) {
   // your setup ...
diff --git a/docs/progmasoft-catch3.md b/docs/progmasoft-catch3.md
index 28d54fd1..7dc09822 100644
--- a/docs/progmasoft-catch3.md
+++ b/docs/progmasoft-catch3.md
@@ -1,13 +1,13 @@
 # Progmasoft Catch3 additions
 
-Progmasoft Catch3 keeps Catch2's API for writing tests and replaces Catch2's
-runner with its own. Tests, `catch2/` include paths, `Catch2::` CMake targets
-and the BSL-1.0 files of the engine stay as they are; the
-[Catch3 runner](progmasoft-runner.md#top) runs them in parallel worker
+Progmasoft Catch3 keeps Catch2's API for writing tests, its macros and the
+`Catch::` namespace, and replaces Catch2's runner with its own. The
+[Catch3 runner](progmasoft-runner.md#top) runs tests in parallel worker
 processes and adds retries, flaky-test detection, quarantine, history,
 predictive ordering, test selection, sharding, time limits and failure
-analysis. Progmasoft-owned headers use the `Progmasoft/Catch3` include tree
-and `Progmasoft::Catch3` namespace.
+analysis. Every header is in the `Progmasoft/Catch3` include tree; the files
+of the engine that come from Catch2 keep its BSL-1.0 license, and
+Progmasoft's own API is in the `Progmasoft::Catch3` namespace.
 
 ## Property testing
 
@@ -19,8 +19,8 @@ metamorphic oracles. New tests should use it. The value-shrinking
 `CheckProperty` API described here remains supported for existing tests.
 [The roadmap](progmasoft-roadmap.md#top) lists what comes next.
 
-`<Progmasoft/Catch3.hpp>` is the umbrella header. It brings in Catch2's
-`catch_all.hpp` as well as the Progmasoft extensions, so it is convenient but
+`<Progmasoft/Catch3.hpp>` is the umbrella header. It brings in the engine's
+`Progmasoft/Catch3/All.hpp` as well as the Progmasoft extensions, so it is convenient but
 increases compile time. Include individual headers when a translation unit only
 needs a narrow part of the API.
 
@@ -162,32 +162,30 @@ through `JUnitXmlWriter::Write` or `ToString`, with `<rerunFailure>` and
 and XML-forbidden control characters, and omits timestamps so identical
 results produce identical output.
 
-The results, the JUnit writer and the runner are compiled into the
-`Catch2::Catch2` library; the snapshot API is compiled into the
-`Progmasoft::Catch3` target. Generator templates and convenience macros
-remain in headers where their types or call-site expansion require it.
+The results, the JUnit writer, the runner, property testing and the
+snapshot API are compiled into the `Catch3::Catch3` library. Generator
+templates and convenience macros remain in headers where their types or
+call-site expansion require it.
 
 ## Build and integration
 
-The CMake build exposes `Progmasoft::Catch3`, a compiled C++20 library linked to
-`Catch2::Catch2`. `Catch2::Catch2`, which holds the runner, is built as C++20;
-code that includes only Catch2's headers still needs only C++14. After
-installation, consumers can use:
+The CMake package is `Catch3`, with the targets `Catch3::Catch3` and
+`Catch3::Catch3WithMain`. The library is built as C++20; code that includes
+only the engine's headers still needs only C++14. After installation,
+consumers can use:
 
 ```cmake
-find_package(Catch2 3.16 CONFIG REQUIRED)
-find_package(ProgmasoftCatch3 3.16 CONFIG REQUIRED)
-target_link_libraries(MyTests PRIVATE Progmasoft::Catch3 Catch2::Catch2WithMain)
+find_package(Catch3 0.3 CONFIG REQUIRED)
+target_link_libraries(MyTests PRIVATE Catch3::Catch3WithMain)
 ```
 
-The Bazel target is `//src/Progmasoft:catch3`; its tests are
-`//tests/Progmasoft:property_tests`. The compatibility project continues to
-build with Catch2's upstream build and test structure. Bazel is the primary
+The Bazel target is `//:catch3`; its tests are
+`//tests/Progmasoft:property_tests`. Bazel is the primary
 build path; CMake, Meson, Xmake, and Premake are also maintained as alternate
 ways to build the same engine and property tests. Their root files are
 `CMakeLists.txt`, `meson.build`, `xmake.lua`, and `premake5.lua`. Xmake and
-Premake materialize Catch2's default generated configuration header from the
-checked-in upstream template. Meson 1.1.0 or newer is required for the Clang-CL
+Premake materialize the default generated configuration header,
+`Progmasoft/Catch3/UserConfig.hpp`, from the checked-in template. Meson 1.1.0 or newer is required for the Clang-CL
 C++20 test target.
 
 For project history, compatibility intent, license split, and current feature
@@ -205,7 +203,7 @@ The alternate project builds exercise the same property suite:
 
 ```sh
 # CMake
-cmake -S . -B build/cmake -DCATCH_DEVELOPMENT_BUILD=ON -DCATCH_BUILD_TESTING=ON
+cmake -S . -B build/cmake -DCATCH3_DEVELOPMENT_BUILD=ON -DCATCH3_BUILD_TESTING=ON
 cmake --build build/cmake --target ProgmasoftSelfTest
 ctest --test-dir build/cmake -R Progmasoft --output-on-failure
 
diff --git a/docs/progmasoft-properties.md b/docs/progmasoft-properties.md
index 8042b85b..e4302383 100644
--- a/docs/progmasoft-properties.md
+++ b/docs/progmasoft-properties.md
@@ -224,7 +224,6 @@ A mismatch reports both results as notes.
 
 ## Compatibility
 
-The engine is C++20 and part of the `Progmasoft::Catch3` library target. It
-does not change Catch2's runner, reporters, command line, or the `Catch`
-namespace, and it needs no exceptions: a client built without them gets the
+The engine is C++20 and part of the `Catch3::Catch3` library. It does not
+change the `Catch` namespace, and it needs no exceptions: a client built without them gets the
 same results, except that an exception thrown by a body cannot be caught.
diff --git a/docs/progmasoft-roadmap.md b/docs/progmasoft-roadmap.md
index 20b88dd4..f376e9a0 100644
--- a/docs/progmasoft-roadmap.md
+++ b/docs/progmasoft-roadmap.md
@@ -6,11 +6,12 @@ unit testing, property testing, mocking, coverage, mutation testing, test
 generation and test selection, driven by a runner of its own. Two rules hold
 for every step:
 
-- **Catch2's API stays compatible.** The `Catch` namespace, the `catch2/`
-  headers, the macros, matchers, generators and listeners keep working
-  unchanged. The runner is Catch3's own: Catch2's session, command line and
-  reporters were replaced. New capabilities live under `Progmasoft::Catch3`
-  and `Progmasoft/Catch3/`.
+- **Catch2's test-writing API stays compatible.** The macros and the `Catch`
+  namespace, with its matchers, generators and listeners, keep working
+  unchanged. Everything else is Catch3's own: the runner replaced Catch2's
+  session, command line and reporters, the headers are under
+  `Progmasoft/Catch3/` and the build names are `Catch3`. New capabilities
+  live in the `Progmasoft::Catch3` namespace.
 - **Nothing is claimed before it is tested.** A feature is listed as done when
   its tests run in CI on Windows, Linux and macOS.
 
diff --git a/docs/progmasoft-runner.md b/docs/progmasoft-runner.md
index 1c5d0efe..baf5521a 100644
--- a/docs/progmasoft-runner.md
+++ b/docs/progmasoft-runner.md
@@ -262,7 +262,7 @@ version.
   object per test with `id`, `name`, `className`, `file`, `line`, `tags`,
   `hidden`, and what the runner tags say: `serial`, `isolated`,
   `quarantined`, `resources`, `dependsOn`, `timeoutSeconds` and `retries`.
-  CMake's `catch_discover_tests` reads it.
+  CMake's `catch3_discover_tests` reads it.
 * **Run report**, `--json`: `"format": "catch3-run"`, version 1.
 * **Analytics**, `--analytics=json`: `"format": "catch3-analytics"`,
   version 1.
@@ -281,7 +281,7 @@ for a JUnit report, `TESTBRIDGE_TEST_ONLY` for `--test_filter`,
 sharding, `TEST_RANDOM_SEED` for the seed, `TEST_PREMATURE_EXIT_FILE` for
 the exit guard and `TEST_UNDECLARED_OUTPUTS_DIR` for a JSON report.
 
-[`catch_discover_tests`](cmake-integration.md#automatic-test-registration)
+[`catch3_discover_tests`](cmake-integration.md#automatic-test-registration)
 registers each test with CTest through the discovery format. The runner
 also parallelises a whole binary under one CTest test, which usually starts
 fewer processes.
diff --git a/docs/release-notes.md b/docs/release-notes.md
index 9f5a1b31..3dd4ca66 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -36,10 +36,25 @@ line and reporters with [a runner of its own](progmasoft-runner.md#top):
 
 ### Breaking changes
 
+* Catch3 has its own build and header names, so that it is never mistaken
+  for Catch2 and both can be used in one project:
+  * CMake: `find_package(Catch3)` with `Catch3::Catch3` and
+    `Catch3::Catch3WithMain`, options `CATCH3_*`, and the scripts
+    `Catch3.cmake` (`catch3_discover_tests`) and `Catch3ShardTests.cmake`
+    (`catch3_add_sharded_tests`). The `Progmasoft::Catch3` target is gone:
+    its code is part of `Catch3::Catch3`.
+  * Bazel `//:catch3` and `//:catch3_main`, Meson `catch3` and
+    `catch3-with-main`, pkg-config `catch3.pc` and `catch3-with-main.pc`.
+  * Headers moved from `catch2/` to `Progmasoft/Catch3/` with Progmasoft
+    names: `<catch2/catch_test_macros.hpp>` is
+    `<Progmasoft/Catch3/TestMacros.hpp>`, `<catch2/matchers/catch_matchers_string.hpp>`
+    is `<Progmasoft/Catch3/Matchers/String.hpp>`, and so on. Test bodies do
+    not change: the macros and the `Catch::` namespace keep their names.
+  * `ParseAndAddCatchTests.cmake`, deprecated upstream, was removed.
 * Catch2's command line, reporters, `CATCH_REGISTER_REPORTER` and listing
   were removed; see [the command line](command-line.md#top) and
   [reports](reporters.md#top). Listeners keep working.
-* The Catch2 library is compiled as C++20; code that includes only its
+* The library is compiled as C++20; code that includes only the engine's
   headers still needs C++14.
 * The results model in `Progmasoft/Catch3/Results.hpp` was rewritten around
   tests and attempts.
diff --git a/docs/reporter-events.md b/docs/reporter-events.md
index 45ecaaa0..802c4473 100644
--- a/docs/reporter-events.md
+++ b/docs/reporter-events.md
@@ -1,6 +1,6 @@
 <a id="top"></a>
 
-> **Catch3 compatibility reference:** This page describes the bundled Catch2-compatible API. Names such as `Catch2`, `catch2/`, and `Catch2::Catch2WithMain` remain where they are actual compatibility interfaces. See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
+> **Catch3 compatibility reference:** This page describes the test-writing API Catch3 shares with Catch2: the macros, such as `TEST_CASE` and `REQUIRE`, and the `Catch::` namespace keep Catch2's names. Headers and build names are Catch3's own (`<Progmasoft/Catch3/TestMacros.hpp>`, `find_package(Catch3)`, `Catch3::Catch3WithMain`). See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
 
 # Reporter events
 
diff --git a/docs/skipping-passing-failing.md b/docs/skipping-passing-failing.md
index 013199d5..e4bb58c5 100644
--- a/docs/skipping-passing-failing.md
+++ b/docs/skipping-passing-failing.md
@@ -1,6 +1,6 @@
 <a id="top"></a>
 
-> **Catch3 compatibility reference:** This page describes the bundled Catch2-compatible API. Names such as `Catch2`, `catch2/`, and `Catch2::Catch2WithMain` remain where they are actual compatibility interfaces. See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
+> **Catch3 compatibility reference:** This page describes the test-writing API Catch3 shares with Catch2: the macros, such as `TEST_CASE` and `REQUIRE`, and the `Catch::` namespace keep Catch2's names. Headers and build names are Catch3's own (`<Progmasoft/Catch3/TestMacros.hpp>`, `find_package(Catch3)`, `Catch3::Catch3WithMain`). See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
 
 # Explicitly skipping, passing, and failing tests at runtime
 
diff --git a/docs/test-cases-and-sections.md b/docs/test-cases-and-sections.md
index 8be71361..a87c822e 100644
--- a/docs/test-cases-and-sections.md
+++ b/docs/test-cases-and-sections.md
@@ -1,6 +1,6 @@
 <a id="top"></a>
 
-> **Catch3 compatibility reference:** This page describes the bundled Catch2-compatible API. Names such as `Catch2`, `catch2/`, and `Catch2::Catch2WithMain` remain where they are actual compatibility interfaces. See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
+> **Catch3 compatibility reference:** This page describes the test-writing API Catch3 shares with Catch2: the macros, such as `TEST_CASE` and `REQUIRE`, and the `Catch::` namespace keep Catch2's names. Headers and build names are Catch3's own (`<Progmasoft/Catch3/TestMacros.hpp>`, `find_package(Catch3)`, `Catch3::Catch3WithMain`). See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
 
 # Test cases and sections
 
@@ -175,9 +175,9 @@ Other than the additional prefixes and the formatting in the console reporter th
 In addition to `TEST_CASE`s, Catch2 also supports test cases parametrised
 by types, in the form of `TEMPLATE_TEST_CASE`,
 `TEMPLATE_PRODUCT_TEST_CASE` and `TEMPLATE_LIST_TEST_CASE`. These macros
-are defined in the `catch_template_test_macros.hpp` header, so compiling
+are defined in the `Progmasoft/Catch3/TemplateTestMacros.hpp` header, so compiling
 the code examples below also requires
-`#include <catch2/catch_template_test_macros.hpp>`.
+`#include <Progmasoft/Catch3/TemplateTestMacros.hpp>`.
 
 
 * **TEMPLATE_TEST_CASE(** _test name_ , _tags_,  _type1_, _type2_, ..., _typen_ **)**
@@ -301,8 +301,8 @@ In addition to [type parametrised test cases](#type-parametrised-test-cases) Cat
 signature base parametrised test cases, in form of `TEMPLATE_TEST_CASE_SIG` and `TEMPLATE_PRODUCT_TEST_CASE_SIG`.
 These test cases have similar syntax like [type parametrised test cases](#type-parametrised-test-cases), with one
 additional positional argument which specifies the signature. These macros are defined in the
-`catch_template_test_macros.hpp` header, so compiling the code examples below also requires
-`#include <catch2/catch_template_test_macros.hpp>`.
+`Progmasoft/Catch3/TemplateTestMacros.hpp` header, so compiling the code examples below also requires
+`#include <Progmasoft/Catch3/TemplateTestMacros.hpp>`.
 
 ### Signature
 Signature has some strict rules for these tests cases to work properly:
diff --git a/docs/test-fixtures.md b/docs/test-fixtures.md
index 542398c8..a6dc7f52 100644
--- a/docs/test-fixtures.md
+++ b/docs/test-fixtures.md
@@ -1,6 +1,6 @@
 <a id="top"></a>
 
-> **Catch3 compatibility reference:** This page describes the bundled Catch2-compatible API. Names such as `Catch2`, `catch2/`, and `Catch2::Catch2WithMain` remain where they are actual compatibility interfaces. See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
+> **Catch3 compatibility reference:** This page describes the test-writing API Catch3 shares with Catch2: the macros, such as `TEST_CASE` and `REQUIRE`, and the `Catch::` namespace keep Catch2's names. Headers and build names are Catch3's own (`<Progmasoft/Catch3/TestMacros.hpp>`, `find_package(Catch3)`, `Catch3::Catch3WithMain`). See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
 
 # Test fixtures
 
diff --git a/docs/thread-safety.md b/docs/thread-safety.md
index 00a339ea..18d92981 100644
--- a/docs/thread-safety.md
+++ b/docs/thread-safety.md
@@ -1,6 +1,6 @@
 <a id="top"></a>
 
-> **Catch3 compatibility reference:** This page describes the bundled Catch2-compatible API. Names such as `Catch2`, `catch2/`, and `Catch2::Catch2WithMain` remain where they are actual compatibility interfaces. See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
+> **Catch3 compatibility reference:** This page describes the test-writing API Catch3 shares with Catch2: the macros, such as `TEST_CASE` and `REQUIRE`, and the `Catch::` namespace keep Catch2's names. Headers and build names are Catch3's own (`<Progmasoft/Catch3/TestMacros.hpp>`, `find_package(Catch3)`, `Catch3::Catch3WithMain`). See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
 
 # Thread safety of the Catch3 compatibility engine
 
diff --git a/docs/tostring.md b/docs/tostring.md
index adbac461..b40295fc 100644
--- a/docs/tostring.md
+++ b/docs/tostring.md
@@ -1,6 +1,6 @@
 <a id="top"></a>
 
-> **Catch3 compatibility reference:** This page describes the bundled Catch2-compatible API. Names such as `Catch2`, `catch2/`, and `Catch2::Catch2WithMain` remain where they are actual compatibility interfaces. See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
+> **Catch3 compatibility reference:** This page describes the test-writing API Catch3 shares with Catch2: the macros, such as `TEST_CASE` and `REQUIRE`, and the `Catch::` namespace keep Catch2's names. Headers and build names are Catch3's own (`<Progmasoft/Catch3/TestMacros.hpp>`, `find_package(Catch3)`, `Catch3::Catch3WithMain`). See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
 
 # String conversions
 
diff --git a/docs/tutorial.md b/docs/tutorial.md
index fb316c10..cf895705 100644
--- a/docs/tutorial.md
+++ b/docs/tutorial.md
@@ -1,6 +1,6 @@
 <a id="top"></a>
 
-> **Catch3 compatibility reference:** This page describes the bundled Catch2-compatible API. Names such as `Catch2`, `catch2/`, and `Catch2::Catch2WithMain` remain where they are actual compatibility interfaces. See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
+> **Catch3 compatibility reference:** This page describes the test-writing API Catch3 shares with Catch2: the macros, such as `TEST_CASE` and `REQUIRE`, and the `Catch::` namespace keep Catch2's names. Headers and build names are Catch3's own (`<Progmasoft/Catch3/TestMacros.hpp>`, `find_package(Catch3)`, `Catch3::Catch3WithMain`). See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
 
 # Tutorial
 
@@ -17,8 +17,9 @@
 
 Clone or consume [Progmasoft/catch3](https://github.com/Progmasoft/catch3),
 then use its [CMake integration](cmake-integration.md#top) or another supported
-build system. The examples in this tutorial exercise the bundled
-Catch2-compatible API, so their actual include paths remain `catch2/...`.
+build system. The examples in this tutorial use the Catch2-compatible API:
+its macros and the `Catch::` namespace, from headers such as
+`<Progmasoft/Catch3/TestMacros.hpp>`.
 For property tests, snapshots, and the result/XML writer, continue with the
 [Progmasoft extensions](progmasoft-catch3.md).
 
@@ -34,7 +35,7 @@ unsigned int Factorial( unsigned int number ) {
 ```
 
 ```c++
-#include <catch2/catch_test_macros.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
 
 unsigned int Factorial( unsigned int number ) {
     return number <= 1 ? number : Factorial(number-1)*number;
diff --git a/docs/usage-tips.md b/docs/usage-tips.md
index 18e9cd11..b11aee5f 100644
--- a/docs/usage-tips.md
+++ b/docs/usage-tips.md
@@ -1,6 +1,6 @@
 <a id="top"></a>
 
-> **Catch3 compatibility reference:** This page describes the bundled Catch2-compatible API. Names such as `Catch2`, `catch2/`, and `Catch2::Catch2WithMain` remain where they are actual compatibility interfaces. See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
+> **Catch3 compatibility reference:** This page describes the test-writing API Catch3 shares with Catch2: the macros, such as `TEST_CASE` and `REQUIRE`, and the `Catch::` namespace keep Catch2's names. Headers and build names are Catch3's own (`<Progmasoft/Catch3/TestMacros.hpp>`, `find_package(Catch3)`, `Catch3::Catch3WithMain`). See [Catch3 additions](progmasoft-catch3.md) for Progmasoft APIs.
 
 # Best practices for the Catch3 compatibility API
 
@@ -44,9 +44,9 @@ cover every test exactly once whatever the order or seed of each run. With
 `--shard-durations=FILE`, a JSON report or history of an earlier run, the
 shards are balanced by duration instead.
 
-If you use CMake and CTest, [`catch_discover_tests`](cmake-integration.md#automatic-test-registration)
+If you use CMake and CTest, [`catch3_discover_tests`](cmake-integration.md#automatic-test-registration)
 registers each `TEST_CASE` as a CTest test, and
-[`CatchShardTests.cmake`](cmake-integration.md#catchshardtestscmake)
+[`Catch3ShardTests.cmake`](cmake-integration.md#catchshardtestscmake)
 registers shards.
 
 
diff --git a/docs/why-catch3.md b/docs/why-catch3.md
index 69b88a5e..4d29c4ff 100644
--- a/docs/why-catch3.md
+++ b/docs/why-catch3.md
@@ -16,11 +16,11 @@ Catch2's runner with [its own](progmasoft-runner.md#top).
 | Area | Catch2 compatibility engine | Progmasoft Catch3 additions |
 | --- | --- | --- |
 | Test execution | Catch2's test registration, `RunContext` and listeners | The Catch3 runner: parallel worker processes, retries, flaky-test detection, quarantine, history, selection, sharding and its own command line and reports; `CATCH3_CHECK_FOR_ALL` and `CATCH3_CHECK_PROPERTY` report property outcomes through Catch2's assertion path |
-| Public include path | Existing `catch2/...` headers | `Progmasoft/Catch3.hpp` and focused `Progmasoft/Catch3/...` headers |
-| C++ baseline | Code that includes Catch2's headers needs C++14; the library, which holds the runner, is built as C++20 | The added property API requires C++20 |
+| Public include path | The engine's headers moved to `Progmasoft/Catch3/...` with Progmasoft names, such as `TestMacros.hpp` | `Progmasoft/Catch3.hpp` and the other `Progmasoft/Catch3/...` headers |
+| C++ baseline | Code that includes the engine's headers needs C++14; the library, which holds the runner, is built as C++20 | The added property API requires C++20 |
 | Randomness | Catch2's existing behavior is unchanged | A specified SplitMix64 sequence provides deterministic trial seeds and unbiased bounded integer sampling |
 | Generated values | No change to existing Catch2 generators | Strategies for numbers, text, collections and structures with `Map`, `Filter` and `FlatMap`; shrinking of recorded choices, so every combination shrinks; replay tokens and an example database; state machines, `Classify`/`Cover` statistics, targeted search, and differential and metamorphic oracles |
-| Build identity | Existing `Catch2` target and APIs remain available | Separate `Progmasoft::Catch3` CMake target and `//src/Progmasoft:catch3` Bazel target |
+| Build identity | One library: the `Catch3` CMake package with `Catch3::Catch3` and `Catch3::Catch3WithMain`, `//:catch3` in Bazel, `catch3` in Meson and pkg-config | The same library |
 | Source terms | Catch2-originated source retains its upstream BSL-1.0 terms | Progmasoft-authored additions state their own SPDX license in each file |
 
 Properties take any number of generated values. Shrinking is deterministic and
@@ -31,19 +31,18 @@ and test generation.
 
 ## Compatibility policy
 
-Catch2's `Catch` namespace, established headers, macros, matchers,
-generators, listeners and coding style remain the compatibility surface; the
-runner, its command line and its reports are Catch3's own and are not
-compatible with Catch2's. Progmasoft
-features should be added under `Progmasoft::Catch3` and must not require users
-to rename existing Catch2 tests. The first compatibility goal is source-level
+Catch2's macros and its `Catch` namespace, with matchers, generators and
+listeners, remain the compatibility surface. The runner, its command line,
+its reports, the header paths and the build names are Catch3's own; moving
+tests from Catch2 means changing their includes and their build files, not
+their bodies. Progmasoft features are added in `Progmasoft::Catch3` and must
+not require users to rewrite existing Catch2 test bodies. The first compatibility goal is source-level
 continuity with the included Catch2 3.16.1 base; this is not a promise that every
 future Catch2 upstream change will be adopted unchanged or that all downstream
 projects have already been validated.
 
-The split also applies to implementation and packaging: Catch2 remains the
-engine dependency, while Progmasoft's compiled C++20 library is a separate
-target. Template-based generators and call-site assertion macros remain in
+The engine, the runner and the Progmasoft additions are one compiled C++20
+library. Template-based generators and call-site assertion macros remain in
 headers; snapshot I/O, result aggregation, and XML serialization are compiled
 implementations.
 Keep tests for the two areas independently identifiable so additions do not
@@ -62,9 +61,9 @@ files can be submitted unchanged.
 
 Bazel is the primary build and validation path. CMake, Meson, Xmake, and Premake
 are supported alternate project-generation/build paths over the same local sources.
-The CMake project preserves the upstream `Catch2` targets and adds
-`Progmasoft::Catch3`; the other build descriptions compile the same Catch2
-engine and the Progmasoft property-test executable. See the repository build
+The CMake project exports `Catch3::Catch3` and `Catch3::Catch3WithMain`; the
+other build descriptions compile the same library and the Progmasoft
+property-test executable. See the repository build
 instructions and each build file for tool-specific commands.
 
 Registry publication is a separate release step. It requires a versioned
diff --git a/examples/010-TestCase.cpp b/examples/010-TestCase.cpp
index 9e5cd8cd..5eb982c8 100644
--- a/examples/010-TestCase.cpp
+++ b/examples/010-TestCase.cpp
@@ -8,7 +8,7 @@
 
 // 010-TestCase.cpp
 // And write tests in the same file:
-#include <catch2/catch_test_macros.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
 
 static int Factorial( int number ) {
    return number <= 1 ? number : Factorial( number - 1 ) * number;  // fail
diff --git a/examples/020-TestCase-1.cpp b/examples/020-TestCase-1.cpp
index a9d87dbc..86de07a9 100644
--- a/examples/020-TestCase-1.cpp
+++ b/examples/020-TestCase-1.cpp
@@ -8,7 +8,7 @@
 
 // 020-TestCase-1.cpp
 
-#include <catch2/catch_test_macros.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
 
 TEST_CASE( "1: All test cases reside in other .cpp files (empty)", "[multi-file:1]" ) {
 }
diff --git a/examples/020-TestCase-2.cpp b/examples/020-TestCase-2.cpp
index 72dd0ffb..908db1c0 100644
--- a/examples/020-TestCase-2.cpp
+++ b/examples/020-TestCase-2.cpp
@@ -10,7 +10,7 @@
 
 // main() provided by Catch in file 020-TestCase-1.cpp.
 
-#include <catch2/catch_test_macros.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
 
 static int Factorial( int number ) {
    return number <= 1 ? number : Factorial( number - 1 ) * number;  // fail
diff --git a/examples/030-Asn-Require-Check.cpp b/examples/030-Asn-Require-Check.cpp
index 62cd3cfc..ed6ad752 100644
--- a/examples/030-Asn-Require-Check.cpp
+++ b/examples/030-Asn-Require-Check.cpp
@@ -18,7 +18,7 @@
 
 // main() provided by linkage to Catch2WithMain
 
-#include <catch2/catch_test_macros.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
 
 static std::string one() {
     return "1";
diff --git a/examples/100-Fix-Section.cpp b/examples/100-Fix-Section.cpp
index 7c8d8aa8..d1e4cdbc 100644
--- a/examples/100-Fix-Section.cpp
+++ b/examples/100-Fix-Section.cpp
@@ -14,7 +14,7 @@
 
 // main() provided by linkage to Catch2WithMain
 
-#include <catch2/catch_test_macros.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
 #include <vector>
 
 TEST_CASE( "vectors can be sized and resized", "[vector]" ) {
diff --git a/examples/110-Fix-ClassFixture.cpp b/examples/110-Fix-ClassFixture.cpp
index 614c3797..1b3f053f 100644
--- a/examples/110-Fix-ClassFixture.cpp
+++ b/examples/110-Fix-ClassFixture.cpp
@@ -14,7 +14,7 @@
 
 // main() provided by linkage to Catch2WithMain
 
-#include <catch2/catch_test_macros.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
 
 class DBConnection
 {
diff --git a/examples/111-Fix-PersistentFixture.cpp b/examples/111-Fix-PersistentFixture.cpp
index 2bef90ff..bed9d3e3 100644
--- a/examples/111-Fix-PersistentFixture.cpp
+++ b/examples/111-Fix-PersistentFixture.cpp
@@ -17,7 +17,7 @@
 
 // main() provided by linkage to Catch2WithMain
 
-#include <catch2/catch_test_macros.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
 
 #include <thread>
 
diff --git a/examples/120-Bdd-ScenarioGivenWhenThen.cpp b/examples/120-Bdd-ScenarioGivenWhenThen.cpp
index 345d53c3..b3edcd8c 100644
--- a/examples/120-Bdd-ScenarioGivenWhenThen.cpp
+++ b/examples/120-Bdd-ScenarioGivenWhenThen.cpp
@@ -10,7 +10,7 @@
 
 // main() provided by linkage with Catch2WithMain
 
-#include <catch2/catch_test_macros.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
 
 SCENARIO( "vectors can be sized and resized", "[vector]" ) {
 
diff --git a/examples/210-Evt-EventListeners.cpp b/examples/210-Evt-EventListeners.cpp
index f0a9f0af..48ccce20 100644
--- a/examples/210-Evt-EventListeners.cpp
+++ b/examples/210-Evt-EventListeners.cpp
@@ -13,10 +13,10 @@
 // 2. My listener and registration
 // 3. Test cases
 
-#include <catch2/catch_test_macros.hpp>
-#include <catch2/reporters/catch_reporter_event_listener.hpp>
-#include <catch2/reporters/catch_reporter_registrars.hpp>
-#include <catch2/catch_test_case_info.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
+#include <Progmasoft/Catch3/Reporters/EventListener.hpp>
+#include <Progmasoft/Catch3/Reporters/Registrars.hpp>
+#include <Progmasoft/Catch3/TestCaseInfo.hpp>
 #include <iostream>
 
 // -----------------------------------------------------------------------
diff --git a/examples/231-Cfg-OutputStreams.cpp b/examples/231-Cfg-OutputStreams.cpp
index 5aee38bc..e750333d 100644
--- a/examples/231-Cfg-OutputStreams.cpp
+++ b/examples/231-Cfg-OutputStreams.cpp
@@ -13,7 +13,7 @@
 // semantic, because it buffers the output. For most uses however,
 // there is no important difference between having `std::cerr` buffered
 // or unbuffered.
-#include <catch2/catch_test_macros.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
 
 #include <sstream>
 #include <cstdio>
diff --git a/examples/232-Cfg-CustomMain.cpp b/examples/232-Cfg-CustomMain.cpp
index 6ef05fe7..0ba58250 100644
--- a/examples/232-Cfg-CustomMain.cpp
+++ b/examples/232-Cfg-CustomMain.cpp
@@ -14,7 +14,7 @@
 // same `main`: what happens before `run` happens in every worker too, which
 // is where global set-up belongs.
 
-#include <catch2/catch_session.hpp>
+#include <Progmasoft/Catch3/Session.hpp>
 
 #include <cstdlib>
 #include <iostream>
diff --git a/examples/300-Gen-OwnGenerator.cpp b/examples/300-Gen-OwnGenerator.cpp
index ff28ad73..12859026 100644
--- a/examples/300-Gen-OwnGenerator.cpp
+++ b/examples/300-Gen-OwnGenerator.cpp
@@ -12,9 +12,9 @@
 // Specifically we will implement a random number generator for integers
 // It will have infinite capacity and settable lower/upper bound
 
-#include <catch2/catch_test_macros.hpp>
-#include <catch2/generators/catch_generators.hpp>
-#include <catch2/generators/catch_generators_adapters.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
+#include <Progmasoft/Catch3/Generators/Generators.hpp>
+#include <Progmasoft/Catch3/Generators/Adapters.hpp>
 
 #include <random>
 
diff --git a/examples/301-Gen-MapTypeConversion.cpp b/examples/301-Gen-MapTypeConversion.cpp
index 26f7538c..99bb1f6b 100644
--- a/examples/301-Gen-MapTypeConversion.cpp
+++ b/examples/301-Gen-MapTypeConversion.cpp
@@ -13,8 +13,8 @@
 // that converts the strings using stoi, so the returned type is actually
 // an int.
 
-#include <catch2/catch_test_macros.hpp>
-#include <catch2/generators/catch_generators_adapters.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
+#include <Progmasoft/Catch3/Generators/Adapters.hpp>
 
 #include <string>
 #include <sstream>
diff --git a/examples/302-Gen-Table.cpp b/examples/302-Gen-Table.cpp
index 3cdb1430..54afc802 100644
--- a/examples/302-Gen-Table.cpp
+++ b/examples/302-Gen-Table.cpp
@@ -10,8 +10,8 @@
 // Shows how to use table to run a test many times with different inputs. Lifted from examples on
 // issue #850.
 
-#include <catch2/catch_test_macros.hpp>
-#include <catch2/generators/catch_generators.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
+#include <Progmasoft/Catch3/Generators/Generators.hpp>
 #include <string>
 
 struct TestSubject {
diff --git a/examples/310-Gen-VariablesInGenerators.cpp b/examples/310-Gen-VariablesInGenerators.cpp
index 5d24d45a..ab584520 100644
--- a/examples/310-Gen-VariablesInGenerators.cpp
+++ b/examples/310-Gen-VariablesInGenerators.cpp
@@ -14,9 +14,9 @@
 // _WILL_ outlive the variables -- thus they should be either captured
 // by value directly, or copied by the generators during construction.
 
-#include <catch2/catch_test_macros.hpp>
-#include <catch2/generators/catch_generators_adapters.hpp>
-#include <catch2/generators/catch_generators_random.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
+#include <Progmasoft/Catch3/Generators/Adapters.hpp>
+#include <Progmasoft/Catch3/Generators/Random.hpp>
 
 TEST_CASE("Generate random doubles across different ranges",
           "[generator][example][advanced]") {
diff --git a/examples/311-Gen-CustomCapture.cpp b/examples/311-Gen-CustomCapture.cpp
index ee310383..5c01a084 100644
--- a/examples/311-Gen-CustomCapture.cpp
+++ b/examples/311-Gen-CustomCapture.cpp
@@ -17,9 +17,9 @@
 // per-variable custom capture list, this example shows how to achieve
 // that.
 
-#include <catch2/catch_test_macros.hpp>
-#include <catch2/generators/catch_generators_adapters.hpp>
-#include <catch2/generators/catch_generators_random.hpp>
+#include <Progmasoft/Catch3/TestMacros.hpp>
+#include <Progmasoft/Catch3/Generators/Adapters.hpp>
+#include <Progmasoft/Catch3/Generators/Random.hpp>
 
 TEST_CASE("Generate random doubles across different ranges",
           "[generator][example][advanced]") {
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 74b65995..292dac9a 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,5 +1,5 @@
 cmake_minimum_required(VERSION 3.16)
-project(Catch2Examples LANGUAGES CXX)
+project(Catch3Examples LANGUAGES CXX)
 
 message(STATUS "Examples included")
 
@@ -18,7 +18,7 @@ add_executable(020-MultiFile
 add_executable(231-Cfg_OutputStreams
   231-Cfg-OutputStreams.cpp
 )
-target_link_libraries(231-Cfg_OutputStreams Catch2_buildall_interface)
+target_link_libraries(231-Cfg_OutputStreams Catch3_buildall_interface)
 target_compile_definitions(231-Cfg_OutputStreams PUBLIC CATCH_CONFIG_NOSTDOUT)
 
 # These examples use the standard separate compilation
@@ -51,7 +51,7 @@ set(ALL_EXAMPLE_TARGETS
 )
 
 foreach(name ${ALL_EXAMPLE_TARGETS})
-  target_link_libraries(${name} Catch2WithMain)
+  target_link_libraries(${name} Catch3WithMain)
 endforeach()
 
 list(APPEND CATCH_TEST_TARGETS ${ALL_EXAMPLE_TARGETS})
diff --git a/extras/Catch.cmake b/extras/Catch3.cmake
similarity index 91%
rename from extras/Catch.cmake
rename to extras/Catch3.cmake
index 1b068de6..064d44b6 100644
--- a/extras/Catch.cmake
+++ b/extras/Catch3.cmake
@@ -2,12 +2,12 @@
 # file Copyright.txt or https://cmake.org/licensing for details.
 
 #[=======================================================================[.rst:
-Catch
------
+Catch3
+------
 
-This module defines a function to help use the Catch test framework.
+This module defines a function to help use the Catch3 test framework.
 
-The :command:`catch_discover_tests` discovers tests by asking the compiled test
+The :command:`catch3_discover_tests` discovers tests by asking the compiled test
 executable to enumerate its tests.  This does not require CMake to be re-run
 when tests change.  However, it may not work in a cross-compiling environment,
 and setting test properties is less convenient.
@@ -20,12 +20,12 @@ However, it provides more fine-grained pass/fail information to CTest, which is
 usually considered as more beneficial.  By default, the CTest test name is the
 same as the Catch name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``.
 
-.. command:: catch_discover_tests
+.. command:: catch3_discover_tests
 
   Automatically add tests with CTest by querying the compiled test executable
   for available tests::
 
-    catch_discover_tests(target
+    catch3_discover_tests(target
                          [TEST_SPEC arg1...]
                          [EXTRA_ARGS arg1...]
                          [WORKING_DIRECTORY dir]
@@ -42,7 +42,7 @@ same as the Catch name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``.
                          [ADD_TAGS_AS_LABELS]
     )
 
-  ``catch_discover_tests`` sets up a post-build command on the test executable
+  ``catch3_discover_tests`` sets up a post-build command on the test executable
   that generates the list of tests by parsing the output from running the test
   with the ``--list=json`` argument, the discovery protocol of the Catch3 runner
   (``"format": "catch3-tests"``, version 1).  This ensures that the full
@@ -85,7 +85,7 @@ same as the Catch name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``.
   ``TEST_PREFIX prefix``
     Specifies a ``prefix`` to be prepended to the name of each discovered test
     case.  This can be useful when the same test executable is being used in
-    multiple calls to ``catch_discover_tests()`` but with different
+    multiple calls to ``catch3_discover_tests()`` but with different
     ``TEST_SPEC`` or ``EXTRA_ARGS``.
 
   ``TEST_SUFFIX suffix``
@@ -95,12 +95,12 @@ same as the Catch name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``.
 
   ``PROPERTIES name1 value1...``
     Specifies additional properties to be set on all tests discovered by this
-    invocation of ``catch_discover_tests``.
+    invocation of ``catch3_discover_tests``.
 
   ``TEST_LIST var``
     Make the list of tests available in the variable ``var``, rather than the
     default ``<target>_TESTS``.  This can be useful when the same test
-    executable is being used in multiple calls to ``catch_discover_tests()``.
+    executable is being used in multiple calls to ``catch3_discover_tests()``.
     Note that this variable is only available in CTest.
 
   ``REPORTER reporter``
@@ -139,7 +139,7 @@ same as the Catch name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``.
     This requires cmake/ctest >= 3.22.
 
   ``DISCOVERY_MODE mode``
-    Provides control over when ``catch_discover_tests`` performs test discovery.
+    Provides control over when ``catch3_discover_tests`` performs test discovery.
     By default, ``POST_BUILD`` sets up a post-build command to perform test discovery
     at build time. In certain scenarios, like cross-compiling, this ``POST_BUILD``
     behavior is not desirable. By contrast, ``PRE_TEST`` delays test discovery until
@@ -147,8 +147,8 @@ same as the Catch name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``.
     where the test has a better chance at finding appropriate runtime dependencies.
 
     ``DISCOVERY_MODE`` defaults to the value of the
-    ``CMAKE_CATCH_DISCOVER_TESTS_DISCOVERY_MODE`` variable if it is not passed when
-    calling ``catch_discover_tests``. This provides a mechanism for globally selecting
+    ``CMAKE_CATCH3_DISCOVER_TESTS_DISCOVERY_MODE`` variable if it is not passed when
+    calling ``catch3_discover_tests``. This provides a mechanism for globally selecting
     a preferred test discovery behavior without having to modify each call site.
 
     On Apple Silicon with the Xcode generator you must use ``PRE_TEST``. With the
@@ -166,7 +166,7 @@ same as the Catch name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``.
 #]=======================================================================]
 
 #------------------------------------------------------------------------------
-function(catch_discover_tests TARGET)
+function(catch3_discover_tests TARGET)
 
   cmake_parse_arguments(
     ""
@@ -193,10 +193,10 @@ function(catch_discover_tests TARGET)
     message(FATAL_ERROR "The DL_FRAMEWORK_PATHS option requires at least cmake 3.22")
   endif()
   if(NOT _DISCOVERY_MODE)
-    if(NOT CMAKE_CATCH_DISCOVER_TESTS_DISCOVERY_MODE)
-      set(CMAKE_CATCH_DISCOVER_TESTS_DISCOVERY_MODE "POST_BUILD")
+    if(NOT CMAKE_CATCH3_DISCOVER_TESTS_DISCOVERY_MODE)
+      set(CMAKE_CATCH3_DISCOVER_TESTS_DISCOVERY_MODE "POST_BUILD")
     endif()
-    set(_DISCOVERY_MODE ${CMAKE_CATCH_DISCOVER_TESTS_DISCOVERY_MODE})
+    set(_DISCOVERY_MODE ${CMAKE_CATCH3_DISCOVER_TESTS_DISCOVERY_MODE})
   endif()
   if(NOT _DISCOVERY_MODE MATCHES "^(POST_BUILD|PRE_TEST)$")
     message(FATAL_ERROR "Unknown DISCOVERY_MODE: ${_DISCOVERY_MODE}")
@@ -242,7 +242,7 @@ function(catch_discover_tests TARGET)
               -D "TEST_DL_FRAMEWORK_PATHS=${_DL_FRAMEWORK_PATHS}"
               -D "CTEST_FILE=${ctest_tests_file}"
               -D "ADD_TAGS_AS_LABELS=${_ADD_TAGS_AS_LABELS}"
-              -P "${_CATCH_DISCOVER_TESTS_SCRIPT}"
+              -P "${_CATCH3_DISCOVER_TESTS_SCRIPT}"
       VERBATIM
     )
 
@@ -269,8 +269,8 @@ function(catch_discover_tests TARGET)
       "  if(NOT EXISTS \"${ctest_tests_file}\" OR"                                 "\n"
       "     NOT \"${ctest_tests_file}\" IS_NEWER_THAN \"$<TARGET_FILE:${TARGET}>\" OR\n"
       "     NOT \"${ctest_tests_file}\" IS_NEWER_THAN \"\${CMAKE_CURRENT_LIST_FILE}\")\n"
-      "    include(\"${_CATCH_DISCOVER_TESTS_SCRIPT}\")"                           "\n"
-      "    catch_discover_tests_impl("                                             "\n"
+      "    include(\"${_CATCH3_DISCOVER_TESTS_SCRIPT}\")"                           "\n"
+      "    catch3_discover_tests_impl("                                             "\n"
       "      TEST_EXECUTABLE"        " [==[" "$<TARGET_FILE:${TARGET}>"   "]==]"   "\n"
       "      TEST_EXECUTOR"          " [==[" "${crosscompiling_emulator}" "]==]"   "\n"
       "      TEST_WORKING_DIR"       " [==[" "${_WORKING_DIRECTORY}"      "]==]"   "\n"
@@ -323,7 +323,7 @@ endfunction()
 
 ###############################################################################
 
-set(_CATCH_DISCOVER_TESTS_SCRIPT
-  ${CMAKE_CURRENT_LIST_DIR}/CatchAddTests.cmake
-  CACHE INTERNAL "Catch2 full path to CatchAddTests.cmake helper file"
+set(_CATCH3_DISCOVER_TESTS_SCRIPT
+  ${CMAKE_CURRENT_LIST_DIR}/Catch3AddTests.cmake
+  CACHE INTERNAL "Full path to the Catch3AddTests.cmake helper file"
 )
diff --git a/extras/CatchAddTests.cmake b/extras/Catch3AddTests.cmake
similarity index 93%
rename from extras/CatchAddTests.cmake
rename to extras/Catch3AddTests.cmake
index ef2fb439..cbe431d4 100644
--- a/extras/CatchAddTests.cmake
+++ b/extras/Catch3AddTests.cmake
@@ -39,7 +39,7 @@ string(ASCII 3 _CloseBracketListingEscape)
 # Placeholder bytes in the listing would break our parsing hack, so
 # we check they don't exist. They shouldn't exist in valid JSON, but
 # the reporter might not be escaping them properly.
-function(validate_input_noescapes listing_var)
+function(catch3_validate_input_noescapes listing_var)
   foreach(byte "${_SemicolonEscape}" "${_BoundaryEscape}" "${_OpenBracketEscape}" "${_CloseBracketEscape}")
     string(FIND "${${listing_var}}" "${byte}" found)
     if(NOT found EQUAL -1)
@@ -54,7 +54,7 @@ endfunction()
 
 # Replaces relevant characters with their placeholders, see the top of this file.
 # Modifies argument `var` in place.
-function(magic_escape_chars var)
+function(catch3_magic_escape_chars var)
   set(value "${${var}}")
   string(REPLACE ";" "${_SemicolonEscape}" value "${value}")
   string(REPLACE "[" "${_OpenBracketEscape}" value "${value}")
@@ -65,7 +65,7 @@ endfunction()
 
 # Turns placeholders back into original characters, see the top of this file.
 # Modifies argument `var` in place.
-function(magic_unescape_chars var)
+function(catch3_magic_unescape_chars var)
   set(value "${${var}}")
   string(REPLACE "${_SemicolonEscape}" ";" value "${value}")
   string(REPLACE "${_OpenBracketEscape}" "[" value "${value}")
@@ -95,7 +95,7 @@ endfunction()
 # Note that to support passing the object strings back from the function,
 # they will still contain the placeholders and need to be unescaped before
 # further processing (e.g. sending them into CMake's JSON parsing API).
-function(split_json_array json_array_var out_var)
+function(catch3_split_json_array json_array_var out_var)
   # We have to pass the input by var name to avoid CMake processing
   # the input as an arg.
   set(json_in "${${json_array_var}}")
@@ -106,7 +106,7 @@ function(split_json_array json_array_var out_var)
   string(REGEX REPLACE "^[ \t\r\n]*\\[" "" json_in "${json_in}")
   string(REGEX REPLACE "\\][ \t\r\n]*$" "" json_in "${json_in}")
 
-  magic_escape_chars(json_in)
+  catch3_magic_escape_chars(json_in)
 
   # We need to keep the whitespace around comma around, so that if we
   # split inside the test object, we can reconstruct it losslessly.
@@ -129,7 +129,7 @@ function(split_json_array json_array_var out_var)
     # Because the fragments (might) contain invalid JSON characters due
     # to escaping, we have to unescape it before checking if we can parse it.
     set(maybe_json "${accumulator}")
-    magic_unescape_chars(maybe_json)
+    catch3_magic_unescape_chars(maybe_json)
     string(JSON unused ERROR_VARIABLE err GET "${maybe_json}" "name")
     if(err STREQUAL "NOTFOUND")
       list(APPEND array_elements "${accumulator}")
@@ -145,7 +145,7 @@ endfunction()
 #
 # This allows the registration script to escape parts of the test script
 # only once, instead of escaping the unchanged arguments over and over again.
-function(prepare_command_fragment out_var)
+function(catch3_prepare_command_fragment out_var)
   set(_args "")
   math(EXPR _last_arg ${ARGC}-1)
   if(_last_arg GREATER_EQUAL 1)
@@ -164,7 +164,7 @@ endfunction()
 
 # Generates random filename in the temp folder.
 # Temp folder is retrieved by checking env vars from various platforms.
-function(make_temp_file_path OUT_VARIABLE FALLBACK_PATH)
+function(catch3_make_temp_file_path OUT_VARIABLE FALLBACK_PATH)
   set(TEMP_DIR "")
   set(ENV_VARS
     # From XDG base dir specification
@@ -192,7 +192,7 @@ function(make_temp_file_path OUT_VARIABLE FALLBACK_PATH)
 
   # Generate the random file name
   string(RANDOM LENGTH 8 RAND_ID)
-  set(FINAL_TEMP_PATH "${TEMP_DIR}/Catch2-test-listing.${RAND_ID}.json")
+  set(FINAL_TEMP_PATH "${TEMP_DIR}/Catch3-test-listing.${RAND_ID}.json")
 
   set(${OUT_VARIABLE} "${FINAL_TEMP_PATH}" PARENT_SCOPE)
 endfunction()
@@ -205,7 +205,7 @@ endfunction()
 #
 #   <base>_tests.cmake       -> <base>_test-list.cmake
 #   <base>_tests-Debug.cmake -> <base>_test-list-Debug.cmake
-function(make_test_list_file_path CTEST_FILE OUT_VARIABLE)
+function(catch3_make_test_list_file_path CTEST_FILE OUT_VARIABLE)
   if("${CTEST_FILE}" MATCHES "_tests(.*)\\.cmake$")
     string(REGEX REPLACE "_tests(.*)\\.cmake$" "_test-list\\1.cmake" list_file "${CTEST_FILE}")
   else()
@@ -214,7 +214,7 @@ function(make_test_list_file_path CTEST_FILE OUT_VARIABLE)
   set(${OUT_VARIABLE} "${list_file}" PARENT_SCOPE)
 endfunction()
 
-function(catch_discover_tests_impl)
+function(catch3_discover_tests_impl)
   cmake_parse_arguments(
     ""
     ""
@@ -224,7 +224,7 @@ function(catch_discover_tests_impl)
   )
 
   # We write the list of all discovered tests into a separate file
-  make_test_list_file_path("${_CTEST_FILE}" _CTEST_LIST_FILE)
+  catch3_make_test_list_file_path("${_CTEST_FILE}" _CTEST_LIST_FILE)
 
   # We periodically append to the output files below, so we have to ensure
   # that it is empty at the start, or we get duplicated test scripts.
@@ -306,7 +306,7 @@ function(catch_discover_tests_impl)
   if(listing_start GREATER 0)
     string(SUBSTRING "${listing_output}" ${listing_start} -1 listing_output)
   endif()
-  validate_input_noescapes(listing_output)
+  catch3_validate_input_noescapes(listing_output)
 
   # The runner writes reports itself: REPORTER chooses which, OUTPUT_DIR where.
   set(report_option "")
@@ -360,7 +360,7 @@ function(catch_discover_tests_impl)
   # Extract just the JSON array with tests and then split them into
   # individual objects.
   string(JSON test_listing GET "${listing_output}" "tests")
-  split_json_array(test_listing tests)
+  catch3_split_json_array(test_listing tests)
 
   # Exit early if no tests are detected
   if(NOT tests)
@@ -378,7 +378,7 @@ function(catch_discover_tests_impl)
   set(test_names "set(${_TEST_LIST}")
 
   # Most of the commands/arguments in the CTest script are identical
-  # for every test registered with one `catch_discover_tests` call.
+  # for every test registered with one `catch3_discover_tests` call.
   # To avoid repeating the work in escaping them, we escape them before
   # the per-test loop and reuse the escaped fragments.
   #
@@ -386,11 +386,11 @@ function(catch_discover_tests_impl)
   #   add_test(<name><exec><exe><escaped_name><extra_args><reporter><out_dir>)
   # Of these, <exec>,<exe>,<extra_args>, and <reporter> are the same between
   # all tests.
-  prepare_command_fragment(_exec_exe_fragment
+  catch3_prepare_command_fragment(_exec_exe_fragment
     ${_TEST_EXECUTOR}
     "${_TEST_EXECUTABLE}"
   )
-  prepare_command_fragment(_args_reporter_fragment
+  catch3_prepare_command_fragment(_args_reporter_fragment
     "${extra_args}"
   )
 
@@ -398,14 +398,14 @@ function(catch_discover_tests_impl)
   #   set_tests_properties(<name> PROPERTIES WORKING_DIRECTORY <dir> <properties>)
   #   set_tests_properties(<name> PROPERTIES ENVIRONMENT_MODIFICATION <env_mod>)
   # Of these, only the <name> changes between tests.
-  prepare_command_fragment(_properties_fragment
+  catch3_prepare_command_fragment(_properties_fragment
     PROPERTIES
     WORKING_DIRECTORY "${_TEST_WORKING_DIR}"
     ${properties}
   )
   # Env modification is optional, so we prepare it in a separate command
   if(environment_modifications)
-    prepare_command_fragment(_env_modification_fragment
+    catch3_prepare_command_fragment(_env_modification_fragment
       PROPERTIES
       ENVIRONMENT_MODIFICATION "${environment_modifications}"
     )
@@ -429,7 +429,7 @@ function(catch_discover_tests_impl)
 
     # The elements are still escaped and contain JSON-invalid characters,
     # they have to be unescaped before parsing them as JSON.
-    magic_unescape_chars(single_test)
+    catch3_magic_unescape_chars(single_test)
     if(add_tags)
       string(JSON test_tags GET "${single_test}" "tags")
     endif()
@@ -450,9 +450,9 @@ function(catch_discover_tests_impl)
     endif()
 
     set(full_name "${prefix}${plain_name}${suffix}")
-    prepare_command_fragment(_full_name_fragment "${full_name}")
-    prepare_command_fragment(_escaped_name_fragment "${escaped_name}")
-    prepare_command_fragment(_outdir_fragment "${output_dir_arg}")
+    catch3_prepare_command_fragment(_full_name_fragment "${full_name}")
+    catch3_prepare_command_fragment(_escaped_name_fragment "${escaped_name}")
+    catch3_prepare_command_fragment(_outdir_fragment "${output_dir_arg}")
 
     string(APPEND script
       "add_test(${_full_name_fragment}${_exec_exe_fragment}${_escaped_name_fragment}${_args_reporter_fragment}${_outdir_fragment})\n")
@@ -477,7 +477,7 @@ function(catch_discover_tests_impl)
           list(APPEND tag_list "${a_tag}")
         endforeach()
 
-        prepare_command_fragment(_labels_fragment
+        catch3_prepare_command_fragment(_labels_fragment
           PROPERTIES
           LABELS "${tag_list}"
         )
@@ -515,7 +515,7 @@ endfunction()
 # To enable `include`ing this file in the unit test scripts, we only run
 # the impl if an actual `TEST_EXECUTABLE` is provided.
 if(CMAKE_SCRIPT_MODE_FILE AND DEFINED TEST_EXECUTABLE)
-  catch_discover_tests_impl(
+  catch3_discover_tests_impl(
     TEST_EXECUTABLE ${TEST_EXECUTABLE}
     TEST_EXECUTOR ${TEST_EXECUTOR}
     TEST_WORKING_DIR ${TEST_WORKING_DIR}
diff --git a/extras/CatchShardTests.cmake b/extras/Catch3ShardTests.cmake
similarity index 87%
rename from extras/CatchShardTests.cmake
rename to extras/Catch3ShardTests.cmake
index 27f7c9f7..a7d651ef 100644
--- a/extras/CatchShardTests.cmake
+++ b/extras/Catch3ShardTests.cmake
@@ -10,7 +10,7 @@
 #  * SHARD_COUNT - number of shards to split target's tests into
 #  * REPORTER    - report options for the shards, such as --junit=FILE
 #  * TEST_SPEC   - test spec used for filtering tests
-function(catch_add_sharded_tests TARGET)
+function(catch3_add_sharded_tests TARGET)
   if(${CMAKE_VERSION} VERSION_LESS "3.10.0")
     message(FATAL_ERROR "add_sharded_catch_tests only supports CMake versions 3.10.0 and up")
   endif()
@@ -46,7 +46,7 @@ function(catch_add_sharded_tests TARGET)
     APPEND PROPERTY TEST_INCLUDE_FILES "${ctest_include_file}"
   )
 
-  set(shard_impl_script_file "${_CATCH_DISCOVER_SHARD_TESTS_IMPL_SCRIPT}")
+  set(shard_impl_script_file "${_CATCH3_DISCOVER_SHARD_TESTS_IMPL_SCRIPT}")
 
   add_custom_command(
     TARGET ${TARGET} POST_BUILD
@@ -66,7 +66,7 @@ endfunction()
 
 ###############################################################################
 
-set(_CATCH_DISCOVER_SHARD_TESTS_IMPL_SCRIPT
-    ${CMAKE_CURRENT_LIST_DIR}/CatchShardTestsImpl.cmake
-  CACHE INTERNAL "Catch2 full path to CatchShardTestsImpl.cmake helper file"
+set(_CATCH3_DISCOVER_SHARD_TESTS_IMPL_SCRIPT
+    ${CMAKE_CURRENT_LIST_DIR}/Catch3ShardTestsImpl.cmake
+  CACHE INTERNAL "Full path to the Catch3ShardTestsImpl.cmake helper file"
 )
diff --git a/extras/CatchShardTestsImpl.cmake b/extras/Catch3ShardTestsImpl.cmake
similarity index 100%
rename from extras/CatchShardTestsImpl.cmake
rename to extras/Catch3ShardTestsImpl.cmake
diff --git a/extras/ParseAndAddCatchTests.cmake b/extras/ParseAndAddCatchTests.cmake
deleted file mode 100644
index d7c17ace..00000000
--- a/extras/ParseAndAddCatchTests.cmake
+++ /dev/null
@@ -1,250 +0,0 @@
-#==================================================================================================#
-#  supported macros                                                                                #
-#    - TEST_CASE,                                                                                  #
-#    - TEMPLATE_TEST_CASE                                                                          #
-#    - SCENARIO,                                                                                   #
-#    - TEST_CASE_METHOD,                                                                           #
-#    - CATCH_TEST_CASE,                                                                            #
-#    - CATCH_TEMPLATE_TEST_CASE                                                                    #
-#    - CATCH_SCENARIO,                                                                             #
-#    - CATCH_TEST_CASE_METHOD.                                                                     #
-#                                                                                                  #
-#  Usage                                                                                           #
-# 1. make sure this module is in the path or add this otherwise:                                   #
-#    set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake.modules/")              #
-# 2. make sure that you've enabled testing option for the project by the call:                     #
-#    enable_testing()                                                                              #
-# 3. add the lines to the script for testing target (sample CMakeLists.txt):                       #
-#        project(testing_target)                                                                   #
-#        set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake.modules/")          #
-#        enable_testing()                                                                          #
-#                                                                                                  #
-#        find_path(CATCH_INCLUDE_DIR "catch.hpp")                                                  #
-#        include_directories(${INCLUDE_DIRECTORIES} ${CATCH_INCLUDE_DIR})                          #
-#                                                                                                  #
-#        file(GLOB SOURCE_FILES "*.cpp")                                                           #
-#        add_executable(${PROJECT_NAME} ${SOURCE_FILES})                                           #
-#                                                                                                  #
-#        include(ParseAndAddCatchTests)                                                            #
-#        ParseAndAddCatchTests(${PROJECT_NAME})                                                    #
-#                                                                                                  #
-# The following variables affect the behavior of the script:                                       #
-#                                                                                                  #
-#    PARSE_CATCH_TESTS_VERBOSE (Default OFF)                                                       #
-#    -- enables debug messages                                                                     #
-#    PARSE_CATCH_TESTS_NO_HIDDEN_TESTS (Default OFF)                                               #
-#    -- excludes tests marked with [!hide], [.] or [.foo] tags                                     #
-#    PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME (Default ON)                                       #
-#    -- adds fixture class name to the test name                                                   #
-#    PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME (Default ON)                                        #
-#    -- adds cmake target name to the test name                                                    #
-#    PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS (Default OFF)                                      #
-#    -- causes CMake to rerun when file with tests changes so that new tests will be discovered    #
-#                                                                                                  #
-# One can also set (locally) the optional variable OptionalCatchTestLauncher to precise the way    #
-# a test should be run. For instance to use test MPI, one can write                                #
-#     set(OptionalCatchTestLauncher ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${NUMPROC})                 #
-# just before calling this ParseAndAddCatchTests function                                          #
-#                                                                                                  #
-# The AdditionalCatchParameters optional variable can be used to pass extra argument to the test   #
-# command. For example, to include successful tests in the output, one can write                   #
-#     set(AdditionalCatchParameters --success)                                                     #
-#                                                                                                  #
-# After the script, the ParseAndAddCatchTests_TESTS property for the target, and for each source   #
-# file in the target is set, and contains the list of the tests extracted from that target, or     #
-# from that file. This is useful, for example to add further labels or properties to the tests.    #
-#                                                                                                  #
-#==================================================================================================#
-
-if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.8)
-  message(FATAL_ERROR "ParseAndAddCatchTests requires CMake 2.8.8 or newer")
-endif()
-
-option(PARSE_CATCH_TESTS_VERBOSE "Print Catch to CTest parser debug messages" OFF)
-option(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS "Exclude tests with [!hide], [.] or [.foo] tags" OFF)
-option(PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME "Add fixture class name to the test name" ON)
-option(PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME "Add target name to the test name" ON)
-option(PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS "Add test file to CMAKE_CONFIGURE_DEPENDS property" OFF)
-
-function(ParseAndAddCatchTests_PrintDebugMessage)
-  if(PARSE_CATCH_TESTS_VERBOSE)
-    message(STATUS "ParseAndAddCatchTests: ${ARGV}")
-  endif()
-endfunction()
-
-# This removes the contents between
-#  - block comments (i.e. /* ... */)
-#  - full line comments (i.e. // ... )
-# contents have been read into '${CppCode}'.
-# !keep partial line comments
-function(ParseAndAddCatchTests_RemoveComments CppCode)
-  string(ASCII 2 CMakeBeginBlockComment)
-  string(ASCII 3 CMakeEndBlockComment)
-  string(REGEX REPLACE "/\\*" "${CMakeBeginBlockComment}" ${CppCode} "${${CppCode}}")
-  string(REGEX REPLACE "\\*/" "${CMakeEndBlockComment}" ${CppCode} "${${CppCode}}")
-  string(REGEX REPLACE "${CMakeBeginBlockComment}[^${CMakeEndBlockComment}]*${CMakeEndBlockComment}" "" ${CppCode} "${${CppCode}}")
-  string(REGEX REPLACE "\n[ \t]*//+[^\n]+" "\n" ${CppCode} "${${CppCode}}")
-
-  set(${CppCode} "${${CppCode}}" PARENT_SCOPE)
-endfunction()
-
-# Worker function
-function(ParseAndAddCatchTests_ParseFile SourceFile TestTarget)
-  # If SourceFile is an object library, do not scan it (as it is not a file). Exit without giving a warning about a missing file.
-  if(SourceFile MATCHES "\\\$<TARGET_OBJECTS:.+>")
-    ParseAndAddCatchTests_PrintDebugMessage("Detected OBJECT library: ${SourceFile} this will not be scanned for tests.")
-    return()
-  endif()
-  # According to CMake docs EXISTS behavior is well-defined only for full paths.
-  get_filename_component(SourceFile ${SourceFile} ABSOLUTE)
-  if(NOT EXISTS ${SourceFile})
-    message(WARNING "Cannot find source file: ${SourceFile}")
-    return()
-  endif()
-  ParseAndAddCatchTests_PrintDebugMessage("parsing ${SourceFile}")
-  file(STRINGS ${SourceFile} Contents NEWLINE_CONSUME)
-
-  # Remove block and fullline comments
-  ParseAndAddCatchTests_RemoveComments(Contents)
-
-  # Find definition of test names
-  # https://regex101.com/r/JygOND/1
-  string(REGEX MATCHALL "[ \t]*(CATCH_)?(TEMPLATE_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)[ \t]*\\([ \t\n]*\"[^\"]*\"[ \t\n]*(,[ \t\n]*\"[^\"]*\")?(,[ \t\n]*[^\,\)]*)*\\)[ \t\n]*\{+[ \t]*(//[^\n]*[Tt][Ii][Mm][Ee][Oo][Uu][Tt][ \t]*[0-9]+)*" Tests "${Contents}")
-
-  if(PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS AND Tests)
-    ParseAndAddCatchTests_PrintDebugMessage("Adding ${SourceFile} to CMAKE_CONFIGURE_DEPENDS property")
-    set_property(
-      DIRECTORY
-      APPEND
-      PROPERTY CMAKE_CONFIGURE_DEPENDS ${SourceFile}
-    )
-  endif()
-
-  # check CMP0110 policy for new add_test() behavior
-  if(POLICY CMP0110)
-    cmake_policy(GET CMP0110 _cmp0110_value) # new add_test() behavior
-  else()
-    # just to be thorough explicitly set the variable
-    set(_cmp0110_value)
-  endif()
-
-  foreach(TestName ${Tests})
-    # Strip newlines
-    string(REGEX REPLACE "\\\\\n|\n" "" TestName "${TestName}")
-
-    # Get test type and fixture if applicable
-    string(REGEX MATCH "(CATCH_)?(TEMPLATE_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)[ \t]*\\([^,^\"]*" TestTypeAndFixture "${TestName}")
-    string(REGEX MATCH "(CATCH_)?(TEMPLATE_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)" TestType "${TestTypeAndFixture}")
-    string(REGEX REPLACE "${TestType}\\([ \t]*" "" TestFixture "${TestTypeAndFixture}")
-
-    # Get string parts of test definition
-    string(REGEX MATCHALL "\"+([^\\^\"]|\\\\\")+\"+" TestStrings "${TestName}")
-
-    # Strip wrapping quotation marks
-    string(REGEX REPLACE "^\"(.*)\"$" "\\1" TestStrings "${TestStrings}")
-    string(REPLACE "\";\"" ";" TestStrings "${TestStrings}")
-
-    # Validate that a test name and tags have been provided
-    list(LENGTH TestStrings TestStringsLength)
-    if(TestStringsLength GREATER 2 OR TestStringsLength LESS 1)
-      message(FATAL_ERROR "You must provide a valid test name and tags for all tests in ${SourceFile}")
-    endif()
-
-    # Assign name and tags
-    list(GET TestStrings 0 Name)
-    if("${TestType}" STREQUAL "SCENARIO")
-      set(Name "Scenario: ${Name}")
-    endif()
-    if(PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME AND "${TestType}" MATCHES "(CATCH_)?TEST_CASE_METHOD" AND TestFixture)
-      set(CTestName "${TestFixture}:${Name}")
-    else()
-      set(CTestName "${Name}")
-    endif()
-    if(PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME)
-      set(CTestName "${TestTarget}:${CTestName}")
-    endif()
-    # add target to labels to enable running all tests added from this target
-    set(Labels ${TestTarget})
-    if(TestStringsLength EQUAL 2)
-      list(GET TestStrings 1 Tags)
-      string(TOLOWER "${Tags}" Tags)
-      # remove target from labels if the test is hidden
-      if("${Tags}" MATCHES ".*\\[!?(hide|\\.)\\].*")
-        list(REMOVE_ITEM Labels ${TestTarget})
-      endif()
-      string(REPLACE "]" ";" Tags "${Tags}")
-      string(REPLACE "[" "" Tags "${Tags}")
-    else()
-      # unset tags variable from previous loop
-      unset(Tags)
-    endif()
-
-    list(APPEND Labels ${Tags})
-
-    set(HiddenTagFound OFF)
-    foreach(label ${Labels})
-      string(REGEX MATCH "^!hide|^\\." result ${label})
-      if(result)
-        set(HiddenTagFound ON)
-        break()
-      endif()
-    endforeach(label)
-    if(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS AND ${HiddenTagFound} AND ${CMAKE_VERSION} VERSION_LESS "3.9")
-      ParseAndAddCatchTests_PrintDebugMessage("Skipping test \"${CTestName}\" as it has [!hide], [.] or [.foo] label")
-    else()
-      ParseAndAddCatchTests_PrintDebugMessage("Adding test \"${CTestName}\"")
-      if(Labels)
-        ParseAndAddCatchTests_PrintDebugMessage("Setting labels to ${Labels}")
-      endif()
-
-      # Escape commas in the test spec
-      string(REPLACE "," "\\," Name ${Name})
-
-      # Work around CMake 3.18.0 change in `add_test()`, before the escaped quotes were necessary,
-      # only with CMake 3.18.0 the escaped double quotes confuse the call. This change is reverted in 3.18.1
-      # And properly introduced in 3.19 with the CMP0110 policy
-      if(_cmp0110_value STREQUAL "NEW" OR ${CMAKE_VERSION} VERSION_EQUAL "3.18")
-        ParseAndAddCatchTests_PrintDebugMessage("CMP0110 set to NEW, no need for add_test(\"\") workaround")
-      else()
-        ParseAndAddCatchTests_PrintDebugMessage("CMP0110 set to OLD adding \"\" for add_test() workaround")
-        set(CTestName "\"${CTestName}\"")
-      endif()
-
-      # Handle template test cases
-      if("${TestTypeAndFixture}" MATCHES ".*TEMPLATE_.*")
-        set(Name "${Name} - *")
-      endif()
-
-      # Add the test and set its properties
-      add_test(NAME "${CTestName}" COMMAND ${OptionalCatchTestLauncher} $<TARGET_FILE:${TestTarget}> ${Name} ${AdditionalCatchParameters})
-      # Old CMake versions do not document VERSION_GREATER_EQUAL, so we use VERSION_GREATER with 3.8 instead
-      if(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS AND ${HiddenTagFound} AND ${CMAKE_VERSION} VERSION_GREATER "3.8")
-        ParseAndAddCatchTests_PrintDebugMessage("Setting DISABLED test property")
-        set_tests_properties("${CTestName}" PROPERTIES DISABLED ON)
-      else()
-        set_tests_properties("${CTestName}" PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran"
-                                                LABELS "${Labels}")
-      endif()
-      set_property(
-        TARGET ${TestTarget}
-        APPEND
-        PROPERTY ParseAndAddCatchTests_TESTS "${CTestName}")
-      set_property(
-        SOURCE ${SourceFile}
-        APPEND
-        PROPERTY ParseAndAddCatchTests_TESTS "${CTestName}")
-    endif()
-  endforeach()
-endfunction()
-
-# entry point
-function(ParseAndAddCatchTests TestTarget)
-  message(DEPRECATION "ParseAndAddCatchTest: function deprecated because of possibility of missed test cases. Consider using 'catch_discover_tests' from 'Catch.cmake'")
-  ParseAndAddCatchTests_PrintDebugMessage("Started parsing ${TestTarget}")
-  get_target_property(SourceFiles ${TestTarget} SOURCES)
-  ParseAndAddCatchTests_PrintDebugMessage("Found the following sources: ${SourceFiles}")
-  foreach(SourceFile ${SourceFiles})
-    ParseAndAddCatchTests_ParseFile(${SourceFile} ${TestTarget})
-  endforeach()
-  ParseAndAddCatchTests_PrintDebugMessage("Finished parsing ${TestTarget}")
-endfunction()
diff --git a/extras/catch_amalgamated.cpp b/extras/catch_amalgamated.cpp
index f5a8b781..0f336b53 100644
--- a/extras/catch_amalgamated.cpp
+++ b/extras/catch_amalgamated.cpp
@@ -7,7 +7,7 @@
 // SPDX-License-Identifier: BSL-1.0
 
 //  Catch3 v0.3.0, on the Catch2 v3.16.1 engine
-//  Generated: 2026-10-24 19:06:40.031209
+//  Generated: 2026-10-25 02:37:10.065190
 //  ----------------------------------------------------------
 //  This file is an amalgamation of multiple different files.
 //  You probably shouldn't edit it directly.
@@ -20,8 +20,6 @@
 #include "catch_amalgamated.hpp"
 
 
-#ifndef CATCH_WINDOWS_H_PROXY_HPP_INCLUDED
-#define CATCH_WINDOWS_H_PROXY_HPP_INCLUDED
 
 
 #if defined(CATCH_PLATFORM_WINDOWS)
@@ -39,7 +37,6 @@
 
 #endif // defined(CATCH_PLATFORM_WINDOWS)
 
-#endif // CATCH_WINDOWS_H_PROXY_HPP_INCLUDED
 // Copyright (c) 2026 Progmasoft.
 // SPDX-License-Identifier: MPL-2.0 WITH AdditionRef-Progmasoft-Exception-1.1
 
@@ -2160,6 +2157,180 @@ namespace Progmasoft::Catch3
 
 
 
+#include <cmath>
+#include <limits>
+
+namespace {
+
+// Performs equivalent check of std::fabs(lhs - rhs) <= margin
+// But without the subtraction to allow for INFINITY in comparison
+bool marginComparison(double lhs, double rhs, double margin) {
+    return (lhs + margin >= rhs) && (rhs + margin >= lhs);
+}
+
+}
+
+namespace Catch {
+
+    Approx::Approx ( double value )
+    :   m_epsilon( static_cast<double>(std::numeric_limits<float>::epsilon())*100. ),
+        m_margin( 0.0 ),
+        m_scale( 0.0 ),
+        m_value( value )
+    {}
+
+    Approx Approx::custom() {
+        return Approx( 0 );
+    }
+
+    Approx Approx::operator-() const {
+        auto temp(*this);
+        temp.m_value = -temp.m_value;
+        return temp;
+    }
+
+
+    std::string Approx::toString() const {
+        ReusableStringStream rss;
+        rss << "Approx( " << ::Catch::Detail::stringify( m_value ) << " )";
+        return rss.str();
+    }
+
+    bool Approx::equalityComparisonImpl(const double other) const {
+        // First try with fixed margin, then compute margin based on epsilon, scale and Approx's value
+        // Thanks to Richard Harris for his help refining the scaled margin value
+        return marginComparison(m_value, other, m_margin)
+            || marginComparison(m_value, other, m_epsilon * (m_scale + std::fabs(std::isinf(m_value)? 0 : m_value)));
+    }
+
+    void Approx::setMargin(double newMargin) {
+        CATCH_ENFORCE(newMargin >= 0,
+            "Invalid Approx::margin: " << newMargin << '.'
+            << " Approx::Margin has to be non-negative.");
+        m_margin = newMargin;
+    }
+
+    void Approx::setEpsilon(double newEpsilon) {
+        CATCH_ENFORCE(newEpsilon >= 0 && newEpsilon <= 1.0,
+            "Invalid Approx::epsilon: " << newEpsilon << '.'
+            << " Approx::epsilon has to be in [0, 1]");
+        m_epsilon = newEpsilon;
+    }
+
+namespace literals {
+    Approx operator ""_a(long double val) {
+        return Approx(val);
+    }
+    Approx operator ""_a(unsigned long long val) {
+        return Approx(val);
+    }
+} // end namespace literals
+
+std::string StringMaker<Catch::Approx>::convert(Catch::Approx const& value) {
+    return value.toString();
+}
+
+} // end namespace Catch
+
+
+
+namespace Catch {
+
+    AssertionResultData::AssertionResultData(ResultWas::OfType _resultType, LazyExpression const& _lazyExpression):
+        lazyExpression(_lazyExpression),
+        resultType(_resultType) {}
+
+    std::string AssertionResultData::reconstructExpression() const {
+
+        if( reconstructedExpression.empty() ) {
+            if( lazyExpression ) {
+                ReusableStringStream rss;
+                rss << lazyExpression;
+                reconstructedExpression = rss.str();
+            }
+        }
+        return reconstructedExpression;
+    }
+
+    AssertionResult::AssertionResult( AssertionInfo const& info, AssertionResultData&& data )
+    :   m_info( info ),
+        m_resultData( CATCH_MOVE(data) )
+    {}
+
+    // Result was a success
+    bool AssertionResult::succeeded() const {
+        return Catch::isOk( m_resultData.resultType );
+    }
+
+    // Result was a success, or failure is suppressed
+    bool AssertionResult::isOk() const {
+        return Catch::isOk( m_resultData.resultType ) || shouldSuppressFailure( m_info.resultDisposition );
+    }
+
+    ResultWas::OfType AssertionResult::getResultType() const {
+        return m_resultData.resultType;
+    }
+
+    bool AssertionResult::hasExpression() const {
+        return !m_info.capturedExpression.empty();
+    }
+
+    bool AssertionResult::hasMessage() const {
+        return !m_resultData.message.empty();
+    }
+
+    std::string AssertionResult::getExpression() const {
+        // Possibly overallocating by 3 characters should be basically free
+        std::string expr; expr.reserve(m_info.capturedExpression.size() + 3);
+        if (isFalseTest(m_info.resultDisposition)) {
+            expr += "!(";
+        }
+        expr += m_info.capturedExpression;
+        if (isFalseTest(m_info.resultDisposition)) {
+            expr += ')';
+        }
+        return expr;
+    }
+
+    std::string AssertionResult::getExpressionInMacro() const {
+        if ( m_info.macroName.empty() ) {
+            return static_cast<std::string>( m_info.capturedExpression );
+        }
+        std::string expr;
+        expr.reserve( m_info.macroName.size() + m_info.capturedExpression.size() + 4 );
+        expr += m_info.macroName;
+        expr += "( ";
+        expr += m_info.capturedExpression;
+        expr += " )";
+        return expr;
+    }
+
+    bool AssertionResult::hasExpandedExpression() const {
+        return hasExpression() && getExpandedExpression() != getExpression();
+    }
+
+    std::string AssertionResult::getExpandedExpression() const {
+        std::string expr = m_resultData.reconstructExpression();
+        return expr.empty()
+                ? getExpression()
+                : expr;
+    }
+
+    StringRef AssertionResult::getMessage() const {
+        return m_resultData.message;
+    }
+    SourceLineInfo AssertionResult::getSourceInfo() const {
+        return m_info.lineInfo;
+    }
+
+    StringRef AssertionResult::getTestMacroName() const {
+        return m_info.macroName;
+    }
+
+} // end namespace Catch
+
+
+
 
 #include <algorithm>
 #include <chrono>
@@ -2717,249 +2888,203 @@ namespace Catch {
 
 
 
-#include <cmath>
-#include <limits>
-
-namespace {
-
-// Performs equivalent check of std::fabs(lhs - rhs) <= margin
-// But without the subtraction to allow for INFINITY in comparison
-bool marginComparison(double lhs, double rhs, double margin) {
-    return (lhs + margin >= rhs) && (rhs + margin >= lhs);
-}
-
-}
-
 namespace Catch {
 
-    Approx::Approx ( double value )
-    :   m_epsilon( static_cast<double>(std::numeric_limits<float>::epsilon())*100. ),
-        m_margin( 0.0 ),
-        m_scale( 0.0 ),
-        m_value( value )
-    {}
-
-    Approx Approx::custom() {
-        return Approx( 0 );
+    bool operator==( PathFilter const& lhs, PathFilter const& rhs ) {
+        return lhs.type == rhs.type && lhs.filter == rhs.filter;
     }
 
-    Approx Approx::operator-() const {
-        auto temp(*this);
-        temp.m_value = -temp.m_value;
-        return temp;
+    Config::Config( ConfigData const& data ):
+        m_data( data ) {
+        // We need to trim filter specs to avoid trouble with superfluous
+        // whitespace (esp. important for bdd macros, as those are manually
+        // aligned with whitespace).
+        for (auto& elem : m_data.testsOrTags) {
+            elem = trim(elem);
+        }
+
+        TestSpecParser parser( ITagAliasRegistry::get() );
+        if ( !m_data.testsOrTags.empty() ) {
+            m_hasTestFilters = true;
+            for ( auto const& testOrTags : m_data.testsOrTags ) {
+                parser.parse( testOrTags );
+            }
+        }
+        m_testSpec = parser.testSpec();
     }
 
+    Config::~Config() = default;
 
-    std::string Approx::toString() const {
-        ReusableStringStream rss;
-        rss << "Approx( " << ::Catch::Detail::stringify( m_value ) << " )";
-        return rss.str();
-    }
+    std::vector<std::string> const& Config::getTestsOrTags() const { return m_data.testsOrTags; }
+    std::vector<PathFilter> const& Config::getPathFilters() const { return m_data.pathFilters; }
+    bool Config::useNewFilterBehaviour() const { return m_data.useNewPathFilteringBehaviour; }
 
-    bool Approx::equalityComparisonImpl(const double other) const {
-        // First try with fixed margin, then compute margin based on epsilon, scale and Approx's value
-        // Thanks to Richard Harris for his help refining the scaled margin value
-        return marginComparison(m_value, other, m_margin)
-            || marginComparison(m_value, other, m_epsilon * (m_scale + std::fabs(std::isinf(m_value)? 0 : m_value)));
-    }
+    TestSpec const& Config::testSpec() const { return m_testSpec; }
+    bool Config::hasTestFilters() const { return m_hasTestFilters; }
 
-    void Approx::setMargin(double newMargin) {
-        CATCH_ENFORCE(newMargin >= 0,
-            "Invalid Approx::margin: " << newMargin << '.'
-            << " Approx::Margin has to be non-negative.");
-        m_margin = newMargin;
+    // IConfig interface
+    bool Config::allowThrows() const                   { return !m_data.noThrow; }
+    StringRef Config::name() const { return m_data.name.empty() ? m_data.processName : m_data.name; }
+    bool Config::includeSuccessfulResults() const      { return m_data.showSuccessfulTests; }
+    bool Config::warnAboutMissingAssertions() const {
+        return !!( m_data.warnings & WarnAbout::NoAssertions );
     }
-
-    void Approx::setEpsilon(double newEpsilon) {
-        CATCH_ENFORCE(newEpsilon >= 0 && newEpsilon <= 1.0,
-            "Invalid Approx::epsilon: " << newEpsilon << '.'
-            << " Approx::epsilon has to be in [0, 1]");
-        m_epsilon = newEpsilon;
+    bool Config::warnAboutUnmatchedTestSpecs() const {
+        return !!( m_data.warnings & WarnAbout::UnmatchedTestSpec );
     }
-
-namespace literals {
-    Approx operator ""_a(long double val) {
-        return Approx(val);
-    }
-    Approx operator ""_a(unsigned long long val) {
-        return Approx(val);
+    bool Config::warnAboutInfiniteGenerators() const {
+        return !!( m_data.warnings & WarnAbout::InfiniteGenerator );
     }
-} // end namespace literals
+    bool Config::zeroTestsCountAsSuccess() const       { return m_data.allowZeroTests; }
+    ShowDurations Config::showDurations() const        { return m_data.showDurations; }
+    double Config::minDuration() const                 { return m_data.minDuration; }
+    TestRunOrder Config::runOrder() const              { return m_data.runOrder; }
+    uint32_t Config::rngSeed() const                   { return m_data.rngSeed; }
+    bool Config::rngSeedWasFixed() const               { return m_data.rngSeedWasFixed; }
+    unsigned int Config::shardCount() const            { return m_data.shardCount; }
+    unsigned int Config::shardIndex() const            { return m_data.shardIndex; }
+    ColourMode Config::defaultColourMode() const       { return m_data.defaultColourMode; }
+    bool Config::shouldDebugBreak() const              { return m_data.shouldDebugBreak; }
+    int Config::abortAfter() const                     { return m_data.abortAfter; }
+    bool Config::showInvisibles() const                { return m_data.showInvisibles; }
+    Verbosity Config::verbosity() const                { return m_data.verbosity; }
 
-std::string StringMaker<Catch::Approx>::convert(Catch::Approx const& value) {
-    return value.toString();
-}
+    bool Config::skipBenchmarks() const                           { return m_data.skipBenchmarks; }
+    bool Config::benchmarkNoAnalysis() const                      { return m_data.benchmarkNoAnalysis; }
+    unsigned int Config::benchmarkSamples() const                 { return m_data.benchmarkSamples; }
+    double Config::benchmarkConfidenceInterval() const            { return m_data.benchmarkConfidenceInterval; }
+    unsigned int Config::benchmarkResamples() const               { return m_data.benchmarkResamples; }
+    std::chrono::milliseconds Config::benchmarkWarmupTime() const { return std::chrono::milliseconds(m_data.benchmarkWarmupTime); }
 
 } // end namespace Catch
 
 
+#include <ostream>
 
 namespace Catch {
 
-    AssertionResultData::AssertionResultData(ResultWas::OfType _resultType, LazyExpression const& _lazyExpression):
-        lazyExpression(_lazyExpression),
-        resultType(_resultType) {}
-
-    std::string AssertionResultData::reconstructExpression() const {
+    Version::Version
+        (   unsigned int _majorVersion,
+            unsigned int _minorVersion,
+            unsigned int _patchNumber,
+            char const * const _branchName,
+            unsigned int _buildNumber )
+    :   majorVersion( _majorVersion ),
+        minorVersion( _minorVersion ),
+        patchNumber( _patchNumber ),
+        branchName( _branchName ),
+        buildNumber( _buildNumber )
+    {}
 
-        if( reconstructedExpression.empty() ) {
-            if( lazyExpression ) {
-                ReusableStringStream rss;
-                rss << lazyExpression;
-                reconstructedExpression = rss.str();
-            }
+    std::ostream& operator << ( std::ostream& os, Version const& version ) {
+        os  << version.majorVersion << '.'
+            << version.minorVersion << '.'
+            << version.patchNumber;
+        // branchName is never null -> 0th char is \0 if it is empty
+        if (version.branchName[0]) {
+            os << '-' << version.branchName
+               << '.' << version.buildNumber;
         }
-        return reconstructedExpression;
+        return os;
     }
 
-    AssertionResult::AssertionResult( AssertionInfo const& info, AssertionResultData&& data )
-    :   m_info( info ),
-        m_resultData( CATCH_MOVE(data) )
-    {}
-
-    // Result was a success
-    bool AssertionResult::succeeded() const {
-        return Catch::isOk( m_resultData.resultType );
+    Version const& libraryVersion() {
+        static Version version( 3, 16, 1, "", 0 );
+        return version;
     }
 
-    // Result was a success, or failure is suppressed
-    bool AssertionResult::isOk() const {
-        return Catch::isOk( m_resultData.resultType ) || shouldSuppressFailure( m_info.resultDisposition );
-    }
+}
 
-    ResultWas::OfType AssertionResult::getResultType() const {
-        return m_resultData.resultType;
-    }
 
-    bool AssertionResult::hasExpression() const {
-        return !m_info.capturedExpression.empty();
-    }
 
-    bool AssertionResult::hasMessage() const {
-        return !m_resultData.message.empty();
-    }
 
-    std::string AssertionResult::getExpression() const {
-        // Possibly overallocating by 3 characters should be basically free
-        std::string expr; expr.reserve(m_info.capturedExpression.size() + 3);
-        if (isFalseTest(m_info.resultDisposition)) {
-            expr += "!(";
-        }
-        expr += m_info.capturedExpression;
-        if (isFalseTest(m_info.resultDisposition)) {
-            expr += ')';
-        }
-        return expr;
-    }
+namespace Catch {
 
-    std::string AssertionResult::getExpressionInMacro() const {
-        if ( m_info.macroName.empty() ) {
-            return static_cast<std::string>( m_info.capturedExpression );
-        }
-        std::string expr;
-        expr.reserve( m_info.macroName.size() + m_info.capturedExpression.size() + 4 );
-        expr += m_info.macroName;
-        expr += "( ";
-        expr += m_info.capturedExpression;
-        expr += " )";
-        return expr;
+    const char* GeneratorException::what() const noexcept {
+        return m_msg;
     }
 
-    bool AssertionResult::hasExpandedExpression() const {
-        return hasExpression() && getExpandedExpression() != getExpression();
-    }
+} // end namespace Catch
 
-    std::string AssertionResult::getExpandedExpression() const {
-        std::string expr = m_resultData.reconstructExpression();
-        return expr.empty()
-                ? getExpression()
-                : expr;
-    }
 
-    StringRef AssertionResult::getMessage() const {
-        return m_resultData.message;
-    }
-    SourceLineInfo AssertionResult::getSourceInfo() const {
-        return m_info.lineInfo;
+
+
+namespace Catch {
+
+    IGeneratorTracker::~IGeneratorTracker() = default;
+
+namespace Generators {
+
+    GeneratorUntypedBase::~GeneratorUntypedBase() = default;
+
+    IGeneratorTracker* acquireGeneratorTracker(StringRef generatorName, SourceLineInfo const& lineInfo ) {
+        return getResultCapture().acquireGeneratorTracker( generatorName, lineInfo );
     }
 
-    StringRef AssertionResult::getTestMacroName() const {
-        return m_info.macroName;
+    IGeneratorTracker* createGeneratorTracker( StringRef generatorName,
+                                 SourceLineInfo lineInfo,
+                                 GeneratorBasePtr&& generator ) {
+        return getResultCapture().createGeneratorTracker(
+            generatorName, lineInfo, CATCH_MOVE( generator ) );
     }
 
-} // end namespace Catch
+} // namespace Generators
+} // namespace Catch
+
 
 
 
+#include <random>
+
 namespace Catch {
+    namespace Generators {
+        namespace Detail {
+            std::uint32_t getSeed() { return sharedRng()(); }
+        } // namespace Detail
 
-    bool operator==( PathFilter const& lhs, PathFilter const& rhs ) {
-        return lhs.type == rhs.type && lhs.filter == rhs.filter;
-    }
+        struct RandomFloatingGenerator<long double>::PImpl {
+            PImpl( long double a, long double b, uint32_t seed ):
+                rng( seed ), dist( a, b ) {}
 
-    Config::Config( ConfigData const& data ):
-        m_data( data ) {
-        // We need to trim filter specs to avoid trouble with superfluous
-        // whitespace (esp. important for bdd macros, as those are manually
-        // aligned with whitespace).
-        for (auto& elem : m_data.testsOrTags) {
-            elem = trim(elem);
+            Catch::SimplePcg32 rng;
+            std::uniform_real_distribution<long double> dist;
+        };
+
+        RandomFloatingGenerator<long double>::RandomFloatingGenerator(
+            long double a, long double b, std::uint32_t seed) :
+            m_pimpl(Catch::Detail::make_unique<PImpl>(a, b, seed)) {
+            static_cast<void>( next() );
         }
 
-        TestSpecParser parser( ITagAliasRegistry::get() );
-        if ( !m_data.testsOrTags.empty() ) {
-            m_hasTestFilters = true;
-            for ( auto const& testOrTags : m_data.testsOrTags ) {
-                parser.parse( testOrTags );
-            }
+        RandomFloatingGenerator<long double>::~RandomFloatingGenerator() =
+            default;
+        bool RandomFloatingGenerator<long double>::next() {
+            m_current_number = m_pimpl->dist( m_pimpl->rng );
+            return true;
         }
-        m_testSpec = parser.testSpec();
-    }
 
-    Config::~Config() = default;
+        bool RandomFloatingGenerator<long double>::isFinite() const {
+            return false;
+        }
 
-    std::vector<std::string> const& Config::getTestsOrTags() const { return m_data.testsOrTags; }
-    std::vector<PathFilter> const& Config::getPathFilters() const { return m_data.pathFilters; }
-    bool Config::useNewFilterBehaviour() const { return m_data.useNewPathFilteringBehaviour; }
+    } // namespace Generators
+} // namespace Catch
 
-    TestSpec const& Config::testSpec() const { return m_testSpec; }
-    bool Config::hasTestFilters() const { return m_hasTestFilters; }
 
-    // IConfig interface
-    bool Config::allowThrows() const                   { return !m_data.noThrow; }
-    StringRef Config::name() const { return m_data.name.empty() ? m_data.processName : m_data.name; }
-    bool Config::includeSuccessfulResults() const      { return m_data.showSuccessfulTests; }
-    bool Config::warnAboutMissingAssertions() const {
-        return !!( m_data.warnings & WarnAbout::NoAssertions );
-    }
-    bool Config::warnAboutUnmatchedTestSpecs() const {
-        return !!( m_data.warnings & WarnAbout::UnmatchedTestSpec );
-    }
-    bool Config::warnAboutInfiniteGenerators() const {
-        return !!( m_data.warnings & WarnAbout::InfiniteGenerator );
-    }
-    bool Config::zeroTestsCountAsSuccess() const       { return m_data.allowZeroTests; }
-    ShowDurations Config::showDurations() const        { return m_data.showDurations; }
-    double Config::minDuration() const                 { return m_data.minDuration; }
-    TestRunOrder Config::runOrder() const              { return m_data.runOrder; }
-    uint32_t Config::rngSeed() const                   { return m_data.rngSeed; }
-    bool Config::rngSeedWasFixed() const               { return m_data.rngSeedWasFixed; }
-    unsigned int Config::shardCount() const            { return m_data.shardCount; }
-    unsigned int Config::shardIndex() const            { return m_data.shardIndex; }
-    ColourMode Config::defaultColourMode() const       { return m_data.defaultColourMode; }
-    bool Config::shouldDebugBreak() const              { return m_data.shouldDebugBreak; }
-    int Config::abortAfter() const                     { return m_data.abortAfter; }
-    bool Config::showInvisibles() const                { return m_data.showInvisibles; }
-    Verbosity Config::verbosity() const                { return m_data.verbosity; }
 
-    bool Config::skipBenchmarks() const                           { return m_data.skipBenchmarks; }
-    bool Config::benchmarkNoAnalysis() const                      { return m_data.benchmarkNoAnalysis; }
-    unsigned int Config::benchmarkSamples() const                 { return m_data.benchmarkSamples; }
-    double Config::benchmarkConfidenceInterval() const            { return m_data.benchmarkConfidenceInterval; }
-    unsigned int Config::benchmarkResamples() const               { return m_data.benchmarkResamples; }
-    std::chrono::milliseconds Config::benchmarkWarmupTime() const { return std::chrono::milliseconds(m_data.benchmarkWarmupTime); }
 
-} // end namespace Catch
+namespace Catch {
+    namespace Generators {
+        namespace Detail {
+
+            [[noreturn]]
+            void throw_generator_exception( char const* msg ) {
+                Catch::throw_exception( GeneratorException{ msg } );
+            }
+
+        } // namespace Detail
+    } // namespace Generators
+} // namespace Catch
 
 
 
@@ -2974,5671 +3099,5543 @@ namespace Catch {
 
 
 
-#include <cassert>
-#include <stack>
-
 namespace Catch {
+    EventListenerFactory::~EventListenerFactory() = default;
+}
 
-    ////////////////////////////////////////////////////////////////////////////
 
 
-    ScopedMessage::ScopedMessage( MessageBuilder&& builder ):
-        m_messageId( builder.m_info.sequence ) {
-        MessageInfo info( CATCH_MOVE( builder.m_info ) );
-        info.message = builder.m_stream.str();
-        Detail::pushScopedMessage( CATCH_MOVE( info ) );
-    }
 
-    ScopedMessage::ScopedMessage( ScopedMessage&& old ) noexcept:
-        m_messageId( old.m_messageId ) {
-        old.m_moved = true;
-    }
+namespace Catch {
+    IConfig::~IConfig() = default;
+}
 
-    ScopedMessage::~ScopedMessage() {
-        if ( !m_moved ) { Detail::popScopedMessage( m_messageId ); }
-    }
 
 
-    Capturer::Capturer( StringRef macroName,
-                        SourceLineInfo const& lineInfo,
-                        ResultWas::OfType resultType,
-                        StringRef names,
-                        bool isScoped):
-        m_isScoped(isScoped) {
-        auto trimmed = [&] (size_t start, size_t end) {
-            while (names[start] == ',' || isspace(static_cast<unsigned char>(names[start]))) {
-                ++start;
-            }
-            while (names[end] == ',' || isspace(static_cast<unsigned char>(names[end]))) {
-                --end;
-            }
-            return names.substr(start, end - start + 1);
-        };
-        auto skipq = [&] (size_t start, char quote) {
-            for (auto i = start + 1; i < names.size() ; ++i) {
-                if (names[i] == quote)
-                    return i;
-                if (names[i] == '\\')
-                    ++i;
-            }
-            CATCH_INTERNAL_ERROR("CAPTURE parsing encountered unmatched quote");
-        };
+#include <cassert>
 
-        size_t start = 0;
-        std::stack<char> openings;
-        for (size_t pos = 0; pos < names.size(); ++pos) {
-            char c = names[pos];
-            switch (c) {
-            case '[':
-            case '{':
-            case '(':
-            // It is basically impossible to disambiguate between
-            // comparison and start of template args in this context
-//            case '<':
-                openings.push(c);
-                break;
-            case ']':
-            case '}':
-            case ')':
-//           case '>':
-                openings.pop();
-                break;
-            case '"':
-            case '\'':
-                pos = skipq(pos, c);
-                break;
-            case ',':
-                if (start != pos && openings.empty()) {
-                    m_messages.emplace_back(macroName, lineInfo, resultType);
-                    m_messages.back().message += trimmed(start, pos);
-                    m_messages.back().message += " := "_sr;
-                    start = pos;
-                }
-                break;
-            default:; // noop
-            }
-        }
-        assert(openings.empty() && "Mismatched openings");
-        m_messages.emplace_back(macroName, lineInfo, resultType);
-        m_messages.back().message += trimmed(start, names.size() - 1);
-        m_messages.back().message += " := "_sr;
-    }
-    Capturer::~Capturer() {
-        assert( m_captured == m_messages.size() );
-        if ( m_isScoped ) {
-            for ( auto const& message : m_messages ) {
-                Detail::popScopedMessage( message.sequence );
-            }
-        }
-    }
+namespace Catch {
 
-    void Capturer::captureValue( size_t index, std::string const& value ) {
-        assert( index < m_messages.size() );
-        m_messages[index].message += value;
-        if ( m_isScoped ) {
-            Detail::pushScopedMessage( CATCH_MOVE( m_messages[index] ) );
-        } else {
-            Detail::addUnscopedMessage( CATCH_MOVE( m_messages[index] ) );
+    AssertionStats::AssertionStats( AssertionResult const& _assertionResult,
+                                    std::vector<MessageInfo> const& _infoMessages,
+                                    Totals const& _totals )
+    :   assertionResult( _assertionResult ),
+        infoMessages( _infoMessages ),
+        totals( _totals )
+    {
+        if( assertionResult.hasMessage() ) {
+            // Copy message into messages list.
+            // !TBD This should have been done earlier, somewhere
+            MessageBuilder builder( assertionResult.getTestMacroName(), assertionResult.getSourceInfo(), assertionResult.getResultType() );
+            builder.m_info.message = static_cast<std::string>(assertionResult.getMessage());
+
+            infoMessages.push_back( CATCH_MOVE(builder.m_info) );
         }
-        m_captured++;
     }
 
-} // end namespace Catch
+    SectionStats::SectionStats(  SectionInfo&& _sectionInfo,
+                                 Counts const& _assertions,
+                                 double _durationInSeconds,
+                                 bool _missingAssertions )
+    :   sectionInfo( CATCH_MOVE(_sectionInfo) ),
+        assertions( _assertions ),
+        durationInSeconds( _durationInSeconds ),
+        missingAssertions( _missingAssertions )
+    {}
+
+
+    TestCaseStats::TestCaseStats(  TestCaseInfo const& _testInfo,
+                                   Totals const& _totals,
+                                   std::string&& _stdOut,
+                                   std::string&& _stdErr,
+                                   bool _aborting )
+    : testInfo( &_testInfo ),
+        totals( _totals ),
+        stdOut( CATCH_MOVE(_stdOut) ),
+        stdErr( CATCH_MOVE(_stdErr) ),
+        aborting( _aborting )
+    {}
 
 
+    TestRunStats::TestRunStats(   TestRunInfo const& _runInfo,
+                    Totals const& _totals,
+                    bool _aborting )
+    :   runInfo( _runInfo ),
+        totals( _totals ),
+        aborting( _aborting )
+    {}
+
+    IEventListener::~IEventListener() = default;
+
+} // end namespace Catch
+
 
 
-#include <exception>
 
 namespace Catch {
+    IExceptionTranslator::~IExceptionTranslator() = default;
+    IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() = default;
+}
 
-    namespace {
 
-        class RegistryHub : public IRegistryHub,
-                            public IMutableRegistryHub,
-                            private Detail::NonCopyable {
 
-        public: // IRegistryHub
-            RegistryHub() = default;
-            ReporterRegistry const& getReporterRegistry() const override {
-                return m_reporterRegistry;
-            }
-            ITestCaseRegistry const& getTestCaseRegistry() const override {
-                return m_testCaseRegistry;
-            }
-            IExceptionTranslatorRegistry const& getExceptionTranslatorRegistry() const override {
-                return m_exceptionTranslatorRegistry;
-            }
-            ITagAliasRegistry const& getTagAliasRegistry() const override {
-                return m_tagAliasRegistry;
-            }
-            StartupExceptionRegistry const& getStartupExceptionRegistry() const override {
-                return m_exceptionRegistry;
-            }
 
-        public: // IMutableRegistryHub
-            void registerListener( Detail::unique_ptr<EventListenerFactory> factory ) override {
-                m_reporterRegistry.registerListener( CATCH_MOVE(factory) );
-            }
-            void registerTest( Detail::unique_ptr<TestCaseInfo>&& testInfo, Detail::unique_ptr<ITestInvoker>&& invoker ) override {
-                m_testCaseRegistry.registerTest( CATCH_MOVE(testInfo), CATCH_MOVE(invoker) );
-            }
-            void registerTranslator( Detail::unique_ptr<IExceptionTranslator>&& translator ) override {
-                m_exceptionTranslatorRegistry.registerTranslator( CATCH_MOVE(translator) );
-            }
-            void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) override {
-                m_tagAliasRegistry.add( alias, tag, lineInfo );
-            }
-            void registerStartupException() noexcept override {
-#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
-                m_exceptionRegistry.add(std::current_exception());
-#else
-                CATCH_INTERNAL_ERROR("Attempted to register active exception under CATCH_CONFIG_DISABLE_EXCEPTIONS!");
-#endif
+#include <string>
+
+namespace Catch {
+    namespace Generators {
+
+        bool GeneratorUntypedBase::countedNext() {
+            auto ret = next();
+            if ( ret ) {
+                m_stringReprCache.clear();
+                ++m_currentElementIndex;
             }
+            return ret;
+        }
 
-            ITestCaseRegistry& getMutableTestCaseRegistry() override {
-                return m_testCaseRegistry;
+        void GeneratorUntypedBase::skipToNthElementImpl( std::size_t n ) {
+            for ( size_t i = m_currentElementIndex; i < n; ++i ) {
+                bool isValid = next();
+                if ( !isValid ) {
+                    Detail::throw_generator_exception(
+                        "Could not jump to Nth element: not enough elements" );
+                }
             }
+        }
 
-        private:
-            TestRegistry m_testCaseRegistry;
-            ReporterRegistry m_reporterRegistry;
-            ExceptionTranslatorRegistry m_exceptionTranslatorRegistry;
-            TagAliasRegistry m_tagAliasRegistry;
-            StartupExceptionRegistry m_exceptionRegistry;
-        };
-    }
+        void GeneratorUntypedBase::skipToNthElement( std::size_t n ) {
+            if ( n < m_currentElementIndex ) {
+                Detail::throw_generator_exception(
+                    "Tried to jump generator backwards" );
+            }
+            if ( n == m_currentElementIndex ) { return; }
 
-    using RegistryHubSingleton = Singleton<RegistryHub, IRegistryHub, IMutableRegistryHub>;
+            skipToNthElementImpl(n);
+            // Fixup tracking after moving the generator forward
+            //  * Ensure that the correct element index is set after skipping
+            //  * Invalidate cache
+            m_currentElementIndex = n;
+            m_stringReprCache.clear();
+        }
 
-    IRegistryHub const& getRegistryHub() {
-        return RegistryHubSingleton::get();
-    }
-    IMutableRegistryHub& getMutableRegistryHub() {
-        return RegistryHubSingleton::getMutable();
-    }
-    void cleanUp() {
-        cleanupSingletons();
-    }
-    std::string translateActiveException() {
-        return getRegistryHub().getExceptionTranslatorRegistry().translateActiveException();
-    }
+        StringRef GeneratorUntypedBase::currentElementAsString() const {
+            if ( m_stringReprCache.empty() ) {
+                m_stringReprCache = stringifyImpl();
+            }
+            return m_stringReprCache;
+        }
 
+        bool GeneratorUntypedBase::isFinite() const { return true; }
 
-} // end namespace Catch
+    } // namespace Generators
+} // namespace Catch
 
 
 
 
 namespace Catch {
+    IRegistryHub::~IRegistryHub() = default;
+    IMutableRegistryHub::~IMutableRegistryHub() = default;
+}
 
-    Session::Session() {
-        static bool alreadyInstantiated = false;
-        if( alreadyInstantiated ) {
-            CATCH_TRY { CATCH_INTERNAL_ERROR( "Only one instance of Catch::Session can ever be used" ); }
-            CATCH_CATCH_ALL { getMutableRegistryHub().registerStartupException(); }
+
+
+
+namespace Catch {
+    namespace Detail {
+        void missingCaptureInstance() {
+            CATCH_INTERNAL_ERROR( "No result capture instance" );
         }
-        alreadyInstantiated = true;
+    } // namespace Detail
+
+    IResultCapture::~IResultCapture() = default;
+} // namespace Catch
+
+
+
+
+namespace Catch {
+    ITestCaseRegistry::~ITestCaseRegistry() = default;
+}
+
+
+
+namespace Catch {
+
+    void AssertionHandler::finishIncomplete() {
+        m_resultCapture.handleIncomplete( m_assertionInfo );
     }
-    Session::~Session() {
-        Catch::cleanUp();
+
+    AssertionHandler::AssertionHandler
+        (   StringRef macroName,
+            SourceLineInfo const& lineInfo,
+            StringRef capturedExpression,
+            ResultDisposition::Flags resultDisposition )
+    :   m_assertionInfo{ macroName, lineInfo, capturedExpression, resultDisposition },
+        m_resultCapture( static_cast<RunContext&>(getResultCapture()) )
+    {
+        m_resultCapture.notifyAssertionStarted( m_assertionInfo );
     }
 
-    void Session::showHelp() const {
-        Progmasoft::Catch3::PrintHelp( m_arguments.empty() ? std::string( "tests" )
-                                                           : m_arguments.front() );
+    void AssertionHandler::handleExpr( ITransientExpression const& expr ) {
+        m_resultCapture.handleExpr( m_assertionInfo, expr, m_reaction );
+    }
+    void AssertionHandler::handleMessage(ResultWas::OfType resultType, std::string&& message) {
+        m_resultCapture.handleMessage( m_assertionInfo, resultType, CATCH_MOVE(message), m_reaction );
     }
 
-    int Session::applyCommandLine( int argc, char const * const * argv ) {
-        m_arguments.assign( argv, argv + argc );
-        return 0;
+    auto AssertionHandler::allowThrows() const -> bool {
+        return getCurrentContext().getConfig()->allowThrows();
     }
 
-#if defined(CATCH_CONFIG_WCHAR) && defined(_WIN32) && defined(UNICODE)
-    int Session::applyCommandLine( int argc, wchar_t const * const * argv ) {
-        m_arguments.clear();
-        for ( int i = 0; i < argc; ++i ) {
-            int bufSize = WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, nullptr, 0, nullptr, nullptr );
-            std::string utf8( static_cast<std::size_t>( bufSize ), '\0' );
-            WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, &utf8[0], bufSize, nullptr, nullptr );
-            if ( !utf8.empty() ) { utf8.pop_back(); } // the terminator
-            m_arguments.push_back( utf8 );
+    void AssertionHandler::complete() {
+        m_completed = true;
+        if( m_reaction.shouldDebugBreak ) {
+
+            // If you find your debugger stopping you here then go one level up on the
+            // call-stack for the code that caused it (typically a failed assertion)
+
+            // (To go back to the test and change execution, jump over the throw, next)
+            CATCH_BREAK_INTO_DEBUGGER();
+        }
+        if (m_reaction.shouldThrow) {
+            throw_test_failure_exception();
+        }
+        if ( m_reaction.shouldSkip ) {
+            throw_test_skip_exception();
         }
-        return 0;
     }
-#endif
 
-    int Session::run() {
-        return Progmasoft::Catch3::RunTests( m_arguments );
+    void AssertionHandler::handleUnexpectedInflightException() noexcept {
+        m_resultCapture.handleUnexpectedInflightException( m_assertionInfo, Catch::translateActiveException(), m_reaction );
     }
 
-} // end namespace Catch
-
-
+    void AssertionHandler::handleExceptionThrownAsExpected() {
+        m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction);
+    }
+    void AssertionHandler::handleExceptionNotThrownAsExpected() {
+        m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction);
+    }
 
+    void AssertionHandler::handleUnexpectedExceptionNotThrown() {
+        m_resultCapture.handleUnexpectedExceptionNotThrown( m_assertionInfo, m_reaction );
+    }
 
-namespace Catch {
+    void AssertionHandler::handleThrowingCallSkipped() {
+        m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction);
+    }
 
-    RegistrarForTagAliases::RegistrarForTagAliases(char const* alias, char const* tag, SourceLineInfo const& lineInfo) {
-        CATCH_TRY {
-            getMutableRegistryHub().registerTagAlias(alias, tag, lineInfo);
-        } CATCH_CATCH_ALL {
-            // Do not throw when constructing global objects, instead register the exception to be processed later
-            getMutableRegistryHub().registerStartupException();
-        }
+    // This is the overload that takes a string and infers the Equals matcher from it
+    // The more general overload, that takes any string matcher, is in catch_capture_matchers.cpp
+    void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str ) {
+        handleExceptionMatchExpr( handler, Matchers::Equals( str ) );
     }
 
-}
+} // namespace Catch
+
 
 
 
-#include <cassert>
-#include <cctype>
 #include <algorithm>
-#include <utility>
 
 namespace Catch {
+    namespace Detail {
 
-    namespace {
-        using TCP_underlying_type = uint8_t;
-        static_assert(sizeof(TestCaseProperties) == sizeof(TCP_underlying_type),
-                      "The size of the TestCaseProperties is different from the assumed size");
-
-        constexpr TestCaseProperties operator|(TestCaseProperties lhs, TestCaseProperties rhs) {
-            return static_cast<TestCaseProperties>(
-                static_cast<TCP_underlying_type>(lhs) | static_cast<TCP_underlying_type>(rhs)
-            );
-        }
-
-        constexpr TestCaseProperties& operator|=(TestCaseProperties& lhs, TestCaseProperties rhs) {
-            lhs = static_cast<TestCaseProperties>(
-                static_cast<TCP_underlying_type>(lhs) | static_cast<TCP_underlying_type>(rhs)
-            );
-            return lhs;
+        bool CaseInsensitiveLess::operator()( StringRef lhs,
+                                              StringRef rhs ) const {
+            return std::lexicographical_compare(
+                lhs.begin(), lhs.end(),
+                rhs.begin(), rhs.end(),
+                []( char l, char r ) { return toLower( l ) < toLower( r ); } );
         }
 
-        constexpr TestCaseProperties operator&(TestCaseProperties lhs, TestCaseProperties rhs) {
-            return static_cast<TestCaseProperties>(
-                static_cast<TCP_underlying_type>(lhs) & static_cast<TCP_underlying_type>(rhs)
-            );
+        bool
+        CaseInsensitiveEqualTo::operator()( StringRef lhs,
+                                            StringRef rhs ) const {
+            return std::equal(
+                lhs.begin(), lhs.end(),
+                rhs.begin(), rhs.end(),
+                []( char l, char r ) { return toLower( l ) == toLower( r ); } );
         }
 
-        constexpr bool applies(TestCaseProperties tcp) {
-            static_assert(static_cast<TCP_underlying_type>(TestCaseProperties::None) == 0,
-                          "TestCaseProperties::None must be equal to 0");
-            return tcp != TestCaseProperties::None;
-        }
+    } // namespace Detail
+} // namespace Catch
 
-        bool isRunnerTagWithValue( StringRef tag ) {
-            for ( StringRef prefix : { "!resource:"_sr, "!depends:"_sr,
-                                       "!timeout:"_sr, "!retries:"_sr } ) {
-                if ( tag.size() >= prefix.size() &&
-                     tag.substr( 0, prefix.size() ) == prefix ) {
-                    return true;
-                }
-            }
-            return false;
-        }
 
-        TestCaseProperties propertiesFromTag( StringRef tag, SourceLineInfo const& _lineInfo ) {
-            if ( tag.empty() ) { return TestCaseProperties::None; }
-            // All tags starting with alphanumeric characters are normal.
-            if ( std::isalnum( tag[0] ) ) { return TestCaseProperties::None; }
 
-            // Explicitly check known special tags, and error out if it is not one of them
-            if ( tag[0] == '.' ) { return TestCaseProperties::IsHidden; }
-            else if ( tag == "!throws"_sr ) { return TestCaseProperties::Throws; }
-            else if ( tag == "!shouldfail"_sr ) { return TestCaseProperties::ShouldFail; }
-            else if ( tag == "!mayfail"_sr ) { return TestCaseProperties::MayFail; }
-            else if ( tag == "!nonportable"_sr ) { return TestCaseProperties::NonPortable; }
-            else if ( tag == "!benchmark"_sr ) {
-                return TestCaseProperties::Benchmark |
-                       TestCaseProperties::IsHidden;
-            }
-            // Read by the Catch3 runner: scheduling, limits and quarantine.
-            else if ( tag == "!serial"_sr || tag == "!isolated"_sr ||
-                      tag == "!quarantine"_sr ) {
-                return TestCaseProperties::None;
-            } else if ( isRunnerTagWithValue( tag ) ) {
-                CATCH_ENFORCE( tag[tag.size() - 1] != ':',
-                               "Tag name: [" << tag << "] needs a value after ':'\n"
-                                             << _lineInfo );
-                return TestCaseProperties::None;
-            } else {
-                CATCH_RUNTIME_ERROR(
-                    "Tag name: [" << tag << "] is not allowed.\n"
-                                  << "Tag names starting with non-alphanumeric "
-                                     "characters are reserved.\n"
-                                  << _lineInfo );
-            }
-        }
+namespace Catch {
 
-        std::string makeDefaultName() {
-            static size_t counter = 0;
-            return "Anonymous test case " + std::to_string(++counter);
-        }
+    Context Context::currentContext;
 
-        constexpr StringRef extractFilenamePart(StringRef filename) {
-            size_t lastDot = filename.size();
-            while (lastDot > 0 && filename[lastDot - 1] != '.') {
-                --lastDot;
-            }
-            // In theory we could have filename without any extension in it
-            if ( lastDot == 0 ) { return StringRef(); }
+    Context& getCurrentMutableContext() {
+        return Context::currentContext;
+    }
 
-            --lastDot;
-            size_t nameStart = lastDot;
-            while (nameStart > 0 && filename[nameStart - 1] != '/' && filename[nameStart - 1] != '\\') {
-                --nameStart;
-            }
+    SimplePcg32& sharedRng() {
+        static SimplePcg32 s_rng;
+        return s_rng;
+    }
 
-            return filename.substr(nameStart, lastDot - nameStart);
-        }
+}
 
-        // Returns the upper bound on size of extra tags ([#file]+[.])
-        constexpr size_t sizeOfExtraTags(StringRef filepath) {
-            // [.] is 3, [#] is another 3
-            const size_t extras = 3 + 3;
-            return extractFilenamePart(filepath).size() + extras;
-        }
-    } // end unnamed namespace
 
-    bool operator<(  Tag const& lhs, Tag const& rhs ) {
-        Detail::CaseInsensitiveLess cmp;
-        return cmp( lhs.original, rhs.original );
-    }
-    bool operator==( Tag const& lhs, Tag const& rhs ) {
-        Detail::CaseInsensitiveEqualTo cmp;
-        return cmp( lhs.original, rhs.original );
-    }
 
-    Detail::unique_ptr<TestCaseInfo>
-        makeTestCaseInfo(StringRef _className,
-                         NameAndTags const& nameAndTags,
-                         SourceLineInfo const& _lineInfo ) {
-        return Detail::make_unique<TestCaseInfo>(_className, nameAndTags, _lineInfo);
-    }
+#if defined(CATCH_PLATFORM_MAC) || defined(CATCH_PLATFORM_IPHONE)
 
-    TestCaseInfo::TestCaseInfo(StringRef _className,
-                               NameAndTags const& _nameAndTags,
-                               SourceLineInfo const& _lineInfo):
-        name( _nameAndTags.name.empty() ? makeDefaultName() : _nameAndTags.name ),
-        className( _className ),
-        lineInfo( _lineInfo )
-    {
-        StringRef originalTags = _nameAndTags.tags;
-        // We need to reserve enough space to store all of the tags
-        // (including optional hidden tag and filename tag)
-        auto requiredSize = originalTags.size() + sizeOfExtraTags(_lineInfo.file);
-        backingTags.reserve(requiredSize);
-
-        // Since there is usually only small number of tags on a test case,
-        // the geometric growth on vector does not get time to properly
-        // amortize the reallocations. But we can save a lot of time by
-        // pre-allocating space for all tags.
-        if ( !originalTags.empty() ) {
-            size_t tagCount = 1; // 1 for filename tag
-            for ( size_t i = 0; i < originalTags.size(); ++i ) {
-                if ( originalTags[i] == '[' ) { ++tagCount; }
-            }
-            tags.reserve( tagCount );
-        }
-
-        // We cannot copy the tags directly, as we need to normalize
-        // some tags, so that [.foo] is copied as [.][foo].
-        size_t tagStart = 0;
-        size_t tagEnd = 0;
-        bool inTag = false;
-        for (size_t idx = 0; idx < originalTags.size(); ++idx) {
-            auto c = originalTags[idx];
-            if (c == '[') {
-                CATCH_ENFORCE(
-                    !inTag,
-                    "Found '[' inside a tag while registering test case '"
-                        << _nameAndTags.name << "' at " << _lineInfo );
+#  include <cassert>
+#  include <sys/types.h>
+#  include <unistd.h>
+#  include <cstddef>
+#  include <ostream>
 
-                inTag = true;
-                tagStart = idx;
-            }
-            if (c == ']') {
-                CATCH_ENFORCE(
-                    inTag,
-                    "Found unmatched ']' while registering test case '"
-                        << _nameAndTags.name << "' at " << _lineInfo );
+#ifdef __apple_build_version__
+    // These headers will only compile with AppleClang (XCode)
+    // For other compilers (Clang, GCC, ... ) we need to exclude them
+#  include <sys/sysctl.h>
+#endif
 
-                inTag = false;
-                tagEnd = idx;
-                assert(tagStart < tagEnd);
+    namespace Catch {
+        #ifdef __apple_build_version__
+        // The following function is taken directly from the following technical note:
+        // https://developer.apple.com/library/archive/qa/qa1361/_index.html
 
-                // We need to check the tag for special meanings, copy
-                // it over to backing storage and actually reference the
-                // backing storage in the saved tags
-                StringRef tagStr = originalTags.substr(tagStart+1, tagEnd - tagStart - 1);
-                CATCH_ENFORCE( !tagStr.empty(),
-                               "Found an empty tag while registering test case '"
-                                   << _nameAndTags.name << "' at "
-                                   << _lineInfo );
+        // Returns true if the current process is being debugged (either
+        // running under the debugger or has a debugger attached post facto).
+        bool isDebuggerActive(){
+            int                 mib[4];
+            struct kinfo_proc   info;
+            std::size_t         size;
 
-                properties |= propertiesFromTag(tagStr, _lineInfo);
-                // When copying a tag to the backing storage, we need to
-                // check if it is a merged hide tag, such as [.foo], and
-                // if it is, we need to handle it as if it was [foo].
-                if (tagStr.size() > 1 && tagStr[0] == '.') {
-                    tagStr = tagStr.substr(1, tagStr.size() - 1);
-                }
-                // We skip over dealing with the [.] tag, as we will add
-                // it later unconditionally and then sort and unique all
-                // the tags.
-                internalAppendTag(tagStr);
-            }
-        }
-        CATCH_ENFORCE( !inTag,
-                       "Found an unclosed tag while registering test case '"
-                           << _nameAndTags.name << "' at " << _lineInfo );
+            // Initialize the flags so that, if sysctl fails for some bizarre
+            // reason, we get a predictable result.
 
+            info.kp_proc.p_flag = 0;
 
-        // Add [.] if relevant
-        if (isHidden()) {
-            internalAppendTag("."_sr);
-        }
+            // Initialize mib, which tells sysctl the info we want, in this case
+            // we're looking for information about a specific process ID.
 
-        // Tests usually have small number of tags, so we explicitly handle
-        // the 1 and 2 tags cases for better performance in low-opt builds.
-        switch ( tags.size() ) {
-        case 1:
-            break;
-        case 2:
-            if ( tags[0] == tags[1] ) { tags.pop_back(); }
-            else if ( tags[1] < tags[0] ) { std::swap( tags[0], tags[1] ); }
-            break;
-        default:
-            std::sort( begin( tags ), end( tags ) );
-            tags.erase( std::unique( begin( tags ), end( tags ) ),
-                        end( tags ) );
-        }
+            mib[0] = CTL_KERN;
+            mib[1] = KERN_PROC;
+            mib[2] = KERN_PROC_PID;
+            mib[3] = getpid();
 
-    }
+            // Call sysctl.
 
-    bool TestCaseInfo::isHidden() const {
-        return applies( properties & TestCaseProperties::IsHidden );
-    }
-    bool TestCaseInfo::throws() const {
-        return applies( properties & TestCaseProperties::Throws );
-    }
-    bool TestCaseInfo::okToFail() const {
-        return applies( properties & (TestCaseProperties::ShouldFail | TestCaseProperties::MayFail ) );
-    }
-    bool TestCaseInfo::expectedToFail() const {
-        return applies( properties & (TestCaseProperties::ShouldFail) );
-    }
+            size = sizeof(info);
+            if( sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, nullptr, 0) != 0 ) {
+                Catch::cerr() << "\n** Call to sysctl failed - unable to determine if debugger is active **\n\n" << std::flush;
+                return false;
+            }
 
-    void TestCaseInfo::addFilenameTag() {
-        std::string combined("#");
-        combined += extractFilenamePart(lineInfo.file);
-        internalAppendTag(combined);
-    }
+            // We're being debugged if the P_TRACED flag is set.
 
-    std::string TestCaseInfo::tagsAsString() const {
-        std::string ret;
-        // '[' and ']' per tag
-        std::size_t full_size = 2 * tags.size();
-        for (const auto& tag : tags) {
-            full_size += tag.original.size();
+            return ( (info.kp_proc.p_flag & P_TRACED) != 0 );
         }
-        ret.reserve(full_size);
-        for (const auto& tag : tags) {
-            ret.push_back('[');
-            ret += tag.original;
-            ret.push_back(']');
+        #else
+        bool isDebuggerActive() {
+            // We need to find another way to determine this for non-appleclang compilers on macOS
+            return false;
         }
+        #endif
+    } // namespace Catch
 
-        return ret;
-    }
+#elif defined(CATCH_PLATFORM_LINUX) || defined(CATCH_PLATFORM_QNX)
+    #include <fstream>
+    #include <string>
 
-    void TestCaseInfo::internalAppendTag(StringRef tagStr) {
-        backingTags += '[';
-        const auto backingStart = backingTags.size();
-        backingTags += tagStr;
-        const auto backingEnd = backingTags.size();
-        backingTags += ']';
-        tags.emplace_back(StringRef(backingTags.c_str() + backingStart, backingEnd - backingStart));
-    }
+    namespace Catch{
+        // The standard POSIX way of detecting a debugger is to attempt to
+        // ptrace() the process, but this needs to be done from a child and not
+        // this process itself to still allow attaching to this process later
+        // if wanted, so is rather heavy. Under Linux we have the PID of the
+        // "debugger" (which doesn't need to be gdb, of course, it could also
+        // be strace, for example) in /proc/$PID/status, so just get it from
+        // there instead.
+        bool isDebuggerActive(){
+            // Libstdc++ has a bug, where std::ifstream sets errno to 0
+            // This way our users can properly assert over errno values
+            ErrnoGuard guard;
+            std::ifstream in("/proc/self/status");
+            for( std::string line; std::getline(in, line); ) {
+                static const int PREFIX_LEN = 11;
+                if( line.compare(0, PREFIX_LEN, "TracerPid:\t") == 0 ) {
+                    // We're traced if the PID is not 0 and no other PID starts
+                    // with 0 digit, so it's enough to check for just a single
+                    // character.
+                    return line.length() > PREFIX_LEN && line[PREFIX_LEN] != '0';
+                }
+            }
 
-    bool operator<( TestCaseInfo const& lhs, TestCaseInfo const& rhs ) {
-        // We want to avoid redoing the string comparisons multiple times,
-        // so we store the result of a three-way comparison before using
-        // it in the actual comparison logic.
-        const auto cmpName = lhs.name.compare( rhs.name );
-        if ( cmpName != 0 ) {
-            return cmpName < 0;
+            return false;
         }
-        const auto cmpClassName = lhs.className.compare( rhs.className );
-        if ( cmpClassName != 0 ) {
-            return cmpClassName < 0;
+    } // namespace Catch
+#elif defined(_MSC_VER)
+    extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent();
+    namespace Catch {
+        bool isDebuggerActive() {
+            return IsDebuggerPresent() != 0;
         }
-        return lhs.tags < rhs.tags;
     }
-
-    bool operator==( TestCaseInfo const& lhs, TestCaseInfo const& rhs ) {
-        return lhs.name == rhs.name
-            && lhs.className == rhs.className
-            && lhs.tags == rhs.tags;
+#elif defined(__MINGW32__)
+    extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent();
+    namespace Catch {
+        bool isDebuggerActive() {
+            return IsDebuggerPresent() != 0;
+        }
     }
-
-} // end namespace Catch
+#else
+    namespace Catch {
+       bool isDebuggerActive() { return false; }
+    }
+#endif // Platform
 
 
 
-#include <algorithm>
-#include <string>
-#include <vector>
-#include <ostream>
 
 namespace Catch {
 
-    TestSpec::Pattern::Pattern( std::string const& name )
-    : m_name( name )
-    {}
+    void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ) {
+        if( lhs.size() + rhs.size() < 40 &&
+                lhs.find('\n') == std::string::npos &&
+                rhs.find('\n') == std::string::npos )
+            os << lhs << ' ' << op << ' ' << rhs;
+        else
+            os << lhs << '\n' << op << '\n' << rhs;
+    }
+}
 
-    TestSpec::Pattern::~Pattern() = default;
 
-    std::string const& TestSpec::Pattern::name() const {
-        return m_name;
-    }
 
+#include <stdexcept>
 
-    TestSpec::NamePattern::NamePattern( std::string const& name, std::string const& filterString )
-    : Pattern( filterString )
-    , m_wildcardPattern( name, CaseSensitive::No )
-    {}
 
-    bool TestSpec::NamePattern::matches( TestCaseInfo const& testCase ) const {
-        return m_wildcardPattern.matches( testCase.name );
+namespace Catch {
+#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER)
+    [[noreturn]]
+    void throw_exception(std::exception const& e) {
+        Catch::cerr() << "Catch will terminate because it needed to throw an exception.\n"
+                      << "The message was: " << e.what() << '\n';
+        std::terminate();
     }
+#endif
 
-    void TestSpec::NamePattern::serializeTo( std::ostream& out ) const {
-        out << '"' << name() << '"';
+    [[noreturn]]
+    void throw_logic_error(std::string const& msg) {
+        throw_exception(std::logic_error(msg));
     }
 
-
-    TestSpec::TagPattern::TagPattern( std::string const& tag, std::string const& filterString )
-    : Pattern( filterString )
-    , m_tag( tag )
-    {}
-
-    bool TestSpec::TagPattern::matches( TestCaseInfo const& testCase ) const {
-        return std::find( begin( testCase.tags ),
-                          end( testCase.tags ),
-                          Tag( m_tag ) ) != end( testCase.tags );
+    [[noreturn]]
+    void throw_domain_error(std::string const& msg) {
+        throw_exception(std::domain_error(msg));
     }
 
-    void TestSpec::TagPattern::serializeTo( std::ostream& out ) const {
-        out << name();
+    [[noreturn]]
+    void throw_runtime_error(std::string const& msg) {
+        throw_exception(std::runtime_error(msg));
     }
 
-    bool TestSpec::Filter::matches( TestCaseInfo const& testCase ) const {
-        bool should_use = !testCase.isHidden();
-        for (auto const& pattern : m_required) {
-            should_use = true;
-            if (!pattern->matches(testCase)) {
-                return false;
+
+
+} // namespace Catch;
+
+
+
+
+#include <cassert>
+
+namespace Catch {
+
+    namespace Detail {
+
+        namespace {
+            // Extracts the actual name part of an enum instance
+            // In other words, it returns the Blue part of Bikeshed::Colour::Blue
+            StringRef extractInstanceName(StringRef enumInstance) {
+                // Find last occurrence of ":"
+                size_t name_start = enumInstance.size();
+                while (name_start > 0 && enumInstance[name_start - 1] != ':') {
+                    --name_start;
+                }
+                return enumInstance.substr(name_start, enumInstance.size() - name_start);
             }
         }
-        for (auto const& pattern : m_forbidden) {
-            if (pattern->matches(testCase)) {
-                return false;
+
+        std::vector<StringRef> parseEnums( StringRef enums ) {
+            auto enumValues = splitStringRef( enums, ',' );
+            std::vector<StringRef> parsed;
+            parsed.reserve( enumValues.size() );
+            for( auto const& enumValue : enumValues ) {
+                parsed.push_back(trim(extractInstanceName(enumValue)));
             }
+            return parsed;
         }
-        return should_use;
-    }
 
-    void TestSpec::Filter::serializeTo( std::ostream& out ) const {
-        bool first = true;
-        for ( auto const& pattern : m_required ) {
-            if ( !first ) {
-                out << ' ';
+        StringRef EnumInfo::lookup( int64_t value ) const {
+            for( auto const& valueToName : m_values ) {
+                if( valueToName.first == value )
+                    return valueToName.second;
             }
-            out << *pattern;
-            first = false;
+            return "{** unexpected enum value **}"_sr;
         }
-        for ( auto const& pattern : m_forbidden ) {
-            if ( !first ) {
-                out << ' ';
+
+        EnumInfo makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector<int64_t> const& values ) {
+            EnumInfo enumInfo;
+            enumInfo.m_name = enumName;
+            enumInfo.m_values.reserve( values.size() );
+
+            const auto valueNames = Catch::Detail::parseEnums( allValueNames );
+            assert( valueNames.size() == values.size() );
+            for (size_t i = 0; i < values.size(); ++i) {
+                enumInfo.m_values.emplace_back( values[i], valueNames[i] );
             }
-            out << *pattern;
-            first = false;
-        }
-    }
 
+            return enumInfo;
+        }
 
-    std::string TestSpec::extractFilterName( Filter const& filter ) {
-        Catch::ReusableStringStream sstr;
-        sstr << filter;
-        return sstr.str();
-    }
+    } // Detail
+} // Catch
 
-    bool TestSpec::hasFilters() const {
-        return !m_filters.empty();
-    }
 
-    bool TestSpec::matches( TestCaseInfo const& testCase ) const {
-        return std::any_of( m_filters.begin(), m_filters.end(), [&]( Filter const& f ){ return f.matches( testCase ); } );
-    }
 
-    TestSpec::Matches TestSpec::matchesByFilter( std::vector<TestCaseHandle> const& testCases, IConfig const& config ) const {
-        Matches matches;
-        matches.reserve( m_filters.size() );
-        for ( auto const& filter : m_filters ) {
-            std::vector<TestCaseHandle const*> currentMatches;
-            for ( auto const& test : testCases ) {
-                if ( isThrowSafe( test, config ) &&
-                     filter.matches( test.getTestCaseInfo() ) ) {
-                    currentMatches.emplace_back( &test );
-                }
-            }
-            matches.push_back( FilterMatch{ extractFilterName( filter ),
-                                            CATCH_MOVE( currentMatches ) } );
-        }
-        return matches;
-    }
 
-    const TestSpec::vectorStrings& TestSpec::getInvalidSpecs() const {
-        return m_invalidSpecs;
-    }
 
-    void TestSpec::serializeTo( std::ostream& out ) const {
-        bool first = true;
-        for ( auto const& filter : m_filters ) {
-            if ( !first ) {
-                out << ',';
-            }
-            out << filter;
-            first = false;
-        }
-    }
+#include <cerrno>
 
+namespace Catch {
+        ErrnoGuard::ErrnoGuard():m_oldErrno(errno){}
+        ErrnoGuard::~ErrnoGuard() { errno = m_oldErrno; }
 }
 
 
 
-#include <chrono>
+#include <exception>
 
 namespace Catch {
 
+#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
     namespace {
-        static auto getCurrentNanosecondsSinceEpoch() -> uint64_t {
-            return std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::steady_clock::now().time_since_epoch()).count();
+        static std::string tryTranslators(
+            std::vector<
+                Detail::unique_ptr<IExceptionTranslator const>> const& translators ) {
+            if ( translators.empty() ) {
+                std::rethrow_exception( std::current_exception() );
+            } else {
+                return translators[0]->translate( translators.begin() + 1,
+                                                  translators.end() );
+            }
         }
-    } // end unnamed namespace
 
-    void Timer::start() {
-       m_nanoseconds = getCurrentNanosecondsSinceEpoch();
-    }
-    auto Timer::getElapsedNanoseconds() const -> uint64_t {
-        return getCurrentNanosecondsSinceEpoch() - m_nanoseconds;
     }
-    auto Timer::getElapsedMicroseconds() const -> uint64_t {
-        return getElapsedNanoseconds()/1000;
+#endif //!defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
+
+    ExceptionTranslatorRegistry::~ExceptionTranslatorRegistry() = default;
+
+    void ExceptionTranslatorRegistry::registerTranslator( Detail::unique_ptr<IExceptionTranslator>&& translator ) {
+        m_translators.push_back( CATCH_MOVE( translator ) );
     }
-    auto Timer::getElapsedMilliseconds() const -> unsigned int {
-        return static_cast<unsigned int>(getElapsedMicroseconds()/1000);
+
+#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
+    std::string ExceptionTranslatorRegistry::translateActiveException() const {
+        // Compiling a mixed mode project with MSVC means that CLR
+        // exceptions will be caught in (...) as well. However, these do
+        // do not fill-in std::current_exception and thus lead to crash
+        // when attempting rethrow.
+        // /EHa switch also causes structured exceptions to be caught
+        // here, but they fill-in current_exception properly, so
+        // at worst the output should be a little weird, instead of
+        // causing a crash.
+        if ( std::current_exception() == nullptr ) {
+            return "Non C++ exception. Possibly a CLR exception.";
+        }
+
+        // First we try user-registered translators. If none of them can
+        // handle the exception, it will be rethrown handled by our defaults.
+        try {
+            return tryTranslators(m_translators);
+        }
+        // To avoid having to handle TFE explicitly everywhere, we just
+        // rethrow it so that it goes back up the caller.
+        catch( TestFailureException& ) {
+            return "{ nested assertion failed }";
+        }
+        catch( TestSkipException& ) {
+            return "{ nested SKIP() called }";
+        }
+        catch( std::exception const& ex ) {
+            return ex.what();
+        }
+        catch( std::string const& msg ) {
+            return msg;
+        }
+        catch( const char* msg ) {
+            return msg;
+        }
+        catch(...) {
+            return "Unknown exception";
+        }
     }
-    auto Timer::getElapsedSeconds() const -> double {
-        return static_cast<double>(getElapsedMicroseconds())/1000000.0;
+
+#else // ^^ Exceptions are enabled // Exceptions are disabled vv
+    std::string ExceptionTranslatorRegistry::translateActiveException() const {
+        CATCH_INTERNAL_ERROR("Attempted to translate active exception under CATCH_CONFIG_DISABLE_EXCEPTIONS!");
     }
+#endif
 
+}
 
-} // namespace Catch
 
 
+/** \file
+ * This file provides platform specific implementations of FatalConditionHandler
+ *
+ * This means that there is a lot of conditional compilation, and platform
+ * specific code. Currently, Catch2 supports a dummy handler (if no
+ * handler is desired), and 2 platform specific handlers:
+ *  * Windows' SEH
+ *  * POSIX signals
+ *
+ * Consequently, various pieces of code below are compiled if either of
+ * the platform specific handlers is enabled, or if none of them are
+ * enabled. It is assumed that both cannot be enabled at the same time,
+ * and doing so should cause a compilation error.
+ *
+ * If another platform specific handler is added, the compile guards
+ * below will need to be updated taking these assumptions into account.
+ */
 
 
-#include <iomanip>
 
-namespace Catch {
+#include <algorithm>
 
-namespace Detail {
+#if !defined( CATCH_CONFIG_WINDOWS_SEH ) && !defined( CATCH_CONFIG_POSIX_SIGNALS )
 
-    namespace {
-        const int hexThreshold = 255;
+namespace Catch {
 
-        struct Endianness {
-            enum Arch : uint8_t {
-                Big,
-                Little
-            };
+    // If neither SEH nor signal handling is required, the handler impls
+    // do not have to do anything, and can be empty.
+    void FatalConditionHandler::engage_platform() {}
+    void FatalConditionHandler::disengage_platform() noexcept {}
+    FatalConditionHandler::FatalConditionHandler() = default;
+    FatalConditionHandler::~FatalConditionHandler() = default;
 
-            static Arch which() {
-                int one = 1;
-                // If the lowest byte we read is non-zero, we can assume
-                // that little endian format is used.
-                auto value = *reinterpret_cast<char*>(&one);
-                return value ? Little : Big;
-            }
-        };
+} // end namespace Catch
 
-        template<typename T>
-        std::string fpToString(T value, int precision) {
-            if (Catch::isnan(value)) {
-                return "nan";
-            }
+#endif // !CATCH_CONFIG_WINDOWS_SEH && !CATCH_CONFIG_POSIX_SIGNALS
 
-            ReusableStringStream rss;
-            rss << std::setprecision(precision)
-                << std::fixed
-                << value;
-            std::string d = rss.str();
-            std::size_t i = d.find_last_not_of('0');
-            if (i != std::string::npos && i != d.size() - 1) {
-                if (d[i] == '.')
-                    i++;
-                d = d.substr(0, i + 1);
-            }
-            return d;
-        }
-    } // end unnamed namespace
+#if defined( CATCH_CONFIG_WINDOWS_SEH ) && defined( CATCH_CONFIG_POSIX_SIGNALS )
+#error "Inconsistent configuration: Windows' SEH handling and POSIX signals cannot be enabled at the same time"
+#endif // CATCH_CONFIG_WINDOWS_SEH && CATCH_CONFIG_POSIX_SIGNALS
 
-    std::size_t catch_strnlen( const char* str, std::size_t n ) {
-        auto ret = std::char_traits<char>::find( str, n, '\0' );
-        if ( ret != nullptr ) { return static_cast<std::size_t>( ret - str ); }
-        return n;
+#if defined( CATCH_CONFIG_WINDOWS_SEH ) || defined( CATCH_CONFIG_POSIX_SIGNALS )
+
+namespace {
+    //! Signals fatal error message to the run context
+    void reportFatal( char const * const message ) {
+        Catch::getCurrentContext().getResultCapture()->handleFatalErrorCondition( message );
     }
 
-    std::string formatTimeT(std::time_t time) {
-        std::tm timeInfo = {};
-#ifdef _MSC_VER
-        const auto err = gmtime_s( &timeInfo, &time );
-        if ( err ) {
-            return "gmtime from provided timepoint has failed. This "
-                   "happens e.g. with pre-1970 dates using Microsoft libc";
-        }
-#elif defined( __MINGW32__ )
-        if ( gmtime_s( &timeInfo, &time ) != 0 ) {
-            return "gmtime from provided timepoint has failed";
-        }
-#elif defined( CATCH_PLATFORM_PLAYSTATION )
-        gmtime_s( &time, &timeInfo );
-#elif defined( __IAR_SYSTEMS_ICC__ )
-        // This toolchain does not provide gmtime_r. Copy the result immediately
-        // so the formatter does not retain the C library's static buffer.
-        const std::tm* const converted = std::gmtime( &time );
-        if ( converted == nullptr ) {
-            return "gmtime from provided timepoint has failed";
-        }
-        timeInfo = *converted;
-#else
-        if ( gmtime_r( &time, &timeInfo ) == nullptr ) {
-            return "gmtime from provided timepoint has failed";
-        }
-#endif
+    //! Minimal size Catch2 needs for its own fatal error handling.
+    //! Picked empirically, so it might not be sufficient on all
+    //! platforms, and for all configurations.
+    constexpr std::size_t minStackSizeForErrors = 32 * 1024;
+} // end unnamed namespace
 
-        auto const timeStampSize = sizeof( "2017-01-16T17:06:45Z" );
-        char timeStamp[timeStampSize] = {};
-        const char* const fmt = "%Y-%m-%dT%H:%M:%SZ";
+#endif // CATCH_CONFIG_WINDOWS_SEH || CATCH_CONFIG_POSIX_SIGNALS
 
-        if ( std::strftime( timeStamp, timeStampSize, fmt, &timeInfo ) == 0 ) {
-            return "gmtime from provided timepoint has failed";
-        }
-        return std::string( timeStamp, timeStampSize - 1 );
-    }
+#if defined( CATCH_CONFIG_WINDOWS_SEH )
 
-    std::string convertIntoString(StringRef string, bool escapeInvisibles) {
-        std::string ret;
-        // This is enough for the "don't escape invisibles" case, and a good
-        // lower bound on the "escape invisibles" case.
-        ret.reserve( string.size() + 2 );
+namespace Catch {
 
-        if ( !escapeInvisibles ) {
-            ret += '"';
-            ret += string;
-            ret += '"';
-            return ret;
-        }
+    struct SignalDefs { DWORD id; const char* name; };
 
-        size_t last_start = 0;
-        auto write_to = [&]( size_t idx ) {
-            if ( last_start < idx ) {
-                ret += string.substr( last_start, idx - last_start );
-            }
-            last_start = idx + 1;
-        };
+    // There is no 1-1 mapping between signals and windows exceptions.
+    // Windows can easily distinguish between SO and SigSegV,
+    // but SigInt, SigTerm, etc are handled differently.
+    static constexpr SignalDefs signalDefs[] = {
+        { EXCEPTION_ILLEGAL_INSTRUCTION,  "SIGILL - Illegal instruction signal" },
+        { EXCEPTION_STACK_OVERFLOW, "SIGSEGV - Stack overflow" },
+        { EXCEPTION_ACCESS_VIOLATION, "SIGSEGV - Segmentation violation signal" },
+        { EXCEPTION_INT_DIVIDE_BY_ZERO, "Divide by zero error" },
+    };
 
-        ret += '"';
-        for ( size_t i = 0; i < string.size(); ++i ) {
-            const char c = string[i];
-            if ( c == '\r' || c == '\n' || c == '\t' || c == '\f' ) {
-                write_to( i );
-                if ( c == '\r' ) { ret.append( "\\r" ); }
-                if ( c == '\n' ) { ret.append( "\\n" ); }
-                if ( c == '\t' ) { ret.append( "\\t" ); }
-                if ( c == '\f' ) { ret.append( "\\f" ); }
+    // Since we do not support multiple instantiations, we put these
+    // into global variables and rely on cleaning them up in outlined
+    // constructors/destructors
+    static LPTOP_LEVEL_EXCEPTION_FILTER previousTopLevelExceptionFilter = nullptr;
+
+
+    static LONG CALLBACK topLevelExceptionFilter(PEXCEPTION_POINTERS ExceptionInfo) {
+        for (auto const& def : signalDefs) {
+            if (ExceptionInfo->ExceptionRecord->ExceptionCode == def.id) {
+                reportFatal(def.name);
             }
         }
-        write_to( string.size() );
-        ret += '"';
+        // If a filter was previously registered, invoke it
+        if (previousTopLevelExceptionFilter) {
+            return previousTopLevelExceptionFilter(ExceptionInfo);
+        }
+        // Otherwise, pass along all exceptions.
+        // This stops us from eating debugger breaks etc.
+        return EXCEPTION_CONTINUE_SEARCH;
+    }
 
-        return ret;
+    // For MSVC, we reserve part of the stack memory for handling
+    // memory overflow structured exception.
+    FatalConditionHandler::FatalConditionHandler() {
+        ULONG guaranteeSize = static_cast<ULONG>(minStackSizeForErrors);
+        if (!SetThreadStackGuarantee(&guaranteeSize)) {
+            // We do not want to fully error out, because needing
+            // the stack reserve should be rare enough anyway.
+            Catch::cerr()
+                << "Failed to reserve piece of stack."
+                << " Stack overflows will not be reported successfully.";
+        }
     }
 
-    std::string convertIntoString(StringRef string) {
-        return convertIntoString(string, getCurrentContext().getConfig()->showInvisibles());
+    // We do not attempt to unset the stack guarantee, because
+    // Windows does not support lowering the stack size guarantee.
+    FatalConditionHandler::~FatalConditionHandler() = default;
+
+
+    void FatalConditionHandler::engage_platform() {
+        // Register as a the top level exception filter.
+        previousTopLevelExceptionFilter = SetUnhandledExceptionFilter(topLevelExceptionFilter);
     }
 
-    std::string rawMemoryToString( const void *object, std::size_t size ) {
-        // Reverse order for little endian architectures
-        int i = 0, end = static_cast<int>( size ), inc = 1;
-        if( Endianness::which() == Endianness::Little ) {
-            i = end-1;
-            end = inc = -1;
+    void FatalConditionHandler::disengage_platform() noexcept {
+        if (SetUnhandledExceptionFilter(previousTopLevelExceptionFilter) != topLevelExceptionFilter) {
+            Catch::cerr()
+                << "Unexpected SEH unhandled exception filter on disengage."
+                << " The filter was restored, but might be rolled back unexpectedly.";
         }
-
-        unsigned char const *bytes = static_cast<unsigned char const *>(object);
-        ReusableStringStream rss;
-        rss << "0x" << std::setfill('0') << std::hex;
-        for( ; i != end; i += inc )
-             rss << std::setw(2) << static_cast<unsigned>(bytes[i]);
-       return rss.str();
+        previousTopLevelExceptionFilter = nullptr;
     }
 
-    std::string makeExceptionHappenedString() {
-        return "{ stringification failed with an exception: \"" +
-               translateActiveException() + "\" }";
+} // end namespace Catch
 
-    }
+#endif // CATCH_CONFIG_WINDOWS_SEH
 
-} // end Detail namespace
+#if defined( CATCH_CONFIG_POSIX_SIGNALS )
 
+#include <signal.h>
 
+namespace Catch {
 
-//// ======================================================= ////
-//
-//   Out-of-line defs for full specialization of StringMaker
-//
-//// ======================================================= ////
+    struct SignalDefs {
+        int id;
+        const char* name;
+    };
 
-std::string StringMaker<std::string>::convert(const std::string& str) {
-    return Detail::convertIntoString( str );
-}
+    static constexpr SignalDefs signalDefs[] = {
+        { SIGINT,  "SIGINT - Terminal interrupt signal" },
+        { SIGILL,  "SIGILL - Illegal instruction signal" },
+        { SIGFPE,  "SIGFPE - Floating point error signal" },
+        { SIGSEGV, "SIGSEGV - Segmentation violation signal" },
+        { SIGTERM, "SIGTERM - Termination request signal" },
+        { SIGABRT, "SIGABRT - Abort (abnormal termination) signal" }
+    };
 
-#ifdef CATCH_CONFIG_CPP17_STRING_VIEW
-std::string StringMaker<std::string_view>::convert(std::string_view str) {
-    return Detail::convertIntoString( StringRef( str.data(), str.size() ) );
-}
+// Older GCCs trigger -Wmissing-field-initializers for T foo = {}
+// which is zero initialization, but not explicit. We want to avoid
+// that.
+#if defined(__GNUC__)
+#    pragma GCC diagnostic push
+#    pragma GCC diagnostic ignored "-Wmissing-field-initializers"
 #endif
 
-std::string StringMaker<char const*>::convert(char const* str) {
-    if (str) {
-        return Detail::convertIntoString( str );
-    } else {
-        return{ "{null string}" };
-    }
-}
-std::string StringMaker<char*>::convert(char* str) { // NOLINT(readability-non-const-parameter)
-    if (str) {
-        return Detail::convertIntoString( str );
-    } else {
-        return{ "{null string}" };
-    }
-}
+    static char* altStackMem = nullptr;
+    static std::size_t altStackSize = 0;
+    static stack_t oldSigStack{};
+    static struct sigaction oldSigActions[sizeof(signalDefs) / sizeof(SignalDefs)]{};
 
-#ifdef CATCH_CONFIG_WCHAR
-std::string StringMaker<std::wstring>::convert(const std::wstring& wstr) {
-    std::string s;
-    s.reserve(wstr.size());
-    for (auto c : wstr) {
-        s += (c <= 0xff) ? static_cast<char>(c) : '?';
+    static void restorePreviousSignalHandlers() noexcept {
+        // We set signal handlers back to the previous ones. Hopefully
+        // nobody overwrote them in the meantime, and doesn't expect
+        // their signal handlers to live past ours given that they
+        // installed them after ours..
+        for (std::size_t i = 0; i < sizeof(signalDefs) / sizeof(SignalDefs); ++i) {
+            sigaction(signalDefs[i].id, &oldSigActions[i], nullptr);
+        }
+        // Return the old stack
+        sigaltstack(&oldSigStack, nullptr);
     }
-    return ::Catch::Detail::stringify(s);
-}
 
-# ifdef CATCH_CONFIG_CPP17_STRING_VIEW
-std::string StringMaker<std::wstring_view>::convert(std::wstring_view str) {
-    return StringMaker<std::wstring>::convert(std::wstring(str));
-}
-# endif
+    static void handleSignal( int sig ) {
+        char const * name = "<unknown signal>";
+        for (auto const& def : signalDefs) {
+            if (sig == def.id) {
+                name = def.name;
+                break;
+            }
+        }
+        // We need to restore previous signal handlers and let them do
+        // their thing, so that the users can have the debugger break
+        // when a signal is raised, and so on.
+        restorePreviousSignalHandlers();
+        reportFatal( name );
+        raise( sig );
+    }
 
-std::string StringMaker<wchar_t const*>::convert(wchar_t const * str) {
-    if (str) {
-        return ::Catch::Detail::stringify(std::wstring{ str });
-    } else {
-        return{ "{null string}" };
+    FatalConditionHandler::FatalConditionHandler() {
+        assert(!altStackMem && "Cannot initialize POSIX signal handler when one already exists");
+        if (altStackSize == 0) {
+            altStackSize = std::max(static_cast<size_t>(SIGSTKSZ), minStackSizeForErrors);
+        }
+        altStackMem = new char[altStackSize]();
     }
-}
-std::string StringMaker<wchar_t *>::convert(wchar_t * str) {
-    if (str) {
-        return ::Catch::Detail::stringify(std::wstring{ str });
-    } else {
-        return{ "{null string}" };
+
+    FatalConditionHandler::~FatalConditionHandler() {
+        delete[] altStackMem;
+        // We signal that another instance can be constructed by zeroing
+        // out the pointer.
+        altStackMem = nullptr;
     }
-}
-#endif
 
-#if defined(CATCH_CONFIG_CPP17_BYTE)
-#include <cstddef>
-std::string StringMaker<std::byte>::convert(std::byte value) {
-    return ::Catch::Detail::stringify(std::to_integer<unsigned long long>(value));
-}
-#endif // defined(CATCH_CONFIG_CPP17_BYTE)
+    void FatalConditionHandler::engage_platform() {
+        stack_t sigStack;
+        sigStack.ss_sp = altStackMem;
+        sigStack.ss_size = altStackSize;
+        sigStack.ss_flags = 0;
+        sigaltstack(&sigStack, &oldSigStack);
+        struct sigaction sa = { };
 
-std::string StringMaker<int>::convert(int value) {
-    return ::Catch::Detail::stringify(static_cast<long long>(value));
-}
-std::string StringMaker<long>::convert(long value) {
-    return ::Catch::Detail::stringify(static_cast<long long>(value));
-}
-std::string StringMaker<long long>::convert(long long value) {
-    ReusableStringStream rss;
-    rss << value;
-    if (value > Detail::hexThreshold) {
-        rss << " (0x" << std::hex << value << ')';
+        sa.sa_handler = handleSignal;
+        sa.sa_flags = SA_ONSTACK;
+        for (std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i) {
+            sigaction(signalDefs[i].id, &sa, &oldSigActions[i]);
+        }
     }
-    return rss.str();
-}
 
-std::string StringMaker<unsigned int>::convert(unsigned int value) {
-    return ::Catch::Detail::stringify(static_cast<unsigned long long>(value));
-}
-std::string StringMaker<unsigned long>::convert(unsigned long value) {
-    return ::Catch::Detail::stringify(static_cast<unsigned long long>(value));
-}
-std::string StringMaker<unsigned long long>::convert(unsigned long long value) {
-    ReusableStringStream rss;
-    rss << value;
-    if (value > Detail::hexThreshold) {
-        rss << " (0x" << std::hex << value << ')';
-    }
-    return rss.str();
-}
+#if defined(__GNUC__)
+#    pragma GCC diagnostic pop
+#endif
 
-std::string StringMaker<signed char>::convert(signed char value) {
-    if (value == '\r') {
-        return "'\\r'";
-    } else if (value == '\f') {
-        return "'\\f'";
-    } else if (value == '\n') {
-        return "'\\n'";
-    } else if (value == '\t') {
-        return "'\\t'";
-    } else if ('\0' <= value && value < ' ') {
-        return ::Catch::Detail::stringify(static_cast<unsigned int>(value));
-    } else {
-        char chstr[] = "' '";
-        chstr[1] = value;
-        return chstr;
-    }
-}
-std::string StringMaker<char>::convert(char c) {
-    return ::Catch::Detail::stringify(static_cast<signed char>(c));
-}
-std::string StringMaker<unsigned char>::convert(unsigned char value) {
-    return ::Catch::Detail::stringify(static_cast<char>(value));
-}
 
-int StringMaker<float>::precision = std::numeric_limits<float>::max_digits10;
+    void FatalConditionHandler::disengage_platform() noexcept {
+        restorePreviousSignalHandlers();
+    }
 
-std::string StringMaker<float>::convert(float value) {
-    return Detail::fpToString(value, precision) + 'f';
-}
+} // end namespace Catch
 
-int StringMaker<double>::precision = std::numeric_limits<double>::max_digits10;
+#endif // CATCH_CONFIG_POSIX_SIGNALS
 
-std::string StringMaker<double>::convert(double value) {
-    return Detail::fpToString(value, precision);
-}
 
-} // end namespace Catch
 
 
+#include <cstring>
 
 namespace Catch {
+    namespace Detail {
 
-    Counts Counts::operator - ( Counts const& other ) const {
-        Counts diff;
-        diff.passed = passed - other.passed;
-        diff.failed = failed - other.failed;
-        diff.failedButOk = failedButOk - other.failedButOk;
-        diff.skipped = skipped - other.skipped;
-        return diff;
-    }
+        uint32_t convertToBits(float f) {
+            static_assert(sizeof(float) == sizeof(uint32_t), "Important ULP matcher assumption violated");
+            uint32_t i;
+            std::memcpy(&i, &f, sizeof(f));
+            return i;
+        }
 
-    Counts& Counts::operator += ( Counts const& other ) {
-        passed += other.passed;
-        failed += other.failed;
-        failedButOk += other.failedButOk;
-        skipped += other.skipped;
-        return *this;
-    }
+        uint64_t convertToBits(double d) {
+            static_assert(sizeof(double) == sizeof(uint64_t), "Important ULP matcher assumption violated");
+            uint64_t i;
+            std::memcpy(&i, &d, sizeof(d));
+            return i;
+        }
 
-    std::uint64_t Counts::total() const {
-        return passed + failed + failedButOk + skipped;
-    }
-    bool Counts::allPassed() const {
-        return failed == 0 && failedButOk == 0 && skipped == 0;
-    }
-    bool Counts::allOk() const {
-        return failed == 0;
-    }
+#if defined( __GNUC__ ) || defined( __clang__ )
+#    pragma GCC diagnostic push
+#    pragma GCC diagnostic ignored "-Wfloat-equal"
+#endif
+        bool directCompare( float lhs, float rhs ) { return lhs == rhs; }
+        bool directCompare( double lhs, double rhs ) { return lhs == rhs; }
+#if defined( __GNUC__ ) || defined( __clang__ )
+#    pragma GCC diagnostic pop
+#endif
 
-    Totals Totals::operator - ( Totals const& other ) const {
-        Totals diff;
-        diff.assertions = assertions - other.assertions;
-        diff.testCases = testCases - other.testCases;
-        return diff;
-    }
 
-    Totals& Totals::operator += ( Totals const& other ) {
-        assertions += other.assertions;
-        testCases += other.testCases;
-        return *this;
-    }
+    } // end namespace Detail
+} // end namespace Catch
+
 
-    Totals Totals::delta( Totals const& prevTotals ) const {
-        Totals diff = *this - prevTotals;
-        if( diff.assertions.failed > 0 )
-            ++diff.testCases.failed;
-        else if( diff.assertions.failedButOk > 0 )
-            ++diff.testCases.failedButOk;
-        else if ( diff.assertions.skipped > 0 )
-            ++ diff.testCases.skipped;
-        else
-            ++diff.testCases.passed;
-        return diff;
-    }
 
-}
 
 
 
+#include <cstdlib>
 
 namespace Catch {
     namespace Detail {
-        void registerTranslatorImpl(
-            Detail::unique_ptr<IExceptionTranslator>&& translator ) {
-            getMutableRegistryHub().registerTranslator(
-                CATCH_MOVE( translator ) );
+
+#if !defined (CATCH_CONFIG_GETENV)
+        char const* getEnv( char const* ) { return nullptr; }
+#else
+
+        char const* getEnv( char const* varName ) {
+#    if defined( _MSC_VER )
+#        pragma warning( push )
+#        pragma warning( disable : 4996 ) // use getenv_s instead of getenv
+#    endif
+
+            return std::getenv( varName );
+
+#    if defined( _MSC_VER )
+#        pragma warning( pop )
+#    endif
         }
-    } // namespace Detail
+#endif
+} // namespace Detail
 } // namespace Catch
 
 
-#include <ostream>
+
 
 namespace Catch {
 
-    Version::Version
-        (   unsigned int _majorVersion,
-            unsigned int _minorVersion,
-            unsigned int _patchNumber,
-            char const * const _branchName,
-            unsigned int _buildNumber )
-    :   majorVersion( _majorVersion ),
-        minorVersion( _minorVersion ),
-        patchNumber( _patchNumber ),
-        branchName( _branchName ),
-        buildNumber( _buildNumber )
-    {}
+    auto operator << (std::ostream& os, LazyExpression const& lazyExpr) -> std::ostream& {
+        if (lazyExpr.m_isNegated)
+            os << '!';
 
-    std::ostream& operator << ( std::ostream& os, Version const& version ) {
-        os  << version.majorVersion << '.'
-            << version.minorVersion << '.'
-            << version.patchNumber;
-        // branchName is never null -> 0th char is \0 if it is empty
-        if (version.branchName[0]) {
-            os << '-' << version.branchName
-               << '.' << version.buildNumber;
+        if (lazyExpr) {
+            if (lazyExpr.m_isNegated && lazyExpr.m_transientExpression->isBinaryExpression())
+                os << '(' << *lazyExpr.m_transientExpression << ')';
+            else
+                os << *lazyExpr.m_transientExpression;
+        } else {
+            os << "{** error - unchecked empty expression requested **}";
         }
         return os;
     }
 
-    Version const& libraryVersion() {
-        static Version version( 3, 16, 1, "", 0 );
-        return version;
-    }
-
-}
-
-
-
-
-namespace Catch {
-
-    const char* GeneratorException::what() const noexcept {
-        return m_msg;
-    }
+} // namespace Catch
 
-} // end namespace Catch
 
 
 
+#ifdef CATCH_CONFIG_WINDOWS_CRTDBG
+#include <crtdbg.h>
 
 namespace Catch {
 
-    IGeneratorTracker::~IGeneratorTracker() = default;
-
-namespace Generators {
-
-    GeneratorUntypedBase::~GeneratorUntypedBase() = default;
-
-    IGeneratorTracker* acquireGeneratorTracker(StringRef generatorName, SourceLineInfo const& lineInfo ) {
-        return getResultCapture().acquireGeneratorTracker( generatorName, lineInfo );
+    LeakDetector::LeakDetector() {
+        int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
+        flag |= _CRTDBG_LEAK_CHECK_DF;
+        flag |= _CRTDBG_ALLOC_MEM_DF;
+        _CrtSetDbgFlag(flag);
+        _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+        _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
+        // Change this to leaking allocation's number to break there
+        _CrtSetBreakAlloc(-1);
     }
+}
 
-    IGeneratorTracker* createGeneratorTracker( StringRef generatorName,
-                                 SourceLineInfo lineInfo,
-                                 GeneratorBasePtr&& generator ) {
-        return getResultCapture().createGeneratorTracker(
-            generatorName, lineInfo, CATCH_MOVE( generator ) );
-    }
+#else // ^^ Windows crt debug heap enabled // Windows crt debug heap disabled vv
 
-} // namespace Generators
-} // namespace Catch
+    Catch::LeakDetector::LeakDetector() = default;
 
+#endif // CATCH_CONFIG_WINDOWS_CRTDBG
 
+Catch::LeakDetector::~LeakDetector() {
+    Catch::cleanUp();
+}
 
 
-#include <random>
 
 namespace Catch {
-    namespace Generators {
-        namespace Detail {
-            std::uint32_t getSeed() { return sharedRng()(); }
-        } // namespace Detail
-
-        struct RandomFloatingGenerator<long double>::PImpl {
-            PImpl( long double a, long double b, uint32_t seed ):
-                rng( seed ), dist( a, b ) {}
+    CATCH_INTERNAL_START_WARNINGS_SUPPRESSION
+    CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
+    static const LeakDetector leakDetector;
+    CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
+}
 
-            Catch::SimplePcg32 rng;
-            std::uniform_real_distribution<long double> dist;
-        };
+// Allow users of amalgamated .cpp file to remove our main and provide their own.
+#if !defined(CATCH_AMALGAMATED_CUSTOM_MAIN)
 
-        RandomFloatingGenerator<long double>::RandomFloatingGenerator(
-            long double a, long double b, std::uint32_t seed) :
-            m_pimpl(Catch::Detail::make_unique<PImpl>(a, b, seed)) {
-            static_cast<void>( next() );
-        }
+#if defined(CATCH_CONFIG_WCHAR) && defined(CATCH_PLATFORM_WINDOWS) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN)
+// Standard C/C++ Win32 Unicode wmain entry point
+extern "C" int __cdecl wmain (int argc, wchar_t * argv[], wchar_t * []) {
+#else
+// Standard C/C++ main entry point
+int main (int argc, char * argv[]) {
+#endif
 
-        RandomFloatingGenerator<long double>::~RandomFloatingGenerator() =
-            default;
-        bool RandomFloatingGenerator<long double>::next() {
-            m_current_number = m_pimpl->dist( m_pimpl->rng );
-            return true;
-        }
+    // We want to force the linker not to discard the global variable
+    // and its constructor, as it (optionally) registers leak detector
+    (void)&Catch::leakDetector;
 
-        bool RandomFloatingGenerator<long double>::isFinite() const {
-            return false;
-        }
+    return Catch::Session().run( argc, argv );
+}
 
-    } // namespace Generators
-} // namespace Catch
+#endif // !defined(CATCH_AMALGAMATED_CUSTOM_MAIN
 
 
 
 
 namespace Catch {
-    namespace Generators {
-        namespace Detail {
-
-            [[noreturn]]
-            void throw_generator_exception( char const* msg ) {
-                Catch::throw_exception( GeneratorException{ msg } );
-            }
-
-        } // namespace Detail
-    } // namespace Generators
-} // namespace Catch
-
 
+    namespace {
+        // Messages are owned by their individual threads, so the counter should
+        // be thread-local as well. Alternative consideration: atomic counter,
+        // so threads don't share IDs and things are easier to debug.
+        static CATCH_INTERNAL_THREAD_LOCAL unsigned int messageIDCounter = 0;
+    }
 
+    MessageInfo::MessageInfo( StringRef _macroName,
+                              SourceLineInfo const& _lineInfo,
+                              ResultWas::OfType _type )
+    :   macroName( _macroName ),
+        lineInfo( _lineInfo ),
+        type( _type ),
+        sequence( ++messageIDCounter )
+    {}
 
-namespace Catch {
-    namespace Detail {
-        void missingCaptureInstance() {
-            CATCH_INTERNAL_ERROR( "No result capture instance" );
-        }
-    } // namespace Detail
+} // end namespace Catch
 
-    IResultCapture::~IResultCapture() = default;
-} // namespace Catch
 
 
+#include <cstdio>
+#include <cstring>
+#include <iosfwd>
+#include <sstream>
 
+#if defined( CATCH_CONFIG_NEW_CAPTURE )
+#    if defined( _MSC_VER )
+#        include <io.h> //_dup and _dup2
+#        define dup _dup
+#        define dup2 _dup2
+#        define fileno _fileno
+#    else
+#        include <unistd.h> // dup and dup2
+#    endif
+#endif
 
 namespace Catch {
-    IConfig::~IConfig() = default;
-}
 
+    namespace {
+        //! A no-op implementation, used if no reporter wants output
+        //! redirection.
+        class NoopRedirect final : public OutputRedirect {
+            void activateImpl() override {}
+            void deactivateImpl() override {}
+            std::string getStdout() override { return {}; }
+            std::string getStderr() override { return {}; }
+            void clearBuffers() override {}
+        };
 
+        /**
+         * Redirects specific stream's rdbuf with another's.
+         *
+         * Redirection can be stopped and started on-demand, assumes
+         * that the underlying stream's rdbuf aren't changed by other
+         * users while it is active. The rdbuf to restore is the one the
+         * stream had when the redirection started, not when this object
+         * was made.
+         */
+        class RedirectedStreamNew {
+            std::ostream& m_originalStream;
+            std::ostream& m_redirectionStream;
+            std::streambuf* m_prevBuf = nullptr;
 
+        public:
+            RedirectedStreamNew( std::ostream& originalStream,
+                                 std::ostream& redirectionStream ):
+                m_originalStream( originalStream ),
+                m_redirectionStream( redirectionStream ) {}
 
-namespace Catch {
-    IExceptionTranslator::~IExceptionTranslator() = default;
-    IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() = default;
-}
-
-
-
+            void startRedirect() {
+                m_prevBuf = m_originalStream.rdbuf();
+                m_originalStream.rdbuf( m_redirectionStream.rdbuf() );
+            }
+            void stopRedirect() { m_originalStream.rdbuf( m_prevBuf ); }
+        };
 
-#include <string>
+        /**
+         * Redirects the `std::cout`, `std::cerr`, `std::clog` streams,
+         * but does not touch the actual `stdout`/`stderr` file descriptors.
+         */
+        class StreamRedirect final : public OutputRedirect {
+            ReusableStringStream m_redirectedOut, m_redirectedErr;
+            RedirectedStreamNew m_cout, m_cerr, m_clog;
 
-namespace Catch {
-    namespace Generators {
+        public:
+            StreamRedirect():
+                m_cout( Catch::cout(), m_redirectedOut.get() ),
+                m_cerr( Catch::cerr(), m_redirectedErr.get() ),
+                m_clog( Catch::clog(), m_redirectedErr.get() ) {}
 
-        bool GeneratorUntypedBase::countedNext() {
-            auto ret = next();
-            if ( ret ) {
-                m_stringReprCache.clear();
-                ++m_currentElementIndex;
+            void activateImpl() override {
+                m_cout.startRedirect();
+                m_cerr.startRedirect();
+                m_clog.startRedirect();
             }
-            return ret;
-        }
-
-        void GeneratorUntypedBase::skipToNthElementImpl( std::size_t n ) {
-            for ( size_t i = m_currentElementIndex; i < n; ++i ) {
-                bool isValid = next();
-                if ( !isValid ) {
-                    Detail::throw_generator_exception(
-                        "Could not jump to Nth element: not enough elements" );
-                }
+            void deactivateImpl() override {
+                m_cout.stopRedirect();
+                m_cerr.stopRedirect();
+                m_clog.stopRedirect();
             }
-        }
+            std::string getStdout() override { return m_redirectedOut.str(); }
+            std::string getStderr() override { return m_redirectedErr.str(); }
+            void clearBuffers() override {
+                m_redirectedOut.str( "" );
+                m_redirectedErr.str( "" );
+            }
+        };
 
-        void GeneratorUntypedBase::skipToNthElement( std::size_t n ) {
-            if ( n < m_currentElementIndex ) {
-                Detail::throw_generator_exception(
-                    "Tried to jump generator backwards" );
+#if defined( CATCH_CONFIG_NEW_CAPTURE )
+
+        // Windows's implementation of std::tmpfile is terrible (it tries
+        // to create a file inside system folder, thus requiring elevated
+        // privileges for the binary), so we have to use tmpnam(_s) and
+        // create the file ourselves there.
+        class TempFile {
+        public:
+            TempFile( TempFile const& ) = delete;
+            TempFile& operator=( TempFile const& ) = delete;
+            TempFile( TempFile&& ) = delete;
+            TempFile& operator=( TempFile&& ) = delete;
+
+#    if defined( _MSC_VER )
+            TempFile() {
+                if ( tmpnam_s( m_buffer ) ) {
+                    CATCH_RUNTIME_ERROR( "Could not get a temp filename" );
+                }
+                if ( fopen_s( &m_file, m_buffer, "wb+" ) ) {
+                    char buffer[100];
+                    if ( strerror_s( buffer, errno ) ) {
+                        CATCH_RUNTIME_ERROR(
+                            "Could not translate errno to a string" );
+                    }
+                    CATCH_RUNTIME_ERROR( "Could not open the temp file: '"
+                                         << m_buffer
+                                         << "' because: " << buffer );
+                }
             }
-            if ( n == m_currentElementIndex ) { return; }
+#    else
+            TempFile() {
+                m_file = std::tmpfile();
+                if ( !m_file ) {
+                    CATCH_RUNTIME_ERROR( "Could not create a temp file." );
+                }
+            }
+#    endif
 
-            skipToNthElementImpl(n);
-            // Fixup tracking after moving the generator forward
-            //  * Ensure that the correct element index is set after skipping
-            //  * Invalidate cache
-            m_currentElementIndex = n;
-            m_stringReprCache.clear();
-        }
+            ~TempFile() {
+                // TBD: What to do about errors here?
+                std::fclose( m_file );
+                // We manually create the file on Windows only, on Linux
+                // it will be autodeleted
+#    if defined( _MSC_VER )
+                std::remove( m_buffer );
+#    endif
+            }
 
-        StringRef GeneratorUntypedBase::currentElementAsString() const {
-            if ( m_stringReprCache.empty() ) {
-                m_stringReprCache = stringifyImpl();
+            std::FILE* getFile() { return m_file; }
+            std::string getContents() {
+                ReusableStringStream sstr;
+                constexpr long buffer_size = 100;
+                char buffer[buffer_size + 1] = {};
+                long current_pos = ftell( m_file );
+                CATCH_ENFORCE( current_pos >= 0,
+                               "ftell failed, errno: " << errno );
+                std::rewind( m_file );
+                while ( current_pos > 0 ) {
+                    auto read_characters =
+                        std::fread( buffer,
+                                    1,
+                                    std::min( buffer_size, current_pos ),
+                                    m_file );
+                    buffer[read_characters] = '\0';
+                    sstr << buffer;
+                    current_pos -= static_cast<long>( read_characters );
+                }
+                return sstr.str();
             }
-            return m_stringReprCache;
-        }
 
-        bool GeneratorUntypedBase::isFinite() const { return true; }
+            void clear() { std::rewind( m_file ); }
 
-    } // namespace Generators
-} // namespace Catch
+        private:
+            std::FILE* m_file = nullptr;
+            char m_buffer[L_tmpnam] = { 0 };
+        };
 
+        /**
+         * Redirects the actual `stdout`/`stderr` file descriptors.
+         *
+         * Works by replacing the file descriptors numbered 1 and 2
+         * with an open temporary file.
+         */
+        class FileRedirect final : public OutputRedirect {
+            TempFile m_outFile, m_errFile;
+            int m_originalOut = -1;
+            int m_originalErr = -1;
 
+            // Flushes cout/cerr/clog streams and stdout/stderr FDs
+            void flushEverything() {
+                Catch::cout() << std::flush;
+                fflush( stdout );
+                // Since we support overriding these streams, we flush cerr
+                // even though std::cerr is unbuffered
+                Catch::cerr() << std::flush;
+                Catch::clog() << std::flush;
+                fflush( stderr );
+            }
 
+        public:
+            FileRedirect():
+                m_originalOut( dup( fileno( stdout ) ) ),
+                m_originalErr( dup( fileno( stderr ) ) ) {
+                CATCH_ENFORCE( m_originalOut >= 0, "Could not dup stdout" );
+                CATCH_ENFORCE( m_originalErr >= 0, "Could not dup stderr" );
+            }
 
-namespace Catch {
-    IRegistryHub::~IRegistryHub() = default;
-    IMutableRegistryHub::~IMutableRegistryHub() = default;
-}
+            std::string getStdout() override { return m_outFile.getContents(); }
+            std::string getStderr() override { return m_errFile.getContents(); }
+            void clearBuffers() override {
+                m_outFile.clear();
+                m_errFile.clear();
+            }
 
+            void activateImpl() override {
+                // We flush before starting redirect, to ensure that we do
+                // not capture the end of message sent before activation.
+                flushEverything();
 
+                int ret;
+                ret = dup2( fileno( m_outFile.getFile() ), fileno( stdout ) );
+                CATCH_ENFORCE( ret >= 0,
+                               "dup2 to stdout has failed, errno: " << errno );
+                ret = dup2( fileno( m_errFile.getFile() ), fileno( stderr ) );
+                CATCH_ENFORCE( ret >= 0,
+                               "dup2 to stderr has failed, errno: " << errno );
+            }
+            void deactivateImpl() override {
+                // We flush before ending redirect, to ensure that we
+                // capture all messages sent while the redirect was active.
+                flushEverything();
 
-#include <cassert>
+                int ret;
+                ret = dup2( m_originalOut, fileno( stdout ) );
+                CATCH_ENFORCE(
+                    ret >= 0,
+                    "dup2 of original stdout has failed, errno: " << errno );
+                ret = dup2( m_originalErr, fileno( stderr ) );
+                CATCH_ENFORCE(
+                    ret >= 0,
+                    "dup2 of original stderr has failed, errno: " << errno );
+            }
+        };
 
-namespace Catch {
+#endif // CATCH_CONFIG_NEW_CAPTURE
 
-    AssertionStats::AssertionStats( AssertionResult const& _assertionResult,
-                                    std::vector<MessageInfo> const& _infoMessages,
-                                    Totals const& _totals )
-    :   assertionResult( _assertionResult ),
-        infoMessages( _infoMessages ),
-        totals( _totals )
-    {
-        if( assertionResult.hasMessage() ) {
-            // Copy message into messages list.
-            // !TBD This should have been done earlier, somewhere
-            MessageBuilder builder( assertionResult.getTestMacroName(), assertionResult.getSourceInfo(), assertionResult.getResultType() );
-            builder.m_info.message = static_cast<std::string>(assertionResult.getMessage());
+    } // end namespace
 
-            infoMessages.push_back( CATCH_MOVE(builder.m_info) );
+    bool isRedirectAvailable( OutputRedirect::Kind kind ) {
+        switch ( kind ) {
+        // These two are always available
+        case OutputRedirect::None:
+        case OutputRedirect::Streams:
+            return true;
+#if defined( CATCH_CONFIG_NEW_CAPTURE )
+        case OutputRedirect::FileDescriptors:
+            return true;
+#endif
+        default:
+            return false;
         }
     }
 
-    SectionStats::SectionStats(  SectionInfo&& _sectionInfo,
-                                 Counts const& _assertions,
-                                 double _durationInSeconds,
-                                 bool _missingAssertions )
-    :   sectionInfo( CATCH_MOVE(_sectionInfo) ),
-        assertions( _assertions ),
-        durationInSeconds( _durationInSeconds ),
-        missingAssertions( _missingAssertions )
-    {}
-
+    Detail::unique_ptr<OutputRedirect> makeOutputRedirect( bool actual ) {
+        if ( actual ) {
+            // TODO: Clean this up later
+#if defined( CATCH_CONFIG_NEW_CAPTURE )
+            return Detail::make_unique<FileRedirect>();
+#else
+            return Detail::make_unique<StreamRedirect>();
+#endif
+        } else {
+            return Detail::make_unique<NoopRedirect>();
+        }
+    }
 
-    TestCaseStats::TestCaseStats(  TestCaseInfo const& _testInfo,
-                                   Totals const& _totals,
-                                   std::string&& _stdOut,
-                                   std::string&& _stdErr,
-                                   bool _aborting )
-    : testInfo( &_testInfo ),
-        totals( _totals ),
-        stdOut( CATCH_MOVE(_stdOut) ),
-        stdErr( CATCH_MOVE(_stdErr) ),
-        aborting( _aborting )
-    {}
+    RedirectGuard scopedActivate( OutputRedirect& redirectImpl ) {
+        return RedirectGuard( true, redirectImpl );
+    }
 
+    RedirectGuard scopedDeactivate( OutputRedirect& redirectImpl ) {
+        return RedirectGuard( false, redirectImpl );
+    }
 
-    TestRunStats::TestRunStats(   TestRunInfo const& _runInfo,
-                    Totals const& _totals,
-                    bool _aborting )
-    :   runInfo( _runInfo ),
-        totals( _totals ),
-        aborting( _aborting )
-    {}
+    OutputRedirect::~OutputRedirect() = default;
 
-    IEventListener::~IEventListener() = default;
+    RedirectGuard::RedirectGuard( bool activate, OutputRedirect& redirectImpl ):
+        m_redirect( &redirectImpl ),
+        m_activate( activate ),
+        m_previouslyActive( redirectImpl.isActive() ) {
 
-} // end namespace Catch
+        // Skip cases where there is no actual state change.
+        if ( m_activate == m_previouslyActive ) { return; }
 
+        if ( m_activate ) {
+            m_redirect->activate();
+        } else {
+            m_redirect->deactivate();
+        }
+    }
 
+    RedirectGuard::~RedirectGuard() noexcept( false ) {
+        if ( m_moved ) { return; }
+        // Skip cases where there is no actual state change.
+        if ( m_activate == m_previouslyActive ) { return; }
 
+        if ( m_activate ) {
+            m_redirect->deactivate();
+        } else {
+            m_redirect->activate();
+        }
+    }
 
-namespace Catch {
-    EventListenerFactory::~EventListenerFactory() = default;
-}
+    RedirectGuard::RedirectGuard( RedirectGuard&& rhs ) noexcept:
+        m_redirect( rhs.m_redirect ),
+        m_activate( rhs.m_activate ),
+        m_previouslyActive( rhs.m_previouslyActive ),
+        m_moved( false ) {
+        rhs.m_moved = true;
+    }
+
+    RedirectGuard& RedirectGuard::operator=( RedirectGuard&& rhs ) noexcept {
+        m_redirect = rhs.m_redirect;
+        m_activate = rhs.m_activate;
+        m_previouslyActive = rhs.m_previouslyActive;
+        m_moved = false;
+        rhs.m_moved = true;
+        return *this;
+    }
 
+} // namespace Catch
 
+#if defined( CATCH_CONFIG_NEW_CAPTURE )
+#    if defined( _MSC_VER )
+#        undef dup
+#        undef dup2
+#        undef fileno
+#    endif
+#endif
 
 
-namespace Catch {
-    ITestCaseRegistry::~ITestCaseRegistry() = default;
-}
 
 
+#include <limits>
+#include <stdexcept>
 
 namespace Catch {
 
-    void AssertionHandler::finishIncomplete() {
-        m_resultCapture.handleIncomplete( m_assertionInfo );
-    }
+    Optional<unsigned int> parseUInt(std::string const& input, int base) {
+        auto trimmed = trim( input );
+        // std::stoull is annoying and accepts numbers starting with '-',
+        // it just negates them into unsigned int
+        if ( trimmed.empty() || trimmed[0] == '-' ) {
+            return {};
+        }
 
-    AssertionHandler::AssertionHandler
-        (   StringRef macroName,
-            SourceLineInfo const& lineInfo,
-            StringRef capturedExpression,
-            ResultDisposition::Flags resultDisposition )
-    :   m_assertionInfo{ macroName, lineInfo, capturedExpression, resultDisposition },
-        m_resultCapture( static_cast<RunContext&>(getResultCapture()) )
-    {
-        m_resultCapture.notifyAssertionStarted( m_assertionInfo );
+        CATCH_TRY {
+            size_t pos = 0;
+            const auto ret = std::stoull( trimmed, &pos, base );
+
+            // We did not consume the whole input, so there is an issue
+            // This can be bunch of different stuff, like multiple numbers
+            // in the input, or invalid digits/characters and so on. Either
+            // way, we do not want to return the partially parsed result.
+            if ( pos != trimmed.size() ) {
+                return {};
+            }
+            // Too large
+            if ( ret > std::numeric_limits<unsigned int>::max() ) {
+                return {};
+            }
+            return static_cast<unsigned int>(ret);
+        }
+        CATCH_CATCH_ANON( std::invalid_argument const& ) {
+            // no conversion could be performed
+        }
+        CATCH_CATCH_ANON( std::out_of_range const& ) {
+            // the input does not fit into an unsigned long long
+        }
+        return {};
     }
 
-    void AssertionHandler::handleExpr( ITransientExpression const& expr ) {
-        m_resultCapture.handleExpr( m_assertionInfo, expr, m_reaction );
+} // namespace Catch
+
+
+
+
+#include <cmath>
+
+namespace Catch {
+
+#if !defined(CATCH_CONFIG_POLYFILL_ISNAN)
+    bool isnan(float f) {
+        return std::isnan(f);
     }
-    void AssertionHandler::handleMessage(ResultWas::OfType resultType, std::string&& message) {
-        m_resultCapture.handleMessage( m_assertionInfo, resultType, CATCH_MOVE(message), m_reaction );
+    bool isnan(double d) {
+        return std::isnan(d);
     }
-
-    auto AssertionHandler::allowThrows() const -> bool {
-        return getCurrentContext().getConfig()->allowThrows();
+#else
+    // For now we only use this for embarcadero
+    bool isnan(float f) {
+        return std::_isnan(f);
+    }
+    bool isnan(double d) {
+        return std::_isnan(d);
     }
+#endif
 
-    void AssertionHandler::complete() {
-        m_completed = true;
-        if( m_reaction.shouldDebugBreak ) {
+#if !defined( CATCH_CONFIG_GLOBAL_NEXTAFTER )
+    float nextafter( float x, float y ) { return std::nextafter( x, y ); }
+    double nextafter( double x, double y ) { return std::nextafter( x, y ); }
+#else
+    float nextafter( float x, float y ) { return ::nextafterf( x, y ); }
+    double nextafter( double x, double y ) { return ::nextafter( x, y ); }
+#endif
 
-            // If you find your debugger stopping you here then go one level up on the
-            // call-stack for the code that caused it (typically a failed assertion)
+} // end namespace Catch
 
-            // (To go back to the test and change execution, jump over the throw, next)
-            CATCH_BREAK_INTO_DEBUGGER();
-        }
-        if (m_reaction.shouldThrow) {
-            throw_test_failure_exception();
-        }
-        if ( m_reaction.shouldSkip ) {
-            throw_test_skip_exception();
+
+
+#if defined( __clang__ )
+#    define CATCH2_CLANG_NO_SANITIZE_INTEGER \
+        __attribute__( ( no_sanitize( "unsigned-integer-overflow" ) ) )
+#else
+#    define CATCH2_CLANG_NO_SANITIZE_INTEGER
+#endif
+namespace Catch {
+
+namespace {
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4146) // we negate uint32 during the rotate
+#endif
+        // Safe rotr implementation thanks to John Regehr
+        CATCH2_CLANG_NO_SANITIZE_INTEGER
+        uint32_t rotate_right(uint32_t val, uint32_t count) {
+            const uint32_t mask = 31;
+            count &= mask;
+            return (val >> count) | (val << (-count & mask));
         }
-    }
 
-    void AssertionHandler::handleUnexpectedInflightException() noexcept {
-        m_resultCapture.handleUnexpectedInflightException( m_assertionInfo, Catch::translateActiveException(), m_reaction );
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif
+
+}
+
+
+    SimplePcg32::SimplePcg32(result_type seed_) {
+        seed(seed_);
     }
 
-    void AssertionHandler::handleExceptionThrownAsExpected() {
-        m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction);
+
+    void SimplePcg32::seed(result_type seed_) {
+        m_state = 0;
+        (*this)();
+        m_state += seed_;
+        (*this)();
     }
-    void AssertionHandler::handleExceptionNotThrownAsExpected() {
-        m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction);
+
+    void SimplePcg32::discard(uint64_t skip) {
+        // We could implement this to run in O(log n) steps, but this
+        // should suffice for our use case.
+        for (uint64_t s = 0; s < skip; ++s) {
+            static_cast<void>((*this)());
+        }
     }
 
-    void AssertionHandler::handleUnexpectedExceptionNotThrown() {
-        m_resultCapture.handleUnexpectedExceptionNotThrown( m_assertionInfo, m_reaction );
+    CATCH2_CLANG_NO_SANITIZE_INTEGER
+    SimplePcg32::result_type SimplePcg32::operator()() {
+        // prepare the output value
+        const uint32_t xorshifted = static_cast<uint32_t>(((m_state >> 18u) ^ m_state) >> 27u);
+        const auto output = rotate_right(xorshifted, static_cast<uint32_t>(m_state >> 59u));
+
+        // advance state
+        m_state = m_state * 6364136223846793005ULL + s_inc;
+
+        return output;
     }
 
-    void AssertionHandler::handleThrowingCallSkipped() {
-        m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction);
+    bool operator==(SimplePcg32 const& lhs, SimplePcg32 const& rhs) {
+        return lhs.m_state == rhs.m_state;
     }
 
-    // This is the overload that takes a string and infers the Equals matcher from it
-    // The more general overload, that takes any string matcher, is in catch_capture_matchers.cpp
-    void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str ) {
-        handleExceptionMatchExpr( handler, Matchers::Equals( str ) );
+    bool operator!=(SimplePcg32 const& lhs, SimplePcg32 const& rhs) {
+        return lhs.m_state != rhs.m_state;
     }
+}
 
-} // namespace Catch
 
 
 
 
-#include <algorithm>
+#include <ctime>
+#include <random>
 
 namespace Catch {
-    namespace Detail {
 
-        bool CaseInsensitiveLess::operator()( StringRef lhs,
-                                              StringRef rhs ) const {
-            return std::lexicographical_compare(
-                lhs.begin(), lhs.end(),
-                rhs.begin(), rhs.end(),
-                []( char l, char r ) { return toLower( l ) < toLower( r ); } );
+    std::uint32_t generateRandomSeed( GenerateFrom from ) {
+        switch ( from ) {
+        case GenerateFrom::Time:
+            return static_cast<std::uint32_t>( std::time( nullptr ) );
+
+        case GenerateFrom::Default:
+        case GenerateFrom::RandomDevice: {
+            std::random_device rd;
+            return Detail::fillBitsFrom<std::uint32_t>( rd );
         }
 
-        bool
-        CaseInsensitiveEqualTo::operator()( StringRef lhs,
-                                            StringRef rhs ) const {
-            return std::equal(
-                lhs.begin(), lhs.end(),
-                rhs.begin(), rhs.end(),
-                []( char l, char r ) { return toLower( l ) == toLower( r ); } );
+        default:
+            CATCH_ERROR("Unknown generation method");
         }
+    }
+
+} // end namespace Catch
 
-    } // namespace Detail
-} // namespace Catch
 
 
 
 namespace Catch {
+    struct ReporterRegistry::ReporterRegistryImpl {
+        std::vector<Detail::unique_ptr<EventListenerFactory>> listeners;
+    };
 
-    Context Context::currentContext;
+    ReporterRegistry::ReporterRegistry():
+        m_impl( Detail::make_unique<ReporterRegistryImpl>() ) {}
 
-    Context& getCurrentMutableContext() {
-        return Context::currentContext;
+    ReporterRegistry::~ReporterRegistry() = default;
+
+    void ReporterRegistry::registerListener(
+        Detail::unique_ptr<EventListenerFactory> factory ) {
+        m_impl->listeners.push_back( CATCH_MOVE( factory ) );
     }
 
-    SimplePcg32& sharedRng() {
-        static SimplePcg32 s_rng;
-        return s_rng;
+    std::vector<Detail::unique_ptr<EventListenerFactory>> const&
+    ReporterRegistry::getListeners() const {
+        return m_impl->listeners;
     }
+} // namespace Catch
 
-}
 
 
+#include <cstdio>
+#include <list>
+#include <sstream>
+#include <tuple>
+#include <vector>
 
-#if defined(CATCH_PLATFORM_MAC) || defined(CATCH_PLATFORM_IPHONE)
-
-#  include <cassert>
-#  include <sys/types.h>
-#  include <unistd.h>
-#  include <cstddef>
-#  include <ostream>
-
-#ifdef __apple_build_version__
-    // These headers will only compile with AppleClang (XCode)
-    // For other compilers (Clang, GCC, ... ) we need to exclude them
-#  include <sys/sysctl.h>
-#endif
-
-    namespace Catch {
-        #ifdef __apple_build_version__
-        // The following function is taken directly from the following technical note:
-        // https://developer.apple.com/library/archive/qa/qa1361/_index.html
-
-        // Returns true if the current process is being debugged (either
-        // running under the debugger or has a debugger attached post facto).
-        bool isDebuggerActive(){
-            int                 mib[4];
-            struct kinfo_proc   info;
-            std::size_t         size;
-
-            // Initialize the flags so that, if sysctl fails for some bizarre
-            // reason, we get a predictable result.
-
-            info.kp_proc.p_flag = 0;
-
-            // Initialize mib, which tells sysctl the info we want, in this case
-            // we're looking for information about a specific process ID.
-
-            mib[0] = CTL_KERN;
-            mib[1] = KERN_PROC;
-            mib[2] = KERN_PROC_PID;
-            mib[3] = getpid();
+namespace Catch {
 
-            // Call sysctl.
+    // This class encapsulates the idea of a pool of ostringstreams that can be reused.
+    struct StringStreams {
+        std::vector<Detail::unique_ptr<std::ostringstream>> m_streams;
+        // The library can be linked into ASan-instrumented clients without
+        // instrumenting Catch3 itself. A list avoids mixed-mode libc++ vector
+        // container annotations for the reusable-index pool.
+        std::list<std::size_t> m_unused;
+        std::ostringstream m_referenceStream; // Used for copy state/ flags from
+        Detail::Mutex m_mutex;
 
-            size = sizeof(info);
-            if( sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, nullptr, 0) != 0 ) {
-                Catch::cerr() << "\n** Call to sysctl failed - unable to determine if debugger is active **\n\n" << std::flush;
-                return false;
+        auto add() -> std::pair<std::size_t, std::ostringstream*> {
+            Detail::LockGuard _( m_mutex );
+            if( m_unused.empty() ) {
+                m_streams.push_back( Detail::make_unique<std::ostringstream>() );
+                return { m_streams.size()-1, m_streams.back().get() };
             }
-
-            // We're being debugged if the P_TRACED flag is set.
-
-            return ( (info.kp_proc.p_flag & P_TRACED) != 0 );
-        }
-        #else
-        bool isDebuggerActive() {
-            // We need to find another way to determine this for non-appleclang compilers on macOS
-            return false;
-        }
-        #endif
-    } // namespace Catch
-
-#elif defined(CATCH_PLATFORM_LINUX) || defined(CATCH_PLATFORM_QNX)
-    #include <fstream>
-    #include <string>
-
-    namespace Catch{
-        // The standard POSIX way of detecting a debugger is to attempt to
-        // ptrace() the process, but this needs to be done from a child and not
-        // this process itself to still allow attaching to this process later
-        // if wanted, so is rather heavy. Under Linux we have the PID of the
-        // "debugger" (which doesn't need to be gdb, of course, it could also
-        // be strace, for example) in /proc/$PID/status, so just get it from
-        // there instead.
-        bool isDebuggerActive(){
-            // Libstdc++ has a bug, where std::ifstream sets errno to 0
-            // This way our users can properly assert over errno values
-            ErrnoGuard guard;
-            std::ifstream in("/proc/self/status");
-            for( std::string line; std::getline(in, line); ) {
-                static const int PREFIX_LEN = 11;
-                if( line.compare(0, PREFIX_LEN, "TracerPid:\t") == 0 ) {
-                    // We're traced if the PID is not 0 and no other PID starts
-                    // with 0 digit, so it's enough to check for just a single
-                    // character.
-                    return line.length() > PREFIX_LEN && line[PREFIX_LEN] != '0';
-                }
+            else {
+                auto index = m_unused.back();
+                m_unused.pop_back();
+                return { index, m_streams[index].get() };
             }
-
-            return false;
-        }
-    } // namespace Catch
-#elif defined(_MSC_VER)
-    extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent();
-    namespace Catch {
-        bool isDebuggerActive() {
-            return IsDebuggerPresent() != 0;
-        }
-    }
-#elif defined(__MINGW32__)
-    extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent();
-    namespace Catch {
-        bool isDebuggerActive() {
-            return IsDebuggerPresent() != 0;
         }
-    }
-#else
-    namespace Catch {
-       bool isDebuggerActive() { return false; }
-    }
-#endif // Platform
-
-
-
-
-namespace Catch {
-
-    void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ) {
-        if( lhs.size() + rhs.size() < 40 &&
-                lhs.find('\n') == std::string::npos &&
-                rhs.find('\n') == std::string::npos )
-            os << lhs << ' ' << op << ' ' << rhs;
-        else
-            os << lhs << '\n' << op << '\n' << rhs;
-    }
-}
-
 
+        void release( std::size_t index, std::ostream* originalPtr ) {
+            assert( originalPtr );
+            originalPtr->copyfmt( m_referenceStream );  // Restore initial flags and other state
 
-#include <stdexcept>
-
+            Detail::LockGuard _( m_mutex );
+            assert( originalPtr == m_streams[index].get() && "Mismatch between release index and stream ptr" );
+            m_unused.push_back( index );
+        }
+    };
 
-namespace Catch {
-#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER)
-    [[noreturn]]
-    void throw_exception(std::exception const& e) {
-        Catch::cerr() << "Catch will terminate because it needed to throw an exception.\n"
-                      << "The message was: " << e.what() << '\n';
-        std::terminate();
+    ReusableStringStream::ReusableStringStream() {
+        std::tie( m_index, m_oss ) =
+            Singleton<StringStreams>::getMutable().add();
     }
-#endif
 
-    [[noreturn]]
-    void throw_logic_error(std::string const& msg) {
-        throw_exception(std::logic_error(msg));
+    ReusableStringStream::~ReusableStringStream() {
+        static_cast<std::ostringstream*>( m_oss )->str("");
+        m_oss->clear();
+        Singleton<StringStreams>::getMutable().release( m_index, m_oss );
     }
 
-    [[noreturn]]
-    void throw_domain_error(std::string const& msg) {
-        throw_exception(std::domain_error(msg));
+    std::string ReusableStringStream::str() const {
+        return static_cast<std::ostringstream*>( m_oss )->str();
     }
 
-    [[noreturn]]
-    void throw_runtime_error(std::string const& msg) {
-        throw_exception(std::runtime_error(msg));
+    void ReusableStringStream::str( std::string const& str ) {
+        static_cast<std::ostringstream*>( m_oss )->str( str );
     }
 
 
-
-} // namespace Catch;
+}
 
 
 
 
 #include <cassert>
+#include <algorithm>
 
 namespace Catch {
 
-    namespace Detail {
-
+    namespace Generators {
         namespace {
-            // Extracts the actual name part of an enum instance
-            // In other words, it returns the Blue part of Bikeshed::Colour::Blue
-            StringRef extractInstanceName(StringRef enumInstance) {
-                // Find last occurrence of ":"
-                size_t name_start = enumInstance.size();
-                while (name_start > 0 && enumInstance[name_start - 1] != ':') {
-                    --name_start;
-                }
-                return enumInstance.substr(name_start, enumInstance.size() - name_start);
-            }
-        }
+            struct GeneratorTracker final : TestCaseTracking::TrackerBase,
+                                      IGeneratorTracker {
+                GeneratorBasePtr m_generator;
+                // Filtered generator has moved to specific index due to
+                // a filter, it needs special handling of `countedNext()`
+                bool m_isFiltered = false;
 
-        std::vector<StringRef> parseEnums( StringRef enums ) {
-            auto enumValues = splitStringRef( enums, ',' );
-            std::vector<StringRef> parsed;
-            parsed.reserve( enumValues.size() );
-            for( auto const& enumValue : enumValues ) {
-                parsed.push_back(trim(extractInstanceName(enumValue)));
-            }
-            return parsed;
-        }
+                GeneratorTracker(
+                    TestCaseTracking::NameAndLocation&& nameAndLocation,
+                    TrackerContext& ctx,
+                    ITracker* parent,
+                    GeneratorBasePtr&& generator ):
+                    TrackerBase( CATCH_MOVE( nameAndLocation ), ctx, parent ),
+                    m_generator( CATCH_MOVE( generator ) ) {
+                    assert( m_generator &&
+                            "Cannot create tracker without generator" );
 
-        StringRef EnumInfo::lookup( int64_t value ) const {
-            for( auto const& valueToName : m_values ) {
-                if( valueToName.first == value )
-                    return valueToName.second;
-            }
-            return "{** unexpected enum value **}"_sr;
-        }
+                    // Handle potential filter and move forward here...
+                    // Old style filters do not affect generators at all
+                    if (m_newStyleFilters && m_allTrackerDepth < m_filterRef->size()) {
+                        auto const& filter =
+                            ( *m_filterRef )[m_allTrackerDepth];
+                        // Generator cannot be un-entered the way a section
+                        // can be, so the tracker has to throw for a wrong
+                        // filter to stop the execution flow.
+                        if (filter.type == PathFilter::For::Section) {
+                            // We want the semantics of `SKIP()`, but we inline it
+                            // to avoid issues with conditionally prefixed macros
+                            INTERNAL_CATCH_MSG(
+                                "SKIP",
+                                Catch::ResultWas::ExplicitSkip,
+                                Catch::ResultDisposition::Normal,
+                                "" );
+                            Catch::Detail::Unreachable();
+                        }
+                        // '*' is the wildcard for "all elements in generator"
+                        // used for filtering sections below the generator, but
+                        // not the generator itself.
+                        if ( filter.filter != "*" ) {
+                            m_isFiltered = true;
+                            // TBD: We assume that the filter was validated as
+                            //      number during parsing. We should pass it
+                            //      as number from the CLI parser.
+                            size_t targetIndex = std::stoul( filter.filter );
+                            m_generator->skipToNthElement( targetIndex );
+                        }
+                    }
+                }
 
-        EnumInfo makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector<int64_t> const& values ) {
-            EnumInfo enumInfo;
-            enumInfo.m_name = enumName;
-            enumInfo.m_values.reserve( values.size() );
-
-            const auto valueNames = Catch::Detail::parseEnums( allValueNames );
-            assert( valueNames.size() == values.size() );
-            for (size_t i = 0; i < values.size(); ++i) {
-                enumInfo.m_values.emplace_back( values[i], valueNames[i] );
-            }
-
-            return enumInfo;
-        }
+                static GeneratorTracker*
+                acquire( TrackerContext& ctx,
+                         TestCaseTracking::NameAndLocationRef const&
+                             nameAndLocation ) {
+                    GeneratorTracker* tracker;
 
-    } // Detail
-} // Catch
+                    ITracker& currentTracker = ctx.currentTracker();
+                    // Under specific circumstances, the generator we want
+                    // to acquire is also the current tracker. If this is
+                    // the case, we have to avoid looking through current
+                    // tracker's children, and instead return the current
+                    // tracker.
+                    // A case where this check is important is e.g.
+                    //     for (int i = 0; i < 5; ++i) {
+                    //         int n = GENERATE(1, 2);
+                    //     }
+                    //
+                    // without it, the code above creates 5 nested generators.
+                    if ( currentTracker.nameAndLocation() == nameAndLocation ) {
+                        auto thisTracker = currentTracker.parent()->findChild(
+                            nameAndLocation );
+                        assert( thisTracker );
+                        assert( thisTracker->isGeneratorTracker() );
+                        tracker = static_cast<GeneratorTracker*>( thisTracker );
+                    } else if ( ITracker* childTracker =
+                                    currentTracker.findChild(
+                                        nameAndLocation ) ) {
+                        assert( childTracker );
+                        assert( childTracker->isGeneratorTracker() );
+                        tracker =
+                            static_cast<GeneratorTracker*>( childTracker );
+                    } else {
+                        return nullptr;
+                    }
 
+                    if ( !tracker->isComplete() ) { tracker->open(); }
 
+                    return tracker;
+                }
 
+                // TrackerBase interface
+                bool isGeneratorTracker() const override { return true; }
+                void close() override {
+                    TrackerBase::close();
+                    // If a generator has a child (it is followed by a section)
+                    // and none of its children have started, then we must wait
+                    // until later to start consuming its values.
+                    // This catches cases where `GENERATE` is placed between two
+                    // `SECTION`s.
+                    // **The check for m_children.empty cannot be removed**.
+                    // doing so would break `GENERATE` _not_ followed by
+                    // `SECTION`s.
+                    const bool should_wait_for_child = [&]() {
+                        // No children -> nobody to wait for
+                        if ( m_children.empty() ) { return false; }
+                        // If at least one child started executing, don't wait
+                        if ( std::find_if(
+                                 m_children.begin(),
+                                 m_children.end(),
+                                 []( TestCaseTracking::ITrackerPtr const&
+                                         tracker ) {
+                                     return tracker->hasStarted();
+                                 } ) != m_children.end() ) {
+                            return false;
+                        }
 
+                        // No children have started. We need to check if they
+                        // _can_ start, and thus we should wait for them, or
+                        // they cannot start (due to filters), and we shouldn't
+                        // wait for them
 
-#include <cerrno>
+                        // No filters left -> no restrictions on running sections
+                        size_t childDepth = 1 + (m_newStyleFilters ? m_allTrackerDepth : m_sectionOnlyDepth);
+                        if ( childDepth >= m_filterRef->size() ) {
+                            return true;
+                        }
 
-namespace Catch {
-        ErrnoGuard::ErrnoGuard():m_oldErrno(errno){}
-        ErrnoGuard::~ErrnoGuard() { errno = m_oldErrno; }
-}
+                        // If we are using the new style filters, we need to check
+                        // whether the successive filter is for section or a generator.
+                        if ( m_newStyleFilters
+                            && (*m_filterRef)[childDepth].type != PathFilter::For::Section ) {
+                            return false;
+                        }
+                        // Look for any child section that could match the remaining filters
+                        for ( auto const& child : m_children ) {
+                            if ( child->isSectionTracker() &&
+                                 static_cast<SectionTracker const&>( *child )
+                                         .trimmedName() == StringRef((*m_filterRef)[childDepth].filter) ) {
+                                return true;
+                            }
+                        }
+                        return false;
+                    }();
 
+                    // This check is a bit tricky, because m_generator->next()
+                    // has a side-effect, where it consumes generator's current
+                    // value, but we do not want to invoke the side-effect if
+                    // this generator is still waiting for any child to start.
+                    assert( m_generator && "Tracker without generator" );
+                    if ( should_wait_for_child
+                        ||  ( m_runState == CompletedSuccessfully
+                            && !m_isFiltered // filtered generators cannot meaningfully move forward, as they would get past the filter
+                            && m_generator->countedNext() ) ) {
+                        m_children.clear();
+                        m_runState = Executing;
+                    }
+                }
 
+                // IGeneratorTracker interface
+                auto getGenerator() const -> GeneratorBasePtr const& override {
+                    return m_generator;
+                }
 
-#include <exception>
+                bool isFilteredImpl() const override { return m_isFiltered; }
+            };
+        } // namespace
+    }
 
-namespace Catch {
+    namespace Detail {
+        // Assertions are owned by the thread that is executing them.
+        // This allows for lock-free progress in common cases where we
+        // do not need to send the assertion events to the reporter.
+        // This also implies that messages are owned by their respective
+        // threads, and should not be shared across different threads.
+        //
+        // This implies that various pieces of metadata referring to last
+        // assertion result/source location/message handling, etc
+        // should also be thread local. For now we just use naked globals
+        // below, in the future we will want to allocate piece of memory
+        // from heap, to avoid consuming too much thread-local storage.
+        //
+        // Note that we also don't want non-trivial the thread-local variables
+        // below be initialized for every thread, only for those that touch
+        // Catch2. To make this work with both GCC/Clang and MSVC, we have to
+        // make them thread-local magic statics. (Class-level statics have the
+        // desired semantics on GCC, but not on MSVC).
 
-#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
-    namespace {
-        static std::string tryTranslators(
-            std::vector<
-                Detail::unique_ptr<IExceptionTranslator const>> const& translators ) {
-            if ( translators.empty() ) {
-                std::rethrow_exception( std::current_exception() );
-            } else {
-                return translators[0]->translate( translators.begin() + 1,
-                                                  translators.end() );
-            }
-        }
+        // This is used for the "if" part of CHECKED_IF/CHECKED_ELSE
+        static CATCH_INTERNAL_THREAD_LOCAL bool g_lastAssertionPassed = false;
 
-    }
-#endif //!defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
+        // This is the source location for last encountered macro. It is
+        // used to provide the users with more precise location of error
+        // when an unexpected exception/fatal error happens.
+        static CATCH_INTERNAL_THREAD_LOCAL SourceLineInfo
+            g_lastKnownLineInfo( "DummyLocation", static_cast<size_t>( -1 ) );
 
-    ExceptionTranslatorRegistry::~ExceptionTranslatorRegistry() = default;
+        // Should we clear message scopes before sending off the messages to
+        // reporter? Set in `assertionPassedFastPath` to avoid doing the full
+        // clear there for performance reasons.
+        static CATCH_INTERNAL_THREAD_LOCAL bool g_clearMessageScopes = false;
 
-    void ExceptionTranslatorRegistry::registerTranslator( Detail::unique_ptr<IExceptionTranslator>&& translator ) {
-        m_translators.push_back( CATCH_MOVE( translator ) );
-    }
 
-#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
-    std::string ExceptionTranslatorRegistry::translateActiveException() const {
-        // Compiling a mixed mode project with MSVC means that CLR
-        // exceptions will be caught in (...) as well. However, these do
-        // do not fill-in std::current_exception and thus lead to crash
-        // when attempting rethrow.
-        // /EHa switch also causes structured exceptions to be caught
-        // here, but they fill-in current_exception properly, so
-        // at worst the output should be a little weird, instead of
-        // causing a crash.
-        if ( std::current_exception() == nullptr ) {
-            return "Non C++ exception. Possibly a CLR exception.";
-        }
+        // Holds the data for both scoped and unscoped messages together,
+        // to avoid issues where their lifetimes start in wrong order,
+        // and then are destroyed in wrong order.
+        class MessageHolder {
+            // The actual message vector passed to the reporters
+            std::vector<MessageInfo> messages;
+            // IDs of messages from UNSCOPED_X macros, which we have to
+            // remove manually.
+            std::vector<unsigned int> unscoped_ids;
 
-        // First we try user-registered translators. If none of them can
-        // handle the exception, it will be rethrown handled by our defaults.
-        try {
-            return tryTranslators(m_translators);
-        }
-        // To avoid having to handle TFE explicitly everywhere, we just
-        // rethrow it so that it goes back up the caller.
-        catch( TestFailureException& ) {
-            return "{ nested assertion failed }";
-        }
-        catch( TestSkipException& ) {
-            return "{ nested SKIP() called }";
-        }
-        catch( std::exception const& ex ) {
-            return ex.what();
-        }
-        catch( std::string const& msg ) {
-            return msg;
-        }
-        catch( const char* msg ) {
-            return msg;
-        }
-        catch(...) {
-            return "Unknown exception";
-        }
-    }
+        public:
+            // We do not need to special-case the unscoped messages when
+            // we only keep around the raw msg ids.
+            ~MessageHolder() = default;
 
-#else // ^^ Exceptions are enabled // Exceptions are disabled vv
-    std::string ExceptionTranslatorRegistry::translateActiveException() const {
-        CATCH_INTERNAL_ERROR("Attempted to translate active exception under CATCH_CONFIG_DISABLE_EXCEPTIONS!");
-    }
-#endif
+            void addUnscopedMessage( MessageInfo&& info ) {
+                repairUnscopedMessageInvariant();
+                unscoped_ids.push_back( info.sequence );
+                messages.push_back( CATCH_MOVE( info ) );
+            }
 
-}
+            void addUnscopedMessage(MessageBuilder&& builder) {
+                MessageInfo info( CATCH_MOVE( builder.m_info ) );
+                info.message = builder.m_stream.str();
+                addUnscopedMessage( CATCH_MOVE( info ) );
+            }
 
+            void addScopedMessage(MessageInfo&& info) {
+                messages.push_back( CATCH_MOVE( info ) );
+            }
 
+            std::vector<MessageInfo> const& getMessages() const {
+                return messages;
+            }
 
-/** \file
- * This file provides platform specific implementations of FatalConditionHandler
- *
- * This means that there is a lot of conditional compilation, and platform
- * specific code. Currently, Catch2 supports a dummy handler (if no
- * handler is desired), and 2 platform specific handlers:
- *  * Windows' SEH
- *  * POSIX signals
- *
- * Consequently, various pieces of code below are compiled if either of
- * the platform specific handlers is enabled, or if none of them are
- * enabled. It is assumed that both cannot be enabled at the same time,
- * and doing so should cause a compilation error.
- *
- * If another platform specific handler is added, the compile guards
- * below will need to be updated taking these assumptions into account.
- */
-
+            void removeMessage( unsigned int messageId ) {
+                // Note: On average, it would probably be better to look for
+                //       the message backwards. However, we do not expect to have
+                //       to  deal with more messages than low single digits, so
+                //       the improvement is tiny, and we would have to hand-write
+                //       the loop to avoid terrible codegen of reverse iterators
+                //       in debug mode.
+                auto iter =
+                    std::find_if( messages.begin(),
+                                  messages.end(),
+                                  [messageId]( MessageInfo const& msg ) {
+                                      return msg.sequence == messageId;
+                                  } );
+                assert( iter != messages.end() &&
+                        "Trying to remove non-existent message." );
+                messages.erase( iter );
+            }
 
+            void removeUnscopedMessages() {
+                for ( const auto messageId : unscoped_ids ) {
+                    removeMessage( messageId );
+                }
+                unscoped_ids.clear();
+                g_clearMessageScopes = false;
+            }
 
-#include <algorithm>
+            void repairUnscopedMessageInvariant() {
+                if ( g_clearMessageScopes ) { removeUnscopedMessages(); }
+                g_clearMessageScopes = false;
+            }
+        };
 
-#if !defined( CATCH_CONFIG_WINDOWS_SEH ) && !defined( CATCH_CONFIG_POSIX_SIGNALS )
+        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION
+        CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
+        static MessageHolder& g_messageHolder() {
+            static CATCH_INTERNAL_THREAD_LOCAL MessageHolder value;
+            return value;
+        }
+        CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
 
-namespace Catch {
 
-    // If neither SEH nor signal handling is required, the handler impls
-    // do not have to do anything, and can be empty.
-    void FatalConditionHandler::engage_platform() {}
-    void FatalConditionHandler::disengage_platform() noexcept {}
-    FatalConditionHandler::FatalConditionHandler() = default;
-    FatalConditionHandler::~FatalConditionHandler() = default;
+        void pushScopedMessage( MessageInfo&& message ) {
+            Detail::g_messageHolder().addScopedMessage(  CATCH_MOVE( message ) );
+        }
 
-} // end namespace Catch
+        void popScopedMessage( unsigned int messageId ) {
+            Detail::g_messageHolder().removeMessage( messageId );
+        }
 
-#endif // !CATCH_CONFIG_WINDOWS_SEH && !CATCH_CONFIG_POSIX_SIGNALS
+        void emplaceUnscopedMessage( MessageBuilder&& builder ) {
+            Detail::g_messageHolder().addUnscopedMessage( CATCH_MOVE( builder ) );
+        }
 
-#if defined( CATCH_CONFIG_WINDOWS_SEH ) && defined( CATCH_CONFIG_POSIX_SIGNALS )
-#error "Inconsistent configuration: Windows' SEH handling and POSIX signals cannot be enabled at the same time"
-#endif // CATCH_CONFIG_WINDOWS_SEH && CATCH_CONFIG_POSIX_SIGNALS
+        void addUnscopedMessage( MessageInfo&& message ) {
+            Detail::g_messageHolder().addUnscopedMessage( CATCH_MOVE( message ) );
+        }
 
-#if defined( CATCH_CONFIG_WINDOWS_SEH ) || defined( CATCH_CONFIG_POSIX_SIGNALS )
+        bool lastAssertionPassed() { return Detail::g_lastAssertionPassed; }
 
-namespace {
-    //! Signals fatal error message to the run context
-    void reportFatal( char const * const message ) {
-        Catch::getCurrentContext().getResultCapture()->handleFatalErrorCondition( message );
-    }
+    } // namespace Detail
 
-    //! Minimal size Catch2 needs for its own fatal error handling.
-    //! Picked empirically, so it might not be sufficient on all
-    //! platforms, and for all configurations.
-    constexpr std::size_t minStackSizeForErrors = 32 * 1024;
-} // end unnamed namespace
+    RunContext::RunContext(IConfig const* _config, IEventListenerPtr&& reporter)
+    :   m_runInfo(_config->name()),
+        m_config(_config),
+        m_reporter(CATCH_MOVE(reporter)),
+        m_outputRedirect( makeOutputRedirect( m_reporter->getPreferences().shouldRedirectStdOut ) ),
+        m_abortAfterXFailedAssertions( m_config->abortAfter() ),
+        m_reportAssertionStarting( m_reporter->getPreferences().shouldReportAllAssertionStarts ),
+        m_includeSuccessfulResults( m_config->includeSuccessfulResults() || m_reporter->getPreferences().shouldReportAllAssertions ),
+        m_shouldDebugBreak( m_config->shouldDebugBreak() )
+    {
+        getCurrentMutableContext().setResultCapture( this );
+        m_reporter->testRunStarting(m_runInfo);
 
-#endif // CATCH_CONFIG_WINDOWS_SEH || CATCH_CONFIG_POSIX_SIGNALS
+        // TODO: HACK!
+        //       We need to make sure the underlying cache is initialized
+        //       while we are guaranteed to be running in a single thread,
+        //       because the initialization is not thread-safe.
+        ReusableStringStream rss;
+        (void)rss;
+    }
 
-#if defined( CATCH_CONFIG_WINDOWS_SEH )
+    RunContext::~RunContext() {
+        updateTotalsFromAtomics();
+        m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, aborting()));
+    }
 
-namespace Catch {
+    Totals RunContext::runTest(TestCaseHandle const& testCase) {
+        updateTotalsFromAtomics();
+        const Totals prevTotals = m_totals;
 
-    struct SignalDefs { DWORD id; const char* name; };
+        auto const& testInfo = testCase.getTestCaseInfo();
+        m_reporter->testCaseStarting(testInfo);
+        testCase.prepareTestCase();
+        m_activeTestCase = &testCase;
 
-    // There is no 1-1 mapping between signals and windows exceptions.
-    // Windows can easily distinguish between SO and SigSegV,
-    // but SigInt, SigTerm, etc are handled differently.
-    static constexpr SignalDefs signalDefs[] = {
-        { EXCEPTION_ILLEGAL_INSTRUCTION,  "SIGILL - Illegal instruction signal" },
-        { EXCEPTION_STACK_OVERFLOW, "SIGSEGV - Stack overflow" },
-        { EXCEPTION_ACCESS_VIOLATION, "SIGSEGV - Segmentation violation signal" },
-        { EXCEPTION_INT_DIVIDE_BY_ZERO, "Divide by zero error" },
-    };
 
-    // Since we do not support multiple instantiations, we put these
-    // into global variables and rely on cleaning them up in outlined
-    // constructors/destructors
-    static LPTOP_LEVEL_EXCEPTION_FILTER previousTopLevelExceptionFilter = nullptr;
+        ITracker& rootTracker = m_trackerContext.startRun();
+        assert(rootTracker.isSectionTracker());
+        rootTracker.setFilters( &m_config->getPathFilters(),
+                                m_config->useNewFilterBehaviour() );
 
+        // We intentionally only seed the internal RNG once per test case,
+        // before it is first invoked. The reason for that is a complex
+        // interplay of generator/section implementation details and the
+        // Random*Generator types.
+        //
+        // The issue boils down to us needing to seed the Random*Generators
+        // with different seed each, so that they return different sequences
+        // of random numbers. We do this by giving them a number from the
+        // shared RNG instance as their seed.
+        //
+        // However, this runs into an issue if the reseeding happens each
+        // time the test case is entered (as opposed to first time only),
+        // because multiple generators could get the same seed, e.g. in
+        // ```cpp
+        // TEST_CASE() {
+        //     auto i = GENERATE(take(10, random(0, 100));
+        //     SECTION("A") {
+        //         auto j = GENERATE(take(10, random(0, 100));
+        //     }
+        //     SECTION("B") {
+        //         auto k = GENERATE(take(10, random(0, 100));
+        //     }
+        // }
+        // ```
+        // `i` and `j` would properly return values from different sequences,
+        // but `i` and `k` would return the same sequence, because their seed
+        // would be the same.
+        // (The reason their seeds would be the same is that the generator
+        //  for k would be initialized when the test case is entered the second
+        //  time, after the shared RNG instance was reset to the same value
+        //  it had when the generator for i was initialized.)
+        seedRng( *m_config );
 
-    static LONG CALLBACK topLevelExceptionFilter(PEXCEPTION_POINTERS ExceptionInfo) {
-        for (auto const& def : signalDefs) {
-            if (ExceptionInfo->ExceptionRecord->ExceptionCode == def.id) {
-                reportFatal(def.name);
-            }
-        }
-        // If a filter was previously registered, invoke it
-        if (previousTopLevelExceptionFilter) {
-            return previousTopLevelExceptionFilter(ExceptionInfo);
-        }
-        // Otherwise, pass along all exceptions.
-        // This stops us from eating debugger breaks etc.
-        return EXCEPTION_CONTINUE_SEARCH;
-    }
+        uint64_t testRuns = 0;
+        std::string redirectedCout;
+        std::string redirectedCerr;
+        do {
+            m_trackerContext.startCycle();
+            m_testCaseTracker = &SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocationRef(testInfo.name, testInfo.lineInfo));
 
-    // For MSVC, we reserve part of the stack memory for handling
-    // memory overflow structured exception.
-    FatalConditionHandler::FatalConditionHandler() {
-        ULONG guaranteeSize = static_cast<ULONG>(minStackSizeForErrors);
-        if (!SetThreadStackGuarantee(&guaranteeSize)) {
-            // We do not want to fully error out, because needing
-            // the stack reserve should be rare enough anyway.
-            Catch::cerr()
-                << "Failed to reserve piece of stack."
-                << " Stack overflows will not be reported successfully.";
-        }
-    }
+            m_reporter->testCasePartialStarting(testInfo, testRuns);
 
-    // We do not attempt to unset the stack guarantee, because
-    // Windows does not support lowering the stack size guarantee.
-    FatalConditionHandler::~FatalConditionHandler() = default;
+            updateTotalsFromAtomics();
+            const auto beforeRunTotals = m_totals;
+            runCurrentTest();
+            std::string oneRunCout = m_outputRedirect->getStdout();
+            std::string oneRunCerr = m_outputRedirect->getStderr();
+            m_outputRedirect->clearBuffers();
+            redirectedCout += oneRunCout;
+            redirectedCerr += oneRunCerr;
 
+            updateTotalsFromAtomics();
+            const auto singleRunTotals = m_totals.delta(beforeRunTotals);
+            auto statsForOneRun = TestCaseStats(testInfo, singleRunTotals, CATCH_MOVE(oneRunCout), CATCH_MOVE(oneRunCerr), aborting());
+            m_reporter->testCasePartialEnded(statsForOneRun, testRuns);
 
-    void FatalConditionHandler::engage_platform() {
-        // Register as a the top level exception filter.
-        previousTopLevelExceptionFilter = SetUnhandledExceptionFilter(topLevelExceptionFilter);
-    }
+            ++testRuns;
+        } while (!m_testCaseTracker->isSuccessfullyCompleted() && !aborting());
 
-    void FatalConditionHandler::disengage_platform() noexcept {
-        if (SetUnhandledExceptionFilter(previousTopLevelExceptionFilter) != topLevelExceptionFilter) {
-            Catch::cerr()
-                << "Unexpected SEH unhandled exception filter on disengage."
-                << " The filter was restored, but might be rolled back unexpectedly.";
+        Totals deltaTotals = m_totals.delta(prevTotals);
+        if (testInfo.expectedToFail() && deltaTotals.testCases.passed > 0) {
+            deltaTotals.assertions.failed++;
+            deltaTotals.testCases.passed--;
+            deltaTotals.testCases.failed++;
         }
-        previousTopLevelExceptionFilter = nullptr;
-    }
-
-} // end namespace Catch
-
-#endif // CATCH_CONFIG_WINDOWS_SEH
+        m_totals.testCases += deltaTotals.testCases;
+        testCase.tearDownTestCase();
+        m_reporter->testCaseEnded(TestCaseStats(testInfo,
+                                  deltaTotals,
+                                  CATCH_MOVE(redirectedCout),
+                                  CATCH_MOVE(redirectedCerr),
+                                  aborting()));
 
-#if defined( CATCH_CONFIG_POSIX_SIGNALS )
+        m_activeTestCase = nullptr;
+        m_testCaseTracker = nullptr;
 
-#include <signal.h>
+        return deltaTotals;
+    }
 
-namespace Catch {
 
-    struct SignalDefs {
-        int id;
-        const char* name;
-    };
-
-    static constexpr SignalDefs signalDefs[] = {
-        { SIGINT,  "SIGINT - Terminal interrupt signal" },
-        { SIGILL,  "SIGILL - Illegal instruction signal" },
-        { SIGFPE,  "SIGFPE - Floating point error signal" },
-        { SIGSEGV, "SIGSEGV - Segmentation violation signal" },
-        { SIGTERM, "SIGTERM - Termination request signal" },
-        { SIGABRT, "SIGABRT - Abort (abnormal termination) signal" }
-    };
-
-// Older GCCs trigger -Wmissing-field-initializers for T foo = {}
-// which is zero initialization, but not explicit. We want to avoid
-// that.
-#if defined(__GNUC__)
-#    pragma GCC diagnostic push
-#    pragma GCC diagnostic ignored "-Wmissing-field-initializers"
-#endif
+    void RunContext::assertionEnded(AssertionResult&& result) {
+        Detail::g_lastKnownLineInfo = result.m_info.lineInfo;
+        if (result.getResultType() == ResultWas::Ok) {
+            m_atomicAssertionCount.passed++;
+            Detail::g_lastAssertionPassed = true;
+        } else if (result.getResultType() == ResultWas::ExplicitSkip) {
+            m_atomicAssertionCount.skipped++;
+            Detail::g_lastAssertionPassed = true;
+        } else if (!result.succeeded()) {
+            Detail::g_lastAssertionPassed = false;
+            if (result.isOk()) {}
+            else if( m_activeTestCase->getTestCaseInfo().okToFail() ) { // Read from a shared state established before the threads could start, this is fine
+                m_atomicAssertionCount.failedButOk++;
+            } else {
+                m_atomicAssertionCount.failed++;
+            }
+        } else {
+            Detail::g_lastAssertionPassed = true;
+        }
 
-    static char* altStackMem = nullptr;
-    static std::size_t altStackSize = 0;
-    static stack_t oldSigStack{};
-    static struct sigaction oldSigActions[sizeof(signalDefs) / sizeof(SignalDefs)]{};
+        auto& msgHolder = Detail::g_messageHolder();
+        msgHolder.repairUnscopedMessageInvariant();
 
-    static void restorePreviousSignalHandlers() noexcept {
-        // We set signal handlers back to the previous ones. Hopefully
-        // nobody overwrote them in the meantime, and doesn't expect
-        // their signal handlers to live past ours given that they
-        // installed them after ours..
-        for (std::size_t i = 0; i < sizeof(signalDefs) / sizeof(SignalDefs); ++i) {
-            sigaction(signalDefs[i].id, &oldSigActions[i], nullptr);
+        // From here, we are touching shared state and need mutex.
+        Detail::LockGuard lock( m_assertionMutex );
+        {
+            auto _ = scopedDeactivate( *m_outputRedirect );
+            updateTotalsFromAtomics();
+            m_reporter->assertionEnded( AssertionStats( result, msgHolder.getMessages(), m_totals ) );
         }
-        // Return the old stack
-        sigaltstack(&oldSigStack, nullptr);
-    }
 
-    static void handleSignal( int sig ) {
-        char const * name = "<unknown signal>";
-        for (auto const& def : signalDefs) {
-            if (sig == def.id) {
-                name = def.name;
-                break;
-            }
+        if ( result.getResultType() != ResultWas::Warning ) {
+            msgHolder.removeUnscopedMessages();
         }
-        // We need to restore previous signal handlers and let them do
-        // their thing, so that the users can have the debugger break
-        // when a signal is raised, and so on.
-        restorePreviousSignalHandlers();
-        reportFatal( name );
-        raise( sig );
+
+        // Reset working state. assertion info will be reset after
+        // populateReaction is run if it is needed
+        m_lastResult = CATCH_MOVE( result );
     }
 
-    FatalConditionHandler::FatalConditionHandler() {
-        assert(!altStackMem && "Cannot initialize POSIX signal handler when one already exists");
-        if (altStackSize == 0) {
-            altStackSize = std::max(static_cast<size_t>(SIGSTKSZ), minStackSizeForErrors);
+    void RunContext::notifyAssertionStarted( AssertionInfo const& info ) {
+        if (m_reportAssertionStarting) {
+            Detail::LockGuard lock( m_assertionMutex );
+            auto _ = scopedDeactivate( *m_outputRedirect );
+            m_reporter->assertionStarting( info );
         }
-        altStackMem = new char[altStackSize]();
     }
 
-    FatalConditionHandler::~FatalConditionHandler() {
-        delete[] altStackMem;
-        // We signal that another instance can be constructed by zeroing
-        // out the pointer.
-        altStackMem = nullptr;
-    }
+    bool RunContext::sectionStarted( StringRef sectionName,
+                                     SourceLineInfo const& sectionLineInfo,
+                                     Counts& assertions ) {
+        ITracker& sectionTracker =
+            SectionTracker::acquire( m_trackerContext,
+                                     TestCaseTracking::NameAndLocationRef(
+                                         sectionName, sectionLineInfo ) );
 
-    void FatalConditionHandler::engage_platform() {
-        stack_t sigStack;
-        sigStack.ss_sp = altStackMem;
-        sigStack.ss_size = altStackSize;
-        sigStack.ss_flags = 0;
-        sigaltstack(&sigStack, &oldSigStack);
-        struct sigaction sa = { };
+        if (!sectionTracker.isOpen())
+            return false;
+        m_activeSections.push_back(&sectionTracker);
 
-        sa.sa_handler = handleSignal;
-        sa.sa_flags = SA_ONSTACK;
-        for (std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i) {
-            sigaction(signalDefs[i].id, &sa, &oldSigActions[i]);
-        }
-    }
+        SectionInfo sectionInfo( sectionLineInfo, static_cast<std::string>(sectionName) );
+        Detail::g_lastKnownLineInfo = sectionLineInfo;
 
-#if defined(__GNUC__)
-#    pragma GCC diagnostic pop
-#endif
+        {
+            auto _ = scopedDeactivate( *m_outputRedirect );
+            m_reporter->sectionStarting( sectionInfo );
+        }
 
+        updateTotalsFromAtomics();
+        assertions = m_totals.assertions;
 
-    void FatalConditionHandler::disengage_platform() noexcept {
-        restorePreviousSignalHandlers();
+        return true;
+    }
+    IGeneratorTracker*
+    RunContext::acquireGeneratorTracker( StringRef generatorName,
+                                         SourceLineInfo const& lineInfo ) {
+        auto* tracker = Generators::GeneratorTracker::acquire(
+            m_trackerContext,
+            TestCaseTracking::NameAndLocationRef(
+                 generatorName, lineInfo ) );
+        Detail::g_lastKnownLineInfo = lineInfo;
+        return tracker;
     }
 
-} // end namespace Catch
+    IGeneratorTracker* RunContext::createGeneratorTracker(
+        StringRef generatorName,
+        SourceLineInfo lineInfo,
+        Generators::GeneratorBasePtr&& generator ) {
 
-#endif // CATCH_CONFIG_POSIX_SIGNALS
+        auto nameAndLoc = TestCaseTracking::NameAndLocation( static_cast<std::string>( generatorName ), lineInfo );
+        auto& currentTracker = m_trackerContext.currentTracker();
+        assert(
+            currentTracker.nameAndLocation() != nameAndLoc &&
+            "Trying to create tracker for a generator that already has one" );
 
+        auto newTracker =
+            Catch::Detail::make_unique<Generators::GeneratorTracker>(
+                CATCH_MOVE( nameAndLoc ),
+                m_trackerContext,
+                &currentTracker,
+                CATCH_MOVE( generator ) );
 
+        // The warning shouldn't fire if the generator is infinite, **but** filtered down.
+        if ( m_config->warnAboutInfiniteGenerators() &&
+             !newTracker->m_generator->isFinite() &&
+             !newTracker->isFiltered() ) {
+            // We want the semantics of `FAIL()`, but we inline it
+            // to avoid issues with conditionally prefixed macros
+            INTERNAL_CATCH_MSG( "FAIL",
+                                Catch::ResultWas::ExplicitFailure,
+                                Catch::ResultDisposition::Normal,
+                                "GENERATE() would run infinitely" );
+        }
 
+        auto returnPtr = newTracker.get();
+        currentTracker.addChild( CATCH_MOVE( newTracker ) );
 
-#include <cstring>
+        returnPtr->open();
+        return returnPtr;
+    }
 
-namespace Catch {
-    namespace Detail {
+    bool RunContext::testForMissingAssertions(Counts& assertions) {
+        if (assertions.total() != 0)
+            return false;
+        if (!m_config->warnAboutMissingAssertions())
+            return false;
+        if (m_trackerContext.currentTracker().hasChildren())
+            return false;
+        m_atomicAssertionCount.failed++;
+        assertions.failed++;
+        return true;
+    }
 
-        uint32_t convertToBits(float f) {
-            static_assert(sizeof(float) == sizeof(uint32_t), "Important ULP matcher assumption violated");
-            uint32_t i;
-            std::memcpy(&i, &f, sizeof(f));
-            return i;
+    void RunContext::sectionEnded(SectionEndInfo&& endInfo) {
+        updateTotalsFromAtomics();
+        Counts assertions = m_totals.assertions - endInfo.prevAssertions;
+        bool missingAssertions = testForMissingAssertions(assertions);
+
+        if (!m_activeSections.empty()) {
+            m_activeSections.back()->close();
+            m_activeSections.pop_back();
         }
 
-        uint64_t convertToBits(double d) {
-            static_assert(sizeof(double) == sizeof(uint64_t), "Important ULP matcher assumption violated");
-            uint64_t i;
-            std::memcpy(&i, &d, sizeof(d));
-            return i;
+        {
+            auto _ = scopedDeactivate( *m_outputRedirect );
+            m_reporter->sectionEnded(
+                SectionStats( CATCH_MOVE( endInfo.sectionInfo ),
+                              assertions,
+                              endInfo.durationInSeconds,
+                              missingAssertions ) );
         }
+    }
 
-#if defined( __GNUC__ ) || defined( __clang__ )
-#    pragma GCC diagnostic push
-#    pragma GCC diagnostic ignored "-Wfloat-equal"
-#endif
-        bool directCompare( float lhs, float rhs ) { return lhs == rhs; }
-        bool directCompare( double lhs, double rhs ) { return lhs == rhs; }
-#if defined( __GNUC__ ) || defined( __clang__ )
-#    pragma GCC diagnostic pop
-#endif
+    void RunContext::sectionEndedEarly(SectionEndInfo&& endInfo) {
+        if ( m_unfinishedSections.empty() ) {
+            m_activeSections.back()->fail();
+        } else {
+            m_activeSections.back()->close();
+        }
+        m_activeSections.pop_back();
 
+        m_unfinishedSections.push_back(CATCH_MOVE(endInfo));
+    }
 
-    } // end namespace Detail
-} // end namespace Catch
+    void RunContext::benchmarkPreparing( StringRef name ) {
+        auto _ = scopedDeactivate( *m_outputRedirect );
+        m_reporter->benchmarkPreparing( name );
+    }
+    void RunContext::benchmarkStarting( BenchmarkInfo const& info ) {
+        auto _ = scopedDeactivate( *m_outputRedirect );
+        m_reporter->benchmarkStarting( info );
+    }
+    void RunContext::benchmarkEnded( BenchmarkStats<> const& stats ) {
+        auto _ = scopedDeactivate( *m_outputRedirect );
+        m_reporter->benchmarkEnded( stats );
+    }
+    void RunContext::benchmarkFailed( StringRef error ) {
+        auto _ = scopedDeactivate( *m_outputRedirect );
+        m_reporter->benchmarkFailed( error );
+    }
 
+    std::string RunContext::getCurrentTestName() const {
+        return m_activeTestCase
+            ? m_activeTestCase->getTestCaseInfo().name
+            : std::string();
+    }
 
+    const AssertionResult * RunContext::getLastResult() const {
+        // m_lastResult is updated inside the assertion slow-path, under
+        // a mutex, so the read needs to happen under mutex as well.
 
+        // TBD: The last result only makes sense if it is a thread-local
+        //      thing, because the answer is different per thread, like
+        //      last line info, whether last assertion passed, and so on.
+        //
+        //      However, the last result was also never updated in the
+        //      assertion fast path, so it was always somewhat broken,
+        //      and since IResultCapture::getLastResult is deprecated,
+        //      we will leave it as is, until it is finally removed.
+        Detail::LockGuard _( m_assertionMutex );
+        return &*m_lastResult;
+    }
 
+    void RunContext::exceptionEarlyReported() {
+        m_shouldReportUnexpected = false;
+    }
 
+    void RunContext::handleFatalErrorCondition( StringRef message ) {
+        // We lock only when touching the reporters directly, to avoid
+        // deadlocks when we call into other functions that also want
+        // to lock the mutex before touching reporters.
+        //
+        // This does mean that we allow other threads to run while handling
+        // a fatal error, but this is all a best effort attempt anyway.
+        {
+            Detail::LockGuard lock( m_assertionMutex );
+            // TODO: scoped deactivate here? Just give up and do best effort?
+            //       the deactivation can break things further, OTOH so can the
+            //       capture
+            auto _ = scopedDeactivate( *m_outputRedirect );
 
-#include <cstdlib>
+            // First notify reporter that bad things happened
+            m_reporter->fatalErrorEncountered( message );
+        }
 
-namespace Catch {
-    namespace Detail {
+        // Don't rebuild the result -- the stringification itself can cause more fatal errors
+        // Instead, fake a result data.
+        AssertionResultData tempResult( ResultWas::FatalErrorCondition, { false } );
+        tempResult.message = static_cast<std::string>(message);
+        AssertionResult result( makeDummyAssertionInfo(),
+                                CATCH_MOVE( tempResult ) );
 
-#if !defined (CATCH_CONFIG_GETENV)
-        char const* getEnv( char const* ) { return nullptr; }
-#else
+        assertionEnded(CATCH_MOVE(result) );
 
-        char const* getEnv( char const* varName ) {
-#    if defined( _MSC_VER )
-#        pragma warning( push )
-#        pragma warning( disable : 4996 ) // use getenv_s instead of getenv
-#    endif
 
-            return std::getenv( varName );
+        // At this point we touch sections/test cases from this thread
+        // to try and end them. Technically that is not supported when
+        // using multiple threads, but the worst thing that can happen
+        // is that the process aborts harder :-D
+        Detail::LockGuard lock( m_assertionMutex );
 
-#    if defined( _MSC_VER )
-#        pragma warning( pop )
-#    endif
+        // Best effort cleanup for sections that have not been destructed yet
+        // Since this is a fatal error, we have not had and won't have the opportunity to destruct them properly
+        while (!m_activeSections.empty()) {
+            auto const& nl = m_activeSections.back()->nameAndLocation();
+            SectionEndInfo endInfo{ SectionInfo(nl.location, nl.name), {}, 0.0 };
+            sectionEndedEarly(CATCH_MOVE(endInfo));
         }
-#endif
-} // namespace Detail
-} // namespace Catch
-
+        handleUnfinishedSections();
 
+        // Recreate section for test case (as we will lose the one that was in scope)
+        auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo();
+        SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name);
 
+        Counts assertions;
+        assertions.failed = 1;
+        SectionStats testCaseSectionStats(CATCH_MOVE(testCaseSection), assertions, 0, false);
+        m_reporter->sectionEnded( testCaseSectionStats );
 
-namespace Catch {
+        auto const& testInfo = m_activeTestCase->getTestCaseInfo();
 
-    auto operator << (std::ostream& os, LazyExpression const& lazyExpr) -> std::ostream& {
-        if (lazyExpr.m_isNegated)
-            os << '!';
+        Totals deltaTotals;
+        deltaTotals.testCases.failed = 1;
+        deltaTotals.assertions.failed = 1;
+        m_reporter->testCaseEnded(TestCaseStats(testInfo,
+                                  deltaTotals,
+                                  std::string(),
+                                  std::string(),
+                                  false));
+        m_totals.testCases.failed++;
+        updateTotalsFromAtomics();
+        m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, false));
+    }
 
-        if (lazyExpr) {
-            if (lazyExpr.m_isNegated && lazyExpr.m_transientExpression->isBinaryExpression())
-                os << '(' << *lazyExpr.m_transientExpression << ')';
-            else
-                os << *lazyExpr.m_transientExpression;
-        } else {
-            os << "{** error - unchecked empty expression requested **}";
-        }
-        return os;
+    void RunContext::assertionPassedFastPath(SourceLineInfo lineInfo) {
+        // We want to save the line info for better experience with unexpected assertions
+        Detail::g_lastKnownLineInfo = lineInfo;
+        ++m_atomicAssertionCount.passed;
+        Detail::g_lastAssertionPassed = true;
+        Detail::g_clearMessageScopes = true;
     }
 
-} // namespace Catch
+    void RunContext::updateTotalsFromAtomics() {
+        m_totals.assertions = Counts{
+            m_atomicAssertionCount.passed,
+            m_atomicAssertionCount.failed,
+            m_atomicAssertionCount.failedButOk,
+            m_atomicAssertionCount.skipped,
+        };
+    }
 
+    bool RunContext::aborting() const {
+        return m_atomicAssertionCount.failed >= m_abortAfterXFailedAssertions;
+    }
 
+    std::string RunContext::endCapture() {
+        if ( !m_outputRedirect->isActive() ) {
+            return {};
+        }
+        m_outputRedirect->deactivate();
+        return m_outputRedirect->getStdout() + m_outputRedirect->getStderr();
+    }
 
+    void RunContext::runCurrentTest() {
+        auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo();
+        SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name);
+        m_reporter->sectionStarting(testCaseSection);
+        updateTotalsFromAtomics();
+        Counts prevAssertions = m_totals.assertions;
+        double duration = 0;
+        m_shouldReportUnexpected = true;
+        Detail::g_lastKnownLineInfo = testCaseInfo.lineInfo;
 
-#ifdef CATCH_CONFIG_WINDOWS_CRTDBG
-#include <crtdbg.h>
+        Timer timer;
+        CATCH_TRY {
+            {
+                auto _ = scopedActivate( *m_outputRedirect );
+                timer.start();
+                invokeActiveTestCase();
+            }
+            duration = timer.getElapsedSeconds();
+        } CATCH_CATCH_ANON (TestFailureException&) {
+            // This just means the test was aborted due to failure
+        } CATCH_CATCH_ANON (TestSkipException&) {
+            // This just means the test was explicitly skipped
+        } CATCH_CATCH_ALL {
+            // Under CATCH_CONFIG_FAST_COMPILE, unexpected exceptions under REQUIRE assertions
+            // are reported without translation at the point of origin.
+            if ( m_shouldReportUnexpected ) {
+                AssertionReaction dummyReaction;
+                handleUnexpectedInflightException( makeDummyAssertionInfo(),
+                                                   translateActiveException(),
+                                                   dummyReaction );
+            }
+        }
+        updateTotalsFromAtomics();
+        Counts assertions = m_totals.assertions - prevAssertions;
+        bool missingAssertions = testForMissingAssertions(assertions);
 
-namespace Catch {
+        m_testCaseTracker->close();
+        handleUnfinishedSections();
+        auto& msgHolder = Detail::g_messageHolder();
+        msgHolder.removeUnscopedMessages();
+        assert( msgHolder.getMessages().empty() &&
+                "There should be no leftover messages after the test ends" );
 
-    LeakDetector::LeakDetector() {
-        int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
-        flag |= _CRTDBG_LEAK_CHECK_DF;
-        flag |= _CRTDBG_ALLOC_MEM_DF;
-        _CrtSetDbgFlag(flag);
-        _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
-        _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
-        // Change this to leaking allocation's number to break there
-        _CrtSetBreakAlloc(-1);
+        SectionStats testCaseSectionStats(CATCH_MOVE(testCaseSection), assertions, duration, missingAssertions);
+        m_reporter->sectionEnded(testCaseSectionStats);
     }
-}
 
-#else // ^^ Windows crt debug heap enabled // Windows crt debug heap disabled vv
+    void RunContext::invokeActiveTestCase() {
+        // We need to engage a handler for signals/structured exceptions
+        // before running the tests themselves, or the binary can crash
+        // without failed test being reported.
+        FatalConditionHandlerGuard _(&m_fatalConditionhandler);
+        // We keep having issue where some compilers warn about an unused
+        // variable, even though the type has non-trivial constructor and
+        // destructor. This is annoying and ugly, but it makes them stfu.
+        (void)_;
 
-    Catch::LeakDetector::LeakDetector() = default;
+        m_activeTestCase->invoke();
+    }
 
-#endif // CATCH_CONFIG_WINDOWS_CRTDBG
+    void RunContext::handleUnfinishedSections() {
+        // If sections ended prematurely due to an exception we stored their
+        // infos here so we can tear them down outside the unwind process.
+        for ( auto it = m_unfinishedSections.rbegin(),
+                   itEnd = m_unfinishedSections.rend();
+              it != itEnd;
+              ++it ) {
+            sectionEnded( CATCH_MOVE( *it ) );
+        }
+        m_unfinishedSections.clear();
+    }
 
-Catch::LeakDetector::~LeakDetector() {
-    Catch::cleanUp();
-}
+    void RunContext::handleExpr(
+        AssertionInfo const& info,
+        ITransientExpression const& expr,
+        AssertionReaction& reaction
+    ) {
+        bool negated = isFalseTest( info.resultDisposition );
+        bool result = expr.getResult() != negated;
 
+        if( result ) {
+            if (!m_includeSuccessfulResults) {
+                assertionPassedFastPath(info.lineInfo);
+            }
+            else {
+                reportExpr(info, ResultWas::Ok, &expr, negated);
+            }
+        }
+        else {
+            reportExpr(info, ResultWas::ExpressionFailed, &expr, negated );
+            populateReaction(
+                reaction, info.resultDisposition & ResultDisposition::Normal );
+        }
+    }
+    void RunContext::reportExpr(
+            AssertionInfo const &info,
+            ResultWas::OfType resultType,
+            ITransientExpression const *expr,
+            bool negated ) {
 
+        Detail::g_lastKnownLineInfo = info.lineInfo;
+        AssertionResultData data( resultType, LazyExpression( negated ) );
 
-namespace Catch {
-    CATCH_INTERNAL_START_WARNINGS_SUPPRESSION
-    CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
-    static const LeakDetector leakDetector;
-    CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
-}
+        AssertionResult assertionResult{ info, CATCH_MOVE( data ) };
+        assertionResult.m_resultData.lazyExpression.m_transientExpression = expr;
 
-// Allow users of amalgamated .cpp file to remove our main and provide their own.
-#if !defined(CATCH_AMALGAMATED_CUSTOM_MAIN)
+        assertionEnded( CATCH_MOVE(assertionResult) );
+    }
 
-#if defined(CATCH_CONFIG_WCHAR) && defined(CATCH_PLATFORM_WINDOWS) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN)
-// Standard C/C++ Win32 Unicode wmain entry point
-extern "C" int __cdecl wmain (int argc, wchar_t * argv[], wchar_t * []) {
-#else
-// Standard C/C++ main entry point
-int main (int argc, char * argv[]) {
-#endif
+    void RunContext::handleMessage(
+            AssertionInfo const& info,
+            ResultWas::OfType resultType,
+            std::string&& message,
+            AssertionReaction& reaction
+    ) {
+        Detail::g_lastKnownLineInfo = info.lineInfo;
 
-    // We want to force the linker not to discard the global variable
-    // and its constructor, as it (optionally) registers leak detector
-    (void)&Catch::leakDetector;
+        AssertionResultData data( resultType, LazyExpression( false ) );
+        data.message = CATCH_MOVE( message );
+        AssertionResult assertionResult{ info,
+                                         CATCH_MOVE( data ) };
 
-    return Catch::Session().run( argc, argv );
-}
+        const auto isOk = assertionResult.isOk();
+        assertionEnded( CATCH_MOVE(assertionResult) );
+        if ( !isOk ) {
+            populateReaction(
+                reaction, info.resultDisposition & ResultDisposition::Normal );
+        } else if ( resultType == ResultWas::ExplicitSkip ) {
+            // TODO: Need to handle this explicitly, as ExplicitSkip is
+            // considered "OK"
+            reaction.shouldSkip = true;
+        }
+    }
 
-#endif // !defined(CATCH_AMALGAMATED_CUSTOM_MAIN
+    void RunContext::handleUnexpectedExceptionNotThrown(
+            AssertionInfo const& info,
+            AssertionReaction& reaction
+    ) {
+        handleNonExpr(info, Catch::ResultWas::DidntThrowException, reaction);
+    }
 
+    void RunContext::handleUnexpectedInflightException(
+            AssertionInfo const& info,
+            std::string&& message,
+            AssertionReaction& reaction
+    ) {
+        Detail::g_lastKnownLineInfo = info.lineInfo;
 
+        AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) );
+        data.message = CATCH_MOVE(message);
+        AssertionResult assertionResult{ info, CATCH_MOVE(data) };
+        assertionEnded( CATCH_MOVE(assertionResult) );
+        populateReaction( reaction,
+                          info.resultDisposition & ResultDisposition::Normal );
+    }
 
+    void RunContext::populateReaction( AssertionReaction& reaction,
+                                       bool has_normal_disposition ) const {
+        reaction.shouldDebugBreak = m_shouldDebugBreak;
+        reaction.shouldThrow = aborting() || has_normal_disposition;
+    }
 
-namespace Catch {
+    AssertionInfo RunContext::makeDummyAssertionInfo() {
+        const bool testCaseJustStarted =
+            Detail::g_lastKnownLineInfo ==
+            m_activeTestCase->getTestCaseInfo().lineInfo;
 
-    namespace {
-        // Messages are owned by their individual threads, so the counter should
-        // be thread-local as well. Alternative consideration: atomic counter,
-        // so threads don't share IDs and things are easier to debug.
-        static CATCH_INTERNAL_THREAD_LOCAL unsigned int messageIDCounter = 0;
+        return AssertionInfo{
+            testCaseJustStarted ? "TEST_CASE"_sr : StringRef(),
+            Detail::g_lastKnownLineInfo,
+            testCaseJustStarted ? StringRef() : "{Unknown expression after the reported line}"_sr,
+            ResultDisposition::Normal
+        };
     }
 
-    MessageInfo::MessageInfo( StringRef _macroName,
-                              SourceLineInfo const& _lineInfo,
-                              ResultWas::OfType _type )
-    :   macroName( _macroName ),
-        lineInfo( _lineInfo ),
-        type( _type ),
-        sequence( ++messageIDCounter )
-    {}
+    void RunContext::handleIncomplete(
+            AssertionInfo const& info
+    ) {
+        using namespace std::string_literals;
+        Detail::g_lastKnownLineInfo = info.lineInfo;
 
-} // end namespace Catch
+        AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) );
+        data.message = "Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE"s;
+        AssertionResult assertionResult{ info, CATCH_MOVE( data ) };
+        assertionEnded( CATCH_MOVE(assertionResult) );
+    }
 
+    void RunContext::handleNonExpr(
+            AssertionInfo const &info,
+            ResultWas::OfType resultType,
+            AssertionReaction &reaction
+    ) {
+        AssertionResultData data( resultType, LazyExpression( false ) );
+        AssertionResult assertionResult{ info, CATCH_MOVE( data ) };
 
+        const auto isOk = assertionResult.isOk();
+        if ( isOk && !m_includeSuccessfulResults ) {
+            assertionPassedFastPath( info.lineInfo );
+            return;
+        }
 
-#include <cstdio>
-#include <cstring>
-#include <iosfwd>
-#include <sstream>
+        assertionEnded( CATCH_MOVE(assertionResult) );
+        if ( !isOk ) {
+            populateReaction(
+                reaction, info.resultDisposition & ResultDisposition::Normal );
+        }
+    }
 
-#if defined( CATCH_CONFIG_NEW_CAPTURE )
-#    if defined( _MSC_VER )
-#        include <io.h> //_dup and _dup2
-#        define dup _dup
-#        define dup2 _dup2
-#        define fileno _fileno
-#    else
-#        include <unistd.h> // dup and dup2
-#    endif
-#endif
+    void seedRng(IConfig const& config) {
+        sharedRng().seed(config.rngSeed());
+    }
 
-namespace Catch {
+    unsigned int rngSeed() {
+        return getCurrentContext().getConfig()->rngSeed();
+    }
 
-    namespace {
-        //! A no-op implementation, used if no reporter wants output
-        //! redirection.
-        class NoopRedirect final : public OutputRedirect {
-            void activateImpl() override {}
-            void deactivateImpl() override {}
-            std::string getStdout() override { return {}; }
-            std::string getStderr() override { return {}; }
-            void clearBuffers() override {}
-        };
+}
 
-        /**
-         * Redirects specific stream's rdbuf with another's.
-         *
-         * Redirection can be stopped and started on-demand, assumes
-         * that the underlying stream's rdbuf aren't changed by other
-         * users while it is active. The rdbuf to restore is the one the
-         * stream had when the redirection started, not when this object
-         * was made.
-         */
-        class RedirectedStreamNew {
-            std::ostream& m_originalStream;
-            std::ostream& m_redirectionStream;
-            std::streambuf* m_prevBuf = nullptr;
 
-        public:
-            RedirectedStreamNew( std::ostream& originalStream,
-                                 std::ostream& redirectionStream ):
-                m_originalStream( originalStream ),
-                m_redirectionStream( redirectionStream ) {}
 
-            void startRedirect() {
-                m_prevBuf = m_originalStream.rdbuf();
-                m_originalStream.rdbuf( m_redirectionStream.rdbuf() );
-            }
-            void stopRedirect() { m_originalStream.rdbuf( m_prevBuf ); }
-        };
+namespace Catch {
 
-        /**
-         * Redirects the `std::cout`, `std::cerr`, `std::clog` streams,
-         * but does not touch the actual `stdout`/`stderr` file descriptors.
-         */
-        class StreamRedirect final : public OutputRedirect {
-            ReusableStringStream m_redirectedOut, m_redirectedErr;
-            RedirectedStreamNew m_cout, m_cerr, m_clog;
+    Section::Section( SectionInfo&& info ):
+        m_info( CATCH_MOVE( info ) ),
+        m_sectionIncluded(
+            getResultCapture().sectionStarted( m_info.name, m_info.lineInfo, m_assertions ) ) {
+        // Non-"included" sections will not use the timing information
+        // anyway, so don't bother with the potential syscall.
+        if (m_sectionIncluded) {
+            m_timer.start();
+        }
+    }
 
-        public:
-            StreamRedirect():
-                m_cout( Catch::cout(), m_redirectedOut.get() ),
-                m_cerr( Catch::cerr(), m_redirectedErr.get() ),
-                m_clog( Catch::clog(), m_redirectedErr.get() ) {}
+    Section::Section( SourceLineInfo const& _lineInfo,
+                      StringRef _name,
+                      const char* const ):
+        m_info( { "invalid", static_cast<std::size_t>( -1 ) }, std::string{} ),
+        m_sectionIncluded(
+            getResultCapture().sectionStarted( _name, _lineInfo, m_assertions ) ) {
+        // We delay initialization the SectionInfo member until we know
+        // this section needs it, so we avoid allocating std::string for name.
+        // We also delay timer start to avoid the potential syscall unless we
+        // will actually use the result.
+        if ( m_sectionIncluded ) {
+            m_info.name = static_cast<std::string>( _name );
+            m_info.lineInfo = _lineInfo;
+            m_timer.start();
+        }
+    }
 
-            void activateImpl() override {
-                m_cout.startRedirect();
-                m_cerr.startRedirect();
-                m_clog.startRedirect();
-            }
-            void deactivateImpl() override {
-                m_cout.stopRedirect();
-                m_cerr.stopRedirect();
-                m_clog.stopRedirect();
-            }
-            std::string getStdout() override { return m_redirectedOut.str(); }
-            std::string getStderr() override { return m_redirectedErr.str(); }
-            void clearBuffers() override {
-                m_redirectedOut.str( "" );
-                m_redirectedErr.str( "" );
+    Section::~Section() {
+        if( m_sectionIncluded ) {
+            SectionEndInfo endInfo{ CATCH_MOVE(m_info), m_assertions, m_timer.getElapsedSeconds() };
+            if ( uncaught_exceptions() ) {
+                getResultCapture().sectionEndedEarly( CATCH_MOVE(endInfo) );
+            } else {
+                getResultCapture().sectionEnded( CATCH_MOVE( endInfo ) );
             }
-        };
+        }
+    }
 
-#if defined( CATCH_CONFIG_NEW_CAPTURE )
+    // This indicates whether the section should be executed or not
+    Section::operator bool() const {
+        return m_sectionIncluded;
+    }
 
-        // Windows's implementation of std::tmpfile is terrible (it tries
-        // to create a file inside system folder, thus requiring elevated
-        // privileges for the binary), so we have to use tmpnam(_s) and
-        // create the file ourselves there.
-        class TempFile {
-        public:
-            TempFile( TempFile const& ) = delete;
-            TempFile& operator=( TempFile const& ) = delete;
-            TempFile( TempFile&& ) = delete;
-            TempFile& operator=( TempFile&& ) = delete;
 
-#    if defined( _MSC_VER )
-            TempFile() {
-                if ( tmpnam_s( m_buffer ) ) {
-                    CATCH_RUNTIME_ERROR( "Could not get a temp filename" );
-                }
-                if ( fopen_s( &m_file, m_buffer, "wb+" ) ) {
-                    char buffer[100];
-                    if ( strerror_s( buffer, errno ) ) {
-                        CATCH_RUNTIME_ERROR(
-                            "Could not translate errno to a string" );
-                    }
-                    CATCH_RUNTIME_ERROR( "Could not open the temp file: '"
-                                         << m_buffer
-                                         << "' because: " << buffer );
-                }
-            }
-#    else
-            TempFile() {
-                m_file = std::tmpfile();
-                if ( !m_file ) {
-                    CATCH_RUNTIME_ERROR( "Could not create a temp file." );
-                }
-            }
-#    endif
-
-            ~TempFile() {
-                // TBD: What to do about errors here?
-                std::fclose( m_file );
-                // We manually create the file on Windows only, on Linux
-                // it will be autodeleted
-#    if defined( _MSC_VER )
-                std::remove( m_buffer );
-#    endif
-            }
+} // end namespace Catch
 
-            std::FILE* getFile() { return m_file; }
-            std::string getContents() {
-                ReusableStringStream sstr;
-                constexpr long buffer_size = 100;
-                char buffer[buffer_size + 1] = {};
-                long current_pos = ftell( m_file );
-                CATCH_ENFORCE( current_pos >= 0,
-                               "ftell failed, errno: " << errno );
-                std::rewind( m_file );
-                while ( current_pos > 0 ) {
-                    auto read_characters =
-                        std::fread( buffer,
-                                    1,
-                                    std::min( buffer_size, current_pos ),
-                                    m_file );
-                    buffer[read_characters] = '\0';
-                    sstr << buffer;
-                    current_pos -= static_cast<long>( read_characters );
-                }
-                return sstr.str();
-            }
 
-            void clear() { std::rewind( m_file ); }
 
-        private:
-            std::FILE* m_file = nullptr;
-            char m_buffer[L_tmpnam] = { 0 };
-        };
+#include <vector>
 
-        /**
-         * Redirects the actual `stdout`/`stderr` file descriptors.
-         *
-         * Works by replacing the file descriptors numbered 1 and 2
-         * with an open temporary file.
-         */
-        class FileRedirect final : public OutputRedirect {
-            TempFile m_outFile, m_errFile;
-            int m_originalOut = -1;
-            int m_originalErr = -1;
+namespace Catch {
 
-            // Flushes cout/cerr/clog streams and stdout/stderr FDs
-            void flushEverything() {
-                Catch::cout() << std::flush;
-                fflush( stdout );
-                // Since we support overriding these streams, we flush cerr
-                // even though std::cerr is unbuffered
-                Catch::cerr() << std::flush;
-                Catch::clog() << std::flush;
-                fflush( stderr );
-            }
+    namespace {
+        static auto getSingletons() -> std::vector<ISingleton*>*& {
+            static std::vector<ISingleton*>* g_singletons = nullptr;
+            if( !g_singletons )
+                g_singletons = new std::vector<ISingleton*>();
+            return g_singletons;
+        }
+    }
 
-        public:
-            FileRedirect():
-                m_originalOut( dup( fileno( stdout ) ) ),
-                m_originalErr( dup( fileno( stderr ) ) ) {
-                CATCH_ENFORCE( m_originalOut >= 0, "Could not dup stdout" );
-                CATCH_ENFORCE( m_originalErr >= 0, "Could not dup stderr" );
-            }
+    ISingleton::~ISingleton() = default;
 
-            std::string getStdout() override { return m_outFile.getContents(); }
-            std::string getStderr() override { return m_errFile.getContents(); }
-            void clearBuffers() override {
-                m_outFile.clear();
-                m_errFile.clear();
-            }
+    void addSingleton(ISingleton* singleton ) {
+        getSingletons()->push_back( singleton );
+    }
+    void cleanupSingletons() {
+        auto& singletons = getSingletons();
+        for( auto singleton : *singletons )
+            delete singleton;
+        delete singletons;
+        singletons = nullptr;
+    }
 
-            void activateImpl() override {
-                // We flush before starting redirect, to ensure that we do
-                // not capture the end of message sent before activation.
-                flushEverything();
+} // namespace Catch
 
-                int ret;
-                ret = dup2( fileno( m_outFile.getFile() ), fileno( stdout ) );
-                CATCH_ENFORCE( ret >= 0,
-                               "dup2 to stdout has failed, errno: " << errno );
-                ret = dup2( fileno( m_errFile.getFile() ), fileno( stderr ) );
-                CATCH_ENFORCE( ret >= 0,
-                               "dup2 to stderr has failed, errno: " << errno );
-            }
-            void deactivateImpl() override {
-                // We flush before ending redirect, to ensure that we
-                // capture all messages sent while the redirect was active.
-                flushEverything();
 
-                int ret;
-                ret = dup2( m_originalOut, fileno( stdout ) );
-                CATCH_ENFORCE(
-                    ret >= 0,
-                    "dup2 of original stdout has failed, errno: " << errno );
-                ret = dup2( m_originalErr, fileno( stderr ) );
-                CATCH_ENFORCE(
-                    ret >= 0,
-                    "dup2 of original stderr has failed, errno: " << errno );
-            }
-        };
 
-#endif // CATCH_CONFIG_NEW_CAPTURE
+#include <cstring>
+#include <ostream>
 
-    } // end namespace
+namespace Catch {
 
-    bool isRedirectAvailable( OutputRedirect::Kind kind ) {
-        switch ( kind ) {
-        // These two are always available
-        case OutputRedirect::None:
-        case OutputRedirect::Streams:
-            return true;
-#if defined( CATCH_CONFIG_NEW_CAPTURE )
-        case OutputRedirect::FileDescriptors:
-            return true;
-#endif
-        default:
-            return false;
-        }
+    bool SourceLineInfo::operator == ( SourceLineInfo const& other ) const noexcept {
+        return line == other.line && (file == other.file || std::strcmp(file, other.file) == 0);
+    }
+    bool SourceLineInfo::operator < ( SourceLineInfo const& other ) const noexcept {
+        // We can assume that the same file will usually have the same pointer.
+        // Thus, if the pointers are the same, there is no point in calling the strcmp
+        return line < other.line || ( line == other.line && file != other.file && (std::strcmp(file, other.file) < 0));
     }
 
-    Detail::unique_ptr<OutputRedirect> makeOutputRedirect( bool actual ) {
-        if ( actual ) {
-            // TODO: Clean this up later
-#if defined( CATCH_CONFIG_NEW_CAPTURE )
-            return Detail::make_unique<FileRedirect>();
+    std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) {
+#ifndef __GNUG__
+        os << info.file << '(' << info.line << ')';
 #else
-            return Detail::make_unique<StreamRedirect>();
+        os << info.file << ':' << info.line;
 #endif
-        } else {
-            return Detail::make_unique<NoopRedirect>();
-        }
-    }
-
-    RedirectGuard scopedActivate( OutputRedirect& redirectImpl ) {
-        return RedirectGuard( true, redirectImpl );
+        return os;
     }
 
-    RedirectGuard scopedDeactivate( OutputRedirect& redirectImpl ) {
-        return RedirectGuard( false, redirectImpl );
-    }
+} // end namespace Catch
 
-    OutputRedirect::~OutputRedirect() = default;
 
-    RedirectGuard::RedirectGuard( bool activate, OutputRedirect& redirectImpl ):
-        m_redirect( &redirectImpl ),
-        m_activate( activate ),
-        m_previouslyActive( redirectImpl.isActive() ) {
 
-        // Skip cases where there is no actual state change.
-        if ( m_activate == m_previouslyActive ) { return; }
 
-        if ( m_activate ) {
-            m_redirect->activate();
-        } else {
-            m_redirect->deactivate();
+namespace Catch {
+#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
+    void StartupExceptionRegistry::add( std::exception_ptr const& exception ) noexcept {
+        CATCH_TRY {
+            m_exceptions.push_back(exception);
+        } CATCH_CATCH_ALL {
+            // If we run out of memory during start-up there's really not a lot more we can do about it
+            std::terminate();
         }
     }
 
-    RedirectGuard::~RedirectGuard() noexcept( false ) {
-        if ( m_moved ) { return; }
-        // Skip cases where there is no actual state change.
-        if ( m_activate == m_previouslyActive ) { return; }
-
-        if ( m_activate ) {
-            m_redirect->deactivate();
-        } else {
-            m_redirect->activate();
-        }
+    std::vector<std::exception_ptr> const& StartupExceptionRegistry::getExceptions() const noexcept {
+        return m_exceptions;
     }
+#endif
 
-    RedirectGuard::RedirectGuard( RedirectGuard&& rhs ) noexcept:
-        m_redirect( rhs.m_redirect ),
-        m_activate( rhs.m_activate ),
-        m_previouslyActive( rhs.m_previouslyActive ),
-        m_moved( false ) {
-        rhs.m_moved = true;
-    }
+} // end namespace Catch
 
-    RedirectGuard& RedirectGuard::operator=( RedirectGuard&& rhs ) noexcept {
-        m_redirect = rhs.m_redirect;
-        m_activate = rhs.m_activate;
-        m_previouslyActive = rhs.m_previouslyActive;
-        m_moved = false;
-        rhs.m_moved = true;
-        return *this;
-    }
 
-} // namespace Catch
 
-#if defined( CATCH_CONFIG_NEW_CAPTURE )
-#    if defined( _MSC_VER )
-#        undef dup
-#        undef dup2
-#        undef fileno
-#    endif
-#endif
 
 
+#include <iostream>
 
+namespace Catch {
 
-#include <limits>
-#include <stdexcept>
+// If you #define this you must implement these functions
+#if !defined( CATCH_CONFIG_NOSTDOUT )
+    std::ostream& cout() { return std::cout; }
+    std::ostream& cerr() { return std::cerr; }
+    std::ostream& clog() { return std::clog; }
+#endif
 
-namespace Catch {
+} // namespace Catch
 
-    Optional<unsigned int> parseUInt(std::string const& input, int base) {
-        auto trimmed = trim( input );
-        // std::stoull is annoying and accepts numbers starting with '-',
-        // it just negates them into unsigned int
-        if ( trimmed.empty() || trimmed[0] == '-' ) {
-            return {};
-        }
 
-        CATCH_TRY {
-            size_t pos = 0;
-            const auto ret = std::stoull( trimmed, &pos, base );
 
-            // We did not consume the whole input, so there is an issue
-            // This can be bunch of different stuff, like multiple numbers
-            // in the input, or invalid digits/characters and so on. Either
-            // way, we do not want to return the partially parsed result.
-            if ( pos != trimmed.size() ) {
-                return {};
-            }
-            // Too large
-            if ( ret > std::numeric_limits<unsigned int>::max() ) {
-                return {};
-            }
-            return static_cast<unsigned int>(ret);
-        }
-        CATCH_CATCH_ANON( std::invalid_argument const& ) {
-            // no conversion could be performed
-        }
-        CATCH_CATCH_ANON( std::out_of_range const& ) {
-            // the input does not fit into an unsigned long long
-        }
-        return {};
-    }
-
-} // namespace Catch
-
-
-
-
-#include <cmath>
+#include <ostream>
+#include <cstring>
+#include <vector>
 
 namespace Catch {
 
-#if !defined(CATCH_CONFIG_POLYFILL_ISNAN)
-    bool isnan(float f) {
-        return std::isnan(f);
+    bool startsWith( std::string const& s, std::string const& prefix ) {
+        return s.size() >= prefix.size() && std::equal(prefix.begin(), prefix.end(), s.begin());
     }
-    bool isnan(double d) {
-        return std::isnan(d);
+    bool startsWith( StringRef s, char prefix ) {
+        return !s.empty() && s[0] == prefix;
     }
-#else
-    // For now we only use this for embarcadero
-    bool isnan(float f) {
-        return std::_isnan(f);
+    bool endsWith( std::string const& s, std::string const& suffix ) {
+        return s.size() >= suffix.size() && std::equal(suffix.rbegin(), suffix.rend(), s.rbegin());
     }
-    bool isnan(double d) {
-        return std::_isnan(d);
+    bool endsWith( std::string const& s, char suffix ) {
+        return !s.empty() && s[s.size()-1] == suffix;
+    }
+    bool contains( std::string const& s, std::string const& infix ) {
+        return s.find( infix ) != std::string::npos;
+    }
+    void toLowerInPlace( std::string& s ) {
+        for ( char& c : s ) {
+            c = toLower( c );
+        }
+    }
+    std::string toLower( std::string const& s ) {
+        std::string lc = s;
+        toLowerInPlace( lc );
+        return lc;
     }
-#endif
-
-#if !defined( CATCH_CONFIG_GLOBAL_NEXTAFTER )
-    float nextafter( float x, float y ) { return std::nextafter( x, y ); }
-    double nextafter( double x, double y ) { return std::nextafter( x, y ); }
-#else
-    float nextafter( float x, float y ) { return ::nextafterf( x, y ); }
-    double nextafter( double x, double y ) { return ::nextafter( x, y ); }
-#endif
 
-} // end namespace Catch
+    std::string trim( std::string const& str ) {
+        static char const* whitespaceChars = "\n\r\t ";
+        std::string::size_type start = str.find_first_not_of( whitespaceChars );
+        std::string::size_type end = str.find_last_not_of( whitespaceChars );
 
+        return start != std::string::npos ? str.substr( start, 1+end-start ) : std::string();
+    }
 
+    StringRef trim(StringRef ref) {
+        const auto is_ws = [](char c) {
+            return c == ' ' || c == '\t' || c == '\n' || c == '\r';
+        };
+        size_t real_begin = 0;
+        while (real_begin < ref.size() && is_ws(ref[real_begin])) { ++real_begin; }
+        size_t real_end = ref.size();
+        while (real_end > real_begin && is_ws(ref[real_end - 1])) { --real_end; }
 
-#if defined( __clang__ )
-#    define CATCH2_CLANG_NO_SANITIZE_INTEGER \
-        __attribute__( ( no_sanitize( "unsigned-integer-overflow" ) ) )
-#else
-#    define CATCH2_CLANG_NO_SANITIZE_INTEGER
-#endif
-namespace Catch {
+        return ref.substr(real_begin, real_end - real_begin);
+    }
 
-namespace {
+    bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ) {
+        std::size_t i = str.find( replaceThis );
+        if (i == std::string::npos) {
+            return false;
+        }
+        std::size_t copyBegin = 0;
+        std::string origStr = CATCH_MOVE(str);
+        str.clear();
+        // There is at least one replacement, so reserve with the best guess
+        // we can make without actually counting the number of occurrences.
+        str.reserve(origStr.size() - replaceThis.size() + withThis.size());
+        do {
+            str.append(origStr, copyBegin, i-copyBegin );
+            str += withThis;
+            copyBegin = i + replaceThis.size();
+            if( copyBegin < origStr.size() )
+                i = origStr.find( replaceThis, copyBegin );
+            else
+                i = std::string::npos;
+        } while( i != std::string::npos );
+        if ( copyBegin < origStr.size() ) {
+            str.append(origStr, copyBegin, origStr.size() );
+        }
+        return true;
+    }
 
-#if defined(_MSC_VER)
-#pragma warning(push)
-#pragma warning(disable:4146) // we negate uint32 during the rotate
-#endif
-        // Safe rotr implementation thanks to John Regehr
-        CATCH2_CLANG_NO_SANITIZE_INTEGER
-        uint32_t rotate_right(uint32_t val, uint32_t count) {
-            const uint32_t mask = 31;
-            count &= mask;
-            return (val >> count) | (val << (-count & mask));
+    std::vector<StringRef> splitStringRef( StringRef str, char delimiter ) {
+        std::vector<StringRef> subStrings;
+        std::size_t start = 0;
+        for(std::size_t pos = 0; pos < str.size(); ++pos ) {
+            if( str[pos] == delimiter ) {
+                if( pos - start > 1 )
+                    subStrings.push_back( str.substr( start, pos-start ) );
+                start = pos+1;
+            }
         }
+        if( start < str.size() )
+            subStrings.push_back( str.substr( start, str.size()-start ) );
+        return subStrings;
+    }
 
-#if defined(_MSC_VER)
-#pragma warning(pop)
-#endif
+    std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ) {
+        os << pluraliser.m_count << ' ' << pluraliser.m_label;
+        if( pluraliser.m_count != 1 )
+            os << 's';
+        return os;
+    }
 
 }
 
 
-    SimplePcg32::SimplePcg32(result_type seed_) {
-        seed(seed_);
-    }
 
+#include <algorithm>
+#include <ostream>
+#include <cstring>
 
-    void SimplePcg32::seed(result_type seed_) {
-        m_state = 0;
-        (*this)();
-        m_state += seed_;
-        (*this)();
-    }
+namespace Catch {
+    StringRef::StringRef( char const* rawChars ) noexcept
+    : StringRef( rawChars, std::strlen(rawChars) )
+    {}
 
-    void SimplePcg32::discard(uint64_t skip) {
-        // We could implement this to run in O(log n) steps, but this
-        // should suffice for our use case.
-        for (uint64_t s = 0; s < skip; ++s) {
-            static_cast<void>((*this)());
+
+    bool StringRef::operator<(StringRef rhs) const noexcept {
+        if (m_size < rhs.m_size) {
+            return strncmp(m_start, rhs.m_start, m_size) <= 0;
         }
+        return strncmp(m_start, rhs.m_start, rhs.m_size) < 0;
     }
 
-    CATCH2_CLANG_NO_SANITIZE_INTEGER
-    SimplePcg32::result_type SimplePcg32::operator()() {
-        // prepare the output value
-        const uint32_t xorshifted = static_cast<uint32_t>(((m_state >> 18u) ^ m_state) >> 27u);
-        const auto output = rotate_right(xorshifted, static_cast<uint32_t>(m_state >> 59u));
+    int StringRef::compare( StringRef rhs ) const {
+        auto cmpResult =
+            strncmp( m_start, rhs.m_start, std::min( m_size, rhs.m_size ) );
 
-        // advance state
-        m_state = m_state * 6364136223846793005ULL + s_inc;
+        // This means that strncmp found a difference before the strings
+        // ended, and we can return it directly
+        if ( cmpResult != 0 ) {
+            return cmpResult;
+        }
 
-        return output;
+        // If strings are equal up to length, then their comparison results on
+        // their size
+        if ( m_size < rhs.m_size ) {
+            return -1;
+        } else if ( m_size > rhs.m_size ) {
+            return 1;
+        } else {
+            return 0;
+        }
     }
 
-    bool operator==(SimplePcg32 const& lhs, SimplePcg32 const& rhs) {
-        return lhs.m_state == rhs.m_state;
+    auto operator << ( std::ostream& os, StringRef str ) -> std::ostream& {
+        return os.write(str.data(), static_cast<std::streamsize>(str.size()));
     }
 
-    bool operator!=(SimplePcg32 const& lhs, SimplePcg32 const& rhs) {
-        return lhs.m_state != rhs.m_state;
+    std::string operator+(StringRef lhs, StringRef rhs) {
+        std::string ret;
+        ret.reserve(lhs.size() + rhs.size());
+        ret += lhs;
+        ret += rhs;
+        return ret;
     }
-}
-
 
+    auto operator+=( std::string& lhs, StringRef rhs ) -> std::string& {
+        lhs.append(rhs.data(), rhs.size());
+        return lhs;
+    }
 
+} // namespace Catch
 
 
-#include <ctime>
-#include <random>
 
 namespace Catch {
 
-    std::uint32_t generateRandomSeed( GenerateFrom from ) {
-        switch ( from ) {
-        case GenerateFrom::Time:
-            return static_cast<std::uint32_t>( std::time( nullptr ) );
+    TagAliasRegistry::~TagAliasRegistry() = default;
 
-        case GenerateFrom::Default:
-        case GenerateFrom::RandomDevice: {
-            std::random_device rd;
-            return Detail::fillBitsFrom<std::uint32_t>( rd );
+    TagAlias const* TagAliasRegistry::find( std::string const& alias ) const {
+        auto it = m_registry.find( alias );
+        if ( it != m_registry.end() ) {
+            return &it->second;
+        } else {
+            return nullptr;
         }
+    }
 
-        default:
-            CATCH_ERROR("Unknown generation method");
+    std::string TagAliasRegistry::expandAliases( std::string const& unexpandedTestSpec ) const {
+        std::string expandedTestSpec = unexpandedTestSpec;
+        for( auto const& registryKvp : m_registry ) {
+            std::size_t pos = expandedTestSpec.find( registryKvp.first );
+            if( pos != std::string::npos ) {
+                expandedTestSpec =  expandedTestSpec.substr( 0, pos ) +
+                                    registryKvp.second.tag +
+                                    expandedTestSpec.substr( pos + registryKvp.first.size() );
+            }
         }
+        return expandedTestSpec;
     }
 
-} // end namespace Catch
-
-
+    void TagAliasRegistry::add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) {
+        CATCH_ENFORCE( startsWith(alias, "[@") && endsWith(alias, ']'),
+                      "error: tag alias, '" << alias << "' is not of the form [@alias name].\n" << lineInfo );
 
+        CATCH_ENFORCE( m_registry.insert(std::make_pair(alias, TagAlias(tag, lineInfo))).second,
+                      "error: tag alias, '" << alias << "' already registered.\n"
+                      << "\tFirst seen at: " << find(alias)->lineInfo << "\n"
+                      << "\tRedefined at: " << lineInfo );
+    }
 
-namespace Catch {
-    struct ReporterRegistry::ReporterRegistryImpl {
-        std::vector<Detail::unique_ptr<EventListenerFactory>> listeners;
-    };
+    ITagAliasRegistry::~ITagAliasRegistry() = default;
 
-    ReporterRegistry::ReporterRegistry():
-        m_impl( Detail::make_unique<ReporterRegistryImpl>() ) {}
+    ITagAliasRegistry const& ITagAliasRegistry::get() {
+        return getRegistryHub().getTagAliasRegistry();
+    }
 
-    ReporterRegistry::~ReporterRegistry() = default;
+} // end namespace Catch
 
-    void ReporterRegistry::registerListener(
-        Detail::unique_ptr<EventListenerFactory> factory ) {
-        m_impl->listeners.push_back( CATCH_MOVE( factory ) );
-    }
 
-    std::vector<Detail::unique_ptr<EventListenerFactory>> const&
-    ReporterRegistry::getListeners() const {
-        return m_impl->listeners;
+
+
+namespace Catch {
+    TestCaseInfoHasher::TestCaseInfoHasher( hash_t seed ): m_seed( seed ) {}
+
+    uint32_t TestCaseInfoHasher::operator()( TestCaseInfo const& t ) const {
+        // FNV-1a hash algorithm that is designed for uniqueness:
+        const hash_t prime = 1099511628211u;
+        hash_t hash = 14695981039346656037u;
+        for ( const char c : t.name ) {
+            hash ^= c;
+            hash *= prime;
+        }
+        for ( const char c : t.className ) {
+            hash ^= c;
+            hash *= prime;
+        }
+        for ( const Tag& tag : t.tags ) {
+            for ( const char c : tag.original ) {
+                hash ^= c;
+                hash *= prime;
+            }
+        }
+        hash ^= m_seed;
+        hash *= prime;
+        const uint32_t low{ static_cast<uint32_t>( hash ) };
+        const uint32_t high{ static_cast<uint32_t>( hash >> 32 ) };
+        return low * high;
     }
 } // namespace Catch
 
 
 
-#include <cstdio>
-#include <list>
-#include <sstream>
-#include <tuple>
-#include <vector>
+
+#include <algorithm>
 
 namespace Catch {
 
-    // This class encapsulates the idea of a pool of ostringstreams that can be reused.
-    struct StringStreams {
-        std::vector<Detail::unique_ptr<std::ostringstream>> m_streams;
-        // The library can be linked into ASan-instrumented clients without
-        // instrumenting Catch3 itself. A list avoids mixed-mode libc++ vector
-        // container annotations for the reusable-index pool.
-        std::list<std::size_t> m_unused;
-        std::ostringstream m_referenceStream; // Used for copy state/ flags from
-        Detail::Mutex m_mutex;
+    namespace {
+        // Picked small-ish number at random
+        static size_t kInitialTestCount = 120;
 
-        auto add() -> std::pair<std::size_t, std::ostringstream*> {
-            Detail::LockGuard _( m_mutex );
-            if( m_unused.empty() ) {
-                m_streams.push_back( Detail::make_unique<std::ostringstream>() );
-                return { m_streams.size()-1, m_streams.back().get() };
+        static void enforceNoDuplicateTestCases(
+            std::vector<TestCaseHandle> const& tests ) {
+            // Flat set instead of std::set for performance.
+            std::vector<TestCaseInfo const*> seenTests;
+            seenTests.reserve( tests.size() );
+            for ( auto const& test : tests ) {
+                seenTests.push_back( &test.getTestCaseInfo() );
             }
-            else {
-                auto index = m_unused.back();
-                m_unused.pop_back();
-                return { index, m_streams[index].get() };
+            // We want to keep order of ~equal~ tests
+            // stable_sort so that duplicates are reported with the
+            // registration order preserved ("first seen" really is first)
+            std::stable_sort(
+                seenTests.begin(),
+                seenTests.end(),
+                []( TestCaseInfo const* lhs, TestCaseInfo const* rhs ) {
+                    return *lhs < *rhs;
+                }
+            );
+            const auto duplicate = std::adjacent_find(
+                seenTests.begin(),
+                seenTests.end(),
+                []( TestCaseInfo const* lhs, TestCaseInfo const* rhs ) {
+                    return *lhs == *rhs;
+                }
+            );
+
+            if ( duplicate != seenTests.end() ) {
+                const auto infoPtr = *std::next( duplicate );
+                CATCH_ERROR( "error: test case \""
+                             << infoPtr->name << "\", with tags \""
+                             << infoPtr->tagsAsString()
+                             << "\" already defined.\n"
+                             << "\tFirst seen at "
+                             << ( *duplicate )->lineInfo << "\n"
+                             << "\tRedefined at " << infoPtr->lineInfo );
             }
         }
 
-        void release( std::size_t index, std::ostream* originalPtr ) {
-            assert( originalPtr );
-            originalPtr->copyfmt( m_referenceStream );  // Restore initial flags and other state
+        static bool matchTest( TestCaseHandle const& testCase,
+                               TestSpec const& testSpec,
+                               IConfig const& config ) {
+            return testSpec.matches( testCase.getTestCaseInfo() ) &&
+                   isThrowSafe( testCase, config );
+        }
 
-            Detail::LockGuard _( m_mutex );
-            assert( originalPtr == m_streams[index].get() && "Mismatch between release index and stream ptr" );
-            m_unused.push_back( index );
+    } // end unnamed namespace
+
+    std::vector<TestCaseHandle> sortTests( IConfig const& config, std::vector<TestCaseHandle> const& unsortedTestCases ) {
+        switch (config.runOrder()) {
+        case TestRunOrder::Declared:
+            return unsortedTestCases;
+
+        case TestRunOrder::LexicographicallySorted: {
+            std::vector<TestCaseHandle> sorted = unsortedTestCases;
+            std::sort(
+                sorted.begin(),
+                sorted.end(),
+                []( TestCaseHandle const& lhs, TestCaseHandle const& rhs ) {
+                    return lhs.getTestCaseInfo() < rhs.getTestCaseInfo();
+                }
+            );
+            return sorted;
         }
-    };
+        case TestRunOrder::Randomized: {
+            using TestWithHash = std::pair<TestCaseInfoHasher::hash_t, TestCaseHandle>;
 
-    ReusableStringStream::ReusableStringStream() {
-        std::tie( m_index, m_oss ) =
-            Singleton<StringStreams>::getMutable().add();
+            TestCaseInfoHasher h{ config.rngSeed() };
+            std::vector<TestWithHash> indexed_tests;
+            indexed_tests.reserve(unsortedTestCases.size());
+
+            for (auto const& handle : unsortedTestCases) {
+                indexed_tests.emplace_back(h(handle.getTestCaseInfo()), handle);
+            }
+
+            std::sort( indexed_tests.begin(),
+                       indexed_tests.end(),
+                       []( TestWithHash const& lhs, TestWithHash const& rhs ) {
+                           if ( lhs.first == rhs.first ) {
+                               return lhs.second.getTestCaseInfo() <
+                                      rhs.second.getTestCaseInfo();
+                           }
+                           return lhs.first < rhs.first;
+                       } );
+
+            std::vector<TestCaseHandle> randomized;
+            randomized.reserve(indexed_tests.size());
+
+            for (auto const& indexed : indexed_tests) {
+                randomized.push_back(indexed.second);
+            }
+
+            return randomized;
+        }
+        }
+
+        CATCH_INTERNAL_ERROR("Unknown test order value!");
     }
 
-    ReusableStringStream::~ReusableStringStream() {
-        static_cast<std::ostringstream*>( m_oss )->str("");
-        m_oss->clear();
-        Singleton<StringStreams>::getMutable().release( m_index, m_oss );
+    bool isThrowSafe( TestCaseHandle const& testCase, IConfig const& config ) {
+        return !testCase.getTestCaseInfo().throws() || config.allowThrows();
     }
 
-    std::string ReusableStringStream::str() const {
-        return static_cast<std::ostringstream*>( m_oss )->str();
+    std::vector<TestCaseHandle> filterTests( std::vector<TestCaseHandle> const& testCases, TestSpec const& testSpec, IConfig const& config ) {
+        std::vector<TestCaseHandle> filtered;
+        filtered.reserve( testCases.size() );
+        for (auto const& testCase : testCases) {
+            if ((!testSpec.hasFilters() && !testCase.getTestCaseInfo().isHidden()) ||
+                (testSpec.hasFilters() && matchTest(testCase, testSpec, config))) {
+                filtered.push_back(testCase);
+            }
+        }
+        // The Catch3 runner shards the run itself.
+        return filtered;
+    }
+    std::vector<TestCaseHandle> const& getAllTestCasesSorted( IConfig const& config ) {
+        return getRegistryHub().getTestCaseRegistry().getAllTestsSorted( config );
     }
 
-    void ReusableStringStream::str( std::string const& str ) {
-        static_cast<std::ostringstream*>( m_oss )->str( str );
+
+    TestRegistry::TestRegistry() {
+        // We pre-reserve some reasonable number of tests to avoid the
+        // initial geometric growth churning during test registration.
+        m_handles.reserve( kInitialTestCount );
+        m_test_infos.reserve( kInitialTestCount );
+        m_invokers.reserve( kInitialTestCount );
     }
+    TestRegistry::~TestRegistry() = default;
 
+    void TestRegistry::registerTest(Detail::unique_ptr<TestCaseInfo> testInfo, Detail::unique_ptr<ITestInvoker> testInvoker) {
+        m_handles.emplace_back(testInfo.get(), testInvoker.get());
+        m_test_infos.push_back(CATCH_MOVE(testInfo));
+        m_invokers.push_back(CATCH_MOVE(testInvoker));
+    }
 
-}
+    void TestRegistry::enableFilenameTags() {
+        for (auto& info : m_test_infos) {
+            info->addFilenameTag();
+        }
+    }
+
+    std::vector<TestCaseHandle> const& TestRegistry::getAllTests() const {
+        return m_handles;
+    }
+    std::vector<TestCaseHandle> const& TestRegistry::getAllTestsSorted( IConfig const& config ) const {
+        if( m_sortedFunctions.empty() )
+            enforceNoDuplicateTestCases( m_handles );
+
+        if(  m_currentSortOrder != config.runOrder() || m_sortedFunctions.empty() ) {
+            m_sortedFunctions = sortTests( config, m_handles );
+            m_currentSortOrder = config.runOrder();
+        }
+        return m_sortedFunctions;
+    }
+
+} // end namespace Catch
 
 
 
 
-#include <cassert>
 #include <algorithm>
+#include <cassert>
+
+#if defined(__clang__)
+#    pragma clang diagnostic push
+#    pragma clang diagnostic ignored "-Wexit-time-destructors"
+#endif
 
 namespace Catch {
+namespace TestCaseTracking {
 
-    namespace Generators {
-        namespace {
-            struct GeneratorTracker final : TestCaseTracking::TrackerBase,
-                                      IGeneratorTracker {
-                GeneratorBasePtr m_generator;
-                // Filtered generator has moved to specific index due to
-                // a filter, it needs special handling of `countedNext()`
-                bool m_isFiltered = false;
-
-                GeneratorTracker(
-                    TestCaseTracking::NameAndLocation&& nameAndLocation,
-                    TrackerContext& ctx,
-                    ITracker* parent,
-                    GeneratorBasePtr&& generator ):
-                    TrackerBase( CATCH_MOVE( nameAndLocation ), ctx, parent ),
-                    m_generator( CATCH_MOVE( generator ) ) {
-                    assert( m_generator &&
-                            "Cannot create tracker without generator" );
-
-                    // Handle potential filter and move forward here...
-                    // Old style filters do not affect generators at all
-                    if (m_newStyleFilters && m_allTrackerDepth < m_filterRef->size()) {
-                        auto const& filter =
-                            ( *m_filterRef )[m_allTrackerDepth];
-                        // Generator cannot be un-entered the way a section
-                        // can be, so the tracker has to throw for a wrong
-                        // filter to stop the execution flow.
-                        if (filter.type == PathFilter::For::Section) {
-                            // We want the semantics of `SKIP()`, but we inline it
-                            // to avoid issues with conditionally prefixed macros
-                            INTERNAL_CATCH_MSG(
-                                "SKIP",
-                                Catch::ResultWas::ExplicitSkip,
-                                Catch::ResultDisposition::Normal,
-                                "" );
-                            Catch::Detail::Unreachable();
-                        }
-                        // '*' is the wildcard for "all elements in generator"
-                        // used for filtering sections below the generator, but
-                        // not the generator itself.
-                        if ( filter.filter != "*" ) {
-                            m_isFiltered = true;
-                            // TBD: We assume that the filter was validated as
-                            //      number during parsing. We should pass it
-                            //      as number from the CLI parser.
-                            size_t targetIndex = std::stoul( filter.filter );
-                            m_generator->skipToNthElement( targetIndex );
-                        }
-                    }
-                }
-
-                static GeneratorTracker*
-                acquire( TrackerContext& ctx,
-                         TestCaseTracking::NameAndLocationRef const&
-                             nameAndLocation ) {
-                    GeneratorTracker* tracker;
-
-                    ITracker& currentTracker = ctx.currentTracker();
-                    // Under specific circumstances, the generator we want
-                    // to acquire is also the current tracker. If this is
-                    // the case, we have to avoid looking through current
-                    // tracker's children, and instead return the current
-                    // tracker.
-                    // A case where this check is important is e.g.
-                    //     for (int i = 0; i < 5; ++i) {
-                    //         int n = GENERATE(1, 2);
-                    //     }
-                    //
-                    // without it, the code above creates 5 nested generators.
-                    if ( currentTracker.nameAndLocation() == nameAndLocation ) {
-                        auto thisTracker = currentTracker.parent()->findChild(
-                            nameAndLocation );
-                        assert( thisTracker );
-                        assert( thisTracker->isGeneratorTracker() );
-                        tracker = static_cast<GeneratorTracker*>( thisTracker );
-                    } else if ( ITracker* childTracker =
-                                    currentTracker.findChild(
-                                        nameAndLocation ) ) {
-                        assert( childTracker );
-                        assert( childTracker->isGeneratorTracker() );
-                        tracker =
-                            static_cast<GeneratorTracker*>( childTracker );
-                    } else {
-                        return nullptr;
-                    }
-
-                    if ( !tracker->isComplete() ) { tracker->open(); }
-
-                    return tracker;
-                }
-
-                // TrackerBase interface
-                bool isGeneratorTracker() const override { return true; }
-                void close() override {
-                    TrackerBase::close();
-                    // If a generator has a child (it is followed by a section)
-                    // and none of its children have started, then we must wait
-                    // until later to start consuming its values.
-                    // This catches cases where `GENERATE` is placed between two
-                    // `SECTION`s.
-                    // **The check for m_children.empty cannot be removed**.
-                    // doing so would break `GENERATE` _not_ followed by
-                    // `SECTION`s.
-                    const bool should_wait_for_child = [&]() {
-                        // No children -> nobody to wait for
-                        if ( m_children.empty() ) { return false; }
-                        // If at least one child started executing, don't wait
-                        if ( std::find_if(
-                                 m_children.begin(),
-                                 m_children.end(),
-                                 []( TestCaseTracking::ITrackerPtr const&
-                                         tracker ) {
-                                     return tracker->hasStarted();
-                                 } ) != m_children.end() ) {
-                            return false;
-                        }
-
-                        // No children have started. We need to check if they
-                        // _can_ start, and thus we should wait for them, or
-                        // they cannot start (due to filters), and we shouldn't
-                        // wait for them
-
-                        // No filters left -> no restrictions on running sections
-                        size_t childDepth = 1 + (m_newStyleFilters ? m_allTrackerDepth : m_sectionOnlyDepth);
-                        if ( childDepth >= m_filterRef->size() ) {
-                            return true;
-                        }
-
-                        // If we are using the new style filters, we need to check
-                        // whether the successive filter is for section or a generator.
-                        if ( m_newStyleFilters
-                            && (*m_filterRef)[childDepth].type != PathFilter::For::Section ) {
-                            return false;
-                        }
-                        // Look for any child section that could match the remaining filters
-                        for ( auto const& child : m_children ) {
-                            if ( child->isSectionTracker() &&
-                                 static_cast<SectionTracker const&>( *child )
-                                         .trimmedName() == StringRef((*m_filterRef)[childDepth].filter) ) {
-                                return true;
-                            }
-                        }
-                        return false;
-                    }();
-
-                    // This check is a bit tricky, because m_generator->next()
-                    // has a side-effect, where it consumes generator's current
-                    // value, but we do not want to invoke the side-effect if
-                    // this generator is still waiting for any child to start.
-                    assert( m_generator && "Tracker without generator" );
-                    if ( should_wait_for_child
-                        ||  ( m_runState == CompletedSuccessfully
-                            && !m_isFiltered // filtered generators cannot meaningfully move forward, as they would get past the filter
-                            && m_generator->countedNext() ) ) {
-                        m_children.clear();
-                        m_runState = Executing;
-                    }
-                }
-
-                // IGeneratorTracker interface
-                auto getGenerator() const -> GeneratorBasePtr const& override {
-                    return m_generator;
-                }
-
-                bool isFilteredImpl() const override { return m_isFiltered; }
-            };
-        } // namespace
-    }
-
-    namespace Detail {
-        // Assertions are owned by the thread that is executing them.
-        // This allows for lock-free progress in common cases where we
-        // do not need to send the assertion events to the reporter.
-        // This also implies that messages are owned by their respective
-        // threads, and should not be shared across different threads.
-        //
-        // This implies that various pieces of metadata referring to last
-        // assertion result/source location/message handling, etc
-        // should also be thread local. For now we just use naked globals
-        // below, in the future we will want to allocate piece of memory
-        // from heap, to avoid consuming too much thread-local storage.
-        //
-        // Note that we also don't want non-trivial the thread-local variables
-        // below be initialized for every thread, only for those that touch
-        // Catch2. To make this work with both GCC/Clang and MSVC, we have to
-        // make them thread-local magic statics. (Class-level statics have the
-        // desired semantics on GCC, but not on MSVC).
-
-        // This is used for the "if" part of CHECKED_IF/CHECKED_ELSE
-        static CATCH_INTERNAL_THREAD_LOCAL bool g_lastAssertionPassed = false;
-
-        // This is the source location for last encountered macro. It is
-        // used to provide the users with more precise location of error
-        // when an unexpected exception/fatal error happens.
-        static CATCH_INTERNAL_THREAD_LOCAL SourceLineInfo
-            g_lastKnownLineInfo( "DummyLocation", static_cast<size_t>( -1 ) );
-
-        // Should we clear message scopes before sending off the messages to
-        // reporter? Set in `assertionPassedFastPath` to avoid doing the full
-        // clear there for performance reasons.
-        static CATCH_INTERNAL_THREAD_LOCAL bool g_clearMessageScopes = false;
-
-
-        // Holds the data for both scoped and unscoped messages together,
-        // to avoid issues where their lifetimes start in wrong order,
-        // and then are destroyed in wrong order.
-        class MessageHolder {
-            // The actual message vector passed to the reporters
-            std::vector<MessageInfo> messages;
-            // IDs of messages from UNSCOPED_X macros, which we have to
-            // remove manually.
-            std::vector<unsigned int> unscoped_ids;
-
-        public:
-            // We do not need to special-case the unscoped messages when
-            // we only keep around the raw msg ids.
-            ~MessageHolder() = default;
-
-            void addUnscopedMessage( MessageInfo&& info ) {
-                repairUnscopedMessageInvariant();
-                unscoped_ids.push_back( info.sequence );
-                messages.push_back( CATCH_MOVE( info ) );
-            }
-
-            void addUnscopedMessage(MessageBuilder&& builder) {
-                MessageInfo info( CATCH_MOVE( builder.m_info ) );
-                info.message = builder.m_stream.str();
-                addUnscopedMessage( CATCH_MOVE( info ) );
-            }
-
-            void addScopedMessage(MessageInfo&& info) {
-                messages.push_back( CATCH_MOVE( info ) );
-            }
-
-            std::vector<MessageInfo> const& getMessages() const {
-                return messages;
-            }
-
-            void removeMessage( unsigned int messageId ) {
-                // Note: On average, it would probably be better to look for
-                //       the message backwards. However, we do not expect to have
-                //       to  deal with more messages than low single digits, so
-                //       the improvement is tiny, and we would have to hand-write
-                //       the loop to avoid terrible codegen of reverse iterators
-                //       in debug mode.
-                auto iter =
-                    std::find_if( messages.begin(),
-                                  messages.end(),
-                                  [messageId]( MessageInfo const& msg ) {
-                                      return msg.sequence == messageId;
-                                  } );
-                assert( iter != messages.end() &&
-                        "Trying to remove non-existent message." );
-                messages.erase( iter );
-            }
-
-            void removeUnscopedMessages() {
-                for ( const auto messageId : unscoped_ids ) {
-                    removeMessage( messageId );
-                }
-                unscoped_ids.clear();
-                g_clearMessageScopes = false;
-            }
-
-            void repairUnscopedMessageInvariant() {
-                if ( g_clearMessageScopes ) { removeUnscopedMessages(); }
-                g_clearMessageScopes = false;
-            }
-        };
-
-        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION
-        CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
-        static MessageHolder& g_messageHolder() {
-            static CATCH_INTERNAL_THREAD_LOCAL MessageHolder value;
-            return value;
-        }
-        CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
-
-
-        void pushScopedMessage( MessageInfo&& message ) {
-            Detail::g_messageHolder().addScopedMessage(  CATCH_MOVE( message ) );
-        }
-
-        void popScopedMessage( unsigned int messageId ) {
-            Detail::g_messageHolder().removeMessage( messageId );
-        }
-
-        void emplaceUnscopedMessage( MessageBuilder&& builder ) {
-            Detail::g_messageHolder().addUnscopedMessage( CATCH_MOVE( builder ) );
-        }
-
-        void addUnscopedMessage( MessageInfo&& message ) {
-            Detail::g_messageHolder().addUnscopedMessage( CATCH_MOVE( message ) );
-        }
-
-        bool lastAssertionPassed() { return Detail::g_lastAssertionPassed; }
-
-    } // namespace Detail
-
-    RunContext::RunContext(IConfig const* _config, IEventListenerPtr&& reporter)
-    :   m_runInfo(_config->name()),
-        m_config(_config),
-        m_reporter(CATCH_MOVE(reporter)),
-        m_outputRedirect( makeOutputRedirect( m_reporter->getPreferences().shouldRedirectStdOut ) ),
-        m_abortAfterXFailedAssertions( m_config->abortAfter() ),
-        m_reportAssertionStarting( m_reporter->getPreferences().shouldReportAllAssertionStarts ),
-        m_includeSuccessfulResults( m_config->includeSuccessfulResults() || m_reporter->getPreferences().shouldReportAllAssertions ),
-        m_shouldDebugBreak( m_config->shouldDebugBreak() )
-    {
-        getCurrentMutableContext().setResultCapture( this );
-        m_reporter->testRunStarting(m_runInfo);
-
-        // TODO: HACK!
-        //       We need to make sure the underlying cache is initialized
-        //       while we are guaranteed to be running in a single thread,
-        //       because the initialization is not thread-safe.
-        ReusableStringStream rss;
-        (void)rss;
-    }
-
-    RunContext::~RunContext() {
-        updateTotalsFromAtomics();
-        m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, aborting()));
-    }
-
-    Totals RunContext::runTest(TestCaseHandle const& testCase) {
-        updateTotalsFromAtomics();
-        const Totals prevTotals = m_totals;
-
-        auto const& testInfo = testCase.getTestCaseInfo();
-        m_reporter->testCaseStarting(testInfo);
-        testCase.prepareTestCase();
-        m_activeTestCase = &testCase;
-
-
-        ITracker& rootTracker = m_trackerContext.startRun();
-        assert(rootTracker.isSectionTracker());
-        rootTracker.setFilters( &m_config->getPathFilters(),
-                                m_config->useNewFilterBehaviour() );
-
-        // We intentionally only seed the internal RNG once per test case,
-        // before it is first invoked. The reason for that is a complex
-        // interplay of generator/section implementation details and the
-        // Random*Generator types.
-        //
-        // The issue boils down to us needing to seed the Random*Generators
-        // with different seed each, so that they return different sequences
-        // of random numbers. We do this by giving them a number from the
-        // shared RNG instance as their seed.
-        //
-        // However, this runs into an issue if the reseeding happens each
-        // time the test case is entered (as opposed to first time only),
-        // because multiple generators could get the same seed, e.g. in
-        // ```cpp
-        // TEST_CASE() {
-        //     auto i = GENERATE(take(10, random(0, 100));
-        //     SECTION("A") {
-        //         auto j = GENERATE(take(10, random(0, 100));
-        //     }
-        //     SECTION("B") {
-        //         auto k = GENERATE(take(10, random(0, 100));
-        //     }
-        // }
-        // ```
-        // `i` and `j` would properly return values from different sequences,
-        // but `i` and `k` would return the same sequence, because their seed
-        // would be the same.
-        // (The reason their seeds would be the same is that the generator
-        //  for k would be initialized when the test case is entered the second
-        //  time, after the shared RNG instance was reset to the same value
-        //  it had when the generator for i was initialized.)
-        seedRng( *m_config );
-
-        uint64_t testRuns = 0;
-        std::string redirectedCout;
-        std::string redirectedCerr;
-        do {
-            m_trackerContext.startCycle();
-            m_testCaseTracker = &SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocationRef(testInfo.name, testInfo.lineInfo));
-
-            m_reporter->testCasePartialStarting(testInfo, testRuns);
-
-            updateTotalsFromAtomics();
-            const auto beforeRunTotals = m_totals;
-            runCurrentTest();
-            std::string oneRunCout = m_outputRedirect->getStdout();
-            std::string oneRunCerr = m_outputRedirect->getStderr();
-            m_outputRedirect->clearBuffers();
-            redirectedCout += oneRunCout;
-            redirectedCerr += oneRunCerr;
-
-            updateTotalsFromAtomics();
-            const auto singleRunTotals = m_totals.delta(beforeRunTotals);
-            auto statsForOneRun = TestCaseStats(testInfo, singleRunTotals, CATCH_MOVE(oneRunCout), CATCH_MOVE(oneRunCerr), aborting());
-            m_reporter->testCasePartialEnded(statsForOneRun, testRuns);
-
-            ++testRuns;
-        } while (!m_testCaseTracker->isSuccessfullyCompleted() && !aborting());
-
-        Totals deltaTotals = m_totals.delta(prevTotals);
-        if (testInfo.expectedToFail() && deltaTotals.testCases.passed > 0) {
-            deltaTotals.assertions.failed++;
-            deltaTotals.testCases.passed--;
-            deltaTotals.testCases.failed++;
-        }
-        m_totals.testCases += deltaTotals.testCases;
-        testCase.tearDownTestCase();
-        m_reporter->testCaseEnded(TestCaseStats(testInfo,
-                                  deltaTotals,
-                                  CATCH_MOVE(redirectedCout),
-                                  CATCH_MOVE(redirectedCerr),
-                                  aborting()));
-
-        m_activeTestCase = nullptr;
-        m_testCaseTracker = nullptr;
-
-        return deltaTotals;
-    }
-
-
-    void RunContext::assertionEnded(AssertionResult&& result) {
-        Detail::g_lastKnownLineInfo = result.m_info.lineInfo;
-        if (result.getResultType() == ResultWas::Ok) {
-            m_atomicAssertionCount.passed++;
-            Detail::g_lastAssertionPassed = true;
-        } else if (result.getResultType() == ResultWas::ExplicitSkip) {
-            m_atomicAssertionCount.skipped++;
-            Detail::g_lastAssertionPassed = true;
-        } else if (!result.succeeded()) {
-            Detail::g_lastAssertionPassed = false;
-            if (result.isOk()) {}
-            else if( m_activeTestCase->getTestCaseInfo().okToFail() ) { // Read from a shared state established before the threads could start, this is fine
-                m_atomicAssertionCount.failedButOk++;
-            } else {
-                m_atomicAssertionCount.failed++;
-            }
-        } else {
-            Detail::g_lastAssertionPassed = true;
-        }
-
-        auto& msgHolder = Detail::g_messageHolder();
-        msgHolder.repairUnscopedMessageInvariant();
-
-        // From here, we are touching shared state and need mutex.
-        Detail::LockGuard lock( m_assertionMutex );
-        {
-            auto _ = scopedDeactivate( *m_outputRedirect );
-            updateTotalsFromAtomics();
-            m_reporter->assertionEnded( AssertionStats( result, msgHolder.getMessages(), m_totals ) );
-        }
-
-        if ( result.getResultType() != ResultWas::Warning ) {
-            msgHolder.removeUnscopedMessages();
-        }
-
-        // Reset working state. assertion info will be reset after
-        // populateReaction is run if it is needed
-        m_lastResult = CATCH_MOVE( result );
-    }
-
-    void RunContext::notifyAssertionStarted( AssertionInfo const& info ) {
-        if (m_reportAssertionStarting) {
-            Detail::LockGuard lock( m_assertionMutex );
-            auto _ = scopedDeactivate( *m_outputRedirect );
-            m_reporter->assertionStarting( info );
-        }
-    }
-
-    bool RunContext::sectionStarted( StringRef sectionName,
-                                     SourceLineInfo const& sectionLineInfo,
-                                     Counts& assertions ) {
-        ITracker& sectionTracker =
-            SectionTracker::acquire( m_trackerContext,
-                                     TestCaseTracking::NameAndLocationRef(
-                                         sectionName, sectionLineInfo ) );
-
-        if (!sectionTracker.isOpen())
-            return false;
-        m_activeSections.push_back(&sectionTracker);
-
-        SectionInfo sectionInfo( sectionLineInfo, static_cast<std::string>(sectionName) );
-        Detail::g_lastKnownLineInfo = sectionLineInfo;
-
-        {
-            auto _ = scopedDeactivate( *m_outputRedirect );
-            m_reporter->sectionStarting( sectionInfo );
-        }
-
-        updateTotalsFromAtomics();
-        assertions = m_totals.assertions;
-
-        return true;
-    }
-    IGeneratorTracker*
-    RunContext::acquireGeneratorTracker( StringRef generatorName,
-                                         SourceLineInfo const& lineInfo ) {
-        auto* tracker = Generators::GeneratorTracker::acquire(
-            m_trackerContext,
-            TestCaseTracking::NameAndLocationRef(
-                 generatorName, lineInfo ) );
-        Detail::g_lastKnownLineInfo = lineInfo;
-        return tracker;
-    }
-
-    IGeneratorTracker* RunContext::createGeneratorTracker(
-        StringRef generatorName,
-        SourceLineInfo lineInfo,
-        Generators::GeneratorBasePtr&& generator ) {
-
-        auto nameAndLoc = TestCaseTracking::NameAndLocation( static_cast<std::string>( generatorName ), lineInfo );
-        auto& currentTracker = m_trackerContext.currentTracker();
-        assert(
-            currentTracker.nameAndLocation() != nameAndLoc &&
-            "Trying to create tracker for a generator that already has one" );
-
-        auto newTracker =
-            Catch::Detail::make_unique<Generators::GeneratorTracker>(
-                CATCH_MOVE( nameAndLoc ),
-                m_trackerContext,
-                &currentTracker,
-                CATCH_MOVE( generator ) );
-
-        // The warning shouldn't fire if the generator is infinite, **but** filtered down.
-        if ( m_config->warnAboutInfiniteGenerators() &&
-             !newTracker->m_generator->isFinite() &&
-             !newTracker->isFiltered() ) {
-            // We want the semantics of `FAIL()`, but we inline it
-            // to avoid issues with conditionally prefixed macros
-            INTERNAL_CATCH_MSG( "FAIL",
-                                Catch::ResultWas::ExplicitFailure,
-                                Catch::ResultDisposition::Normal,
-                                "GENERATE() would run infinitely" );
-        }
-
-        auto returnPtr = newTracker.get();
-        currentTracker.addChild( CATCH_MOVE( newTracker ) );
-
-        returnPtr->open();
-        return returnPtr;
-    }
-
-    bool RunContext::testForMissingAssertions(Counts& assertions) {
-        if (assertions.total() != 0)
-            return false;
-        if (!m_config->warnAboutMissingAssertions())
-            return false;
-        if (m_trackerContext.currentTracker().hasChildren())
-            return false;
-        m_atomicAssertionCount.failed++;
-        assertions.failed++;
-        return true;
-    }
-
-    void RunContext::sectionEnded(SectionEndInfo&& endInfo) {
-        updateTotalsFromAtomics();
-        Counts assertions = m_totals.assertions - endInfo.prevAssertions;
-        bool missingAssertions = testForMissingAssertions(assertions);
-
-        if (!m_activeSections.empty()) {
-            m_activeSections.back()->close();
-            m_activeSections.pop_back();
-        }
-
-        {
-            auto _ = scopedDeactivate( *m_outputRedirect );
-            m_reporter->sectionEnded(
-                SectionStats( CATCH_MOVE( endInfo.sectionInfo ),
-                              assertions,
-                              endInfo.durationInSeconds,
-                              missingAssertions ) );
-        }
-    }
-
-    void RunContext::sectionEndedEarly(SectionEndInfo&& endInfo) {
-        if ( m_unfinishedSections.empty() ) {
-            m_activeSections.back()->fail();
-        } else {
-            m_activeSections.back()->close();
-        }
-        m_activeSections.pop_back();
-
-        m_unfinishedSections.push_back(CATCH_MOVE(endInfo));
-    }
-
-    void RunContext::benchmarkPreparing( StringRef name ) {
-        auto _ = scopedDeactivate( *m_outputRedirect );
-        m_reporter->benchmarkPreparing( name );
-    }
-    void RunContext::benchmarkStarting( BenchmarkInfo const& info ) {
-        auto _ = scopedDeactivate( *m_outputRedirect );
-        m_reporter->benchmarkStarting( info );
-    }
-    void RunContext::benchmarkEnded( BenchmarkStats<> const& stats ) {
-        auto _ = scopedDeactivate( *m_outputRedirect );
-        m_reporter->benchmarkEnded( stats );
-    }
-    void RunContext::benchmarkFailed( StringRef error ) {
-        auto _ = scopedDeactivate( *m_outputRedirect );
-        m_reporter->benchmarkFailed( error );
-    }
-
-    std::string RunContext::getCurrentTestName() const {
-        return m_activeTestCase
-            ? m_activeTestCase->getTestCaseInfo().name
-            : std::string();
-    }
-
-    const AssertionResult * RunContext::getLastResult() const {
-        // m_lastResult is updated inside the assertion slow-path, under
-        // a mutex, so the read needs to happen under mutex as well.
-
-        // TBD: The last result only makes sense if it is a thread-local
-        //      thing, because the answer is different per thread, like
-        //      last line info, whether last assertion passed, and so on.
-        //
-        //      However, the last result was also never updated in the
-        //      assertion fast path, so it was always somewhat broken,
-        //      and since IResultCapture::getLastResult is deprecated,
-        //      we will leave it as is, until it is finally removed.
-        Detail::LockGuard _( m_assertionMutex );
-        return &*m_lastResult;
-    }
-
-    void RunContext::exceptionEarlyReported() {
-        m_shouldReportUnexpected = false;
-    }
-
-    void RunContext::handleFatalErrorCondition( StringRef message ) {
-        // We lock only when touching the reporters directly, to avoid
-        // deadlocks when we call into other functions that also want
-        // to lock the mutex before touching reporters.
-        //
-        // This does mean that we allow other threads to run while handling
-        // a fatal error, but this is all a best effort attempt anyway.
-        {
-            Detail::LockGuard lock( m_assertionMutex );
-            // TODO: scoped deactivate here? Just give up and do best effort?
-            //       the deactivation can break things further, OTOH so can the
-            //       capture
-            auto _ = scopedDeactivate( *m_outputRedirect );
-
-            // First notify reporter that bad things happened
-            m_reporter->fatalErrorEncountered( message );
-        }
-
-        // Don't rebuild the result -- the stringification itself can cause more fatal errors
-        // Instead, fake a result data.
-        AssertionResultData tempResult( ResultWas::FatalErrorCondition, { false } );
-        tempResult.message = static_cast<std::string>(message);
-        AssertionResult result( makeDummyAssertionInfo(),
-                                CATCH_MOVE( tempResult ) );
-
-        assertionEnded(CATCH_MOVE(result) );
-
-
-        // At this point we touch sections/test cases from this thread
-        // to try and end them. Technically that is not supported when
-        // using multiple threads, but the worst thing that can happen
-        // is that the process aborts harder :-D
-        Detail::LockGuard lock( m_assertionMutex );
+    NameAndLocation::NameAndLocation( std::string&& _name, SourceLineInfo const& _location )
+    :   name( CATCH_MOVE(_name) ),
+        location( _location )
+    {}
 
-        // Best effort cleanup for sections that have not been destructed yet
-        // Since this is a fatal error, we have not had and won't have the opportunity to destruct them properly
-        while (!m_activeSections.empty()) {
-            auto const& nl = m_activeSections.back()->nameAndLocation();
-            SectionEndInfo endInfo{ SectionInfo(nl.location, nl.name), {}, 0.0 };
-            sectionEndedEarly(CATCH_MOVE(endInfo));
+    ITracker::ITracker( NameAndLocation&& nameAndLoc, ITracker* parent ):
+        m_nameAndLocation( CATCH_MOVE( nameAndLoc ) ), m_parent( parent ) {
+        if ( m_parent ) {
+            m_allTrackerDepth = m_parent->m_allTrackerDepth + 1;
+            // We leave section trackers to bump themselves up, as
+            // we cannot use `isSectionTracker` in constructor
+            m_sectionOnlyDepth = m_parent->m_sectionOnlyDepth;
+            m_filterRef = m_parent->m_filterRef;
+            m_newStyleFilters = m_parent->m_newStyleFilters;
         }
-        handleUnfinishedSections();
-
-        // Recreate section for test case (as we will lose the one that was in scope)
-        auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo();
-        SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name);
-
-        Counts assertions;
-        assertions.failed = 1;
-        SectionStats testCaseSectionStats(CATCH_MOVE(testCaseSection), assertions, 0, false);
-        m_reporter->sectionEnded( testCaseSectionStats );
+    }
 
-        auto const& testInfo = m_activeTestCase->getTestCaseInfo();
+    ITracker::~ITracker() = default;
 
-        Totals deltaTotals;
-        deltaTotals.testCases.failed = 1;
-        deltaTotals.assertions.failed = 1;
-        m_reporter->testCaseEnded(TestCaseStats(testInfo,
-                                  deltaTotals,
-                                  std::string(),
-                                  std::string(),
-                                  false));
-        m_totals.testCases.failed++;
-        updateTotalsFromAtomics();
-        m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, false));
+    void ITracker::markAsNeedingAnotherRun() {
+        m_runState = NeedsAnotherRun;
     }
 
-    void RunContext::assertionPassedFastPath(SourceLineInfo lineInfo) {
-        // We want to save the line info for better experience with unexpected assertions
-        Detail::g_lastKnownLineInfo = lineInfo;
-        ++m_atomicAssertionCount.passed;
-        Detail::g_lastAssertionPassed = true;
-        Detail::g_clearMessageScopes = true;
+    void ITracker::addChild( ITrackerPtr&& child ) {
+        m_children.push_back( CATCH_MOVE(child) );
     }
 
-    void RunContext::updateTotalsFromAtomics() {
-        m_totals.assertions = Counts{
-            m_atomicAssertionCount.passed,
-            m_atomicAssertionCount.failed,
-            m_atomicAssertionCount.failedButOk,
-            m_atomicAssertionCount.skipped,
-        };
+    ITracker* ITracker::findChild( NameAndLocationRef const& nameAndLocation ) {
+        auto it = std::find_if(
+            m_children.begin(),
+            m_children.end(),
+            [&nameAndLocation]( ITrackerPtr const& tracker ) {
+                auto const& tnameAndLoc = tracker->nameAndLocation();
+                if ( tnameAndLoc.location.line !=
+                     nameAndLocation.location.line ) {
+                    return false;
+                }
+                return tnameAndLoc == nameAndLocation;
+            } );
+        return ( it != m_children.end() ) ? it->get() : nullptr;
     }
 
-    bool RunContext::aborting() const {
-        return m_atomicAssertionCount.failed >= m_abortAfterXFailedAssertions;
-    }
+    bool ITracker::isSectionTracker() const { return false; }
+    bool ITracker::isGeneratorTracker() const { return false; }
 
-    std::string RunContext::endCapture() {
-        if ( !m_outputRedirect->isActive() ) {
-            return {};
-        }
-        m_outputRedirect->deactivate();
-        return m_outputRedirect->getStdout() + m_outputRedirect->getStderr();
+    bool ITracker::isOpen() const {
+        return m_runState != NotStarted && !isComplete();
     }
 
-    void RunContext::runCurrentTest() {
-        auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo();
-        SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name);
-        m_reporter->sectionStarting(testCaseSection);
-        updateTotalsFromAtomics();
-        Counts prevAssertions = m_totals.assertions;
-        double duration = 0;
-        m_shouldReportUnexpected = true;
-        Detail::g_lastKnownLineInfo = testCaseInfo.lineInfo;
+    bool ITracker::hasStarted() const { return m_runState != NotStarted; }
 
-        Timer timer;
-        CATCH_TRY {
-            {
-                auto _ = scopedActivate( *m_outputRedirect );
-                timer.start();
-                invokeActiveTestCase();
-            }
-            duration = timer.getElapsedSeconds();
-        } CATCH_CATCH_ANON (TestFailureException&) {
-            // This just means the test was aborted due to failure
-        } CATCH_CATCH_ANON (TestSkipException&) {
-            // This just means the test was explicitly skipped
-        } CATCH_CATCH_ALL {
-            // Under CATCH_CONFIG_FAST_COMPILE, unexpected exceptions under REQUIRE assertions
-            // are reported without translation at the point of origin.
-            if ( m_shouldReportUnexpected ) {
-                AssertionReaction dummyReaction;
-                handleUnexpectedInflightException( makeDummyAssertionInfo(),
-                                                   translateActiveException(),
-                                                   dummyReaction );
+    void ITracker::openChild() {
+        if (m_runState != ExecutingChildren) {
+            m_runState = ExecutingChildren;
+            if (m_parent) {
+                m_parent->openChild();
             }
         }
-        updateTotalsFromAtomics();
-        Counts assertions = m_totals.assertions - prevAssertions;
-        bool missingAssertions = testForMissingAssertions(assertions);
-
-        m_testCaseTracker->close();
-        handleUnfinishedSections();
-        auto& msgHolder = Detail::g_messageHolder();
-        msgHolder.removeUnscopedMessages();
-        assert( msgHolder.getMessages().empty() &&
-                "There should be no leftover messages after the test ends" );
-
-        SectionStats testCaseSectionStats(CATCH_MOVE(testCaseSection), assertions, duration, missingAssertions);
-        m_reporter->sectionEnded(testCaseSectionStats);
     }
 
-    void RunContext::invokeActiveTestCase() {
-        // We need to engage a handler for signals/structured exceptions
-        // before running the tests themselves, or the binary can crash
-        // without failed test being reported.
-        FatalConditionHandlerGuard _(&m_fatalConditionhandler);
-        // We keep having issue where some compilers warn about an unused
-        // variable, even though the type has non-trivial constructor and
-        // destructor. This is annoying and ugly, but it makes them stfu.
-        (void)_;
+    ITracker& TrackerContext::startRun() {
+        using namespace std::string_literals;
+        m_rootTracker = Catch::Detail::make_unique<SectionTracker>(
+            NameAndLocation( "{root}"s, CATCH_INTERNAL_LINEINFO ),
+            *this,
+            nullptr );
+        m_currentTracker = nullptr;
+        m_runState = Executing;
+        return *m_rootTracker;
+    }
 
-        m_activeTestCase->invoke();
+    void TrackerContext::completeCycle() {
+        m_runState = CompletedCycle;
     }
 
-    void RunContext::handleUnfinishedSections() {
-        // If sections ended prematurely due to an exception we stored their
-        // infos here so we can tear them down outside the unwind process.
-        for ( auto it = m_unfinishedSections.rbegin(),
-                   itEnd = m_unfinishedSections.rend();
-              it != itEnd;
-              ++it ) {
-            sectionEnded( CATCH_MOVE( *it ) );
-        }
-        m_unfinishedSections.clear();
+    bool TrackerContext::completedCycle() const {
+        return m_runState == CompletedCycle;
+    }
+    void TrackerContext::setCurrentTracker( ITracker* tracker ) {
+        m_currentTracker = tracker;
     }
 
-    void RunContext::handleExpr(
-        AssertionInfo const& info,
-        ITransientExpression const& expr,
-        AssertionReaction& reaction
-    ) {
-        bool negated = isFalseTest( info.resultDisposition );
-        bool result = expr.getResult() != negated;
 
-        if( result ) {
-            if (!m_includeSuccessfulResults) {
-                assertionPassedFastPath(info.lineInfo);
-            }
-            else {
-                reportExpr(info, ResultWas::Ok, &expr, negated);
-            }
-        }
-        else {
-            reportExpr(info, ResultWas::ExpressionFailed, &expr, negated );
-            populateReaction(
-                reaction, info.resultDisposition & ResultDisposition::Normal );
-        }
+    TrackerBase::TrackerBase( NameAndLocation&& nameAndLocation, TrackerContext& ctx, ITracker* parent ):
+        ITracker(CATCH_MOVE(nameAndLocation), parent),
+        m_ctx( ctx )
+    {}
+
+    bool TrackerBase::isComplete() const {
+        return m_runState == CompletedSuccessfully || m_runState == Failed;
     }
-    void RunContext::reportExpr(
-            AssertionInfo const &info,
-            ResultWas::OfType resultType,
-            ITransientExpression const *expr,
-            bool negated ) {
 
-        Detail::g_lastKnownLineInfo = info.lineInfo;
-        AssertionResultData data( resultType, LazyExpression( negated ) );
+    void TrackerBase::open() {
+        m_runState = Executing;
+        moveToThis();
+        if( m_parent )
+            m_parent->openChild();
+    }
 
-        AssertionResult assertionResult{ info, CATCH_MOVE( data ) };
-        assertionResult.m_resultData.lazyExpression.m_transientExpression = expr;
+    void TrackerBase::close() {
 
-        assertionEnded( CATCH_MOVE(assertionResult) );
-    }
+        // Close any still open children (e.g. generators)
+        while( &m_ctx.currentTracker() != this )
+            m_ctx.currentTracker().close();
 
-    void RunContext::handleMessage(
-            AssertionInfo const& info,
-            ResultWas::OfType resultType,
-            std::string&& message,
-            AssertionReaction& reaction
-    ) {
-        Detail::g_lastKnownLineInfo = info.lineInfo;
+        switch( m_runState ) {
+            case NeedsAnotherRun:
+                break;
 
-        AssertionResultData data( resultType, LazyExpression( false ) );
-        data.message = CATCH_MOVE( message );
-        AssertionResult assertionResult{ info,
-                                         CATCH_MOVE( data ) };
+            case Executing:
+                m_runState = CompletedSuccessfully;
+                break;
+            case ExecutingChildren:
+                if( std::all_of(m_children.begin(), m_children.end(), [](ITrackerPtr const& t){ return t->isComplete(); }) )
+                    m_runState = CompletedSuccessfully;
+                break;
 
-        const auto isOk = assertionResult.isOk();
-        assertionEnded( CATCH_MOVE(assertionResult) );
-        if ( !isOk ) {
-            populateReaction(
-                reaction, info.resultDisposition & ResultDisposition::Normal );
-        } else if ( resultType == ResultWas::ExplicitSkip ) {
-            // TODO: Need to handle this explicitly, as ExplicitSkip is
-            // considered "OK"
-            reaction.shouldSkip = true;
+            case NotStarted:
+            case CompletedSuccessfully:
+            case Failed:
+                CATCH_INTERNAL_ERROR( "Illogical state: " << m_runState );
+
+            default:
+                CATCH_INTERNAL_ERROR( "Unknown state: " << m_runState );
         }
+        moveToParent();
+        m_ctx.completeCycle();
+    }
+    void TrackerBase::fail() {
+        m_runState = Failed;
+        if( m_parent )
+            m_parent->markAsNeedingAnotherRun();
+        moveToParent();
+        m_ctx.completeCycle();
     }
 
-    void RunContext::handleUnexpectedExceptionNotThrown(
-            AssertionInfo const& info,
-            AssertionReaction& reaction
-    ) {
-        handleNonExpr(info, Catch::ResultWas::DidntThrowException, reaction);
+    void TrackerBase::moveToParent() {
+        assert( m_parent );
+        m_ctx.setCurrentTracker( m_parent );
+    }
+    void TrackerBase::moveToThis() {
+        m_ctx.setCurrentTracker( this );
     }
 
-    void RunContext::handleUnexpectedInflightException(
-            AssertionInfo const& info,
-            std::string&& message,
-            AssertionReaction& reaction
-    ) {
-        Detail::g_lastKnownLineInfo = info.lineInfo;
+    bool SectionTracker::isFilteredImpl() const {
+        // TBD: This is currently _very_ similar to the block in `isComplete`.
+        //      Is this necessarily that way, or just accident of current semantics?
+        const size_t filterIndex =
+            m_newStyleFilters ? m_allTrackerDepth : m_sectionOnlyDepth;
 
-        AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) );
-        data.message = CATCH_MOVE(message);
-        AssertionResult assertionResult{ info, CATCH_MOVE(data) };
-        assertionEnded( CATCH_MOVE(assertionResult) );
-        populateReaction( reaction,
-                          info.resultDisposition & ResultDisposition::Normal );
-    }
+        if ( filterIndex < m_filterRef->size() ) {
+            // 1) New style filter must explicitly target section
+            if ( m_newStyleFilters && ( *m_filterRef )[filterIndex].type !=
+                                          PathFilter::For::Section ) {
+                return true;
+            }
+            // 2) Both style filters must match the trimmed name exactly
+            if ( m_trimmed_name !=
+                 StringRef( ( *m_filterRef )[filterIndex].filter ) ) {
+                return true;
+            }
+        }
 
-    void RunContext::populateReaction( AssertionReaction& reaction,
-                                       bool has_normal_disposition ) const {
-        reaction.shouldDebugBreak = m_shouldDebugBreak;
-        reaction.shouldThrow = aborting() || has_normal_disposition;
+        return false;
     }
 
-    AssertionInfo RunContext::makeDummyAssertionInfo() {
-        const bool testCaseJustStarted =
-            Detail::g_lastKnownLineInfo ==
-            m_activeTestCase->getTestCaseInfo().lineInfo;
-
-        return AssertionInfo{
-            testCaseJustStarted ? "TEST_CASE"_sr : StringRef(),
-            Detail::g_lastKnownLineInfo,
-            testCaseJustStarted ? StringRef() : "{Unknown expression after the reported line}"_sr,
-            ResultDisposition::Normal
-        };
+    SectionTracker::SectionTracker( NameAndLocation&& nameAndLocation, TrackerContext& ctx, ITracker* parent )
+    :   TrackerBase( CATCH_MOVE(nameAndLocation), ctx, parent ),
+        m_trimmed_name(trim(StringRef(ITracker::nameAndLocation().name)))
+    {
+        if( m_parent ) {
+            ++m_sectionOnlyDepth;
+        }
     }
 
-    void RunContext::handleIncomplete(
-            AssertionInfo const& info
-    ) {
-        using namespace std::string_literals;
-        Detail::g_lastKnownLineInfo = info.lineInfo;
+    bool SectionTracker::isComplete() const {
+        // If there are active filters AND we do not pass them,
+        // the section is always "completed"
+        const size_t filterIndex =
+            m_newStyleFilters ? m_allTrackerDepth : m_sectionOnlyDepth;
+        if ( filterIndex < m_filterRef->size() ) {
+            // There is active filter, check it
+            // 1) New style filter must explicitly target section
+            if ( m_newStyleFilters && ( *m_filterRef )[filterIndex].type !=
+                                          PathFilter::For::Section ) {
+                return true;
+            }
+            // 2) Both style filters must match the trimmed name exactly
+            if ( m_trimmed_name !=
+                 StringRef( ( *m_filterRef )[filterIndex].filter ) ) {
+                return true;
+            }
+        }
 
-        AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) );
-        data.message = "Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE"s;
-        AssertionResult assertionResult{ info, CATCH_MOVE( data ) };
-        assertionEnded( CATCH_MOVE(assertionResult) );
+        // Otherwise we delegate to the generic processing
+        return TrackerBase::isComplete();
     }
 
-    void RunContext::handleNonExpr(
-            AssertionInfo const &info,
-            ResultWas::OfType resultType,
-            AssertionReaction &reaction
-    ) {
-        AssertionResultData data( resultType, LazyExpression( false ) );
-        AssertionResult assertionResult{ info, CATCH_MOVE( data ) };
+    bool SectionTracker::isSectionTracker() const { return true; }
 
-        const auto isOk = assertionResult.isOk();
-        if ( isOk && !m_includeSuccessfulResults ) {
-            assertionPassedFastPath( info.lineInfo );
-            return;
+    SectionTracker& SectionTracker::acquire( TrackerContext& ctx, NameAndLocationRef const& nameAndLocation ) {
+        SectionTracker* tracker;
+
+        ITracker& currentTracker = ctx.currentTracker();
+        if ( ITracker* childTracker =
+                 currentTracker.findChild( nameAndLocation ) ) {
+            assert( childTracker );
+            assert( childTracker->isSectionTracker() );
+            tracker = static_cast<SectionTracker*>( childTracker );
+        } else {
+            auto newTracker = Catch::Detail::make_unique<SectionTracker>(
+                NameAndLocation{ static_cast<std::string>(nameAndLocation.name),
+                                 nameAndLocation.location },
+                ctx,
+                &currentTracker );
+            tracker = newTracker.get();
+            currentTracker.addChild( CATCH_MOVE( newTracker ) );
         }
 
-        assertionEnded( CATCH_MOVE(assertionResult) );
-        if ( !isOk ) {
-            populateReaction(
-                reaction, info.resultDisposition & ResultDisposition::Normal );
+        if ( !ctx.completedCycle() ) {
+            tracker->tryOpen();
         }
+
+        return *tracker;
     }
 
-    void seedRng(IConfig const& config) {
-        sharedRng().seed(config.rngSeed());
+    void SectionTracker::tryOpen() {
+        if( !isComplete() )
+            open();
     }
 
-    unsigned int rngSeed() {
-        return getCurrentContext().getConfig()->rngSeed();
+    StringRef SectionTracker::trimmedName() const {
+        return m_trimmed_name;
     }
 
-}
+} // namespace TestCaseTracking
 
+} // namespace Catch
 
+#if defined(__clang__)
+#    pragma clang diagnostic pop
+#endif
 
-namespace Catch {
 
-    Section::Section( SectionInfo&& info ):
-        m_info( CATCH_MOVE( info ) ),
-        m_sectionIncluded(
-            getResultCapture().sectionStarted( m_info.name, m_info.lineInfo, m_assertions ) ) {
-        // Non-"included" sections will not use the timing information
-        // anyway, so don't bother with the potential syscall.
-        if (m_sectionIncluded) {
-            m_timer.start();
-        }
-    }
 
-    Section::Section( SourceLineInfo const& _lineInfo,
-                      StringRef _name,
-                      const char* const ):
-        m_info( { "invalid", static_cast<std::size_t>( -1 ) }, std::string{} ),
-        m_sectionIncluded(
-            getResultCapture().sectionStarted( _name, _lineInfo, m_assertions ) ) {
-        // We delay initialization the SectionInfo member until we know
-        // this section needs it, so we avoid allocating std::string for name.
-        // We also delay timer start to avoid the potential syscall unless we
-        // will actually use the result.
-        if ( m_sectionIncluded ) {
-            m_info.name = static_cast<std::string>( _name );
-            m_info.lineInfo = _lineInfo;
-            m_timer.start();
-        }
-    }
 
-    Section::~Section() {
-        if( m_sectionIncluded ) {
-            SectionEndInfo endInfo{ CATCH_MOVE(m_info), m_assertions, m_timer.getElapsedSeconds() };
-            if ( uncaught_exceptions() ) {
-                getResultCapture().sectionEndedEarly( CATCH_MOVE(endInfo) );
-            } else {
-                getResultCapture().sectionEnded( CATCH_MOVE( endInfo ) );
-            }
-        }
-    }
+namespace Catch {
 
-    // This indicates whether the section should be executed or not
-    Section::operator bool() const {
-        return m_sectionIncluded;
+    void throw_test_failure_exception() {
+#if !defined( CATCH_CONFIG_DISABLE_EXCEPTIONS )
+        throw TestFailureException{}; //NOLINT(bugprone-std-exception-baseclass)
+#else
+        CATCH_ERROR( "Test failure requires aborting test!" );
+#endif
     }
 
+    void throw_test_skip_exception() {
+#if !defined( CATCH_CONFIG_DISABLE_EXCEPTIONS )
+        throw Catch::TestSkipException(); //NOLINT(bugprone-std-exception-baseclass)
+#else
+        CATCH_ERROR( "Explicitly skipping tests during runtime requires exceptions" );
+#endif
+    }
 
-} // end namespace Catch
+} // namespace Catch
 
 
 
-#include <vector>
+#include <algorithm>
+#include <iterator>
 
 namespace Catch {
+    void ITestInvoker::prepareTestCase() {}
+    void ITestInvoker::tearDownTestCase() {}
+    ITestInvoker::~ITestInvoker() = default;
 
     namespace {
-        static auto getSingletons() -> std::vector<ISingleton*>*& {
-            static std::vector<ISingleton*>* g_singletons = nullptr;
-            if( !g_singletons )
-                g_singletons = new std::vector<ISingleton*>();
-            return g_singletons;
-        }
-    }
-
-    ISingleton::~ISingleton() = default;
-
-    void addSingleton(ISingleton* singleton ) {
-        getSingletons()->push_back( singleton );
-    }
-    void cleanupSingletons() {
-        auto& singletons = getSingletons();
-        for( auto singleton : *singletons )
-            delete singleton;
-        delete singletons;
-        singletons = nullptr;
-    }
+        static StringRef extractClassName( StringRef classOrMethodName ) {
+            if ( !startsWith( classOrMethodName, '&' ) ) {
+                return classOrMethodName;
+            }
 
-} // namespace Catch
+            // Remove the leading '&' to avoid having to special case it later
+            const auto methodName =
+                classOrMethodName.substr( 1, classOrMethodName.size() );
 
+            auto reverseStart = std::make_reverse_iterator( methodName.end() );
+            auto reverseEnd = std::make_reverse_iterator( methodName.begin() );
 
+            // We make a simplifying assumption that ":" is only present
+            // in the input as part of "::" from C++ typenames (this is
+            // relatively safe assumption because the input is generated
+            // as stringification of type through preprocessor).
+            auto lastColons = std::find( reverseStart, reverseEnd, ':' ) + 1;
+            auto secondLastColons =
+                std::find( lastColons + 1, reverseEnd, ':' );
 
-#include <cstring>
-#include <ostream>
+            auto const startIdx = reverseEnd - secondLastColons;
+            auto const classNameSize = secondLastColons - lastColons - 1;
 
-namespace Catch {
+            return methodName.substr(
+                static_cast<std::size_t>( startIdx ),
+                static_cast<std::size_t>( classNameSize ) );
+        }
 
-    bool SourceLineInfo::operator == ( SourceLineInfo const& other ) const noexcept {
-        return line == other.line && (file == other.file || std::strcmp(file, other.file) == 0);
-    }
-    bool SourceLineInfo::operator < ( SourceLineInfo const& other ) const noexcept {
-        // We can assume that the same file will usually have the same pointer.
-        // Thus, if the pointers are the same, there is no point in calling the strcmp
-        return line < other.line || ( line == other.line && file != other.file && (std::strcmp(file, other.file) < 0));
-    }
+        class TestInvokerAsFunction final : public ITestInvoker {
+            using TestType = void ( * )();
+            TestType m_testAsFunction;
 
-    std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) {
-#ifndef __GNUG__
-        os << info.file << '(' << info.line << ')';
-#else
-        os << info.file << ':' << info.line;
-#endif
-        return os;
-    }
+        public:
+            constexpr TestInvokerAsFunction( TestType testAsFunction ) noexcept:
+                m_testAsFunction( testAsFunction ) {}
 
-} // end namespace Catch
+            void invoke() const override { m_testAsFunction(); }
+        };
 
+    } // namespace
 
+    Detail::unique_ptr<ITestInvoker> makeTestInvoker( void(*testAsFunction)() ) {
+        return Detail::make_unique<TestInvokerAsFunction>( testAsFunction );
+    }
 
+    AutoReg::AutoReg( void ( *testAsFunction )(),
+                      SourceLineInfo const& lineInfo,
+                      StringRef classOrMethod,
+                      NameAndTags const& nameAndTags ) noexcept:
+        AutoReg( makeTestInvoker( testAsFunction ),
+                 lineInfo,
+                 classOrMethod,
+                 nameAndTags ) {}
 
-namespace Catch {
-#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
-    void StartupExceptionRegistry::add( std::exception_ptr const& exception ) noexcept {
+    AutoReg::AutoReg( Detail::unique_ptr<ITestInvoker> invoker, SourceLineInfo const& lineInfo, StringRef classOrMethod, NameAndTags const& nameAndTags ) noexcept {
         CATCH_TRY {
-            m_exceptions.push_back(exception);
+            getMutableRegistryHub()
+                    .registerTest(
+                        makeTestCaseInfo(
+                            extractClassName( classOrMethod ),
+                            nameAndTags,
+                            lineInfo),
+                        CATCH_MOVE(invoker)
+                    );
         } CATCH_CATCH_ALL {
-            // If we run out of memory during start-up there's really not a lot more we can do about it
-            std::terminate();
+            // Do not throw when constructing global objects, instead register the exception to be processed later
+            getMutableRegistryHub().registerStartupException();
         }
     }
-
-    std::vector<std::exception_ptr> const& StartupExceptionRegistry::getExceptions() const noexcept {
-        return m_exceptions;
-    }
-#endif
-
-} // end namespace Catch
-
+}
 
 
 
 
-#include <iostream>
 
 namespace Catch {
 
-// If you #define this you must implement these functions
-#if !defined( CATCH_CONFIG_NOSTDOUT )
-    std::ostream& cout() { return std::cout; }
-    std::ostream& cerr() { return std::cerr; }
-    std::ostream& clog() { return std::clog; }
-#endif
-
-} // namespace Catch
-
+    TestSpecParser::TestSpecParser( ITagAliasRegistry const& tagAliases ) : m_tagAliases( &tagAliases ) {}
 
+    TestSpecParser& TestSpecParser::parse( std::string const& arg ) {
+        m_mode = None;
+        m_exclusion = false;
+        m_arg = m_tagAliases->expandAliases( arg );
+        m_escapeChars.clear();
+        m_substring.reserve(m_arg.size());
+        m_patternName.reserve(m_arg.size());
+        m_realPatternPos = 0;
 
-#include <ostream>
-#include <cstring>
-#include <vector>
+        for( m_pos = 0; m_pos < m_arg.size(); ++m_pos )
+          //if visitChar fails
+           if( !visitChar( m_arg[m_pos] ) ){
+               m_testSpec.m_invalidSpecs.push_back(arg);
+               break;
+           }
+        endMode();
+        return *this;
+    }
+    TestSpec TestSpecParser::testSpec() {
+        addFilter();
+        return CATCH_MOVE(m_testSpec);
+    }
+    bool TestSpecParser::visitChar( char c ) {
+        if( (m_mode != EscapedName) && (c == '\\') ) {
+            escape();
+            addCharToPattern(c);
+            return true;
+        }else if((m_mode != EscapedName) && (c == ',') )  {
+            return separate();
+        }
 
-namespace Catch {
+        switch( m_mode ) {
+        case None:
+            if( processNoneChar( c ) )
+                return true;
+            break;
+        case Name:
+            processNameChar( c );
+            break;
+        case EscapedName:
+            endMode();
+            addCharToPattern(c);
+            return true;
+        default:
+        case Tag:
+        case QuotedName:
+            if( processOtherChar( c ) )
+                return true;
+            break;
+        }
 
-    bool startsWith( std::string const& s, std::string const& prefix ) {
-        return s.size() >= prefix.size() && std::equal(prefix.begin(), prefix.end(), s.begin());
+        m_substring += c;
+        if( !isControlChar( c ) ) {
+            m_patternName += c;
+            m_realPatternPos++;
+        }
+        return true;
     }
-    bool startsWith( StringRef s, char prefix ) {
-        return !s.empty() && s[0] == prefix;
+    // Two of the processing methods return true to signal the caller to return
+    // without adding the given character to the current pattern strings
+    bool TestSpecParser::processNoneChar( char c ) {
+        switch( c ) {
+        case ' ':
+            return true;
+        case '~':
+            m_exclusion = true;
+            return false;
+        case '[':
+            startNewMode( Tag );
+            return false;
+        case '"':
+            startNewMode( QuotedName );
+            return false;
+        default:
+            startNewMode( Name );
+            return false;
+        }
     }
-    bool endsWith( std::string const& s, std::string const& suffix ) {
-        return s.size() >= suffix.size() && std::equal(suffix.rbegin(), suffix.rend(), s.rbegin());
+    void TestSpecParser::processNameChar( char c ) {
+        if( c == '[' ) {
+            if( m_substring == "exclude:" )
+                m_exclusion = true;
+            else
+                endMode();
+            startNewMode( Tag );
+        }
     }
-    bool endsWith( std::string const& s, char suffix ) {
-        return !s.empty() && s[s.size()-1] == suffix;
+    bool TestSpecParser::processOtherChar( char c ) {
+        if( !isControlChar( c ) )
+            return false;
+        m_substring += c;
+        endMode();
+        return true;
     }
-    bool contains( std::string const& s, std::string const& infix ) {
-        return s.find( infix ) != std::string::npos;
+    void TestSpecParser::startNewMode( Mode mode ) {
+        m_mode = mode;
     }
-    void toLowerInPlace( std::string& s ) {
-        for ( char& c : s ) {
-            c = toLower( c );
+    void TestSpecParser::endMode() {
+        switch( m_mode ) {
+        case Name:
+        case QuotedName:
+            return addNamePattern();
+        case Tag:
+            return addTagPattern();
+        case EscapedName:
+            revertBackToLastMode();
+            return;
+        case None:
+        default:
+            return startNewMode( None );
         }
     }
-    std::string toLower( std::string const& s ) {
-        std::string lc = s;
-        toLowerInPlace( lc );
-        return lc;
-    }
-
-    std::string trim( std::string const& str ) {
-        static char const* whitespaceChars = "\n\r\t ";
-        std::string::size_type start = str.find_first_not_of( whitespaceChars );
-        std::string::size_type end = str.find_last_not_of( whitespaceChars );
-
-        return start != std::string::npos ? str.substr( start, 1+end-start ) : std::string();
-    }
-
-    StringRef trim(StringRef ref) {
-        const auto is_ws = [](char c) {
-            return c == ' ' || c == '\t' || c == '\n' || c == '\r';
-        };
-        size_t real_begin = 0;
-        while (real_begin < ref.size() && is_ws(ref[real_begin])) { ++real_begin; }
-        size_t real_end = ref.size();
-        while (real_end > real_begin && is_ws(ref[real_end - 1])) { --real_end; }
-
-        return ref.substr(real_begin, real_end - real_begin);
+    void TestSpecParser::escape() {
+        saveLastMode();
+        m_mode = EscapedName;
+        m_escapeChars.push_back(m_realPatternPos);
     }
-
-    bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ) {
-        std::size_t i = str.find( replaceThis );
-        if (i == std::string::npos) {
-            return false;
-        }
-        std::size_t copyBegin = 0;
-        std::string origStr = CATCH_MOVE(str);
-        str.clear();
-        // There is at least one replacement, so reserve with the best guess
-        // we can make without actually counting the number of occurrences.
-        str.reserve(origStr.size() - replaceThis.size() + withThis.size());
-        do {
-            str.append(origStr, copyBegin, i-copyBegin );
-            str += withThis;
-            copyBegin = i + replaceThis.size();
-            if( copyBegin < origStr.size() )
-                i = origStr.find( replaceThis, copyBegin );
-            else
-                i = std::string::npos;
-        } while( i != std::string::npos );
-        if ( copyBegin < origStr.size() ) {
-            str.append(origStr, copyBegin, origStr.size() );
+    bool TestSpecParser::isControlChar( char c ) const {
+        switch( m_mode ) {
+            default:
+                return false;
+            case None:
+                return c == '~';
+            case Name:
+                return c == '[';
+            case EscapedName:
+                return true;
+            case QuotedName:
+                return c == '"';
+            case Tag:
+                return c == '[' || c == ']';
         }
-        return true;
     }
 
-    std::vector<StringRef> splitStringRef( StringRef str, char delimiter ) {
-        std::vector<StringRef> subStrings;
-        std::size_t start = 0;
-        for(std::size_t pos = 0; pos < str.size(); ++pos ) {
-            if( str[pos] == delimiter ) {
-                if( pos - start > 1 )
-                    subStrings.push_back( str.substr( start, pos-start ) );
-                start = pos+1;
-            }
+    void TestSpecParser::addFilter() {
+        if( !m_currentFilter.m_required.empty() || !m_currentFilter.m_forbidden.empty() ) {
+            m_testSpec.m_filters.push_back( CATCH_MOVE(m_currentFilter) );
+            m_currentFilter = TestSpec::Filter();
         }
-        if( start < str.size() )
-            subStrings.push_back( str.substr( start, str.size()-start ) );
-        return subStrings;
     }
 
-    std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ) {
-        os << pluraliser.m_count << ' ' << pluraliser.m_label;
-        if( pluraliser.m_count != 1 )
-            os << 's';
-        return os;
+    void TestSpecParser::saveLastMode() {
+      lastMode = m_mode;
     }
 
-}
+    void TestSpecParser::revertBackToLastMode() {
+      m_mode = lastMode;
+    }
 
+    bool TestSpecParser::separate() {
+      if( (m_mode==QuotedName) || (m_mode==Tag) ){
+         //invalid argument, signal failure to previous scope.
+         m_mode = None;
+         m_pos = m_arg.size();
+         m_substring.clear();
+         m_patternName.clear();
+         m_realPatternPos = 0;
+         return false;
+      }
+      endMode();
+      addFilter();
+      return true; //success
+    }
 
+    std::string TestSpecParser::preprocessPattern() {
+        std::string token = m_patternName;
+        for (std::size_t i = 0; i < m_escapeChars.size(); ++i)
+            token = token.substr(0, m_escapeChars[i] - i) + token.substr(m_escapeChars[i] - i + 1);
+        m_escapeChars.clear();
+        if (startsWith(token, "exclude:")) {
+            m_exclusion = true;
+            token = token.substr(8);
+        }
 
-#include <algorithm>
-#include <ostream>
-#include <cstring>
+        m_patternName.clear();
+        m_realPatternPos = 0;
 
-namespace Catch {
-    StringRef::StringRef( char const* rawChars ) noexcept
-    : StringRef( rawChars, std::strlen(rawChars) )
-    {}
+        return token;
+    }
 
+    void TestSpecParser::addNamePattern() {
+        auto token = preprocessPattern();
 
-    bool StringRef::operator<(StringRef rhs) const noexcept {
-        if (m_size < rhs.m_size) {
-            return strncmp(m_start, rhs.m_start, m_size) <= 0;
+        if (!token.empty()) {
+            if (m_exclusion) {
+                m_currentFilter.m_forbidden.emplace_back(Detail::make_unique<TestSpec::NamePattern>(token, m_substring));
+            } else {
+                m_currentFilter.m_required.emplace_back(Detail::make_unique<TestSpec::NamePattern>(token, m_substring));
+            }
         }
-        return strncmp(m_start, rhs.m_start, rhs.m_size) < 0;
+        m_substring.clear();
+        m_exclusion = false;
+        m_mode = None;
     }
 
-    int StringRef::compare( StringRef rhs ) const {
-        auto cmpResult =
-            strncmp( m_start, rhs.m_start, std::min( m_size, rhs.m_size ) );
-
-        // This means that strncmp found a difference before the strings
-        // ended, and we can return it directly
-        if ( cmpResult != 0 ) {
-            return cmpResult;
-        }
+    void TestSpecParser::addTagPattern() {
+        auto token = preprocessPattern();
 
-        // If strings are equal up to length, then their comparison results on
-        // their size
-        if ( m_size < rhs.m_size ) {
-            return -1;
-        } else if ( m_size > rhs.m_size ) {
-            return 1;
-        } else {
-            return 0;
+        if (!token.empty()) {
+            // If the tag pattern is the "hide and tag" shorthand (e.g. [.foo])
+            // we have to create a separate hide tag and shorten the real one
+            if (token.size() > 1 && token[0] == '.') {
+                token.erase(token.begin());
+                if (m_exclusion) {
+                    m_currentFilter.m_forbidden.emplace_back(Detail::make_unique<TestSpec::TagPattern>(".", m_substring));
+                } else {
+                    m_currentFilter.m_required.emplace_back(Detail::make_unique<TestSpec::TagPattern>(".", m_substring));
+                }
+            }
+            if (m_exclusion) {
+                m_currentFilter.m_forbidden.emplace_back(Detail::make_unique<TestSpec::TagPattern>(token, m_substring));
+            } else {
+                m_currentFilter.m_required.emplace_back(Detail::make_unique<TestSpec::TagPattern>(token, m_substring));
+            }
         }
+        m_substring.clear();
+        m_exclusion = false;
+        m_mode = None;
     }
 
-    auto operator << ( std::ostream& os, StringRef str ) -> std::ostream& {
-        return os.write(str.data(), static_cast<std::streamsize>(str.size()));
-    }
-
-    std::string operator+(StringRef lhs, StringRef rhs) {
-        std::string ret;
-        ret.reserve(lhs.size() + rhs.size());
-        ret += lhs;
-        ret += rhs;
-        return ret;
-    }
+} // namespace Catch
 
-    auto operator+=( std::string& lhs, StringRef rhs ) -> std::string& {
-        lhs.append(rhs.data(), rhs.size());
-        return lhs;
-    }
 
-} // namespace Catch
 
 
+#include <exception>
 
 namespace Catch {
+    bool uncaught_exceptions() {
+#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
+        return false;
+#elif defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
+        return std::uncaught_exceptions() > 0;
+#else
+        return std::uncaught_exception();
+#endif
+  }
+} // end namespace Catch
 
-    TagAliasRegistry::~TagAliasRegistry() = default;
 
-    TagAlias const* TagAliasRegistry::find( std::string const& alias ) const {
-        auto it = m_registry.find( alias );
-        if ( it != m_registry.end() ) {
-            return &it->second;
-        } else {
-            return nullptr;
-        }
-    }
 
-    std::string TagAliasRegistry::expandAliases( std::string const& unexpandedTestSpec ) const {
-        std::string expandedTestSpec = unexpandedTestSpec;
-        for( auto const& registryKvp : m_registry ) {
-            std::size_t pos = expandedTestSpec.find( registryKvp.first );
-            if( pos != std::string::npos ) {
-                expandedTestSpec =  expandedTestSpec.substr( 0, pos ) +
-                                    registryKvp.second.tag +
-                                    expandedTestSpec.substr( pos + registryKvp.first.size() );
-            }
+namespace Catch {
+
+    WildcardPattern::WildcardPattern( std::string const& pattern,
+                                      CaseSensitive caseSensitivity )
+    :   m_caseSensitivity( caseSensitivity ),
+        m_pattern( trim(pattern) )
+    {
+        if( startsWith( m_pattern, '*' ) ) {
+            m_pattern = m_pattern.erase( 0, 1 ); // effectively pop_front
+            m_wildcard = static_cast<WildcardPosition>( m_wildcard | WildcardAtStart );
+        }
+        if( endsWith( m_pattern, '*' ) ) {
+            m_pattern.pop_back();
+            m_wildcard = static_cast<WildcardPosition>( m_wildcard | WildcardAtEnd );
         }
-        return expandedTestSpec;
     }
 
-    void TagAliasRegistry::add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) {
-        CATCH_ENFORCE( startsWith(alias, "[@") && endsWith(alias, ']'),
-                      "error: tag alias, '" << alias << "' is not of the form [@alias name].\n" << lineInfo );
-
-        CATCH_ENFORCE( m_registry.insert(std::make_pair(alias, TagAlias(tag, lineInfo))).second,
-                      "error: tag alias, '" << alias << "' already registered.\n"
-                      << "\tFirst seen at: " << find(alias)->lineInfo << "\n"
-                      << "\tRedefined at: " << lineInfo );
-    }
+    bool WildcardPattern::matches( StringRef input ) const {
+        input = trim( input );
+        if ( input.size() < m_pattern.size() ) { return false; }
 
-    ITagAliasRegistry::~ITagAliasRegistry() = default;
+        auto casedMatch = [&]( StringRef lhs, StringRef rhs ) {
+            if ( m_caseSensitivity == CaseSensitive::Yes ) {
+                return lhs == rhs;
+            } else {
+                Detail::CaseInsensitiveEqualTo eq;
+                return eq( lhs, rhs );
+            }
+        };
 
-    ITagAliasRegistry const& ITagAliasRegistry::get() {
-        return getRegistryHub().getTagAliasRegistry();
+        switch ( m_wildcard ) {
+        case NoWildcard:
+            return casedMatch(input, m_pattern);
+        case WildcardAtStart:
+            return casedMatch(
+                input.substr( input.size() - m_pattern.size(), input.size() ),
+                m_pattern );
+        case WildcardAtEnd:
+            return casedMatch( input.substr( 0, m_pattern.size() ), m_pattern );
+        case WildcardAtBothEnds: {
+            // TBD: This has terrible performance, but it is also the least
+            //      common use case. Once the StringContains matcher gets
+            //      efficient implementation, we should reuse it here.
+            const size_t lastOffset = input.size() - m_pattern.size();
+            for ( size_t offset = 0; offset <= lastOffset; ++offset ) {
+                if ( casedMatch( input.substr(offset, m_pattern.size()), m_pattern ) ) { return true; }
+            }
+            return false;
+        }
+        default:
+            CATCH_INTERNAL_ERROR( "Unknown enum" );
+        }
     }
-
-} // end namespace Catch
+}
 
 
 
 
 namespace Catch {
-    TestCaseInfoHasher::TestCaseInfoHasher( hash_t seed ): m_seed( seed ) {}
+namespace Matchers {
 
-    uint32_t TestCaseInfoHasher::operator()( TestCaseInfo const& t ) const {
-        // FNV-1a hash algorithm that is designed for uniqueness:
-        const hash_t prime = 1099511628211u;
-        hash_t hash = 14695981039346656037u;
-        for ( const char c : t.name ) {
-            hash ^= c;
-            hash *= prime;
-        }
-        for ( const char c : t.className ) {
-            hash ^= c;
-            hash *= prime;
-        }
-        for ( const Tag& tag : t.tags ) {
-            for ( const char c : tag.original ) {
-                hash ^= c;
-                hash *= prime;
-            }
-        }
-        hash ^= m_seed;
-        hash *= prime;
-        const uint32_t low{ static_cast<uint32_t>( hash ) };
-        const uint32_t high{ static_cast<uint32_t>( hash >> 32 ) };
-        return low * high;
+    std::string IsEmptyMatcher::describe() const {
+        return "is empty";
     }
-} // namespace Catch
 
+    std::string HasSizeMatcher::describe() const {
+        ReusableStringStream sstr;
+        sstr << "has size == " << m_target_size;
+        return sstr.str();
+    }
 
+} // end namespace Matchers
+} // end namespace Catch
 
 
-#include <algorithm>
 
 namespace Catch {
+namespace Matchers {
 
-    namespace {
-        // Picked small-ish number at random
-        static size_t kInitialTestCount = 120;
+bool ExceptionMessageMatcher::match(std::exception const& ex) const {
+    return ex.what() == m_message;
+}
 
-        static void enforceNoDuplicateTestCases(
-            std::vector<TestCaseHandle> const& tests ) {
-            // Flat set instead of std::set for performance.
-            std::vector<TestCaseInfo const*> seenTests;
-            seenTests.reserve( tests.size() );
-            for ( auto const& test : tests ) {
-                seenTests.push_back( &test.getTestCaseInfo() );
-            }
-            // We want to keep order of ~equal~ tests
-            // stable_sort so that duplicates are reported with the
-            // registration order preserved ("first seen" really is first)
-            std::stable_sort(
-                seenTests.begin(),
-                seenTests.end(),
-                []( TestCaseInfo const* lhs, TestCaseInfo const* rhs ) {
-                    return *lhs < *rhs;
-                }
-            );
-            const auto duplicate = std::adjacent_find(
-                seenTests.begin(),
-                seenTests.end(),
-                []( TestCaseInfo const* lhs, TestCaseInfo const* rhs ) {
-                    return *lhs == *rhs;
-                }
-            );
+std::string ExceptionMessageMatcher::describe() const {
+    return "exception message matches \"" + m_message + '"';
+}
 
-            if ( duplicate != seenTests.end() ) {
-                const auto infoPtr = *std::next( duplicate );
-                CATCH_ERROR( "error: test case \""
-                             << infoPtr->name << "\", with tags \""
-                             << infoPtr->tagsAsString()
-                             << "\" already defined.\n"
-                             << "\tFirst seen at "
-                             << ( *duplicate )->lineInfo << "\n"
-                             << "\tRedefined at " << infoPtr->lineInfo );
-            }
-        }
+ExceptionMessageMatcher Message(std::string const& message) {
+    return ExceptionMessageMatcher(message);
+}
 
-        static bool matchTest( TestCaseHandle const& testCase,
-                               TestSpec const& testSpec,
-                               IConfig const& config ) {
-            return testSpec.matches( testCase.getTestCaseInfo() ) &&
-                   isThrowSafe( testCase, config );
-        }
+} // namespace Matchers
+} // namespace Catch
 
-    } // end unnamed namespace
 
-    std::vector<TestCaseHandle> sortTests( IConfig const& config, std::vector<TestCaseHandle> const& unsortedTestCases ) {
-        switch (config.runOrder()) {
-        case TestRunOrder::Declared:
-            return unsortedTestCases;
 
-        case TestRunOrder::LexicographicallySorted: {
-            std::vector<TestCaseHandle> sorted = unsortedTestCases;
-            std::sort(
-                sorted.begin(),
-                sorted.end(),
-                []( TestCaseHandle const& lhs, TestCaseHandle const& rhs ) {
-                    return lhs.getTestCaseInfo() < rhs.getTestCaseInfo();
-                }
-            );
-            return sorted;
-        }
-        case TestRunOrder::Randomized: {
-            using TestWithHash = std::pair<TestCaseInfoHasher::hash_t, TestCaseHandle>;
+#include <algorithm>
+#include <cmath>
+#include <cstdlib>
+#include <cstdint>
+#include <sstream>
+#include <iomanip>
+#include <limits>
 
-            TestCaseInfoHasher h{ config.rngSeed() };
-            std::vector<TestWithHash> indexed_tests;
-            indexed_tests.reserve(unsortedTestCases.size());
 
-            for (auto const& handle : unsortedTestCases) {
-                indexed_tests.emplace_back(h(handle.getTestCaseInfo()), handle);
-            }
+namespace Catch {
+namespace {
 
-            std::sort( indexed_tests.begin(),
-                       indexed_tests.end(),
-                       []( TestWithHash const& lhs, TestWithHash const& rhs ) {
-                           if ( lhs.first == rhs.first ) {
-                               return lhs.second.getTestCaseInfo() <
-                                      rhs.second.getTestCaseInfo();
-                           }
-                           return lhs.first < rhs.first;
-                       } );
+    template <typename FP>
+    bool almostEqualUlps(FP lhs, FP rhs, uint64_t maxUlpDiff) {
+        // Comparison with NaN should always be false.
+        // This way we can rule it out before getting into the ugly details
+        if (Catch::isnan(lhs) || Catch::isnan(rhs)) {
+            return false;
+        }
 
-            std::vector<TestCaseHandle> randomized;
-            randomized.reserve(indexed_tests.size());
+        // This should also handle positive and negative zeros, infinities
+        const auto ulpDist = ulpDistance(lhs, rhs);
 
-            for (auto const& indexed : indexed_tests) {
-                randomized.push_back(indexed.second);
-            }
+        return ulpDist <= maxUlpDiff;
+    }
 
-            return randomized;
-        }
-        }
 
-        CATCH_INTERNAL_ERROR("Unknown test order value!");
+template <typename FP>
+FP step(FP start, FP direction, uint64_t steps) {
+    for (uint64_t i = 0; i < steps; ++i) {
+        start = Catch::nextafter(start, direction);
     }
+    return start;
+}
 
-    bool isThrowSafe( TestCaseHandle const& testCase, IConfig const& config ) {
-        return !testCase.getTestCaseInfo().throws() || config.allowThrows();
+// Performs equivalent check of std::fabs(lhs - rhs) <= margin
+// But without the subtraction to allow for INFINITY in comparison
+bool marginComparison(double lhs, double rhs, double margin) {
+    return (lhs + margin >= rhs) && (rhs + margin >= lhs);
+}
+
+template <typename FloatingPoint>
+void write(std::ostream& out, FloatingPoint num) {
+    out << std::scientific
+        << std::setprecision(std::numeric_limits<FloatingPoint>::max_digits10 - 1)
+        << num;
+}
+
+} // end anonymous namespace
+
+namespace Matchers {
+namespace Detail {
+
+    enum class FloatingPointKind : uint8_t {
+        Float,
+        Double
+    };
+
+} // end namespace Detail
+
+
+    WithinAbsMatcher::WithinAbsMatcher(double target, double margin)
+        :m_target{ target }, m_margin{ margin } {
+        CATCH_ENFORCE(margin >= 0, "Invalid margin: " << margin << '.'
+            << " Margin has to be non-negative.");
     }
 
-    std::vector<TestCaseHandle> filterTests( std::vector<TestCaseHandle> const& testCases, TestSpec const& testSpec, IConfig const& config ) {
-        std::vector<TestCaseHandle> filtered;
-        filtered.reserve( testCases.size() );
-        for (auto const& testCase : testCases) {
-            if ((!testSpec.hasFilters() && !testCase.getTestCaseInfo().isHidden()) ||
-                (testSpec.hasFilters() && matchTest(testCase, testSpec, config))) {
-                filtered.push_back(testCase);
-            }
-        }
-        // The Catch3 runner shards the run itself.
-        return filtered;
+    // Performs equivalent check of std::fabs(lhs - rhs) <= margin
+    // But without the subtraction to allow for INFINITY in comparison
+    bool WithinAbsMatcher::match(double const& matchee) const {
+        return (matchee + m_margin >= m_target) && (m_target + m_margin >= matchee);
     }
-    std::vector<TestCaseHandle> const& getAllTestCasesSorted( IConfig const& config ) {
-        return getRegistryHub().getTestCaseRegistry().getAllTestsSorted( config );
+
+    std::string WithinAbsMatcher::describe() const {
+        return "is within " + ::Catch::Detail::stringify(m_margin) + " of " + ::Catch::Detail::stringify(m_target);
     }
 
 
-    TestRegistry::TestRegistry() {
-        // We pre-reserve some reasonable number of tests to avoid the
-        // initial geometric growth churning during test registration.
-        m_handles.reserve( kInitialTestCount );
-        m_test_infos.reserve( kInitialTestCount );
-        m_invokers.reserve( kInitialTestCount );
+    WithinUlpsMatcher::WithinUlpsMatcher(double target, uint64_t ulps, Detail::FloatingPointKind baseType)
+        :m_target{ target }, m_ulps{ ulps }, m_type{ baseType } {
+        CATCH_ENFORCE(m_type == Detail::FloatingPointKind::Double
+                   || m_ulps < (std::numeric_limits<uint32_t>::max)(),
+            "Provided ULP is impossibly large for a float comparison.");
+        CATCH_ENFORCE( std::numeric_limits<double>::is_iec559,
+                       "WithinUlp matcher only supports platforms with "
+                       "IEEE-754 compatible floating point representation" );
     }
-    TestRegistry::~TestRegistry() = default;
 
-    void TestRegistry::registerTest(Detail::unique_ptr<TestCaseInfo> testInfo, Detail::unique_ptr<ITestInvoker> testInvoker) {
-        m_handles.emplace_back(testInfo.get(), testInvoker.get());
-        m_test_infos.push_back(CATCH_MOVE(testInfo));
-        m_invokers.push_back(CATCH_MOVE(testInvoker));
+#if defined(__clang__)
+#pragma clang diagnostic push
+// Clang <3.5 reports on the default branch in the switch below
+#pragma clang diagnostic ignored "-Wunreachable-code"
+#endif
+
+    bool WithinUlpsMatcher::match(double const& matchee) const {
+        switch (m_type) {
+        case Detail::FloatingPointKind::Float:
+            return almostEqualUlps<float>(static_cast<float>(matchee), static_cast<float>(m_target), m_ulps);
+        case Detail::FloatingPointKind::Double:
+            return almostEqualUlps<double>(matchee, m_target, m_ulps);
+        default:
+            CATCH_INTERNAL_ERROR( "Unknown Detail::FloatingPointKind value" );
+        }
     }
 
-    void TestRegistry::enableFilenameTags() {
-        for (auto& info : m_test_infos) {
-            info->addFilenameTag();
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
+
+    std::string WithinUlpsMatcher::describe() const {
+        std::stringstream ret;
+
+        ret << "is within " << m_ulps << " ULPs of ";
+
+        if (m_type == Detail::FloatingPointKind::Float) {
+            write(ret, static_cast<float>(m_target));
+            ret << 'f';
+        } else {
+            write(ret, m_target);
+        }
+
+        ret << " ([";
+        if (m_type == Detail::FloatingPointKind::Double) {
+            write( ret,
+                   step( m_target,
+                         -std::numeric_limits<double>::infinity(),
+                         m_ulps ) );
+            ret << ", ";
+            write( ret,
+                   step( m_target,
+                         std::numeric_limits<double>::infinity(),
+                         m_ulps ) );
+        } else {
+            // We have to cast INFINITY to float because of MinGW, see #1782
+            write( ret,
+                   step( static_cast<float>( m_target ),
+                         -std::numeric_limits<float>::infinity(),
+                         m_ulps ) );
+            ret << ", ";
+            write( ret,
+                   step( static_cast<float>( m_target ),
+                         std::numeric_limits<float>::infinity(),
+                         m_ulps ) );
         }
-    }
+        ret << "])";
 
-    std::vector<TestCaseHandle> const& TestRegistry::getAllTests() const {
-        return m_handles;
+        return ret.str();
     }
-    std::vector<TestCaseHandle> const& TestRegistry::getAllTestsSorted( IConfig const& config ) const {
-        if( m_sortedFunctions.empty() )
-            enforceNoDuplicateTestCases( m_handles );
 
-        if(  m_currentSortOrder != config.runOrder() || m_sortedFunctions.empty() ) {
-            m_sortedFunctions = sortTests( config, m_handles );
-            m_currentSortOrder = config.runOrder();
-        }
-        return m_sortedFunctions;
+    WithinRelMatcher::WithinRelMatcher(double target, double epsilon):
+        m_target(target),
+        m_epsilon(epsilon){
+        CATCH_ENFORCE(m_epsilon >= 0., "Relative comparison with epsilon <  0 does not make sense.");
+        CATCH_ENFORCE(m_epsilon  < 1., "Relative comparison with epsilon >= 1 does not make sense.");
     }
 
-} // end namespace Catch
-
-
+    bool WithinRelMatcher::match(double const& matchee) const {
+        const auto relMargin = m_epsilon * (std::max)(std::fabs(matchee), std::fabs(m_target));
+        return marginComparison(matchee, m_target,
+                                std::isinf(relMargin)? 0 : relMargin);
+    }
 
+    std::string WithinRelMatcher::describe() const {
+        Catch::ReusableStringStream sstr;
+        sstr << "and " << ::Catch::Detail::stringify(m_target) << " are within " << m_epsilon * 100. << "% of each other";
+        return sstr.str();
+    }
 
-#include <algorithm>
-#include <cassert>
 
-#if defined(__clang__)
-#    pragma clang diagnostic push
-#    pragma clang diagnostic ignored "-Wexit-time-destructors"
-#endif
+WithinUlpsMatcher WithinULP(double target, uint64_t maxUlpDiff) {
+    return WithinUlpsMatcher(target, maxUlpDiff, Detail::FloatingPointKind::Double);
+}
 
-namespace Catch {
-namespace TestCaseTracking {
+WithinUlpsMatcher WithinULP(float target, uint64_t maxUlpDiff) {
+    return WithinUlpsMatcher(target, maxUlpDiff, Detail::FloatingPointKind::Float);
+}
 
-    NameAndLocation::NameAndLocation( std::string&& _name, SourceLineInfo const& _location )
-    :   name( CATCH_MOVE(_name) ),
-        location( _location )
-    {}
+WithinAbsMatcher WithinAbs(double target, double margin) {
+    return WithinAbsMatcher(target, margin);
+}
 
-    ITracker::ITracker( NameAndLocation&& nameAndLoc, ITracker* parent ):
-        m_nameAndLocation( CATCH_MOVE( nameAndLoc ) ), m_parent( parent ) {
-        if ( m_parent ) {
-            m_allTrackerDepth = m_parent->m_allTrackerDepth + 1;
-            // We leave section trackers to bump themselves up, as
-            // we cannot use `isSectionTracker` in constructor
-            m_sectionOnlyDepth = m_parent->m_sectionOnlyDepth;
-            m_filterRef = m_parent->m_filterRef;
-            m_newStyleFilters = m_parent->m_newStyleFilters;
-        }
-    }
+WithinRelMatcher WithinRel(double target, double eps) {
+    return WithinRelMatcher(target, eps);
+}
 
-    ITracker::~ITracker() = default;
+WithinRelMatcher WithinRel(double target) {
+    return WithinRelMatcher(target, std::numeric_limits<double>::epsilon() * 100);
+}
 
-    void ITracker::markAsNeedingAnotherRun() {
-        m_runState = NeedsAnotherRun;
-    }
+WithinRelMatcher WithinRel(float target, float eps) {
+    return WithinRelMatcher(target, eps);
+}
 
-    void ITracker::addChild( ITrackerPtr&& child ) {
-        m_children.push_back( CATCH_MOVE(child) );
-    }
+WithinRelMatcher WithinRel(float target) {
+    return WithinRelMatcher(target, std::numeric_limits<float>::epsilon() * 100);
+}
 
-    ITracker* ITracker::findChild( NameAndLocationRef const& nameAndLocation ) {
-        auto it = std::find_if(
-            m_children.begin(),
-            m_children.end(),
-            [&nameAndLocation]( ITrackerPtr const& tracker ) {
-                auto const& tnameAndLoc = tracker->nameAndLocation();
-                if ( tnameAndLoc.location.line !=
-                     nameAndLocation.location.line ) {
-                    return false;
-                }
-                return tnameAndLoc == nameAndLocation;
-            } );
-        return ( it != m_children.end() ) ? it->get() : nullptr;
-    }
 
-    bool ITracker::isSectionTracker() const { return false; }
-    bool ITracker::isGeneratorTracker() const { return false; }
 
-    bool ITracker::isOpen() const {
-        return m_runState != NotStarted && !isComplete();
-    }
+bool IsNaNMatcher::match( double const& matchee ) const {
+    return std::isnan( matchee );
+}
 
-    bool ITracker::hasStarted() const { return m_runState != NotStarted; }
+std::string IsNaNMatcher::describe() const {
+    using namespace std::string_literals;
+    return "is NaN"s;
+}
 
-    void ITracker::openChild() {
-        if (m_runState != ExecutingChildren) {
-            m_runState = ExecutingChildren;
-            if (m_parent) {
-                m_parent->openChild();
-            }
-        }
-    }
+IsNaNMatcher IsNaN() { return IsNaNMatcher(); }
 
-    ITracker& TrackerContext::startRun() {
-        using namespace std::string_literals;
-        m_rootTracker = Catch::Detail::make_unique<SectionTracker>(
-            NameAndLocation( "{root}"s, CATCH_INTERNAL_LINEINFO ),
-            *this,
-            nullptr );
-        m_currentTracker = nullptr;
-        m_runState = Executing;
-        return *m_rootTracker;
-    }
+    } // namespace Matchers
+} // namespace Catch
 
-    void TrackerContext::completeCycle() {
-        m_runState = CompletedCycle;
-    }
 
-    bool TrackerContext::completedCycle() const {
-        return m_runState == CompletedCycle;
-    }
-    void TrackerContext::setCurrentTracker( ITracker* tracker ) {
-        m_currentTracker = tracker;
-    }
 
 
-    TrackerBase::TrackerBase( NameAndLocation&& nameAndLocation, TrackerContext& ctx, ITracker* parent ):
-        ITracker(CATCH_MOVE(nameAndLocation), parent),
-        m_ctx( ctx )
-    {}
+namespace Catch {
 
-    bool TrackerBase::isComplete() const {
-        return m_runState == CompletedSuccessfully || m_runState == Failed;
+    // This is the general overload that takes a any string matcher
+    // There is another overload, in catch_assertionhandler.h/.cpp, that only takes a string and infers
+    // the Equals matcher (so the header does not mention matchers)
+    void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher ) {
+        std::string exceptionMessage = Catch::translateActiveException();
+        MatchExpr<std::string, StringMatcher const&> expr( CATCH_MOVE(exceptionMessage), matcher );
+        handler.handleExpr( expr );
     }
 
-    void TrackerBase::open() {
-        m_runState = Executing;
-        moveToThis();
-        if( m_parent )
-            m_parent->openChild();
-    }
+} // namespace Catch
 
-    void TrackerBase::close() {
 
-        // Close any still open children (e.g. generators)
-        while( &m_ctx.currentTracker() != this )
-            m_ctx.currentTracker().close();
 
-        switch( m_runState ) {
-            case NeedsAnotherRun:
-                break;
 
-            case Executing:
-                m_runState = CompletedSuccessfully;
-                break;
-            case ExecutingChildren:
-                if( std::all_of(m_children.begin(), m_children.end(), [](ITrackerPtr const& t){ return t->isComplete(); }) )
-                    m_runState = CompletedSuccessfully;
-                break;
 
-            case NotStarted:
-            case CompletedSuccessfully:
-            case Failed:
-                CATCH_INTERNAL_ERROR( "Illogical state: " << m_runState );
+namespace Catch {
+namespace Matchers {
 
-            default:
-                CATCH_INTERNAL_ERROR( "Unknown state: " << m_runState );
-        }
-        moveToParent();
-        m_ctx.completeCycle();
-    }
-    void TrackerBase::fail() {
-        m_runState = Failed;
-        if( m_parent )
-            m_parent->markAsNeedingAnotherRun();
-        moveToParent();
-        m_ctx.completeCycle();
+    std::string MatcherUntypedBase::toString() const {
+        return describe();
     }
 
-    void TrackerBase::moveToParent() {
-        assert( m_parent );
-        m_ctx.setCurrentTracker( m_parent );
-    }
-    void TrackerBase::moveToThis() {
-        m_ctx.setCurrentTracker( this );
+    std::string MatcherUntypedBase::describe() const {
+        using namespace std::string_literals;
+        return "Undescribed matcher"s;
     }
 
-    bool SectionTracker::isFilteredImpl() const {
-        // TBD: This is currently _very_ similar to the block in `isComplete`.
-        //      Is this necessarily that way, or just accident of current semantics?
-        const size_t filterIndex =
-            m_newStyleFilters ? m_allTrackerDepth : m_sectionOnlyDepth;
-
-        if ( filterIndex < m_filterRef->size() ) {
-            // 1) New style filter must explicitly target section
-            if ( m_newStyleFilters && ( *m_filterRef )[filterIndex].type !=
-                                          PathFilter::For::Section ) {
-                return true;
-            }
-            // 2) Both style filters must match the trimmed name exactly
-            if ( m_trimmed_name !=
-                 StringRef( ( *m_filterRef )[filterIndex].filter ) ) {
-                return true;
-            }
-        }
+} // namespace Matchers
+} // namespace Catch
 
-        return false;
-    }
 
-    SectionTracker::SectionTracker( NameAndLocation&& nameAndLocation, TrackerContext& ctx, ITracker* parent )
-    :   TrackerBase( CATCH_MOVE(nameAndLocation), ctx, parent ),
-        m_trimmed_name(trim(StringRef(ITracker::nameAndLocation().name)))
-    {
-        if( m_parent ) {
-            ++m_sectionOnlyDepth;
-        }
-    }
 
-    bool SectionTracker::isComplete() const {
-        // If there are active filters AND we do not pass them,
-        // the section is always "completed"
-        const size_t filterIndex =
-            m_newStyleFilters ? m_allTrackerDepth : m_sectionOnlyDepth;
-        if ( filterIndex < m_filterRef->size() ) {
-            // There is active filter, check it
-            // 1) New style filter must explicitly target section
-            if ( m_newStyleFilters && ( *m_filterRef )[filterIndex].type !=
-                                          PathFilter::For::Section ) {
-                return true;
-            }
-            // 2) Both style filters must match the trimmed name exactly
-            if ( m_trimmed_name !=
-                 StringRef( ( *m_filterRef )[filterIndex].filter ) ) {
-                return true;
-            }
-        }
 
-        // Otherwise we delegate to the generic processing
-        return TrackerBase::isComplete();
+std::string Catch::Matchers::Detail::finalizeDescription(const std::string& desc) {
+    if (desc.empty()) {
+        return "matches undescribed predicate";
+    } else {
+        return "matches predicate: \"" + desc + '"';
     }
+}
 
-    bool SectionTracker::isSectionTracker() const { return true; }
 
-    SectionTracker& SectionTracker::acquire( TrackerContext& ctx, NameAndLocationRef const& nameAndLocation ) {
-        SectionTracker* tracker;
 
-        ITracker& currentTracker = ctx.currentTracker();
-        if ( ITracker* childTracker =
-                 currentTracker.findChild( nameAndLocation ) ) {
-            assert( childTracker );
-            assert( childTracker->isSectionTracker() );
-            tracker = static_cast<SectionTracker*>( childTracker );
-        } else {
-            auto newTracker = Catch::Detail::make_unique<SectionTracker>(
-                NameAndLocation{ static_cast<std::string>(nameAndLocation.name),
-                                 nameAndLocation.location },
-                ctx,
-                &currentTracker );
-            tracker = newTracker.get();
-            currentTracker.addChild( CATCH_MOVE( newTracker ) );
-        }
+namespace Catch {
+    namespace Matchers {
 
-        if ( !ctx.completedCycle() ) {
-            tracker->tryOpen();
-        }
+        std::string AllTrueMatcher::describe() const { return "contains only true"; }
 
-        return *tracker;
-    }
+        std::string NoneTrueMatcher::describe() const { return "contains no true"; }
 
-    void SectionTracker::tryOpen() {
-        if( !isComplete() )
-            open();
-    }
+        std::string AnyTrueMatcher::describe() const { return "contains at least one true"; }
 
-    StringRef SectionTracker::trimmedName() const {
-        return m_trimmed_name;
-    }
+    } // namespace Matchers
+} // namespace Catch
 
-} // namespace TestCaseTracking
 
-} // namespace Catch
 
-#if defined(__clang__)
-#    pragma clang diagnostic pop
-#endif
+#include <regex>
 
+namespace Catch {
 
+    namespace {
+        constexpr StringRef caseSensitivitySuffix( CaseSensitive caseSensitivity ) {
+            return caseSensitivity == CaseSensitive::Yes
+                       ? StringRef{}
+                       : " (case insensitive)"_sr;
+        }
+    } // namespace
 
+namespace Matchers {
 
-namespace Catch {
+    StringMatcherBase::StringMatcherBase( std::string target,
+                                          StringRef operation,
+                                          CaseSensitive caseSensitivity ):
+        m_target( CATCH_MOVE( target ) ),
+        m_operation( operation ),
+        m_caseSensitivity( caseSensitivity ) {}
 
-    void throw_test_failure_exception() {
-#if !defined( CATCH_CONFIG_DISABLE_EXCEPTIONS )
-        throw TestFailureException{}; //NOLINT(bugprone-std-exception-baseclass)
-#else
-        CATCH_ERROR( "Test failure requires aborting test!" );
-#endif
+
+    std::string StringMatcherBase::describe() const {
+        std::string description;
+        description.reserve(5 + m_operation.size() + m_target.size() +
+                                    caseSensitivitySuffix(m_caseSensitivity).size());
+        description += m_operation;
+        description += ": \"";
+        description += m_target;
+        description += '"';
+        description += caseSensitivitySuffix(m_caseSensitivity);
+        return description;
     }
 
-    void throw_test_skip_exception() {
-#if !defined( CATCH_CONFIG_DISABLE_EXCEPTIONS )
-        throw Catch::TestSkipException(); //NOLINT(bugprone-std-exception-baseclass)
-#else
-        CATCH_ERROR( "Explicitly skipping tests during runtime requires exceptions" );
-#endif
+
+    StringEqualsMatcher::StringEqualsMatcher( std::string comparator, CaseSensitive caseSensitivity ):
+        StringMatcherBase( CATCH_MOVE( comparator ), "equals"_sr, caseSensitivity ) {}
+
+    bool StringEqualsMatcher::match( std::string const& source ) const {
+        if (m_caseSensitivity == CaseSensitive::Yes) {
+            return m_target == source;
+        }
+        if (m_target.size() != source.size()) { return false; }
+        Catch::Detail::CaseInsensitiveEqualTo eq;
+        return eq( m_target, source );
     }
 
-} // namespace Catch
 
+    StringContainsMatcher::StringContainsMatcher(
+        std::string comparator, CaseSensitive caseSensitivity ):
+        StringMatcherBase( CATCH_MOVE( comparator ), "contains"_sr, caseSensitivity ) {}
 
+    bool StringContainsMatcher::match( std::string const& source ) const {
+        if ( m_caseSensitivity == CaseSensitive::Yes ) {
+            return contains( source, m_target );
+        }
+        if ( source.size() < m_target.size() ) { return false; }
+        StringRef as_ref( source );
+        // The worst case of this is O(m*n), which is terrible, BUT:
+        //  * The average case is much better, the worst case only happens rarely
+        //  * We can implement BMH/other better searchers later if it matters
+        Catch::Detail::CaseInsensitiveEqualTo eq;
+        for (size_t i = 0; i < source.size(); ++i) {
+            const auto substr = as_ref.substr( i, m_target.size() );
+            bool found = eq( substr, m_target );
+            if ( found ) { return true; }
+        }
+        return false;
+    }
 
-#include <algorithm>
-#include <iterator>
 
-namespace Catch {
-    void ITestInvoker::prepareTestCase() {}
-    void ITestInvoker::tearDownTestCase() {}
-    ITestInvoker::~ITestInvoker() = default;
+    StartsWithMatcher::StartsWithMatcher( std::string comparator,
+                                          CaseSensitive caseSensitivity ):
+        StringMatcherBase( CATCH_MOVE( comparator ), "starts with"_sr, caseSensitivity ) {}
 
-    namespace {
-        static StringRef extractClassName( StringRef classOrMethodName ) {
-            if ( !startsWith( classOrMethodName, '&' ) ) {
-                return classOrMethodName;
-            }
+    bool StartsWithMatcher::match( std::string const& source ) const {
+        if ( m_caseSensitivity == CaseSensitive::Yes ) {
+            return startsWith( source, m_target );
+        }
+        if (source.size() < m_target.size()) { return false; }
+        Catch::Detail::CaseInsensitiveEqualTo eq;
+        return eq(
+            StringRef( source ).substr( 0, m_target.size() ), m_target );
+    }
 
-            // Remove the leading '&' to avoid having to special case it later
-            const auto methodName =
-                classOrMethodName.substr( 1, classOrMethodName.size() );
 
-            auto reverseStart = std::make_reverse_iterator( methodName.end() );
-            auto reverseEnd = std::make_reverse_iterator( methodName.begin() );
+    EndsWithMatcher::EndsWithMatcher( std::string comparator,
+                                      CaseSensitive caseSensitivity ):
+        StringMatcherBase( CATCH_MOVE( comparator ), "ends with"_sr, caseSensitivity ) {}
 
-            // We make a simplifying assumption that ":" is only present
-            // in the input as part of "::" from C++ typenames (this is
-            // relatively safe assumption because the input is generated
-            // as stringification of type through preprocessor).
-            auto lastColons = std::find( reverseStart, reverseEnd, ':' ) + 1;
-            auto secondLastColons =
-                std::find( lastColons + 1, reverseEnd, ':' );
+    bool EndsWithMatcher::match( std::string const& source ) const {
+        if ( m_caseSensitivity == CaseSensitive::Yes ) {
+            return endsWith( source, m_target );
+        }
+        if ( source.size() < m_target.size() ) { return false; }
+        Catch::Detail::CaseInsensitiveEqualTo eq;
+        const size_t start_point = source.size() - m_target.size();
+        return eq( StringRef( source ).substr( start_point, m_target.size() ), m_target );
+    }
 
-            auto const startIdx = reverseEnd - secondLastColons;
-            auto const classNameSize = secondLastColons - lastColons - 1;
 
-            return methodName.substr(
-                static_cast<std::size_t>( startIdx ),
-                static_cast<std::size_t>( classNameSize ) );
+
+    RegexMatcher::RegexMatcher(std::string regex, CaseSensitive caseSensitivity): m_regex(CATCH_MOVE(regex)), m_caseSensitivity(caseSensitivity) {}
+
+    bool RegexMatcher::match(std::string const& matchee) const {
+        auto flags = std::regex::ECMAScript; // ECMAScript is the default syntax option anyway
+        if (m_caseSensitivity == CaseSensitive::No) {
+            flags |= std::regex::icase;
         }
+        auto reg = std::regex(m_regex, flags);
+        return std::regex_match(matchee, reg);
+    }
 
-        class TestInvokerAsFunction final : public ITestInvoker {
-            using TestType = void ( * )();
-            TestType m_testAsFunction;
+    std::string RegexMatcher::describe() const {
+        return "matches " + ::Catch::Detail::stringify(m_regex) + ((m_caseSensitivity == CaseSensitive::Yes)? " case sensitively" : " case insensitively");
+    }
 
-        public:
-            constexpr TestInvokerAsFunction( TestType testAsFunction ) noexcept:
-                m_testAsFunction( testAsFunction ) {}
 
-            void invoke() const override { m_testAsFunction(); }
-        };
+    StringEqualsMatcher Equals( std::string str, CaseSensitive caseSensitivity ) {
+        return StringEqualsMatcher( CATCH_MOVE( str ), caseSensitivity );
+    }
+    StringContainsMatcher ContainsSubstring( std::string str, CaseSensitive caseSensitivity ) {
+        return StringContainsMatcher( CATCH_MOVE( str ), caseSensitivity );
+    }
+    EndsWithMatcher EndsWith( std::string str, CaseSensitive caseSensitivity ) {
+        return EndsWithMatcher( CATCH_MOVE( str ), caseSensitivity );
+    }
+    StartsWithMatcher StartsWith( std::string str, CaseSensitive caseSensitivity ) {
+        return StartsWithMatcher( CATCH_MOVE( str ), caseSensitivity );
+    }
 
-    } // namespace
+    RegexMatcher Matches(std::string regex, CaseSensitive caseSensitivity) {
+        return RegexMatcher( CATCH_MOVE( regex ), caseSensitivity );
+    }
 
-    Detail::unique_ptr<ITestInvoker> makeTestInvoker( void(*testAsFunction)() ) {
-        return Detail::make_unique<TestInvokerAsFunction>( testAsFunction );
+} // namespace Matchers
+} // namespace Catch
+
+
+
+namespace Catch {
+namespace Matchers {
+
+    std::string MatcherGenericBase::describe() const {
+        using namespace std::string_literals;
+        return "Undescribed generic matcher"s;
     }
 
-    AutoReg::AutoReg( void ( *testAsFunction )(),
-                      SourceLineInfo const& lineInfo,
-                      StringRef classOrMethod,
-                      NameAndTags const& nameAndTags ) noexcept:
-        AutoReg( makeTestInvoker( testAsFunction ),
-                 lineInfo,
-                 classOrMethod,
-                 nameAndTags ) {}
+    namespace Detail {
 
-    AutoReg::AutoReg( Detail::unique_ptr<ITestInvoker> invoker, SourceLineInfo const& lineInfo, StringRef classOrMethod, NameAndTags const& nameAndTags ) noexcept {
-        CATCH_TRY {
-            getMutableRegistryHub()
-                    .registerTest(
-                        makeTestCaseInfo(
-                            extractClassName( classOrMethod ),
-                            nameAndTags,
-                            lineInfo),
-                        CATCH_MOVE(invoker)
-                    );
-        } CATCH_CATCH_ALL {
-            // Do not throw when constructing global objects, instead register the exception to be processed later
-            getMutableRegistryHub().registerStartupException();
+        std::string describe_multi_matcher(StringRef combine, std::string const* descriptions_begin, std::string const* descriptions_end) {
+            std::string description;
+            std::size_t combined_size = 4;
+            for ( auto desc = descriptions_begin; desc != descriptions_end; ++desc ) {
+                combined_size += desc->size();
+            }
+            combined_size += static_cast<size_t>(descriptions_end - descriptions_begin - 1) * combine.size();
+
+            description.reserve(combined_size);
+
+            description += "( ";
+            bool first = true;
+            for( auto desc = descriptions_begin; desc != descriptions_end; ++desc ) {
+                if( first )
+                    first = false;
+                else
+                    description += combine;
+                description += *desc;
+            }
+            description += " )";
+            return description;
         }
-    }
-}
+
+    } // namespace Detail
+} // namespace Matchers
+} // namespace Catch
 
 
 
 
+#include <cassert>
+#include <stack>
 
 namespace Catch {
 
-    TestSpecParser::TestSpecParser( ITagAliasRegistry const& tagAliases ) : m_tagAliases( &tagAliases ) {}
+    ////////////////////////////////////////////////////////////////////////////
 
-    TestSpecParser& TestSpecParser::parse( std::string const& arg ) {
-        m_mode = None;
-        m_exclusion = false;
-        m_arg = m_tagAliases->expandAliases( arg );
-        m_escapeChars.clear();
-        m_substring.reserve(m_arg.size());
-        m_patternName.reserve(m_arg.size());
-        m_realPatternPos = 0;
 
-        for( m_pos = 0; m_pos < m_arg.size(); ++m_pos )
-          //if visitChar fails
-           if( !visitChar( m_arg[m_pos] ) ){
-               m_testSpec.m_invalidSpecs.push_back(arg);
-               break;
-           }
-        endMode();
-        return *this;
+    ScopedMessage::ScopedMessage( MessageBuilder&& builder ):
+        m_messageId( builder.m_info.sequence ) {
+        MessageInfo info( CATCH_MOVE( builder.m_info ) );
+        info.message = builder.m_stream.str();
+        Detail::pushScopedMessage( CATCH_MOVE( info ) );
     }
-    TestSpec TestSpecParser::testSpec() {
-        addFilter();
-        return CATCH_MOVE(m_testSpec);
+
+    ScopedMessage::ScopedMessage( ScopedMessage&& old ) noexcept:
+        m_messageId( old.m_messageId ) {
+        old.m_moved = true;
     }
-    bool TestSpecParser::visitChar( char c ) {
-        if( (m_mode != EscapedName) && (c == '\\') ) {
-            escape();
-            addCharToPattern(c);
-            return true;
-        }else if((m_mode != EscapedName) && (c == ',') )  {
-            return separate();
-        }
 
-        switch( m_mode ) {
-        case None:
-            if( processNoneChar( c ) )
-                return true;
-            break;
-        case Name:
-            processNameChar( c );
-            break;
-        case EscapedName:
-            endMode();
-            addCharToPattern(c);
-            return true;
-        default:
-        case Tag:
-        case QuotedName:
-            if( processOtherChar( c ) )
-                return true;
-            break;
-        }
+    ScopedMessage::~ScopedMessage() {
+        if ( !m_moved ) { Detail::popScopedMessage( m_messageId ); }
+    }
 
-        m_substring += c;
-        if( !isControlChar( c ) ) {
-            m_patternName += c;
-            m_realPatternPos++;
+
+    Capturer::Capturer( StringRef macroName,
+                        SourceLineInfo const& lineInfo,
+                        ResultWas::OfType resultType,
+                        StringRef names,
+                        bool isScoped):
+        m_isScoped(isScoped) {
+        auto trimmed = [&] (size_t start, size_t end) {
+            while (names[start] == ',' || isspace(static_cast<unsigned char>(names[start]))) {
+                ++start;
+            }
+            while (names[end] == ',' || isspace(static_cast<unsigned char>(names[end]))) {
+                --end;
+            }
+            return names.substr(start, end - start + 1);
+        };
+        auto skipq = [&] (size_t start, char quote) {
+            for (auto i = start + 1; i < names.size() ; ++i) {
+                if (names[i] == quote)
+                    return i;
+                if (names[i] == '\\')
+                    ++i;
+            }
+            CATCH_INTERNAL_ERROR("CAPTURE parsing encountered unmatched quote");
+        };
+
+        size_t start = 0;
+        std::stack<char> openings;
+        for (size_t pos = 0; pos < names.size(); ++pos) {
+            char c = names[pos];
+            switch (c) {
+            case '[':
+            case '{':
+            case '(':
+            // It is basically impossible to disambiguate between
+            // comparison and start of template args in this context
+//            case '<':
+                openings.push(c);
+                break;
+            case ']':
+            case '}':
+            case ')':
+//           case '>':
+                openings.pop();
+                break;
+            case '"':
+            case '\'':
+                pos = skipq(pos, c);
+                break;
+            case ',':
+                if (start != pos && openings.empty()) {
+                    m_messages.emplace_back(macroName, lineInfo, resultType);
+                    m_messages.back().message += trimmed(start, pos);
+                    m_messages.back().message += " := "_sr;
+                    start = pos;
+                }
+                break;
+            default:; // noop
+            }
         }
-        return true;
+        assert(openings.empty() && "Mismatched openings");
+        m_messages.emplace_back(macroName, lineInfo, resultType);
+        m_messages.back().message += trimmed(start, names.size() - 1);
+        m_messages.back().message += " := "_sr;
     }
-    // Two of the processing methods return true to signal the caller to return
-    // without adding the given character to the current pattern strings
-    bool TestSpecParser::processNoneChar( char c ) {
-        switch( c ) {
-        case ' ':
-            return true;
-        case '~':
-            m_exclusion = true;
-            return false;
-        case '[':
-            startNewMode( Tag );
-            return false;
-        case '"':
-            startNewMode( QuotedName );
-            return false;
-        default:
-            startNewMode( Name );
-            return false;
+    Capturer::~Capturer() {
+        assert( m_captured == m_messages.size() );
+        if ( m_isScoped ) {
+            for ( auto const& message : m_messages ) {
+                Detail::popScopedMessage( message.sequence );
+            }
         }
     }
-    void TestSpecParser::processNameChar( char c ) {
-        if( c == '[' ) {
-            if( m_substring == "exclude:" )
-                m_exclusion = true;
-            else
-                endMode();
-            startNewMode( Tag );
+
+    void Capturer::captureValue( size_t 

The changes are longer than what is shown.