Skip to content

Commit 25c3939

Browse files
committed
update example,tests
1 parent 2ab3414 commit 25c3939

File tree

16 files changed

+601
-82
lines changed

16 files changed

+601
-82
lines changed

example/.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/vendor/cget/cget.cmake
22
/vendor/cget/pkg/pqrs-org__cget-recipes/
3-
/vendor/etc/
3+
/vendor/etc/cget/recipes/
44
/vendor/**/pkgconfig/

tests/.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/vendor/cget/cget.cmake
22
/vendor/cget/pkg/pqrs-org__cget-recipes/
3-
/vendor/etc/
3+
/vendor/etc/cget/recipes/
44
/vendor/**/pkgconfig/

tests/cget-requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
catchorg/Catch2@v2.4.2
1+
catchorg/Catch2
22
pqrs-org/cpp-string

tests/vendor/cget/pkg/catchorg__Catch2/install/include/catch2/catch.hpp

+324-37
Large diffs are not rendered by default.

tests/vendor/cget/pkg/catchorg__Catch2/install/lib/cmake/Catch2/Catch2ConfigVersion.cmake

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
# The variable CVF_VERSION must be set before calling configure_file().
1010

1111

12-
set(PACKAGE_VERSION "2.4.2")
12+
set(PACKAGE_VERSION "2.5.0")
1313

1414
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
1515
set(PACKAGE_VERSION_COMPATIBLE FALSE)
1616
else()
1717

18-
if("2.4.2" MATCHES "^([0-9]+)\\.")
18+
if("2.5.0" MATCHES "^([0-9]+)\\.")
1919
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
2020
else()
21-
set(CVF_VERSION_MAJOR "2.4.2")
21+
set(CVF_VERSION_MAJOR "2.5.0")
2222
endif()
2323

2424
if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR)

tests/vendor/cget/pkg/catchorg__Catch2/install/share/doc/Catch2/Readme.md

+1
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@ Other:
3636
* [Open Source Projects using Catch](opensource-users.md#top)
3737
* [Contributing](contributing.md#top)
3838
* [Release Notes](release-notes.md#top)
39+
* [Deprecations and incoming changes](deprecations.md#top)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<a id="top"></a>
2+
# Deprecations and incoming changes
3+
4+
This page documents current deprecations and upcoming planned changes
5+
inside Catch2. The difference between these is that a deprecated feature
6+
will be removed, while a planned change to a feature means that the
7+
feature will behave differently, but will still be present. Obviously,
8+
either of these is a breaking change, and thus will not happen until
9+
at least the next major release.
10+
11+
12+
## Deprecations
13+
14+
### `--list-*` return values
15+
16+
The return codes of the `--list-*` family of command line arguments
17+
will no longer be equal to the number of tests/tags/etc found, instead
18+
it will be 0 for success and non-zero for failure.
19+
20+
21+
### `--list-test-names-only`
22+
23+
`--list-test-names-only` command line argument will be removed.
24+
25+
26+
### `ANON_TEST_CASE`
27+
28+
`ANON_TEST_CASE` is scheduled for removal, as it can be fully replaced
29+
by a `TEST_CASE` with no arguments.
30+
31+
32+
### Secondary description amongst tags
33+
34+
Currently, the tags part of `TEST_CASE` (and others) macro can also
35+
contain text that is not part of tags. This text is then separated into
36+
a "description" of the test case, but the description is then never used
37+
apart from writing it out for `--list-tests -v high`.
38+
39+
Because it isn't actually used nor documented, and brings complications
40+
to Catch2's internals, description support will be removed.
41+
42+
43+
## Planned changes
44+
45+
46+
### Reporter verbosities
47+
48+
The current implementation of verbosities, where the reporter is checked
49+
up-front whether it supports the requested verbosity, is fundamentally
50+
misguided and will be changed. The new implementation will no longer check
51+
whether the specified reporter supports the requested verbosity, instead
52+
it will be up to the reporters to deal with verbosities as they see fit
53+
(with an expectation that unsupported verbosities will be, at most,
54+
warnings, but not errors).
55+
56+
57+
### Output format of `--list-*` command line parameters
58+
59+
The various list operations will be piped through reporters. This means
60+
that e.g. XML reporter will write the output as machine-parseable XML,
61+
while the Console reporter will keep the current, human-oriented output.
62+
63+
64+
### `CHECKED_IF` and `CHECKED_ELSE`
65+
66+
To make the `CHECKED_IF` and `CHECKED_ELSE` macros more useful, they will
67+
be marked as "OK to fail" (`Catch::ResultDisposition::SuppressFail` flag
68+
will be added), which means that their failure will not fail the test,
69+
making the `else` actually useful.
70+
71+
72+
### Change semantics of `[.]` and tag exclusion
73+
74+
Currently, given these 2 tests
75+
```cpp
76+
TEST_CASE("A", "[.][foo]") {}
77+
TEST_CASE("B", "[.][bar]") {}
78+
```
79+
specifying `[foo]` as the testspec will run test "A" and specifying
80+
`~[foo]` will run test "B", even though it is hidden. Also, specifying
81+
`~[baz]` will run both tests. This behaviour is often surprising and will
82+
be changed so that hidden tests are included in a run only if they
83+
positively match a testspec.
84+
85+
86+
---
87+
88+
[Home](Readme.md#top)

tests/vendor/cget/pkg/catchorg__Catch2/install/share/doc/Catch2/logging.md

+25-8
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,37 @@ The message is reported and the test case fails.
5757

5858
AS `FAIL`, but does not abort the test
5959

60-
## Quickly capture a variable value
60+
## Quickly capture value of variables or expressions
6161

62-
**CAPTURE(** _expression_ **)**
62+
**CAPTURE(** _expression1_, _expression2_, ... **)**
6363

64-
Sometimes you just want to log the name and value of a variable. While you can easily do this with the INFO macro, above, as a convenience the CAPTURE macro handles the stringising of the variable name for you (actually it works with any expression, not just variables).
64+
Sometimes you just want to log a value of variable, or expression. For
65+
convenience, we provide the `CAPTURE` macro, that can take a variable,
66+
or an expression, and prints out that variable/expression and its value
67+
at the time of capture.
6568

66-
E.g.
67-
```c++
68-
CAPTURE( theAnswer );
69+
e.g. `CAPTURE( theAnswer );` will log message "theAnswer := 42", while
70+
```cpp
71+
int a = 1, b = 2, c = 3;
72+
CAPTURE( a, b, c, a + b, c > b, a == 1);
73+
```
74+
will log a total of 6 messages:
75+
```
76+
a := 1
77+
b := 2
78+
c := 3
79+
a + b := 3
80+
c > b := true
81+
a == 1 := true
6982
```
7083
71-
This would log something like:
84+
You can also capture expressions that use commas inside parentheses
85+
(e.g. function calls), brackets, or braces (e.g. initializers). To
86+
properly capture expression that contains template parameters list
87+
(in other words, it contains commas between angle brackets), you need
88+
to enclose the expression inside parentheses:
89+
`CAPTURE( (std::pair<int, int>{1, 2}) );`
7290
73-
<pre>"theAnswer := 42"</pre>
7491
7592
---
7693

tests/vendor/cget/pkg/catchorg__Catch2/install/share/doc/Catch2/release-notes.md

+22
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# Release notes
44
**Contents**<br>
5+
[2.5.0](#250)<br>
56
[2.4.2](#242)<br>
67
[2.4.1](#241)<br>
78
[2.4.0](#240)<br>
@@ -17,6 +18,27 @@
1718
[Older versions](#older-versions)<br>
1819
[Even Older versions](#even-older-versions)<br>
1920

21+
## 2.5.0
22+
23+
### Improvements
24+
* Added support for templated tests via `TEMPLATE_TEST_CASE` (#1437)
25+
26+
27+
### Fixes
28+
* Fixed compilation of `PredicateMatcher<const char*>` by removing partial specialization of `MatcherMethod<T*>`
29+
* Listeners now implicitly support any verbosity (#1426)
30+
* Fixed compilation with Embarcadero builder by introducing `Catch::isnan` polyfill (#1438)
31+
* Fixed `CAPTURE` asserting for non-trivial captures (#1436, #1448)
32+
33+
34+
### Miscellaneous
35+
* We should now be providing first party Conan support via https://bintray.com/catchorg/Catch2 (#1443)
36+
* Added new section "deprecations and planned changes" to the documentation
37+
* It contains summary of what is deprecated and might change with next major version
38+
* From this release forward, the released headers should be pgp signed (#430)
39+
* KeyID `E29C 46F3 B8A7 5028 6079 3B7D ECC9 C20E 314B 2360`
40+
* or https://codingnest.com/files/horenmar-publickey.asc
41+
2042

2143
## 2.4.2
2244

tests/vendor/cget/pkg/catchorg__Catch2/install/share/doc/Catch2/release-process.md

+9-12
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ When enough changes have accumulated, it is time to release new version of Catch
88
These steps are necessary and have to be performed before each new release. They serve to make sure that the new release is correct and linked-to from the standard places.
99

1010

11-
### Approval testing
11+
### Testing
1212

13-
Catch's releases are primarily validated against output from previous release, stored in `projects/SelfTest/Baselines`. To validate current sources, build the SelfTest binary and pass it to the `approvalTests.py` script: `approvalTests.py <path/to/SelfTest>`.
14-
15-
There should be no differences, as Approval tests should be updated when changes to Catch are made, but if there are, then they need to be manually reviewed and either approved (using `approve.py`) or Catch requires other fixes.
13+
All of the tests are currently run in our CI setup based on TravisCI and
14+
AppVeyor. As long as the last commit tested green, the release can
15+
proceed.
1616

1717

1818
### Incrementing version number
@@ -27,7 +27,7 @@ version numbers everywhere and pushing the new version to Wandbox.
2727

2828
### Release notes
2929

30-
Once a release is ready, release notes need to be written. They should summarize changes done since last release. For rough idea of expected notes see previous releases. Once written, release notes should be placed in `docs/release-notes.md`.
30+
Once a release is ready, release notes need to be written. They should summarize changes done since last release. For rough idea of expected notes see previous releases. Once written, release notes should be added to `docs/release-notes.md`.
3131

3232

3333
### Commit and push update to GitHub
@@ -43,11 +43,8 @@ description should contain the release notes for the current release.
4343
Single header version of `catch.hpp` *needs* to be attached as a binary,
4444
as that is where the official download link links to. Preferably
4545
it should use linux line endings. All non-bundled reporters (Automake,
46-
TAP, TeamCity) should also be attached as binaries, as they are dependent
47-
on a specific version of the single-include header.
48-
49-
50-
## Optional steps
46+
TAP, TeamCity) should also be attached as binaries, as they might be
47+
dependent on a specific version of the single-include header.
5148

52-
Because Catch's [vcpkg](https://github.com/Microsoft/vcpkg) port updates
53-
itself automagically, there are no optional steps at this time.
49+
Since 2.5.0, the release tag and the "binaries" (headers) should be PGP
50+
signed.

tests/vendor/cget/pkg/catchorg__Catch2/install/share/doc/Catch2/test-cases-and-sections.md

+65
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
<a id="top"></a>
22
# Test cases and sections
33

4+
**Contents**<br>
5+
[Tags](#tags)<br>
6+
[Tag aliases](#tag-aliases)<br>
7+
[BDD-style test cases](#bdd-style-test-cases)<br>
8+
[Type parametrised test cases](#type-parametrised-test-cases)<br>
9+
410
While Catch fully supports the traditional, xUnit, style of class-based fixtures containing test case methods this is not the preferred style.
511

612
Instead Catch provides a powerful mechanism for nesting test case sections within a test case. For a more detailed discussion see the [tutorial](tutorial.md#test-cases-and-sections).
@@ -86,6 +92,65 @@ When any of these macros are used the console reporter recognises them and forma
8692

8793
Other than the additional prefixes and the formatting in the console reporter these macros behave exactly as ```TEST_CASE```s and ```SECTION```s. As such there is nothing enforcing the correct sequencing of these macros - that's up to the programmer!
8894

95+
## Type parametrised test cases
96+
97+
In addition to `TEST_CASE`s, Catch2 also supports test cases parametrised
98+
by type, in the form of `TEMPLATE_TEST_CASE`.
99+
100+
* **TEMPLATE_TEST_CASE(** _test name_ , _tags_, _type1_, _type2_, ..., _typen_ **)**
101+
102+
_test name_ and _tag_ are exactly the same as they are in `TEST_CASE`,
103+
with the difference that the tag string must be provided (however, it
104+
can be empty). _type1_ through _typen_ is the list of types for which
105+
this test case should run, and, inside the test code, the current type
106+
is available as the `TestType` type.
107+
108+
Because of limitations of the C++ preprocessor, if you want to specify
109+
a type with multiple template parameters, you need to enclose it in
110+
parentheses, e.g. `std::map<int, std::string>` needs to be passed as
111+
`(std::map<int, std::string>)`.
112+
113+
Example:
114+
```cpp
115+
TEMPLATE_TEST_CASE( "vectors can be sized and resized", "[vector][template]", int, std::string, (std::tuple<int,float>) ) {
116+
117+
std::vector<TestType> v( 5 );
118+
119+
REQUIRE( v.size() == 5 );
120+
REQUIRE( v.capacity() >= 5 );
121+
122+
SECTION( "resizing bigger changes size and capacity" ) {
123+
v.resize( 10 );
124+
125+
REQUIRE( v.size() == 10 );
126+
REQUIRE( v.capacity() >= 10 );
127+
}
128+
SECTION( "resizing smaller changes size but not capacity" ) {
129+
v.resize( 0 );
130+
131+
REQUIRE( v.size() == 0 );
132+
REQUIRE( v.capacity() >= 5 );
133+
134+
SECTION( "We can use the 'swap trick' to reset the capacity" ) {
135+
std::vector<TestType> empty;
136+
empty.swap( v );
137+
138+
REQUIRE( v.capacity() == 0 );
139+
}
140+
}
141+
SECTION( "reserving smaller does not change size or capacity" ) {
142+
v.reserve( 0 );
143+
144+
REQUIRE( v.size() == 5 );
145+
REQUIRE( v.capacity() >= 5 );
146+
}
147+
}
148+
```
149+
150+
_While there is an upper limit on the number of types you can specify
151+
in single `TEMPLATE_TEST_CASE`, the limit is very high and should not
152+
be encountered in practice._
153+
89154
---
90155
91156
[Home](Readme.md#top)

tests/vendor/cget/pkg/catchorg__Catch2/install/share/doc/Catch2/test-fixtures.md

+30
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,36 @@ class UniqueTestsFixture {
3030
3131
The two test cases here will create uniquely-named derived classes of UniqueTestsFixture and thus can access the `getID()` protected method and `conn` member variables. This ensures that both the test cases are able to create a DBConnection using the same method (DRY principle) and that any ID's created are unique such that the order that tests are executed does not matter.
3232
33+
34+
Catch2 also provides `TEMPLATE_TEST_CASE_METHOD` that can be used together
35+
with templated fixtures to perform tests for multiple different types.
36+
However, unlike `TEST_CASE_METHOD`, `TEMPLATE_TEST_CASE_METHOD` requires
37+
the tag specification to be non-empty, as it is followed by further macros
38+
arguments.
39+
40+
Also note that, because of limitations of the C++ preprocessor, if you
41+
want to specify a type with multiple template parameters, you need to
42+
enclose it in parentheses, e.g. `std::map<int, std::string>` needs to be
43+
passed as `(std::map<int, std::string>)`.
44+
45+
Example:
46+
```cpp
47+
template< typename T >
48+
struct Template_Fixture {
49+
Template_Fixture(): m_a(1) {}
50+
51+
T m_a;
52+
};
53+
54+
TEMPLATE_TEST_CASE_METHOD(Template_Fixture,"A TEMPLATE_TEST_CASE_METHOD based test run that succeeds", "[class][template]", int, float, double) {
55+
REQUIRE( Template_Fixture<TestType>::m_a == 1 );
56+
}
57+
```
58+
59+
_While there is an upper limit on the number of types you can specify
60+
in single `TEMPLATE_TEST_CASE`, the limit is very high and should not
61+
be encountered in practice._
62+
3363
---
3464

3565
[Home](Readme.md#top)

tests/vendor/cget/pkg/catchorg__Catch2/install/share/doc/Catch2/tostring.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ std::ostream& operator << ( std::ostream& os, T const& value ) {
2323

2424
(where ```T``` is your type and ```convertMyTypeToString``` is where you'll write whatever code is necessary to make your type printable - it doesn't have to be in another function).
2525

26-
You should put this function in the same namespace as your type and have it declared before including Catch's header.
26+
You should put this function in the same namespace as your type, or the global namespace, and have it declared before including Catch's header.
2727

2828
## Catch::StringMaker specialisation
2929
If you don't want to provide an ```operator <<``` overload, or you want to convert your type differently for testing purposes, you can provide a specialization for `Catch::StringMaker<T>`:

0 commit comments

Comments
 (0)