mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-19 11:25:38 +02:00
Compare commits
20 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c299133a31 | ||
![]() |
09b8017ea3 | ||
![]() |
bad3c93049 | ||
![]() |
0f05c034c2 | ||
![]() |
ee4538c0c6 | ||
![]() |
dc7a20fc74 | ||
![]() |
018dc0b74f | ||
![]() |
ad1940f336 | ||
![]() |
5399921622 | ||
![]() |
e815acddf8 | ||
![]() |
e7189f1e4f | ||
![]() |
1806b21545 | ||
![]() |
288416f501 | ||
![]() |
cbbebb65b6 | ||
![]() |
fb08596b1b | ||
![]() |
0614a4acb3 | ||
![]() |
0f12995501 | ||
![]() |
0807fdb175 | ||
![]() |
9500ded83b | ||
![]() |
6c6ebe374a |
25
.clang-format
Normal file
25
.clang-format
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
AccessModifierOffset: '-4'
|
||||||
|
AlignEscapedNewlines: Left
|
||||||
|
AllowAllConstructorInitializersOnNextLine: 'true'
|
||||||
|
BinPackArguments: 'false'
|
||||||
|
BinPackParameters: 'false'
|
||||||
|
BreakConstructorInitializers: AfterColon
|
||||||
|
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true'
|
||||||
|
DerivePointerAlignment: 'false'
|
||||||
|
FixNamespaceComments: 'true'
|
||||||
|
IncludeBlocks: Regroup
|
||||||
|
IndentCaseLabels: 'false'
|
||||||
|
IndentPPDirectives: AfterHash
|
||||||
|
IndentWidth: '4'
|
||||||
|
Language: Cpp
|
||||||
|
NamespaceIndentation: All
|
||||||
|
PointerAlignment: Left
|
||||||
|
SpaceBeforeCtorInitializerColon: 'false'
|
||||||
|
SpaceInEmptyParentheses: 'false'
|
||||||
|
SpacesInParentheses: 'true'
|
||||||
|
Standard: Cpp11
|
||||||
|
TabWidth: '4'
|
||||||
|
UseTab: Never
|
||||||
|
|
||||||
|
...
|
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@@ -1 +1 @@
|
|||||||
patreon: horenmar
|
custom: "https://www.paypal.me/horenmar"
|
||||||
|
@@ -14,7 +14,7 @@ if (CMAKE_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
project(Catch2 LANGUAGES CXX VERSION 2.12.2)
|
project(Catch2 LANGUAGES CXX VERSION 2.12.4)
|
||||||
|
|
||||||
# Provide path for scripts
|
# Provide path for scripts
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake")
|
||||||
|
@@ -5,11 +5,11 @@
|
|||||||
[](https://travis-ci.org/catchorg/Catch2)
|
[](https://travis-ci.org/catchorg/Catch2)
|
||||||
[](https://ci.appveyor.com/project/catchorg/catch2)
|
[](https://ci.appveyor.com/project/catchorg/catch2)
|
||||||
[](https://codecov.io/gh/catchorg/Catch2)
|
[](https://codecov.io/gh/catchorg/Catch2)
|
||||||
[](https://wandbox.org/permlink/QdDfqVqDGRuwcduN)
|
[](https://wandbox.org/permlink/wRuqI3INY7fTagL7)
|
||||||
[](https://discord.gg/4CWS9zD)
|
[](https://discord.gg/4CWS9zD)
|
||||||
|
|
||||||
|
|
||||||
<a href="https://github.com/catchorg/Catch2/releases/download/v2.12.2/catch.hpp">The latest version of the single header can be downloaded directly using this link</a>
|
<a href="https://github.com/catchorg/Catch2/releases/download/v2.12.4/catch.hpp">The latest version of the single header can be downloaded directly using this link</a>
|
||||||
|
|
||||||
## Catch2 is released!
|
## Catch2 is released!
|
||||||
|
|
||||||
|
@@ -1,100 +1,134 @@
|
|||||||
<a id="top"></a>
|
<a id="top"></a>
|
||||||
# Contributing to Catch
|
# Contributing to Catch2
|
||||||
|
|
||||||
**Contents**<br>
|
**Contents**<br>
|
||||||
[Branches](#branches)<br>
|
[Using Git(Hub)](#using-github)<br>
|
||||||
[Directory structure](#directory-structure)<br>
|
|
||||||
[Testing your changes](#testing-your-changes)<br>
|
[Testing your changes](#testing-your-changes)<br>
|
||||||
[Documenting your code](#documenting-your-code)<br>
|
[Writing documentation](#writing-documentation)<br>
|
||||||
[Code constructs to watch out for](#code-constructs-to-watch-out-for)<br>
|
[Writing code](#writing-code)<br>
|
||||||
|
[CoC](#coc)<br>
|
||||||
|
|
||||||
So you want to contribute something to Catch? That's great! Whether it's a bug fix, a new feature, support for
|
So you want to contribute something to Catch2? That's great! Whether it's
|
||||||
additional compilers - or just a fix to the documentation - all contributions are very welcome and very much appreciated.
|
a bug fix, a new feature, support for additional compilers - or just
|
||||||
Of course so are bug reports and other comments and questions.
|
a fix to the documentation - all contributions are very welcome and very
|
||||||
|
much appreciated. Of course so are bug reports, other comments, and
|
||||||
|
questions, but generally it is a better idea to ask questions in our
|
||||||
|
[Discord](https://discord.gg/4CWS9zD), than in the issue tracker.
|
||||||
|
|
||||||
If you are contributing to the code base there are a few simple guidelines to keep in mind. This also includes notes to
|
|
||||||
help you find your way around. As this is liable to drift out of date please raise an issue or, better still, a pull
|
|
||||||
request for this file, if you notice that.
|
|
||||||
|
|
||||||
## Branches
|
This page covers some guidelines and helpful tips for contributing
|
||||||
|
to the codebase itself.
|
||||||
|
|
||||||
Ongoing development is currently on _master_. At some point an integration branch will be set-up and PRs should target
|
## Using Git(Hub)
|
||||||
that - but for now it's all against master. You may see feature branches come and go from time to time, too.
|
|
||||||
|
|
||||||
## Directory structure
|
Ongoing development happens in the `master` branch for Catch2 v2, and in
|
||||||
|
`dev-v3` for the next major version, v3.
|
||||||
|
|
||||||
_Users_ of Catch primarily use the single header version. _Maintainers_ should work with the full source (which is still,
|
Commits should be small and atomic. A commit is atomic when, after it is
|
||||||
primarily, in headers). This can be found in the `include` folder. There are a set of test files, currently under
|
applied, the codebase, tests and all, still works as expected. Small
|
||||||
`projects/SelfTest`. The test app can be built via CMake from the `CMakeLists.txt` file in the root, or you can generate
|
commits are also prefered, as they make later operations with git history,
|
||||||
project files for Visual Studio, XCode, and others (instructions in the `projects` folder). If you have access to CLion,
|
whether it is bisecting, reverting, or something else, easier.
|
||||||
it can work with the CMake file directly.
|
|
||||||
|
|
||||||
As well as the runtime test files you'll also see a `SurrogateCpps` directory under `projects/SelfTest`.
|
_When submitting a pull request please do not include changes to the
|
||||||
This contains a set of .cpp files that each `#include` a single header.
|
single include. This means do not include them in your git commits!_
|
||||||
While these files are not essential to compilation they help to keep the implementation headers self-contained.
|
|
||||||
At time of writing this set is not complete but has reasonable coverage.
|
|
||||||
If you add additional headers please try to remember to add a surrogate cpp for it.
|
|
||||||
|
|
||||||
The other directories are `scripts` which contains a set of python scripts to help in testing Catch as well as
|
|
||||||
generating the single include, and `docs`, which contains the documentation as a set of markdown files.
|
|
||||||
|
|
||||||
__When submitting a pull request please do not include changes to the single include, or to the version number file
|
When addressing review comments in a MR, please do not rebase/squash the
|
||||||
as these are managed by the scripts!__
|
commits immediately. Doing so makes it harder to review the new changes,
|
||||||
|
slowing down the process of merging a MR. Instead, when addressing review
|
||||||
|
comments, you should append new commits to the branch and only squash
|
||||||
|
them into other commits when the MR is ready to be merged. We recommend
|
||||||
|
creating new commits with `git commit --fixup` (or `--squash`) and then
|
||||||
|
later squashing them with `git rebase --autosquash` to make things easier.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Testing your changes
|
## Testing your changes
|
||||||
|
|
||||||
Obviously all changes to Catch's code should be tested. If you added new
|
_Note: Running Catch2's tests requires Python3_
|
||||||
functionality, you should add tests covering and showcasing it. Even if you have
|
|
||||||
only made changes to Catch internals (i.e. you implemented some performance
|
|
||||||
improvements), you should still test your changes.
|
|
||||||
|
|
||||||
This means 2 things
|
|
||||||
|
|
||||||
* Compiling Catch's SelfTest project:
|
Catch2 has multiple layers of tests that are then run as part of our CI.
|
||||||
|
The most obvious one are the unit tests compiled into the `SelfTest`
|
||||||
|
binary. These are then used in "Approval tests", which run (almost) all
|
||||||
|
tests from `SelfTest` through a specific reporter and then compare the
|
||||||
|
generated output with a known good output ("Baseline"). By default, new
|
||||||
|
tests should be placed here.
|
||||||
|
|
||||||
|
However, not all tests can be written as plain unit tests. For example,
|
||||||
|
checking that Catch2 orders tests randomly when asked to, and that this
|
||||||
|
random ordering is subset-invariant, is better done as an integration
|
||||||
|
test using an external check script. Catch2 integration tests are written
|
||||||
|
using CTest, either as a direct command invocation + pass/fail regex,
|
||||||
|
or by delegating the check to a Python script.
|
||||||
|
|
||||||
|
There are also two more kinds of tests, examples and "ExtraTests".
|
||||||
|
Examples serve as a compilation test on the single-header distribution,
|
||||||
|
and present a small and self-contained snippets of using Catch2 for
|
||||||
|
writing tests. ExtraTests then are tests that either take a long time
|
||||||
|
to run, or require separate compilation, e.g. because of testing compile
|
||||||
|
time configuration options, and take a long time because of that.
|
||||||
|
|
||||||
|
Both of these are compiled against the single-header distribution of
|
||||||
|
Catch2, and thus might require you to regenerate it manually. This is
|
||||||
|
done by calling the `generateSingleHeader.py` script in `scripts`.
|
||||||
|
|
||||||
|
Examples and ExtraTests are not compiled by default. To compile them,
|
||||||
|
add `-DCATCH_BUILD_EXAMPLES=ON` and `-DCATCH_BUILD_EXTRA_TESTS=ON` to
|
||||||
|
the invocation of CMake configuration step.
|
||||||
|
|
||||||
|
Bringing this all together, the steps below should configure, build,
|
||||||
|
and run all tests in the `Debug` compilation.
|
||||||
|
|
||||||
|
1. Regenerate the single header distribution
|
||||||
```
|
```
|
||||||
$ cd Catch2
|
$ cd Catch2
|
||||||
$ cmake -Bdebug-build -H. -DCMAKE_BUILD_TYPE=Debug
|
$ ./scripts/generateSingleHeader.py
|
||||||
|
```
|
||||||
|
2. Configure the full test build
|
||||||
|
```
|
||||||
|
$ cmake -Bdebug-build -H. -DCMAKE_BUILD_TYPE=Debug -DCATCH_BUILD_EXAMPLES=ON -DCATCH_BUILD_EXTRA_TESTS=ON
|
||||||
|
```
|
||||||
|
3. Run the actual build
|
||||||
|
```
|
||||||
$ cmake --build debug-build
|
$ cmake --build debug-build
|
||||||
```
|
```
|
||||||
because code that does not compile is evidently incorrect. Obviously,
|
4. Run the tests using CTest
|
||||||
you are not expected to have access to all the compilers and platforms
|
|
||||||
supported by Catch2, but you should at least smoke test your changes
|
|
||||||
on your platform. Our CI pipeline will check your PR against most of
|
|
||||||
the supported platforms, but it takes an hour to finish -- compiling
|
|
||||||
locally takes just a few minutes.
|
|
||||||
|
|
||||||
|
|
||||||
* Running the tests via CTest:
|
|
||||||
```
|
```
|
||||||
$ cd debug-build
|
$ cd debug-build
|
||||||
$ ctest -j 2 --output-on-failure
|
$ ctest -j 4 --output-on-failure -C Debug
|
||||||
```
|
```
|
||||||
__Note:__ When running your tests with multi-configuration generators like
|
|
||||||
Visual Studio, you might get errors "Test not available without configuration."
|
|
||||||
You then have to pick one configuration (e.g. ` -C Debug`) in the `ctest` call.
|
|
||||||
|
|
||||||
If you added new tests, approval tests are very likely to fail. If they
|
|
||||||
do not, it means that your changes weren't run as part of them. This
|
|
||||||
_might_ be intentional, but usually is not.
|
|
||||||
|
|
||||||
The approval tests compare current output of the SelfTest binary in various
|
|
||||||
configurations against known good outputs. The reason it fails is,
|
|
||||||
_usually_, that you've added new tests but have not yet approved the changes
|
|
||||||
they introduce. This is done with the `scripts/approve.py` script, but
|
|
||||||
before you do so, you need to check that the introduced changes are indeed
|
|
||||||
intentional.
|
|
||||||
|
|
||||||
|
|
||||||
## Documenting your code
|
## Writing documentation
|
||||||
|
|
||||||
If you have added new feature to Catch2, it needs documentation, so that
|
If you have added new feature to Catch2, it needs documentation, so that
|
||||||
other people can use it as well. This section collects some technical
|
other people can use it as well. This section collects some technical
|
||||||
information that you will need for updating Catch2's documentation, and
|
information that you will need for updating Catch2's documentation, and
|
||||||
possibly some generic advise as well.
|
possibly some generic advise as well.
|
||||||
|
|
||||||
|
### Technicalities
|
||||||
|
|
||||||
First, the technicalities:
|
First, the technicalities:
|
||||||
|
|
||||||
|
* If you have introduced a new document, there is a simple template you
|
||||||
|
should use. It provides you with the top anchor mentioned to link to
|
||||||
|
(more below), and also with a backlink to the top of the documentation:
|
||||||
|
```markdown
|
||||||
|
<a id="top"></a>
|
||||||
|
# Cool feature
|
||||||
|
|
||||||
|
Text that explains how to use the cool feature.
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
[Home](Readme.md#top)
|
||||||
|
```
|
||||||
|
|
||||||
|
* Crosslinks to different pages should target the `top` anchor, like this
|
||||||
|
`[link to contributing](contributing.md#top)`.
|
||||||
|
|
||||||
* We introduced version tags to the documentation, which show users in
|
* We introduced version tags to the documentation, which show users in
|
||||||
which version a specific feature was introduced. This means that newly
|
which version a specific feature was introduced. This means that newly
|
||||||
written documentation should be tagged with a placeholder, that will
|
written documentation should be tagged with a placeholder, that will
|
||||||
@@ -106,23 +140,8 @@ tags for other features).
|
|||||||
placeholder is usually used after a section heading
|
placeholder is usually used after a section heading
|
||||||
* `> X (Y and Z) was [introduced](link-to-issue-or-PR) in Catch X.Y.Z`
|
* `> X (Y and Z) was [introduced](link-to-issue-or-PR) in Catch X.Y.Z`
|
||||||
- this placeholder is used when you need to tag a subpart of something,
|
- this placeholder is used when you need to tag a subpart of something,
|
||||||
e.g. list
|
e.g. a list
|
||||||
* Crosslinks to different pages should target the `top` anchor, like this
|
|
||||||
`[link to contributing](contributing.md#top)`.
|
|
||||||
* If you have introduced a new document, there is a simple template you
|
|
||||||
should use. It provides you with the top anchor mentioned above, and also
|
|
||||||
with a backlink to the top of the documentation:
|
|
||||||
```markdown
|
|
||||||
<a id="top"></a>
|
|
||||||
# Cool feature
|
|
||||||
|
|
||||||
Text that explains how to use the cool feature.
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
[Home](Readme.md#top)
|
|
||||||
```
|
|
||||||
* For pages with more than 4 subheadings, we provide a table of contents
|
* For pages with more than 4 subheadings, we provide a table of contents
|
||||||
(ToC) at the top of the page. Because GitHub markdown does not support
|
(ToC) at the top of the page. Because GitHub markdown does not support
|
||||||
automatic generation of ToC, it has to be handled semi-manually. Thus,
|
automatic generation of ToC, it has to be handled semi-manually. Thus,
|
||||||
@@ -130,21 +149,54 @@ if you've added a new subheading to some page, you should add it to the
|
|||||||
ToC. This can be done either manually, or by running the
|
ToC. This can be done either manually, or by running the
|
||||||
`updateDocumentToC.py` script in the `scripts/` folder.
|
`updateDocumentToC.py` script in the `scripts/` folder.
|
||||||
|
|
||||||
|
### Contents
|
||||||
|
|
||||||
Now, for the generic tips:
|
Now, for some content tips:
|
||||||
* Usage examples are good
|
|
||||||
* Don't be afraid to introduce new pages
|
* Usage examples are good. However, having large code snippets inline
|
||||||
* Try to be reasonably consistent with the surrounding documentation
|
can make the documentation less readable, and so the inline snippets
|
||||||
|
should be kept reasonably short. To provide more complex compilable
|
||||||
|
examples, consider adding new .cpp file to `examples/`.
|
||||||
|
|
||||||
|
* Don't be afraid to introduce new pages. The current documentation
|
||||||
|
tends towards long pages, but a lot of that is caused by legacy, and
|
||||||
|
we know that some of the pages are overly big and unfocused.
|
||||||
|
|
||||||
|
* When adding information to an existing page, please try to keep your
|
||||||
|
formatting, style and changes consistent with the rest of the page.
|
||||||
|
|
||||||
|
* Any documentation has multiple different audiences, that desire
|
||||||
|
different information from the text. The 3 basic user-types to try and
|
||||||
|
cover are:
|
||||||
|
* A beginner to Catch2, who requires closer guidance for the usage of Catch2.
|
||||||
|
* Advanced user of Catch2, who want to customize their usage.
|
||||||
|
* Experts, looking for full reference of Catch2's capabilities.
|
||||||
|
|
||||||
|
|
||||||
|
## Writing code
|
||||||
|
|
||||||
|
If want to contribute code, this section contains some simple rules
|
||||||
|
and tips on things like code formatting, code constructions to avoid,
|
||||||
|
and so on.
|
||||||
|
|
||||||
|
|
||||||
## Code constructs to watch out for
|
### Formatting
|
||||||
|
|
||||||
|
To make code formatting simpler for the contributors, Catch2 provides
|
||||||
|
its own config for `clang-format`. However, because it is currently
|
||||||
|
impossible to replicate existing Catch2's formatting in clang-format,
|
||||||
|
using it to reformat a whole file would cause massive diffs. To keep
|
||||||
|
the size of your diffs reasonable, you should only use clang-format
|
||||||
|
on the newly changed code.
|
||||||
|
|
||||||
|
|
||||||
|
### Code constructs to watch out for
|
||||||
|
|
||||||
This section is a (sadly incomplete) listing of various constructs that
|
This section is a (sadly incomplete) listing of various constructs that
|
||||||
are problematic and are not always caught by our CI infrastructure.
|
are problematic and are not always caught by our CI infrastructure.
|
||||||
|
|
||||||
### Naked exceptions and exceptions-related function
|
|
||||||
|
#### Naked exceptions and exceptions-related function
|
||||||
|
|
||||||
If you are throwing an exception, it should be done via `CATCH_ERROR`
|
If you are throwing an exception, it should be done via `CATCH_ERROR`
|
||||||
or `CATCH_RUNTIME_ERROR` in `catch_enforce.h`. These macros will handle
|
or `CATCH_RUNTIME_ERROR` in `catch_enforce.h`. These macros will handle
|
||||||
@@ -155,7 +207,8 @@ CI, but luckily there should not be too many reasons to use these.
|
|||||||
However, if you do, they should be kept behind a
|
However, if you do, they should be kept behind a
|
||||||
`CATCH_CONFIG_DISABLE_EXCEPTIONS` macro.
|
`CATCH_CONFIG_DISABLE_EXCEPTIONS` macro.
|
||||||
|
|
||||||
### Unqualified usage of functions from C's stdlib
|
|
||||||
|
#### Unqualified usage of functions from C's stdlib
|
||||||
|
|
||||||
If you are using a function from C's stdlib, please include the header
|
If you are using a function from C's stdlib, please include the header
|
||||||
as `<cfoo>` and call the function qualified. The common knowledge that
|
as `<cfoo>` and call the function qualified. The common knowledge that
|
||||||
@@ -163,7 +216,12 @@ there is no difference is wrong, QNX and VxWorks won't compile if you
|
|||||||
include the header as `<cfoo>` and call the function unqualified.
|
include the header as `<cfoo>` and call the function unqualified.
|
||||||
|
|
||||||
|
|
||||||
----
|
## CoC
|
||||||
|
|
||||||
|
This project has a [CoC](../CODE_OF_CONDUCT.md). Please adhere to it
|
||||||
|
while contributing to Catch2.
|
||||||
|
|
||||||
|
-----------
|
||||||
|
|
||||||
_This documentation will always be in-progress as new information comes
|
_This documentation will always be in-progress as new information comes
|
||||||
up, but we are trying to keep it as up to date as possible._
|
up, but we are trying to keep it as up to date as possible._
|
||||||
|
@@ -12,17 +12,36 @@ are run once per each value in a generator.
|
|||||||
This is best explained with an example:
|
This is best explained with an example:
|
||||||
```cpp
|
```cpp
|
||||||
TEST_CASE("Generators") {
|
TEST_CASE("Generators") {
|
||||||
auto i = GENERATE(1, 2, 3);
|
auto i = GENERATE(1, 2);
|
||||||
SECTION("one") {
|
SECTION("one") {
|
||||||
auto j = GENERATE( -3, -2, -1 );
|
auto j = GENERATE(-3, -2);
|
||||||
REQUIRE(j < i);
|
REQUIRE(j < i);
|
||||||
}
|
}
|
||||||
|
SECTION("two") {
|
||||||
|
auto k = GENERATE(4, 5, 6);
|
||||||
|
REQUIRE(j != k);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
The assertion in this test case will be run 9 times, because there
|
The `SECTION` "one" will be run 4 (2*2) times, because the outer
|
||||||
are 3 possible values for `i` (1, 2, and 3) and there are 3 possible
|
generator has 2 elements in it, and the inner generator also has 2
|
||||||
values for `j` (-3, -2, and -1).
|
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",
|
||||||
|
...
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
```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
|
There are 2 parts to generators in Catch2, the `GENERATE` macro together
|
||||||
|
@@ -16,6 +16,7 @@
|
|||||||
- Configuration: [Provide your own output streams](../examples/231-Cfg-OutputStreams.cpp)
|
- Configuration: [Provide your own output streams](../examples/231-Cfg-OutputStreams.cpp)
|
||||||
- Generators: [Create your own generator](../examples/300-Gen-OwnGenerator.cpp)
|
- Generators: [Create your own generator](../examples/300-Gen-OwnGenerator.cpp)
|
||||||
- Generators: [Use map to convert types in GENERATE expression](../examples/301-Gen-MapTypeConversion.cpp)
|
- Generators: [Use map to convert types in GENERATE expression](../examples/301-Gen-MapTypeConversion.cpp)
|
||||||
|
- Generators: [Run test with a table of input values](../examples/302-Gen-Table.cpp)
|
||||||
- Generators: [Use variables in generator expressions](../examples/310-Gen-VariablesInGenerators.cpp)
|
- Generators: [Use variables in generator expressions](../examples/310-Gen-VariablesInGenerators.cpp)
|
||||||
- Generators: [Use custom variable capture in generator expressions](../examples/311-Gen-CustomCapture.cpp)
|
- Generators: [Use custom variable capture in generator expressions](../examples/311-Gen-CustomCapture.cpp)
|
||||||
|
|
||||||
|
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
# Release notes
|
# Release notes
|
||||||
**Contents**<br>
|
**Contents**<br>
|
||||||
|
[2.12.4](#2124)<br>
|
||||||
|
[2.12.3](#2123)<br>
|
||||||
[2.12.2](#2122)<br>
|
[2.12.2](#2122)<br>
|
||||||
[2.12.1](#2121)<br>
|
[2.12.1](#2121)<br>
|
||||||
[2.12.0](#2120)<br>
|
[2.12.0](#2120)<br>
|
||||||
@@ -38,6 +40,32 @@
|
|||||||
[Even Older versions](#even-older-versions)<br>
|
[Even Older versions](#even-older-versions)<br>
|
||||||
|
|
||||||
|
|
||||||
|
## 2.12.4
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
* Added support for MacOS on ARM (#1971)
|
||||||
|
|
||||||
|
|
||||||
|
## 2.12.3
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
* `GENERATE` nested in a for loop no longer creates multiple generators (#1913)
|
||||||
|
* Fixed copy paste error breaking `TEMPLATE_TEST_CASE_SIG` for 6 or more arguments (#1954)
|
||||||
|
* Fixed potential UB when handling non-ASCII characters in CLI args (#1943)
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
* There can be multiple calls to `GENERATE` on a single line
|
||||||
|
* Improved `fno-except` support for platforms that do not provide shims for exception-related std functions (#1950)
|
||||||
|
* E.g. the Green Hills C++ compiler
|
||||||
|
* XmlReporter now also reports test-case-level statistics (#1958)
|
||||||
|
* This is done via a new element, `OverallResultsCases`
|
||||||
|
|
||||||
|
### Miscellaneous
|
||||||
|
* Added `.clang-format` file to the repo (#1182, #1920)
|
||||||
|
* Rewrote contributing docs
|
||||||
|
* They should explain the different levels of testing and so on much better
|
||||||
|
|
||||||
|
|
||||||
## 2.12.2
|
## 2.12.2
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
|
@@ -1,7 +1,9 @@
|
|||||||
// 301-Gen-MapTypeConversion.cpp
|
// 301-Gen-MapTypeConversion.cpp
|
||||||
// Shows how to use map to modify generator's return type.
|
// Shows how to use map to modify generator's return type.
|
||||||
|
|
||||||
// TODO
|
// Specifically we wrap a std::string returning generator with a generator
|
||||||
|
// that converts the strings using stoi, so the returned type is actually
|
||||||
|
// an int.
|
||||||
|
|
||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch.hpp>
|
||||||
|
|
||||||
|
54
examples/302-Gen-Table.cpp
Normal file
54
examples/302-Gen-Table.cpp
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
// 302-Gen-Table.cpp
|
||||||
|
// Shows how to use table to run a test many times with different inputs. Lifted from examples on
|
||||||
|
// issue #850.
|
||||||
|
|
||||||
|
#include <catch2/catch.hpp>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
struct TestSubject {
|
||||||
|
// this is the method we are going to test. It returns the length of the
|
||||||
|
// input string.
|
||||||
|
size_t GetLength( const std::string& input ) const { return input.size(); }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
TEST_CASE("Table allows pre-computed test inputs and outputs", "[example][generator]") {
|
||||||
|
using std::make_tuple;
|
||||||
|
// do setup here as normal
|
||||||
|
TestSubject subj;
|
||||||
|
|
||||||
|
SECTION("This section is run for each row in the table") {
|
||||||
|
std::string test_input;
|
||||||
|
size_t expected_output;
|
||||||
|
std::tie( test_input, expected_output ) =
|
||||||
|
GENERATE( table<std::string, size_t>(
|
||||||
|
{ /* In this case one of the parameters to our test case is the
|
||||||
|
* expected output, but this is not required. There could be
|
||||||
|
* multiple expected values in the table, which can have any
|
||||||
|
* (fixed) number of columns.
|
||||||
|
*/
|
||||||
|
make_tuple( "one", 3 ),
|
||||||
|
make_tuple( "two", 3 ),
|
||||||
|
make_tuple( "three", 5 ),
|
||||||
|
make_tuple( "four", 4 ) } ) );
|
||||||
|
|
||||||
|
// run the test
|
||||||
|
auto result = subj.GetLength(test_input);
|
||||||
|
// capture the input data to go with the outputs.
|
||||||
|
CAPTURE(test_input);
|
||||||
|
// check it matches the pre-calculated data
|
||||||
|
REQUIRE(result == expected_output);
|
||||||
|
} // end section
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Possible simplifications where less legacy toolchain support is needed:
|
||||||
|
*
|
||||||
|
* - With libstdc++6 or newer, the make_tuple() calls can be ommitted
|
||||||
|
* (technically C++17 but does not require -std in GCC/Clang). See
|
||||||
|
* https://stackoverflow.com/questions/12436586/tuple-vector-and-initializer-list
|
||||||
|
*
|
||||||
|
* - In C++17 mode std::tie() and the preceeding variable delcarations can be
|
||||||
|
* replaced by structured bindings: auto [test_input, expected] = GENERATE(
|
||||||
|
* table<std::string, size_t>({ ...
|
||||||
|
*/
|
||||||
|
// Compiling and running this file will result in 4 successful assertions
|
@@ -27,7 +27,7 @@ TEST_CASE("Generate random doubles across different ranges",
|
|||||||
// This will take r1 by reference and r2 by value.
|
// This will take r1 by reference and r2 by value.
|
||||||
// Note that there are no advantages for doing so in this example,
|
// Note that there are no advantages for doing so in this example,
|
||||||
// it is done only for expository purposes.
|
// it is done only for expository purposes.
|
||||||
auto number = Catch::Generators::generate( CATCH_INTERNAL_LINEINFO,
|
auto number = Catch::Generators::generate( "custom capture generator", CATCH_INTERNAL_LINEINFO,
|
||||||
[&r1, r2]{
|
[&r1, r2]{
|
||||||
using namespace Catch::Generators;
|
using namespace Catch::Generators;
|
||||||
return makeGenerators(take(50, random(std::get<0>(r1), std::get<1>(r2))));
|
return makeGenerators(take(50, random(std::get<0>(r1), std::get<1>(r2))));
|
||||||
|
@@ -46,6 +46,7 @@ set( SOURCES_IDIOMATIC_TESTS
|
|||||||
210-Evt-EventListeners.cpp
|
210-Evt-EventListeners.cpp
|
||||||
300-Gen-OwnGenerator.cpp
|
300-Gen-OwnGenerator.cpp
|
||||||
301-Gen-MapTypeConversion.cpp
|
301-Gen-MapTypeConversion.cpp
|
||||||
|
302-Gen-Table.cpp
|
||||||
310-Gen-VariablesInGenerators.cpp
|
310-Gen-VariablesInGenerators.cpp
|
||||||
311-Gen-CustomCapture.cpp
|
311-Gen-CustomCapture.cpp
|
||||||
)
|
)
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#define CATCH_VERSION_MAJOR 2
|
#define CATCH_VERSION_MAJOR 2
|
||||||
#define CATCH_VERSION_MINOR 12
|
#define CATCH_VERSION_MINOR 12
|
||||||
#define CATCH_VERSION_PATCH 2
|
#define CATCH_VERSION_PATCH 4
|
||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
# pragma clang system_header
|
# pragma clang system_header
|
||||||
|
2
include/external/clara.hpp
vendored
2
include/external/clara.hpp
vendored
@@ -667,7 +667,7 @@ namespace detail {
|
|||||||
}
|
}
|
||||||
inline auto convertInto( std::string const &source, bool &target ) -> ParserResult {
|
inline auto convertInto( std::string const &source, bool &target ) -> ParserResult {
|
||||||
std::string srcLC = source;
|
std::string srcLC = source;
|
||||||
std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( char c ) { return static_cast<char>( std::tolower(c) ); } );
|
std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( unsigned char c ) { return static_cast<char>( std::tolower(c) ); } );
|
||||||
if (srcLC == "y" || srcLC == "1" || srcLC == "true" || srcLC == "yes" || srcLC == "on")
|
if (srcLC == "y" || srcLC == "1" || srcLC == "true" || srcLC == "yes" || srcLC == "on")
|
||||||
target = true;
|
target = true;
|
||||||
else if (srcLC == "n" || srcLC == "0" || srcLC == "false" || srcLC == "no" || srcLC == "off")
|
else if (srcLC == "n" || srcLC == "0" || srcLC == "false" || srcLC == "no" || srcLC == "off")
|
||||||
|
@@ -17,7 +17,11 @@ namespace Catch {
|
|||||||
|
|
||||||
#ifdef CATCH_PLATFORM_MAC
|
#ifdef CATCH_PLATFORM_MAC
|
||||||
|
|
||||||
|
#if defined(__i386__) || defined(__x86_64__)
|
||||||
#define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */
|
#define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */
|
||||||
|
#elif defined(__aarch64__)
|
||||||
|
#define CATCH_TRAP() __asm__(".inst 0xd4200000")
|
||||||
|
#endif
|
||||||
|
|
||||||
#elif defined(CATCH_PLATFORM_IPHONE)
|
#elif defined(CATCH_PLATFORM_IPHONE)
|
||||||
|
|
||||||
|
@@ -24,8 +24,8 @@ namespace Generators {
|
|||||||
|
|
||||||
GeneratorUntypedBase::~GeneratorUntypedBase() {}
|
GeneratorUntypedBase::~GeneratorUntypedBase() {}
|
||||||
|
|
||||||
auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& {
|
auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& {
|
||||||
return getResultCapture().acquireGeneratorTracker( lineInfo );
|
return getResultCapture().acquireGeneratorTracker( generatorName, lineInfo );
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Generators
|
} // namespace Generators
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
#include "catch_interfaces_generatortracker.h"
|
#include "catch_interfaces_generatortracker.h"
|
||||||
#include "catch_common.h"
|
#include "catch_common.h"
|
||||||
#include "catch_enforce.h"
|
#include "catch_enforce.h"
|
||||||
|
#include "catch_stringref.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -181,16 +182,16 @@ namespace Generators {
|
|||||||
return makeGenerators( value( T( std::forward<U>( val ) ) ), std::forward<Gs>( moreGenerators )... );
|
return makeGenerators( value( T( std::forward<U>( val ) ) ), std::forward<Gs>( moreGenerators )... );
|
||||||
}
|
}
|
||||||
|
|
||||||
auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker&;
|
auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker&;
|
||||||
|
|
||||||
template<typename L>
|
template<typename L>
|
||||||
// Note: The type after -> is weird, because VS2015 cannot parse
|
// Note: The type after -> is weird, because VS2015 cannot parse
|
||||||
// the expression used in the typedef inside, when it is in
|
// the expression used in the typedef inside, when it is in
|
||||||
// return type. Yeah.
|
// return type. Yeah.
|
||||||
auto generate( SourceLineInfo const& lineInfo, L const& generatorExpression ) -> decltype(std::declval<decltype(generatorExpression())>().get()) {
|
auto generate( StringRef generatorName, SourceLineInfo const& lineInfo, L const& generatorExpression ) -> decltype(std::declval<decltype(generatorExpression())>().get()) {
|
||||||
using UnderlyingType = typename decltype(generatorExpression())::type;
|
using UnderlyingType = typename decltype(generatorExpression())::type;
|
||||||
|
|
||||||
IGeneratorTracker& tracker = acquireGeneratorTracker( lineInfo );
|
IGeneratorTracker& tracker = acquireGeneratorTracker( generatorName, lineInfo );
|
||||||
if (!tracker.hasGenerator()) {
|
if (!tracker.hasGenerator()) {
|
||||||
tracker.setGenerator(pf::make_unique<Generators<UnderlyingType>>(generatorExpression()));
|
tracker.setGenerator(pf::make_unique<Generators<UnderlyingType>>(generatorExpression()));
|
||||||
}
|
}
|
||||||
@@ -203,10 +204,16 @@ namespace Generators {
|
|||||||
} // namespace Catch
|
} // namespace Catch
|
||||||
|
|
||||||
#define GENERATE( ... ) \
|
#define GENERATE( ... ) \
|
||||||
Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [ ]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace)
|
Catch::Generators::generate( INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \
|
||||||
|
CATCH_INTERNAL_LINEINFO, \
|
||||||
|
[ ]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace)
|
||||||
#define GENERATE_COPY( ... ) \
|
#define GENERATE_COPY( ... ) \
|
||||||
Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [=]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace)
|
Catch::Generators::generate( INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \
|
||||||
|
CATCH_INTERNAL_LINEINFO, \
|
||||||
|
[=]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace)
|
||||||
#define GENERATE_REF( ... ) \
|
#define GENERATE_REF( ... ) \
|
||||||
Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [&]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace)
|
Catch::Generators::generate( INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \
|
||||||
|
CATCH_INTERNAL_LINEINFO, \
|
||||||
|
[&]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace)
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_GENERATORS_HPP_INCLUDED
|
#endif // TWOBLUECUBES_CATCH_GENERATORS_HPP_INCLUDED
|
||||||
|
@@ -44,7 +44,7 @@ namespace Catch {
|
|||||||
virtual void sectionEnded( SectionEndInfo const& endInfo ) = 0;
|
virtual void sectionEnded( SectionEndInfo const& endInfo ) = 0;
|
||||||
virtual void sectionEndedEarly( SectionEndInfo const& endInfo ) = 0;
|
virtual void sectionEndedEarly( SectionEndInfo const& endInfo ) = 0;
|
||||||
|
|
||||||
virtual auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& = 0;
|
virtual auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& = 0;
|
||||||
|
|
||||||
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
|
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
|
||||||
virtual void benchmarkPreparing( std::string const& name ) = 0;
|
virtual void benchmarkPreparing( std::string const& name ) = 0;
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Created by Jozef on 12/11/2018.
|
* Created by Jozef on 12/11/2018.
|
||||||
* Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
|
* Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
|
||||||
@@ -90,7 +91,7 @@
|
|||||||
#define INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_0, _1, _2, _3) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_1, _2, _3)
|
#define INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_0, _1, _2, _3) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_1, _2, _3)
|
||||||
#define INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_0, _1, _2, _3, _4) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_1, _2, _3, _4)
|
#define INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_0, _1, _2, _3, _4) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_1, _2, _3, _4)
|
||||||
#define INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_0, _1, _2, _3, _4, _5) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_1, _2, _3, _4, _5)
|
#define INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_0, _1, _2, _3, _4, _5) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_1, _2, _3, _4, _5)
|
||||||
#define INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_0, _1, _2, _3, _4, _5, _6) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_1, _2, _4, _5, _6)
|
#define INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_0, _1, _2, _3, _4, _5, _6) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_1, _2, _3, _4, _5, _6)
|
||||||
#define INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_0, _1, _2, _3, _4, _5, _6, _7) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_1, _2, _3, _4, _5, _6, _7)
|
#define INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_0, _1, _2, _3, _4, _5, _6, _7) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_1, _2, _3, _4, _5, _6, _7)
|
||||||
#define INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_1, _2, _3, _4, _5, _6, _7, _8)
|
#define INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_1, _2, _3, _4, _5, _6, _7, _8)
|
||||||
#define INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9)
|
#define INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9)
|
||||||
|
@@ -59,7 +59,11 @@ namespace Catch {
|
|||||||
m_tagAliasRegistry.add( alias, tag, lineInfo );
|
m_tagAliasRegistry.add( alias, tag, lineInfo );
|
||||||
}
|
}
|
||||||
void registerStartupException() noexcept override {
|
void registerStartupException() noexcept override {
|
||||||
|
#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
|
||||||
m_exceptionRegistry.add(std::current_exception());
|
m_exceptionRegistry.add(std::current_exception());
|
||||||
|
#else
|
||||||
|
CATCH_INTERNAL_ERROR("Attempted to register active exception under CATCH_CONFIG_DISABLE_EXCEPTIONS!");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
IMutableEnumValuesRegistry& getMutableEnumValuesRegistry() override {
|
IMutableEnumValuesRegistry& getMutableEnumValuesRegistry() override {
|
||||||
return m_enumValuesRegistry;
|
return m_enumValuesRegistry;
|
||||||
|
@@ -25,12 +25,27 @@ namespace Catch {
|
|||||||
std::shared_ptr<GeneratorTracker> tracker;
|
std::shared_ptr<GeneratorTracker> tracker;
|
||||||
|
|
||||||
ITracker& currentTracker = ctx.currentTracker();
|
ITracker& currentTracker = ctx.currentTracker();
|
||||||
if( TestCaseTracking::ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) {
|
// Under specific circumstances, the generator we want
|
||||||
|
// to acquire is also the current tracker. If this is
|
||||||
|
// the case, we have to avoid looking through current
|
||||||
|
// tracker's children, and instead return the current
|
||||||
|
// tracker.
|
||||||
|
// A case where this check is important is e.g.
|
||||||
|
// for (int i = 0; i < 5; ++i) {
|
||||||
|
// int n = GENERATE(1, 2);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// without it, the code above creates 5 nested generators.
|
||||||
|
if (currentTracker.nameAndLocation() == nameAndLocation) {
|
||||||
|
auto thisTracker = currentTracker.parent().findChild(nameAndLocation);
|
||||||
|
assert(thisTracker);
|
||||||
|
assert(thisTracker->isGeneratorTracker());
|
||||||
|
tracker = std::static_pointer_cast<GeneratorTracker>(thisTracker);
|
||||||
|
} else if ( TestCaseTracking::ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) {
|
||||||
assert( childTracker );
|
assert( childTracker );
|
||||||
assert( childTracker->isGeneratorTracker() );
|
assert( childTracker->isGeneratorTracker() );
|
||||||
tracker = std::static_pointer_cast<GeneratorTracker>( childTracker );
|
tracker = std::static_pointer_cast<GeneratorTracker>( childTracker );
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
tracker = std::make_shared<GeneratorTracker>( nameAndLocation, ctx, ¤tTracker );
|
tracker = std::make_shared<GeneratorTracker>( nameAndLocation, ctx, ¤tTracker );
|
||||||
currentTracker.addChild( tracker );
|
currentTracker.addChild( tracker );
|
||||||
}
|
}
|
||||||
@@ -187,9 +202,10 @@ namespace Catch {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
auto RunContext::acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& {
|
auto RunContext::acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& {
|
||||||
using namespace Generators;
|
using namespace Generators;
|
||||||
GeneratorTracker& tracker = GeneratorTracker::acquire( m_trackerContext, TestCaseTracking::NameAndLocation( "generator", lineInfo ) );
|
GeneratorTracker& tracker = GeneratorTracker::acquire(m_trackerContext,
|
||||||
|
TestCaseTracking::NameAndLocation( static_cast<std::string>(generatorName), lineInfo ) );
|
||||||
assert( tracker.isOpen() );
|
assert( tracker.isOpen() );
|
||||||
m_lastAssertionInfo.lineInfo = lineInfo;
|
m_lastAssertionInfo.lineInfo = lineInfo;
|
||||||
return tracker;
|
return tracker;
|
||||||
|
@@ -80,7 +80,7 @@ namespace Catch {
|
|||||||
void sectionEnded( SectionEndInfo const& endInfo ) override;
|
void sectionEnded( SectionEndInfo const& endInfo ) override;
|
||||||
void sectionEndedEarly( SectionEndInfo const& endInfo ) override;
|
void sectionEndedEarly( SectionEndInfo const& endInfo ) override;
|
||||||
|
|
||||||
auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& override;
|
auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& override;
|
||||||
|
|
||||||
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
|
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
|
||||||
void benchmarkPreparing( std::string const& name ) override;
|
void benchmarkPreparing( std::string const& name ) override;
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
#include "catch_startup_exception_registry.h"
|
#include "catch_startup_exception_registry.h"
|
||||||
#include "catch_compiler_capabilities.h"
|
#include "catch_compiler_capabilities.h"
|
||||||
|
|
||||||
|
#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
void StartupExceptionRegistry::add( std::exception_ptr const& exception ) noexcept {
|
void StartupExceptionRegistry::add( std::exception_ptr const& exception ) noexcept {
|
||||||
CATCH_TRY {
|
CATCH_TRY {
|
||||||
@@ -24,3 +25,4 @@ void StartupExceptionRegistry::add( std::exception_ptr const& exception ) noexce
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // end namespace Catch
|
} // end namespace Catch
|
||||||
|
#endif
|
||||||
|
@@ -15,11 +15,13 @@
|
|||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
class StartupExceptionRegistry {
|
class StartupExceptionRegistry {
|
||||||
|
#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
|
||||||
public:
|
public:
|
||||||
void add(std::exception_ptr const& exception) noexcept;
|
void add(std::exception_ptr const& exception) noexcept;
|
||||||
std::vector<std::exception_ptr> const& getExceptions() const noexcept;
|
std::vector<std::exception_ptr> const& getExceptions() const noexcept;
|
||||||
private:
|
private:
|
||||||
std::vector<std::exception_ptr> m_exceptions;
|
std::vector<std::exception_ptr> m_exceptions;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace Catch
|
} // end namespace Catch
|
||||||
|
@@ -18,7 +18,7 @@ namespace Catch {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
char toLowerCh(char c) {
|
char toLowerCh(char c) {
|
||||||
return static_cast<char>( std::tolower( c ) );
|
return static_cast<char>( std::tolower( static_cast<unsigned char>(c) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -65,15 +65,12 @@ namespace TestCaseTracking {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TrackerBase::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent )
|
TrackerBase::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ):
|
||||||
: m_nameAndLocation( nameAndLocation ),
|
ITracker(nameAndLocation),
|
||||||
m_ctx( ctx ),
|
m_ctx( ctx ),
|
||||||
m_parent( parent )
|
m_parent( parent )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
NameAndLocation const& TrackerBase::nameAndLocation() const {
|
|
||||||
return m_nameAndLocation;
|
|
||||||
}
|
|
||||||
bool TrackerBase::isComplete() const {
|
bool TrackerBase::isComplete() const {
|
||||||
return m_runState == CompletedSuccessfully || m_runState == Failed;
|
return m_runState == CompletedSuccessfully || m_runState == Failed;
|
||||||
}
|
}
|
||||||
|
@@ -23,17 +23,32 @@ namespace TestCaseTracking {
|
|||||||
SourceLineInfo location;
|
SourceLineInfo location;
|
||||||
|
|
||||||
NameAndLocation( std::string const& _name, SourceLineInfo const& _location );
|
NameAndLocation( std::string const& _name, SourceLineInfo const& _location );
|
||||||
|
friend bool operator==(NameAndLocation const& lhs, NameAndLocation const& rhs) {
|
||||||
|
return lhs.name == rhs.name
|
||||||
|
&& lhs.location == rhs.location;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ITracker;
|
class ITracker;
|
||||||
|
|
||||||
using ITrackerPtr = std::shared_ptr<ITracker>;
|
using ITrackerPtr = std::shared_ptr<ITracker>;
|
||||||
|
|
||||||
struct ITracker {
|
class ITracker {
|
||||||
virtual ~ITracker();
|
NameAndLocation m_nameAndLocation;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ITracker(NameAndLocation const& nameAndLoc) :
|
||||||
|
m_nameAndLocation(nameAndLoc)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// static queries
|
// static queries
|
||||||
virtual NameAndLocation const& nameAndLocation() const = 0;
|
NameAndLocation const& nameAndLocation() const {
|
||||||
|
return m_nameAndLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ~ITracker();
|
||||||
|
|
||||||
|
|
||||||
// dynamic queries
|
// dynamic queries
|
||||||
virtual bool isComplete() const = 0; // Successfully completed or failed
|
virtual bool isComplete() const = 0; // Successfully completed or failed
|
||||||
@@ -94,7 +109,6 @@ namespace TestCaseTracking {
|
|||||||
};
|
};
|
||||||
|
|
||||||
using Children = std::vector<ITrackerPtr>;
|
using Children = std::vector<ITrackerPtr>;
|
||||||
NameAndLocation m_nameAndLocation;
|
|
||||||
TrackerContext& m_ctx;
|
TrackerContext& m_ctx;
|
||||||
ITracker* m_parent;
|
ITracker* m_parent;
|
||||||
Children m_children;
|
Children m_children;
|
||||||
@@ -103,7 +117,6 @@ namespace TestCaseTracking {
|
|||||||
public:
|
public:
|
||||||
TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent );
|
TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent );
|
||||||
|
|
||||||
NameAndLocation const& nameAndLocation() const override;
|
|
||||||
bool isComplete() const override;
|
bool isComplete() const override;
|
||||||
bool isSuccessfullyCompleted() const override;
|
bool isSuccessfullyCompleted() const override;
|
||||||
bool isOpen() const override;
|
bool isOpen() const override;
|
||||||
|
@@ -12,7 +12,9 @@
|
|||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
bool uncaught_exceptions() {
|
bool uncaught_exceptions() {
|
||||||
#if defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
|
#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
|
||||||
|
return false;
|
||||||
|
#elif defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
|
||||||
return std::uncaught_exceptions() > 0;
|
return std::uncaught_exceptions() > 0;
|
||||||
#else
|
#else
|
||||||
return std::uncaught_exception();
|
return std::uncaught_exception();
|
||||||
|
@@ -37,7 +37,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Version const& libraryVersion() {
|
Version const& libraryVersion() {
|
||||||
static Version version( 2, 12, 2, "", 0 );
|
static Version version( 2, 12, 4, "", 0 );
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -207,6 +207,10 @@ namespace Catch {
|
|||||||
.writeAttribute( "successes", testGroupStats.totals.assertions.passed )
|
.writeAttribute( "successes", testGroupStats.totals.assertions.passed )
|
||||||
.writeAttribute( "failures", testGroupStats.totals.assertions.failed )
|
.writeAttribute( "failures", testGroupStats.totals.assertions.failed )
|
||||||
.writeAttribute( "expectedFailures", testGroupStats.totals.assertions.failedButOk );
|
.writeAttribute( "expectedFailures", testGroupStats.totals.assertions.failedButOk );
|
||||||
|
m_xml.scopedElement( "OverallResultsCases")
|
||||||
|
.writeAttribute( "successes", testGroupStats.totals.testCases.passed )
|
||||||
|
.writeAttribute( "failures", testGroupStats.totals.testCases.failed )
|
||||||
|
.writeAttribute( "expectedFailures", testGroupStats.totals.testCases.failedButOk );
|
||||||
m_xml.endElement();
|
m_xml.endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,6 +220,10 @@ namespace Catch {
|
|||||||
.writeAttribute( "successes", testRunStats.totals.assertions.passed )
|
.writeAttribute( "successes", testRunStats.totals.assertions.passed )
|
||||||
.writeAttribute( "failures", testRunStats.totals.assertions.failed )
|
.writeAttribute( "failures", testRunStats.totals.assertions.failed )
|
||||||
.writeAttribute( "expectedFailures", testRunStats.totals.assertions.failedButOk );
|
.writeAttribute( "expectedFailures", testRunStats.totals.assertions.failedButOk );
|
||||||
|
m_xml.scopedElement( "OverallResultsCases")
|
||||||
|
.writeAttribute( "successes", testRunStats.totals.testCases.passed )
|
||||||
|
.writeAttribute( "failures", testRunStats.totals.testCases.failed )
|
||||||
|
.writeAttribute( "expectedFailures", testRunStats.totals.testCases.failedButOk );
|
||||||
m_xml.endElement();
|
m_xml.endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -30,6 +30,15 @@ CmdLine.tests.cpp:<line number>: passed: spec.matches(fakeTestCase(R"(spec {a} c
|
|||||||
CmdLine.tests.cpp:<line number>: passed: spec.matches(fakeTestCase(R"(spec [a] char)")) for: true
|
CmdLine.tests.cpp:<line number>: passed: spec.matches(fakeTestCase(R"(spec [a] char)")) for: true
|
||||||
CmdLine.tests.cpp:<line number>: passed: !(spec.matches(fakeTestCase("differs but has similar tag", "[a]"))) for: !false
|
CmdLine.tests.cpp:<line number>: passed: !(spec.matches(fakeTestCase("differs but has similar tag", "[a]"))) for: !false
|
||||||
CmdLine.tests.cpp:<line number>: passed: spec.matches(fakeTestCase(R"(spec \ char)")) for: true
|
CmdLine.tests.cpp:<line number>: passed: spec.matches(fakeTestCase(R"(spec \ char)")) for: true
|
||||||
|
Generators.tests.cpp:<line number>: passed: counter < 7 for: 3 < 7
|
||||||
|
Generators.tests.cpp:<line number>: passed: counter < 7 for: 6 < 7
|
||||||
|
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
|
||||||
|
Misc.tests.cpp:<line number>: passed:
|
||||||
|
Misc.tests.cpp:<line number>: passed:
|
||||||
|
Misc.tests.cpp:<line number>: passed:
|
||||||
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'answer := 42' with 1 message: 'expected exception'
|
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'answer := 42' with 1 message: 'expected exception'
|
||||||
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'answer := 42'; expression was: thisThrows() with 1 message: 'expected exception'
|
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'answer := 42'; expression was: thisThrows() with 1 message: 'expected exception'
|
||||||
Exception.tests.cpp:<line number>: passed: thisThrows() with 1 message: 'answer := 42'
|
Exception.tests.cpp:<line number>: passed: thisThrows() with 1 message: 'answer := 42'
|
||||||
@@ -326,6 +335,12 @@ Condition.tests.cpp:<line number>: passed: 6 == uc for: 6 == 6
|
|||||||
Condition.tests.cpp:<line number>: passed: (std::numeric_limits<uint32_t>::max)() > ul for: 4294967295 (0x<hex digits>) > 4
|
Condition.tests.cpp:<line number>: passed: (std::numeric_limits<uint32_t>::max)() > ul for: 4294967295 (0x<hex digits>) > 4
|
||||||
Matchers.tests.cpp:<line number>: passed: testStringForMatching2(), !composed1 for: "some completely different text that contains one common word" not ( contains: "string" or contains: "random" )
|
Matchers.tests.cpp:<line number>: passed: testStringForMatching2(), !composed1 for: "some completely different text that contains one common word" not ( contains: "string" or contains: "random" )
|
||||||
Matchers.tests.cpp:<line number>: passed: testStringForMatching2(), composed2 for: "some completely different text that contains one common word" ( contains: "string" or contains: "random" or contains: "different" )
|
Matchers.tests.cpp:<line number>: passed: testStringForMatching2(), composed2 for: "some completely different text that contains one common word" ( contains: "string" or contains: "random" or contains: "different" )
|
||||||
|
Matchers.tests.cpp:<line number>: passed: 1, !(first && second) for: 1 not ( CheckedTestingMatcher set to fail and CheckedTestingMatcher set to fail )
|
||||||
|
Matchers.tests.cpp:<line number>: passed: first.matchCalled for: true
|
||||||
|
Matchers.tests.cpp:<line number>: passed: !second.matchCalled for: true
|
||||||
|
Matchers.tests.cpp:<line number>: passed: 1, first || second for: 1 ( CheckedTestingMatcher set to succeed or CheckedTestingMatcher set to fail )
|
||||||
|
Matchers.tests.cpp:<line number>: passed: first.matchCalled for: true
|
||||||
|
Matchers.tests.cpp:<line number>: passed: !second.matchCalled for: true
|
||||||
Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Contains("not there", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" contains: "not there" (case insensitive)
|
Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Contains("not there", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" contains: "not there" (case insensitive)
|
||||||
Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Contains("STRING") for: "this string contains 'abc' as a substring" contains: "STRING"
|
Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Contains("STRING") for: "this string contains 'abc' as a substring" contains: "STRING"
|
||||||
Generators.tests.cpp:<line number>: passed: elem % 2 == 1 for: 1 == 1
|
Generators.tests.cpp:<line number>: passed: elem % 2 == 1 for: 1 == 1
|
||||||
|
@@ -1380,6 +1380,6 @@ due to unexpected exception with message:
|
|||||||
Why would you throw a std::string?
|
Why would you throw a std::string?
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
test cases: 310 | 236 passed | 70 failed | 4 failed as expected
|
test cases: 316 | 242 passed | 70 failed | 4 failed as expected
|
||||||
assertions: 1701 | 1549 passed | 131 failed | 21 failed as expected
|
assertions: 1716 | 1564 passed | 131 failed | 21 failed as expected
|
||||||
|
|
||||||
|
@@ -243,6 +243,96 @@ CmdLine.tests.cpp:<line number>: PASSED:
|
|||||||
with expansion:
|
with expansion:
|
||||||
true
|
true
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
#1913 - GENERATE inside a for loop should not keep recreating the generator
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Generators.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Generators.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE( counter < 7 )
|
||||||
|
with expansion:
|
||||||
|
3 < 7
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
#1913 - GENERATE inside a for loop should not keep recreating the generator
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Generators.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Generators.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE( counter < 7 )
|
||||||
|
with expansion:
|
||||||
|
6 < 7
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
#1913 - GENERATEs can share a line
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Generators.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Generators.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE( i != j )
|
||||||
|
with expansion:
|
||||||
|
1 != 3
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
#1913 - GENERATEs can share a line
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Generators.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Generators.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE( i != j )
|
||||||
|
with expansion:
|
||||||
|
1 != 4
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
#1913 - GENERATEs can share a line
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Generators.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Generators.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE( i != j )
|
||||||
|
with expansion:
|
||||||
|
2 != 3
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
#1913 - GENERATEs can share a line
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Generators.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Generators.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE( i != j )
|
||||||
|
with expansion:
|
||||||
|
2 != 4
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
#1954 - 7 arg template test case sig compiles - 1, 1, 1, 1, 1, 0, 0
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Misc.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Misc.tests.cpp:<line number>: PASSED:
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
#1954 - 7 arg template test case sig compiles - 5, 1, 1, 1, 1, 0, 0
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Misc.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Misc.tests.cpp:<line number>: PASSED:
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
#1954 - 7 arg template test case sig compiles - 5, 3, 1, 1, 1, 0, 0
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Misc.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Misc.tests.cpp:<line number>: PASSED:
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
#748 - captures with unexpected exceptions
|
#748 - captures with unexpected exceptions
|
||||||
outside assertions
|
outside assertions
|
||||||
@@ -2494,6 +2584,52 @@ with expansion:
|
|||||||
"some completely different text that contains one common word" ( contains:
|
"some completely different text that contains one common word" ( contains:
|
||||||
"string" or contains: "random" or contains: "different" )
|
"string" or contains: "random" or contains: "different" )
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Composed matchers shortcircuit
|
||||||
|
&&
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Matchers.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Matchers.tests.cpp:<line number>: PASSED:
|
||||||
|
CHECK_THAT( 1, !(first && second) )
|
||||||
|
with expansion:
|
||||||
|
1 not ( CheckedTestingMatcher set to fail and CheckedTestingMatcher set to
|
||||||
|
fail )
|
||||||
|
|
||||||
|
Matchers.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE( first.matchCalled )
|
||||||
|
with expansion:
|
||||||
|
true
|
||||||
|
|
||||||
|
Matchers.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE( !second.matchCalled )
|
||||||
|
with expansion:
|
||||||
|
true
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Composed matchers shortcircuit
|
||||||
|
||
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Matchers.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Matchers.tests.cpp:<line number>: PASSED:
|
||||||
|
CHECK_THAT( 1, first || second )
|
||||||
|
with expansion:
|
||||||
|
1 ( CheckedTestingMatcher set to succeed or CheckedTestingMatcher set to fail
|
||||||
|
)
|
||||||
|
|
||||||
|
Matchers.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE( first.matchCalled )
|
||||||
|
with expansion:
|
||||||
|
true
|
||||||
|
|
||||||
|
Matchers.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE( !second.matchCalled )
|
||||||
|
with expansion:
|
||||||
|
true
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Contains string matcher
|
Contains string matcher
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@@ -13573,6 +13709,6 @@ Misc.tests.cpp:<line number>
|
|||||||
Misc.tests.cpp:<line number>: PASSED:
|
Misc.tests.cpp:<line number>: PASSED:
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
test cases: 310 | 220 passed | 86 failed | 4 failed as expected
|
test cases: 316 | 226 passed | 86 failed | 4 failed as expected
|
||||||
assertions: 1718 | 1549 passed | 148 failed | 21 failed as expected
|
assertions: 1733 | 1564 passed | 148 failed | 21 failed as expected
|
||||||
|
|
||||||
|
@@ -243,6 +243,96 @@ CmdLine.tests.cpp:<line number>: PASSED:
|
|||||||
with expansion:
|
with expansion:
|
||||||
true
|
true
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
#1913 - GENERATE inside a for loop should not keep recreating the generator
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Generators.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Generators.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE( counter < 7 )
|
||||||
|
with expansion:
|
||||||
|
3 < 7
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
#1913 - GENERATE inside a for loop should not keep recreating the generator
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Generators.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Generators.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE( counter < 7 )
|
||||||
|
with expansion:
|
||||||
|
6 < 7
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
#1913 - GENERATEs can share a line
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Generators.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Generators.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE( i != j )
|
||||||
|
with expansion:
|
||||||
|
1 != 3
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
#1913 - GENERATEs can share a line
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Generators.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Generators.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE( i != j )
|
||||||
|
with expansion:
|
||||||
|
1 != 4
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
#1913 - GENERATEs can share a line
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Generators.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Generators.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE( i != j )
|
||||||
|
with expansion:
|
||||||
|
2 != 3
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
#1913 - GENERATEs can share a line
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Generators.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Generators.tests.cpp:<line number>: PASSED:
|
||||||
|
REQUIRE( i != j )
|
||||||
|
with expansion:
|
||||||
|
2 != 4
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
#1954 - 7 arg template test case sig compiles - 1, 1, 1, 1, 1, 0, 0
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Misc.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Misc.tests.cpp:<line number>: PASSED:
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
#1954 - 7 arg template test case sig compiles - 5, 1, 1, 1, 1, 0, 0
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Misc.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Misc.tests.cpp:<line number>: PASSED:
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
#1954 - 7 arg template test case sig compiles - 5, 3, 1, 1, 1, 0, 0
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Misc.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Misc.tests.cpp:<line number>: PASSED:
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
#748 - captures with unexpected exceptions
|
#748 - captures with unexpected exceptions
|
||||||
outside assertions
|
outside assertions
|
||||||
@@ -423,6 +513,6 @@ Condition.tests.cpp:<line number>: FAILED:
|
|||||||
CHECK( true != true )
|
CHECK( true != true )
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
test cases: 21 | 16 passed | 3 failed | 2 failed as expected
|
test cases: 26 | 21 passed | 3 failed | 2 failed as expected
|
||||||
assertions: 49 | 42 passed | 4 failed | 3 failed as expected
|
assertions: 58 | 51 passed | 4 failed | 3 failed as expected
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<testsuitesloose text artifact
|
<testsuitesloose text artifact
|
||||||
>
|
>
|
||||||
<testsuite name="<exe-name>" errors="17" failures="132" tests="1719" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
<testsuite name="<exe-name>" errors="17" failures="132" tests="1734" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="filters" value="~[!nonportable]~[!benchmark]~[approvals]"/>
|
<property name="filters" value="~[!nonportable]~[!benchmark]~[approvals]"/>
|
||||||
<property name="random-seed" value="1"/>
|
<property name="random-seed" value="1"/>
|
||||||
@@ -33,6 +33,11 @@ Nor would this
|
|||||||
<testcase classname="<exe-name>.global" name="#1905 -- test spec parser properly clears internal state between compound tests" time="{duration}" status="run"/>
|
<testcase classname="<exe-name>.global" name="#1905 -- test spec parser properly clears internal state between compound tests" time="{duration}" status="run"/>
|
||||||
<testcase classname="<exe-name>.global" name="#1912 -- test spec parser handles escaping/Various parentheses" time="{duration}" status="run"/>
|
<testcase classname="<exe-name>.global" name="#1912 -- test spec parser handles escaping/Various parentheses" time="{duration}" status="run"/>
|
||||||
<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="#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="#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"/>
|
||||||
<testcase classname="<exe-name>.global" name="#748 - captures with unexpected exceptions/outside assertions" time="{duration}" status="run">
|
<testcase classname="<exe-name>.global" name="#748 - captures with unexpected exceptions/outside assertions" time="{duration}" status="run">
|
||||||
<error type="TEST_CASE">
|
<error type="TEST_CASE">
|
||||||
FAILED:
|
FAILED:
|
||||||
@@ -361,6 +366,8 @@ Exception.tests.cpp:<line number>
|
|||||||
<testcase classname="<exe-name>.global" name="Comparisons between unsigned ints and negative signed ints match c++ standard behaviour" time="{duration}" status="run"/>
|
<testcase classname="<exe-name>.global" name="Comparisons between unsigned ints and negative signed ints match c++ standard behaviour" time="{duration}" status="run"/>
|
||||||
<testcase classname="<exe-name>.global" name="Comparisons with int literals don't warn when mixing signed/ unsigned" time="{duration}" status="run"/>
|
<testcase classname="<exe-name>.global" name="Comparisons with int literals don't warn when mixing signed/ unsigned" time="{duration}" status="run"/>
|
||||||
<testcase classname="<exe-name>.global" name="Composed matchers are distinct" time="{duration}" status="run"/>
|
<testcase classname="<exe-name>.global" name="Composed matchers are distinct" time="{duration}" status="run"/>
|
||||||
|
<testcase classname="<exe-name>.global" name="Composed matchers shortcircuit/&&" time="{duration}" status="run"/>
|
||||||
|
<testcase classname="<exe-name>.global" name="Composed matchers shortcircuit/||" time="{duration}" status="run"/>
|
||||||
<testcase classname="<exe-name>.global" name="Contains string matcher" time="{duration}" status="run">
|
<testcase classname="<exe-name>.global" name="Contains string matcher" time="{duration}" status="run">
|
||||||
<failure message="testStringForMatching(), Contains("not there", Catch::CaseSensitive::No)" type="CHECK_THAT">
|
<failure message="testStringForMatching(), Contains("not there", Catch::CaseSensitive::No)" type="CHECK_THAT">
|
||||||
FAILED:
|
FAILED:
|
||||||
|
@@ -875,6 +875,8 @@ Exception.tests.cpp:<line number>
|
|||||||
</testCase>
|
</testCase>
|
||||||
</file>
|
</file>
|
||||||
<file path="projects/<exe-name>/UsageTests/Generators.tests.cpp">
|
<file path="projects/<exe-name>/UsageTests/Generators.tests.cpp">
|
||||||
|
<testCase name="#1913 - GENERATE inside a for loop should not keep recreating the generator" duration="{duration}"/>
|
||||||
|
<testCase name="#1913 - GENERATEs can share a line" duration="{duration}"/>
|
||||||
<testCase name="3x3x3 ints" duration="{duration}"/>
|
<testCase name="3x3x3 ints" duration="{duration}"/>
|
||||||
<testCase name="Copy and then generate a range/from var and iterators" duration="{duration}"/>
|
<testCase name="Copy and then generate a range/from var and iterators" duration="{duration}"/>
|
||||||
<testCase name="Copy and then generate a range/From a temporary container" duration="{duration}"/>
|
<testCase name="Copy and then generate a range/From a temporary container" duration="{duration}"/>
|
||||||
@@ -900,6 +902,8 @@ Exception.tests.cpp:<line number>
|
|||||||
<testCase name="Arbitrary predicate matcher/Function pointer" duration="{duration}"/>
|
<testCase name="Arbitrary predicate matcher/Function pointer" duration="{duration}"/>
|
||||||
<testCase name="Arbitrary predicate matcher/Lambdas + different type" duration="{duration}"/>
|
<testCase name="Arbitrary predicate matcher/Lambdas + different type" duration="{duration}"/>
|
||||||
<testCase name="Composed matchers are distinct" duration="{duration}"/>
|
<testCase name="Composed matchers are distinct" duration="{duration}"/>
|
||||||
|
<testCase name="Composed matchers shortcircuit/&&" duration="{duration}"/>
|
||||||
|
<testCase name="Composed matchers shortcircuit/||" duration="{duration}"/>
|
||||||
<testCase name="Contains string matcher" duration="{duration}">
|
<testCase name="Contains string matcher" duration="{duration}">
|
||||||
<failure message="CHECK_THAT(testStringForMatching(), Contains("not there", Catch::CaseSensitive::No))">
|
<failure message="CHECK_THAT(testStringForMatching(), Contains("not there", Catch::CaseSensitive::No))">
|
||||||
FAILED:
|
FAILED:
|
||||||
@@ -1350,6 +1354,9 @@ Message.tests.cpp:<line number>
|
|||||||
<file path="projects/<exe-name>/UsageTests/Misc.tests.cpp">
|
<file path="projects/<exe-name>/UsageTests/Misc.tests.cpp">
|
||||||
<testCase name="# A test name that starts with a #" duration="{duration}"/>
|
<testCase name="# A test name that starts with a #" duration="{duration}"/>
|
||||||
<testCase name="#1175 - Hidden Test" duration="{duration}"/>
|
<testCase name="#1175 - Hidden Test" duration="{duration}"/>
|
||||||
|
<testCase name="#1954 - 7 arg template test case sig compiles - 1, 1, 1, 1, 1, 0, 0" duration="{duration}"/>
|
||||||
|
<testCase name="#1954 - 7 arg template test case sig compiles - 5, 1, 1, 1, 1, 0, 0" duration="{duration}"/>
|
||||||
|
<testCase name="#1954 - 7 arg template test case sig compiles - 5, 3, 1, 1, 1, 0, 0" duration="{duration}"/>
|
||||||
<testCase name="#835 -- errno should not be touched by Catch" duration="{duration}">
|
<testCase name="#835 -- errno should not be touched by Catch" duration="{duration}">
|
||||||
<skipped message="CHECK(f() == 0)">
|
<skipped message="CHECK(f() == 0)">
|
||||||
FAILED:
|
FAILED:
|
||||||
|
@@ -264,6 +264,69 @@ Nor would this
|
|||||||
</Section>
|
</Section>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
|
<TestCase name="#1913 - GENERATE inside a for loop should not keep recreating the generator" tags="[generators][regression]" filename="projects/<exe-name>/UsageTests/Generators.tests.cpp" >
|
||||||
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Generators.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
counter < 7
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
3 < 7
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Generators.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
counter < 7
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
6 < 7
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<OverallResult success="true"/>
|
||||||
|
</TestCase>
|
||||||
|
<TestCase name="#1913 - GENERATEs can share a line" tags="[generators][regression]" filename="projects/<exe-name>/UsageTests/Generators.tests.cpp" >
|
||||||
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Generators.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
i != j
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
1 != 3
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Generators.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
i != j
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
1 != 4
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Generators.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
i != j
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
2 != 3
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Generators.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
i != j
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
2 != 4
|
||||||
|
</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>
|
||||||
|
<TestCase name="#1954 - 7 arg template test case sig compiles - 5, 1, 1, 1, 1, 0, 0" tags="[!hide][.][compilation][regression]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
|
<OverallResult success="true"/>
|
||||||
|
</TestCase>
|
||||||
|
<TestCase name="#1954 - 7 arg template test case sig compiles - 5, 3, 1, 1, 1, 0, 0" tags="[!hide][.][compilation][regression]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
|
<OverallResult success="true"/>
|
||||||
|
</TestCase>
|
||||||
<TestCase name="#748 - captures with unexpected exceptions" tags="[!hide][!shouldfail][!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
|
<TestCase name="#748 - captures with unexpected exceptions" tags="[!hide][!shouldfail][!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
|
||||||
<Section name="outside assertions" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
|
<Section name="outside assertions" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
|
||||||
<Info>
|
<Info>
|
||||||
@@ -2962,6 +3025,63 @@ Nor would this
|
|||||||
</Expression>
|
</Expression>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
|
<TestCase name="Composed matchers shortcircuit" tags="[composed][matchers]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
||||||
|
<Section name="&&" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
||||||
|
<Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
1, !(first && second)
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
1 not ( CheckedTestingMatcher set to fail and CheckedTestingMatcher set to fail )
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
first.matchCalled
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
true
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
!second.matchCalled
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
true
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<OverallResults successes="3" failures="0" expectedFailures="0"/>
|
||||||
|
</Section>
|
||||||
|
<Section name="||" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
||||||
|
<Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
1, first || second
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
1 ( CheckedTestingMatcher set to succeed or CheckedTestingMatcher set to fail )
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
first.matchCalled
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
true
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
!second.matchCalled
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
true
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<OverallResults successes="3" failures="0" expectedFailures="0"/>
|
||||||
|
</Section>
|
||||||
|
<OverallResult success="true"/>
|
||||||
|
</TestCase>
|
||||||
<TestCase name="Contains string matcher" tags="[!hide][.][failing][matchers]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
<TestCase name="Contains string matcher" tags="[!hide][.][failing][matchers]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
||||||
<Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
<Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
@@ -16255,7 +16375,9 @@ loose text artifact
|
|||||||
</Section>
|
</Section>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<OverallResults successes="1549" failures="149" expectedFailures="21"/>
|
<OverallResults successes="1564" failures="149" expectedFailures="21"/>
|
||||||
|
<OverallResultsCases successes="226" failures="86" expectedFailures="4"/>
|
||||||
</Group>
|
</Group>
|
||||||
<OverallResults successes="1549" failures="148" expectedFailures="21"/>
|
<OverallResults successes="1564" failures="148" expectedFailures="21"/>
|
||||||
|
<OverallResultsCases successes="226" failures="86" expectedFailures="4"/>
|
||||||
</Catch>
|
</Catch>
|
||||||
|
@@ -251,6 +251,22 @@ TEST_CASE("Copy and then generate a range", "[generators]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("#1913 - GENERATE inside a for loop should not keep recreating the generator", "[regression][generators]") {
|
||||||
|
static int counter = 0;
|
||||||
|
for (int i = 0; i < 3; ++i) {
|
||||||
|
int _ = GENERATE(1, 2);
|
||||||
|
(void)_;
|
||||||
|
++counter;
|
||||||
|
}
|
||||||
|
// There should be at most 6 (3 * 2) counter increments
|
||||||
|
REQUIRE(counter < 7);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("#1913 - GENERATEs can share a line", "[regression][generators]") {
|
||||||
|
int i = GENERATE(1, 2); int j = GENERATE(3, 4);
|
||||||
|
REQUIRE(i != j);
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(__clang__)
|
#if defined(__clang__)
|
||||||
#pragma clang diagnostic pop
|
#pragma clang diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
@@ -628,6 +628,45 @@ namespace { namespace MatchersTests {
|
|||||||
REQUIRE_THAT(testStringForMatching2(), composed2);
|
REQUIRE_THAT(testStringForMatching2(), composed2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct CheckedTestingMatcher : Catch::MatcherBase<int> {
|
||||||
|
mutable bool matchCalled = false;
|
||||||
|
bool matchSucceeds = false;
|
||||||
|
|
||||||
|
bool match(int const&) const override {
|
||||||
|
matchCalled = true;
|
||||||
|
return matchSucceeds;
|
||||||
|
}
|
||||||
|
std::string describe() const override {
|
||||||
|
return "CheckedTestingMatcher set to " + (matchSucceeds ? std::string("succeed") : std::string("fail"));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_CASE("Composed matchers shortcircuit", "[matchers][composed]") {
|
||||||
|
// Check that if first returns false, second is not touched
|
||||||
|
CheckedTestingMatcher first, second;
|
||||||
|
SECTION("&&") {
|
||||||
|
first.matchSucceeds = false;
|
||||||
|
// This assertion doesn't actually test anything, we just
|
||||||
|
// want the composed matcher's `match` being called.
|
||||||
|
CHECK_THAT(1, !(first && second));
|
||||||
|
|
||||||
|
// These two assertions are the important ones
|
||||||
|
REQUIRE(first.matchCalled);
|
||||||
|
REQUIRE(!second.matchCalled);
|
||||||
|
}
|
||||||
|
// Check that if first returns true, second is not touched
|
||||||
|
SECTION("||") {
|
||||||
|
first.matchSucceeds = true;
|
||||||
|
// This assertion doesn't actually test anything, we just
|
||||||
|
// want the composed matcher's `match` being called.
|
||||||
|
CHECK_THAT(1, first || second);
|
||||||
|
|
||||||
|
// These two assertions are the important ones
|
||||||
|
REQUIRE(first.matchCalled);
|
||||||
|
REQUIRE(!second.matchCalled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} } // namespace MatchersTests
|
} } // namespace MatchersTests
|
||||||
|
|
||||||
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
||||||
|
@@ -484,4 +484,10 @@ TEST_CASE( "#1175 - Hidden Test", "[.]" ) {
|
|||||||
SUCCEED();
|
SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEMPLATE_TEST_CASE_SIG("#1954 - 7 arg template test case sig compiles", "[regression][.compilation]",
|
||||||
|
((int Tnx, int Tnu, int Tny, int Tph, int Tch, int Tineq, int Teq), Tnx, Tnu, Tny, Tph, Tch, Tineq, Teq),
|
||||||
|
(1, 1, 1, 1, 1, 0, 0), (5, 1, 1, 1, 1, 0, 0), (5, 3, 1, 1, 1, 0, 0)) {
|
||||||
|
SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
}} // namespace MiscTests
|
}} // namespace MiscTests
|
||||||
|
0
scripts/updateDocumentToC.py
Normal file → Executable file
0
scripts/updateDocumentToC.py
Normal file → Executable file
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Catch v2.12.2
|
* Catch v2.12.4
|
||||||
* Generated: 2020-05-25 15:09:23.791719
|
* Generated: 2020-07-05 11:47:18.451282
|
||||||
* ----------------------------------------------------------
|
* ----------------------------------------------------------
|
||||||
* This file has been merged from multiple headers. Please don't edit it directly
|
* This file has been merged from multiple headers. Please don't edit it directly
|
||||||
* Copyright (c) 2020 Two Blue Cubes Ltd. All rights reserved.
|
* Copyright (c) 2020 Two Blue Cubes Ltd. All rights reserved.
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#define CATCH_VERSION_MAJOR 2
|
#define CATCH_VERSION_MAJOR 2
|
||||||
#define CATCH_VERSION_MINOR 12
|
#define CATCH_VERSION_MINOR 12
|
||||||
#define CATCH_VERSION_PATCH 2
|
#define CATCH_VERSION_PATCH 4
|
||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
# pragma clang system_header
|
# pragma clang system_header
|
||||||
@@ -775,7 +775,7 @@ constexpr auto operator "" _catch_sr( char const* rawChars, std::size_t size ) n
|
|||||||
#define INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_0, _1, _2, _3) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_1, _2, _3)
|
#define INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_0, _1, _2, _3) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_1, _2, _3)
|
||||||
#define INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_0, _1, _2, _3, _4) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_1, _2, _3, _4)
|
#define INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_0, _1, _2, _3, _4) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_1, _2, _3, _4)
|
||||||
#define INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_0, _1, _2, _3, _4, _5) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_1, _2, _3, _4, _5)
|
#define INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_0, _1, _2, _3, _4, _5) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_1, _2, _3, _4, _5)
|
||||||
#define INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_0, _1, _2, _3, _4, _5, _6) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_1, _2, _4, _5, _6)
|
#define INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_0, _1, _2, _3, _4, _5, _6) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_1, _2, _3, _4, _5, _6)
|
||||||
#define INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_0, _1, _2, _3, _4, _5, _6, _7) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_1, _2, _3, _4, _5, _6, _7)
|
#define INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_0, _1, _2, _3, _4, _5, _6, _7) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_1, _2, _3, _4, _5, _6, _7)
|
||||||
#define INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_1, _2, _3, _4, _5, _6, _7, _8)
|
#define INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_1, _2, _3, _4, _5, _6, _7, _8)
|
||||||
#define INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9)
|
#define INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9)
|
||||||
@@ -2468,7 +2468,7 @@ namespace Catch {
|
|||||||
virtual void sectionEnded( SectionEndInfo const& endInfo ) = 0;
|
virtual void sectionEnded( SectionEndInfo const& endInfo ) = 0;
|
||||||
virtual void sectionEndedEarly( SectionEndInfo const& endInfo ) = 0;
|
virtual void sectionEndedEarly( SectionEndInfo const& endInfo ) = 0;
|
||||||
|
|
||||||
virtual auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& = 0;
|
virtual auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& = 0;
|
||||||
|
|
||||||
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
|
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
|
||||||
virtual void benchmarkPreparing( std::string const& name ) = 0;
|
virtual void benchmarkPreparing( std::string const& name ) = 0;
|
||||||
@@ -4080,16 +4080,16 @@ namespace Generators {
|
|||||||
return makeGenerators( value( T( std::forward<U>( val ) ) ), std::forward<Gs>( moreGenerators )... );
|
return makeGenerators( value( T( std::forward<U>( val ) ) ), std::forward<Gs>( moreGenerators )... );
|
||||||
}
|
}
|
||||||
|
|
||||||
auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker&;
|
auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker&;
|
||||||
|
|
||||||
template<typename L>
|
template<typename L>
|
||||||
// Note: The type after -> is weird, because VS2015 cannot parse
|
// Note: The type after -> is weird, because VS2015 cannot parse
|
||||||
// the expression used in the typedef inside, when it is in
|
// the expression used in the typedef inside, when it is in
|
||||||
// return type. Yeah.
|
// return type. Yeah.
|
||||||
auto generate( SourceLineInfo const& lineInfo, L const& generatorExpression ) -> decltype(std::declval<decltype(generatorExpression())>().get()) {
|
auto generate( StringRef generatorName, SourceLineInfo const& lineInfo, L const& generatorExpression ) -> decltype(std::declval<decltype(generatorExpression())>().get()) {
|
||||||
using UnderlyingType = typename decltype(generatorExpression())::type;
|
using UnderlyingType = typename decltype(generatorExpression())::type;
|
||||||
|
|
||||||
IGeneratorTracker& tracker = acquireGeneratorTracker( lineInfo );
|
IGeneratorTracker& tracker = acquireGeneratorTracker( generatorName, lineInfo );
|
||||||
if (!tracker.hasGenerator()) {
|
if (!tracker.hasGenerator()) {
|
||||||
tracker.setGenerator(pf::make_unique<Generators<UnderlyingType>>(generatorExpression()));
|
tracker.setGenerator(pf::make_unique<Generators<UnderlyingType>>(generatorExpression()));
|
||||||
}
|
}
|
||||||
@@ -4102,11 +4102,17 @@ namespace Generators {
|
|||||||
} // namespace Catch
|
} // namespace Catch
|
||||||
|
|
||||||
#define GENERATE( ... ) \
|
#define GENERATE( ... ) \
|
||||||
Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [ ]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace)
|
Catch::Generators::generate( INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \
|
||||||
|
CATCH_INTERNAL_LINEINFO, \
|
||||||
|
[ ]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace)
|
||||||
#define GENERATE_COPY( ... ) \
|
#define GENERATE_COPY( ... ) \
|
||||||
Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [=]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace)
|
Catch::Generators::generate( INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \
|
||||||
|
CATCH_INTERNAL_LINEINFO, \
|
||||||
|
[=]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace)
|
||||||
#define GENERATE_REF( ... ) \
|
#define GENERATE_REF( ... ) \
|
||||||
Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [&]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace)
|
Catch::Generators::generate( INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \
|
||||||
|
CATCH_INTERNAL_LINEINFO, \
|
||||||
|
[&]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace)
|
||||||
|
|
||||||
// end catch_generators.hpp
|
// end catch_generators.hpp
|
||||||
// start catch_generators_generic.hpp
|
// start catch_generators_generic.hpp
|
||||||
@@ -7463,17 +7469,30 @@ namespace TestCaseTracking {
|
|||||||
SourceLineInfo location;
|
SourceLineInfo location;
|
||||||
|
|
||||||
NameAndLocation( std::string const& _name, SourceLineInfo const& _location );
|
NameAndLocation( std::string const& _name, SourceLineInfo const& _location );
|
||||||
|
friend bool operator==(NameAndLocation const& lhs, NameAndLocation const& rhs) {
|
||||||
|
return lhs.name == rhs.name
|
||||||
|
&& lhs.location == rhs.location;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ITracker;
|
class ITracker;
|
||||||
|
|
||||||
using ITrackerPtr = std::shared_ptr<ITracker>;
|
using ITrackerPtr = std::shared_ptr<ITracker>;
|
||||||
|
|
||||||
struct ITracker {
|
class ITracker {
|
||||||
virtual ~ITracker();
|
NameAndLocation m_nameAndLocation;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ITracker(NameAndLocation const& nameAndLoc) :
|
||||||
|
m_nameAndLocation(nameAndLoc)
|
||||||
|
{}
|
||||||
|
|
||||||
// static queries
|
// static queries
|
||||||
virtual NameAndLocation const& nameAndLocation() const = 0;
|
NameAndLocation const& nameAndLocation() const {
|
||||||
|
return m_nameAndLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ~ITracker();
|
||||||
|
|
||||||
// dynamic queries
|
// dynamic queries
|
||||||
virtual bool isComplete() const = 0; // Successfully completed or failed
|
virtual bool isComplete() const = 0; // Successfully completed or failed
|
||||||
@@ -7534,7 +7553,6 @@ namespace TestCaseTracking {
|
|||||||
};
|
};
|
||||||
|
|
||||||
using Children = std::vector<ITrackerPtr>;
|
using Children = std::vector<ITrackerPtr>;
|
||||||
NameAndLocation m_nameAndLocation;
|
|
||||||
TrackerContext& m_ctx;
|
TrackerContext& m_ctx;
|
||||||
ITracker* m_parent;
|
ITracker* m_parent;
|
||||||
Children m_children;
|
Children m_children;
|
||||||
@@ -7543,7 +7561,6 @@ namespace TestCaseTracking {
|
|||||||
public:
|
public:
|
||||||
TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent );
|
TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent );
|
||||||
|
|
||||||
NameAndLocation const& nameAndLocation() const override;
|
|
||||||
bool isComplete() const override;
|
bool isComplete() const override;
|
||||||
bool isSuccessfullyCompleted() const override;
|
bool isSuccessfullyCompleted() const override;
|
||||||
bool isOpen() const override;
|
bool isOpen() const override;
|
||||||
@@ -7910,7 +7927,11 @@ namespace Catch {
|
|||||||
|
|
||||||
#ifdef CATCH_PLATFORM_MAC
|
#ifdef CATCH_PLATFORM_MAC
|
||||||
|
|
||||||
|
#if defined(__i386__) || defined(__x86_64__)
|
||||||
#define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */
|
#define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */
|
||||||
|
#elif defined(__aarch64__)
|
||||||
|
#define CATCH_TRAP() __asm__(".inst 0xd4200000")
|
||||||
|
#endif
|
||||||
|
|
||||||
#elif defined(CATCH_PLATFORM_IPHONE)
|
#elif defined(CATCH_PLATFORM_IPHONE)
|
||||||
|
|
||||||
@@ -8095,7 +8116,7 @@ namespace Catch {
|
|||||||
void sectionEnded( SectionEndInfo const& endInfo ) override;
|
void sectionEnded( SectionEndInfo const& endInfo ) override;
|
||||||
void sectionEndedEarly( SectionEndInfo const& endInfo ) override;
|
void sectionEndedEarly( SectionEndInfo const& endInfo ) override;
|
||||||
|
|
||||||
auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& override;
|
auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& override;
|
||||||
|
|
||||||
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
|
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
|
||||||
void benchmarkPreparing( std::string const& name ) override;
|
void benchmarkPreparing( std::string const& name ) override;
|
||||||
@@ -9071,7 +9092,7 @@ namespace detail {
|
|||||||
}
|
}
|
||||||
inline auto convertInto( std::string const &source, bool &target ) -> ParserResult {
|
inline auto convertInto( std::string const &source, bool &target ) -> ParserResult {
|
||||||
std::string srcLC = source;
|
std::string srcLC = source;
|
||||||
std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( char c ) { return static_cast<char>( std::tolower(c) ); } );
|
std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( unsigned char c ) { return static_cast<char>( std::tolower(c) ); } );
|
||||||
if (srcLC == "y" || srcLC == "1" || srcLC == "true" || srcLC == "yes" || srcLC == "on")
|
if (srcLC == "y" || srcLC == "1" || srcLC == "true" || srcLC == "yes" || srcLC == "on")
|
||||||
target = true;
|
target = true;
|
||||||
else if (srcLC == "n" || srcLC == "0" || srcLC == "false" || srcLC == "no" || srcLC == "off")
|
else if (srcLC == "n" || srcLC == "0" || srcLC == "false" || srcLC == "no" || srcLC == "off")
|
||||||
@@ -10883,8 +10904,8 @@ namespace Generators {
|
|||||||
|
|
||||||
GeneratorUntypedBase::~GeneratorUntypedBase() {}
|
GeneratorUntypedBase::~GeneratorUntypedBase() {}
|
||||||
|
|
||||||
auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& {
|
auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& {
|
||||||
return getResultCapture().acquireGeneratorTracker( lineInfo );
|
return getResultCapture().acquireGeneratorTracker( generatorName, lineInfo );
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Generators
|
} // namespace Generators
|
||||||
@@ -12304,11 +12325,13 @@ namespace Catch {
|
|||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
class StartupExceptionRegistry {
|
class StartupExceptionRegistry {
|
||||||
|
#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
|
||||||
public:
|
public:
|
||||||
void add(std::exception_ptr const& exception) noexcept;
|
void add(std::exception_ptr const& exception) noexcept;
|
||||||
std::vector<std::exception_ptr> const& getExceptions() const noexcept;
|
std::vector<std::exception_ptr> const& getExceptions() const noexcept;
|
||||||
private:
|
private:
|
||||||
std::vector<std::exception_ptr> m_exceptions;
|
std::vector<std::exception_ptr> m_exceptions;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace Catch
|
} // end namespace Catch
|
||||||
@@ -12391,7 +12414,11 @@ namespace Catch {
|
|||||||
m_tagAliasRegistry.add( alias, tag, lineInfo );
|
m_tagAliasRegistry.add( alias, tag, lineInfo );
|
||||||
}
|
}
|
||||||
void registerStartupException() noexcept override {
|
void registerStartupException() noexcept override {
|
||||||
|
#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
|
||||||
m_exceptionRegistry.add(std::current_exception());
|
m_exceptionRegistry.add(std::current_exception());
|
||||||
|
#else
|
||||||
|
CATCH_INTERNAL_ERROR("Attempted to register active exception under CATCH_CONFIG_DISABLE_EXCEPTIONS!");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
IMutableEnumValuesRegistry& getMutableEnumValuesRegistry() override {
|
IMutableEnumValuesRegistry& getMutableEnumValuesRegistry() override {
|
||||||
return m_enumValuesRegistry;
|
return m_enumValuesRegistry;
|
||||||
@@ -12495,12 +12522,27 @@ namespace Catch {
|
|||||||
std::shared_ptr<GeneratorTracker> tracker;
|
std::shared_ptr<GeneratorTracker> tracker;
|
||||||
|
|
||||||
ITracker& currentTracker = ctx.currentTracker();
|
ITracker& currentTracker = ctx.currentTracker();
|
||||||
if( TestCaseTracking::ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) {
|
// Under specific circumstances, the generator we want
|
||||||
|
// to acquire is also the current tracker. If this is
|
||||||
|
// the case, we have to avoid looking through current
|
||||||
|
// tracker's children, and instead return the current
|
||||||
|
// tracker.
|
||||||
|
// A case where this check is important is e.g.
|
||||||
|
// for (int i = 0; i < 5; ++i) {
|
||||||
|
// int n = GENERATE(1, 2);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// without it, the code above creates 5 nested generators.
|
||||||
|
if (currentTracker.nameAndLocation() == nameAndLocation) {
|
||||||
|
auto thisTracker = currentTracker.parent().findChild(nameAndLocation);
|
||||||
|
assert(thisTracker);
|
||||||
|
assert(thisTracker->isGeneratorTracker());
|
||||||
|
tracker = std::static_pointer_cast<GeneratorTracker>(thisTracker);
|
||||||
|
} else if ( TestCaseTracking::ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) {
|
||||||
assert( childTracker );
|
assert( childTracker );
|
||||||
assert( childTracker->isGeneratorTracker() );
|
assert( childTracker->isGeneratorTracker() );
|
||||||
tracker = std::static_pointer_cast<GeneratorTracker>( childTracker );
|
tracker = std::static_pointer_cast<GeneratorTracker>( childTracker );
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
tracker = std::make_shared<GeneratorTracker>( nameAndLocation, ctx, ¤tTracker );
|
tracker = std::make_shared<GeneratorTracker>( nameAndLocation, ctx, ¤tTracker );
|
||||||
currentTracker.addChild( tracker );
|
currentTracker.addChild( tracker );
|
||||||
}
|
}
|
||||||
@@ -12656,9 +12698,10 @@ namespace Catch {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
auto RunContext::acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& {
|
auto RunContext::acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& {
|
||||||
using namespace Generators;
|
using namespace Generators;
|
||||||
GeneratorTracker& tracker = GeneratorTracker::acquire( m_trackerContext, TestCaseTracking::NameAndLocation( "generator", lineInfo ) );
|
GeneratorTracker& tracker = GeneratorTracker::acquire(m_trackerContext,
|
||||||
|
TestCaseTracking::NameAndLocation( static_cast<std::string>(generatorName), lineInfo ) );
|
||||||
assert( tracker.isOpen() );
|
assert( tracker.isOpen() );
|
||||||
m_lastAssertionInfo.lineInfo = lineInfo;
|
m_lastAssertionInfo.lineInfo = lineInfo;
|
||||||
return tracker;
|
return tracker;
|
||||||
@@ -13433,6 +13476,7 @@ namespace Catch {
|
|||||||
// end catch_singletons.cpp
|
// end catch_singletons.cpp
|
||||||
// start catch_startup_exception_registry.cpp
|
// start catch_startup_exception_registry.cpp
|
||||||
|
|
||||||
|
#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
void StartupExceptionRegistry::add( std::exception_ptr const& exception ) noexcept {
|
void StartupExceptionRegistry::add( std::exception_ptr const& exception ) noexcept {
|
||||||
CATCH_TRY {
|
CATCH_TRY {
|
||||||
@@ -13448,6 +13492,7 @@ void StartupExceptionRegistry::add( std::exception_ptr const& exception ) noexce
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // end namespace Catch
|
} // end namespace Catch
|
||||||
|
#endif
|
||||||
// end catch_startup_exception_registry.cpp
|
// end catch_startup_exception_registry.cpp
|
||||||
// start catch_stream.cpp
|
// start catch_stream.cpp
|
||||||
|
|
||||||
@@ -13632,7 +13677,7 @@ namespace Catch {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
char toLowerCh(char c) {
|
char toLowerCh(char c) {
|
||||||
return static_cast<char>( std::tolower( c ) );
|
return static_cast<char>( std::tolower( static_cast<unsigned char>(c) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -14215,15 +14260,12 @@ namespace TestCaseTracking {
|
|||||||
m_currentTracker = tracker;
|
m_currentTracker = tracker;
|
||||||
}
|
}
|
||||||
|
|
||||||
TrackerBase::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent )
|
TrackerBase::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ):
|
||||||
: m_nameAndLocation( nameAndLocation ),
|
ITracker(nameAndLocation),
|
||||||
m_ctx( ctx ),
|
m_ctx( ctx ),
|
||||||
m_parent( parent )
|
m_parent( parent )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
NameAndLocation const& TrackerBase::nameAndLocation() const {
|
|
||||||
return m_nameAndLocation;
|
|
||||||
}
|
|
||||||
bool TrackerBase::isComplete() const {
|
bool TrackerBase::isComplete() const {
|
||||||
return m_runState == CompletedSuccessfully || m_runState == Failed;
|
return m_runState == CompletedSuccessfully || m_runState == Failed;
|
||||||
}
|
}
|
||||||
@@ -15122,7 +15164,9 @@ namespace Catch {
|
|||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
bool uncaught_exceptions() {
|
bool uncaught_exceptions() {
|
||||||
#if defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
|
#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
|
||||||
|
return false;
|
||||||
|
#elif defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
|
||||||
return std::uncaught_exceptions() > 0;
|
return std::uncaught_exceptions() > 0;
|
||||||
#else
|
#else
|
||||||
return std::uncaught_exception();
|
return std::uncaught_exception();
|
||||||
@@ -15162,7 +15206,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Version const& libraryVersion() {
|
Version const& libraryVersion() {
|
||||||
static Version version( 2, 12, 2, "", 0 );
|
static Version version( 2, 12, 4, "", 0 );
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17180,6 +17224,10 @@ namespace Catch {
|
|||||||
.writeAttribute( "successes", testGroupStats.totals.assertions.passed )
|
.writeAttribute( "successes", testGroupStats.totals.assertions.passed )
|
||||||
.writeAttribute( "failures", testGroupStats.totals.assertions.failed )
|
.writeAttribute( "failures", testGroupStats.totals.assertions.failed )
|
||||||
.writeAttribute( "expectedFailures", testGroupStats.totals.assertions.failedButOk );
|
.writeAttribute( "expectedFailures", testGroupStats.totals.assertions.failedButOk );
|
||||||
|
m_xml.scopedElement( "OverallResultsCases")
|
||||||
|
.writeAttribute( "successes", testGroupStats.totals.testCases.passed )
|
||||||
|
.writeAttribute( "failures", testGroupStats.totals.testCases.failed )
|
||||||
|
.writeAttribute( "expectedFailures", testGroupStats.totals.testCases.failedButOk );
|
||||||
m_xml.endElement();
|
m_xml.endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17189,6 +17237,10 @@ namespace Catch {
|
|||||||
.writeAttribute( "successes", testRunStats.totals.assertions.passed )
|
.writeAttribute( "successes", testRunStats.totals.assertions.passed )
|
||||||
.writeAttribute( "failures", testRunStats.totals.assertions.failed )
|
.writeAttribute( "failures", testRunStats.totals.assertions.failed )
|
||||||
.writeAttribute( "expectedFailures", testRunStats.totals.assertions.failedButOk );
|
.writeAttribute( "expectedFailures", testRunStats.totals.assertions.failedButOk );
|
||||||
|
m_xml.scopedElement( "OverallResultsCases")
|
||||||
|
.writeAttribute( "successes", testRunStats.totals.testCases.passed )
|
||||||
|
.writeAttribute( "failures", testRunStats.totals.testCases.failed )
|
||||||
|
.writeAttribute( "expectedFailures", testRunStats.totals.testCases.failedButOk );
|
||||||
m_xml.endElement();
|
m_xml.endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
third_party/clara.hpp
vendored
2
third_party/clara.hpp
vendored
@@ -667,7 +667,7 @@ namespace detail {
|
|||||||
}
|
}
|
||||||
inline auto convertInto( std::string const &source, bool &target ) -> ParserResult {
|
inline auto convertInto( std::string const &source, bool &target ) -> ParserResult {
|
||||||
std::string srcLC = source;
|
std::string srcLC = source;
|
||||||
std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( char c ) { return static_cast<char>( ::tolower(c) ); } );
|
std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( unsigned char c ) { return static_cast<char>( ::tolower( c ) ); } );
|
||||||
if (srcLC == "y" || srcLC == "1" || srcLC == "true" || srcLC == "yes" || srcLC == "on")
|
if (srcLC == "y" || srcLC == "1" || srcLC == "true" || srcLC == "yes" || srcLC == "on")
|
||||||
target = true;
|
target = true;
|
||||||
else if (srcLC == "n" || srcLC == "0" || srcLC == "false" || srcLC == "no" || srcLC == "off")
|
else if (srcLC == "n" || srcLC == "0" || srcLC == "false" || srcLC == "no" || srcLC == "off")
|
||||||
|
Reference in New Issue
Block a user