Compare commits

..

28 Commits

Author SHA1 Message Date
Martin Hořeňovský
fd9f5ac661 v2.13.1 2020-09-07 12:34:55 +02:00
Dawid Kurek
f0dc4d9be0 Remove superfluous values
The `0`s were needed for the expansion of parameter pack for the sake of
expander. Now when we have `index++` it is no more needed.
2020-08-27 11:15:58 +02:00
Sean Middleditch
284672cc84 Support sentinel-based ranges in default stringify (#2004) 2020-08-18 10:34:47 +02:00
mattkurz
2b34b5c7d0 Fix typo in generators docs 2020-08-03 23:33:32 +02:00
Gregory Bond
708487d201 Issue 1992: Better c++17 std::byte detection
This fixed buld errors for ubuntu-16 + clang and similar situations
where C++17 is supported in the compiler but not the default
C++ standard library.
2020-08-03 14:38:56 +02:00
James Touton
6859c683e0 Don't apply global settings when configuring as a subproject. 2020-08-01 19:42:30 +02:00
Karthik Nishanth
de3a208e16 Update ParseAndAddCatchTests.cmake 2020-08-01 19:40:29 +02:00
Reinhold Gschweicher
229cc4823c Fix CMake add test helper for CMake 3.18.0
With CMake 3.18.0 the `add_test(NAME)` handling changed. The escaped
double quotes confuse the new call. Work around this upstream change.

fixes: https://github.com/catchorg/Catch2/issues/1984
2020-07-17 23:56:33 +02:00
Martin Hořeňovský
7f21cc6c55 v2.13.0 2020-07-12 20:28:38 +02:00
Martin Hořeňovský
4c85248179 Fixup whitespace in TAPReporter 2020-07-12 20:27:25 +02:00
Martin Hořeňovský
b4e2237152 Remove pointless CompactReporter::getPreferences override 2020-07-12 20:06:14 +02:00
Martin Hořeňovský
40937b67c7 Merge pull request #1983 from s7726/patch-1
Update catch_reporter_tap.hpp
2020-07-12 20:00:03 +02:00
Martin Hořeňovský
0d5b131394 Improve documentation for --min-duration 2020-07-12 16:27:55 +02:00
Martin Hořeňovský
ad3b90553b Document GENERATE's new usage between SECTIONs 2020-07-12 16:24:32 +02:00
Gavin S
b1c45652e5 Update catch_reporter_tap.hpp
TAP format requires all results to be reported.
Removed extraneous preferences function (handled by parent)
Incorporated fix from 3d9e7db2e0
Simplified total printing
2020-07-12 01:17:37 -07:00
Martin Hořeňovský
b79a83e4aa Modify generator tracking to allow GENERATEs between SECTIONs
This means that code such as

```cpp
TEST_CASE() {
    SECTION("first") { SUCCEED(); }
    auto _ = GENERATE(1, 2);
    SECTION("second") { SUCCEED(); }
}
```

will run and report 3 assertions, 1 from section "first" and 2
from section "second". This also applies for greater and potentially
more confusing nesting, but fundamentally it is up to the user to
avoid overly complex and confusing nestings, just as with `SECTION`s.

The old behaviour of `GENERATE` as first thing in a `TEST_CASE`,
`GENERATE` not followed by a `SECTION`, etc etc should be unchanged.

Closes #1938
2020-07-11 23:16:07 +02:00
Martin Hořeňovský
89fe35d515 Fix how testRandomOrder.py builds tag arguments 2020-07-11 21:32:10 +02:00
Martin Hořeňovský
115d6a1c40 Increase tolerances in --min-duration tests
The underpowered and oversubscribed CI servers are hell.
2020-07-07 11:36:56 +02:00
Martin Hořeňovský
91576352f9 Fixup single_include to be consistent with last tag
Closes #1975
2020-07-07 11:32:05 +02:00
Martin Hořeňovský
6f7c191513 --min-duration is overriden by -d no 2020-07-06 20:33:08 +02:00
Martin Hořeňovský
4eb9d37e05 Refactor tests for duration reporting threshold 2020-07-06 20:02:20 +02:00
John Bytheway
53d8af8e96 Test for --min-duration 2020-07-06 11:35:02 +02:00
John Bytheway
46fde0c597 Add --min-duration option
A test runner already has a --durations option to print durations.
However, this isn't entirely satisfactory.

When there are many tests, this produces output spam which makes it hard
to find the test failure output.  Nevertheless, it is helpful to be
informed of tests which are unusually slow.

Therefore, introduce a new option --min-duration that causes all
durations above a certain threshold to be printed.  This allows slow
tests to be visible without mentioning every test.
2020-07-06 11:35:02 +02:00
Martin Hořeňovský
de103db696 Merge pull request #1973 from echuber2/patch-1
Escaping "*" ("times") to fix Markdown presentation
2020-07-06 11:34:22 +02:00
Eric Huber
fedc3a7b7b Escaping literal "*" ("times") to fix markdown 2020-07-05 17:04:00 -05:00
Martin Hořeňovský
c299133a31 v2.12.4 2020-07-05 11:51:30 +02:00
Martin Hořeňovský
09b8017ea3 Update FUNDING file (-Patreon, +PayPal) 2020-07-04 20:06:27 +02:00
George Rhoten
bad3c93049 Fix for macOS on ARM 2020-07-01 19:28:50 +02:00
42 changed files with 1697 additions and 130 deletions

2
.github/FUNDING.yml vendored
View File

@@ -1 +1 @@
patreon: horenmar
custom: "https://www.paypal.me/horenmar"

View File

@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5)
# detect if Catch is being bundled,
# disable testsuite in that case
if(NOT DEFINED PROJECT_NAME)
set(NOT_SUBPROJECT ON)
set(NOT_SUBPROJECT ON)
endif()
# Catch2's build breaks if done in-tree. You probably should not build
@@ -14,14 +14,12 @@ if (CMAKE_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
endif()
project(Catch2 LANGUAGES CXX VERSION 2.12.3)
project(Catch2 LANGUAGES CXX VERSION 2.13.1)
# Provide path for scripts
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake")
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
include(CTest)
option(CATCH_USE_VALGRIND "Perform SelfTests with Valgrind" OFF)
option(CATCH_BUILD_TESTING "Build SelfTest project" ON)
@@ -33,8 +31,6 @@ option(CATCH_INSTALL_DOCS "Install documentation alongside library" ON)
option(CATCH_INSTALL_HELPERS "Install contrib alongside library" ON)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# define some folders
set(CATCH_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(SELF_TEST_DIR ${CATCH_DIR}/projects/SelfTest)
@@ -45,12 +41,16 @@ if(USE_WMAIN)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:wmainCRTStartup")
endif()
if (BUILD_TESTING AND CATCH_BUILD_TESTING AND NOT_SUBPROJECT)
find_package(PythonInterp)
if (NOT PYTHONINTERP_FOUND)
message(FATAL_ERROR "Python not found, but required for tests")
if(NOT_SUBPROJECT)
include(CTest)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
if(BUILD_TESTING AND CATCH_BUILD_TESTING)
find_package(PythonInterp)
if (NOT PYTHONINTERP_FOUND)
message(FATAL_ERROR "Python not found, but required for tests")
endif()
add_subdirectory(projects)
endif()
add_subdirectory(projects)
endif()
if(CATCH_BUILD_EXAMPLES)
@@ -107,6 +107,7 @@ add_library(Catch2::Catch2 ALIAS Catch2)
# a subproject via `add_subdirectory`, or the destinations will break,
# see https://github.com/catchorg/Catch2/issues/1373
if (NOT_SUBPROJECT)
include(CMakePackageConfigHelpers)
set(CATCH_CMAKE_CONFIG_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Catch2")
configure_package_config_file(

View File

@@ -5,11 +5,11 @@
[![Build Status](https://travis-ci.org/catchorg/Catch2.svg?branch=master)](https://travis-ci.org/catchorg/Catch2)
[![Build status](https://ci.appveyor.com/api/projects/status/github/catchorg/Catch2?svg=true)](https://ci.appveyor.com/project/catchorg/catch2)
[![codecov](https://codecov.io/gh/catchorg/Catch2/branch/master/graph/badge.svg)](https://codecov.io/gh/catchorg/Catch2)
[![Try online](https://img.shields.io/badge/try-online-blue.svg)](https://wandbox.org/permlink/yfl7WhNJBY0IpgtF)
[![Try online](https://img.shields.io/badge/try-online-blue.svg)](https://wandbox.org/permlink/6JUH8Eybx4CtvkJS)
[![Join the chat in Discord: https://discord.gg/4CWS9zD](https://img.shields.io/badge/Discord-Chat!-brightgreen.svg)](https://discord.gg/4CWS9zD)
<a href="https://github.com/catchorg/Catch2/releases/download/v2.12.3/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.13.1/catch.hpp">The latest version of the single header can be downloaded directly using this link</a>
## Catch2 is released!

View File

@@ -189,24 +189,29 @@ function(ParseAndAddCatchTests_ParseFile SourceFile TestTarget)
# Escape commas in the test spec
string(REPLACE "," "\\," Name ${Name})
# Work around CMake 3.18.0 change in `add_test()`, before the escaped quotes were neccessary,
# only with CMake 3.18.0 the escaped double quotes confuse the call. This change is reverted in 3.18.1
if(NOT ${CMAKE_VERSION} VERSION_EQUAL "3.18")
set(CTestName "\"${CTestName}\"")
endif()
# Add the test and set its properties
add_test(NAME "\"${CTestName}\"" COMMAND ${OptionalCatchTestLauncher} $<TARGET_FILE:${TestTarget}> ${Name} ${AdditionalCatchParameters})
add_test(NAME "${CTestName}" COMMAND ${OptionalCatchTestLauncher} $<TARGET_FILE:${TestTarget}> ${Name} ${AdditionalCatchParameters})
# Old CMake versions do not document VERSION_GREATER_EQUAL, so we use VERSION_GREATER with 3.8 instead
if(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS AND ${HiddenTagFound} AND ${CMAKE_VERSION} VERSION_GREATER "3.8")
ParseAndAddCatchTests_PrintDebugMessage("Setting DISABLED test property")
set_tests_properties("\"${CTestName}\"" PROPERTIES DISABLED ON)
set_tests_properties("${CTestName}" PROPERTIES DISABLED ON)
else()
set_tests_properties("\"${CTestName}\"" PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran"
set_tests_properties("${CTestName}" PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran"
LABELS "${Labels}")
endif()
set_property(
TARGET ${TestTarget}
APPEND
PROPERTY ParseAndAddCatchTests_TESTS "\"${CTestName}\"")
PROPERTY ParseAndAddCatchTests_TESTS "${CTestName}")
set_property(
SOURCE ${SourceFile}
APPEND
PROPERTY ParseAndAddCatchTests_TESTS "\"${CTestName}\"")
PROPERTY ParseAndAddCatchTests_TESTS "${CTestName}")
endif()

View File

@@ -222,6 +222,16 @@ available warnings
When set to ```yes``` Catch will report the duration of each test case, in milliseconds. Note that it does this regardless of whether a test case passes or fails. Note, also, the certain reporters (e.g. Junit) always report test case durations regardless of this option being set or not.
<pre>-D, --min-duration &lt;value></pre>
> `--min-duration` was [introduced](https://github.com/catchorg/Catch2/pull/1910) in Catch 2.13.0
When set, Catch will report the duration of each test case that took more
than &lt;value> seconds, in milliseconds. This option is overriden by both
`-d yes` and `-d no`, so that either all durations are reported, or none
are.
<a id="input-file"></a>
## Load test names to run from a file
<pre>-f, --input-file &lt;filename></pre>

View File

@@ -11,6 +11,38 @@ are run once per each value in a generator.
This is best explained with an example:
```cpp
TEST_CASE("Generators") {
auto i = GENERATE(1, 3, 5);
REQUIRE(is_odd(i));
}
```
The "Generators" `TEST_CASE` will be entered 3 times, and the value of
`i` will be 1, 3, and 5 in turn. `GENERATE`s can also be used multiple
times at the same scope, in which case the result will be a cartesian
product of all elements in the generators. This means that in the snippet
below, the test case will be run 6 (2\*3) times.
```cpp
TEST_CASE("Generators") {
auto i = GENERATE(1, 2);
auto j = GENERATE(3, 4, 5);
}
```
There are 2 parts to generators in Catch2, the `GENERATE` macro together
with the already provided generators, and the `IGenerator<T>` interface
that allows users to implement their own generators.
## Combining `GENERATE` and `SECTION`.
`GENERATE` can be seen as an implicit `SECTION`, that goes from the place
`GENERATE` is used, to the end of the scope. This can be used for various
effects. The simplest usage is shown below, where the `SECTION` "one"
runs 4 (2\*2) times, and `SECTION` "two" is run 6 times (2\*3).
```
TEST_CASE("Generators") {
auto i = GENERATE(1, 2);
SECTION("one") {
@@ -24,29 +56,43 @@ TEST_CASE("Generators") {
}
```
The `SECTION` "one" will be run 4 (2*2) times, because the outer
generator has 2 elements in it, and the inner generator also has 2
elements in it. The `SECTION` "two" will be run 6 (2*3) times. The
sections will be run in order "one", "one", "two", "two", "two", "one",
...
The specific order of the `SECTION`s will be "one", "one", "two", "two",
"two", "one"...
It is also possible to have multiple generators at the same level of
nesting. The result is the same as when generators are inside nested
sections, that is, the result will be a cartesian product of all
elements. This means that in the snippet below, the test case will be
run 6 (2*3) times.
The fact that `GENERATE` introduces a virtual `SECTION` can also be used
to make a generator replay only some `SECTION`s, without having to
explicitly add a `SECTION`. As an example, the code below reports 3
assertions, because the "first" section is run once, but the "second"
section is run twice.
```cpp
TEST_CASE("Generators") {
auto i = GENERATE(1, 2);
auto j = GENERATE(3, 4, 5);
TEST_CASE("GENERATE between SECTIONs") {
SECTION("first") { REQUIRE(true); }
auto _ = GENERATE(1, 2);
SECTION("second") { REQUIRE(true); }
}
```
This can lead to surprisingly complex test flows. As an example, the test
below will report 14 assertions:
There are 2 parts to generators in Catch2, the `GENERATE` macro together
with the already provided generators, and the `IGenerator<T>` interface
that allows users to implement their own generators.
```cpp
TEST_CASE("Complex mix of sections and generates") {
auto i = GENERATE(1, 2);
SECTION("A") {
SUCCEED("A");
}
auto j = GENERATE(3, 4);
SECTION("B") {
SUCCEED("B");
}
auto k = GENERATE(5, 6);
SUCCEED();
}
```
> The ability to place `GENERATE` between two `SECTION`s was [introduced](https://github.com/catchorg/Catch2/issues/1938) in Catch 2.13.0.
## Provided generators

View File

@@ -2,6 +2,9 @@
# Release notes
**Contents**<br>
[2.13.1](#2131)<br>
[2.13.0](#2130)<br>
[2.12.4](#2124)<br>
[2.12.3](#2123)<br>
[2.12.2](#2122)<br>
[2.12.1](#2121)<br>
@@ -39,6 +42,37 @@
[Even Older versions](#even-older-versions)<br>
## 2.13.1
### Improvements
* `ParseAndAddCatchTests` handles CMake v3.18.0 correctly (#1984)
* Improved autodetection of `std::byte` (#1992)
* Simplified implementation of templated test cases (#2007)
* This should have a tiny positive effect on its compilation throughput
### Fixes
* Automatic stringification of ranges handles sentinel ranges properly (#2004)
## 2.13.0
### Improvements
* `GENERATE` can now follow a `SECTION` at the same level of nesting (#1938)
* The `SECTION`(s) before the `GENERATE` will not be run multiple times, the following ones will.
* Added `-D`/`--min-duration` command line flag (#1910)
* If a test takes longer to finish than the provided value, its name and duration will be printed.
* This flag is overriden by setting `-d`/`--duration`.
### Fixes
* `TAPReporter` no longer skips successful assertions (#1983)
## 2.12.4
### Improvements
* Added support for MacOS on ARM (#1971)
## 2.12.3
### Fixes

View File

@@ -10,8 +10,8 @@
#define TWOBLUECUBES_CATCH_HPP_INCLUDED
#define CATCH_VERSION_MAJOR 2
#define CATCH_VERSION_MINOR 12
#define CATCH_VERSION_PATCH 3
#define CATCH_VERSION_MINOR 13
#define CATCH_VERSION_PATCH 1
#ifdef __clang__
# pragma clang system_header

View File

@@ -170,6 +170,9 @@ namespace Catch {
| Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, "yes|no" )
["-d"]["--durations"]
( "show test durations" )
| Opt( config.minDuration, "seconds" )
["-D"]["--min-duration"]
( "show test durations for tests taking at least the given number of seconds" )
| Opt( loadTestNamesFromFile, "filename" )
["-f"]["--input-file"]
( "load test names to run from a file" )

View File

@@ -240,7 +240,10 @@
// Check if byte is available and usable
# if __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER)
# define CATCH_INTERNAL_CONFIG_CPP17_BYTE
# include <cstddef>
# if __cpp_lib_byte > 0
# define CATCH_INTERNAL_CONFIG_CPP17_BYTE
# endif
# endif // __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER)
// Check if variant is available and usable

View File

@@ -64,6 +64,7 @@ namespace Catch {
bool Config::warnAboutMissingAssertions() const { return !!(m_data.warnings & WarnAbout::NoAssertions); }
bool Config::warnAboutNoTests() const { return !!(m_data.warnings & WarnAbout::NoTests); }
ShowDurations::OrNot Config::showDurations() const { return m_data.showDurations; }
double Config::minDuration() const { return m_data.minDuration; }
RunTests::InWhatOrder Config::runOrder() const { return m_data.runOrder; }
unsigned int Config::rngSeed() const { return m_data.rngSeed; }
UseColour::YesOrNo Config::useColour() const { return m_data.useColour; }

View File

@@ -52,6 +52,7 @@ namespace Catch {
Verbosity verbosity = Verbosity::Normal;
WarnAbout::What warnings = WarnAbout::Nothing;
ShowDurations::OrNot showDurations = ShowDurations::DefaultForReporter;
double minDuration = -1;
RunTests::InWhatOrder runOrder = RunTests::InDeclarationOrder;
UseColour::YesOrNo useColour = UseColour::Auto;
WaitForKeypress::When waitForKeypress = WaitForKeypress::Never;
@@ -103,6 +104,7 @@ namespace Catch {
bool warnAboutMissingAssertions() const override;
bool warnAboutNoTests() const override;
ShowDurations::OrNot showDurations() const override;
double minDuration() const override;
RunTests::InWhatOrder runOrder() const override;
unsigned int rngSeed() const override;
UseColour::YesOrNo useColour() const override;

View File

@@ -17,7 +17,11 @@ namespace Catch {
#ifdef CATCH_PLATFORM_MAC
#define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */
#if defined(__i386__) || defined(__x86_64__)
#define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */
#elif defined(__aarch64__)
#define CATCH_TRAP() __asm__(".inst 0xd4200000")
#endif
#elif defined(CATCH_PLATFORM_IPHONE)

View File

@@ -69,6 +69,7 @@ namespace Catch {
virtual int abortAfter() const = 0;
virtual bool showInvisibles() const = 0;
virtual ShowDurations::OrNot showDurations() const = 0;
virtual double minDuration() const = 0;
virtual TestSpec const& testSpec() const = 0;
virtual bool hasTestFilters() const = 0;
virtual std::vector<std::string> const& getTestsOrTags() const = 0;

View File

@@ -50,7 +50,7 @@ namespace Catch {
currentTracker.addChild( tracker );
}
if( !ctx.completedCycle() && !tracker->isComplete() ) {
if( !tracker->isComplete() ) {
tracker->open();
}
@@ -64,8 +64,28 @@ namespace Catch {
}
void close() override {
TrackerBase::close();
// Generator interface only finds out if it has another item on atual move
if (m_runState == CompletedSuccessfully && m_generator->next()) {
// If a generator has a child (it is followed by a section)
// and none of its children have started, then we must wait
// until later to start consuming its values.
// This catches cases where `GENERATE` is placed between two
// `SECTION`s.
// **The check for m_children.empty cannot be removed**.
// doing so would break `GENERATE` _not_ followed by `SECTION`s.
const bool should_wait_for_child =
!m_children.empty() &&
std::find_if( m_children.begin(),
m_children.end(),
[]( TestCaseTracking::ITrackerPtr tracker ) {
return tracker->hasStarted();
} ) == m_children.end();
// This check is a bit tricky, because m_generator->next()
// has a side-effect, where it consumes generator's current
// value, but we do not want to invoke the side-effect if
// this generator is still waiting for any child to start.
if ( should_wait_for_child ||
( m_runState == CompletedSuccessfully &&
m_generator->next() ) ) {
m_children.clear();
m_runState = Executing;
}
@@ -206,7 +226,6 @@ namespace Catch {
using namespace Generators;
GeneratorTracker& tracker = GeneratorTracker::acquire(m_trackerContext,
TestCaseTracking::NameAndLocation( static_cast<std::string>(generatorName), lineInfo ) );
assert( tracker.isOpen() );
m_lastAssertionInfo.lineInfo = lineInfo;
return tracker;
}

View File

@@ -187,7 +187,8 @@ namespace TestCaseTracking {
bool SectionTracker::isComplete() const {
bool complete = true;
if ((m_filters.empty() || m_filters[0] == "")
if (m_filters.empty()
|| m_filters[0] == ""
|| std::find(m_filters.begin(), m_filters.end(), m_trimmed_name) != m_filters.end()) {
complete = TrackerBase::isComplete();
}

View File

@@ -55,6 +55,7 @@ namespace TestCaseTracking {
virtual bool isSuccessfullyCompleted() const = 0;
virtual bool isOpen() const = 0; // Started but not complete
virtual bool hasChildren() const = 0;
virtual bool hasStarted() const = 0;
virtual ITracker& parent() = 0;
@@ -121,7 +122,9 @@ namespace TestCaseTracking {
bool isSuccessfullyCompleted() const override;
bool isOpen() const override;
bool hasChildren() const override;
bool hasStarted() const override {
return m_runState != NotStarted;
}
void addChild( ITrackerPtr const& child ) override;

View File

@@ -160,7 +160,7 @@ struct AutoReg : NonCopyable {
int index = 0; \
constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\
using expander = int[];\
(void)expander{(reg_test(Types{}, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++, 0)... };/* NOLINT */ \
(void)expander{(reg_test(Types{}, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++)... };/* NOLINT */ \
}\
};\
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
@@ -206,7 +206,7 @@ struct AutoReg : NonCopyable {
constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};\
constexpr char const* types_list[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};\
constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);\
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFuncName<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + "<" + std::string(types_list[index % num_types]) + ">", Tags } ), index++, 0)... };/* NOLINT */\
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFuncName<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + "<" + std::string(types_list[index % num_types]) + ">", Tags } ), index++)... };/* NOLINT */\
} \
}; \
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \
@@ -250,7 +250,7 @@ struct AutoReg : NonCopyable {
void reg_tests() { \
int index = 0; \
using expander = int[]; \
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFunc<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + " - " + std::to_string(index), Tags } ), index++, 0)... };/* NOLINT */\
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFunc<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + " - " + std::to_string(index), Tags } ), index++)... };/* NOLINT */\
} \
};\
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \
@@ -285,7 +285,7 @@ struct AutoReg : NonCopyable {
int index = 0; \
constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\
using expander = int[];\
(void)expander{(reg_test(Types{}, #ClassName, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++, 0)... };/* NOLINT */ \
(void)expander{(reg_test(Types{}, #ClassName, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++)... };/* NOLINT */ \
}\
};\
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
@@ -334,7 +334,7 @@ struct AutoReg : NonCopyable {
constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};\
constexpr char const* types_list[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};\
constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);\
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + "<" + std::string(types_list[index % num_types]) + ">", Tags } ), index++, 0)... };/* NOLINT */ \
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + "<" + std::string(types_list[index % num_types]) + ">", Tags } ), index++)... };/* NOLINT */ \
}\
};\
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
@@ -381,7 +381,7 @@ struct AutoReg : NonCopyable {
void reg_tests(){\
int index = 0;\
using expander = int[];\
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + " - " + std::to_string(index), Tags } ), index++, 0)... };/* NOLINT */ \
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + " - " + std::to_string(index), Tags } ), index++)... };/* NOLINT */ \
}\
};\
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\

View File

@@ -309,8 +309,8 @@ namespace Catch {
#endif
namespace Detail {
template<typename InputIterator>
std::string rangeToString(InputIterator first, InputIterator last) {
template<typename InputIterator, typename Sentinel = InputIterator>
std::string rangeToString(InputIterator first, Sentinel last) {
ReusableStringStream rss;
rss << "{ ";
if (first != last) {

View File

@@ -37,7 +37,7 @@ namespace Catch {
}
Version const& libraryVersion() {
static Version version( 2, 12, 3, "", 0 );
static Version version( 2, 13, 1, "", 0 );
return version;
}

View File

@@ -41,6 +41,17 @@ namespace Catch {
return std::string(buffer);
}
bool shouldShowDuration( IConfig const& config, double duration ) {
if ( config.showDurations() == ShowDurations::Always ) {
return true;
}
if ( config.showDurations() == ShowDurations::Never ) {
return false;
}
const double min = config.minDuration();
return min >= 0 && duration >= min;
}
std::string serializeFilters( std::vector<std::string> const& container ) {
ReusableStringStream oss;
bool first = true;

View File

@@ -25,6 +25,9 @@ namespace Catch {
// Returns double formatted as %.3f (format expected on output)
std::string getFormattedDuration( double duration );
//! Should the reporter show
bool shouldShowDuration( IConfig const& config, double duration );
std::string serializeFilters( std::vector<std::string> const& container );
template<typename DerivedT>
@@ -52,7 +55,7 @@ namespace Catch {
void noMatchingTestCases(std::string const&) override {}
void reportInvalidArguments(std::string const&) override {}
void testRunStarting(TestRunInfo const& _testRunInfo) override {
currentTestRunInfo = _testRunInfo;
}

View File

@@ -245,10 +245,6 @@ private:
return "Reports test results on a single line, suitable for IDEs";
}
ReporterPreferences CompactReporter::getPreferences() const {
return m_reporterPrefs;
}
void CompactReporter::noMatchingTestCases( std::string const& spec ) {
stream << "No test cases matched '" << spec << '\'' << std::endl;
}
@@ -275,8 +271,9 @@ private:
}
void CompactReporter::sectionEnded(SectionStats const& _sectionStats) {
if (m_config->showDurations() == ShowDurations::Always) {
stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl;
double dur = _sectionStats.durationInSeconds;
if ( shouldShowDuration( *m_config, dur ) ) {
stream << getFormattedDuration( dur ) << " s: " << _sectionStats.sectionInfo.name << std::endl;
}
}

View File

@@ -22,8 +22,6 @@ namespace Catch {
static std::string getDescription();
ReporterPreferences getPreferences() const override;
void noMatchingTestCases(std::string const& spec) override;
void assertionStarting(AssertionInfo const&) override;

View File

@@ -418,8 +418,9 @@ void ConsoleReporter::sectionEnded(SectionStats const& _sectionStats) {
stream << "\nNo assertions in test case";
stream << " '" << _sectionStats.sectionInfo.name << "'\n" << std::endl;
}
if (m_config->showDurations() == ShowDurations::Always) {
stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl;
double dur = _sectionStats.durationInSeconds;
if (shouldShowDuration(*m_config, dur)) {
stream << getFormattedDuration(dur) << " s: " << _sectionStats.sectionInfo.name << std::endl;
}
if (m_headerPrinted) {
m_headerPrinted = false;

View File

@@ -23,16 +23,17 @@ namespace Catch {
using StreamingReporterBase::StreamingReporterBase;
TAPReporter( ReporterConfig const& config ):
StreamingReporterBase( config ) {
m_reporterPrefs.shouldReportAllAssertions = true;
}
~TAPReporter() override;
static std::string getDescription() {
return "Reports test results in TAP format, suitable for test harnesses";
}
ReporterPreferences getPreferences() const override {
return m_reporterPrefs;
}
void noMatchingTestCases( std::string const& spec ) override {
stream << "# No test cases matched '" << spec << "'" << std::endl;
}
@@ -203,16 +204,15 @@ namespace Catch {
return;
}
// using messages.end() directly (or auto) yields compilation error:
std::vector<MessageInfo>::const_iterator itEnd = messages.end();
const std::size_t N = static_cast<std::size_t>( std::distance( itMessage, itEnd ) );
const auto itEnd = messages.cend();
const auto N = static_cast<std::size_t>( std::distance( itMessage, itEnd ) );
{
Colour colourGuard( colour );
stream << " with " << pluralise( N, "message" ) << ":";
}
for(; itMessage != itEnd; ) {
while( itMessage != itEnd ) {
// If this assertion is a warning ignore any INFO messages
if( printInfoMessages || itMessage->type != ResultWas::Info ) {
stream << " '" << itMessage->message << "'";
@@ -220,7 +220,9 @@ namespace Catch {
Colour colourGuard( dimColour() );
stream << " and";
}
continue;
}
++itMessage;
}
}
@@ -234,10 +236,9 @@ namespace Catch {
};
void printTotals( const Totals& totals ) const {
stream << "1.." << totals.assertions.total();
if( totals.testCases.total() == 0 ) {
stream << "1..0 # Skipped: No tests ran.";
} else {
stream << "1.." << counter;
stream << " # Skipped: No tests ran.";
}
}
};

View File

@@ -27,6 +27,7 @@ set(TEST_SOURCES
${SELF_TEST_DIR}/IntrospectiveTests/StringManip.tests.cpp
${SELF_TEST_DIR}/IntrospectiveTests/Xml.tests.cpp
${SELF_TEST_DIR}/IntrospectiveTests/ToString.tests.cpp
${SELF_TEST_DIR}/TimingTests/Sleep.tests.cpp
${SELF_TEST_DIR}/UsageTests/Approx.tests.cpp
${SELF_TEST_DIR}/UsageTests/BDD.tests.cpp
${SELF_TEST_DIR}/UsageTests/Benchmark.tests.cpp

View File

@@ -10,6 +10,40 @@ project( Catch2ExtraTests LANGUAGES CXX )
message( STATUS "Extra tests included" )
# The MinDuration reporting tests do not need separate compilation, but
# they have non-trivial execution time, so they are categorized as
# extra tests, so that they are run less.
add_test(NAME MinDuration::SimpleThreshold COMMAND $<TARGET_FILE:SelfTest> --min-duration 0.22 [min_duration_test])
set_tests_properties(
MinDuration::SimpleThreshold
PROPERTIES
PASS_REGULAR_EXPRESSION "s: sleep_for_250ms"
FAIL_REGULAR_EXPRESSION "sleep_for_100ms"
RUN_SERIAL ON # The test is timing sensitive, so we want to run it
# serially to avoid false positives on oversubscribed machines
)
# -d yes overrides the threshold, so we should see the faster test even
# with a ridiculous high min duration threshold
add_test(NAME MinDuration::DurationOverrideYes COMMAND $<TARGET_FILE:SelfTest> --min-duration 1.0 -d yes [min_duration_test])
set_tests_properties(
MinDuration::DurationOverrideYes
PROPERTIES
PASS_REGULAR_EXPRESSION "s: sleep_for_100ms"
)
# -d no overrides the threshold, so we should never see any tests even
# with ridiculously low min duration threshold
add_test(NAME MinDuration::DurationOverrideNo COMMAND $<TARGET_FILE:SelfTest> --min-duration 0.0001 -d no [min_duration_test])
set_tests_properties(
MinDuration::DurationOverrideNo
PROPERTIES
FAIL_REGULAR_EXPRESSION "sleep_for_250ms"
)
# ------------ end of duration reporting tests
# define folders used:
set( TESTS_DIR ${CATCH_DIR}/projects/ExtraTests )

View File

@@ -36,6 +36,48 @@ Generators.tests.cpp:<line number>: passed: i != j for: 1 != 3
Generators.tests.cpp:<line number>: passed: i != j for: 1 != 4
Generators.tests.cpp:<line number>: passed: i != j for: 2 != 3
Generators.tests.cpp:<line number>: passed: i != j for: 2 != 4
PartTracker.tests.cpp:<line number>: passed: with 1 message: 'A'
PartTracker.tests.cpp:<line number>: passed: m for: 1
PartTracker.tests.cpp:<line number>: passed: m for: 2
PartTracker.tests.cpp:<line number>: passed: m for: 3
PartTracker.tests.cpp:<line number>: passed: 1
PartTracker.tests.cpp:<line number>: passed: m for: 2
PartTracker.tests.cpp:<line number>: passed: m for: 3
PartTracker.tests.cpp:<line number>: passed: m for: 1
PartTracker.tests.cpp:<line number>: passed: m for: 2
PartTracker.tests.cpp:<line number>: passed: m for: 3
PartTracker.tests.cpp:<line number>: passed: with 1 message: 'A'
PartTracker.tests.cpp:<line number>: passed: with 3 messages: 'i := 1' and 'j := 3' and 'k := 5'
PartTracker.tests.cpp:<line number>: passed: with 1 message: 'B'
PartTracker.tests.cpp:<line number>: passed: with 3 messages: 'i := 1' and 'j := 3' and 'k := 6'
PartTracker.tests.cpp:<line number>: passed: with 1 message: 'B'
PartTracker.tests.cpp:<line number>: passed: with 3 messages: 'i := 1' and 'j := 4' and 'k := 5'
PartTracker.tests.cpp:<line number>: passed: with 3 messages: 'i := 1' and 'j := 4' and 'k := 6'
PartTracker.tests.cpp:<line number>: passed: with 1 message: 'A'
PartTracker.tests.cpp:<line number>: passed: with 3 messages: 'i := 2' and 'j := 3' and 'k := 5'
PartTracker.tests.cpp:<line number>: passed: with 1 message: 'B'
PartTracker.tests.cpp:<line number>: passed: with 3 messages: 'i := 2' and 'j := 3' and 'k := 6'
PartTracker.tests.cpp:<line number>: passed: with 1 message: 'B'
PartTracker.tests.cpp:<line number>: passed: with 3 messages: 'i := 2' and 'j := 4' and 'k := 5'
PartTracker.tests.cpp:<line number>: passed: with 3 messages: 'i := 2' and 'j := 4' and 'k := 6'
PartTracker.tests.cpp:<line number>: passed: m for: 1
PartTracker.tests.cpp:<line number>: passed: n for: 1
PartTracker.tests.cpp:<line number>: passed: m for: 1
PartTracker.tests.cpp:<line number>: passed: n for: 2
PartTracker.tests.cpp:<line number>: passed: m for: 1
PartTracker.tests.cpp:<line number>: passed: n for: 3
PartTracker.tests.cpp:<line number>: passed: m for: 2
PartTracker.tests.cpp:<line number>: passed: n for: 1
PartTracker.tests.cpp:<line number>: passed: m for: 2
PartTracker.tests.cpp:<line number>: passed: n for: 2
PartTracker.tests.cpp:<line number>: passed: m for: 2
PartTracker.tests.cpp:<line number>: passed: n for: 3
PartTracker.tests.cpp:<line number>: passed: m for: 3
PartTracker.tests.cpp:<line number>: passed: n for: 1
PartTracker.tests.cpp:<line number>: passed: m for: 3
PartTracker.tests.cpp:<line number>: passed: n for: 2
PartTracker.tests.cpp:<line number>: passed: m for: 3
PartTracker.tests.cpp:<line number>: passed: n for: 3
Misc.tests.cpp:<line number>: passed:
Misc.tests.cpp:<line number>: passed:
Misc.tests.cpp:<line number>: passed:
@@ -1161,6 +1203,7 @@ CmdLine.tests.cpp:<line number>: passed: config.benchmarkWarmupTime == 10 for: 1
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
ToString.tests.cpp:<line number>: passed: Catch::Detail::stringify(UsesSentinel{}) == "{ }" for: "{ }" == "{ }"
Decomposition.tests.cpp:<line number>: failed: truthy(false) for: Hey, its truthy!
Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Matches("this STRING contains 'abc' as a substring") for: "this string contains 'abc' as a substring" matches "this STRING contains 'abc' as a substring" case sensitively
Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Matches("contains 'abc' as a substring") for: "this string contains 'abc' as a substring" matches "contains 'abc' as a substring" case sensitively

View File

@@ -1380,6 +1380,6 @@ due to unexpected exception with message:
Why would you throw a std::string?
===============================================================================
test cases: 316 | 242 passed | 70 failed | 4 failed as expected
assertions: 1716 | 1564 passed | 131 failed | 21 failed as expected
test cases: 322 | 248 passed | 70 failed | 4 failed as expected
assertions: 1759 | 1607 passed | 131 failed | 21 failed as expected

View File

@@ -309,6 +309,424 @@ Generators.tests.cpp:<line number>: PASSED:
with expansion:
2 != 4
-------------------------------------------------------------------------------
#1938 - GENERATE after a section
A
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with message:
A
-------------------------------------------------------------------------------
#1938 - GENERATE after a section
B
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
1
-------------------------------------------------------------------------------
#1938 - GENERATE after a section
B
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
2
-------------------------------------------------------------------------------
#1938 - GENERATE after a section
B
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
3
-------------------------------------------------------------------------------
#1938 - Section followed by flat generate
A
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( 1 )
-------------------------------------------------------------------------------
#1938 - Section followed by flat generate
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
2
-------------------------------------------------------------------------------
#1938 - Section followed by flat generate
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
3
-------------------------------------------------------------------------------
#1938 - flat generate
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
1
-------------------------------------------------------------------------------
#1938 - flat generate
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
2
-------------------------------------------------------------------------------
#1938 - flat generate
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
3
-------------------------------------------------------------------------------
#1938 - mixed sections and generates
A
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with message:
A
-------------------------------------------------------------------------------
#1938 - mixed sections and generates
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with messages:
i := 1
j := 3
k := 5
-------------------------------------------------------------------------------
#1938 - mixed sections and generates
B
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with message:
B
-------------------------------------------------------------------------------
#1938 - mixed sections and generates
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with messages:
i := 1
j := 3
k := 6
-------------------------------------------------------------------------------
#1938 - mixed sections and generates
B
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with message:
B
-------------------------------------------------------------------------------
#1938 - mixed sections and generates
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with messages:
i := 1
j := 4
k := 5
-------------------------------------------------------------------------------
#1938 - mixed sections and generates
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with messages:
i := 1
j := 4
k := 6
-------------------------------------------------------------------------------
#1938 - mixed sections and generates
A
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with message:
A
-------------------------------------------------------------------------------
#1938 - mixed sections and generates
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with messages:
i := 2
j := 3
k := 5
-------------------------------------------------------------------------------
#1938 - mixed sections and generates
B
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with message:
B
-------------------------------------------------------------------------------
#1938 - mixed sections and generates
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with messages:
i := 2
j := 3
k := 6
-------------------------------------------------------------------------------
#1938 - mixed sections and generates
B
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with message:
B
-------------------------------------------------------------------------------
#1938 - mixed sections and generates
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with messages:
i := 2
j := 4
k := 5
-------------------------------------------------------------------------------
#1938 - mixed sections and generates
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with messages:
i := 2
j := 4
k := 6
-------------------------------------------------------------------------------
#1938 - nested generate
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
1
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( n )
with expansion:
1
-------------------------------------------------------------------------------
#1938 - nested generate
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
1
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( n )
with expansion:
2
-------------------------------------------------------------------------------
#1938 - nested generate
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
1
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( n )
with expansion:
3
-------------------------------------------------------------------------------
#1938 - nested generate
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
2
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( n )
with expansion:
1
-------------------------------------------------------------------------------
#1938 - nested generate
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
2
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( n )
with expansion:
2
-------------------------------------------------------------------------------
#1938 - nested generate
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
2
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( n )
with expansion:
3
-------------------------------------------------------------------------------
#1938 - nested generate
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
3
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( n )
with expansion:
1
-------------------------------------------------------------------------------
#1938 - nested generate
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
3
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( n )
with expansion:
2
-------------------------------------------------------------------------------
#1938 - nested generate
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
3
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( n )
with expansion:
3
-------------------------------------------------------------------------------
#1954 - 7 arg template test case sig compiles - 1, 1, 1, 1, 1, 0, 0
-------------------------------------------------------------------------------
@@ -8477,6 +8895,17 @@ Misc.tests.cpp:<line number>: PASSED:
with expansion:
1 >= 1
-------------------------------------------------------------------------------
Range type with sentinel
-------------------------------------------------------------------------------
ToString.tests.cpp:<line number>
...............................................................................
ToString.tests.cpp:<line number>: PASSED:
CHECK( Catch::Detail::stringify(UsesSentinel{}) == "{ }" )
with expansion:
"{ }" == "{ }"
-------------------------------------------------------------------------------
Reconstruction should be based on stringification: #914
-------------------------------------------------------------------------------
@@ -13709,6 +14138,6 @@ Misc.tests.cpp:<line number>
Misc.tests.cpp:<line number>: PASSED:
===============================================================================
test cases: 316 | 226 passed | 86 failed | 4 failed as expected
assertions: 1733 | 1564 passed | 148 failed | 21 failed as expected
test cases: 322 | 232 passed | 86 failed | 4 failed as expected
assertions: 1776 | 1607 passed | 148 failed | 21 failed as expected

View File

@@ -309,6 +309,424 @@ Generators.tests.cpp:<line number>: PASSED:
with expansion:
2 != 4
-------------------------------------------------------------------------------
#1938 - GENERATE after a section
A
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with message:
A
-------------------------------------------------------------------------------
#1938 - GENERATE after a section
B
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
1
-------------------------------------------------------------------------------
#1938 - GENERATE after a section
B
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
2
-------------------------------------------------------------------------------
#1938 - GENERATE after a section
B
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
3
-------------------------------------------------------------------------------
#1938 - Section followed by flat generate
A
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( 1 )
-------------------------------------------------------------------------------
#1938 - Section followed by flat generate
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
2
-------------------------------------------------------------------------------
#1938 - Section followed by flat generate
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
3
-------------------------------------------------------------------------------
#1938 - flat generate
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
1
-------------------------------------------------------------------------------
#1938 - flat generate
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
2
-------------------------------------------------------------------------------
#1938 - flat generate
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
3
-------------------------------------------------------------------------------
#1938 - mixed sections and generates
A
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with message:
A
-------------------------------------------------------------------------------
#1938 - mixed sections and generates
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with messages:
i := 1
j := 3
k := 5
-------------------------------------------------------------------------------
#1938 - mixed sections and generates
B
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with message:
B
-------------------------------------------------------------------------------
#1938 - mixed sections and generates
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with messages:
i := 1
j := 3
k := 6
-------------------------------------------------------------------------------
#1938 - mixed sections and generates
B
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with message:
B
-------------------------------------------------------------------------------
#1938 - mixed sections and generates
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with messages:
i := 1
j := 4
k := 5
-------------------------------------------------------------------------------
#1938 - mixed sections and generates
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with messages:
i := 1
j := 4
k := 6
-------------------------------------------------------------------------------
#1938 - mixed sections and generates
A
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with message:
A
-------------------------------------------------------------------------------
#1938 - mixed sections and generates
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with messages:
i := 2
j := 3
k := 5
-------------------------------------------------------------------------------
#1938 - mixed sections and generates
B
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with message:
B
-------------------------------------------------------------------------------
#1938 - mixed sections and generates
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with messages:
i := 2
j := 3
k := 6
-------------------------------------------------------------------------------
#1938 - mixed sections and generates
B
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with message:
B
-------------------------------------------------------------------------------
#1938 - mixed sections and generates
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with messages:
i := 2
j := 4
k := 5
-------------------------------------------------------------------------------
#1938 - mixed sections and generates
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
with messages:
i := 2
j := 4
k := 6
-------------------------------------------------------------------------------
#1938 - nested generate
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
1
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( n )
with expansion:
1
-------------------------------------------------------------------------------
#1938 - nested generate
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
1
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( n )
with expansion:
2
-------------------------------------------------------------------------------
#1938 - nested generate
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
1
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( n )
with expansion:
3
-------------------------------------------------------------------------------
#1938 - nested generate
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
2
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( n )
with expansion:
1
-------------------------------------------------------------------------------
#1938 - nested generate
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
2
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( n )
with expansion:
2
-------------------------------------------------------------------------------
#1938 - nested generate
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
2
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( n )
with expansion:
3
-------------------------------------------------------------------------------
#1938 - nested generate
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
3
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( n )
with expansion:
1
-------------------------------------------------------------------------------
#1938 - nested generate
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
3
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( n )
with expansion:
2
-------------------------------------------------------------------------------
#1938 - nested generate
-------------------------------------------------------------------------------
PartTracker.tests.cpp:<line number>
...............................................................................
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( m )
with expansion:
3
PartTracker.tests.cpp:<line number>: PASSED:
REQUIRE( n )
with expansion:
3
-------------------------------------------------------------------------------
#1954 - 7 arg template test case sig compiles - 1, 1, 1, 1, 1, 0, 0
-------------------------------------------------------------------------------
@@ -513,6 +931,6 @@ Condition.tests.cpp:<line number>: FAILED:
CHECK( true != true )
===============================================================================
test cases: 26 | 21 passed | 3 failed | 2 failed as expected
assertions: 58 | 51 passed | 4 failed | 3 failed as expected
test cases: 31 | 26 passed | 3 failed | 2 failed as expected
assertions: 100 | 93 passed | 4 failed | 3 failed as expected

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuitesloose text artifact
>
<testsuite name="<exe-name>" errors="17" failures="132" tests="1734" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<testsuite name="<exe-name>" errors="17" failures="132" tests="1777" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<properties>
<property name="filters" value="~[!nonportable]~[!benchmark]~[approvals]"/>
<property name="random-seed" value="1"/>
@@ -35,6 +35,15 @@ Nor would this
<testcase classname="<exe-name>.global" name="#1912 -- test spec parser handles escaping/backslash in test name" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="#1913 - GENERATE inside a for loop should not keep recreating the generator" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="#1913 - GENERATEs can share a line" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="#1938 - GENERATE after a section/A" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="#1938 - GENERATE after a section/B" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="#1938 - Section followed by flat generate" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="#1938 - Section followed by flat generate/A" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="#1938 - flat generate" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="#1938 - mixed sections and generates" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="#1938 - mixed sections and generates/A" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="#1938 - mixed sections and generates/B" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="#1938 - nested generate" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="#1954 - 7 arg template test case sig compiles - 1, 1, 1, 1, 1, 0, 0" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="#1954 - 7 arg template test case sig compiles - 5, 1, 1, 1, 1, 0, 0" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="#1954 - 7 arg template test case sig compiles - 5, 3, 1, 1, 1, 0, 0" time="{duration}" status="run"/>
@@ -1036,6 +1045,7 @@ Message.tests.cpp:<line number>
<testcase classname="<exe-name>.global" name="Product with differing arities - std::tuple&lt;int, double, float>" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Product with differing arities - std::tuple&lt;int, double>" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Product with differing arities - std::tuple&lt;int>" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Range type with sentinel" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="Reconstruction should be based on stringification: #914" time="{duration}" status="run">
<failure message="truthy(false)" type="CHECK">
FAILED:

View File

@@ -99,6 +99,15 @@
<testCase name="Generators internals/Range/Negative manual step/Integer/Slightly under end" duration="{duration}"/>
</file>
<file path="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp">
<testCase name="#1938 - GENERATE after a section/A" duration="{duration}"/>
<testCase name="#1938 - GENERATE after a section/B" duration="{duration}"/>
<testCase name="#1938 - Section followed by flat generate" duration="{duration}"/>
<testCase name="#1938 - Section followed by flat generate/A" duration="{duration}"/>
<testCase name="#1938 - flat generate" duration="{duration}"/>
<testCase name="#1938 - mixed sections and generates" duration="{duration}"/>
<testCase name="#1938 - mixed sections and generates/A" duration="{duration}"/>
<testCase name="#1938 - mixed sections and generates/B" duration="{duration}"/>
<testCase name="#1938 - nested generate" duration="{duration}"/>
<testCase name="Tracker" duration="{duration}"/>
<testCase name="Tracker/successfully close one section" duration="{duration}"/>
<testCase name="Tracker/fail one section" duration="{duration}"/>
@@ -153,6 +162,7 @@
</file>
<file path="projects/<exe-name>/IntrospectiveTests/ToString.tests.cpp">
<testCase name="Directly creating an EnumInfo" duration="{duration}"/>
<testCase name="Range type with sentinel" duration="{duration}"/>
<testCase name="parseEnums/No enums" duration="{duration}"/>
<testCase name="parseEnums/One enum value" duration="{duration}"/>
<testCase name="parseEnums/Multiple enum values" duration="{duration}"/>

View File

@@ -318,6 +318,342 @@ Nor would this
</Expression>
<OverallResult success="true"/>
</TestCase>
<TestCase name="#1938 - GENERATE after a section" tags="[!hide][.][generators][regression]" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Section name="A" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<OverallResults successes="1" failures="0" expectedFailures="0"/>
</Section>
<Section name="B" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Original>
m
</Original>
<Expanded>
1
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0"/>
</Section>
<Section name="B" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Original>
m
</Original>
<Expanded>
2
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0"/>
</Section>
<Section name="B" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Original>
m
</Original>
<Expanded>
3
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0"/>
</Section>
<OverallResult success="true"/>
</TestCase>
<TestCase name="#1938 - Section followed by flat generate" tags="[!hide][.][generators][regression]" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Section name="A" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Original>
1
</Original>
<Expanded>
1
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0"/>
</Section>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Original>
m
</Original>
<Expanded>
2
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Original>
m
</Original>
<Expanded>
3
</Expanded>
</Expression>
<OverallResult success="true"/>
</TestCase>
<TestCase name="#1938 - flat generate" tags="[!hide][.][generators][regression]" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Original>
m
</Original>
<Expanded>
1
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Original>
m
</Original>
<Expanded>
2
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Original>
m
</Original>
<Expanded>
3
</Expanded>
</Expression>
<OverallResult success="true"/>
</TestCase>
<TestCase name="#1938 - mixed sections and generates" tags="[!hide][.][generators][regression]" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Section name="A" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<OverallResults successes="1" failures="0" expectedFailures="0"/>
</Section>
<Info>
i := 1
</Info>
<Info>
j := 3
</Info>
<Info>
k := 5
</Info>
<Section name="B" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<OverallResults successes="1" failures="0" expectedFailures="0"/>
</Section>
<Info>
i := 1
</Info>
<Info>
j := 3
</Info>
<Info>
k := 6
</Info>
<Section name="B" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<OverallResults successes="1" failures="0" expectedFailures="0"/>
</Section>
<Info>
i := 1
</Info>
<Info>
j := 4
</Info>
<Info>
k := 5
</Info>
<Info>
i := 1
</Info>
<Info>
j := 4
</Info>
<Info>
k := 6
</Info>
<Section name="A" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<OverallResults successes="1" failures="0" expectedFailures="0"/>
</Section>
<Info>
i := 2
</Info>
<Info>
j := 3
</Info>
<Info>
k := 5
</Info>
<Section name="B" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<OverallResults successes="1" failures="0" expectedFailures="0"/>
</Section>
<Info>
i := 2
</Info>
<Info>
j := 3
</Info>
<Info>
k := 6
</Info>
<Section name="B" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<OverallResults successes="1" failures="0" expectedFailures="0"/>
</Section>
<Info>
i := 2
</Info>
<Info>
j := 4
</Info>
<Info>
k := 5
</Info>
<Info>
i := 2
</Info>
<Info>
j := 4
</Info>
<Info>
k := 6
</Info>
<OverallResult success="true"/>
</TestCase>
<TestCase name="#1938 - nested generate" tags="[!hide][.][generators][regression]" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Original>
m
</Original>
<Expanded>
1
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Original>
n
</Original>
<Expanded>
1
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Original>
m
</Original>
<Expanded>
1
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Original>
n
</Original>
<Expanded>
2
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Original>
m
</Original>
<Expanded>
1
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Original>
n
</Original>
<Expanded>
3
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Original>
m
</Original>
<Expanded>
2
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Original>
n
</Original>
<Expanded>
1
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Original>
m
</Original>
<Expanded>
2
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Original>
n
</Original>
<Expanded>
2
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Original>
m
</Original>
<Expanded>
2
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Original>
n
</Original>
<Expanded>
3
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Original>
m
</Original>
<Expanded>
3
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Original>
n
</Original>
<Expanded>
1
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Original>
m
</Original>
<Expanded>
3
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Original>
n
</Original>
<Expanded>
2
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Original>
m
</Original>
<Expanded>
3
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
<Original>
n
</Original>
<Expanded>
3
</Expanded>
</Expression>
<OverallResult success="true"/>
</TestCase>
<TestCase name="#1954 - 7 arg template test case sig compiles - 1, 1, 1, 1, 1, 0, 0" tags="[!hide][.][compilation][regression]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
<OverallResult success="true"/>
</TestCase>
@@ -10626,6 +10962,17 @@ Nor would this
</Expression>
<OverallResult success="true"/>
</TestCase>
<TestCase name="Range type with sentinel" filename="projects/<exe-name>/IntrospectiveTests/ToString.tests.cpp" >
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/ToString.tests.cpp" >
<Original>
Catch::Detail::stringify(UsesSentinel{}) == "{ }"
</Original>
<Expanded>
"{ }" == "{ }"
</Expanded>
</Expression>
<OverallResult success="true"/>
</TestCase>
<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>
@@ -16375,9 +16722,9 @@ loose text artifact
</Section>
<OverallResult success="true"/>
</TestCase>
<OverallResults successes="1564" failures="149" expectedFailures="21"/>
<OverallResultsCases successes="226" failures="86" expectedFailures="4"/>
<OverallResults successes="1607" failures="149" expectedFailures="21"/>
<OverallResultsCases successes="232" failures="86" expectedFailures="4"/>
</Group>
<OverallResults successes="1564" failures="148" expectedFailures="21"/>
<OverallResultsCases successes="226" failures="86" expectedFailures="4"/>
<OverallResults successes="1607" failures="148" expectedFailures="21"/>
<OverallResultsCases successes="232" failures="86" expectedFailures="4"/>
</Catch>

View File

@@ -204,3 +204,50 @@ TEST_CASE("#1670 regression check", "[.approvals][tracker]") {
SECTION("2") SUCCEED();
}
}
// #1938 required a rework on how generator tracking works, so that `GENERATE`
// supports being sandwiched between two `SECTION`s. The following tests check
// various other scenarios through checking output in approval tests.
TEST_CASE("#1938 - GENERATE after a section", "[.][regression][generators]") {
SECTION("A") {
SUCCEED("A");
}
auto m = GENERATE(1, 2, 3);
SECTION("B") {
REQUIRE(m);
}
}
TEST_CASE("#1938 - flat generate", "[.][regression][generators]") {
auto m = GENERATE(1, 2, 3);
REQUIRE(m);
}
TEST_CASE("#1938 - nested generate", "[.][regression][generators]") {
auto m = GENERATE(1, 2, 3);
auto n = GENERATE(1, 2, 3);
REQUIRE(m);
REQUIRE(n);
}
TEST_CASE("#1938 - mixed sections and generates", "[.][regression][generators]") {
auto i = GENERATE(1, 2);
SECTION("A") {
SUCCEED("A");
}
auto j = GENERATE(3, 4);
SECTION("B") {
SUCCEED("B");
}
auto k = GENERATE(5, 6);
CAPTURE(i, j, k);
SUCCEED();
}
TEST_CASE("#1938 - Section followed by flat generate", "[.][regression][generators]") {
SECTION("A") {
REQUIRE(1);
}
auto m = GENERATE(2, 3);
REQUIRE(m);
}

View File

@@ -4,6 +4,13 @@
enum class EnumClass3 { Value1, Value2, Value3, Value4 };
struct UsesSentinel {
using const_iterator = int const*;
using const_sentinel = std::nullptr_t;
const_iterator begin() const { return nullptr; }
const_iterator end() const { return nullptr; }
};
TEST_CASE( "parseEnums", "[Strings][enums]" ) {
using namespace Catch::Matchers;
@@ -40,3 +47,7 @@ TEST_CASE( "Directly creating an EnumInfo" ) {
CHECK( enumInfo->lookup(1) == "Value2" );
CHECK( enumInfo->lookup(3) == "{** unexpected enum value **}" );
}
TEST_CASE("Range type with sentinel") {
CHECK( Catch::Detail::stringify(UsesSentinel{}) == "{ }" );
}

View File

@@ -0,0 +1,23 @@
/*
* Copyright 2011 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)
*/
#include "catch.hpp"
#include <chrono>
#include <thread>
TEST_CASE( "sleep_for_100ms", "[.min_duration_test][approvals]" )
{
std::this_thread::sleep_for( std::chrono::milliseconds( 100 ) );
CHECK( true );
}
TEST_CASE( "sleep_for_250ms", "[.min_duration_test][approvals]" )
{
std::this_thread::sleep_for( std::chrono::milliseconds( 250 ) );
CHECK( true );
}

View File

@@ -267,6 +267,7 @@ TEST_CASE("#1913 - GENERATEs can share a line", "[regression][generators]") {
REQUIRE(i != j);
}
#if defined(__clang__)
#pragma clang diagnostic pop
#endif

View File

@@ -15,9 +15,9 @@ import random
def list_tests(self_test_exe, tags, rng_seed):
cmd = [self_test_exe, '--list-test-names-only', '--order', 'rand',
'--rng-seed', str(rng_seed)]
tags_arg = ','.join('[{}]'.format(t) for t in tags)
tags_arg = ','.join('[{}]~[.]'.format(t) for t in tags)
if tags_arg:
cmd.append(tags_arg + '~[.]')
cmd.append(tags_arg)
process = subprocess.Popen(
cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = process.communicate()

View File

@@ -1,6 +1,6 @@
/*
* Catch v2.12.3
* Generated: 2020-06-29 20:47:52.374964
* Catch v2.13.1
* Generated: 2020-09-07 12:12:38.090364
* ----------------------------------------------------------
* This file has been merged from multiple headers. Please don't edit it directly
* Copyright (c) 2020 Two Blue Cubes Ltd. All rights reserved.
@@ -14,8 +14,8 @@
#define CATCH_VERSION_MAJOR 2
#define CATCH_VERSION_MINOR 12
#define CATCH_VERSION_PATCH 3
#define CATCH_VERSION_MINOR 13
#define CATCH_VERSION_PATCH 1
#ifdef __clang__
# pragma clang system_header
@@ -330,7 +330,10 @@ namespace Catch {
// Check if byte is available and usable
# if __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER)
# define CATCH_INTERNAL_CONFIG_CPP17_BYTE
# include <cstddef>
# if __cpp_lib_byte > 0
# define CATCH_INTERNAL_CONFIG_CPP17_BYTE
# endif
# endif // __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER)
// Check if variant is available and usable
@@ -1105,7 +1108,7 @@ struct AutoReg : NonCopyable {
int index = 0; \
constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\
using expander = int[];\
(void)expander{(reg_test(Types{}, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++, 0)... };/* NOLINT */ \
(void)expander{(reg_test(Types{}, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++)... };/* NOLINT */ \
}\
};\
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
@@ -1151,7 +1154,7 @@ struct AutoReg : NonCopyable {
constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};\
constexpr char const* types_list[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};\
constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);\
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFuncName<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + "<" + std::string(types_list[index % num_types]) + ">", Tags } ), index++, 0)... };/* NOLINT */\
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFuncName<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + "<" + std::string(types_list[index % num_types]) + ">", Tags } ), index++)... };/* NOLINT */\
} \
}; \
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \
@@ -1195,7 +1198,7 @@ struct AutoReg : NonCopyable {
void reg_tests() { \
int index = 0; \
using expander = int[]; \
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFunc<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + " - " + std::to_string(index), Tags } ), index++, 0)... };/* NOLINT */\
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFunc<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + " - " + std::to_string(index), Tags } ), index++)... };/* NOLINT */\
} \
};\
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \
@@ -1229,7 +1232,7 @@ struct AutoReg : NonCopyable {
int index = 0; \
constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\
using expander = int[];\
(void)expander{(reg_test(Types{}, #ClassName, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++, 0)... };/* NOLINT */ \
(void)expander{(reg_test(Types{}, #ClassName, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++)... };/* NOLINT */ \
}\
};\
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
@@ -1278,7 +1281,7 @@ struct AutoReg : NonCopyable {
constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};\
constexpr char const* types_list[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};\
constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);\
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + "<" + std::string(types_list[index % num_types]) + ">", Tags } ), index++, 0)... };/* NOLINT */ \
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + "<" + std::string(types_list[index % num_types]) + ">", Tags } ), index++)... };/* NOLINT */ \
}\
};\
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
@@ -1325,7 +1328,7 @@ struct AutoReg : NonCopyable {
void reg_tests(){\
int index = 0;\
using expander = int[];\
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + " - " + std::to_string(index), Tags } ), index++, 0)... };/* NOLINT */ \
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + " - " + std::to_string(index), Tags } ), index++)... };/* NOLINT */ \
}\
};\
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
@@ -1829,8 +1832,8 @@ namespace Catch {
#endif
namespace Detail {
template<typename InputIterator>
std::string rangeToString(InputIterator first, InputIterator last) {
template<typename InputIterator, typename Sentinel = InputIterator>
std::string rangeToString(InputIterator first, Sentinel last) {
ReusableStringStream rss;
rss << "{ ";
if (first != last) {
@@ -4522,6 +4525,7 @@ namespace Catch {
virtual int abortAfter() const = 0;
virtual bool showInvisibles() const = 0;
virtual ShowDurations::OrNot showDurations() const = 0;
virtual double minDuration() const = 0;
virtual TestSpec const& testSpec() const = 0;
virtual bool hasTestFilters() const = 0;
virtual std::vector<std::string> const& getTestsOrTags() const = 0;
@@ -5294,6 +5298,7 @@ namespace Catch {
Verbosity verbosity = Verbosity::Normal;
WarnAbout::What warnings = WarnAbout::Nothing;
ShowDurations::OrNot showDurations = ShowDurations::DefaultForReporter;
double minDuration = -1;
RunTests::InWhatOrder runOrder = RunTests::InDeclarationOrder;
UseColour::YesOrNo useColour = UseColour::Auto;
WaitForKeypress::When waitForKeypress = WaitForKeypress::Never;
@@ -5344,6 +5349,7 @@ namespace Catch {
bool warnAboutMissingAssertions() const override;
bool warnAboutNoTests() const override;
ShowDurations::OrNot showDurations() const override;
double minDuration() const override;
RunTests::InWhatOrder runOrder() const override;
unsigned int rngSeed() const override;
UseColour::YesOrNo useColour() const override;
@@ -5721,6 +5727,9 @@ namespace Catch {
// Returns double formatted as %.3f (format expected on output)
std::string getFormattedDuration( double duration );
//! Should the reporter show
bool shouldShowDuration( IConfig const& config, double duration );
std::string serializeFilters( std::vector<std::string> const& container );
template<typename DerivedT>
@@ -6114,8 +6123,6 @@ namespace Catch {
static std::string getDescription();
ReporterPreferences getPreferences() const override;
void noMatchingTestCases(std::string const& spec) override;
void assertionStarting(AssertionInfo const&) override;
@@ -7499,6 +7506,7 @@ namespace TestCaseTracking {
virtual bool isSuccessfullyCompleted() const = 0;
virtual bool isOpen() const = 0; // Started but not complete
virtual bool hasChildren() const = 0;
virtual bool hasStarted() const = 0;
virtual ITracker& parent() = 0;
@@ -7565,6 +7573,9 @@ namespace TestCaseTracking {
bool isSuccessfullyCompleted() const override;
bool isOpen() const override;
bool hasChildren() const override;
bool hasStarted() const override {
return m_runState != NotStarted;
}
void addChild( ITrackerPtr const& child ) override;
@@ -7927,7 +7938,11 @@ namespace Catch {
#ifdef CATCH_PLATFORM_MAC
#define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */
#if defined(__i386__) || defined(__x86_64__)
#define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */
#elif defined(__aarch64__)
#define CATCH_TRAP() __asm__(".inst 0xd4200000")
#endif
#elif defined(CATCH_PLATFORM_IPHONE)
@@ -9857,6 +9872,9 @@ namespace Catch {
| Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, "yes|no" )
["-d"]["--durations"]
( "show test durations" )
| Opt( config.minDuration, "seconds" )
["-D"]["--min-duration"]
( "show test durations for tests taking at least the given number of seconds" )
| Opt( loadTestNamesFromFile, "filename" )
["-f"]["--input-file"]
( "load test names to run from a file" )
@@ -10004,6 +10022,7 @@ namespace Catch {
bool Config::warnAboutMissingAssertions() const { return !!(m_data.warnings & WarnAbout::NoAssertions); }
bool Config::warnAboutNoTests() const { return !!(m_data.warnings & WarnAbout::NoTests); }
ShowDurations::OrNot Config::showDurations() const { return m_data.showDurations; }
double Config::minDuration() const { return m_data.minDuration; }
RunTests::InWhatOrder Config::runOrder() const { return m_data.runOrder; }
unsigned int Config::rngSeed() const { return m_data.rngSeed; }
UseColour::YesOrNo Config::useColour() const { return m_data.useColour; }
@@ -12543,7 +12562,7 @@ namespace Catch {
currentTracker.addChild( tracker );
}
if( !ctx.completedCycle() && !tracker->isComplete() ) {
if( !tracker->isComplete() ) {
tracker->open();
}
@@ -12557,8 +12576,28 @@ namespace Catch {
}
void close() override {
TrackerBase::close();
// Generator interface only finds out if it has another item on atual move
if (m_runState == CompletedSuccessfully && m_generator->next()) {
// If a generator has a child (it is followed by a section)
// and none of its children have started, then we must wait
// until later to start consuming its values.
// This catches cases where `GENERATE` is placed between two
// `SECTION`s.
// **The check for m_children.empty cannot be removed**.
// doing so would break `GENERATE` _not_ followed by `SECTION`s.
const bool should_wait_for_child =
!m_children.empty() &&
std::find_if( m_children.begin(),
m_children.end(),
[]( TestCaseTracking::ITrackerPtr tracker ) {
return tracker->hasStarted();
} ) == m_children.end();
// This check is a bit tricky, because m_generator->next()
// has a side-effect, where it consumes generator's current
// value, but we do not want to invoke the side-effect if
// this generator is still waiting for any child to start.
if ( should_wait_for_child ||
( m_runState == CompletedSuccessfully &&
m_generator->next() ) ) {
m_children.clear();
m_runState = Executing;
}
@@ -12698,7 +12737,6 @@ namespace Catch {
using namespace Generators;
GeneratorTracker& tracker = GeneratorTracker::acquire(m_trackerContext,
TestCaseTracking::NameAndLocation( static_cast<std::string>(generatorName), lineInfo ) );
assert( tracker.isOpen() );
m_lastAssertionInfo.lineInfo = lineInfo;
return tracker;
}
@@ -14377,7 +14415,8 @@ namespace TestCaseTracking {
bool SectionTracker::isComplete() const {
bool complete = true;
if ((m_filters.empty() || m_filters[0] == "")
if (m_filters.empty()
|| m_filters[0] == ""
|| std::find(m_filters.begin(), m_filters.end(), m_trimmed_name) != m_filters.end()) {
complete = TrackerBase::isComplete();
}
@@ -15202,7 +15241,7 @@ namespace Catch {
}
Version const& libraryVersion() {
static Version version( 2, 12, 3, "", 0 );
static Version version( 2, 13, 1, "", 0 );
return version;
}
@@ -15604,6 +15643,17 @@ namespace Catch {
return std::string(buffer);
}
bool shouldShowDuration( IConfig const& config, double duration ) {
if ( config.showDurations() == ShowDurations::Always ) {
return true;
}
if ( config.showDurations() == ShowDurations::Never ) {
return false;
}
const double min = config.minDuration();
return min >= 0 && duration >= min;
}
std::string serializeFilters( std::vector<std::string> const& container ) {
ReusableStringStream oss;
bool first = true;
@@ -15870,10 +15920,6 @@ private:
return "Reports test results on a single line, suitable for IDEs";
}
ReporterPreferences CompactReporter::getPreferences() const {
return m_reporterPrefs;
}
void CompactReporter::noMatchingTestCases( std::string const& spec ) {
stream << "No test cases matched '" << spec << '\'' << std::endl;
}
@@ -15900,8 +15946,9 @@ private:
}
void CompactReporter::sectionEnded(SectionStats const& _sectionStats) {
if (m_config->showDurations() == ShowDurations::Always) {
stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl;
double dur = _sectionStats.durationInSeconds;
if ( shouldShowDuration( *m_config, dur ) ) {
stream << getFormattedDuration( dur ) << " s: " << _sectionStats.sectionInfo.name << std::endl;
}
}
@@ -16321,8 +16368,9 @@ void ConsoleReporter::sectionEnded(SectionStats const& _sectionStats) {
stream << "\nNo assertions in test case";
stream << " '" << _sectionStats.sectionInfo.name << "'\n" << std::endl;
}
if (m_config->showDurations() == ShowDurations::Always) {
stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl;
double dur = _sectionStats.durationInSeconds;
if (shouldShowDuration(*m_config, dur)) {
stream << getFormattedDuration(dur) << " s: " << _sectionStats.sectionInfo.name << std::endl;
}
if (m_headerPrinted) {
m_headerPrinted = false;

View File

@@ -23,16 +23,17 @@ namespace Catch {
using StreamingReporterBase::StreamingReporterBase;
TAPReporter( ReporterConfig const& config ):
StreamingReporterBase( config ) {
m_reporterPrefs.shouldReportAllAssertions = true;
}
~TAPReporter() override;
static std::string getDescription() {
return "Reports test results in TAP format, suitable for test harnesses";
}
ReporterPreferences getPreferences() const override {
return m_reporterPrefs;
}
void noMatchingTestCases( std::string const& spec ) override {
stream << "# No test cases matched '" << spec << "'" << std::endl;
}
@@ -203,16 +204,15 @@ namespace Catch {
return;
}
// using messages.end() directly (or auto) yields compilation error:
std::vector<MessageInfo>::const_iterator itEnd = messages.end();
const std::size_t N = static_cast<std::size_t>( std::distance( itMessage, itEnd ) );
const auto itEnd = messages.cend();
const auto N = static_cast<std::size_t>( std::distance( itMessage, itEnd ) );
{
Colour colourGuard( colour );
stream << " with " << pluralise( N, "message" ) << ":";
}
for(; itMessage != itEnd; ) {
while( itMessage != itEnd ) {
// If this assertion is a warning ignore any INFO messages
if( printInfoMessages || itMessage->type != ResultWas::Info ) {
stream << " '" << itMessage->message << "'";
@@ -220,7 +220,9 @@ namespace Catch {
Colour colourGuard( dimColour() );
stream << " and";
}
continue;
}
++itMessage;
}
}
@@ -234,10 +236,9 @@ namespace Catch {
};
void printTotals( const Totals& totals ) const {
stream << "1.." << totals.assertions.total();
if( totals.testCases.total() == 0 ) {
stream << "1..0 # Skipped: No tests ran.";
} else {
stream << "1.." << counter;
stream << " # Skipped: No tests ran.";
}
}
};