diff --git a/packages/Catch2/.gitrepo b/packages/Catch2/.gitrepo index adc0df81e8c95b703a4a5d417f3597e7907ee86c..1a05ad8d9e001995d59ee6fec83eb9f0eb20d5ed 100644 --- a/packages/Catch2/.gitrepo +++ b/packages/Catch2/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = git@github.com:catchorg/Catch2.git branch = master - commit = 930f49a641aa6a495d264d7b5e7c007734da0b0c - parent = 5c9d332c93a9e1253e960d8d5fb38ed777f315fa - cmdver = 0.4.0 + commit = e70fd2a4b9a867c57c215b73d28bf911333bf45c + parent = 56106d874a699ac6e0a2f014b3fb954646b15044 + cmdver = 0.4.1 method = merge diff --git a/packages/Catch2/CMakeLists.txt b/packages/Catch2/CMakeLists.txt index 8aa5b58b92cf1aa8bf78f57a815e22ed4df07e4b..d5fcb7d1c195b0b512db444d1de40d312c45c90b 100644 --- a/packages/Catch2/CMakeLists.txt +++ b/packages/Catch2/CMakeLists.txt @@ -14,7 +14,7 @@ if (CMAKE_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) endif() -project(Catch2 LANGUAGES CXX VERSION 2.10.2) +project(Catch2 LANGUAGES CXX VERSION 2.11.1) # Provide path for scripts list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake") diff --git a/packages/Catch2/README.md b/packages/Catch2/README.md index ebf619051642889bae0c8baf1990c2ef55be03e0..a2adb83fb1d2afba02890d314033ccf6af27812e 100644 --- a/packages/Catch2/README.md +++ b/packages/Catch2/README.md @@ -5,11 +5,11 @@ [](https://travis-ci.org/catchorg/Catch2) [](https://ci.appveyor.com/project/catchorg/catch2) [](https://codecov.io/gh/catchorg/Catch2) -[](https://wandbox.org/permlink/LzYWgcPrcy9yQmed) +[](https://wandbox.org/permlink/Fj98nizVNqgaWH3i) [](https://discord.gg/4CWS9zD) -<a href="https://github.com/catchorg/Catch2/releases/download/v2.10.2/catch.hpp">The latest version of the single header can be downloaded directly using this link</a> +<a href="https://github.com/catchorg/Catch2/releases/download/v2.11.1/catch.hpp">The latest version of the single header can be downloaded directly using this link</a> ## Catch2 is released! diff --git a/packages/Catch2/appveyor.yml b/packages/Catch2/appveyor.yml index 53f5b395c470e421934c90444c2e8fa1658605d8..dfd443163af4ab3a9d9ea7ecfa0f276a58a6ba00 100644 --- a/packages/Catch2/appveyor.yml +++ b/packages/Catch2/appveyor.yml @@ -1,6 +1,11 @@ # version string format -- This will be overwritten later anyway version: "{build}" +# We need a more up to date pip because Python 2.7 is EOL soon +init: + - set PATH=C:\Python35\Scripts;%PATH% + + branches: except: - /dev-travis.+/ @@ -62,7 +67,7 @@ matrix: install: - - ps: if (($env:CONFIGURATION) -eq "Debug" -And ($env:coverage) -eq "1" ) { python -m pip --disable-pip-version-check install codecov } + - ps: if (($env:CONFIGURATION) -eq "Debug" -And ($env:coverage) -eq "1" ) { pip --disable-pip-version-check install codecov } - ps: if (($env:CONFIGURATION) -eq "Debug" -And ($env:coverage) -eq "1" ) { .\misc\installOpenCppCoverage.ps1 } # Win32 and x64 are CMake-compatible solution platform names. diff --git a/packages/Catch2/docs/Readme.md b/packages/Catch2/docs/Readme.md index 582540f4e9cff21a2df99de9df4876065a0da232..0bbb104ecb6ae68c59aad8dcc8e3d28b90e6e95c 100644 --- a/packages/Catch2/docs/Readme.md +++ b/packages/Catch2/docs/Readme.md @@ -35,6 +35,7 @@ FAQ: Other: * [Why Catch?](why-catch.md#top) * [Open Source Projects using Catch](opensource-users.md#top) +* [Commercial Projects using Catch](commercial-users.md#top) * [Contributing](contributing.md#top) * [Release Notes](release-notes.md#top) * [Deprecations and incoming changes](deprecations.md#top) diff --git a/packages/Catch2/docs/benchmarks.md b/packages/Catch2/docs/benchmarks.md index 295bba300161f106038d8d53bb50251a4d824625..a41839fd18f633ef1f861693b4d524cc0d21b37e 100644 --- a/packages/Catch2/docs/benchmarks.md +++ b/packages/Catch2/docs/benchmarks.md @@ -168,7 +168,7 @@ Note that it is not possible to simply use the same instance for different runs and resetting it between each run since that would pollute the measurements with the resetting code. -It is also possible to just provide an argument name to the simple `BENCHMARK` macro to get +It is also possible to just provide an argument name to the simple `BENCHMARK` macro to get the same semantics as providing a callable to `meter.measure` with `int` argument: ```c++ @@ -189,19 +189,17 @@ construct and destroy objects without dynamic allocation and in a way that lets you measure construction and destruction separately. ```c++ -BENCHMARK_ADVANCED("construct")(Catch::Benchmark::Chronometer meter) -{ +BENCHMARK_ADVANCED("construct")(Catch::Benchmark::Chronometer meter) { std::vector<Catch::Benchmark::storage_for<std::string>> storage(meter.runs()); meter.measure([&](int i) { storage[i].construct("thing"); }); -}) +}; -BENCHMARK_ADVANCED("destroy", [](Catch::Benchmark::Chronometer meter) -{ +BENCHMARK_ADVANCED("destroy")(Catch::Benchmark::Chronometer meter) { std::vector<Catch::Benchmark::destructable_object<std::string>> storage(meter.runs()); for(auto&& o : storage) o.construct("thing"); meter.measure([&](int i) { storage[i].destruct(); }); -}) +}; ``` `Catch::Benchmark::storage_for<T>` objects are just pieces of raw storage suitable for `T` diff --git a/packages/Catch2/docs/command-line.md b/packages/Catch2/docs/command-line.md index 742d84b6602bdde58b423e194cc7dde2e353c50c..7ec2fbb31d43829be8f2b78340f9df57b7e92ae5 100644 --- a/packages/Catch2/docs/command-line.md +++ b/packages/Catch2/docs/command-line.md @@ -24,6 +24,7 @@ [Specify the number of resamples for bootstrapping](#specify-the-number-of-resamples-for-bootstrapping)<br> [Specify the confidence-interval for bootstrapping](#specify-the-confidence-interval-for-bootstrapping)<br> [Disable statistical analysis of collected benchmark samples](#disable-statistical-analysis-of-collected-benchmark-samples)<br> +[Specify the amount of time in milliseconds spent on warming up each test](#specify-the-amount-of-time-in-milliseconds-spent-on-warming-up-each-test)<br> [Usage](#usage)<br> [Specify the section to run](#specify-the-section-to-run)<br> [Filenames as tags](#filenames-as-tags)<br> @@ -64,6 +65,7 @@ Click one of the following links to take you straight to that option - or scroll <a href="#benchmark-resamples"> ` --benchmark-resamples`</a><br /> <a href="#benchmark-confidence-interval"> ` --benchmark-confidence-interval`</a><br /> <a href="#benchmark-no-analysis"> ` --benchmark-no-analysis`</a><br /> +<a href="#benchmark-warmup-time"> ` --benchmark-warmup-time`</a><br /> <a href="#use-colour"> ` --use-colour`</a><br /> </br> @@ -317,6 +319,14 @@ Must be between 0 and 1 and defaults to 0.95. When this flag is specified no bootstrapping or any other statistical analysis is performed. Instead the user code is only measured and the plain mean from the samples is reported. +<a id="benchmark-warmup-time"></a> +## Specify the amount of time in milliseconds spent on warming up each test +<pre>--benchmark-warmup-time</pre> + +> [Introduced](https://github.com/catchorg/Catch2/pull/1844) in Catch X.Y.Z. + +Configure the amount of time spent warming up each test. + <a id="usage"></a> ## Usage <pre>-h, -?, --help</pre> diff --git a/packages/Catch2/docs/commercial-users.md b/packages/Catch2/docs/commercial-users.md index 2b17e0c39c4eaf930d239e586884de25bf381f22..c38fb321072f114cac376af292ff635514a40d69 100644 --- a/packages/Catch2/docs/commercial-users.md +++ b/packages/Catch2/docs/commercial-users.md @@ -17,4 +17,4 @@ fact then please let us know - either directly, via a PR or - NASA - [Inscopix Inc.](https://www.inscopix.com/) - [Makimo](https://makimo.pl/) - - [UX3D] (https://ux3d.io) + - [UX3D](https://ux3d.io) diff --git a/packages/Catch2/docs/configuration.md b/packages/Catch2/docs/configuration.md index 599bb9ae4a273351108622a9c0fd1cf2b8be181a..d09e043f9fed94c3a4dc8cbe146abcafc915d482 100644 --- a/packages/Catch2/docs/configuration.md +++ b/packages/Catch2/docs/configuration.md @@ -16,6 +16,7 @@ [Windows header clutter](#windows-header-clutter)<br> [Enabling stringification](#enabling-stringification)<br> [Disabling exceptions](#disabling-exceptions)<br> +[Overriding Catch's debug break (`-b`)](#overriding-catchs-debug-break--b)<br> Catch is designed to "just work" as much as possible. For most people the only configuration needed is telling Catch which source file should host all the implementation code (```CATCH_CONFIG_MAIN```). @@ -257,6 +258,18 @@ namespace Catch { } ``` +## Overriding Catch's debug break (`-b`) + +> [Introduced](https://github.com/catchorg/Catch2/pull/1846) in Catch X.Y.Z. + +You can override Catch2's break-into-debugger code by defining the +`CATCH_BREAK_INTO_DEBUGGER()` macro. This can be used if e.g. Catch2 does +not know your platform, or your platform is misdetected. + +The macro will be used as is, that is, `CATCH_BREAK_INTO_DEBUGGER();` +must compile and must break into debugger. + + --- [Home](Readme.md#top) diff --git a/packages/Catch2/docs/deprecations.md b/packages/Catch2/docs/deprecations.md index c2b178e22778626ee296ba436397a6f11cd2cd2f..39194ed7de7b543e0642f3afd912ceac1750d3bd 100644 --- a/packages/Catch2/docs/deprecations.md +++ b/packages/Catch2/docs/deprecations.md @@ -45,6 +45,34 @@ There should be no reason to ever have an empty `SourceLineInfo`, so the method will be removed. +### Composing lvalues of already composed matchers + +Because a significant bug in this use case has persisted for 2+ years +without a bug report, and to simplify the implementation, code that +composes lvalues of composed matchers will not compile. That is, +this code will no longer work: + +```cpp + auto m1 = Contains("string"); + auto m2 = Contains("random"); + auto composed1 = m1 || m2; + auto m3 = Contains("different"); + auto composed2 = composed1 || m3; + REQUIRE_THAT(foo(), !composed1); + REQUIRE_THAT(foo(), composed2); +``` + +Instead you will have to write this: + +```cpp + auto m1 = Contains("string"); + auto m2 = Contains("random"); + auto m3 = Contains("different"); + REQUIRE_THAT(foo(), !(m1 || m2)); + REQUIRE_THAT(foo(), m1 || m2 || m3); +``` + + ## Planned changes diff --git a/packages/Catch2/docs/generators.md b/packages/Catch2/docs/generators.md index d0147d7f0638034598313d8417215974f216780d..55ff0ba541dfc0665e21b1726754d10e4f7904dd 100644 --- a/packages/Catch2/docs/generators.md +++ b/packages/Catch2/docs/generators.md @@ -78,7 +78,7 @@ type, making their usage much nicer. These are > `from_range` has been introduced in Catch 2.10.0 -> `range()` for floating point numbers has been introduced in Catch X.Y.Z +> `range()` for floating point numbers has been introduced in Catch 2.11.0 And can be used as shown in the example below to create a generator that returns 100 odd random number: diff --git a/packages/Catch2/docs/release-notes.md b/packages/Catch2/docs/release-notes.md index aef09bf095c7114e6bead21f7389b666503aaed7..5eb7f33fa707f112bb2dfc226bd1c0cbdee71ff7 100644 --- a/packages/Catch2/docs/release-notes.md +++ b/packages/Catch2/docs/release-notes.md @@ -2,6 +2,8 @@ # Release notes **Contents**<br> +[2.11.1](#2111)<br> +[2.11.0](#2110)<br> [2.10.2](#2102)<br> [2.10.1](#2101)<br> [2.10.0](#2100)<br> @@ -30,6 +32,35 @@ [Older versions](#older-versions)<br> [Even Older versions](#even-older-versions)<br> +## 2.11.1 + +### Improvements +* Breaking into debugger is supported on iOS (#1817) +* `google-build-using-namespace` clang-tidy warning is suppressed (#1799) + +### Fixes +* Clang on Windows is no longer assumed to implement MSVC's traditional preprocessor (#1806) +* `ObjectStorage` now behaves properly in `const` contexts (#1820) +* `GENERATE_COPY(a, b)` now compiles properly (#1809, #1815) +* Some more cleanups in the benchmarking support + + +## 2.11.0 + +### Improvements +* JUnit reporter output now contains more details in case of failure (#1347, #1719) +* Added SonarQube Test Data reporter (#1738) + * It is in a separate header, just like the TAP, Automake, and TeamCity reporters +* `range` generator now allows floating point numbers (#1776) +* Reworked part of internals to increase throughput + + +### Fixes +* The single header version should contain full benchmarking support (#1800) +* `[.foo]` is now properly parsed as `[.][foo]` when used on the command line (#1798) +* Fixed compilation of benchmarking on platforms where `steady_clock::period` is not `std::nano` (#1794) + + ## 2.10.2 diff --git a/packages/Catch2/docs/release-process.md b/packages/Catch2/docs/release-process.md index ca48da033056e4836d491b42bc97b81571d6799b..130a89226fd649c327ad009fcdd618a77c0c51df 100644 --- a/packages/Catch2/docs/release-process.md +++ b/packages/Catch2/docs/release-process.md @@ -67,6 +67,7 @@ $ gpg2 --armor --output catch.hpp.asc --detach-sig catch.hpp $ gpg2 --armor --output catch_reporter_automake.hpp.asc --detach-sig catch_reporter_automake.hpp $ gpg2 --armor --output catch_reporter_teamcity.hpp.asc --detach-sig catch_reporter_teamcity.hpp $ gpg2 --armor --output catch_reporter_tap.hpp.asc --detach-sig catch_reporter_tap.hpp +$ gpg2 --armor --output catch_reporter_sonarqube.hpp.asc --detach-sig catch_reporter_sonarqube.hpp ``` _GPG does not support signing multiple files in single invocation._ diff --git a/packages/Catch2/examples/210-Evt-EventListeners.cpp b/packages/Catch2/examples/210-Evt-EventListeners.cpp index 2d5fdb287570cd37f5d6368879b779b66ab666e6..044a29e3a23a7f1a25e2a1eeba2fd828f659f447 100644 --- a/packages/Catch2/examples/210-Evt-EventListeners.cpp +++ b/packages/Catch2/examples/210-Evt-EventListeners.cpp @@ -24,7 +24,7 @@ std::string ws(int const level) { template< typename T > std::ostream& operator<<( std::ostream& os, std::vector<T> const& v ) { os << "{ "; - for ( auto x : v ) + for ( const auto& x : v ) os << x << ", "; return os << "}"; } @@ -57,7 +57,7 @@ void print( std::ostream& os, int const level, Catch::MessageInfo const& info ) void print( std::ostream& os, int const level, std::string const& title, std::vector<Catch::MessageInfo> const& v ) { os << ws(level ) << title << ":\n"; - for ( auto x : v ) + for ( const auto& x : v ) { os << ws(level+1) << "{\n"; print( os, level+2, x ); @@ -300,7 +300,7 @@ char const * dashed_line = struct MyListener : Catch::TestEventListenerBase { using TestEventListenerBase::TestEventListenerBase; // inherit constructor - + // Get rid of Wweak-tables ~MyListener(); diff --git a/packages/Catch2/examples/231-Cfg-OutputStreams.cpp b/packages/Catch2/examples/231-Cfg-OutputStreams.cpp index 2f42c297363ccf8fe9a4ec42eaa88de1f1c266b8..8c65cc449993cd3371b7ff551d9995fca6966e8c 100644 --- a/packages/Catch2/examples/231-Cfg-OutputStreams.cpp +++ b/packages/Catch2/examples/231-Cfg-OutputStreams.cpp @@ -16,7 +16,7 @@ class out_buff : public std::stringbuf { public: out_buff(std::FILE* stream):m_stream(stream) {} ~out_buff(); - int sync() { + int sync() override { int ret = 0; for (unsigned char c : str()) { if (putc(c, m_stream) == EOF) { diff --git a/packages/Catch2/include/catch.hpp b/packages/Catch2/include/catch.hpp index 805939ae18958e1d76904e276938f5300b81c963..d2f1a8e7c9ca2383db1084352eb2e33fb8d1c897 100644 --- a/packages/Catch2/include/catch.hpp +++ b/packages/Catch2/include/catch.hpp @@ -10,8 +10,8 @@ #define TWOBLUECUBES_CATCH_HPP_INCLUDED #define CATCH_VERSION_MAJOR 2 -#define CATCH_VERSION_MINOR 10 -#define CATCH_VERSION_PATCH 2 +#define CATCH_VERSION_MINOR 11 +#define CATCH_VERSION_PATCH 1 #ifdef __clang__ # pragma clang system_header @@ -80,7 +80,7 @@ #endif #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) -#include "internal/benchmark/catch_benchmark.hpp" +#include "internal/benchmark/catch_benchmarking_all.hpp" #endif #endif // ! CATCH_CONFIG_IMPL_ONLY diff --git a/packages/Catch2/include/internal/benchmark/catch_benchmark.hpp b/packages/Catch2/include/internal/benchmark/catch_benchmark.hpp index d9887eba75c18ad4804ae956a834713a26f65f17..ec8dde0861f515fcf4a39e4d8b5a7aa1ac59565b 100644 --- a/packages/Catch2/include/internal/benchmark/catch_benchmark.hpp +++ b/packages/Catch2/include/internal/benchmark/catch_benchmark.hpp @@ -44,10 +44,10 @@ namespace Catch { template <typename Clock> ExecutionPlan<FloatDuration<Clock>> prepare(const IConfig &cfg, Environment<FloatDuration<Clock>> env) const { auto min_time = env.clock_resolution.mean * Detail::minimum_ticks; - auto run_time = std::max(min_time, std::chrono::duration_cast<decltype(min_time)>(Detail::warmup_time)); + auto run_time = std::max(min_time, std::chrono::duration_cast<decltype(min_time)>(cfg.benchmarkWarmupTime())); auto&& test = Detail::run_for_at_least<Clock>(std::chrono::duration_cast<ClockDuration<Clock>>(run_time), 1, fun); int new_iters = static_cast<int>(std::ceil(min_time * test.iterations / test.elapsed)); - return { new_iters, test.elapsed / test.iterations * new_iters * cfg.benchmarkSamples(), fun, std::chrono::duration_cast<FloatDuration<Clock>>(Detail::warmup_time), Detail::warmup_iterations }; + return { new_iters, test.elapsed / test.iterations * new_iters * cfg.benchmarkSamples(), fun, std::chrono::duration_cast<FloatDuration<Clock>>(cfg.benchmarkWarmupTime()), Detail::warmup_iterations }; } template <typename Clock = default_clock> diff --git a/packages/Catch2/include/internal/benchmark/catch_benchmarking_all.hpp b/packages/Catch2/include/internal/benchmark/catch_benchmarking_all.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7717f8993b381f89dd49b52a7b045b44019f4de7 --- /dev/null +++ b/packages/Catch2/include/internal/benchmark/catch_benchmarking_all.hpp @@ -0,0 +1,29 @@ +/* + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ + + +// A proxy header that includes all of the benchmarking headers to allow +// concise include of the benchmarking features. You should prefer the +// individual includes in standard use. + +#include "catch_benchmark.hpp" +#include "catch_chronometer.hpp" +#include "catch_clock.hpp" +#include "catch_constructor.hpp" +#include "catch_environment.hpp" +#include "catch_estimate.hpp" +#include "catch_execution_plan.hpp" +#include "catch_optimizer.hpp" +#include "catch_outlier_classification.hpp" +#include "catch_sample_analysis.hpp" +#include "detail/catch_analyse.hpp" +#include "detail/catch_benchmark_function.hpp" +#include "detail/catch_complete_invoke.hpp" +#include "detail/catch_estimate_clock.hpp" +#include "detail/catch_measure.hpp" +#include "detail/catch_repeat.hpp" +#include "detail/catch_run_for_at_least.hpp" +#include "detail/catch_stats.hpp" +#include "detail/catch_timing.hpp" diff --git a/packages/Catch2/include/internal/benchmark/catch_constructor.hpp b/packages/Catch2/include/internal/benchmark/catch_constructor.hpp index bf6dfec990bc58f395c93b052c3648b7359563e7..4fc04042394964868b2e67cb08a6bd0f27aaba9a 100644 --- a/packages/Catch2/include/internal/benchmark/catch_constructor.hpp +++ b/packages/Catch2/include/internal/benchmark/catch_constructor.hpp @@ -14,60 +14,66 @@ #include <type_traits> namespace Catch { - namespace Detail { - template <typename T, bool Destruct> - struct ObjectStorage - { - using TStorage = typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type; + namespace Benchmark { + namespace Detail { + template <typename T, bool Destruct> + struct ObjectStorage + { + using TStorage = typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type; - ObjectStorage() : data() {} + ObjectStorage() : data() {} - ObjectStorage(const ObjectStorage& other) - { - new(&data) T(other.stored_object()); - } + ObjectStorage(const ObjectStorage& other) + { + new(&data) T(other.stored_object()); + } - ObjectStorage(ObjectStorage&& other) - { - new(&data) T(std::move(other.stored_object())); - } + ObjectStorage(ObjectStorage&& other) + { + new(&data) T(std::move(other.stored_object())); + } - ~ObjectStorage() { destruct_on_exit<T>(); } + ~ObjectStorage() { destruct_on_exit<T>(); } - template <typename... Args> - void construct(Args&&... args) - { - new (&data) T(std::forward<Args>(args)...); - } + template <typename... Args> + void construct(Args&&... args) + { + new (&data) T(std::forward<Args>(args)...); + } - template <bool AllowManualDestruction = !Destruct> - typename std::enable_if<AllowManualDestruction>::type destruct() - { - stored_object().~T(); - } - - private: - // If this is a constructor benchmark, destruct the underlying object - template <typename U> - void destruct_on_exit(typename std::enable_if<Destruct, U>::type* = 0) { destruct<true>(); } - // Otherwise, don't - template <typename U> - void destruct_on_exit(typename std::enable_if<!Destruct, U>::type* = 0) { } - - T& stored_object() - { - return *static_cast<T*>(static_cast<void*>(&data)); - } + template <bool AllowManualDestruction = !Destruct> + typename std::enable_if<AllowManualDestruction>::type destruct() + { + stored_object().~T(); + } - TStorage data; - }; - } + private: + // If this is a constructor benchmark, destruct the underlying object + template <typename U> + void destruct_on_exit(typename std::enable_if<Destruct, U>::type* = 0) { destruct<true>(); } + // Otherwise, don't + template <typename U> + void destruct_on_exit(typename std::enable_if<!Destruct, U>::type* = 0) { } + + T& stored_object() { + return *static_cast<T*>(static_cast<void*>(&data)); + } + + T const& stored_object() const { + return *static_cast<T*>(static_cast<void*>(&data)); + } - template <typename T> - using storage_for = Detail::ObjectStorage<T, true>; - template <typename T> - using destructable_object = Detail::ObjectStorage<T, false>; + TStorage data; + }; + } + + template <typename T> + using storage_for = Detail::ObjectStorage<T, true>; + + template <typename T> + using destructable_object = Detail::ObjectStorage<T, false>; + } } #endif // TWOBLUECUBES_CATCH_CONSTRUCTOR_HPP_INCLUDED diff --git a/packages/Catch2/include/internal/benchmark/detail/catch_stats.hpp b/packages/Catch2/include/internal/benchmark/detail/catch_stats.hpp index e686c1aa5fe172d630d12e141ac2f5d28db45749..c05f9679bbb95fa1306a5458caea9d6cb4cb1f17 100644 --- a/packages/Catch2/include/internal/benchmark/detail/catch_stats.hpp +++ b/packages/Catch2/include/internal/benchmark/detail/catch_stats.hpp @@ -23,6 +23,7 @@ #include <cmath> #include <utility> #include <cstddef> +#include <random> namespace Catch { namespace Benchmark { diff --git a/packages/Catch2/include/internal/catch_commandline.cpp b/packages/Catch2/include/internal/catch_commandline.cpp index 365a3c9d6ce9ab5265a65cdc2e780cc498867cbd..b0412d50d89f22699e471feb34df3ad5977eb919 100644 --- a/packages/Catch2/include/internal/catch_commandline.cpp +++ b/packages/Catch2/include/internal/catch_commandline.cpp @@ -50,14 +50,13 @@ namespace Catch { if( !startsWith( line, '"' ) ) line = '"' + line + '"'; config.testsOrTags.push_back( line ); - config.testsOrTags.push_back( "," ); - + config.testsOrTags.emplace_back( "," ); } } //Remove comma in the end if(!config.testsOrTags.empty()) config.testsOrTags.erase( config.testsOrTags.end()-1 ); - + return ParserResult::ok( ParseResultType::Matched ); }; auto const setTestOrder = [&]( std::string const& order ) { @@ -214,7 +213,10 @@ namespace Catch { | Opt( config.benchmarkNoAnalysis ) ["--benchmark-no-analysis"] ( "perform only measurements; do not perform any analysis" ) - | Arg( config.testsOrTags, "test name|pattern|tags" ) + | Opt( config.benchmarkWarmupTime, "benchmarkWarmupTime" ) + ["--benchmark-warmup-time"] + ( "amount of time in milliseconds spent on warming up each test (default: 100)" ) + | Arg( config.testsOrTags, "test name|pattern|tags" ) ( "which test or tests to use" ); return cli; diff --git a/packages/Catch2/include/internal/catch_compiler_capabilities.h b/packages/Catch2/include/internal/catch_compiler_capabilities.h index 18128a836d8ce45f9dd42349c0770e09359f481a..9eebd8de4faf8de3996a8e9df8808fa5271db547 100644 --- a/packages/Catch2/include/internal/catch_compiler_capabilities.h +++ b/packages/Catch2/include/internal/catch_compiler_capabilities.h @@ -149,9 +149,12 @@ // MSVC traditional preprocessor needs some workaround for __VA_ARGS__ // _MSVC_TRADITIONAL == 0 means new conformant preprocessor // _MSVC_TRADITIONAL == 1 means old traditional non-conformant preprocessor -# if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL) -# define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -# endif +# if !defined(__clang__) // Handle Clang masquerading for msvc +# if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL) +# define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +# endif // MSVC_TRADITIONAL +# endif // __clang__ + #endif // _MSC_VER #if defined(_REENTRANT) || defined(_MSC_VER) @@ -200,7 +203,7 @@ #define CATCH_CONFIG_COLOUR_NONE #endif -#if defined(__UCLIBC__) +#if !defined(_GLIBCXX_USE_C99_MATH_TR1) #define CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER #endif diff --git a/packages/Catch2/include/internal/catch_config.cpp b/packages/Catch2/include/internal/catch_config.cpp index e222328b9790e3fe540252e6eee5b67806065ed6..21cd62965ba214fd7b6ed0aa2290c8d0d9b5e29e 100644 --- a/packages/Catch2/include/internal/catch_config.cpp +++ b/packages/Catch2/include/internal/catch_config.cpp @@ -72,10 +72,11 @@ namespace Catch { bool Config::showInvisibles() const { return m_data.showInvisibles; } Verbosity Config::verbosity() const { return m_data.verbosity; } - bool Config::benchmarkNoAnalysis() const { return m_data.benchmarkNoAnalysis; } - 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; } + bool Config::benchmarkNoAnalysis() const { return m_data.benchmarkNoAnalysis; } + 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); } IStream const* Config::openStream() { return Catch::makeStream(m_data.outputFilename); diff --git a/packages/Catch2/include/internal/catch_config.hpp b/packages/Catch2/include/internal/catch_config.hpp index 95b67d25fce0269424f8aaf9590d83066265fd29..64d2c035f9bb80e18fe3bffb8b558ffff9fa3b2c 100644 --- a/packages/Catch2/include/internal/catch_config.hpp +++ b/packages/Catch2/include/internal/catch_config.hpp @@ -47,6 +47,7 @@ namespace Catch { unsigned int benchmarkSamples = 100; double benchmarkConfidenceInterval = 0.95; unsigned int benchmarkResamples = 100000; + std::chrono::milliseconds::rep benchmarkWarmupTime = 100; Verbosity verbosity = Verbosity::Normal; WarnAbout::What warnings = WarnAbout::Nothing; @@ -113,6 +114,7 @@ namespace Catch { int benchmarkSamples() const override; double benchmarkConfidenceInterval() const override; unsigned int benchmarkResamples() const override; + std::chrono::milliseconds benchmarkWarmupTime() const override; private: diff --git a/packages/Catch2/include/internal/catch_console_colour.cpp b/packages/Catch2/include/internal/catch_console_colour.cpp index 1c4799f828d4c9b9e28c491ef0c7c67658520787..de0fff4318eb3a993f31b411bda1b11707865e61 100644 --- a/packages/Catch2/include/internal/catch_console_colour.cpp +++ b/packages/Catch2/include/internal/catch_console_colour.cpp @@ -34,7 +34,7 @@ namespace Catch { }; struct NoColourImpl : IColourImpl { - void use( Colour::Code ) {} + void use( Colour::Code ) override {} static IColourImpl* instance() { static NoColourImpl s_instance; @@ -167,7 +167,7 @@ namespace { bool useColourOnPlatform() { return -#ifdef CATCH_PLATFORM_MAC +#if defined(CATCH_PLATFORM_MAC) || defined(CATCH_PLATFORM_IPHONE) !isDebuggerActive() && #endif #if !(defined(__DJGPP__) && defined(__STRICT_ANSI__)) @@ -208,13 +208,13 @@ namespace Catch { namespace Catch { Colour::Colour( Code _colourCode ) { use( _colourCode ); } - Colour::Colour( Colour&& rhs ) noexcept { - m_moved = rhs.m_moved; - rhs.m_moved = true; + Colour::Colour( Colour&& other ) noexcept { + m_moved = other.m_moved; + other.m_moved = true; } - Colour& Colour::operator=( Colour&& rhs ) noexcept { - m_moved = rhs.m_moved; - rhs.m_moved = true; + Colour& Colour::operator=( Colour&& other ) noexcept { + m_moved = other.m_moved; + other.m_moved = true; return *this; } @@ -226,7 +226,7 @@ namespace Catch { // However, under some conditions it does happen (see #1626), // and this change is small enough that we can let practicality // triumph over purity in this case. - if (impl != NULL) { + if (impl != nullptr) { impl->use( _colourCode ); } } diff --git a/packages/Catch2/include/internal/catch_debugger.cpp b/packages/Catch2/include/internal/catch_debugger.cpp index f04900a4c5804610993659965dd558419fd5f091..fc78c36e9b4958a5be7e9a225cba65610f0d68bb 100644 --- a/packages/Catch2/include/internal/catch_debugger.cpp +++ b/packages/Catch2/include/internal/catch_debugger.cpp @@ -12,7 +12,7 @@ #include "catch_stream.h" #include "catch_platform.h" -#ifdef CATCH_PLATFORM_MAC +#if defined(CATCH_PLATFORM_MAC) || defined(CATCH_PLATFORM_IPHONE) # include <assert.h> # include <stdbool.h> diff --git a/packages/Catch2/include/internal/catch_debugger.h b/packages/Catch2/include/internal/catch_debugger.h index db3ff681b92aa76e396521db876366d7e4d2929e..001b46457b0fdde88b1033a26b92bc32ed065d71 100644 --- a/packages/Catch2/include/internal/catch_debugger.h +++ b/packages/Catch2/include/internal/catch_debugger.h @@ -19,6 +19,17 @@ namespace Catch { #define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */ +#elif defined(CATCH_PLATFORM_IPHONE) + + // use inline assembler + #if defined(__i386__) || defined(__x86_64__) + #define CATCH_TRAP() __asm__("int $3") + #elif defined(__aarch64__) + #define CATCH_TRAP() __asm__(".inst 0xd4200000") + #elif defined(__arm__) + #define CATCH_TRAP() __asm__(".inst 0xe7f001f0") + #endif + #elif defined(CATCH_PLATFORM_LINUX) // If we can use inline assembler, do it because this allows us to break // directly at the location of the failing check instead of breaking inside @@ -37,10 +48,12 @@ namespace Catch { #define CATCH_TRAP() DebugBreak() #endif -#ifdef CATCH_TRAP - #define CATCH_BREAK_INTO_DEBUGGER() []{ if( Catch::isDebuggerActive() ) { CATCH_TRAP(); } }() -#else - #define CATCH_BREAK_INTO_DEBUGGER() []{}() +#ifndef CATCH_BREAK_INTO_DEBUGGER + #ifdef CATCH_TRAP + #define CATCH_BREAK_INTO_DEBUGGER() []{ if( Catch::isDebuggerActive() ) { CATCH_TRAP(); } }() + #else + #define CATCH_BREAK_INTO_DEBUGGER() []{}() + #endif #endif #endif // TWOBLUECUBES_CATCH_DEBUGGER_H_INCLUDED diff --git a/packages/Catch2/include/internal/catch_default_main.hpp b/packages/Catch2/include/internal/catch_default_main.hpp index 17ad090a8cf17308c337056c6fcefe406d0dc419..aab5cba3ea1bd526c21b1983b22550e0aece0314 100644 --- a/packages/Catch2/include/internal/catch_default_main.hpp +++ b/packages/Catch2/include/internal/catch_default_main.hpp @@ -9,10 +9,11 @@ #define TWOBLUECUBES_CATCH_DEFAULT_MAIN_HPP_INCLUDED #include "catch_session.h" +#include "catch_platform.h" #ifndef __OBJC__ -#if defined(CATCH_CONFIG_WCHAR) && defined(WIN32) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN) +#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 wmain (int argc, wchar_t * argv[], wchar_t * []) { #else diff --git a/packages/Catch2/include/internal/catch_enum_values_registry.cpp b/packages/Catch2/include/internal/catch_enum_values_registry.cpp index fb060f5b477eeaaf85658f360ae0665920c7542c..063f9d628276a89b2cf044c68dd6dadc92716dce 100644 --- a/packages/Catch2/include/internal/catch_enum_values_registry.cpp +++ b/packages/Catch2/include/internal/catch_enum_values_registry.cpp @@ -60,7 +60,7 @@ namespace Catch { assert( valueNames.size() == values.size() ); std::size_t i = 0; for( auto value : values ) - enumInfo->m_values.push_back({ value, valueNames[i++] }); + enumInfo->m_values.emplace_back(value, valueNames[i++]); return enumInfo; } diff --git a/packages/Catch2/include/internal/catch_generators.hpp b/packages/Catch2/include/internal/catch_generators.hpp index ea575c85ce9f916795e3e9ecfb5af5201f20273c..d0fbe8bf316a829ddd3f6e27b6225f81c032e1c1 100644 --- a/packages/Catch2/include/internal/catch_generators.hpp +++ b/packages/Catch2/include/internal/catch_generators.hpp @@ -57,7 +57,6 @@ namespace Generators { class SingleValueGenerator final : public IGenerator<T> { T m_value; public: - SingleValueGenerator(T const& value) : m_value( value ) {} SingleValueGenerator(T&& value) : m_value(std::move(value)) {} T const& get() const override { @@ -120,21 +119,21 @@ namespace Generators { m_generators.emplace_back(std::move(generator)); } void populate(T&& val) { - m_generators.emplace_back(value(std::move(val))); + m_generators.emplace_back(value(std::forward<T>(val))); } template<typename U> void populate(U&& val) { - populate(T(std::move(val))); + populate(T(std::forward<U>(val))); } template<typename U, typename... Gs> - void populate(U&& valueOrGenerator, Gs... moreGenerators) { + void populate(U&& valueOrGenerator, Gs &&... moreGenerators) { populate(std::forward<U>(valueOrGenerator)); populate(std::forward<Gs>(moreGenerators)...); } public: template <typename... Gs> - Generators(Gs... moreGenerators) { + Generators(Gs &&... moreGenerators) { m_generators.reserve(sizeof...(Gs)); populate(std::forward<Gs>(moreGenerators)...); } @@ -166,7 +165,7 @@ namespace Generators { struct as {}; template<typename T, typename... Gs> - auto makeGenerators( GeneratorWrapper<T>&& generator, Gs... moreGenerators ) -> Generators<T> { + auto makeGenerators( GeneratorWrapper<T>&& generator, Gs &&... moreGenerators ) -> Generators<T> { return Generators<T>(std::move(generator), std::forward<Gs>(moreGenerators)...); } template<typename T> @@ -174,11 +173,11 @@ namespace Generators { return Generators<T>(std::move(generator)); } template<typename T, typename... Gs> - auto makeGenerators( T&& val, Gs... moreGenerators ) -> Generators<T> { + auto makeGenerators( T&& val, Gs &&... moreGenerators ) -> Generators<T> { return makeGenerators( value( std::forward<T>( val ) ), std::forward<Gs>( moreGenerators )... ); } template<typename T, typename U, typename... Gs> - auto makeGenerators( as<T>, U&& val, Gs... moreGenerators ) -> Generators<T> { + auto makeGenerators( as<T>, U&& val, Gs &&... moreGenerators ) -> Generators<T> { return makeGenerators( value( T( std::forward<U>( val ) ) ), std::forward<Gs>( moreGenerators )... ); } @@ -204,10 +203,10 @@ namespace Generators { } // namespace Catch #define GENERATE( ... ) \ - Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [ ]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) + Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [ ]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace) #define GENERATE_COPY( ... ) \ - Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [=]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) + Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [=]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace) #define GENERATE_REF( ... ) \ - Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [&]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) + Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [&]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace) #endif // TWOBLUECUBES_CATCH_GENERATORS_HPP_INCLUDED diff --git a/packages/Catch2/include/internal/catch_interfaces_config.h b/packages/Catch2/include/internal/catch_interfaces_config.h index f8cbf71c86b73c51139e8cfc9d152c2676e53097..8fb986be467911c037231a5f92e8f1d0d7f16378 100644 --- a/packages/Catch2/include/internal/catch_interfaces_config.h +++ b/packages/Catch2/include/internal/catch_interfaces_config.h @@ -11,6 +11,7 @@ #include "catch_common.h" #include "catch_option.hpp" +#include <chrono> #include <iosfwd> #include <string> #include <vector> @@ -81,6 +82,7 @@ namespace Catch { virtual int benchmarkSamples() const = 0; virtual double benchmarkConfidenceInterval() const = 0; virtual unsigned int benchmarkResamples() const = 0; + virtual std::chrono::milliseconds benchmarkWarmupTime() const = 0; }; using IConfigPtr = std::shared_ptr<IConfig const>; diff --git a/packages/Catch2/include/internal/catch_list.cpp b/packages/Catch2/include/internal/catch_list.cpp index 11e55140444f5d070a820c043b7e5e4b7825b55a..9f748e4ca3d251d906fb291a6b90d49ef70a817e 100644 --- a/packages/Catch2/include/internal/catch_list.cpp +++ b/packages/Catch2/include/internal/catch_list.cpp @@ -28,7 +28,7 @@ namespace Catch { std::size_t listTests( Config const& config ) { - TestSpec testSpec = config.testSpec(); + TestSpec const& testSpec = config.testSpec(); if( config.hasTestFilters() ) Catch::cout() << "Matching test cases:\n"; else { @@ -62,7 +62,7 @@ namespace Catch { } std::size_t listTestsNamesOnly( Config const& config ) { - TestSpec testSpec = config.testSpec(); + TestSpec const& testSpec = config.testSpec(); std::size_t matchedTests = 0; std::vector<TestCase> matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config ); for( auto const& testCaseInfo : matchedTestCases ) { @@ -100,7 +100,7 @@ namespace Catch { } std::size_t listTags( Config const& config ) { - TestSpec testSpec = config.testSpec(); + TestSpec const& testSpec = config.testSpec(); if( config.hasTestFilters() ) Catch::cout() << "Tags for matching test cases:\n"; else { diff --git a/packages/Catch2/include/internal/catch_matchers.h b/packages/Catch2/include/internal/catch_matchers.h index 5b69c4a82045a811d43a97e7a95fed75c32c27e7..518a6e0d341b9d87e3a01c670caa4dc7c24572d1 100644 --- a/packages/Catch2/include/internal/catch_matchers.h +++ b/packages/Catch2/include/internal/catch_matchers.h @@ -91,9 +91,10 @@ namespace Matchers { return description; } - MatchAllOf<ArgT>& operator && ( MatcherBase<ArgT> const& other ) { - m_matchers.push_back( &other ); - return *this; + MatchAllOf<ArgT> operator && ( MatcherBase<ArgT> const& other ) { + auto copy(*this); + copy.m_matchers.push_back( &other ); + return copy; } std::vector<MatcherBase<ArgT> const*> m_matchers; @@ -124,9 +125,10 @@ namespace Matchers { return description; } - MatchAnyOf<ArgT>& operator || ( MatcherBase<ArgT> const& other ) { - m_matchers.push_back( &other ); - return *this; + MatchAnyOf<ArgT> operator || ( MatcherBase<ArgT> const& other ) { + auto copy(*this); + copy.m_matchers.push_back( &other ); + return copy; } std::vector<MatcherBase<ArgT> const*> m_matchers; diff --git a/packages/Catch2/include/internal/catch_matchers_floating.cpp b/packages/Catch2/include/internal/catch_matchers_floating.cpp index c226fc56c9eda58ebb96c45c55ae9d761fe7f026..bcca0725d31f7a8d4c98f40b9850c6559e08c372 100644 --- a/packages/Catch2/include/internal/catch_matchers_floating.cpp +++ b/packages/Catch2/include/internal/catch_matchers_floating.cpp @@ -59,16 +59,8 @@ namespace { return static_cast<uint64_t>(ulpDiff) <= maxUlpDiff; } -} //end anonymous namespace - #if defined(CATCH_CONFIG_GLOBAL_NEXTAFTER) -#if defined(__clang__) -#pragma clang diagnostic push -// The long double overload is currently unused -#pragma clang diagnostic ignored "-Wunused-function" -#endif - float nextafter(float x, float y) { return ::nextafterf(x, y); } @@ -77,18 +69,8 @@ namespace { return ::nextafter(x, y); } - long double nextafter(long double x, long double y) { - return ::nextafterl(x, y); - } - -#if defined(__clang__) -#pragma clang diagnostic pop -#endif - #endif // ^^^ CATCH_CONFIG_GLOBAL_NEXTAFTER ^^^ -namespace { - template <typename FP> FP step(FP start, FP direction, uint64_t steps) { for (uint64_t i = 0; i < steps; ++i) { diff --git a/packages/Catch2/include/internal/catch_message.cpp b/packages/Catch2/include/internal/catch_message.cpp index 8f391bcb2b686e5ff90ecf574e0fbbcfa1e1a0d9..64c817b7005c86fafdc59cc7168f0d5bfa3b15f6 100644 --- a/packages/Catch2/include/internal/catch_message.cpp +++ b/packages/Catch2/include/internal/catch_message.cpp @@ -111,7 +111,7 @@ namespace Catch { pos = skipq(pos, c); break; case ',': - if (start != pos && openings.size() == 0) { + if (start != pos && openings.empty()) { m_messages.emplace_back(macroName, lineInfo, resultType); m_messages.back().message = static_cast<std::string>(trimmed(start, pos)); m_messages.back().message += " := "; @@ -119,7 +119,7 @@ namespace Catch { } } } - assert(openings.size() == 0 && "Mismatched openings"); + assert(openings.empty() && "Mismatched openings"); m_messages.emplace_back(macroName, lineInfo, resultType); m_messages.back().message = static_cast<std::string>(trimmed(start, names.size() - 1)); m_messages.back().message += " := "; diff --git a/packages/Catch2/include/internal/catch_session.cpp b/packages/Catch2/include/internal/catch_session.cpp index b1d7a404b19eec0a25de05a0718438274b819ee3..24ebe4deb3925f6a4c2d8c032ef0a0c7e9347b94 100644 --- a/packages/Catch2/include/internal/catch_session.cpp +++ b/packages/Catch2/include/internal/catch_session.cpp @@ -69,7 +69,7 @@ namespace Catch { auto const& allTestCases = getAllTestCasesSorted(*m_config); m_matches = m_config->testSpec().matchesByFilter(allTestCases, *m_config); auto const& invalidArgs = m_config->testSpec().getInvalidArgs(); - + if (m_matches.empty() && invalidArgs.empty()) { for (auto const& test : allTestCases) if (!test.isHidden()) @@ -97,12 +97,12 @@ namespace Catch { totals.error = -1; } } - + if (!invalidArgs.empty()) { - for (auto const& invalidArg: invalidArgs) + for (auto const& invalidArg: invalidArgs) m_context.reporter().reportInvalidArguments(invalidArg); - } - + } + m_context.testGroupEnded(m_config->name(), totals, 1, 1); return totals; } @@ -220,11 +220,11 @@ namespace Catch { char **utf8Argv = new char *[ argc ]; for ( int i = 0; i < argc; ++i ) { - int bufSize = WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, NULL, 0, NULL, NULL ); + int bufSize = WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, nullptr, 0, nullptr, nullptr ); utf8Argv[ i ] = new char[ bufSize ]; - WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, utf8Argv[i], bufSize, NULL, NULL ); + WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, utf8Argv[i], bufSize, nullptr, nullptr ); } int returnCode = applyCommandLine( argc, utf8Argv ); diff --git a/packages/Catch2/include/internal/catch_test_case_info.cpp b/packages/Catch2/include/internal/catch_test_case_info.cpp index 685ee30f3e6c39d66476caaf62abd100d7ebcf7d..cee972fa4a59ebf0ff4621336fa573588cf6b209 100644 --- a/packages/Catch2/include/internal/catch_test_case_info.cpp +++ b/packages/Catch2/include/internal/catch_test_case_info.cpp @@ -89,7 +89,8 @@ namespace Catch { } } if( isHidden ) { - tags.push_back( "." ); + // Add all "hidden" tags to make them behave identically + tags.insert( tags.end(), { ".", "!hide" } ); } TestCaseInfo info( static_cast<std::string>(nameAndTags.name), _className, desc, tags, _lineInfo ); diff --git a/packages/Catch2/include/internal/catch_test_case_tracker.cpp b/packages/Catch2/include/internal/catch_test_case_tracker.cpp index 77bd65cbbf39c1ad0198b72db4e98a49b4181585..1fc820b13ec198da7e668cebdccd44a36fe75e4b 100644 --- a/packages/Catch2/include/internal/catch_test_case_tracker.cpp +++ b/packages/Catch2/include/internal/catch_test_case_tracker.cpp @@ -225,8 +225,8 @@ namespace TestCaseTracking { void SectionTracker::addInitialFilters( std::vector<std::string> const& filters ) { if( !filters.empty() ) { m_filters.reserve( m_filters.size() + filters.size() + 2 ); - m_filters.push_back(""); // Root - should never be consulted - m_filters.push_back(""); // Test Case - not a section filter + m_filters.emplace_back(""); // Root - should never be consulted + m_filters.emplace_back(""); // Test Case - not a section filter m_filters.insert( m_filters.end(), filters.begin(), filters.end() ); } } diff --git a/packages/Catch2/include/internal/catch_version.cpp b/packages/Catch2/include/internal/catch_version.cpp index 625e11501cc8b5be6e2b0256a18ea2472f8cf4dc..ca59d6dbdd76dd21cdea6c82723a2def857bfc60 100644 --- a/packages/Catch2/include/internal/catch_version.cpp +++ b/packages/Catch2/include/internal/catch_version.cpp @@ -37,7 +37,7 @@ namespace Catch { } Version const& libraryVersion() { - static Version version( 2, 10, 2, "", 0 ); + static Version version( 2, 11, 1, "", 0 ); return version; } diff --git a/packages/Catch2/include/internal/catch_xmlwriter.cpp b/packages/Catch2/include/internal/catch_xmlwriter.cpp index b0d81ab7f95acf97c632bf37612348983aff5237..30f3b0f1b382219b4027065f929a595700bdb20e 100644 --- a/packages/Catch2/include/internal/catch_xmlwriter.cpp +++ b/packages/Catch2/include/internal/catch_xmlwriter.cpp @@ -12,8 +12,6 @@ #include <iomanip> #include <type_traits> -using uchar = unsigned char; - namespace Catch { namespace { @@ -87,7 +85,7 @@ namespace { // (see: http://www.w3.org/TR/xml/#syntax) for( std::size_t idx = 0; idx < m_str.size(); ++ idx ) { - uchar c = m_str[idx]; + unsigned char c = m_str[idx]; switch (c) { case '<': os << "<"; break; case '&': os << "&"; break; @@ -147,7 +145,7 @@ namespace { bool valid = true; uint32_t value = headerValue(c); for (std::size_t n = 1; n < encBytes; ++n) { - uchar nc = m_str[idx + n]; + unsigned char nc = m_str[idx + n]; valid &= ((nc & 0xC0) == 0x80); value = (value << 6) | (nc & 0x3F); } diff --git a/packages/Catch2/include/reporters/catch_reporter_junit.cpp b/packages/Catch2/include/reporters/catch_reporter_junit.cpp index 820b574fdd2de326fb55c17f3e5c8aa31c671090..7416a523e7112a093cf2634d5910a1a9ffee8e15 100644 --- a/packages/Catch2/include/reporters/catch_reporter_junit.cpp +++ b/packages/Catch2/include/reporters/catch_reporter_junit.cpp @@ -223,11 +223,7 @@ namespace Catch { elementName = "error"; break; case ResultWas::ExplicitFailure: - elementName = "failure"; - break; case ResultWas::ExpressionFailed: - elementName = "failure"; - break; case ResultWas::DidntThrowException: elementName = "failure"; break; diff --git a/packages/Catch2/projects/ExtraTests/CMakeLists.txt b/packages/Catch2/projects/ExtraTests/CMakeLists.txt index 13b02870d5385154e59773d72b2cf8d3205e4f9b..0e514d96fc8a2cdd3d6d11be5b232bd003131b15 100644 --- a/packages/Catch2/projects/ExtraTests/CMakeLists.txt +++ b/packages/Catch2/projects/ExtraTests/CMakeLists.txt @@ -137,6 +137,14 @@ if (MSVC) add_test(NAME WindowsHeader COMMAND WindowsHeader -r compact) endif() +add_executable(DebugBreakMacros ${TESTS_DIR}/X12-CustomDebugBreakMacro.cpp) +add_test(NAME DebugBreakMacros COMMAND DebugBreakMacros --break) +set_tests_properties( + DebugBreakMacros + PROPERTIES + PASS_REGULAR_EXPRESSION "Pretty please, break into debugger" +) + set( EXTRA_TEST_BINARIES PrefixedMacros DisabledMacros @@ -145,6 +153,7 @@ set( EXTRA_TEST_BINARIES FallbackStringifier DisableStringification BenchmarkingMacros + DebugBreakMacros ) # Shared config diff --git a/packages/Catch2/projects/ExtraTests/X12-CustomDebugBreakMacro.cpp b/packages/Catch2/projects/ExtraTests/X12-CustomDebugBreakMacro.cpp new file mode 100644 index 0000000000000000000000000000000000000000..25ab4a0ec85494ca6c106cb97feb829b481182e3 --- /dev/null +++ b/packages/Catch2/projects/ExtraTests/X12-CustomDebugBreakMacro.cpp @@ -0,0 +1,17 @@ +// X12-CustomDebugBreakMacro.cpp +// Test that user-defined `CATCH_BREAK_INTO_DEBUGGER` is respected and used. + +#include <iostream> + +void custom_debug_break() { + std::cerr << "Pretty please, break into debugger\n"; +} + +#define CATCH_BREAK_INTO_DEBUGGER() custom_debug_break() + +#define CATCH_CONFIG_MAIN +#include <catch2/catch.hpp> + +TEST_CASE("Failing test that breaks into debugger", "[macros]") { + REQUIRE(1 == 2); +} diff --git a/packages/Catch2/projects/ExtraTests/X20-BenchmarkingMacros.cpp b/packages/Catch2/projects/ExtraTests/X20-BenchmarkingMacros.cpp index e76af0c71ff901ff95021f097dcf3663431709c2..ca2f056b2b2c550d2b11c3bd9ac49bb64de86192 100644 --- a/packages/Catch2/projects/ExtraTests/X20-BenchmarkingMacros.cpp +++ b/packages/Catch2/projects/ExtraTests/X20-BenchmarkingMacros.cpp @@ -26,14 +26,6 @@ TEST_CASE("Benchmark factorial", "[benchmark]") { BENCHMARK("factorial 14") { return factorial(14); }; -// -// BENCHMARK("factorial 20") { -// return factorial(20); -// }; -// -// BENCHMARK("factorial 35") { -// return factorial(35); -// }; } TEST_CASE("Benchmark containers", "[.][benchmark]") { diff --git a/packages/Catch2/projects/SelfTest/Baselines/compact.sw.approved.txt b/packages/Catch2/projects/SelfTest/Baselines/compact.sw.approved.txt index a74faf9be09b3d2c970bc4b3cc84763bbb516a09..c12ce081d882f91ebba89299f7044f77170c41c7 100644 --- a/packages/Catch2/projects/SelfTest/Baselines/compact.sw.approved.txt +++ b/packages/Catch2/projects/SelfTest/Baselines/compact.sw.approved.txt @@ -312,6 +312,8 @@ Condition.tests.cpp:<line number>: passed: 4 == ul for: 4 == 4 Condition.tests.cpp:<line number>: passed: 5 == c for: 5 == 5 Condition.tests.cpp:<line number>: passed: 6 == uc for: 6 == 6 Condition.tests.cpp:<line number>: passed: (std::numeric_limits<uint32_t>::max)() > ul for: 4294967295 (0x<hex digits>) > 4 +Matchers.tests.cpp:<line number>: passed: testStringForMatching2(), !composed1 for: "some completely different text that contains one common word" not ( contains: "string" or contains: "random" ) +Matchers.tests.cpp:<line number>: passed: testStringForMatching2(), composed2 for: "some completely different text that contains one common word" ( contains: "string" or contains: "random" or contains: "different" ) Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Contains("not there", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" contains: "not there" (case insensitive) Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Contains("STRING") for: "this string contains 'abc' as a substring" contains: "STRING" Generators.tests.cpp:<line number>: passed: elem % 2 == 1 for: 1 == 1 @@ -1116,6 +1118,8 @@ CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "--benchmark-confid CmdLine.tests.cpp:<line number>: passed: config.benchmarkConfidenceInterval == Catch::Detail::Approx(0.99) for: 0.99 == Approx( 0.99 ) CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "--benchmark-no-analysis" }) for: {?} CmdLine.tests.cpp:<line number>: passed: config.benchmarkNoAnalysis for: true +CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "--benchmark-warmup-time=10" }) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.benchmarkWarmupTime == 10 for: 10 == 10 Misc.tests.cpp:<line number>: passed: std::tuple_size<TestType>::value >= 1 for: 3 >= 1 Misc.tests.cpp:<line number>: passed: std::tuple_size<TestType>::value >= 1 for: 2 >= 1 Misc.tests.cpp:<line number>: passed: std::tuple_size<TestType>::value >= 1 for: 1 >= 1 @@ -1567,6 +1571,9 @@ Xml.tests.cpp:<line number>: passed: encode( stringWithQuotes, Catch::XmlEncode: "don't "quote" me on that" Xml.tests.cpp:<line number>: passed: encode( "[\x01]" ) == "[\\x01]" for: "[\x01]" == "[\x01]" Xml.tests.cpp:<line number>: passed: encode( "[\x7F]" ) == "[\\x7F]" for: "[\x7F]" == "[\x7F]" +Tag.tests.cpp:<line number>: passed: testcase.tags, VectorContains(std::string(".")) && VectorContains(std::string("!hide")) for: { "!hide", "." } ( Contains: "." and Contains: "!hide" ) +Tag.tests.cpp:<line number>: passed: testcase.tags, VectorContains(std::string(".")) && VectorContains(std::string("!hide")) for: { "!hide", "." } ( Contains: "." and Contains: "!hide" ) +Tag.tests.cpp:<line number>: passed: testcase.tags, VectorContains(std::string(".")) && VectorContains(std::string("!hide")) for: { "!hide", ".", "foo" } ( Contains: "." and Contains: "!hide" ) ToStringVector.tests.cpp:<line number>: passed: Catch::Detail::stringify( empty ) == "{ }" for: "{ }" == "{ }" ToStringVector.tests.cpp:<line number>: passed: Catch::Detail::stringify( oneValue ) == "{ 42 }" for: "{ 42 }" == "{ 42 }" ToStringVector.tests.cpp:<line number>: passed: Catch::Detail::stringify( twoValues ) == "{ 42, 250 }" for: "{ 42, 250 }" == "{ 42, 250 }" @@ -1668,7 +1675,7 @@ StringManip.tests.cpp:<line number>: passed: Catch::replaceInPlace(s, "'", "|'") StringManip.tests.cpp:<line number>: passed: s == "didn|'t" for: "didn|'t" == "didn|'t" Misc.tests.cpp:<line number>: failed: false with 1 message: '3' Message.tests.cpp:<line number>: failed: false with 2 messages: 'hi' and 'i := 7' -Tag.tests.cpp:<line number>: passed: testcase.tags, Catch::VectorContains(std::string("magic-tag")) && Catch::VectorContains(std::string(".")) for: { ".", "magic-tag" } ( Contains: "magic-tag" and Contains: "." ) +Tag.tests.cpp:<line number>: passed: testcase.tags, Catch::VectorContains(std::string("magic-tag")) && Catch::VectorContains(std::string(".")) for: { "!hide", ".", "magic-tag" } ( Contains: "magic-tag" and Contains: "." ) StringManip.tests.cpp:<line number>: passed: splitStringRef("", ','), Equals(std::vector<StringRef>()) for: { } Equals: { } StringManip.tests.cpp:<line number>: passed: splitStringRef("abc", ','), Equals(std::vector<StringRef>{"abc"}) for: { abc } Equals: { abc } StringManip.tests.cpp:<line number>: passed: splitStringRef("abc,def", ','), Equals(std::vector<StringRef>{"abc", "def"}) for: { abc, def } Equals: { abc, def } diff --git a/packages/Catch2/projects/SelfTest/Baselines/console.std.approved.txt b/packages/Catch2/projects/SelfTest/Baselines/console.std.approved.txt index 4db2b90a44e6bd79ba63d3ef00b9d5cb78a1e284..f62b2e48c8f6526ca13e6f79135bbb6e214573fa 100644 --- a/packages/Catch2/projects/SelfTest/Baselines/console.std.approved.txt +++ b/packages/Catch2/projects/SelfTest/Baselines/console.std.approved.txt @@ -1380,6 +1380,6 @@ due to unexpected exception with message: Why would you throw a std::string? =============================================================================== -test cases: 304 | 230 passed | 70 failed | 4 failed as expected -assertions: 1659 | 1507 passed | 131 failed | 21 failed as expected +test cases: 306 | 232 passed | 70 failed | 4 failed as expected +assertions: 1666 | 1514 passed | 131 failed | 21 failed as expected diff --git a/packages/Catch2/projects/SelfTest/Baselines/console.sw.approved.txt b/packages/Catch2/projects/SelfTest/Baselines/console.sw.approved.txt index 8de4bcaa8040ae7b6c18cebd3548febc233fe719..68357ef07d5303cd16d93a6f4e10440d1ca8337c 100644 --- a/packages/Catch2/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/packages/Catch2/projects/SelfTest/Baselines/console.sw.approved.txt @@ -2390,6 +2390,24 @@ Condition.tests.cpp:<line number>: PASSED: with expansion: 4294967295 (0x<hex digits>) > 4 +------------------------------------------------------------------------------- +Composed matchers are distinct +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( testStringForMatching2(), !composed1 ) +with expansion: + "some completely different text that contains one common word" not ( + contains: "string" or contains: "random" ) + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( testStringForMatching2(), composed2 ) +with expansion: + "some completely different text that contains one common word" ( contains: + "string" or contains: "random" or contains: "different" ) + ------------------------------------------------------------------------------- Contains string matcher ------------------------------------------------------------------------------- @@ -8046,7 +8064,7 @@ with expansion: ------------------------------------------------------------------------------- Process can be configured on command line Benchmark options - resamples + confidence-interval ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... @@ -8064,7 +8082,7 @@ with expansion: ------------------------------------------------------------------------------- Process can be configured on command line Benchmark options - resamples + no-analysis ------------------------------------------------------------------------------- CmdLine.tests.cpp:<line number> ............................................................................... @@ -8079,6 +8097,24 @@ CmdLine.tests.cpp:<line number>: PASSED: with expansion: true +------------------------------------------------------------------------------- +Process can be configured on command line + Benchmark options + warmup-time +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cli.parse({ "test", "--benchmark-warmup-time=10" }) ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.benchmarkWarmupTime == 10 ) +with expansion: + 10 == 10 + ------------------------------------------------------------------------------- Product with differing arities - std::tuple<int, double, float> ------------------------------------------------------------------------------- @@ -11465,6 +11501,39 @@ Xml.tests.cpp:<line number>: PASSED: with expansion: "[\x7F]" == "[\x7F]" +------------------------------------------------------------------------------- +adding a hide tag implicitly enables all others +------------------------------------------------------------------------------- +Tag.tests.cpp:<line number> +............................................................................... + +Tag.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( testcase.tags, VectorContains(std::string(".")) && VectorContains(std::string("!hide")) ) +with expansion: + { "!hide", "." } ( Contains: "." and Contains: "!hide" ) + +------------------------------------------------------------------------------- +adding a hide tag implicitly enables all others +------------------------------------------------------------------------------- +Tag.tests.cpp:<line number> +............................................................................... + +Tag.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( testcase.tags, VectorContains(std::string(".")) && VectorContains(std::string("!hide")) ) +with expansion: + { "!hide", "." } ( Contains: "." and Contains: "!hide" ) + +------------------------------------------------------------------------------- +adding a hide tag implicitly enables all others +------------------------------------------------------------------------------- +Tag.tests.cpp:<line number> +............................................................................... + +Tag.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( testcase.tags, VectorContains(std::string(".")) && VectorContains(std::string("!hide")) ) +with expansion: + { "!hide", ".", "foo" } ( Contains: "." and Contains: "!hide" ) + ------------------------------------------------------------------------------- array<int, N> -> toString ------------------------------------------------------------------------------- @@ -12387,7 +12456,7 @@ Tag.tests.cpp:<line number> Tag.tests.cpp:<line number>: PASSED: REQUIRE_THAT( testcase.tags, Catch::VectorContains(std::string("magic-tag")) && Catch::VectorContains(std::string(".")) ) with expansion: - { ".", "magic-tag" } ( Contains: "magic-tag" and Contains: "." ) + { "!hide", ".", "magic-tag" } ( Contains: "magic-tag" and Contains: "." ) ------------------------------------------------------------------------------- splitString @@ -13251,6 +13320,6 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: =============================================================================== -test cases: 304 | 214 passed | 86 failed | 4 failed as expected -assertions: 1676 | 1507 passed | 148 failed | 21 failed as expected +test cases: 306 | 216 passed | 86 failed | 4 failed as expected +assertions: 1683 | 1514 passed | 148 failed | 21 failed as expected diff --git a/packages/Catch2/projects/SelfTest/Baselines/junit.sw.approved.txt b/packages/Catch2/projects/SelfTest/Baselines/junit.sw.approved.txt index 41065c4e6a391537b6ab910426350e668bea7f0c..59119a25812344447239cf615874940334511eec 100644 --- a/packages/Catch2/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/packages/Catch2/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <testsuitesloose text artifact > - <testsuite name="<exe-name>" errors="17" failures="132" tests="1677" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> + <testsuite name="<exe-name>" errors="17" failures="132" tests="1684" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> <properties> <property name="filters" value="~[!nonportable]~[!benchmark]~[approvals]"/> <property name="random-seed" value="1"/> @@ -356,6 +356,7 @@ Exception.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="Comparisons between ints where one side is computed" time="{duration}"/> <testcase classname="<exe-name>.global" name="Comparisons between unsigned ints and negative signed ints match c++ standard behaviour" time="{duration}"/> <testcase classname="<exe-name>.global" name="Comparisons with int literals don't warn when mixing signed/ unsigned" time="{duration}"/> + <testcase classname="<exe-name>.global" name="Composed matchers are distinct" time="{duration}"/> <testcase classname="<exe-name>.global" name="Contains string matcher" time="{duration}"> <failure message="testStringForMatching(), Contains("not there", Catch::CaseSensitive::No)" type="CHECK_THAT"> FAILED: @@ -1015,8 +1016,9 @@ Message.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="Process can be configured on command line/use-colour/error" time="{duration}"/> <testcase classname="<exe-name>.global" name="Process can be configured on command line/Benchmark options/samples" time="{duration}"/> <testcase classname="<exe-name>.global" name="Process can be configured on command line/Benchmark options/resamples" time="{duration}"/> - <testcase classname="<exe-name>.global" name="Process can be configured on command line/Benchmark options/resamples" time="{duration}"/> - <testcase classname="<exe-name>.global" name="Process can be configured on command line/Benchmark options/resamples" time="{duration}"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/Benchmark options/confidence-interval" time="{duration}"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/Benchmark options/no-analysis" time="{duration}"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/Benchmark options/warmup-time" time="{duration}"/> <testcase classname="<exe-name>.global" name="Product with differing arities - std::tuple<int, double, float>" time="{duration}"/> <testcase classname="<exe-name>.global" name="Product with differing arities - std::tuple<int, double>" time="{duration}"/> <testcase classname="<exe-name>.global" name="Product with differing arities - std::tuple<int>" time="{duration}"/> @@ -1404,6 +1406,7 @@ Exception.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="XmlEncode/string with quotes" time="{duration}"/> <testcase classname="<exe-name>.global" name="XmlEncode/string with control char (1)" time="{duration}"/> <testcase classname="<exe-name>.global" name="XmlEncode/string with control char (x7F)" time="{duration}"/> + <testcase classname="<exe-name>.global" name="adding a hide tag implicitly enables all others" time="{duration}"/> <testcase classname="<exe-name>.global" name="array<int, N> -> toString" time="{duration}"/> <testcase classname="<exe-name>.global" name="atomic if" time="{duration}"/> <testcase classname="<exe-name>.global" name="boolean member" time="{duration}"/> diff --git a/packages/Catch2/projects/SelfTest/Baselines/sonarqube.sw.approved.txt b/packages/Catch2/projects/SelfTest/Baselines/sonarqube.sw.approved.txt index f1b9fe9838f70606d53baa8d45e45f9b5b629554..1d7e92bffd2494cccdcbefed2de2409b1660610c 100644 --- a/packages/Catch2/projects/SelfTest/Baselines/sonarqube.sw.approved.txt +++ b/packages/Catch2/projects/SelfTest/Baselines/sonarqube.sw.approved.txt @@ -64,8 +64,9 @@ <testCase name="Process can be configured on command line/use-colour/error" duration="{duration}"/> <testCase name="Process can be configured on command line/Benchmark options/samples" duration="{duration}"/> <testCase name="Process can be configured on command line/Benchmark options/resamples" duration="{duration}"/> - <testCase name="Process can be configured on command line/Benchmark options/resamples" duration="{duration}"/> - <testCase name="Process can be configured on command line/Benchmark options/resamples" duration="{duration}"/> + <testCase name="Process can be configured on command line/Benchmark options/confidence-interval" duration="{duration}"/> + <testCase name="Process can be configured on command line/Benchmark options/no-analysis" duration="{duration}"/> + <testCase name="Process can be configured on command line/Benchmark options/warmup-time" duration="{duration}"/> <testCase name="Test with special, characters "in name" duration="{duration}"/> </file> <file path="projects/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp"> @@ -142,6 +143,7 @@ <file path="projects/<exe-name>/IntrospectiveTests/Tag.tests.cpp"> <testCase name="Tag alias can be registered against tag patterns/The same tag alias can only be registered once" duration="{duration}"/> <testCase name="Tag alias can be registered against tag patterns/Tag aliases must be of the form [@name]" duration="{duration}"/> + <testCase name="adding a hide tag implicitly enables all others" duration="{duration}"/> <testCase name="shortened hide tags are split apart" duration="{duration}"/> </file> <file path="projects/<exe-name>/IntrospectiveTests/ToString.tests.cpp"> @@ -890,6 +892,7 @@ Exception.tests.cpp:<line number> <file path="projects/<exe-name>/UsageTests/Matchers.tests.cpp"> <testCase name="Arbitrary predicate matcher/Function pointer" duration="{duration}"/> <testCase name="Arbitrary predicate matcher/Lambdas + different type" duration="{duration}"/> + <testCase name="Composed matchers are distinct" duration="{duration}"/> <testCase name="Contains string matcher" duration="{duration}"> <failure message="CHECK_THAT(testStringForMatching(), Contains("not there", Catch::CaseSensitive::No))"> FAILED: diff --git a/packages/Catch2/projects/SelfTest/Baselines/xml.sw.approved.txt b/packages/Catch2/projects/SelfTest/Baselines/xml.sw.approved.txt index cf7413e33a0e8ae0817ac8127b3d34c724c501c8..1021e16842f9a72bee27da9ed9d1a8353cc451ff 100644 --- a/packages/Catch2/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/packages/Catch2/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -113,7 +113,7 @@ </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="#1175 - Hidden Test" tags="[.]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <TestCase name="#1175 - Hidden Test" tags="[!hide][.]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <OverallResult success="true"/> </TestCase> <TestCase name="#1238" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" > @@ -161,7 +161,7 @@ </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="#1455 - INFO and WARN can start with a linebreak" tags="[.][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > + <TestCase name="#1455 - INFO and WARN can start with a linebreak" tags="[!hide][.][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > <Info> This info message starts with a linebreak @@ -172,7 +172,7 @@ This warning message starts with a linebreak </Warning> <OverallResult success="false"/> </TestCase> - <TestCase name="#1514: stderr/stdout is not captured in tests aborted by an exception" tags="[.][output-capture][regression]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" > + <TestCase name="#1514: stderr/stdout is not captured in tests aborted by an exception" tags="[!hide][.][output-capture][regression]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" > <Failure filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" > 1514 </Failure> @@ -196,7 +196,7 @@ Nor would this </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="#748 - captures with unexpected exceptions" tags="[!shouldfail][!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > + <TestCase name="#748 - captures with unexpected exceptions" tags="[!hide][!shouldfail][!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > <Section name="outside assertions" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > <Info> answer := 42 @@ -309,7 +309,7 @@ Nor would this </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="#835 -- errno should not be touched by Catch" tags="[!shouldfail][.][failing]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <TestCase name="#835 -- errno should not be touched by Catch" tags="[!hide][!shouldfail][.][failing]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> f() == 0 @@ -342,7 +342,7 @@ Nor would this </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="#961 -- Dynamically created sections should all be reported" tags="[.]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <TestCase name="#961 -- Dynamically created sections should all be reported" tags="[!hide][.]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="Looped section 0" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <OverallResults successes="1" failures="0" expectedFailures="0"/> </Section> @@ -360,7 +360,7 @@ Nor would this </Section> <OverallResult success="true"/> </TestCase> - <TestCase name="'Not' checks that should fail" tags="[.][failing]" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" > + <TestCase name="'Not' checks that should fail" tags="[!hide][.][failing]" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" > <Original> false != false @@ -1227,7 +1227,7 @@ Nor would this </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="A METHOD_AS_TEST_CASE based test run that fails" tags="[.][class][failing]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > + <TestCase name="A METHOD_AS_TEST_CASE based test run that fails" tags="[!hide][.][class][failing]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Original> s == "world" @@ -1249,7 +1249,7 @@ Nor would this </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<float>" tags="[.][class][failing][product][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > + <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<float>" tags="[!hide][.][class][failing][product][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Original> Template_Fixture_2<TestType>::m_a.size() == 1 @@ -1260,7 +1260,7 @@ Nor would this </Expression> <OverallResult success="false"/> </TestCase> - <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<int>" tags="[.][class][failing][product][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > + <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<int>" tags="[!hide][.][class][failing][product][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Original> Template_Fixture_2<TestType>::m_a.size() == 1 @@ -1271,7 +1271,7 @@ Nor would this </Expression> <OverallResult success="false"/> </TestCase> - <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<float>" tags="[.][class][failing][product][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > + <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<float>" tags="[!hide][.][class][failing][product][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Original> Template_Fixture_2<TestType>::m_a.size() == 1 @@ -1282,7 +1282,7 @@ Nor would this </Expression> <OverallResult success="false"/> </TestCase> - <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<int>" tags="[.][class][failing][product][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > + <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<int>" tags="[!hide][.][class][failing][product][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Original> Template_Fixture_2<TestType>::m_a.size() == 1 @@ -1337,7 +1337,7 @@ Nor would this </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<float, 6>" tags="[.][class][failing][nttp][product][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > + <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<float, 6>" tags="[!hide][.][class][failing][nttp][product][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Original> Template_Fixture_2<TestType>{}.m_a.size() < 2 @@ -1348,7 +1348,7 @@ Nor would this </Expression> <OverallResult success="false"/> </TestCase> - <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<int, 2>" tags="[.][class][failing][nttp][product][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > + <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<int, 2>" tags="[!hide][.][class][failing][nttp][product][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Original> Template_Fixture_2<TestType>{}.m_a.size() < 2 @@ -1359,7 +1359,7 @@ Nor would this </Expression> <OverallResult success="false"/> </TestCase> - <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<float, 6>" tags="[.][class][failing][nttp][product][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > + <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<float, 6>" tags="[!hide][.][class][failing][nttp][product][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Original> Template_Fixture_2<TestType>{}.m_a.size() < 2 @@ -1370,7 +1370,7 @@ Nor would this </Expression> <OverallResult success="false"/> </TestCase> - <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<int, 2>" tags="[.][class][failing][nttp][product][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > + <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<int, 2>" tags="[!hide][.][class][failing][nttp][product][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Original> Template_Fixture_2<TestType>{}.m_a.size() < 2 @@ -1425,7 +1425,7 @@ Nor would this </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - double" tags="[.][class][failing][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > + <TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - double" tags="[!hide][.][class][failing][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Original> Template_Fixture<TestType>::m_a == 2 @@ -1436,7 +1436,7 @@ Nor would this </Expression> <OverallResult success="false"/> </TestCase> - <TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - float" tags="[.][class][failing][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > + <TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - float" tags="[!hide][.][class][failing][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Original> Template_Fixture<TestType>::m_a == 2 @@ -1447,7 +1447,7 @@ Nor would this </Expression> <OverallResult success="false"/> </TestCase> - <TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - int" tags="[.][class][failing][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > + <TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - int" tags="[!hide][.][class][failing][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Original> Template_Fixture<TestType>::m_a == 2 @@ -1491,7 +1491,7 @@ Nor would this </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 1" tags="[.][class][failing][nttp][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > + <TestCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 1" tags="[!hide][.][class][failing][nttp][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Original> Nttp_Fixture<V>::value == 0 @@ -1502,7 +1502,7 @@ Nor would this </Expression> <OverallResult success="false"/> </TestCase> - <TestCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 3" tags="[.][class][failing][nttp][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > + <TestCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 3" tags="[!hide][.][class][failing][nttp][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Original> Nttp_Fixture<V>::value == 0 @@ -1513,7 +1513,7 @@ Nor would this </Expression> <OverallResult success="false"/> </TestCase> - <TestCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 6" tags="[.][class][failing][nttp][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > + <TestCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 6" tags="[!hide][.][class][failing][nttp][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Original> Nttp_Fixture<V>::value == 0 @@ -1557,7 +1557,7 @@ Nor would this </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="A TEST_CASE_METHOD based test run that fails" tags="[.][class][failing]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > + <TestCase name="A TEST_CASE_METHOD based test run that fails" tags="[!hide][.][class][failing]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > <Original> m_a == 2 @@ -1718,7 +1718,7 @@ Nor would this </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="A couple of nested sections followed by a failure" tags="[.][failing]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <TestCase name="A couple of nested sections followed by a failure" tags="[!hide][.][failing]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="Outer" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="Inner" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <OverallResults successes="1" failures="0" expectedFailures="0"/> @@ -1730,7 +1730,7 @@ Nor would this </Failure> <OverallResult success="false"/> </TestCase> - <TestCase name="A failing expression with a non streamable type is still captured" tags="[.][Tricky][failing]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" > + <TestCase name="A failing expression with a non streamable type is still captured" tags="[!hide][.][Tricky][failing]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" > <Original> &o1 == &o2 @@ -1822,7 +1822,7 @@ Nor would this </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="An unchecked exception reports the line of the last assertion" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > + <TestCase name="An unchecked exception reports the line of the last assertion" tags="[!hide][!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > <Original> 1 == 1 @@ -2832,7 +2832,26 @@ Nor would this </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="Contains string matcher" tags="[.][failing][matchers]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > + <TestCase name="Composed matchers are distinct" tags="[composed][matchers]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + testStringForMatching2(), !composed1 + </Original> + <Expanded> + "some completely different text that contains one common word" not ( contains: "string" or contains: "random" ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + testStringForMatching2(), composed2 + </Original> + <Expanded> + "some completely different text that contains one common word" ( contains: "string" or contains: "random" or contains: "different" ) + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Contains string matcher" tags="[!hide][.][failing][matchers]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > <Original> testStringForMatching(), Contains("not there", Catch::CaseSensitive::No) @@ -3005,7 +3024,7 @@ Nor would this </Section> <OverallResult success="true"/> </TestCase> - <TestCase name="Custom exceptions can be translated when testing for nothrow" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > + <TestCase name="Custom exceptions can be translated when testing for nothrow" tags="[!hide][!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="false" type="REQUIRE_NOTHROW" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > <Original> throwCustom() @@ -3019,7 +3038,7 @@ Nor would this </Expression> <OverallResult success="false"/> </TestCase> - <TestCase name="Custom exceptions can be translated when testing for throwing as something else" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > + <TestCase name="Custom exceptions can be translated when testing for throwing as something else" tags="[!hide][!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="false" type="REQUIRE_THROWS_AS" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > <Original> throwCustom(), std::exception @@ -3033,7 +3052,7 @@ Nor would this </Expression> <OverallResult success="false"/> </TestCase> - <TestCase name="Custom std-exceptions can be custom translated" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > + <TestCase name="Custom std-exceptions can be custom translated" tags="[!hide][!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > <Exception filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > custom std exception </Exception> @@ -3087,7 +3106,7 @@ Nor would this </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="EndsWith string matcher" tags="[.][failing][matchers]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > + <TestCase name="EndsWith string matcher" tags="[!hide][.][failing][matchers]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > <Original> testStringForMatching(), EndsWith("Substring") @@ -3181,7 +3200,7 @@ Nor would this </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="Equality checks that should fail" tags="[!mayfail][.][failing]" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" > + <TestCase name="Equality checks that should fail" tags="[!hide][!mayfail][.][failing]" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" > <Original> data.int_seven == 6 @@ -3366,7 +3385,7 @@ Nor would this </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="Equals string matcher" tags="[.][failing][matchers]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > + <TestCase name="Equals string matcher" tags="[!hide][.][failing][matchers]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > <Original> testStringForMatching(), Equals("this string contains 'ABC' as a substring") @@ -3416,7 +3435,7 @@ Nor would this </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="Exception matchers that fail" tags="[!throws][.][exceptions][failing][matchers]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > + <TestCase name="Exception matchers that fail" tags="[!hide][!throws][.][exceptions][failing][matchers]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > <Section name="No exception" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THROWS_MATCHES" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > <Original> @@ -3596,7 +3615,7 @@ Nor would this </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="Expected exceptions that don't throw or unexpected exceptions fail the test" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > + <TestCase name="Expected exceptions that don't throw or unexpected exceptions fail the test" tags="[!hide][!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="false" type="CHECK_THROWS_AS" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > <Original> thisThrows(), std::string @@ -3629,17 +3648,17 @@ Nor would this </Expression> <OverallResult success="false"/> </TestCase> - <TestCase name="FAIL aborts the test" tags="[.][failing][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > + <TestCase name="FAIL aborts the test" tags="[!hide][.][failing][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > <Failure filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > This is a failure </Failure> <OverallResult success="false"/> </TestCase> - <TestCase name="FAIL does not require an argument" tags="[.][failing][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > + <TestCase name="FAIL does not require an argument" tags="[!hide][.][failing][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > <Failure filename="projects/<exe-name>/UsageTests/Message.tests.cpp" /> <OverallResult success="false"/> </TestCase> - <TestCase name="FAIL_CHECK does not abort the test" tags="[.][failing][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > + <TestCase name="FAIL_CHECK does not abort the test" tags="[!hide][.][failing][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > <Failure filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > This is a failure </Failure> @@ -6865,7 +6884,7 @@ Nor would this </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="INFO and WARN do not abort tests" tags="[.][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > + <TestCase name="INFO and WARN do not abort tests" tags="[!hide][.][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > <Info> this is a message </Info> @@ -6874,7 +6893,7 @@ Nor would this </Warning> <OverallResult success="false"/> </TestCase> - <TestCase name="INFO gets logged on failure" tags="[.][failing][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > + <TestCase name="INFO gets logged on failure" tags="[!hide][.][failing][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > <Info> this message should be logged </Info> @@ -6891,7 +6910,7 @@ Nor would this </Expression> <OverallResult success="false"/> </TestCase> - <TestCase name="INFO gets logged on failure, even if captured before successful assertions" tags="[.][failing][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > + <TestCase name="INFO gets logged on failure, even if captured before successful assertions" tags="[!hide][.][failing][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > <Info> this message may be logged later </Info> @@ -6956,7 +6975,7 @@ Nor would this </Expression> <OverallResult success="false"/> </TestCase> - <TestCase name="INFO is reset for each loop" tags="[.][failing][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > + <TestCase name="INFO is reset for each loop" tags="[!hide][.][failing][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > <Info> current counter 0 </Info> @@ -7113,7 +7132,7 @@ Nor would this </Expression> <OverallResult success="false"/> </TestCase> - <TestCase name="Inequality checks that should fail" tags="[!shouldfail][.][failing]" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" > + <TestCase name="Inequality checks that should fail" tags="[!hide][!shouldfail][.][failing]" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" > <Original> data.int_seven != 7 @@ -7326,7 +7345,7 @@ Nor would this </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="Matchers can be composed with both && and || - failing" tags="[.][failing][matchers][operator&&][operators][operator||]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > + <TestCase name="Matchers can be composed with both && and || - failing" tags="[!hide][.][failing][matchers][operator&&][operators][operator||]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > <Original> testStringForMatching(), (Contains("string") || Contains("different")) && Contains("random") @@ -7348,7 +7367,7 @@ Nor would this </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="Matchers can be negated (Not) with the ! operator - failing" tags="[.][failing][matchers][not][operators]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > + <TestCase name="Matchers can be negated (Not) with the ! operator - failing" tags="[!hide][.][failing][matchers][not][operators]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > <Original> testStringForMatching(), !Contains("substring") @@ -7359,7 +7378,7 @@ Nor would this </Expression> <OverallResult success="false"/> </TestCase> - <TestCase name="Mismatching exception messages failing the test" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > + <TestCase name="Mismatching exception messages failing the test" tags="[!hide][!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="true" type="REQUIRE_THROWS_WITH" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > <Original> thisThrows(), "expected exception" @@ -7509,13 +7528,13 @@ Nor would this </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="Nice descriptive name" tags="[.][tag1][tag2][tag3]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <TestCase name="Nice descriptive name" tags="[!hide][.][tag1][tag2][tag3]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Warning> This one ran </Warning> <OverallResult success="false"/> </TestCase> - <TestCase name="Non-std exceptions can be translated" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > + <TestCase name="Non-std exceptions can be translated" tags="[!hide][!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > <Exception filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > custom exception </Exception> @@ -7551,7 +7570,7 @@ Nor would this <TestCase name="Optionally static assertions" tags="[compilation]" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" > <OverallResult success="true"/> </TestCase> - <TestCase name="Ordering comparison checks that should fail" tags="[.][failing]" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" > + <TestCase name="Ordering comparison checks that should fail" tags="[!hide][.][failing]" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" > <Original> data.int_seven > 7 @@ -8004,7 +8023,7 @@ Nor would this </Section> <OverallResult success="true"/> </TestCase> - <TestCase name="Output from all sections is reported" tags="[.][failing][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > + <TestCase name="Output from all sections is reported" tags="[!hide][.][failing][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > <Section name="one" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > <Failure filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > Message from section one @@ -10140,7 +10159,7 @@ Nor would this <OverallResults successes="2" failures="0" expectedFailures="0"/> </Section> <Section name="Benchmark options" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Section name="resamples" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="confidence-interval" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> cli.parse({ "test", "--benchmark-confidence-interval=0.99" }) @@ -10162,7 +10181,7 @@ Nor would this <OverallResults successes="2" failures="0" expectedFailures="0"/> </Section> <Section name="Benchmark options" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > - <Section name="resamples" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="no-analysis" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Original> cli.parse({ "test", "--benchmark-no-analysis" }) @@ -10183,6 +10202,28 @@ Nor would this </Section> <OverallResults successes="2" failures="0" expectedFailures="0"/> </Section> + <Section name="Benchmark options" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="warmup-time" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse({ "test", "--benchmark-warmup-time=10" }) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.benchmarkWarmupTime == 10 + </Original> + <Expanded> + 10 == 10 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> <OverallResult success="true"/> </TestCase> <TestCase name="Product with differing arities - std::tuple<int, double, float>" tags="[product][template]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -10218,7 +10259,7 @@ Nor would this </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="Reconstruction should be based on stringification: #914" tags="[.][Decomposition][failing]" filename="projects/<exe-name>/UsageTests/Decomposition.tests.cpp" > + <TestCase name="Reconstruction should be based on stringification: #914" tags="[!hide][.][Decomposition][failing]" filename="projects/<exe-name>/UsageTests/Decomposition.tests.cpp" > <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Decomposition.tests.cpp" > <Original> truthy(false) @@ -10229,7 +10270,7 @@ Nor would this </Expression> <OverallResult success="false"/> </TestCase> - <TestCase name="Regex string matcher" tags="[.][failing][matchers]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > + <TestCase name="Regex string matcher" tags="[!hide][.][failing][matchers]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > <Original> testStringForMatching(), Matches("this STRING contains 'abc' as a substring") @@ -10270,7 +10311,7 @@ Nor would this <TestCase name="SUCCEED counts as a test pass" tags="[messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > <OverallResult success="true"/> </TestCase> - <TestCase name="SUCCEED does not require an argument" tags="[.][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > + <TestCase name="SUCCEED does not require an argument" tags="[!hide][.][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > <OverallResult success="true"/> </TestCase> <TestCase name="Scenario: BDD tests requiring Fixtures to provide commonly-accessed data or methods" tags="[bdd][fixtures]" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" > @@ -10438,7 +10479,7 @@ Nor would this </Section> <OverallResult success="true"/> </TestCase> - <TestCase name="Sends stuff to stdout and stderr" tags="[.]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <TestCase name="Sends stuff to stdout and stderr" tags="[!hide][.]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <OverallResult success="false"> <StdOut> A string sent directly to stdout @@ -10516,7 +10557,7 @@ A string sent to stderr via clog </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="Standard output from all sections is reported" tags="[.][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > + <TestCase name="Standard output from all sections is reported" tags="[!hide][.][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > <Section name="one" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > <OverallResults successes="0" failures="1" expectedFailures="0"/> </Section> @@ -10530,7 +10571,7 @@ Message from section two </StdOut> </OverallResult> </TestCase> - <TestCase name="StartsWith string matcher" tags="[.][failing][matchers]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > + <TestCase name="StartsWith string matcher" tags="[!hide][.][failing][matchers]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > <Original> testStringForMatching(), StartsWith("This String") @@ -11115,7 +11156,7 @@ Message from section two </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="Tabs and newlines show in output" tags="[.][failing][whitespace]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <TestCase name="Tabs and newlines show in output" tags="[!hide][.][failing][whitespace]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> s1 == s2 @@ -12584,10 +12625,10 @@ Message from section two </Expression> <OverallResult success="false"/> </TestCase> - <TestCase name="This test 'should' fail but doesn't" tags="[!shouldfail][.][failing]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <TestCase name="This test 'should' fail but doesn't" tags="[!hide][!shouldfail][.][failing]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <OverallResult success="false"/> </TestCase> - <TestCase name="Thrown string literals are translated" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > + <TestCase name="Thrown string literals are translated" tags="[!hide][!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > <Exception filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > For some reason someone is throwing a string literal! </Exception> @@ -13251,7 +13292,7 @@ There is no extra whitespace here </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="Unexpected exceptions can be translated" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > + <TestCase name="Unexpected exceptions can be translated" tags="[!hide][!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > <Exception filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > 3.14 </Exception> @@ -13410,7 +13451,7 @@ There is no extra whitespace here </Section> <OverallResult success="true"/> </TestCase> - <TestCase name="Vector Approx matcher -- failing" tags="[.][approx][failing][matchers][vector]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > + <TestCase name="Vector Approx matcher -- failing" tags="[!hide][.][approx][failing][matchers][vector]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > <Section name="Empty and non empty vectors are not approx equal" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > <Original> @@ -13565,7 +13606,7 @@ There is no extra whitespace here </Section> <OverallResult success="true"/> </TestCase> - <TestCase name="Vector matchers that fail" tags="[.][failing][matchers][vector]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > + <TestCase name="Vector matchers that fail" tags="[!hide][.][failing][matchers][vector]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > <Section name="Contains (element)" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > <Original> @@ -13703,13 +13744,13 @@ There is no extra whitespace here </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="When unchecked exceptions are thrown directly they are always failures" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > + <TestCase name="When unchecked exceptions are thrown directly they are always failures" tags="[!hide][!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > <Exception filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > unexpected exception </Exception> <OverallResult success="false"/> </TestCase> - <TestCase name="When unchecked exceptions are thrown during a CHECK the test should continue" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > + <TestCase name="When unchecked exceptions are thrown during a CHECK the test should continue" tags="[!hide][!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > <Original> thisThrows() == 0 @@ -13723,7 +13764,7 @@ There is no extra whitespace here </Expression> <OverallResult success="false"/> </TestCase> - <TestCase name="When unchecked exceptions are thrown during a REQUIRE the test should abort fail" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > + <TestCase name="When unchecked exceptions are thrown during a REQUIRE the test should abort fail" tags="[!hide][!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > <Original> thisThrows() == 0 @@ -13737,7 +13778,7 @@ There is no extra whitespace here </Expression> <OverallResult success="false"/> </TestCase> - <TestCase name="When unchecked exceptions are thrown from functions they are always failures" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > + <TestCase name="When unchecked exceptions are thrown from functions they are always failures" tags="[!hide][!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > <Original> thisThrows() == 0 @@ -13751,7 +13792,7 @@ There is no extra whitespace here </Expression> <OverallResult success="false"/> </TestCase> - <TestCase name="When unchecked exceptions are thrown from sections they are always failures" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > + <TestCase name="When unchecked exceptions are thrown from sections they are always failures" tags="[!hide][!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > <Section name="section name" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > <Exception filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > unexpected exception @@ -13763,13 +13804,13 @@ There is no extra whitespace here <TestCase name="When unchecked exceptions are thrown, but caught, they do not affect the test" tags="[!throws]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > <OverallResult success="false"/> </TestCase> - <TestCase name="Where the LHS is not a simple value" tags="[.][Tricky][failing]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" > + <TestCase name="Where the LHS is not a simple value" tags="[!hide][.][Tricky][failing]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" > <Warning> Uncomment the code in this test to check that it gives a sensible compiler error </Warning> <OverallResult success="false"/> </TestCase> - <TestCase name="Where there is more to the expression after the RHS" tags="[.][Tricky][failing]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" > + <TestCase name="Where there is more to the expression after the RHS" tags="[!hide][.][Tricky][failing]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" > <Warning> Uncomment the code in this test to check that it gives a sensible compiler error </Warning> @@ -13900,6 +13941,33 @@ There is no extra whitespace here </Section> <OverallResult success="true"/> </TestCase> + <TestCase name="adding a hide tag implicitly enables all others" tags="[tags]" filename="projects/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Original> + testcase.tags, VectorContains(std::string(".")) && VectorContains(std::string("!hide")) + </Original> + <Expanded> + { "!hide", "." } ( Contains: "." and Contains: "!hide" ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Original> + testcase.tags, VectorContains(std::string(".")) && VectorContains(std::string("!hide")) + </Original> + <Expanded> + { "!hide", "." } ( Contains: "." and Contains: "!hide" ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Original> + testcase.tags, VectorContains(std::string(".")) && VectorContains(std::string("!hide")) + </Original> + <Expanded> + { "!hide", ".", "foo" } ( Contains: "." and Contains: "!hide" ) + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> <TestCase name="array<int, N> -> toString" tags="[array][containers][toString]" filename="projects/<exe-name>/UsageTests/ToStringVector.tests.cpp" > <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringVector.tests.cpp" > <Original> @@ -13968,7 +14036,7 @@ There is no extra whitespace here </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="checkedElse, failing" tags="[.][failing]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <TestCase name="checkedElse, failing" tags="[!hide][.][failing]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="false" type="CHECKED_ELSE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> flag @@ -14006,7 +14074,7 @@ There is no extra whitespace here </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="checkedIf, failing" tags="[.][failing]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <TestCase name="checkedIf, failing" tags="[!hide][.][failing]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="false" type="CHECKED_IF" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> flag @@ -14120,13 +14188,13 @@ There is no extra whitespace here loose text artifact <OverallResult success="false"/> </TestCase> - <TestCase name="just failure" tags="[.][fail][isolated info][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > + <TestCase name="just failure" tags="[!hide][.][fail][isolated info][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > <Failure filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > Previous info should not be seen </Failure> <OverallResult success="false"/> </TestCase> - <TestCase name="just failure after unscoped info" tags="[.][failing][info][unscoped]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > + <TestCase name="just failure after unscoped info" tags="[!hide][.][failing][info][unscoped]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > <Failure filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > previous unscoped info SHOULD not be seen </Failure> @@ -14151,7 +14219,7 @@ loose text artifact </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="looped SECTION tests" tags="[.][failing][sections]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <TestCase name="looped SECTION tests" tags="[!hide][.][failing][sections]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="b is currently: 0" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -14264,7 +14332,7 @@ loose text artifact </Section> <OverallResult success="false"/> </TestCase> - <TestCase name="looped tests" tags="[.][failing]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <TestCase name="looped tests" tags="[!hide][.][failing]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Info> Testing if fib[0] (1) is even </Info> @@ -14376,7 +14444,7 @@ loose text artifact </Warning> <OverallResult success="false"/> </TestCase> - <TestCase name="more nested SECTION tests" tags="[.][failing][sections]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <TestCase name="more nested SECTION tests" tags="[!hide][.][failing][sections]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="doesn't equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -14421,7 +14489,7 @@ loose text artifact </Section> <OverallResult success="false"/> </TestCase> - <TestCase name="nested SECTION tests" tags="[.][failing][sections]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <TestCase name="nested SECTION tests" tags="[!hide][.][failing][sections]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="doesn't equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -14465,7 +14533,7 @@ loose text artifact </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="non-copyable objects" tags="[.][failing]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" > + <TestCase name="non-copyable objects" tags="[!hide][.][failing]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" > <Original> ti == typeid(int) @@ -14479,7 +14547,7 @@ loose text artifact <TestCase name="not allowed" tags="[!throws]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <OverallResult success="true"/> </TestCase> - <TestCase name="not prints unscoped info from previous failures" tags="[.][failing][info][unscoped]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > + <TestCase name="not prints unscoped info from previous failures" tags="[!hide][.][failing][info][unscoped]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > <Info> this MAY be seen only for the FIRST assertion IF info is printed for passing assertions </Info> @@ -14651,7 +14719,7 @@ loose text artifact </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="prints unscoped info on failure" tags="[.][failing][info][unscoped]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > + <TestCase name="prints unscoped info on failure" tags="[!hide][.][failing][info][unscoped]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > <Info> this SHOULD be seen </Info> @@ -14668,7 +14736,7 @@ loose text artifact </Expression> <OverallResult success="false"/> </TestCase> - <TestCase name="prints unscoped info only for the first assertion" tags="[.][failing][info][unscoped]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > + <TestCase name="prints unscoped info only for the first assertion" tags="[!hide][.][failing][info][unscoped]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > <Info> this SHOULD be seen only ONCE </Info> @@ -14709,7 +14777,7 @@ loose text artifact </Expression> <OverallResult success="false"/> </TestCase> - <TestCase name="random SECTION tests" tags="[.][failing][sections]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <TestCase name="random SECTION tests" tags="[!hide][.][failing][sections]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Section name="doesn't equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -14881,7 +14949,7 @@ loose text artifact <TestCase name="second tag" tags="[tag2]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <OverallResult success="false"/> </TestCase> - <TestCase name="send a single char to INFO" tags="[.][failing]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > + <TestCase name="send a single char to INFO" tags="[!hide][.][failing]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Info> 3 </Info> @@ -14895,7 +14963,7 @@ loose text artifact </Expression> <OverallResult success="false"/> </TestCase> - <TestCase name="sends information to INFO" tags="[.][failing]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > + <TestCase name="sends information to INFO" tags="[!hide][.][failing]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > <Info> hi </Info> @@ -14918,7 +14986,7 @@ loose text artifact testcase.tags, Catch::VectorContains(std::string("magic-tag")) && Catch::VectorContains(std::string(".")) </Original> <Expanded> - { ".", "magic-tag" } ( Contains: "magic-tag" and Contains: "." ) + { "!hide", ".", "magic-tag" } ( Contains: "magic-tag" and Contains: "." ) </Expanded> </Expression> <OverallResult success="true"/> @@ -14950,7 +15018,7 @@ loose text artifact </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="stacks unscoped info in loops" tags="[.][failing][info][unscoped]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > + <TestCase name="stacks unscoped info in loops" tags="[!hide][.][failing][info][unscoped]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" > <Info> Count 1 to 3... </Info> @@ -15104,7 +15172,7 @@ loose text artifact </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="string literals of different sizes can be compared" tags="[.][Tricky][failing]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" > + <TestCase name="string literals of different sizes can be compared" tags="[!hide][.][Tricky][failing]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" > <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" > <Original> std::string( "first" ) == "second" @@ -15326,7 +15394,7 @@ loose text artifact </Expression> <OverallResult success="true"/> </TestCase> - <TestCase name="thrown std::strings are translated" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > + <TestCase name="thrown std::strings are translated" tags="[!hide][!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > <Exception filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > Why would you throw a std::string? </Exception> @@ -15844,7 +15912,7 @@ loose text artifact </Section> <OverallResult success="true"/> </TestCase> - <OverallResults successes="1507" failures="149" expectedFailures="21"/> + <OverallResults successes="1514" failures="149" expectedFailures="21"/> </Group> - <OverallResults successes="1507" failures="148" expectedFailures="21"/> + <OverallResults successes="1514" failures="148" expectedFailures="21"/> </Catch> diff --git a/packages/Catch2/projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp b/packages/Catch2/projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp index c1fd90e3a90aae0145667bca293aa79c4ccb38fc..641f1b2941552e8b74af96025572d97c44a907da 100644 --- a/packages/Catch2/projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp +++ b/packages/Catch2/projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp @@ -503,17 +503,23 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]" REQUIRE(config.benchmarkResamples == 20000); } - SECTION("resamples") { + SECTION("confidence-interval") { CHECK(cli.parse({ "test", "--benchmark-confidence-interval=0.99" })); REQUIRE(config.benchmarkConfidenceInterval == Catch::Detail::Approx(0.99)); } - SECTION("resamples") { + SECTION("no-analysis") { CHECK(cli.parse({ "test", "--benchmark-no-analysis" })); REQUIRE(config.benchmarkNoAnalysis); } + + SECTION("warmup-time") { + CHECK(cli.parse({ "test", "--benchmark-warmup-time=10" })); + + REQUIRE(config.benchmarkWarmupTime == 10); + } } } diff --git a/packages/Catch2/projects/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp b/packages/Catch2/projects/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp index 9cbe89310f3c3378d2b84a2fc79d9ce45b4d155a..549f35595ea1ed58c9a8acb5a577d8f698e70df3 100644 --- a/packages/Catch2/projects/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp +++ b/packages/Catch2/projects/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp @@ -181,7 +181,7 @@ TEST_CASE("Generators internals", "[generators][internals]") { const auto step = .1; auto gen = range(rangeStart, rangeEnd, step); - auto expected = rangeStart; + auto expected = rangeStart; while( (rangeEnd - expected) > step ) { INFO( "Current expected value is " << expected ) REQUIRE(gen.get() == Approx(expected)); @@ -198,7 +198,7 @@ TEST_CASE("Generators internals", "[generators][internals]") { const auto step = .3; auto gen = range(rangeStart, rangeEnd, step); - auto expected = rangeStart; + auto expected = rangeStart; while( (rangeEnd - expected) > step ) { INFO( "Current expected value is " << expected ) REQUIRE(gen.get() == Approx(expected)); @@ -214,7 +214,7 @@ TEST_CASE("Generators internals", "[generators][internals]") { const auto step = .3; auto gen = range(rangeStart, rangeEnd, step); - auto expected = rangeStart; + auto expected = rangeStart; while( (rangeEnd - expected) > step ) { INFO( "Current expected value is " << expected ) REQUIRE(gen.get() == Approx(expected)); @@ -223,7 +223,7 @@ TEST_CASE("Generators internals", "[generators][internals]") { expected += step; } REQUIRE_FALSE(gen.next()); - } + } } } SECTION("Negative manual step") { @@ -311,6 +311,21 @@ TEST_CASE("GENERATE capture macros", "[generators][internals][approvals]") { REQUIRE(value == value2); } +TEST_CASE("#1809 - GENERATE_COPY and SingleValueGenerator does not compile", "[generators][compilation][approvals]") { + // Verify Issue #1809 fix, only needs to compile. + auto a = GENERATE_COPY(1, 2); + (void)a; + auto b = GENERATE_COPY(as<long>{}, 1, 2); + (void)b; + int i = 1; + int j = 2; + auto c = GENERATE_COPY(i, j); + (void)c; + auto d = GENERATE_COPY(as<long>{}, i, j); + (void)d; + SUCCEED(); +} + TEST_CASE("Multiple random generators in one test case output different values", "[generators][internals][approvals]") { SECTION("Integer") { auto random1 = Catch::Generators::random(0, 1000); diff --git a/packages/Catch2/projects/SelfTest/IntrospectiveTests/Tag.tests.cpp b/packages/Catch2/projects/SelfTest/IntrospectiveTests/Tag.tests.cpp index 27958223bca98dfbba5616216801e56f0cb521b3..ae9114443f1b5a1930f5094045b04f76608c9690 100644 --- a/packages/Catch2/projects/SelfTest/IntrospectiveTests/Tag.tests.cpp +++ b/packages/Catch2/projects/SelfTest/IntrospectiveTests/Tag.tests.cpp @@ -45,3 +45,10 @@ TEST_CASE("shortened hide tags are split apart") { auto testcase = Catch::makeTestCase(nullptr, "", {"fake test name", "[.magic-tag]"}, CATCH_INTERNAL_LINEINFO); REQUIRE_THAT(testcase.tags, Catch::VectorContains(std::string("magic-tag")) && Catch::VectorContains(std::string("."))); } + +TEST_CASE("adding a hide tag implicitly enables all others", "[tags]") { + using Catch::VectorContains; + auto tag = GENERATE(as<char const*>{}, "[!hide]", "[.]", "[.foo]"); + auto testcase = Catch::makeTestCase(nullptr, "", {"fake test name", tag}, CATCH_INTERNAL_LINEINFO); + REQUIRE_THAT(testcase.tags, VectorContains(std::string(".")) && VectorContains(std::string("!hide"))); +} diff --git a/packages/Catch2/projects/SelfTest/UsageTests/Benchmark.tests.cpp b/packages/Catch2/projects/SelfTest/UsageTests/Benchmark.tests.cpp index 24fda0133b45281abb8d2dad34465e6ceb337d41..e795ddd1d2af911518ff021435b421bbed7dacd5 100644 --- a/packages/Catch2/projects/SelfTest/UsageTests/Benchmark.tests.cpp +++ b/packages/Catch2/projects/SelfTest/UsageTests/Benchmark.tests.cpp @@ -126,5 +126,19 @@ TEST_CASE("Benchmark containers", "[!benchmark]") { REQUIRE(v[i] == generated); } } + + SECTION("construct and destroy example") { + BENCHMARK_ADVANCED("construct")(Catch::Benchmark::Chronometer meter) { + std::vector<Catch::Benchmark::storage_for<std::string>> storage(meter.runs()); + meter.measure([&](int i) { storage[i].construct("thing"); }); + }; + + BENCHMARK_ADVANCED("destroy")(Catch::Benchmark::Chronometer meter) { + std::vector<Catch::Benchmark::destructable_object<std::string>> storage(meter.runs()); + for(auto&& o : storage) + o.construct("thing"); + meter.measure([&](int i) { storage[i].destruct(); }); + }; + } } #endif // CATCH_CONFIG_ENABLE_BENCHMARKING diff --git a/packages/Catch2/projects/SelfTest/UsageTests/Matchers.tests.cpp b/packages/Catch2/projects/SelfTest/UsageTests/Matchers.tests.cpp index 80e0420fe344741d82c1e97cce51a2a44ef49b7c..52f2912d7461e403d11e2040142b8f4350f727ed 100644 --- a/packages/Catch2/projects/SelfTest/UsageTests/Matchers.tests.cpp +++ b/packages/Catch2/projects/SelfTest/UsageTests/Matchers.tests.cpp @@ -552,6 +552,16 @@ namespace { namespace MatchersTests { REQUIRE_THROWS_MATCHES(throwsSpecialException(2), SpecialException, !Message("DerivedException::what")); REQUIRE_THROWS_MATCHES(throwsSpecialException(2), SpecialException, Message("SpecialException::what")); } + + TEST_CASE("Composed matchers are distinct", "[matchers][composed]") { + auto m1 = Contains("string"); + auto m2 = Contains("random"); + auto composed1 = m1 || m2; + auto m3 = Contains("different"); + auto composed2 = composed1 || m3; + REQUIRE_THAT(testStringForMatching2(), !composed1); + REQUIRE_THAT(testStringForMatching2(), composed2); + } } } // namespace MatchersTests diff --git a/packages/Catch2/projects/SelfTest/UsageTests/ToStringVector.tests.cpp b/packages/Catch2/projects/SelfTest/UsageTests/ToStringVector.tests.cpp index 63b49e502612593f8169213d7ec275982d6fcc8a..ea4d5c8628541ff2b38026a4a4f098a426f1cea7 100644 --- a/packages/Catch2/projects/SelfTest/UsageTests/ToStringVector.tests.cpp +++ b/packages/Catch2/projects/SelfTest/UsageTests/ToStringVector.tests.cpp @@ -17,9 +17,9 @@ TEST_CASE( "vector<string> -> toString", "[toString][vector]" ) { std::vector<std::string> vv; REQUIRE( ::Catch::Detail::stringify(vv) == "{ }" ); - vv.push_back( "hello" ); + vv.emplace_back( "hello" ); REQUIRE( ::Catch::Detail::stringify(vv) == "{ \"hello\" }" ); - vv.push_back( "world" ); + vv.emplace_back( "world" ); REQUIRE( ::Catch::Detail::stringify(vv) == "{ \"hello\", \"world\" }" ); } @@ -83,4 +83,4 @@ TEST_CASE( "array<int, N> -> toString", "[toString][containers][array]" ) { REQUIRE( Catch::Detail::stringify( oneValue ) == "{ 42 }" ); std::array<int, 2> twoValues = {{ 42, 250 }}; REQUIRE( Catch::Detail::stringify( twoValues ) == "{ 42, 250 }" ); -} \ No newline at end of file +} diff --git a/packages/Catch2/projects/SelfTest/UsageTests/Tricky.tests.cpp b/packages/Catch2/projects/SelfTest/UsageTests/Tricky.tests.cpp index 55fe6230a961721ea7df1519e898502e852bad1c..41d0adf47e9a492b5e14ce324b6f7c639ce236b1 100644 --- a/packages/Catch2/projects/SelfTest/UsageTests/Tricky.tests.cpp +++ b/packages/Catch2/projects/SelfTest/UsageTests/Tricky.tests.cpp @@ -17,7 +17,7 @@ #include "catch.hpp" -#include <stdio.h> +#include <cstdio> #include <sstream> #include <iostream> diff --git a/packages/Catch2/scripts/generateSingleHeader.py b/packages/Catch2/scripts/generateSingleHeader.py index f896877438530b3efe00a4fa1a8d84c653fd3ddf..ef14f5f157eb8ed1f4106d9bc0f27c460c4d697b 100755 --- a/packages/Catch2/scripts/generateSingleHeader.py +++ b/packages/Catch2/scripts/generateSingleHeader.py @@ -23,6 +23,7 @@ def generate(v): blankParser = re.compile( r'^\s*$') seenHeaders = set([]) + possibleHeaders = set([]) rootPath = os.path.join( catchPath, 'include/' ) outputPath = os.path.join( catchPath, 'single_include/catch2/catch.hpp' ) @@ -52,8 +53,20 @@ def generate(v): if globals['includeImpl'] or globals['implIfDefs'] == -1: out.write( line ) + def getDirsToSearch( ): + return [os.path.join( rootPath, s) for s in ['', 'internal', 'reporters', 'internal/benchmark', 'internal/benchmark/detail']] + + def collectPossibleHeaders(): + dirs = getDirsToSearch() + for dir in dirs: + hpps = glob(os.path.join(dir, '*.hpp')) + hs = glob(os.path.join(dir, '*.h')) + possibleHeaders.update( hpp.rpartition( os.sep )[2] for hpp in hpps ) + possibleHeaders.update( h.rpartition( os.sep )[2] for h in hs ) + + def insertCpps(): - dirs = [os.path.join( rootPath, s) for s in ['', 'internal', 'reporters', 'internal/benchmark', 'internal/benchmark/detail']] + dirs = getDirsToSearch() cppFiles = [] for dir in dirs: cppFiles += glob(os.path.join(dir, '*.cpp')) @@ -103,6 +116,13 @@ def generate(v): write( line.rstrip() + "\n" ) write( u'// end {}\n'.format(filename) ) + def warnUnparsedHeaders(): + unparsedHeaders = possibleHeaders.difference( seenHeaders ) + # These headers aren't packaged into the unified header, exclude them from any warning + whitelist = ['catch.hpp', 'catch_reporter_teamcity.hpp', 'catch_with_main.hpp', 'catch_reporter_automake.hpp', 'catch_reporter_tap.hpp', 'catch_reporter_sonarqube.hpp'] + unparsedHeaders = unparsedHeaders.difference( whitelist ) + if unparsedHeaders: + print( "WARNING: unparsed headers detected\n{0}\n".format( unparsedHeaders ) ) write( u"/*\n" ) write( u" * Catch v{0}\n".format( v.getVersionString() ) ) @@ -117,11 +137,13 @@ def generate(v): write( u"#ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" ) write( u"#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" ) + collectPossibleHeaders() parseFile( rootPath, 'catch.hpp' ) + warnUnparsedHeaders() write( u"#endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n\n" ) out.close() - print ("Generated single include for Catch v{0}\n".format( v.getVersionString() ) ) + print( "Generated single include for Catch v{0}\n".format( v.getVersionString() ) ) if __name__ == '__main__': diff --git a/packages/Catch2/single_include/catch2/catch.hpp b/packages/Catch2/single_include/catch2/catch.hpp index 1b9b06e17dd176bff69994fd942cb884789cf889..6c1756a6cef5bf87eacb7aba0f3575bab2e1ae18 100644 --- a/packages/Catch2/single_include/catch2/catch.hpp +++ b/packages/Catch2/single_include/catch2/catch.hpp @@ -1,6 +1,6 @@ /* - * Catch v2.10.2 - * Generated: 2019-10-24 17:49:11.459934 + * Catch v2.11.1 + * Generated: 2019-12-28 21:22:11.930976 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2019 Two Blue Cubes Ltd. All rights reserved. @@ -14,8 +14,8 @@ #define CATCH_VERSION_MAJOR 2 -#define CATCH_VERSION_MINOR 10 -#define CATCH_VERSION_PATCH 2 +#define CATCH_VERSION_MINOR 11 +#define CATCH_VERSION_PATCH 1 #ifdef __clang__ # pragma clang system_header @@ -136,38 +136,34 @@ namespace Catch { # define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS #endif -#ifdef __clang__ +// We have to avoid both ICC and Clang, because they try to mask themselves +// as gcc, and we want only GCC in this block +#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) +# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic push" ) +# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic pop" ) +#endif + +#if defined(__clang__) + +# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic push" ) +# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic pop" ) + +# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) \ + _Pragma( "clang diagnostic ignored \"-Wglobal-constructors\"") + +# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wparentheses\"" ) + +# define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wunused-variable\"" ) + +# define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wgnu-zero-variadic-macro-arguments\"" ) + +# define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wunused-template\"" ) -# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ - _Pragma( "clang diagnostic push" ) \ - _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) \ - _Pragma( "clang diagnostic ignored \"-Wglobal-constructors\"") -# define CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ - _Pragma( "clang diagnostic pop" ) - -# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ - _Pragma( "clang diagnostic push" ) \ - _Pragma( "clang diagnostic ignored \"-Wparentheses\"" ) -# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \ - _Pragma( "clang diagnostic pop" ) - -# define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \ - _Pragma( "clang diagnostic push" ) \ - _Pragma( "clang diagnostic ignored \"-Wunused-variable\"" ) -# define CATCH_INTERNAL_UNSUPPRESS_UNUSED_WARNINGS \ - _Pragma( "clang diagnostic pop" ) - -# define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ - _Pragma( "clang diagnostic push" ) \ - _Pragma( "clang diagnostic ignored \"-Wgnu-zero-variadic-macro-arguments\"" ) -# define CATCH_INTERNAL_UNSUPPRESS_ZERO_VARIADIC_WARNINGS \ - _Pragma( "clang diagnostic pop" ) - -# define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ - _Pragma( "clang diagnostic push" ) \ - _Pragma( "clang diagnostic ignored \"-Wunused-template\"" ) -# define CATCH_INTERNAL_UNSUPPRESS_UNUSED_TEMPLATE_WARNINGS \ - _Pragma( "clang diagnostic pop" ) #endif // __clang__ //////////////////////////////////////////////////////////////////////////////// @@ -225,7 +221,10 @@ namespace Catch { //////////////////////////////////////////////////////////////////////////////// // Visual C++ -#ifdef _MSC_VER +#if defined(_MSC_VER) + +# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma( warning(push) ) +# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION __pragma( warning(pop) ) # if _MSC_VER >= 1900 // Visual Studio 2015 or newer # define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS @@ -242,9 +241,12 @@ namespace Catch { // MSVC traditional preprocessor needs some workaround for __VA_ARGS__ // _MSVC_TRADITIONAL == 0 means new conformant preprocessor // _MSVC_TRADITIONAL == 1 means old traditional non-conformant preprocessor -# if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL) -# define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -# endif +# if !defined(__clang__) // Handle Clang masquerading for msvc +# if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL) +# define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +# endif // MSVC_TRADITIONAL +# endif // __clang__ + #endif // _MSC_VER #if defined(_REENTRANT) || defined(_MSC_VER) @@ -397,34 +399,35 @@ namespace Catch { # define CATCH_CONFIG_GLOBAL_NEXTAFTER #endif +// Even if we do not think the compiler has that warning, we still have +// to provide a macro that can be used by the code. +#if !defined(CATCH_INTERNAL_START_WARNINGS_SUPPRESSION) +# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION +#endif +#if !defined(CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION) +# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION +#endif #if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS) # define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS -# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS #endif #if !defined(CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS) # define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS -# define CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS #endif #if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS) # define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS -# define CATCH_INTERNAL_UNSUPPRESS_UNUSED_WARNINGS #endif #if !defined(CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS) # define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS -# define CATCH_INTERNAL_UNSUPPRESS_ZERO_VARIADIC_WARNINGS #endif #if defined(__APPLE__) && defined(__apple_build_version__) && (__clang_major__ < 10) # undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS -# undef CATCH_INTERNAL_UNSUPPRESS_UNUSED_TEMPLATE_WARNINGS #elif defined(__clang__) && (__clang_major__ < 5) # undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS -# undef CATCH_INTERNAL_UNSUPPRESS_UNUSED_TEMPLATE_WARNINGS #endif #if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS) # define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS -# define CATCH_INTERNAL_UNSUPPRESS_UNUSED_TEMPLATE_WARNINGS #endif #if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) @@ -530,9 +533,10 @@ namespace Catch { } // end namespace Catch #define CATCH_REGISTER_TAG_ALIAS( alias, spec ) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ namespace{ Catch::RegistrarForTagAliases INTERNAL_CATCH_UNIQUE_NAME( AutoRegisterTagAlias )( alias, spec, CATCH_INTERNAL_LINEINFO ); } \ - CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION // end catch_tag_alias_autoregistrar.h // start catch_test_registry.h @@ -578,49 +582,24 @@ namespace Catch { /// A non-owning string class (similar to the forthcoming std::string_view) /// Note that, because a StringRef may be a substring of another string, - /// it may not be null terminated. c_str() must return a null terminated - /// string, however, and so the StringRef will internally take ownership - /// (taking a copy), if necessary. In theory this ownership is not externally - /// visible - but it does mean (substring) StringRefs should not be shared between - /// threads. + /// it may not be null terminated. class StringRef { public: using size_type = std::size_t; using const_iterator = const char*; private: - friend struct StringRefTestAccess; - - char const* m_start; - size_type m_size; - - char* m_data = nullptr; - - void takeOwnership(); - static constexpr char const* const s_empty = ""; - public: // construction/ assignment - StringRef() noexcept - : StringRef( s_empty, 0 ) - {} + char const* m_start = s_empty; + size_type m_size = 0; - StringRef( StringRef const& other ) noexcept - : m_start( other.m_start ), - m_size( other.m_size ) - {} - - StringRef( StringRef&& other ) noexcept - : m_start( other.m_start ), - m_size( other.m_size ), - m_data( other.m_data ) - { - other.m_data = nullptr; - } + public: // construction + constexpr StringRef() noexcept = default; StringRef( char const* rawChars ) noexcept; - StringRef( char const* rawChars, size_type size ) noexcept + constexpr StringRef( char const* rawChars, size_type size ) noexcept : m_start( rawChars ), m_size( size ) {} @@ -630,27 +609,15 @@ namespace Catch { m_size( stdString.size() ) {} - ~StringRef() noexcept { - delete[] m_data; - } - - auto operator = ( StringRef const &other ) noexcept -> StringRef& { - delete[] m_data; - m_data = nullptr; - m_start = other.m_start; - m_size = other.m_size; - return *this; - } - explicit operator std::string() const { return std::string(m_start, m_size); } - void swap( StringRef& other ) noexcept; - public: // operators auto operator == ( StringRef const& other ) const noexcept -> bool; - auto operator != ( StringRef const& other ) const noexcept -> bool; + auto operator != (StringRef const& other) const noexcept -> bool { + return !(*this == other); + } auto operator[] ( size_type index ) const noexcept -> char { assert(index < m_size); @@ -658,41 +625,44 @@ namespace Catch { } public: // named queries - auto empty() const noexcept -> bool { + constexpr auto empty() const noexcept -> bool { return m_size == 0; } - auto size() const noexcept -> size_type { + constexpr auto size() const noexcept -> size_type { return m_size; } + // Returns the current start pointer. If the StringRef is not + // null-terminated, throws std::domain_exception auto c_str() const -> char const*; public: // substrings and searches - auto substr( size_type start, size_type size ) const noexcept -> StringRef; + // Returns a substring of [start, start + length). + // If start + length > size(), then the substring is [start, size()). + // If start > size(), then the substring is empty. + auto substr( size_type start, size_type length ) const noexcept -> StringRef; - // Returns the current start pointer. - // Note that the pointer can change when if the StringRef is a substring - auto currentData() const noexcept -> char const*; + // Returns the current start pointer. May not be null-terminated. + auto data() const noexcept -> char const*; - public: // iterators - const_iterator begin() const { return m_start; } - const_iterator end() const { return m_start + m_size; } + constexpr auto isNullTerminated() const noexcept -> bool { + return m_start[m_size] == '\0'; + } - private: // ownership queries - may not be consistent between calls - auto isOwned() const noexcept -> bool; - auto isSubstring() const noexcept -> bool; + public: // iterators + constexpr const_iterator begin() const { return m_start; } + constexpr const_iterator end() const { return m_start + m_size; } }; auto operator += ( std::string& lhs, StringRef const& sr ) -> std::string&; auto operator << ( std::ostream& os, StringRef const& sr ) -> std::ostream&; - inline auto operator "" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef { + constexpr auto operator "" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef { return StringRef( rawChars, size ); } - } // namespace Catch -inline auto operator "" _catch_sr( char const* rawChars, std::size_t size ) noexcept -> Catch::StringRef { +constexpr auto operator "" _catch_sr( char const* rawChars, std::size_t size ) noexcept -> Catch::StringRef { return Catch::StringRef( rawChars, size ); } @@ -931,22 +901,33 @@ inline auto operator "" _catch_sr( char const* rawChars, std::size_t size ) noex #include <type_traits> namespace Catch { -template<typename T> -struct always_false : std::false_type {}; + template<typename T> + struct always_false : std::false_type {}; + + template <typename> struct true_given : std::true_type {}; + struct is_callable_tester { + template <typename Fun, typename... Args> + true_given<decltype(std::declval<Fun>()(std::declval<Args>()...))> static test(int); + template <typename...> + std::false_type static test(...); + }; -template <typename> struct true_given : std::true_type {}; -struct is_callable_tester { - template <typename Fun, typename... Args> - true_given<decltype(std::declval<Fun>()(std::declval<Args>()...))> static test(int); - template <typename...> - std::false_type static test(...); -}; + template <typename T> + struct is_callable; -template <typename T> -struct is_callable; + template <typename Fun, typename... Args> + struct is_callable<Fun(Args...)> : decltype(is_callable_tester::test<Fun, Args...>(0)) {}; -template <typename Fun, typename... Args> -struct is_callable<Fun(Args...)> : decltype(is_callable_tester::test<Fun, Args...>(0)) {}; +#if defined(__cpp_lib_is_invocable) && __cpp_lib_is_invocable >= 201703 + // std::result_of is deprecated in C++17 and removed in C++20. Hence, it is + // replaced with std::invoke_result here. Also *_t format is preferred over + // typename *::type format. + template <typename Func, typename U> + using FunctionReturnType = std::remove_reference_t<std::remove_cv_t<std::invoke_result_t<Func, U>>>; +#else + template <typename Func, typename U> + using FunctionReturnType = typename std::remove_reference<typename std::remove_cv<typename std::result_of<Func(U)>::type>::type>::type; +#endif } // namespace Catch @@ -1045,21 +1026,24 @@ struct AutoReg : NonCopyable { /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \ static void TestName(); \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &TestName ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \ - CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ static void TestName() #define INTERNAL_CATCH_TESTCASE( ... ) \ INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), __VA_ARGS__ ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &QualifiedMethod ), CATCH_INTERNAL_LINEINFO, "&" #QualifiedMethod, Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \ - CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ namespace{ \ struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) { \ @@ -1067,19 +1051,21 @@ struct AutoReg : NonCopyable { }; \ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( Catch::makeTestInvoker( &TestName::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \ } \ - CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ void TestName::test() #define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... ) \ INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, __VA_ARGS__ ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( Function ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \ - CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_2(TestName, TestFunc, Name, Tags, Signature, ... )\ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ @@ -1104,9 +1090,7 @@ struct AutoReg : NonCopyable { }();\ }\ }\ - CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ - CATCH_INTERNAL_UNSUPPRESS_ZERO_VARIADIC_WARNINGS \ - CATCH_INTERNAL_UNSUPPRESS_UNUSED_TEMPLATE_WARNINGS \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ INTERNAL_CATCH_DEFINE_SIG_TEST(TestFunc,INTERNAL_CATCH_REMOVE_PARENS(Signature)) #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR @@ -1126,9 +1110,10 @@ struct AutoReg : NonCopyable { #endif #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(TestName, TestFuncName, Name, Tags, Signature, TmplTypes, TypesList) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ - CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ template<typename TestType> static void TestFuncName(); \ namespace {\ namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) { \ @@ -1153,9 +1138,7 @@ struct AutoReg : NonCopyable { }(); \ } \ } \ - CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ - CATCH_INTERNAL_UNSUPPRESS_ZERO_VARIADIC_WARNINGS \ - CATCH_INTERNAL_UNSUPPRESS_UNUSED_TEMPLATE_WARNINGS \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ template<typename TestType> \ static void TestFuncName() @@ -1176,6 +1159,7 @@ struct AutoReg : NonCopyable { #endif #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2(TestName, TestFunc, Name, Tags, TmplList)\ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ template<typename TestType> static void TestFunc(); \ @@ -1195,10 +1179,9 @@ struct AutoReg : NonCopyable { TestInit t; \ t.reg_tests(); \ return 0; \ - }(); \ + }(); \ }}\ - CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ - CATCH_INTERNAL_UNSUPPRESS_UNUSED_TEMPLATE_WARNINGS \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ template<typename TestType> \ static void TestFunc() @@ -1206,6 +1189,7 @@ struct AutoReg : NonCopyable { INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, TmplList ) #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, Signature, ... ) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ @@ -1230,9 +1214,7 @@ struct AutoReg : NonCopyable { }();\ }\ }\ - CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS\ - CATCH_INTERNAL_UNSUPPRESS_ZERO_VARIADIC_WARNINGS\ - CATCH_INTERNAL_UNSUPPRESS_UNUSED_TEMPLATE_WARNINGS\ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature)) #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR @@ -1252,6 +1234,7 @@ struct AutoReg : NonCopyable { #endif #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2(TestNameClass, TestName, ClassName, Name, Tags, Signature, TmplTypes, TypesList)\ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ @@ -1282,9 +1265,7 @@ struct AutoReg : NonCopyable { }(); \ }\ }\ - CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ - CATCH_INTERNAL_UNSUPPRESS_ZERO_VARIADIC_WARNINGS \ - CATCH_INTERNAL_UNSUPPRESS_UNUSED_TEMPLATE_WARNINGS \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ template<typename TestType> \ void TestName<TestType>::test() @@ -1305,6 +1286,7 @@ struct AutoReg : NonCopyable { #endif #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, TmplList) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ template<typename TestType> \ @@ -1329,8 +1311,7 @@ struct AutoReg : NonCopyable { return 0;\ }(); \ }}\ - CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ - CATCH_INTERNAL_UNSUPPRESS_UNUSED_TEMPLATE_WARNINGS \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ template<typename TestType> \ void TestName<TestType>::test() @@ -1436,7 +1417,7 @@ namespace Catch { auto makeStream( StringRef const &filename ) -> IStream const*; - class ReusableStringStream { + class ReusableStringStream : NonCopyable { std::size_t m_index; std::ostream* m_oss; public: @@ -2684,9 +2665,10 @@ namespace Catch { do { \ Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \ INTERNAL_CATCH_TRY { \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ catchAssertionHandler.handleExpr( Catch::Decomposer() <= __VA_ARGS__ ); \ - CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \ INTERNAL_CATCH_REACT( catchAssertionHandler ) \ } while( (void)0, (false) && static_cast<bool>( !!(__VA_ARGS__) ) ) // the expression here is never evaluated at runtime but it forces the compiler to give it a look @@ -2907,14 +2889,16 @@ namespace Catch { } // end namespace Catch #define INTERNAL_CATCH_SECTION( ... ) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \ if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) ) \ - CATCH_INTERNAL_UNSUPPRESS_UNUSED_WARNINGS + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION #define INTERNAL_CATCH_DYNAMIC_SECTION( ... ) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \ if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, (Catch::ReusableStringStream() << __VA_ARGS__).str() ) ) \ - CATCH_INTERNAL_UNSUPPRESS_UNUSED_WARNINGS + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION // end catch_section.h // start catch_interfaces_exception.h @@ -3032,9 +3016,10 @@ namespace Catch { /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_TRANSLATE_EXCEPTION2( translatorName, signature ) \ static std::string translatorName( signature ); \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ namespace{ Catch::ExceptionTranslatorRegistrar INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionRegistrar )( &translatorName ); } \ - CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ static std::string translatorName( signature ) #define INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION2( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature ) @@ -3925,7 +3910,6 @@ namespace Generators { class SingleValueGenerator final : public IGenerator<T> { T m_value; public: - SingleValueGenerator(T const& value) : m_value( value ) {} SingleValueGenerator(T&& value) : m_value(std::move(value)) {} T const& get() const override { @@ -3988,21 +3972,21 @@ namespace Generators { m_generators.emplace_back(std::move(generator)); } void populate(T&& val) { - m_generators.emplace_back(value(std::move(val))); + m_generators.emplace_back(value(std::forward<T>(val))); } template<typename U> void populate(U&& val) { - populate(T(std::move(val))); + populate(T(std::forward<U>(val))); } template<typename U, typename... Gs> - void populate(U&& valueOrGenerator, Gs... moreGenerators) { + void populate(U&& valueOrGenerator, Gs &&... moreGenerators) { populate(std::forward<U>(valueOrGenerator)); populate(std::forward<Gs>(moreGenerators)...); } public: template <typename... Gs> - Generators(Gs... moreGenerators) { + Generators(Gs &&... moreGenerators) { m_generators.reserve(sizeof...(Gs)); populate(std::forward<Gs>(moreGenerators)...); } @@ -4033,7 +4017,7 @@ namespace Generators { struct as {}; template<typename T, typename... Gs> - auto makeGenerators( GeneratorWrapper<T>&& generator, Gs... moreGenerators ) -> Generators<T> { + auto makeGenerators( GeneratorWrapper<T>&& generator, Gs &&... moreGenerators ) -> Generators<T> { return Generators<T>(std::move(generator), std::forward<Gs>(moreGenerators)...); } template<typename T> @@ -4041,11 +4025,11 @@ namespace Generators { return Generators<T>(std::move(generator)); } template<typename T, typename... Gs> - auto makeGenerators( T&& val, Gs... moreGenerators ) -> Generators<T> { + auto makeGenerators( T&& val, Gs &&... moreGenerators ) -> Generators<T> { return makeGenerators( value( std::forward<T>( val ) ), std::forward<Gs>( moreGenerators )... ); } template<typename T, typename U, typename... Gs> - auto makeGenerators( as<T>, U&& val, Gs... moreGenerators ) -> Generators<T> { + auto makeGenerators( as<T>, U&& val, Gs &&... moreGenerators ) -> Generators<T> { return makeGenerators( value( T( std::forward<U>( val ) ) ), std::forward<Gs>( moreGenerators )... ); } @@ -4071,11 +4055,11 @@ namespace Generators { } // namespace Catch #define GENERATE( ... ) \ - Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [ ]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) + Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [ ]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace) #define GENERATE_COPY( ... ) \ - Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [=]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) + Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [=]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace) #define GENERATE_REF( ... ) \ - Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [&]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) + Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [&]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace) // end catch_generators.hpp // start catch_generators_generic.hpp @@ -4241,18 +4225,7 @@ namespace Generators { } }; -#if defined(__cpp_lib_is_invocable) && __cpp_lib_is_invocable >= 201703 - // std::result_of is deprecated in C++17 and removed in C++20. Hence, it is - // replaced with std::invoke_result here. Also *_t format is preferred over - // typename *::type format. - template <typename Func, typename U> - using MapFunctionReturnType = std::remove_reference_t<std::remove_cv_t<std::invoke_result_t<Func, U>>>; -#else - template <typename Func, typename U> - using MapFunctionReturnType = typename std::remove_reference<typename std::remove_cv<typename std::result_of<Func(U)>::type>::type>::type; -#endif - - template <typename Func, typename U, typename T = MapFunctionReturnType<Func, U>> + template <typename Func, typename U, typename T = FunctionReturnType<Func, U>> GeneratorWrapper<T> map(Func&& function, GeneratorWrapper<U>&& generator) { return GeneratorWrapper<T>( pf::make_unique<MapGenerator<T, U, Func>>(std::forward<Func>(function), std::move(generator)) @@ -4668,7 +4641,7 @@ public: template <typename T> GeneratorWrapper<T> range(T const& start, T const& end, T const& step) { - static_assert(std::is_integral<T>::value && !std::is_same<T, bool>::value, "Type must be an integer"); + static_assert(std::is_arithmetic<T>::value && !std::is_same<T, bool>::value, "Type must be numeric"); return GeneratorWrapper<T>(pf::make_unique<RangeGenerator<T>>(start, end, step)); } @@ -5203,27 +5176,12 @@ namespace Catch { void addFilter(); bool separate(); - template<typename T> - void addPattern() { - 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 ); - } - if( !token.empty() ) { - TestSpec::PatternPtr pattern = std::make_shared<T>( token, m_substring ); - if( m_exclusion ) - pattern = std::make_shared<TestSpec::ExcludedPattern>( pattern ); - m_currentFilter.m_patterns.push_back( pattern ); - } - m_substring.clear(); - m_patternName.clear(); - m_exclusion = false; - m_mode = None; - } + // Handles common preprocessing of the pattern for name/tag patterns + std::string preprocessPattern(); + // Adds the current pattern as a test name + void addNamePattern(); + // Adds the current pattern as a tag + void addTagPattern(); inline void addCharToPattern(char c) { m_substring += c; @@ -6068,14 +6026,16 @@ namespace Catch { #if !defined(CATCH_CONFIG_DISABLE) #define CATCH_REGISTER_REPORTER( name, reporterType ) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ namespace{ Catch::ReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name ); } \ - CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION #define CATCH_REGISTER_LISTENER( listenerType ) \ - CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ namespace{ Catch::ListenerRegistrar<listenerType> catch_internal_RegistrarFor##listenerType; } \ - CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION #else // CATCH_CONFIG_DISABLE #define CATCH_REGISTER_REPORTER(name, reporterType) @@ -6198,6 +6158,14 @@ namespace Catch { #include <vector> namespace Catch { + enum class XmlFormatting { + None = 0x00, + Indent = 0x01, + Newline = 0x02, + }; + + XmlFormatting operator | (XmlFormatting lhs, XmlFormatting rhs); + XmlFormatting operator & (XmlFormatting lhs, XmlFormatting rhs); class XmlEncode { public: @@ -6219,14 +6187,14 @@ namespace Catch { class ScopedElement { public: - ScopedElement( XmlWriter* writer ); + ScopedElement( XmlWriter* writer, XmlFormatting fmt ); ScopedElement( ScopedElement&& other ) noexcept; ScopedElement& operator=( ScopedElement&& other ) noexcept; ~ScopedElement(); - ScopedElement& writeText( std::string const& text, bool indent = true ); + ScopedElement& writeText( std::string const& text, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent ); template<typename T> ScopedElement& writeAttribute( std::string const& name, T const& attribute ) { @@ -6236,6 +6204,7 @@ namespace Catch { private: mutable XmlWriter* m_writer = nullptr; + XmlFormatting m_fmt; }; XmlWriter( std::ostream& os = Catch::cout() ); @@ -6244,11 +6213,11 @@ namespace Catch { XmlWriter( XmlWriter const& ) = delete; XmlWriter& operator=( XmlWriter const& ) = delete; - XmlWriter& startElement( std::string const& name ); + XmlWriter& startElement( std::string const& name, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent); - ScopedElement scopedElement( std::string const& name ); + ScopedElement scopedElement( std::string const& name, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent); - XmlWriter& endElement(); + XmlWriter& endElement(XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent); XmlWriter& writeAttribute( std::string const& name, std::string const& attribute ); @@ -6261,9 +6230,9 @@ namespace Catch { return writeAttribute( name, rss.str() ); } - XmlWriter& writeText( std::string const& text, bool indent = true ); + XmlWriter& writeText( std::string const& text, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent); - XmlWriter& writeComment( std::string const& text ); + XmlWriter& writeComment(std::string const& text, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent); void writeStylesheetRef( std::string const& url ); @@ -6273,6 +6242,8 @@ namespace Catch { private: + void applyFormatting(XmlFormatting fmt); + void writeDeclaration(); void newlineIfNecessary(); @@ -6394,6 +6365,12 @@ namespace Catch { #endif #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) +// start catch_benchmarking_all.hpp + +// A proxy header that includes all of the benchmarking headers to allow +// concise include of the benchmarking features. You should prefer the +// individual includes in standard use. + // start catch_benchmark.hpp // Benchmark @@ -7296,7 +7273,7 @@ namespace Catch { }); auto analysis = Detail::analyse(*cfg, env, samples.begin(), samples.end()); - BenchmarkStats<std::chrono::duration<double, std::nano>> stats{ info, analysis.samples, analysis.mean, analysis.standard_deviation, analysis.outliers, analysis.outlier_variance }; + BenchmarkStats<FloatDuration<Clock>> stats{ info, analysis.samples, analysis.mean, analysis.standard_deviation, analysis.outliers, analysis.outlier_variance }; getResultCapture().benchmarkEnded(stats); } CATCH_CATCH_ALL{ @@ -7337,6 +7314,77 @@ namespace Catch { BenchmarkName = [&] // end catch_benchmark.hpp +// start catch_constructor.hpp + +// Constructor and destructor helpers + + +#include <type_traits> + +namespace Catch { + namespace Benchmark { + namespace Detail { + template <typename T, bool Destruct> + struct ObjectStorage + { + using TStorage = typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type; + + ObjectStorage() : data() {} + + ObjectStorage(const ObjectStorage& other) + { + new(&data) T(other.stored_object()); + } + + ObjectStorage(ObjectStorage&& other) + { + new(&data) T(std::move(other.stored_object())); + } + + ~ObjectStorage() { destruct_on_exit<T>(); } + + template <typename... Args> + void construct(Args&&... args) + { + new (&data) T(std::forward<Args>(args)...); + } + + template <bool AllowManualDestruction = !Destruct> + typename std::enable_if<AllowManualDestruction>::type destruct() + { + stored_object().~T(); + } + + private: + // If this is a constructor benchmark, destruct the underlying object + template <typename U> + void destruct_on_exit(typename std::enable_if<Destruct, U>::type* = 0) { destruct<true>(); } + // Otherwise, don't + template <typename U> + void destruct_on_exit(typename std::enable_if<!Destruct, U>::type* = 0) { } + + T& stored_object() { + return *static_cast<T*>(static_cast<void*>(&data)); + } + + T const& stored_object() const { + return *static_cast<T*>(static_cast<void*>(&data)); + } + + TStorage data; + }; + } + + template <typename T> + using storage_for = Detail::ObjectStorage<T, true>; + + template <typename T> + using destructable_object = Detail::ObjectStorage<T, false>; + } +} + +// end catch_constructor.hpp +// end catch_benchmarking_all.hpp #endif #endif // ! CATCH_CONFIG_IMPL_ONLY @@ -7675,9 +7723,10 @@ namespace Catch { } bootstrap_analysis analyse_samples(double confidence_level, int n_resamples, std::vector<double>::iterator first, std::vector<double>::iterator last) { + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS static std::random_device entropy; - CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION auto n = static_cast<int>(last - first); // seriously, one can't use integral types without hell in C++ @@ -7812,6 +7861,17 @@ namespace Catch { #define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */ +#elif defined(CATCH_PLATFORM_IPHONE) + + // use inline assembler + #if defined(__i386__) || defined(__x86_64__) + #define CATCH_TRAP() __asm__("int $3") + #elif defined(__aarch64__) + #define CATCH_TRAP() __asm__(".inst 0xd4200000") + #elif defined(__arm__) + #define CATCH_TRAP() __asm__(".inst 0xe7f001f0") + #endif + #elif defined(CATCH_PLATFORM_LINUX) // If we can use inline assembler, do it because this allows us to break // directly at the location of the failing check instead of breaking inside @@ -10052,7 +10112,7 @@ namespace { bool useColourOnPlatform() { return -#ifdef CATCH_PLATFORM_MAC +#if defined(CATCH_PLATFORM_MAC) || defined(CATCH_PLATFORM_IPHONE) !isDebuggerActive() && #endif #if !(defined(__DJGPP__) && defined(__STRICT_ANSI__)) @@ -10229,7 +10289,7 @@ namespace Catch { // end catch_debug_console.cpp // start catch_debugger.cpp -#ifdef CATCH_PLATFORM_MAC +#if defined(CATCH_PLATFORM_MAC) || defined(CATCH_PLATFORM_IPHONE) # include <assert.h> # include <stdbool.h> @@ -13623,11 +13683,7 @@ namespace Catch { // end catch_string_manip.cpp // start catch_stringref.cpp -#if defined(__clang__) -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wexit-time-destructors" -#endif - +#include <algorithm> #include <ostream> #include <cstring> #include <cstdint> @@ -13637,66 +13693,36 @@ namespace Catch { : StringRef( rawChars, static_cast<StringRef::size_type>(std::strlen(rawChars) ) ) {} - void StringRef::swap( StringRef& other ) noexcept { - std::swap( m_start, other.m_start ); - std::swap( m_size, other.m_size ); - std::swap( m_data, other.m_data ); - } - auto StringRef::c_str() const -> char const* { - if( !isSubstring() ) - return m_start; - - const_cast<StringRef *>( this )->takeOwnership(); - return m_data; - } - auto StringRef::currentData() const noexcept -> char const* { + CATCH_ENFORCE(isNullTerminated(), "Called StringRef::c_str() on a non-null-terminated instance"); return m_start; } - - auto StringRef::isOwned() const noexcept -> bool { - return m_data != nullptr; - } - auto StringRef::isSubstring() const noexcept -> bool { - return m_start[m_size] != '\0'; + auto StringRef::data() const noexcept -> char const* { + return m_start; } - void StringRef::takeOwnership() { - if( !isOwned() ) { - m_data = new char[m_size+1]; - memcpy( m_data, m_start, m_size ); - m_data[m_size] = '\0'; - } - } auto StringRef::substr( size_type start, size_type size ) const noexcept -> StringRef { - if( start < m_size ) - return StringRef( m_start+start, size ); - else + if (start < m_size) { + return StringRef(m_start + start, (std::min)(m_size - start, size)); + } else { return StringRef(); + } } auto StringRef::operator == ( StringRef const& other ) const noexcept -> bool { - return - size() == other.size() && - (std::strncmp( m_start, other.m_start, size() ) == 0); - } - auto StringRef::operator != ( StringRef const& other ) const noexcept -> bool { - return !operator==( other ); + return m_size == other.m_size + && (std::memcmp( m_start, other.m_start, m_size ) == 0); } auto operator << ( std::ostream& os, StringRef const& str ) -> std::ostream& { - return os.write(str.currentData(), str.size()); + return os.write(str.data(), str.size()); } auto operator+=( std::string& lhs, StringRef const& rhs ) -> std::string& { - lhs.append(rhs.currentData(), rhs.size()); + lhs.append(rhs.data(), rhs.size()); return lhs; } } // namespace Catch - -#if defined(__clang__) -# pragma clang diagnostic pop -#endif // end catch_stringref.cpp // start catch_tag_alias.cpp @@ -14499,9 +14525,9 @@ namespace Catch { switch( m_mode ) { case Name: case QuotedName: - return addPattern<TestSpec::NamePattern>(); + return addNamePattern(); case Tag: - return addPattern<TestSpec::TagPattern>(); + return addTagPattern(); case EscapedName: revertBackToLastMode(); return; @@ -14561,6 +14587,62 @@ namespace Catch { 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); + } + + m_patternName.clear(); + + return token; + } + + void TestSpecParser::addNamePattern() { + auto token = preprocessPattern(); + + if (!token.empty()) { + TestSpec::PatternPtr pattern = std::make_shared<TestSpec::NamePattern>(token, m_substring); + if (m_exclusion) + pattern = std::make_shared<TestSpec::ExcludedPattern>(pattern); + m_currentFilter.m_patterns.push_back(pattern); + } + m_substring.clear(); + m_exclusion = false; + m_mode = None; + } + + void TestSpecParser::addTagPattern() { + auto token = preprocessPattern(); + + 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()); + TestSpec::PatternPtr pattern = std::make_shared<TestSpec::TagPattern>(".", m_substring); + if (m_exclusion) { + pattern = std::make_shared<TestSpec::ExcludedPattern>(pattern); + } + m_currentFilter.m_patterns.push_back(pattern); + } + + TestSpec::PatternPtr pattern = std::make_shared<TestSpec::TagPattern>(token, m_substring); + + if (m_exclusion) { + pattern = std::make_shared<TestSpec::ExcludedPattern>(pattern); + } + m_currentFilter.m_patterns.push_back(pattern); + } + m_substring.clear(); + m_exclusion = false; + m_mode = None; + } + TestSpec parseTestSpec( std::string const& arg ) { return TestSpecParser( ITagAliasRegistry::get() ).parse( arg ).testSpec(); } @@ -14662,13 +14744,11 @@ namespace Detail { enum Arch { Big, Little }; static Arch which() { - union _{ - int asInt; - char asChar[sizeof (int)]; - } u; - - u.asInt = 1; - return ( u.asChar[sizeof(int)-1] == 1 ) ? Big : Little; + 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; } }; } @@ -14988,7 +15068,7 @@ namespace Catch { } Version const& libraryVersion() { - static Version version( 2, 10, 2, "", 0 ); + static Version version( 2, 11, 1, "", 0 ); return version; } @@ -15036,6 +15116,7 @@ namespace Catch { // start catch_xmlwriter.cpp #include <iomanip> +#include <type_traits> using uchar = unsigned char; @@ -15077,8 +15158,30 @@ namespace { os.flags(f); } + bool shouldNewline(XmlFormatting fmt) { + return !!(static_cast<std::underlying_type<XmlFormatting>::type>(fmt & XmlFormatting::Newline)); + } + + bool shouldIndent(XmlFormatting fmt) { + return !!(static_cast<std::underlying_type<XmlFormatting>::type>(fmt & XmlFormatting::Indent)); + } + } // anonymous namespace + XmlFormatting operator | (XmlFormatting lhs, XmlFormatting rhs) { + return static_cast<XmlFormatting>( + static_cast<std::underlying_type<XmlFormatting>::type>(lhs) | + static_cast<std::underlying_type<XmlFormatting>::type>(rhs) + ); + } + + XmlFormatting operator & (XmlFormatting lhs, XmlFormatting rhs) { + return static_cast<XmlFormatting>( + static_cast<std::underlying_type<XmlFormatting>::type>(lhs) & + static_cast<std::underlying_type<XmlFormatting>::type>(rhs) + ); + } + XmlEncode::XmlEncode( std::string const& str, ForWhat forWhat ) : m_str( str ), m_forWhat( forWhat ) @@ -15183,13 +15286,17 @@ namespace { return os; } - XmlWriter::ScopedElement::ScopedElement( XmlWriter* writer ) - : m_writer( writer ) + XmlWriter::ScopedElement::ScopedElement( XmlWriter* writer, XmlFormatting fmt ) + : m_writer( writer ), + m_fmt(fmt) {} XmlWriter::ScopedElement::ScopedElement( ScopedElement&& other ) noexcept - : m_writer( other.m_writer ){ + : m_writer( other.m_writer ), + m_fmt(other.m_fmt) + { other.m_writer = nullptr; + other.m_fmt = XmlFormatting::None; } XmlWriter::ScopedElement& XmlWriter::ScopedElement::operator=( ScopedElement&& other ) noexcept { if ( m_writer ) { @@ -15197,16 +15304,19 @@ namespace { } m_writer = other.m_writer; other.m_writer = nullptr; + m_fmt = other.m_fmt; + other.m_fmt = XmlFormatting::None; return *this; } XmlWriter::ScopedElement::~ScopedElement() { - if( m_writer ) - m_writer->endElement(); + if (m_writer) { + m_writer->endElement(m_fmt); + } } - XmlWriter::ScopedElement& XmlWriter::ScopedElement::writeText( std::string const& text, bool indent ) { - m_writer->writeText( text, indent ); + XmlWriter::ScopedElement& XmlWriter::ScopedElement::writeText( std::string const& text, XmlFormatting fmt ) { + m_writer->writeText( text, fmt ); return *this; } @@ -15216,37 +15326,47 @@ namespace { } XmlWriter::~XmlWriter() { - while( !m_tags.empty() ) + while (!m_tags.empty()) { endElement(); + } + newlineIfNecessary(); } - XmlWriter& XmlWriter::startElement( std::string const& name ) { + XmlWriter& XmlWriter::startElement( std::string const& name, XmlFormatting fmt ) { ensureTagClosed(); newlineIfNecessary(); - m_os << m_indent << '<' << name; + if (shouldIndent(fmt)) { + m_os << m_indent; + m_indent += " "; + } + m_os << '<' << name; m_tags.push_back( name ); - m_indent += " "; m_tagIsOpen = true; + applyFormatting(fmt); return *this; } - XmlWriter::ScopedElement XmlWriter::scopedElement( std::string const& name ) { - ScopedElement scoped( this ); - startElement( name ); + XmlWriter::ScopedElement XmlWriter::scopedElement( std::string const& name, XmlFormatting fmt ) { + ScopedElement scoped( this, fmt ); + startElement( name, fmt ); return scoped; } - XmlWriter& XmlWriter::endElement() { - newlineIfNecessary(); - m_indent = m_indent.substr( 0, m_indent.size()-2 ); + XmlWriter& XmlWriter::endElement(XmlFormatting fmt) { + m_indent = m_indent.substr(0, m_indent.size() - 2); + if( m_tagIsOpen ) { m_os << "/>"; m_tagIsOpen = false; + } else { + newlineIfNecessary(); + if (shouldIndent(fmt)) { + m_os << m_indent; + } + m_os << "</" << m_tags.back() << ">"; } - else { - m_os << m_indent << "</" << m_tags.back() << ">"; - } - m_os << std::endl; + m_os << std::flush; + applyFormatting(fmt); m_tags.pop_back(); return *this; } @@ -15262,22 +15382,26 @@ namespace { return *this; } - XmlWriter& XmlWriter::writeText( std::string const& text, bool indent ) { + XmlWriter& XmlWriter::writeText( std::string const& text, XmlFormatting fmt) { if( !text.empty() ){ bool tagWasOpen = m_tagIsOpen; ensureTagClosed(); - if( tagWasOpen && indent ) + if (tagWasOpen && shouldIndent(fmt)) { m_os << m_indent; + } m_os << XmlEncode( text ); - m_needsNewline = true; + applyFormatting(fmt); } return *this; } - XmlWriter& XmlWriter::writeComment( std::string const& text ) { + XmlWriter& XmlWriter::writeComment( std::string const& text, XmlFormatting fmt) { ensureTagClosed(); - m_os << m_indent << "<!--" << text << "-->"; - m_needsNewline = true; + if (shouldIndent(fmt)) { + m_os << m_indent; + } + m_os << "<!--" << text << "-->"; + applyFormatting(fmt); return *this; } @@ -15293,11 +15417,16 @@ namespace { void XmlWriter::ensureTagClosed() { if( m_tagIsOpen ) { - m_os << ">" << std::endl; + m_os << '>' << std::flush; + newlineIfNecessary(); m_tagIsOpen = false; } } + void XmlWriter::applyFormatting(XmlFormatting fmt) { + m_needsNewline = shouldNewline(fmt); + } + void XmlWriter::writeDeclaration() { m_os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; } @@ -16476,8 +16605,8 @@ namespace Catch { for( auto const& child : groupNode.children ) writeTestCase( *child ); - xml.scopedElement( "system-out" ).writeText( trim( stdOutForSuite ), false ); - xml.scopedElement( "system-err" ).writeText( trim( stdErrForSuite ), false ); + xml.scopedElement( "system-out" ).writeText( trim( stdOutForSuite ), XmlFormatting::Newline ); + xml.scopedElement( "system-err" ).writeText( trim( stdErrForSuite ), XmlFormatting::Newline ); } void JunitReporter::writeTestCase( TestCaseNode const& testCaseNode ) { @@ -16526,9 +16655,9 @@ namespace Catch { writeAssertions( sectionNode ); if( !sectionNode.stdOut.empty() ) - xml.scopedElement( "system-out" ).writeText( trim( sectionNode.stdOut ), false ); + xml.scopedElement( "system-out" ).writeText( trim( sectionNode.stdOut ), XmlFormatting::Newline ); if( !sectionNode.stdErr.empty() ) - xml.scopedElement( "system-err" ).writeText( trim( sectionNode.stdErr ), false ); + xml.scopedElement( "system-err" ).writeText( trim( sectionNode.stdErr ), XmlFormatting::Newline ); } for( auto const& childNode : sectionNode.childSections ) if( className.empty() ) @@ -16574,10 +16703,25 @@ namespace Catch { XmlWriter::ScopedElement e = xml.scopedElement( elementName ); - xml.writeAttribute( "message", result.getExpandedExpression() ); + xml.writeAttribute( "message", result.getExpression() ); xml.writeAttribute( "type", result.getTestMacroName() ); ReusableStringStream rss; + if (stats.totals.assertions.total() > 0) { + rss << "FAILED" << ":\n"; + if (result.hasExpression()) { + rss << " "; + rss << result.getExpressionInMacro(); + rss << '\n'; + } + if (result.hasExpandedExpression()) { + rss << "with expansion:\n"; + rss << Column(result.getExpandedExpression()).indent(2) << '\n'; + } + } else { + rss << '\n'; + } + if( !result.getMessage().empty() ) rss << result.getMessage() << '\n'; for( auto const& msg : stats.infoMessages ) @@ -16585,7 +16729,7 @@ namespace Catch { rss << msg.message << '\n'; rss << "at " << result.getSourceInfo(); - xml.writeText( rss.str(), false ); + xml.writeText( rss.str(), XmlFormatting::Newline ); } } @@ -16931,9 +17075,9 @@ namespace Catch { e.writeAttribute( "durationInSeconds", m_testCaseTimer.getElapsedSeconds() ); if( !testCaseStats.stdOut.empty() ) - m_xml.scopedElement( "StdOut" ).writeText( trim( testCaseStats.stdOut ), false ); + m_xml.scopedElement( "StdOut" ).writeText( trim( testCaseStats.stdOut ), XmlFormatting::Newline ); if( !testCaseStats.stdErr.empty() ) - m_xml.scopedElement( "StdErr" ).writeText( trim( testCaseStats.stdErr ), false ); + m_xml.scopedElement( "StdErr" ).writeText( trim( testCaseStats.stdErr ), XmlFormatting::Newline ); m_xml.endElement(); } diff --git a/packages/Catch2/single_include/catch2/catch_reporter_sonarqube.hpp b/packages/Catch2/single_include/catch2/catch_reporter_sonarqube.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bf7d9299a50ab6651633b8f5b7a369618f45aece --- /dev/null +++ b/packages/Catch2/single_include/catch2/catch_reporter_sonarqube.hpp @@ -0,0 +1,181 @@ +/* + * Created by Daniel Garcia on 2018-12-04. + * Copyright Social Point SL. All rights reserved. + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ +#ifndef CATCH_REPORTER_SONARQUBE_HPP_INCLUDED +#define CATCH_REPORTER_SONARQUBE_HPP_INCLUDED + + +// Don't #include any Catch headers here - we can assume they are already +// included before this header. +// This is not good practice in general but is necessary in this case so this +// file can be distributed as a single header that works with the main +// Catch single header. + +#include <map> + +namespace Catch { + + struct SonarQubeReporter : CumulativeReporterBase<SonarQubeReporter> { + + SonarQubeReporter(ReporterConfig const& config) + : CumulativeReporterBase(config) + , xml(config.stream()) { + m_reporterPrefs.shouldRedirectStdOut = true; + m_reporterPrefs.shouldReportAllAssertions = true; + } + + ~SonarQubeReporter() override; + + static std::string getDescription() { + return "Reports test results in the Generic Test Data SonarQube XML format"; + } + + static std::set<Verbosity> getSupportedVerbosities() { + return { Verbosity::Normal }; + } + + void noMatchingTestCases(std::string const& /*spec*/) override {} + + void testRunStarting(TestRunInfo const& testRunInfo) override { + CumulativeReporterBase::testRunStarting(testRunInfo); + xml.startElement("testExecutions"); + xml.writeAttribute("version", "1"); + } + + void testGroupEnded(TestGroupStats const& testGroupStats) override { + CumulativeReporterBase::testGroupEnded(testGroupStats); + writeGroup(*m_testGroups.back()); + } + + void testRunEndedCumulative() override { + xml.endElement(); + } + + void writeGroup(TestGroupNode const& groupNode) { + std::map<std::string, TestGroupNode::ChildNodes> testsPerFile; + for(auto const& child : groupNode.children) + testsPerFile[child->value.testInfo.lineInfo.file].push_back(child); + + for(auto const& kv : testsPerFile) + writeTestFile(kv.first.c_str(), kv.second); + } + + void writeTestFile(const char* filename, TestGroupNode::ChildNodes const& testCaseNodes) { + XmlWriter::ScopedElement e = xml.scopedElement("file"); + xml.writeAttribute("path", filename); + + for(auto const& child : testCaseNodes) + writeTestCase(*child); + } + + void writeTestCase(TestCaseNode const& testCaseNode) { + // All test cases have exactly one section - which represents the + // test case itself. That section may have 0-n nested sections + assert(testCaseNode.children.size() == 1); + SectionNode const& rootSection = *testCaseNode.children.front(); + writeSection("", rootSection, testCaseNode.value.testInfo.okToFail()); + } + + void writeSection(std::string const& rootName, SectionNode const& sectionNode, bool okToFail) { + std::string name = trim(sectionNode.stats.sectionInfo.name); + if(!rootName.empty()) + name = rootName + '/' + name; + + if(!sectionNode.assertions.empty() || !sectionNode.stdOut.empty() || !sectionNode.stdErr.empty()) { + XmlWriter::ScopedElement e = xml.scopedElement("testCase"); + xml.writeAttribute("name", name); + xml.writeAttribute("duration", static_cast<long>(sectionNode.stats.durationInSeconds * 1000)); + + writeAssertions(sectionNode, okToFail); + } + + for(auto const& childNode : sectionNode.childSections) + writeSection(name, *childNode, okToFail); + } + + void writeAssertions(SectionNode const& sectionNode, bool okToFail) { + for(auto const& assertion : sectionNode.assertions) + writeAssertion( assertion, okToFail); + } + + void writeAssertion(AssertionStats const& stats, bool okToFail) { + AssertionResult const& result = stats.assertionResult; + if(!result.isOk()) { + std::string elementName; + if(okToFail) { + elementName = "skipped"; + } + else { + switch(result.getResultType()) { + case ResultWas::ThrewException: + case ResultWas::FatalErrorCondition: + elementName = "error"; + break; + case ResultWas::ExplicitFailure: + elementName = "failure"; + break; + case ResultWas::ExpressionFailed: + elementName = "failure"; + break; + case ResultWas::DidntThrowException: + elementName = "failure"; + break; + + // We should never see these here: + case ResultWas::Info: + case ResultWas::Warning: + case ResultWas::Ok: + case ResultWas::Unknown: + case ResultWas::FailureBit: + case ResultWas::Exception: + elementName = "internalError"; + break; + } + } + + XmlWriter::ScopedElement e = xml.scopedElement(elementName); + + ReusableStringStream messageRss; + messageRss << result.getTestMacroName() << "(" << result.getExpression() << ")"; + xml.writeAttribute("message", messageRss.str()); + + ReusableStringStream textRss; + if (stats.totals.assertions.total() > 0) { + textRss << "FAILED:\n"; + if (result.hasExpression()) { + textRss << "\t" << result.getExpressionInMacro() << "\n"; + } + if (result.hasExpandedExpression()) { + textRss << "with expansion:\n\t" << result.getExpandedExpression() << "\n"; + } + } + + if(!result.getMessage().empty()) + textRss << result.getMessage() << "\n"; + + for(auto const& msg : stats.infoMessages) + if(msg.type == ResultWas::Info) + textRss << msg.message << "\n"; + + textRss << "at " << result.getSourceInfo(); + xml.writeText(textRss.str(), XmlFormatting::Newline); + } + } + + private: + XmlWriter xml; + }; + +#ifdef CATCH_IMPL + SonarQubeReporter::~SonarQubeReporter() {} +#endif + + CATCH_REGISTER_REPORTER( "sonarqube", SonarQubeReporter ) + +} // end namespace Catch + +#endif // CATCH_REPORTER_SONARQUBE_HPP_INCLUDED \ No newline at end of file