mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-14 17:35:39 +02:00
Compare commits
25 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6ccd467094 | ||
![]() |
34dcd2c436 | ||
![]() |
16656c4c9e | ||
![]() |
df019cc113 | ||
![]() |
695e6eafc5 | ||
![]() |
59087f74d9 | ||
![]() |
62460fafe6 | ||
![]() |
ac0a83a35d | ||
![]() |
77f29c2f1c | ||
![]() |
c6a89f14c2 | ||
![]() |
a9d5b7193d | ||
![]() |
396e0951c8 | ||
![]() |
68860ff129 | ||
![]() |
99b37a4c62 | ||
![]() |
1dccd26de7 | ||
![]() |
3f3238edf0 | ||
![]() |
450dd0562b | ||
![]() |
00d4f5d3c6 | ||
![]() |
2d906a92cb | ||
![]() |
489a41012e | ||
![]() |
eccbffec0f | ||
![]() |
c51f2edfb1 | ||
![]() |
de6bfb5c25 | ||
![]() |
87950d9cfa | ||
![]() |
d0eb9dfb9b |
94
.conan/build.py
Normal file
94
.conan/build.py
Normal file
@@ -0,0 +1,94 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import re
|
||||
from cpt.packager import ConanMultiPackager
|
||||
from cpt.ci_manager import CIManager
|
||||
from cpt.printer import Printer
|
||||
|
||||
|
||||
class BuilderSettings(object):
|
||||
@property
|
||||
def username(self):
|
||||
""" Set catchorg as package's owner
|
||||
"""
|
||||
return os.getenv("CONAN_USERNAME", "catchorg")
|
||||
|
||||
@property
|
||||
def login_username(self):
|
||||
""" Set Bintray login username
|
||||
"""
|
||||
return os.getenv("CONAN_LOGIN_USERNAME", "horenmar")
|
||||
|
||||
@property
|
||||
def upload(self):
|
||||
""" Set Catch2 repository to be used on upload.
|
||||
The upload server address could be customized by env var
|
||||
CONAN_UPLOAD. If not defined, the method will check the branch name.
|
||||
Only master or CONAN_STABLE_BRANCH_PATTERN will be accepted.
|
||||
The master branch will be pushed to testing channel, because it does
|
||||
not match the stable pattern. Otherwise it will upload to stable
|
||||
channel.
|
||||
"""
|
||||
return os.getenv("CONAN_UPLOAD", "https://api.bintray.com/conan/horenmar/Catch2")
|
||||
|
||||
@property
|
||||
def upload_only_when_stable(self):
|
||||
""" Force to upload when running over tag branch
|
||||
"""
|
||||
return os.getenv("CONAN_UPLOAD_ONLY_WHEN_STABLE", "True").lower() in ["true", "1", "yes"]
|
||||
|
||||
@property
|
||||
def stable_branch_pattern(self):
|
||||
""" Only upload the package the branch name is like a tag
|
||||
"""
|
||||
return os.getenv("CONAN_STABLE_BRANCH_PATTERN", r"v\d+\.\d+\.\d+")
|
||||
|
||||
@property
|
||||
def reference(self):
|
||||
""" Read project version from branch create Conan referece
|
||||
"""
|
||||
return os.getenv("CONAN_REFERENCE", "Catch2/{}@{}/{}".format(self._version, self.username, self.channel))
|
||||
|
||||
@property
|
||||
def channel(self):
|
||||
""" Default Conan package channel when not stable
|
||||
"""
|
||||
return os.getenv("CONAN_CHANNEL", "testing")
|
||||
|
||||
@property
|
||||
def _version(self):
|
||||
""" Get version name from cmake file
|
||||
"""
|
||||
pattern = re.compile(r"project\(Catch2 LANGUAGES CXX VERSION (\d+\.\d+\.\d+)\)")
|
||||
version = "latest"
|
||||
with open("CMakeLists.txt") as file:
|
||||
for line in file:
|
||||
result = pattern.search(line)
|
||||
if result:
|
||||
version = result.group(1)
|
||||
return version
|
||||
|
||||
@property
|
||||
def _branch(self):
|
||||
""" Get branch name from CI manager
|
||||
"""
|
||||
printer = Printer(None)
|
||||
ci_manager = CIManager(printer)
|
||||
return ci_manager.get_branch()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
settings = BuilderSettings()
|
||||
builder = ConanMultiPackager(
|
||||
reference=settings.reference,
|
||||
channel=settings.channel,
|
||||
upload=settings.upload,
|
||||
upload_only_when_stable=settings.upload_only_when_stable,
|
||||
stable_branch_pattern=settings.stable_branch_pattern,
|
||||
login_username=settings.login_username,
|
||||
username=settings.username,
|
||||
test_folder=os.path.join(".conan", "test_package"))
|
||||
builder.add()
|
||||
builder.run()
|
11
.conan/test_package/CMakeLists.txt
Normal file
11
.conan/test_package/CMakeLists.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
cmake_minimum_required(VERSION 3.2.0)
|
||||
project(test_package CXX)
|
||||
|
||||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
||||
conan_basic_setup(TARGETS)
|
||||
|
||||
find_package(Catch2 REQUIRED CONFIG)
|
||||
|
||||
add_executable(${PROJECT_NAME} test_package.cpp)
|
||||
target_link_libraries(${PROJECT_NAME} CONAN_PKG::Catch2)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11)
|
19
.conan/test_package/conanfile.py
Normal file
19
.conan/test_package/conanfile.py
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
from conans import ConanFile, CMake
|
||||
import os
|
||||
|
||||
|
||||
class TestPackageConan(ConanFile):
|
||||
settings = "os", "compiler", "build_type", "arch"
|
||||
generators = "cmake"
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def test(self):
|
||||
assert os.path.isfile(os.path.join(self.deps_cpp_info["Catch2"].rootpath, "licenses", "LICENSE.txt"))
|
||||
bin_path = os.path.join("bin", "test_package")
|
||||
self.run("%s -s" % bin_path, run_environment=True)
|
15
.conan/test_package/test_package.cpp
Normal file
15
.conan/test_package/test_package.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#define CATCH_CONFIG_MAIN
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
int Factorial( int number ) {
|
||||
return number <= 1 ? 1 : Factorial( number - 1 ) * number;
|
||||
}
|
||||
|
||||
TEST_CASE( "Factorial Tests", "[single-file]" ) {
|
||||
REQUIRE( Factorial(0) == 1 );
|
||||
REQUIRE( Factorial(1) == 1 );
|
||||
REQUIRE( Factorial(2) == 2 );
|
||||
REQUIRE( Factorial(3) == 6 );
|
||||
REQUIRE( Factorial(10) == 3628800 );
|
||||
}
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -27,3 +27,4 @@ Build
|
||||
.vs
|
||||
cmake-build-*
|
||||
benchmark-dir
|
||||
.conan/test_package/build
|
||||
|
13
.travis.yml
13
.travis.yml
@@ -271,6 +271,19 @@ matrix:
|
||||
packages: ['clang-6.0', 'libstdc++-8-dev']
|
||||
env: COMPILER='clang++-6.0' CPP17=1 EXAMPLES=1 COVERAGE=1 EXTRAS=1
|
||||
|
||||
# 8/ Conan
|
||||
- language: python
|
||||
python:
|
||||
- "3.7"
|
||||
dist: xenial
|
||||
install:
|
||||
- pip install conan conan-package-tools
|
||||
env:
|
||||
- CONAN_GCC_VERSIONS=8
|
||||
- CONAN_DOCKER_IMAGE=conanio/gcc8
|
||||
script:
|
||||
- python .conan/build.py
|
||||
|
||||
install:
|
||||
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
|
||||
- mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}
|
||||
|
@@ -6,7 +6,7 @@ if(NOT DEFINED PROJECT_NAME)
|
||||
set(NOT_SUBPROJECT ON)
|
||||
endif()
|
||||
|
||||
project(Catch2 LANGUAGES CXX VERSION 2.4.2)
|
||||
project(Catch2 LANGUAGES CXX VERSION 2.5.0)
|
||||
|
||||
# Provide path for scripts
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake")
|
||||
|
@@ -5,11 +5,11 @@
|
||||
[](https://travis-ci.org/catchorg/Catch2)
|
||||
[](https://ci.appveyor.com/project/catchorg/catch2)
|
||||
[](https://codecov.io/gh/catchorg/Catch2)
|
||||
[](https://wandbox.org/permlink/rbkudthN4hBNJznk)
|
||||
[](https://wandbox.org/permlink/7lDqHmzKQxA2eaM0)
|
||||
[](https://discord.gg/4CWS9zD)
|
||||
|
||||
|
||||
<a href="https://github.com/catchorg/Catch2/releases/download/v2.4.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.5.0/catch.hpp">The latest version of the single header can be downloaded directly using this link</a>
|
||||
|
||||
## Catch2 is released!
|
||||
|
||||
|
18
conanfile.py
18
conanfile.py
@@ -3,19 +3,15 @@ from conans import ConanFile, CMake
|
||||
|
||||
|
||||
class CatchConan(ConanFile):
|
||||
name = "Catch"
|
||||
version = "2.4.2"
|
||||
name = "Catch2"
|
||||
description = "A modern, C++-native, header-only, framework for unit-tests, TDD and BDD"
|
||||
author = "philsquared"
|
||||
generators = "cmake"
|
||||
# Only needed until conan 1.5 is released
|
||||
settings = "compiler", "arch"
|
||||
exports_sources = "single_include/*", "CMakeLists.txt", "CMake/catch2.pc.in", "LICENSE.txt"
|
||||
topics = ("conan", "catch2", "header-only", "unit-test", "tdd", "bdd")
|
||||
url = "https://github.com/catchorg/Catch2"
|
||||
license = "Boost Software License - Version 1.0. http://www.boost.org/LICENSE_1_0.txt"
|
||||
|
||||
def build(self):
|
||||
pass
|
||||
homepage = url
|
||||
license = "BSL-1.0"
|
||||
exports = "LICENSE.txt"
|
||||
exports_sources = ("single_include/*", "CMakeLists.txt", "CMake/*", "contrib/*")
|
||||
generators = "cmake"
|
||||
|
||||
def package(self):
|
||||
cmake = CMake(self)
|
||||
|
@@ -36,3 +36,4 @@ Other:
|
||||
* [Open Source Projects using Catch](opensource-users.md#top)
|
||||
* [Contributing](contributing.md#top)
|
||||
* [Release Notes](release-notes.md#top)
|
||||
* [Deprecations and incoming changes](deprecations.md#top)
|
||||
|
88
docs/deprecations.md
Normal file
88
docs/deprecations.md
Normal file
@@ -0,0 +1,88 @@
|
||||
<a id="top"></a>
|
||||
# Deprecations and incoming changes
|
||||
|
||||
This page documents current deprecations and upcoming planned changes
|
||||
inside Catch2. The difference between these is that a deprecated feature
|
||||
will be removed, while a planned change to a feature means that the
|
||||
feature will behave differently, but will still be present. Obviously,
|
||||
either of these is a breaking change, and thus will not happen until
|
||||
at least the next major release.
|
||||
|
||||
|
||||
## Deprecations
|
||||
|
||||
### `--list-*` return values
|
||||
|
||||
The return codes of the `--list-*` family of command line arguments
|
||||
will no longer be equal to the number of tests/tags/etc found, instead
|
||||
it will be 0 for success and non-zero for failure.
|
||||
|
||||
|
||||
### `--list-test-names-only`
|
||||
|
||||
`--list-test-names-only` command line argument will be removed.
|
||||
|
||||
|
||||
### `ANON_TEST_CASE`
|
||||
|
||||
`ANON_TEST_CASE` is scheduled for removal, as it can be fully replaced
|
||||
by a `TEST_CASE` with no arguments.
|
||||
|
||||
|
||||
### Secondary description amongst tags
|
||||
|
||||
Currently, the tags part of `TEST_CASE` (and others) macro can also
|
||||
contain text that is not part of tags. This text is then separated into
|
||||
a "description" of the test case, but the description is then never used
|
||||
apart from writing it out for `--list-tests -v high`.
|
||||
|
||||
Because it isn't actually used nor documented, and brings complications
|
||||
to Catch2's internals, description support will be removed.
|
||||
|
||||
|
||||
## Planned changes
|
||||
|
||||
|
||||
### Reporter verbosities
|
||||
|
||||
The current implementation of verbosities, where the reporter is checked
|
||||
up-front whether it supports the requested verbosity, is fundamentally
|
||||
misguided and will be changed. The new implementation will no longer check
|
||||
whether the specified reporter supports the requested verbosity, instead
|
||||
it will be up to the reporters to deal with verbosities as they see fit
|
||||
(with an expectation that unsupported verbosities will be, at most,
|
||||
warnings, but not errors).
|
||||
|
||||
|
||||
### Output format of `--list-*` command line parameters
|
||||
|
||||
The various list operations will be piped through reporters. This means
|
||||
that e.g. XML reporter will write the output as machine-parseable XML,
|
||||
while the Console reporter will keep the current, human-oriented output.
|
||||
|
||||
|
||||
### `CHECKED_IF` and `CHECKED_ELSE`
|
||||
|
||||
To make the `CHECKED_IF` and `CHECKED_ELSE` macros more useful, they will
|
||||
be marked as "OK to fail" (`Catch::ResultDisposition::SuppressFail` flag
|
||||
will be added), which means that their failure will not fail the test,
|
||||
making the `else` actually useful.
|
||||
|
||||
|
||||
### Change semantics of `[.]` and tag exclusion
|
||||
|
||||
Currently, given these 2 tests
|
||||
```cpp
|
||||
TEST_CASE("A", "[.][foo]") {}
|
||||
TEST_CASE("B", "[.][bar]") {}
|
||||
```
|
||||
specifying `[foo]` as the testspec will run test "A" and specifying
|
||||
`~[foo]` will run test "B", even though it is hidden. Also, specifying
|
||||
`~[baz]` will run both tests. This behaviour is often surprising and will
|
||||
be changed so that hidden tests are included in a run only if they
|
||||
positively match a testspec.
|
||||
|
||||
|
||||
---
|
||||
|
||||
[Home](Readme.md#top)
|
@@ -57,20 +57,37 @@ The message is reported and the test case fails.
|
||||
|
||||
AS `FAIL`, but does not abort the test
|
||||
|
||||
## Quickly capture a variable value
|
||||
## Quickly capture value of variables or expressions
|
||||
|
||||
**CAPTURE(** _expression_ **)**
|
||||
**CAPTURE(** _expression1_, _expression2_, ... **)**
|
||||
|
||||
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).
|
||||
Sometimes you just want to log a value of variable, or expression. For
|
||||
convenience, we provide the `CAPTURE` macro, that can take a variable,
|
||||
or an expression, and prints out that variable/expression and its value
|
||||
at the time of capture.
|
||||
|
||||
E.g.
|
||||
```c++
|
||||
CAPTURE( theAnswer );
|
||||
e.g. `CAPTURE( theAnswer );` will log message "theAnswer := 42", while
|
||||
```cpp
|
||||
int a = 1, b = 2, c = 3;
|
||||
CAPTURE( a, b, c, a + b, c > b, a == 1);
|
||||
```
|
||||
will log a total of 6 messages:
|
||||
```
|
||||
a := 1
|
||||
b := 2
|
||||
c := 3
|
||||
a + b := 3
|
||||
c > b := true
|
||||
a == 1 := true
|
||||
```
|
||||
|
||||
This would log something like:
|
||||
You can also capture expressions that use commas inside parentheses
|
||||
(e.g. function calls), brackets, or braces (e.g. initializers). To
|
||||
properly capture expression that contains template parameters list
|
||||
(in other words, it contains commas between angle brackets), you need
|
||||
to enclose the expression inside parentheses:
|
||||
`CAPTURE( (std::pair<int, int>{1, 2}) );`
|
||||
|
||||
<pre>"theAnswer := 42"</pre>
|
||||
|
||||
---
|
||||
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
# Release notes
|
||||
**Contents**<br>
|
||||
[2.5.0](#250)<br>
|
||||
[2.4.2](#242)<br>
|
||||
[2.4.1](#241)<br>
|
||||
[2.4.0](#240)<br>
|
||||
@@ -17,6 +18,27 @@
|
||||
[Older versions](#older-versions)<br>
|
||||
[Even Older versions](#even-older-versions)<br>
|
||||
|
||||
## 2.5.0
|
||||
|
||||
### Improvements
|
||||
* Added support for templated tests via `TEMPLATE_TEST_CASE` (#1437)
|
||||
|
||||
|
||||
### Fixes
|
||||
* Fixed compilation of `PredicateMatcher<const char*>` by removing partial specialization of `MatcherMethod<T*>`
|
||||
* Listeners now implicitly support any verbosity (#1426)
|
||||
* Fixed compilation with Embarcadero builder by introducing `Catch::isnan` polyfill (#1438)
|
||||
* Fixed `CAPTURE` asserting for non-trivial captures (#1436, #1448)
|
||||
|
||||
|
||||
### Miscellaneous
|
||||
* We should now be providing first party Conan support via https://bintray.com/catchorg/Catch2 (#1443)
|
||||
* Added new section "deprecations and planned changes" to the documentation
|
||||
* It contains summary of what is deprecated and might change with next major version
|
||||
* From this release forward, the released headers should be pgp signed (#430)
|
||||
* KeyID `E29C 46F3 B8A7 5028 6079 3B7D ECC9 C20E 314B 2360`
|
||||
* or https://codingnest.com/files/horenmar-publickey.asc
|
||||
|
||||
|
||||
## 2.4.2
|
||||
|
||||
|
@@ -8,11 +8,11 @@ When enough changes have accumulated, it is time to release new version of Catch
|
||||
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.
|
||||
|
||||
|
||||
### Approval testing
|
||||
### Testing
|
||||
|
||||
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>`.
|
||||
|
||||
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.
|
||||
All of the tests are currently run in our CI setup based on TravisCI and
|
||||
AppVeyor. As long as the last commit tested green, the release can
|
||||
proceed.
|
||||
|
||||
|
||||
### Incrementing version number
|
||||
@@ -27,7 +27,7 @@ version numbers everywhere and pushing the new version to Wandbox.
|
||||
|
||||
### Release notes
|
||||
|
||||
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`.
|
||||
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`.
|
||||
|
||||
|
||||
### Commit and push update to GitHub
|
||||
@@ -43,11 +43,8 @@ description should contain the release notes for the current release.
|
||||
Single header version of `catch.hpp` *needs* to be attached as a binary,
|
||||
as that is where the official download link links to. Preferably
|
||||
it should use linux line endings. All non-bundled reporters (Automake,
|
||||
TAP, TeamCity) should also be attached as binaries, as they are dependent
|
||||
on a specific version of the single-include header.
|
||||
TAP, TeamCity) should also be attached as binaries, as they might be
|
||||
dependent on a specific version of the single-include header.
|
||||
|
||||
|
||||
## Optional steps
|
||||
|
||||
Because Catch's [vcpkg](https://github.com/Microsoft/vcpkg) port updates
|
||||
itself automagically, there are no optional steps at this time.
|
||||
Since 2.5.0, the release tag and the "binaries" (headers) should be PGP
|
||||
signed.
|
||||
|
@@ -1,6 +1,12 @@
|
||||
<a id="top"></a>
|
||||
# Test cases and sections
|
||||
|
||||
**Contents**<br>
|
||||
[Tags](#tags)<br>
|
||||
[Tag aliases](#tag-aliases)<br>
|
||||
[BDD-style test cases](#bdd-style-test-cases)<br>
|
||||
[Type parametrised test cases](#type-parametrised-test-cases)<br>
|
||||
|
||||
While Catch fully supports the traditional, xUnit, style of class-based fixtures containing test case methods this is not the preferred style.
|
||||
|
||||
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
|
||||
|
||||
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!
|
||||
|
||||
## Type parametrised test cases
|
||||
|
||||
In addition to `TEST_CASE`s, Catch2 also supports test cases parametrised
|
||||
by type, in the form of `TEMPLATE_TEST_CASE`.
|
||||
|
||||
* **TEMPLATE_TEST_CASE(** _test name_ , _tags_, _type1_, _type2_, ..., _typen_ **)**
|
||||
|
||||
_test name_ and _tag_ are exactly the same as they are in `TEST_CASE`,
|
||||
with the difference that the tag string must be provided (however, it
|
||||
can be empty). _type1_ through _typen_ is the list of types for which
|
||||
this test case should run, and, inside the test code, the current type
|
||||
is available as the `TestType` type.
|
||||
|
||||
Because of limitations of the C++ preprocessor, if you want to specify
|
||||
a type with multiple template parameters, you need to enclose it in
|
||||
parentheses, e.g. `std::map<int, std::string>` needs to be passed as
|
||||
`(std::map<int, std::string>)`.
|
||||
|
||||
Example:
|
||||
```cpp
|
||||
TEMPLATE_TEST_CASE( "vectors can be sized and resized", "[vector][template]", int, std::string, (std::tuple<int,float>) ) {
|
||||
|
||||
std::vector<TestType> v( 5 );
|
||||
|
||||
REQUIRE( v.size() == 5 );
|
||||
REQUIRE( v.capacity() >= 5 );
|
||||
|
||||
SECTION( "resizing bigger changes size and capacity" ) {
|
||||
v.resize( 10 );
|
||||
|
||||
REQUIRE( v.size() == 10 );
|
||||
REQUIRE( v.capacity() >= 10 );
|
||||
}
|
||||
SECTION( "resizing smaller changes size but not capacity" ) {
|
||||
v.resize( 0 );
|
||||
|
||||
REQUIRE( v.size() == 0 );
|
||||
REQUIRE( v.capacity() >= 5 );
|
||||
|
||||
SECTION( "We can use the 'swap trick' to reset the capacity" ) {
|
||||
std::vector<TestType> empty;
|
||||
empty.swap( v );
|
||||
|
||||
REQUIRE( v.capacity() == 0 );
|
||||
}
|
||||
}
|
||||
SECTION( "reserving smaller does not change size or capacity" ) {
|
||||
v.reserve( 0 );
|
||||
|
||||
REQUIRE( v.size() == 5 );
|
||||
REQUIRE( v.capacity() >= 5 );
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
_While there is an upper limit on the number of types you can specify
|
||||
in single `TEMPLATE_TEST_CASE`, the limit is very high and should not
|
||||
be encountered in practice._
|
||||
|
||||
---
|
||||
|
||||
[Home](Readme.md#top)
|
||||
|
@@ -30,6 +30,36 @@ class UniqueTestsFixture {
|
||||
|
||||
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.
|
||||
|
||||
|
||||
Catch2 also provides `TEMPLATE_TEST_CASE_METHOD` that can be used together
|
||||
with templated fixtures to perform tests for multiple different types.
|
||||
However, unlike `TEST_CASE_METHOD`, `TEMPLATE_TEST_CASE_METHOD` requires
|
||||
the tag specification to be non-empty, as it is followed by further macros
|
||||
arguments.
|
||||
|
||||
Also note that, because of limitations of the C++ preprocessor, if you
|
||||
want to specify a type with multiple template parameters, you need to
|
||||
enclose it in parentheses, e.g. `std::map<int, std::string>` needs to be
|
||||
passed as `(std::map<int, std::string>)`.
|
||||
|
||||
Example:
|
||||
```cpp
|
||||
template< typename T >
|
||||
struct Template_Fixture {
|
||||
Template_Fixture(): m_a(1) {}
|
||||
|
||||
T m_a;
|
||||
};
|
||||
|
||||
TEMPLATE_TEST_CASE_METHOD(Template_Fixture,"A TEMPLATE_TEST_CASE_METHOD based test run that succeeds", "[class][template]", int, float, double) {
|
||||
REQUIRE( Template_Fixture<TestType>::m_a == 1 );
|
||||
}
|
||||
```
|
||||
|
||||
_While there is an upper limit on the number of types you can specify
|
||||
in single `TEMPLATE_TEST_CASE`, the limit is very high and should not
|
||||
be encountered in practice._
|
||||
|
||||
---
|
||||
|
||||
[Home](Readme.md#top)
|
||||
|
@@ -23,7 +23,7 @@ std::ostream& operator << ( std::ostream& os, T const& value ) {
|
||||
|
||||
(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).
|
||||
|
||||
You should put this function in the same namespace as your type and have it declared before including Catch's header.
|
||||
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.
|
||||
|
||||
## Catch::StringMaker specialisation
|
||||
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>`:
|
||||
|
@@ -8,6 +8,7 @@
|
||||
[Test cases and sections](#test-cases-and-sections)<br>
|
||||
[BDD-Style](#bdd-style)<br>
|
||||
[Scaling up](#scaling-up)<br>
|
||||
[Type parametrised test cases](#type-parametrised-test-cases)<br>
|
||||
[Next steps](#next-steps)<br>
|
||||
|
||||
## Getting Catch2
|
||||
@@ -22,7 +23,7 @@ The full source for Catch2, including test projects, documentation, and other th
|
||||
|
||||
## Where to put it?
|
||||
|
||||
Catch2 is header only. All you need to do is drop the file somewhere reachable from your project - either in some central location you can set your header search path to find, or directly into your project tree itself! This is a particularly good option for other Open-Source projects that want to use Catch for their test suite. See [this blog entry for more on that](http://www.levelofindirection.com/journal/2011/5/27/unit-testing-in-c-and-objective-c-just-got-ridiculously-easi.html).
|
||||
Catch2 is header only. All you need to do is drop the file somewhere reachable from your project - either in some central location you can set your header search path to find, or directly into your project tree itself! This is a particularly good option for other Open-Source projects that want to use Catch for their test suite. See [this blog entry for more on that](http://www.levelofindirection.com/journal/2011/5/27/unit-testing-in-c-and-objective-c-just-got-ridiculously-easi.html).
|
||||
|
||||
The rest of this tutorial will assume that the Catch2 single-include header (or the include folder) is available unqualified - but you may need to prefix it with a folder name if necessary.
|
||||
|
||||
@@ -31,7 +32,7 @@ package, you need to include the header as `#include <catch2/catch.hpp>`_
|
||||
|
||||
## Writing tests
|
||||
|
||||
Let's start with a really simple example ([code](../examples/010-TestCase.cpp)). Say you have written a function to calculate factorials and now you want to test it (let's leave aside TDD for now).
|
||||
Let's start with a really simple example ([code](../examples/010-TestCase.cpp)). Say you have written a function to calculate factorials and now you want to test it (let's leave aside TDD for now).
|
||||
|
||||
```c++
|
||||
unsigned int Factorial( unsigned int number ) {
|
||||
@@ -122,31 +123,31 @@ Catch takes a different approach (to both NUnit and xUnit) that is a more natura
|
||||
TEST_CASE( "vectors can be sized and resized", "[vector]" ) {
|
||||
|
||||
std::vector<int> v( 5 );
|
||||
|
||||
|
||||
REQUIRE( v.size() == 5 );
|
||||
REQUIRE( v.capacity() >= 5 );
|
||||
|
||||
|
||||
SECTION( "resizing bigger changes size and capacity" ) {
|
||||
v.resize( 10 );
|
||||
|
||||
|
||||
REQUIRE( v.size() == 10 );
|
||||
REQUIRE( v.capacity() >= 10 );
|
||||
}
|
||||
SECTION( "resizing smaller changes size but not capacity" ) {
|
||||
v.resize( 0 );
|
||||
|
||||
|
||||
REQUIRE( v.size() == 0 );
|
||||
REQUIRE( v.capacity() >= 5 );
|
||||
}
|
||||
SECTION( "reserving bigger changes capacity but not size" ) {
|
||||
v.reserve( 10 );
|
||||
|
||||
|
||||
REQUIRE( v.size() == 5 );
|
||||
REQUIRE( v.capacity() >= 10 );
|
||||
}
|
||||
SECTION( "reserving smaller does not change size or capacity" ) {
|
||||
v.reserve( 0 );
|
||||
|
||||
|
||||
REQUIRE( v.size() == 5 );
|
||||
REQUIRE( v.capacity() >= 5 );
|
||||
}
|
||||
@@ -163,13 +164,13 @@ The power of sections really shows, however, when we need to execute a sequence
|
||||
```c++
|
||||
SECTION( "reserving bigger changes capacity but not size" ) {
|
||||
v.reserve( 10 );
|
||||
|
||||
|
||||
REQUIRE( v.size() == 5 );
|
||||
REQUIRE( v.capacity() >= 10 );
|
||||
|
||||
|
||||
SECTION( "reserving smaller again does not change capacity" ) {
|
||||
v.reserve( 7 );
|
||||
|
||||
|
||||
REQUIRE( v.capacity() >= 10 );
|
||||
}
|
||||
}
|
||||
@@ -188,13 +189,13 @@ SCENARIO( "vectors can be sized and resized", "[vector]" ) {
|
||||
|
||||
GIVEN( "A vector with some items" ) {
|
||||
std::vector<int> v( 5 );
|
||||
|
||||
|
||||
REQUIRE( v.size() == 5 );
|
||||
REQUIRE( v.capacity() >= 5 );
|
||||
|
||||
|
||||
WHEN( "the size is increased" ) {
|
||||
v.resize( 10 );
|
||||
|
||||
|
||||
THEN( "the size and capacity change" ) {
|
||||
REQUIRE( v.size() == 10 );
|
||||
REQUIRE( v.capacity() >= 10 );
|
||||
@@ -202,7 +203,7 @@ SCENARIO( "vectors can be sized and resized", "[vector]" ) {
|
||||
}
|
||||
WHEN( "the size is reduced" ) {
|
||||
v.resize( 0 );
|
||||
|
||||
|
||||
THEN( "the size changes but not capacity" ) {
|
||||
REQUIRE( v.size() == 0 );
|
||||
REQUIRE( v.capacity() >= 5 );
|
||||
@@ -210,7 +211,7 @@ SCENARIO( "vectors can be sized and resized", "[vector]" ) {
|
||||
}
|
||||
WHEN( "more capacity is reserved" ) {
|
||||
v.reserve( 10 );
|
||||
|
||||
|
||||
THEN( "the capacity changes but not the size" ) {
|
||||
REQUIRE( v.size() == 5 );
|
||||
REQUIRE( v.capacity() >= 10 );
|
||||
@@ -218,7 +219,7 @@ SCENARIO( "vectors can be sized and resized", "[vector]" ) {
|
||||
}
|
||||
WHEN( "less capacity is reserved" ) {
|
||||
v.reserve( 0 );
|
||||
|
||||
|
||||
THEN( "neither size nor capacity are changed" ) {
|
||||
REQUIRE( v.size() == 5 );
|
||||
REQUIRE( v.capacity() >= 5 );
|
||||
@@ -256,6 +257,16 @@ In fact it is usually a good idea to put the block with the ```#define``` [in it
|
||||
Do not write your tests in header files!
|
||||
|
||||
|
||||
## Type parametrised test cases
|
||||
|
||||
Test cases in Catch2 can be also parametrised by type, via the
|
||||
`TEMPLATE_TEST_CASE` macro, which behaves in the same way the `TEST_CASE`
|
||||
macro, but is run for every type.
|
||||
|
||||
For more details, see our documentation on [test cases and
|
||||
sections](test-cases-and-sections.md#type-parametrised-test-cases).
|
||||
|
||||
|
||||
## Next steps
|
||||
|
||||
This has been a brief introduction to get you up and running with Catch, and to point out some of the key differences between Catch and other frameworks you may already be familiar with. This will get you going quite far already and you are now in a position to dive in and write some tests.
|
||||
|
@@ -6,7 +6,7 @@ including (but not limited to),
|
||||
[Google Test](http://code.google.com/p/googletest/),
|
||||
[Boost.Test](http://www.boost.org/doc/libs/1_49_0/libs/test/doc/html/index.html),
|
||||
[CppUnit](http://sourceforge.net/apps/mediawiki/cppunit/index.php?title=Main_Page),
|
||||
[Cute](http://r2.ifs.hsr.ch/cute),
|
||||
[Cute](http://www.cute-test.com),
|
||||
[many, many more](http://en.wikipedia.org/wiki/List_of_unit_testing_frameworks#C.2B.2B).
|
||||
|
||||
So what does Catch bring to the party that differentiates it from these? Apart from a Catchy name, of course.
|
||||
|
@@ -10,8 +10,8 @@
|
||||
#define TWOBLUECUBES_CATCH_HPP_INCLUDED
|
||||
|
||||
#define CATCH_VERSION_MAJOR 2
|
||||
#define CATCH_VERSION_MINOR 4
|
||||
#define CATCH_VERSION_PATCH 2
|
||||
#define CATCH_VERSION_MINOR 5
|
||||
#define CATCH_VERSION_PATCH 0
|
||||
|
||||
#ifdef __clang__
|
||||
# pragma clang system_header
|
||||
@@ -145,6 +145,15 @@
|
||||
|
||||
#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE()
|
||||
|
||||
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )
|
||||
#define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
||||
#else
|
||||
#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) )
|
||||
#define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) )
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(CATCH_CONFIG_RUNTIME_STATIC_REQUIRE)
|
||||
#define CATCH_STATIC_REQUIRE( ... ) static_assert( __VA_ARGS__ , #__VA_ARGS__ ); CATCH_SUCCEED( #__VA_ARGS__ )
|
||||
#define CATCH_STATIC_REQUIRE_FALSE( ... ) static_assert( !(__VA_ARGS__), "!(" #__VA_ARGS__ ")" ); CATCH_SUCCEED( #__VA_ARGS__ )
|
||||
@@ -214,6 +223,15 @@
|
||||
#define SUCCEED( ... ) INTERNAL_CATCH_MSG( "SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
||||
#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE()
|
||||
|
||||
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )
|
||||
#define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
||||
#else
|
||||
#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) )
|
||||
#define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) )
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(CATCH_CONFIG_RUNTIME_STATIC_REQUIRE)
|
||||
#define STATIC_REQUIRE( ... ) static_assert( __VA_ARGS__, #__VA_ARGS__ ); SUCCEED( #__VA_ARGS__ )
|
||||
#define STATIC_REQUIRE_FALSE( ... ) static_assert( !(__VA_ARGS__), "!(" #__VA_ARGS__ ")" ); SUCCEED( "!(" #__VA_ARGS__ ")" )
|
||||
@@ -292,6 +310,14 @@ using Catch::Detail::Approx;
|
||||
|
||||
#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
|
||||
|
||||
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) )
|
||||
#define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), className )
|
||||
#else
|
||||
#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) ) )
|
||||
#define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), className ) )
|
||||
#endif
|
||||
|
||||
// "BDD-style" convenience wrappers
|
||||
#define CATCH_SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
|
||||
#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), className )
|
||||
@@ -355,6 +381,13 @@ using Catch::Detail::Approx;
|
||||
#define SUCCEED( ... ) (void)(0)
|
||||
#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
|
||||
|
||||
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) )
|
||||
#define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), className )
|
||||
#else
|
||||
#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) ) )
|
||||
#define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), className ) )
|
||||
#endif
|
||||
|
||||
#define STATIC_REQUIRE( ... ) (void)(0)
|
||||
#define STATIC_REQUIRE_FALSE( ... ) (void)(0)
|
||||
|
@@ -136,6 +136,13 @@
|
||||
# define CATCH_INTERNAL_CONFIG_WINDOWS_SEH
|
||||
# endif
|
||||
|
||||
// MSVC traditional preprocessor needs some workaround for __VA_ARGS__
|
||||
// _MSVC_TRADITIONAL == 0 means new conformant preprocessor
|
||||
// _MSVC_TRADITIONAL == 1 means old traditional non-conformant preprocessor
|
||||
# if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL)
|
||||
# define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
# endif
|
||||
|
||||
#endif // _MSC_VER
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -150,6 +157,12 @@
|
||||
# define CATCH_INTERNAL_CONFIG_NO_WCHAR
|
||||
#endif // __DJGPP__
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Embarcadero C++Build
|
||||
#if defined(__BORLANDC__)
|
||||
#define CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Use of __COUNTER__ is suppressed during code analysis in
|
||||
@@ -231,6 +244,10 @@
|
||||
# define CATCH_CONFIG_DISABLE_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
#if defined(CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_NO_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_POLYFILL_ISNAN)
|
||||
# define CATCH_CONFIG_POLYFILL_ISNAN
|
||||
#endif
|
||||
|
||||
#if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS)
|
||||
# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS
|
||||
# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS
|
||||
@@ -254,6 +271,9 @@
|
||||
#define CATCH_CATCH_ANON(type) catch (type)
|
||||
#endif
|
||||
|
||||
#if defined(CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_NO_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR)
|
||||
#define CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#endif
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED
|
||||
|
||||
|
@@ -43,10 +43,6 @@ namespace Matchers {
|
||||
struct MatcherMethod {
|
||||
virtual bool match( ObjectT const& arg ) const = 0;
|
||||
};
|
||||
template<typename PtrT>
|
||||
struct MatcherMethod<PtrT*> {
|
||||
virtual bool match( PtrT* arg ) const = 0;
|
||||
};
|
||||
|
||||
#ifdef __clang__
|
||||
# pragma clang diagnostic pop
|
||||
|
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "catch_matchers_floating.h"
|
||||
#include "catch_enforce.h"
|
||||
#include "catch_polyfills.hpp"
|
||||
#include "catch_to_string.hpp"
|
||||
#include "catch_tostring.h"
|
||||
|
||||
@@ -57,7 +58,7 @@ template <typename FP>
|
||||
bool almostEqualUlps(FP lhs, FP rhs, int maxUlpDiff) {
|
||||
// Comparison with NaN should always be false.
|
||||
// This way we can rule it out before getting into the ugly details
|
||||
if (std::isnan(lhs) || std::isnan(rhs)) {
|
||||
if (Catch::isnan(lhs) || Catch::isnan(rhs)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -11,6 +11,7 @@
|
||||
#include "catch_uncaught_exceptions.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <stack>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
@@ -60,19 +61,48 @@ namespace Catch {
|
||||
|
||||
|
||||
Capturer::Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names ) {
|
||||
auto start = std::string::npos;
|
||||
for( size_t pos = 0; pos <= names.size(); ++pos ) {
|
||||
auto trimmed = [&] (size_t start, size_t end) {
|
||||
while (names[start] == ',' || isspace(names[start])) {
|
||||
++start;
|
||||
}
|
||||
while (names[end] == ',' || isspace(names[end])) {
|
||||
--end;
|
||||
}
|
||||
return names.substr(start, end - start + 1);
|
||||
};
|
||||
|
||||
size_t start = 0;
|
||||
std::stack<char> openings;
|
||||
for (size_t pos = 0; pos < names.size(); ++pos) {
|
||||
char c = names[pos];
|
||||
if( pos == names.size() || c == ' ' || c == '\t' || c == ',' || c == ']' ) {
|
||||
if( start != std::string::npos ) {
|
||||
m_messages.push_back( MessageInfo( macroName, lineInfo, resultType ) );
|
||||
m_messages.back().message = names.substr( start, pos-start) + " := ";
|
||||
start = std::string::npos;
|
||||
switch (c) {
|
||||
case '[':
|
||||
case '{':
|
||||
case '(':
|
||||
// It is basically impossible to disambiguate between
|
||||
// comparison and start of template args in this context
|
||||
// case '<':
|
||||
openings.push(c);
|
||||
break;
|
||||
case ']':
|
||||
case '}':
|
||||
case ')':
|
||||
// case '>':
|
||||
openings.pop();
|
||||
break;
|
||||
case ',':
|
||||
if (start != pos && openings.size() == 0) {
|
||||
m_messages.emplace_back(macroName, lineInfo, resultType);
|
||||
m_messages.back().message = trimmed(start, pos);
|
||||
m_messages.back().message += " := ";
|
||||
start = pos;
|
||||
}
|
||||
}
|
||||
else if( c != '[' && c != ']' && start == std::string::npos )
|
||||
start = pos;
|
||||
}
|
||||
assert(openings.size() == 0 && "Mismatched openings");
|
||||
m_messages.emplace_back(macroName, lineInfo, resultType);
|
||||
m_messages.back().message = trimmed(start, names.size() - 1);
|
||||
m_messages.back().message += " := ";
|
||||
}
|
||||
Capturer::~Capturer() {
|
||||
if ( !uncaught_exceptions() ){
|
||||
@@ -82,7 +112,7 @@ namespace Catch {
|
||||
}
|
||||
}
|
||||
|
||||
void Capturer::captureValue( size_t index, StringRef value ) {
|
||||
void Capturer::captureValue( size_t index, std::string const& value ) {
|
||||
assert( index < m_messages.size() );
|
||||
m_messages[index].message += value;
|
||||
m_resultCapture.pushScopedMessage( m_messages[index] );
|
||||
|
@@ -77,16 +77,16 @@ namespace Catch {
|
||||
Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names );
|
||||
~Capturer();
|
||||
|
||||
void captureValue( size_t index, StringRef value );
|
||||
void captureValue( size_t index, std::string const& value );
|
||||
|
||||
template<typename T>
|
||||
void captureValues( size_t index, T&& value ) {
|
||||
void captureValues( size_t index, T const& value ) {
|
||||
captureValue( index, Catch::Detail::stringify( value ) );
|
||||
}
|
||||
|
||||
template<typename T, typename... Ts>
|
||||
void captureValues( size_t index, T&& value, Ts&&... values ) {
|
||||
captureValues( index, value );
|
||||
void captureValues( size_t index, T const& value, Ts const&... values ) {
|
||||
captureValue( index, Catch::Detail::stringify(value) );
|
||||
captureValues( index+1, values... );
|
||||
}
|
||||
};
|
||||
|
31
include/internal/catch_polyfills.cpp
Normal file
31
include/internal/catch_polyfills.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Created by Martin on 17/11/2017.
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#include "catch_polyfills.hpp"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
#if !defined(CATCH_CONFIG_POLYFILL_ISNAN)
|
||||
bool isnan(float f) {
|
||||
return std::isnan(f);
|
||||
}
|
||||
bool isnan(double d) {
|
||||
return std::isnan(d);
|
||||
}
|
||||
#else
|
||||
// For now we only use this for embarcadero
|
||||
bool isnan(float f) {
|
||||
return std::_isnan(f);
|
||||
}
|
||||
bool isnan(double d) {
|
||||
return std::_isnan(d);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // end namespace Catch
|
15
include/internal/catch_polyfills.hpp
Normal file
15
include/internal/catch_polyfills.hpp
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Created by Martin on 17/11/2017.
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef TWOBLUECUBES_CATCH_POLYFILLS_HPP_INCLUDED
|
||||
#define TWOBLUECUBES_CATCH_POLYFILLS_HPP_INCLUDED
|
||||
|
||||
namespace Catch {
|
||||
bool isnan(float f);
|
||||
bool isnan(double d);
|
||||
}
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_POLYFILLS_HPP_INCLUDED
|
74
include/internal/catch_preprocessor.hpp
Normal file
74
include/internal/catch_preprocessor.hpp
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Created by Jozef on 12/11/2018.
|
||||
* Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef TWOBLUECUBES_CATCH_PREPROCESSOR_HPP_INCLUDED
|
||||
#define TWOBLUECUBES_CATCH_PREPROCESSOR_HPP_INCLUDED
|
||||
|
||||
#define CATCH_RECURSION_LEVEL0(...) __VA_ARGS__
|
||||
#define CATCH_RECURSION_LEVEL1(...) CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(__VA_ARGS__)))
|
||||
#define CATCH_RECURSION_LEVEL2(...) CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(__VA_ARGS__)))
|
||||
#define CATCH_RECURSION_LEVEL3(...) CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(__VA_ARGS__)))
|
||||
#define CATCH_RECURSION_LEVEL4(...) CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(__VA_ARGS__)))
|
||||
#define CATCH_RECURSION_LEVEL5(...) CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(__VA_ARGS__)))
|
||||
|
||||
#ifdef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define INTERNAL_CATCH_EXPAND_VARGS(...) __VA_ARGS__
|
||||
// MSVC needs more evaluations
|
||||
#define CATCH_RECURSION_LEVEL6(...) CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(__VA_ARGS__)))
|
||||
#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL6(CATCH_RECURSION_LEVEL6(__VA_ARGS__))
|
||||
#else
|
||||
#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL5(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#define CATCH_REC_END(...)
|
||||
#define CATCH_REC_OUT
|
||||
|
||||
#define CATCH_EMPTY()
|
||||
#define CATCH_DEFER(id) id CATCH_EMPTY()
|
||||
|
||||
#define CATCH_REC_GET_END2() 0, CATCH_REC_END
|
||||
#define CATCH_REC_GET_END1(...) CATCH_REC_GET_END2
|
||||
#define CATCH_REC_GET_END(...) CATCH_REC_GET_END1
|
||||
#define CATCH_REC_NEXT0(test, next, ...) next CATCH_REC_OUT
|
||||
#define CATCH_REC_NEXT1(test, next) CATCH_DEFER ( CATCH_REC_NEXT0 ) ( test, next, 0)
|
||||
#define CATCH_REC_NEXT(test, next) CATCH_REC_NEXT1(CATCH_REC_GET_END test, next)
|
||||
|
||||
#define CATCH_REC_LIST0(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ )
|
||||
#define CATCH_REC_LIST1(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0) ) ( f, peek, __VA_ARGS__ )
|
||||
#define CATCH_REC_LIST2(f, x, peek, ...) f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ )
|
||||
|
||||
#define CATCH_REC_LIST0_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ )
|
||||
#define CATCH_REC_LIST1_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0_UD) ) ( f, userdata, peek, __VA_ARGS__ )
|
||||
#define CATCH_REC_LIST2_UD(f, userdata, x, peek, ...) f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ )
|
||||
|
||||
// Applies the function macro `f` to each of the remaining parameters, inserts commas between the results,
|
||||
// and passes userdata as the first parameter to each invocation,
|
||||
// e.g. CATCH_REC_LIST_UD(f, x, a, b, c) evaluates to f(x, a), f(x, b), f(x, c)
|
||||
#define CATCH_REC_LIST_UD(f, userdata, ...) CATCH_RECURSE(CATCH_REC_LIST2_UD(f, userdata, __VA_ARGS__, ()()(), ()()(), ()()(), 0))
|
||||
|
||||
#define CATCH_REC_LIST(f, ...) CATCH_RECURSE(CATCH_REC_LIST2(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0))
|
||||
|
||||
#define INTERNAL_CATCH_EXPAND1(param) INTERNAL_CATCH_EXPAND2(param)
|
||||
#define INTERNAL_CATCH_EXPAND2(...) INTERNAL_CATCH_NO## __VA_ARGS__
|
||||
#define INTERNAL_CATCH_DEF(...) INTERNAL_CATCH_DEF __VA_ARGS__
|
||||
#define INTERNAL_CATCH_NOINTERNAL_CATCH_DEF
|
||||
|
||||
#define INTERNAL_CATCH_REMOVE_PARENS(...) INTERNAL_CATCH_EXPAND1(INTERNAL_CATCH_DEF __VA_ARGS__)
|
||||
|
||||
#define INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME2(Name, ...) INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME3(Name, __VA_ARGS__)
|
||||
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME3(Name,...) Name " - " #__VA_ARGS__
|
||||
#define INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME(Name,...) INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME2(Name, INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__))
|
||||
#else
|
||||
// MSVC is adding extra space and needs more calls to properly remove ()
|
||||
#define INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME3(Name,...) Name " -" #__VA_ARGS__
|
||||
#define INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME1(Name, ...) INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME2(Name, __VA_ARGS__)
|
||||
#define INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME(Name, ...) INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME1(Name, INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__)))
|
||||
#endif
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_PREPROCESSOR_HPP_INCLUDED
|
@@ -54,8 +54,6 @@ namespace Catch {
|
||||
|
||||
|
||||
Catch::Totals runTests(std::shared_ptr<Config> const& config) {
|
||||
// FixMe: Add listeners in order first, then add reporters.
|
||||
|
||||
auto reporter = makeReporter(config);
|
||||
|
||||
RunContext context(config, std::move(reporter));
|
||||
|
@@ -12,6 +12,8 @@
|
||||
#include "catch_interfaces_testcase.h"
|
||||
#include "catch_compiler_capabilities.h"
|
||||
#include "catch_stringref.h"
|
||||
#include "catch_type_traits.hpp"
|
||||
#include "catch_preprocessor.hpp"
|
||||
|
||||
namespace Catch {
|
||||
|
||||
@@ -47,22 +49,28 @@ struct AutoReg : NonCopyable {
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
#define INTERNAL_CATCH_EXPAND1(param) INTERNAL_CATCH_EXPAND2(param)
|
||||
#define INTERNAL_CATCH_EXPAND2(...) INTERNAL_CATCH_NO## __VA_ARGS__
|
||||
#define INTERNAL_CATCH_DEF(...) INTERNAL_CATCH_DEF __VA_ARGS__
|
||||
#define INTERNAL_CATCH_NOINTERNAL_CATCH_DEF
|
||||
|
||||
#if defined(CATCH_CONFIG_DISABLE)
|
||||
#define INTERNAL_CATCH_TESTCASE_NO_REGISTRATION( TestName, ... ) \
|
||||
static void TestName()
|
||||
#define INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION( TestName, ClassName, ... ) \
|
||||
namespace{ \
|
||||
struct TestName : INTERNAL_CATCH_EXPAND1(INTERNAL_CATCH_DEF ClassName) { \
|
||||
struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) { \
|
||||
void test(); \
|
||||
}; \
|
||||
} \
|
||||
void TestName::test()
|
||||
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION( TestName, ... ) \
|
||||
template<typename TestType> \
|
||||
static void TestName()
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION( TestName, ClassName, ... ) \
|
||||
namespace{ \
|
||||
template<typename TestType> \
|
||||
struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName <TestType>) { \
|
||||
void test(); \
|
||||
}; \
|
||||
} \
|
||||
template<typename TestType> \
|
||||
void TestName::test()
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -85,7 +93,7 @@ struct AutoReg : NonCopyable {
|
||||
#define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\
|
||||
CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
|
||||
namespace{ \
|
||||
struct TestName : INTERNAL_CATCH_EXPAND1(INTERNAL_CATCH_DEF ClassName) { \
|
||||
struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) { \
|
||||
void test(); \
|
||||
}; \
|
||||
Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( Catch::makeTestInvoker( &TestName::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \
|
||||
@@ -101,5 +109,75 @@ struct AutoReg : NonCopyable {
|
||||
Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( Function ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \
|
||||
CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_2(TestName, TestFunc, Name, Tags, ... )\
|
||||
CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
|
||||
template<typename TestType> \
|
||||
static void TestFunc();\
|
||||
namespace {\
|
||||
template<typename...Types> \
|
||||
struct TestName{\
|
||||
template<typename...Ts> \
|
||||
TestName(Ts...names){\
|
||||
CATCH_INTERNAL_CHECK_UNIQUE_TYPES(CATCH_REC_LIST(INTERNAL_CATCH_REMOVE_PARENS, __VA_ARGS__)) \
|
||||
using expander = int[];\
|
||||
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFunc<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ names, Tags } ), 0)... };/* NOLINT */ \
|
||||
}\
|
||||
};\
|
||||
INTERNAL_CATCH_TEMPLATE_REGISTRY_INITIATE(TestName, Name, __VA_ARGS__) \
|
||||
}\
|
||||
CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
|
||||
template<typename TestType> \
|
||||
static void TestFunc()
|
||||
|
||||
#if defined(CATCH_CPP17_OR_GREATER)
|
||||
#define CATCH_INTERNAL_CHECK_UNIQUE_TYPES(...) static_assert(Catch::is_unique<__VA_ARGS__>,"Duplicate type detected in declaration of template test case");
|
||||
#else
|
||||
#define CATCH_INTERNAL_CHECK_UNIQUE_TYPES(...) static_assert(Catch::is_unique<__VA_ARGS__>::value,"Duplicate type detected in declaration of template test case");
|
||||
#endif
|
||||
|
||||
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \
|
||||
INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, __VA_ARGS__ )
|
||||
#else
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \
|
||||
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, __VA_ARGS__ ) )
|
||||
#endif
|
||||
|
||||
#define INTERNAL_CATCH_TEMPLATE_REGISTRY_INITIATE(TestName, Name, ...)\
|
||||
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
|
||||
TestName<CATCH_REC_LIST(INTERNAL_CATCH_REMOVE_PARENS, __VA_ARGS__)>(CATCH_REC_LIST_UD(INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME,Name, __VA_ARGS__));\
|
||||
return 0;\
|
||||
}();
|
||||
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, ... ) \
|
||||
CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
|
||||
namespace{ \
|
||||
template<typename TestType> \
|
||||
struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName <TestType>) { \
|
||||
void test();\
|
||||
};\
|
||||
template<typename...Types> \
|
||||
struct TestNameClass{\
|
||||
template<typename...Ts> \
|
||||
TestNameClass(Ts...names){\
|
||||
CATCH_INTERNAL_CHECK_UNIQUE_TYPES(CATCH_REC_LIST(INTERNAL_CATCH_REMOVE_PARENS, __VA_ARGS__)) \
|
||||
using expander = int[];\
|
||||
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ names, Tags } ), 0)... };/* NOLINT */ \
|
||||
}\
|
||||
};\
|
||||
INTERNAL_CATCH_TEMPLATE_REGISTRY_INITIATE(TestNameClass, Name, __VA_ARGS__)\
|
||||
}\
|
||||
CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS\
|
||||
template<typename TestType> \
|
||||
void TestName<TestType>::test()
|
||||
|
||||
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \
|
||||
INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, __VA_ARGS__ )
|
||||
#else
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \
|
||||
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, __VA_ARGS__ ) )
|
||||
#endif
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_TEST_REGISTRY_HPP_INCLUDED
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include "catch_tostring.h"
|
||||
#include "catch_interfaces_config.h"
|
||||
#include "catch_context.h"
|
||||
#include "catch_polyfills.hpp"
|
||||
|
||||
#include <cmath>
|
||||
#include <iomanip>
|
||||
@@ -68,7 +69,7 @@ namespace Detail {
|
||||
|
||||
template<typename T>
|
||||
std::string fpToString( T value, int precision ) {
|
||||
if (std::isnan(value)) {
|
||||
if (Catch::isnan(value)) {
|
||||
return "nan";
|
||||
}
|
||||
|
||||
|
38
include/internal/catch_type_traits.hpp
Normal file
38
include/internal/catch_type_traits.hpp
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Created by Jozef on 12/11/2018.
|
||||
* Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef TWOBLUECUBES_CATCH_TYPE_TRAITS_HPP_INCLUDED
|
||||
#define TWOBLUECUBES_CATCH_TYPE_TRAITS_HPP_INCLUDED
|
||||
|
||||
namespace Catch{
|
||||
|
||||
#ifdef CATCH_CPP17_OR_GREATER
|
||||
template <typename...>
|
||||
inline constexpr auto is_unique = std::true_type{};
|
||||
|
||||
template <typename T, typename... Rest>
|
||||
inline constexpr auto is_unique<T, Rest...> = std::bool_constant<
|
||||
(!std::is_same_v<T, Rest> && ...) && is_unique<Rest...>
|
||||
>{};
|
||||
#else
|
||||
|
||||
template <typename...>
|
||||
struct is_unique : std::true_type{};
|
||||
|
||||
template <typename T0, typename T1, typename... Rest>
|
||||
struct is_unique<T0, T1, Rest...> : std::integral_constant
|
||||
<bool,
|
||||
!std::is_same<T0, T1>::value
|
||||
&& is_unique<T0, Rest...>::value
|
||||
&& is_unique<T1, Rest...>::value
|
||||
>{};
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_TYPE_TRAITS_HPP_INCLUDED
|
@@ -37,7 +37,7 @@ namespace Catch {
|
||||
}
|
||||
|
||||
Version const& libraryVersion() {
|
||||
static Version version( 2, 4, 2, "", 0 );
|
||||
static Version version( 2, 5, 0, "", 0 );
|
||||
return version;
|
||||
}
|
||||
|
||||
|
@@ -30,7 +30,7 @@ namespace Catch {
|
||||
// + 1 for null terminator
|
||||
const std::size_t maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1;
|
||||
char buffer[maxDoubleSize];
|
||||
|
||||
|
||||
// Save previous errno, to prevent sprintf from overwriting it
|
||||
ErrnoGuard guard;
|
||||
#ifdef _MSC_VER
|
||||
@@ -45,6 +45,10 @@ namespace Catch {
|
||||
TestEventListenerBase::TestEventListenerBase(ReporterConfig const & _config)
|
||||
:StreamingReporterBase(_config) {}
|
||||
|
||||
std::set<Verbosity> TestEventListenerBase::getSupportedVerbosities() {
|
||||
return { Verbosity::Quiet, Verbosity::Normal, Verbosity::High };
|
||||
}
|
||||
|
||||
void TestEventListenerBase::assertionStarting(AssertionInfo const &) {}
|
||||
|
||||
bool TestEventListenerBase::assertionEnded(AssertionStats const &) {
|
||||
|
@@ -217,7 +217,7 @@ namespace Catch {
|
||||
node->children.push_back(m_rootSection);
|
||||
m_testCases.push_back(node);
|
||||
m_rootSection.reset();
|
||||
|
||||
|
||||
assert(m_deepestSection);
|
||||
m_deepestSection->stdOut = testCaseStats.stdOut;
|
||||
m_deepestSection->stdErr = testCaseStats.stdErr;
|
||||
@@ -266,6 +266,8 @@ namespace Catch {
|
||||
struct TestEventListenerBase : StreamingReporterBase<TestEventListenerBase> {
|
||||
TestEventListenerBase( ReporterConfig const& _config );
|
||||
|
||||
static std::set<Verbosity> getSupportedVerbosities();
|
||||
|
||||
void assertionStarting(AssertionInfo const&) override;
|
||||
bool assertionEnded(AssertionStats const&) override;
|
||||
};
|
||||
|
@@ -111,8 +111,6 @@ public:
|
||||
void print() const {
|
||||
printSourceInfo();
|
||||
if (stats.totals.assertions.total() > 0) {
|
||||
if (result.isOk())
|
||||
stream << '\n';
|
||||
printResultType();
|
||||
printOriginalExpression();
|
||||
printReconstructedExpression();
|
||||
|
@@ -123,6 +123,8 @@ set(INTERNAL_HEADERS
|
||||
${HEADER_DIR}/internal/catch_option.hpp
|
||||
${HEADER_DIR}/internal/catch_output_redirect.h
|
||||
${HEADER_DIR}/internal/catch_platform.h
|
||||
${HEADER_DIR}/internal/catch_polyfills.hpp
|
||||
${HEADER_DIR}/internal/catch_preprocessor.hpp
|
||||
${HEADER_DIR}/internal/catch_random_number_generator.h
|
||||
${HEADER_DIR}/internal/catch_reenable_warnings.h
|
||||
${HEADER_DIR}/internal/catch_reporter_registrars.hpp
|
||||
@@ -153,6 +155,7 @@ set(INTERNAL_HEADERS
|
||||
${HEADER_DIR}/internal/catch_to_string.hpp
|
||||
${HEADER_DIR}/internal/catch_tostring.h
|
||||
${HEADER_DIR}/internal/catch_totals.h
|
||||
${HEADER_DIR}/internal/catch_type_traits.hpp
|
||||
${HEADER_DIR}/internal/catch_uncaught_exceptions.h
|
||||
${HEADER_DIR}/internal/catch_user_interfaces.h
|
||||
${HEADER_DIR}/internal/catch_version.h
|
||||
@@ -196,6 +199,7 @@ set(IMPL_SOURCES
|
||||
${HEADER_DIR}/internal/catch_output_redirect.cpp
|
||||
${HEADER_DIR}/internal/catch_registry_hub.cpp
|
||||
${HEADER_DIR}/internal/catch_interfaces_reporter.cpp
|
||||
${HEADER_DIR}/internal/catch_polyfills.cpp
|
||||
${HEADER_DIR}/internal/catch_random_number_generator.cpp
|
||||
${HEADER_DIR}/internal/catch_reporter_registry.cpp
|
||||
${HEADER_DIR}/internal/catch_result_type.cpp
|
||||
@@ -303,7 +307,7 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
endif()
|
||||
if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" )
|
||||
STRING(REGEX REPLACE "/W[0-9]" "/W4" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # override default warning level
|
||||
target_compile_options( SelfTest PRIVATE /w44265 /w44061 /w44062 )
|
||||
target_compile_options( SelfTest PRIVATE /w44265 /w44061 /w44062 /w45038 )
|
||||
if (CATCH_ENABLE_WERROR)
|
||||
target_compile_options( SelfTest PRIVATE /WX)
|
||||
endif()
|
||||
|
@@ -159,6 +159,12 @@ Generators.tests.cpp:<line number>: passed: x < y for: 10 < 109
|
||||
Generators.tests.cpp:<line number>: passed: x < y for: 10 < 110
|
||||
Class.tests.cpp:<line number>: failed: s == "world" for: "hello" == "world"
|
||||
Class.tests.cpp:<line number>: passed: s == "hello" for: "hello" == "hello"
|
||||
Class.tests.cpp:<line number>: failed: Template_Fixture<TestType>::m_a == 2 for: 1.0 == 2
|
||||
Class.tests.cpp:<line number>: failed: Template_Fixture<TestType>::m_a == 2 for: 1.0f == 2
|
||||
Class.tests.cpp:<line number>: failed: Template_Fixture<TestType>::m_a == 2 for: 1 == 2
|
||||
Class.tests.cpp:<line number>: passed: Template_Fixture<TestType>::m_a == 1 for: 1.0 == 1
|
||||
Class.tests.cpp:<line number>: passed: Template_Fixture<TestType>::m_a == 1 for: 1.0f == 1
|
||||
Class.tests.cpp:<line number>: passed: Template_Fixture<TestType>::m_a == 1 for: 1 == 1
|
||||
Class.tests.cpp:<line number>: failed: m_a == 2 for: 1 == 2
|
||||
Class.tests.cpp:<line number>: passed: m_a == 1 for: 1 == 1
|
||||
Approx.tests.cpp:<line number>: passed: d == 1.23_a for: 1.23 == Approx( 1.23 )
|
||||
@@ -222,6 +228,8 @@ Approx.tests.cpp:<line number>: passed: NAN != Approx(NAN) for: nanf != Approx(
|
||||
Approx.tests.cpp:<line number>: passed: !(NAN == Approx(NAN)) for: !(nanf == Approx( nan ))
|
||||
Tricky.tests.cpp:<line number>: passed: y.v == 0 for: 0 == 0
|
||||
Tricky.tests.cpp:<line number>: passed: 0 == y.v for: 0 == 0
|
||||
Message.tests.cpp:<line number>: passed: with 7 messages: 'a := 1' and 'b := 2' and 'c := 3' and 'a + b := 3' and 'a+b := 3' and 'c > b := true' and 'a == 1 := true'
|
||||
Message.tests.cpp:<line number>: passed: with 7 messages: 'std::vector<int>{1, 2, 3}[0, 1, 2] := 3' and 'std::vector<int>{1, 2, 3}[(0, 1)] := 2' and 'std::vector<int>{1, 2, 3}[0] := 1' and '(helper_1436<int, int>{12, -12}) := { 12, -12 }' and '(helper_1436<int, int>(-12, 12)) := { -12, 12 }' and '(1, 2) := 2' and '(2, 3) := 3'
|
||||
ToStringGeneral.tests.cpp:<line number>: passed: true with 1 message: 'i := 2'
|
||||
ToStringGeneral.tests.cpp:<line number>: passed: true with 1 message: '3'
|
||||
ToStringGeneral.tests.cpp:<line number>: passed: tab == '\t' for: '\t' == '\t'
|
||||
@@ -679,6 +687,7 @@ Condition.tests.cpp:<line number>: passed: cpc != 0 for: 0x<hex digits> != 0
|
||||
Condition.tests.cpp:<line number>: passed: returnsNull() == 0 for: {null string} == 0
|
||||
Condition.tests.cpp:<line number>: passed: returnsConstNull() == 0 for: {null string} == 0
|
||||
Condition.tests.cpp:<line number>: passed: 0 != p for: 0 != 0x<hex digits>
|
||||
Matchers.tests.cpp:<line number>: passed: "foo", Predicate<const char*>([] (const char* const&) { return true; }) for: "foo" matches undescribed predicate
|
||||
CmdLine.tests.cpp:<line number>: passed: result for: {?}
|
||||
CmdLine.tests.cpp:<line number>: passed: config.processName == "" for: "" == ""
|
||||
CmdLine.tests.cpp:<line number>: passed: result for: {?}
|
||||
@@ -870,6 +879,74 @@ TagAlias.tests.cpp:<line number>: passed: registry.add( "[no ampersat]", "", Cat
|
||||
TagAlias.tests.cpp:<line number>: passed: registry.add( "[the @ is not at the start]", "", Catch::SourceLineInfo( "file", 3 ) )
|
||||
TagAlias.tests.cpp:<line number>: passed: registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) )
|
||||
TagAlias.tests.cpp:<line number>: passed: registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) )
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 10 for: 10 == 10
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 10 for: 10 >= 10
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 0 for: 0 == 0
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() == 0 for: 0 == 0
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 10 for: 10 >= 10
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 10 for: 10 == 10
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 10 for: 10 >= 10
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 0 for: 0 == 0
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() == 0 for: 0 == 0
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 10 for: 10 >= 10
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 10 for: 10 == 10
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 10 for: 10 >= 10
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 0 for: 0 == 0
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() == 0 for: 0 == 0
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 10 for: 10 >= 10
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 10 for: 10 == 10
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 10 for: 10 >= 10
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 0 for: 0 == 0
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() == 0 for: 0 == 0
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 10 for: 10 >= 10
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
|
||||
Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
|
||||
VariadicMacros.tests.cpp:<line number>: passed: with 1 message: 'no assertions'
|
||||
Tricky.tests.cpp:<line number>: passed: 0x<hex digits> == bit30and31 for: 3221225472 (0x<hex digits>) == 3221225472
|
||||
Message.tests.cpp:<line number>: failed - but was ok: 1 == 2
|
||||
@@ -1312,5 +1389,5 @@ Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5
|
||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
|
||||
Misc.tests.cpp:<line number>: passed:
|
||||
Misc.tests.cpp:<line number>: passed:
|
||||
Failed 62 test cases, failed 122 assertions.
|
||||
Failed 65 test cases, failed 125 assertions.
|
||||
|
||||
|
@@ -92,6 +92,39 @@ Class.tests.cpp:<line number>: FAILED:
|
||||
with expansion:
|
||||
"hello" == "world"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
A TEMPLATE_TEST_CASE_METHOD based test run that fails - double
|
||||
-------------------------------------------------------------------------------
|
||||
Class.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Class.tests.cpp:<line number>: FAILED:
|
||||
REQUIRE( Template_Fixture<TestType>::m_a == 2 )
|
||||
with expansion:
|
||||
1.0 == 2
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
A TEMPLATE_TEST_CASE_METHOD based test run that fails - float
|
||||
-------------------------------------------------------------------------------
|
||||
Class.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Class.tests.cpp:<line number>: FAILED:
|
||||
REQUIRE( Template_Fixture<TestType>::m_a == 2 )
|
||||
with expansion:
|
||||
1.0f == 2
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
A TEMPLATE_TEST_CASE_METHOD based test run that fails - int
|
||||
-------------------------------------------------------------------------------
|
||||
Class.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Class.tests.cpp:<line number>: FAILED:
|
||||
REQUIRE( Template_Fixture<TestType>::m_a == 2 )
|
||||
with expansion:
|
||||
1 == 2
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
A TEST_CASE_METHOD based test run that fails
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -392,8 +425,7 @@ Message.tests.cpp:<line number>: FAILED:
|
||||
explicitly with message:
|
||||
This is a failure
|
||||
|
||||
Message.tests.cpp:<line number>:
|
||||
warning:
|
||||
Message.tests.cpp:<line number>: warning:
|
||||
This message appears in the output
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -402,8 +434,7 @@ INFO and WARN do not abort tests
|
||||
Message.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Message.tests.cpp:<line number>:
|
||||
warning:
|
||||
Message.tests.cpp:<line number>: warning:
|
||||
this is a warning
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -528,8 +559,7 @@ Nice descriptive name
|
||||
Misc.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Misc.tests.cpp:<line number>:
|
||||
warning:
|
||||
Misc.tests.cpp:<line number>: warning:
|
||||
This one ran
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -909,8 +939,7 @@ Where the LHS is not a simple value
|
||||
Tricky.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Tricky.tests.cpp:<line number>:
|
||||
warning:
|
||||
Tricky.tests.cpp:<line number>: warning:
|
||||
Uncomment the code in this test to check that it gives a sensible compiler
|
||||
error
|
||||
|
||||
@@ -920,8 +949,7 @@ Where there is more to the expression after the RHS
|
||||
Tricky.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Tricky.tests.cpp:<line number>:
|
||||
warning:
|
||||
Tricky.tests.cpp:<line number>: warning:
|
||||
Uncomment the code in this test to check that it gives a sensible compiler
|
||||
error
|
||||
|
||||
@@ -1098,6 +1126,6 @@ due to unexpected exception with message:
|
||||
Why would you throw a std::string?
|
||||
|
||||
===============================================================================
|
||||
test cases: 215 | 162 passed | 49 failed | 4 failed as expected
|
||||
assertions: 1233 | 1104 passed | 108 failed | 21 failed as expected
|
||||
test cases: 228 | 172 passed | 52 failed | 4 failed as expected
|
||||
assertions: 1310 | 1178 passed | 111 failed | 21 failed as expected
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -11,8 +11,7 @@ Randomness seeded to: 1
|
||||
Misc.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Misc.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Misc.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
yay
|
||||
|
||||
@@ -23,14 +22,12 @@ with message:
|
||||
Decomposition.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Decomposition.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Decomposition.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( fptr == 0 )
|
||||
with expansion:
|
||||
0 == 0
|
||||
|
||||
Decomposition.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Decomposition.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( fptr == 0l )
|
||||
with expansion:
|
||||
0 == 0
|
||||
@@ -41,14 +38,12 @@ with expansion:
|
||||
Compilation.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Compilation.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Compilation.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( y.v == 0 )
|
||||
with expansion:
|
||||
0 == 0
|
||||
|
||||
Compilation.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Compilation.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( 0 == y.v )
|
||||
with expansion:
|
||||
0 == 0
|
||||
@@ -59,38 +54,32 @@ with expansion:
|
||||
Compilation.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Compilation.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Compilation.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( t1 == t2 )
|
||||
with expansion:
|
||||
{?} == {?}
|
||||
|
||||
Compilation.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Compilation.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( t1 != t2 )
|
||||
with expansion:
|
||||
{?} != {?}
|
||||
|
||||
Compilation.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Compilation.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( t1 < t2 )
|
||||
with expansion:
|
||||
{?} < {?}
|
||||
|
||||
Compilation.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Compilation.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( t1 > t2 )
|
||||
with expansion:
|
||||
{?} > {?}
|
||||
|
||||
Compilation.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Compilation.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( t1 <= t2 )
|
||||
with expansion:
|
||||
{?} <= {?}
|
||||
|
||||
Compilation.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Compilation.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( t1 >= t2 )
|
||||
with expansion:
|
||||
{?} >= {?}
|
||||
@@ -101,8 +90,7 @@ with expansion:
|
||||
Misc.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Misc.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Misc.tests.cpp:<line number>: PASSED:
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1238
|
||||
@@ -110,8 +98,7 @@ PASSED:
|
||||
Compilation.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Compilation.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Compilation.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( std::memcmp(uarr, "123", sizeof(uarr)) == 0 )
|
||||
with expansion:
|
||||
0 == 0
|
||||
@@ -119,8 +106,7 @@ with messages:
|
||||
uarr := "123"
|
||||
sarr := "456"
|
||||
|
||||
Compilation.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Compilation.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( std::memcmp(sarr, "456", sizeof(sarr)) == 0 )
|
||||
with expansion:
|
||||
0 == 0
|
||||
@@ -134,8 +120,7 @@ with messages:
|
||||
Compilation.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Compilation.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Compilation.tests.cpp:<line number>: PASSED:
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1403
|
||||
@@ -143,8 +128,7 @@ PASSED:
|
||||
Compilation.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Compilation.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Compilation.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( h1 == h2 )
|
||||
with expansion:
|
||||
[1403 helper] == [1403 helper]
|
||||
@@ -181,8 +165,7 @@ due to unexpected exception with messages:
|
||||
Exception.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Exception.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Exception.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE_THROWS( thisThrows() )
|
||||
with message:
|
||||
answer := 42
|
||||
@@ -193,8 +176,7 @@ with message:
|
||||
Compilation.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Compilation.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Compilation.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( 42 == f )
|
||||
with expansion:
|
||||
42 == {?}
|
||||
@@ -205,38 +187,31 @@ with expansion:
|
||||
Compilation.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Compilation.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Compilation.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( a == t )
|
||||
with expansion:
|
||||
3 == 3
|
||||
|
||||
Compilation.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Compilation.tests.cpp:<line number>: PASSED:
|
||||
CHECK( a == t )
|
||||
with expansion:
|
||||
3 == 3
|
||||
|
||||
Compilation.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Compilation.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE_THROWS( throws_int(true) )
|
||||
|
||||
Compilation.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Compilation.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THROWS_AS( throws_int(true), int )
|
||||
|
||||
Compilation.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Compilation.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE_NOTHROW( throws_int(false) )
|
||||
|
||||
Compilation.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Compilation.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE_THAT( "aaa", Catch::EndsWith("aaa") )
|
||||
with expansion:
|
||||
"aaa" ends with: "aaa"
|
||||
|
||||
Compilation.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Compilation.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( templated_tests<int>(3) )
|
||||
with expansion:
|
||||
true
|
||||
@@ -252,8 +227,7 @@ Misc.tests.cpp:<line number>: FAILED:
|
||||
with expansion:
|
||||
1 == 0
|
||||
|
||||
Misc.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Misc.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( errno == 1 )
|
||||
with expansion:
|
||||
1 == 1
|
||||
@@ -264,8 +238,7 @@ with expansion:
|
||||
Compilation.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Compilation.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Compilation.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( x == 4 )
|
||||
with expansion:
|
||||
{?} == 4
|
||||
@@ -279,8 +252,7 @@ with message:
|
||||
Misc.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Misc.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Misc.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
Everything is OK
|
||||
|
||||
@@ -291,8 +263,7 @@ with message:
|
||||
Misc.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Misc.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Misc.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
Everything is OK
|
||||
|
||||
@@ -303,8 +274,7 @@ with message:
|
||||
Misc.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Misc.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Misc.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
Everything is OK
|
||||
|
||||
@@ -315,8 +285,7 @@ with message:
|
||||
Misc.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Misc.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Misc.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
Everything is OK
|
||||
|
||||
@@ -327,8 +296,7 @@ with message:
|
||||
Misc.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Misc.tests.cpp:<line number>:
|
||||
PASSED:
|
||||
Misc.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
Everything is OK
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuitesloose text artifact
|
||||
>
|
||||
<testsuite name="<exe-name>" errors="17" failures="106" tests="1248" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||
<testsuite name="<exe-name>" errors="17" failures="109" tests="1325" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||
<testcase classname="<exe-name>.global" name="# A test name that starts with a #" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="#1005: Comparing pointer to int and long (NULL can be either on various systems)" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="#1027" time="{duration}"/>
|
||||
@@ -77,6 +77,24 @@ Class.tests.cpp:<line number>
|
||||
</failure>
|
||||
</testcase>
|
||||
<testcase classname="<exe-name>.TestClass" name="A METHOD_AS_TEST_CASE based test run that succeeds" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.Template_Fixture" name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - double" time="{duration}">
|
||||
<failure message="1.0 == 2" type="REQUIRE">
|
||||
Class.tests.cpp:<line number>
|
||||
</failure>
|
||||
</testcase>
|
||||
<testcase classname="<exe-name>.Template_Fixture" name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - float" time="{duration}">
|
||||
<failure message="1.0f == 2" type="REQUIRE">
|
||||
Class.tests.cpp:<line number>
|
||||
</failure>
|
||||
</testcase>
|
||||
<testcase classname="<exe-name>.Template_Fixture" name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - int" time="{duration}">
|
||||
<failure message="1 == 2" type="REQUIRE">
|
||||
Class.tests.cpp:<line number>
|
||||
</failure>
|
||||
</testcase>
|
||||
<testcase classname="<exe-name>.Template_Fixture" name="A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - double" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.Template_Fixture" name="A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - float" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.Template_Fixture" name="A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - int" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.Fixture" name="A TEST_CASE_METHOD based test run that fails" time="{duration}">
|
||||
<failure message="1 == 2" type="REQUIRE">
|
||||
Class.tests.cpp:<line number>
|
||||
@@ -123,6 +141,8 @@ Exception.tests.cpp:<line number>
|
||||
<testcase classname="<exe-name>.global" name="Assertions then sections/A section/Another other section" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Assorted miscellaneous tests" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Bitfields can be captured (#1027)" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="CAPTURE can deal with complex expressions" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="CAPTURE can deal with complex expressions involving commas" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Capture and info messages/Capture should stringify like assertions" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Capture and info messages/Info should NOT stringify the way assertions do" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Character pretty printing/Specifically escaped" time="{duration}"/>
|
||||
@@ -480,6 +500,7 @@ Message.tests.cpp:<line number>
|
||||
<testcase classname="<exe-name>.global" name="Parse test names and tags/empty quoted name" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Parse test names and tags/quoted string followed by tag exclusion" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Pointers can be compared to null" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Predicate matcher can accept const char*" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Process can be configured on command line/empty args don't cause a crash" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Process can be configured on command line/default - no arguments" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Process can be configured on command line/test lists/Specify one test case using" time="{duration}"/>
|
||||
@@ -595,6 +616,30 @@ Misc.tests.cpp:<line number>
|
||||
</testcase>
|
||||
<testcase classname="<exe-name>.global" name="Tag alias can be registered against tag patterns/The same tag alias can only be registered once" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Tag alias can be registered against tag patterns/Tag aliases must be of the form [@name]" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - float" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - float/resizing bigger changes size and capacity" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - float/resizing smaller changes size but not capacity" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - float/resizing smaller changes size but not capacity/We can use the 'swap trick' to reset the capacity" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - float/reserving bigger changes capacity but not size" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - float/reserving smaller does not change size or capacity" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - int" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - int/resizing bigger changes size and capacity" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - int/resizing smaller changes size but not capacity" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - int/resizing smaller changes size but not capacity/We can use the 'swap trick' to reset the capacity" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - int/reserving bigger changes capacity but not size" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - int/reserving smaller does not change size or capacity" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - std::string" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - std::string/resizing bigger changes size and capacity" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - std::string/resizing smaller changes size but not capacity" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - std::string/resizing smaller changes size but not capacity/We can use the 'swap trick' to reset the capacity" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - std::string/reserving bigger changes capacity but not size" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - std::string/reserving smaller does not change size or capacity" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - std::tuple<int,float>" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - std::tuple<int,float>/resizing bigger changes size and capacity" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - std::tuple<int,float>/resizing smaller changes size but not capacity" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - std::tuple<int,float>/resizing smaller changes size but not capacity/We can use the 'swap trick' to reset the capacity" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - std::tuple<int,float>/reserving bigger changes capacity but not size" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - std::tuple<int,float>/reserving smaller does not change size or capacity" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Test case with one argument" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="Test enum bit values" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="The NO_FAIL macro reports a failure but does not fail the test" time="{duration}"/>
|
||||
|
@@ -1347,6 +1347,72 @@
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - double" tags="[.][class][failing][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" >
|
||||
<Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" >
|
||||
<Original>
|
||||
Template_Fixture<TestType>::m_a == 2
|
||||
</Original>
|
||||
<Expanded>
|
||||
1.0 == 2
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - float" tags="[.][class][failing][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" >
|
||||
<Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" >
|
||||
<Original>
|
||||
Template_Fixture<TestType>::m_a == 2
|
||||
</Original>
|
||||
<Expanded>
|
||||
1.0f == 2
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - int" tags="[.][class][failing][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" >
|
||||
<Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" >
|
||||
<Original>
|
||||
Template_Fixture<TestType>::m_a == 2
|
||||
</Original>
|
||||
<Expanded>
|
||||
1 == 2
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - double" tags="[class][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" >
|
||||
<Original>
|
||||
Template_Fixture<TestType>::m_a == 1
|
||||
</Original>
|
||||
<Expanded>
|
||||
1.0 == 1
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - float" tags="[class][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" >
|
||||
<Original>
|
||||
Template_Fixture<TestType>::m_a == 1
|
||||
</Original>
|
||||
<Expanded>
|
||||
1.0f == 1
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - int" tags="[class][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" >
|
||||
<Original>
|
||||
Template_Fixture<TestType>::m_a == 1
|
||||
</Original>
|
||||
<Expanded>
|
||||
1 == 1
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="A TEST_CASE_METHOD based test run that fails" tags="[.][class][failing]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" >
|
||||
<Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" >
|
||||
<Original>
|
||||
@@ -1920,6 +1986,54 @@
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="CAPTURE can deal with complex expressions" tags="[capture][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
|
||||
<Info>
|
||||
a := 1
|
||||
</Info>
|
||||
<Info>
|
||||
b := 2
|
||||
</Info>
|
||||
<Info>
|
||||
c := 3
|
||||
</Info>
|
||||
<Info>
|
||||
a + b := 3
|
||||
</Info>
|
||||
<Info>
|
||||
a+b := 3
|
||||
</Info>
|
||||
<Info>
|
||||
c > b := true
|
||||
</Info>
|
||||
<Info>
|
||||
a == 1 := true
|
||||
</Info>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="CAPTURE can deal with complex expressions involving commas" tags="[capture][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
|
||||
<Info>
|
||||
std::vector<int>{1, 2, 3}[0, 1, 2] := 3
|
||||
</Info>
|
||||
<Info>
|
||||
std::vector<int>{1, 2, 3}[(0, 1)] := 2
|
||||
</Info>
|
||||
<Info>
|
||||
std::vector<int>{1, 2, 3}[0] := 1
|
||||
</Info>
|
||||
<Info>
|
||||
(helper_1436<int, int>{12, -12}) := { 12, -12 }
|
||||
</Info>
|
||||
<Info>
|
||||
(helper_1436<int, int>(-12, 12)) := { -12, 12 }
|
||||
</Info>
|
||||
<Info>
|
||||
(1, 2) := 2
|
||||
</Info>
|
||||
<Info>
|
||||
(2, 3) := 3
|
||||
</Info>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Capture and info messages" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
|
||||
<Section name="Capture should stringify like assertions" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
|
||||
<Info>
|
||||
@@ -5964,6 +6078,17 @@
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Predicate matcher can accept const char*" tags="[compilation][matchers]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
||||
<Original>
|
||||
"foo", Predicate<const char*>([] (const char* const&) { return true; })
|
||||
</Original>
|
||||
<Expanded>
|
||||
"foo" matches undescribed predicate
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Process can be configured on command line" tags="[command-line][config]" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
||||
<Section name="empty args don't cause a crash" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
||||
@@ -7680,6 +7805,622 @@ Message from section two
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="TemplateTest: vectors can be sized and resized - float" tags="[template][vector]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 == 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 >= 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Section name="resizing bigger changes size and capacity" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 10
|
||||
</Original>
|
||||
<Expanded>
|
||||
10 == 10
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 10
|
||||
</Original>
|
||||
<Expanded>
|
||||
10 >= 10
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 == 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 >= 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Section name="resizing smaller changes size but not capacity" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 0
|
||||
</Original>
|
||||
<Expanded>
|
||||
0 == 0
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 >= 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Section name="We can use the 'swap trick' to reset the capacity" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() == 0
|
||||
</Original>
|
||||
<Expanded>
|
||||
0 == 0
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<OverallResults successes="3" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 == 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 >= 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Section name="reserving bigger changes capacity but not size" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 == 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 10
|
||||
</Original>
|
||||
<Expanded>
|
||||
10 >= 10
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 == 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 >= 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Section name="reserving smaller does not change size or capacity" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 == 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 >= 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="TemplateTest: vectors can be sized and resized - int" tags="[template][vector]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 == 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 >= 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Section name="resizing bigger changes size and capacity" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 10
|
||||
</Original>
|
||||
<Expanded>
|
||||
10 == 10
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 10
|
||||
</Original>
|
||||
<Expanded>
|
||||
10 >= 10
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 == 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 >= 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Section name="resizing smaller changes size but not capacity" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 0
|
||||
</Original>
|
||||
<Expanded>
|
||||
0 == 0
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 >= 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Section name="We can use the 'swap trick' to reset the capacity" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() == 0
|
||||
</Original>
|
||||
<Expanded>
|
||||
0 == 0
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<OverallResults successes="3" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 == 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 >= 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Section name="reserving bigger changes capacity but not size" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 == 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 10
|
||||
</Original>
|
||||
<Expanded>
|
||||
10 >= 10
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 == 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 >= 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Section name="reserving smaller does not change size or capacity" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 == 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 >= 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="TemplateTest: vectors can be sized and resized - std::string" tags="[template][vector]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 == 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 >= 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Section name="resizing bigger changes size and capacity" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 10
|
||||
</Original>
|
||||
<Expanded>
|
||||
10 == 10
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 10
|
||||
</Original>
|
||||
<Expanded>
|
||||
10 >= 10
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 == 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 >= 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Section name="resizing smaller changes size but not capacity" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 0
|
||||
</Original>
|
||||
<Expanded>
|
||||
0 == 0
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 >= 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Section name="We can use the 'swap trick' to reset the capacity" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() == 0
|
||||
</Original>
|
||||
<Expanded>
|
||||
0 == 0
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<OverallResults successes="3" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 == 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 >= 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Section name="reserving bigger changes capacity but not size" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 == 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 10
|
||||
</Original>
|
||||
<Expanded>
|
||||
10 >= 10
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 == 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 >= 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Section name="reserving smaller does not change size or capacity" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 == 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 >= 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="TemplateTest: vectors can be sized and resized - std::tuple<int,float>" tags="[template][vector]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 == 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 >= 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Section name="resizing bigger changes size and capacity" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 10
|
||||
</Original>
|
||||
<Expanded>
|
||||
10 == 10
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 10
|
||||
</Original>
|
||||
<Expanded>
|
||||
10 >= 10
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 == 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 >= 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Section name="resizing smaller changes size but not capacity" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 0
|
||||
</Original>
|
||||
<Expanded>
|
||||
0 == 0
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 >= 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Section name="We can use the 'swap trick' to reset the capacity" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() == 0
|
||||
</Original>
|
||||
<Expanded>
|
||||
0 == 0
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<OverallResults successes="3" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 == 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 >= 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Section name="reserving bigger changes capacity but not size" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 == 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 10
|
||||
</Original>
|
||||
<Expanded>
|
||||
10 >= 10
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 == 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 >= 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Section name="reserving smaller does not change size or capacity" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.size() == 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 == 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||
<Original>
|
||||
v.capacity() >= 5
|
||||
</Original>
|
||||
<Expanded>
|
||||
5 >= 5
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Test case with one argument" filename="projects/<exe-name>/UsageTests/VariadicMacros.tests.cpp" >
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
@@ -11358,7 +12099,7 @@ loose text artifact
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<OverallResults successes="1104" failures="123" expectedFailures="21"/>
|
||||
<OverallResults successes="1178" failures="126" expectedFailures="21"/>
|
||||
</Group>
|
||||
<OverallResults successes="1104" failures="122" expectedFailures="21"/>
|
||||
<OverallResults successes="1178" failures="125" expectedFailures="21"/>
|
||||
</Catch>
|
||||
|
@@ -39,6 +39,13 @@ struct Fixture
|
||||
int m_a;
|
||||
};
|
||||
|
||||
template< typename T >
|
||||
struct Template_Fixture {
|
||||
Template_Fixture(): m_a(1) {}
|
||||
|
||||
T m_a;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -51,6 +58,10 @@ TEST_CASE_METHOD( Fixture, "A TEST_CASE_METHOD based test run that succeeds", "[
|
||||
REQUIRE( m_a == 1 );
|
||||
}
|
||||
|
||||
TEMPLATE_TEST_CASE_METHOD(Template_Fixture, "A TEMPLATE_TEST_CASE_METHOD based test run that succeeds", "[class][template]", int, float, double) {
|
||||
REQUIRE( Template_Fixture<TestType>::m_a == 1 );
|
||||
}
|
||||
|
||||
// We should be able to write our tests within a different namespace
|
||||
namespace Inner
|
||||
{
|
||||
@@ -58,6 +69,13 @@ namespace Inner
|
||||
{
|
||||
REQUIRE( m_a == 2 );
|
||||
}
|
||||
|
||||
TEMPLATE_TEST_CASE_METHOD(Template_Fixture,"A TEMPLATE_TEST_CASE_METHOD based test run that fails", "[.][class][template][failing]", int, float, double)
|
||||
{
|
||||
REQUIRE( Template_Fixture<TestType>::m_a == 2 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}} // namespace ClassTests
|
||||
|
@@ -432,6 +432,10 @@ namespace { namespace MatchersTests {
|
||||
CHECK_THAT(actual, !UnorderedEquals(expected));
|
||||
}
|
||||
|
||||
TEST_CASE("Predicate matcher can accept const char*", "[matchers][compilation]") {
|
||||
REQUIRE_THAT("foo", Predicate<const char*>([] (const char* const&) { return true; }));
|
||||
}
|
||||
|
||||
} } // namespace MatchersTests
|
||||
|
||||
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
||||
|
@@ -9,10 +9,6 @@
|
||||
#include "catch.hpp"
|
||||
#include <iostream>
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
|
||||
#endif
|
||||
|
||||
TEST_CASE( "INFO and WARN do not abort tests", "[messages][.]" ) {
|
||||
INFO( "this is a " << "message" ); // This should output the message if a failure occurs
|
||||
WARN( "this is a " << "warning" ); // This should always output the message but then continue
|
||||
@@ -135,3 +131,60 @@ TEST_CASE( "Pointers can be converted to strings", "[messages][.][approvals]" )
|
||||
WARN( "actual address of p: " << &p );
|
||||
WARN( "toString(p): " << ::Catch::Detail::stringify( &p ) );
|
||||
}
|
||||
|
||||
TEST_CASE( "CAPTURE can deal with complex expressions", "[messages][capture]" ) {
|
||||
int a = 1;
|
||||
int b = 2;
|
||||
int c = 3;
|
||||
CAPTURE( a, b, c, a + b, a+b, c > b, a == 1 );
|
||||
SUCCEED();
|
||||
}
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-value" // In (1, 2), the "1" is unused ...
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-value" // All the comma operators are side-effect free
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4709) // comma in indexing operator
|
||||
#endif
|
||||
|
||||
template <typename T1, typename T2>
|
||||
struct helper_1436 {
|
||||
helper_1436(T1 t1, T2 t2):
|
||||
t1{ t1 },
|
||||
t2{ t2 }
|
||||
{}
|
||||
T1 t1;
|
||||
T2 t2;
|
||||
};
|
||||
|
||||
template <typename T1, typename T2>
|
||||
std::ostream& operator<<(std::ostream& out, helper_1436<T1, T2> const& helper) {
|
||||
out << "{ " << helper.t1 << ", " << helper.t2 << " }";
|
||||
return out;
|
||||
}
|
||||
|
||||
TEST_CASE("CAPTURE can deal with complex expressions involving commas", "[messages][capture]") {
|
||||
CAPTURE(std::vector<int>{1, 2, 3}[0, 1, 2],
|
||||
std::vector<int>{1, 2, 3}[(0, 1)],
|
||||
std::vector<int>{1, 2, 3}[0]);
|
||||
CAPTURE((helper_1436<int, int>{12, -12}),
|
||||
(helper_1436<int, int>(-12, 12)));
|
||||
CAPTURE( (1, 2), (2, 3) );
|
||||
SUCCEED();
|
||||
}
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
@@ -261,6 +261,46 @@ TEST_CASE( "vectors can be sized and resized", "[vector]" ) {
|
||||
}
|
||||
}
|
||||
|
||||
TEMPLATE_TEST_CASE( "TemplateTest: vectors can be sized and resized", "[vector][template]", int, float, std::string, (std::tuple<int,float>) ) {
|
||||
|
||||
std::vector<TestType> v( 5 );
|
||||
|
||||
REQUIRE( v.size() == 5 );
|
||||
REQUIRE( v.capacity() >= 5 );
|
||||
|
||||
SECTION( "resizing bigger changes size and capacity" ) {
|
||||
v.resize( 10 );
|
||||
|
||||
REQUIRE( v.size() == 10 );
|
||||
REQUIRE( v.capacity() >= 10 );
|
||||
}
|
||||
SECTION( "resizing smaller changes size but not capacity" ) {
|
||||
v.resize( 0 );
|
||||
|
||||
REQUIRE( v.size() == 0 );
|
||||
REQUIRE( v.capacity() >= 5 );
|
||||
|
||||
SECTION( "We can use the 'swap trick' to reset the capacity" ) {
|
||||
std::vector<TestType> empty;
|
||||
empty.swap( v );
|
||||
|
||||
REQUIRE( v.capacity() == 0 );
|
||||
}
|
||||
}
|
||||
SECTION( "reserving bigger changes capacity but not size" ) {
|
||||
v.reserve( 10 );
|
||||
|
||||
REQUIRE( v.size() == 5 );
|
||||
REQUIRE( v.capacity() >= 10 );
|
||||
}
|
||||
SECTION( "reserving smaller does not change size or capacity" ) {
|
||||
v.reserve( 0 );
|
||||
|
||||
REQUIRE( v.size() == 5 );
|
||||
REQUIRE( v.capacity() >= 5 );
|
||||
}
|
||||
}
|
||||
|
||||
// https://github.com/philsquared/Catch/issues/166
|
||||
TEST_CASE("A couple of nested sections followed by a failure", "[failing][.]") {
|
||||
SECTION("Outer")
|
||||
|
@@ -12,8 +12,6 @@ rootPath = os.path.join( catchPath, 'include/' )
|
||||
versionPath = os.path.join( rootPath, "internal/catch_version.cpp" )
|
||||
definePath = os.path.join(rootPath, 'catch.hpp')
|
||||
readmePath = os.path.join( catchPath, "README.md" )
|
||||
conanPath = os.path.join(catchPath, 'conanfile.py')
|
||||
conanTestPath = os.path.join(catchPath, 'test_package', 'conanfile.py')
|
||||
cmakePath = os.path.join(catchPath, 'CMakeLists.txt')
|
||||
|
||||
class Version:
|
||||
@@ -98,35 +96,6 @@ def updateReadmeFile(version):
|
||||
line = '[]({0})'.format(wandboxLink)
|
||||
f.write( line + "\n" )
|
||||
|
||||
def updateConanFile(version):
|
||||
conanParser = re.compile( r' version = "\d+\.\d+\.\d+.*"')
|
||||
f = open( conanPath, 'r' )
|
||||
lines = []
|
||||
for line in f:
|
||||
m = conanParser.match( line )
|
||||
if m:
|
||||
lines.append( ' version = "{0}"'.format(format(version.getVersionString())) )
|
||||
else:
|
||||
lines.append( line.rstrip() )
|
||||
f.close()
|
||||
f = open( conanPath, 'w' )
|
||||
for line in lines:
|
||||
f.write( line + "\n" )
|
||||
|
||||
def updateConanTestFile(version):
|
||||
conanParser = re.compile( r' requires = \"Catch\/\d+\.\d+\.\d+.*@%s\/%s\" % \(username, channel\)')
|
||||
f = open( conanTestPath, 'r' )
|
||||
lines = []
|
||||
for line in f:
|
||||
m = conanParser.match( line )
|
||||
if m:
|
||||
lines.append( ' requires = "Catch/{0}@%s/%s" % (username, channel)'.format(format(version.getVersionString())) )
|
||||
else:
|
||||
lines.append( line.rstrip() )
|
||||
f.close()
|
||||
f = open( conanTestPath, 'w' )
|
||||
for line in lines:
|
||||
f.write( line + "\n" )
|
||||
|
||||
def updateCmakeFile(version):
|
||||
with open(cmakePath, 'r') as file:
|
||||
@@ -173,6 +142,4 @@ def performUpdates(version):
|
||||
shutil.copyfile(sourceFile, destFile)
|
||||
|
||||
updateReadmeFile(version)
|
||||
updateConanFile(version)
|
||||
updateConanTestFile(version)
|
||||
updateCmakeFile(version)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Catch v2.4.2
|
||||
* Generated: 2018-10-26 21:12:29.223927
|
||||
* Catch v2.5.0
|
||||
* Generated: 2018-11-26 20:46:12.165372
|
||||
* ----------------------------------------------------------
|
||||
* This file has been merged from multiple headers. Please don't edit it directly
|
||||
* Copyright (c) 2018 Two Blue Cubes Ltd. All rights reserved.
|
||||
@@ -14,8 +14,8 @@
|
||||
|
||||
|
||||
#define CATCH_VERSION_MAJOR 2
|
||||
#define CATCH_VERSION_MINOR 4
|
||||
#define CATCH_VERSION_PATCH 2
|
||||
#define CATCH_VERSION_MINOR 5
|
||||
#define CATCH_VERSION_PATCH 0
|
||||
|
||||
#ifdef __clang__
|
||||
# pragma clang system_header
|
||||
@@ -226,6 +226,13 @@ namespace Catch {
|
||||
# define CATCH_INTERNAL_CONFIG_WINDOWS_SEH
|
||||
# endif
|
||||
|
||||
// MSVC traditional preprocessor needs some workaround for __VA_ARGS__
|
||||
// _MSVC_TRADITIONAL == 0 means new conformant preprocessor
|
||||
// _MSVC_TRADITIONAL == 1 means old traditional non-conformant preprocessor
|
||||
# if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL)
|
||||
# define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
# endif
|
||||
|
||||
#endif // _MSC_VER
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -240,6 +247,12 @@ namespace Catch {
|
||||
# define CATCH_INTERNAL_CONFIG_NO_WCHAR
|
||||
#endif // __DJGPP__
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Embarcadero C++Build
|
||||
#if defined(__BORLANDC__)
|
||||
#define CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Use of __COUNTER__ is suppressed during code analysis in
|
||||
@@ -320,6 +333,10 @@ namespace Catch {
|
||||
# define CATCH_CONFIG_DISABLE_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
#if defined(CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_NO_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_POLYFILL_ISNAN)
|
||||
# define CATCH_CONFIG_POLYFILL_ISNAN
|
||||
#endif
|
||||
|
||||
#if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS)
|
||||
# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS
|
||||
# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS
|
||||
@@ -343,6 +360,10 @@ namespace Catch {
|
||||
#define CATCH_CATCH_ANON(type) catch (type)
|
||||
#endif
|
||||
|
||||
#if defined(CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_NO_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR)
|
||||
#define CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#endif
|
||||
|
||||
// end catch_compiler_capabilities.h
|
||||
#define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line
|
||||
#define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line )
|
||||
@@ -597,6 +618,102 @@ inline auto operator "" _catch_sr( char const* rawChars, std::size_t size ) noex
|
||||
}
|
||||
|
||||
// end catch_stringref.h
|
||||
// start catch_type_traits.hpp
|
||||
|
||||
|
||||
namespace Catch{
|
||||
|
||||
#ifdef CATCH_CPP17_OR_GREATER
|
||||
template <typename...>
|
||||
inline constexpr auto is_unique = std::true_type{};
|
||||
|
||||
template <typename T, typename... Rest>
|
||||
inline constexpr auto is_unique<T, Rest...> = std::bool_constant<
|
||||
(!std::is_same_v<T, Rest> && ...) && is_unique<Rest...>
|
||||
>{};
|
||||
#else
|
||||
|
||||
template <typename...>
|
||||
struct is_unique : std::true_type{};
|
||||
|
||||
template <typename T0, typename T1, typename... Rest>
|
||||
struct is_unique<T0, T1, Rest...> : std::integral_constant
|
||||
<bool,
|
||||
!std::is_same<T0, T1>::value
|
||||
&& is_unique<T0, Rest...>::value
|
||||
&& is_unique<T1, Rest...>::value
|
||||
>{};
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
// end catch_type_traits.hpp
|
||||
// start catch_preprocessor.hpp
|
||||
|
||||
|
||||
#define CATCH_RECURSION_LEVEL0(...) __VA_ARGS__
|
||||
#define CATCH_RECURSION_LEVEL1(...) CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(__VA_ARGS__)))
|
||||
#define CATCH_RECURSION_LEVEL2(...) CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(__VA_ARGS__)))
|
||||
#define CATCH_RECURSION_LEVEL3(...) CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(__VA_ARGS__)))
|
||||
#define CATCH_RECURSION_LEVEL4(...) CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(__VA_ARGS__)))
|
||||
#define CATCH_RECURSION_LEVEL5(...) CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(__VA_ARGS__)))
|
||||
|
||||
#ifdef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define INTERNAL_CATCH_EXPAND_VARGS(...) __VA_ARGS__
|
||||
// MSVC needs more evaluations
|
||||
#define CATCH_RECURSION_LEVEL6(...) CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(__VA_ARGS__)))
|
||||
#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL6(CATCH_RECURSION_LEVEL6(__VA_ARGS__))
|
||||
#else
|
||||
#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL5(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#define CATCH_REC_END(...)
|
||||
#define CATCH_REC_OUT
|
||||
|
||||
#define CATCH_EMPTY()
|
||||
#define CATCH_DEFER(id) id CATCH_EMPTY()
|
||||
|
||||
#define CATCH_REC_GET_END2() 0, CATCH_REC_END
|
||||
#define CATCH_REC_GET_END1(...) CATCH_REC_GET_END2
|
||||
#define CATCH_REC_GET_END(...) CATCH_REC_GET_END1
|
||||
#define CATCH_REC_NEXT0(test, next, ...) next CATCH_REC_OUT
|
||||
#define CATCH_REC_NEXT1(test, next) CATCH_DEFER ( CATCH_REC_NEXT0 ) ( test, next, 0)
|
||||
#define CATCH_REC_NEXT(test, next) CATCH_REC_NEXT1(CATCH_REC_GET_END test, next)
|
||||
|
||||
#define CATCH_REC_LIST0(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ )
|
||||
#define CATCH_REC_LIST1(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0) ) ( f, peek, __VA_ARGS__ )
|
||||
#define CATCH_REC_LIST2(f, x, peek, ...) f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ )
|
||||
|
||||
#define CATCH_REC_LIST0_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ )
|
||||
#define CATCH_REC_LIST1_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0_UD) ) ( f, userdata, peek, __VA_ARGS__ )
|
||||
#define CATCH_REC_LIST2_UD(f, userdata, x, peek, ...) f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ )
|
||||
|
||||
// Applies the function macro `f` to each of the remaining parameters, inserts commas between the results,
|
||||
// and passes userdata as the first parameter to each invocation,
|
||||
// e.g. CATCH_REC_LIST_UD(f, x, a, b, c) evaluates to f(x, a), f(x, b), f(x, c)
|
||||
#define CATCH_REC_LIST_UD(f, userdata, ...) CATCH_RECURSE(CATCH_REC_LIST2_UD(f, userdata, __VA_ARGS__, ()()(), ()()(), ()()(), 0))
|
||||
|
||||
#define CATCH_REC_LIST(f, ...) CATCH_RECURSE(CATCH_REC_LIST2(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0))
|
||||
|
||||
#define INTERNAL_CATCH_EXPAND1(param) INTERNAL_CATCH_EXPAND2(param)
|
||||
#define INTERNAL_CATCH_EXPAND2(...) INTERNAL_CATCH_NO## __VA_ARGS__
|
||||
#define INTERNAL_CATCH_DEF(...) INTERNAL_CATCH_DEF __VA_ARGS__
|
||||
#define INTERNAL_CATCH_NOINTERNAL_CATCH_DEF
|
||||
|
||||
#define INTERNAL_CATCH_REMOVE_PARENS(...) INTERNAL_CATCH_EXPAND1(INTERNAL_CATCH_DEF __VA_ARGS__)
|
||||
|
||||
#define INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME2(Name, ...) INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME3(Name, __VA_ARGS__)
|
||||
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME3(Name,...) Name " - " #__VA_ARGS__
|
||||
#define INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME(Name,...) INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME2(Name, INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__))
|
||||
#else
|
||||
// MSVC is adding extra space and needs more calls to properly remove ()
|
||||
#define INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME3(Name,...) Name " -" #__VA_ARGS__
|
||||
#define INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME1(Name, ...) INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME2(Name, __VA_ARGS__)
|
||||
#define INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME(Name, ...) INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME1(Name, INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__)))
|
||||
#endif
|
||||
|
||||
// end catch_preprocessor.hpp
|
||||
namespace Catch {
|
||||
|
||||
template<typename C>
|
||||
@@ -631,22 +748,28 @@ struct AutoReg : NonCopyable {
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
#define INTERNAL_CATCH_EXPAND1(param) INTERNAL_CATCH_EXPAND2(param)
|
||||
#define INTERNAL_CATCH_EXPAND2(...) INTERNAL_CATCH_NO## __VA_ARGS__
|
||||
#define INTERNAL_CATCH_DEF(...) INTERNAL_CATCH_DEF __VA_ARGS__
|
||||
#define INTERNAL_CATCH_NOINTERNAL_CATCH_DEF
|
||||
|
||||
#if defined(CATCH_CONFIG_DISABLE)
|
||||
#define INTERNAL_CATCH_TESTCASE_NO_REGISTRATION( TestName, ... ) \
|
||||
static void TestName()
|
||||
#define INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION( TestName, ClassName, ... ) \
|
||||
namespace{ \
|
||||
struct TestName : INTERNAL_CATCH_EXPAND1(INTERNAL_CATCH_DEF ClassName) { \
|
||||
struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) { \
|
||||
void test(); \
|
||||
}; \
|
||||
} \
|
||||
void TestName::test()
|
||||
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION( TestName, ... ) \
|
||||
template<typename TestType> \
|
||||
static void TestName()
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION( TestName, ClassName, ... ) \
|
||||
namespace{ \
|
||||
template<typename TestType> \
|
||||
struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName <TestType>) { \
|
||||
void test(); \
|
||||
}; \
|
||||
} \
|
||||
template<typename TestType> \
|
||||
void TestName::test()
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -669,7 +792,7 @@ struct AutoReg : NonCopyable {
|
||||
#define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\
|
||||
CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
|
||||
namespace{ \
|
||||
struct TestName : INTERNAL_CATCH_EXPAND1(INTERNAL_CATCH_DEF ClassName) { \
|
||||
struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) { \
|
||||
void test(); \
|
||||
}; \
|
||||
Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( Catch::makeTestInvoker( &TestName::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \
|
||||
@@ -685,6 +808,77 @@ struct AutoReg : NonCopyable {
|
||||
Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( Function ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \
|
||||
CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_2(TestName, TestFunc, Name, Tags, ... )\
|
||||
CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
|
||||
template<typename TestType> \
|
||||
static void TestFunc();\
|
||||
namespace {\
|
||||
template<typename...Types> \
|
||||
struct TestName{\
|
||||
template<typename...Ts> \
|
||||
TestName(Ts...names){\
|
||||
CATCH_INTERNAL_CHECK_UNIQUE_TYPES(CATCH_REC_LIST(INTERNAL_CATCH_REMOVE_PARENS, __VA_ARGS__)) \
|
||||
using expander = int[];\
|
||||
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFunc<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ names, Tags } ), 0)... };/* NOLINT */ \
|
||||
}\
|
||||
};\
|
||||
INTERNAL_CATCH_TEMPLATE_REGISTRY_INITIATE(TestName, Name, __VA_ARGS__) \
|
||||
}\
|
||||
CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
|
||||
template<typename TestType> \
|
||||
static void TestFunc()
|
||||
|
||||
#if defined(CATCH_CPP17_OR_GREATER)
|
||||
#define CATCH_INTERNAL_CHECK_UNIQUE_TYPES(...) static_assert(Catch::is_unique<__VA_ARGS__>,"Duplicate type detected in declaration of template test case");
|
||||
#else
|
||||
#define CATCH_INTERNAL_CHECK_UNIQUE_TYPES(...) static_assert(Catch::is_unique<__VA_ARGS__>::value,"Duplicate type detected in declaration of template test case");
|
||||
#endif
|
||||
|
||||
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \
|
||||
INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, __VA_ARGS__ )
|
||||
#else
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \
|
||||
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, __VA_ARGS__ ) )
|
||||
#endif
|
||||
|
||||
#define INTERNAL_CATCH_TEMPLATE_REGISTRY_INITIATE(TestName, Name, ...)\
|
||||
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
|
||||
TestName<CATCH_REC_LIST(INTERNAL_CATCH_REMOVE_PARENS, __VA_ARGS__)>(CATCH_REC_LIST_UD(INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME,Name, __VA_ARGS__));\
|
||||
return 0;\
|
||||
}();
|
||||
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, ... ) \
|
||||
CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
|
||||
namespace{ \
|
||||
template<typename TestType> \
|
||||
struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName <TestType>) { \
|
||||
void test();\
|
||||
};\
|
||||
template<typename...Types> \
|
||||
struct TestNameClass{\
|
||||
template<typename...Ts> \
|
||||
TestNameClass(Ts...names){\
|
||||
CATCH_INTERNAL_CHECK_UNIQUE_TYPES(CATCH_REC_LIST(INTERNAL_CATCH_REMOVE_PARENS, __VA_ARGS__)) \
|
||||
using expander = int[];\
|
||||
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ names, Tags } ), 0)... };/* NOLINT */ \
|
||||
}\
|
||||
};\
|
||||
INTERNAL_CATCH_TEMPLATE_REGISTRY_INITIATE(TestNameClass, Name, __VA_ARGS__)\
|
||||
}\
|
||||
CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS\
|
||||
template<typename TestType> \
|
||||
void TestName<TestType>::test()
|
||||
|
||||
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \
|
||||
INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, __VA_ARGS__ )
|
||||
#else
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \
|
||||
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, __VA_ARGS__ ) )
|
||||
#endif
|
||||
|
||||
// end catch_test_registry.h
|
||||
// start catch_capture.hpp
|
||||
|
||||
@@ -1823,16 +2017,16 @@ namespace Catch {
|
||||
Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names );
|
||||
~Capturer();
|
||||
|
||||
void captureValue( size_t index, StringRef value );
|
||||
void captureValue( size_t index, std::string const& value );
|
||||
|
||||
template<typename T>
|
||||
void captureValues( size_t index, T&& value ) {
|
||||
void captureValues( size_t index, T const& value ) {
|
||||
captureValue( index, Catch::Detail::stringify( value ) );
|
||||
}
|
||||
|
||||
template<typename T, typename... Ts>
|
||||
void captureValues( size_t index, T&& value, Ts&&... values ) {
|
||||
captureValues( index, value );
|
||||
void captureValues( size_t index, T const& value, Ts const&... values ) {
|
||||
captureValue( index, Catch::Detail::stringify(value) );
|
||||
captureValues( index+1, values... );
|
||||
}
|
||||
};
|
||||
@@ -2453,10 +2647,6 @@ namespace Matchers {
|
||||
struct MatcherMethod {
|
||||
virtual bool match( ObjectT const& arg ) const = 0;
|
||||
};
|
||||
template<typename PtrT>
|
||||
struct MatcherMethod<PtrT*> {
|
||||
virtual bool match( PtrT* arg ) const = 0;
|
||||
};
|
||||
|
||||
#ifdef __clang__
|
||||
# pragma clang diagnostic pop
|
||||
@@ -4514,6 +4704,8 @@ namespace Catch {
|
||||
struct TestEventListenerBase : StreamingReporterBase<TestEventListenerBase> {
|
||||
TestEventListenerBase( ReporterConfig const& _config );
|
||||
|
||||
static std::set<Verbosity> getSupportedVerbosities();
|
||||
|
||||
void assertionStarting(AssertionInfo const&) override;
|
||||
bool assertionEnded(AssertionStats const&) override;
|
||||
};
|
||||
@@ -8523,6 +8715,14 @@ using Matchers::Impl::MatcherBase;
|
||||
// end catch_matchers.cpp
|
||||
// start catch_matchers_floating.cpp
|
||||
|
||||
// start catch_polyfills.hpp
|
||||
|
||||
namespace Catch {
|
||||
bool isnan(float f);
|
||||
bool isnan(double d);
|
||||
}
|
||||
|
||||
// end catch_polyfills.hpp
|
||||
// start catch_to_string.hpp
|
||||
|
||||
#include <string>
|
||||
@@ -8588,7 +8788,7 @@ template <typename FP>
|
||||
bool almostEqualUlps(FP lhs, FP rhs, int maxUlpDiff) {
|
||||
// Comparison with NaN should always be false.
|
||||
// This way we can rule it out before getting into the ugly details
|
||||
if (std::isnan(lhs) || std::isnan(rhs)) {
|
||||
if (Catch::isnan(lhs) || Catch::isnan(rhs)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -8796,6 +8996,7 @@ namespace Catch {
|
||||
|
||||
// end catch_uncaught_exceptions.h
|
||||
#include <cassert>
|
||||
#include <stack>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
@@ -8842,19 +9043,48 @@ namespace Catch {
|
||||
}
|
||||
|
||||
Capturer::Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names ) {
|
||||
auto start = std::string::npos;
|
||||
for( size_t pos = 0; pos <= names.size(); ++pos ) {
|
||||
auto trimmed = [&] (size_t start, size_t end) {
|
||||
while (names[start] == ',' || isspace(names[start])) {
|
||||
++start;
|
||||
}
|
||||
while (names[end] == ',' || isspace(names[end])) {
|
||||
--end;
|
||||
}
|
||||
return names.substr(start, end - start + 1);
|
||||
};
|
||||
|
||||
size_t start = 0;
|
||||
std::stack<char> openings;
|
||||
for (size_t pos = 0; pos < names.size(); ++pos) {
|
||||
char c = names[pos];
|
||||
if( pos == names.size() || c == ' ' || c == '\t' || c == ',' || c == ']' ) {
|
||||
if( start != std::string::npos ) {
|
||||
m_messages.push_back( MessageInfo( macroName, lineInfo, resultType ) );
|
||||
m_messages.back().message = names.substr( start, pos-start) + " := ";
|
||||
start = std::string::npos;
|
||||
switch (c) {
|
||||
case '[':
|
||||
case '{':
|
||||
case '(':
|
||||
// It is basically impossible to disambiguate between
|
||||
// comparison and start of template args in this context
|
||||
// case '<':
|
||||
openings.push(c);
|
||||
break;
|
||||
case ']':
|
||||
case '}':
|
||||
case ')':
|
||||
// case '>':
|
||||
openings.pop();
|
||||
break;
|
||||
case ',':
|
||||
if (start != pos && openings.size() == 0) {
|
||||
m_messages.emplace_back(macroName, lineInfo, resultType);
|
||||
m_messages.back().message = trimmed(start, pos);
|
||||
m_messages.back().message += " := ";
|
||||
start = pos;
|
||||
}
|
||||
}
|
||||
else if( c != '[' && c != ']' && start == std::string::npos )
|
||||
start = pos;
|
||||
}
|
||||
assert(openings.size() == 0 && "Mismatched openings");
|
||||
m_messages.emplace_back(macroName, lineInfo, resultType);
|
||||
m_messages.back().message = trimmed(start, names.size() - 1);
|
||||
m_messages.back().message += " := ";
|
||||
}
|
||||
Capturer::~Capturer() {
|
||||
if ( !uncaught_exceptions() ){
|
||||
@@ -8864,7 +9094,7 @@ namespace Catch {
|
||||
}
|
||||
}
|
||||
|
||||
void Capturer::captureValue( size_t index, StringRef value ) {
|
||||
void Capturer::captureValue( size_t index, std::string const& value ) {
|
||||
assert( index < m_messages.size() );
|
||||
m_messages[index].message += value;
|
||||
m_resultCapture.pushScopedMessage( m_messages[index] );
|
||||
@@ -9092,6 +9322,31 @@ namespace Catch {
|
||||
#endif
|
||||
#endif
|
||||
// end catch_output_redirect.cpp
|
||||
// start catch_polyfills.cpp
|
||||
|
||||
#include <cmath>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
#if !defined(CATCH_CONFIG_POLYFILL_ISNAN)
|
||||
bool isnan(float f) {
|
||||
return std::isnan(f);
|
||||
}
|
||||
bool isnan(double d) {
|
||||
return std::isnan(d);
|
||||
}
|
||||
#else
|
||||
// For now we only use this for embarcadero
|
||||
bool isnan(float f) {
|
||||
return std::_isnan(f);
|
||||
}
|
||||
bool isnan(double d) {
|
||||
return std::_isnan(d);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // end namespace Catch
|
||||
// end catch_polyfills.cpp
|
||||
// start catch_random_number_generator.cpp
|
||||
|
||||
namespace Catch {
|
||||
@@ -10055,8 +10310,6 @@ namespace Catch {
|
||||
}
|
||||
|
||||
Catch::Totals runTests(std::shared_ptr<Config> const& config) {
|
||||
// FixMe: Add listeners in order first, then add reporters.
|
||||
|
||||
auto reporter = makeReporter(config);
|
||||
|
||||
RunContext context(config, std::move(reporter));
|
||||
@@ -11582,7 +11835,7 @@ namespace Detail {
|
||||
|
||||
template<typename T>
|
||||
std::string fpToString( T value, int precision ) {
|
||||
if (std::isnan(value)) {
|
||||
if (Catch::isnan(value)) {
|
||||
return "nan";
|
||||
}
|
||||
|
||||
@@ -11866,7 +12119,7 @@ namespace Catch {
|
||||
}
|
||||
|
||||
Version const& libraryVersion() {
|
||||
static Version version( 2, 4, 2, "", 0 );
|
||||
static Version version( 2, 5, 0, "", 0 );
|
||||
return version;
|
||||
}
|
||||
|
||||
@@ -12224,6 +12477,10 @@ namespace Catch {
|
||||
TestEventListenerBase::TestEventListenerBase(ReporterConfig const & _config)
|
||||
:StreamingReporterBase(_config) {}
|
||||
|
||||
std::set<Verbosity> TestEventListenerBase::getSupportedVerbosities() {
|
||||
return { Verbosity::Quiet, Verbosity::Normal, Verbosity::High };
|
||||
}
|
||||
|
||||
void TestEventListenerBase::assertionStarting(AssertionInfo const &) {}
|
||||
|
||||
bool TestEventListenerBase::assertionEnded(AssertionStats const &) {
|
||||
@@ -12612,8 +12869,6 @@ public:
|
||||
void print() const {
|
||||
printSourceInfo();
|
||||
if (stats.totals.assertions.total() > 0) {
|
||||
if (result.isOk())
|
||||
stream << '\n';
|
||||
printResultType();
|
||||
printOriginalExpression();
|
||||
printReconstructedExpression();
|
||||
@@ -13825,6 +14080,14 @@ int main (int argc, char * const argv[]) {
|
||||
|
||||
#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE()
|
||||
|
||||
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )
|
||||
#define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
||||
#else
|
||||
#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) )
|
||||
#define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) )
|
||||
#endif
|
||||
|
||||
#if !defined(CATCH_CONFIG_RUNTIME_STATIC_REQUIRE)
|
||||
#define CATCH_STATIC_REQUIRE( ... ) static_assert( __VA_ARGS__ , #__VA_ARGS__ ); CATCH_SUCCEED( #__VA_ARGS__ )
|
||||
#define CATCH_STATIC_REQUIRE_FALSE( ... ) static_assert( !(__VA_ARGS__), "!(" #__VA_ARGS__ ")" ); CATCH_SUCCEED( #__VA_ARGS__ )
|
||||
@@ -13892,6 +14155,14 @@ int main (int argc, char * const argv[]) {
|
||||
#define SUCCEED( ... ) INTERNAL_CATCH_MSG( "SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
||||
#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE()
|
||||
|
||||
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )
|
||||
#define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )
|
||||
#else
|
||||
#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) )
|
||||
#define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) )
|
||||
#endif
|
||||
|
||||
#if !defined(CATCH_CONFIG_RUNTIME_STATIC_REQUIRE)
|
||||
#define STATIC_REQUIRE( ... ) static_assert( __VA_ARGS__, #__VA_ARGS__ ); SUCCEED( #__VA_ARGS__ )
|
||||
#define STATIC_REQUIRE_FALSE( ... ) static_assert( !(__VA_ARGS__), "!(" #__VA_ARGS__ ")" ); SUCCEED( "!(" #__VA_ARGS__ ")" )
|
||||
@@ -13970,6 +14241,14 @@ using Catch::Detail::Approx;
|
||||
|
||||
#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
|
||||
|
||||
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) )
|
||||
#define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), className )
|
||||
#else
|
||||
#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) ) )
|
||||
#define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), className ) )
|
||||
#endif
|
||||
|
||||
// "BDD-style" convenience wrappers
|
||||
#define CATCH_SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
|
||||
#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), className )
|
||||
@@ -14032,6 +14311,14 @@ using Catch::Detail::Approx;
|
||||
#define SUCCEED( ... ) (void)(0)
|
||||
#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
|
||||
|
||||
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) )
|
||||
#define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), className )
|
||||
#else
|
||||
#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) ) )
|
||||
#define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), className ) )
|
||||
#endif
|
||||
|
||||
#define STATIC_REQUIRE( ... ) (void)(0)
|
||||
#define STATIC_REQUIRE_FALSE( ... ) (void)(0)
|
||||
|
||||
|
@@ -1,7 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(CatchTest CXX)
|
||||
|
||||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
||||
conan_basic_setup()
|
||||
|
||||
add_executable(${CMAKE_PROJECT_NAME} MainTest.cpp)
|
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Created by Phil on 22/10/2010.
|
||||
* Copyright 2010 Two Blue Cubes Ltd
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
unsigned int Factorial( unsigned int number ) {
|
||||
return number > 1 ? Factorial(number-1)*number : 1;
|
||||
}
|
||||
|
||||
TEST_CASE( "Factorials are computed", "[factorial]" ) {
|
||||
REQUIRE( Factorial(0) == 1 );
|
||||
REQUIRE( Factorial(1) == 1 );
|
||||
REQUIRE( Factorial(2) == 2 );
|
||||
REQUIRE( Factorial(3) == 6 );
|
||||
REQUIRE( Factorial(10) == 3628800 );
|
||||
}
|
@@ -1,21 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
from os import getenv
|
||||
from os import path
|
||||
from conans import ConanFile
|
||||
from conans import CMake
|
||||
|
||||
|
||||
class CatchConanTest(ConanFile):
|
||||
generators = "cmake"
|
||||
settings = "os", "compiler", "arch", "build_type"
|
||||
username = getenv("CONAN_USERNAME", "philsquared")
|
||||
channel = getenv("CONAN_CHANNEL", "testing")
|
||||
requires = "Catch/2.4.2@%s/%s" % (username, channel)
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure(build_dir="./")
|
||||
cmake.build()
|
||||
|
||||
def test(self):
|
||||
self.run(path.join("bin", "CatchTest"))
|
Reference in New Issue
Block a user