Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- weight/_dep/Catch2/.conan/build.py +94 -0
- weight/_dep/Catch2/.conan/test_package/CMakeLists.txt +11 -0
- weight/_dep/Catch2/.conan/test_package/conanfile.py +19 -0
- weight/_dep/Catch2/.conan/test_package/test_package.cpp +15 -0
- weight/_dep/Catch2/.github/FUNDING.yml +1 -0
- weight/_dep/Catch2/.github/ISSUE_TEMPLATE/bug_report.md +29 -0
- weight/_dep/Catch2/.github/ISSUE_TEMPLATE/feature_request.md +14 -0
- weight/_dep/Catch2/.github/pull_request_template.md +28 -0
- weight/_dep/Catch2/BUILD.bazel +17 -0
- weight/_dep/Catch2/CMake/Catch2Config.cmake.in +10 -0
- weight/_dep/Catch2/CMake/FindGcov.cmake +157 -0
- weight/_dep/Catch2/CMake/FindLcov.cmake +354 -0
- weight/_dep/Catch2/CMake/Findcodecov.cmake +258 -0
- weight/_dep/Catch2/CMake/MiscFunctions.cmake +26 -0
- weight/_dep/Catch2/CMake/catch2.pc.in +10 -0
- weight/_dep/Catch2/CMake/llvm-cov-wrapper +56 -0
- weight/_dep/Catch2/CMakeLists.txt +259 -0
- weight/_dep/Catch2/CODE_OF_CONDUCT.md +46 -0
- weight/_dep/Catch2/LICENSE.txt +23 -0
- weight/_dep/Catch2/README.md +37 -0
- weight/_dep/Catch2/WORKSPACE +0 -0
- weight/_dep/Catch2/artwork/catch2-c-logo.png +0 -0
- weight/_dep/Catch2/artwork/catch2-hand-logo.png +0 -0
- weight/_dep/Catch2/artwork/catch2-logo-small.png +0 -0
- weight/_dep/Catch2/codecov.yml +25 -0
- weight/_dep/Catch2/conanfile.py +30 -0
- weight/_dep/Catch2/contrib/Catch.cmake +206 -0
- weight/_dep/Catch2/contrib/CatchAddTests.cmake +135 -0
- weight/_dep/Catch2/contrib/ParseAndAddCatchTests.cmake +252 -0
- weight/_dep/Catch2/contrib/gdbinit +16 -0
- weight/_dep/Catch2/contrib/lldbinit +16 -0
- weight/_dep/Catch2/docs/Readme.md +41 -0
- weight/_dep/Catch2/docs/ci-and-misc.md +112 -0
- weight/_dep/Catch2/docs/cmake-integration.md +291 -0
- weight/_dep/Catch2/docs/command-line.md +421 -0
- weight/_dep/Catch2/docs/commercial-users.md +22 -0
- weight/_dep/Catch2/docs/configuration.md +275 -0
- weight/_dep/Catch2/docs/contributing.md +231 -0
- weight/_dep/Catch2/docs/deprecations.md +144 -0
- weight/_dep/Catch2/docs/event-listeners.md +75 -0
- weight/_dep/Catch2/docs/generators.md +219 -0
- weight/_dep/Catch2/docs/limitations.md +201 -0
- weight/_dep/Catch2/docs/list-of-examples.md +49 -0
- weight/_dep/Catch2/docs/logging.md +159 -0
- weight/_dep/Catch2/docs/matchers.md +207 -0
- weight/_dep/Catch2/docs/other-macros.md +154 -0
- weight/_dep/Catch2/docs/own-main.md +131 -0
- weight/_dep/Catch2/docs/release-notes.md +1316 -0
- weight/_dep/Catch2/docs/release-process.md +73 -0
- weight/_dep/Catch2/docs/reporters.md +47 -0
weight/_dep/Catch2/.conan/build.py
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
|
| 4 |
+
import os
|
| 5 |
+
import re
|
| 6 |
+
from cpt.packager import ConanMultiPackager
|
| 7 |
+
from cpt.ci_manager import CIManager
|
| 8 |
+
from cpt.printer import Printer
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
class BuilderSettings(object):
|
| 12 |
+
@property
|
| 13 |
+
def username(self):
|
| 14 |
+
""" Set catchorg as package's owner
|
| 15 |
+
"""
|
| 16 |
+
return os.getenv("CONAN_USERNAME", "catchorg")
|
| 17 |
+
|
| 18 |
+
@property
|
| 19 |
+
def login_username(self):
|
| 20 |
+
""" Set Bintray login username
|
| 21 |
+
"""
|
| 22 |
+
return os.getenv("CONAN_LOGIN_USERNAME", "horenmar")
|
| 23 |
+
|
| 24 |
+
@property
|
| 25 |
+
def upload(self):
|
| 26 |
+
""" Set Catch2 repository to be used on upload.
|
| 27 |
+
The upload server address could be customized by env var
|
| 28 |
+
CONAN_UPLOAD. If not defined, the method will check the branch name.
|
| 29 |
+
Only master or CONAN_STABLE_BRANCH_PATTERN will be accepted.
|
| 30 |
+
The master branch will be pushed to testing channel, because it does
|
| 31 |
+
not match the stable pattern. Otherwise it will upload to stable
|
| 32 |
+
channel.
|
| 33 |
+
"""
|
| 34 |
+
return os.getenv("CONAN_UPLOAD", "https://api.bintray.com/conan/catchorg/catch2")
|
| 35 |
+
|
| 36 |
+
@property
|
| 37 |
+
def upload_only_when_stable(self):
|
| 38 |
+
""" Force to upload when running over tag branch
|
| 39 |
+
"""
|
| 40 |
+
return os.getenv("CONAN_UPLOAD_ONLY_WHEN_STABLE", "True").lower() in ["true", "1", "yes"]
|
| 41 |
+
|
| 42 |
+
@property
|
| 43 |
+
def stable_branch_pattern(self):
|
| 44 |
+
""" Only upload the package the branch name is like a tag
|
| 45 |
+
"""
|
| 46 |
+
return os.getenv("CONAN_STABLE_BRANCH_PATTERN", r"v\d+\.\d+\.\d+")
|
| 47 |
+
|
| 48 |
+
@property
|
| 49 |
+
def reference(self):
|
| 50 |
+
""" Read project version from branch create Conan reference
|
| 51 |
+
"""
|
| 52 |
+
return os.getenv("CONAN_REFERENCE", "Catch2/{}".format(self._version))
|
| 53 |
+
|
| 54 |
+
@property
|
| 55 |
+
def channel(self):
|
| 56 |
+
""" Default Conan package channel when not stable
|
| 57 |
+
"""
|
| 58 |
+
return os.getenv("CONAN_CHANNEL", "testing")
|
| 59 |
+
|
| 60 |
+
@property
|
| 61 |
+
def _version(self):
|
| 62 |
+
""" Get version name from cmake file
|
| 63 |
+
"""
|
| 64 |
+
pattern = re.compile(r"project\(Catch2 LANGUAGES CXX VERSION (\d+\.\d+\.\d+)\)")
|
| 65 |
+
version = "latest"
|
| 66 |
+
with open("CMakeLists.txt") as file:
|
| 67 |
+
for line in file:
|
| 68 |
+
result = pattern.search(line)
|
| 69 |
+
if result:
|
| 70 |
+
version = result.group(1)
|
| 71 |
+
return version
|
| 72 |
+
|
| 73 |
+
@property
|
| 74 |
+
def _branch(self):
|
| 75 |
+
""" Get branch name from CI manager
|
| 76 |
+
"""
|
| 77 |
+
printer = Printer(None)
|
| 78 |
+
ci_manager = CIManager(printer)
|
| 79 |
+
return ci_manager.get_branch()
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
if __name__ == "__main__":
|
| 83 |
+
settings = BuilderSettings()
|
| 84 |
+
builder = ConanMultiPackager(
|
| 85 |
+
reference=settings.reference,
|
| 86 |
+
channel=settings.channel,
|
| 87 |
+
upload=settings.upload,
|
| 88 |
+
upload_only_when_stable=settings.upload_only_when_stable,
|
| 89 |
+
stable_branch_pattern=settings.stable_branch_pattern,
|
| 90 |
+
login_username=settings.login_username,
|
| 91 |
+
username=settings.username,
|
| 92 |
+
test_folder=os.path.join(".conan", "test_package"))
|
| 93 |
+
builder.add()
|
| 94 |
+
builder.run()
|
weight/_dep/Catch2/.conan/test_package/CMakeLists.txt
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cmake_minimum_required(VERSION 3.2.0)
|
| 2 |
+
project(test_package CXX)
|
| 3 |
+
|
| 4 |
+
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
| 5 |
+
conan_basic_setup(TARGETS)
|
| 6 |
+
|
| 7 |
+
find_package(Catch2 REQUIRED CONFIG)
|
| 8 |
+
|
| 9 |
+
add_executable(${PROJECT_NAME} test_package.cpp)
|
| 10 |
+
target_link_libraries(${PROJECT_NAME} CONAN_PKG::Catch2)
|
| 11 |
+
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11)
|
weight/_dep/Catch2/.conan/test_package/conanfile.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
from conans import ConanFile, CMake
|
| 4 |
+
import os
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
class TestPackageConan(ConanFile):
|
| 8 |
+
settings = "os", "compiler", "build_type", "arch"
|
| 9 |
+
generators = "cmake"
|
| 10 |
+
|
| 11 |
+
def build(self):
|
| 12 |
+
cmake = CMake(self)
|
| 13 |
+
cmake.configure()
|
| 14 |
+
cmake.build()
|
| 15 |
+
|
| 16 |
+
def test(self):
|
| 17 |
+
assert os.path.isfile(os.path.join(self.deps_cpp_info["Catch2"].rootpath, "licenses", "LICENSE.txt"))
|
| 18 |
+
bin_path = os.path.join("bin", "test_package")
|
| 19 |
+
self.run("%s -s" % bin_path, run_environment=True)
|
weight/_dep/Catch2/.conan/test_package/test_package.cpp
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#define CATCH_CONFIG_MAIN
|
| 2 |
+
|
| 3 |
+
#include <catch2/catch.hpp>
|
| 4 |
+
|
| 5 |
+
int Factorial( int number ) {
|
| 6 |
+
return number <= 1 ? 1 : Factorial( number - 1 ) * number;
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
TEST_CASE( "Factorial Tests", "[single-file]" ) {
|
| 10 |
+
REQUIRE( Factorial(0) == 1 );
|
| 11 |
+
REQUIRE( Factorial(1) == 1 );
|
| 12 |
+
REQUIRE( Factorial(2) == 2 );
|
| 13 |
+
REQUIRE( Factorial(3) == 6 );
|
| 14 |
+
REQUIRE( Factorial(10) == 3628800 );
|
| 15 |
+
}
|
weight/_dep/Catch2/.github/FUNDING.yml
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
custom: "https://www.paypal.me/horenmar"
|
weight/_dep/Catch2/.github/ISSUE_TEMPLATE/bug_report.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: Bug report
|
| 3 |
+
about: Create an issue that documents a bug
|
| 4 |
+
title: ''
|
| 5 |
+
labels: ''
|
| 6 |
+
assignees: ''
|
| 7 |
+
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
**Describe the bug**
|
| 11 |
+
A clear and concise description of what the bug is.
|
| 12 |
+
|
| 13 |
+
**Expected behavior**
|
| 14 |
+
A clear and concise description of what you expected to happen.
|
| 15 |
+
|
| 16 |
+
**Reproduction steps**
|
| 17 |
+
Steps to reproduce the bug.
|
| 18 |
+
<!-- Usually this means a small and self-contained piece of code that uses Catch and specifying compiler flags if relevant. -->
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
**Platform information:**
|
| 22 |
+
<!-- Fill in any extra information that might be important for your issue. -->
|
| 23 |
+
- OS: **Windows NT**
|
| 24 |
+
- Compiler+version: **GCC v2.9.5**
|
| 25 |
+
- Catch version: **v1.2.3**
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
**Additional context**
|
| 29 |
+
Add any other context about the problem here.
|
weight/_dep/Catch2/.github/ISSUE_TEMPLATE/feature_request.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: Feature request
|
| 3 |
+
about: Create an issue that requests a feature or other improvement
|
| 4 |
+
title: ''
|
| 5 |
+
labels: ''
|
| 6 |
+
assignees: ''
|
| 7 |
+
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
**Description**
|
| 11 |
+
Describe the feature/change you request and why do you want it.
|
| 12 |
+
|
| 13 |
+
**Additional context**
|
| 14 |
+
Add any other context or screenshots about the feature request here.
|
weight/_dep/Catch2/.github/pull_request_template.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!--
|
| 2 |
+
Please do not submit pull requests changing the `version.hpp`
|
| 3 |
+
or the single-include `catch.hpp` file, these are changed
|
| 4 |
+
only when a new release is made.
|
| 5 |
+
|
| 6 |
+
Before submitting a PR you should probably read the contributor documentation
|
| 7 |
+
at docs/contributing.md. It will tell you how to properly test your changes.
|
| 8 |
+
-->
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
## Description
|
| 12 |
+
<!--
|
| 13 |
+
Describe the what and the why of your pull request. Remember that these two
|
| 14 |
+
are usually a bit different. As an example, if you have made various changes
|
| 15 |
+
to decrease the number of new strings allocated, that's what. The why probably
|
| 16 |
+
was that you have a large set of tests and found that this speeds them up.
|
| 17 |
+
-->
|
| 18 |
+
|
| 19 |
+
## GitHub Issues
|
| 20 |
+
<!--
|
| 21 |
+
If this PR was motivated by some existing issues, reference them here.
|
| 22 |
+
|
| 23 |
+
If it is a simple bug-fix, please also add a line like 'Closes #123'
|
| 24 |
+
to your commit message, so that it is automatically closed.
|
| 25 |
+
If it is not, don't, as it might take several iterations for a feature
|
| 26 |
+
to be done properly. If in doubt, leave it open and reference it in the
|
| 27 |
+
PR itself, so that maintainers can decide.
|
| 28 |
+
-->
|
weight/_dep/Catch2/BUILD.bazel
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Load the cc_library rule.
|
| 2 |
+
load("@rules_cc//cc:defs.bzl", "cc_library")
|
| 3 |
+
|
| 4 |
+
# Header-only rule to export catch2/catch.hpp.
|
| 5 |
+
cc_library(
|
| 6 |
+
name = "catch2",
|
| 7 |
+
hdrs = ["single_include/catch2/catch.hpp"],
|
| 8 |
+
includes = ["single_include/"],
|
| 9 |
+
visibility = ["//visibility:public"],
|
| 10 |
+
)
|
| 11 |
+
|
| 12 |
+
cc_library(
|
| 13 |
+
name = "catch2_with_main",
|
| 14 |
+
srcs = ["src/catch_with_main.cpp"],
|
| 15 |
+
visibility = ["//visibility:public"],
|
| 16 |
+
deps = ["//:catch2"],
|
| 17 |
+
)
|
weight/_dep/Catch2/CMake/Catch2Config.cmake.in
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@PACKAGE_INIT@
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
# Avoid repeatedly including the targets
|
| 5 |
+
if(NOT TARGET Catch2::Catch2)
|
| 6 |
+
# Provide path for scripts
|
| 7 |
+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
|
| 8 |
+
|
| 9 |
+
include(${CMAKE_CURRENT_LIST_DIR}/Catch2Targets.cmake)
|
| 10 |
+
endif()
|
weight/_dep/Catch2/CMake/FindGcov.cmake
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is part of CMake-codecov.
|
| 2 |
+
#
|
| 3 |
+
# Copyright (c)
|
| 4 |
+
# 2015-2017 RWTH Aachen University, Federal Republic of Germany
|
| 5 |
+
#
|
| 6 |
+
# See the LICENSE file in the package base directory for details
|
| 7 |
+
#
|
| 8 |
+
# Written by Alexander Haase, alexander.haase@rwth-aachen.de
|
| 9 |
+
#
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
# include required Modules
|
| 13 |
+
include(FindPackageHandleStandardArgs)
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
# Search for gcov binary.
|
| 17 |
+
set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
|
| 18 |
+
set(CMAKE_REQUIRED_QUIET ${codecov_FIND_QUIETLY})
|
| 19 |
+
|
| 20 |
+
get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
|
| 21 |
+
foreach (LANG ${ENABLED_LANGUAGES})
|
| 22 |
+
# Gcov evaluation is dependent on the used compiler. Check gcov support for
|
| 23 |
+
# each compiler that is used. If gcov binary was already found for this
|
| 24 |
+
# compiler, do not try to find it again.
|
| 25 |
+
if (NOT GCOV_${CMAKE_${LANG}_COMPILER_ID}_BIN)
|
| 26 |
+
get_filename_component(COMPILER_PATH "${CMAKE_${LANG}_COMPILER}" PATH)
|
| 27 |
+
|
| 28 |
+
if ("${CMAKE_${LANG}_COMPILER_ID}" STREQUAL "GNU")
|
| 29 |
+
# Some distributions like OSX (homebrew) ship gcov with the compiler
|
| 30 |
+
# version appended as gcov-x. To find this binary we'll build the
|
| 31 |
+
# suggested binary name with the compiler version.
|
| 32 |
+
string(REGEX MATCH "^[0-9]+" GCC_VERSION
|
| 33 |
+
"${CMAKE_${LANG}_COMPILER_VERSION}")
|
| 34 |
+
|
| 35 |
+
find_program(GCOV_BIN NAMES gcov-${GCC_VERSION} gcov
|
| 36 |
+
HINTS ${COMPILER_PATH})
|
| 37 |
+
|
| 38 |
+
elseif ("${CMAKE_${LANG}_COMPILER_ID}" STREQUAL "Clang")
|
| 39 |
+
# Some distributions like Debian ship llvm-cov with the compiler
|
| 40 |
+
# version appended as llvm-cov-x.y. To find this binary we'll build
|
| 41 |
+
# the suggested binary name with the compiler version.
|
| 42 |
+
string(REGEX MATCH "^[0-9]+.[0-9]+" LLVM_VERSION
|
| 43 |
+
"${CMAKE_${LANG}_COMPILER_VERSION}")
|
| 44 |
+
|
| 45 |
+
# llvm-cov prior version 3.5 seems to be not working with coverage
|
| 46 |
+
# evaluation tools, but these versions are compatible with the gcc
|
| 47 |
+
# gcov tool.
|
| 48 |
+
if(LLVM_VERSION VERSION_GREATER 3.4)
|
| 49 |
+
find_program(LLVM_COV_BIN NAMES "llvm-cov-${LLVM_VERSION}"
|
| 50 |
+
"llvm-cov" HINTS ${COMPILER_PATH})
|
| 51 |
+
mark_as_advanced(LLVM_COV_BIN)
|
| 52 |
+
|
| 53 |
+
if (LLVM_COV_BIN)
|
| 54 |
+
find_program(LLVM_COV_WRAPPER "llvm-cov-wrapper" PATHS
|
| 55 |
+
${CMAKE_MODULE_PATH})
|
| 56 |
+
if (LLVM_COV_WRAPPER)
|
| 57 |
+
set(GCOV_BIN "${LLVM_COV_WRAPPER}" CACHE FILEPATH "")
|
| 58 |
+
|
| 59 |
+
# set additional parameters
|
| 60 |
+
set(GCOV_${CMAKE_${LANG}_COMPILER_ID}_ENV
|
| 61 |
+
"LLVM_COV_BIN=${LLVM_COV_BIN}" CACHE STRING
|
| 62 |
+
"Environment variables for llvm-cov-wrapper.")
|
| 63 |
+
mark_as_advanced(GCOV_${CMAKE_${LANG}_COMPILER_ID}_ENV)
|
| 64 |
+
endif ()
|
| 65 |
+
endif ()
|
| 66 |
+
endif ()
|
| 67 |
+
|
| 68 |
+
if (NOT GCOV_BIN)
|
| 69 |
+
# Fall back to gcov binary if llvm-cov was not found or is
|
| 70 |
+
# incompatible. This is the default on OSX, but may crash on
|
| 71 |
+
# recent Linux versions.
|
| 72 |
+
find_program(GCOV_BIN gcov HINTS ${COMPILER_PATH})
|
| 73 |
+
endif ()
|
| 74 |
+
endif ()
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
if (GCOV_BIN)
|
| 78 |
+
set(GCOV_${CMAKE_${LANG}_COMPILER_ID}_BIN "${GCOV_BIN}" CACHE STRING
|
| 79 |
+
"${LANG} gcov binary.")
|
| 80 |
+
|
| 81 |
+
if (NOT CMAKE_REQUIRED_QUIET)
|
| 82 |
+
message("-- Found gcov evaluation for "
|
| 83 |
+
"${CMAKE_${LANG}_COMPILER_ID}: ${GCOV_BIN}")
|
| 84 |
+
endif()
|
| 85 |
+
|
| 86 |
+
unset(GCOV_BIN CACHE)
|
| 87 |
+
endif ()
|
| 88 |
+
endif ()
|
| 89 |
+
endforeach ()
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
# Add a new global target for all gcov targets. This target could be used to
|
| 95 |
+
# generate the gcov files for the whole project instead of calling <TARGET>-gcov
|
| 96 |
+
# for each target.
|
| 97 |
+
if (NOT TARGET gcov)
|
| 98 |
+
add_custom_target(gcov)
|
| 99 |
+
endif (NOT TARGET gcov)
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
# This function will add gcov evaluation for target <TNAME>. Only sources of
|
| 104 |
+
# this target will be evaluated and no dependencies will be added. It will call
|
| 105 |
+
# Gcov on any source file of <TNAME> once and store the gcov file in the same
|
| 106 |
+
# directory.
|
| 107 |
+
function (add_gcov_target TNAME)
|
| 108 |
+
set(TDIR ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TNAME}.dir)
|
| 109 |
+
|
| 110 |
+
# We don't have to check, if the target has support for coverage, thus this
|
| 111 |
+
# will be checked by add_coverage_target in Findcoverage.cmake. Instead we
|
| 112 |
+
# have to determine which gcov binary to use.
|
| 113 |
+
get_target_property(TSOURCES ${TNAME} SOURCES)
|
| 114 |
+
set(SOURCES "")
|
| 115 |
+
set(TCOMPILER "")
|
| 116 |
+
foreach (FILE ${TSOURCES})
|
| 117 |
+
codecov_path_of_source(${FILE} FILE)
|
| 118 |
+
if (NOT "${FILE}" STREQUAL "")
|
| 119 |
+
codecov_lang_of_source(${FILE} LANG)
|
| 120 |
+
if (NOT "${LANG}" STREQUAL "")
|
| 121 |
+
list(APPEND SOURCES "${FILE}")
|
| 122 |
+
set(TCOMPILER ${CMAKE_${LANG}_COMPILER_ID})
|
| 123 |
+
endif ()
|
| 124 |
+
endif ()
|
| 125 |
+
endforeach ()
|
| 126 |
+
|
| 127 |
+
# If no gcov binary was found, coverage data can't be evaluated.
|
| 128 |
+
if (NOT GCOV_${TCOMPILER}_BIN)
|
| 129 |
+
message(WARNING "No coverage evaluation binary found for ${TCOMPILER}.")
|
| 130 |
+
return()
|
| 131 |
+
endif ()
|
| 132 |
+
|
| 133 |
+
set(GCOV_BIN "${GCOV_${TCOMPILER}_BIN}")
|
| 134 |
+
set(GCOV_ENV "${GCOV_${TCOMPILER}_ENV}")
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
set(BUFFER "")
|
| 138 |
+
foreach(FILE ${SOURCES})
|
| 139 |
+
get_filename_component(FILE_PATH "${TDIR}/${FILE}" PATH)
|
| 140 |
+
|
| 141 |
+
# call gcov
|
| 142 |
+
add_custom_command(OUTPUT ${TDIR}/${FILE}.gcov
|
| 143 |
+
COMMAND ${GCOV_ENV} ${GCOV_BIN} ${TDIR}/${FILE}.gcno > /dev/null
|
| 144 |
+
DEPENDS ${TNAME} ${TDIR}/${FILE}.gcno
|
| 145 |
+
WORKING_DIRECTORY ${FILE_PATH}
|
| 146 |
+
)
|
| 147 |
+
|
| 148 |
+
list(APPEND BUFFER ${TDIR}/${FILE}.gcov)
|
| 149 |
+
endforeach()
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
# add target for gcov evaluation of <TNAME>
|
| 153 |
+
add_custom_target(${TNAME}-gcov DEPENDS ${BUFFER})
|
| 154 |
+
|
| 155 |
+
# add evaluation target to the global gcov target.
|
| 156 |
+
add_dependencies(gcov ${TNAME}-gcov)
|
| 157 |
+
endfunction (add_gcov_target)
|
weight/_dep/Catch2/CMake/FindLcov.cmake
ADDED
|
@@ -0,0 +1,354 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is part of CMake-codecov.
|
| 2 |
+
#
|
| 3 |
+
# Copyright (c)
|
| 4 |
+
# 2015-2017 RWTH Aachen University, Federal Republic of Germany
|
| 5 |
+
#
|
| 6 |
+
# See the LICENSE file in the package base directory for details
|
| 7 |
+
#
|
| 8 |
+
# Written by Alexander Haase, alexander.haase@rwth-aachen.de
|
| 9 |
+
#
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
# configuration
|
| 13 |
+
set(LCOV_DATA_PATH "${CMAKE_BINARY_DIR}/lcov/data")
|
| 14 |
+
set(LCOV_DATA_PATH_INIT "${LCOV_DATA_PATH}/init")
|
| 15 |
+
set(LCOV_DATA_PATH_CAPTURE "${LCOV_DATA_PATH}/capture")
|
| 16 |
+
set(LCOV_HTML_PATH "${CMAKE_BINARY_DIR}/lcov/html")
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
# Search for Gcov which is used by Lcov.
|
| 22 |
+
find_package(Gcov)
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
# This function will add lcov evaluation for target <TNAME>. Only sources of
|
| 28 |
+
# this target will be evaluated and no dependencies will be added. It will call
|
| 29 |
+
# geninfo on any source file of <TNAME> once and store the info file in the same
|
| 30 |
+
# directory.
|
| 31 |
+
#
|
| 32 |
+
# Note: This function is only a wrapper to define this function always, even if
|
| 33 |
+
# coverage is not supported by the compiler or disabled. This function must
|
| 34 |
+
# be defined here, because the module will be exited, if there is no coverage
|
| 35 |
+
# support by the compiler or it is disabled by the user.
|
| 36 |
+
function (add_lcov_target TNAME)
|
| 37 |
+
if (LCOV_FOUND)
|
| 38 |
+
# capture initial coverage data
|
| 39 |
+
lcov_capture_initial_tgt(${TNAME})
|
| 40 |
+
|
| 41 |
+
# capture coverage data after execution
|
| 42 |
+
lcov_capture_tgt(${TNAME})
|
| 43 |
+
endif ()
|
| 44 |
+
endfunction (add_lcov_target)
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
# include required Modules
|
| 50 |
+
include(FindPackageHandleStandardArgs)
|
| 51 |
+
|
| 52 |
+
# Search for required lcov binaries.
|
| 53 |
+
find_program(LCOV_BIN lcov)
|
| 54 |
+
find_program(GENINFO_BIN geninfo)
|
| 55 |
+
find_program(GENHTML_BIN genhtml)
|
| 56 |
+
find_package_handle_standard_args(lcov
|
| 57 |
+
REQUIRED_VARS LCOV_BIN GENINFO_BIN GENHTML_BIN
|
| 58 |
+
)
|
| 59 |
+
|
| 60 |
+
# enable genhtml C++ demangeling, if c++filt is found.
|
| 61 |
+
set(GENHTML_CPPFILT_FLAG "")
|
| 62 |
+
find_program(CPPFILT_BIN c++filt)
|
| 63 |
+
if (NOT CPPFILT_BIN STREQUAL "")
|
| 64 |
+
set(GENHTML_CPPFILT_FLAG "--demangle-cpp")
|
| 65 |
+
endif (NOT CPPFILT_BIN STREQUAL "")
|
| 66 |
+
|
| 67 |
+
# enable no-external flag for lcov, if available.
|
| 68 |
+
if (GENINFO_BIN AND NOT DEFINED GENINFO_EXTERN_FLAG)
|
| 69 |
+
set(FLAG "")
|
| 70 |
+
execute_process(COMMAND ${GENINFO_BIN} --help OUTPUT_VARIABLE GENINFO_HELP)
|
| 71 |
+
string(REGEX MATCH "external" GENINFO_RES "${GENINFO_HELP}")
|
| 72 |
+
if (GENINFO_RES)
|
| 73 |
+
set(FLAG "--no-external")
|
| 74 |
+
endif ()
|
| 75 |
+
|
| 76 |
+
set(GENINFO_EXTERN_FLAG "${FLAG}"
|
| 77 |
+
CACHE STRING "Geninfo flag to exclude system sources.")
|
| 78 |
+
endif ()
|
| 79 |
+
|
| 80 |
+
# If Lcov was not found, exit module now.
|
| 81 |
+
if (NOT LCOV_FOUND)
|
| 82 |
+
return()
|
| 83 |
+
endif (NOT LCOV_FOUND)
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
# Create directories to be used.
|
| 89 |
+
file(MAKE_DIRECTORY ${LCOV_DATA_PATH_INIT})
|
| 90 |
+
file(MAKE_DIRECTORY ${LCOV_DATA_PATH_CAPTURE})
|
| 91 |
+
|
| 92 |
+
set(LCOV_REMOVE_PATTERNS "")
|
| 93 |
+
|
| 94 |
+
# This function will merge lcov files to a single target file. Additional lcov
|
| 95 |
+
# flags may be set with setting LCOV_EXTRA_FLAGS before calling this function.
|
| 96 |
+
function (lcov_merge_files OUTFILE ...)
|
| 97 |
+
# Remove ${OUTFILE} from ${ARGV} and generate lcov parameters with files.
|
| 98 |
+
list(REMOVE_AT ARGV 0)
|
| 99 |
+
|
| 100 |
+
# Generate merged file.
|
| 101 |
+
string(REPLACE "${CMAKE_BINARY_DIR}/" "" FILE_REL "${OUTFILE}")
|
| 102 |
+
add_custom_command(OUTPUT "${OUTFILE}.raw"
|
| 103 |
+
COMMAND cat ${ARGV} > ${OUTFILE}.raw
|
| 104 |
+
DEPENDS ${ARGV}
|
| 105 |
+
COMMENT "Generating ${FILE_REL}"
|
| 106 |
+
)
|
| 107 |
+
|
| 108 |
+
add_custom_command(OUTPUT "${OUTFILE}"
|
| 109 |
+
COMMAND ${LCOV_BIN} --quiet -a ${OUTFILE}.raw --output-file ${OUTFILE}
|
| 110 |
+
--base-directory ${PROJECT_SOURCE_DIR} ${LCOV_EXTRA_FLAGS}
|
| 111 |
+
COMMAND ${LCOV_BIN} --quiet -r ${OUTFILE} ${LCOV_REMOVE_PATTERNS}
|
| 112 |
+
--output-file ${OUTFILE} ${LCOV_EXTRA_FLAGS}
|
| 113 |
+
DEPENDS ${OUTFILE}.raw
|
| 114 |
+
COMMENT "Post-processing ${FILE_REL}"
|
| 115 |
+
)
|
| 116 |
+
endfunction ()
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
# Add a new global target to generate initial coverage reports for all targets.
|
| 122 |
+
# This target will be used to generate the global initial info file, which is
|
| 123 |
+
# used to gather even empty report data.
|
| 124 |
+
if (NOT TARGET lcov-capture-init)
|
| 125 |
+
add_custom_target(lcov-capture-init)
|
| 126 |
+
set(LCOV_CAPTURE_INIT_FILES "" CACHE INTERNAL "")
|
| 127 |
+
endif (NOT TARGET lcov-capture-init)
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
# This function will add initial capture of coverage data for target <TNAME>,
|
| 131 |
+
# which is needed to get also data for objects, which were not loaded at
|
| 132 |
+
# execution time. It will call geninfo for every source file of <TNAME> once and
|
| 133 |
+
# store the info file in the same directory.
|
| 134 |
+
function (lcov_capture_initial_tgt TNAME)
|
| 135 |
+
# We don't have to check, if the target has support for coverage, thus this
|
| 136 |
+
# will be checked by add_coverage_target in Findcoverage.cmake. Instead we
|
| 137 |
+
# have to determine which gcov binary to use.
|
| 138 |
+
get_target_property(TSOURCES ${TNAME} SOURCES)
|
| 139 |
+
set(SOURCES "")
|
| 140 |
+
set(TCOMPILER "")
|
| 141 |
+
foreach (FILE ${TSOURCES})
|
| 142 |
+
codecov_path_of_source(${FILE} FILE)
|
| 143 |
+
if (NOT "${FILE}" STREQUAL "")
|
| 144 |
+
codecov_lang_of_source(${FILE} LANG)
|
| 145 |
+
if (NOT "${LANG}" STREQUAL "")
|
| 146 |
+
list(APPEND SOURCES "${FILE}")
|
| 147 |
+
set(TCOMPILER ${CMAKE_${LANG}_COMPILER_ID})
|
| 148 |
+
endif ()
|
| 149 |
+
endif ()
|
| 150 |
+
endforeach ()
|
| 151 |
+
|
| 152 |
+
# If no gcov binary was found, coverage data can't be evaluated.
|
| 153 |
+
if (NOT GCOV_${TCOMPILER}_BIN)
|
| 154 |
+
message(WARNING "No coverage evaluation binary found for ${TCOMPILER}.")
|
| 155 |
+
return()
|
| 156 |
+
endif ()
|
| 157 |
+
|
| 158 |
+
set(GCOV_BIN "${GCOV_${TCOMPILER}_BIN}")
|
| 159 |
+
set(GCOV_ENV "${GCOV_${TCOMPILER}_ENV}")
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
set(TDIR ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TNAME}.dir)
|
| 163 |
+
set(GENINFO_FILES "")
|
| 164 |
+
foreach(FILE ${SOURCES})
|
| 165 |
+
# generate empty coverage files
|
| 166 |
+
set(OUTFILE "${TDIR}/${FILE}.info.init")
|
| 167 |
+
list(APPEND GENINFO_FILES ${OUTFILE})
|
| 168 |
+
|
| 169 |
+
add_custom_command(OUTPUT ${OUTFILE} COMMAND ${GCOV_ENV} ${GENINFO_BIN}
|
| 170 |
+
--quiet --base-directory ${PROJECT_SOURCE_DIR} --initial
|
| 171 |
+
--gcov-tool ${GCOV_BIN} --output-filename ${OUTFILE}
|
| 172 |
+
${GENINFO_EXTERN_FLAG} ${TDIR}/${FILE}.gcno
|
| 173 |
+
DEPENDS ${TNAME}
|
| 174 |
+
COMMENT "Capturing initial coverage data for ${FILE}"
|
| 175 |
+
)
|
| 176 |
+
endforeach()
|
| 177 |
+
|
| 178 |
+
# Concatenate all files generated by geninfo to a single file per target.
|
| 179 |
+
set(OUTFILE "${LCOV_DATA_PATH_INIT}/${TNAME}.info")
|
| 180 |
+
set(LCOV_EXTRA_FLAGS "--initial")
|
| 181 |
+
lcov_merge_files("${OUTFILE}" ${GENINFO_FILES})
|
| 182 |
+
add_custom_target(${TNAME}-capture-init ALL DEPENDS ${OUTFILE})
|
| 183 |
+
|
| 184 |
+
# add geninfo file generation to global lcov-geninfo target
|
| 185 |
+
add_dependencies(lcov-capture-init ${TNAME}-capture-init)
|
| 186 |
+
set(LCOV_CAPTURE_INIT_FILES "${LCOV_CAPTURE_INIT_FILES}"
|
| 187 |
+
"${OUTFILE}" CACHE INTERNAL ""
|
| 188 |
+
)
|
| 189 |
+
endfunction (lcov_capture_initial_tgt)
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
# This function will generate the global info file for all targets. It has to be
|
| 193 |
+
# called after all other CMake functions in the root CMakeLists.txt file, to get
|
| 194 |
+
# a full list of all targets that generate coverage data.
|
| 195 |
+
function (lcov_capture_initial)
|
| 196 |
+
# Skip this function (and do not create the following targets), if there are
|
| 197 |
+
# no input files.
|
| 198 |
+
if ("${LCOV_CAPTURE_INIT_FILES}" STREQUAL "")
|
| 199 |
+
return()
|
| 200 |
+
endif ()
|
| 201 |
+
|
| 202 |
+
# Add a new target to merge the files of all targets.
|
| 203 |
+
set(OUTFILE "${LCOV_DATA_PATH_INIT}/all_targets.info")
|
| 204 |
+
lcov_merge_files("${OUTFILE}" ${LCOV_CAPTURE_INIT_FILES})
|
| 205 |
+
add_custom_target(lcov-geninfo-init ALL DEPENDS ${OUTFILE}
|
| 206 |
+
lcov-capture-init
|
| 207 |
+
)
|
| 208 |
+
endfunction (lcov_capture_initial)
|
| 209 |
+
|
| 210 |
+
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
# Add a new global target to generate coverage reports for all targets. This
|
| 214 |
+
# target will be used to generate the global info file.
|
| 215 |
+
if (NOT TARGET lcov-capture)
|
| 216 |
+
add_custom_target(lcov-capture)
|
| 217 |
+
set(LCOV_CAPTURE_FILES "" CACHE INTERNAL "")
|
| 218 |
+
endif (NOT TARGET lcov-capture)
|
| 219 |
+
|
| 220 |
+
|
| 221 |
+
# This function will add capture of coverage data for target <TNAME>, which is
|
| 222 |
+
# needed to get also data for objects, which were not loaded at execution time.
|
| 223 |
+
# It will call geninfo for every source file of <TNAME> once and store the info
|
| 224 |
+
# file in the same directory.
|
| 225 |
+
function (lcov_capture_tgt TNAME)
|
| 226 |
+
# We don't have to check, if the target has support for coverage, thus this
|
| 227 |
+
# will be checked by add_coverage_target in Findcoverage.cmake. Instead we
|
| 228 |
+
# have to determine which gcov binary to use.
|
| 229 |
+
get_target_property(TSOURCES ${TNAME} SOURCES)
|
| 230 |
+
set(SOURCES "")
|
| 231 |
+
set(TCOMPILER "")
|
| 232 |
+
foreach (FILE ${TSOURCES})
|
| 233 |
+
codecov_path_of_source(${FILE} FILE)
|
| 234 |
+
if (NOT "${FILE}" STREQUAL "")
|
| 235 |
+
codecov_lang_of_source(${FILE} LANG)
|
| 236 |
+
if (NOT "${LANG}" STREQUAL "")
|
| 237 |
+
list(APPEND SOURCES "${FILE}")
|
| 238 |
+
set(TCOMPILER ${CMAKE_${LANG}_COMPILER_ID})
|
| 239 |
+
endif ()
|
| 240 |
+
endif ()
|
| 241 |
+
endforeach ()
|
| 242 |
+
|
| 243 |
+
# If no gcov binary was found, coverage data can't be evaluated.
|
| 244 |
+
if (NOT GCOV_${TCOMPILER}_BIN)
|
| 245 |
+
message(WARNING "No coverage evaluation binary found for ${TCOMPILER}.")
|
| 246 |
+
return()
|
| 247 |
+
endif ()
|
| 248 |
+
|
| 249 |
+
set(GCOV_BIN "${GCOV_${TCOMPILER}_BIN}")
|
| 250 |
+
set(GCOV_ENV "${GCOV_${TCOMPILER}_ENV}")
|
| 251 |
+
|
| 252 |
+
|
| 253 |
+
set(TDIR ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TNAME}.dir)
|
| 254 |
+
set(GENINFO_FILES "")
|
| 255 |
+
foreach(FILE ${SOURCES})
|
| 256 |
+
# Generate coverage files. If no .gcda file was generated during
|
| 257 |
+
# execution, the empty coverage file will be used instead.
|
| 258 |
+
set(OUTFILE "${TDIR}/${FILE}.info")
|
| 259 |
+
list(APPEND GENINFO_FILES ${OUTFILE})
|
| 260 |
+
|
| 261 |
+
add_custom_command(OUTPUT ${OUTFILE}
|
| 262 |
+
COMMAND test -f "${TDIR}/${FILE}.gcda"
|
| 263 |
+
&& ${GCOV_ENV} ${GENINFO_BIN} --quiet --base-directory
|
| 264 |
+
${PROJECT_SOURCE_DIR} --gcov-tool ${GCOV_BIN}
|
| 265 |
+
--output-filename ${OUTFILE} ${GENINFO_EXTERN_FLAG}
|
| 266 |
+
${TDIR}/${FILE}.gcda
|
| 267 |
+
|| cp ${OUTFILE}.init ${OUTFILE}
|
| 268 |
+
DEPENDS ${TNAME} ${TNAME}-capture-init
|
| 269 |
+
COMMENT "Capturing coverage data for ${FILE}"
|
| 270 |
+
)
|
| 271 |
+
endforeach()
|
| 272 |
+
|
| 273 |
+
# Concatenate all files generated by geninfo to a single file per target.
|
| 274 |
+
set(OUTFILE "${LCOV_DATA_PATH_CAPTURE}/${TNAME}.info")
|
| 275 |
+
lcov_merge_files("${OUTFILE}" ${GENINFO_FILES})
|
| 276 |
+
add_custom_target(${TNAME}-geninfo DEPENDS ${OUTFILE})
|
| 277 |
+
|
| 278 |
+
# add geninfo file generation to global lcov-capture target
|
| 279 |
+
add_dependencies(lcov-capture ${TNAME}-geninfo)
|
| 280 |
+
set(LCOV_CAPTURE_FILES "${LCOV_CAPTURE_FILES}" "${OUTFILE}" CACHE INTERNAL
|
| 281 |
+
""
|
| 282 |
+
)
|
| 283 |
+
|
| 284 |
+
# Add target for generating html output for this target only.
|
| 285 |
+
file(MAKE_DIRECTORY ${LCOV_HTML_PATH}/${TNAME})
|
| 286 |
+
add_custom_target(${TNAME}-genhtml
|
| 287 |
+
COMMAND ${GENHTML_BIN} --quiet --sort --prefix ${PROJECT_SOURCE_DIR}
|
| 288 |
+
--baseline-file ${LCOV_DATA_PATH_INIT}/${TNAME}.info
|
| 289 |
+
--output-directory ${LCOV_HTML_PATH}/${TNAME}
|
| 290 |
+
--title "${CMAKE_PROJECT_NAME} - target ${TNAME}"
|
| 291 |
+
${GENHTML_CPPFILT_FLAG} ${OUTFILE}
|
| 292 |
+
DEPENDS ${TNAME}-geninfo ${TNAME}-capture-init
|
| 293 |
+
)
|
| 294 |
+
endfunction (lcov_capture_tgt)
|
| 295 |
+
|
| 296 |
+
|
| 297 |
+
# This function will generate the global info file for all targets. It has to be
|
| 298 |
+
# called after all other CMake functions in the root CMakeLists.txt file, to get
|
| 299 |
+
# a full list of all targets that generate coverage data.
|
| 300 |
+
function (lcov_capture)
|
| 301 |
+
# Skip this function (and do not create the following targets), if there are
|
| 302 |
+
# no input files.
|
| 303 |
+
if ("${LCOV_CAPTURE_FILES}" STREQUAL "")
|
| 304 |
+
return()
|
| 305 |
+
endif ()
|
| 306 |
+
|
| 307 |
+
# Add a new target to merge the files of all targets.
|
| 308 |
+
set(OUTFILE "${LCOV_DATA_PATH_CAPTURE}/all_targets.info")
|
| 309 |
+
lcov_merge_files("${OUTFILE}" ${LCOV_CAPTURE_FILES})
|
| 310 |
+
add_custom_target(lcov-geninfo DEPENDS ${OUTFILE} lcov-capture)
|
| 311 |
+
|
| 312 |
+
# Add a new global target for all lcov targets. This target could be used to
|
| 313 |
+
# generate the lcov html output for the whole project instead of calling
|
| 314 |
+
# <TARGET>-geninfo and <TARGET>-genhtml for each target. It will also be
|
| 315 |
+
# used to generate a html site for all project data together instead of one
|
| 316 |
+
# for each target.
|
| 317 |
+
if (NOT TARGET lcov)
|
| 318 |
+
file(MAKE_DIRECTORY ${LCOV_HTML_PATH}/all_targets)
|
| 319 |
+
add_custom_target(lcov
|
| 320 |
+
COMMAND ${GENHTML_BIN} --quiet --sort
|
| 321 |
+
--baseline-file ${LCOV_DATA_PATH_INIT}/all_targets.info
|
| 322 |
+
--output-directory ${LCOV_HTML_PATH}/all_targets
|
| 323 |
+
--title "${CMAKE_PROJECT_NAME}" --prefix "${PROJECT_SOURCE_DIR}"
|
| 324 |
+
${GENHTML_CPPFILT_FLAG} ${OUTFILE}
|
| 325 |
+
DEPENDS lcov-geninfo-init lcov-geninfo
|
| 326 |
+
)
|
| 327 |
+
endif ()
|
| 328 |
+
endfunction (lcov_capture)
|
| 329 |
+
|
| 330 |
+
|
| 331 |
+
|
| 332 |
+
|
| 333 |
+
# Add a new global target to generate the lcov html report for the whole project
|
| 334 |
+
# instead of calling <TARGET>-genhtml for each target (to create an own report
|
| 335 |
+
# for each target). Instead of the lcov target it does not require geninfo for
|
| 336 |
+
# all targets, so you have to call <TARGET>-geninfo to generate the info files
|
| 337 |
+
# the targets you'd like to have in your report or lcov-geninfo for generating
|
| 338 |
+
# info files for all targets before calling lcov-genhtml.
|
| 339 |
+
file(MAKE_DIRECTORY ${LCOV_HTML_PATH}/selected_targets)
|
| 340 |
+
if (NOT TARGET lcov-genhtml)
|
| 341 |
+
add_custom_target(lcov-genhtml
|
| 342 |
+
COMMAND ${GENHTML_BIN}
|
| 343 |
+
--quiet
|
| 344 |
+
--output-directory ${LCOV_HTML_PATH}/selected_targets
|
| 345 |
+
--title \"${CMAKE_PROJECT_NAME} - targets `find
|
| 346 |
+
${LCOV_DATA_PATH_CAPTURE} -name \"*.info\" ! -name
|
| 347 |
+
\"all_targets.info\" -exec basename {} .info \\\;`\"
|
| 348 |
+
--prefix ${PROJECT_SOURCE_DIR}
|
| 349 |
+
--sort
|
| 350 |
+
${GENHTML_CPPFILT_FLAG}
|
| 351 |
+
`find ${LCOV_DATA_PATH_CAPTURE} -name \"*.info\" ! -name
|
| 352 |
+
\"all_targets.info\"`
|
| 353 |
+
)
|
| 354 |
+
endif (NOT TARGET lcov-genhtml)
|
weight/_dep/Catch2/CMake/Findcodecov.cmake
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is part of CMake-codecov.
|
| 2 |
+
#
|
| 3 |
+
# Copyright (c)
|
| 4 |
+
# 2015-2017 RWTH Aachen University, Federal Republic of Germany
|
| 5 |
+
#
|
| 6 |
+
# See the LICENSE file in the package base directory for details
|
| 7 |
+
#
|
| 8 |
+
# Written by Alexander Haase, alexander.haase@rwth-aachen.de
|
| 9 |
+
#
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
# Add an option to choose, if coverage should be enabled or not. If enabled
|
| 13 |
+
# marked targets will be build with coverage support and appropriate targets
|
| 14 |
+
# will be added. If disabled coverage will be ignored for *ALL* targets.
|
| 15 |
+
option(ENABLE_COVERAGE "Enable coverage build." OFF)
|
| 16 |
+
|
| 17 |
+
set(COVERAGE_FLAG_CANDIDATES
|
| 18 |
+
# gcc and clang
|
| 19 |
+
"-O0 -g -fprofile-arcs -ftest-coverage"
|
| 20 |
+
|
| 21 |
+
# gcc and clang fallback
|
| 22 |
+
"-O0 -g --coverage"
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
# Add coverage support for target ${TNAME} and register target for coverage
|
| 27 |
+
# evaluation. If coverage is disabled or not supported, this function will
|
| 28 |
+
# simply do nothing.
|
| 29 |
+
#
|
| 30 |
+
# Note: This function is only a wrapper to define this function always, even if
|
| 31 |
+
# coverage is not supported by the compiler or disabled. This function must
|
| 32 |
+
# be defined here, because the module will be exited, if there is no coverage
|
| 33 |
+
# support by the compiler or it is disabled by the user.
|
| 34 |
+
function (add_coverage TNAME)
|
| 35 |
+
# only add coverage for target, if coverage is support and enabled.
|
| 36 |
+
if (ENABLE_COVERAGE)
|
| 37 |
+
foreach (TNAME ${ARGV})
|
| 38 |
+
add_coverage_target(${TNAME})
|
| 39 |
+
endforeach ()
|
| 40 |
+
endif ()
|
| 41 |
+
endfunction (add_coverage)
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
# Add global target to gather coverage information after all targets have been
|
| 45 |
+
# added. Other evaluation functions could be added here, after checks for the
|
| 46 |
+
# specific module have been passed.
|
| 47 |
+
#
|
| 48 |
+
# Note: This function is only a wrapper to define this function always, even if
|
| 49 |
+
# coverage is not supported by the compiler or disabled. This function must
|
| 50 |
+
# be defined here, because the module will be exited, if there is no coverage
|
| 51 |
+
# support by the compiler or it is disabled by the user.
|
| 52 |
+
function (coverage_evaluate)
|
| 53 |
+
# add lcov evaluation
|
| 54 |
+
if (LCOV_FOUND)
|
| 55 |
+
lcov_capture_initial()
|
| 56 |
+
lcov_capture()
|
| 57 |
+
endif (LCOV_FOUND)
|
| 58 |
+
endfunction ()
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
# Exit this module, if coverage is disabled. add_coverage is defined before this
|
| 62 |
+
# return, so this module can be exited now safely without breaking any build-
|
| 63 |
+
# scripts.
|
| 64 |
+
if (NOT ENABLE_COVERAGE)
|
| 65 |
+
return()
|
| 66 |
+
endif ()
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
# Find the reuired flags foreach language.
|
| 72 |
+
set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
|
| 73 |
+
set(CMAKE_REQUIRED_QUIET ${codecov_FIND_QUIETLY})
|
| 74 |
+
|
| 75 |
+
get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
|
| 76 |
+
foreach (LANG ${ENABLED_LANGUAGES})
|
| 77 |
+
# Coverage flags are not dependent on language, but the used compiler. So
|
| 78 |
+
# instead of searching flags foreach language, search flags foreach compiler
|
| 79 |
+
# used.
|
| 80 |
+
set(COMPILER ${CMAKE_${LANG}_COMPILER_ID})
|
| 81 |
+
if (NOT COVERAGE_${COMPILER}_FLAGS)
|
| 82 |
+
foreach (FLAG ${COVERAGE_FLAG_CANDIDATES})
|
| 83 |
+
if(NOT CMAKE_REQUIRED_QUIET)
|
| 84 |
+
message(STATUS "Try ${COMPILER} code coverage flag = [${FLAG}]")
|
| 85 |
+
endif()
|
| 86 |
+
|
| 87 |
+
set(CMAKE_REQUIRED_FLAGS "${FLAG}")
|
| 88 |
+
unset(COVERAGE_FLAG_DETECTED CACHE)
|
| 89 |
+
|
| 90 |
+
if (${LANG} STREQUAL "C")
|
| 91 |
+
include(CheckCCompilerFlag)
|
| 92 |
+
check_c_compiler_flag("${FLAG}" COVERAGE_FLAG_DETECTED)
|
| 93 |
+
|
| 94 |
+
elseif (${LANG} STREQUAL "CXX")
|
| 95 |
+
include(CheckCXXCompilerFlag)
|
| 96 |
+
check_cxx_compiler_flag("${FLAG}" COVERAGE_FLAG_DETECTED)
|
| 97 |
+
|
| 98 |
+
elseif (${LANG} STREQUAL "Fortran")
|
| 99 |
+
# CheckFortranCompilerFlag was introduced in CMake 3.x. To be
|
| 100 |
+
# compatible with older Cmake versions, we will check if this
|
| 101 |
+
# module is present before we use it. Otherwise we will define
|
| 102 |
+
# Fortran coverage support as not available.
|
| 103 |
+
include(CheckFortranCompilerFlag OPTIONAL
|
| 104 |
+
RESULT_VARIABLE INCLUDED)
|
| 105 |
+
if (INCLUDED)
|
| 106 |
+
check_fortran_compiler_flag("${FLAG}"
|
| 107 |
+
COVERAGE_FLAG_DETECTED)
|
| 108 |
+
elseif (NOT CMAKE_REQUIRED_QUIET)
|
| 109 |
+
message("-- Performing Test COVERAGE_FLAG_DETECTED")
|
| 110 |
+
message("-- Performing Test COVERAGE_FLAG_DETECTED - Failed"
|
| 111 |
+
" (Check not supported)")
|
| 112 |
+
endif ()
|
| 113 |
+
endif()
|
| 114 |
+
|
| 115 |
+
if (COVERAGE_FLAG_DETECTED)
|
| 116 |
+
set(COVERAGE_${COMPILER}_FLAGS "${FLAG}"
|
| 117 |
+
CACHE STRING "${COMPILER} flags for code coverage.")
|
| 118 |
+
mark_as_advanced(COVERAGE_${COMPILER}_FLAGS)
|
| 119 |
+
break()
|
| 120 |
+
else ()
|
| 121 |
+
message(WARNING "Code coverage is not available for ${COMPILER}"
|
| 122 |
+
" compiler. Targets using this compiler will be "
|
| 123 |
+
"compiled without it.")
|
| 124 |
+
endif ()
|
| 125 |
+
endforeach ()
|
| 126 |
+
endif ()
|
| 127 |
+
endforeach ()
|
| 128 |
+
|
| 129 |
+
set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
# Helper function to get the language of a source file.
|
| 135 |
+
function (codecov_lang_of_source FILE RETURN_VAR)
|
| 136 |
+
get_filename_component(FILE_EXT "${FILE}" EXT)
|
| 137 |
+
string(TOLOWER "${FILE_EXT}" FILE_EXT)
|
| 138 |
+
string(SUBSTRING "${FILE_EXT}" 1 -1 FILE_EXT)
|
| 139 |
+
|
| 140 |
+
get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
|
| 141 |
+
foreach (LANG ${ENABLED_LANGUAGES})
|
| 142 |
+
list(FIND CMAKE_${LANG}_SOURCE_FILE_EXTENSIONS "${FILE_EXT}" TEMP)
|
| 143 |
+
if (NOT ${TEMP} EQUAL -1)
|
| 144 |
+
set(${RETURN_VAR} "${LANG}" PARENT_SCOPE)
|
| 145 |
+
return()
|
| 146 |
+
endif ()
|
| 147 |
+
endforeach()
|
| 148 |
+
|
| 149 |
+
set(${RETURN_VAR} "" PARENT_SCOPE)
|
| 150 |
+
endfunction ()
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
# Helper function to get the relative path of the source file destination path.
|
| 154 |
+
# This path is needed by FindGcov and FindLcov cmake files to locate the
|
| 155 |
+
# captured data.
|
| 156 |
+
function (codecov_path_of_source FILE RETURN_VAR)
|
| 157 |
+
string(REGEX MATCH "TARGET_OBJECTS:([^ >]+)" _source ${FILE})
|
| 158 |
+
|
| 159 |
+
# If expression was found, SOURCEFILE is a generator-expression for an
|
| 160 |
+
# object library. Currently we found no way to call this function automatic
|
| 161 |
+
# for the referenced target, so it must be called in the directoryso of the
|
| 162 |
+
# object library definition.
|
| 163 |
+
if (NOT "${_source}" STREQUAL "")
|
| 164 |
+
set(${RETURN_VAR} "" PARENT_SCOPE)
|
| 165 |
+
return()
|
| 166 |
+
endif ()
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
string(REPLACE "${CMAKE_CURRENT_BINARY_DIR}/" "" FILE "${FILE}")
|
| 170 |
+
if(IS_ABSOLUTE ${FILE})
|
| 171 |
+
file(RELATIVE_PATH FILE ${CMAKE_CURRENT_SOURCE_DIR} ${FILE})
|
| 172 |
+
endif()
|
| 173 |
+
|
| 174 |
+
# get the right path for file
|
| 175 |
+
string(REPLACE ".." "__" PATH "${FILE}")
|
| 176 |
+
|
| 177 |
+
set(${RETURN_VAR} "${PATH}" PARENT_SCOPE)
|
| 178 |
+
endfunction()
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
# Add coverage support for target ${TNAME} and register target for coverage
|
| 184 |
+
# evaluation.
|
| 185 |
+
function(add_coverage_target TNAME)
|
| 186 |
+
# Check if all sources for target use the same compiler. If a target uses
|
| 187 |
+
# e.g. C and Fortran mixed and uses different compilers (e.g. clang and
|
| 188 |
+
# gfortran) this can trigger huge problems, because different compilers may
|
| 189 |
+
# use different implementations for code coverage.
|
| 190 |
+
get_target_property(TSOURCES ${TNAME} SOURCES)
|
| 191 |
+
set(TARGET_COMPILER "")
|
| 192 |
+
set(ADDITIONAL_FILES "")
|
| 193 |
+
foreach (FILE ${TSOURCES})
|
| 194 |
+
# If expression was found, FILE is a generator-expression for an object
|
| 195 |
+
# library. Object libraries will be ignored.
|
| 196 |
+
string(REGEX MATCH "TARGET_OBJECTS:([^ >]+)" _file ${FILE})
|
| 197 |
+
if ("${_file}" STREQUAL "")
|
| 198 |
+
codecov_lang_of_source(${FILE} LANG)
|
| 199 |
+
if (LANG)
|
| 200 |
+
list(APPEND TARGET_COMPILER ${CMAKE_${LANG}_COMPILER_ID})
|
| 201 |
+
|
| 202 |
+
list(APPEND ADDITIONAL_FILES "${FILE}.gcno")
|
| 203 |
+
list(APPEND ADDITIONAL_FILES "${FILE}.gcda")
|
| 204 |
+
endif ()
|
| 205 |
+
endif ()
|
| 206 |
+
endforeach ()
|
| 207 |
+
|
| 208 |
+
list(REMOVE_DUPLICATES TARGET_COMPILER)
|
| 209 |
+
list(LENGTH TARGET_COMPILER NUM_COMPILERS)
|
| 210 |
+
|
| 211 |
+
if (NUM_COMPILERS GREATER 1)
|
| 212 |
+
message(WARNING "Can't use code coverage for target ${TNAME}, because "
|
| 213 |
+
"it will be compiled by incompatible compilers. Target will be "
|
| 214 |
+
"compiled without code coverage.")
|
| 215 |
+
return()
|
| 216 |
+
|
| 217 |
+
elseif (NUM_COMPILERS EQUAL 0)
|
| 218 |
+
message(WARNING "Can't use code coverage for target ${TNAME}, because "
|
| 219 |
+
"it uses an unknown compiler. Target will be compiled without "
|
| 220 |
+
"code coverage.")
|
| 221 |
+
return()
|
| 222 |
+
|
| 223 |
+
elseif (NOT DEFINED "COVERAGE_${TARGET_COMPILER}_FLAGS")
|
| 224 |
+
# A warning has been printed before, so just return if flags for this
|
| 225 |
+
# compiler aren't available.
|
| 226 |
+
return()
|
| 227 |
+
endif()
|
| 228 |
+
|
| 229 |
+
|
| 230 |
+
# enable coverage for target
|
| 231 |
+
set_property(TARGET ${TNAME} APPEND_STRING
|
| 232 |
+
PROPERTY COMPILE_FLAGS " ${COVERAGE_${TARGET_COMPILER}_FLAGS}")
|
| 233 |
+
set_property(TARGET ${TNAME} APPEND_STRING
|
| 234 |
+
PROPERTY LINK_FLAGS " ${COVERAGE_${TARGET_COMPILER}_FLAGS}")
|
| 235 |
+
|
| 236 |
+
|
| 237 |
+
# Add gcov files generated by compiler to clean target.
|
| 238 |
+
set(CLEAN_FILES "")
|
| 239 |
+
foreach (FILE ${ADDITIONAL_FILES})
|
| 240 |
+
codecov_path_of_source(${FILE} FILE)
|
| 241 |
+
list(APPEND CLEAN_FILES "CMakeFiles/${TNAME}.dir/${FILE}")
|
| 242 |
+
endforeach()
|
| 243 |
+
|
| 244 |
+
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
|
| 245 |
+
"${CLEAN_FILES}")
|
| 246 |
+
|
| 247 |
+
|
| 248 |
+
add_gcov_target(${TNAME})
|
| 249 |
+
add_lcov_target(${TNAME})
|
| 250 |
+
endfunction(add_coverage_target)
|
| 251 |
+
|
| 252 |
+
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
# Include modules for parsing the collected data and output it in a readable
|
| 256 |
+
# format (like gcov and lcov).
|
| 257 |
+
find_package(Gcov)
|
| 258 |
+
find_package(Lcov)
|
weight/_dep/Catch2/CMake/MiscFunctions.cmake
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#checks that the given hard-coded list contains all headers + sources in the given folder
|
| 2 |
+
function(CheckFileList LIST_VAR FOLDER)
|
| 3 |
+
set(MESSAGE " should be added to the variable ${LIST_VAR}")
|
| 4 |
+
set(MESSAGE "${MESSAGE} in ${CMAKE_CURRENT_LIST_FILE}\n")
|
| 5 |
+
file(GLOB GLOBBED_LIST "${FOLDER}/*.cpp"
|
| 6 |
+
"${FOLDER}/*.hpp"
|
| 7 |
+
"${FOLDER}/*.h")
|
| 8 |
+
list(REMOVE_ITEM GLOBBED_LIST ${${LIST_VAR}})
|
| 9 |
+
foreach(EXTRA_ITEM ${GLOBBED_LIST})
|
| 10 |
+
string(REPLACE "${CATCH_DIR}/" "" RELATIVE_FILE_NAME "${EXTRA_ITEM}")
|
| 11 |
+
message(AUTHOR_WARNING "The file \"${RELATIVE_FILE_NAME}\"${MESSAGE}")
|
| 12 |
+
endforeach()
|
| 13 |
+
endfunction()
|
| 14 |
+
|
| 15 |
+
function(CheckFileListRec LIST_VAR FOLDER)
|
| 16 |
+
set(MESSAGE " should be added to the variable ${LIST_VAR}")
|
| 17 |
+
set(MESSAGE "${MESSAGE} in ${CMAKE_CURRENT_LIST_FILE}\n")
|
| 18 |
+
file(GLOB_RECURSE GLOBBED_LIST "${FOLDER}/*.cpp"
|
| 19 |
+
"${FOLDER}/*.hpp"
|
| 20 |
+
"${FOLDER}/*.h")
|
| 21 |
+
list(REMOVE_ITEM GLOBBED_LIST ${${LIST_VAR}})
|
| 22 |
+
foreach(EXTRA_ITEM ${GLOBBED_LIST})
|
| 23 |
+
string(REPLACE "${CATCH_DIR}/" "" RELATIVE_FILE_NAME "${EXTRA_ITEM}")
|
| 24 |
+
message(AUTHOR_WARNING "The file \"${RELATIVE_FILE_NAME}\"${MESSAGE}")
|
| 25 |
+
endforeach()
|
| 26 |
+
endfunction()
|
weight/_dep/Catch2/CMake/catch2.pc.in
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
prefix=@CMAKE_INSTALL_PREFIX@
|
| 2 |
+
exec_prefix=${prefix}
|
| 3 |
+
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
|
| 4 |
+
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
|
| 5 |
+
|
| 6 |
+
Name: Catch2
|
| 7 |
+
Description: A modern, C++-native, header-only, test framework for C++11
|
| 8 |
+
URL: https://github.com/catchorg/Catch2
|
| 9 |
+
Version: @Catch2_VERSION@
|
| 10 |
+
Cflags: -I${includedir}
|
weight/_dep/Catch2/CMake/llvm-cov-wrapper
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
|
| 3 |
+
# This file is part of CMake-codecov.
|
| 4 |
+
#
|
| 5 |
+
# Copyright (c)
|
| 6 |
+
# 2015-2017 RWTH Aachen University, Federal Republic of Germany
|
| 7 |
+
#
|
| 8 |
+
# See the LICENSE file in the package base directory for details
|
| 9 |
+
#
|
| 10 |
+
# Written by Alexander Haase, alexander.haase@rwth-aachen.de
|
| 11 |
+
#
|
| 12 |
+
|
| 13 |
+
if [ -z "$LLVM_COV_BIN" ]
|
| 14 |
+
then
|
| 15 |
+
echo "LLVM_COV_BIN not set!" >& 2
|
| 16 |
+
exit 1
|
| 17 |
+
fi
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
# Get LLVM version to find out.
|
| 21 |
+
LLVM_VERSION=$($LLVM_COV_BIN -version | grep -i "LLVM version" \
|
| 22 |
+
| sed "s/^\([A-Za-z ]*\)\([0-9]\).\([0-9]\).*$/\2.\3/g")
|
| 23 |
+
|
| 24 |
+
if [ "$1" = "-v" ]
|
| 25 |
+
then
|
| 26 |
+
echo "llvm-cov-wrapper $LLVM_VERSION"
|
| 27 |
+
exit 0
|
| 28 |
+
fi
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
if [ -n "$LLVM_VERSION" ]
|
| 32 |
+
then
|
| 33 |
+
MAJOR=$(echo $LLVM_VERSION | cut -d'.' -f1)
|
| 34 |
+
MINOR=$(echo $LLVM_VERSION | cut -d'.' -f2)
|
| 35 |
+
|
| 36 |
+
if [ $MAJOR -eq 3 ] && [ $MINOR -le 4 ]
|
| 37 |
+
then
|
| 38 |
+
if [ -f "$1" ]
|
| 39 |
+
then
|
| 40 |
+
filename=$(basename "$1")
|
| 41 |
+
extension="${filename##*.}"
|
| 42 |
+
|
| 43 |
+
case "$extension" in
|
| 44 |
+
"gcno") exec $LLVM_COV_BIN --gcno="$1" ;;
|
| 45 |
+
"gcda") exec $LLVM_COV_BIN --gcda="$1" ;;
|
| 46 |
+
esac
|
| 47 |
+
fi
|
| 48 |
+
fi
|
| 49 |
+
|
| 50 |
+
if [ $MAJOR -eq 3 ] && [ $MINOR -le 5 ]
|
| 51 |
+
then
|
| 52 |
+
exec $LLVM_COV_BIN $@
|
| 53 |
+
fi
|
| 54 |
+
fi
|
| 55 |
+
|
| 56 |
+
exec $LLVM_COV_BIN gcov $@
|
weight/_dep/Catch2/CMakeLists.txt
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cmake_minimum_required(VERSION 3.5)
|
| 2 |
+
|
| 3 |
+
# detect if Catch is being bundled,
|
| 4 |
+
# disable testsuite in that case
|
| 5 |
+
if(NOT DEFINED PROJECT_NAME)
|
| 6 |
+
set(NOT_SUBPROJECT ON)
|
| 7 |
+
else()
|
| 8 |
+
set(NOT_SUBPROJECT OFF)
|
| 9 |
+
endif()
|
| 10 |
+
|
| 11 |
+
# Catch2's build breaks if done in-tree. You probably should not build
|
| 12 |
+
# things in tree anyway, but we can allow projects that include Catch2
|
| 13 |
+
# as a subproject to build in-tree as long as it is not in our tree.
|
| 14 |
+
if (CMAKE_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
| 15 |
+
message(FATAL_ERROR "Building in-source is not supported! Create a build dir and remove ${CMAKE_SOURCE_DIR}/CMakeCache.txt")
|
| 16 |
+
endif()
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
project(Catch2 LANGUAGES CXX VERSION 2.13.9)
|
| 20 |
+
|
| 21 |
+
# Provide path for scripts
|
| 22 |
+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake")
|
| 23 |
+
|
| 24 |
+
include(GNUInstallDirs)
|
| 25 |
+
|
| 26 |
+
option(CATCH_USE_VALGRIND "Perform SelfTests with Valgrind" OFF)
|
| 27 |
+
option(CATCH_BUILD_TESTING "Build SelfTest project" ON)
|
| 28 |
+
option(CATCH_BUILD_EXAMPLES "Build documentation examples" OFF)
|
| 29 |
+
option(CATCH_BUILD_EXTRA_TESTS "Build extra tests" OFF)
|
| 30 |
+
option(CATCH_BUILD_STATIC_LIBRARY "Builds static library from the main implementation. EXPERIMENTAL" OFF)
|
| 31 |
+
option(CATCH_ENABLE_COVERAGE "Generate coverage for codecov.io" OFF)
|
| 32 |
+
option(CATCH_ENABLE_WERROR "Enable all warnings as errors" ON)
|
| 33 |
+
option(CATCH_INSTALL_DOCS "Install documentation alongside library" ON)
|
| 34 |
+
option(CATCH_INSTALL_HELPERS "Install contrib alongside library" ON)
|
| 35 |
+
|
| 36 |
+
# define some folders
|
| 37 |
+
set(CATCH_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
| 38 |
+
set(SELF_TEST_DIR ${CATCH_DIR}/projects/SelfTest)
|
| 39 |
+
set(BENCHMARK_DIR ${CATCH_DIR}/projects/Benchmark)
|
| 40 |
+
set(HEADER_DIR ${CATCH_DIR}/include)
|
| 41 |
+
|
| 42 |
+
if(USE_WMAIN)
|
| 43 |
+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:wmainCRTStartup")
|
| 44 |
+
endif()
|
| 45 |
+
|
| 46 |
+
if(NOT_SUBPROJECT)
|
| 47 |
+
include(CTest)
|
| 48 |
+
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
| 49 |
+
if(BUILD_TESTING AND CATCH_BUILD_TESTING)
|
| 50 |
+
find_package(PythonInterp)
|
| 51 |
+
if (NOT PYTHONINTERP_FOUND)
|
| 52 |
+
message(FATAL_ERROR "Python not found, but required for tests")
|
| 53 |
+
endif()
|
| 54 |
+
add_subdirectory(projects)
|
| 55 |
+
endif()
|
| 56 |
+
endif()
|
| 57 |
+
|
| 58 |
+
if(CATCH_BUILD_EXAMPLES)
|
| 59 |
+
add_subdirectory(examples)
|
| 60 |
+
endif()
|
| 61 |
+
|
| 62 |
+
if(CATCH_BUILD_EXTRA_TESTS)
|
| 63 |
+
add_subdirectory(projects/ExtraTests)
|
| 64 |
+
endif()
|
| 65 |
+
|
| 66 |
+
# add catch as a 'linkable' target
|
| 67 |
+
add_library(Catch2 INTERFACE)
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
# depend on some obvious c++11 features so the dependency is transitively added dependents
|
| 72 |
+
target_compile_features(Catch2
|
| 73 |
+
INTERFACE
|
| 74 |
+
cxx_alignas
|
| 75 |
+
cxx_alignof
|
| 76 |
+
cxx_attributes
|
| 77 |
+
cxx_auto_type
|
| 78 |
+
cxx_constexpr
|
| 79 |
+
cxx_defaulted_functions
|
| 80 |
+
cxx_deleted_functions
|
| 81 |
+
cxx_final
|
| 82 |
+
cxx_lambdas
|
| 83 |
+
cxx_noexcept
|
| 84 |
+
cxx_override
|
| 85 |
+
cxx_range_for
|
| 86 |
+
cxx_rvalue_references
|
| 87 |
+
cxx_static_assert
|
| 88 |
+
cxx_strong_enums
|
| 89 |
+
cxx_trailing_return_types
|
| 90 |
+
cxx_unicode_literals
|
| 91 |
+
cxx_user_literals
|
| 92 |
+
cxx_variadic_macros
|
| 93 |
+
)
|
| 94 |
+
|
| 95 |
+
target_include_directories(Catch2
|
| 96 |
+
INTERFACE
|
| 97 |
+
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/single_include>
|
| 98 |
+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
| 99 |
+
)
|
| 100 |
+
|
| 101 |
+
if (ANDROID)
|
| 102 |
+
target_link_libraries(Catch2 INTERFACE log)
|
| 103 |
+
endif()
|
| 104 |
+
|
| 105 |
+
# provide a namespaced alias for clients to 'link' against if catch is included as a sub-project
|
| 106 |
+
add_library(Catch2::Catch2 ALIAS Catch2)
|
| 107 |
+
|
| 108 |
+
# Hacky support for compiling the impl into a static lib
|
| 109 |
+
if (CATCH_BUILD_STATIC_LIBRARY)
|
| 110 |
+
add_library(Catch2WithMain ${CMAKE_CURRENT_LIST_DIR}/src/catch_with_main.cpp)
|
| 111 |
+
target_link_libraries(Catch2WithMain PUBLIC Catch2)
|
| 112 |
+
add_library(Catch2::Catch2WithMain ALIAS Catch2WithMain)
|
| 113 |
+
|
| 114 |
+
# Make the build reproducible on versions of g++ and clang that supports -ffile-prefix-map
|
| 115 |
+
if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 8) OR
|
| 116 |
+
("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 10))
|
| 117 |
+
target_compile_options(Catch2WithMain PRIVATE "-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.")
|
| 118 |
+
endif()
|
| 119 |
+
|
| 120 |
+
if (CATCH_CONFIG_DEFAULT_REPORTER)
|
| 121 |
+
target_compile_definitions(Catch2WithMain PRIVATE CATCH_CONFIG_DEFAULT_REPORTER=${CATCH_CONFIG_DEFAULT_REPORTER})
|
| 122 |
+
endif()
|
| 123 |
+
endif(CATCH_BUILD_STATIC_LIBRARY)
|
| 124 |
+
|
| 125 |
+
# Only perform the installation steps when Catch is not being used as
|
| 126 |
+
# a subproject via `add_subdirectory`, or the destinations will break,
|
| 127 |
+
# see https://github.com/catchorg/Catch2/issues/1373
|
| 128 |
+
if (NOT_SUBPROJECT)
|
| 129 |
+
include(CMakePackageConfigHelpers)
|
| 130 |
+
set(CATCH_CMAKE_CONFIG_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Catch2")
|
| 131 |
+
|
| 132 |
+
configure_package_config_file(
|
| 133 |
+
${CMAKE_CURRENT_LIST_DIR}/CMake/Catch2Config.cmake.in
|
| 134 |
+
${CMAKE_CURRENT_BINARY_DIR}/Catch2Config.cmake
|
| 135 |
+
INSTALL_DESTINATION
|
| 136 |
+
${CATCH_CMAKE_CONFIG_DESTINATION}
|
| 137 |
+
)
|
| 138 |
+
|
| 139 |
+
# Workaround lack of generator expressions in install(TARGETS
|
| 140 |
+
set(InstallationTargets Catch2)
|
| 141 |
+
if (TARGET Catch2WithMain)
|
| 142 |
+
list(APPEND InstallationTargets Catch2WithMain)
|
| 143 |
+
endif()
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
# create and install an export set for catch target as Catch2::Catch
|
| 147 |
+
install(
|
| 148 |
+
TARGETS
|
| 149 |
+
${InstallationTargets}
|
| 150 |
+
EXPORT
|
| 151 |
+
Catch2Targets
|
| 152 |
+
DESTINATION
|
| 153 |
+
${CMAKE_INSTALL_LIBDIR}
|
| 154 |
+
)
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
install(
|
| 158 |
+
EXPORT
|
| 159 |
+
Catch2Targets
|
| 160 |
+
NAMESPACE
|
| 161 |
+
Catch2::
|
| 162 |
+
DESTINATION
|
| 163 |
+
${CATCH_CMAKE_CONFIG_DESTINATION}
|
| 164 |
+
)
|
| 165 |
+
|
| 166 |
+
# By default, FooConfigVersion is tied to architecture that it was
|
| 167 |
+
# generated on. Because Catch2 is header-only, it is arch-independent
|
| 168 |
+
# and thus Catch2ConfigVersion should not be tied to the architecture
|
| 169 |
+
# it was generated on.
|
| 170 |
+
#
|
| 171 |
+
# CMake does not provide a direct customization point for this in
|
| 172 |
+
# `write_basic_package_version_file`, but it can be accomplished
|
| 173 |
+
# indirectly by temporarily redefining `CMAKE_SIZEOF_VOID_P` to an
|
| 174 |
+
# empty string. Note that just undefining the variable could be
|
| 175 |
+
# insufficient in cases where the variable was already in CMake cache
|
| 176 |
+
set(CATCH2_CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
|
| 177 |
+
set(CMAKE_SIZEOF_VOID_P "")
|
| 178 |
+
write_basic_package_version_file(
|
| 179 |
+
"${CMAKE_CURRENT_BINARY_DIR}/Catch2ConfigVersion.cmake"
|
| 180 |
+
COMPATIBILITY
|
| 181 |
+
SameMajorVersion
|
| 182 |
+
)
|
| 183 |
+
set(CMAKE_SIZEOF_VOID_P ${CATCH2_CMAKE_SIZEOF_VOID_P})
|
| 184 |
+
|
| 185 |
+
install(
|
| 186 |
+
DIRECTORY
|
| 187 |
+
"single_include/"
|
| 188 |
+
DESTINATION
|
| 189 |
+
"${CMAKE_INSTALL_INCLUDEDIR}"
|
| 190 |
+
)
|
| 191 |
+
|
| 192 |
+
install(
|
| 193 |
+
FILES
|
| 194 |
+
"${CMAKE_CURRENT_BINARY_DIR}/Catch2Config.cmake"
|
| 195 |
+
"${CMAKE_CURRENT_BINARY_DIR}/Catch2ConfigVersion.cmake"
|
| 196 |
+
DESTINATION
|
| 197 |
+
${CATCH_CMAKE_CONFIG_DESTINATION}
|
| 198 |
+
)
|
| 199 |
+
|
| 200 |
+
# Install documentation
|
| 201 |
+
if(CATCH_INSTALL_DOCS)
|
| 202 |
+
install(
|
| 203 |
+
DIRECTORY
|
| 204 |
+
docs/
|
| 205 |
+
DESTINATION
|
| 206 |
+
"${CMAKE_INSTALL_DOCDIR}"
|
| 207 |
+
)
|
| 208 |
+
endif()
|
| 209 |
+
|
| 210 |
+
if(CATCH_INSTALL_HELPERS)
|
| 211 |
+
# Install CMake scripts
|
| 212 |
+
install(
|
| 213 |
+
FILES
|
| 214 |
+
"contrib/ParseAndAddCatchTests.cmake"
|
| 215 |
+
"contrib/Catch.cmake"
|
| 216 |
+
"contrib/CatchAddTests.cmake"
|
| 217 |
+
DESTINATION
|
| 218 |
+
${CATCH_CMAKE_CONFIG_DESTINATION}
|
| 219 |
+
)
|
| 220 |
+
|
| 221 |
+
# Install debugger helpers
|
| 222 |
+
install(
|
| 223 |
+
FILES
|
| 224 |
+
"contrib/gdbinit"
|
| 225 |
+
"contrib/lldbinit"
|
| 226 |
+
DESTINATION
|
| 227 |
+
${CMAKE_INSTALL_DATAROOTDIR}/Catch2
|
| 228 |
+
)
|
| 229 |
+
endif()
|
| 230 |
+
|
| 231 |
+
## Provide some pkg-config integration
|
| 232 |
+
set(PKGCONFIG_INSTALL_DIR
|
| 233 |
+
"${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig"
|
| 234 |
+
CACHE PATH "Path where catch2.pc is installed"
|
| 235 |
+
)
|
| 236 |
+
configure_file(
|
| 237 |
+
${CMAKE_CURRENT_SOURCE_DIR}/CMake/catch2.pc.in
|
| 238 |
+
${CMAKE_CURRENT_BINARY_DIR}/catch2.pc
|
| 239 |
+
@ONLY
|
| 240 |
+
)
|
| 241 |
+
install(
|
| 242 |
+
FILES
|
| 243 |
+
"${CMAKE_CURRENT_BINARY_DIR}/catch2.pc"
|
| 244 |
+
DESTINATION
|
| 245 |
+
${PKGCONFIG_INSTALL_DIR}
|
| 246 |
+
)
|
| 247 |
+
|
| 248 |
+
# CPack/CMake started taking the package version from project version 3.12
|
| 249 |
+
# So we need to set the version manually for older CMake versions
|
| 250 |
+
if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
|
| 251 |
+
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
|
| 252 |
+
endif()
|
| 253 |
+
|
| 254 |
+
set(CPACK_PACKAGE_CONTACT "https://github.com/catchorg/Catch2/")
|
| 255 |
+
|
| 256 |
+
|
| 257 |
+
include( CPack )
|
| 258 |
+
|
| 259 |
+
endif(NOT_SUBPROJECT)
|
weight/_dep/Catch2/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Contributor Covenant Code of Conduct
|
| 2 |
+
|
| 3 |
+
## Our Pledge
|
| 4 |
+
|
| 5 |
+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
| 6 |
+
|
| 7 |
+
## Our Standards
|
| 8 |
+
|
| 9 |
+
Examples of behavior that contributes to creating a positive environment include:
|
| 10 |
+
|
| 11 |
+
* Using welcoming and inclusive language
|
| 12 |
+
* Being respectful of differing viewpoints and experiences
|
| 13 |
+
* Gracefully accepting constructive criticism
|
| 14 |
+
* Focusing on what is best for the community
|
| 15 |
+
* Showing empathy towards other community members
|
| 16 |
+
|
| 17 |
+
Examples of unacceptable behavior by participants include:
|
| 18 |
+
|
| 19 |
+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
| 20 |
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
| 21 |
+
* Public or private harassment
|
| 22 |
+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
| 23 |
+
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
| 24 |
+
|
| 25 |
+
## Our Responsibilities
|
| 26 |
+
|
| 27 |
+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
| 28 |
+
|
| 29 |
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
| 30 |
+
|
| 31 |
+
## Scope
|
| 32 |
+
|
| 33 |
+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
| 34 |
+
|
| 35 |
+
## Enforcement
|
| 36 |
+
|
| 37 |
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at github@philnash.me. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
| 38 |
+
|
| 39 |
+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
| 40 |
+
|
| 41 |
+
## Attribution
|
| 42 |
+
|
| 43 |
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
| 44 |
+
|
| 45 |
+
[homepage]: http://contributor-covenant.org
|
| 46 |
+
[version]: http://contributor-covenant.org/version/1/4/
|
weight/_dep/Catch2/LICENSE.txt
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Boost Software License - Version 1.0 - August 17th, 2003
|
| 2 |
+
|
| 3 |
+
Permission is hereby granted, free of charge, to any person or organization
|
| 4 |
+
obtaining a copy of the software and accompanying documentation covered by
|
| 5 |
+
this license (the "Software") to use, reproduce, display, distribute,
|
| 6 |
+
execute, and transmit the Software, and to prepare derivative works of the
|
| 7 |
+
Software, and to permit third-parties to whom the Software is furnished to
|
| 8 |
+
do so, all subject to the following:
|
| 9 |
+
|
| 10 |
+
The copyright notices in the Software and this entire statement, including
|
| 11 |
+
the above license grant, this restriction and the following disclaimer,
|
| 12 |
+
must be included in all copies of the Software, in whole or in part, and
|
| 13 |
+
all derivative works of the Software, unless such copies or derivative
|
| 14 |
+
works are solely in the form of machine-executable object code generated by
|
| 15 |
+
a source language processor.
|
| 16 |
+
|
| 17 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 18 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 19 |
+
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
| 20 |
+
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
| 21 |
+
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
| 22 |
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
| 23 |
+
DEALINGS IN THE SOFTWARE.
|
weight/_dep/Catch2/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<a id="top"></a>
|
| 2 |
+

|
| 3 |
+
|
| 4 |
+
[](https://github.com/catchorg/catch2/releases)
|
| 5 |
+
[](https://travis-ci.org/catchorg/Catch2)
|
| 6 |
+
[](https://ci.appveyor.com/project/catchorg/catch2)
|
| 7 |
+
[](https://codecov.io/gh/catchorg/Catch2)
|
| 8 |
+
[](https://wandbox.org/permlink/6JUH8Eybx4CtvkJS)
|
| 9 |
+
[](https://discord.gg/4CWS9zD)
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
<a href="https://github.com/catchorg/Catch2/releases/download/v2.13.9/catch.hpp">The latest version of the single header can be downloaded directly using this link</a>
|
| 13 |
+
|
| 14 |
+
## Catch2 is released!
|
| 15 |
+
|
| 16 |
+
If you've been using an earlier version of Catch, please see the
|
| 17 |
+
Breaking Changes section of [the release notes](https://github.com/catchorg/Catch2/releases/tag/v2.0.1)
|
| 18 |
+
before moving to Catch2. You might also like to read [this blog post](https://levelofindirection.com/blog/catch2-released.html) for more details.
|
| 19 |
+
|
| 20 |
+
## What's the Catch?
|
| 21 |
+
|
| 22 |
+
Catch2 is a multi-paradigm test framework for C++. which also supports
|
| 23 |
+
Objective-C (and maybe C).
|
| 24 |
+
It is primarily distributed as a single header file, although certain
|
| 25 |
+
extensions may require additional headers.
|
| 26 |
+
|
| 27 |
+
## How to use it
|
| 28 |
+
This documentation comprises these three parts:
|
| 29 |
+
|
| 30 |
+
* [Why do we need yet another C++ Test Framework?](docs/why-catch.md#top)
|
| 31 |
+
* [Tutorial](docs/tutorial.md#top) - getting started
|
| 32 |
+
* [Reference section](docs/Readme.md#top) - all the details
|
| 33 |
+
|
| 34 |
+
## More
|
| 35 |
+
* Issues and bugs can be raised on the [Issue tracker on GitHub](https://github.com/catchorg/Catch2/issues)
|
| 36 |
+
* For discussion or questions please use [the dedicated Google Groups forum](https://groups.google.com/forum/?fromgroups#!forum/catch-forum) or our [Discord](https://discord.gg/4CWS9zD)
|
| 37 |
+
* See [who else is using Catch2](docs/opensource-users.md#top)
|
weight/_dep/Catch2/WORKSPACE
ADDED
|
File without changes
|
weight/_dep/Catch2/artwork/catch2-c-logo.png
ADDED
|
weight/_dep/Catch2/artwork/catch2-hand-logo.png
ADDED
|
weight/_dep/Catch2/artwork/catch2-logo-small.png
ADDED
|
weight/_dep/Catch2/codecov.yml
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
coverage:
|
| 2 |
+
precision: 2
|
| 3 |
+
round: nearest
|
| 4 |
+
range: "60...90"
|
| 5 |
+
status:
|
| 6 |
+
project:
|
| 7 |
+
default:
|
| 8 |
+
threshold: 2%
|
| 9 |
+
patch:
|
| 10 |
+
default:
|
| 11 |
+
target: 80%
|
| 12 |
+
ignore:
|
| 13 |
+
- "projects/SelfTest"
|
| 14 |
+
- "**/catch_reporter_tap.hpp"
|
| 15 |
+
- "**/catch_reporter_automake.hpp"
|
| 16 |
+
- "**/catch_reporter_teamcity.hpp"
|
| 17 |
+
- "**/catch_reporter_sonarqube.hpp"
|
| 18 |
+
- "**/external/clara.hpp"
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
codecov:
|
| 22 |
+
branch: v2.x
|
| 23 |
+
|
| 24 |
+
comment:
|
| 25 |
+
layout: "diff"
|
weight/_dep/Catch2/conanfile.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
from conans import ConanFile, CMake
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
class CatchConan(ConanFile):
|
| 6 |
+
name = "Catch2"
|
| 7 |
+
description = "A modern, C++-native, header-only, framework for unit-tests, TDD and BDD"
|
| 8 |
+
topics = ("conan", "catch2", "header-only", "unit-test", "tdd", "bdd")
|
| 9 |
+
url = "https://github.com/catchorg/Catch2"
|
| 10 |
+
homepage = url
|
| 11 |
+
license = "BSL-1.0"
|
| 12 |
+
exports = "LICENSE.txt"
|
| 13 |
+
exports_sources = ("single_include/*", "CMakeLists.txt", "CMake/*", "contrib/*", "src/*")
|
| 14 |
+
generators = "cmake"
|
| 15 |
+
|
| 16 |
+
def package(self):
|
| 17 |
+
cmake = CMake(self)
|
| 18 |
+
cmake.definitions["BUILD_TESTING"] = "OFF"
|
| 19 |
+
cmake.definitions["CATCH_INSTALL_DOCS"] = "OFF"
|
| 20 |
+
cmake.definitions["CATCH_INSTALL_HELPERS"] = "ON"
|
| 21 |
+
cmake.configure(build_folder='build')
|
| 22 |
+
cmake.install()
|
| 23 |
+
|
| 24 |
+
self.copy(pattern="LICENSE.txt", dst="licenses")
|
| 25 |
+
|
| 26 |
+
def package_id(self):
|
| 27 |
+
self.info.header_only()
|
| 28 |
+
|
| 29 |
+
def package_info(self):
|
| 30 |
+
self.cpp_info.builddirs.append("lib/cmake/Catch2")
|
weight/_dep/Catch2/contrib/Catch.cmake
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
| 2 |
+
# file Copyright.txt or https://cmake.org/licensing for details.
|
| 3 |
+
|
| 4 |
+
#[=======================================================================[.rst:
|
| 5 |
+
Catch
|
| 6 |
+
-----
|
| 7 |
+
|
| 8 |
+
This module defines a function to help use the Catch test framework.
|
| 9 |
+
|
| 10 |
+
The :command:`catch_discover_tests` discovers tests by asking the compiled test
|
| 11 |
+
executable to enumerate its tests. This does not require CMake to be re-run
|
| 12 |
+
when tests change. However, it may not work in a cross-compiling environment,
|
| 13 |
+
and setting test properties is less convenient.
|
| 14 |
+
|
| 15 |
+
This command is intended to replace use of :command:`add_test` to register
|
| 16 |
+
tests, and will create a separate CTest test for each Catch test case. Note
|
| 17 |
+
that this is in some cases less efficient, as common set-up and tear-down logic
|
| 18 |
+
cannot be shared by multiple test cases executing in the same instance.
|
| 19 |
+
However, it provides more fine-grained pass/fail information to CTest, which is
|
| 20 |
+
usually considered as more beneficial. By default, the CTest test name is the
|
| 21 |
+
same as the Catch name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``.
|
| 22 |
+
|
| 23 |
+
.. command:: catch_discover_tests
|
| 24 |
+
|
| 25 |
+
Automatically add tests with CTest by querying the compiled test executable
|
| 26 |
+
for available tests::
|
| 27 |
+
|
| 28 |
+
catch_discover_tests(target
|
| 29 |
+
[TEST_SPEC arg1...]
|
| 30 |
+
[EXTRA_ARGS arg1...]
|
| 31 |
+
[WORKING_DIRECTORY dir]
|
| 32 |
+
[TEST_PREFIX prefix]
|
| 33 |
+
[TEST_SUFFIX suffix]
|
| 34 |
+
[PROPERTIES name1 value1...]
|
| 35 |
+
[TEST_LIST var]
|
| 36 |
+
[REPORTER reporter]
|
| 37 |
+
[OUTPUT_DIR dir]
|
| 38 |
+
[OUTPUT_PREFIX prefix}
|
| 39 |
+
[OUTPUT_SUFFIX suffix]
|
| 40 |
+
)
|
| 41 |
+
|
| 42 |
+
``catch_discover_tests`` sets up a post-build command on the test executable
|
| 43 |
+
that generates the list of tests by parsing the output from running the test
|
| 44 |
+
with the ``--list-test-names-only`` argument. This ensures that the full
|
| 45 |
+
list of tests is obtained. Since test discovery occurs at build time, it is
|
| 46 |
+
not necessary to re-run CMake when the list of tests changes.
|
| 47 |
+
However, it requires that :prop_tgt:`CROSSCOMPILING_EMULATOR` is properly set
|
| 48 |
+
in order to function in a cross-compiling environment.
|
| 49 |
+
|
| 50 |
+
Additionally, setting properties on tests is somewhat less convenient, since
|
| 51 |
+
the tests are not available at CMake time. Additional test properties may be
|
| 52 |
+
assigned to the set of tests as a whole using the ``PROPERTIES`` option. If
|
| 53 |
+
more fine-grained test control is needed, custom content may be provided
|
| 54 |
+
through an external CTest script using the :prop_dir:`TEST_INCLUDE_FILES`
|
| 55 |
+
directory property. The set of discovered tests is made accessible to such a
|
| 56 |
+
script via the ``<target>_TESTS`` variable.
|
| 57 |
+
|
| 58 |
+
The options are:
|
| 59 |
+
|
| 60 |
+
``target``
|
| 61 |
+
Specifies the Catch executable, which must be a known CMake executable
|
| 62 |
+
target. CMake will substitute the location of the built executable when
|
| 63 |
+
running the test.
|
| 64 |
+
|
| 65 |
+
``TEST_SPEC arg1...``
|
| 66 |
+
Specifies test cases, wildcarded test cases, tags and tag expressions to
|
| 67 |
+
pass to the Catch executable with the ``--list-test-names-only`` argument.
|
| 68 |
+
|
| 69 |
+
``EXTRA_ARGS arg1...``
|
| 70 |
+
Any extra arguments to pass on the command line to each test case.
|
| 71 |
+
|
| 72 |
+
``WORKING_DIRECTORY dir``
|
| 73 |
+
Specifies the directory in which to run the discovered test cases. If this
|
| 74 |
+
option is not provided, the current binary directory is used.
|
| 75 |
+
|
| 76 |
+
``TEST_PREFIX prefix``
|
| 77 |
+
Specifies a ``prefix`` to be prepended to the name of each discovered test
|
| 78 |
+
case. This can be useful when the same test executable is being used in
|
| 79 |
+
multiple calls to ``catch_discover_tests()`` but with different
|
| 80 |
+
``TEST_SPEC`` or ``EXTRA_ARGS``.
|
| 81 |
+
|
| 82 |
+
``TEST_SUFFIX suffix``
|
| 83 |
+
Similar to ``TEST_PREFIX`` except the ``suffix`` is appended to the name of
|
| 84 |
+
every discovered test case. Both ``TEST_PREFIX`` and ``TEST_SUFFIX`` may
|
| 85 |
+
be specified.
|
| 86 |
+
|
| 87 |
+
``PROPERTIES name1 value1...``
|
| 88 |
+
Specifies additional properties to be set on all tests discovered by this
|
| 89 |
+
invocation of ``catch_discover_tests``.
|
| 90 |
+
|
| 91 |
+
``TEST_LIST var``
|
| 92 |
+
Make the list of tests available in the variable ``var``, rather than the
|
| 93 |
+
default ``<target>_TESTS``. This can be useful when the same test
|
| 94 |
+
executable is being used in multiple calls to ``catch_discover_tests()``.
|
| 95 |
+
Note that this variable is only available in CTest.
|
| 96 |
+
|
| 97 |
+
``REPORTER reporter``
|
| 98 |
+
Use the specified reporter when running the test case. The reporter will
|
| 99 |
+
be passed to the Catch executable as ``--reporter reporter``.
|
| 100 |
+
|
| 101 |
+
``OUTPUT_DIR dir``
|
| 102 |
+
If specified, the parameter is passed along as
|
| 103 |
+
``--out dir/<test_name>`` to Catch executable. The actual file name is the
|
| 104 |
+
same as the test name. This should be used instead of
|
| 105 |
+
``EXTRA_ARGS --out foo`` to avoid race conditions writing the result output
|
| 106 |
+
when using parallel test execution.
|
| 107 |
+
|
| 108 |
+
``OUTPUT_PREFIX prefix``
|
| 109 |
+
May be used in conjunction with ``OUTPUT_DIR``.
|
| 110 |
+
If specified, ``prefix`` is added to each output file name, like so
|
| 111 |
+
``--out dir/prefix<test_name>``.
|
| 112 |
+
|
| 113 |
+
``OUTPUT_SUFFIX suffix``
|
| 114 |
+
May be used in conjunction with ``OUTPUT_DIR``.
|
| 115 |
+
If specified, ``suffix`` is added to each output file name, like so
|
| 116 |
+
``--out dir/<test_name>suffix``. This can be used to add a file extension to
|
| 117 |
+
the output e.g. ".xml".
|
| 118 |
+
|
| 119 |
+
#]=======================================================================]
|
| 120 |
+
|
| 121 |
+
#------------------------------------------------------------------------------
|
| 122 |
+
function(catch_discover_tests TARGET)
|
| 123 |
+
cmake_parse_arguments(
|
| 124 |
+
""
|
| 125 |
+
""
|
| 126 |
+
"TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST;REPORTER;OUTPUT_DIR;OUTPUT_PREFIX;OUTPUT_SUFFIX"
|
| 127 |
+
"TEST_SPEC;EXTRA_ARGS;PROPERTIES"
|
| 128 |
+
${ARGN}
|
| 129 |
+
)
|
| 130 |
+
|
| 131 |
+
if(NOT _WORKING_DIRECTORY)
|
| 132 |
+
set(_WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
| 133 |
+
endif()
|
| 134 |
+
if(NOT _TEST_LIST)
|
| 135 |
+
set(_TEST_LIST ${TARGET}_TESTS)
|
| 136 |
+
endif()
|
| 137 |
+
|
| 138 |
+
## Generate a unique name based on the extra arguments
|
| 139 |
+
string(SHA1 args_hash "${_TEST_SPEC} ${_EXTRA_ARGS} ${_REPORTER} ${_OUTPUT_DIR} ${_OUTPUT_PREFIX} ${_OUTPUT_SUFFIX}")
|
| 140 |
+
string(SUBSTRING ${args_hash} 0 7 args_hash)
|
| 141 |
+
|
| 142 |
+
# Define rule to generate test list for aforementioned test executable
|
| 143 |
+
set(ctest_include_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_include-${args_hash}.cmake")
|
| 144 |
+
set(ctest_tests_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_tests-${args_hash}.cmake")
|
| 145 |
+
get_property(crosscompiling_emulator
|
| 146 |
+
TARGET ${TARGET}
|
| 147 |
+
PROPERTY CROSSCOMPILING_EMULATOR
|
| 148 |
+
)
|
| 149 |
+
add_custom_command(
|
| 150 |
+
TARGET ${TARGET} POST_BUILD
|
| 151 |
+
BYPRODUCTS "${ctest_tests_file}"
|
| 152 |
+
COMMAND "${CMAKE_COMMAND}"
|
| 153 |
+
-D "TEST_TARGET=${TARGET}"
|
| 154 |
+
-D "TEST_EXECUTABLE=$<TARGET_FILE:${TARGET}>"
|
| 155 |
+
-D "TEST_EXECUTOR=${crosscompiling_emulator}"
|
| 156 |
+
-D "TEST_WORKING_DIR=${_WORKING_DIRECTORY}"
|
| 157 |
+
-D "TEST_SPEC=${_TEST_SPEC}"
|
| 158 |
+
-D "TEST_EXTRA_ARGS=${_EXTRA_ARGS}"
|
| 159 |
+
-D "TEST_PROPERTIES=${_PROPERTIES}"
|
| 160 |
+
-D "TEST_PREFIX=${_TEST_PREFIX}"
|
| 161 |
+
-D "TEST_SUFFIX=${_TEST_SUFFIX}"
|
| 162 |
+
-D "TEST_LIST=${_TEST_LIST}"
|
| 163 |
+
-D "TEST_REPORTER=${_REPORTER}"
|
| 164 |
+
-D "TEST_OUTPUT_DIR=${_OUTPUT_DIR}"
|
| 165 |
+
-D "TEST_OUTPUT_PREFIX=${_OUTPUT_PREFIX}"
|
| 166 |
+
-D "TEST_OUTPUT_SUFFIX=${_OUTPUT_SUFFIX}"
|
| 167 |
+
-D "CTEST_FILE=${ctest_tests_file}"
|
| 168 |
+
-P "${_CATCH_DISCOVER_TESTS_SCRIPT}"
|
| 169 |
+
VERBATIM
|
| 170 |
+
)
|
| 171 |
+
|
| 172 |
+
file(WRITE "${ctest_include_file}"
|
| 173 |
+
"if(EXISTS \"${ctest_tests_file}\")\n"
|
| 174 |
+
" include(\"${ctest_tests_file}\")\n"
|
| 175 |
+
"else()\n"
|
| 176 |
+
" add_test(${TARGET}_NOT_BUILT-${args_hash} ${TARGET}_NOT_BUILT-${args_hash})\n"
|
| 177 |
+
"endif()\n"
|
| 178 |
+
)
|
| 179 |
+
|
| 180 |
+
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.10.0")
|
| 181 |
+
# Add discovered tests to directory TEST_INCLUDE_FILES
|
| 182 |
+
set_property(DIRECTORY
|
| 183 |
+
APPEND PROPERTY TEST_INCLUDE_FILES "${ctest_include_file}"
|
| 184 |
+
)
|
| 185 |
+
else()
|
| 186 |
+
# Add discovered tests as directory TEST_INCLUDE_FILE if possible
|
| 187 |
+
get_property(test_include_file_set DIRECTORY PROPERTY TEST_INCLUDE_FILE SET)
|
| 188 |
+
if (NOT ${test_include_file_set})
|
| 189 |
+
set_property(DIRECTORY
|
| 190 |
+
PROPERTY TEST_INCLUDE_FILE "${ctest_include_file}"
|
| 191 |
+
)
|
| 192 |
+
else()
|
| 193 |
+
message(FATAL_ERROR
|
| 194 |
+
"Cannot set more than one TEST_INCLUDE_FILE"
|
| 195 |
+
)
|
| 196 |
+
endif()
|
| 197 |
+
endif()
|
| 198 |
+
|
| 199 |
+
endfunction()
|
| 200 |
+
|
| 201 |
+
###############################################################################
|
| 202 |
+
|
| 203 |
+
set(_CATCH_DISCOVER_TESTS_SCRIPT
|
| 204 |
+
${CMAKE_CURRENT_LIST_DIR}/CatchAddTests.cmake
|
| 205 |
+
CACHE INTERNAL "Catch2 full path to CatchAddTests.cmake helper file"
|
| 206 |
+
)
|
weight/_dep/Catch2/contrib/CatchAddTests.cmake
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
| 2 |
+
# file Copyright.txt or https://cmake.org/licensing for details.
|
| 3 |
+
|
| 4 |
+
set(prefix "${TEST_PREFIX}")
|
| 5 |
+
set(suffix "${TEST_SUFFIX}")
|
| 6 |
+
set(spec ${TEST_SPEC})
|
| 7 |
+
set(extra_args ${TEST_EXTRA_ARGS})
|
| 8 |
+
set(properties ${TEST_PROPERTIES})
|
| 9 |
+
set(reporter ${TEST_REPORTER})
|
| 10 |
+
set(output_dir ${TEST_OUTPUT_DIR})
|
| 11 |
+
set(output_prefix ${TEST_OUTPUT_PREFIX})
|
| 12 |
+
set(output_suffix ${TEST_OUTPUT_SUFFIX})
|
| 13 |
+
set(script)
|
| 14 |
+
set(suite)
|
| 15 |
+
set(tests)
|
| 16 |
+
|
| 17 |
+
function(add_command NAME)
|
| 18 |
+
set(_args "")
|
| 19 |
+
# use ARGV* instead of ARGN, because ARGN splits arrays into multiple arguments
|
| 20 |
+
math(EXPR _last_arg ${ARGC}-1)
|
| 21 |
+
foreach(_n RANGE 1 ${_last_arg})
|
| 22 |
+
set(_arg "${ARGV${_n}}")
|
| 23 |
+
if(_arg MATCHES "[^-./:a-zA-Z0-9_]")
|
| 24 |
+
set(_args "${_args} [==[${_arg}]==]") # form a bracket_argument
|
| 25 |
+
else()
|
| 26 |
+
set(_args "${_args} ${_arg}")
|
| 27 |
+
endif()
|
| 28 |
+
endforeach()
|
| 29 |
+
set(script "${script}${NAME}(${_args})\n" PARENT_SCOPE)
|
| 30 |
+
endfunction()
|
| 31 |
+
|
| 32 |
+
# Run test executable to get list of available tests
|
| 33 |
+
if(NOT EXISTS "${TEST_EXECUTABLE}")
|
| 34 |
+
message(FATAL_ERROR
|
| 35 |
+
"Specified test executable '${TEST_EXECUTABLE}' does not exist"
|
| 36 |
+
)
|
| 37 |
+
endif()
|
| 38 |
+
execute_process(
|
| 39 |
+
COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} --list-test-names-only
|
| 40 |
+
OUTPUT_VARIABLE output
|
| 41 |
+
RESULT_VARIABLE result
|
| 42 |
+
WORKING_DIRECTORY "${TEST_WORKING_DIR}"
|
| 43 |
+
)
|
| 44 |
+
# Catch --list-test-names-only reports the number of tests, so 0 is... surprising
|
| 45 |
+
if(${result} EQUAL 0)
|
| 46 |
+
message(WARNING
|
| 47 |
+
"Test executable '${TEST_EXECUTABLE}' contains no tests!\n"
|
| 48 |
+
)
|
| 49 |
+
elseif(${result} LESS 0)
|
| 50 |
+
message(FATAL_ERROR
|
| 51 |
+
"Error running test executable '${TEST_EXECUTABLE}':\n"
|
| 52 |
+
" Result: ${result}\n"
|
| 53 |
+
" Output: ${output}\n"
|
| 54 |
+
)
|
| 55 |
+
endif()
|
| 56 |
+
|
| 57 |
+
string(REPLACE "\n" ";" output "${output}")
|
| 58 |
+
|
| 59 |
+
# Run test executable to get list of available reporters
|
| 60 |
+
execute_process(
|
| 61 |
+
COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} --list-reporters
|
| 62 |
+
OUTPUT_VARIABLE reporters_output
|
| 63 |
+
RESULT_VARIABLE reporters_result
|
| 64 |
+
WORKING_DIRECTORY "${TEST_WORKING_DIR}"
|
| 65 |
+
)
|
| 66 |
+
if(${reporters_result} EQUAL 0)
|
| 67 |
+
message(WARNING
|
| 68 |
+
"Test executable '${TEST_EXECUTABLE}' contains no reporters!\n"
|
| 69 |
+
)
|
| 70 |
+
elseif(${reporters_result} LESS 0)
|
| 71 |
+
message(FATAL_ERROR
|
| 72 |
+
"Error running test executable '${TEST_EXECUTABLE}':\n"
|
| 73 |
+
" Result: ${reporters_result}\n"
|
| 74 |
+
" Output: ${reporters_output}\n"
|
| 75 |
+
)
|
| 76 |
+
endif()
|
| 77 |
+
string(FIND "${reporters_output}" "${reporter}" reporter_is_valid)
|
| 78 |
+
if(reporter AND ${reporter_is_valid} EQUAL -1)
|
| 79 |
+
message(FATAL_ERROR
|
| 80 |
+
"\"${reporter}\" is not a valid reporter!\n"
|
| 81 |
+
)
|
| 82 |
+
endif()
|
| 83 |
+
|
| 84 |
+
# Prepare reporter
|
| 85 |
+
if(reporter)
|
| 86 |
+
set(reporter_arg "--reporter ${reporter}")
|
| 87 |
+
endif()
|
| 88 |
+
|
| 89 |
+
# Prepare output dir
|
| 90 |
+
if(output_dir AND NOT IS_ABSOLUTE ${output_dir})
|
| 91 |
+
set(output_dir "${TEST_WORKING_DIR}/${output_dir}")
|
| 92 |
+
if(NOT EXISTS ${output_dir})
|
| 93 |
+
file(MAKE_DIRECTORY ${output_dir})
|
| 94 |
+
endif()
|
| 95 |
+
endif()
|
| 96 |
+
|
| 97 |
+
# Parse output
|
| 98 |
+
foreach(line ${output})
|
| 99 |
+
set(test ${line})
|
| 100 |
+
# Escape characters in test case names that would be parsed by Catch2
|
| 101 |
+
set(test_name ${test})
|
| 102 |
+
foreach(char , [ ])
|
| 103 |
+
string(REPLACE ${char} "\\${char}" test_name ${test_name})
|
| 104 |
+
endforeach(char)
|
| 105 |
+
# ...add output dir
|
| 106 |
+
if(output_dir)
|
| 107 |
+
string(REGEX REPLACE "[^A-Za-z0-9_]" "_" test_name_clean ${test_name})
|
| 108 |
+
set(output_dir_arg "--out ${output_dir}/${output_prefix}${test_name_clean}${output_suffix}")
|
| 109 |
+
endif()
|
| 110 |
+
|
| 111 |
+
# ...and add to script
|
| 112 |
+
add_command(add_test
|
| 113 |
+
"${prefix}${test}${suffix}"
|
| 114 |
+
${TEST_EXECUTOR}
|
| 115 |
+
"${TEST_EXECUTABLE}"
|
| 116 |
+
"${test_name}"
|
| 117 |
+
${extra_args}
|
| 118 |
+
"${reporter_arg}"
|
| 119 |
+
"${output_dir_arg}"
|
| 120 |
+
)
|
| 121 |
+
add_command(set_tests_properties
|
| 122 |
+
"${prefix}${test}${suffix}"
|
| 123 |
+
PROPERTIES
|
| 124 |
+
WORKING_DIRECTORY "${TEST_WORKING_DIR}"
|
| 125 |
+
${properties}
|
| 126 |
+
)
|
| 127 |
+
list(APPEND tests "${prefix}${test}${suffix}")
|
| 128 |
+
endforeach()
|
| 129 |
+
|
| 130 |
+
# Create a list of all discovered tests, which users may use to e.g. set
|
| 131 |
+
# properties on the tests
|
| 132 |
+
add_command(set ${TEST_LIST} ${tests})
|
| 133 |
+
|
| 134 |
+
# Write CTest script
|
| 135 |
+
file(WRITE "${CTEST_FILE}" "${script}")
|
weight/_dep/Catch2/contrib/ParseAndAddCatchTests.cmake
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#==================================================================================================#
|
| 2 |
+
# supported macros #
|
| 3 |
+
# - TEST_CASE, #
|
| 4 |
+
# - TEMPLATE_TEST_CASE #
|
| 5 |
+
# - SCENARIO, #
|
| 6 |
+
# - TEST_CASE_METHOD, #
|
| 7 |
+
# - CATCH_TEST_CASE, #
|
| 8 |
+
# - CATCH_TEMPLATE_TEST_CASE #
|
| 9 |
+
# - CATCH_SCENARIO, #
|
| 10 |
+
# - CATCH_TEST_CASE_METHOD. #
|
| 11 |
+
# #
|
| 12 |
+
# Usage #
|
| 13 |
+
# 1. make sure this module is in the path or add this otherwise: #
|
| 14 |
+
# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake.modules/") #
|
| 15 |
+
# 2. make sure that you've enabled testing option for the project by the call: #
|
| 16 |
+
# enable_testing() #
|
| 17 |
+
# 3. add the lines to the script for testing target (sample CMakeLists.txt): #
|
| 18 |
+
# project(testing_target) #
|
| 19 |
+
# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake.modules/") #
|
| 20 |
+
# enable_testing() #
|
| 21 |
+
# #
|
| 22 |
+
# find_path(CATCH_INCLUDE_DIR "catch.hpp") #
|
| 23 |
+
# include_directories(${INCLUDE_DIRECTORIES} ${CATCH_INCLUDE_DIR}) #
|
| 24 |
+
# #
|
| 25 |
+
# file(GLOB SOURCE_FILES "*.cpp") #
|
| 26 |
+
# add_executable(${PROJECT_NAME} ${SOURCE_FILES}) #
|
| 27 |
+
# #
|
| 28 |
+
# include(ParseAndAddCatchTests) #
|
| 29 |
+
# ParseAndAddCatchTests(${PROJECT_NAME}) #
|
| 30 |
+
# #
|
| 31 |
+
# The following variables affect the behavior of the script: #
|
| 32 |
+
# #
|
| 33 |
+
# PARSE_CATCH_TESTS_VERBOSE (Default OFF) #
|
| 34 |
+
# -- enables debug messages #
|
| 35 |
+
# PARSE_CATCH_TESTS_NO_HIDDEN_TESTS (Default OFF) #
|
| 36 |
+
# -- excludes tests marked with [!hide], [.] or [.foo] tags #
|
| 37 |
+
# PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME (Default ON) #
|
| 38 |
+
# -- adds fixture class name to the test name #
|
| 39 |
+
# PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME (Default ON) #
|
| 40 |
+
# -- adds cmake target name to the test name #
|
| 41 |
+
# PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS (Default OFF) #
|
| 42 |
+
# -- causes CMake to rerun when file with tests changes so that new tests will be discovered #
|
| 43 |
+
# #
|
| 44 |
+
# One can also set (locally) the optional variable OptionalCatchTestLauncher to precise the way #
|
| 45 |
+
# a test should be run. For instance to use test MPI, one can write #
|
| 46 |
+
# set(OptionalCatchTestLauncher ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${NUMPROC}) #
|
| 47 |
+
# just before calling this ParseAndAddCatchTests function #
|
| 48 |
+
# #
|
| 49 |
+
# The AdditionalCatchParameters optional variable can be used to pass extra argument to the test #
|
| 50 |
+
# command. For example, to include successful tests in the output, one can write #
|
| 51 |
+
# set(AdditionalCatchParameters --success) #
|
| 52 |
+
# #
|
| 53 |
+
# After the script, the ParseAndAddCatchTests_TESTS property for the target, and for each source #
|
| 54 |
+
# file in the target is set, and contains the list of the tests extracted from that target, or #
|
| 55 |
+
# from that file. This is useful, for example to add further labels or properties to the tests. #
|
| 56 |
+
# #
|
| 57 |
+
#==================================================================================================#
|
| 58 |
+
|
| 59 |
+
if (CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.8)
|
| 60 |
+
message(FATAL_ERROR "ParseAndAddCatchTests requires CMake 2.8.8 or newer")
|
| 61 |
+
endif()
|
| 62 |
+
|
| 63 |
+
option(PARSE_CATCH_TESTS_VERBOSE "Print Catch to CTest parser debug messages" OFF)
|
| 64 |
+
option(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS "Exclude tests with [!hide], [.] or [.foo] tags" OFF)
|
| 65 |
+
option(PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME "Add fixture class name to the test name" ON)
|
| 66 |
+
option(PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME "Add target name to the test name" ON)
|
| 67 |
+
option(PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS "Add test file to CMAKE_CONFIGURE_DEPENDS property" OFF)
|
| 68 |
+
|
| 69 |
+
function(ParseAndAddCatchTests_PrintDebugMessage)
|
| 70 |
+
if(PARSE_CATCH_TESTS_VERBOSE)
|
| 71 |
+
message(STATUS "ParseAndAddCatchTests: ${ARGV}")
|
| 72 |
+
endif()
|
| 73 |
+
endfunction()
|
| 74 |
+
|
| 75 |
+
# This removes the contents between
|
| 76 |
+
# - block comments (i.e. /* ... */)
|
| 77 |
+
# - full line comments (i.e. // ... )
|
| 78 |
+
# contents have been read into '${CppCode}'.
|
| 79 |
+
# !keep partial line comments
|
| 80 |
+
function(ParseAndAddCatchTests_RemoveComments CppCode)
|
| 81 |
+
string(ASCII 2 CMakeBeginBlockComment)
|
| 82 |
+
string(ASCII 3 CMakeEndBlockComment)
|
| 83 |
+
string(REGEX REPLACE "/\\*" "${CMakeBeginBlockComment}" ${CppCode} "${${CppCode}}")
|
| 84 |
+
string(REGEX REPLACE "\\*/" "${CMakeEndBlockComment}" ${CppCode} "${${CppCode}}")
|
| 85 |
+
string(REGEX REPLACE "${CMakeBeginBlockComment}[^${CMakeEndBlockComment}]*${CMakeEndBlockComment}" "" ${CppCode} "${${CppCode}}")
|
| 86 |
+
string(REGEX REPLACE "\n[ \t]*//+[^\n]+" "\n" ${CppCode} "${${CppCode}}")
|
| 87 |
+
|
| 88 |
+
set(${CppCode} "${${CppCode}}" PARENT_SCOPE)
|
| 89 |
+
endfunction()
|
| 90 |
+
|
| 91 |
+
# Worker function
|
| 92 |
+
function(ParseAndAddCatchTests_ParseFile SourceFile TestTarget)
|
| 93 |
+
# If SourceFile is an object library, do not scan it (as it is not a file). Exit without giving a warning about a missing file.
|
| 94 |
+
if(SourceFile MATCHES "\\\$<TARGET_OBJECTS:.+>")
|
| 95 |
+
ParseAndAddCatchTests_PrintDebugMessage("Detected OBJECT library: ${SourceFile} this will not be scanned for tests.")
|
| 96 |
+
return()
|
| 97 |
+
endif()
|
| 98 |
+
# According to CMake docs EXISTS behavior is well-defined only for full paths.
|
| 99 |
+
get_filename_component(SourceFile ${SourceFile} ABSOLUTE)
|
| 100 |
+
if(NOT EXISTS ${SourceFile})
|
| 101 |
+
message(WARNING "Cannot find source file: ${SourceFile}")
|
| 102 |
+
return()
|
| 103 |
+
endif()
|
| 104 |
+
ParseAndAddCatchTests_PrintDebugMessage("parsing ${SourceFile}")
|
| 105 |
+
file(STRINGS ${SourceFile} Contents NEWLINE_CONSUME)
|
| 106 |
+
|
| 107 |
+
# Remove block and fullline comments
|
| 108 |
+
ParseAndAddCatchTests_RemoveComments(Contents)
|
| 109 |
+
|
| 110 |
+
# Find definition of test names
|
| 111 |
+
# https://regex101.com/r/JygOND/1
|
| 112 |
+
string(REGEX MATCHALL "[ \t]*(CATCH_)?(TEMPLATE_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)[ \t]*\\([ \t\n]*\"[^\"]*\"[ \t\n]*(,[ \t\n]*\"[^\"]*\")?(,[ \t\n]*[^\,\)]*)*\\)[ \t\n]*\{+[ \t]*(//[^\n]*[Tt][Ii][Mm][Ee][Oo][Uu][Tt][ \t]*[0-9]+)*" Tests "${Contents}")
|
| 113 |
+
|
| 114 |
+
if(PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS AND Tests)
|
| 115 |
+
ParseAndAddCatchTests_PrintDebugMessage("Adding ${SourceFile} to CMAKE_CONFIGURE_DEPENDS property")
|
| 116 |
+
set_property(
|
| 117 |
+
DIRECTORY
|
| 118 |
+
APPEND
|
| 119 |
+
PROPERTY CMAKE_CONFIGURE_DEPENDS ${SourceFile}
|
| 120 |
+
)
|
| 121 |
+
endif()
|
| 122 |
+
|
| 123 |
+
# check CMP0110 policy for new add_test() behavior
|
| 124 |
+
if(POLICY CMP0110)
|
| 125 |
+
cmake_policy(GET CMP0110 _cmp0110_value) # new add_test() behavior
|
| 126 |
+
else()
|
| 127 |
+
# just to be thorough explicitly set the variable
|
| 128 |
+
set(_cmp0110_value)
|
| 129 |
+
endif()
|
| 130 |
+
|
| 131 |
+
foreach(TestName ${Tests})
|
| 132 |
+
# Strip newlines
|
| 133 |
+
string(REGEX REPLACE "\\\\\n|\n" "" TestName "${TestName}")
|
| 134 |
+
|
| 135 |
+
# Get test type and fixture if applicable
|
| 136 |
+
string(REGEX MATCH "(CATCH_)?(TEMPLATE_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)[ \t]*\\([^,^\"]*" TestTypeAndFixture "${TestName}")
|
| 137 |
+
string(REGEX MATCH "(CATCH_)?(TEMPLATE_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)" TestType "${TestTypeAndFixture}")
|
| 138 |
+
string(REGEX REPLACE "${TestType}\\([ \t]*" "" TestFixture "${TestTypeAndFixture}")
|
| 139 |
+
|
| 140 |
+
# Get string parts of test definition
|
| 141 |
+
string(REGEX MATCHALL "\"+([^\\^\"]|\\\\\")+\"+" TestStrings "${TestName}")
|
| 142 |
+
|
| 143 |
+
# Strip wrapping quotation marks
|
| 144 |
+
string(REGEX REPLACE "^\"(.*)\"$" "\\1" TestStrings "${TestStrings}")
|
| 145 |
+
string(REPLACE "\";\"" ";" TestStrings "${TestStrings}")
|
| 146 |
+
|
| 147 |
+
# Validate that a test name and tags have been provided
|
| 148 |
+
list(LENGTH TestStrings TestStringsLength)
|
| 149 |
+
if(TestStringsLength GREATER 2 OR TestStringsLength LESS 1)
|
| 150 |
+
message(FATAL_ERROR "You must provide a valid test name and tags for all tests in ${SourceFile}")
|
| 151 |
+
endif()
|
| 152 |
+
|
| 153 |
+
# Assign name and tags
|
| 154 |
+
list(GET TestStrings 0 Name)
|
| 155 |
+
if("${TestType}" STREQUAL "SCENARIO")
|
| 156 |
+
set(Name "Scenario: ${Name}")
|
| 157 |
+
endif()
|
| 158 |
+
if(PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME AND "${TestType}" MATCHES "(CATCH_)?TEST_CASE_METHOD" AND TestFixture )
|
| 159 |
+
set(CTestName "${TestFixture}:${Name}")
|
| 160 |
+
else()
|
| 161 |
+
set(CTestName "${Name}")
|
| 162 |
+
endif()
|
| 163 |
+
if(PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME)
|
| 164 |
+
set(CTestName "${TestTarget}:${CTestName}")
|
| 165 |
+
endif()
|
| 166 |
+
# add target to labels to enable running all tests added from this target
|
| 167 |
+
set(Labels ${TestTarget})
|
| 168 |
+
if(TestStringsLength EQUAL 2)
|
| 169 |
+
list(GET TestStrings 1 Tags)
|
| 170 |
+
string(TOLOWER "${Tags}" Tags)
|
| 171 |
+
# remove target from labels if the test is hidden
|
| 172 |
+
if("${Tags}" MATCHES ".*\\[!?(hide|\\.)\\].*")
|
| 173 |
+
list(REMOVE_ITEM Labels ${TestTarget})
|
| 174 |
+
endif()
|
| 175 |
+
string(REPLACE "]" ";" Tags "${Tags}")
|
| 176 |
+
string(REPLACE "[" "" Tags "${Tags}")
|
| 177 |
+
else()
|
| 178 |
+
# unset tags variable from previous loop
|
| 179 |
+
unset(Tags)
|
| 180 |
+
endif()
|
| 181 |
+
|
| 182 |
+
list(APPEND Labels ${Tags})
|
| 183 |
+
|
| 184 |
+
set(HiddenTagFound OFF)
|
| 185 |
+
foreach(label ${Labels})
|
| 186 |
+
string(REGEX MATCH "^!hide|^\\." result ${label})
|
| 187 |
+
if(result)
|
| 188 |
+
set(HiddenTagFound ON)
|
| 189 |
+
break()
|
| 190 |
+
endif(result)
|
| 191 |
+
endforeach(label)
|
| 192 |
+
if(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS AND ${HiddenTagFound} AND ${CMAKE_VERSION} VERSION_LESS "3.9")
|
| 193 |
+
ParseAndAddCatchTests_PrintDebugMessage("Skipping test \"${CTestName}\" as it has [!hide], [.] or [.foo] label")
|
| 194 |
+
else()
|
| 195 |
+
ParseAndAddCatchTests_PrintDebugMessage("Adding test \"${CTestName}\"")
|
| 196 |
+
if(Labels)
|
| 197 |
+
ParseAndAddCatchTests_PrintDebugMessage("Setting labels to ${Labels}")
|
| 198 |
+
endif()
|
| 199 |
+
|
| 200 |
+
# Escape commas in the test spec
|
| 201 |
+
string(REPLACE "," "\\," Name ${Name})
|
| 202 |
+
|
| 203 |
+
# Work around CMake 3.18.0 change in `add_test()`, before the escaped quotes were necessary,
|
| 204 |
+
# only with CMake 3.18.0 the escaped double quotes confuse the call. This change is reverted in 3.18.1
|
| 205 |
+
# And properly introduced in 3.19 with the CMP0110 policy
|
| 206 |
+
if(_cmp0110_value STREQUAL "NEW" OR ${CMAKE_VERSION} VERSION_EQUAL "3.18")
|
| 207 |
+
ParseAndAddCatchTests_PrintDebugMessage("CMP0110 set to NEW, no need for add_test(\"\") workaround")
|
| 208 |
+
else()
|
| 209 |
+
ParseAndAddCatchTests_PrintDebugMessage("CMP0110 set to OLD adding \"\" for add_test() workaround")
|
| 210 |
+
set(CTestName "\"${CTestName}\"")
|
| 211 |
+
endif()
|
| 212 |
+
|
| 213 |
+
# Handle template test cases
|
| 214 |
+
if("${TestTypeAndFixture}" MATCHES ".*TEMPLATE_.*")
|
| 215 |
+
set(Name "${Name} - *")
|
| 216 |
+
endif()
|
| 217 |
+
|
| 218 |
+
# Add the test and set its properties
|
| 219 |
+
add_test(NAME "${CTestName}" COMMAND ${OptionalCatchTestLauncher} $<TARGET_FILE:${TestTarget}> ${Name} ${AdditionalCatchParameters})
|
| 220 |
+
# Old CMake versions do not document VERSION_GREATER_EQUAL, so we use VERSION_GREATER with 3.8 instead
|
| 221 |
+
if(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS AND ${HiddenTagFound} AND ${CMAKE_VERSION} VERSION_GREATER "3.8")
|
| 222 |
+
ParseAndAddCatchTests_PrintDebugMessage("Setting DISABLED test property")
|
| 223 |
+
set_tests_properties("${CTestName}" PROPERTIES DISABLED ON)
|
| 224 |
+
else()
|
| 225 |
+
set_tests_properties("${CTestName}" PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran"
|
| 226 |
+
LABELS "${Labels}")
|
| 227 |
+
endif()
|
| 228 |
+
set_property(
|
| 229 |
+
TARGET ${TestTarget}
|
| 230 |
+
APPEND
|
| 231 |
+
PROPERTY ParseAndAddCatchTests_TESTS "${CTestName}")
|
| 232 |
+
set_property(
|
| 233 |
+
SOURCE ${SourceFile}
|
| 234 |
+
APPEND
|
| 235 |
+
PROPERTY ParseAndAddCatchTests_TESTS "${CTestName}")
|
| 236 |
+
endif()
|
| 237 |
+
|
| 238 |
+
|
| 239 |
+
endforeach()
|
| 240 |
+
endfunction()
|
| 241 |
+
|
| 242 |
+
# entry point
|
| 243 |
+
function(ParseAndAddCatchTests TestTarget)
|
| 244 |
+
message(DEPRECATION "ParseAndAddCatchTest: function deprecated because of possibility of missed test cases. Consider using 'catch_discover_tests' from 'Catch.cmake'")
|
| 245 |
+
ParseAndAddCatchTests_PrintDebugMessage("Started parsing ${TestTarget}")
|
| 246 |
+
get_target_property(SourceFiles ${TestTarget} SOURCES)
|
| 247 |
+
ParseAndAddCatchTests_PrintDebugMessage("Found the following sources: ${SourceFiles}")
|
| 248 |
+
foreach(SourceFile ${SourceFiles})
|
| 249 |
+
ParseAndAddCatchTests_ParseFile(${SourceFile} ${TestTarget})
|
| 250 |
+
endforeach()
|
| 251 |
+
ParseAndAddCatchTests_PrintDebugMessage("Finished parsing ${TestTarget}")
|
| 252 |
+
endfunction()
|
weight/_dep/Catch2/contrib/gdbinit
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#
|
| 2 |
+
# This file provides a way to skip stepping into Catch code when debugging with gdb.
|
| 3 |
+
#
|
| 4 |
+
# With the gdb "skip" command you can tell gdb to skip files or functions during debugging.
|
| 5 |
+
# see https://xaizek.github.io/2016-05-26/skipping-standard-library-in-gdb/ for an example
|
| 6 |
+
#
|
| 7 |
+
# Basically the following line tells gdb to skip all functions containing the
|
| 8 |
+
# regexp "Catch", which matches the complete Catch namespace.
|
| 9 |
+
# If you want to skip just some parts of the Catch code you can modify the
|
| 10 |
+
# regexp accordingly.
|
| 11 |
+
#
|
| 12 |
+
# If you want to permanently skip stepping into Catch code copy the following
|
| 13 |
+
# line into your ~/.gdbinit file
|
| 14 |
+
#
|
| 15 |
+
|
| 16 |
+
skip -rfu Catch
|
weight/_dep/Catch2/contrib/lldbinit
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#
|
| 2 |
+
# This file provides a way to skip stepping into Catch code when debugging with lldb.
|
| 3 |
+
#
|
| 4 |
+
# With the setting "target.process.thread.step-avoid-regexp" you can tell lldb
|
| 5 |
+
# to skip functions matching the regexp
|
| 6 |
+
#
|
| 7 |
+
# Basically the following line tells lldb to skip all functions containing the
|
| 8 |
+
# regexp "Catch", which matches the complete Catch namespace.
|
| 9 |
+
# If you want to skip just some parts of the Catch code you can modify the
|
| 10 |
+
# regexp accordingly.
|
| 11 |
+
#
|
| 12 |
+
# If you want to permanently skip stepping into Catch code copy the following
|
| 13 |
+
# line into your ~/.lldbinit file
|
| 14 |
+
#
|
| 15 |
+
|
| 16 |
+
settings set target.process.thread.step-avoid-regexp Catch
|
weight/_dep/Catch2/docs/Readme.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<a id="top"></a>
|
| 2 |
+
# Reference
|
| 3 |
+
|
| 4 |
+
To get the most out of Catch2, start with the [tutorial](tutorial.md#top).
|
| 5 |
+
Once you're up and running consider the following reference material.
|
| 6 |
+
|
| 7 |
+
Writing tests:
|
| 8 |
+
* [Assertion macros](assertions.md#top)
|
| 9 |
+
* [Matchers](matchers.md#top)
|
| 10 |
+
* [Logging macros](logging.md#top)
|
| 11 |
+
* [Test cases and sections](test-cases-and-sections.md#top)
|
| 12 |
+
* [Test fixtures](test-fixtures.md#top)
|
| 13 |
+
* [Reporters](reporters.md#top)
|
| 14 |
+
* [Event Listeners](event-listeners.md#top)
|
| 15 |
+
* [Data Generators](generators.md#top)
|
| 16 |
+
* [Other macros](other-macros.md#top)
|
| 17 |
+
* [Micro benchmarking](benchmarks.md#top)
|
| 18 |
+
|
| 19 |
+
Fine tuning:
|
| 20 |
+
* [Supplying your own main()](own-main.md#top)
|
| 21 |
+
* [Compile-time configuration](configuration.md#top)
|
| 22 |
+
* [String Conversions](tostring.md#top)
|
| 23 |
+
|
| 24 |
+
Running:
|
| 25 |
+
* [Command line](command-line.md#top)
|
| 26 |
+
|
| 27 |
+
Odds and ends:
|
| 28 |
+
* [CMake integration](cmake-integration.md#top)
|
| 29 |
+
* [CI and other miscellaneous pieces](ci-and-misc.md#top)
|
| 30 |
+
|
| 31 |
+
FAQ:
|
| 32 |
+
* [Why are my tests slow to compile?](slow-compiles.md#top)
|
| 33 |
+
* [Known limitations](limitations.md#top)
|
| 34 |
+
|
| 35 |
+
Other:
|
| 36 |
+
* [Why Catch?](why-catch.md#top)
|
| 37 |
+
* [Open Source Projects using Catch](opensource-users.md#top)
|
| 38 |
+
* [Commercial Projects using Catch](commercial-users.md#top)
|
| 39 |
+
* [Contributing](contributing.md#top)
|
| 40 |
+
* [Release Notes](release-notes.md#top)
|
| 41 |
+
* [Deprecations and incoming changes](deprecations.md#top)
|
weight/_dep/Catch2/docs/ci-and-misc.md
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<a id="top"></a>
|
| 2 |
+
# CI and other odd pieces
|
| 3 |
+
|
| 4 |
+
**Contents**<br>
|
| 5 |
+
[Continuous Integration systems](#continuous-integration-systems)<br>
|
| 6 |
+
[Other reporters](#other-reporters)<br>
|
| 7 |
+
[Low-level tools](#low-level-tools)<br>
|
| 8 |
+
[CMake](#cmake)<br>
|
| 9 |
+
|
| 10 |
+
This page talks about how Catch integrates with Continuous Integration
|
| 11 |
+
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.
|
| 12 |
+
|
| 13 |
+
## Continuous Integration systems
|
| 14 |
+
|
| 15 |
+
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, Automake and SonarQube reporters).
|
| 16 |
+
|
| 17 |
+
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.
|
| 18 |
+
|
| 19 |
+
### XML Reporter
|
| 20 |
+
```-r xml```
|
| 21 |
+
|
| 22 |
+
The XML Reporter writes in an XML format that is specific to Catch.
|
| 23 |
+
|
| 24 |
+
The advantage of this format is that it corresponds well to the way Catch works (especially the more unusual features, such as nested sections) and is a fully streaming format - that is it writes output as it goes, without having to store up all its results before it can start writing.
|
| 25 |
+
|
| 26 |
+
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 convert it to, say, HTML - although this loses the streaming advantage, of course.
|
| 27 |
+
|
| 28 |
+
### JUnit Reporter
|
| 29 |
+
```-r junit```
|
| 30 |
+
|
| 31 |
+
The JUnit Reporter writes in an XML format that mimics the JUnit ANT schema.
|
| 32 |
+
|
| 33 |
+
The advantage of this format is that the JUnit Ant schema is widely understood by most build servers and so can usually be consumed with no additional work.
|
| 34 |
+
|
| 35 |
+
The disadvantage is that this schema was designed to correspond to how JUnit works - and there is a significant mismatch with how Catch works. Additionally the format is not streamable (because opening elements hold counts of failed and passing tests as attributes) - so the whole test run must complete before it can be written.
|
| 36 |
+
|
| 37 |
+
## Other reporters
|
| 38 |
+
Other reporters are not part of the single-header distribution and need
|
| 39 |
+
to be downloaded and included separately. All reporters are stored in
|
| 40 |
+
`single_include` directory in the git repository, and are named
|
| 41 |
+
`catch_reporter_*.hpp`. For example, to use the TeamCity reporter you
|
| 42 |
+
need to download `single_include/catch_reporter_teamcity.hpp` and include
|
| 43 |
+
it after Catch itself.
|
| 44 |
+
|
| 45 |
+
```cpp
|
| 46 |
+
#define CATCH_CONFIG_MAIN
|
| 47 |
+
#include "catch.hpp"
|
| 48 |
+
#include "catch_reporter_teamcity.hpp"
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
### TeamCity Reporter
|
| 52 |
+
```-r teamcity```
|
| 53 |
+
|
| 54 |
+
The TeamCity Reporter writes TeamCity service messages to stdout. In order to be able to use this reporter an additional header must also be included.
|
| 55 |
+
|
| 56 |
+
Being specific to TeamCity this is the best reporter to use with it - but it is completely unsuitable for any other purpose. It is a streaming format (it writes as it goes) - although test results don't appear in the TeamCity interface until the completion of a suite (usually the whole test run).
|
| 57 |
+
|
| 58 |
+
### Automake Reporter
|
| 59 |
+
```-r automake```
|
| 60 |
+
|
| 61 |
+
The Automake Reporter writes out the [meta tags](https://www.gnu.org/software/automake/manual/html_node/Log-files-generation-and-test-results-recording.html#Log-files-generation-and-test-results-recording) expected by automake via `make check`.
|
| 62 |
+
|
| 63 |
+
### TAP (Test Anything Protocol) Reporter
|
| 64 |
+
```-r tap```
|
| 65 |
+
|
| 66 |
+
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.
|
| 67 |
+
|
| 68 |
+
### SonarQube Reporter
|
| 69 |
+
```-r sonarqube```
|
| 70 |
+
[SonarQube Generic Test Data](https://docs.sonarqube.org/latest/analysis/generic-test/) XML format for tests metrics.
|
| 71 |
+
|
| 72 |
+
## Low-level tools
|
| 73 |
+
|
| 74 |
+
### Precompiled headers (PCHs)
|
| 75 |
+
|
| 76 |
+
Catch offers prototypal support for being included in precompiled headers, but because of its single-header nature it does need some actions by the user:
|
| 77 |
+
* The precompiled header needs to define `CATCH_CONFIG_ALL_PARTS`
|
| 78 |
+
* The implementation file needs to
|
| 79 |
+
* undefine `TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED`
|
| 80 |
+
* define `CATCH_CONFIG_IMPL_ONLY`
|
| 81 |
+
* define `CATCH_CONFIG_MAIN` or `CATCH_CONFIG_RUNNER`
|
| 82 |
+
* include "catch.hpp" again
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
### CodeCoverage module (GCOV, LCOV...)
|
| 86 |
+
|
| 87 |
+
If you are using GCOV tool to get testing coverage of your code, and are not sure how to integrate it with CMake and Catch, there should be an external example over at https://github.com/fkromer/catch_cmake_coverage
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
### pkg-config
|
| 91 |
+
|
| 92 |
+
Catch2 provides a rudimentary pkg-config integration, by registering itself
|
| 93 |
+
under the name `catch2`. This means that after Catch2 is installed, you
|
| 94 |
+
can use `pkg-config` to get its include path: `pkg-config --cflags catch2`.
|
| 95 |
+
|
| 96 |
+
### gdb and lldb scripts
|
| 97 |
+
|
| 98 |
+
Catch2's `contrib` folder also contains two simple debugger scripts,
|
| 99 |
+
`gdbinit` for `gdb` and `lldbinit` for `lldb`. If loaded into their
|
| 100 |
+
respective debugger, these will tell it to step over Catch2's internals
|
| 101 |
+
when stepping through code.
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
## CMake
|
| 105 |
+
|
| 106 |
+
[As it has been getting kinda long, the documentation of Catch2's
|
| 107 |
+
integration with CMake has been moved to its own page.](cmake-integration.md#top)
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
---
|
| 111 |
+
|
| 112 |
+
[Home](Readme.md#top)
|
weight/_dep/Catch2/docs/cmake-integration.md
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<a id="top"></a>
|
| 2 |
+
# CMake integration
|
| 3 |
+
|
| 4 |
+
**Contents**<br>
|
| 5 |
+
[CMake target](#cmake-target)<br>
|
| 6 |
+
[Automatic test registration](#automatic-test-registration)<br>
|
| 7 |
+
[CMake project options](#cmake-project-options)<br>
|
| 8 |
+
[Installing Catch2 from git repository](#installing-catch2-from-git-repository)<br>
|
| 9 |
+
[Installing Catch2 from vcpkg](#installing-catch2-from-vcpkg)<br>
|
| 10 |
+
|
| 11 |
+
Because we use CMake to build Catch2, we also provide a couple of
|
| 12 |
+
integration points for our users.
|
| 13 |
+
|
| 14 |
+
1) Catch2 exports a (namespaced) CMake target
|
| 15 |
+
2) Catch2's repository contains CMake scripts for automatic registration
|
| 16 |
+
of `TEST_CASE`s in CTest
|
| 17 |
+
|
| 18 |
+
## CMake target
|
| 19 |
+
|
| 20 |
+
Catch2's CMake build exports an interface target `Catch2::Catch2`. Linking
|
| 21 |
+
against it will add the proper include path and all necessary capabilities
|
| 22 |
+
to the resulting binary.
|
| 23 |
+
|
| 24 |
+
This means that if Catch2 has been installed on the system, it should be
|
| 25 |
+
enough to do:
|
| 26 |
+
```cmake
|
| 27 |
+
find_package(Catch2 REQUIRED)
|
| 28 |
+
target_link_libraries(tests Catch2::Catch2)
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
This target is also provided when Catch2 is used as a subdirectory.
|
| 33 |
+
Assuming that Catch2 has been cloned to `lib/Catch2`:
|
| 34 |
+
```cmake
|
| 35 |
+
add_subdirectory(lib/Catch2)
|
| 36 |
+
target_link_libraries(tests Catch2::Catch2)
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
Another possibility is to use [FetchContent](https://cmake.org/cmake/help/latest/module/FetchContent.html):
|
| 40 |
+
```cmake
|
| 41 |
+
Include(FetchContent)
|
| 42 |
+
|
| 43 |
+
FetchContent_Declare(
|
| 44 |
+
Catch2
|
| 45 |
+
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
| 46 |
+
GIT_TAG v2.13.1)
|
| 47 |
+
|
| 48 |
+
FetchContent_MakeAvailable(Catch2)
|
| 49 |
+
|
| 50 |
+
target_link_libraries(tests Catch2::Catch2)
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
## Automatic test registration
|
| 54 |
+
|
| 55 |
+
Catch2's repository also contains two CMake scripts that help users
|
| 56 |
+
with automatically registering their `TEST_CASE`s with CTest. They
|
| 57 |
+
can be found in the `contrib` folder, and are
|
| 58 |
+
|
| 59 |
+
1) `Catch.cmake` (and its dependency `CatchAddTests.cmake`)
|
| 60 |
+
2) `ParseAndAddCatchTests.cmake` (deprecated)
|
| 61 |
+
|
| 62 |
+
If Catch2 has been installed in system, both of these can be used after
|
| 63 |
+
doing `find_package(Catch2 REQUIRED)`. Otherwise you need to add them
|
| 64 |
+
to your CMake module path.
|
| 65 |
+
|
| 66 |
+
### `Catch.cmake` and `CatchAddTests.cmake`
|
| 67 |
+
|
| 68 |
+
`Catch.cmake` provides function `catch_discover_tests` to get tests from
|
| 69 |
+
a target. This function works by running the resulting executable with
|
| 70 |
+
`--list-test-names-only` flag, and then parsing the output to find all
|
| 71 |
+
existing tests.
|
| 72 |
+
|
| 73 |
+
#### Usage
|
| 74 |
+
```cmake
|
| 75 |
+
cmake_minimum_required(VERSION 3.5)
|
| 76 |
+
|
| 77 |
+
project(baz LANGUAGES CXX VERSION 0.0.1)
|
| 78 |
+
|
| 79 |
+
find_package(Catch2 REQUIRED)
|
| 80 |
+
add_executable(foo test.cpp)
|
| 81 |
+
target_link_libraries(foo Catch2::Catch2)
|
| 82 |
+
|
| 83 |
+
include(CTest)
|
| 84 |
+
include(Catch)
|
| 85 |
+
catch_discover_tests(foo)
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
#### Customization
|
| 90 |
+
`catch_discover_tests` can be given several extra argumets:
|
| 91 |
+
```cmake
|
| 92 |
+
catch_discover_tests(target
|
| 93 |
+
[TEST_SPEC arg1...]
|
| 94 |
+
[EXTRA_ARGS arg1...]
|
| 95 |
+
[WORKING_DIRECTORY dir]
|
| 96 |
+
[TEST_PREFIX prefix]
|
| 97 |
+
[TEST_SUFFIX suffix]
|
| 98 |
+
[PROPERTIES name1 value1...]
|
| 99 |
+
[TEST_LIST var]
|
| 100 |
+
[REPORTER reporter]
|
| 101 |
+
[OUTPUT_DIR dir]
|
| 102 |
+
[OUTPUT_PREFIX prefix]
|
| 103 |
+
[OUTPUT_SUFFIX suffix]
|
| 104 |
+
)
|
| 105 |
+
```
|
| 106 |
+
|
| 107 |
+
* `TEST_SPEC arg1...`
|
| 108 |
+
|
| 109 |
+
Specifies test cases, wildcarded test cases, tags and tag expressions to
|
| 110 |
+
pass to the Catch executable alongside the `--list-test-names-only` flag.
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
* `EXTRA_ARGS arg1...`
|
| 114 |
+
|
| 115 |
+
Any extra arguments to pass on the command line to each test case.
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
* `WORKING_DIRECTORY dir`
|
| 119 |
+
|
| 120 |
+
Specifies the directory in which to run the discovered test cases. If this
|
| 121 |
+
option is not provided, the current binary directory is used.
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
* `TEST_PREFIX prefix`
|
| 125 |
+
|
| 126 |
+
Specifies a _prefix_ to be added to the name of each discovered test case.
|
| 127 |
+
This can be useful when the same test executable is being used in multiple
|
| 128 |
+
calls to `catch_discover_tests()`, with different `TEST_SPEC` or `EXTRA_ARGS`.
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
* `TEST_SUFFIX suffix`
|
| 132 |
+
|
| 133 |
+
Same as `TEST_PREFIX`, except it specific the _suffix_ for the test names.
|
| 134 |
+
Both `TEST_PREFIX` and `TEST_SUFFIX` can be specified at the same time.
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
* `PROPERTIES name1 value1...`
|
| 138 |
+
|
| 139 |
+
Specifies additional properties to be set on all tests discovered by this
|
| 140 |
+
invocation of `catch_discover_tests`.
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
* `TEST_LIST var`
|
| 144 |
+
|
| 145 |
+
Make the list of tests available in the variable `var`, rather than the
|
| 146 |
+
default `<target>_TESTS`. This can be useful when the same test
|
| 147 |
+
executable is being used in multiple calls to `catch_discover_tests()`.
|
| 148 |
+
Note that this variable is only available in CTest.
|
| 149 |
+
|
| 150 |
+
* `REPORTER reporter`
|
| 151 |
+
|
| 152 |
+
Use the specified reporter when running the test case. The reporter will
|
| 153 |
+
be passed to the test runner as `--reporter reporter`.
|
| 154 |
+
|
| 155 |
+
* `OUTPUT_DIR dir`
|
| 156 |
+
|
| 157 |
+
If specified, the parameter is passed along as
|
| 158 |
+
`--out dir/<test_name>` to test executable. The actual file name is the
|
| 159 |
+
same as the test name. This should be used instead of
|
| 160 |
+
`EXTRA_ARGS --out foo` to avoid race conditions writing the result output
|
| 161 |
+
when using parallel test execution.
|
| 162 |
+
|
| 163 |
+
* `OUTPUT_PREFIX prefix`
|
| 164 |
+
|
| 165 |
+
May be used in conjunction with `OUTPUT_DIR`.
|
| 166 |
+
If specified, `prefix` is added to each output file name, like so
|
| 167 |
+
`--out dir/prefix<test_name>`.
|
| 168 |
+
|
| 169 |
+
* `OUTPUT_SUFFIX suffix`
|
| 170 |
+
|
| 171 |
+
May be used in conjunction with `OUTPUT_DIR`.
|
| 172 |
+
If specified, `suffix` is added to each output file name, like so
|
| 173 |
+
`--out dir/<test_name>suffix`. This can be used to add a file extension to
|
| 174 |
+
the output file name e.g. ".xml".
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
### `ParseAndAddCatchTests.cmake`
|
| 178 |
+
|
| 179 |
+
⚠ This script is [deprecated](https://github.com/catchorg/Catch2/pull/2120)
|
| 180 |
+
in Catch 2.13.4 and superseded by the above approach using `catch_discover_tests`.
|
| 181 |
+
See [#2092](https://github.com/catchorg/Catch2/issues/2092) for details.
|
| 182 |
+
|
| 183 |
+
`ParseAndAddCatchTests` works by parsing all implementation files
|
| 184 |
+
associated with the provided target, and registering them via CTest's
|
| 185 |
+
`add_test`. This approach has some limitations, such as the fact that
|
| 186 |
+
commented-out tests will be registered anyway. More serious, only a
|
| 187 |
+
subset of the assertion macros currently available in Catch can be
|
| 188 |
+
detected by this script and tests with any macros that cannot be
|
| 189 |
+
parsed are *silently ignored*.
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
#### Usage
|
| 193 |
+
|
| 194 |
+
```cmake
|
| 195 |
+
cmake_minimum_required(VERSION 3.5)
|
| 196 |
+
|
| 197 |
+
project(baz LANGUAGES CXX VERSION 0.0.1)
|
| 198 |
+
|
| 199 |
+
find_package(Catch2 REQUIRED)
|
| 200 |
+
add_executable(foo test.cpp)
|
| 201 |
+
target_link_libraries(foo Catch2::Catch2)
|
| 202 |
+
|
| 203 |
+
include(CTest)
|
| 204 |
+
include(ParseAndAddCatchTests)
|
| 205 |
+
ParseAndAddCatchTests(foo)
|
| 206 |
+
```
|
| 207 |
+
|
| 208 |
+
|
| 209 |
+
#### Customization
|
| 210 |
+
|
| 211 |
+
`ParseAndAddCatchTests` provides some customization points:
|
| 212 |
+
* `PARSE_CATCH_TESTS_VERBOSE` -- When `ON`, the script prints debug
|
| 213 |
+
messages. Defaults to `OFF`.
|
| 214 |
+
* `PARSE_CATCH_TESTS_NO_HIDDEN_TESTS` -- When `ON`, hidden tests (tests
|
| 215 |
+
tagged with any of `[!hide]`, `[.]` or `[.foo]`) will not be registered.
|
| 216 |
+
Defaults to `OFF`.
|
| 217 |
+
* `PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME` -- When `ON`, adds fixture
|
| 218 |
+
class name to the test name in CTest. Defaults to `ON`.
|
| 219 |
+
* `PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME` -- When `ON`, adds target
|
| 220 |
+
name to the test name in CTest. Defaults to `ON`.
|
| 221 |
+
* `PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS` -- When `ON`, adds test
|
| 222 |
+
file to `CMAKE_CONFIGURE_DEPENDS`. This means that the CMake configuration
|
| 223 |
+
step will be re-ran when the test files change, letting new tests be
|
| 224 |
+
automatically discovered. Defaults to `OFF`.
|
| 225 |
+
|
| 226 |
+
|
| 227 |
+
Optionally, one can specify a launching command to run tests by setting the
|
| 228 |
+
variable `OptionalCatchTestLauncher` before calling `ParseAndAddCatchTests`. For
|
| 229 |
+
instance to run some tests using `MPI` and other sequentially, one can write
|
| 230 |
+
```cmake
|
| 231 |
+
set(OptionalCatchTestLauncher ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${NUMPROC})
|
| 232 |
+
ParseAndAddCatchTests(mpi_foo)
|
| 233 |
+
unset(OptionalCatchTestLauncher)
|
| 234 |
+
ParseAndAddCatchTests(bar)
|
| 235 |
+
```
|
| 236 |
+
|
| 237 |
+
## CMake project options
|
| 238 |
+
|
| 239 |
+
Catch2's CMake project also provides some options for other projects
|
| 240 |
+
that consume it. These are
|
| 241 |
+
|
| 242 |
+
* `CATCH_BUILD_TESTING` -- When `ON`, Catch2's SelfTest project will be
|
| 243 |
+
built. Defaults to `ON`. Note that Catch2 also obeys `BUILD_TESTING` CMake
|
| 244 |
+
variable, so _both_ of them need to be `ON` for the SelfTest to be built,
|
| 245 |
+
and either of them can be set to `OFF` to disable building SelfTest.
|
| 246 |
+
* `CATCH_BUILD_EXAMPLES` -- When `ON`, Catch2's usage examples will be
|
| 247 |
+
built. Defaults to `OFF`.
|
| 248 |
+
* `CATCH_INSTALL_DOCS` -- When `ON`, Catch2's documentation will be
|
| 249 |
+
included in the installation. Defaults to `ON`.
|
| 250 |
+
* `CATCH_INSTALL_HELPERS` -- When `ON`, Catch2's contrib folder will be
|
| 251 |
+
included in the installation. Defaults to `ON`.
|
| 252 |
+
* `BUILD_TESTING` -- When `ON` and the project is not used as a subproject,
|
| 253 |
+
Catch2's test binary will be built. Defaults to `ON`.
|
| 254 |
+
|
| 255 |
+
|
| 256 |
+
## Installing Catch2 from git repository
|
| 257 |
+
|
| 258 |
+
If you cannot install Catch2 from a package manager (e.g. Ubuntu 16.04
|
| 259 |
+
provides catch only in version 1.2.0) you might want to install it from
|
| 260 |
+
the repository instead. Assuming you have enough rights, you can just
|
| 261 |
+
install it to the default location, like so:
|
| 262 |
+
```
|
| 263 |
+
$ git clone https://github.com/catchorg/Catch2.git
|
| 264 |
+
$ cd Catch2
|
| 265 |
+
$ cmake -Bbuild -H. -DBUILD_TESTING=OFF
|
| 266 |
+
$ sudo cmake --build build/ --target install
|
| 267 |
+
```
|
| 268 |
+
|
| 269 |
+
If you do not have superuser rights, you will also need to specify
|
| 270 |
+
[CMAKE_INSTALL_PREFIX](https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html)
|
| 271 |
+
when configuring the build, and then modify your calls to
|
| 272 |
+
[find_package](https://cmake.org/cmake/help/latest/command/find_package.html)
|
| 273 |
+
accordingly.
|
| 274 |
+
|
| 275 |
+
## Installing Catch2 from vcpkg
|
| 276 |
+
|
| 277 |
+
Alternatively, you can build and install Catch2 using [vcpkg](https://github.com/microsoft/vcpkg/) dependency manager:
|
| 278 |
+
```
|
| 279 |
+
git clone https://github.com/Microsoft/vcpkg.git
|
| 280 |
+
cd vcpkg
|
| 281 |
+
./bootstrap-vcpkg.sh
|
| 282 |
+
./vcpkg integrate install
|
| 283 |
+
./vcpkg install catch2
|
| 284 |
+
```
|
| 285 |
+
|
| 286 |
+
The catch2 port in vcpkg is kept up to date by microsoft team members and community contributors.
|
| 287 |
+
If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
|
| 288 |
+
|
| 289 |
+
---
|
| 290 |
+
|
| 291 |
+
[Home](Readme.md#top)
|
weight/_dep/Catch2/docs/command-line.md
ADDED
|
@@ -0,0 +1,421 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<a id="top"></a>
|
| 2 |
+
# Command line
|
| 3 |
+
|
| 4 |
+
**Contents**<br>
|
| 5 |
+
[Specifying which tests to run](#specifying-which-tests-to-run)<br>
|
| 6 |
+
[Choosing a reporter to use](#choosing-a-reporter-to-use)<br>
|
| 7 |
+
[Breaking into the debugger](#breaking-into-the-debugger)<br>
|
| 8 |
+
[Showing results for successful tests](#showing-results-for-successful-tests)<br>
|
| 9 |
+
[Aborting after a certain number of failures](#aborting-after-a-certain-number-of-failures)<br>
|
| 10 |
+
[Listing available tests, tags or reporters](#listing-available-tests-tags-or-reporters)<br>
|
| 11 |
+
[Sending output to a file](#sending-output-to-a-file)<br>
|
| 12 |
+
[Naming a test run](#naming-a-test-run)<br>
|
| 13 |
+
[Eliding assertions expected to throw](#eliding-assertions-expected-to-throw)<br>
|
| 14 |
+
[Make whitespace visible](#make-whitespace-visible)<br>
|
| 15 |
+
[Warnings](#warnings)<br>
|
| 16 |
+
[Reporting timings](#reporting-timings)<br>
|
| 17 |
+
[Load test names to run from a file](#load-test-names-to-run-from-a-file)<br>
|
| 18 |
+
[Just test names](#just-test-names)<br>
|
| 19 |
+
[Specify the order test cases are run](#specify-the-order-test-cases-are-run)<br>
|
| 20 |
+
[Specify a seed for the Random Number Generator](#specify-a-seed-for-the-random-number-generator)<br>
|
| 21 |
+
[Identify framework and version according to the libIdentify standard](#identify-framework-and-version-according-to-the-libidentify-standard)<br>
|
| 22 |
+
[Wait for key before continuing](#wait-for-key-before-continuing)<br>
|
| 23 |
+
[Specify the number of benchmark samples to collect](#specify-the-number-of-benchmark-samples-to-collect)<br>
|
| 24 |
+
[Specify the number of resamples for bootstrapping](#specify-the-number-of-resamples-for-bootstrapping)<br>
|
| 25 |
+
[Specify the confidence-interval for bootstrapping](#specify-the-confidence-interval-for-bootstrapping)<br>
|
| 26 |
+
[Disable statistical analysis of collected benchmark samples](#disable-statistical-analysis-of-collected-benchmark-samples)<br>
|
| 27 |
+
[Specify the amount of time in milliseconds spent on warming up each test](#specify-the-amount-of-time-in-milliseconds-spent-on-warming-up-each-test)<br>
|
| 28 |
+
[Usage](#usage)<br>
|
| 29 |
+
[Specify the section to run](#specify-the-section-to-run)<br>
|
| 30 |
+
[Filenames as tags](#filenames-as-tags)<br>
|
| 31 |
+
[Override output colouring](#override-output-colouring)<br>
|
| 32 |
+
|
| 33 |
+
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.
|
| 34 |
+
Click one of the following links to take you straight to that option - or scroll on to browse the available options.
|
| 35 |
+
|
| 36 |
+
<a href="#specifying-which-tests-to-run"> ` <test-spec> ...`</a><br />
|
| 37 |
+
<a href="#usage"> ` -h, -?, --help`</a><br />
|
| 38 |
+
<a href="#listing-available-tests-tags-or-reporters"> ` -l, --list-tests`</a><br />
|
| 39 |
+
<a href="#listing-available-tests-tags-or-reporters"> ` -t, --list-tags`</a><br />
|
| 40 |
+
<a href="#showing-results-for-successful-tests"> ` -s, --success`</a><br />
|
| 41 |
+
<a href="#breaking-into-the-debugger"> ` -b, --break`</a><br />
|
| 42 |
+
<a href="#eliding-assertions-expected-to-throw"> ` -e, --nothrow`</a><br />
|
| 43 |
+
<a href="#invisibles"> ` -i, --invisibles`</a><br />
|
| 44 |
+
<a href="#sending-output-to-a-file"> ` -o, --out`</a><br />
|
| 45 |
+
<a href="#choosing-a-reporter-to-use"> ` -r, --reporter`</a><br />
|
| 46 |
+
<a href="#naming-a-test-run"> ` -n, --name`</a><br />
|
| 47 |
+
<a href="#aborting-after-a-certain-number-of-failures"> ` -a, --abort`</a><br />
|
| 48 |
+
<a href="#aborting-after-a-certain-number-of-failures"> ` -x, --abortx`</a><br />
|
| 49 |
+
<a href="#warnings"> ` -w, --warn`</a><br />
|
| 50 |
+
<a href="#reporting-timings"> ` -d, --durations`</a><br />
|
| 51 |
+
<a href="#input-file"> ` -f, --input-file`</a><br />
|
| 52 |
+
<a href="#run-section"> ` -c, --section`</a><br />
|
| 53 |
+
<a href="#filenames-as-tags"> ` -#, --filenames-as-tags`</a><br />
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
</br>
|
| 57 |
+
|
| 58 |
+
<a href="#list-test-names-only"> ` --list-test-names-only`</a><br />
|
| 59 |
+
<a href="#listing-available-tests-tags-or-reporters"> ` --list-reporters`</a><br />
|
| 60 |
+
<a href="#order"> ` --order`</a><br />
|
| 61 |
+
<a href="#rng-seed"> ` --rng-seed`</a><br />
|
| 62 |
+
<a href="#libidentify"> ` --libidentify`</a><br />
|
| 63 |
+
<a href="#wait-for-keypress"> ` --wait-for-keypress`</a><br />
|
| 64 |
+
<a href="#benchmark-samples"> ` --benchmark-samples`</a><br />
|
| 65 |
+
<a href="#benchmark-resamples"> ` --benchmark-resamples`</a><br />
|
| 66 |
+
<a href="#benchmark-confidence-interval"> ` --benchmark-confidence-interval`</a><br />
|
| 67 |
+
<a href="#benchmark-no-analysis"> ` --benchmark-no-analysis`</a><br />
|
| 68 |
+
<a href="#benchmark-warmup-time"> ` --benchmark-warmup-time`</a><br />
|
| 69 |
+
<a href="#use-colour"> ` --use-colour`</a><br />
|
| 70 |
+
|
| 71 |
+
</br>
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
<a id="specifying-which-tests-to-run"></a>
|
| 76 |
+
## Specifying which tests to run
|
| 77 |
+
|
| 78 |
+
<pre><test-spec> ...</pre>
|
| 79 |
+
|
| 80 |
+
Test cases, wildcarded test cases, tags and tag expressions are all passed directly as arguments. Tags are distinguished by being enclosed in square brackets.
|
| 81 |
+
|
| 82 |
+
If no test specs are supplied then all test cases, except "hidden" tests, are run.
|
| 83 |
+
A test is hidden by giving it any tag starting with (or just) a period (```.```) - or, in the deprecated case, tagged ```[hide]``` or given name starting with `'./'`. To specify hidden tests from the command line ```[.]``` or ```[hide]``` can be used *regardless of how they were declared*.
|
| 84 |
+
|
| 85 |
+
Specs must be enclosed in quotes if they contain spaces. If they do not contain spaces the quotes are optional.
|
| 86 |
+
|
| 87 |
+
Wildcards consist of the `*` character at the beginning and/or end of test case names and can substitute for any number of any characters (including none).
|
| 88 |
+
|
| 89 |
+
Test specs are case insensitive.
|
| 90 |
+
|
| 91 |
+
If a spec is prefixed with `exclude:` or the `~` character then the pattern matches an exclusion. This means that tests matching the pattern are excluded from the set - even if a prior inclusion spec included them. Subsequent inclusion specs will take precedence, however.
|
| 92 |
+
Inclusions and exclusions are evaluated in left-to-right order.
|
| 93 |
+
|
| 94 |
+
Test case examples:
|
| 95 |
+
|
| 96 |
+
<pre>thisTestOnly Matches the test case called, 'thisTestOnly'
|
| 97 |
+
"this test only" Matches the test case called, 'this test only'
|
| 98 |
+
these* Matches all cases starting with 'these'
|
| 99 |
+
exclude:notThis Matches all tests except, 'notThis'
|
| 100 |
+
~notThis Matches all tests except, 'notThis'
|
| 101 |
+
~*private* Matches all tests except those that contain 'private'
|
| 102 |
+
a* ~ab* abc Matches all tests that start with 'a', except those that
|
| 103 |
+
start with 'ab', except 'abc', which is included
|
| 104 |
+
-# [#somefile] Matches all tests from the file 'somefile.cpp'
|
| 105 |
+
</pre>
|
| 106 |
+
|
| 107 |
+
Names within square brackets are interpreted as tags.
|
| 108 |
+
A series of tags form an AND expression whereas a comma-separated sequence forms an OR expression. e.g.:
|
| 109 |
+
|
| 110 |
+
<pre>[one][two],[three]</pre>
|
| 111 |
+
This matches all tests tagged `[one]` and `[two]`, as well as all tests tagged `[three]`
|
| 112 |
+
|
| 113 |
+
Test names containing special characters, such as `,` or `[` can specify them on the command line using `\`.
|
| 114 |
+
`\` also escapes itself.
|
| 115 |
+
|
| 116 |
+
<a id="choosing-a-reporter-to-use"></a>
|
| 117 |
+
## Choosing a reporter to use
|
| 118 |
+
|
| 119 |
+
<pre>-r, --reporter <reporter></pre>
|
| 120 |
+
|
| 121 |
+
A reporter is an object that formats and structures the output of running tests, and potentially summarises the results. By default a console reporter is used that writes, IDE friendly, textual output. Catch comes bundled with some alternative reporters, but more can be added in client code.<br />
|
| 122 |
+
The bundled reporters are:
|
| 123 |
+
|
| 124 |
+
<pre>-r console
|
| 125 |
+
-r compact
|
| 126 |
+
-r xml
|
| 127 |
+
-r junit
|
| 128 |
+
</pre>
|
| 129 |
+
|
| 130 |
+
The JUnit reporter is an xml format that follows the structure of the JUnit XML Report ANT task, as consumed by a number of third-party tools, including Continuous Integration servers such as Hudson. If not otherwise needed, the standard XML reporter is preferred as this is a streaming reporter, whereas the Junit reporter needs to hold all its results until the end so it can write the overall results into attributes of the root node.
|
| 131 |
+
|
| 132 |
+
<a id="breaking-into-the-debugger"></a>
|
| 133 |
+
## Breaking into the debugger
|
| 134 |
+
<pre>-b, --break</pre>
|
| 135 |
+
|
| 136 |
+
Under most debuggers Catch2 is capable of automatically breaking on a test
|
| 137 |
+
failure. This allows the user to see the current state of the test during
|
| 138 |
+
failure.
|
| 139 |
+
|
| 140 |
+
<a id="showing-results-for-successful-tests"></a>
|
| 141 |
+
## Showing results for successful tests
|
| 142 |
+
<pre>-s, --success</pre>
|
| 143 |
+
|
| 144 |
+
Usually you only want to see reporting for failed tests. Sometimes it's useful to see *all* the output (especially when you don't trust that that test you just added worked first time!).
|
| 145 |
+
To see successful, as well as failing, test results just pass this option. Note that each reporter may treat this option differently. The Junit reporter, for example, logs all results regardless.
|
| 146 |
+
|
| 147 |
+
<a id="aborting-after-a-certain-number-of-failures"></a>
|
| 148 |
+
## Aborting after a certain number of failures
|
| 149 |
+
<pre>-a, --abort
|
| 150 |
+
-x, --abortx [<failure threshold>]
|
| 151 |
+
</pre>
|
| 152 |
+
|
| 153 |
+
If a ```REQUIRE``` assertion fails the test case aborts, but subsequent test cases are still run.
|
| 154 |
+
If a ```CHECK``` assertion fails even the current test case is not aborted.
|
| 155 |
+
|
| 156 |
+
Sometimes this results in a flood of failure messages and you'd rather just see the first few. Specifying ```-a``` or ```--abort``` on its own will abort the whole test run on the first failed assertion of any kind. Use ```-x``` or ```--abortx``` followed by a number to abort after that number of assertion failures.
|
| 157 |
+
|
| 158 |
+
<a id="listing-available-tests-tags-or-reporters"></a>
|
| 159 |
+
## Listing available tests, tags or reporters
|
| 160 |
+
<pre>-l, --list-tests
|
| 161 |
+
-t, --list-tags
|
| 162 |
+
--list-reporters
|
| 163 |
+
</pre>
|
| 164 |
+
|
| 165 |
+
```-l``` or ```--list-tests``` will list all registered tests, along with any tags.
|
| 166 |
+
If one or more test-specs have been supplied too then only the matching tests will be listed.
|
| 167 |
+
|
| 168 |
+
```-t``` or ```--list-tags``` lists all available tags, along with the number of test cases they match. Again, supplying test specs limits the tags that match.
|
| 169 |
+
|
| 170 |
+
```--list-reporters``` lists the available reporters.
|
| 171 |
+
|
| 172 |
+
<a id="sending-output-to-a-file"></a>
|
| 173 |
+
## Sending output to a file
|
| 174 |
+
<pre>-o, --out <filename>
|
| 175 |
+
</pre>
|
| 176 |
+
|
| 177 |
+
Use this option to send all output to a file. By default output is sent to stdout (note that uses of stdout and stderr *from within test cases* are redirected and included in the report - so even stderr will effectively end up on stdout).
|
| 178 |
+
|
| 179 |
+
<a id="naming-a-test-run"></a>
|
| 180 |
+
## Naming a test run
|
| 181 |
+
<pre>-n, --name <name for test run></pre>
|
| 182 |
+
|
| 183 |
+
If a name is supplied it will be used by the reporter to provide an overall name for the test run. This can be useful if you are sending to a file, for example, and need to distinguish different test runs - either from different Catch executables or runs of the same executable with different options. If not supplied the name is defaulted to the name of the executable.
|
| 184 |
+
|
| 185 |
+
<a id="eliding-assertions-expected-to-throw"></a>
|
| 186 |
+
## Eliding assertions expected to throw
|
| 187 |
+
<pre>-e, --nothrow</pre>
|
| 188 |
+
|
| 189 |
+
Skips all assertions that test that an exception is thrown, e.g. ```REQUIRE_THROWS```.
|
| 190 |
+
|
| 191 |
+
These can be a nuisance in certain debugging environments that may break when exceptions are thrown (while this is usually optional for handled exceptions, it can be useful to have enabled if you are trying to track down something unexpected).
|
| 192 |
+
|
| 193 |
+
Sometimes exceptions are expected outside of one of the assertions that tests for them (perhaps thrown and caught within the code-under-test). The whole test case can be skipped when using ```-e``` by marking it with the ```[!throws]``` tag.
|
| 194 |
+
|
| 195 |
+
When running with this option any throw checking assertions are skipped so as not to contribute additional noise. Be careful if this affects the behaviour of subsequent tests.
|
| 196 |
+
|
| 197 |
+
<a id="invisibles"></a>
|
| 198 |
+
## Make whitespace visible
|
| 199 |
+
<pre>-i, --invisibles</pre>
|
| 200 |
+
|
| 201 |
+
If a string comparison fails due to differences in whitespace - especially leading or trailing whitespace - it can be hard to see what's going on.
|
| 202 |
+
This option transforms tabs and newline characters into ```\t``` and ```\n``` respectively when printing.
|
| 203 |
+
|
| 204 |
+
<a id="warnings"></a>
|
| 205 |
+
## Warnings
|
| 206 |
+
<pre>-w, --warn <warning name></pre>
|
| 207 |
+
|
| 208 |
+
Enables reporting of suspicious test states. There are currently two
|
| 209 |
+
available warnings
|
| 210 |
+
|
| 211 |
+
```
|
| 212 |
+
NoAssertions // Fail test case / leaf section if no assertions
|
| 213 |
+
// (e.g. `REQUIRE`) is encountered.
|
| 214 |
+
NoTests // Return non-zero exit code when no test cases were run
|
| 215 |
+
// Also calls reporter's noMatchingTestCases method
|
| 216 |
+
```
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
<a id="reporting-timings"></a>
|
| 220 |
+
## Reporting timings
|
| 221 |
+
<pre>-d, --durations <yes/no></pre>
|
| 222 |
+
|
| 223 |
+
When set to ```yes``` Catch will report the duration of each test case, in milliseconds. Note that it does this regardless of whether a test case passes or fails. Note, also, the certain reporters (e.g. Junit) always report test case durations regardless of this option being set or not.
|
| 224 |
+
|
| 225 |
+
<pre>-D, --min-duration <value></pre>
|
| 226 |
+
|
| 227 |
+
> `--min-duration` was [introduced](https://github.com/catchorg/Catch2/pull/1910) in Catch 2.13.0
|
| 228 |
+
|
| 229 |
+
When set, Catch will report the duration of each test case that took more
|
| 230 |
+
than <value> seconds, in milliseconds. This option is overriden by both
|
| 231 |
+
`-d yes` and `-d no`, so that either all durations are reported, or none
|
| 232 |
+
are.
|
| 233 |
+
|
| 234 |
+
|
| 235 |
+
<a id="input-file"></a>
|
| 236 |
+
## Load test names to run from a file
|
| 237 |
+
<pre>-f, --input-file <filename></pre>
|
| 238 |
+
|
| 239 |
+
Provide the name of a file that contains a list of test case names - one per line. Blank lines are skipped and anything after the comment character, ```#```, is ignored.
|
| 240 |
+
|
| 241 |
+
A useful way to generate an initial instance of this file is to use the <a href="#list-test-names-only">list-test-names-only</a> option. This can then be manually curated to specify a specific subset of tests - or in a specific order.
|
| 242 |
+
|
| 243 |
+
<a id="list-test-names-only"></a>
|
| 244 |
+
## Just test names
|
| 245 |
+
<pre>--list-test-names-only</pre>
|
| 246 |
+
|
| 247 |
+
This option lists all available tests in a non-indented form, one on each line. This makes it ideal for saving to a file and feeding back into the <a href="#input-file">```-f``` or ```--input-file```</a> option.
|
| 248 |
+
|
| 249 |
+
|
| 250 |
+
<a id="order"></a>
|
| 251 |
+
## Specify the order test cases are run
|
| 252 |
+
<pre>--order <decl|lex|rand></pre>
|
| 253 |
+
|
| 254 |
+
Test cases are ordered one of three ways:
|
| 255 |
+
|
| 256 |
+
### decl
|
| 257 |
+
Declaration order (this is the default order if no --order argument is provided).
|
| 258 |
+
Tests in the same TU are sorted using their declaration orders, different
|
| 259 |
+
TUs are in an implementation (linking) dependent order.
|
| 260 |
+
|
| 261 |
+
|
| 262 |
+
### lex
|
| 263 |
+
Lexicographic order. Tests are sorted by their name, their tags are ignored.
|
| 264 |
+
|
| 265 |
+
|
| 266 |
+
### rand
|
| 267 |
+
|
| 268 |
+
Randomly sorted. The order is dependent on Catch2's random seed (see
|
| 269 |
+
[`--rng-seed`](#rng-seed)), and is subset invariant. What this means
|
| 270 |
+
is that as long as the random seed is fixed, running only some tests
|
| 271 |
+
(e.g. via tag) does not change their relative order.
|
| 272 |
+
|
| 273 |
+
> The subset stability was introduced in Catch2 v2.12.0
|
| 274 |
+
|
| 275 |
+
|
| 276 |
+
<a id="rng-seed"></a>
|
| 277 |
+
## Specify a seed for the Random Number Generator
|
| 278 |
+
<pre>--rng-seed <'time'|number></pre>
|
| 279 |
+
|
| 280 |
+
Sets a seed for the random number generator using ```std::srand()```.
|
| 281 |
+
If a number is provided this is used directly as the seed so the random pattern is repeatable.
|
| 282 |
+
Alternatively if the keyword ```time``` is provided then the result of calling ```std::time(0)``` is used and so the pattern becomes unpredictable. In some cases, you might need to pass the keyword ```time``` in double quotes instead of single quotes.
|
| 283 |
+
|
| 284 |
+
In either case the actual value for the seed is printed as part of Catch's output so if an issue is discovered that is sensitive to test ordering the ordering can be reproduced - even if it was originally seeded from ```std::time(0)```.
|
| 285 |
+
|
| 286 |
+
<a id="libidentify"></a>
|
| 287 |
+
## Identify framework and version according to the libIdentify standard
|
| 288 |
+
<pre>--libidentify</pre>
|
| 289 |
+
|
| 290 |
+
See [The LibIdentify repo for more information and examples](https://github.com/janwilmans/LibIdentify).
|
| 291 |
+
|
| 292 |
+
<a id="wait-for-keypress"></a>
|
| 293 |
+
## Wait for key before continuing
|
| 294 |
+
<pre>--wait-for-keypress <never|start|exit|both></pre>
|
| 295 |
+
|
| 296 |
+
Will cause the executable to print a message and wait until the return/ enter key is pressed before continuing -
|
| 297 |
+
either before running any tests, after running all tests - or both, depending on the argument.
|
| 298 |
+
|
| 299 |
+
<a id="benchmark-samples"></a>
|
| 300 |
+
## Specify the number of benchmark samples to collect
|
| 301 |
+
<pre>--benchmark-samples <# of samples></pre>
|
| 302 |
+
|
| 303 |
+
> [Introduced](https://github.com/catchorg/Catch2/issues/1616) in Catch 2.9.0.
|
| 304 |
+
|
| 305 |
+
When running benchmarks a number of "samples" is collected. This is the base data for later statistical analysis.
|
| 306 |
+
Per sample a clock resolution dependent number of iterations of the user code is run, which is independent of the number of samples. Defaults to 100.
|
| 307 |
+
|
| 308 |
+
<a id="benchmark-resamples"></a>
|
| 309 |
+
## Specify the number of resamples for bootstrapping
|
| 310 |
+
<pre>--benchmark-resamples <# of resamples></pre>
|
| 311 |
+
|
| 312 |
+
> [Introduced](https://github.com/catchorg/Catch2/issues/1616) in Catch 2.9.0.
|
| 313 |
+
|
| 314 |
+
After the measurements are performed, statistical [bootstrapping] is performed
|
| 315 |
+
on the samples. The number of resamples for that bootstrapping is configurable
|
| 316 |
+
but defaults to 100000. Due to the bootstrapping it is possible to give
|
| 317 |
+
estimates for the mean and standard deviation. The estimates come with a lower
|
| 318 |
+
bound and an upper bound, and the confidence interval (which is configurable but
|
| 319 |
+
defaults to 95%).
|
| 320 |
+
|
| 321 |
+
[bootstrapping]: http://en.wikipedia.org/wiki/Bootstrapping_%28statistics%29
|
| 322 |
+
|
| 323 |
+
<a id="benchmark-confidence-interval"></a>
|
| 324 |
+
## Specify the confidence-interval for bootstrapping
|
| 325 |
+
<pre>--benchmark-confidence-interval <confidence-interval></pre>
|
| 326 |
+
|
| 327 |
+
> [Introduced](https://github.com/catchorg/Catch2/issues/1616) in Catch 2.9.0.
|
| 328 |
+
|
| 329 |
+
The confidence-interval is used for statistical bootstrapping on the samples to
|
| 330 |
+
calculate the upper and lower bounds of mean and standard deviation.
|
| 331 |
+
Must be between 0 and 1 and defaults to 0.95.
|
| 332 |
+
|
| 333 |
+
<a id="benchmark-no-analysis"></a>
|
| 334 |
+
## Disable statistical analysis of collected benchmark samples
|
| 335 |
+
<pre>--benchmark-no-analysis</pre>
|
| 336 |
+
|
| 337 |
+
> [Introduced](https://github.com/catchorg/Catch2/issues/1616) in Catch 2.9.0.
|
| 338 |
+
|
| 339 |
+
When this flag is specified no bootstrapping or any other statistical analysis is performed.
|
| 340 |
+
Instead the user code is only measured and the plain mean from the samples is reported.
|
| 341 |
+
|
| 342 |
+
<a id="benchmark-warmup-time"></a>
|
| 343 |
+
## Specify the amount of time in milliseconds spent on warming up each test
|
| 344 |
+
<pre>--benchmark-warmup-time</pre>
|
| 345 |
+
|
| 346 |
+
> [Introduced](https://github.com/catchorg/Catch2/pull/1844) in Catch 2.11.2.
|
| 347 |
+
|
| 348 |
+
Configure the amount of time spent warming up each test.
|
| 349 |
+
|
| 350 |
+
<a id="usage"></a>
|
| 351 |
+
## Usage
|
| 352 |
+
<pre>-h, -?, --help</pre>
|
| 353 |
+
|
| 354 |
+
Prints the command line arguments to stdout
|
| 355 |
+
|
| 356 |
+
|
| 357 |
+
<a id="run-section"></a>
|
| 358 |
+
## Specify the section to run
|
| 359 |
+
<pre>-c, --section <section name></pre>
|
| 360 |
+
|
| 361 |
+
To limit execution to a specific section within a test case, use this option one or more times.
|
| 362 |
+
To narrow to sub-sections use multiple instances, where each subsequent instance specifies a deeper nesting level.
|
| 363 |
+
|
| 364 |
+
E.g. if you have:
|
| 365 |
+
|
| 366 |
+
<pre>
|
| 367 |
+
TEST_CASE( "Test" ) {
|
| 368 |
+
SECTION( "sa" ) {
|
| 369 |
+
SECTION( "sb" ) {
|
| 370 |
+
/*...*/
|
| 371 |
+
}
|
| 372 |
+
SECTION( "sc" ) {
|
| 373 |
+
/*...*/
|
| 374 |
+
}
|
| 375 |
+
}
|
| 376 |
+
SECTION( "sd" ) {
|
| 377 |
+
/*...*/
|
| 378 |
+
}
|
| 379 |
+
}
|
| 380 |
+
</pre>
|
| 381 |
+
|
| 382 |
+
Then you can run `sb` with:
|
| 383 |
+
<pre>./MyExe Test -c sa -c sb</pre>
|
| 384 |
+
|
| 385 |
+
Or run just `sd` with:
|
| 386 |
+
<pre>./MyExe Test -c sd</pre>
|
| 387 |
+
|
| 388 |
+
To run all of `sa`, including `sb` and `sc` use:
|
| 389 |
+
<pre>./MyExe Test -c sa</pre>
|
| 390 |
+
|
| 391 |
+
There are some limitations of this feature to be aware of:
|
| 392 |
+
- Code outside of sections being skipped will still be executed - e.g. any set-up code in the TEST_CASE before the
|
| 393 |
+
start of the first section.</br>
|
| 394 |
+
- At time of writing, wildcards are not supported in section names.
|
| 395 |
+
- If you specify a section without narrowing to a test case first then all test cases will be executed
|
| 396 |
+
(but only matching sections within them).
|
| 397 |
+
|
| 398 |
+
|
| 399 |
+
<a id="filenames-as-tags"></a>
|
| 400 |
+
## Filenames as tags
|
| 401 |
+
<pre>-#, --filenames-as-tags</pre>
|
| 402 |
+
|
| 403 |
+
When this option is used then every test is given an additional tag which is formed of the unqualified
|
| 404 |
+
filename it is found in, with any extension stripped, prefixed with the `#` character.
|
| 405 |
+
|
| 406 |
+
So, for example, tests within the file `~\Dev\MyProject\Ferrets.cpp` would be tagged `[#Ferrets]`.
|
| 407 |
+
|
| 408 |
+
<a id="use-colour"></a>
|
| 409 |
+
## Override output colouring
|
| 410 |
+
<pre>--use-colour <yes|no|auto></pre>
|
| 411 |
+
|
| 412 |
+
Catch colours output for terminals, but omits colouring when it detects that
|
| 413 |
+
output is being sent to a pipe. This is done to avoid interfering with automated
|
| 414 |
+
processing of output.
|
| 415 |
+
|
| 416 |
+
`--use-colour yes` forces coloured output, `--use-colour no` disables coloured
|
| 417 |
+
output. The default behaviour is `--use-colour auto`.
|
| 418 |
+
|
| 419 |
+
---
|
| 420 |
+
|
| 421 |
+
[Home](Readme.md#top)
|
weight/_dep/Catch2/docs/commercial-users.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<a id="top"></a>
|
| 2 |
+
# Commercial users of Catch
|
| 3 |
+
|
| 4 |
+
As well as [Open Source](opensource-users.md#top) users Catch is widely used within proprietary code bases too.
|
| 5 |
+
Many organisations like to keep this information internal, and that's fine,
|
| 6 |
+
but if you're more open it would be great if we could list the names of as
|
| 7 |
+
many organisations as possible that use Catch somewhere in their codebase.
|
| 8 |
+
Enterprise environments often tend to be far more conservative in their tool adoption -
|
| 9 |
+
and being aware that other companies are using Catch can ease the path in.
|
| 10 |
+
|
| 11 |
+
So if you are aware of Catch usage in your organisation, and are fairly confident there is no issue with sharing this
|
| 12 |
+
fact then please let us know - either directly, via a PR or
|
| 13 |
+
[issue](https://github.com/philsquared/Catch/issues), or on the [forums](https://groups.google.com/forum/?fromgroups#!forum/catch-forum).
|
| 14 |
+
|
| 15 |
+
- Bloomberg
|
| 16 |
+
- [Bloomlife](https://bloomlife.com)
|
| 17 |
+
- NASA
|
| 18 |
+
- [Inscopix Inc.](https://www.inscopix.com/)
|
| 19 |
+
- [Makimo](https://makimo.pl/)
|
| 20 |
+
- [UX3D](https://ux3d.io)
|
| 21 |
+
- [King](https://king.com)
|
| 22 |
+
|
weight/_dep/Catch2/docs/configuration.md
ADDED
|
@@ -0,0 +1,275 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<a id="top"></a>
|
| 2 |
+
# Compile-time configuration
|
| 3 |
+
|
| 4 |
+
**Contents**<br>
|
| 5 |
+
[main()/ implementation](#main-implementation)<br>
|
| 6 |
+
[Reporter / Listener interfaces](#reporter--listener-interfaces)<br>
|
| 7 |
+
[Prefixing Catch macros](#prefixing-catch-macros)<br>
|
| 8 |
+
[Terminal colour](#terminal-colour)<br>
|
| 9 |
+
[Console width](#console-width)<br>
|
| 10 |
+
[stdout](#stdout)<br>
|
| 11 |
+
[Fallback stringifier](#fallback-stringifier)<br>
|
| 12 |
+
[Default reporter](#default-reporter)<br>
|
| 13 |
+
[C++11 toggles](#c11-toggles)<br>
|
| 14 |
+
[C++17 toggles](#c17-toggles)<br>
|
| 15 |
+
[Other toggles](#other-toggles)<br>
|
| 16 |
+
[Windows header clutter](#windows-header-clutter)<br>
|
| 17 |
+
[Enabling stringification](#enabling-stringification)<br>
|
| 18 |
+
[Disabling exceptions](#disabling-exceptions)<br>
|
| 19 |
+
[Overriding Catch's debug break (`-b`)](#overriding-catchs-debug-break--b)<br>
|
| 20 |
+
|
| 21 |
+
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```).
|
| 22 |
+
|
| 23 |
+
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.
|
| 24 |
+
|
| 25 |
+
## main()/ implementation
|
| 26 |
+
|
| 27 |
+
CATCH_CONFIG_MAIN // Designates this as implementation file and defines main()
|
| 28 |
+
CATCH_CONFIG_RUNNER // Designates this as implementation file
|
| 29 |
+
|
| 30 |
+
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*.
|
| 31 |
+
|
| 32 |
+
## Reporter / Listener interfaces
|
| 33 |
+
|
| 34 |
+
CATCH_CONFIG_EXTERNAL_INTERFACES // Brings in necessary headers for Reporter/Listener implementation
|
| 35 |
+
|
| 36 |
+
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.
|
| 37 |
+
|
| 38 |
+
Implied by both `CATCH_CONFIG_MAIN` and `CATCH_CONFIG_RUNNER`.
|
| 39 |
+
|
| 40 |
+
## Prefixing Catch macros
|
| 41 |
+
|
| 42 |
+
CATCH_CONFIG_PREFIX_ALL
|
| 43 |
+
|
| 44 |
+
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```).
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
## Terminal colour
|
| 48 |
+
|
| 49 |
+
CATCH_CONFIG_COLOUR_NONE // completely disables all text colouring
|
| 50 |
+
CATCH_CONFIG_COLOUR_WINDOWS // forces the Win32 console API to be used
|
| 51 |
+
CATCH_CONFIG_COLOUR_ANSI // forces ANSI colour codes to be used
|
| 52 |
+
|
| 53 |
+
Yes, I am English, so I will continue to spell "colour" with a 'u'.
|
| 54 |
+
|
| 55 |
+
When sending output to the terminal, if it detects that it can, Catch will use colourised text. On Windows the Win32 API, ```SetConsoleTextAttribute```, is used. On POSIX systems ANSI colour escape codes are inserted into the stream.
|
| 56 |
+
|
| 57 |
+
For finer control you can define one of the above identifiers (these are mutually exclusive - but that is not checked so may behave unexpectedly if you mix them):
|
| 58 |
+
|
| 59 |
+
Note that when ANSI colour codes are used "unistd.h" must be includable - along with a definition of ```isatty()```
|
| 60 |
+
|
| 61 |
+
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.
|
| 62 |
+
|
| 63 |
+
## Console width
|
| 64 |
+
|
| 65 |
+
CATCH_CONFIG_CONSOLE_WIDTH = x // where x is a number
|
| 66 |
+
|
| 67 |
+
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.
|
| 68 |
+
By default a console width of 80 is assumed but this can be controlled by defining the above identifier to be a different value.
|
| 69 |
+
|
| 70 |
+
## stdout
|
| 71 |
+
|
| 72 |
+
CATCH_CONFIG_NOSTDOUT
|
| 73 |
+
|
| 74 |
+
To support platforms that do not provide `std::cout`, `std::cerr` and
|
| 75 |
+
`std::clog`, Catch does not usem the directly, but rather calls
|
| 76 |
+
`Catch::cout`, `Catch::cerr` and `Catch::clog`. You can replace their
|
| 77 |
+
implementation by defining `CATCH_CONFIG_NOSTDOUT` and implementing
|
| 78 |
+
them yourself, their signatures are:
|
| 79 |
+
|
| 80 |
+
std::ostream& cout();
|
| 81 |
+
std::ostream& cerr();
|
| 82 |
+
std::ostream& clog();
|
| 83 |
+
|
| 84 |
+
[You can see an example of replacing these functions here.](
|
| 85 |
+
../examples/231-Cfg-OutputStreams.cpp)
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
## Fallback stringifier
|
| 89 |
+
|
| 90 |
+
By default, when Catch's stringification machinery has to stringify
|
| 91 |
+
a type that does not specialize `StringMaker`, does not overload `operator<<`,
|
| 92 |
+
is not an enumeration and is not a range, it uses `"{?}"`. This can be
|
| 93 |
+
overridden by defining `CATCH_CONFIG_FALLBACK_STRINGIFIER` to name of a
|
| 94 |
+
function that should perform the stringification instead.
|
| 95 |
+
|
| 96 |
+
All types that do not provide `StringMaker` specialization or `operator<<`
|
| 97 |
+
overload will be sent to this function (this includes enums and ranges).
|
| 98 |
+
The provided function must return `std::string` and must accept any type,
|
| 99 |
+
e.g. via overloading.
|
| 100 |
+
|
| 101 |
+
_Note that if the provided function does not handle a type and this type
|
| 102 |
+
requires to be stringified, the compilation will fail._
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
## Default reporter
|
| 106 |
+
|
| 107 |
+
Catch's default reporter can be changed by defining macro
|
| 108 |
+
`CATCH_CONFIG_DEFAULT_REPORTER` to string literal naming the desired
|
| 109 |
+
default reporter.
|
| 110 |
+
|
| 111 |
+
This means that defining `CATCH_CONFIG_DEFAULT_REPORTER` to `"console"`
|
| 112 |
+
is equivalent with the out-of-the-box experience.
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
## C++11 toggles
|
| 116 |
+
|
| 117 |
+
CATCH_CONFIG_CPP11_TO_STRING // Use `std::to_string`
|
| 118 |
+
|
| 119 |
+
Because we support platforms whose standard library does not contain
|
| 120 |
+
`std::to_string`, it is possible to force Catch to use a workaround
|
| 121 |
+
based on `std::stringstream`. On platforms other than Android,
|
| 122 |
+
the default is to use `std::to_string`. On Android, the default is to
|
| 123 |
+
use the `stringstream` workaround. As always, it is possible to override
|
| 124 |
+
Catch's selection, by defining either `CATCH_CONFIG_CPP11_TO_STRING` or
|
| 125 |
+
`CATCH_CONFIG_NO_CPP11_TO_STRING`.
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
## C++17 toggles
|
| 129 |
+
|
| 130 |
+
CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS // Use std::uncaught_exceptions instead of std::uncaught_exception
|
| 131 |
+
CATCH_CONFIG_CPP17_STRING_VIEW // Override std::string_view support detection(Catch provides a StringMaker specialization by default)
|
| 132 |
+
CATCH_CONFIG_CPP17_VARIANT // Override std::variant support detection (checked by CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER)
|
| 133 |
+
CATCH_CONFIG_CPP17_OPTIONAL // Override std::optional support detection (checked by CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER)
|
| 134 |
+
CATCH_CONFIG_CPP17_BYTE // Override std::byte support detection (Catch provides a StringMaker specialization by default)
|
| 135 |
+
|
| 136 |
+
> `CATCH_CONFIG_CPP17_STRING_VIEW` was [introduced](https://github.com/catchorg/Catch2/issues/1376) in Catch 2.4.1.
|
| 137 |
+
|
| 138 |
+
Catch contains basic compiler/standard detection and attempts to use
|
| 139 |
+
some C++17 features whenever appropriate. This automatic detection
|
| 140 |
+
can be manually overridden in both directions, that is, a feature
|
| 141 |
+
can be enabled by defining the macro in the table above, and disabled
|
| 142 |
+
by using `_NO_` in the macro, e.g. `CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS`.
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
## Other toggles
|
| 146 |
+
|
| 147 |
+
CATCH_CONFIG_COUNTER // Use __COUNTER__ to generate unique names for test cases
|
| 148 |
+
CATCH_CONFIG_WINDOWS_SEH // Enable SEH handling on Windows
|
| 149 |
+
CATCH_CONFIG_FAST_COMPILE // Sacrifices some (rather minor) features for compilation speed
|
| 150 |
+
CATCH_CONFIG_DISABLE_MATCHERS // Do not compile Matchers in this compilation unit
|
| 151 |
+
CATCH_CONFIG_POSIX_SIGNALS // Enable handling POSIX signals
|
| 152 |
+
CATCH_CONFIG_WINDOWS_CRTDBG // Enable leak checking using Windows's CRT Debug Heap
|
| 153 |
+
CATCH_CONFIG_DISABLE_STRINGIFICATION // Disable stringifying the original expression
|
| 154 |
+
CATCH_CONFIG_DISABLE // Disables assertions and test case registration
|
| 155 |
+
CATCH_CONFIG_WCHAR // Enables use of wchart_t
|
| 156 |
+
CATCH_CONFIG_EXPERIMENTAL_REDIRECT // Enables the new (experimental) way of capturing stdout/stderr
|
| 157 |
+
CATCH_CONFIG_ENABLE_BENCHMARKING // Enables the integrated benchmarking features (has a significant effect on compilation speed)
|
| 158 |
+
CATCH_CONFIG_USE_ASYNC // Force parallel statistical processing of samples during benchmarking
|
| 159 |
+
CATCH_CONFIG_ANDROID_LOGWRITE // Use android's logging system for debug output
|
| 160 |
+
CATCH_CONFIG_GLOBAL_NEXTAFTER // Use nextafter{,f,l} instead of std::nextafter
|
| 161 |
+
|
| 162 |
+
> [`CATCH_CONFIG_ANDROID_LOGWRITE`](https://github.com/catchorg/Catch2/issues/1743) and [`CATCH_CONFIG_GLOBAL_NEXTAFTER`](https://github.com/catchorg/Catch2/pull/1739) were introduced in Catch 2.10.0
|
| 163 |
+
|
| 164 |
+
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.
|
| 165 |
+
|
| 166 |
+
`CATCH_CONFIG_POSIX_SIGNALS` is on by default, except when Catch is compiled under `Cygwin`, where it is disabled by default (but can be force-enabled by defining `CATCH_CONFIG_POSIX_SIGNALS`).
|
| 167 |
+
|
| 168 |
+
`CATCH_CONFIG_WINDOWS_CRTDBG` is off by default. If enabled, Windows's CRT is used to check for memory leaks, and displays them after the tests finish running.
|
| 169 |
+
|
| 170 |
+
`CATCH_CONFIG_WCHAR` is on by default, but can be disabled. Currently
|
| 171 |
+
it is only used in support for DJGPP cross-compiler.
|
| 172 |
+
|
| 173 |
+
With the exception of `CATCH_CONFIG_EXPERIMENTAL_REDIRECT`,
|
| 174 |
+
these toggles can be disabled by using `_NO_` form of the toggle,
|
| 175 |
+
e.g. `CATCH_CONFIG_NO_WINDOWS_SEH`.
|
| 176 |
+
|
| 177 |
+
### `CATCH_CONFIG_FAST_COMPILE`
|
| 178 |
+
This compile-time flag speeds up compilation of assertion macros by ~20%,
|
| 179 |
+
by disabling the generation of assertion-local try-catch blocks for
|
| 180 |
+
non-exception family of assertion macros ({`REQUIRE`,`CHECK`}{``,`_FALSE`, `_THAT`}).
|
| 181 |
+
This disables translation of exceptions thrown under these assertions, but
|
| 182 |
+
should not lead to false negatives.
|
| 183 |
+
|
| 184 |
+
`CATCH_CONFIG_FAST_COMPILE` has to be either defined, or not defined,
|
| 185 |
+
in all translation units that are linked into single test binary.
|
| 186 |
+
|
| 187 |
+
### `CATCH_CONFIG_DISABLE_MATCHERS`
|
| 188 |
+
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.
|
| 189 |
+
|
| 190 |
+
_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._
|
| 191 |
+
|
| 192 |
+
### `CATCH_CONFIG_DISABLE_STRINGIFICATION`
|
| 193 |
+
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).
|
| 194 |
+
|
| 195 |
+
### `CATCH_CONFIG_DISABLE`
|
| 196 |
+
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.
|
| 197 |
+
|
| 198 |
+
This feature is considered experimental and might change at any point.
|
| 199 |
+
|
| 200 |
+
_Inspired by Doctest's `DOCTEST_CONFIG_DISABLE`_
|
| 201 |
+
|
| 202 |
+
## Windows header clutter
|
| 203 |
+
|
| 204 |
+
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:
|
| 205 |
+
|
| 206 |
+
CATCH_CONFIG_NO_NOMINMAX // Stops Catch from using NOMINMAX macro
|
| 207 |
+
CATCH_CONFIG_NO_WIN32_LEAN_AND_MEAN // Stops Catch from using WIN32_LEAN_AND_MEAN macro
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
## Enabling stringification
|
| 211 |
+
|
| 212 |
+
By default, Catch does not stringify some types from the standard library. This is done to avoid dragging in various standard library headers by default. However, Catch does contain these and can be configured to provide them, using these macros:
|
| 213 |
+
|
| 214 |
+
CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER // Provide StringMaker specialization for std::pair
|
| 215 |
+
CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER // Provide StringMaker specialization for std::tuple
|
| 216 |
+
CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER // Provide StringMaker specialization for std::chrono::duration, std::chrono::timepoint
|
| 217 |
+
CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER // Provide StringMaker specialization for std::variant, std::monostate (on C++17)
|
| 218 |
+
CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER // Provide StringMaker specialization for std::optional (on C++17)
|
| 219 |
+
CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS // Defines all of the above
|
| 220 |
+
|
| 221 |
+
> `CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER` was [introduced](https://github.com/catchorg/Catch2/issues/1380) in Catch 2.4.1.
|
| 222 |
+
|
| 223 |
+
> `CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER` was [introduced](https://github.com/catchorg/Catch2/issues/1510) in Catch 2.6.0.
|
| 224 |
+
|
| 225 |
+
## Disabling exceptions
|
| 226 |
+
|
| 227 |
+
> Introduced in Catch 2.4.0.
|
| 228 |
+
|
| 229 |
+
By default, Catch2 uses exceptions to signal errors and to abort tests
|
| 230 |
+
when an assertion from the `REQUIRE` family of assertions fails. We also
|
| 231 |
+
provide an experimental support for disabling exceptions. Catch2 should
|
| 232 |
+
automatically detect when it is compiled with exceptions disabled, but
|
| 233 |
+
it can be forced to compile without exceptions by defining
|
| 234 |
+
|
| 235 |
+
CATCH_CONFIG_DISABLE_EXCEPTIONS
|
| 236 |
+
|
| 237 |
+
Note that when using Catch2 without exceptions, there are 2 major
|
| 238 |
+
limitations:
|
| 239 |
+
|
| 240 |
+
1) If there is an error that would normally be signalled by an exception,
|
| 241 |
+
the exception's message will instead be written to `Catch::cerr` and
|
| 242 |
+
`std::terminate` will be called.
|
| 243 |
+
2) If an assertion from the `REQUIRE` family of macros fails,
|
| 244 |
+
`std::terminate` will be called after the active reporter returns.
|
| 245 |
+
|
| 246 |
+
|
| 247 |
+
There is also a customization point for the exact behaviour of what
|
| 248 |
+
happens instead of exception being thrown. To use it, define
|
| 249 |
+
|
| 250 |
+
CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER
|
| 251 |
+
|
| 252 |
+
and provide a definition for this function:
|
| 253 |
+
|
| 254 |
+
```cpp
|
| 255 |
+
namespace Catch {
|
| 256 |
+
[[noreturn]]
|
| 257 |
+
void throw_exception(std::exception const&);
|
| 258 |
+
}
|
| 259 |
+
```
|
| 260 |
+
|
| 261 |
+
## Overriding Catch's debug break (`-b`)
|
| 262 |
+
|
| 263 |
+
> [Introduced](https://github.com/catchorg/Catch2/pull/1846) in Catch 2.11.2.
|
| 264 |
+
|
| 265 |
+
You can override Catch2's break-into-debugger code by defining the
|
| 266 |
+
`CATCH_BREAK_INTO_DEBUGGER()` macro. This can be used if e.g. Catch2 does
|
| 267 |
+
not know your platform, or your platform is misdetected.
|
| 268 |
+
|
| 269 |
+
The macro will be used as is, that is, `CATCH_BREAK_INTO_DEBUGGER();`
|
| 270 |
+
must compile and must break into debugger.
|
| 271 |
+
|
| 272 |
+
|
| 273 |
+
---
|
| 274 |
+
|
| 275 |
+
[Home](Readme.md#top)
|
weight/_dep/Catch2/docs/contributing.md
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<a id="top"></a>
|
| 2 |
+
# Contributing to Catch2
|
| 3 |
+
|
| 4 |
+
**Contents**<br>
|
| 5 |
+
[Using Git(Hub)](#using-github)<br>
|
| 6 |
+
[Testing your changes](#testing-your-changes)<br>
|
| 7 |
+
[Writing documentation](#writing-documentation)<br>
|
| 8 |
+
[Writing code](#writing-code)<br>
|
| 9 |
+
[CoC](#coc)<br>
|
| 10 |
+
|
| 11 |
+
So you want to contribute something to Catch2? That's great! Whether it's
|
| 12 |
+
a bug fix, a new feature, support for additional compilers - or just
|
| 13 |
+
a fix to the documentation - all contributions are very welcome and very
|
| 14 |
+
much appreciated. Of course so are bug reports, other comments, and
|
| 15 |
+
questions, but generally it is a better idea to ask questions in our
|
| 16 |
+
[Discord](https://discord.gg/4CWS9zD), than in the issue tracker.
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
This page covers some guidelines and helpful tips for contributing
|
| 20 |
+
to the codebase itself.
|
| 21 |
+
|
| 22 |
+
## Using Git(Hub)
|
| 23 |
+
|
| 24 |
+
Ongoing development happens in the `v2.x` branch for Catch2 v2, and in
|
| 25 |
+
`devel` for the next major version, v3.
|
| 26 |
+
|
| 27 |
+
Commits should be small and atomic. A commit is atomic when, after it is
|
| 28 |
+
applied, the codebase, tests and all, still works as expected. Small
|
| 29 |
+
commits are also preferred, as they make later operations with git history,
|
| 30 |
+
whether it is bisecting, reverting, or something else, easier.
|
| 31 |
+
|
| 32 |
+
_When submitting a pull request please do not include changes to the
|
| 33 |
+
single include. This means do not include them in your git commits!_
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
When addressing review comments in a MR, please do not rebase/squash the
|
| 37 |
+
commits immediately. Doing so makes it harder to review the new changes,
|
| 38 |
+
slowing down the process of merging a MR. Instead, when addressing review
|
| 39 |
+
comments, you should append new commits to the branch and only squash
|
| 40 |
+
them into other commits when the MR is ready to be merged. We recommend
|
| 41 |
+
creating new commits with `git commit --fixup` (or `--squash`) and then
|
| 42 |
+
later squashing them with `git rebase --autosquash` to make things easier.
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
## Testing your changes
|
| 47 |
+
|
| 48 |
+
_Note: Running Catch2's tests requires Python3_
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
Catch2 has multiple layers of tests that are then run as part of our CI.
|
| 52 |
+
The most obvious one are the unit tests compiled into the `SelfTest`
|
| 53 |
+
binary. These are then used in "Approval tests", which run (almost) all
|
| 54 |
+
tests from `SelfTest` through a specific reporter and then compare the
|
| 55 |
+
generated output with a known good output ("Baseline"). By default, new
|
| 56 |
+
tests should be placed here.
|
| 57 |
+
|
| 58 |
+
However, not all tests can be written as plain unit tests. For example,
|
| 59 |
+
checking that Catch2 orders tests randomly when asked to, and that this
|
| 60 |
+
random ordering is subset-invariant, is better done as an integration
|
| 61 |
+
test using an external check script. Catch2 integration tests are written
|
| 62 |
+
using CTest, either as a direct command invocation + pass/fail regex,
|
| 63 |
+
or by delegating the check to a Python script.
|
| 64 |
+
|
| 65 |
+
There are also two more kinds of tests, examples and "ExtraTests".
|
| 66 |
+
Examples serve as a compilation test on the single-header distribution,
|
| 67 |
+
and present a small and self-contained snippets of using Catch2 for
|
| 68 |
+
writing tests. ExtraTests then are tests that either take a long time
|
| 69 |
+
to run, or require separate compilation, e.g. because of testing compile
|
| 70 |
+
time configuration options, and take a long time because of that.
|
| 71 |
+
|
| 72 |
+
Both of these are compiled against the single-header distribution of
|
| 73 |
+
Catch2, and thus might require you to regenerate it manually. This is
|
| 74 |
+
done by calling the `generateSingleHeader.py` script in `scripts`.
|
| 75 |
+
|
| 76 |
+
Examples and ExtraTests are not compiled by default. To compile them,
|
| 77 |
+
add `-DCATCH_BUILD_EXAMPLES=ON` and `-DCATCH_BUILD_EXTRA_TESTS=ON` to
|
| 78 |
+
the invocation of CMake configuration step.
|
| 79 |
+
|
| 80 |
+
Bringing this all together, the steps below should configure, build,
|
| 81 |
+
and run all tests in the `Debug` compilation.
|
| 82 |
+
|
| 83 |
+
1. Regenerate the single header distribution
|
| 84 |
+
```
|
| 85 |
+
$ cd Catch2
|
| 86 |
+
$ ./scripts/generateSingleHeader.py
|
| 87 |
+
```
|
| 88 |
+
2. Configure the full test build
|
| 89 |
+
```
|
| 90 |
+
$ cmake -Bdebug-build -H. -DCMAKE_BUILD_TYPE=Debug -DCATCH_BUILD_EXAMPLES=ON -DCATCH_BUILD_EXTRA_TESTS=ON
|
| 91 |
+
```
|
| 92 |
+
3. Run the actual build
|
| 93 |
+
```
|
| 94 |
+
$ cmake --build debug-build
|
| 95 |
+
```
|
| 96 |
+
4. Run the tests using CTest
|
| 97 |
+
```
|
| 98 |
+
$ cd debug-build
|
| 99 |
+
$ ctest -j 4 --output-on-failure -C Debug
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
## Writing documentation
|
| 104 |
+
|
| 105 |
+
If you have added new feature to Catch2, it needs documentation, so that
|
| 106 |
+
other people can use it as well. This section collects some technical
|
| 107 |
+
information that you will need for updating Catch2's documentation, and
|
| 108 |
+
possibly some generic advise as well.
|
| 109 |
+
|
| 110 |
+
### Technicalities
|
| 111 |
+
|
| 112 |
+
First, the technicalities:
|
| 113 |
+
|
| 114 |
+
* If you have introduced a new document, there is a simple template you
|
| 115 |
+
should use. It provides you with the top anchor mentioned to link to
|
| 116 |
+
(more below), and also with a backlink to the top of the documentation:
|
| 117 |
+
```markdown
|
| 118 |
+
<a id="top"></a>
|
| 119 |
+
# Cool feature
|
| 120 |
+
|
| 121 |
+
Text that explains how to use the cool feature.
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
---
|
| 125 |
+
|
| 126 |
+
[Home](Readme.md#top)
|
| 127 |
+
```
|
| 128 |
+
|
| 129 |
+
* Crosslinks to different pages should target the `top` anchor, like this
|
| 130 |
+
`[link to contributing](contributing.md#top)`.
|
| 131 |
+
|
| 132 |
+
* We introduced version tags to the documentation, which show users in
|
| 133 |
+
which version a specific feature was introduced. This means that newly
|
| 134 |
+
written documentation should be tagged with a placeholder, that will
|
| 135 |
+
be replaced with the actual version upon release. There are 2 styles
|
| 136 |
+
of placeholders used through the documentation, you should pick one that
|
| 137 |
+
fits your text better (if in doubt, take a look at the existing version
|
| 138 |
+
tags for other features).
|
| 139 |
+
* `> [Introduced](link-to-issue-or-PR) in Catch X.Y.Z` - this
|
| 140 |
+
placeholder is usually used after a section heading
|
| 141 |
+
* `> X (Y and Z) was [introduced](link-to-issue-or-PR) in Catch X.Y.Z`
|
| 142 |
+
- this placeholder is used when you need to tag a subpart of something,
|
| 143 |
+
e.g. a list
|
| 144 |
+
|
| 145 |
+
* For pages with more than 4 subheadings, we provide a table of contents
|
| 146 |
+
(ToC) at the top of the page. Because GitHub markdown does not support
|
| 147 |
+
automatic generation of ToC, it has to be handled semi-manually. Thus,
|
| 148 |
+
if you've added a new subheading to some page, you should add it to the
|
| 149 |
+
ToC. This can be done either manually, or by running the
|
| 150 |
+
`updateDocumentToC.py` script in the `scripts/` folder.
|
| 151 |
+
|
| 152 |
+
### Contents
|
| 153 |
+
|
| 154 |
+
Now, for some content tips:
|
| 155 |
+
|
| 156 |
+
* Usage examples are good. However, having large code snippets inline
|
| 157 |
+
can make the documentation less readable, and so the inline snippets
|
| 158 |
+
should be kept reasonably short. To provide more complex compilable
|
| 159 |
+
examples, consider adding new .cpp file to `examples/`.
|
| 160 |
+
|
| 161 |
+
* Don't be afraid to introduce new pages. The current documentation
|
| 162 |
+
tends towards long pages, but a lot of that is caused by legacy, and
|
| 163 |
+
we know that some of the pages are overly big and unfocused.
|
| 164 |
+
|
| 165 |
+
* When adding information to an existing page, please try to keep your
|
| 166 |
+
formatting, style and changes consistent with the rest of the page.
|
| 167 |
+
|
| 168 |
+
* Any documentation has multiple different audiences, that desire
|
| 169 |
+
different information from the text. The 3 basic user-types to try and
|
| 170 |
+
cover are:
|
| 171 |
+
* A beginner to Catch2, who requires closer guidance for the usage of Catch2.
|
| 172 |
+
* Advanced user of Catch2, who want to customize their usage.
|
| 173 |
+
* Experts, looking for full reference of Catch2's capabilities.
|
| 174 |
+
|
| 175 |
+
|
| 176 |
+
## Writing code
|
| 177 |
+
|
| 178 |
+
If want to contribute code, this section contains some simple rules
|
| 179 |
+
and tips on things like code formatting, code constructions to avoid,
|
| 180 |
+
and so on.
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
### Formatting
|
| 184 |
+
|
| 185 |
+
To make code formatting simpler for the contributors, Catch2 provides
|
| 186 |
+
its own config for `clang-format`. However, because it is currently
|
| 187 |
+
impossible to replicate existing Catch2's formatting in clang-format,
|
| 188 |
+
using it to reformat a whole file would cause massive diffs. To keep
|
| 189 |
+
the size of your diffs reasonable, you should only use clang-format
|
| 190 |
+
on the newly changed code.
|
| 191 |
+
|
| 192 |
+
|
| 193 |
+
### Code constructs to watch out for
|
| 194 |
+
|
| 195 |
+
This section is a (sadly incomplete) listing of various constructs that
|
| 196 |
+
are problematic and are not always caught by our CI infrastructure.
|
| 197 |
+
|
| 198 |
+
|
| 199 |
+
#### Naked exceptions and exceptions-related function
|
| 200 |
+
|
| 201 |
+
If you are throwing an exception, it should be done via `CATCH_ERROR`
|
| 202 |
+
or `CATCH_RUNTIME_ERROR` in `catch_enforce.h`. These macros will handle
|
| 203 |
+
the differences between compilation with or without exceptions for you.
|
| 204 |
+
However, some platforms (IAR) also have problems with exceptions-related
|
| 205 |
+
functions, such as `std::current_exceptions`. We do not have IAR in our
|
| 206 |
+
CI, but luckily there should not be too many reasons to use these.
|
| 207 |
+
However, if you do, they should be kept behind a
|
| 208 |
+
`CATCH_CONFIG_DISABLE_EXCEPTIONS` macro.
|
| 209 |
+
|
| 210 |
+
|
| 211 |
+
#### Unqualified usage of functions from C's stdlib
|
| 212 |
+
|
| 213 |
+
If you are using a function from C's stdlib, please include the header
|
| 214 |
+
as `<cfoo>` and call the function qualified. The common knowledge that
|
| 215 |
+
there is no difference is wrong, QNX and VxWorks won't compile if you
|
| 216 |
+
include the header as `<cfoo>` and call the function unqualified.
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
## CoC
|
| 220 |
+
|
| 221 |
+
This project has a [CoC](../CODE_OF_CONDUCT.md). Please adhere to it
|
| 222 |
+
while contributing to Catch2.
|
| 223 |
+
|
| 224 |
+
-----------
|
| 225 |
+
|
| 226 |
+
_This documentation will always be in-progress as new information comes
|
| 227 |
+
up, but we are trying to keep it as up to date as possible._
|
| 228 |
+
|
| 229 |
+
---
|
| 230 |
+
|
| 231 |
+
[Home](Readme.md#top)
|
weight/_dep/Catch2/docs/deprecations.md
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<a id="top"></a>
|
| 2 |
+
# Deprecations and incoming changes
|
| 3 |
+
|
| 4 |
+
This page documents current deprecations and upcoming planned changes
|
| 5 |
+
inside Catch2. The difference between these is that a deprecated feature
|
| 6 |
+
will be removed, while a planned change to a feature means that the
|
| 7 |
+
feature will behave differently, but will still be present. Obviously,
|
| 8 |
+
either of these is a breaking change, and thus will not happen until
|
| 9 |
+
at least the next major release.
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
## Deprecations
|
| 13 |
+
|
| 14 |
+
### `--list-*` return values
|
| 15 |
+
|
| 16 |
+
The return codes of the `--list-*` family of command line arguments
|
| 17 |
+
will no longer be equal to the number of tests/tags/etc found, instead
|
| 18 |
+
it will be 0 for success and non-zero for failure.
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
### `--list-test-names-only`
|
| 22 |
+
|
| 23 |
+
`--list-test-names-only` command line argument will be removed.
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
### `ANON_TEST_CASE`
|
| 27 |
+
|
| 28 |
+
`ANON_TEST_CASE` is scheduled for removal, as it can be fully replaced
|
| 29 |
+
by a `TEST_CASE` with no arguments.
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
### Secondary description amongst tags
|
| 33 |
+
|
| 34 |
+
Currently, the tags part of `TEST_CASE` (and others) macro can also
|
| 35 |
+
contain text that is not part of tags. This text is then separated into
|
| 36 |
+
a "description" of the test case, but the description is then never used
|
| 37 |
+
apart from writing it out for `--list-tests -v high`.
|
| 38 |
+
|
| 39 |
+
Because it isn't actually used nor documented, and brings complications
|
| 40 |
+
to Catch2's internals, description support will be removed.
|
| 41 |
+
|
| 42 |
+
### SourceLineInfo::empty()
|
| 43 |
+
|
| 44 |
+
There should be no reason to ever have an empty `SourceLineInfo`, so the
|
| 45 |
+
method will be removed.
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
### Composing lvalues of already composed matchers
|
| 49 |
+
|
| 50 |
+
Because a significant bug in this use case has persisted for 2+ years
|
| 51 |
+
without a bug report, and to simplify the implementation, code that
|
| 52 |
+
composes lvalues of composed matchers will not compile. That is,
|
| 53 |
+
this code will no longer work:
|
| 54 |
+
|
| 55 |
+
```cpp
|
| 56 |
+
auto m1 = Contains("string");
|
| 57 |
+
auto m2 = Contains("random");
|
| 58 |
+
auto composed1 = m1 || m2;
|
| 59 |
+
auto m3 = Contains("different");
|
| 60 |
+
auto composed2 = composed1 || m3;
|
| 61 |
+
REQUIRE_THAT(foo(), !composed1);
|
| 62 |
+
REQUIRE_THAT(foo(), composed2);
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
Instead you will have to write this:
|
| 66 |
+
|
| 67 |
+
```cpp
|
| 68 |
+
auto m1 = Contains("string");
|
| 69 |
+
auto m2 = Contains("random");
|
| 70 |
+
auto m3 = Contains("different");
|
| 71 |
+
REQUIRE_THAT(foo(), !(m1 || m2));
|
| 72 |
+
REQUIRE_THAT(foo(), m1 || m2 || m3);
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
### `ParseAndAddCatchTests.cmake`
|
| 76 |
+
|
| 77 |
+
The CMake/CTest integration using `ParseAndAddCatchTests.cmake` is deprecated,
|
| 78 |
+
as it can be replaced by `Catch.cmake` that provides the function
|
| 79 |
+
`catch_discover_tests` to get tests directly from a CMake target via the
|
| 80 |
+
command line interface instead of parsing C++ code with regular expressions.
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
## Planned changes
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
### Reporter verbosities
|
| 87 |
+
|
| 88 |
+
The current implementation of verbosities, where the reporter is checked
|
| 89 |
+
up-front whether it supports the requested verbosity, is fundamentally
|
| 90 |
+
misguided and will be changed. The new implementation will no longer check
|
| 91 |
+
whether the specified reporter supports the requested verbosity, instead
|
| 92 |
+
it will be up to the reporters to deal with verbosities as they see fit
|
| 93 |
+
(with an expectation that unsupported verbosities will be, at most,
|
| 94 |
+
warnings, but not errors).
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
### Output format of `--list-*` command line parameters
|
| 98 |
+
|
| 99 |
+
The various list operations will be piped through reporters. This means
|
| 100 |
+
that e.g. XML reporter will write the output as machine-parseable XML,
|
| 101 |
+
while the Console reporter will keep the current, human-oriented output.
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
### `CHECKED_IF` and `CHECKED_ELSE`
|
| 105 |
+
|
| 106 |
+
To make the `CHECKED_IF` and `CHECKED_ELSE` macros more useful, they will
|
| 107 |
+
be marked as "OK to fail" (`Catch::ResultDisposition::SuppressFail` flag
|
| 108 |
+
will be added), which means that their failure will not fail the test,
|
| 109 |
+
making the `else` actually useful.
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
### Change semantics of `[.]` and tag exclusion
|
| 113 |
+
|
| 114 |
+
Currently, given these 2 tests
|
| 115 |
+
```cpp
|
| 116 |
+
TEST_CASE("A", "[.][foo]") {}
|
| 117 |
+
TEST_CASE("B", "[.][bar]") {}
|
| 118 |
+
```
|
| 119 |
+
specifying `[foo]` as the testspec will run test "A" and specifying
|
| 120 |
+
`~[foo]` will run test "B", even though it is hidden. Also, specifying
|
| 121 |
+
`~[baz]` will run both tests. This behaviour is often surprising and will
|
| 122 |
+
be changed so that hidden tests are included in a run only if they
|
| 123 |
+
positively match a testspec.
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
### Console Colour API
|
| 127 |
+
|
| 128 |
+
The API for Catch2's console colour will be changed to take an extra
|
| 129 |
+
argument, the stream to which the colour code should be applied.
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
### Type erasure in the `PredicateMatcher`
|
| 133 |
+
|
| 134 |
+
Currently, the `PredicateMatcher` uses `std::function` for type erasure,
|
| 135 |
+
so that type of the matcher is always `PredicateMatcher<T>`, regardless
|
| 136 |
+
of the type of the predicate. Because of the high compilation overhead
|
| 137 |
+
of `std::function`, and the fact that the type erasure is used only rarely,
|
| 138 |
+
`PredicateMatcher` will no longer be type erased in the future. Instead,
|
| 139 |
+
the predicate type will be made part of the PredicateMatcher's type.
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
---
|
| 143 |
+
|
| 144 |
+
[Home](Readme.md#top)
|
weight/_dep/Catch2/docs/event-listeners.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<a id="top"></a>
|
| 2 |
+
# Event Listeners
|
| 3 |
+
|
| 4 |
+
A `Listener` is a class you can register with Catch that will then be passed events,
|
| 5 |
+
such as a test case starting or ending, as they happen during a test run.
|
| 6 |
+
`Listeners` are actually types of `Reporters`, with a few small differences:
|
| 7 |
+
|
| 8 |
+
1. Once registered in code they are automatically used - you don't need to specify them on the command line
|
| 9 |
+
2. They are called in addition to (just before) any reporters, and you can register multiple listeners.
|
| 10 |
+
3. They derive from `Catch::TestEventListenerBase`, which has default stubs for all the events,
|
| 11 |
+
so you are not forced to implement events you're not interested in.
|
| 12 |
+
4. You register a listener with `CATCH_REGISTER_LISTENER`
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
## Implementing a Listener
|
| 16 |
+
Simply derive a class from `Catch::TestEventListenerBase` and implement the methods you are interested in, either in
|
| 17 |
+
the main source file (i.e. the one that defines `CATCH_CONFIG_MAIN` or `CATCH_CONFIG_RUNNER`), or in a
|
| 18 |
+
file that defines `CATCH_CONFIG_EXTERNAL_INTERFACES`.
|
| 19 |
+
|
| 20 |
+
Then register it using `CATCH_REGISTER_LISTENER`.
|
| 21 |
+
|
| 22 |
+
For example ([complete source code](../examples/210-Evt-EventListeners.cpp)):
|
| 23 |
+
|
| 24 |
+
```c++
|
| 25 |
+
#define CATCH_CONFIG_MAIN
|
| 26 |
+
#include "catch.hpp"
|
| 27 |
+
|
| 28 |
+
struct MyListener : Catch::TestEventListenerBase {
|
| 29 |
+
|
| 30 |
+
using TestEventListenerBase::TestEventListenerBase; // inherit constructor
|
| 31 |
+
|
| 32 |
+
void testCaseStarting( Catch::TestCaseInfo const& testInfo ) override {
|
| 33 |
+
// Perform some setup before a test case is run
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
void testCaseEnded( Catch::TestCaseStats const& testCaseStats ) override {
|
| 37 |
+
// Tear-down after a test case is run
|
| 38 |
+
}
|
| 39 |
+
};
|
| 40 |
+
CATCH_REGISTER_LISTENER( MyListener )
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
_Note that you should not use any assertion macros within a Listener!_
|
| 44 |
+
|
| 45 |
+
## Events that can be hooked
|
| 46 |
+
|
| 47 |
+
The following are the methods that can be overridden in the Listener:
|
| 48 |
+
|
| 49 |
+
```c++
|
| 50 |
+
// The whole test run, starting and ending
|
| 51 |
+
virtual void testRunStarting( TestRunInfo const& testRunInfo );
|
| 52 |
+
virtual void testRunEnded( TestRunStats const& testRunStats );
|
| 53 |
+
|
| 54 |
+
// Test cases starting and ending
|
| 55 |
+
virtual void testCaseStarting( TestCaseInfo const& testInfo );
|
| 56 |
+
virtual void testCaseEnded( TestCaseStats const& testCaseStats );
|
| 57 |
+
|
| 58 |
+
// Sections starting and ending
|
| 59 |
+
virtual void sectionStarting( SectionInfo const& sectionInfo );
|
| 60 |
+
virtual void sectionEnded( SectionStats const& sectionStats );
|
| 61 |
+
|
| 62 |
+
// Assertions before/ after
|
| 63 |
+
virtual void assertionStarting( AssertionInfo const& assertionInfo );
|
| 64 |
+
virtual bool assertionEnded( AssertionStats const& assertionStats );
|
| 65 |
+
|
| 66 |
+
// A test is being skipped (because it is "hidden")
|
| 67 |
+
virtual void skipTest( TestCaseInfo const& testInfo );
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
More information about the events (e.g. name of the test case) is contained in the structs passed as arguments -
|
| 71 |
+
just look in the source code to see what fields are available.
|
| 72 |
+
|
| 73 |
+
---
|
| 74 |
+
|
| 75 |
+
[Home](Readme.md#top)
|
weight/_dep/Catch2/docs/generators.md
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<a id="top"></a>
|
| 2 |
+
# Data Generators
|
| 3 |
+
|
| 4 |
+
> Introduced in Catch 2.6.0.
|
| 5 |
+
|
| 6 |
+
Data generators (also known as _data driven/parametrized test cases_)
|
| 7 |
+
let you reuse the same set of assertions across different input values.
|
| 8 |
+
In Catch2, this means that they respect the ordering and nesting
|
| 9 |
+
of the `TEST_CASE` and `SECTION` macros, and their nested sections
|
| 10 |
+
are run once per each value in a generator.
|
| 11 |
+
|
| 12 |
+
This is best explained with an example:
|
| 13 |
+
```cpp
|
| 14 |
+
TEST_CASE("Generators") {
|
| 15 |
+
auto i = GENERATE(1, 3, 5);
|
| 16 |
+
REQUIRE(is_odd(i));
|
| 17 |
+
}
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
The "Generators" `TEST_CASE` will be entered 3 times, and the value of
|
| 21 |
+
`i` will be 1, 3, and 5 in turn. `GENERATE`s can also be used multiple
|
| 22 |
+
times at the same scope, in which case the result will be a cartesian
|
| 23 |
+
product of all elements in the generators. This means that in the snippet
|
| 24 |
+
below, the test case will be run 6 (2\*3) times.
|
| 25 |
+
|
| 26 |
+
```cpp
|
| 27 |
+
TEST_CASE("Generators") {
|
| 28 |
+
auto i = GENERATE(1, 2);
|
| 29 |
+
auto j = GENERATE(3, 4, 5);
|
| 30 |
+
}
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
+
There are 2 parts to generators in Catch2, the `GENERATE` macro together
|
| 34 |
+
with the already provided generators, and the `IGenerator<T>` interface
|
| 35 |
+
that allows users to implement their own generators.
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
## Combining `GENERATE` and `SECTION`.
|
| 39 |
+
|
| 40 |
+
`GENERATE` can be seen as an implicit `SECTION`, that goes from the place
|
| 41 |
+
`GENERATE` is used, to the end of the scope. This can be used for various
|
| 42 |
+
effects. The simplest usage is shown below, where the `SECTION` "one"
|
| 43 |
+
runs 4 (2\*2) times, and `SECTION` "two" is run 6 times (2\*3).
|
| 44 |
+
|
| 45 |
+
```cpp
|
| 46 |
+
TEST_CASE("Generators") {
|
| 47 |
+
auto i = GENERATE(1, 2);
|
| 48 |
+
SECTION("one") {
|
| 49 |
+
auto j = GENERATE(-3, -2);
|
| 50 |
+
REQUIRE(j < i);
|
| 51 |
+
}
|
| 52 |
+
SECTION("two") {
|
| 53 |
+
auto k = GENERATE(4, 5, 6);
|
| 54 |
+
REQUIRE(i != k);
|
| 55 |
+
}
|
| 56 |
+
}
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
The specific order of the `SECTION`s will be "one", "one", "two", "two",
|
| 60 |
+
"two", "one"...
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
The fact that `GENERATE` introduces a virtual `SECTION` can also be used
|
| 64 |
+
to make a generator replay only some `SECTION`s, without having to
|
| 65 |
+
explicitly add a `SECTION`. As an example, the code below reports 3
|
| 66 |
+
assertions, because the "first" section is run once, but the "second"
|
| 67 |
+
section is run twice.
|
| 68 |
+
|
| 69 |
+
```cpp
|
| 70 |
+
TEST_CASE("GENERATE between SECTIONs") {
|
| 71 |
+
SECTION("first") { REQUIRE(true); }
|
| 72 |
+
auto _ = GENERATE(1, 2);
|
| 73 |
+
SECTION("second") { REQUIRE(true); }
|
| 74 |
+
}
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
This can lead to surprisingly complex test flows. As an example, the test
|
| 78 |
+
below will report 14 assertions:
|
| 79 |
+
|
| 80 |
+
```cpp
|
| 81 |
+
TEST_CASE("Complex mix of sections and generates") {
|
| 82 |
+
auto i = GENERATE(1, 2);
|
| 83 |
+
SECTION("A") {
|
| 84 |
+
SUCCEED("A");
|
| 85 |
+
}
|
| 86 |
+
auto j = GENERATE(3, 4);
|
| 87 |
+
SECTION("B") {
|
| 88 |
+
SUCCEED("B");
|
| 89 |
+
}
|
| 90 |
+
auto k = GENERATE(5, 6);
|
| 91 |
+
SUCCEED();
|
| 92 |
+
}
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
> The ability to place `GENERATE` between two `SECTION`s was [introduced](https://github.com/catchorg/Catch2/issues/1938) in Catch 2.13.0.
|
| 96 |
+
|
| 97 |
+
## Provided generators
|
| 98 |
+
|
| 99 |
+
Catch2's provided generator functionality consists of three parts,
|
| 100 |
+
|
| 101 |
+
* `GENERATE` macro, that serves to integrate generator expression with
|
| 102 |
+
a test case,
|
| 103 |
+
* 2 fundamental generators
|
| 104 |
+
* `SingleValueGenerator<T>` -- contains only single element
|
| 105 |
+
* `FixedValuesGenerator<T>` -- contains multiple elements
|
| 106 |
+
* 5 generic generators that modify other generators
|
| 107 |
+
* `FilterGenerator<T, Predicate>` -- filters out elements from a generator
|
| 108 |
+
for which the predicate returns "false"
|
| 109 |
+
* `TakeGenerator<T>` -- takes first `n` elements from a generator
|
| 110 |
+
* `RepeatGenerator<T>` -- repeats output from a generator `n` times
|
| 111 |
+
* `MapGenerator<T, U, Func>` -- returns the result of applying `Func`
|
| 112 |
+
on elements from a different generator
|
| 113 |
+
* `ChunkGenerator<T>` -- returns chunks (inside `std::vector`) of n elements from a generator
|
| 114 |
+
* 4 specific purpose generators
|
| 115 |
+
* `RandomIntegerGenerator<Integral>` -- generates random Integrals from range
|
| 116 |
+
* `RandomFloatGenerator<Float>` -- generates random Floats from range
|
| 117 |
+
* `RangeGenerator<T>` -- generates all values inside an arithmetic range
|
| 118 |
+
* `IteratorGenerator<T>` -- copies and returns values from an iterator range
|
| 119 |
+
|
| 120 |
+
> `ChunkGenerator<T>`, `RandomIntegerGenerator<Integral>`, `RandomFloatGenerator<Float>` and `RangeGenerator<T>` were introduced in Catch 2.7.0.
|
| 121 |
+
|
| 122 |
+
> `IteratorGenerator<T>` was introduced in Catch 2.10.0.
|
| 123 |
+
|
| 124 |
+
The generators also have associated helper functions that infer their
|
| 125 |
+
type, making their usage much nicer. These are
|
| 126 |
+
|
| 127 |
+
* `value(T&&)` for `SingleValueGenerator<T>`
|
| 128 |
+
* `values(std::initializer_list<T>)` for `FixedValuesGenerator<T>`
|
| 129 |
+
* `table<Ts...>(std::initializer_list<std::tuple<Ts...>>)` for `FixedValuesGenerator<std::tuple<Ts...>>`
|
| 130 |
+
* `filter(predicate, GeneratorWrapper<T>&&)` for `FilterGenerator<T, Predicate>`
|
| 131 |
+
* `take(count, GeneratorWrapper<T>&&)` for `TakeGenerator<T>`
|
| 132 |
+
* `repeat(repeats, GeneratorWrapper<T>&&)` for `RepeatGenerator<T>`
|
| 133 |
+
* `map(func, GeneratorWrapper<T>&&)` for `MapGenerator<T, U, Func>` (map `U` to `T`, deduced from `Func`)
|
| 134 |
+
* `map<T>(func, GeneratorWrapper<U>&&)` for `MapGenerator<T, U, Func>` (map `U` to `T`)
|
| 135 |
+
* `chunk(chunk-size, GeneratorWrapper<T>&&)` for `ChunkGenerator<T>`
|
| 136 |
+
* `random(IntegerOrFloat a, IntegerOrFloat b)` for `RandomIntegerGenerator` or `RandomFloatGenerator`
|
| 137 |
+
* `range(Arithemtic start, Arithmetic end)` for `RangeGenerator<Arithmetic>` with a step size of `1`
|
| 138 |
+
* `range(Arithmetic start, Arithmetic end, Arithmetic step)` for `RangeGenerator<Arithmetic>` with a custom step size
|
| 139 |
+
* `from_range(InputIterator from, InputIterator to)` for `IteratorGenerator<T>`
|
| 140 |
+
* `from_range(Container const&)` for `IteratorGenerator<T>`
|
| 141 |
+
|
| 142 |
+
> `chunk()`, `random()` and both `range()` functions were introduced in Catch 2.7.0.
|
| 143 |
+
|
| 144 |
+
> `from_range` has been introduced in Catch 2.10.0
|
| 145 |
+
|
| 146 |
+
> `range()` for floating point numbers has been introduced in Catch 2.11.0
|
| 147 |
+
|
| 148 |
+
And can be used as shown in the example below to create a generator
|
| 149 |
+
that returns 100 odd random number:
|
| 150 |
+
|
| 151 |
+
```cpp
|
| 152 |
+
TEST_CASE("Generating random ints", "[example][generator]") {
|
| 153 |
+
SECTION("Deducing functions") {
|
| 154 |
+
auto i = GENERATE(take(100, filter([](int i) { return i % 2 == 1; }, random(-100, 100))));
|
| 155 |
+
REQUIRE(i > -100);
|
| 156 |
+
REQUIRE(i < 100);
|
| 157 |
+
REQUIRE(i % 2 == 1);
|
| 158 |
+
}
|
| 159 |
+
}
|
| 160 |
+
```
|
| 161 |
+
|
| 162 |
+
|
| 163 |
+
Apart from registering generators with Catch2, the `GENERATE` macro has
|
| 164 |
+
one more purpose, and that is to provide simple way of generating trivial
|
| 165 |
+
generators, as seen in the first example on this page, where we used it
|
| 166 |
+
as `auto i = GENERATE(1, 2, 3);`. This usage converted each of the three
|
| 167 |
+
literals into a single `SingleValueGenerator<int>` and then placed them all in
|
| 168 |
+
a special generator that concatenates other generators. It can also be
|
| 169 |
+
used with other generators as arguments, such as `auto i = GENERATE(0, 2,
|
| 170 |
+
take(100, random(300, 3000)));`. This is useful e.g. if you know that
|
| 171 |
+
specific inputs are problematic and want to test them separately/first.
|
| 172 |
+
|
| 173 |
+
**For safety reasons, you cannot use variables inside the `GENERATE` macro.
|
| 174 |
+
This is done because the generator expression _will_ outlive the outside
|
| 175 |
+
scope and thus capturing references is dangerous. If you need to use
|
| 176 |
+
variables inside the generator expression, make sure you thought through
|
| 177 |
+
the lifetime implications and use `GENERATE_COPY` or `GENERATE_REF`.**
|
| 178 |
+
|
| 179 |
+
> `GENERATE_COPY` and `GENERATE_REF` were introduced in Catch 2.7.1.
|
| 180 |
+
|
| 181 |
+
You can also override the inferred type by using `as<type>` as the first
|
| 182 |
+
argument to the macro. This can be useful when dealing with string literals,
|
| 183 |
+
if you want them to come out as `std::string`:
|
| 184 |
+
|
| 185 |
+
```cpp
|
| 186 |
+
TEST_CASE("type conversion", "[generators]") {
|
| 187 |
+
auto str = GENERATE(as<std::string>{}, "a", "bb", "ccc");
|
| 188 |
+
REQUIRE(str.size() > 0);
|
| 189 |
+
}
|
| 190 |
+
```
|
| 191 |
+
|
| 192 |
+
## Generator interface
|
| 193 |
+
|
| 194 |
+
You can also implement your own generators, by deriving from the
|
| 195 |
+
`IGenerator<T>` interface:
|
| 196 |
+
|
| 197 |
+
```cpp
|
| 198 |
+
template<typename T>
|
| 199 |
+
struct IGenerator : GeneratorUntypedBase {
|
| 200 |
+
// via GeneratorUntypedBase:
|
| 201 |
+
// Attempts to move the generator to the next element.
|
| 202 |
+
// Returns true if successful (and thus has another element that can be read)
|
| 203 |
+
virtual bool next() = 0;
|
| 204 |
+
|
| 205 |
+
// Precondition:
|
| 206 |
+
// The generator is either freshly constructed or the last call to next() returned true
|
| 207 |
+
virtual T const& get() const = 0;
|
| 208 |
+
};
|
| 209 |
+
```
|
| 210 |
+
|
| 211 |
+
However, to be able to use your custom generator inside `GENERATE`, it
|
| 212 |
+
will need to be wrapped inside a `GeneratorWrapper<T>`.
|
| 213 |
+
`GeneratorWrapper<T>` is a value wrapper around a
|
| 214 |
+
`std::unique_ptr<IGenerator<T>>`.
|
| 215 |
+
|
| 216 |
+
For full example of implementing your own generator, look into Catch2's
|
| 217 |
+
examples, specifically
|
| 218 |
+
[Generators: Create your own generator](../examples/300-Gen-OwnGenerator.cpp).
|
| 219 |
+
|
weight/_dep/Catch2/docs/limitations.md
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<a id="top"></a>
|
| 2 |
+
# Known limitations
|
| 3 |
+
|
| 4 |
+
Over time, some limitations of Catch2 emerged. Some of these are due
|
| 5 |
+
to implementation details that cannot be easily changed, some of these
|
| 6 |
+
are due to lack of development resources on our part, and some of these
|
| 7 |
+
are due to plain old 3rd party bugs.
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
## Implementation limits
|
| 11 |
+
### Sections nested in loops
|
| 12 |
+
|
| 13 |
+
If you are using `SECTION`s inside loops, you have to create them with
|
| 14 |
+
different name per loop's iteration. The recommended way to do so is to
|
| 15 |
+
incorporate the loop's counter into section's name, like so:
|
| 16 |
+
|
| 17 |
+
```cpp
|
| 18 |
+
TEST_CASE( "Looped section" ) {
|
| 19 |
+
for (char i = '0'; i < '5'; ++i) {
|
| 20 |
+
SECTION(std::string("Looped section ") + i) {
|
| 21 |
+
SUCCEED( "Everything is OK" );
|
| 22 |
+
}
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
or with a `DYNAMIC_SECTION` macro (that was made for exactly this purpose):
|
| 28 |
+
|
| 29 |
+
```cpp
|
| 30 |
+
TEST_CASE( "Looped section" ) {
|
| 31 |
+
for (char i = '0'; i < '5'; ++i) {
|
| 32 |
+
DYNAMIC_SECTION( "Looped section " << i) {
|
| 33 |
+
SUCCEED( "Everything is OK" );
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
### Tests might be run again if last section fails
|
| 40 |
+
|
| 41 |
+
If the last section in a test fails, it might be run again. This is because
|
| 42 |
+
Catch2 discovers `SECTION`s dynamically, as they are about to run, and
|
| 43 |
+
if the last section in test case is aborted during execution (e.g. via
|
| 44 |
+
the `REQUIRE` family of macros), Catch2 does not know that there are no
|
| 45 |
+
more sections in that test case and must run the test case again.
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
### MinGW/CygWin compilation (linking) is extremely slow
|
| 49 |
+
|
| 50 |
+
Compiling Catch2 with MinGW can be exceedingly slow, especially during
|
| 51 |
+
the linking step. As far as we can tell, this is caused by deficiencies
|
| 52 |
+
in its default linker. If you can tell MinGW to instead use lld, via
|
| 53 |
+
`-fuse-ld=lld`, the link time should drop down to reasonable length
|
| 54 |
+
again.
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
## Features
|
| 58 |
+
This section outlines some missing features, what is their status and their possible workarounds.
|
| 59 |
+
|
| 60 |
+
### Thread safe assertions
|
| 61 |
+
Catch2's assertion macros are not thread safe. This does not mean that
|
| 62 |
+
you cannot use threads inside Catch's test, but that only single thread
|
| 63 |
+
can interact with Catch's assertions and other macros.
|
| 64 |
+
|
| 65 |
+
This means that this is ok
|
| 66 |
+
```cpp
|
| 67 |
+
std::vector<std::thread> threads;
|
| 68 |
+
std::atomic<int> cnt{ 0 };
|
| 69 |
+
for (int i = 0; i < 4; ++i) {
|
| 70 |
+
threads.emplace_back([&]() {
|
| 71 |
+
++cnt; ++cnt; ++cnt; ++cnt;
|
| 72 |
+
});
|
| 73 |
+
}
|
| 74 |
+
for (auto& t : threads) { t.join(); }
|
| 75 |
+
REQUIRE(cnt == 16);
|
| 76 |
+
```
|
| 77 |
+
because only one thread passes the `REQUIRE` macro and this is not
|
| 78 |
+
```cpp
|
| 79 |
+
std::vector<std::thread> threads;
|
| 80 |
+
std::atomic<int> cnt{ 0 };
|
| 81 |
+
for (int i = 0; i < 4; ++i) {
|
| 82 |
+
threads.emplace_back([&]() {
|
| 83 |
+
++cnt; ++cnt; ++cnt; ++cnt;
|
| 84 |
+
CHECK(cnt == 16);
|
| 85 |
+
});
|
| 86 |
+
}
|
| 87 |
+
for (auto& t : threads) { t.join(); }
|
| 88 |
+
REQUIRE(cnt == 16);
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
Because C++11 provides the necessary tools to do this, we are planning
|
| 92 |
+
to remove this limitation in the future.
|
| 93 |
+
|
| 94 |
+
### Process isolation in a test
|
| 95 |
+
Catch does not support running tests in isolated (forked) processes. While this might in the future, the fact that Windows does not support forking and only allows full-on process creation and the desire to keep code as similar as possible across platforms, mean that this is likely to take significant development time, that is not currently available.
|
| 96 |
+
|
| 97 |
+
### Running multiple tests in parallel
|
| 98 |
+
Catch's test execution is strictly serial. If you find yourself with a test suite that takes too long to run and you want to make it parallel, there are 2 feasible solutions
|
| 99 |
+
* You can split your tests into multiple binaries and then run these binaries in parallel.
|
| 100 |
+
* You can have Catch list contained test cases and then run the same test binary multiple times in parallel, passing each instance list of test cases it should run.
|
| 101 |
+
|
| 102 |
+
Both of these solutions have their problems, but should let you wring parallelism out of your test suite.
|
| 103 |
+
|
| 104 |
+
## 3rd party bugs
|
| 105 |
+
This section outlines known bugs in 3rd party components (this means compilers, standard libraries, standard runtimes).
|
| 106 |
+
|
| 107 |
+
### Visual Studio 2015 -- `GENERATE` does not compile if it would deduce char array
|
| 108 |
+
|
| 109 |
+
VS 2015 refuses to compile `GENERATE` statements that would deduce to a
|
| 110 |
+
char array with known size, e.g. this:
|
| 111 |
+
```cpp
|
| 112 |
+
TEST_CASE("Deducing string lit") {
|
| 113 |
+
auto param = GENERATE("start", "stop");
|
| 114 |
+
}
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
A workaround for this is to use the `as` helper and force deduction of
|
| 118 |
+
either a `char const*` or a `std::string`.
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
### Visual Studio 2017 -- raw string literal in assert fails to compile
|
| 122 |
+
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:
|
| 123 |
+
```cpp
|
| 124 |
+
#define CATCH_CONFIG_MAIN
|
| 125 |
+
#include "catch.hpp"
|
| 126 |
+
|
| 127 |
+
TEST_CASE("test") {
|
| 128 |
+
CHECK(std::string(R"("\)") == "\"\\");
|
| 129 |
+
}
|
| 130 |
+
```
|
| 131 |
+
|
| 132 |
+
Catch provides a workaround, it is possible to disable stringification of original expressions by defining `CATCH_CONFIG_DISABLE_STRINGIFICATION`:
|
| 133 |
+
```cpp
|
| 134 |
+
#define CATCH_CONFIG_FAST_COMPILE
|
| 135 |
+
#define CATCH_CONFIG_DISABLE_STRINGIFICATION
|
| 136 |
+
#include "catch.hpp"
|
| 137 |
+
|
| 138 |
+
TEST_CASE("test") {
|
| 139 |
+
CHECK(std::string(R"("\)") == "\"\\");
|
| 140 |
+
}
|
| 141 |
+
```
|
| 142 |
+
|
| 143 |
+
_Do note that this changes the output somewhat_
|
| 144 |
+
```
|
| 145 |
+
catchwork\test1.cpp(6):
|
| 146 |
+
PASSED:
|
| 147 |
+
CHECK( Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION )
|
| 148 |
+
with expansion:
|
| 149 |
+
""\" == ""\"
|
| 150 |
+
```
|
| 151 |
+
|
| 152 |
+
### Visual Studio 2015 -- Alignment compilation error (C2718)
|
| 153 |
+
|
| 154 |
+
VS 2015 has a known bug, where `declval<T>` can cause compilation error
|
| 155 |
+
if `T` has alignment requirements that it cannot meet.
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
A workaround is to explicitly specialize `Catch::is_range` for given
|
| 159 |
+
type (this avoids code path that uses `declval<T>` in a SFINAE context).
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
### Visual Studio 2015 -- Wrong line number reported in debug mode
|
| 163 |
+
VS 2015 has a known bug where `__LINE__` macro can be improperly expanded under certain circumstances, while compiling multi-file project in Debug mode.
|
| 164 |
+
|
| 165 |
+
A workaround is to compile the binary in Release mode.
|
| 166 |
+
|
| 167 |
+
### Clang/G++ -- skipping leaf sections after an exception
|
| 168 |
+
Some versions of `libc++` and `libstdc++` (or their runtimes) have a bug with `std::uncaught_exception()` getting stuck returning `true` after rethrow, even if there are no active exceptions. One such case is this snippet, which skipped the sections "a" and "b", when compiled against `libcxxrt` from master
|
| 169 |
+
```cpp
|
| 170 |
+
#define CATCH_CONFIG_MAIN
|
| 171 |
+
#include <catch.hpp>
|
| 172 |
+
|
| 173 |
+
TEST_CASE("a") {
|
| 174 |
+
CHECK_THROWS(throw 3);
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
TEST_CASE("b") {
|
| 178 |
+
int i = 0;
|
| 179 |
+
SECTION("a") { i = 1; }
|
| 180 |
+
SECTION("b") { i = 2; }
|
| 181 |
+
CHECK(i > 0);
|
| 182 |
+
}
|
| 183 |
+
```
|
| 184 |
+
|
| 185 |
+
If you are seeing a problem like this, i.e. a weird test paths that trigger only under Clang with `libc++`, or only under very specific version of `libstdc++`, it is very likely you are seeing this. The only known workaround is to use a fixed version of your standard library.
|
| 186 |
+
|
| 187 |
+
### Clang/G++ -- `Matches` string matcher always returns false
|
| 188 |
+
This is a bug in `libstdc++-4.8`, where all matching methods from `<regex>` return false. Since `Matches` uses `<regex>` internally, if the underlying implementation does not work, it doesn't work either.
|
| 189 |
+
|
| 190 |
+
Workaround: Use newer version of `libstdc++`.
|
| 191 |
+
|
| 192 |
+
|
| 193 |
+
### libstdc++, `_GLIBCXX_DEBUG` macro and random ordering of tests
|
| 194 |
+
|
| 195 |
+
Running a Catch2 binary compiled against libstdc++ with `_GLIBCXX_DEBUG`
|
| 196 |
+
macro defined with `--order rand` will cause a debug check to trigger and
|
| 197 |
+
abort the run due to self-assignment.
|
| 198 |
+
[This is a known bug inside libstdc++](https://stackoverflow.com/questions/22915325/avoiding-self-assignment-in-stdshuffle/23691322)
|
| 199 |
+
|
| 200 |
+
Workaround: Don't use `--order rand` when compiling against debug-enabled
|
| 201 |
+
libstdc++.
|
weight/_dep/Catch2/docs/list-of-examples.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<a id="top"></a>
|
| 2 |
+
# List of examples
|
| 3 |
+
|
| 4 |
+
## Already available
|
| 5 |
+
|
| 6 |
+
- Catch main: [Catch-provided main](../examples/000-CatchMain.cpp)
|
| 7 |
+
- Test Case: [Single-file](../examples/010-TestCase.cpp)
|
| 8 |
+
- Test Case: [Multiple-file 1](../examples/020-TestCase-1.cpp), [2](../examples/020-TestCase-2.cpp)
|
| 9 |
+
- Assertion: [REQUIRE, CHECK](../examples/030-Asn-Require-Check.cpp)
|
| 10 |
+
- Fixture: [Sections](../examples/100-Fix-Section.cpp)
|
| 11 |
+
- Fixture: [Class-based fixtures](../examples/110-Fix-ClassFixture.cpp)
|
| 12 |
+
- BDD: [SCENARIO, GIVEN, WHEN, THEN](../examples/120-Bdd-ScenarioGivenWhenThen.cpp)
|
| 13 |
+
- Report: [Catch-provided main](../examples/200-Rpt-CatchMain.cpp)
|
| 14 |
+
- Report: [TeamCity reporter](../examples/207-Rpt-TeamCityReporter.cpp)
|
| 15 |
+
- Listener: [Listeners](../examples/210-Evt-EventListeners.cpp)
|
| 16 |
+
- Configuration: [Provide your own output streams](../examples/231-Cfg-OutputStreams.cpp)
|
| 17 |
+
- Generators: [Create your own generator](../examples/300-Gen-OwnGenerator.cpp)
|
| 18 |
+
- Generators: [Use map to convert types in GENERATE expression](../examples/301-Gen-MapTypeConversion.cpp)
|
| 19 |
+
- Generators: [Run test with a table of input values](../examples/302-Gen-Table.cpp)
|
| 20 |
+
- Generators: [Use variables in generator expressions](../examples/310-Gen-VariablesInGenerators.cpp)
|
| 21 |
+
- Generators: [Use custom variable capture in generator expressions](../examples/311-Gen-CustomCapture.cpp)
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
## Planned
|
| 25 |
+
|
| 26 |
+
- Assertion: [REQUIRE_THAT and Matchers](../examples/040-Asn-RequireThat.cpp)
|
| 27 |
+
- Assertion: [REQUIRE_NO_THROW](../examples/050-Asn-RequireNoThrow.cpp)
|
| 28 |
+
- Assertion: [REQUIRE_THROWS](../examples/050-Asn-RequireThrows.cpp)
|
| 29 |
+
- Assertion: [REQUIRE_THROWS_AS](../examples/070-Asn-RequireThrowsAs.cpp)
|
| 30 |
+
- Assertion: [REQUIRE_THROWS_WITH](../examples/080-Asn-RequireThrowsWith.cpp)
|
| 31 |
+
- Assertion: [REQUIRE_THROWS_MATCHES](../examples/090-Asn-RequireThrowsMatches.cpp)
|
| 32 |
+
- Floating point: [Approx - Comparisons](../examples/130-Fpt-Approx.cpp)
|
| 33 |
+
- Logging: [CAPTURE - Capture expression](../examples/140-Log-Capture.cpp)
|
| 34 |
+
- Logging: [INFO - Provide information with failure](../examples/150-Log-Info.cpp)
|
| 35 |
+
- Logging: [WARN - Issue warning](../examples/160-Log-Warn.cpp)
|
| 36 |
+
- Logging: [FAIL, FAIL_CHECK - Issue message and force failure/continue](../examples/170-Log-Fail.cpp)
|
| 37 |
+
- Logging: [SUCCEED - Issue message and continue](../examples/180-Log-Succeed.cpp)
|
| 38 |
+
- Report: [User-defined type](../examples/190-Rpt-ReportUserDefinedType.cpp)
|
| 39 |
+
- Report: [User-defined reporter](../examples/202-Rpt-UserDefinedReporter.cpp)
|
| 40 |
+
- Report: [Automake reporter](../examples/205-Rpt-AutomakeReporter.cpp)
|
| 41 |
+
- Report: [TAP reporter](../examples/206-Rpt-TapReporter.cpp)
|
| 42 |
+
- Report: [Multiple reporter](../examples/208-Rpt-MultipleReporters.cpp)
|
| 43 |
+
- Configuration: [Provide your own main()](../examples/220-Cfg-OwnMain.cpp)
|
| 44 |
+
- Configuration: [Compile-time configuration](../examples/230-Cfg-CompileTimeConfiguration.cpp)
|
| 45 |
+
- Configuration: [Run-time configuration](../examples/240-Cfg-RunTimeConfiguration.cpp)
|
| 46 |
+
|
| 47 |
+
---
|
| 48 |
+
|
| 49 |
+
[Home](Readme.md#top)
|
weight/_dep/Catch2/docs/logging.md
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<a id="top"></a>
|
| 2 |
+
# Logging macros
|
| 3 |
+
|
| 4 |
+
Additional messages can be logged during a test case. Note that the messages logged with `INFO` are scoped and thus will not be reported if failure occurs in scope preceding the message declaration. An example:
|
| 5 |
+
|
| 6 |
+
```cpp
|
| 7 |
+
TEST_CASE("Foo") {
|
| 8 |
+
INFO("Test case start");
|
| 9 |
+
for (int i = 0; i < 2; ++i) {
|
| 10 |
+
INFO("The number is " << i);
|
| 11 |
+
CHECK(i == 0);
|
| 12 |
+
}
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
TEST_CASE("Bar") {
|
| 16 |
+
INFO("Test case start");
|
| 17 |
+
for (int i = 0; i < 2; ++i) {
|
| 18 |
+
INFO("The number is " << i);
|
| 19 |
+
CHECK(i == i);
|
| 20 |
+
}
|
| 21 |
+
CHECK(false);
|
| 22 |
+
}
|
| 23 |
+
```
|
| 24 |
+
When the `CHECK` fails in the "Foo" test case, then two messages will be printed.
|
| 25 |
+
```
|
| 26 |
+
Test case start
|
| 27 |
+
The number is 1
|
| 28 |
+
```
|
| 29 |
+
When the last `CHECK` fails in the "Bar" test case, then only one message will be printed: `Test case start`.
|
| 30 |
+
|
| 31 |
+
## Logging without local scope
|
| 32 |
+
|
| 33 |
+
> [Introduced](https://github.com/catchorg/Catch2/issues/1522) in Catch 2.7.0.
|
| 34 |
+
|
| 35 |
+
`UNSCOPED_INFO` is similar to `INFO` with two key differences:
|
| 36 |
+
|
| 37 |
+
- Lifetime of an unscoped message is not tied to its own scope.
|
| 38 |
+
- An unscoped message can be reported by the first following assertion only, regardless of the result of that assertion.
|
| 39 |
+
|
| 40 |
+
In other words, lifetime of `UNSCOPED_INFO` is limited by the following assertion (or by the end of test case/section, whichever comes first) whereas lifetime of `INFO` is limited by its own scope.
|
| 41 |
+
|
| 42 |
+
These differences make this macro useful for reporting information from helper functions or inner scopes. An example:
|
| 43 |
+
|
| 44 |
+
```cpp
|
| 45 |
+
void print_some_info() {
|
| 46 |
+
UNSCOPED_INFO("Info from helper");
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
TEST_CASE("Baz") {
|
| 50 |
+
print_some_info();
|
| 51 |
+
for (int i = 0; i < 2; ++i) {
|
| 52 |
+
UNSCOPED_INFO("The number is " << i);
|
| 53 |
+
}
|
| 54 |
+
CHECK(false);
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
TEST_CASE("Qux") {
|
| 58 |
+
INFO("First info");
|
| 59 |
+
UNSCOPED_INFO("First unscoped info");
|
| 60 |
+
CHECK(false);
|
| 61 |
+
|
| 62 |
+
INFO("Second info");
|
| 63 |
+
UNSCOPED_INFO("Second unscoped info");
|
| 64 |
+
CHECK(false);
|
| 65 |
+
}
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
"Baz" test case prints:
|
| 69 |
+
```
|
| 70 |
+
Info from helper
|
| 71 |
+
The number is 0
|
| 72 |
+
The number is 1
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
With "Qux" test case, two messages will be printed when the first `CHECK` fails:
|
| 76 |
+
```
|
| 77 |
+
First info
|
| 78 |
+
First unscoped info
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
"First unscoped info" message will be cleared after the first `CHECK`, while "First info" message will persist until the end of the test case. Therefore, when the second `CHECK` fails, three messages will be printed:
|
| 82 |
+
```
|
| 83 |
+
First info
|
| 84 |
+
Second info
|
| 85 |
+
Second unscoped info
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
## Streaming macros
|
| 89 |
+
|
| 90 |
+
All these macros allow heterogeneous sequences of values to be streaming using the insertion operator (```<<```) in the same way that std::ostream, std::cout, etc support it.
|
| 91 |
+
|
| 92 |
+
E.g.:
|
| 93 |
+
```c++
|
| 94 |
+
INFO( "The number is " << i );
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
+
(Note that there is no initial ```<<``` - instead the insertion sequence is placed in parentheses.)
|
| 98 |
+
These macros come in three forms:
|
| 99 |
+
|
| 100 |
+
**INFO(** _message expression_ **)**
|
| 101 |
+
|
| 102 |
+
The message is logged to a buffer, but only reported with next assertions that are logged. This allows you to log contextual information in case of failures which is not shown during a successful test run (for the console reporter, without -s). Messages are removed from the buffer at the end of their scope, so may be used, for example, in loops.
|
| 103 |
+
|
| 104 |
+
_Note that in Catch2 2.x.x `INFO` can be used without a trailing semicolon as there is a trailing semicolon inside macro.
|
| 105 |
+
This semicolon will be removed with next major version. It is highly advised to use a trailing semicolon after `INFO` macro._
|
| 106 |
+
|
| 107 |
+
**UNSCOPED_INFO(** _message expression_ **)**
|
| 108 |
+
|
| 109 |
+
> [Introduced](https://github.com/catchorg/Catch2/issues/1522) in Catch 2.7.0.
|
| 110 |
+
|
| 111 |
+
Similar to `INFO`, but messages are not limited to their own scope: They are removed from the buffer after each assertion, section or test case, whichever comes first.
|
| 112 |
+
|
| 113 |
+
**WARN(** _message expression_ **)**
|
| 114 |
+
|
| 115 |
+
The message is always reported but does not fail the test.
|
| 116 |
+
|
| 117 |
+
**FAIL(** _message expression_ **)**
|
| 118 |
+
|
| 119 |
+
The message is reported and the test case fails.
|
| 120 |
+
|
| 121 |
+
**FAIL_CHECK(** _message expression_ **)**
|
| 122 |
+
|
| 123 |
+
AS `FAIL`, but does not abort the test
|
| 124 |
+
|
| 125 |
+
## Quickly capture value of variables or expressions
|
| 126 |
+
|
| 127 |
+
**CAPTURE(** _expression1_, _expression2_, ... **)**
|
| 128 |
+
|
| 129 |
+
Sometimes you just want to log a value of variable, or expression. For
|
| 130 |
+
convenience, we provide the `CAPTURE` macro, that can take a variable,
|
| 131 |
+
or an expression, and prints out that variable/expression and its value
|
| 132 |
+
at the time of capture.
|
| 133 |
+
|
| 134 |
+
e.g. `CAPTURE( theAnswer );` will log message "theAnswer := 42", while
|
| 135 |
+
```cpp
|
| 136 |
+
int a = 1, b = 2, c = 3;
|
| 137 |
+
CAPTURE( a, b, c, a + b, c > b, a == 1);
|
| 138 |
+
```
|
| 139 |
+
will log a total of 6 messages:
|
| 140 |
+
```
|
| 141 |
+
a := 1
|
| 142 |
+
b := 2
|
| 143 |
+
c := 3
|
| 144 |
+
a + b := 3
|
| 145 |
+
c > b := true
|
| 146 |
+
a == 1 := true
|
| 147 |
+
```
|
| 148 |
+
|
| 149 |
+
You can also capture expressions that use commas inside parentheses
|
| 150 |
+
(e.g. function calls), brackets, or braces (e.g. initializers). To
|
| 151 |
+
properly capture expression that contains template parameters list
|
| 152 |
+
(in other words, it contains commas between angle brackets), you need
|
| 153 |
+
to enclose the expression inside parentheses:
|
| 154 |
+
`CAPTURE( (std::pair<int, int>{1, 2}) );`
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
---
|
| 158 |
+
|
| 159 |
+
[Home](Readme.md#top)
|
weight/_dep/Catch2/docs/matchers.md
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<a id="top"></a>
|
| 2 |
+
# Matchers
|
| 3 |
+
|
| 4 |
+
Matchers are an alternative way to do assertions which are easily extensible and composable.
|
| 5 |
+
This makes them well suited to use with more complex types (such as collections) or your own custom types.
|
| 6 |
+
Matchers were first popularised by the [Hamcrest](https://en.wikipedia.org/wiki/Hamcrest) family of frameworks.
|
| 7 |
+
|
| 8 |
+
## In use
|
| 9 |
+
|
| 10 |
+
Matchers are introduced with the `REQUIRE_THAT` or `CHECK_THAT` macros, which take two arguments.
|
| 11 |
+
The first argument is the thing (object or value) under test. The second part is a match _expression_,
|
| 12 |
+
which consists of either a single matcher or one or more matchers combined using `&&`, `||` or `!` operators.
|
| 13 |
+
|
| 14 |
+
For example, to assert that a string ends with a certain substring:
|
| 15 |
+
|
| 16 |
+
```c++
|
| 17 |
+
using Catch::Matchers::EndsWith; // or Catch::EndsWith
|
| 18 |
+
std::string str = getStringFromSomewhere();
|
| 19 |
+
REQUIRE_THAT( str, EndsWith( "as a service" ) );
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
The matcher objects can take multiple arguments, allowing more fine tuning.
|
| 23 |
+
The built-in string matchers, for example, take a second argument specifying whether the comparison is
|
| 24 |
+
case sensitive or not:
|
| 25 |
+
|
| 26 |
+
```c++
|
| 27 |
+
REQUIRE_THAT( str, EndsWith( "as a service", Catch::CaseSensitive::No ) );
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
And matchers can be combined:
|
| 31 |
+
|
| 32 |
+
```c++
|
| 33 |
+
REQUIRE_THAT( str,
|
| 34 |
+
EndsWith( "as a service" ) ||
|
| 35 |
+
(StartsWith( "Big data" ) && !Contains( "web scale" ) ) );
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
_The combining operators do not take ownership of the matcher objects.
|
| 39 |
+
This means that if you store the combined object, you have to ensure that
|
| 40 |
+
the matcher objects outlive its last use. What this means is that code
|
| 41 |
+
like this leads to a use-after-free and (hopefully) a crash:_
|
| 42 |
+
|
| 43 |
+
```cpp
|
| 44 |
+
TEST_CASE("Bugs, bugs, bugs", "[Bug]"){
|
| 45 |
+
std::string str = "Bugs as a service";
|
| 46 |
+
|
| 47 |
+
auto match_expression = Catch::EndsWith( "as a service" ) ||
|
| 48 |
+
(Catch::StartsWith( "Big data" ) && !Catch::Contains( "web scale" ) );
|
| 49 |
+
REQUIRE_THAT(str, match_expression);
|
| 50 |
+
}
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
## Built in matchers
|
| 55 |
+
Catch2 provides some matchers by default. They can be found in the
|
| 56 |
+
`Catch::Matchers::foo` namespace and are imported into the `Catch`
|
| 57 |
+
namespace as well.
|
| 58 |
+
|
| 59 |
+
There are two parts to each of the built-in matchers, the matcher
|
| 60 |
+
type itself and a helper function that provides template argument
|
| 61 |
+
deduction when creating templated matchers. As an example, the matcher
|
| 62 |
+
for checking that two instances of `std::vector` are identical is
|
| 63 |
+
`EqualsMatcher<T>`, but the user is expected to use the `Equals`
|
| 64 |
+
helper function instead.
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
### String matchers
|
| 68 |
+
The string matchers are `StartsWith`, `EndsWith`, `Contains`, `Equals` and `Matches`. The first four match a literal (sub)string against a result, while `Matches` takes and matches an ECMAScript regex. Do note that `Matches` matches the string as a whole, meaning that "abc" will not match against "abcd", but "abc.*" will.
|
| 69 |
+
|
| 70 |
+
Each of the provided `std::string` matchers also takes an optional second argument, that decides case sensitivity (by-default, they are case sensitive).
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
### Vector matchers
|
| 74 |
+
Catch2 currently provides 5 built-in matchers that work on `std::vector`.
|
| 75 |
+
These are
|
| 76 |
+
|
| 77 |
+
* `Contains` which checks whether a specified vector is present in the result
|
| 78 |
+
* `VectorContains` which checks whether a specified element is present in the result
|
| 79 |
+
* `Equals` which checks whether the result is exactly equal (order matters) to a specific vector
|
| 80 |
+
* `UnorderedEquals` which checks whether the result is equal to a specific vector under a permutation
|
| 81 |
+
* `Approx` which checks whether the result is "approx-equal" (order matters, but comparison is done via `Approx`) to a specific vector
|
| 82 |
+
> Approx matcher was [introduced](https://github.com/catchorg/Catch2/issues/1499) in Catch 2.7.2.
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
### Floating point matchers
|
| 86 |
+
Catch2 provides 3 matchers for working with floating point numbers. These
|
| 87 |
+
are `WithinAbsMatcher`, `WithinUlpsMatcher` and `WithinRelMatcher`.
|
| 88 |
+
|
| 89 |
+
The `WithinAbsMatcher` matcher accepts floating point numbers that are
|
| 90 |
+
within a certain distance of target. It should be constructed with the
|
| 91 |
+
`WithinAbs(double target, double margin)` helper.
|
| 92 |
+
|
| 93 |
+
The `WithinUlpsMatcher` matcher accepts floating point numbers that are
|
| 94 |
+
within a certain number of [ULPs](https://en.wikipedia.org/wiki/Unit_in_the_last_place)
|
| 95 |
+
of the target. Because ULP comparisons need to be done differently for
|
| 96 |
+
`float`s and for `double`s, there are two overloads of the helpers for
|
| 97 |
+
this matcher, `WithinULP(float target, int64_t ULPs)`, and
|
| 98 |
+
`WithinULP(double target, int64_t ULPs)`.
|
| 99 |
+
|
| 100 |
+
The `WithinRelMatcher` matcher accepts floating point numbers that are
|
| 101 |
+
_approximately equal_ with the target number with some specific tolerance.
|
| 102 |
+
In other words, it checks that `|lhs - rhs| <= epsilon * max(|lhs|, |rhs|)`,
|
| 103 |
+
with special casing for `INFINITY` and `NaN`. There are _4_ overloads of
|
| 104 |
+
the helpers for this matcher, `WithinRel(double target, double margin)`,
|
| 105 |
+
`WithinRel(float target, float margin)`, `WithinRel(double target)`, and
|
| 106 |
+
`WithinRel(float target)`. The latter two provide a default epsilon of
|
| 107 |
+
machine epsilon * 100.
|
| 108 |
+
|
| 109 |
+
> `WithinRel` matcher was introduced in Catch 2.10.0
|
| 110 |
+
|
| 111 |
+
### Generic matchers
|
| 112 |
+
Catch also aims to provide a set of generic matchers. Currently this set
|
| 113 |
+
contains only a matcher that takes arbitrary callable predicate and applies
|
| 114 |
+
it onto the provided object.
|
| 115 |
+
|
| 116 |
+
Because of type inference limitations, the argument type of the predicate
|
| 117 |
+
has to be provided explicitly. Example:
|
| 118 |
+
```cpp
|
| 119 |
+
REQUIRE_THAT("Hello olleH",
|
| 120 |
+
Predicate<std::string>(
|
| 121 |
+
[] (std::string const& str) -> bool { return str.front() == str.back(); },
|
| 122 |
+
"First and last character should be equal")
|
| 123 |
+
);
|
| 124 |
+
```
|
| 125 |
+
|
| 126 |
+
The second argument is an optional description of the predicate, and is
|
| 127 |
+
used only during reporting of the result.
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
### Exception matchers
|
| 131 |
+
Catch2 also provides an exception matcher that can be used to verify
|
| 132 |
+
that an exception's message exactly matches desired string. The matcher
|
| 133 |
+
is `ExceptionMessageMatcher`, and we also provide a helper function
|
| 134 |
+
`Message`.
|
| 135 |
+
|
| 136 |
+
The matched exception must publicly derive from `std::exception` and
|
| 137 |
+
the message matching is done _exactly_, including case.
|
| 138 |
+
|
| 139 |
+
> `ExceptionMessageMatcher` was introduced in Catch 2.10.0
|
| 140 |
+
|
| 141 |
+
Example use:
|
| 142 |
+
```cpp
|
| 143 |
+
REQUIRE_THROWS_MATCHES(throwsDerivedException(), DerivedException, Message("DerivedException::what"));
|
| 144 |
+
```
|
| 145 |
+
|
| 146 |
+
## Custom matchers
|
| 147 |
+
It's easy to provide your own matchers to extend Catch or just to work with your own types.
|
| 148 |
+
|
| 149 |
+
You need to provide two things:
|
| 150 |
+
1. A matcher class, derived from `Catch::MatcherBase<T>` - where `T` is the type being tested.
|
| 151 |
+
The constructor takes and stores any arguments needed (e.g. something to compare against) and you must
|
| 152 |
+
override two methods: `match()` and `describe()`.
|
| 153 |
+
2. A simple builder function. This is what is actually called from the test code and allows overloading.
|
| 154 |
+
|
| 155 |
+
Here's an example for asserting that an integer falls within a given range
|
| 156 |
+
(note that it is all inline for the sake of keeping the example short):
|
| 157 |
+
|
| 158 |
+
```c++
|
| 159 |
+
// The matcher class
|
| 160 |
+
class IntRange : public Catch::MatcherBase<int> {
|
| 161 |
+
int m_begin, m_end;
|
| 162 |
+
public:
|
| 163 |
+
IntRange( int begin, int end ) : m_begin( begin ), m_end( end ) {}
|
| 164 |
+
|
| 165 |
+
// Performs the test for this matcher
|
| 166 |
+
bool match( int const& i ) const override {
|
| 167 |
+
return i >= m_begin && i <= m_end;
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
// Produces a string describing what this matcher does. It should
|
| 171 |
+
// include any provided data (the begin/ end in this case) and
|
| 172 |
+
// be written as if it were stating a fact (in the output it will be
|
| 173 |
+
// preceded by the value under test).
|
| 174 |
+
virtual std::string describe() const override {
|
| 175 |
+
std::ostringstream ss;
|
| 176 |
+
ss << "is between " << m_begin << " and " << m_end;
|
| 177 |
+
return ss.str();
|
| 178 |
+
}
|
| 179 |
+
};
|
| 180 |
+
|
| 181 |
+
// The builder function
|
| 182 |
+
inline IntRange IsBetween( int begin, int end ) {
|
| 183 |
+
return IntRange( begin, end );
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
// ...
|
| 187 |
+
|
| 188 |
+
// Usage
|
| 189 |
+
TEST_CASE("Integers are within a range")
|
| 190 |
+
{
|
| 191 |
+
CHECK_THAT( 3, IsBetween( 1, 10 ) );
|
| 192 |
+
CHECK_THAT( 100, IsBetween( 1, 10 ) );
|
| 193 |
+
}
|
| 194 |
+
```
|
| 195 |
+
|
| 196 |
+
Running this test gives the following in the console:
|
| 197 |
+
|
| 198 |
+
```
|
| 199 |
+
/**/TestFile.cpp:123: FAILED:
|
| 200 |
+
CHECK_THAT( 100, IsBetween( 1, 10 ) )
|
| 201 |
+
with expansion:
|
| 202 |
+
100 is between 1 and 10
|
| 203 |
+
```
|
| 204 |
+
|
| 205 |
+
---
|
| 206 |
+
|
| 207 |
+
[Home](Readme.md#top)
|
weight/_dep/Catch2/docs/other-macros.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<a id="top"></a>
|
| 2 |
+
# Other macros
|
| 3 |
+
|
| 4 |
+
This page serves as a reference for macros that are not documented
|
| 5 |
+
elsewhere. For now, these macros are separated into 2 rough categories,
|
| 6 |
+
"assertion related macros" and "test case related macros".
|
| 7 |
+
|
| 8 |
+
## Assertion related macros
|
| 9 |
+
|
| 10 |
+
* `CHECKED_IF` and `CHECKED_ELSE`
|
| 11 |
+
|
| 12 |
+
`CHECKED_IF( expr )` is an `if` replacement, that also applies Catch2's
|
| 13 |
+
stringification machinery to the _expr_ and records the result. As with
|
| 14 |
+
`if`, the block after a `CHECKED_IF` is entered only if the expression
|
| 15 |
+
evaluates to `true`. `CHECKED_ELSE( expr )` work similarly, but the block
|
| 16 |
+
is entered only if the _expr_ evaluated to `false`.
|
| 17 |
+
|
| 18 |
+
Example:
|
| 19 |
+
```cpp
|
| 20 |
+
int a = ...;
|
| 21 |
+
int b = ...;
|
| 22 |
+
CHECKED_IF( a == b ) {
|
| 23 |
+
// This block is entered when a == b
|
| 24 |
+
} CHECKED_ELSE ( a == b ) {
|
| 25 |
+
// This block is entered when a != b
|
| 26 |
+
}
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
* `CHECK_NOFAIL`
|
| 30 |
+
|
| 31 |
+
`CHECK_NOFAIL( expr )` is a variant of `CHECK` that does not fail the test
|
| 32 |
+
case if _expr_ evaluates to `false`. This can be useful for checking some
|
| 33 |
+
assumption, that might be violated without the test necessarily failing.
|
| 34 |
+
|
| 35 |
+
Example output:
|
| 36 |
+
```
|
| 37 |
+
main.cpp:6:
|
| 38 |
+
FAILED - but was ok:
|
| 39 |
+
CHECK_NOFAIL( 1 == 2 )
|
| 40 |
+
|
| 41 |
+
main.cpp:7:
|
| 42 |
+
PASSED:
|
| 43 |
+
CHECK( 2 == 2 )
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
* `SUCCEED`
|
| 47 |
+
|
| 48 |
+
`SUCCEED( msg )` is mostly equivalent with `INFO( msg ); REQUIRE( true );`.
|
| 49 |
+
In other words, `SUCCEED` is for cases where just reaching a certain line
|
| 50 |
+
means that the test has been a success.
|
| 51 |
+
|
| 52 |
+
Example usage:
|
| 53 |
+
```cpp
|
| 54 |
+
TEST_CASE( "SUCCEED showcase" ) {
|
| 55 |
+
int I = 1;
|
| 56 |
+
SUCCEED( "I is " << I );
|
| 57 |
+
}
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
* `STATIC_REQUIRE`
|
| 61 |
+
|
| 62 |
+
> [Introduced](https://github.com/catchorg/Catch2/issues/1362) in Catch 2.4.2.
|
| 63 |
+
|
| 64 |
+
`STATIC_REQUIRE( expr )` is a macro that can be used the same way as a
|
| 65 |
+
`static_assert`, but also registers the success with Catch2, so it is
|
| 66 |
+
reported as a success at runtime. The whole check can also be deferred
|
| 67 |
+
to the runtime, by defining `CATCH_CONFIG_RUNTIME_STATIC_REQUIRE` before
|
| 68 |
+
including the Catch2 header.
|
| 69 |
+
|
| 70 |
+
Example:
|
| 71 |
+
```cpp
|
| 72 |
+
TEST_CASE("STATIC_REQUIRE showcase", "[traits]") {
|
| 73 |
+
STATIC_REQUIRE( std::is_void<void>::value );
|
| 74 |
+
STATIC_REQUIRE_FALSE( std::is_void<int>::value );
|
| 75 |
+
}
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
## Test case related macros
|
| 79 |
+
|
| 80 |
+
* `METHOD_AS_TEST_CASE`
|
| 81 |
+
|
| 82 |
+
`METHOD_AS_TEST_CASE( member-function-pointer, description )` lets you
|
| 83 |
+
register a member function of a class as a Catch2 test case. The class
|
| 84 |
+
will be separately instantiated for each method registered in this way.
|
| 85 |
+
|
| 86 |
+
```cpp
|
| 87 |
+
class TestClass {
|
| 88 |
+
std::string s;
|
| 89 |
+
|
| 90 |
+
public:
|
| 91 |
+
TestClass()
|
| 92 |
+
:s( "hello" )
|
| 93 |
+
{}
|
| 94 |
+
|
| 95 |
+
void testCase() {
|
| 96 |
+
REQUIRE( s == "hello" );
|
| 97 |
+
}
|
| 98 |
+
};
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
METHOD_AS_TEST_CASE( TestClass::testCase, "Use class's method as a test case", "[class]" )
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
* `REGISTER_TEST_CASE`
|
| 105 |
+
|
| 106 |
+
`REGISTER_TEST_CASE( function, description )` let's you register
|
| 107 |
+
a `function` as a test case. The function has to have `void()` signature,
|
| 108 |
+
the description can contain both name and tags.
|
| 109 |
+
|
| 110 |
+
Example:
|
| 111 |
+
```cpp
|
| 112 |
+
REGISTER_TEST_CASE( someFunction, "ManuallyRegistered", "[tags]" );
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
_Note that the registration still has to happen before Catch2's session
|
| 116 |
+
is initiated. This means that it either needs to be done in a global
|
| 117 |
+
constructor, or before Catch2's session is created in user's own main._
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
* `ANON_TEST_CASE`
|
| 121 |
+
|
| 122 |
+
`ANON_TEST_CASE` is a `TEST_CASE` replacement that will autogenerate
|
| 123 |
+
unique name. The advantage of this is that you do not have to think
|
| 124 |
+
of a name for the test case, the disadvantage is that the name doesn't
|
| 125 |
+
necessarily remain stable across different links, and thus it might be
|
| 126 |
+
hard to run directly.
|
| 127 |
+
|
| 128 |
+
Example:
|
| 129 |
+
```cpp
|
| 130 |
+
ANON_TEST_CASE() {
|
| 131 |
+
SUCCEED("Hello from anonymous test case");
|
| 132 |
+
}
|
| 133 |
+
```
|
| 134 |
+
|
| 135 |
+
* `DYNAMIC_SECTION`
|
| 136 |
+
|
| 137 |
+
> Introduced in Catch 2.3.0.
|
| 138 |
+
|
| 139 |
+
`DYNAMIC_SECTION` is a `SECTION` where the user can use `operator<<` to
|
| 140 |
+
create the final name for that section. This can be useful with e.g.
|
| 141 |
+
generators, or when creating a `SECTION` dynamically, within a loop.
|
| 142 |
+
|
| 143 |
+
Example:
|
| 144 |
+
```cpp
|
| 145 |
+
TEST_CASE( "looped SECTION tests" ) {
|
| 146 |
+
int a = 1;
|
| 147 |
+
|
| 148 |
+
for( int b = 0; b < 10; ++b ) {
|
| 149 |
+
DYNAMIC_SECTION( "b is currently: " << b ) {
|
| 150 |
+
CHECK( b > a );
|
| 151 |
+
}
|
| 152 |
+
}
|
| 153 |
+
}
|
| 154 |
+
```
|
weight/_dep/Catch2/docs/own-main.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<a id="top"></a>
|
| 2 |
+
# Supplying main() yourself
|
| 3 |
+
|
| 4 |
+
**Contents**<br>
|
| 5 |
+
[Let Catch take full control of args and config](#let-catch-take-full-control-of-args-and-config)<br>
|
| 6 |
+
[Amending the config](#amending-the-config)<br>
|
| 7 |
+
[Adding your own command line options](#adding-your-own-command-line-options)<br>
|
| 8 |
+
[Version detection](#version-detection)<br>
|
| 9 |
+
|
| 10 |
+
The easiest way to use Catch is to let it supply ```main()``` for you and handle configuring itself from the command line.
|
| 11 |
+
|
| 12 |
+
This is achieved by writing ```#define CATCH_CONFIG_MAIN``` before the ```#include "catch.hpp"``` in *exactly one* source file.
|
| 13 |
+
|
| 14 |
+
Sometimes, though, you need to write your own version of main(). You can do this by writing ```#define CATCH_CONFIG_RUNNER``` instead. Now you are free to write ```main()``` as normal and call into Catch yourself manually. You now have a lot of flexibility - but here are three recipes to get your started:
|
| 15 |
+
|
| 16 |
+
**Important note: you can only provide `main` in the same file you defined `CATCH_CONFIG_RUNNER`.**
|
| 17 |
+
|
| 18 |
+
## Let Catch take full control of args and config
|
| 19 |
+
|
| 20 |
+
If you just need to have code that executes before and/ or after Catch this is the simplest option.
|
| 21 |
+
|
| 22 |
+
```c++
|
| 23 |
+
#define CATCH_CONFIG_RUNNER
|
| 24 |
+
#include "catch.hpp"
|
| 25 |
+
|
| 26 |
+
int main( int argc, char* argv[] ) {
|
| 27 |
+
// global setup...
|
| 28 |
+
|
| 29 |
+
int result = Catch::Session().run( argc, argv );
|
| 30 |
+
|
| 31 |
+
// global clean-up...
|
| 32 |
+
|
| 33 |
+
return result;
|
| 34 |
+
}
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
## Amending the config
|
| 38 |
+
|
| 39 |
+
If you still want Catch to process the command line, but you want to programmatically tweak the config, you can do so in one of two ways:
|
| 40 |
+
|
| 41 |
+
```c++
|
| 42 |
+
#define CATCH_CONFIG_RUNNER
|
| 43 |
+
#include "catch.hpp"
|
| 44 |
+
|
| 45 |
+
int main( int argc, char* argv[] )
|
| 46 |
+
{
|
| 47 |
+
Catch::Session session; // There must be exactly one instance
|
| 48 |
+
|
| 49 |
+
// writing to session.configData() here sets defaults
|
| 50 |
+
// this is the preferred way to set them
|
| 51 |
+
|
| 52 |
+
int returnCode = session.applyCommandLine( argc, argv );
|
| 53 |
+
if( returnCode != 0 ) // Indicates a command line error
|
| 54 |
+
return returnCode;
|
| 55 |
+
|
| 56 |
+
// writing to session.configData() or session.Config() here
|
| 57 |
+
// overrides command line args
|
| 58 |
+
// only do this if you know you need to
|
| 59 |
+
|
| 60 |
+
int numFailed = session.run();
|
| 61 |
+
|
| 62 |
+
// numFailed is clamped to 255 as some unices only use the lower 8 bits.
|
| 63 |
+
// This clamping has already been applied, so just return it here
|
| 64 |
+
// You can also do any post run clean-up here
|
| 65 |
+
return numFailed;
|
| 66 |
+
}
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
Take a look at the definitions of Config and ConfigData to see what you can do with them.
|
| 70 |
+
|
| 71 |
+
To take full control of the config simply omit the call to ```applyCommandLine()```.
|
| 72 |
+
|
| 73 |
+
## Adding your own command line options
|
| 74 |
+
|
| 75 |
+
Catch embeds a powerful command line parser called [Clara](https://github.com/philsquared/Clara).
|
| 76 |
+
As of Catch2 (and Clara 1.0) Clara allows you to write _composable_ option and argument parsers,
|
| 77 |
+
so extending Catch's own command line options is now easy.
|
| 78 |
+
|
| 79 |
+
```c++
|
| 80 |
+
#define CATCH_CONFIG_RUNNER
|
| 81 |
+
#include "catch.hpp"
|
| 82 |
+
|
| 83 |
+
int main( int argc, char* argv[] )
|
| 84 |
+
{
|
| 85 |
+
Catch::Session session; // There must be exactly one instance
|
| 86 |
+
|
| 87 |
+
int height = 0; // Some user variable you want to be able to set
|
| 88 |
+
|
| 89 |
+
// Build a new parser on top of Catch's
|
| 90 |
+
using namespace Catch::clara;
|
| 91 |
+
auto cli
|
| 92 |
+
= session.cli() // Get Catch's composite command line parser
|
| 93 |
+
| Opt( height, "height" ) // bind variable to a new option, with a hint string
|
| 94 |
+
["-g"]["--height"] // the option names it will respond to
|
| 95 |
+
("how high?"); // description string for the help output
|
| 96 |
+
|
| 97 |
+
// Now pass the new composite back to Catch so it uses that
|
| 98 |
+
session.cli( cli );
|
| 99 |
+
|
| 100 |
+
// Let Catch (using Clara) parse the command line
|
| 101 |
+
int returnCode = session.applyCommandLine( argc, argv );
|
| 102 |
+
if( returnCode != 0 ) // Indicates a command line error
|
| 103 |
+
return returnCode;
|
| 104 |
+
|
| 105 |
+
// if set on the command line then 'height' is now set at this point
|
| 106 |
+
if( height > 0 )
|
| 107 |
+
std::cout << "height: " << height << std::endl;
|
| 108 |
+
|
| 109 |
+
return session.run();
|
| 110 |
+
}
|
| 111 |
+
```
|
| 112 |
+
|
| 113 |
+
See the [Clara documentation](https://github.com/philsquared/Clara/blob/master/README.md) for more details.
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
## Version detection
|
| 117 |
+
|
| 118 |
+
Catch provides a triplet of macros providing the header's version,
|
| 119 |
+
|
| 120 |
+
* `CATCH_VERSION_MAJOR`
|
| 121 |
+
* `CATCH_VERSION_MINOR`
|
| 122 |
+
* `CATCH_VERSION_PATCH`
|
| 123 |
+
|
| 124 |
+
these macros expand into a single number, that corresponds to the appropriate
|
| 125 |
+
part of the version. As an example, given single header version v2.3.4,
|
| 126 |
+
the macros would expand into `2`, `3`, and `4` respectively.
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
---
|
| 130 |
+
|
| 131 |
+
[Home](Readme.md#top)
|
weight/_dep/Catch2/docs/release-notes.md
ADDED
|
@@ -0,0 +1,1316 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<a id="top"></a>
|
| 2 |
+
|
| 3 |
+
# Release notes
|
| 4 |
+
**Contents**<br>
|
| 5 |
+
[2.13.9](#2139)<br>
|
| 6 |
+
[2.13.8](#2138)<br>
|
| 7 |
+
[2.13.7](#2137)<br>
|
| 8 |
+
[2.13.6](#2136)<br>
|
| 9 |
+
[2.13.5](#2135)<br>
|
| 10 |
+
[2.13.4](#2134)<br>
|
| 11 |
+
[2.13.3](#2133)<br>
|
| 12 |
+
[2.13.2](#2132)<br>
|
| 13 |
+
[2.13.1](#2131)<br>
|
| 14 |
+
[2.13.0](#2130)<br>
|
| 15 |
+
[2.12.4](#2124)<br>
|
| 16 |
+
[2.12.3](#2123)<br>
|
| 17 |
+
[2.12.2](#2122)<br>
|
| 18 |
+
[2.12.1](#2121)<br>
|
| 19 |
+
[2.12.0](#2120)<br>
|
| 20 |
+
[2.11.3](#2113)<br>
|
| 21 |
+
[2.11.2](#2112)<br>
|
| 22 |
+
[2.11.1](#2111)<br>
|
| 23 |
+
[2.11.0](#2110)<br>
|
| 24 |
+
[2.10.2](#2102)<br>
|
| 25 |
+
[2.10.1](#2101)<br>
|
| 26 |
+
[2.10.0](#2100)<br>
|
| 27 |
+
[2.9.2](#292)<br>
|
| 28 |
+
[2.9.1](#291)<br>
|
| 29 |
+
[2.9.0](#290)<br>
|
| 30 |
+
[2.8.0](#280)<br>
|
| 31 |
+
[2.7.2](#272)<br>
|
| 32 |
+
[2.7.1](#271)<br>
|
| 33 |
+
[2.7.0](#270)<br>
|
| 34 |
+
[2.6.1](#261)<br>
|
| 35 |
+
[2.6.0](#260)<br>
|
| 36 |
+
[2.5.0](#250)<br>
|
| 37 |
+
[2.4.2](#242)<br>
|
| 38 |
+
[2.4.1](#241)<br>
|
| 39 |
+
[2.4.0](#240)<br>
|
| 40 |
+
[2.3.0](#230)<br>
|
| 41 |
+
[2.2.3](#223)<br>
|
| 42 |
+
[2.2.2](#222)<br>
|
| 43 |
+
[2.2.1](#221)<br>
|
| 44 |
+
[2.2.0](#220)<br>
|
| 45 |
+
[2.1.2](#212)<br>
|
| 46 |
+
[2.1.1](#211)<br>
|
| 47 |
+
[2.1.0](#210)<br>
|
| 48 |
+
[2.0.1](#201)<br>
|
| 49 |
+
[Older versions](#older-versions)<br>
|
| 50 |
+
[Even Older versions](#even-older-versions)<br>
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
## 2.13.9
|
| 54 |
+
|
| 55 |
+
### Fixes
|
| 56 |
+
* Fixed issue with `-#` (filename-as-tag) flag when `__FILE__` expands into filename without directories (#2328, #2393)
|
| 57 |
+
* Fixed `CAPTURE` macro not being variadic when disabled through `CATCH_CONFIG_DISABLE` (#2316, #2378)
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
## 2.13.8
|
| 61 |
+
|
| 62 |
+
### Fixes
|
| 63 |
+
* Made `Approx::operator()` const (#2288)
|
| 64 |
+
* Improved pkg-config files (#2284)
|
| 65 |
+
* Fixed warning suppression leaking out of Catch2 when compiled with clang.exe (#2280)
|
| 66 |
+
* The macro-generated names for things like `TEST_CASE` no longer create reserved identifiers (#2336)
|
| 67 |
+
|
| 68 |
+
### Improvements
|
| 69 |
+
* Clang-tidy should no longer warn about missing virtual dispatch in `FilterGenerator`'s constructor (#2314)
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
## 2.13.7
|
| 73 |
+
|
| 74 |
+
### Fixes
|
| 75 |
+
* Added missing `<iterator>` include in benchmarking. (#2231)
|
| 76 |
+
* Fixed noexcept build with benchmarking enabled (#2235)
|
| 77 |
+
* Fixed build for compilers with C++17 support but without C++17 library support (#2195)
|
| 78 |
+
* JUnit only uses 3 decimal places when reporting durations (#2221)
|
| 79 |
+
* `!mayfail` tagged tests are now marked as `skipped` in JUnit reporter output (#2116)
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
## 2.13.6
|
| 83 |
+
|
| 84 |
+
### Fixes
|
| 85 |
+
* Disabling all signal handlers no longer breaks compilation (#2212, #2213)
|
| 86 |
+
|
| 87 |
+
### Miscellaneous
|
| 88 |
+
* `catch_discover_tests` should handle escaped semicolon (`;`) better (#2214, #2215)
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
## 2.13.5
|
| 92 |
+
|
| 93 |
+
### Improvements
|
| 94 |
+
* Detection of MAC and IPHONE platforms has been improved (#2140, #2157)
|
| 95 |
+
* Added workaround for bug in XLC 16.1.0.1 (#2155)
|
| 96 |
+
* Add detection for LCC when it is masquerading as GCC (#2199)
|
| 97 |
+
* Modified posix signal handling so it supports newer libcs (#2178)
|
| 98 |
+
* `MINSIGSTKSZ` was no longer usable in constexpr context.
|
| 99 |
+
|
| 100 |
+
### Fixes
|
| 101 |
+
* Fixed compilation of benchmarking when `min` and `max` macros are defined (#2159)
|
| 102 |
+
* Including `windows.h` without `NOMINMAX` remains a really bad idea, don't do it
|
| 103 |
+
|
| 104 |
+
### Miscellaneous
|
| 105 |
+
* `Catch2WithMain` target (static library) is no longer built by default (#2142)
|
| 106 |
+
* Building it by default was at best unnecessary overhead for people not using it, and at worst it caused trouble with install paths
|
| 107 |
+
* To have it built, set CMake option `CATCH_BUILD_STATIC_LIBRARY` to `ON`
|
| 108 |
+
* The check whether Catch2 is being built as a subproject is now more reliable (#2202, #2204)
|
| 109 |
+
* The problem was that if the variable name used internally was defined the project including Catch2 as subproject, it would not be properly overwritten for Catch2's CMake.
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
## 2.13.4
|
| 113 |
+
|
| 114 |
+
### Improvements
|
| 115 |
+
* Improved the hashing algorithm used for shuffling test cases (#2070)
|
| 116 |
+
* `TEST_CASE`s that differ only in the last character should be properly shuffled
|
| 117 |
+
* Note that this means that v2.13.4 gives you a different order of test cases than 2.13.3, even given the same seed.
|
| 118 |
+
|
| 119 |
+
### Miscellaneous
|
| 120 |
+
* Deprecated `ParseAndAddCatchTests` CMake integration (#2092)
|
| 121 |
+
* It is impossible to implement it properly for all the different test case variants Catch2 provides, and there are better options provided.
|
| 122 |
+
* Use `catch_discover_tests` instead, which uses runtime information about available tests.
|
| 123 |
+
* Fixed bug in `catch_discover_tests` that would cause it to fail when used in specific project structures (#2119)
|
| 124 |
+
* Added Bazel build file
|
| 125 |
+
* Added an experimental static library target to CMake
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
## 2.13.3
|
| 129 |
+
|
| 130 |
+
### Fixes
|
| 131 |
+
* Fixed possible infinite loop when combining generators with section filter (`-c` option) (#2025)
|
| 132 |
+
|
| 133 |
+
### Miscellaneous
|
| 134 |
+
* Fixed `ParseAndAddCatchTests` not finding `TEST_CASE`s without tags (#2055, #2056)
|
| 135 |
+
* `ParseAndAddCatchTests` supports `CMP0110` policy for changing behaviour of `add_test` (#2057)
|
| 136 |
+
* This was the shortlived change in CMake 3.18.0 that temporarily broke `ParseAndAddCatchTests`
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
## 2.13.2
|
| 140 |
+
|
| 141 |
+
### Improvements
|
| 142 |
+
* Implemented workaround for AppleClang shadowing bug (#2030)
|
| 143 |
+
* Implemented workaround for NVCC ICE (#2005, #2027)
|
| 144 |
+
|
| 145 |
+
### Fixes
|
| 146 |
+
* Fixed detection of `std::uncaught_exceptions` support under non-msvc platforms (#2021)
|
| 147 |
+
* Fixed the experimental stdout/stderr capture under Windows (#2013)
|
| 148 |
+
|
| 149 |
+
### Miscellaneous
|
| 150 |
+
* `catch_discover_tests` has been improved significantly (#2023, #2039)
|
| 151 |
+
* You can now specify which reporter should be used
|
| 152 |
+
* You can now modify where the output will be written
|
| 153 |
+
* `WORKING_DIRECTORY` setting is respected
|
| 154 |
+
* `ParseAndAddCatchTests` now supports `TEMPLATE_TEST_CASE` macros (#2031)
|
| 155 |
+
* Various documentation fixes and improvements (#2022, #2028, #2034)
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
## 2.13.1
|
| 159 |
+
|
| 160 |
+
### Improvements
|
| 161 |
+
* `ParseAndAddCatchTests` handles CMake v3.18.0 correctly (#1984)
|
| 162 |
+
* Improved autodetection of `std::byte` (#1992)
|
| 163 |
+
* Simplified implementation of templated test cases (#2007)
|
| 164 |
+
* This should have a tiny positive effect on its compilation throughput
|
| 165 |
+
|
| 166 |
+
### Fixes
|
| 167 |
+
* Automatic stringification of ranges handles sentinel ranges properly (#2004)
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
## 2.13.0
|
| 171 |
+
|
| 172 |
+
### Improvements
|
| 173 |
+
* `GENERATE` can now follow a `SECTION` at the same level of nesting (#1938)
|
| 174 |
+
* The `SECTION`(s) before the `GENERATE` will not be run multiple times, the following ones will.
|
| 175 |
+
* Added `-D`/`--min-duration` command line flag (#1910)
|
| 176 |
+
* If a test takes longer to finish than the provided value, its name and duration will be printed.
|
| 177 |
+
* This flag is overriden by setting `-d`/`--duration`.
|
| 178 |
+
|
| 179 |
+
### Fixes
|
| 180 |
+
* `TAPReporter` no longer skips successful assertions (#1983)
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
## 2.12.4
|
| 184 |
+
|
| 185 |
+
### Improvements
|
| 186 |
+
* Added support for MacOS on ARM (#1971)
|
| 187 |
+
|
| 188 |
+
|
| 189 |
+
## 2.12.3
|
| 190 |
+
|
| 191 |
+
### Fixes
|
| 192 |
+
* `GENERATE` nested in a for loop no longer creates multiple generators (#1913)
|
| 193 |
+
* Fixed copy paste error breaking `TEMPLATE_TEST_CASE_SIG` for 6 or more arguments (#1954)
|
| 194 |
+
* Fixed potential UB when handling non-ASCII characters in CLI args (#1943)
|
| 195 |
+
|
| 196 |
+
### Improvements
|
| 197 |
+
* There can be multiple calls to `GENERATE` on a single line
|
| 198 |
+
* Improved `fno-except` support for platforms that do not provide shims for exception-related std functions (#1950)
|
| 199 |
+
* E.g. the Green Hills C++ compiler
|
| 200 |
+
* XmlReporter now also reports test-case-level statistics (#1958)
|
| 201 |
+
* This is done via a new element, `OverallResultsCases`
|
| 202 |
+
|
| 203 |
+
### Miscellaneous
|
| 204 |
+
* Added `.clang-format` file to the repo (#1182, #1920)
|
| 205 |
+
* Rewrote contributing docs
|
| 206 |
+
* They should explain the different levels of testing and so on much better
|
| 207 |
+
|
| 208 |
+
|
| 209 |
+
## 2.12.2
|
| 210 |
+
|
| 211 |
+
### Fixes
|
| 212 |
+
* Fixed compilation failure if `is_range` ADL found deleted function (#1929)
|
| 213 |
+
* Fixed potential UB in `CAPTURE` if the expression contained non-ASCII characters (#1925)
|
| 214 |
+
|
| 215 |
+
### Improvements
|
| 216 |
+
* `std::result_of` is not used if `std::invoke_result` is available (#1934)
|
| 217 |
+
* JUnit reporter writes out `status` attribute for tests (#1899)
|
| 218 |
+
* Suppresed clang-tidy's `hicpp-vararg` warning (#1921)
|
| 219 |
+
* Catch2 was already suppressing the `cppcoreguidelines-pro-type-vararg` alias of the warning
|
| 220 |
+
|
| 221 |
+
|
| 222 |
+
## 2.12.1
|
| 223 |
+
|
| 224 |
+
### Fixes
|
| 225 |
+
* Vector matchers now support initializer list literals better
|
| 226 |
+
|
| 227 |
+
### Improvements
|
| 228 |
+
* Added support for `^` (bitwise xor) to `CHECK` and `REQUIRE`
|
| 229 |
+
|
| 230 |
+
|
| 231 |
+
## 2.12.0
|
| 232 |
+
|
| 233 |
+
### Improvements
|
| 234 |
+
* Running tests in random order (`--order rand`) has been reworked significantly (#1908)
|
| 235 |
+
* Given same seed, all platforms now produce the same order
|
| 236 |
+
* Given same seed, the relative order of tests does not change if you select only a subset of them
|
| 237 |
+
* Vector matchers support custom allocators (#1909)
|
| 238 |
+
* `|` and `&` (bitwise or and bitwise and) are now supported in `CHECK` and `REQUIRE`
|
| 239 |
+
* The resulting type must be convertible to `bool`
|
| 240 |
+
|
| 241 |
+
### Fixes
|
| 242 |
+
* Fixed computation of benchmarking column widths in ConsoleReporter (#1885, #1886)
|
| 243 |
+
* Suppressed clang-tidy's `cppcoreguidelines-pro-type-vararg` in assertions (#1901)
|
| 244 |
+
* It was a false positive trigered by the new warning support workaround
|
| 245 |
+
* Fixed bug in test specification parser handling of OR'd patterns using escaping (#1905)
|
| 246 |
+
|
| 247 |
+
### Miscellaneous
|
| 248 |
+
* Worked around IBM XL's codegen bug (#1907)
|
| 249 |
+
* It would emit code for _destructors_ of temporaries in an unevaluated context
|
| 250 |
+
* Improved detection of stdlib's support for `std::uncaught_exceptions` (#1911)
|
| 251 |
+
|
| 252 |
+
|
| 253 |
+
## 2.11.3
|
| 254 |
+
|
| 255 |
+
### Fixes
|
| 256 |
+
* Fixed compilation error caused by lambdas in assertions under MSVC
|
| 257 |
+
|
| 258 |
+
|
| 259 |
+
## 2.11.2
|
| 260 |
+
|
| 261 |
+
### Improvements
|
| 262 |
+
* GCC and Clang now issue warnings for suspicious code in assertions (#1880)
|
| 263 |
+
* E.g. `REQUIRE( int != unsigned int )` will now issue mixed signedness comparison warning
|
| 264 |
+
* This has always worked on MSVC, but it now also works for GCC and current Clang versions
|
| 265 |
+
* Colorization of "Test filters" output should be more robust now
|
| 266 |
+
* `--wait-for-keypress` now also accepts `never` as an option (#1866)
|
| 267 |
+
* Reporters no longer round-off nanoseconds when reporting benchmarking results (#1876)
|
| 268 |
+
* Catch2's debug break now supports iOS while using Thumb instruction set (#1862)
|
| 269 |
+
* It is now possible to customize benchmark's warm-up time when running the test binary (#1844)
|
| 270 |
+
* `--benchmark-warmup-time {ms}`
|
| 271 |
+
* User can now specify how Catch2 should break into debugger (#1846)
|
| 272 |
+
|
| 273 |
+
### Fixes
|
| 274 |
+
* Fixes missing `<random>` include in benchmarking (#1831)
|
| 275 |
+
* Fixed missing `<iterator>` include in benchmarking (#1874)
|
| 276 |
+
* Hidden test cases are now also tagged with `[!hide]` as per documentation (#1847)
|
| 277 |
+
* Detection of whether libc provides `std::nextafter` has been improved (#1854)
|
| 278 |
+
* Detection of `wmain` no longer incorrectly looks for `WIN32` macro (#1849)
|
| 279 |
+
* Now it just detects Windows platform
|
| 280 |
+
* Composing already-composed matchers no longer modifies the partially-composed matcher expression
|
| 281 |
+
* This bug has been present for the last ~2 years and nobody reported it
|
| 282 |
+
|
| 283 |
+
|
| 284 |
+
## 2.11.1
|
| 285 |
+
|
| 286 |
+
### Improvements
|
| 287 |
+
* Breaking into debugger is supported on iOS (#1817)
|
| 288 |
+
* `google-build-using-namespace` clang-tidy warning is suppressed (#1799)
|
| 289 |
+
|
| 290 |
+
### Fixes
|
| 291 |
+
* Clang on Windows is no longer assumed to implement MSVC's traditional preprocessor (#1806)
|
| 292 |
+
* `ObjectStorage` now behaves properly in `const` contexts (#1820)
|
| 293 |
+
* `GENERATE_COPY(a, b)` now compiles properly (#1809, #1815)
|
| 294 |
+
* Some more cleanups in the benchmarking support
|
| 295 |
+
|
| 296 |
+
|
| 297 |
+
## 2.11.0
|
| 298 |
+
|
| 299 |
+
### Improvements
|
| 300 |
+
* JUnit reporter output now contains more details in case of failure (#1347, #1719)
|
| 301 |
+
* Added SonarQube Test Data reporter (#1738)
|
| 302 |
+
* It is in a separate header, just like the TAP, Automake, and TeamCity reporters
|
| 303 |
+
* `range` generator now allows floating point numbers (#1776)
|
| 304 |
+
* Reworked part of internals to increase throughput
|
| 305 |
+
|
| 306 |
+
|
| 307 |
+
### Fixes
|
| 308 |
+
* The single header version should contain full benchmarking support (#1800)
|
| 309 |
+
* `[.foo]` is now properly parsed as `[.][foo]` when used on the command line (#1798)
|
| 310 |
+
* Fixed compilation of benchmarking on platforms where `steady_clock::period` is not `std::nano` (#1794)
|
| 311 |
+
|
| 312 |
+
|
| 313 |
+
|
| 314 |
+
## 2.10.2
|
| 315 |
+
|
| 316 |
+
### Improvements
|
| 317 |
+
* Catch2 will now compile on platform where `INFINITY` is double (#1782)
|
| 318 |
+
|
| 319 |
+
|
| 320 |
+
### Fixes
|
| 321 |
+
* Warning suppressed during listener registration will no longer leak
|
| 322 |
+
|
| 323 |
+
|
| 324 |
+
|
| 325 |
+
## 2.10.1
|
| 326 |
+
|
| 327 |
+
### Improvements
|
| 328 |
+
* Catch2 now guards itself against `min` and `max` macros from `windows.h` (#1772)
|
| 329 |
+
* Templated tests will now compile with ICC (#1748)
|
| 330 |
+
* `WithinULP` matcher now uses scientific notation for stringification (#1760)
|
| 331 |
+
|
| 332 |
+
|
| 333 |
+
### Fixes
|
| 334 |
+
* Templated tests no longer trigger `-Wunused-templates` (#1762)
|
| 335 |
+
* Suppressed clang-analyzer false positive in context getter (#1230, #1735)
|
| 336 |
+
|
| 337 |
+
|
| 338 |
+
### Miscellaneous
|
| 339 |
+
* CMake no longer prohibits in-tree build when Catch2 is used as a subproject (#1773, #1774)
|
| 340 |
+
|
| 341 |
+
|
| 342 |
+
|
| 343 |
+
## 2.10.0
|
| 344 |
+
|
| 345 |
+
### Fixes
|
| 346 |
+
* `TEMPLATE_LIST_TEST_CASE` now properly handles non-copyable and non-movable types (#1729)
|
| 347 |
+
* Fixed compilation error on Solaris caused by a system header defining macro `TT` (#1722, #1723)
|
| 348 |
+
* `REGISTER_ENUM` will now fail at compilation time if the registered enum is too large
|
| 349 |
+
* Removed use of `std::is_same_v` in C++17 mode (#1757)
|
| 350 |
+
* Fixed parsing of escaped special characters when reading test specs from a file (#1767, #1769)
|
| 351 |
+
|
| 352 |
+
|
| 353 |
+
### Improvements
|
| 354 |
+
* Trailing and leading whitespace in test/section specs are now ignored.
|
| 355 |
+
* Writing to Android debug log now uses `__android_log_write` instead of `__android_log_print`
|
| 356 |
+
* Android logging support can now be turned on/off at compile time (#1743)
|
| 357 |
+
* The toggle is `CATCH_CONFIG_ANDROID_LOGWRITE`
|
| 358 |
+
* Added a generator that returns elements of a range
|
| 359 |
+
* Use via `from_range(from, to)` or `from_range(container)`
|
| 360 |
+
* Added support for CRTs that do not provide `std::nextafter` (#1739)
|
| 361 |
+
* They must still provide global `nextafter{f,l,}`
|
| 362 |
+
* Enabled via `CATCH_CONFIG_GLOBAL_NEXTAFTER`
|
| 363 |
+
* Special cased `Approx(inf)` not to match non-infinite values
|
| 364 |
+
* Very strictly speaking this might be a breaking change, but it should match user expectations better
|
| 365 |
+
* The output of benchmarking through the Console reporter when `--benchmark-no-analysis` is set is now much simpler (#1768)
|
| 366 |
+
* Added a matcher that can be used for checking an exceptions message (#1649, #1728)
|
| 367 |
+
* The matcher helper function is called `Message`
|
| 368 |
+
* The exception must publicly derive from `std::exception`
|
| 369 |
+
* The matching is done exactly, including case and whitespace
|
| 370 |
+
* Added a matcher that can be used for checking relative equality of floating point numbers (#1746)
|
| 371 |
+
* Unlike `Approx`, it considers both sides when determining the allowed margin
|
| 372 |
+
* Special cases `NaN` and `INFINITY` to match user expectations
|
| 373 |
+
* The matcher helper function is called `WithinRel`
|
| 374 |
+
* The ULP matcher now allows for any possible distance between the two numbers
|
| 375 |
+
* The random number generators now use Catch-global instance of RNG (#1734, #1736)
|
| 376 |
+
* This means that nested random number generators actually generate different numbers
|
| 377 |
+
|
| 378 |
+
|
| 379 |
+
### Miscellaneous
|
| 380 |
+
* In-repo PNGs have been optimized to lower overhead of using Catch2 via git clone
|
| 381 |
+
* Catch2 now uses its own implementation of the URBG concept
|
| 382 |
+
* In the future we also plan to use our own implementation of the distributions from `<random>` to provide cross-platform repeatability of random results
|
| 383 |
+
|
| 384 |
+
|
| 385 |
+
|
| 386 |
+
## 2.9.2
|
| 387 |
+
|
| 388 |
+
### Fixes
|
| 389 |
+
* `ChunkGenerator` can now be used with chunks of size 0 (#1671)
|
| 390 |
+
* Nested subsections are now run properly when specific section is run via the `-c` argument (#1670, #1673)
|
| 391 |
+
* Catch2 now consistently uses `_WIN32` to detect Windows platform (#1676)
|
| 392 |
+
* `TEMPLATE_LIST_TEST_CASE` now support non-default constructible type lists (#1697)
|
| 393 |
+
* Fixed a crash in the XMLReporter when a benchmark throws exception during warmup (#1706)
|
| 394 |
+
* Fixed a possible infinite loop in CompactReporter (#1715)
|
| 395 |
+
* Fixed `-w NoTests` returning 0 even when no tests were matched (#1449, #1683, #1684)
|
| 396 |
+
* Fixed matcher compilation under Obj-C++ (#1661)
|
| 397 |
+
|
| 398 |
+
### Improvements
|
| 399 |
+
* `RepeatGenerator` and `FixedValuesGenerator` now fail to compile when used with `bool` (#1692)
|
| 400 |
+
* Previously they would fail at runtime.
|
| 401 |
+
* Catch2 now supports Android's debug logging for its debug output (#1710)
|
| 402 |
+
* Catch2 now detects and configures itself for the RTX platform (#1693)
|
| 403 |
+
* You still need to pass `--benchmark-no-analysis` if you are using benchmarking under RTX
|
| 404 |
+
* Removed a "storage class is not first" warning when compiling Catch2 with PGI compiler (#1717)
|
| 405 |
+
|
| 406 |
+
### Miscellaneous
|
| 407 |
+
* Documentation now contains indication when a specific feature was introduced (#1695)
|
| 408 |
+
* These start with Catch2 v2.3.0, (a bit over a year ago).
|
| 409 |
+
* `docs/contributing.md` has been updated to provide contributors guidance on how to add these to newly written documentation
|
| 410 |
+
* Various other documentation improvements
|
| 411 |
+
* ToC fixes
|
| 412 |
+
* Documented `--order` and `--rng-seed` command line options
|
| 413 |
+
* Benchmarking documentation now clearly states that it requires opt-in
|
| 414 |
+
* Documented `CATCH_CONFIG_CPP17_OPTIONAL` and `CATCH_CONFIG_CPP17_BYTE` macros
|
| 415 |
+
* Properly documented built-in vector matchers
|
| 416 |
+
* Improved `*_THROWS_MATCHES` documentation a bit
|
| 417 |
+
* CMake config file is now arch-independent even if `CMAKE_SIZEOF_VOID_P` is in CMake cache (#1660)
|
| 418 |
+
* `CatchAddTests` now properly escapes `[` and `]` in test names (#1634, #1698)
|
| 419 |
+
* Reverted `CatchAddTests` adding tags as CTest labels (#1658)
|
| 420 |
+
* The script broke when test names were too long
|
| 421 |
+
* Overwriting `LABELS` caused trouble for users who set them manually
|
| 422 |
+
* CMake does not let users append to `LABELS` if the test name has spaces
|
| 423 |
+
|
| 424 |
+
|
| 425 |
+
## 2.9.1
|
| 426 |
+
|
| 427 |
+
### Fixes
|
| 428 |
+
* Fix benchmarking compilation failure in files without `CATCH_CONFIG_EXTERNAL_INTERFACES` (or implementation)
|
| 429 |
+
|
| 430 |
+
## 2.9.0
|
| 431 |
+
|
| 432 |
+
### Improvements
|
| 433 |
+
* The experimental benchmarking support has been replaced by integrating Nonius code (#1616)
|
| 434 |
+
* This provides a much more featurefull micro-benchmarking support.
|
| 435 |
+
* Due to the compilation cost, it is disabled by default. See the documentation for details.
|
| 436 |
+
* As far as backwards compatibility is concerned, this feature is still considered experimental in that we might change the interface based on user feedback.
|
| 437 |
+
* `WithinULP` matcher now shows the acceptable range (#1581)
|
| 438 |
+
* Template test cases now support type lists (#1627)
|
| 439 |
+
|
| 440 |
+
|
| 441 |
+
## 2.8.0
|
| 442 |
+
|
| 443 |
+
### Improvements
|
| 444 |
+
* Templated test cases no longer check whether the provided types are unique (#1628)
|
| 445 |
+
* This allows you to e.g. test over `uint32_t`, `uint64_t`, and `size_t` without compilation failing
|
| 446 |
+
* The precision of floating point stringification can be modified by user (#1612, #1614)
|
| 447 |
+
* We now provide `REGISTER_ENUM` convenience macro for generating `StringMaker` specializations for enums
|
| 448 |
+
* See the "String conversion" documentation for details
|
| 449 |
+
* Added new set of macros for template test cases that enables the use of NTTPs (#1531, #1609)
|
| 450 |
+
* See "Test cases and sections" documentation for details
|
| 451 |
+
|
| 452 |
+
### Fixes
|
| 453 |
+
* `UNSCOPED_INFO` macro now has a prefixed/disabled/prefixed+disabled versions (#1611)
|
| 454 |
+
* Reporting errors at startup should no longer cause a segfault under certain circumstances (#1626)
|
| 455 |
+
|
| 456 |
+
|
| 457 |
+
### Miscellaneous
|
| 458 |
+
* CMake will now prevent you from attempting in-tree build (#1636, #1638)
|
| 459 |
+
* Previously it would break with an obscure error message during the build step
|
| 460 |
+
|
| 461 |
+
|
| 462 |
+
## 2.7.2
|
| 463 |
+
|
| 464 |
+
### Improvements
|
| 465 |
+
* Added an approximate vector matcher (#1499)
|
| 466 |
+
|
| 467 |
+
### Fixes
|
| 468 |
+
* Filters will no longer be shown if there were none
|
| 469 |
+
* Fixed compilation error when using Homebrew GCC on OS X (#1588, #1589)
|
| 470 |
+
* Fixed the console reporter not showing messages that start with a newline (#1455, #1470)
|
| 471 |
+
* Modified JUnit reporter's output so that rng seed and filters are reported according to the JUnit schema (#1598)
|
| 472 |
+
* Fixed some obscure warnings and static analysis passes
|
| 473 |
+
|
| 474 |
+
### Miscellaneous
|
| 475 |
+
* Various improvements to `ParseAndAddCatchTests` (#1559, #1601)
|
| 476 |
+
* When a target is parsed, it receives `ParseAndAddCatchTests_TESTS` property which summarizes found tests
|
| 477 |
+
* Fixed problem with tests not being found if the `OptionalCatchTestLauncher` variables is used
|
| 478 |
+
* Including the script will no longer forcefully modify `CMAKE_MINIMUM_REQUIRED_VERSION`
|
| 479 |
+
* CMake object libraries are ignored when parsing to avoid needless warnings
|
| 480 |
+
* `CatchAddTests` now adds test's tags to their CTest labels (#1600)
|
| 481 |
+
* Added basic CPack support to our build
|
| 482 |
+
|
| 483 |
+
## 2.7.1
|
| 484 |
+
|
| 485 |
+
### Improvements
|
| 486 |
+
* Reporters now print out the filters applied to test cases (#1550, #1585)
|
| 487 |
+
* Added `GENERATE_COPY` and `GENERATE_REF` macros that can use variables inside the generator expression
|
| 488 |
+
* Because of the significant danger of lifetime issues, the default `GENERATE` macro still does not allow variables
|
| 489 |
+
* The `map` generator helper now deduces the mapped return type (#1576)
|
| 490 |
+
|
| 491 |
+
### Fixes
|
| 492 |
+
* Fixed ObjC++ compilation (#1571)
|
| 493 |
+
* Fixed test tag parsing so that `[.foo]` is now parsed as `[.][foo]`.
|
| 494 |
+
* Suppressed warning caused by the Windows headers defining SE codes in different manners (#1575)
|
| 495 |
+
|
| 496 |
+
## 2.7.0
|
| 497 |
+
|
| 498 |
+
### Improvements
|
| 499 |
+
* `TEMPLATE_PRODUCT_TEST_CASE` now uses the resulting type in the name, instead of the serial number (#1544)
|
| 500 |
+
* Catch2's single header is now strictly ASCII (#1542)
|
| 501 |
+
* Added generator for random integral/floating point types
|
| 502 |
+
* The types are inferred within the `random` helper
|
| 503 |
+
* Added back RangeGenerator (#1526)
|
| 504 |
+
* RangeGenerator returns elements within a certain range
|
| 505 |
+
* Added ChunkGenerator generic transform (#1538)
|
| 506 |
+
* A ChunkGenerator returns the elements from different generator in chunks of n elements
|
| 507 |
+
* Added `UNSCOPED_INFO` (#415, #983, #1522)
|
| 508 |
+
* This is a variant of `INFO` that lives until next assertion/end of the test case.
|
| 509 |
+
|
| 510 |
+
|
| 511 |
+
### Fixes
|
| 512 |
+
* All calls to C stdlib functions are now `std::` qualified (#1541)
|
| 513 |
+
* Code brought in from Clara was also updated.
|
| 514 |
+
* Running tests will no longer open the specified output file twice (#1545)
|
| 515 |
+
* This would cause trouble when the file was not a file, but rather a named pipe
|
| 516 |
+
* Fixes the CLion/Resharper integration with Catch
|
| 517 |
+
* Fixed `-Wunreachable-code` occurring with (old) ccache+cmake+clang combination (#1540)
|
| 518 |
+
* Fixed `-Wdefaulted-function-deleted` warning with Clang 8 (#1537)
|
| 519 |
+
* Catch2's type traits and helpers are now properly namespaced inside `Catch::` (#1548)
|
| 520 |
+
* Fixed std{out,err} redirection for failing test (#1514, #1525)
|
| 521 |
+
* Somehow, this bug has been present for well over a year before it was reported
|
| 522 |
+
|
| 523 |
+
|
| 524 |
+
### Contrib
|
| 525 |
+
* `ParseAndAddCatchTests` now properly escapes commas in the test name
|
| 526 |
+
|
| 527 |
+
|
| 528 |
+
|
| 529 |
+
## 2.6.1
|
| 530 |
+
|
| 531 |
+
### Improvements
|
| 532 |
+
* The JUnit reporter now also reports random seed (#1520, #1521)
|
| 533 |
+
|
| 534 |
+
### Fixes
|
| 535 |
+
* The TAP reporter now formats comments with test name properly (#1529)
|
| 536 |
+
* `CATCH_REQUIRE_THROWS`'s internals were unified with `REQUIRE_THROWS` (#1536)
|
| 537 |
+
* This fixes a potential `-Wunused-value` warning when used
|
| 538 |
+
* Fixed a potential segfault when using any of the `--list-*` options (#1533, #1534)
|
| 539 |
+
|
| 540 |
+
|
| 541 |
+
## 2.6.0
|
| 542 |
+
|
| 543 |
+
**With this release the data generator feature is now fully supported.**
|
| 544 |
+
|
| 545 |
+
|
| 546 |
+
### Improvements
|
| 547 |
+
* Added `TEMPLATE_PRODUCT_TEST_CASE` (#1454, #1468)
|
| 548 |
+
* This allows you to easily test various type combinations, see documentation for details
|
| 549 |
+
* The error message for `&&` and `||` inside assertions has been improved (#1273, #1480)
|
| 550 |
+
* The error message for chained comparisons inside assertions has been improved (#1481)
|
| 551 |
+
* Added `StringMaker` specialization for `std::optional` (#1510)
|
| 552 |
+
* The generator interface has been redone once again (#1516)
|
| 553 |
+
* It is no longer considered experimental and is fully supported
|
| 554 |
+
* The new interface supports "Input" generators
|
| 555 |
+
* The generator documentation has been fully updated
|
| 556 |
+
* We also added 2 generator examples
|
| 557 |
+
|
| 558 |
+
|
| 559 |
+
### Fixes
|
| 560 |
+
* Fixed `-Wredundant-move` on newer Clang (#1474)
|
| 561 |
+
* Removed unreachable mentions `std::current_exception`, `std::rethrow_exception` in no-exceptions mode (#1462)
|
| 562 |
+
* This should fix compilation with IAR
|
| 563 |
+
* Fixed missing `<type_traits>` include (#1494)
|
| 564 |
+
* Fixed various static analysis warnings
|
| 565 |
+
* Unrestored stream state in `XmlWriter` (#1489)
|
| 566 |
+
* Potential division by zero in `estimateClockResolution` (#1490)
|
| 567 |
+
* Uninitialized member in `RunContext` (#1491)
|
| 568 |
+
* `SourceLineInfo` move ops are now marked `noexcept`
|
| 569 |
+
* `CATCH_BREAK_INTO_DEBUGGER` is now always a function
|
| 570 |
+
* Fix double run of a test case if user asks for a specific section (#1394, #1492)
|
| 571 |
+
* ANSI colour code output now respects `-o` flag and writes to the file as well (#1502)
|
| 572 |
+
* Fixed detection of `std::variant` support for compilers other than Clang (#1511)
|
| 573 |
+
|
| 574 |
+
|
| 575 |
+
### Contrib
|
| 576 |
+
* `ParseAndAddCatchTests` has learned how to use `DISABLED` CTest property (#1452)
|
| 577 |
+
* `ParseAndAddCatchTests` now works when there is a whitspace before the test name (#1493)
|
| 578 |
+
|
| 579 |
+
|
| 580 |
+
### Miscellaneous
|
| 581 |
+
* We added new issue templates for reporting issues on GitHub
|
| 582 |
+
* `contributing.md` has been updated to reflect the current test status (#1484)
|
| 583 |
+
|
| 584 |
+
|
| 585 |
+
|
| 586 |
+
## 2.5.0
|
| 587 |
+
|
| 588 |
+
### Improvements
|
| 589 |
+
* Added support for templated tests via `TEMPLATE_TEST_CASE` (#1437)
|
| 590 |
+
|
| 591 |
+
|
| 592 |
+
### Fixes
|
| 593 |
+
* Fixed compilation of `PredicateMatcher<const char*>` by removing partial specialization of `MatcherMethod<T*>`
|
| 594 |
+
* Listeners now implicitly support any verbosity (#1426)
|
| 595 |
+
* Fixed compilation with Embarcadero builder by introducing `Catch::isnan` polyfill (#1438)
|
| 596 |
+
* Fixed `CAPTURE` asserting for non-trivial captures (#1436, #1448)
|
| 597 |
+
|
| 598 |
+
|
| 599 |
+
### Miscellaneous
|
| 600 |
+
* We should now be providing first party Conan support via https://bintray.com/catchorg/Catch2 (#1443)
|
| 601 |
+
* Added new section "deprecations and planned changes" to the documentation
|
| 602 |
+
* It contains summary of what is deprecated and might change with next major version
|
| 603 |
+
* From this release forward, the released headers should be pgp signed (#430)
|
| 604 |
+
* KeyID `E29C 46F3 B8A7 5028 6079 3B7D ECC9 C20E 314B 2360`
|
| 605 |
+
* or https://codingnest.com/files/horenmar-publickey.asc
|
| 606 |
+
|
| 607 |
+
|
| 608 |
+
## 2.4.2
|
| 609 |
+
|
| 610 |
+
### Improvements
|
| 611 |
+
* XmlReporter now also outputs the RNG seed that was used in a run (#1404)
|
| 612 |
+
* `Catch::Session::applyCommandLine` now also accepts `wchar_t` arguments.
|
| 613 |
+
* However, Catch2 still does not support unicode.
|
| 614 |
+
* Added `STATIC_REQUIRE` macro (#1356, #1362)
|
| 615 |
+
* Catch2's singleton's are now cleaned up even if tests are run (#1411)
|
| 616 |
+
* This is mostly useful as a FP prevention for users who define their own main.
|
| 617 |
+
* Specifying an invalid reporter via `-r` is now reported sooner (#1351, #1422)
|
| 618 |
+
|
| 619 |
+
|
| 620 |
+
### Fixes
|
| 621 |
+
* Stringification no longer assumes that `char` is signed (#1399, #1407)
|
| 622 |
+
* This caused a `Wtautological-compare` warning.
|
| 623 |
+
* SFINAE for `operator<<` no longer sees different overload set than the actual insertion (#1403)
|
| 624 |
+
|
| 625 |
+
|
| 626 |
+
### Contrib
|
| 627 |
+
* `catch_discover_tests` correctly adds tests with comma in name (#1327, #1409)
|
| 628 |
+
* Added a new customization point in how the tests are launched to `catch_discover_tests`
|
| 629 |
+
|
| 630 |
+
|
| 631 |
+
## 2.4.1
|
| 632 |
+
|
| 633 |
+
### Improvements
|
| 634 |
+
* Added a StringMaker for `std::(w)string_view` (#1375, #1376)
|
| 635 |
+
* Added a StringMaker for `std::variant` (#1380)
|
| 636 |
+
* This one is disabled by default to avoid increased compile-time drag
|
| 637 |
+
* Added detection for cygwin environment without `std::to_string` (#1396, #1397)
|
| 638 |
+
|
| 639 |
+
### Fixes
|
| 640 |
+
* `UnorderedEqualsMatcher` will no longer accept erroneously accept
|
| 641 |
+
vectors that share suffix, but are not permutation of the desired vector
|
| 642 |
+
* Abort after (`-x N`) can no longer be overshot by nested `REQUIRES` and
|
| 643 |
+
subsequently ignored (#1391, #1392)
|
| 644 |
+
|
| 645 |
+
|
| 646 |
+
## 2.4.0
|
| 647 |
+
|
| 648 |
+
**This release brings two new experimental features, generator support
|
| 649 |
+
and a `-fno-exceptions` support. Being experimental means that they
|
| 650 |
+
will not be subject to the usual stability guarantees provided by semver.**
|
| 651 |
+
|
| 652 |
+
### Improvements
|
| 653 |
+
* Various small runtime performance improvements
|
| 654 |
+
* `CAPTURE` macro is now variadic
|
| 655 |
+
* Added `AND_GIVEN` macro (#1360)
|
| 656 |
+
* Added experimental support for data generators
|
| 657 |
+
* See [their documentation](generators.md) for details
|
| 658 |
+
* Added support for compiling and running Catch without exceptions
|
| 659 |
+
* Doing so limits the functionality somewhat
|
| 660 |
+
* Look [into the documentation](configuration.md#disablingexceptions) for details
|
| 661 |
+
|
| 662 |
+
### Fixes
|
| 663 |
+
* Suppressed `-Wnon-virtual-dtor` warnings in Matchers (#1357)
|
| 664 |
+
* Suppressed `-Wunreachable-code` warnings in floating point matchers (#1350)
|
| 665 |
+
|
| 666 |
+
### CMake
|
| 667 |
+
* It is now possible to override which Python is used to run Catch's tests (#1365)
|
| 668 |
+
* Catch now provides infrastructure for adding tests that check compile-time configuration
|
| 669 |
+
* Catch no longer tries to install itself when used as a subproject (#1373)
|
| 670 |
+
* Catch2ConfigVersion.cmake is now generated as arch-independent (#1368)
|
| 671 |
+
* This means that installing Catch from 32-bit machine and copying it to 64-bit one works
|
| 672 |
+
* This fixes conan installation of Catch
|
| 673 |
+
|
| 674 |
+
|
| 675 |
+
## 2.3.0
|
| 676 |
+
|
| 677 |
+
**This release changes the include paths provided by our CMake and
|
| 678 |
+
pkg-config integration. The proper include path for the single-header
|
| 679 |
+
when using one of the above is now `<catch2/catch.hpp>`. This change
|
| 680 |
+
also necessitated changes to paths inside the repository, so that the
|
| 681 |
+
single-header version is now at `single_include/catch2/catch.hpp`, rather
|
| 682 |
+
than `single_include/catch.hpp`.**
|
| 683 |
+
|
| 684 |
+
|
| 685 |
+
|
| 686 |
+
### Fixes
|
| 687 |
+
* Fixed Objective-C++ build
|
| 688 |
+
* `-Wunused-variable` suppression no longer leaks from Catch's header under Clang
|
| 689 |
+
* Implementation of the experimental new output capture can now be disabled (#1335)
|
| 690 |
+
* This allows building Catch2 on platforms that do not provide things like `dup` or `tmpfile`.
|
| 691 |
+
* The JUnit and XML reporters will no longer skip over successful tests when running without `-s` (#1264, #1267, #1310)
|
| 692 |
+
* See improvements for more details
|
| 693 |
+
|
| 694 |
+
### Improvements
|
| 695 |
+
* pkg-config and CMake integration has been rewritten
|
| 696 |
+
* If you use them, the new include path is `#include <catch2/catch.hpp>`
|
| 697 |
+
* CMake installation now also installs scripts from `contrib/`
|
| 698 |
+
* For details see the [new documentation](cmake-integration.md#top)
|
| 699 |
+
* Reporters now have a new customization point, `ReporterPreferences::shouldReportAllAssertions`
|
| 700 |
+
* When this is set to `false` and the tests are run without `-s`, passing assertions are not sent to the reporter.
|
| 701 |
+
* Defaults to `false`.
|
| 702 |
+
* Added `DYNAMIC_SECTION`, a section variant that constructs its name using stream
|
| 703 |
+
* This means that you can do `DYNAMIC_SECTION("For X := " << x)`.
|
| 704 |
+
|
| 705 |
+
|
| 706 |
+
## 2.2.3
|
| 707 |
+
|
| 708 |
+
**To fix some of the bugs, some behavior had to change in potentially breaking manner.**
|
| 709 |
+
**This means that even though this is a patch release, it might not be a drop-in replacement.**
|
| 710 |
+
|
| 711 |
+
### Fixes
|
| 712 |
+
* Listeners are now called before reporter
|
| 713 |
+
* This was always documented to be the case, now it actually works that way
|
| 714 |
+
* Catch's commandline will no longer accept multiple reporters
|
| 715 |
+
* This was done because multiple reporters never worked properly and broke things in non-obvious ways
|
| 716 |
+
* **This has potential to be a breaking change**
|
| 717 |
+
* MinGW is now detected as Windows platform w/o SEH support (#1257)
|
| 718 |
+
* This means that Catch2 no longer tries to use POSIX signal handling when compiled with MinGW
|
| 719 |
+
* Fixed potential UB in parsing tags using non-ASCII characters (#1266)
|
| 720 |
+
* Note that Catch2 still supports only ASCII test names/tags/etc
|
| 721 |
+
* `TEST_CASE_METHOD` can now be used on classnames containing commas (#1245)
|
| 722 |
+
* You have to enclose the classname in extra set of parentheses
|
| 723 |
+
* Fixed insufficient alt stack size for POSIX signal handling (#1225)
|
| 724 |
+
* Fixed compilation error on Android due to missing `std::to_string` in C++11 mode (#1280)
|
| 725 |
+
* Fixed the order of user-provided `FALLBACK_STRINGIFIER` in stringification machinery (#1024)
|
| 726 |
+
* It was intended to be replacement for built-in fallbacks, but it was used _after_ them.
|
| 727 |
+
* **This has potential to be a breaking change**
|
| 728 |
+
* Fixed compilation error when a type has an `operator<<` with templated lhs (#1285, #1306)
|
| 729 |
+
|
| 730 |
+
### Improvements
|
| 731 |
+
* Added a new, experimental, output capture (#1243)
|
| 732 |
+
* This capture can also redirect output written via C apis, e.g. `printf`
|
| 733 |
+
* To opt-in, define `CATCH_CONFIG_EXPERIMENTAL_REDIRECT` in the implementation file
|
| 734 |
+
* Added a new fallback stringifier for classes derived from `std::exception`
|
| 735 |
+
* Both `StringMaker` specialization and `operator<<` overload are given priority
|
| 736 |
+
|
| 737 |
+
### Miscellaneous
|
| 738 |
+
* `contrib/` now contains dbg scripts that skip over Catch's internals (#904, #1283)
|
| 739 |
+
* `gdbinit` for gdb `lldbinit` for lldb
|
| 740 |
+
* `CatchAddTests.cmake` no longer strips whitespace from tests (#1265, #1281)
|
| 741 |
+
* Online documentation now describes `--use-colour` option (#1263)
|
| 742 |
+
|
| 743 |
+
|
| 744 |
+
## 2.2.2
|
| 745 |
+
|
| 746 |
+
### Fixes
|
| 747 |
+
* Fixed bug in `WithinAbs::match()` failing spuriously (#1228)
|
| 748 |
+
* Fixed clang-tidy diagnostic about virtual call in destructor (#1226)
|
| 749 |
+
* Reduced the number of GCC warnings suppression leaking out of the header (#1090, #1091)
|
| 750 |
+
* Only `-Wparentheses` should be leaking now
|
| 751 |
+
* Added upper bound on the time benchmark timer calibration is allowed to take (#1237)
|
| 752 |
+
* On platforms where `std::chrono::high_resolution_clock`'s resolution is low, the calibration would appear stuck
|
| 753 |
+
* Fixed compilation error when stringifying static arrays of `unsigned char`s (#1238)
|
| 754 |
+
|
| 755 |
+
### Improvements
|
| 756 |
+
* XML encoder now hex-encodes invalid UTF-8 sequences (#1207)
|
| 757 |
+
* This affects xml and junit reporters
|
| 758 |
+
* Some invalid UTF-8 parts are left as is, e.g. surrogate pairs. This is because certain extensions of UTF-8 allow them, such as WTF-8.
|
| 759 |
+
* CLR objects (`T^`) can now be stringified (#1216)
|
| 760 |
+
* This affects code compiled as C++/CLI
|
| 761 |
+
* Added `PredicateMatcher`, a matcher that takes an arbitrary predicate function (#1236)
|
| 762 |
+
* See [documentation for details](https://github.com/catchorg/Catch2/blob/v2.x/docs/matchers.md)
|
| 763 |
+
|
| 764 |
+
### Others
|
| 765 |
+
* Modified CMake-installed pkg-config to allow `#include <catch.hpp>`(#1239)
|
| 766 |
+
* The plans to standardize on `#include <catch2/catch.hpp>` are still in effect
|
| 767 |
+
|
| 768 |
+
|
| 769 |
+
## 2.2.1
|
| 770 |
+
|
| 771 |
+
### Fixes
|
| 772 |
+
* Fixed compilation error when compiling Catch2 with `std=c++17` against libc++ (#1214)
|
| 773 |
+
* Clara (Catch2's CLI parsing library) used `std::optional` without including it explicitly
|
| 774 |
+
* Fixed Catch2 return code always being 0 (#1215)
|
| 775 |
+
* In the words of STL, "We feel superbad about letting this in"
|
| 776 |
+
|
| 777 |
+
|
| 778 |
+
## 2.2.0
|
| 779 |
+
|
| 780 |
+
### Fixes
|
| 781 |
+
* Hidden tests are not listed by default when listing tests (#1175)
|
| 782 |
+
* This makes `catch_discover_tests` CMake script work better
|
| 783 |
+
* Fixed regression that meant `<windows.h>` could potentially not be included properly (#1197)
|
| 784 |
+
* Fixed installing `Catch2ConfigVersion.cmake` when Catch2 is a subproject.
|
| 785 |
+
|
| 786 |
+
### Improvements
|
| 787 |
+
* Added an option to warn (+ exit with error) when no tests were ran (#1158)
|
| 788 |
+
* Use as `-w NoTests`
|
| 789 |
+
* Added provisional support for Emscripten (#1114)
|
| 790 |
+
* [Added a way to override the fallback stringifier](https://github.com/catchorg/Catch2/blob/v2.x/docs/configuration.md#fallback-stringifier) (#1024)
|
| 791 |
+
* This allows project's own stringification machinery to be easily reused for Catch
|
| 792 |
+
* `Catch::Session::run()` now accepts `char const * const *`, allowing it to accept array of string literals (#1031, #1178)
|
| 793 |
+
* The embedded version of Clara was bumped to v1.1.3
|
| 794 |
+
* Various minor performance improvements
|
| 795 |
+
* Added support for DJGPP DOS crosscompiler (#1206)
|
| 796 |
+
|
| 797 |
+
|
| 798 |
+
## 2.1.2
|
| 799 |
+
|
| 800 |
+
### Fixes
|
| 801 |
+
* Fixed compilation error with `-fno-rtti` (#1165)
|
| 802 |
+
* Fixed NoAssertion warnings
|
| 803 |
+
* `operator<<` is used before range-based stringification (#1172)
|
| 804 |
+
* Fixed `-Wpedantic` warnings (extra semicolons and binary literals) (#1173)
|
| 805 |
+
|
| 806 |
+
|
| 807 |
+
### Improvements
|
| 808 |
+
* Added `CATCH_VERSION_{MAJOR,MINOR,PATCH}` macros (#1131)
|
| 809 |
+
* Added `BrightYellow` colour for use in reporters (#979)
|
| 810 |
+
* It is also used by ConsoleReporter for reconstructed expressions
|
| 811 |
+
|
| 812 |
+
### Other changes
|
| 813 |
+
* Catch is now exported as a CMake package and linkable target (#1170)
|
| 814 |
+
|
| 815 |
+
## 2.1.1
|
| 816 |
+
|
| 817 |
+
### Improvements
|
| 818 |
+
* Static arrays are now properly stringified like ranges across MSVC/GCC/Clang
|
| 819 |
+
* Embedded newer version of Clara -- v1.1.1
|
| 820 |
+
* This should fix some warnings dragged in from Clara
|
| 821 |
+
* MSVC's CLR exceptions are supported
|
| 822 |
+
|
| 823 |
+
|
| 824 |
+
### Fixes
|
| 825 |
+
* Fixed compilation when comparison operators do not return bool (#1147)
|
| 826 |
+
* Fixed CLR exceptions blowing up the executable during translation (#1138)
|
| 827 |
+
|
| 828 |
+
|
| 829 |
+
### Other changes
|
| 830 |
+
* Many CMake changes
|
| 831 |
+
* `NO_SELFTEST` option is deprecated, use `BUILD_TESTING` instead.
|
| 832 |
+
* Catch specific CMake options were prefixed with `CATCH_` for namespacing purposes
|
| 833 |
+
* Other changes to simplify Catch2's packaging
|
| 834 |
+
|
| 835 |
+
|
| 836 |
+
|
| 837 |
+
## 2.1.0
|
| 838 |
+
|
| 839 |
+
### Improvements
|
| 840 |
+
* Various performance improvements
|
| 841 |
+
* On top of the performance regression fixes
|
| 842 |
+
* Experimental support for PCH was added (#1061)
|
| 843 |
+
* `CATCH_CONFIG_EXTERNAL_INTERFACES` now brings in declarations of Console, Compact, XML and JUnit reporters
|
| 844 |
+
* `MatcherBase` no longer has a pointless second template argument
|
| 845 |
+
* Reduced the number of warning suppressions that leak into user's code
|
| 846 |
+
* Bugs in g++ 4.x and 5.x mean that some of them have to be left in
|
| 847 |
+
|
| 848 |
+
|
| 849 |
+
### Fixes
|
| 850 |
+
* Fixed performance regression from Catch classic
|
| 851 |
+
* One of the performance improvement patches for Catch classic was not applied to Catch2
|
| 852 |
+
* Fixed platform detection for iOS (#1084)
|
| 853 |
+
* Fixed compilation when `g++` is used together with `libc++` (#1110)
|
| 854 |
+
* Fixed TeamCity reporter compilation with the single header version
|
| 855 |
+
* To fix the underlying issue we will be versioning reporters in single_include folder per release
|
| 856 |
+
* The XML reporter will now report `WARN` messages even when not used with `-s`
|
| 857 |
+
* Fixed compilation when `VectorContains` matcher was combined using `&&` (#1092)
|
| 858 |
+
* Fixed test duration overflowing after 10 seconds (#1125, #1129)
|
| 859 |
+
* Fixed `std::uncaught_exception` deprecation warning (#1124)
|
| 860 |
+
|
| 861 |
+
|
| 862 |
+
### New features
|
| 863 |
+
* New Matchers
|
| 864 |
+
* Regex matcher for strings, `Matches`.
|
| 865 |
+
* Set-equal matcher for vectors, `UnorderedEquals`
|
| 866 |
+
* Floating point matchers, `WithinAbs` and `WithinULP`.
|
| 867 |
+
* Stringification now attempts to decompose all containers (#606)
|
| 868 |
+
* Containers are objects that respond to ADL `begin(T)` and `end(T)`.
|
| 869 |
+
|
| 870 |
+
|
| 871 |
+
### Other changes
|
| 872 |
+
* Reporters will now be versioned in the `single_include` folder to ensure their compatibility with the last released version
|
| 873 |
+
|
| 874 |
+
|
| 875 |
+
|
| 876 |
+
|
| 877 |
+
## 2.0.1
|
| 878 |
+
|
| 879 |
+
### Breaking changes
|
| 880 |
+
* Removed C++98 support
|
| 881 |
+
* Removed legacy reporter support
|
| 882 |
+
* Removed legacy generator support
|
| 883 |
+
* Generator support will come back later, reworked
|
| 884 |
+
* Removed `Catch::toString` support
|
| 885 |
+
* The new stringification machinery uses `Catch::StringMaker` specializations first and `operator<<` overloads second.
|
| 886 |
+
* Removed legacy `SCOPED_MSG` and `SCOPED_INFO` macros
|
| 887 |
+
* Removed `INTERNAL_CATCH_REGISTER_REPORTER`
|
| 888 |
+
* `CATCH_REGISTER_REPORTER` should be used to register reporters
|
| 889 |
+
* Removed legacy `[hide]` tag
|
| 890 |
+
* `[.]`, `[.foo]` and `[!hide]` are still supported
|
| 891 |
+
* Output into debugger is now colourized
|
| 892 |
+
* `*_THROWS_AS(expr, exception_type)` now unconditionally appends `const&` to the exception type.
|
| 893 |
+
* `CATCH_CONFIG_FAST_COMPILE` now affects the `CHECK_` family of assertions as well as `REQUIRE_` family of assertions
|
| 894 |
+
* 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.
|
| 895 |
+
* Removed deprecated matcher utility functions `Not`, `AllOf` and `AnyOf`.
|
| 896 |
+
* They are superseded by operators `!`, `&&` and `||`, which are natural and do not have limited arity
|
| 897 |
+
* Removed support for non-const comparison operators
|
| 898 |
+
* Non-const comparison operators are an abomination that should not exist
|
| 899 |
+
* They were breaking support for comparing function to function pointer
|
| 900 |
+
* `std::pair` and `std::tuple` are no longer stringified by default
|
| 901 |
+
* This is done to avoid dragging in `<tuple>` and `<utility>` headers in common path
|
| 902 |
+
* Their stringification can be enabled per-file via new configuration macros
|
| 903 |
+
* `Approx` is subtly different and hopefully behaves more as users would expect
|
| 904 |
+
* `Approx::scale` defaults to `0.0`
|
| 905 |
+
* `Approx::epsilon` no longer applies to the larger of the two compared values, but only to the `Approx`'s value
|
| 906 |
+
* `INFINITY == Approx(INFINITY)` returns true
|
| 907 |
+
|
| 908 |
+
|
| 909 |
+
### Improvements
|
| 910 |
+
* Reporters and Listeners can be defined in files different from the main file
|
| 911 |
+
* The file has to define `CATCH_CONFIG_EXTERNAL_INTERFACES` before including catch.hpp.
|
| 912 |
+
* Errors that happen during set up before main are now caught and properly reported once main is entered
|
| 913 |
+
* If you are providing your own main, you can access and use these as well.
|
| 914 |
+
* New assertion macros, *_THROWS_MATCHES(expr, exception_type, matcher) are provided
|
| 915 |
+
* As the arguments suggest, these allow you to assert that an expression throws desired type of exception and pass the exception to a matcher.
|
| 916 |
+
* JUnit reporter no longer has significantly different output for test cases with and without sections
|
| 917 |
+
* Most assertions now support expressions containing commas (ie `REQUIRE(foo() == std::vector<int>{1, 2, 3});`)
|
| 918 |
+
* Catch now contains experimental micro benchmarking support
|
| 919 |
+
* See `projects/SelfTest/Benchmark.tests.cpp` for examples
|
| 920 |
+
* The support being experiment means that it can be changed without prior notice
|
| 921 |
+
* Catch uses new CLI parsing library (Clara)
|
| 922 |
+
* Users can now easily add new command line options to the final executable
|
| 923 |
+
* This also leads to some changes in `Catch::Session` interface
|
| 924 |
+
* All parts of matchers can be removed from a TU by defining `CATCH_CONFIG_DISABLE_MATCHERS`
|
| 925 |
+
* This can be used to somewhat speed up compilation times
|
| 926 |
+
* An experimental implementation of `CATCH_CONFIG_DISABLE` has been added
|
| 927 |
+
* Inspired by Doctest's `DOCTEST_CONFIG_DISABLE`
|
| 928 |
+
* Useful for implementing tests in source files
|
| 929 |
+
* ie for functions in anonymous namespaces
|
| 930 |
+
* Removes all assertions
|
| 931 |
+
* Prevents `TEST_CASE` registrations
|
| 932 |
+
* Exception translators are not registered
|
| 933 |
+
* Reporters are not registered
|
| 934 |
+
* Listeners are not registered
|
| 935 |
+
* Reporters/Listeners are now notified of fatal errors
|
| 936 |
+
* This means specific signals or structured exceptions
|
| 937 |
+
* The Reporter/Listener interface provides default, empty, implementation to preserve backward compatibility
|
| 938 |
+
* Stringification of `std::chrono::duration` and `std::chrono::time_point` is now supported
|
| 939 |
+
* Needs to be enabled by a per-file compile time configuration option
|
| 940 |
+
* Add `pkg-config` support to CMake install command
|
| 941 |
+
|
| 942 |
+
|
| 943 |
+
### Fixes
|
| 944 |
+
* Don't use console colour if running in XCode
|
| 945 |
+
* Explicit constructor in reporter base class
|
| 946 |
+
* Swept out `-Wweak-vtables`, `-Wexit-time-destructors`, `-Wglobal-constructors` warnings
|
| 947 |
+
* Compilation for Universal Windows Platform (UWP) is supported
|
| 948 |
+
* SEH handling and colorized output are disabled when compiling for UWP
|
| 949 |
+
* Implemented a workaround for `std::uncaught_exception` issues in libcxxrt
|
| 950 |
+
* These issues caused incorrect section traversals
|
| 951 |
+
* The workaround is only partial, user's test can still trigger the issue by using `throw;` to rethrow an exception
|
| 952 |
+
* Suppressed C4061 warning under MSVC
|
| 953 |
+
|
| 954 |
+
|
| 955 |
+
### Internal changes
|
| 956 |
+
* The development version now uses .cpp files instead of header files containing implementation.
|
| 957 |
+
* This makes partial rebuilds much faster during development
|
| 958 |
+
* The expression decomposition layer has been rewritten
|
| 959 |
+
* The evaluation layer has been rewritten
|
| 960 |
+
* New library (TextFlow) is used for formatting text to output
|
| 961 |
+
|
| 962 |
+
|
| 963 |
+
## Older versions
|
| 964 |
+
|
| 965 |
+
### 1.12.x
|
| 966 |
+
|
| 967 |
+
#### 1.12.2
|
| 968 |
+
##### Fixes
|
| 969 |
+
* Fixed missing <cassert> include
|
| 970 |
+
|
| 971 |
+
#### 1.12.1
|
| 972 |
+
|
| 973 |
+
##### Fixes
|
| 974 |
+
* Fixed deprecation warning in `ScopedMessage::~ScopedMessage`
|
| 975 |
+
* All uses of `min` or `max` identifiers are now wrapped in parentheses
|
| 976 |
+
* This avoids problems when Windows headers define `min` and `max` macros
|
| 977 |
+
|
| 978 |
+
#### 1.12.0
|
| 979 |
+
|
| 980 |
+
##### Fixes
|
| 981 |
+
* Fixed compilation for strict C++98 mode (ie not gnu++98) and older compilers (#1103)
|
| 982 |
+
* `INFO` messages are included in the `xml` reporter output even without `-s` specified.
|
| 983 |
+
|
| 984 |
+
|
| 985 |
+
### 1.11.x
|
| 986 |
+
|
| 987 |
+
#### 1.11.0
|
| 988 |
+
|
| 989 |
+
##### Fixes
|
| 990 |
+
* The original expression in `REQUIRE_FALSE( expr )` is now reporter properly as `!( expr )` (#1051)
|
| 991 |
+
* Previously the parentheses were missing and `x != y` would be expanded as `!x != x`
|
| 992 |
+
* `Approx::Margin` is now inclusive (#952)
|
| 993 |
+
* Previously it was meant and documented as inclusive, but the check itself wasn't
|
| 994 |
+
* This means that `REQUIRE( 0.25f == Approx( 0.0f ).margin( 0.25f ) )` passes, instead of fails
|
| 995 |
+
* `RandomNumberGenerator::result_type` is now unsigned (#1050)
|
| 996 |
+
|
| 997 |
+
##### Improvements
|
| 998 |
+
* `__JETBRAINS_IDE__` macro handling is now CLion version specific (#1017)
|
| 999 |
+
* When CLion 2017.3 or newer is detected, `__COUNTER__` is used instead of
|
| 1000 |
+
* TeamCity reporter now explicitly flushes output stream after each report (#1057)
|
| 1001 |
+
* On some platforms, output from redirected streams would show up only after the tests finished running
|
| 1002 |
+
* `ParseAndAddCatchTests` now can add test files as dependency to CMake configuration
|
| 1003 |
+
* This means you do not have to manually rerun CMake configuration step to detect new tests
|
| 1004 |
+
|
| 1005 |
+
### 1.10.x
|
| 1006 |
+
|
| 1007 |
+
#### 1.10.0
|
| 1008 |
+
|
| 1009 |
+
##### Fixes
|
| 1010 |
+
* Evaluation layer has been rewritten (backported from Catch 2)
|
| 1011 |
+
* The new layer is much simpler and fixes some issues (#981)
|
| 1012 |
+
* Implemented workaround for VS 2017 raw string literal stringification bug (#995)
|
| 1013 |
+
* Fixed interaction between `[!shouldfail]` and `[!mayfail]` tags and sections
|
| 1014 |
+
* Previously sections with failing assertions would be marked as failed, not failed-but-ok
|
| 1015 |
+
|
| 1016 |
+
##### Improvements
|
| 1017 |
+
* Added [libidentify](https://github.com/janwilmans/LibIdentify) support
|
| 1018 |
+
* Added "wait-for-keypress" option
|
| 1019 |
+
|
| 1020 |
+
### 1.9.x
|
| 1021 |
+
|
| 1022 |
+
#### 1.9.6
|
| 1023 |
+
|
| 1024 |
+
##### Improvements
|
| 1025 |
+
* Catch's runtime overhead has been significantly decreased (#937, #939)
|
| 1026 |
+
* Added `--list-extra-info` cli option (#934).
|
| 1027 |
+
* It lists all tests together with extra information, ie filename, line number and description.
|
| 1028 |
+
|
| 1029 |
+
|
| 1030 |
+
|
| 1031 |
+
#### 1.9.5
|
| 1032 |
+
|
| 1033 |
+
##### Fixes
|
| 1034 |
+
* Truthy expressions are now reconstructed properly, not as booleans (#914)
|
| 1035 |
+
* 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)
|
| 1036 |
+
* Catch no longer fails to link when main is compiled as C++, but linked against Objective-C (#855)
|
| 1037 |
+
* Fixed incorrect gcc version detection when deciding to use `__COUNTER__` (#928)
|
| 1038 |
+
* Previously any GCC with minor version less than 3 would be incorrectly classified as not supporting `__COUNTER__`.
|
| 1039 |
+
* Suppressed C4996 warning caused by upcoming updated to MSVC 2017, marking `std::uncaught_exception` as deprecated. (#927)
|
| 1040 |
+
|
| 1041 |
+
##### Improvements
|
| 1042 |
+
* CMake integration script now incorporates debug messages and registers tests in an improved way (#911)
|
| 1043 |
+
* Various documentation improvements
|
| 1044 |
+
|
| 1045 |
+
|
| 1046 |
+
|
| 1047 |
+
#### 1.9.4
|
| 1048 |
+
|
| 1049 |
+
##### Fixes
|
| 1050 |
+
* `CATCH_FAIL` macro no longer causes compilation error without variadic macro support
|
| 1051 |
+
* `INFO` messages are no longer cleared after being reported once
|
| 1052 |
+
|
| 1053 |
+
##### Improvements and minor changes
|
| 1054 |
+
* Catch now uses `wmain` when compiled under Windows and `UNICODE` is defined.
|
| 1055 |
+
* Note that Catch still officially supports only ASCII
|
| 1056 |
+
|
| 1057 |
+
#### 1.9.3
|
| 1058 |
+
|
| 1059 |
+
##### Fixes
|
| 1060 |
+
* Completed the fix for (lack of) uint64_t in earlier Visual Studios
|
| 1061 |
+
|
| 1062 |
+
#### 1.9.2
|
| 1063 |
+
|
| 1064 |
+
##### Improvements and minor changes
|
| 1065 |
+
* All of `Approx`'s member functions now accept strong typedefs in C++11 mode (#888)
|
| 1066 |
+
* Previously `Approx::scale`, `Approx::epsilon`, `Approx::margin` and `Approx::operator()` didn't.
|
| 1067 |
+
|
| 1068 |
+
|
| 1069 |
+
##### Fixes
|
| 1070 |
+
* POSIX signals are now disabled by default under QNX (#889)
|
| 1071 |
+
* QNX does not support current enough (2001) POSIX specification
|
| 1072 |
+
* JUnit no longer counts exceptions as failures if given test case is marked as ok to fail.
|
| 1073 |
+
* `Catch::Option` should now have its storage properly aligned.
|
| 1074 |
+
* Catch no longer attempts to define `uint64_t` on windows (#862)
|
| 1075 |
+
* This was causing trouble when compiled under Cygwin
|
| 1076 |
+
|
| 1077 |
+
##### Other
|
| 1078 |
+
* Catch is now compiled under MSVC 2017 using `std:c++latest` (C++17 mode) in CI
|
| 1079 |
+
* We now provide cmake script that autoregisters Catch tests into ctest.
|
| 1080 |
+
* See `contrib` folder.
|
| 1081 |
+
|
| 1082 |
+
|
| 1083 |
+
#### 1.9.1
|
| 1084 |
+
|
| 1085 |
+
##### Fixes
|
| 1086 |
+
* Unexpected exceptions are no longer ignored by default (#885, #887)
|
| 1087 |
+
|
| 1088 |
+
|
| 1089 |
+
#### 1.9.0
|
| 1090 |
+
|
| 1091 |
+
|
| 1092 |
+
##### Improvements and minor changes
|
| 1093 |
+
* Catch no longer attempts to ensure the exception type passed by user in `REQUIRE_THROWS_AS` is a constant reference.
|
| 1094 |
+
* It was causing trouble when `REQUIRE_THROWS_AS` was used inside templated functions
|
| 1095 |
+
* This actually reverts changes made in v1.7.2
|
| 1096 |
+
* Catch's `Version` struct should no longer be double freed when multiple instances of Catch tests are loaded into single program (#858)
|
| 1097 |
+
* It is now a static variable in an inline function instead of being an `extern`ed struct.
|
| 1098 |
+
* Attempt to register invalid tag or tag alias now throws instead of calling `exit()`.
|
| 1099 |
+
* Because this happen before entering main, it still aborts execution
|
| 1100 |
+
* Further improvements to this are coming
|
| 1101 |
+
* `CATCH_CONFIG_FAST_COMPILE` now speeds-up compilation of `REQUIRE*` assertions by further ~15%.
|
| 1102 |
+
* The trade-off is disabling translation of unexpected exceptions into text.
|
| 1103 |
+
* When Catch is compiled using C++11, `Approx` is now constructible with anything that can be explicitly converted to `double`.
|
| 1104 |
+
* Captured messages are now printed on unexpected exceptions
|
| 1105 |
+
|
| 1106 |
+
##### Fixes:
|
| 1107 |
+
* Clang's `-Wexit-time-destructors` should be suppressed for Catch's internals
|
| 1108 |
+
* GCC's `-Wparentheses` is now suppressed for all TU's that include `catch.hpp`.
|
| 1109 |
+
* 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.
|
| 1110 |
+
* You can now tell Catch to use C++11-based check when checking whether a type can be streamed to output.
|
| 1111 |
+
* This fixes cases when an unstreamable type has streamable private base (#877)
|
| 1112 |
+
* [Details can be found in documentation](configuration.md#catch_config_cpp11_stream_insertable_check)
|
| 1113 |
+
|
| 1114 |
+
|
| 1115 |
+
##### Other notes:
|
| 1116 |
+
* We have added VS 2017 to our CI
|
| 1117 |
+
* Work on Catch 2 should start soon
|
| 1118 |
+
|
| 1119 |
+
|
| 1120 |
+
|
| 1121 |
+
### 1.8.x
|
| 1122 |
+
|
| 1123 |
+
#### 1.8.2
|
| 1124 |
+
|
| 1125 |
+
|
| 1126 |
+
##### Improvements and minor changes
|
| 1127 |
+
* TAP reporter now behaves as if `-s` was always set
|
| 1128 |
+
* This should be more consistent with the protocol desired behaviour.
|
| 1129 |
+
* Compact reporter now obeys `-d yes` argument (#780)
|
| 1130 |
+
* The format is "XXX.123 s: <section-name>" (3 decimal places are always present).
|
| 1131 |
+
* Before it did not report the durations at all.
|
| 1132 |
+
* XML reporter now behaves the same way as Console reporter in regards to `INFO`
|
| 1133 |
+
* This means it reports `INFO` messages on success, if output on success (`-s`) is enabled.
|
| 1134 |
+
* Previously it only reported `INFO` messages on failure.
|
| 1135 |
+
* `CAPTURE(expr)` now stringifies `expr` in the same way assertion macros do (#639)
|
| 1136 |
+
* Listeners are now finally [documented](event-listeners.md#top).
|
| 1137 |
+
* 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.
|
| 1138 |
+
|
| 1139 |
+
|
| 1140 |
+
##### Fixes:
|
| 1141 |
+
* Catch no longer attempts to reconstruct expression that led to a fatal error (#810)
|
| 1142 |
+
* This fixes possible signal/SEH loop when processing expressions, where the signal was triggered by expression decomposition.
|
| 1143 |
+
* Fixed (C4265) missing virtual destructor warning in Matchers (#844)
|
| 1144 |
+
* `std::string`s are now taken by `const&` everywhere (#842).
|
| 1145 |
+
* Previously some places were taking them by-value.
|
| 1146 |
+
* Catch should no longer change errno (#835).
|
| 1147 |
+
* This was caused by libstdc++ bug that we now work around.
|
| 1148 |
+
* Catch now provides `FAIL_CHECK( ... )` macro (#765).
|
| 1149 |
+
* Same as `FAIL( ... )`, but does not abort the test.
|
| 1150 |
+
* Functions like `fabs`, `tolower`, `memset`, `isalnum` are now used with `std::` qualification (#543).
|
| 1151 |
+
* Clara no longer assumes first argument (binary name) is always present (#729)
|
| 1152 |
+
* If it is missing, empty string is used as default.
|
| 1153 |
+
* Clara no longer reads 1 character past argument string (#830)
|
| 1154 |
+
* Regression in Objective-C bindings (Matchers) fixed (#854)
|
| 1155 |
+
|
| 1156 |
+
|
| 1157 |
+
##### Other notes:
|
| 1158 |
+
* We have added VS 2013 and 2015 to our CI
|
| 1159 |
+
* Catch Classic (1.x.x) now contains its own, forked, version of Clara (the argument parser).
|
| 1160 |
+
|
| 1161 |
+
|
| 1162 |
+
|
| 1163 |
+
#### 1.8.1
|
| 1164 |
+
|
| 1165 |
+
##### Fixes
|
| 1166 |
+
|
| 1167 |
+
Cygwin issue with `gettimeofday` - `#define` was not early enough
|
| 1168 |
+
|
| 1169 |
+
#### 1.8.0
|
| 1170 |
+
|
| 1171 |
+
##### New features/ minor changes
|
| 1172 |
+
|
| 1173 |
+
* Matchers have new, simpler (and documented) interface.
|
| 1174 |
+
* Catch provides string and vector matchers.
|
| 1175 |
+
* For details see [Matchers documentation](matchers.md#top).
|
| 1176 |
+
* Changed console reporter test duration reporting format (#322)
|
| 1177 |
+
* Old format: `Some simple comparisons between doubles completed in 0.000123s`
|
| 1178 |
+
* New format: `xxx.123s: Some simple comparisons between doubles` _(There will always be exactly 3 decimal places)_
|
| 1179 |
+
* Added opt-in leak detection under MSVC + Windows (#439)
|
| 1180 |
+
* Enable it by compiling Catch's main with `CATCH_CONFIG_WINDOWS_CRTDBG`
|
| 1181 |
+
* Introduced new compile-time flag, `CATCH_CONFIG_FAST_COMPILE`, trading features for compilation speed.
|
| 1182 |
+
* Moves debug breaks out of tests and into implementation, speeding up test compilation time (~10% on linux).
|
| 1183 |
+
* _More changes are coming_
|
| 1184 |
+
* 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.
|
| 1185 |
+
* These are not present in the default single-include header and need to be downloaded from GitHub separately.
|
| 1186 |
+
* For details see [documentation about integrating with build systems](build-systems.md#top).
|
| 1187 |
+
* XML reporter now reports filename as part of the `Section` and `TestCase` tags.
|
| 1188 |
+
* `Approx` now supports an optional margin of absolute error
|
| 1189 |
+
* It has also received [new documentation](assertions.md#top).
|
| 1190 |
+
|
| 1191 |
+
##### Fixes
|
| 1192 |
+
* Silenced C4312 ("conversion from int to 'ClassName *") warnings in the evaluate layer.
|
| 1193 |
+
* Fixed C4512 ("assignment operator could not be generated") warnings under VS2013.
|
| 1194 |
+
* Cygwin compatibility fixes
|
| 1195 |
+
* Signal handling is no longer compiled by default.
|
| 1196 |
+
* Usage of `gettimeofday` inside Catch should no longer cause compilation errors.
|
| 1197 |
+
* Improved `-Wparentheses` suppression for gcc (#674)
|
| 1198 |
+
* When compiled with gcc 4.8 or newer, the suppression is localized to assertions only
|
| 1199 |
+
* Otherwise it is suppressed for the whole TU
|
| 1200 |
+
* Fixed test spec parser issue (with escapes in multiple names)
|
| 1201 |
+
|
| 1202 |
+
##### Other
|
| 1203 |
+
* Various documentation fixes and improvements
|
| 1204 |
+
|
| 1205 |
+
|
| 1206 |
+
### 1.7.x
|
| 1207 |
+
|
| 1208 |
+
#### 1.7.2
|
| 1209 |
+
|
| 1210 |
+
##### Fixes and minor improvements
|
| 1211 |
+
Xml:
|
| 1212 |
+
|
| 1213 |
+
(technically the first two are breaking changes but are also fixes and arguably break few if any people)
|
| 1214 |
+
* C-escape control characters instead of XML encoding them (which requires XML 1.1)
|
| 1215 |
+
* Revert XML output to XML 1.0
|
| 1216 |
+
* Can provide stylesheet references by extending the XML reporter
|
| 1217 |
+
* Added description and tags attributes to XML Reporter
|
| 1218 |
+
* Tags are closed and the stream flushed more eagerly to avoid stdout interpolation
|
| 1219 |
+
|
| 1220 |
+
|
| 1221 |
+
Other:
|
| 1222 |
+
* `REQUIRE_THROWS_AS` now catches exception by `const&` and reports expected type
|
| 1223 |
+
* In `SECTION`s the file/ line is now of the `SECTION`. not the `TEST_CASE`
|
| 1224 |
+
* Added std:: qualification to some functions from C stdlib
|
| 1225 |
+
* Removed use of RTTI (`dynamic_cast`) that had crept back in
|
| 1226 |
+
* Silenced a few more warnings in different circumstances
|
| 1227 |
+
* Travis improvements
|
| 1228 |
+
|
| 1229 |
+
#### 1.7.1
|
| 1230 |
+
|
| 1231 |
+
##### Fixes:
|
| 1232 |
+
* Fixed inconsistency in defining `NOMINMAX` and `WIN32_LEAN_AND_MEAN` inside `catch.hpp`.
|
| 1233 |
+
* Fixed SEH-related compilation error under older MinGW compilers, by making Windows SEH handling opt-in for compilers other than MSVC.
|
| 1234 |
+
* For specifics, look into the [documentation](configuration.md#top).
|
| 1235 |
+
* Fixed compilation error under MinGW caused by improper compiler detection.
|
| 1236 |
+
* Fixed XML reporter sometimes leaving an empty output file when a test ends with signal/structured exception.
|
| 1237 |
+
* Fixed XML reporter not reporting captured stdout/stderr.
|
| 1238 |
+
* Fixed possible infinite recursion in Windows SEH.
|
| 1239 |
+
* Fixed possible compilation error caused by Catch's operator overloads being ambiguous in regards to user-defined templated operators.
|
| 1240 |
+
|
| 1241 |
+
#### 1.7.0
|
| 1242 |
+
|
| 1243 |
+
##### Features/ Changes:
|
| 1244 |
+
* Catch now runs significantly faster for passing tests
|
| 1245 |
+
* Microbenchmark focused on Catch's overhead went from ~3.4s to ~0.7s.
|
| 1246 |
+
* Real world test using [JSON for Modern C++](https://github.com/nlohmann/json)'s test suite went from ~6m 25s to ~4m 14s.
|
| 1247 |
+
* Catch can now run specific sections within test cases.
|
| 1248 |
+
* For now the support is only basic (no wildcards or tags), for details see the [documentation](command-line.md#top).
|
| 1249 |
+
* Catch now supports SEH on Windows as well as signals on Linux.
|
| 1250 |
+
* After receiving a signal, Catch reports failing assertion and then passes the signal onto the previous handler.
|
| 1251 |
+
* Approx can be used to compare values against strong typedefs (available in C++11 mode only).
|
| 1252 |
+
* Strong typedefs mean types that are explicitly convertible to double.
|
| 1253 |
+
* CHECK macro no longer stops executing section if an exception happens.
|
| 1254 |
+
* Certain characters (space, tab, etc) are now pretty printed.
|
| 1255 |
+
* This means that a `char c = ' '; REQUIRE(c == '\t');` would be printed as `' ' == '\t'`, instead of ` == 9`.
|
| 1256 |
+
|
| 1257 |
+
##### Fixes:
|
| 1258 |
+
* Text formatting no longer attempts to access out-of-bounds characters under certain conditions.
|
| 1259 |
+
* THROW family of assertions no longer trigger `-Wunused-value` on expressions containing explicit cast.
|
| 1260 |
+
* Breaking into debugger under OS X works again and no longer required `DEBUG` to be defined.
|
| 1261 |
+
* Compilation no longer breaks under certain compiler if a lambda is used inside assertion macro.
|
| 1262 |
+
|
| 1263 |
+
##### Other:
|
| 1264 |
+
* Catch's CMakeLists now defines install command.
|
| 1265 |
+
* Catch's CMakeLists now generates projects with warnings enabled.
|
| 1266 |
+
|
| 1267 |
+
|
| 1268 |
+
### 1.6.x
|
| 1269 |
+
|
| 1270 |
+
#### 1.6.1
|
| 1271 |
+
|
| 1272 |
+
##### Features/ Changes:
|
| 1273 |
+
* Catch now supports breaking into debugger on Linux
|
| 1274 |
+
|
| 1275 |
+
##### Fixes:
|
| 1276 |
+
* Generators no longer leak memory (generators are still unsupported in general)
|
| 1277 |
+
* JUnit reporter now reports UTC timestamps, instead of "tbd"
|
| 1278 |
+
* `CHECK_THAT` macro is now properly defined as `CATCH_CHECK_THAT` when using `CATCH_` prefixed macros
|
| 1279 |
+
|
| 1280 |
+
##### Other:
|
| 1281 |
+
* Types with overloaded `&&` operator are no longer evaluated twice when used in an assertion macro.
|
| 1282 |
+
* The use of `__COUNTER__` is suppressed when Catch is parsed by CLion
|
| 1283 |
+
* This change is not active when compiling a binary
|
| 1284 |
+
* Approval tests can now be run on Windows
|
| 1285 |
+
* CMake will now warn if a file is present in the `include` folder but not is not enumerated as part of the project
|
| 1286 |
+
* Catch now defines `NOMINMAX` and `WIN32_LEAN_AND_MEAN` before including `windows.h`
|
| 1287 |
+
* This can be disabled if needed, see [documentation](configuration.md#top) for details.
|
| 1288 |
+
|
| 1289 |
+
|
| 1290 |
+
#### 1.6.0
|
| 1291 |
+
|
| 1292 |
+
##### Cmake/ projects:
|
| 1293 |
+
* 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.
|
| 1294 |
+
|
| 1295 |
+
##### Features/ Changes:
|
| 1296 |
+
* Approx now supports `>=` and `<=`
|
| 1297 |
+
* Can now use `\` to escape chars in test names on command line
|
| 1298 |
+
* Standardize C++11 feature toggles
|
| 1299 |
+
|
| 1300 |
+
##### Fixes:
|
| 1301 |
+
* Blue shell colour
|
| 1302 |
+
* Missing argument to `CATCH_CHECK_THROWS`
|
| 1303 |
+
* Don't encode extended ASCII in XML
|
| 1304 |
+
* use `std::shuffle` on more compilers (fixes deprecation warning/error)
|
| 1305 |
+
* Use `__COUNTER__` more consistently (where available)
|
| 1306 |
+
|
| 1307 |
+
##### Other:
|
| 1308 |
+
* Tweaks and changes to scripts - particularly for Approval test - to make them more portable
|
| 1309 |
+
|
| 1310 |
+
|
| 1311 |
+
## Even Older versions
|
| 1312 |
+
Release notes were not maintained prior to v1.6.0, but you should be able to work them out from the Git history
|
| 1313 |
+
|
| 1314 |
+
---
|
| 1315 |
+
|
| 1316 |
+
[Home](Readme.md#top)
|
weight/_dep/Catch2/docs/release-process.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<a id="top"></a>
|
| 2 |
+
# How to release
|
| 3 |
+
|
| 4 |
+
When enough changes have accumulated, it is time to release new version of Catch. This document describes the process in doing so, that no steps are forgotten. Note that all referenced scripts can be found in the `scripts/` directory.
|
| 5 |
+
|
| 6 |
+
## Necessary steps
|
| 7 |
+
|
| 8 |
+
These steps are necessary and have to be performed before each new release. They serve to make sure that the new release is correct and linked-to from the standard places.
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
### Testing
|
| 12 |
+
|
| 13 |
+
All of the tests are currently run in our CI setup based on TravisCI and
|
| 14 |
+
AppVeyor. As long as the last commit tested green, the release can
|
| 15 |
+
proceed.
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
### Incrementing version number
|
| 19 |
+
|
| 20 |
+
Catch uses a variant of [semantic versioning](http://semver.org/), with breaking API changes (and thus major version increments) being very rare. Thus, the release will usually increment the patch version, when it only contains couple of bugfixes, or minor version, when it contains new functionality, or larger changes in implementation of current functionality.
|
| 21 |
+
|
| 22 |
+
After deciding which part of version number should be incremented, you can use one of the `*Release.py` scripts to perform the required changes to Catch.
|
| 23 |
+
|
| 24 |
+
This will take care of generating the single include header, updating
|
| 25 |
+
version numbers everywhere and pushing the new version to Wandbox.
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
### Release notes
|
| 29 |
+
|
| 30 |
+
Once a release is ready, release notes need to be written. They should summarize changes done since last release. For rough idea of expected notes see previous releases. Once written, release notes should be added to `docs/release-notes.md`.
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
### Commit and push update to GitHub
|
| 34 |
+
|
| 35 |
+
After version number is incremented, single-include header is regenerated and release notes are updated, changes should be committed and pushed to GitHub.
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
### Release on GitHub
|
| 39 |
+
|
| 40 |
+
After pushing changes to GitHub, GitHub release *needs* to be created.
|
| 41 |
+
Tag version and release title should be same as the new version,
|
| 42 |
+
description should contain the release notes for the current release.
|
| 43 |
+
Single header version of `catch.hpp` *needs* to be attached as a binary,
|
| 44 |
+
as that is where the official download link links to. Preferably
|
| 45 |
+
it should use linux line endings. All non-bundled reporters (Automake, TAP,
|
| 46 |
+
TeamCity, SonarQube) should also be attached as binaries, as they might be
|
| 47 |
+
dependent on a specific version of the single-include header.
|
| 48 |
+
|
| 49 |
+
Since 2.5.0, the release tag and the "binaries" (headers) should be PGP
|
| 50 |
+
signed.
|
| 51 |
+
|
| 52 |
+
#### Signing a tag
|
| 53 |
+
|
| 54 |
+
To create a signed tag, use `git tag -s <VERSION>`, where `<VERSION>`
|
| 55 |
+
is the version being released, e.g. `git tag -s v2.6.0`.
|
| 56 |
+
|
| 57 |
+
Use the version name as the short message and the release notes as
|
| 58 |
+
the body (long) message.
|
| 59 |
+
|
| 60 |
+
#### Signing the headers
|
| 61 |
+
|
| 62 |
+
This will create ASCII-armored signatures for the headers that are
|
| 63 |
+
uploaded to the GitHub release:
|
| 64 |
+
|
| 65 |
+
```
|
| 66 |
+
$ gpg2 --armor --output catch.hpp.asc --detach-sig catch.hpp
|
| 67 |
+
$ gpg2 --armor --output catch_reporter_automake.hpp.asc --detach-sig catch_reporter_automake.hpp
|
| 68 |
+
$ gpg2 --armor --output catch_reporter_teamcity.hpp.asc --detach-sig catch_reporter_teamcity.hpp
|
| 69 |
+
$ gpg2 --armor --output catch_reporter_tap.hpp.asc --detach-sig catch_reporter_tap.hpp
|
| 70 |
+
$ gpg2 --armor --output catch_reporter_sonarqube.hpp.asc --detach-sig catch_reporter_sonarqube.hpp
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
_GPG does not support signing multiple files in single invocation._
|
weight/_dep/Catch2/docs/reporters.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<a id="top"></a>
|
| 2 |
+
# Reporters
|
| 3 |
+
|
| 4 |
+
Catch has a modular reporting system and comes bundled with a handful of useful reporters built in.
|
| 5 |
+
You can also write your own reporters.
|
| 6 |
+
|
| 7 |
+
## Using different reporters
|
| 8 |
+
|
| 9 |
+
The reporter to use can easily be controlled from the command line.
|
| 10 |
+
To specify a reporter use [`-r` or `--reporter`](command-line.md#choosing-a-reporter-to-use), followed by the name of the reporter, e.g.:
|
| 11 |
+
|
| 12 |
+
```
|
| 13 |
+
-r xml
|
| 14 |
+
```
|
| 15 |
+
|
| 16 |
+
If you don't specify a reporter then the console reporter is used by default.
|
| 17 |
+
There are four reporters built in to the single include:
|
| 18 |
+
|
| 19 |
+
* `console` writes as lines of text, formatted to a typical terminal width, with colours if a capable terminal is detected.
|
| 20 |
+
* `compact` similar to `console` but optimised for minimal output - each entry on one line
|
| 21 |
+
* `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.
|
| 22 |
+
Because of the way the junit format is structured the run must complete before anything is written.
|
| 23 |
+
* `xml` writes an xml format tailored to Catch. Unlike `junit` this is a streaming format so results are delivered progressively.
|
| 24 |
+
|
| 25 |
+
There are a few additional reporters, for specific build systems, in the Catch repository (in `include\reporters`) which you can `#include` in your project if you would like to make use of them.
|
| 26 |
+
Do this in one source file - the same one you have `CATCH_CONFIG_MAIN` or `CATCH_CONFIG_RUNNER`.
|
| 27 |
+
|
| 28 |
+
* `teamcity` writes the native, streaming, format that [TeamCity](https://www.jetbrains.com/teamcity/) understands.
|
| 29 |
+
Use this when building as part of a TeamCity build to see results as they happen ([code example](../examples/207-Rpt-TeamCityReporter.cpp)).
|
| 30 |
+
* `tap` writes in the TAP ([Test Anything Protocol](https://en.wikipedia.org/wiki/Test_Anything_Protocol)) format.
|
| 31 |
+
* `automake` writes in a format that correspond to [automake .trs](https://www.gnu.org/software/automake/manual/html_node/Log-files-generation-and-test-results-recording.html) files
|
| 32 |
+
* `sonarqube` writes the [SonarQube Generic Test Data](https://docs.sonarqube.org/latest/analysis/generic-test/) XML format.
|
| 33 |
+
|
| 34 |
+
You see what reporters are available from the command line by running with `--list-reporters`.
|
| 35 |
+
|
| 36 |
+
By default all these reports are written to stdout, but can be redirected to a file with [`-o` or `--out`](command-line.md#sending-output-to-a-file)
|
| 37 |
+
|
| 38 |
+
## Writing your own reporter
|
| 39 |
+
|
| 40 |
+
You can write your own custom reporter and register it with Catch.
|
| 41 |
+
At time of writing the interface is subject to some changes so is not, yet, documented here.
|
| 42 |
+
If you are determined you shouldn't have too much trouble working it out from the existing implementations -
|
| 43 |
+
but do keep in mind upcoming changes (these will be minor, simplifying, changes such as not needing to forward calls to the base class).
|
| 44 |
+
|
| 45 |
+
---
|
| 46 |
+
|
| 47 |
+
[Home](Readme.md#top)
|