mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-18 02:45:40 +02:00
Compare commits
50 Commits
v2.0.0-dev
...
v2.0.0-dev
Author | SHA1 | Date | |
---|---|---|---|
![]() |
fc495ba0cb | ||
![]() |
4dcdcc0ac3 | ||
![]() |
61d2c375dd | ||
![]() |
07211cea9c | ||
![]() |
c5553019cc | ||
![]() |
66124d9e38 | ||
![]() |
dd8e79c529 | ||
![]() |
4453fefb00 | ||
![]() |
6e46f29830 | ||
![]() |
92444d8b72 | ||
![]() |
bcb430b837 | ||
![]() |
5932576f53 | ||
![]() |
faead53151 | ||
![]() |
3b8b25c59d | ||
![]() |
75f143835e | ||
![]() |
05b6f03f3e | ||
![]() |
053c29a2b8 | ||
![]() |
2a13593885 | ||
![]() |
a0988dabf6 | ||
![]() |
8f6d6a4a2d | ||
![]() |
e8d3be3621 | ||
![]() |
67dc654c70 | ||
![]() |
b1d0085796 | ||
![]() |
071f49b12b | ||
![]() |
dee61df274 | ||
![]() |
6c09b45a20 | ||
![]() |
e8225052f1 | ||
![]() |
a7a9be59ff | ||
![]() |
cb2fceb119 | ||
![]() |
49f5919c41 | ||
![]() |
489b639587 | ||
![]() |
c7da5b5128 | ||
![]() |
3dc4de8173 | ||
![]() |
626b1d3936 | ||
![]() |
5d6c1f4dd0 | ||
![]() |
3bc03cd617 | ||
![]() |
28f11a7149 | ||
![]() |
24af32f378 | ||
![]() |
0545de0a31 | ||
![]() |
ee75b324e7 | ||
![]() |
597fca3c89 | ||
![]() |
f99f511155 | ||
![]() |
9a18ba042f | ||
![]() |
8e6641c19b | ||
![]() |
185573e701 | ||
![]() |
632e023ff4 | ||
![]() |
b8f482b9aa | ||
![]() |
aaedae60b4 | ||
![]() |
ff9aaf3afe | ||
![]() |
e6ffbb732a |
@@ -132,12 +132,14 @@ set(INTERNAL_HEADERS
|
||||
${HEADER_DIR}/internal/catch_config.hpp
|
||||
${HEADER_DIR}/internal/catch_console_colour.hpp
|
||||
${HEADER_DIR}/internal/catch_context.h
|
||||
${HEADER_DIR}/internal/catch_debug_console.h
|
||||
${HEADER_DIR}/internal/catch_debugger.h
|
||||
${HEADER_DIR}/internal/catch_decomposer.h
|
||||
${HEADER_DIR}/internal/catch_default_main.hpp
|
||||
${HEADER_DIR}/internal/catch_enforce.h
|
||||
${HEADER_DIR}/internal/catch_errno_guard.h
|
||||
${HEADER_DIR}/internal/catch_exception_translator_registry.h
|
||||
${HEADER_DIR}/internal/catch_external_interfaces.h
|
||||
${HEADER_DIR}/internal/catch_fatal_condition.h
|
||||
${HEADER_DIR}/internal/catch_impl.hpp
|
||||
${HEADER_DIR}/internal/catch_interfaces_capture.h
|
||||
@@ -202,6 +204,7 @@ set(IMPL_SOURCES
|
||||
${HEADER_DIR}/internal/catch_config.cpp
|
||||
${HEADER_DIR}/internal/catch_console_colour.cpp
|
||||
${HEADER_DIR}/internal/catch_context.cpp
|
||||
${HEADER_DIR}/internal/catch_debug_console.cpp
|
||||
${HEADER_DIR}/internal/catch_debugger.cpp
|
||||
${HEADER_DIR}/internal/catch_decomposer.cpp
|
||||
${HEADER_DIR}/internal/catch_errno_guard.cpp
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<a id="top"></a>
|
||||

|
||||
|
||||
[](https://github.com/philsquared/catch/releases)
|
||||
@@ -17,11 +18,11 @@ extensions may require additional headers.
|
||||
## How to use it
|
||||
This documentation comprises these three parts:
|
||||
|
||||
* [Why do we need yet another C++ Test Framework?](docs/why-catch.md)
|
||||
* [Tutorial](docs/tutorial.md) - getting started
|
||||
* [Reference section](docs/Readme.md) - all the details
|
||||
* [Why do we need yet another C++ Test Framework?](docs/why-catch.md#top)
|
||||
* [Tutorial](docs/tutorial.md#top) - getting started
|
||||
* [Reference section](docs/Readme.md#top) - all the details
|
||||
|
||||
## More
|
||||
* Issues and bugs can be raised on the [Issue tracker on GitHub](https://github.com/philsquared/Catch/issues)
|
||||
* For discussion or questions please use [the dedicated Google Groups forum](https://groups.google.com/forum/?fromgroups#!forum/catch-forum)
|
||||
* See [who else is using Catch](docs/opensource-users.md)
|
||||
* See [who else is using Catch](docs/opensource-users.md#top)
|
||||
|
@@ -4,7 +4,7 @@ from conans import ConanFile
|
||||
|
||||
class CatchConan(ConanFile):
|
||||
name = "Catch"
|
||||
version = "1.9.6"
|
||||
version = "2.0.0-develop.3"
|
||||
description = "A modern, C++-native, header-only, framework for unit-tests, TDD and BDD"
|
||||
author = "philsquared"
|
||||
generators = "cmake"
|
||||
|
@@ -1,30 +1,33 @@
|
||||
To get the most out of Catch, start with the [tutorial](tutorial.md).
|
||||
<a id="top"></a>
|
||||
# Reference
|
||||
|
||||
To get the most out of Catch, start with the [tutorial](tutorial.md#top).
|
||||
Once you're up and running consider the following reference material.
|
||||
|
||||
Writing tests:
|
||||
* [Assertion macros](assertions.md)
|
||||
* [Matchers](matchers.md)
|
||||
* [Logging macros](logging.md)
|
||||
* [Test cases and sections](test-cases-and-sections.md)
|
||||
* [Test fixtures](test-fixtures.md)
|
||||
* [Reporters](reporters.md)
|
||||
* [Event Listeners](event-listeners.md)
|
||||
* [Assertion macros](assertions.md#top)
|
||||
* [Matchers](matchers.md#top)
|
||||
* [Logging macros](logging.md#top)
|
||||
* [Test cases and sections](test-cases-and-sections.md#top)
|
||||
* [Test fixtures](test-fixtures.md#top)
|
||||
* [Reporters](reporters.md#top)
|
||||
* [Event Listeners](event-listeners.md#top)
|
||||
|
||||
Fine tuning:
|
||||
* [Supplying your own main()](own-main.md)
|
||||
* [Compile-time configuration](configuration.md)
|
||||
* [String Conversions](tostring.md)
|
||||
* [Supplying your own main()](own-main.md#top)
|
||||
* [Compile-time configuration](configuration.md#top)
|
||||
* [String Conversions](tostring.md#top)
|
||||
|
||||
Running:
|
||||
* [Command line](command-line.md)
|
||||
* [CI and Build system integration](build-systems.md)
|
||||
* [Command line](command-line.md#top)
|
||||
* [CI and Build system integration](build-systems.md#top)
|
||||
|
||||
FAQ:
|
||||
* [Why are my tests slow to compile?](slow-compiles.md)
|
||||
* [Known limitations](limitations.md)
|
||||
* [Why are my tests slow to compile?](slow-compiles.md#top)
|
||||
* [Known limitations](limitations.md#top)
|
||||
|
||||
Other:
|
||||
* [Why Catch?](why-catch.md)
|
||||
* [Open Source Projects using Catch](opensource-users.md)
|
||||
* [Contributing](contributing.md)
|
||||
* [Release Notes](release-notes.md)
|
||||
* [Why Catch?](why-catch.md#top)
|
||||
* [Open Source Projects using Catch](opensource-users.md#top)
|
||||
* [Contributing](contributing.md#top)
|
||||
* [Release Notes](release-notes.md#top)
|
||||
|
@@ -1,5 +1,12 @@
|
||||
<a id="top"></a>
|
||||
# Assertion Macros
|
||||
|
||||
**Contents**
|
||||
[Natural Expressions](#natural-expressions)
|
||||
[Exceptions](#exceptions)
|
||||
[Matcher expressions](#matcher-expressions)
|
||||
[Thread Safety](#thread-safety)
|
||||
|
||||
Most test frameworks have a large collection of assertion macros to capture all possible conditional forms (```_EQUALS```, ```_NOTEQUALS```, ```_GREATER_THAN``` etc).
|
||||
|
||||
Catch is different. Because it decomposes natural C-style conditional expressions most of these forms are reduced to one or two that you will use all the time. That said there are a rich set of auxilliary macros as well. We'll describe all of these here.
|
||||
@@ -131,7 +138,7 @@ REQUIRE_NOTHROW([&](){
|
||||
|
||||
## Matcher expressions
|
||||
|
||||
To support Matchers a slightly different form is used. Matchers have [their own documentation](matchers.md).
|
||||
To support Matchers a slightly different form is used. Matchers have [their own documentation](matchers.md#top).
|
||||
|
||||
* **REQUIRE_THAT(** _lhs_, _matcher expression_ **)** and
|
||||
* **CHECK_THAT(** _lhs_, _matcher expression_ **)**
|
||||
@@ -145,4 +152,4 @@ For more details, along with workarounds, see the section on [the limitations pa
|
||||
|
||||
---
|
||||
|
||||
[Home](Readme.md)
|
||||
[Home](Readme.md#top)
|
||||
|
@@ -1,14 +1,15 @@
|
||||
<a id="top"></a>
|
||||
# CI and build system integration
|
||||
|
||||
Build Systems may refer to low-level tools, like CMake, or larger systems that run on servers, like Jenkins or TeamCity. This page will talk about both.
|
||||
|
||||
# Continuous Integration systems
|
||||
## Continuous Integration systems
|
||||
|
||||
Probably the most important aspect to using Catch with a build server is the use of different reporters. Catch comes bundled with three reporters that should cover the majority of build servers out there - although adding more for better integration with some is always a possibility (currently we also offer TeamCity, TAP and Automake reporters).
|
||||
|
||||
Two of these reporters are built in (XML and JUnit) and the third (TeamCity) is included as a separate header. It's possible that the other two may be split out in the future too - as that would make the core of Catch smaller for those that don't need them.
|
||||
|
||||
## XML Reporter
|
||||
### XML Reporter
|
||||
```-r xml```
|
||||
|
||||
The XML Reporter writes in an XML format that is specific to Catch.
|
||||
@@ -17,7 +18,7 @@ The advantage of this format is that it corresponds well to the way Catch works
|
||||
|
||||
The disadvantage is that, being specific to Catch, no existing build servers understand the format natively. It can be used as input to an XSLT transformation that could covert it to, say, HTML - although this loses the streaming advantage, of course.
|
||||
|
||||
## JUnit Reporter
|
||||
### JUnit Reporter
|
||||
```-r junit```
|
||||
|
||||
The JUnit Reporter writes in an XML format that mimics the JUnit ANT schema.
|
||||
@@ -52,9 +53,9 @@ The Automake Reporter writes out the [meta tags](https://www.gnu.org/software/au
|
||||
|
||||
Because of the incremental nature of Catch's test suites and ability to run specific tests, our implementation of TAP reporter writes out the number of tests in a suite last.
|
||||
|
||||
# Low-level tools
|
||||
## Low-level tools
|
||||
|
||||
## CMake
|
||||
### CMake
|
||||
|
||||
In general we recommend "vendoring" Catch's single-include releases inside your own repository. If you do this, the following example shows a minimal CMake project:
|
||||
```CMake
|
||||
@@ -140,4 +141,4 @@ If you are using GCOV tool to get testing coverage of your code, and are not sur
|
||||
|
||||
---
|
||||
|
||||
[Home](Readme.md)
|
||||
[Home](Readme.md#top)
|
||||
|
@@ -1,3 +1,30 @@
|
||||
<a id="top"></a>
|
||||
# Command line
|
||||
|
||||
**Contents**
|
||||
[Specifying which tests to run](#specifying-which-tests-to-run)
|
||||
[Choosing a reporter to use](#choosing-a-reporter-to-use)
|
||||
[Breaking into the debugger](#breaking-into-the-debugger)
|
||||
[Showing results for successful tests](#showing-results-for-successful-tests)
|
||||
[Aborting after a certain number of failures](#aborting-after-a-certain-number-of-failures)
|
||||
[Listing available tests, tags or reporters](#listing-available-tests-tags-or-reporters)
|
||||
[Sending output to a file](#sending-output-to-a-file)
|
||||
[Naming a test run](#naming-a-test-run)
|
||||
[Eliding assertions expected to throw](#eliding-assertions-expected-to-throw)
|
||||
[Make whitespace visible](#make-whitespace-visible)
|
||||
[Warnings](#warnings)
|
||||
[Reporting timings](#reporting-timings)
|
||||
[Load test names to run from a file](#load-test-names-to-run-from-a-file)
|
||||
[Just test names](#just-test-names)
|
||||
[Specify the order test cases are run](#specify-the-order-test-cases-are-run)
|
||||
[Specify a seed for the Random Number Generator](#specify-a-seed-for-the-random-number-generator)
|
||||
[Identify framework and version according to the libIdentify standard](#identify-framework-and-version-according-to-the-libidentify-standard)
|
||||
[Wait for key before continuing](#wait-for-key-before-continuing)
|
||||
[Specify multiples of clock resolution to run benchmarks for](#specify-multiples-of-clock-resolution-to-run-benchmarks-for)
|
||||
[Usage](#usage)
|
||||
[Specify the section to run](#specify-the-section-to-run)
|
||||
[Filenames as tags](#filenames-as-tags)
|
||||
|
||||
Catch works quite nicely without any command line options at all - but for those times when you want greater control the following options are available.
|
||||
Click one of the followings links to take you straight to that option - or scroll on to browse the available options.
|
||||
|
||||
@@ -298,4 +325,4 @@ So, for example, tests within the file `~\Dev\MyProject\Ferrets.cpp` would be t
|
||||
|
||||
---
|
||||
|
||||
[Home](Readme.md)
|
||||
[Home](Readme.md#top)
|
||||
|
@@ -1,6 +1,7 @@
|
||||
<a id="top"></a>
|
||||
# Commercial users of Catch
|
||||
|
||||
As well as [Open Source](opensource-users.md) users Catch is widely used within proprietary code bases too.
|
||||
As well as [Open Source](opensource-users.md#top) users Catch is widely used within proprietary code bases too.
|
||||
Many organisations like to keep this information internal, and that's fine,
|
||||
but if you're more open it would be great if we could list the names of as
|
||||
many organisations as possible that use Catch somewhere in their codebase.
|
||||
|
@@ -1,22 +1,42 @@
|
||||
<a id="top"></a>
|
||||
# Compile-time configuration
|
||||
|
||||
**Contents**
|
||||
[main()/ implementation](#main-implementation)
|
||||
[Prefixing Catch macros](#prefixing-catch-macros)
|
||||
[Terminal colour](#terminal-colour)
|
||||
[Console width](#console-width)
|
||||
[stdout](#stdout)
|
||||
[Other toggles](#other-toggles)
|
||||
[Windows header clutter](#windows-header-clutter)
|
||||
|
||||
Catch is designed to "just work" as much as possible. For most people the only configuration needed is telling Catch which source file should host all the implementation code (```CATCH_CONFIG_MAIN```).
|
||||
|
||||
Nonetheless there are still some occasions where finer control is needed. For these occasions Catch exposes a set of macros for configuring how it is built.
|
||||
|
||||
# main()/ implementation
|
||||
## main()/ implementation
|
||||
|
||||
CATCH_CONFIG_MAIN // Designates this as implementation file and defines main()
|
||||
CATCH_CONFIG_RUNNER // Designates this as implementation file
|
||||
|
||||
Although Catch is header only it still, internally, maintains a distinction between interface headers and headers that contain implementation. Only one source file in your test project should compile the implementation headers and this is controlled through the use of one of these macros - one of these identifiers should be defined before including Catch in *exactly one implementation file in your project*.
|
||||
|
||||
# Prefixing Catch macros
|
||||
# Reporter / Listener interfaces
|
||||
|
||||
CATCH_CONFIG_EXTERNAL_INTERFACES // Brings in neccessary headers for Reporter/Listener implementation
|
||||
|
||||
Brings in various parts of Catch that are required for user defined Reporters and Listeners. This means that new Reporters and Listeners can be defined in this file as well as in the main file.
|
||||
|
||||
Implied by both `CATCH_CONFIG_MAIN` and `CATCH_CONFIG_RUNNER`.
|
||||
|
||||
## Prefixing Catch macros
|
||||
|
||||
CATCH_CONFIG_PREFIX_ALL
|
||||
|
||||
To keep test code clean and uncluttered Catch uses short macro names (e.g. ```TEST_CASE``` and ```REQUIRE```). Occasionally these may conflict with identifiers from platform headers or the system under test. In this case the above identifier can be defined. This will cause all the Catch user macros to be prefixed with ```CATCH_``` (e.g. ```CATCH_TEST_CASE``` and ```CATCH_REQUIRE```).
|
||||
|
||||
|
||||
# Terminal colour
|
||||
## Terminal colour
|
||||
|
||||
CATCH_CONFIG_COLOUR_NONE // completely disables all text colouring
|
||||
CATCH_CONFIG_COLOUR_WINDOWS // forces the Win32 console API to be used
|
||||
@@ -32,14 +52,14 @@ Note that when ANSI colour codes are used "unistd.h" must be includable - along
|
||||
|
||||
Typically you should place the ```#define``` before #including "catch.hpp" in your main source file - but if you prefer you can define it for your whole project by whatever your IDE or build system provides for you to do so.
|
||||
|
||||
# Console width
|
||||
## Console width
|
||||
|
||||
CATCH_CONFIG_CONSOLE_WIDTH = x // where x is a number
|
||||
|
||||
Catch formats output intended for the console to fit within a fixed number of characters. This is especially important as indentation is used extensively and uncontrolled line wraps break this.
|
||||
By default a console width of 80 is assumed but this can be controlled by defining the above identifier to be a different value.
|
||||
|
||||
# stdout
|
||||
## stdout
|
||||
|
||||
CATCH_CONFIG_NOSTDOUT
|
||||
|
||||
@@ -53,7 +73,7 @@ This can be useful on certain platforms that do not provide the standard iostrea
|
||||
|
||||
|
||||
|
||||
# Other toggles
|
||||
## Other toggles
|
||||
|
||||
CATCH_CONFIG_COUNTER // Use __COUNTER__ to generate unique names for test cases
|
||||
CATCH_CONFIG_WINDOWS_SEH // Enable SEH handling on Windows
|
||||
@@ -61,6 +81,8 @@ This can be useful on certain platforms that do not provide the standard iostrea
|
||||
CATCH_CONFIG_DISABLE_MATCHERS // Do not compile Matchers in this compilation unit
|
||||
CATCH_CONFIG_POSIX_SIGNALS // Enable handling POSIX signals
|
||||
CATCH_CONFIG_WINDOWS_CRTDBG // Enable leak checking using Windows's CRT Debug Heap
|
||||
CATCH_CONFIG_DISABLE_STRINGIFICATION // Disable stringifying the original expression
|
||||
CATCH_CONFIG_DISABLE // Disables assertions and test case registration
|
||||
|
||||
Currently Catch enables `CATCH_CONFIG_WINDOWS_SEH` only when compiled with MSVC, because some versions of MinGW do not have the necessary Win32 API support.
|
||||
|
||||
@@ -70,21 +92,29 @@ Currently Catch enables `CATCH_CONFIG_WINDOWS_SEH` only when compiled with MSVC,
|
||||
|
||||
These toggles can be disabled by using `_NO_` form of the toggle, e.g. `CATCH_CONFIG_NO_WINDOWS_SEH`.
|
||||
|
||||
## `CATCH_CONFIG_FAST_COMPILE`
|
||||
### `CATCH_CONFIG_FAST_COMPILE`
|
||||
Defining this flag speeds up compilation of test files by ~20%, by making 2 changes:
|
||||
* The `-b` (`--break`) flag no longer makes Catch break into debugger in the same stack frame as the failed test, but rather in a stack frame *below*.
|
||||
* The `REQUIRE` family of macros (`REQUIRE`, `REQUIRE_FALSE` and `REQUIRE_THAT`) no longer uses local try-catch block. This disables exception translation, but should not lead to false negatives.
|
||||
* Non-exception family of macros ({`REQUIRE`,`CHECK`}{`_`,`_FALSE`, `_FALSE`}, no longer use local try-cache block. This disables exception translation, but should not lead to false negatives.
|
||||
|
||||
`CATCH_CONFIG_FAST_COMPILE` has to be either defined, or not defined, in all translation units that are linked into single test binary, or the behaviour of setting `-b` flag and throwing unexpected exceptions will be unpredictable.
|
||||
|
||||
|
||||
## `CATCH_CONFIG_DISABLE_MATCHERS`
|
||||
### `CATCH_CONFIG_DISABLE_MATCHERS`
|
||||
When `CATCH_CONFIG_DISABLE_MATCHERS` is defined, all mentions of Catch's Matchers are ifdef-ed away from the translation unit. Doing so will speed up compilation of that TU.
|
||||
|
||||
_Note: If you define `CATCH_CONFIG_DISABLE_MATCHERS` in the same file as Catch's main is implemented, your test executable will fail to link if you use Matchers anywhere._
|
||||
|
||||
### `CATCH_CONFIG_DISABLE_STRINGIFICATION`
|
||||
This toggle enables a workaround for VS 2017 bug. For details see [known limitations](limitations.md#Visual Studio 2017 -- raw string literal in assert fails to compile)
|
||||
|
||||
# Windows header clutter
|
||||
### `CATCH_CONFIG_DISABLE`
|
||||
This toggle removes most of Catch from given file. This means that `TEST_CASE`s are not registered and assertions are turned into no-ops. Useful for keeping tests within implementation files (ie for functions with internal linkage), instead of in external files.
|
||||
|
||||
This feature is considered experimental and might change at any point.
|
||||
|
||||
_Inspired by Doctest's `DOCTEST_CONFIG_DISABLE`_
|
||||
|
||||
## Windows header clutter
|
||||
|
||||
On Windows Catch includes `windows.h`. To minimize global namespace clutter in the implementation file, it defines `NOMINMAX` and `WIN32_LEAN_AND_MEAN` before including it. You can control this behaviour via two macros:
|
||||
|
||||
@@ -93,4 +123,4 @@ On Windows Catch includes `windows.h`. To minimize global namespace clutter in t
|
||||
|
||||
---
|
||||
|
||||
[Home](Readme.md)
|
||||
[Home](Readme.md#top)
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<a id="top"></a>
|
||||
# Contributing to Catch
|
||||
|
||||
So you want to contribute something to Catch? That's great! Whether it's a bug fix, a new feature, support for
|
||||
@@ -57,4 +58,4 @@ be fairly self-explanatory.
|
||||
|
||||
---
|
||||
|
||||
[Home](Readme.md)
|
||||
[Home](Readme.md#top)
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<a id="top"></a>
|
||||
# Event Listeners
|
||||
|
||||
A `Listener` is a class you can register with Catch that will then be passed events,
|
||||
@@ -12,10 +13,11 @@ so you are not forced to implement events you're not interested in.
|
||||
|
||||
|
||||
## Implementing a Listener
|
||||
Simply derive a class from `Catch::TestEventListenerBase` and implement the methods you are interested in, either in
|
||||
the main source file (i.e. the one that defines `CATCH_CONFIG_MAIN` or `CATCH_CONFIG_RUNNER`), or in a
|
||||
file that defines `CATCH_CONFIG_EXTERNAL_INTERFACES`.
|
||||
|
||||
In your main source file (i.e. the one that has the `#define` for `CATCH_CONFIG_MAIN` or `CATCH_CONFIG_RUNNER`),
|
||||
simply derive a class from `Catch::TestEventListenerBase` and implement the methods you are interested in.
|
||||
Then register it using `INTERNAL_CATCH_REGISTER_LISTENER`.
|
||||
Then register it using `CATCH_REGISTER_LISTENER`.
|
||||
|
||||
For example:
|
||||
|
||||
@@ -70,4 +72,4 @@ just look in the source code to see what fields are available.
|
||||
|
||||
---
|
||||
|
||||
[Home](Readme.md)
|
||||
[Home](Readme.md#top)
|
||||
|
@@ -1,7 +1,22 @@
|
||||
<a id="top"></a>
|
||||
# Known limitations
|
||||
|
||||
Catch has some known limitations, that we are not planning to change. Some of these are caused by our desire to support C++98 compilers, some of these are caused by our desire to keep Catch crossplatform, some exist because their priority is seen as low compared to the development effort they would need and some other yet are compiler/runtime bugs.
|
||||
|
||||
## Implementation limits
|
||||
### Sections nested in loops
|
||||
|
||||
If you are using `SECTION`s inside loops, you have to create them with different name per loop's iteration. The recommended way to do so is to incorporate the loop's counter into section's name, like so
|
||||
```cpp
|
||||
TEST_CASE( "Looped section" ) {
|
||||
for (char i = '0'; i < '5'; ++i) {
|
||||
SECTION(std::string("Looped section ") + i) {
|
||||
SUCCEED( "Everything is OK" );
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Features
|
||||
This section outlines some missing features, what is their status and their possible workarounds.
|
||||
|
||||
@@ -50,6 +65,38 @@ Both of these solutions have their problems, but should let you wring parallelis
|
||||
## 3rd party bugs
|
||||
This section outlines known bugs in 3rd party components (this means compilers, standard libraries, standard runtimes).
|
||||
|
||||
### Visual Studio 2017 -- raw string literal in assert fails to compile
|
||||
There is a known bug in Visual Studio 2017 (VC 15), that causes compilation error when preprocessor attempts to stringize a raw string literal (`#` preprocessor is applied to it). This snippet is sufficient to trigger the compilation error:
|
||||
```cpp
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include "catch.hpp"
|
||||
|
||||
TEST_CASE("test") {
|
||||
CHECK(std::string(R"("\)") == "\"\\");
|
||||
}
|
||||
```
|
||||
|
||||
Catch provides a workaround, it is possible to disable stringification of original expressions by defining `CATCH_CONFIG_DISABLE_STRINGIFICATION`:
|
||||
```cpp
|
||||
#define CATCH_CONFIG_FAST_COMPILE
|
||||
#define CATCH_CONFIG_DISABLE_STRINGIFICATION
|
||||
#include "catch.hpp"
|
||||
|
||||
TEST_CASE("test") {
|
||||
CHECK(std::string(R"("\)") == "\"\\");
|
||||
}
|
||||
```
|
||||
|
||||
_Do note that this changes the output somewhat_
|
||||
```
|
||||
catchwork\test1.cpp(6):
|
||||
PASSED:
|
||||
CHECK( Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION )
|
||||
with expansion:
|
||||
""\" == ""\"
|
||||
```
|
||||
|
||||
|
||||
### Visual Studio 2013 -- do-while loop withing range based for fails to compile (C2059)
|
||||
There is a known bug in Visual Studio 2013 (VC 12), that causes compilation error if range based for is followed by an assertion macro, without enclosing the block in braces. This snippet is sufficient to trigger the error
|
||||
```cpp
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<a id="top"></a>
|
||||
# Logging macros
|
||||
|
||||
Additional messages can be logged during a test case. Note that the messages are scoped and thus will not be reported if failure occurs in scope preceding the message declaration. An example:
|
||||
@@ -79,4 +80,4 @@ These macros are now deprecated and are just aliases for INFO and CAPTURE (which
|
||||
|
||||
---
|
||||
|
||||
[Home](Readme.md)
|
||||
[Home](Readme.md#top)
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<a id="top"></a>
|
||||
# Matchers
|
||||
|
||||
Matchers are an alternative way to do assertions which are easily extensible and composable.
|
||||
@@ -101,4 +102,4 @@ with expansion:
|
||||
|
||||
---
|
||||
|
||||
[Home](Readme.md)
|
||||
[Home](Readme.md#top)
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<a id="top"></a>
|
||||
# Open Source projects using Catch
|
||||
|
||||
Catch is great for open source. With it's [liberal license](../LICENSE.txt) and single-header, dependency-free, distribution
|
||||
@@ -25,6 +26,9 @@ The core part of the Chakra Javascript engine that powers Microsoft Edge
|
||||
### [ChaiScript](https://github.com/ChaiScript/ChaiScript)
|
||||
A, header-only, embedded scripting language designed from the ground up to directly target C++ and take advantage of modern C++ development techniques
|
||||
|
||||
### [Clara](https://github.com/philsquared/Clara)
|
||||
A, single-header-only, type-safe, command line parser - which also prints formatted usage strings.
|
||||
|
||||
### [Couchbase-lite-core](https://github.com/couchbase/couchbase-lite-core)
|
||||
The next-generation core storage and query engine for Couchbase Lite/
|
||||
|
||||
@@ -52,6 +56,9 @@ A C++ client library for Consul. Consul is a distributed tool for discovering an
|
||||
### [Reactive-Extensions/ RxCpp](https://github.com/Reactive-Extensions/RxCpp)
|
||||
A library of algorithms for values-distributed-in-time
|
||||
|
||||
### [TextFlowCpp](https://github.com/philsquared/textflowcpp)
|
||||
A small, single-header-only, library for wrapping and composing columns of text
|
||||
|
||||
### [Trompeloeil](https://github.com/rollbear/trompeloeil)
|
||||
A thread safe header only mocking framework for C++14
|
||||
|
||||
@@ -77,4 +84,4 @@ Standardese aims to be a nextgen Doxygen
|
||||
|
||||
---
|
||||
|
||||
[Home](Readme.md)
|
||||
[Home](Readme.md#top)
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<a id="top"></a>
|
||||
# Supplying main() yourself
|
||||
|
||||
The easiest way to use Catch is to let it supply ```main()``` for you and handle configuring itself from the command line.
|
||||
@@ -83,4 +84,4 @@ Catch embeds a powerful command line parser which you can also use to parse your
|
||||
|
||||
---
|
||||
|
||||
[Home](Readme.md)
|
||||
[Home](Readme.md#top)
|
||||
|
@@ -1,15 +1,75 @@
|
||||
# 1.9.6
|
||||
<a id="top"></a>
|
||||
# 2.0.0 (in progress)
|
||||
|
||||
### Improvements
|
||||
## Breaking changes
|
||||
* Removed C++98 support
|
||||
* Removed legacy reporter support
|
||||
* Removed legacy generator support
|
||||
* Generator support will come back later, reworked
|
||||
* Removed `Catch::toString` support
|
||||
* The new stringification machinery uses `Catch::StringMaker` specializations first and `operator<<` overloads second.
|
||||
* Removed legacy `SCOPED_MSG` and `SCOPED_INFO` macros
|
||||
* Removed `INTERNAL_CATCH_REGISTER_REPORTER`
|
||||
* `CATCH_REGISTER_REPORTER` should be used to register reporters
|
||||
* Removed legacy `[hide]` tag
|
||||
* `[.]`, `[.foo]` and `[!hide]` are still supported
|
||||
* Output into debugger is now colourized
|
||||
* `*_THROWS_AS(expr, exception_type)` now unconditionally appends `const&` to the exception type.
|
||||
* `CATCH_CONFIG_FAST_COMPILE` now affects the `CHECK_` family of assertions as well as `REQUIRE_` family of assertions
|
||||
* This is most noticeable in `CHECK(throws())`, which would previously report failure, properly stringify the exception and continue. Now it will report failure and stop executing current section.
|
||||
|
||||
## Improvements
|
||||
* Reporters and Listeners can be defined in files different from the main file
|
||||
* The file has to define `CATCH_CONFIG_EXTERNAL_INTERFACES` before including catch.hpp.
|
||||
* Errors that happen during set up before main are now caught and properly reported once main is entered
|
||||
* If you are providing your own main, you can access and use these as well.
|
||||
* New assertion macros, *_THROWS_WITH(expr, exception_type, matcher) are provided
|
||||
* As the arguments suggest, these allow you to assert that an expression throws desired type of exception and pass the exception to a matcher.
|
||||
* JUnit reporter no longer has significantly different output for test cases with and without sections
|
||||
* Most assertions now support expressions containing commas (ie `REQUIRE(foo() == std::vector<int>{1, 2, 3});`)
|
||||
* Catch now contains experimental micro benchmarking support
|
||||
* See `projects/SelfTest/Benchmark.tests.cpp` for examples
|
||||
* The support being experiment means that it can be changed without prior notice
|
||||
* Catch uses new CLI parsing library (Clara)
|
||||
* Users can now easily add new command line options to the final executable
|
||||
* This also leads to some changes in `Catch::Session` interface
|
||||
* All parts of matchers can be removed from a TU by defining `CATCH_CONFIG_DISABLE_MATCHERS`
|
||||
* This can be used to somewhat speed up compilation times
|
||||
* An experimental implementation of `CATCH_CONFIG_DISABLE` has been added
|
||||
* Speeds up compilation by removing away Catch tests
|
||||
* Currently removes all assertions and prevents `TEST_CASE` registrations
|
||||
* Useful for implementing tests in source files
|
||||
* ie for functions in anonymous namespaces
|
||||
* Inspired by Doctest's `DOCTEST_CONFIG_DISABLE`
|
||||
|
||||
## Fixes
|
||||
|
||||
|
||||
## Internal changes
|
||||
* The development version now uses .cpp files instead of header files containing implementation.
|
||||
* This makes partial rebuilds much faster during development
|
||||
* The expression decomposition layer has been rewritten
|
||||
* The evaluation layer has been rewritten
|
||||
* New library (TextFlow) is used for formatting text to output
|
||||
|
||||
|
||||
|
||||
# Older versions
|
||||
|
||||
## 1.9.x
|
||||
|
||||
### 1.9.6
|
||||
|
||||
#### Improvements
|
||||
* Catch's runtime overhead has been significantly decreased (#937, #939)
|
||||
* Added `--list-extra-info` cli option (#934).
|
||||
* It lists all tests together with extra information, ie filename, line number and description.
|
||||
|
||||
|
||||
|
||||
# 1.9.5
|
||||
### 1.9.5
|
||||
|
||||
### Fixes
|
||||
#### Fixes
|
||||
* Truthy expressions are now reconstructed properly, not as booleans (#914)
|
||||
* Various warnings are no longer erroneously suppressed in test files (files that include `catch.hpp`, but do not define `CATCH_CONFIG_MAIN` or `CATCH_CONFIG_RUNNER`) (#871)
|
||||
* Catch no longer fails to link when main is compiled as C++, but linked against Objective-C (#855)
|
||||
@@ -17,35 +77,35 @@
|
||||
* Previously any GCC with minor version less than 3 would be incorrectly classified as not supporting `__COUNTER__`.
|
||||
* Suppressed C4996 warning caused by upcoming updated to MSVC 2017, marking `std::uncaught_exception` as deprecated. (#927)
|
||||
|
||||
### Improvements
|
||||
#### Improvements
|
||||
* CMake integration script now incorporates debug messages and registers tests in an improved way (#911)
|
||||
* Various documentation improvements
|
||||
|
||||
|
||||
|
||||
# 1.9.4
|
||||
### 1.9.4
|
||||
|
||||
### Fixes
|
||||
#### Fixes
|
||||
* `CATCH_FAIL` macro no longer causes compilation error without variadic macro support
|
||||
* `INFO` messages are no longer cleared after being reported once
|
||||
|
||||
### Improvements and minor changes
|
||||
#### Improvements and minor changes
|
||||
* Catch now uses `wmain` when compiled under Windows and `UNICODE` is defined.
|
||||
* Note that Catch still officially supports only ASCII
|
||||
|
||||
# 1.9.3
|
||||
### 1.9.3
|
||||
|
||||
### Fixes
|
||||
#### Fixes
|
||||
* Completed the fix for (lack of) uint64_t in earlier Visual Studios
|
||||
|
||||
# 1.9.2
|
||||
### 1.9.2
|
||||
|
||||
### Improvements and minor changes
|
||||
#### Improvements and minor changes
|
||||
* All of `Approx`'s member functions now accept strong typedefs in C++11 mode (#888)
|
||||
* Previously `Approx::scale`, `Approx::epsilon`, `Approx::margin` and `Approx::operator()` didn't.
|
||||
|
||||
|
||||
### Fixes
|
||||
#### Fixes
|
||||
* POSIX signals are now disabled by default under QNX (#889)
|
||||
* QNX does not support current enough (2001) POSIX specification
|
||||
* JUnit no longer counts exceptions as failures if given test case is marked as ok to fail.
|
||||
@@ -53,22 +113,22 @@
|
||||
* Catch no longer attempts to define `uint64_t` on windows (#862)
|
||||
* This was causing trouble when compiled under Cygwin
|
||||
|
||||
### Other
|
||||
#### Other
|
||||
* Catch is now compiled under MSVC 2017 using `std:c++latest` (C++17 mode) in CI
|
||||
* We now provide cmake script that autoregisters Catch tests into ctest.
|
||||
* See `contrib` folder.
|
||||
|
||||
|
||||
# 1.9.1
|
||||
### 1.9.1
|
||||
|
||||
### Fixes
|
||||
#### Fixes
|
||||
* Unexpected exceptions are no longer ignored by default (#885, #887)
|
||||
|
||||
|
||||
# 1.9.0
|
||||
### 1.9.0
|
||||
|
||||
|
||||
### Improvements and minor changes
|
||||
#### Improvements and minor changes
|
||||
* Catch no longer attempts to ensure the exception type passed by user in `REQUIRE_THROWS_AS` is a constant reference.
|
||||
* It was causing trouble when `REQUIRE_THROWS_AS` was used inside templated functions
|
||||
* This actually reverts changes made in v1.7.2
|
||||
@@ -82,7 +142,7 @@
|
||||
* When Catch is compiled using C++11, `Approx` is now constructible with anything that can be explicitly converted to `double`.
|
||||
* Captured messages are now printed on unexpected exceptions
|
||||
|
||||
### Fixes:
|
||||
#### Fixes:
|
||||
* Clang's `-Wexit-time-destructors` should be suppressed for Catch's internals
|
||||
* GCC's `-Wparentheses` is now suppressed for all TU's that include `catch.hpp`.
|
||||
* This is functionally a revert of changes made in 1.8.0, where we tried using `_Pragma` based suppression. This should have kept the suppression local to Catch's assertions, but bugs in GCC's handling of `_Pragma`s in C++ mode meant that it did not always work.
|
||||
@@ -91,16 +151,18 @@
|
||||
* [Details can be found in documentation](configuration.md#catch_config_cpp11_stream_insertable_check)
|
||||
|
||||
|
||||
### Other notes:
|
||||
#### Other notes:
|
||||
* We have added VS 2017 to our CI
|
||||
* Work on Catch 2 should start soon
|
||||
|
||||
|
||||
|
||||
# 1.8.2
|
||||
## 1.8.x
|
||||
|
||||
### 1.8.2
|
||||
|
||||
|
||||
### Improvements and minor changes
|
||||
#### Improvements and minor changes
|
||||
* TAP reporter now behaves as if `-s` was always set
|
||||
* This should be more consistent with the protocol desired behaviour.
|
||||
* Compact reporter now obeys `-d yes` argument (#780)
|
||||
@@ -110,11 +172,11 @@
|
||||
* This means it reports `INFO` messages on success, if output on success (`-s`) is enabled.
|
||||
* Previously it only reported `INFO` messages on failure.
|
||||
* `CAPTURE(expr)` now stringifies `expr` in the same way assertion macros do (#639)
|
||||
* Listeners are now finally [documented](event-listeners.md).
|
||||
* Listeners are now finally [documented](event-listeners.md#top).
|
||||
* Listeners provide a way to hook into events generated by running your tests, including start and end of run, every test case, every section and every assertion.
|
||||
|
||||
|
||||
### Fixes:
|
||||
#### Fixes:
|
||||
* Catch no longer attempts to reconstruct expression that led to a fatal error (#810)
|
||||
* This fixes possible signal/SEH loop when processing expressions, where the signal was triggered by expression decomposition.
|
||||
* Fixed (C4265) missing virtual destructor warning in Matchers (#844)
|
||||
@@ -131,25 +193,25 @@
|
||||
* Regression in Objective-C bindings (Matchers) fixed (#854)
|
||||
|
||||
|
||||
### Other notes:
|
||||
#### Other notes:
|
||||
* We have added VS 2013 and 2015 to our CI
|
||||
* Catch Classic (1.x.x) now contains its own, forked, version of Clara (the argument parser).
|
||||
|
||||
|
||||
|
||||
# 1.8.1
|
||||
### 1.8.1
|
||||
|
||||
### Fixes
|
||||
#### Fixes
|
||||
|
||||
Cygwin issue with `gettimeofday` - `#define` was not early enough
|
||||
|
||||
# 1.8.0
|
||||
### 1.8.0
|
||||
|
||||
### New features/ minor changes
|
||||
#### New features/ minor changes
|
||||
|
||||
* Matchers have new, simpler (and documented) interface.
|
||||
* Catch provides string and vector matchers.
|
||||
* For details see [Matchers documentation](matchers.md).
|
||||
* For details see [Matchers documentation](matchers.md#top).
|
||||
* Changed console reporter test duration reporting format (#322)
|
||||
* Old format: `Some simple comparisons between doubles completed in 0.000123s`
|
||||
* New format: `xxx.123s: Some simple comparisons between doubles` _(There will always be exactly 3 decimal places)_
|
||||
@@ -160,12 +222,12 @@ Cygwin issue with `gettimeofday` - `#define` was not early enough
|
||||
* _More changes are coming_
|
||||
* Added [TAP (Test Anything Protocol)](https://testanything.org/) and [Automake](https://www.gnu.org/software/automake/manual/html_node/Log-files-generation-and-test-results-recording.html#Log-files-generation-and-test-results-recording) reporters.
|
||||
* These are not present in the default single-include header and need to be downloaded from GitHub separately.
|
||||
* For details see [documentation about integrating with build systems](build-systems.md).
|
||||
* For details see [documentation about integrating with build systems](build-systems.md#top).
|
||||
* XML reporter now reports filename as part of the `Section` and `TestCase` tags.
|
||||
* `Approx` now supports an optional margin of absolute error
|
||||
* It has also received [new documentation](assertions.md).
|
||||
* It has also received [new documentation](assertions.md#top).
|
||||
|
||||
### Fixes
|
||||
#### Fixes
|
||||
* Silenced C4312 ("conversion from int to 'ClassName *") warnings in the evaluate layer.
|
||||
* Fixed C4512 ("assignment operator could not be generated") warnings under VS2013.
|
||||
* Cygwin compatibility fixes
|
||||
@@ -176,13 +238,15 @@ Cygwin issue with `gettimeofday` - `#define` was not early enough
|
||||
* Otherwise it is supressed for the whole TU
|
||||
* Fixed test spec parser issue (with escapes in multiple names)
|
||||
|
||||
### Other
|
||||
#### Other
|
||||
* Various documentation fixes and improvements
|
||||
|
||||
|
||||
# 1.7.2
|
||||
## 1.7.x
|
||||
|
||||
### Fixes and minor improvements
|
||||
### 1.7.2
|
||||
|
||||
#### Fixes and minor improvements
|
||||
Xml:
|
||||
|
||||
(technically the first two are breaking changes but are also fixes and arguably break few if any people)
|
||||
@@ -201,26 +265,26 @@ Other:
|
||||
* Silenced a few more warnings in different circumstances
|
||||
* Travis improvements
|
||||
|
||||
# 1.7.1
|
||||
### 1.7.1
|
||||
|
||||
### Fixes:
|
||||
#### Fixes:
|
||||
* Fixed inconsistency in defining `NOMINMAX` and `WIN32_LEAN_AND_MEAN` inside `catch.hpp`.
|
||||
* Fixed SEH-related compilation error under older MinGW compilers, by making Windows SEH handling opt-in for compilers other than MSVC.
|
||||
* For specifics, look into the [documentation](configuration.md).
|
||||
* For specifics, look into the [documentation](configuration.md#top).
|
||||
* Fixed compilation error under MinGW caused by improper compiler detection.
|
||||
* Fixed XML reporter sometimes leaving an empty output file when a test ends with signal/structured exception.
|
||||
* Fixed XML reporter not reporting captured stdout/stderr.
|
||||
* Fixed possible infinite recursion in Windows SEH.
|
||||
* Fixed possible compilation error caused by Catch's operator overloads being ambiguous in regards to user-defined templated operators.
|
||||
|
||||
## 1.7.0
|
||||
### 1.7.0
|
||||
|
||||
### Features/ Changes:
|
||||
#### Features/ Changes:
|
||||
* Catch now runs significantly faster for passing tests
|
||||
* Microbenchmark focused on Catch's overhead went from ~3.4s to ~0.7s.
|
||||
* Real world test using [JSON for Modern C++](https://github.com/nlohmann/json)'s test suite went from ~6m 25s to ~4m 14s.
|
||||
* Catch can now run specific sections within test cases.
|
||||
* For now the support is only basic (no wildcards or tags), for details see the [documentation](command-line.md).
|
||||
* For now the support is only basic (no wildcards or tags), for details see the [documentation](command-line.md#top).
|
||||
* Catch now supports SEH on Windows as well as signals on Linux.
|
||||
* After receiving a signal, Catch reports failing assertion and then passes the signal onto the previous handler.
|
||||
* Approx can be used to compare values against strong typedefs (available in C++11 mode only).
|
||||
@@ -229,61 +293,63 @@ Other:
|
||||
* Certain characters (space, tab, etc) are now pretty printed.
|
||||
* This means that a `char c = ' '; REQUIRE(c == '\t');` would be printed as `' ' == '\t'`, instead of ` == 9`.
|
||||
|
||||
### Fixes:
|
||||
#### Fixes:
|
||||
* Text formatting no longer attempts to access out-of-bounds characters under certain conditions.
|
||||
* THROW family of assertions no longer trigger `-Wunused-value` on expressions containing explicit cast.
|
||||
* Breaking into debugger under OS X works again and no longer required `DEBUG` to be defined.
|
||||
* Compilation no longer breaks under certain compiler if a lambda is used inside assertion macro.
|
||||
|
||||
### Other:
|
||||
#### Other:
|
||||
* Catch's CMakeLists now defines install command.
|
||||
* Catch's CMakeLists now generates projects with warnings enabled.
|
||||
|
||||
|
||||
## 1.6.1
|
||||
## 1.6.x
|
||||
|
||||
### Features/ Changes:
|
||||
### 1.6.1
|
||||
|
||||
#### Features/ Changes:
|
||||
* Catch now supports breaking into debugger on Linux
|
||||
|
||||
### Fixes:
|
||||
#### Fixes:
|
||||
* Generators no longer leak memory (generators are still unsupported in general)
|
||||
* JUnit reporter now reports UTC timestamps, instead of "tbd"
|
||||
* `CHECK_THAT` macro is now properly defined as `CATCH_CHECK_THAT` when using `CATCH_` prefixed macros
|
||||
|
||||
### Other:
|
||||
#### Other:
|
||||
* Types with overloaded `&&` operator are no longer evaluated twice when used in an assertion macro.
|
||||
* The use of `__COUNTER__` is supressed when Catch is parsed by CLion
|
||||
* This change is not active when compiling a binary
|
||||
* Approval tests can now be run on Windows
|
||||
* CMake will now warn if a file is present in the `include` folder but not is not enumerated as part of the project
|
||||
* Catch now defines `NOMINMAX` and `WIN32_LEAN_AND_MEAN` before including `windows.h`
|
||||
* This can be disabled if needed, see [documentation](configuration.md) for details.
|
||||
* This can be disabled if needed, see [documentation](configuration.md#top) for details.
|
||||
|
||||
|
||||
## 1.6.0
|
||||
### 1.6.0
|
||||
|
||||
### Cmake/ projects:
|
||||
#### Cmake/ projects:
|
||||
* Moved CMakeLists.txt to root, made it friendlier for CLion and generating XCode and VS projects, and removed the manually maintained XCode and VS projects.
|
||||
|
||||
### Features/ Changes:
|
||||
#### Features/ Changes:
|
||||
* Approx now supports `>=` and `<=`
|
||||
* Can now use `\` to escape chars in test names on command line
|
||||
* Standardize C++11 feature toggles
|
||||
|
||||
### Fixes:
|
||||
#### Fixes:
|
||||
* Blue shell colour
|
||||
* Missing argument to `CATCH_CHECK_THROWS`
|
||||
* Don't encode extended ASCII in XML
|
||||
* use `std::shuffle` on more compilers (fixes deprecation warning/error)
|
||||
* Use `__COUNTER__` more consistently (where available)
|
||||
|
||||
### Other:
|
||||
#### Other:
|
||||
* Tweaks and changes to scripts - particularly for Approval test - to make them more portable
|
||||
|
||||
|
||||
# Older versions
|
||||
# Even Older versions
|
||||
Release notes were not maintained prior to v1.6.0, but you should be able to work them out from the Git history
|
||||
|
||||
---
|
||||
|
||||
[Home](Readme.md)
|
||||
[Home](Readme.md#top)
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<a id="top"></a>
|
||||
# How to release
|
||||
|
||||
When enough changes have accumulated, it is time to release new version of Catch. This document describes the proces in doing so, that no steps are forgotten. Note that all referenced scripts can be found in the `scripts/` directory.
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<a id="top"></a>
|
||||
# Reporters
|
||||
|
||||
Catch has a modular reporting system and comes bundled with a handful of useful reporters built in.
|
||||
@@ -17,7 +18,7 @@ There are four reporters built in to the single include:
|
||||
|
||||
* `console` writes as lines of text, formatted to a typical terminal width, with colours if a capable terminal is detected.
|
||||
* `compact` similar to `console` but optimised for minimal output - each entry on one line
|
||||
* `junit` writes xml that corresponds to Ant's [junitreport](http://help.catchsoftware.com/display/ET/JUnit+Format) target. Useful for build systems that understand Junit. If you are using Jenkins with Catch 1.x, you can improve quality of output by applying changes in [#923](https://github.com/philsquared/Catch/pull/923).
|
||||
* `junit` writes xml that corresponds to Ant's [junitreport](http://help.catchsoftware.com/display/ET/JUnit+Format) target. Useful for build systems that understand Junit.
|
||||
Because of the way the junit format is structured the run must complete before anything is written.
|
||||
* `xml` writes an xml format tailored to Catch. Unlike `junit` this is a streaming format so results are delivered progressively.
|
||||
|
||||
@@ -42,4 +43,4 @@ but do keep in mind upcoming changes (these will be minor, simplifying, changes
|
||||
|
||||
---
|
||||
|
||||
[Home](Readme.md)
|
||||
[Home](Readme.md#top)
|
||||
|
@@ -1,5 +1,12 @@
|
||||
<a id="top"></a>
|
||||
# Why do my tests take so long to compile?
|
||||
|
||||
**Contents**
|
||||
[Short answer](#short-answer)
|
||||
[Long answer](#long-answer)
|
||||
[Practical example](#practical-example)
|
||||
[Other possible solutions](#other-possible-solutions)
|
||||
|
||||
Several people have reported that test code written with Catch takes much longer to compile than they would expect. Why is that?
|
||||
|
||||
Catch is implemented entirely in headers. There is a little overhead due to this - but not as much as you might think - and you can minimise it simply by organising your test code as follows:
|
||||
@@ -18,7 +25,7 @@ Because Catch is implemented *entirely* in headers you might think that the whol
|
||||
As a result the main source file *does* compile the whole of Catch every time! So it makes sense to dedicate this file to *only* ```#define```-ing the identifier and ```#include```-ing Catch (and implementing the runner code, if you're doing that). Keep all your test cases in other files. This way you won't pay the recompilation cost for the whole of Catch
|
||||
|
||||
## Practical example
|
||||
Assume you have the `Factorial` function from the [tutorial](tutorial.md) in `factorial.cpp` (with forward declaration in `factorial.h`) and want to test it and keep the compile times down when adding new tests. Then you should have 2 files, `tests-main.cpp` and `tests-factorial.cpp`:
|
||||
Assume you have the `Factorial` function from the [tutorial](tutorial.md#top) in `factorial.cpp` (with forward declaration in `factorial.h`) and want to test it and keep the compile times down when adding new tests. Then you should have 2 files, `tests-main.cpp` and `tests-factorial.cpp`:
|
||||
|
||||
```cpp
|
||||
// tests-main.cpp
|
||||
@@ -61,4 +68,4 @@ You can also opt to sacrifice some features in order to speed-up Catch's compila
|
||||
|
||||
---
|
||||
|
||||
[Home](Readme.md)
|
||||
[Home](Readme.md#top)
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<a id="top"></a>
|
||||
# Test cases and sections
|
||||
|
||||
While Catch fully supports the traditional, xUnit, style of class-based fixtures containing test case methods this is not the preferred style.
|
||||
@@ -11,7 +12,7 @@ Test cases and sections are very easy to use in practice:
|
||||
|
||||
_test name_ and _section name_ are free form, quoted, strings. The optional _tags_ argument is a quoted string containing one or more tags enclosed in square brackets. Tags are discussed below. Test names must be unique within the Catch executable.
|
||||
|
||||
For examples see the [Tutorial](tutorial.md)
|
||||
For examples see the [Tutorial](tutorial.md#top)
|
||||
|
||||
## Tags
|
||||
|
||||
@@ -34,7 +35,7 @@ Tag names are not case sensitive and can contain any ASCII characters. This mean
|
||||
|
||||
All tag names beginning with non-alphanumeric characters are reserved by Catch. Catch defines a number of "special" tags, which have meaning to the test runner itself. These special tags all begin with a symbol character. Following is a list of currently defined special tags and their meanings.
|
||||
|
||||
* `[!hide]` or `[.]` (or, for legacy reasons, `[hide]`) - causes test cases to be skipped from the default list (i.e. when no test cases have been explicitly selected through tag expressions or name wildcards). The hide tag is often combined with another, user, tag (for example `[.][integration]` - so all integration tests are excluded from the default run but can be run by passing `[integration]` on the command line). As a short-cut you can combine these by simply prefixing your user tag with a `.` - e.g. `[.integration]`. Because the hide tag has evolved to have several forms, all forms are added as tags if you use one of them.
|
||||
* `[!hide]` or `[.]` - causes test cases to be skipped from the default list (i.e. when no test cases have been explicitly selected through tag expressions or name wildcards). The hide tag is often combined with another, user, tag (for example `[.][integration]` - so all integration tests are excluded from the default run but can be run by passing `[integration]` on the command line). As a short-cut you can combine these by simply prefixing your user tag with a `.` - e.g. `[.integration]`. Because the hide tag has evolved to have several forms, all forms are added as tags if you use one of them.
|
||||
|
||||
* `[!throws]` - lets Catch know that this test is likely to throw an exception even if successful. This causes the test to be excluded when running with `-e` or `--nothrow`.
|
||||
|
||||
@@ -48,6 +49,8 @@ All tag names beginning with non-alphanumeric characters are reserved by Catch.
|
||||
|
||||
* `[@<alias>]` - tag aliases all begin with `@` (see below).
|
||||
|
||||
* `[!benchmark]` - this test case is actually a benchmark. This is an experimental feature, and currently has no documentation. If you want to try it out, look at `projects/SelfTest/Benchmark.tests.cpp` for details.
|
||||
|
||||
## Tag aliases
|
||||
|
||||
Between tag expressions and wildcarded test names (as well as combinations of the two) quite complex patterns can be constructed to direct which test cases are run. If a complex pattern is used often it is convenient to be able to create an alias for the expression. this can be done, in code, using the following form:
|
||||
@@ -85,4 +88,4 @@ Other than the additional prefixes and the formatting in the console reporter th
|
||||
|
||||
---
|
||||
|
||||
[Home](Readme.md)
|
||||
[Home](Readme.md#top)
|
||||
|
@@ -1,3 +1,6 @@
|
||||
<a id="top"></a>
|
||||
# Test fixtures
|
||||
|
||||
Although Catch allows you to group tests together as sections within a test case, it can still be convenient, sometimes, to group them using a more traditional test fixture. Catch fully supports this too. You define the test fixture as a simple structure:
|
||||
|
||||
```c++
|
||||
@@ -29,4 +32,4 @@ The two test cases here will create uniquely-named derived classes of UniqueTest
|
||||
|
||||
---
|
||||
|
||||
[Home](Readme.md)
|
||||
[Home](Readme.md#top)
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<a id="top"></a>
|
||||
# String conversions
|
||||
|
||||
Catch needs to be able to convert types you use in assertions and logging expressions into strings (for logging and reporting purposes).
|
||||
@@ -44,4 +45,4 @@ CATCH_TRANSLATE_EXCEPTION( MyType& ex ) {
|
||||
|
||||
---
|
||||
|
||||
[Home](Readme.md)
|
||||
[Home](Readme.md#top)
|
||||
|
@@ -1,4 +1,16 @@
|
||||
# Getting Catch
|
||||
<a id="top"></a>
|
||||
# Tutorial
|
||||
|
||||
**Contents**
|
||||
[Getting Catch](#getting-catch)
|
||||
[Where to put it?](#where-to-put-it)
|
||||
[Writing tests](#writing-tests)
|
||||
[Test cases and sections](#test-cases-and-sections)
|
||||
[BDD-Style](#bdd-style)
|
||||
[Scaling up](#scaling-up)
|
||||
[Next steps](#next-steps)
|
||||
|
||||
## Getting Catch
|
||||
|
||||
The simplest way to get Catch is to download the latest [single header version](https://raw.githubusercontent.com/philsquared/Catch/master/single_include/catch.hpp). The single header is generated by merging a set of individual headers but it is still just normal source code in a header file.
|
||||
|
||||
@@ -11,7 +23,7 @@ Catch is header only. All you need to do is drop the file(s) somewhere reachable
|
||||
|
||||
The rest of this tutorial will assume that the Catch single-include header (or the include folder) is available unqualified - but you may need to prefix it with a folder name if necessary.
|
||||
|
||||
# Writing tests
|
||||
## Writing tests
|
||||
|
||||
Let's start with a really simple example. Say you have written a function to calculate factorials and now you want to test it (let's leave aside TDD for now).
|
||||
|
||||
@@ -39,7 +51,7 @@ TEST_CASE( "Factorials are computed", "[factorial]" ) {
|
||||
}
|
||||
```
|
||||
|
||||
This will compile to a complete executable which responds to [command line arguments](command-line.md). If you just run it with no arguments it will execute all test cases (in this case there is just one), report any failures, report a summary of how many tests passed and failed and return the number of failed tests (useful for if you just want a yes/ no answer to: "did it work").
|
||||
This will compile to a complete executable which responds to [command line arguments](command-line.md#top). If you just run it with no arguments it will execute all test cases (in this case there is just one), report any failures, report a summary of how many tests passed and failed and return the number of failed tests (useful for if you just want a yes/ no answer to: "did it work").
|
||||
|
||||
If you run this as written it will pass. Everything is good. Right?
|
||||
Well, there is still a bug here. In fact the first version of this tutorial I posted here genuinely had the bug in! So it's not completely contrived (thanks to Daryle Walker (```@CTMacUser```) for pointing this out).
|
||||
@@ -82,12 +94,12 @@ Now all the tests pass.
|
||||
|
||||
Of course there are still more issues to deal with. For example we'll hit problems when the return value starts to exceed the range of an unsigned int. With factorials that can happen quite quickly. You might want to add tests for such cases and decide how to handle them. We'll stop short of doing that here.
|
||||
|
||||
## What did we do here?
|
||||
### What did we do here?
|
||||
|
||||
Although this was a simple test it's been enough to demonstrate a few things about how Catch is used. Let's take moment to consider those before we move on.
|
||||
|
||||
1. All we did was ```#define``` one identifier and ```#include``` one header and we got everything - even an implementation of ```main()``` that will [respond to command line arguments](command-line.md). You can only use that ```#define``` in one implementation file, for (hopefully) obvious reasons. Once you have more than one file with unit tests in you'll just ```#include "catch.hpp"``` and go. Usually it's a good idea to have a dedicated implementation file that just has ```#define CATCH_CONFIG_MAIN``` and ```#include "catch.hpp"```. You can also provide your own implementation of main and drive Catch yourself (see [Supplying-your-own-main()](own-main.md)).
|
||||
2. We introduce test cases with the ```TEST_CASE``` macro. This macro takes one or two arguments - a free form test name and, optionally, one or more tags (for more see <a href="#test-cases-and-sections">Test cases and Sections</a>, ). The test name must be unique. You can run sets of tests by specifying a wildcarded test name or a tag expression. See the [command line docs](command-line.md) for more information on running tests.
|
||||
1. All we did was ```#define``` one identifier and ```#include``` one header and we got everything - even an implementation of ```main()``` that will [respond to command line arguments](command-line.md#top). You can only use that ```#define``` in one implementation file, for (hopefully) obvious reasons. Once you have more than one file with unit tests in you'll just ```#include "catch.hpp"``` and go. Usually it's a good idea to have a dedicated implementation file that just has ```#define CATCH_CONFIG_MAIN``` and ```#include "catch.hpp"```. You can also provide your own implementation of main and drive Catch yourself (see [Supplying-your-own-main()](own-main.md#top)).
|
||||
2. We introduce test cases with the ```TEST_CASE``` macro. This macro takes one or two arguments - a free form test name and, optionally, one or more tags (for more see <a href="#test-cases-and-sections">Test cases and Sections</a>, ). The test name must be unique. You can run sets of tests by specifying a wildcarded test name or a tag expression. See the [command line docs](command-line.md#top) for more information on running tests.
|
||||
3. The name and tags arguments are just strings. We haven't had to declare a function or method - or explicitly register the test case anywhere. Behind the scenes a function with a generated name is defined for you, and automatically registered using static registry classes. By abstracting the function name away we can name our tests without the constraints of identifier names.
|
||||
4. We write our individual test assertions using the ```REQUIRE``` macro. Rather than a separate macro for each type of condition we express the condition naturally using C/C++ syntax. Behind the scenes a simple set of expression templates captures the left-hand-side and right-hand-side of the expression so we can display the values in our test report. As we'll see later there _are_ other assertion macros - but because of this technique the number of them is drastically reduced.
|
||||
|
||||
@@ -161,7 +173,7 @@ Sections can be nested to an arbitrary depth (limited only by your stack size).
|
||||
|
||||
## BDD-Style
|
||||
|
||||
If you name your test cases and sections appropriately you can achieve a BDD-style specification structure. This became such a useful way of working that first class support has been added to Catch. Scenarios can be specified using ```SCENARIO```, ```GIVEN```, ```WHEN``` and ```THEN``` macros, which map on to ```TEST_CASE```s and ```SECTION```s, respectively. For more details see [Test cases and sections](test-cases-and-sections.md).
|
||||
If you name your test cases and sections appropriately you can achieve a BDD-style specification structure. This became such a useful way of working that first class support has been added to Catch. Scenarios can be specified using ```SCENARIO```, ```GIVEN```, ```WHEN``` and ```THEN``` macros, which map on to ```TEST_CASE```s and ```SECTION```s, respectively. For more details see [Test cases and sections](test-cases-and-sections.md#top).
|
||||
|
||||
The vector example can be adjusted to use these macros like so:
|
||||
|
||||
@@ -224,7 +236,7 @@ Scenario: vectors can be sized and resized
|
||||
|
||||
To keep the tutorial simple we put all our code in a single file. This is fine to get started - and makes jumping into Catch even quicker and easier. As you write more real-world tests, though, this is not really the best approach.
|
||||
|
||||
The requirement is that the following block of code ([or equivalent](own-main.md)):
|
||||
The requirement is that the following block of code ([or equivalent](own-main.md#top)):
|
||||
|
||||
```c++
|
||||
#define CATCH_CONFIG_MAIN
|
||||
@@ -233,7 +245,7 @@ The requirement is that the following block of code ([or equivalent](own-main.md
|
||||
|
||||
appears in _exactly one_ source file. Use as many additional cpp files (or whatever you call your implementation files) as you need for your tests, partitioned however makes most sense for your way of working. Each additional file need only ```#include "catch.hpp"``` - do not repeat the ```#define```!
|
||||
|
||||
In fact it is usually a good idea to put the block with the ```#define``` [in its own source file](slow-compiles.md).
|
||||
In fact it is usually a good idea to put the block with the ```#define``` [in its own source file](slow-compiles.md#top).
|
||||
|
||||
Do not write your tests in header files!
|
||||
|
||||
@@ -242,8 +254,8 @@ Do not write your tests in header files!
|
||||
|
||||
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.
|
||||
|
||||
Of course there is more to learn - most of which you should be able to page-fault in as you go. Please see the ever-growing [Reference section](Readme.md) for what's available.
|
||||
Of course there is more to learn - most of which you should be able to page-fault in as you go. Please see the ever-growing [Reference section](Readme.md#top) for what's available.
|
||||
|
||||
---
|
||||
|
||||
[Home](Readme.md)
|
||||
[Home](Readme.md#top)
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<a id="top"></a>
|
||||
# Why do we need yet another C++ test framework?
|
||||
|
||||
Good question. For C++ there are quite a number of established frameworks,
|
||||
@@ -36,10 +37,10 @@ So what does Catch bring to the party that differentiates it from these? Apart f
|
||||
|
||||
## Who else is using Catch?
|
||||
|
||||
See the list of [open source projects using Catch](opensource-users.md).
|
||||
See the list of [open source projects using Catch](opensource-users.md#top).
|
||||
|
||||
See the [tutorial](tutorial.md) to get more of a taste of using Catch in practice
|
||||
See the [tutorial](tutorial.md#top) to get more of a taste of using Catch in practice
|
||||
|
||||
---
|
||||
|
||||
[Home](Readme.md)
|
||||
[Home](Readme.md#top)
|
||||
|
@@ -19,8 +19,11 @@
|
||||
|
||||
#if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER)
|
||||
# define CATCH_IMPL
|
||||
# define CATCH_CONFIG_EXTERNAL_INTERFACES
|
||||
#endif
|
||||
|
||||
#include "internal/catch_platform.h"
|
||||
|
||||
#ifdef CATCH_IMPL
|
||||
# ifndef CLARA_CONFIG_MAIN
|
||||
# define CLARA_CONFIG_MAIN_NOT_DEFINED
|
||||
@@ -28,7 +31,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "internal/catch_context.h"
|
||||
#include "internal/catch_tag_alias_autoregistrar.h"
|
||||
#include "internal/catch_test_registry.hpp"
|
||||
#include "internal/catch_capture.hpp"
|
||||
@@ -52,6 +54,10 @@
|
||||
#include "internal/catch_objc.hpp"
|
||||
#endif
|
||||
|
||||
#ifdef CATCH_CONFIG_EXTERNAL_INTERFACES
|
||||
#include "internal/catch_external_interfaces.h"
|
||||
#endif
|
||||
|
||||
#ifdef CATCH_IMPL
|
||||
#include "internal/catch_impl.hpp"
|
||||
#endif
|
||||
@@ -65,6 +71,7 @@
|
||||
# undef CLARA_CONFIG_MAIN
|
||||
#endif
|
||||
|
||||
#if !defined(CATCH_CONFIG_DISABLE)
|
||||
//////
|
||||
// If this config identifier is defined then all CATCH macros are prefixed with CATCH_
|
||||
#ifdef CATCH_CONFIG_PREFIX_ALL
|
||||
@@ -115,8 +122,6 @@
|
||||
|
||||
#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE()
|
||||
|
||||
#define CATCH_REGISTER_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType )
|
||||
|
||||
// "BDD-style" convenience wrappers
|
||||
#define CATCH_SCENARIO( ... ) CATCH_TEST_CASE( "Scenario: " __VA_ARGS__ )
|
||||
#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " __VA_ARGS__ )
|
||||
@@ -175,8 +180,6 @@
|
||||
#define SUCCEED( ... ) INTERNAL_CATCH_MSG( "SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
||||
#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE()
|
||||
|
||||
#define REGISTER_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType )
|
||||
|
||||
#endif
|
||||
|
||||
#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature )
|
||||
@@ -193,6 +196,134 @@
|
||||
|
||||
using Catch::Detail::Approx;
|
||||
|
||||
#else
|
||||
//////
|
||||
// If this config identifier is defined then all CATCH macros are prefixed with CATCH_
|
||||
#ifdef CATCH_CONFIG_PREFIX_ALL
|
||||
|
||||
#define CATCH_REQUIRE( ... ) (void)(0)
|
||||
#define CATCH_REQUIRE_FALSE( ... ) (void)(0)
|
||||
|
||||
#define CATCH_REQUIRE_THROWS( ... ) (void)(0)
|
||||
#define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0)
|
||||
#define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) (void)(0)
|
||||
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
||||
#define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
|
||||
#endif// CATCH_CONFIG_DISABLE_MATCHERS
|
||||
#define CATCH_REQUIRE_NOTHROW( ... ) (void)(0)
|
||||
|
||||
#define CATCH_CHECK( ... ) (void)(0)
|
||||
#define CATCH_CHECK_FALSE( ... ) (void)(0)
|
||||
#define CATCH_CHECKED_IF( ... ) if (__VA_ARGS__)
|
||||
#define CATCH_CHECKED_ELSE( ... ) if (!(__VA_ARGS__))
|
||||
#define CATCH_CHECK_NOFAIL( ... ) (void)(0)
|
||||
|
||||
#define CATCH_CHECK_THROWS( ... ) (void)(0)
|
||||
#define CATCH_CHECK_THROWS_AS( expr, exceptionType ) (void)(0)
|
||||
#define CATCH_CHECK_THROWS_WITH( expr, matcher ) (void)(0)
|
||||
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
||||
#define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
|
||||
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
||||
#define CATCH_CHECK_NOTHROW( ... ) (void)(0)
|
||||
|
||||
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
||||
#define CATCH_CHECK_THAT( arg, matcher ) (void)(0)
|
||||
|
||||
#define CATCH_REQUIRE_THAT( arg, matcher ) (void)(0)
|
||||
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
||||
|
||||
#define CATCH_INFO( msg ) (void)(0)
|
||||
#define CATCH_WARN( msg ) (void)(0)
|
||||
#define CATCH_CAPTURE( msg ) (void)(0)
|
||||
|
||||
#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
|
||||
#define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
|
||||
#define CATCH_METHOD_AS_TEST_CASE( method, ... )
|
||||
#define CATCH_REGISTER_TEST_CASE( Function, ... ) (void)(0)
|
||||
#define CATCH_SECTION( ... )
|
||||
#define CATCH_FAIL( ... ) (void)(0)
|
||||
#define CATCH_FAIL_CHECK( ... ) (void)(0)
|
||||
#define CATCH_SUCCEED( ... ) (void)(0)
|
||||
|
||||
#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
|
||||
|
||||
// "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 )
|
||||
#define CATCH_GIVEN( desc )
|
||||
#define CATCH_WHEN( desc )
|
||||
#define CATCH_AND_WHEN( desc )
|
||||
#define CATCH_THEN( desc )
|
||||
#define CATCH_AND_THEN( desc )
|
||||
|
||||
// If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required
|
||||
#else
|
||||
|
||||
#define REQUIRE( ... ) (void)(0)
|
||||
#define REQUIRE_FALSE( ... ) (void)(0)
|
||||
|
||||
#define REQUIRE_THROWS( ... ) (void)(0)
|
||||
#define REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0)
|
||||
#define REQUIRE_THROWS_WITH( expr, matcher ) (void)(0)
|
||||
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
||||
#define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
|
||||
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
||||
#define REQUIRE_NOTHROW( ... ) (void)(0)
|
||||
|
||||
#define CHECK( ... ) (void)(0)
|
||||
#define CHECK_FALSE( ... ) (void)(0)
|
||||
#define CHECKED_IF( ... ) if (__VA_ARGS__)
|
||||
#define CHECKED_ELSE( ... ) if (!(__VA_ARGS__))
|
||||
#define CHECK_NOFAIL( ... ) (void)(0)
|
||||
|
||||
#define CHECK_THROWS( ... ) (void)(0)
|
||||
#define CHECK_THROWS_AS( expr, exceptionType ) (void)(0)
|
||||
#define CHECK_THROWS_WITH( expr, matcher ) (void)(0)
|
||||
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
||||
#define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
|
||||
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
||||
#define CHECK_NOTHROW( ... ) (void)(0)
|
||||
|
||||
|
||||
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
||||
#define CHECK_THAT( arg, matcher ) (void)(0)
|
||||
|
||||
#define REQUIRE_THAT( arg, matcher ) (void)(0)
|
||||
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
||||
|
||||
#define INFO( msg ) (void)(0)
|
||||
#define WARN( msg ) (void)(0)
|
||||
#define CAPTURE( msg ) (void)(0)
|
||||
|
||||
#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
|
||||
#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
|
||||
#define METHOD_AS_TEST_CASE( method, ... )
|
||||
#define REGISTER_TEST_CASE( Function, ... ) (void)(0)
|
||||
#define SECTION( ... )
|
||||
#define FAIL( ... ) (void)(0)
|
||||
#define FAIL_CHECK( ... ) (void)(0)
|
||||
#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____ ))
|
||||
|
||||
#endif
|
||||
|
||||
#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature )
|
||||
|
||||
// "BDD-style" convenience wrappers
|
||||
#define SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ) )
|
||||
#define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), className )
|
||||
|
||||
#define GIVEN( desc )
|
||||
#define WHEN( desc )
|
||||
#define AND_WHEN( desc )
|
||||
#define THEN( desc )
|
||||
#define AND_THEN( desc )
|
||||
|
||||
using Catch::Detail::Approx;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#include "internal/catch_reenable_warnings.h"
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_HPP_INCLUDED
|
||||
|
@@ -13,6 +13,7 @@
|
||||
#include "internal/catch_enforce.h"
|
||||
#include "internal/catch_list.h"
|
||||
#include "internal/catch_run_context.hpp"
|
||||
#include "internal/catch_stream.h"
|
||||
#include "internal/catch_test_spec.hpp"
|
||||
#include "internal/catch_version.h"
|
||||
#include "internal/catch_interfaces_reporter.h"
|
||||
@@ -201,12 +202,12 @@ namespace Catch {
|
||||
int run() {
|
||||
if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeStart ) != 0 ) {
|
||||
Catch::cout() << "...waiting for enter/ return before starting" << std::endl;
|
||||
std::getchar();
|
||||
static_cast<void>(std::getchar());
|
||||
}
|
||||
int exitCode = runInternal();
|
||||
if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeExit ) != 0 ) {
|
||||
Catch::cout() << "...waiting for enter/ return before exiting, with code: " << exitCode << std::endl;
|
||||
std::getchar();
|
||||
static_cast<void>(std::getchar());
|
||||
}
|
||||
return exitCode;
|
||||
}
|
||||
|
@@ -13,6 +13,13 @@
|
||||
namespace Catch {
|
||||
namespace Detail {
|
||||
|
||||
double max(double lhs, double rhs) {
|
||||
if (lhs < rhs) {
|
||||
return rhs;
|
||||
}
|
||||
return lhs;
|
||||
}
|
||||
|
||||
Approx::Approx ( double value )
|
||||
: m_epsilon( std::numeric_limits<float>::epsilon()*100 ),
|
||||
m_margin( 0.0 ),
|
||||
|
@@ -10,7 +10,6 @@
|
||||
|
||||
#include "catch_tostring.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
#include <type_traits>
|
||||
@@ -18,6 +17,8 @@
|
||||
namespace Catch {
|
||||
namespace Detail {
|
||||
|
||||
double max(double lhs, double rhs);
|
||||
|
||||
class Approx {
|
||||
public:
|
||||
explicit Approx ( double value );
|
||||
@@ -42,7 +43,7 @@ namespace Detail {
|
||||
friend bool operator == ( const T& lhs, Approx const& rhs ) {
|
||||
// Thanks to Richard Harris for his help refining this formula
|
||||
auto lhs_v = static_cast<double>(lhs);
|
||||
bool relativeOK = std::fabs(lhs_v - rhs.m_value) < rhs.m_epsilon * (rhs.m_scale + (std::max)(std::fabs(lhs_v), std::fabs(rhs.m_value)));
|
||||
bool relativeOK = std::fabs(lhs_v - rhs.m_value) < rhs.m_epsilon * (rhs.m_scale + (max)(std::fabs(lhs_v), std::fabs(rhs.m_value)));
|
||||
if (relativeOK) {
|
||||
return true;
|
||||
}
|
||||
|
@@ -9,6 +9,9 @@
|
||||
#include "catch_assertionresult.h"
|
||||
|
||||
namespace Catch {
|
||||
AssertionResultData::AssertionResultData(ResultWas::OfType _resultType, LazyExpression const & _lazyExpression):
|
||||
resultType(_resultType),
|
||||
lazyExpression(_lazyExpression) {}
|
||||
|
||||
std::string AssertionResultData::reconstructExpression() const {
|
||||
|
||||
|
@@ -21,10 +21,7 @@ namespace Catch {
|
||||
{
|
||||
AssertionResultData() = delete;
|
||||
|
||||
AssertionResultData( ResultWas::OfType _resultType, LazyExpression const& _lazyExpression )
|
||||
: resultType( _resultType ),
|
||||
lazyExpression( _lazyExpression )
|
||||
{}
|
||||
AssertionResultData( ResultWas::OfType _resultType, LazyExpression const& _lazyExpression );
|
||||
|
||||
ResultWas::OfType resultType = ResultWas::Unknown;
|
||||
std::string message;
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include "catch_benchmark.h"
|
||||
#include "catch_capture.hpp"
|
||||
#include "catch_interfaces_reporter.h"
|
||||
#include "catch_context.h"
|
||||
|
||||
namespace Catch {
|
||||
|
||||
|
@@ -12,6 +12,13 @@
|
||||
#include "catch_message.h"
|
||||
#include "catch_interfaces_capture.h"
|
||||
|
||||
#if !defined(CATCH_CONFIG_DISABLE)
|
||||
|
||||
#if !defined(CATCH_CONFIG_DISABLE_STRINGIFICATION)
|
||||
#define CATCH_INTERNAL_STRINGIFY(...) #__VA_ARGS__
|
||||
#else
|
||||
#define CATCH_INTERNAL_STRINGIFY(...) "Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION"
|
||||
#endif
|
||||
|
||||
#if defined(CATCH_CONFIG_FAST_COMPILE)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -50,7 +57,7 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_TEST( macroName, resultDisposition, ... ) \
|
||||
do { \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, #__VA_ARGS__, resultDisposition ); \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \
|
||||
INTERNAL_CATCH_TRY( catchAssertionHandler ) { \
|
||||
CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \
|
||||
catchAssertionHandler.handle( Catch::Decomposer() <= __VA_ARGS__ ); \
|
||||
@@ -73,7 +80,7 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_NO_THROW( macroName, resultDisposition, ... ) \
|
||||
do { \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, #__VA_ARGS__, resultDisposition ); \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \
|
||||
try { \
|
||||
static_cast<void>(__VA_ARGS__); \
|
||||
catchAssertionHandler.handle( Catch::ResultWas::Ok ); \
|
||||
@@ -87,7 +94,7 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_THROWS( macroName, resultDisposition, ... ) \
|
||||
do { \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, #__VA_ARGS__, resultDisposition); \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition); \
|
||||
if( catchAssertionHandler.allowThrows() ) \
|
||||
try { \
|
||||
static_cast<void>(__VA_ARGS__); \
|
||||
@@ -104,7 +111,7 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_THROWS_AS( macroName, exceptionType, resultDisposition, expr ) \
|
||||
do { \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, #expr ", " #exceptionType, resultDisposition ); \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(expr) ", " CATCH_INTERNAL_STRINGIFY(exceptionType), resultDisposition ); \
|
||||
if( catchAssertionHandler.allowThrows() ) \
|
||||
try { \
|
||||
static_cast<void>(expr); \
|
||||
@@ -138,7 +145,7 @@
|
||||
// Although this is matcher-based, it can be used with just a string
|
||||
#define INTERNAL_CATCH_THROWS_STR_MATCHES( macroName, resultDisposition, matcher, ... ) \
|
||||
do { \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, #__VA_ARGS__ ", " #matcher, resultDisposition ); \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \
|
||||
if( catchAssertionHandler.allowThrows() ) \
|
||||
try { \
|
||||
static_cast<void>(__VA_ARGS__); \
|
||||
@@ -152,5 +159,6 @@
|
||||
INTERNAL_CATCH_REACT( catchAssertionHandler ) \
|
||||
} while( Catch::alwaysFalse() )
|
||||
|
||||
#endif // CATCH_CONFIG_DISABLE
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_CAPTURE_HPP_INCLUDED
|
||||
|
@@ -16,7 +16,8 @@ namespace Catch {
|
||||
// There is another overload, in catch_assertinhandler.h/.cpp, that only takes a string and infers
|
||||
// the Equals matcher (so the header does not mention matchers)
|
||||
void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef matcherString ) {
|
||||
MatchExpr<std::string, StringMatcher const&> expr( Catch::translateActiveException(), matcher, matcherString );
|
||||
std::string exceptionMessage = Catch::translateActiveException();
|
||||
MatchExpr<std::string, StringMatcher const&> expr( exceptionMessage, matcher, matcherString );
|
||||
handler.handle( expr );
|
||||
}
|
||||
|
||||
|
@@ -57,7 +57,7 @@ namespace Catch {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CHECK_THAT( macroName, matcher, resultDisposition, arg ) \
|
||||
do { \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, #arg ", " #matcher, resultDisposition ); \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(arg) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \
|
||||
INTERNAL_CATCH_TRY( catchAssertionHandler ) { \
|
||||
catchAssertionHandler.handle( Catch::makeMatchExpr( arg, matcher, #matcher ) ); \
|
||||
} INTERNAL_CATCH_CATCH( catchAssertionHandler ) \
|
||||
@@ -68,7 +68,7 @@ namespace Catch {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_THROWS_MATCHES( macroName, exceptionType, resultDisposition, matcher, ... ) \
|
||||
do { \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, #__VA_ARGS__ ", " #exceptionType ", " #matcher, resultDisposition ); \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) ", " CATCH_INTERNAL_STRINGIFY(exceptionType) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \
|
||||
if( catchAssertionHandler.allowThrows() ) \
|
||||
try { \
|
||||
static_cast<void>(__VA_ARGS__ ); \
|
||||
|
@@ -135,7 +135,7 @@ namespace Catch {
|
||||
+ Opt( setWarning, "warning name" )
|
||||
["-w"]["--warn"]
|
||||
( "enable warnings" )
|
||||
+ Opt( [&]( bool ) { config.showDurations = ShowDurations::Always; } )
|
||||
+ Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, "yes|no" )
|
||||
["-d"]["--durations"]
|
||||
( "show test durations" )
|
||||
+ Opt( loadTestNamesFromFile, "filename" )
|
||||
|
@@ -76,34 +76,6 @@
|
||||
|
||||
#endif // __CYGWIN__
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Borland
|
||||
#ifdef __BORLANDC__
|
||||
|
||||
|
||||
#endif // __BORLANDC__
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// EDG
|
||||
#ifdef __EDG_VERSION__
|
||||
|
||||
|
||||
#endif // __EDG_VERSION__
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Digital Mars
|
||||
#ifdef __DMC__
|
||||
|
||||
|
||||
#endif // __DMC__
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// GCC
|
||||
#ifdef __GNUC__
|
||||
|
||||
|
||||
#endif // __GNUC__
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Visual C++
|
||||
#ifdef _MSC_VER
|
||||
@@ -114,15 +86,10 @@
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Use __COUNTER__ if the compiler supports it
|
||||
#if ( defined _MSC_VER && _MSC_VER >= 1300 ) || \
|
||||
( defined __GNUC__ && ( __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3 )) ) || \
|
||||
( defined __clang__ && __clang_major__ >= 3 )
|
||||
|
||||
// All supported compilers support COUNTER macro,
|
||||
//but user still might want to turn it off
|
||||
#define CATCH_INTERNAL_CONFIG_COUNTER
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// Now set the actual defines based on the above + anything the user has configured
|
||||
|
||||
|
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "catch_config.hpp"
|
||||
#include "catch_enforce.h"
|
||||
#include "catch_stream.h"
|
||||
|
||||
namespace Catch {
|
||||
|
||||
|
@@ -9,9 +9,7 @@
|
||||
#define TWOBLUECUBES_CATCH_CONFIG_HPP_INCLUDED
|
||||
|
||||
#include "catch_test_spec_parser.hpp"
|
||||
#include "catch_context.h"
|
||||
#include "catch_interfaces_config.h"
|
||||
#include "catch_stream.h"
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
@@ -23,6 +21,8 @@
|
||||
|
||||
namespace Catch {
|
||||
|
||||
struct IStream;
|
||||
|
||||
struct ConfigData {
|
||||
bool listTests = false;
|
||||
bool listTags = false;
|
||||
|
@@ -22,7 +22,7 @@ namespace Catch {
|
||||
|
||||
struct IContext
|
||||
{
|
||||
virtual ~IContext();
|
||||
virtual ~IContext() = default;
|
||||
|
||||
virtual IResultCapture* getResultCapture() = 0;
|
||||
virtual IRunner* getRunner() = 0;
|
||||
@@ -31,7 +31,7 @@ namespace Catch {
|
||||
|
||||
struct IMutableContext : IContext
|
||||
{
|
||||
virtual ~IMutableContext();
|
||||
virtual ~IMutableContext() = default;
|
||||
virtual void setResultCapture( IResultCapture* resultCapture ) = 0;
|
||||
virtual void setRunner( IRunner* runner ) = 0;
|
||||
virtual void setConfig( IConfigPtr const& config ) = 0;
|
||||
|
29
include/internal/catch_debug_console.cpp
Normal file
29
include/internal/catch_debug_console.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Created by Martin on 29/08/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_debug_console.h"
|
||||
#include "catch_stream.h"
|
||||
#include "catch_platform.h"
|
||||
|
||||
#ifdef CATCH_PLATFORM_WINDOWS
|
||||
|
||||
#include "catch_windows_h_proxy.h"
|
||||
|
||||
namespace Catch {
|
||||
void writeToDebugConsole( std::string const& text ) {
|
||||
::OutputDebugStringA( text.c_str() );
|
||||
}
|
||||
}
|
||||
#else
|
||||
namespace Catch {
|
||||
void writeToDebugConsole( std::string const& text ) {
|
||||
// !TBD: Need a version for Mac/ XCode and other IDEs
|
||||
Catch::cout() << text;
|
||||
}
|
||||
}
|
||||
#endif // Platform
|
17
include/internal/catch_debug_console.h
Normal file
17
include/internal/catch_debug_console.h
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Created by Martin on 29/08/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_DEBUG_CONSOLE_H_INCLUDED
|
||||
#define TWOBLUECUBES_CATCH_DEBUG_CONSOLE_H_INCLUDED
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace Catch {
|
||||
void writeToDebugConsole( std::string const& text );
|
||||
}
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_DEBUG_CONSOLE_H_INCLUDED
|
@@ -109,21 +109,3 @@
|
||||
bool isDebuggerActive() { return false; }
|
||||
}
|
||||
#endif // Platform
|
||||
|
||||
#ifdef CATCH_PLATFORM_WINDOWS
|
||||
|
||||
#include "catch_windows_h_proxy.h"
|
||||
|
||||
namespace Catch {
|
||||
void writeToDebugConsole( std::string const& text ) {
|
||||
::OutputDebugStringA( text.c_str() );
|
||||
}
|
||||
}
|
||||
#else
|
||||
namespace Catch {
|
||||
void writeToDebugConsole( std::string const& text ) {
|
||||
// !TBD: Need a version for Mac/ XCode and other IDEs
|
||||
Catch::cout() << text;
|
||||
}
|
||||
}
|
||||
#endif // Platform
|
||||
|
@@ -11,12 +11,8 @@
|
||||
|
||||
#include "catch_platform.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace Catch{
|
||||
|
||||
namespace Catch {
|
||||
bool isDebuggerActive();
|
||||
void writeToDebugConsole( std::string const& text );
|
||||
}
|
||||
|
||||
#ifdef CATCH_PLATFORM_MAC
|
||||
|
@@ -76,18 +76,26 @@ namespace Catch {
|
||||
|
||||
// Specialised comparison functions to handle equality comparisons between ints and pointers (NULL deduces as an int)
|
||||
template<typename LhsT, typename RhsT>
|
||||
auto compareEqual( LhsT lhs, RhsT&& rhs ) -> bool { return lhs == rhs; };
|
||||
auto compareEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return const_cast<LhsT&>( lhs ) == rhs; };
|
||||
template<typename T>
|
||||
auto compareEqual( T* const& lhs, int rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); };
|
||||
template<typename T>
|
||||
auto compareEqual( T* const& lhs, long rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); };
|
||||
template<typename T>
|
||||
auto compareEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; };
|
||||
template<typename T>
|
||||
auto compareEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; };
|
||||
|
||||
template<typename LhsT, typename RhsT>
|
||||
auto compareNotEqual( LhsT lhs, RhsT&& rhs ) -> bool { return lhs != rhs; };
|
||||
auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return const_cast<LhsT&>( lhs ) != rhs; };
|
||||
template<typename T>
|
||||
auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); };
|
||||
template<typename T>
|
||||
auto compareNotEqual( T* const& lhs, long rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); };
|
||||
template<typename T>
|
||||
auto compareNotEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) != rhs; };
|
||||
template<typename T>
|
||||
auto compareNotEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) != rhs; };
|
||||
|
||||
|
||||
template<typename LhsT>
|
||||
|
13
include/internal/catch_external_interfaces.h
Normal file
13
include/internal/catch_external_interfaces.h
Normal file
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Created by Martin on 17/08/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_EXTERNAL_INTERFACES_H_INCLUDED
|
||||
#define TWOBLUECUBES_CATCH_EXTERNAL_INTERFACES_H_INCLUDED
|
||||
|
||||
#include "../reporters/catch_reporter_bases.hpp"
|
||||
#include "catch_reporter_registrars.hpp"
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_EXTERNAL_INTERFACES_H_INCLUDED
|
@@ -47,9 +47,9 @@ namespace Catch {
|
||||
};
|
||||
|
||||
LONG CALLBACK FatalConditionHandler::handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo) {
|
||||
for (int i = 0; i < sizeof(signalDefs) / sizeof(SignalDefs); ++i) {
|
||||
if (ExceptionInfo->ExceptionRecord->ExceptionCode == signalDefs[i].id) {
|
||||
reportFatal(signalDefs[i].name);
|
||||
for (auto const& def : signalDefs) {
|
||||
if (ExceptionInfo->ExceptionRecord->ExceptionCode == def.id) {
|
||||
reportFatal(def.name);
|
||||
}
|
||||
}
|
||||
// If its not an exception we care about, pass it along.
|
||||
@@ -123,8 +123,7 @@ namespace Catch {
|
||||
|
||||
void FatalConditionHandler::handleSignal( int sig ) {
|
||||
std::string name = "<unknown signal>";
|
||||
for (std::size_t i = 0; i < sizeof(signalDefs) / sizeof(SignalDefs); ++i) {
|
||||
SignalDefs &def = signalDefs[i];
|
||||
for (auto const& def : signalDefs) {
|
||||
if (sig == def.id) {
|
||||
name = def.name;
|
||||
break;
|
||||
|
@@ -46,7 +46,6 @@ namespace Catch {
|
||||
CoutStream::~CoutStream() noexcept {}
|
||||
DebugOutStream::~DebugOutStream() noexcept {}
|
||||
StreamBufBase::~StreamBufBase() noexcept {}
|
||||
IContext::~IContext() {}
|
||||
IResultCapture::~IResultCapture() {}
|
||||
ITestInvoker::~ITestInvoker() {}
|
||||
ITestCaseRegistry::~ITestCaseRegistry() {}
|
||||
@@ -55,7 +54,6 @@ namespace Catch {
|
||||
IExceptionTranslator::~IExceptionTranslator() {}
|
||||
IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() {}
|
||||
IRunner::~IRunner() {}
|
||||
IMutableContext::~IMutableContext() {}
|
||||
IConfig::~IConfig() {}
|
||||
|
||||
void Config::dummy() {}
|
||||
|
@@ -8,11 +8,16 @@
|
||||
#ifndef TWOBLUECUBES_CATCH_INTERFACES_EXCEPTION_H_INCLUDED
|
||||
#define TWOBLUECUBES_CATCH_INTERFACES_EXCEPTION_H_INCLUDED
|
||||
|
||||
#include "catch_interfaces_registry_hub.h"
|
||||
|
||||
#if defined(CATCH_CONFIG_DISABLE)
|
||||
#define INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( translatorName, signature) \
|
||||
static std::string translatorName( signature )
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "catch_interfaces_registry_hub.h"
|
||||
|
||||
namespace Catch {
|
||||
using exceptionTranslateFunction = std::string(*)();
|
||||
|
||||
|
@@ -11,7 +11,6 @@
|
||||
#include "catch_section_info.h"
|
||||
#include "catch_common.h"
|
||||
#include "catch_config.hpp"
|
||||
#include "catch_context.h"
|
||||
#include "catch_totals.hpp"
|
||||
#include "catch_test_case_info.h"
|
||||
#include "catch_assertionresult.h"
|
||||
|
@@ -12,6 +12,7 @@
|
||||
#include "catch_interfaces_reporter.h"
|
||||
#include "catch_interfaces_testcase.h"
|
||||
|
||||
#include "catch_stream.h"
|
||||
#include "catch_text.h"
|
||||
|
||||
#include "catch_console_colour.hpp"
|
||||
|
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "catch_interfaces_registry_hub.h"
|
||||
|
||||
#include "catch_context.h"
|
||||
#include "catch_test_case_registry_impl.hpp"
|
||||
#include "catch_reporter_registry.hpp"
|
||||
#include "catch_exception_translator_registry.h"
|
||||
|
@@ -1,3 +1,4 @@
|
||||
|
||||
/*
|
||||
* Created by Phil on 31/12/2010.
|
||||
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
||||
@@ -39,7 +40,7 @@ namespace Catch {
|
||||
class ListenerFactory : public IReporterFactory {
|
||||
|
||||
virtual IStreamingReporterPtr create( ReporterConfig const& config ) const override {
|
||||
return std::make_shared<T>( config );
|
||||
return std::unique_ptr<T>( new T( config ) );
|
||||
}
|
||||
virtual std::string getDescription() const override {
|
||||
return std::string();
|
||||
@@ -54,14 +55,19 @@ namespace Catch {
|
||||
};
|
||||
}
|
||||
|
||||
#define INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType ) \
|
||||
namespace{ Catch::ReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name ); }
|
||||
#if !defined(CATCH_CONFIG_DISABLE)
|
||||
|
||||
// Deprecated - use the form without INTERNAL_
|
||||
#define INTERNAL_CATCH_REGISTER_LISTENER( listenerType ) \
|
||||
namespace{ Catch::ListenerRegistrar<listenerType> catch_internal_RegistrarFor##listenerType; }
|
||||
#define CATCH_REGISTER_REPORTER( name, reporterType ) \
|
||||
namespace{ Catch::ReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name ); }
|
||||
|
||||
#define CATCH_REGISTER_LISTENER( listenerType ) \
|
||||
namespace{ Catch::ListenerRegistrar<listenerType> catch_internal_RegistrarFor##listenerType; }
|
||||
|
||||
#else // CATCH_CONFIG_DISABLE
|
||||
|
||||
#define CATCH_REGISTER_REPORTER(name, reporterType)
|
||||
#define CATCH_REGISTER_LISTENER(listenerType)
|
||||
|
||||
#endif // CATCH_CONFIG_DISABLE
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_REPORTER_REGISTRARS_HPP_INCLUDED
|
||||
|
@@ -21,14 +21,14 @@ namespace Catch {
|
||||
~ReporterRegistry() override {}
|
||||
|
||||
IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const override {
|
||||
FactoryMap::const_iterator it = m_factories.find( name );
|
||||
auto it = m_factories.find( name );
|
||||
if( it == m_factories.end() )
|
||||
return nullptr;
|
||||
return it->second->create( ReporterConfig( config ) );
|
||||
}
|
||||
|
||||
void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) {
|
||||
m_factories.insert( { name, factory } );
|
||||
m_factories.emplace(name, factory);
|
||||
}
|
||||
void registerListener( IReporterFactoryPtr const& factory ) {
|
||||
m_listeners.push_back( factory );
|
||||
|
@@ -1,5 +1,7 @@
|
||||
#include "catch_run_context.hpp"
|
||||
#include "catch_context.h"
|
||||
#include "catch_enforce.h"
|
||||
#include "catch_stream.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <algorithm>
|
||||
@@ -112,7 +114,10 @@ namespace Catch {
|
||||
if (result.getResultType() == ResultWas::Ok) {
|
||||
m_totals.assertions.passed++;
|
||||
} else if (!result.isOk()) {
|
||||
m_totals.assertions.failed++;
|
||||
if( m_activeTestCase->getTestCaseInfo().okToFail() )
|
||||
m_totals.assertions.failedButOk++;
|
||||
else
|
||||
m_totals.assertions.failed++;
|
||||
}
|
||||
|
||||
// We have no use for the return value (whether messages should be cleared), because messages were made scoped
|
||||
@@ -297,13 +302,6 @@ namespace Catch {
|
||||
|
||||
Counts assertions = m_totals.assertions - prevAssertions;
|
||||
bool missingAssertions = testForMissingAssertions(assertions);
|
||||
|
||||
if (testCaseInfo.okToFail()) {
|
||||
std::swap(assertions.failedButOk, assertions.failed);
|
||||
m_totals.assertions.failed -= assertions.failedButOk;
|
||||
m_totals.assertions.failedButOk += assertions.failedButOk;
|
||||
}
|
||||
|
||||
SectionStats testCaseSectionStats(testCaseSection, assertions, duration, missingAssertions);
|
||||
m_reporter->sectionEnded(testCaseSectionStats);
|
||||
}
|
||||
|
@@ -26,6 +26,8 @@
|
||||
|
||||
namespace Catch {
|
||||
|
||||
struct IMutableContext;
|
||||
|
||||
class StreamRedirect {
|
||||
|
||||
public:
|
||||
|
@@ -10,7 +10,7 @@
|
||||
#include "catch_common.h"
|
||||
#include "catch_enforce.h"
|
||||
#include "catch_stream.h"
|
||||
#include "catch_debugger.h"
|
||||
#include "catch_debug_console.h"
|
||||
|
||||
#include <stdexcept>
|
||||
#include <cstdio>
|
||||
|
@@ -20,7 +20,6 @@ namespace Catch {
|
||||
|
||||
TestCaseInfo::SpecialProperties parseSpecialTag( std::string const& tag ) {
|
||||
if( startsWith( tag, '.' ) ||
|
||||
tag == "hide" ||
|
||||
tag == "!hide" )
|
||||
return TestCaseInfo::IsHidden;
|
||||
else if( tag == "!throws" )
|
||||
@@ -52,14 +51,13 @@ namespace Catch {
|
||||
std::string const& _descOrTags,
|
||||
SourceLineInfo const& _lineInfo )
|
||||
{
|
||||
bool isHidden( startsWith( _name, "./" ) ); // Legacy support
|
||||
bool isHidden = false;
|
||||
|
||||
// Parse out tags
|
||||
std::vector<std::string> tags;
|
||||
std::string desc, tag;
|
||||
bool inTag = false;
|
||||
for( std::size_t i = 0; i < _descOrTags.size(); ++i ) {
|
||||
char c = _descOrTags[i];
|
||||
for (char c : _descOrTags) {
|
||||
if( !inTag ) {
|
||||
if( c == '[' )
|
||||
inTag = true;
|
||||
@@ -83,7 +81,6 @@ namespace Catch {
|
||||
}
|
||||
}
|
||||
if( isHidden ) {
|
||||
tags.push_back( "hide" );
|
||||
tags.push_back( "." );
|
||||
}
|
||||
|
||||
|
@@ -47,6 +47,19 @@ struct AutoReg : NonCopyable {
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
#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 : ClassName { \
|
||||
void test(); \
|
||||
}; \
|
||||
} \
|
||||
void TestName::test()
|
||||
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \
|
||||
static void TestName(); \
|
||||
@@ -80,7 +93,7 @@ struct AutoReg : NonCopyable {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \
|
||||
CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
|
||||
Catch::AutoReg( Catch::makeTestInvoker( Function ), CATCH_INTERNAL_LINEINFO, "", Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \
|
||||
Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( Function ), CATCH_INTERNAL_LINEINFO, "", Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \
|
||||
CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS
|
||||
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
#ifndef TWOBLUECUBES_CATCH_TIMER_H_INCLUDED
|
||||
#define TWOBLUECUBES_CATCH_TIMER_H_INCLUDED
|
||||
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
|
@@ -37,7 +37,7 @@ namespace Catch {
|
||||
}
|
||||
|
||||
Version const& libraryVersion() {
|
||||
static Version version( 2, 0, 0, "develop", 1 );
|
||||
static Version version( 2, 0, 0, "develop", 3 );
|
||||
return version;
|
||||
}
|
||||
|
||||
|
@@ -10,8 +10,6 @@
|
||||
|
||||
#include "catch_common.h"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
|
||||
namespace Catch
|
||||
{
|
||||
|
@@ -55,7 +55,7 @@ namespace Catch {
|
||||
AutomakeReporter::~AutomakeReporter() {}
|
||||
#endif
|
||||
|
||||
INTERNAL_CATCH_REGISTER_REPORTER( "automake", AutomakeReporter)
|
||||
CATCH_REGISTER_REPORTER( "automake", AutomakeReporter)
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
|
@@ -174,7 +174,7 @@ namespace Catch {
|
||||
}
|
||||
else {
|
||||
SectionNode& parentNode = *m_sectionStack.back();
|
||||
typename SectionNode::ChildSections::const_iterator it =
|
||||
auto it =
|
||||
std::find_if( parentNode.childSections.begin(),
|
||||
parentNode.childSections.end(),
|
||||
BySectionInfo( sectionInfo ) );
|
||||
|
@@ -299,6 +299,6 @@ namespace Catch {
|
||||
|
||||
CompactReporter::~CompactReporter() {}
|
||||
|
||||
INTERNAL_CATCH_REGISTER_REPORTER( "compact", CompactReporter )
|
||||
CATCH_REGISTER_REPORTER( "compact", CompactReporter )
|
||||
|
||||
} // end namespace Catch
|
||||
|
@@ -634,7 +634,7 @@ namespace Catch {
|
||||
bool m_headerPrinted = false;
|
||||
};
|
||||
|
||||
INTERNAL_CATCH_REGISTER_REPORTER( "console", ConsoleReporter )
|
||||
CATCH_REGISTER_REPORTER( "console", ConsoleReporter )
|
||||
|
||||
ConsoleReporter::~ConsoleReporter() {}
|
||||
|
||||
|
@@ -251,6 +251,6 @@ namespace Catch {
|
||||
};
|
||||
|
||||
JunitReporter::~JunitReporter() {}
|
||||
INTERNAL_CATCH_REGISTER_REPORTER( "junit", JunitReporter )
|
||||
CATCH_REGISTER_REPORTER( "junit", JunitReporter )
|
||||
|
||||
} // end namespace Catch
|
||||
|
@@ -248,7 +248,7 @@ namespace Catch {
|
||||
TAPReporter::~TAPReporter() {}
|
||||
#endif
|
||||
|
||||
INTERNAL_CATCH_REGISTER_REPORTER( "tap", TAPReporter )
|
||||
CATCH_REGISTER_REPORTER( "tap", TAPReporter )
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
|
@@ -206,7 +206,7 @@ namespace Catch {
|
||||
TeamCityReporter::~TeamCityReporter() {}
|
||||
#endif
|
||||
|
||||
INTERNAL_CATCH_REGISTER_REPORTER( "teamcity", TeamCityReporter )
|
||||
CATCH_REGISTER_REPORTER( "teamcity", TeamCityReporter )
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
|
@@ -220,6 +220,6 @@ namespace Catch {
|
||||
};
|
||||
|
||||
XmlReporter::~XmlReporter() {}
|
||||
INTERNAL_CATCH_REGISTER_REPORTER( "xml", XmlReporter )
|
||||
CATCH_REGISTER_REPORTER( "xml", XmlReporter )
|
||||
|
||||
} // end namespace Catch
|
||||
|
@@ -1020,6 +1020,6 @@ with expansion:
|
||||
"{?}" == "1"
|
||||
|
||||
===============================================================================
|
||||
test cases: 182 | 131 passed | 47 failed | 4 failed as expected
|
||||
assertions: 881 | 764 passed | 96 failed | 21 failed as expected
|
||||
test cases: 184 | 133 passed | 47 failed | 4 failed as expected
|
||||
assertions: 884 | 767 passed | 96 failed | 21 failed as expected
|
||||
|
||||
|
@@ -14,6 +14,25 @@ PASSED:
|
||||
with message:
|
||||
yay
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1005: Comparing pointer to int and long (NULL can be either on various
|
||||
systems)
|
||||
-------------------------------------------------------------------------------
|
||||
DecompositionTests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
DecompositionTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( fptr == 0 )
|
||||
with expansion:
|
||||
0 == 0
|
||||
|
||||
DecompositionTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( fptr == 0l )
|
||||
with expansion:
|
||||
0 == 0
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#748 - captures with unexpected exceptions
|
||||
outside assertions
|
||||
@@ -6672,6 +6691,18 @@ PASSED:
|
||||
with expansion:
|
||||
"7" == "7"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
non-copyable objects
|
||||
-------------------------------------------------------------------------------
|
||||
TrickyTests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
TrickyTests.cpp:<line number>:
|
||||
PASSED:
|
||||
CHECK( ti == typeid(int) )
|
||||
with expansion:
|
||||
{?} == {?}
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
not allowed
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -7523,6 +7554,6 @@ MiscTests.cpp:<line number>:
|
||||
PASSED:
|
||||
|
||||
===============================================================================
|
||||
test cases: 182 | 128 passed | 50 failed | 4 failed as expected
|
||||
assertions: 883 | 760 passed | 102 failed | 21 failed as expected
|
||||
test cases: 184 | 130 passed | 50 failed | 4 failed as expected
|
||||
assertions: 886 | 763 passed | 102 failed | 21 failed as expected
|
||||
|
||||
|
@@ -14,6 +14,25 @@ PASSED:
|
||||
with message:
|
||||
yay
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1005: Comparing pointer to int and long (NULL can be either on various
|
||||
systems)
|
||||
-------------------------------------------------------------------------------
|
||||
DecompositionTests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
DecompositionTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( fptr == 0 )
|
||||
with expansion:
|
||||
0 == 0
|
||||
|
||||
DecompositionTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE( fptr == 0l )
|
||||
with expansion:
|
||||
0 == 0
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#748 - captures with unexpected exceptions
|
||||
outside assertions
|
||||
@@ -218,6 +237,6 @@ ConditionTests.cpp:<line number>: FAILED:
|
||||
CHECK_FALSE( true )
|
||||
|
||||
===============================================================================
|
||||
test cases: 8 | 5 passed | 1 failed | 2 failed as expected
|
||||
assertions: 24 | 17 passed | 4 failed | 3 failed as expected
|
||||
test cases: 9 | 6 passed | 1 failed | 2 failed as expected
|
||||
assertions: 26 | 19 passed | 4 failed | 3 failed as expected
|
||||
|
||||
|
@@ -1,8 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuitesloose text artifact
|
||||
>
|
||||
<testsuite name="<exe-name>" errors="15" failures="88" tests="884" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||
<testsuite name="<exe-name>" errors="15" failures="88" tests="887" 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="#748 - captures with unexpected exceptions/outside assertions" time="{duration}">
|
||||
<error type="TEST_CASE">
|
||||
expected exception
|
||||
@@ -725,6 +726,7 @@ MiscTests.cpp:<line number>
|
||||
<testcase classname="<exe-name>.global" name="nested SECTION tests/s1" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="nested SECTION tests/s1/s2" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="non streamable - with conv. op" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="non-copyable objects" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="not allowed" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="null strings" time="{duration}"/>
|
||||
<testcase classname="<exe-name>.global" name="null_ptr" time="{duration}"/>
|
||||
|
@@ -4,7 +4,26 @@
|
||||
<TestCase name="# A test name that starts with a #" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="#748 - captures with unexpected exceptions" tags="[!shouldfail][!throws][.][failing][hide]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<TestCase name="#1005: Comparing pointer to int and long (NULL can be either on various systems)" tags="[Decomposition]" filename="projects/<exe-name>/DecompositionTests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/DecompositionTests.cpp" >
|
||||
<Original>
|
||||
fptr == 0
|
||||
</Original>
|
||||
<Expanded>
|
||||
0 == 0
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/DecompositionTests.cpp" >
|
||||
<Original>
|
||||
fptr == 0l
|
||||
</Original>
|
||||
<Expanded>
|
||||
0 == 0
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="#748 - captures with unexpected exceptions" tags="[!shouldfail][!throws][.][failing]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<Section name="outside assertions" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<Info>
|
||||
answer := 42
|
||||
@@ -12,7 +31,7 @@
|
||||
<Exception filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
expected exception
|
||||
</Exception>
|
||||
<OverallResults successes="0" failures="1" expectedFailures="0"/>
|
||||
<OverallResults successes="0" failures="0" expectedFailures="1"/>
|
||||
</Section>
|
||||
<Section name="inside REQUIRE_NOTHROW" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<Info>
|
||||
@@ -29,7 +48,7 @@
|
||||
expected exception
|
||||
</Exception>
|
||||
</Expression>
|
||||
<OverallResults successes="0" failures="1" expectedFailures="0"/>
|
||||
<OverallResults successes="0" failures="0" expectedFailures="1"/>
|
||||
</Section>
|
||||
<Section name="inside REQUIRE_THROWS" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<Info>
|
||||
@@ -117,7 +136,7 @@
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="#835 -- errno should not be touched by Catch" tags="[!shouldfail][.][failing][hide]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<TestCase name="#835 -- errno should not be touched by Catch" tags="[!shouldfail][.][failing]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Expression success="false" type="CHECK" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Original>
|
||||
f() == 0
|
||||
@@ -150,7 +169,7 @@
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="#961 -- Dynamically created sections should all be reported" tags="[.][hide]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<TestCase name="#961 -- Dynamically created sections should all be reported" tags="[.]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Section name="Looped section 0" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||
</Section>
|
||||
@@ -168,7 +187,7 @@
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="'Not' checks that should fail" tags="[.][failing][hide]" filename="projects/<exe-name>/ConditionTests.cpp" >
|
||||
<TestCase name="'Not' checks that should fail" tags="[.][failing]" filename="projects/<exe-name>/ConditionTests.cpp" >
|
||||
<Expression success="false" type="CHECK" filename="projects/<exe-name>/ConditionTests.cpp" >
|
||||
<Original>
|
||||
false != false
|
||||
@@ -384,7 +403,7 @@
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="A METHOD_AS_TEST_CASE based test run that fails" tags="[.][class][failing][hide]" filename="projects/<exe-name>/ClassTests.cpp" >
|
||||
<TestCase name="A METHOD_AS_TEST_CASE based test run that fails" tags="[.][class][failing]" filename="projects/<exe-name>/ClassTests.cpp" >
|
||||
<Expression success="false" type="REQUIRE" filename="projects/<exe-name>/ClassTests.cpp" >
|
||||
<Original>
|
||||
s == "world"
|
||||
@@ -406,7 +425,7 @@
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="A TEST_CASE_METHOD based test run that fails" tags="[.][class][failing][hide]" filename="projects/<exe-name>/ClassTests.cpp" >
|
||||
<TestCase name="A TEST_CASE_METHOD based test run that fails" tags="[.][class][failing]" filename="projects/<exe-name>/ClassTests.cpp" >
|
||||
<Expression success="false" type="REQUIRE" filename="projects/<exe-name>/ClassTests.cpp" >
|
||||
<Original>
|
||||
m_a == 2
|
||||
@@ -428,7 +447,7 @@
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="A couple of nested sections followed by a failure" tags="[.][failing][hide]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<TestCase name="A couple of nested sections followed by a failure" tags="[.][failing]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Section name="Outer" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Section name="Inner" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||
@@ -440,7 +459,7 @@
|
||||
</Failure>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="A failing expression with a non streamable type is still captured" tags="[.][Tricky][failing][hide]" filename="projects/<exe-name>/TrickyTests.cpp" >
|
||||
<TestCase name="A failing expression with a non streamable type is still captured" tags="[.][Tricky][failing]" filename="projects/<exe-name>/TrickyTests.cpp" >
|
||||
<Expression success="false" type="CHECK" filename="projects/<exe-name>/TrickyTests.cpp" >
|
||||
<Original>
|
||||
&o1 == &o2
|
||||
@@ -535,7 +554,7 @@
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="An unchecked exception reports the line of the last assertion" tags="[!throws][.][failing][hide]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<TestCase name="An unchecked exception reports the line of the last assertion" tags="[!throws][.][failing]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<Original>
|
||||
1 == 1
|
||||
@@ -1317,7 +1336,7 @@
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Contains string matcher" tags="[.][failing][hide][matchers]" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<TestCase name="Contains string matcher" tags="[.][failing][matchers]" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
testStringForMatching(), Contains( "not there" )
|
||||
@@ -1328,7 +1347,7 @@
|
||||
</Expression>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="Custom exceptions can be translated when testing for nothrow" tags="[!throws][.][failing][hide]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<TestCase name="Custom exceptions can be translated when testing for nothrow" tags="[!throws][.][failing]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<Expression success="false" type="REQUIRE_NOTHROW" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<Original>
|
||||
throwCustom()
|
||||
@@ -1342,7 +1361,7 @@
|
||||
</Expression>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="Custom exceptions can be translated when testing for throwing as something else" tags="[!throws][.][failing][hide]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<TestCase name="Custom exceptions can be translated when testing for throwing as something else" tags="[!throws][.][failing]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<Expression success="false" type="REQUIRE_THROWS_AS" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<Original>
|
||||
throwCustom(), std::exception
|
||||
@@ -1356,7 +1375,7 @@
|
||||
</Expression>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="Custom std-exceptions can be custom translated" tags="[!throws][.][failing][hide]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<TestCase name="Custom std-exceptions can be custom translated" tags="[!throws][.][failing]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<Exception filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
custom std exception
|
||||
</Exception>
|
||||
@@ -1373,7 +1392,7 @@
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="EndsWith string matcher" tags="[.][failing][hide][matchers]" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<TestCase name="EndsWith string matcher" tags="[.][failing][matchers]" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
testStringForMatching(), EndsWith( "this" )
|
||||
@@ -1384,7 +1403,7 @@
|
||||
</Expression>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="Equality checks that should fail" tags="[!mayfail][.][failing][hide]" filename="projects/<exe-name>/ConditionTests.cpp" >
|
||||
<TestCase name="Equality checks that should fail" tags="[!mayfail][.][failing]" filename="projects/<exe-name>/ConditionTests.cpp" >
|
||||
<Expression success="false" type="CHECK" filename="projects/<exe-name>/ConditionTests.cpp" >
|
||||
<Original>
|
||||
data.int_seven == 6
|
||||
@@ -1561,7 +1580,7 @@
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Equals string matcher" tags="[.][failing][hide][matchers]" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<TestCase name="Equals string matcher" tags="[.][failing][matchers]" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
testStringForMatching(), Equals( "something else" )
|
||||
@@ -1572,7 +1591,7 @@
|
||||
</Expression>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="Exception matchers that fail" tags="[!throws][.][.failing][exceptions][hide][matchers]" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<TestCase name="Exception matchers that fail" tags="[!throws][.][.failing][exceptions][matchers]" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Section name="No exception" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Expression success="false" type="CHECK_THROWS_MATCHES" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
@@ -1717,7 +1736,7 @@
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Expected exceptions that don't throw or unexpected exceptions fail the test" tags="[!throws][.][failing][hide]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<TestCase name="Expected exceptions that don't throw or unexpected exceptions fail the test" tags="[!throws][.][failing]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<Expression success="false" type="CHECK_THROWS_AS" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<Original>
|
||||
thisThrows(), std::string
|
||||
@@ -1750,17 +1769,17 @@
|
||||
</Expression>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="FAIL aborts the test" tags="[.][failing][hide][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<TestCase name="FAIL aborts the test" tags="[.][failing][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<Failure filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
This is a failure
|
||||
</Failure>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="FAIL does not require an argument" tags="[.][failing][hide][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<TestCase name="FAIL does not require an argument" tags="[.][failing][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<Failure filename="projects/<exe-name>/MessageTests.cpp" />
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="FAIL_CHECK does not abort the test" tags="[.][failing][hide][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<TestCase name="FAIL_CHECK does not abort the test" tags="[.][failing][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<Failure filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
This is a failure
|
||||
</Failure>
|
||||
@@ -1847,7 +1866,7 @@
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="INFO and WARN do not abort tests" tags="[.][hide][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<TestCase name="INFO and WARN do not abort tests" tags="[.][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<Info>
|
||||
this is a message
|
||||
</Info>
|
||||
@@ -1856,7 +1875,7 @@
|
||||
</Warning>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="INFO gets logged on failure" tags="[.][failing][hide][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<TestCase name="INFO gets logged on failure" tags="[.][failing][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<Info>
|
||||
this message should be logged
|
||||
</Info>
|
||||
@@ -1873,7 +1892,7 @@
|
||||
</Expression>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="INFO gets logged on failure, even if captured before successful assertions" tags="[.][failing][hide][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<TestCase name="INFO gets logged on failure, even if captured before successful assertions" tags="[.][failing][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<Info>
|
||||
this message may be logged later
|
||||
</Info>
|
||||
@@ -1938,7 +1957,7 @@
|
||||
</Expression>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="INFO is reset for each loop" tags="[.][failing][hide][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<TestCase name="INFO is reset for each loop" tags="[.][failing][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<Info>
|
||||
current counter 0
|
||||
</Info>
|
||||
@@ -2095,7 +2114,7 @@
|
||||
</Expression>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="Inequality checks that should fail" tags="[!shouldfail][.][failing][hide]" filename="projects/<exe-name>/ConditionTests.cpp" >
|
||||
<TestCase name="Inequality checks that should fail" tags="[!shouldfail][.][failing]" filename="projects/<exe-name>/ConditionTests.cpp" >
|
||||
<Expression success="false" type="CHECK" filename="projects/<exe-name>/ConditionTests.cpp" >
|
||||
<Original>
|
||||
data.int_seven != 7
|
||||
@@ -2308,7 +2327,7 @@
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Matchers can be composed with both && and || - failing" tags="[.][.failing][hide][matchers][operator&&][operators][operator||]" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<TestCase name="Matchers can be composed with both && and || - failing" tags="[.][.failing][matchers][operator&&][operators][operator||]" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "random" )
|
||||
@@ -2330,7 +2349,7 @@
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Matchers can be negated (Not) with the ! operator - failing" tags="[.][.failing][hide][matchers][not][operators]" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<TestCase name="Matchers can be negated (Not) with the ! operator - failing" tags="[.][.failing][matchers][not][operators]" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
testStringForMatching(), !Contains( "substring" )
|
||||
@@ -2341,7 +2360,7 @@
|
||||
</Expression>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="Mismatching exception messages failing the test" tags="[!throws][.][failing][hide]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<TestCase name="Mismatching exception messages failing the test" tags="[!throws][.][failing]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<Expression success="true" type="REQUIRE_THROWS_WITH" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<Original>
|
||||
thisThrows(), "expected exception"
|
||||
@@ -2360,13 +2379,13 @@
|
||||
</Expression>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="Nice descriptive name" tags="[.][hide][tag1][tag2][tag3]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<TestCase name="Nice descriptive name" tags="[.][tag1][tag2][tag3]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Warning>
|
||||
This one ran
|
||||
</Warning>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Non-std exceptions can be translated" tags="[!throws][.][failing][hide]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<TestCase name="Non-std exceptions can be translated" tags="[!throws][.][failing]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<Exception filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
custom exception
|
||||
</Exception>
|
||||
@@ -2410,7 +2429,7 @@
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Ordering comparison checks that should fail" tags="[.][failing][hide]" filename="projects/<exe-name>/ConditionTests.cpp" >
|
||||
<TestCase name="Ordering comparison checks that should fail" tags="[.][failing]" filename="projects/<exe-name>/ConditionTests.cpp" >
|
||||
<Expression success="false" type="CHECK" filename="projects/<exe-name>/ConditionTests.cpp" >
|
||||
<Original>
|
||||
data.int_seven > 7
|
||||
@@ -2704,7 +2723,7 @@
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Output from all sections is reported" tags="[.][failing][hide][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<TestCase name="Output from all sections is reported" tags="[.][failing][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<Section name="one" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<Failure filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
Message from section one
|
||||
@@ -3973,7 +3992,7 @@
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Pointers can be converted to strings" tags="[.][hide][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<TestCase name="Pointers can be converted to strings" tags="[.][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<Warning>
|
||||
actual address of p: 0x<hex digits>
|
||||
</Warning>
|
||||
@@ -4595,7 +4614,7 @@
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Reconstruction should be based on stringification: #914" tags="[.][Decomposition][failing][hide]" filename="projects/<exe-name>/DecompositionTests.cpp" >
|
||||
<TestCase name="Reconstruction should be based on stringification: #914" tags="[.][Decomposition][failing]" filename="projects/<exe-name>/DecompositionTests.cpp" >
|
||||
<Expression success="false" type="CHECK" filename="projects/<exe-name>/DecompositionTests.cpp" >
|
||||
<Original>
|
||||
truthy(false)
|
||||
@@ -4609,7 +4628,7 @@
|
||||
<TestCase name="SUCCEED counts as a test pass" tags="[messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="SUCCESS does not require an argument" tags="[.][hide][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<TestCase name="SUCCESS does not require an argument" tags="[.][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Scenario: BDD tests requiring Fixtures to provide commonly-accessed data or methods" tags="[bdd][fixtures]" filename="projects/<exe-name>/BDDTests.cpp" >
|
||||
@@ -4774,7 +4793,7 @@
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Sends stuff to stdout and stderr" tags="[.][hide]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<TestCase name="Sends stuff to stdout and stderr" tags="[.]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<OverallResult success="true">
|
||||
<StdOut>
|
||||
A string sent directly to stdout
|
||||
@@ -4835,7 +4854,7 @@ A string sent directly to stderr
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Standard error is reported and redirected" tags="[.][hide][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<TestCase name="Standard error is reported and redirected" tags="[.][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<Section name="std::cerr" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<OverallResults successes="0" failures="1" expectedFailures="0"/>
|
||||
</Section>
|
||||
@@ -4853,7 +4872,7 @@ Interleaved writes to error streams
|
||||
</StdErr>
|
||||
</OverallResult>
|
||||
</TestCase>
|
||||
<TestCase name="Standard output from all sections is reported" tags="[.][hide][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<TestCase name="Standard output from all sections is reported" tags="[.][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<Section name="one" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<OverallResults successes="0" failures="1" expectedFailures="0"/>
|
||||
</Section>
|
||||
@@ -4867,7 +4886,7 @@ Message from section two
|
||||
</StdOut>
|
||||
</OverallResult>
|
||||
</TestCase>
|
||||
<TestCase name="StartsWith string matcher" tags="[.][failing][hide][matchers]" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<TestCase name="StartsWith string matcher" tags="[.][failing][matchers]" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
testStringForMatching(), StartsWith( "string" )
|
||||
@@ -5325,7 +5344,7 @@ Message from section two
|
||||
</Section>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="Tabs and newlines show in output" tags="[.][failing][hide][whitespace]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<TestCase name="Tabs and newlines show in output" tags="[.][failing][whitespace]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Expression success="false" type="CHECK" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Original>
|
||||
s1 == s2
|
||||
@@ -5449,7 +5468,7 @@ Message from section two
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="This test 'should' fail but doesn't" tags="[!shouldfail][.][failing][hide]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<TestCase name="This test 'should' fail but doesn't" tags="[!shouldfail][.][failing]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="Tracker" filename="projects/<exe-name>/PartTrackerTests.cpp" >
|
||||
@@ -6558,7 +6577,7 @@ Message from section two
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Unexpected exceptions can be translated" tags="[!throws][.][failing][hide]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<TestCase name="Unexpected exceptions can be translated" tags="[!throws][.][failing]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<Exception filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
3.14
|
||||
</Exception>
|
||||
@@ -6721,7 +6740,7 @@ Message from section two
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Vector matchers that fail" tags="[.][failing][hide][matchers][vector]" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<TestCase name="Vector matchers that fail" tags="[.][failing][matchers][vector]" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Section name="Contains (element)" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||
<Original>
|
||||
@@ -6824,13 +6843,13 @@ Message from section two
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="When unchecked exceptions are thrown directly they are always failures" tags="[!throws][.][failing][hide]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<TestCase name="When unchecked exceptions are thrown directly they are always failures" tags="[!throws][.][failing]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<Exception filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
unexpected exception
|
||||
</Exception>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="When unchecked exceptions are thrown during a CHECK the test should continue" tags="[!throws][.][failing][hide]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<TestCase name="When unchecked exceptions are thrown during a CHECK the test should continue" tags="[!throws][.][failing]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<Expression success="false" type="CHECK" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<Original>
|
||||
thisThrows() == 0
|
||||
@@ -6844,7 +6863,7 @@ Message from section two
|
||||
</Expression>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="When unchecked exceptions are thrown during a REQUIRE the test should abort fail" tags="[!throws][.][failing][hide]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<TestCase name="When unchecked exceptions are thrown during a REQUIRE the test should abort fail" tags="[!throws][.][failing]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<Expression success="false" type="REQUIRE" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<Original>
|
||||
thisThrows() == 0
|
||||
@@ -6858,7 +6877,7 @@ Message from section two
|
||||
</Expression>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="When unchecked exceptions are thrown from functions they are always failures" tags="[!throws][.][failing][hide]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<TestCase name="When unchecked exceptions are thrown from functions they are always failures" tags="[!throws][.][failing]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<Expression success="false" type="CHECK" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<Original>
|
||||
thisThrows() == 0
|
||||
@@ -6872,7 +6891,7 @@ Message from section two
|
||||
</Expression>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="When unchecked exceptions are thrown from sections they are always failures" tags="[!throws][.][failing][hide]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<TestCase name="When unchecked exceptions are thrown from sections they are always failures" tags="[!throws][.][failing]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<Section name="section name" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<Exception filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
unexpected exception
|
||||
@@ -6884,13 +6903,13 @@ Message from section two
|
||||
<TestCase name="When unchecked exceptions are thrown, but caught, they do not affect the test" tags="[!throws]" filename="projects/<exe-name>/ExceptionTests.cpp" >
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Where the LHS is not a simple value" tags="[.][Tricky][failing][hide]" filename="projects/<exe-name>/TrickyTests.cpp" >
|
||||
<TestCase name="Where the LHS is not a simple value" tags="[.][Tricky][failing]" filename="projects/<exe-name>/TrickyTests.cpp" >
|
||||
<Warning>
|
||||
Uncomment the code in this test to check that it gives a sensible compiler error
|
||||
</Warning>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Where there is more to the expression after the RHS" tags="[.][Tricky][failing][hide]" filename="projects/<exe-name>/TrickyTests.cpp" >
|
||||
<TestCase name="Where there is more to the expression after the RHS" tags="[.][Tricky][failing]" filename="projects/<exe-name>/TrickyTests.cpp" >
|
||||
<Warning>
|
||||
Uncomment the code in this test to check that it gives a sensible compiler error
|
||||
</Warning>
|
||||
@@ -7065,7 +7084,7 @@ Message from section two
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="checkedElse, failing" tags="[.][failing][hide]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<TestCase name="checkedElse, failing" tags="[.][failing]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Expression success="false" type="CHECKED_ELSE" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Original>
|
||||
flag
|
||||
@@ -7103,7 +7122,7 @@ Message from section two
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="checkedIf, failing" tags="[.][failing][hide]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<TestCase name="checkedIf, failing" tags="[.][failing]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Expression success="false" type="CHECKED_IF" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Original>
|
||||
flag
|
||||
@@ -7217,7 +7236,7 @@ Message from section two
|
||||
loose text artifact
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="just failure" tags="[.][fail][hide][isolated info][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<TestCase name="just failure" tags="[.][fail][isolated info][messages]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<Failure filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
Previous info should not be seen
|
||||
</Failure>
|
||||
@@ -7239,7 +7258,7 @@ loose text artifact
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="looped SECTION tests" tags="[.][failing][hide][sections]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<TestCase name="looped SECTION tests" tags="[.][failing][sections]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Section name="s1" description="b is currently: 0" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Expression success="false" type="CHECK" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Original>
|
||||
@@ -7253,7 +7272,7 @@ loose text artifact
|
||||
</Section>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="looped tests" tags="[.][failing][hide]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<TestCase name="looped tests" tags="[.][failing]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Info>
|
||||
Testing if fib[0] (1) is even
|
||||
</Info>
|
||||
@@ -7344,7 +7363,7 @@ loose text artifact
|
||||
</Expression>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="more nested SECTION tests" tags="[.][failing][hide][sections]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<TestCase name="more nested SECTION tests" tags="[.][failing][sections]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Section name="s1" description="doesn't equal" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Section name="s2" description="equal" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Expression success="false" type="REQUIRE" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
@@ -7389,7 +7408,7 @@ loose text artifact
|
||||
</Section>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="nested SECTION tests" tags="[.][failing][hide][sections]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<TestCase name="nested SECTION tests" tags="[.][failing][sections]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Section name="s1" description="doesn't equal" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Original>
|
||||
@@ -7433,6 +7452,17 @@ loose text artifact
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="non-copyable objects" tags="[.][failing]" filename="projects/<exe-name>/TrickyTests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/TrickyTests.cpp" >
|
||||
<Original>
|
||||
ti == typeid(int)
|
||||
</Original>
|
||||
<Expanded>
|
||||
{?} == {?}
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="not allowed" tags="[!throws]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
@@ -7490,7 +7520,7 @@ loose text artifact
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="random SECTION tests" tags="[.][failing][hide][sections]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<TestCase name="random SECTION tests" tags="[.][failing][sections]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Section name="s1" description="doesn't equal" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Original>
|
||||
@@ -7662,7 +7692,7 @@ loose text artifact
|
||||
<TestCase name="second tag" tags="[tag2]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="send a single char to INFO" tags="[.][failing][hide]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<TestCase name="send a single char to INFO" tags="[.][failing]" filename="projects/<exe-name>/MiscTests.cpp" >
|
||||
<Info>
|
||||
3
|
||||
</Info>
|
||||
@@ -7676,7 +7706,7 @@ loose text artifact
|
||||
</Expression>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="sends information to INFO" tags="[.][failing][hide]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<TestCase name="sends information to INFO" tags="[.][failing]" filename="projects/<exe-name>/MessageTests.cpp" >
|
||||
<Info>
|
||||
hi
|
||||
</Info>
|
||||
@@ -7728,7 +7758,7 @@ loose text artifact
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="string literals of different sizes can be compared" tags="[.][Tricky][failing][hide]" filename="projects/<exe-name>/TrickyTests.cpp" >
|
||||
<TestCase name="string literals of different sizes can be compared" tags="[.][Tricky][failing]" filename="projects/<exe-name>/TrickyTests.cpp" >
|
||||
<Expression success="false" type="REQUIRE" filename="projects/<exe-name>/TrickyTests.cpp" >
|
||||
<Original>
|
||||
std::string( "first" ) == "second"
|
||||
@@ -7752,7 +7782,7 @@ loose text artifact
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="stringify( has_maker_and_toString )" tags="[.][hide][toString]" filename="projects/<exe-name>/ToStringWhich.cpp" >
|
||||
<TestCase name="stringify( has_maker_and_toString )" tags="[.][toString]" filename="projects/<exe-name>/ToStringWhich.cpp" >
|
||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/ToStringWhich.cpp" >
|
||||
<Original>
|
||||
::Catch::Detail::stringify( item ) == "StringMaker<has_maker_and_operator>"
|
||||
@@ -7864,7 +7894,7 @@ loose text artifact
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="toString(enum class)" tags="[.][enum][enumClass][hide][toString]" filename="projects/<exe-name>/EnumToString.cpp" >
|
||||
<TestCase name="toString(enum class)" tags="[.][enum][enumClass][toString]" filename="projects/<exe-name>/EnumToString.cpp" >
|
||||
<Expression success="false" type="CHECK" filename="projects/<exe-name>/EnumToString.cpp" >
|
||||
<Original>
|
||||
::Catch::Detail::stringify(e0) == "0"
|
||||
@@ -8276,7 +8306,7 @@ loose text artifact
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<OverallResults successes="760" failures="103" expectedFailures="21"/>
|
||||
<OverallResults successes="763" failures="103" expectedFailures="21"/>
|
||||
</Group>
|
||||
<OverallResults successes="760" failures="102" expectedFailures="21"/>
|
||||
<OverallResults successes="763" failures="102" expectedFailures="21"/>
|
||||
</Catch>
|
||||
|
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
|
||||
struct truthy {
|
||||
truthy(bool b):m_value(b){}
|
||||
@@ -26,3 +27,9 @@ std::ostream& operator<<(std::ostream& o, truthy) {
|
||||
TEST_CASE( "Reconstruction should be based on stringification: #914" , "[Decomposition][failing][.]") {
|
||||
CHECK(truthy(false));
|
||||
}
|
||||
|
||||
TEST_CASE("#1005: Comparing pointer to int and long (NULL can be either on various systems)", "[Decomposition]") {
|
||||
FILE* fptr = nullptr;
|
||||
REQUIRE(fptr == 0);
|
||||
REQUIRE(fptr == 0l);
|
||||
}
|
||||
|
@@ -24,25 +24,11 @@ CATCH_REGISTER_TAG_ALIAS( "[@tricky]", "[tricky]~[.]" )
|
||||
# pragma clang diagnostic ignored "-Wc++98-compat"
|
||||
#endif
|
||||
|
||||
struct TestListener : Catch::TestEventListenerBase {
|
||||
using TestEventListenerBase::TestEventListenerBase; // inherit constructor
|
||||
};
|
||||
CATCH_REGISTER_LISTENER( TestListener );
|
||||
|
||||
//template<size_t size>
|
||||
//void parseIntoConfig( const char * (&argv)[size], Catch::ConfigData& config ) {
|
||||
// auto parser = Catch::makeCommandLineParser();
|
||||
// parser.parseInto( Catch::Clara::argsToVector( size, argv ), config );
|
||||
//}
|
||||
//
|
||||
//template<size_t size>
|
||||
//std::string parseIntoConfigAndReturnError( const char * (&argv)[size], Catch::ConfigData& config ) {
|
||||
// try {
|
||||
// parseIntoConfig( argv, config );
|
||||
// FAIL( "expected exception" );
|
||||
// }
|
||||
// catch( std::exception& ex ) {
|
||||
// return ex.what();
|
||||
// }
|
||||
// return "";
|
||||
//}
|
||||
//
|
||||
inline Catch::TestCase fakeTestCase( const char* name, const char* desc = "" ){ return Catch::makeTestCase( nullptr, "", name, desc, CATCH_INTERNAL_LINEINFO ); }
|
||||
|
||||
TEST_CASE( "Process can be configured on command line", "[config][command-line]" ) {
|
||||
|
@@ -435,3 +435,9 @@ TEST_CASE( "null deref", "[.][failing][!nonportable]" ) {
|
||||
int *x = NULL;
|
||||
*x = 1;
|
||||
}
|
||||
|
||||
TEST_CASE( "non-copyable objects", "[.][failing]" ) {
|
||||
// Thanks to Agustin Bergé (@k-ballo on the cpplang Slack) for raising this
|
||||
std::type_info const& ti = typeid(int);
|
||||
CHECK( ti == typeid(int) );
|
||||
}
|
||||
|
@@ -1,13 +1,10 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import print_function
|
||||
from releaseCommon import Version
|
||||
import releaseCommon
|
||||
|
||||
v = Version()
|
||||
v = releaseCommon.Version()
|
||||
v.incrementBuildNumber()
|
||||
v.updateVersionFile()
|
||||
v.updateReadmeFile()
|
||||
v.updateConanFile()
|
||||
v.updateConanTestFile()
|
||||
releaseCommon.performUpdates(v)
|
||||
|
||||
print( "Updated Version.hpp, README and Conan to v{0}".format( v.getVersionString() ) )
|
||||
|
@@ -10,116 +10,119 @@ import string
|
||||
from glob import glob
|
||||
|
||||
from scriptCommon import catchPath
|
||||
from releaseCommon import Version
|
||||
|
||||
def generate(v):
|
||||
includesParser = re.compile( r'\s*#\s*include\s*"(.*)"' )
|
||||
guardParser = re.compile( r'\s*#.*(TWOBLUECUBES_)?CATCH_.*_INCLUDED')
|
||||
defineParser = re.compile( r'\s*#define\s+(TWOBLUECUBES_)?CATCH_.*_INCLUDED')
|
||||
ifParser = re.compile( r'\s*#ifndef (TWOBLUECUBES_)?CATCH_.*_INCLUDED')
|
||||
endIfParser = re.compile( r'\s*#endif // (TWOBLUECUBES_)?CATCH_.*_INCLUDED')
|
||||
ifImplParser = re.compile( r'\s*#ifdef CATCH_CONFIG_RUNNER' )
|
||||
commentParser1 = re.compile( r'^\s*/\*')
|
||||
commentParser2 = re.compile( r'^ \*')
|
||||
blankParser = re.compile( r'^\s*$')
|
||||
|
||||
includesParser = re.compile( r'\s*#\s*include\s*"(.*)"' )
|
||||
guardParser = re.compile( r'\s*#.*(TWOBLUECUBES_)?CATCH_.*_INCLUDED')
|
||||
defineParser = re.compile( r'\s*#define\s+(TWOBLUECUBES_)?CATCH_.*_INCLUDED')
|
||||
ifParser = re.compile( r'\s*#ifndef (TWOBLUECUBES_)?CATCH_.*_INCLUDED')
|
||||
endIfParser = re.compile( r'\s*#endif // (TWOBLUECUBES_)?CATCH_.*_INCLUDED')
|
||||
ifImplParser = re.compile( r'\s*#ifdef CATCH_CONFIG_RUNNER' )
|
||||
commentParser1 = re.compile( r'^\s*/\*')
|
||||
commentParser2 = re.compile( r'^ \*')
|
||||
blankParser = re.compile( r'^\s*$')
|
||||
seenHeaders = set([])
|
||||
rootPath = os.path.join( catchPath, 'include/' )
|
||||
outputPath = os.path.join( catchPath, 'single_include/catch.hpp' )
|
||||
|
||||
seenHeaders = set([])
|
||||
rootPath = os.path.join( catchPath, 'include/' )
|
||||
outputPath = os.path.join( catchPath, 'single_include/catch.hpp' )
|
||||
globals = {
|
||||
'includeImpl' : True,
|
||||
'ifdefs' : 0,
|
||||
'implIfDefs' : -1
|
||||
}
|
||||
|
||||
includeImpl = True
|
||||
|
||||
for arg in sys.argv[1:]:
|
||||
arg = string.lower(arg)
|
||||
if arg == "noimpl":
|
||||
includeImpl = False
|
||||
print( "Not including impl code" )
|
||||
else:
|
||||
print( "\n** Unrecognised argument: " + arg + " **\n" )
|
||||
exit(1)
|
||||
|
||||
|
||||
# ensure that the output directory exists (hopefully no races)
|
||||
outDir = os.path.dirname(outputPath)
|
||||
if not os.path.exists(outDir):
|
||||
os.makedirs(outDir)
|
||||
out = open( outputPath, 'w' )
|
||||
ifdefs = 0
|
||||
implIfDefs = -1
|
||||
|
||||
def write( line ):
|
||||
if includeImpl or implIfDefs == -1:
|
||||
out.write( line )
|
||||
|
||||
def insertCpps():
|
||||
dirs = [os.path.join( rootPath, s) for s in ['', 'internal', 'reporters']]
|
||||
cppFiles = []
|
||||
for dir in dirs:
|
||||
cppFiles += glob(os.path.join(dir, '*.cpp'))
|
||||
for fname in cppFiles:
|
||||
dir, name = fname.rsplit(os.path.sep, 1)
|
||||
dir += os.path.sep
|
||||
parseFile(dir, name)
|
||||
|
||||
def parseFile( path, filename ):
|
||||
global ifdefs
|
||||
global implIfDefs
|
||||
|
||||
f = open( os.path.join(path, filename), 'r' )
|
||||
blanks = 0
|
||||
write( "// start {0}\n".format( filename ) )
|
||||
for line in f:
|
||||
if '// ~*~* CATCH_CPP_STITCH_PLACE *~*~' in line:
|
||||
insertCpps()
|
||||
elif ifParser.match( line ):
|
||||
ifdefs = ifdefs + 1
|
||||
elif endIfParser.match( line ):
|
||||
ifdefs = ifdefs - 1
|
||||
if ifdefs == implIfDefs:
|
||||
implIfDefs = -1
|
||||
m = includesParser.match( line )
|
||||
if m:
|
||||
header = m.group(1)
|
||||
headerPath, sep, headerFile = header.rpartition( "/" )
|
||||
if not headerFile in seenHeaders:
|
||||
if headerFile != "tbc_text_format.h" and headerFile != "clara.h":
|
||||
seenHeaders.add( headerFile )
|
||||
if headerPath == "internal" and path.endswith("internal/"):
|
||||
headerPath = ""
|
||||
sep = ""
|
||||
if os.path.exists( path + headerPath + sep + headerFile ):
|
||||
parseFile( path + headerPath + sep, headerFile )
|
||||
else:
|
||||
parseFile( rootPath + headerPath + sep, headerFile )
|
||||
for arg in sys.argv[1:]:
|
||||
arg = string.lower(arg)
|
||||
if arg == "noimpl":
|
||||
globals['includeImpl'] = False
|
||||
print( "Not including impl code" )
|
||||
else:
|
||||
if ifImplParser.match(line):
|
||||
implIfDefs = ifdefs
|
||||
if (not guardParser.match( line ) or defineParser.match( line ) ) and not commentParser1.match( line )and not commentParser2.match( line ):
|
||||
if blankParser.match( line ):
|
||||
blanks = blanks + 1
|
||||
else:
|
||||
blanks = 0
|
||||
if blanks < 2 and not defineParser.match(line):
|
||||
write( line.rstrip() + "\n" )
|
||||
write( '// end {}\n'.format(filename) )
|
||||
print( "\n** Unrecognised argument: " + arg + " **\n" )
|
||||
exit(1)
|
||||
|
||||
|
||||
v = Version()
|
||||
out.write( "/*\n" )
|
||||
out.write( " * Catch v{0}\n".format( v.getVersionString() ) )
|
||||
out.write( " * Generated: {0}\n".format( datetime.datetime.now() ) )
|
||||
out.write( " * ----------------------------------------------------------\n" )
|
||||
out.write( " * This file has been merged from multiple headers. Please don't edit it directly\n" )
|
||||
out.write( " * Copyright (c) {} Two Blue Cubes Ltd. All rights reserved.\n".format( datetime.date.today().year ) )
|
||||
out.write( " *\n" )
|
||||
out.write( " * Distributed under the Boost Software License, Version 1.0. (See accompanying\n" )
|
||||
out.write( " * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n" )
|
||||
out.write( " */\n" )
|
||||
out.write( "#ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" )
|
||||
out.write( "#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" )
|
||||
# ensure that the output directory exists (hopefully no races)
|
||||
outDir = os.path.dirname(outputPath)
|
||||
if not os.path.exists(outDir):
|
||||
os.makedirs(outDir)
|
||||
out = open( outputPath, 'w' )
|
||||
|
||||
parseFile( rootPath, 'catch.hpp' )
|
||||
def write( line ):
|
||||
if globals['includeImpl'] or globals['implIfDefs'] == -1:
|
||||
out.write( line )
|
||||
|
||||
out.write( "#endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n\n" )
|
||||
def insertCpps():
|
||||
dirs = [os.path.join( rootPath, s) for s in ['', 'internal', 'reporters']]
|
||||
cppFiles = []
|
||||
for dir in dirs:
|
||||
cppFiles += glob(os.path.join(dir, '*.cpp'))
|
||||
for fname in cppFiles:
|
||||
dir, name = fname.rsplit(os.path.sep, 1)
|
||||
dir += os.path.sep
|
||||
parseFile(dir, name)
|
||||
|
||||
print ("Generated single include for Catch v{0}\n".format( v.getVersionString() ) )
|
||||
def parseFile( path, filename ):
|
||||
f = open( os.path.join(path, filename), 'r' )
|
||||
blanks = 0
|
||||
write( "// start {0}\n".format( filename ) )
|
||||
for line in f:
|
||||
if '// ~*~* CATCH_CPP_STITCH_PLACE *~*~' in line:
|
||||
insertCpps()
|
||||
continue
|
||||
elif ifParser.match( line ):
|
||||
globals['ifdefs'] += 1
|
||||
elif endIfParser.match( line ):
|
||||
globals['ifdefs'] -= 1
|
||||
if globals['ifdefs'] == globals['implIfDefs']:
|
||||
globals['implIfDefs'] = -1
|
||||
m = includesParser.match( line )
|
||||
if m:
|
||||
header = m.group(1)
|
||||
headerPath, sep, headerFile = header.rpartition( "/" )
|
||||
if not headerFile in seenHeaders:
|
||||
if headerFile != "tbc_text_format.h" and headerFile != "clara.h":
|
||||
seenHeaders.add( headerFile )
|
||||
if headerPath == "internal" and path.endswith("internal/"):
|
||||
headerPath = ""
|
||||
sep = ""
|
||||
if os.path.exists( path + headerPath + sep + headerFile ):
|
||||
parseFile( path + headerPath + sep, headerFile )
|
||||
else:
|
||||
parseFile( rootPath + headerPath + sep, headerFile )
|
||||
else:
|
||||
if ifImplParser.match(line):
|
||||
globals['implIfDefs'] = globals['ifdefs']
|
||||
if (not guardParser.match( line ) or defineParser.match( line ) ) and not commentParser1.match( line )and not commentParser2.match( line ):
|
||||
if blankParser.match( line ):
|
||||
blanks = blanks + 1
|
||||
else:
|
||||
blanks = 0
|
||||
if blanks < 2 and not defineParser.match(line):
|
||||
write( line.rstrip() + "\n" )
|
||||
write( '// end {}\n'.format(filename) )
|
||||
|
||||
|
||||
out.write( "/*\n" )
|
||||
out.write( " * Catch v{0}\n".format( v.getVersionString() ) )
|
||||
out.write( " * Generated: {0}\n".format( datetime.datetime.now() ) )
|
||||
out.write( " * ----------------------------------------------------------\n" )
|
||||
out.write( " * This file has been merged from multiple headers. Please don't edit it directly\n" )
|
||||
out.write( " * Copyright (c) {} Two Blue Cubes Ltd. All rights reserved.\n".format( datetime.date.today().year ) )
|
||||
out.write( " *\n" )
|
||||
out.write( " * Distributed under the Boost Software License, Version 1.0. (See accompanying\n" )
|
||||
out.write( " * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n" )
|
||||
out.write( " */\n" )
|
||||
out.write( "#ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" )
|
||||
out.write( "#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" )
|
||||
|
||||
parseFile( rootPath, 'catch.hpp' )
|
||||
|
||||
out.write( "#endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n\n" )
|
||||
out.close()
|
||||
print ("Generated single include for Catch v{0}\n".format( v.getVersionString() ) )
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
from releaseCommon import Version
|
||||
generate(Version())
|
||||
|
@@ -1,13 +1,10 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import print_function
|
||||
from releaseCommon import Version
|
||||
import releaseCommon
|
||||
|
||||
v = Version()
|
||||
v = releaseCommon.Version()
|
||||
v.incrementMajorVersion()
|
||||
v.updateVersionFile()
|
||||
v.updateReadmeFile()
|
||||
v.updateConanFile()
|
||||
v.updateConanTestFile()
|
||||
releaseCommon.performUpdates(v)
|
||||
|
||||
print( "Updated Version.hpp, README and Conan to v{0}".format( v.getVersionString() ) )
|
||||
|
@@ -1,13 +1,10 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import print_function
|
||||
from releaseCommon import Version
|
||||
import releaseCommon
|
||||
|
||||
v = Version()
|
||||
v = releaseCommon.Version()
|
||||
v.incrementMinorVersion()
|
||||
v.updateVersionFile()
|
||||
v.updateReadmeFile()
|
||||
v.updateConanFile()
|
||||
v.updateConanTestFile()
|
||||
releaseCommon.performUpdates(v)
|
||||
|
||||
print( "Updated Version.hpp, README and Conan to v{0}".format( v.getVersionString() ) )
|
||||
|
@@ -1,13 +1,10 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import print_function
|
||||
from releaseCommon import Version
|
||||
import releaseCommon
|
||||
|
||||
v = Version()
|
||||
v = releaseCommon.Version()
|
||||
v.incrementPatchNumber()
|
||||
v.updateVersionFile()
|
||||
v.updateReadmeFile()
|
||||
v.updateConanFile()
|
||||
v.updateConanTestFile()
|
||||
releaseCommon.performUpdates(v)
|
||||
|
||||
print( "Updated Version.hpp, README and Conan to v{0}".format( v.getVersionString() ) )
|
||||
|
@@ -6,6 +6,8 @@ import re
|
||||
import string
|
||||
|
||||
from scriptCommon import catchPath
|
||||
import generateSingleHeader
|
||||
import updateWandbox
|
||||
|
||||
versionParser = re.compile( r'(\s*static\sVersion\sversion)\s*\(\s*(.*)\s*,\s*(.*)\s*,\s*(.*)\s*,\s*\"(.*)\"\s*,\s*(.*)\s*\).*' )
|
||||
rootPath = os.path.join( catchPath, 'include/' )
|
||||
@@ -76,44 +78,59 @@ class Version:
|
||||
for line in lines:
|
||||
f.write( line + "\n" )
|
||||
|
||||
def updateReadmeFile(self):
|
||||
downloadParser = re.compile( r'<a href=\"https://github.com/philsquared/Catch/releases/download/v\d+\.\d+\.\d+/catch.hpp\">' )
|
||||
f = open( readmePath, 'r' )
|
||||
lines = []
|
||||
for line in f:
|
||||
def updateReadmeFile(version):
|
||||
downloadParser = re.compile( r'<a href=\"https://github.com/philsquared/Catch/releases/download/v\d+\.\d+\.\d+/catch.hpp\">' )
|
||||
success, wandboxLink = updateWandbox.uploadFiles()
|
||||
if not success:
|
||||
print('Error when uploading to wandbox: {}'.format(wandboxLink))
|
||||
exit(1)
|
||||
f = open( readmePath, 'r' )
|
||||
lines = []
|
||||
for line in f:
|
||||
lines.append( line.rstrip() )
|
||||
f.close()
|
||||
f = open( readmePath, 'w' )
|
||||
for line in lines:
|
||||
line = downloadParser.sub( r'<a href="https://github.com/philsquared/Catch/releases/download/v{0}/catch.hpp">'.format(version.getVersionString()) , line)
|
||||
if '[]' in line:
|
||||
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( readmePath, 'w' )
|
||||
for line in lines:
|
||||
line = downloadParser.sub( r'<a href="https://github.com/philsquared/Catch/releases/download/v{0}/catch.hpp">'.format(self.getVersionString()) , line)
|
||||
f.write( line + "\n" )
|
||||
f.close()
|
||||
f = open( conanPath, 'w' )
|
||||
for line in lines:
|
||||
f.write( line + "\n" )
|
||||
|
||||
def updateConanFile(self):
|
||||
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(self.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 updateConanTestFile(self):
|
||||
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(self.getVersionString())) )
|
||||
else:
|
||||
lines.append( line.rstrip() )
|
||||
f.close()
|
||||
f = open( conanTestPath, 'w' )
|
||||
for line in lines:
|
||||
f.write( line + "\n" )
|
||||
def performUpdates(version):
|
||||
# First update version file, so we can regenerate single header and
|
||||
# have it ready for upload to wandbox, when updating readme
|
||||
version.updateVersionFile()
|
||||
generateSingleHeader.generate(version)
|
||||
updateReadmeFile(version)
|
||||
updateConanFile(version)
|
||||
updateConanTestFile(version)
|
||||
|
@@ -65,7 +65,7 @@ def update_portfile(path, header_hash, licence_hash):
|
||||
for line in lines:
|
||||
# Update the version
|
||||
if 'set(CATCH_VERSION' in line:
|
||||
line = 'set(CATCH_VERSION v{})'.format(v.getVersionString())
|
||||
line = 'set(CATCH_VERSION v{})\n'.format(v.getVersionString())
|
||||
|
||||
# Determine which file we are updating
|
||||
if 'vcpkg_download_distfile' in line:
|
||||
|
47
scripts/updateWandbox.py
Normal file
47
scripts/updateWandbox.py
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import json
|
||||
import os
|
||||
import urllib2
|
||||
|
||||
from scriptCommon import catchPath
|
||||
|
||||
def upload(options):
|
||||
request = urllib2.Request('http://melpon.org/wandbox/api/compile.json')
|
||||
request.add_header('Content-Type', 'application/json')
|
||||
response = urllib2.urlopen(request, json.dumps(options))
|
||||
return json.loads(response.read())
|
||||
|
||||
main_file = '''
|
||||
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file
|
||||
#include "catch.hpp"
|
||||
|
||||
unsigned int Factorial( unsigned int number ) {
|
||||
return number <= 1 ? number : Factorial(number-1)*number;
|
||||
}
|
||||
|
||||
TEST_CASE( "Factorials are computed", "[factorial]" ) {
|
||||
REQUIRE( Factorial(1) == 1 );
|
||||
REQUIRE( Factorial(2) == 2 );
|
||||
REQUIRE( Factorial(3) == 6 );
|
||||
REQUIRE( Factorial(10) == 3628800 );
|
||||
}
|
||||
'''
|
||||
|
||||
def uploadFiles():
|
||||
response = upload({
|
||||
'compiler': 'gcc-head',
|
||||
'code': main_file,
|
||||
'codes': [{
|
||||
'file': 'catch.hpp',
|
||||
'code': open(os.path.join(catchPath, 'single_include', 'catch.hpp')).read()
|
||||
}],
|
||||
'options': 'c++11,cpp-no-pedantic,boost-nothing',
|
||||
'compiler-option-raw': '-DCATCH_CONFIG_FAST_COMPILE',
|
||||
'save': True
|
||||
})
|
||||
|
||||
if 'status' in response and not 'compiler_error' in response:
|
||||
return True, response['url']
|
||||
else:
|
||||
return False, response
|
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,7 @@ class CatchConanTest(ConanFile):
|
||||
settings = "os", "compiler", "arch", "build_type"
|
||||
username = getenv("CONAN_USERNAME", "philsquared")
|
||||
channel = getenv("CONAN_CHANNEL", "testing")
|
||||
requires = "Catch/1.9.5@%s/%s" % (username, channel)
|
||||
requires = "Catch/2.0.0-develop.3@%s/%s" % (username, channel)
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
|
Reference in New Issue
Block a user