diff --git a/packages/Catch2/.gitrepo b/packages/Catch2/.gitrepo index 1a05ad8d9e001995d59ee6fec83eb9f0eb20d5ed..f91066d5da01f7b0ba64a16516f4b3e3a151c168 100644 --- a/packages/Catch2/.gitrepo +++ b/packages/Catch2/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = git@github.com:catchorg/Catch2.git branch = master - commit = e70fd2a4b9a867c57c215b73d28bf911333bf45c - parent = 56106d874a699ac6e0a2f014b3fb954646b15044 + commit = d399a308d04b885433396f4198c0cda999f28d77 + parent = 1bb31be07095e1b4f28fe9012b634f2a9e866180 cmdver = 0.4.1 method = merge diff --git a/packages/Catch2/CMakeLists.txt b/packages/Catch2/CMakeLists.txt index d5fcb7d1c195b0b512db444d1de40d312c45c90b..55bf413d7a696088e1f9dc139b8c6b970b691410 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.11.1) +project(Catch2 LANGUAGES CXX VERSION 2.11.3) # 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 a2adb83fb1d2afba02890d314033ccf6af27812e..e7469c7459b16a9f6ddf7c4538993810bc3b09ec 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/Fj98nizVNqgaWH3i) +[](https://wandbox.org/permlink/p9Pcgple8QWwgNR0) [](https://discord.gg/4CWS9zD) -<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> +<a href="https://github.com/catchorg/Catch2/releases/download/v2.11.3/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/contrib/ParseAndAddCatchTests.cmake b/packages/Catch2/contrib/ParseAndAddCatchTests.cmake index 925d932819621028968173aa07c930ff0d096853..3c551f07d7841293582d97465661469324a0904c 100644 --- a/packages/Catch2/contrib/ParseAndAddCatchTests.cmake +++ b/packages/Catch2/contrib/ParseAndAddCatchTests.cmake @@ -144,7 +144,7 @@ function(ParseAndAddCatchTests_ParseFile SourceFile TestTarget) if("${TestType}" STREQUAL "SCENARIO") set(Name "Scenario: ${Name}") endif() - if(PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME AND TestFixture) + if(PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME AND "${TestType}" MATCHES "(CATCH_)?TEST_CASE_METHOD" AND TestFixture ) set(CTestName "${TestFixture}:${Name}") else() set(CTestName "${Name}") diff --git a/packages/Catch2/docs/cmake-integration.md b/packages/Catch2/docs/cmake-integration.md index 57073c40c111fd3e123e63219f589c22ea6d7580..fda922ae490de632d8b3a831077d5c36a3f3bdd4 100644 --- a/packages/Catch2/docs/cmake-integration.md +++ b/packages/Catch2/docs/cmake-integration.md @@ -6,6 +6,7 @@ [Automatic test registration](#automatic-test-registration)<br> [CMake project options](#cmake-project-options)<br> [Installing Catch2 from git repository](#installing-catch2-from-git-repository)<br> +[Installing Catch2 from vcpkg](#installing-catch2-from-vcpkg)<br> Because we use CMake to build Catch2, we also provide a couple of integration points for our users. @@ -220,6 +221,19 @@ when configuring the build, and then modify your calls to [find_package](https://cmake.org/cmake/help/latest/command/find_package.html) accordingly. +## Installing Catch2 from vcpkg + +Alternatively, you can build and install Catch2 using [vcpkg](https://github.com/microsoft/vcpkg/) dependency manager: +``` +git clone https://github.com/Microsoft/vcpkg.git +cd vcpkg +./bootstrap-vcpkg.sh +./vcpkg integrate install +./vcpkg install catch2 +``` + +The catch2 port in vcpkg is kept up to date by microsoft team members and community contributors. +If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository. --- diff --git a/packages/Catch2/docs/command-line.md b/packages/Catch2/docs/command-line.md index 7ec2fbb31d43829be8f2b78340f9df57b7e92ae5..51eeb2f6d7f7a0d6fff5951905f4de768bb4ae48 100644 --- a/packages/Catch2/docs/command-line.md +++ b/packages/Catch2/docs/command-line.md @@ -271,7 +271,7 @@ See [The LibIdentify repo for more information and examples](https://github.com/ <a id="wait-for-keypress"></a> ## Wait for key before continuing -<pre>--wait-for-keypress <start|exit|both></pre> +<pre>--wait-for-keypress <never|start|exit|both></pre> Will cause the executable to print a message and wait until the return/ enter key is pressed before continuing - either before running any tests, after running all tests - or both, depending on the argument. @@ -323,7 +323,7 @@ Instead the user code is only measured and the plain mean from the samples is re ## 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. +> [Introduced](https://github.com/catchorg/Catch2/pull/1844) in Catch 2.11.2. Configure the amount of time spent warming up each test. diff --git a/packages/Catch2/docs/commercial-users.md b/packages/Catch2/docs/commercial-users.md index c38fb321072f114cac376af292ff635514a40d69..7d2e87d387b52ed7c96aab1d5d30f60d07437dfd 100644 --- a/packages/Catch2/docs/commercial-users.md +++ b/packages/Catch2/docs/commercial-users.md @@ -18,3 +18,5 @@ fact then please let us know - either directly, via a PR or - [Inscopix Inc.](https://www.inscopix.com/) - [Makimo](https://makimo.pl/) - [UX3D](https://ux3d.io) + - [King](https://king.com) + diff --git a/packages/Catch2/docs/configuration.md b/packages/Catch2/docs/configuration.md index d09e043f9fed94c3a4dc8cbe146abcafc915d482..940356adb5a4b7455030d0e3f8e1b5bc0f0afa00 100644 --- a/packages/Catch2/docs/configuration.md +++ b/packages/Catch2/docs/configuration.md @@ -260,7 +260,7 @@ namespace Catch { ## Overriding Catch's debug break (`-b`) -> [Introduced](https://github.com/catchorg/Catch2/pull/1846) in Catch X.Y.Z. +> [Introduced](https://github.com/catchorg/Catch2/pull/1846) in Catch 2.11.2. 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 diff --git a/packages/Catch2/docs/opensource-users.md b/packages/Catch2/docs/opensource-users.md index 36c0db64f6fd7d65d519e1e9b06b41eea7683ea5..cbea85d7910a109d13ac393539e60f45e79fc9ec 100644 --- a/packages/Catch2/docs/opensource-users.md +++ b/packages/Catch2/docs/opensource-users.md @@ -20,18 +20,21 @@ Listing a project here does not imply endorsement and the plan is to keep these ### [ApprovalTests.cpp](https://github.com/approvals/ApprovalTests.cpp) C++11 implementation of Approval Tests, for quick, convenient testing of legacy code. +### [args](https://github.com/Taywee/args) +A simple header-only C++ argument parser library. + ### [Azmq](https://github.com/zeromq/azmq) Boost Asio style bindings for ZeroMQ. ### [Cataclysm: Dark Days Ahead](https://github.com/CleverRaven/Cataclysm-DDA) Post-apocalyptic survival RPG. -### [ChakraCore](https://github.com/Microsoft/ChakraCore) -The core part of the Chakra JavaScript engine that powers Microsoft Edge. - ### [ChaiScript](https://github.com/ChaiScript/ChaiScript) A, header-only, embedded scripting language designed from the ground up to directly target C++ and take advantage of modern C++ development techniques. +### [ChakraCore](https://github.com/Microsoft/ChakraCore) +The core part of the Chakra JavaScript engine that powers Microsoft Edge. + ### [Clara](https://github.com/philsquared/Clara) A, single-header-only, type-safe, command line parser - which also prints formatted usage strings. @@ -65,9 +68,6 @@ A small C++ library wrapper for the native C ODBC API. ### [Nonius](https://github.com/libnonius/nonius) A header-only framework for benchmarking small snippets of C++ code. -### [SOCI](https://github.com/SOCI/soci) -The C++ Database Access Library. - ### [polymorphic_value](https://github.com/jbcoe/polymorphic_value) A polymorphic value-type for C++. @@ -77,18 +77,21 @@ A C++ client library for Consul. Consul is a distributed tool for discovering an ### [Reactive-Extensions/ RxCpp](https://github.com/Reactive-Extensions/RxCpp) A library of algorithms for values-distributed-in-time. -### [thor](https://github.com/xorz57/thor) -Wrapper Library for CUDA. +### [SOCI](https://github.com/SOCI/soci) +The C++ Database Access Library. ### [TextFlowCpp](https://github.com/philsquared/textflowcpp) A small, single-header-only, library for wrapping and composing columns of text. +### [thor](https://github.com/xorz57/thor) +Wrapper Library for CUDA. + +### [toml++](https://github.com/marzer/tomlplusplus) +A header-only TOML parser and serializer for modern C++. + ### [Trompeloeil](https://github.com/rollbear/trompeloeil) A thread-safe header-only mocking framework for C++14. -### [args](https://github.com/Taywee/args) -A simple header-only C++ argument parser library. - ## Applications & Tools ### [ArangoDB](https://github.com/arangodb/arangodb) @@ -103,6 +106,9 @@ MAME originally stood for Multiple Arcade Machine Emulator. ### [Newsbeuter](https://github.com/akrennmair/newsbeuter) Newsbeuter is an open-source RSS/Atom feed reader for text terminals. +### [PopHead](https://github.com/SPC-Some-Polish-Coders/PopHead) +A 2D, Zombie, RPG game which is being made on our own engine. + ### [raspigcd](https://github.com/pantadeusz/raspigcd) Low level CLI app and library for execution of GCODE on Raspberry Pi without any additional microcontrolers (just RPi + Stepsticks). @@ -112,9 +118,6 @@ SpECTRE is a code for multi-scale, multi-physics problems in astrophysics and gr ### [Standardese](https://github.com/foonathan/standardese) Standardese aims to be a nextgen Doxygen. -### [PopHead](https://github.com/SPC-Some-Polish-Coders/PopHead) -A 2D, Zombie, RPG game which is being made on our own engine. - --- [Home](Readme.md#top) diff --git a/packages/Catch2/docs/release-notes.md b/packages/Catch2/docs/release-notes.md index 5eb7f33fa707f112bb2dfc226bd1c0cbdee71ff7..b6975b64caae477a2131d22d1ad6f03541d5c3c1 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.3](#2113)<br> +[2.11.2](#2112)<br> [2.11.1](#2111)<br> [2.11.0](#2110)<br> [2.10.2](#2102)<br> @@ -32,6 +34,37 @@ [Older versions](#older-versions)<br> [Even Older versions](#even-older-versions)<br> +## 2.11.3 + +### Fixes +* Fixed compilation error caused by lambdas in assertions under MSVC + + +## 2.11.2 + +### Improvements +* GCC and Clang now issue warnings for suspicious code in assertions (#1880) + * E.g. `REQUIRE( int != unsigned int )` will now issue mixed signedness comparison warning + * This has always worked on MSVC, but it now also works for GCC and current Clang versions +* Colorization of "Test filters" output should be more robust now +* `--wait-for-keypress` now also accepts `never` as an option (#1866) +* Reporters no longer round-off nanoseconds when reporting benchmarking results (#1876) +* Catch2's debug break now supports iOS while using Thumb instruction set (#1862) +* It is now possible to customize benchmark's warm-up time when running the test binary (#1844) + * `--benchmark-warmup-time {ms}` +* User can now specify how Catch2 should break into debugger (#1846) + +### Fixes +* Fixes missing `<random>` include in benchmarking (#1831) +* Fixed missing `<iterator>` include in benchmarking (#1874) +* Hidden test cases are now also tagged with `[!hide]` as per documentation (#1847) +* Detection of whether libc provides `std::nextafter` has been improved (#1854) +* Detection of `wmain` no longer incorrectly looks for `WIN32` macro (#1849) + * Now it just detects Windows platform +* Composing already-composed matchers no longer modifies the partially-composed matcher expression + * This bug has been present for the last ~2 years and nobody reported it + + ## 2.11.1 ### Improvements diff --git a/packages/Catch2/docs/slow-compiles.md b/packages/Catch2/docs/slow-compiles.md index 366adf291574922934c30c000bbba71fb41b1626..230f533059035150416e0387b2da9efd26fff160 100644 --- a/packages/Catch2/docs/slow-compiles.md +++ b/packages/Catch2/docs/slow-compiles.md @@ -22,7 +22,7 @@ But functions and methods can also be written inline in header files. The downsi Because Catch is implemented *entirely* in headers you might think that the whole of Catch must be compiled into every translation unit that uses it! Actually it's not quite as bad as that. Catch mitigates this situation by effectively maintaining the traditional separation between the implementation code and declarations. Internally the implementation code is protected by ```#ifdef```s and is conditionally compiled into only one translation unit. This translation unit is that one that ```#define```s ```CATCH_CONFIG_MAIN``` or ```CATCH_CONFIG_RUNNER```. Let's call this the main source file. -As a result the main source file *does* compile the whole of Catch every time! So it makes sense to dedicate this file to *only* ```#define```-ing the identifier and ```#include```-ing Catch (and implementing the runner code, if you're doing that). Keep all your test cases in other files. This way you won't pay the recompilation cost for the whole of Catch +As a result the main source file *does* compile the whole of Catch every time! So it makes sense to dedicate this file to *only* ```#define```-ing the identifier and ```#include```-ing Catch (and implementing the runner code, if you're doing that). Keep all your test cases in other files. This way you won't pay the recompilation cost for the whole of Catch. ## Practical example Assume you have the `Factorial` function from the [tutorial](tutorial.md#top) in `factorial.cpp` (with forward declaration in `factorial.h`) and want to test it and keep the compile times down when adding new tests. Then you should have 2 files, `tests-main.cpp` and `tests-factorial.cpp`: diff --git a/packages/Catch2/docs/tutorial.md b/packages/Catch2/docs/tutorial.md index e45f967e2547532723783f4005ef5ac0534df528..1f0b8ff277176a8ad43a2bd67c5ef0319715ea08 100644 --- a/packages/Catch2/docs/tutorial.md +++ b/packages/Catch2/docs/tutorial.md @@ -106,7 +106,7 @@ Of course there are still more issues to deal with. For example we'll hit proble Although this was a simple test it's been enough to demonstrate a few things about how Catch is used. Let's take a moment to consider those before we move on. 1. All we did was ```#define``` one identifier and ```#include``` one header and we got everything - even an implementation of ```main()``` that will [respond to command line arguments](command-line.md#top). You can only use that ```#define``` in one implementation file, for (hopefully) obvious reasons. Once you have more than one file with unit tests in you'll just ```#include "catch.hpp"``` and go. Usually it's a good idea to have a dedicated implementation file that just has ```#define CATCH_CONFIG_MAIN``` and ```#include "catch.hpp"```. You can also provide your own implementation of main and drive Catch yourself (see [Supplying-your-own-main()](own-main.md#top)). -2. We introduce test cases with the ```TEST_CASE``` macro. This macro takes one or two arguments - a free form test name and, optionally, one or more tags (for more see <a href="#test-cases-and-sections">Test cases and Sections</a>, ). The test name must be unique. You can run sets of tests by specifying a wildcarded test name or a tag expression. See the [command line docs](command-line.md#top) for more information on running tests. +2. We introduce test cases with the ```TEST_CASE``` macro. This macro takes one or two arguments - a free form test name and, optionally, one or more tags (for more see <a href="#test-cases-and-sections">Test cases and Sections</a>). The test name must be unique. You can run sets of tests by specifying a wildcarded test name or a tag expression. See the [command line docs](command-line.md#top) for more information on running tests. 3. The name and tags arguments are just strings. We haven't had to declare a function or method - or explicitly register the test case anywhere. Behind the scenes a function with a generated name is defined for you, and automatically registered using static registry classes. By abstracting the function name away we can name our tests without the constraints of identifier names. 4. We write our individual test assertions using the ```REQUIRE``` macro. Rather than a separate macro for each type of condition we express the condition naturally using C/C++ syntax. Behind the scenes a simple set of expression templates captures the left-hand-side and right-hand-side of the expression so we can display the values in our test report. As we'll see later there _are_ other assertion macros - but because of this technique the number of them is drastically reduced. diff --git a/packages/Catch2/include/catch.hpp b/packages/Catch2/include/catch.hpp index d2f1a8e7c9ca2383db1084352eb2e33fb8d1c897..d0404a86ffbba9cf179ee5e55c123cdebcc000d5 100644 --- a/packages/Catch2/include/catch.hpp +++ b/packages/Catch2/include/catch.hpp @@ -11,7 +11,7 @@ #define CATCH_VERSION_MAJOR 2 #define CATCH_VERSION_MINOR 11 -#define CATCH_VERSION_PATCH 1 +#define CATCH_VERSION_PATCH 3 #ifdef __clang__ # pragma clang system_header diff --git a/packages/Catch2/include/internal/benchmark/detail/catch_stats.hpp b/packages/Catch2/include/internal/benchmark/detail/catch_stats.hpp index c05f9679bbb95fa1306a5458caea9d6cb4cb1f17..71a460d90013b142dcfc3fc70687494beba5f10a 100644 --- a/packages/Catch2/include/internal/benchmark/detail/catch_stats.hpp +++ b/packages/Catch2/include/internal/benchmark/detail/catch_stats.hpp @@ -18,6 +18,7 @@ #include <algorithm> #include <functional> #include <vector> +#include <iterator> #include <numeric> #include <tuple> #include <cmath> diff --git a/packages/Catch2/include/internal/catch_capture.hpp b/packages/Catch2/include/internal/catch_capture.hpp index ba842c3efd2e78a95d56854b8f4c1bfa64ad0055..a65b3aeca9ac7927ea350bd85d9b5be6727c019b 100644 --- a/packages/Catch2/include/internal/catch_capture.hpp +++ b/packages/Catch2/include/internal/catch_capture.hpp @@ -41,6 +41,8 @@ /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_TEST( macroName, resultDisposition, ... ) \ do { \ + /* The expression should not be evaluated, but warnings should hopefully be checked */ \ + CATCH_INTERNAL_IGNORE_BUT_WARN(__VA_ARGS__); \ Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \ INTERNAL_CATCH_TRY { \ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ @@ -49,8 +51,7 @@ 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 - // The double negation silences MSVC's C4800 warning, the static_cast forces short-circuit evaluation if the type has overloaded &&. + } while( (void)0, (false) && static_cast<bool>( !!(__VA_ARGS__) ) ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_IF( macroName, resultDisposition, ... ) \ diff --git a/packages/Catch2/include/internal/catch_commandline.cpp b/packages/Catch2/include/internal/catch_commandline.cpp index b0412d50d89f22699e471feb34df3ad5977eb919..a4010850d0cf7bf914dabfe362ea3ade2f8442f5 100644 --- a/packages/Catch2/include/internal/catch_commandline.cpp +++ b/packages/Catch2/include/internal/catch_commandline.cpp @@ -91,14 +91,16 @@ namespace Catch { }; auto const setWaitForKeypress = [&]( std::string const& keypress ) { auto keypressLc = toLower( keypress ); - if( keypressLc == "start" ) + if (keypressLc == "never") + config.waitForKeypress = WaitForKeypress::Never; + else if( keypressLc == "start" ) config.waitForKeypress = WaitForKeypress::BeforeStart; else if( keypressLc == "exit" ) config.waitForKeypress = WaitForKeypress::BeforeExit; else if( keypressLc == "both" ) config.waitForKeypress = WaitForKeypress::BeforeStartAndExit; else - return ParserResult::runtimeError( "keypress argument must be one of: start, exit or both. '" + keypress + "' not recognised" ); + return ParserResult::runtimeError( "keypress argument must be one of: never, start, exit or both. '" + keypress + "' not recognised" ); return ParserResult::ok( ParseResultType::Matched ); }; auto const setVerbosity = [&]( std::string const& verbosity ) { @@ -198,7 +200,7 @@ namespace Catch { | Opt( config.libIdentify ) ["--libidentify"] ( "report name and version according to libidentify standard" ) - | Opt( setWaitForKeypress, "start|exit|both" ) + | Opt( setWaitForKeypress, "never|start|exit|both" ) ["--wait-for-keypress"] ( "waits for a keypress before exiting" ) | Opt( config.benchmarkSamples, "samples" ) diff --git a/packages/Catch2/include/internal/catch_compiler_capabilities.h b/packages/Catch2/include/internal/catch_compiler_capabilities.h index 9eebd8de4faf8de3996a8e9df8808fa5271db547..1529f582e2f56c47d5bc6892228ee7e717d3e755 100644 --- a/packages/Catch2/include/internal/catch_compiler_capabilities.h +++ b/packages/Catch2/include/internal/catch_compiler_capabilities.h @@ -48,6 +48,9 @@ #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" ) + +# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) + #endif #if defined(__clang__) @@ -55,6 +58,9 @@ # define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic push" ) # define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic pop" ) +# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) /* NOLINT(cppcoreguidelines-pro-type-vararg) */ + + # define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) \ _Pragma( "clang diagnostic ignored \"-Wglobal-constructors\"") @@ -332,6 +338,11 @@ # define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS #endif +// The goal of this macro is to avoid evaluation of the arguments, but +// still have the compiler warn on problems inside... +#if !defined(CATCH_INTERNAL_IGNORE_BUT_WARN) +# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) +#endif #if defined(__APPLE__) && defined(__apple_build_version__) && (__clang_major__ < 10) # undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS diff --git a/packages/Catch2/include/internal/catch_debugger.cpp b/packages/Catch2/include/internal/catch_debugger.cpp index fc78c36e9b4958a5be7e9a225cba65610f0d68bb..d4f747801031c6c40d58a263d6d76975a5a3d21d 100644 --- a/packages/Catch2/include/internal/catch_debugger.cpp +++ b/packages/Catch2/include/internal/catch_debugger.cpp @@ -14,8 +14,7 @@ #if defined(CATCH_PLATFORM_MAC) || defined(CATCH_PLATFORM_IPHONE) -# include <assert.h> -# include <stdbool.h> +# include <cassert> # include <sys/types.h> # include <unistd.h> # include <cstddef> diff --git a/packages/Catch2/include/internal/catch_debugger.h b/packages/Catch2/include/internal/catch_debugger.h index 001b46457b0fdde88b1033a26b92bc32ed065d71..77db8aed2fb86c842fa49fa3d446c4201a89c1c8 100644 --- a/packages/Catch2/include/internal/catch_debugger.h +++ b/packages/Catch2/include/internal/catch_debugger.h @@ -26,8 +26,10 @@ namespace Catch { #define CATCH_TRAP() __asm__("int $3") #elif defined(__aarch64__) #define CATCH_TRAP() __asm__(".inst 0xd4200000") - #elif defined(__arm__) + #elif defined(__arm__) && !defined(__thumb__) #define CATCH_TRAP() __asm__(".inst 0xe7f001f0") + #elif defined(__arm__) && defined(__thumb__) + #define CATCH_TRAP() __asm__(".inst 0xde01") #endif #elif defined(CATCH_PLATFORM_LINUX) diff --git a/packages/Catch2/include/internal/catch_version.cpp b/packages/Catch2/include/internal/catch_version.cpp index ca59d6dbdd76dd21cdea6c82723a2def857bfc60..db6425e803708cc15c106abcc2f93b6da6461a5c 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, 11, 1, "", 0 ); + static Version version( 2, 11, 3, "", 0 ); return version; } diff --git a/packages/Catch2/include/reporters/catch_reporter_console.cpp b/packages/Catch2/include/reporters/catch_reporter_console.cpp index be00d0bdf3b0db1e93bd1d62ae6c762f16dd283e..0fa399d586cc567634658844ae17a0e20d0dfdd6 100644 --- a/packages/Catch2/include/reporters/catch_reporter_console.cpp +++ b/packages/Catch2/include/reporters/catch_reporter_console.cpp @@ -210,15 +210,11 @@ class Duration { static const uint64_t s_nanosecondsInASecond = 1000 * s_nanosecondsInAMillisecond; static const uint64_t s_nanosecondsInAMinute = 60 * s_nanosecondsInASecond; - uint64_t m_inNanoseconds; + double m_inNanoseconds; Unit m_units; public: - explicit Duration(double inNanoseconds, Unit units = Unit::Auto) - : Duration(static_cast<uint64_t>(inNanoseconds), units) { - } - - explicit Duration(uint64_t inNanoseconds, Unit units = Unit::Auto) + explicit Duration(double inNanoseconds, Unit units = Unit::Auto) : m_inNanoseconds(inNanoseconds), m_units(units) { if (m_units == Unit::Auto) { @@ -247,7 +243,7 @@ public: case Unit::Minutes: return m_inNanoseconds / static_cast<double>(s_nanosecondsInAMinute); default: - return static_cast<double>(m_inNanoseconds); + return m_inNanoseconds; } } auto unitsAsString() const -> std::string { @@ -366,7 +362,7 @@ ConsoleReporter::ConsoleReporter(ReporterConfig const& config) else { return{ - { "benchmark name", CATCH_CONFIG_CONSOLE_WIDTH - 32, ColumnInfo::Left }, + { "benchmark name", CATCH_CONFIG_CONSOLE_WIDTH - 43, ColumnInfo::Left }, { "samples mean std dev", 14, ColumnInfo::Right }, { "iterations low mean low std dev", 14, ColumnInfo::Right }, { "estimated high mean high std dev", 14, ColumnInfo::Right } @@ -684,8 +680,10 @@ void ConsoleReporter::printSummaryDivider() { } void ConsoleReporter::printTestFilters() { - if (m_config->testSpec().hasFilters()) - stream << Colour(Colour::BrightYellow) << "Filters: " << serializeFilters( m_config->getTestsOrTags() ) << '\n'; + if (m_config->testSpec().hasFilters()) { + Colour guard(Colour::BrightYellow); + stream << "Filters: " << serializeFilters(m_config->getTestsOrTags()) << '\n'; + } } CATCH_REGISTER_REPORTER("console", ConsoleReporter) @@ -698,4 +696,4 @@ CATCH_REGISTER_REPORTER("console", ConsoleReporter) #if defined(__clang__) # pragma clang diagnostic pop -#endif \ No newline at end of file +#endif diff --git a/packages/Catch2/include/reporters/catch_reporter_xml.cpp b/packages/Catch2/include/reporters/catch_reporter_xml.cpp index e110317c46e3bec6130f3a47971f4d77bc449cb2..0fb78be03d472b542e8236224e27d2ee561b1dfd 100644 --- a/packages/Catch2/include/reporters/catch_reporter_xml.cpp +++ b/packages/Catch2/include/reporters/catch_reporter_xml.cpp @@ -229,16 +229,16 @@ namespace Catch { m_xml.writeAttribute("samples", info.samples) .writeAttribute("resamples", info.resamples) .writeAttribute("iterations", info.iterations) - .writeAttribute("clockResolution", static_cast<uint64_t>(info.clockResolution)) - .writeAttribute("estimatedDuration", static_cast<uint64_t>(info.estimatedDuration)) + .writeAttribute("clockResolution", info.clockResolution) + .writeAttribute("estimatedDuration", info.estimatedDuration) .writeComment("All values in nano seconds"); } void XmlReporter::benchmarkEnded(BenchmarkStats<> const& benchmarkStats) { m_xml.startElement("mean") - .writeAttribute("value", static_cast<uint64_t>(benchmarkStats.mean.point.count())) - .writeAttribute("lowerBound", static_cast<uint64_t>(benchmarkStats.mean.lower_bound.count())) - .writeAttribute("upperBound", static_cast<uint64_t>(benchmarkStats.mean.upper_bound.count())) + .writeAttribute("value", benchmarkStats.mean.point.count()) + .writeAttribute("lowerBound", benchmarkStats.mean.lower_bound.count()) + .writeAttribute("upperBound", benchmarkStats.mean.upper_bound.count()) .writeAttribute("ci", benchmarkStats.mean.confidence_interval); m_xml.endElement(); m_xml.startElement("standardDeviation") diff --git a/packages/Catch2/projects/ExtraTests/CMakeLists.txt b/packages/Catch2/projects/ExtraTests/CMakeLists.txt index 0e514d96fc8a2cdd3d6d11be5b232bd003131b15..c8c975c00d65d10e1676b1eaf82bcfd7b9f06dd7 100644 --- a/packages/Catch2/projects/ExtraTests/CMakeLists.txt +++ b/packages/Catch2/projects/ExtraTests/CMakeLists.txt @@ -123,7 +123,7 @@ add_test(NAME BenchmarkingMacros COMMAND BenchmarkingMacros -r console -s) set_tests_properties( BenchmarkingMacros PROPERTIES - PASS_REGULAR_EXPRESSION "benchmark name samples iterations estimated" + PASS_REGULAR_EXPRESSION "benchmark name[\\r\\n\\t ]+samples[\\r\\n\\t ]+iterations[\\r\\n\\t ]+estimated" ) # This test touches windows.h, so it should only be compiled under msvc diff --git a/packages/Catch2/projects/SelfTest/Baselines/compact.sw.approved.txt b/packages/Catch2/projects/SelfTest/Baselines/compact.sw.approved.txt index c12ce081d882f91ebba89299f7044f77170c41c7..eef23b5a972c01e953d1a08b77b016dbd973ee23 100644 --- a/packages/Catch2/projects/SelfTest/Baselines/compact.sw.approved.txt +++ b/packages/Catch2/projects/SelfTest/Baselines/compact.sw.approved.txt @@ -764,6 +764,7 @@ Condition.tests.cpp:<line number>: passed: data.str_hello != "goodbye" for: "hel Condition.tests.cpp:<line number>: passed: data.str_hello != "hell" for: "hello" != "hell" Condition.tests.cpp:<line number>: passed: data.str_hello != "hello1" for: "hello" != "hello1" Condition.tests.cpp:<line number>: passed: data.str_hello.size() != 6 for: 5 != 6 +Compilation.tests.cpp:<line number>: passed: []() { return true; }() for: true Approx.tests.cpp:<line number>: passed: d <= Approx( 1.24 ) for: 1.23 <= Approx( 1.24 ) Approx.tests.cpp:<line number>: passed: d <= Approx( 1.23 ) for: 1.23 <= Approx( 1.23 ) Approx.tests.cpp:<line number>: passed: !(d <= Approx( 1.22 )) for: !(1.23 <= Approx( 1.22 )) @@ -1088,6 +1089,16 @@ CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "-x", "2"}) for: {?} CmdLine.tests.cpp:<line number>: passed: config.abortAfter == 2 for: 2 == 2 CmdLine.tests.cpp:<line number>: passed: !result for: true CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), Contains("convert") && Contains("oops") for: "Unable to convert 'oops' to destination type" ( contains: "convert" and contains: "oops" ) +CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.waitForKeypress == std::get<1>(input) for: 0 == 0 +CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.waitForKeypress == std::get<1>(input) for: 1 == 1 +CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.waitForKeypress == std::get<1>(input) for: 2 == 2 +CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.waitForKeypress == std::get<1>(input) for: 3 == 3 +CmdLine.tests.cpp:<line number>: passed: !result for: true +CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), Contains("never") && Contains("both") for: "keypress argument must be one of: never, start, exit or both. 'sometimes' not recognised" ( contains: "never" and contains: "both" ) CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "-e"}) for: {?} CmdLine.tests.cpp:<line number>: passed: config.noThrow for: true CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--nothrow"}) for: {?} diff --git a/packages/Catch2/projects/SelfTest/Baselines/console.std.approved.txt b/packages/Catch2/projects/SelfTest/Baselines/console.std.approved.txt index f62b2e48c8f6526ca13e6f79135bbb6e214573fa..c0357adb4d8fea84705e014dd596cec5df7f4dbe 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: 306 | 232 passed | 70 failed | 4 failed as expected -assertions: 1666 | 1514 passed | 131 failed | 21 failed as expected +test cases: 307 | 233 passed | 70 failed | 4 failed as expected +assertions: 1677 | 1525 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 68357ef07d5303cd16d93a6f4e10440d1ca8337c..1b0a8ce2125d4a258bee2c626dfa248ba14ed257 100644 --- a/packages/Catch2/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/packages/Catch2/projects/SelfTest/Baselines/console.sw.approved.txt @@ -5729,6 +5729,17 @@ Condition.tests.cpp:<line number>: PASSED: with expansion: 5 != 6 +------------------------------------------------------------------------------- +Lambdas in assertions +------------------------------------------------------------------------------- +Compilation.tests.cpp:<line number> +............................................................................... + +Compilation.tests.cpp:<line number>: PASSED: + REQUIRE( []() { return true; }() ) +with expansion: + true + ------------------------------------------------------------------------------- Less-than inequalities with different epsilons ------------------------------------------------------------------------------- @@ -7834,6 +7845,102 @@ with expansion: "Unable to convert 'oops' to destination type" ( contains: "convert" and contains: "oops" ) +------------------------------------------------------------------------------- +Process can be configured on command line + abort + wait-for-keypress + Accepted options +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.waitForKeypress == std::get<1>(input) ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +Process can be configured on command line + abort + wait-for-keypress + Accepted options +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.waitForKeypress == std::get<1>(input) ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +Process can be configured on command line + abort + wait-for-keypress + Accepted options +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.waitForKeypress == std::get<1>(input) ) +with expansion: + 2 == 2 + +------------------------------------------------------------------------------- +Process can be configured on command line + abort + wait-for-keypress + Accepted options +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.waitForKeypress == std::get<1>(input) ) +with expansion: + 3 == 3 + +------------------------------------------------------------------------------- +Process can be configured on command line + abort + wait-for-keypress + invalid options are reported +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( !result ) +with expansion: + true + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( result.errorMessage(), Contains("never") && Contains("both") ) +with expansion: + "keypress argument must be one of: never, start, exit or both. 'sometimes' + not recognised" ( contains: "never" and contains: "both" ) + ------------------------------------------------------------------------------- Process can be configured on command line nothrow @@ -13320,6 +13427,6 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: =============================================================================== -test cases: 306 | 216 passed | 86 failed | 4 failed as expected -assertions: 1683 | 1514 passed | 148 failed | 21 failed as expected +test cases: 307 | 217 passed | 86 failed | 4 failed as expected +assertions: 1694 | 1525 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 59119a25812344447239cf615874940334511eec..e8f7c09ff42a5f251996a008f0fd176df6d49271 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="1684" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> + <testsuite name="<exe-name>" errors="17" failures="132" tests="1695" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> <properties> <property name="filters" value="~[!nonportable]~[!benchmark]~[approvals]"/> <property name="random-seed" value="1"/> @@ -753,6 +753,7 @@ Condition.tests.cpp:<line number> </failure> </testcase> <testcase classname="<exe-name>.global" name="Inequality checks that should succeed" time="{duration}"/> + <testcase classname="<exe-name>.global" name="Lambdas in assertions" time="{duration}"/> <testcase classname="<exe-name>.global" name="Less-than inequalities with different epsilons" time="{duration}"/> <testcase classname="<exe-name>.global" name="ManuallyRegistered" time="{duration}"/> <testcase classname="<exe-name>.global" name="Matchers can be (AllOf) composed with the && operator" time="{duration}"/> @@ -1004,6 +1005,8 @@ Message.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="Process can be configured on command line/abort/-a aborts after first failure" time="{duration}"/> <testcase classname="<exe-name>.global" name="Process can be configured on command line/abort/-x 2 aborts after two failures" time="{duration}"/> <testcase classname="<exe-name>.global" name="Process can be configured on command line/abort/-x must be numeric" time="{duration}"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/abort/wait-for-keypress/Accepted options" time="{duration}"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/abort/wait-for-keypress/invalid options are reported" time="{duration}"/> <testcase classname="<exe-name>.global" name="Process can be configured on command line/nothrow/-e" time="{duration}"/> <testcase classname="<exe-name>.global" name="Process can be configured on command line/nothrow/--nothrow" time="{duration}"/> <testcase classname="<exe-name>.global" name="Process can be configured on command line/output filename/-o filename" 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 1d7e92bffd2494cccdcbefed2de2409b1660610c..2f11cf5bba511f0101718d09c582859a7be0b01e 100644 --- a/packages/Catch2/projects/SelfTest/Baselines/sonarqube.sw.approved.txt +++ b/packages/Catch2/projects/SelfTest/Baselines/sonarqube.sw.approved.txt @@ -52,6 +52,8 @@ <testCase name="Process can be configured on command line/abort/-a aborts after first failure" duration="{duration}"/> <testCase name="Process can be configured on command line/abort/-x 2 aborts after two failures" duration="{duration}"/> <testCase name="Process can be configured on command line/abort/-x must be numeric" duration="{duration}"/> + <testCase name="Process can be configured on command line/abort/wait-for-keypress/Accepted options" duration="{duration}"/> + <testCase name="Process can be configured on command line/abort/wait-for-keypress/invalid options are reported" duration="{duration}"/> <testCase name="Process can be configured on command line/nothrow/-e" duration="{duration}"/> <testCase name="Process can be configured on command line/nothrow/--nothrow" duration="{duration}"/> <testCase name="Process can be configured on command line/output filename/-o filename" duration="{duration}"/> @@ -367,6 +369,7 @@ Class.tests.cpp:<line number> <testCase name="#809" duration="{duration}"/> <testCase name="#833" duration="{duration}"/> <testCase name="#872" duration="{duration}"/> + <testCase name="Lambdas in assertions" duration="{duration}"/> <testCase name="Optionally static assertions" duration="{duration}"/> </file> <file path="projects/<exe-name>/UsageTests/Condition.tests.cpp"> diff --git a/packages/Catch2/projects/SelfTest/Baselines/xml.sw.approved.txt b/packages/Catch2/projects/SelfTest/Baselines/xml.sw.approved.txt index 1021e16842f9a72bee27da9ed9d1a8353cc451ff..cc90e0cb29482f681c5bcde1d48a5299769f8143 100644 --- a/packages/Catch2/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/packages/Catch2/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -7266,6 +7266,17 @@ Nor would this </Expression> <OverallResult success="true"/> </TestCase> + <TestCase name="Lambdas in assertions" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Original> + []() { return true; }() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> <TestCase name="Less-than inequalities with different epsilons" tags="[Approx]" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" > <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" > <Original> @@ -9878,6 +9889,131 @@ Nor would this </Section> <OverallResults successes="2" failures="0" expectedFailures="0"/> </Section> + <Section name="abort" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="wait-for-keypress" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="Accepted options" 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", "--wait-for-keypress", std::get<0>(input)}) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.waitForKeypress == std::get<1>(input) + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="abort" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="wait-for-keypress" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="Accepted options" 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", "--wait-for-keypress", std::get<0>(input)}) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.waitForKeypress == std::get<1>(input) + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="abort" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="wait-for-keypress" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="Accepted options" 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", "--wait-for-keypress", std::get<0>(input)}) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.waitForKeypress == std::get<1>(input) + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="abort" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="wait-for-keypress" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="Accepted options" 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", "--wait-for-keypress", std::get<0>(input)}) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.waitForKeypress == std::get<1>(input) + </Original> + <Expanded> + 3 == 3 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="abort" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="wait-for-keypress" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="invalid options are reported" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + !result + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + result.errorMessage(), Contains("never") && Contains("both") + </Original> + <Expanded> + "keypress argument must be one of: never, start, exit or both. 'sometimes' not recognised" ( contains: "never" and contains: "both" ) + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> <Section name="nothrow" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Section name="-e" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > @@ -15912,7 +16048,7 @@ loose text artifact </Section> <OverallResult success="true"/> </TestCase> - <OverallResults successes="1514" failures="149" expectedFailures="21"/> + <OverallResults successes="1525" failures="149" expectedFailures="21"/> </Group> - <OverallResults successes="1514" failures="148" expectedFailures="21"/> + <OverallResults successes="1525" 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 641f1b2941552e8b74af96025572d97c44a907da..6e590326fea00164e913ee310dbda020b05a40c0 100644 --- a/packages/Catch2/projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp +++ b/packages/Catch2/projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp @@ -412,9 +412,33 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]" #ifndef CATCH_CONFIG_DISABLE_MATCHERS REQUIRE_THAT(result.errorMessage(), Contains("convert") && Contains("oops")); +#endif + } + + SECTION("wait-for-keypress") { + SECTION("Accepted options") { + using tuple_type = std::tuple<char const*, Catch::WaitForKeypress::When>; + auto input = GENERATE(table<char const*, Catch::WaitForKeypress::When>({ + tuple_type{"never", Catch::WaitForKeypress::Never}, + tuple_type{"start", Catch::WaitForKeypress::BeforeStart}, + tuple_type{"exit", Catch::WaitForKeypress::BeforeExit}, + tuple_type{"both", Catch::WaitForKeypress::BeforeStartAndExit}, + })); + CHECK(cli.parse({"test", "--wait-for-keypress", std::get<0>(input)})); + + REQUIRE(config.waitForKeypress == std::get<1>(input)); + } + + SECTION("invalid options are reported") { + auto result = cli.parse({"test", "--wait-for-keypress", "sometimes"}); + CHECK(!result); + +#ifndef CATCH_CONFIG_DISABLE_MATCHERS + REQUIRE_THAT(result.errorMessage(), Contains("never") && Contains("both")); #endif } } + } SECTION("nothrow") { SECTION("-e") { diff --git a/packages/Catch2/projects/SelfTest/UsageTests/Compilation.tests.cpp b/packages/Catch2/projects/SelfTest/UsageTests/Compilation.tests.cpp index 11d136a469bd84cccc1e2cecc0028568bccba706..0baf2842ba4de01494b6f8628d2c3fad3bf4c6de 100644 --- a/packages/Catch2/projects/SelfTest/UsageTests/Compilation.tests.cpp +++ b/packages/Catch2/projects/SelfTest/UsageTests/Compilation.tests.cpp @@ -205,10 +205,19 @@ namespace { namespace CompilationTests { inline static void synchronizing_callback( void * ) { } } +#if defined (_MSC_VER) +#pragma warning(push) +// The function pointer comparison below triggers warning because of +// calling conventions +#pragma warning(disable:4244) +#endif TEST_CASE("#925: comparing function pointer to function address failed to compile", "[!nonportable]" ) { TestClass test; REQUIRE(utility::synchronizing_callback != test.testMethod_uponComplete_arg); } +#if defined (_MSC_VER) +#pragma warning(pop) +#endif TEST_CASE( "#1027: Bitfields can be captured" ) { struct Y { @@ -219,6 +228,9 @@ namespace { namespace CompilationTests { REQUIRE( 0 == y.v ); } + TEST_CASE("Lambdas in assertions") { + REQUIRE([]() { return true; }()); + } }} // namespace CompilationTests diff --git a/packages/Catch2/scripts/approvalTests.py b/packages/Catch2/scripts/approvalTests.py index dad2a96b7f7d6dce75a49be55936c537d2b3465b..838a1a78fab0cd96e67279f9dff856a31aaad4f5 100755 --- a/packages/Catch2/scripts/approvalTests.py +++ b/packages/Catch2/scripts/approvalTests.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from __future__ import print_function diff --git a/packages/Catch2/scripts/approve.py b/packages/Catch2/scripts/approve.py index f03417dcb3273c699e691e3abccb16a51b6e9ee5..1e0d5a7a543c69a05c3478a408791e25b025d321 100755 --- a/packages/Catch2/scripts/approve.py +++ b/packages/Catch2/scripts/approve.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from __future__ import print_function diff --git a/packages/Catch2/scripts/benchmarkCompile.py b/packages/Catch2/scripts/benchmarkCompile.py index 586c26ac01d24eb7ecb270dd3ea6880bddbaebd2..34113b9e12115c628b3df6150cf8e899c61b7067 100755 --- a/packages/Catch2/scripts/benchmarkCompile.py +++ b/packages/Catch2/scripts/benchmarkCompile.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from __future__ import print_function diff --git a/packages/Catch2/scripts/developBuild.py b/packages/Catch2/scripts/developBuild.py index a8115fe2c8ddf395cf0f95256806b4a07ab0e899..9252c7d63860c3cf2de341c0d029dfaf18d63efe 100755 --- a/packages/Catch2/scripts/developBuild.py +++ b/packages/Catch2/scripts/developBuild.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from __future__ import print_function import releaseCommon diff --git a/packages/Catch2/scripts/embedClara.py b/packages/Catch2/scripts/embedClara.py index 7ceb3e32e2241ef74d71fc31143ff49311205ac7..d8c1520a919b7958936abdb2171d1f8788d3f133 100755 --- a/packages/Catch2/scripts/embedClara.py +++ b/packages/Catch2/scripts/embedClara.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Execute this script any time you import a new copy of Clara into the third_party area import os diff --git a/packages/Catch2/scripts/extractFeaturesFromReleaseNotes.py b/packages/Catch2/scripts/extractFeaturesFromReleaseNotes.py index 090f4772ad1acded8b6472b9a50df1efea007692..11f4955c0b4be262460e83f0a138684883eb9512 100644 --- a/packages/Catch2/scripts/extractFeaturesFromReleaseNotes.py +++ b/packages/Catch2/scripts/extractFeaturesFromReleaseNotes.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # extractFeaturesFromReleaseNotes.py diff --git a/packages/Catch2/scripts/fixWhitespace.py b/packages/Catch2/scripts/fixWhitespace.py index bfa4aa08e6f13080e8723bb630698df2341a3d24..4591c1c444f5352c330cfcc12e34c0db9ccb91d0 100755 --- a/packages/Catch2/scripts/fixWhitespace.py +++ b/packages/Catch2/scripts/fixWhitespace.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from __future__ import print_function import os diff --git a/packages/Catch2/scripts/generateSingleHeader.py b/packages/Catch2/scripts/generateSingleHeader.py index ef14f5f157eb8ed1f4106d9bc0f27c460c4d697b..ffd1178035be680668b044f1a63949c3c11867e7 100755 --- a/packages/Catch2/scripts/generateSingleHeader.py +++ b/packages/Catch2/scripts/generateSingleHeader.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from __future__ import print_function diff --git a/packages/Catch2/scripts/majorRelease.py b/packages/Catch2/scripts/majorRelease.py index 8da34066c53c5bd151fc40482353bc461c8a9da9..e9e285a898b967d041ee86e78290a843c97819df 100755 --- a/packages/Catch2/scripts/majorRelease.py +++ b/packages/Catch2/scripts/majorRelease.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from __future__ import print_function import releaseCommon diff --git a/packages/Catch2/scripts/minorRelease.py b/packages/Catch2/scripts/minorRelease.py index 6e71cd80ec751012c863b2eedd37980e8da1cabe..2b57c2eab59075b62b8cee604dc32e8299a8f559 100755 --- a/packages/Catch2/scripts/minorRelease.py +++ b/packages/Catch2/scripts/minorRelease.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from __future__ import print_function import releaseCommon diff --git a/packages/Catch2/scripts/patchRelease.py b/packages/Catch2/scripts/patchRelease.py index 14176420655cd3b4f5ca8d6798a8c945d7acc85a..d20db714c4341875bfed8a8a63e1e726f44668bb 100755 --- a/packages/Catch2/scripts/patchRelease.py +++ b/packages/Catch2/scripts/patchRelease.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from __future__ import print_function import releaseCommon diff --git a/packages/Catch2/scripts/releaseNotes.py b/packages/Catch2/scripts/releaseNotes.py index 5e770bba7642625435bb3b78a5d015e2377e2f0d..7f580e9839be556952b3fceaa726820e3c8a979e 100755 --- a/packages/Catch2/scripts/releaseNotes.py +++ b/packages/Catch2/scripts/releaseNotes.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from __future__ import print_function diff --git a/packages/Catch2/scripts/updateDocumentToC.py b/packages/Catch2/scripts/updateDocumentToC.py index 325c8a3c2e8bc378896928d2688db1d9e856f15a..41b48752cf68ded013ebabee38d489a229607c3c 100644 --- a/packages/Catch2/scripts/updateDocumentToC.py +++ b/packages/Catch2/scripts/updateDocumentToC.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # updateDocumentToC.py diff --git a/packages/Catch2/scripts/updateWandbox.py b/packages/Catch2/scripts/updateWandbox.py index b448713dc590e9b5169116a68a9d62381eff80f5..3668da52a5f70f2119ab93495bf8e1caa2d819b4 100644 --- a/packages/Catch2/scripts/updateWandbox.py +++ b/packages/Catch2/scripts/updateWandbox.py @@ -1,16 +1,22 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import json import os -import urllib2 +import urllib.request +import urllib.parse + from scriptCommon import catchPath def upload(options): - request = urllib2.Request('http://melpon.org/wandbox/api/compile.json') - request.add_header('Content-Type', 'application/json') - response = urllib2.urlopen(request, json.dumps(options)) - return json.loads(response.read()) +# request_blah = urllib.request.Request('https:// + + request = urllib.request.Request('https://melpon.org/wandbox/api/compile.json', method='POST') + json_bytes = json.dumps(options).encode('utf-8') + request.add_header('Content-Type', 'application/json; charset=utf-8') + request.add_header('Content-Length', len(json_bytes)) + response = urllib.request.urlopen(request, json_bytes) + return json.loads(response.read().decode('utf-8')) main_file = ''' #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file diff --git a/packages/Catch2/single_include/catch2/catch.hpp b/packages/Catch2/single_include/catch2/catch.hpp index 6c1756a6cef5bf87eacb7aba0f3575bab2e1ae18..51618b38e9e4706602c2ce267b12b419987730d9 100644 --- a/packages/Catch2/single_include/catch2/catch.hpp +++ b/packages/Catch2/single_include/catch2/catch.hpp @@ -1,9 +1,9 @@ /* - * Catch v2.11.1 - * Generated: 2019-12-28 21:22:11.930976 + * Catch v2.11.3 + * Generated: 2020-03-19 13:44:21.042491 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly - * Copyright (c) 2019 Two Blue Cubes Ltd. All rights reserved. + * Copyright (c) 2020 Two Blue Cubes Ltd. 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) @@ -15,7 +15,7 @@ #define CATCH_VERSION_MAJOR 2 #define CATCH_VERSION_MINOR 11 -#define CATCH_VERSION_PATCH 1 +#define CATCH_VERSION_PATCH 3 #ifdef __clang__ # pragma clang system_header @@ -141,6 +141,9 @@ namespace Catch { #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" ) + +# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) + #endif #if defined(__clang__) @@ -148,6 +151,8 @@ namespace Catch { # define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic push" ) # define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic pop" ) +# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) + # define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) \ _Pragma( "clang diagnostic ignored \"-Wglobal-constructors\"") @@ -294,7 +299,7 @@ namespace Catch { #define CATCH_CONFIG_COLOUR_NONE #endif -#if defined(__UCLIBC__) +#if !defined(_GLIBCXX_USE_C99_MATH_TR1) #define CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER #endif @@ -420,6 +425,12 @@ namespace Catch { # define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS #endif +// The goal of this macro is to avoid evaluation of the arguments, but +// still have the compiler warn on problems inside... +#if !defined(CATCH_INTERNAL_IGNORE_BUT_WARN) +# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) +#endif + #if defined(__APPLE__) && defined(__apple_build_version__) && (__clang_major__ < 10) # undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS #elif defined(__clang__) && (__clang_major__ < 5) @@ -2663,6 +2674,7 @@ namespace Catch { /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_TEST( macroName, resultDisposition, ... ) \ do { \ + CATCH_INTERNAL_IGNORE_BUT_WARN(__VA_ARGS__); \ Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \ INTERNAL_CATCH_TRY { \ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ @@ -2671,8 +2683,7 @@ namespace Catch { 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 - // The double negation silences MSVC's C4800 warning, the static_cast forces short-circuit evaluation if the type has overloaded &&. + } while( (void)0, (false) && static_cast<bool>( !!(__VA_ARGS__) ) ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_IF( macroName, resultDisposition, ... ) \ @@ -3266,9 +3277,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; @@ -3299,9 +3311,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; @@ -4411,6 +4424,7 @@ namespace Catch { } // end namespace Catch // end catch_option.hpp +#include <chrono> #include <iosfwd> #include <string> #include <vector> @@ -4481,6 +4495,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>; @@ -5234,6 +5249,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; @@ -5299,6 +5315,7 @@ namespace Catch { int benchmarkSamples() const override; double benchmarkConfidenceInterval() const override; unsigned int benchmarkResamples() const override; + std::chrono::milliseconds benchmarkWarmupTime() const override; private: @@ -6884,11 +6901,13 @@ namespace Catch { #include <algorithm> #include <functional> #include <vector> +#include <iterator> #include <numeric> #include <tuple> #include <cmath> #include <utility> #include <cstddef> +#include <random> namespace Catch { namespace Benchmark { @@ -7238,10 +7257,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> @@ -7868,8 +7887,10 @@ namespace Catch { #define CATCH_TRAP() __asm__("int $3") #elif defined(__aarch64__) #define CATCH_TRAP() __asm__(".inst 0xd4200000") - #elif defined(__arm__) + #elif defined(__arm__) && !defined(__thumb__) #define CATCH_TRAP() __asm__(".inst 0xe7f001f0") + #elif defined(__arm__) && defined(__thumb__) + #define CATCH_TRAP() __asm__(".inst 0xde01") #endif #elif defined(CATCH_PLATFORM_LINUX) @@ -7890,10 +7911,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 // end catch_debugger.h @@ -9665,8 +9688,7 @@ 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 @@ -9707,14 +9729,16 @@ namespace Catch { }; auto const setWaitForKeypress = [&]( std::string const& keypress ) { auto keypressLc = toLower( keypress ); - if( keypressLc == "start" ) + if (keypressLc == "never") + config.waitForKeypress = WaitForKeypress::Never; + else if( keypressLc == "start" ) config.waitForKeypress = WaitForKeypress::BeforeStart; else if( keypressLc == "exit" ) config.waitForKeypress = WaitForKeypress::BeforeExit; else if( keypressLc == "both" ) config.waitForKeypress = WaitForKeypress::BeforeStartAndExit; else - return ParserResult::runtimeError( "keypress argument must be one of: start, exit or both. '" + keypress + "' not recognised" ); + return ParserResult::runtimeError( "keypress argument must be one of: never, start, exit or both. '" + keypress + "' not recognised" ); return ParserResult::ok( ParseResultType::Matched ); }; auto const setVerbosity = [&]( std::string const& verbosity ) { @@ -9814,7 +9838,7 @@ namespace Catch { | Opt( config.libIdentify ) ["--libidentify"] ( "report name and version according to libidentify standard" ) - | Opt( setWaitForKeypress, "start|exit|both" ) + | Opt( setWaitForKeypress, "never|start|exit|both" ) ["--wait-for-keypress"] ( "waits for a keypress before exiting" ) | Opt( config.benchmarkSamples, "samples" ) @@ -9829,7 +9853,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; @@ -9936,10 +9963,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); @@ -9980,7 +10008,7 @@ namespace Catch { }; struct NoColourImpl : IColourImpl { - void use( Colour::Code ) {} + void use( Colour::Code ) override {} static IColourImpl* instance() { static NoColourImpl s_instance; @@ -10153,13 +10181,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; } @@ -10171,7 +10199,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 ); } } @@ -10524,7 +10552,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; } @@ -11100,7 +11128,7 @@ namespace Catch { 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 { @@ -11134,7 +11162,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 ) { @@ -11172,7 +11200,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 { @@ -11364,16 +11392,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); } @@ -11382,18 +11402,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) { @@ -11772,7 +11782,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 += " := "; @@ -11780,7 +11790,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 += " := "; @@ -13268,11 +13278,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 ); @@ -13871,7 +13881,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 ); @@ -14282,8 +14293,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() ); } } @@ -15068,7 +15079,7 @@ namespace Catch { } Version const& libraryVersion() { - static Version version( 2, 11, 1, "", 0 ); + static Version version( 2, 11, 3, "", 0 ); return version; } @@ -15118,8 +15129,6 @@ namespace Catch { #include <iomanip> #include <type_traits> -using uchar = unsigned char; - namespace Catch { namespace { @@ -15192,7 +15201,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; @@ -15252,7 +15261,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); } @@ -15981,15 +15990,11 @@ class Duration { static const uint64_t s_nanosecondsInASecond = 1000 * s_nanosecondsInAMillisecond; static const uint64_t s_nanosecondsInAMinute = 60 * s_nanosecondsInASecond; - uint64_t m_inNanoseconds; + double m_inNanoseconds; Unit m_units; public: - explicit Duration(double inNanoseconds, Unit units = Unit::Auto) - : Duration(static_cast<uint64_t>(inNanoseconds), units) { - } - - explicit Duration(uint64_t inNanoseconds, Unit units = Unit::Auto) + explicit Duration(double inNanoseconds, Unit units = Unit::Auto) : m_inNanoseconds(inNanoseconds), m_units(units) { if (m_units == Unit::Auto) { @@ -16018,7 +16023,7 @@ public: case Unit::Minutes: return m_inNanoseconds / static_cast<double>(s_nanosecondsInAMinute); default: - return static_cast<double>(m_inNanoseconds); + return m_inNanoseconds; } } auto unitsAsString() const -> std::string { @@ -16454,8 +16459,10 @@ void ConsoleReporter::printSummaryDivider() { } void ConsoleReporter::printTestFilters() { - if (m_config->testSpec().hasFilters()) - stream << Colour(Colour::BrightYellow) << "Filters: " << serializeFilters( m_config->getTestsOrTags() ) << '\n'; + if (m_config->testSpec().hasFilters()) { + Colour guard(Colour::BrightYellow); + stream << "Filters: " << serializeFilters(m_config->getTestsOrTags()) << '\n'; + } } CATCH_REGISTER_REPORTER("console", ConsoleReporter) @@ -16681,11 +16688,7 @@ namespace Catch { elementName = "error"; break; case ResultWas::ExplicitFailure: - elementName = "failure"; - break; case ResultWas::ExpressionFailed: - elementName = "failure"; - break; case ResultWas::DidntThrowException: elementName = "failure"; break; @@ -17111,16 +17114,16 @@ namespace Catch { m_xml.writeAttribute("samples", info.samples) .writeAttribute("resamples", info.resamples) .writeAttribute("iterations", info.iterations) - .writeAttribute("clockResolution", static_cast<uint64_t>(info.clockResolution)) - .writeAttribute("estimatedDuration", static_cast<uint64_t>(info.estimatedDuration)) + .writeAttribute("clockResolution", info.clockResolution) + .writeAttribute("estimatedDuration", info.estimatedDuration) .writeComment("All values in nano seconds"); } void XmlReporter::benchmarkEnded(BenchmarkStats<> const& benchmarkStats) { m_xml.startElement("mean") - .writeAttribute("value", static_cast<uint64_t>(benchmarkStats.mean.point.count())) - .writeAttribute("lowerBound", static_cast<uint64_t>(benchmarkStats.mean.lower_bound.count())) - .writeAttribute("upperBound", static_cast<uint64_t>(benchmarkStats.mean.upper_bound.count())) + .writeAttribute("value", benchmarkStats.mean.point.count()) + .writeAttribute("lowerBound", benchmarkStats.mean.lower_bound.count()) + .writeAttribute("upperBound", benchmarkStats.mean.upper_bound.count()) .writeAttribute("ci", benchmarkStats.mean.confidence_interval); m_xml.endElement(); m_xml.startElement("standardDeviation") @@ -17171,7 +17174,7 @@ namespace Catch { #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/tests/mpi_test_Messenger.cpp b/tests/mpi_test_Messenger.cpp index 4d446ba65c51b27f16fe4a63cec52f956cc150b8..7dae0088d7453e71f4b91489a5beee1956d5c891 100644 --- a/tests/mpi_test_Messenger.cpp +++ b/tests/mpi_test_Messenger.cpp @@ -32,6 +32,13 @@ struct integer m_int = i; return *this; } + + template <typename T> + bool + operator==(const T& t) const + { + return m_int == static_cast<int>(t); + } }; struct tri_int @@ -102,11 +109,11 @@ TEST_CASE("Messenger", "[mpi]") { int rank = 0; IF_MPI(MPI_Comm_rank(MPI_COMM_WORLD, &rank)); - REQUIRE(rank == parallel::rank()); + REQUIRE(rank == static_cast<int>(parallel::rank())); int size = 1; IF_MPI(MPI_Comm_size(MPI_COMM_WORLD, &size)); - REQUIRE(size == parallel::size()); + REQUIRE(size == static_cast<int>(parallel::size())); } SECTION("reduction") @@ -115,7 +122,7 @@ TEST_CASE("Messenger", "[mpi]") REQUIRE(min_value == 3); const int max_value = parallel::allReduceMax(parallel::rank() + 3); - REQUIRE(max_value == ((parallel::size() - 1) + 3)); + REQUIRE(max_value == static_cast<int>((parallel::size() - 1) + 3)); } SECTION("all to all") @@ -321,23 +328,23 @@ TEST_CASE("Messenger", "[mpi]") SECTION("all array exchanges") { { // simple type - std::vector<Array<const int>> send_array_list(parallel::size()); + std::vector<Array<const size_t>> send_array_list(parallel::size()); for (size_t i = 0; i < send_array_list.size(); ++i) { - Array<int> send_array(i + 1); + Array<size_t> send_array(i + 1); for (size_t j = 0; j < send_array.size(); ++j) { send_array[j] = (parallel::rank() + 1) * j; } send_array_list[i] = send_array; } - std::vector<Array<int>> recv_array_list(parallel::size()); + std::vector<Array<size_t>> recv_array_list(parallel::size()); for (size_t i = 0; i < recv_array_list.size(); ++i) { - recv_array_list[i] = Array<int>(parallel::rank() + 1); + recv_array_list[i] = Array<size_t>(parallel::rank() + 1); } parallel::exchange(send_array_list, recv_array_list); for (size_t i = 0; i < parallel::size(); ++i) { - const Array<const int> recv_array = recv_array_list[i]; + const Array<const size_t> recv_array = recv_array_list[i]; for (size_t j = 0; j < recv_array.size(); ++j) { REQUIRE(recv_array[j] == (i + 1) * j); }