forked from catchorg/Catch2
Compare commits
134 Commits
Author | SHA1 | Date | |
---|---|---|---|
182c910b4b | |||
02123776f2 | |||
14bc25be00 | |||
20d413b8b6 | |||
e33de8fc05 | |||
1127d847a1 | |||
ca455815fd | |||
d71b4617e9 | |||
62fd660583 | |||
0aa4dbae2e | |||
ff151d2833 | |||
958944d27a | |||
216713a406 | |||
e9e4117016 | |||
8a06a6dce8 | |||
33794a204c | |||
f45dac8fc1 | |||
f2f0dcc511 | |||
dba29b60d6 | |||
3d01f3ae32 | |||
85c9544fa4 | |||
4b9780201b | |||
c4e3767e26 | |||
eea3e9a5b5 | |||
7727c15290 | |||
531a149ae7 | |||
9683570be7 | |||
581c46249a | |||
b15b862d86 | |||
6971476563 | |||
5c88067bd3 | |||
86a4d704bc | |||
469a717395 | |||
42e368dd0a | |||
1ff1f2741d | |||
269f96e2bc | |||
cec35630fb | |||
b8b03da534 | |||
8f277a54c0 | |||
4cb3220a8a | |||
b025a007b9 | |||
68975e3ff3 | |||
bcb9ea8cb5 | |||
d4c9494eb5 | |||
bed285af07 | |||
de6fe184a9 | |||
fe3dddcc6d | |||
18ab353e55 | |||
2375a7f5b7 | |||
fac517d571 | |||
578f8b8006 | |||
92f8b01dfa | |||
dc7e705672 | |||
3ba745552b | |||
ff349a50bf | |||
aca2472d40 | |||
765ac08f08 | |||
8dd25b0410 | |||
69297ceeb6 | |||
2d30df3500 | |||
77b2a7daea | |||
e905edb10f | |||
87074da73e | |||
e6f5e05ebc | |||
44900d5371 | |||
7c75ecaef4 | |||
fba0feeba1 | |||
3e8800beb1 | |||
314a05d809 | |||
eadf4e32b6 | |||
f9620d11be | |||
00db4fb497 | |||
2fc83e7e9c | |||
a2e5ce2418 | |||
fd9f5ac661 | |||
f0dc4d9be0 | |||
284672cc84 | |||
2b34b5c7d0 | |||
708487d201 | |||
6859c683e0 | |||
de3a208e16 | |||
229cc4823c | |||
7f21cc6c55 | |||
4c85248179 | |||
b4e2237152 | |||
40937b67c7 | |||
0d5b131394 | |||
ad3b90553b | |||
b1c45652e5 | |||
b79a83e4aa | |||
89fe35d515 | |||
115d6a1c40 | |||
91576352f9 | |||
6f7c191513 | |||
4eb9d37e05 | |||
53d8af8e96 | |||
46fde0c597 | |||
de103db696 | |||
fedc3a7b7b | |||
c299133a31 | |||
09b8017ea3 | |||
bad3c93049 | |||
0f05c034c2 | |||
ee4538c0c6 | |||
dc7a20fc74 | |||
018dc0b74f | |||
ad1940f336 | |||
5399921622 | |||
e815acddf8 | |||
e7189f1e4f | |||
1806b21545 | |||
288416f501 | |||
cbbebb65b6 | |||
fb08596b1b | |||
0614a4acb3 | |||
0f12995501 | |||
0807fdb175 | |||
9500ded83b | |||
6c6ebe374a | |||
b1b5cb8122 | |||
77dc8cfc45 | |||
ddc9f4c61d | |||
bed47374ce | |||
0e9bae1cdb | |||
f133277910 | |||
f764ee3d30 | |||
c190061001 | |||
b1dcdc5032 | |||
f0e596e252 | |||
594cab31ed | |||
89f5f84351 | |||
2e61d38c7c | |||
5c9f09e94a | |||
f4fc2dab2c |
25
.clang-format
Normal file
25
.clang-format
Normal file
@ -0,0 +1,25 @@
|
||||
---
|
||||
AccessModifierOffset: '-4'
|
||||
AlignEscapedNewlines: Left
|
||||
AllowAllConstructorInitializersOnNextLine: 'true'
|
||||
BinPackArguments: 'false'
|
||||
BinPackParameters: 'false'
|
||||
BreakConstructorInitializers: AfterColon
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true'
|
||||
DerivePointerAlignment: 'false'
|
||||
FixNamespaceComments: 'true'
|
||||
IncludeBlocks: Regroup
|
||||
IndentCaseLabels: 'false'
|
||||
IndentPPDirectives: AfterHash
|
||||
IndentWidth: '4'
|
||||
Language: Cpp
|
||||
NamespaceIndentation: All
|
||||
PointerAlignment: Left
|
||||
SpaceBeforeCtorInitializerColon: 'false'
|
||||
SpaceInEmptyParentheses: 'false'
|
||||
SpacesInParentheses: 'true'
|
||||
Standard: Cpp11
|
||||
TabWidth: '4'
|
||||
UseTab: Never
|
||||
|
||||
...
|
@ -31,7 +31,7 @@ class BuilderSettings(object):
|
||||
not match the stable pattern. Otherwise it will upload to stable
|
||||
channel.
|
||||
"""
|
||||
return os.getenv("CONAN_UPLOAD", "https://api.bintray.com/conan/catchorg/Catch2")
|
||||
return os.getenv("CONAN_UPLOAD", "https://api.bintray.com/conan/catchorg/catch2")
|
||||
|
||||
@property
|
||||
def upload_only_when_stable(self):
|
||||
|
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@ -1 +1 @@
|
||||
patreon: horenmar
|
||||
custom: "https://www.paypal.me/horenmar"
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -28,3 +28,4 @@ Build
|
||||
cmake-build-*
|
||||
benchmark-dir
|
||||
.conan/test_package/build
|
||||
bazel-*
|
||||
|
22
.travis.yml
22
.travis.yml
@ -258,6 +258,15 @@ matrix:
|
||||
addons: *gcc7
|
||||
env: COMPILER='g++-7' EXAMPLES=1 COVERAGE=1 EXTRAS=1 CPP17=1
|
||||
|
||||
- os: linux
|
||||
dist: xenial
|
||||
compiler: clang
|
||||
addons:
|
||||
apt:
|
||||
sources: *all_sources
|
||||
packages: ['clang-5.0']
|
||||
env: COMPILER='clang++-5.0' CPP17=1
|
||||
|
||||
- os: linux
|
||||
dist: xenial
|
||||
compiler: clang
|
||||
@ -276,19 +285,6 @@ matrix:
|
||||
packages: ['clang-6.0', 'libstdc++-8-dev']
|
||||
env: COMPILER='clang++-6.0' CPP17=1 EXAMPLES=1 COVERAGE=1 EXTRAS=1
|
||||
|
||||
# 8/ Conan
|
||||
- language: python
|
||||
python:
|
||||
- "3.7"
|
||||
dist: xenial
|
||||
install:
|
||||
- pip install conan-package-tools
|
||||
env:
|
||||
- CONAN_GCC_VERSIONS=8
|
||||
- CONAN_DOCKER_IMAGE=conanio/gcc8
|
||||
script:
|
||||
- python .conan/build.py
|
||||
|
||||
install:
|
||||
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
|
||||
- mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}
|
||||
|
17
BUILD.bazel
Normal file
17
BUILD.bazel
Normal file
@ -0,0 +1,17 @@
|
||||
# Load the cc_library rule.
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
|
||||
# Header-only rule to export catch2/catch.hpp.
|
||||
cc_library(
|
||||
name = "catch2",
|
||||
hdrs = ["single_include/catch2/catch.hpp"],
|
||||
includes = ["single_include/"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "catch2_with_main",
|
||||
srcs = ["src/catch_with_main.cpp"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["//:catch2"],
|
||||
)
|
@ -1,4 +1,7 @@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
|
||||
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
|
||||
|
||||
Name: Catch2
|
||||
Description: A modern, C++-native, header-only, test framework for C++11
|
||||
|
@ -3,7 +3,9 @@ cmake_minimum_required(VERSION 3.5)
|
||||
# detect if Catch is being bundled,
|
||||
# disable testsuite in that case
|
||||
if(NOT DEFINED PROJECT_NAME)
|
||||
set(NOT_SUBPROJECT ON)
|
||||
set(NOT_SUBPROJECT ON)
|
||||
else()
|
||||
set(NOT_SUBPROJECT OFF)
|
||||
endif()
|
||||
|
||||
# Catch2's build breaks if done in-tree. You probably should not build
|
||||
@ -14,27 +16,23 @@ if (CMAKE_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||
endif()
|
||||
|
||||
|
||||
project(Catch2 LANGUAGES CXX VERSION 2.12.0)
|
||||
project(Catch2 LANGUAGES CXX VERSION 2.13.10)
|
||||
|
||||
# Provide path for scripts
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake")
|
||||
|
||||
include(GNUInstallDirs)
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(CTest)
|
||||
|
||||
option(CATCH_USE_VALGRIND "Perform SelfTests with Valgrind" OFF)
|
||||
option(CATCH_BUILD_TESTING "Build SelfTest project" ON)
|
||||
option(CATCH_BUILD_EXAMPLES "Build documentation examples" OFF)
|
||||
option(CATCH_BUILD_EXTRA_TESTS "Build extra tests" OFF)
|
||||
option(CATCH_BUILD_STATIC_LIBRARY "Builds static library from the main implementation. EXPERIMENTAL" OFF)
|
||||
option(CATCH_ENABLE_COVERAGE "Generate coverage for codecov.io" OFF)
|
||||
option(CATCH_ENABLE_WERROR "Enable all warnings as errors" ON)
|
||||
option(CATCH_INSTALL_DOCS "Install documentation alongside library" ON)
|
||||
option(CATCH_INSTALL_HELPERS "Install contrib alongside library" ON)
|
||||
|
||||
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
# define some folders
|
||||
set(CATCH_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(SELF_TEST_DIR ${CATCH_DIR}/projects/SelfTest)
|
||||
@ -45,12 +43,16 @@ if(USE_WMAIN)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:wmainCRTStartup")
|
||||
endif()
|
||||
|
||||
if (BUILD_TESTING AND CATCH_BUILD_TESTING AND NOT_SUBPROJECT)
|
||||
find_package(PythonInterp)
|
||||
if (NOT PYTHONINTERP_FOUND)
|
||||
message(FATAL_ERROR "Python not found, but required for tests")
|
||||
if(NOT_SUBPROJECT)
|
||||
include(CTest)
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
if(BUILD_TESTING AND CATCH_BUILD_TESTING)
|
||||
find_package(PythonInterp)
|
||||
if (NOT PYTHONINTERP_FOUND)
|
||||
message(FATAL_ERROR "Python not found, but required for tests")
|
||||
endif()
|
||||
add_subdirectory(projects)
|
||||
endif()
|
||||
add_subdirectory(projects)
|
||||
endif()
|
||||
|
||||
if(CATCH_BUILD_EXAMPLES)
|
||||
@ -103,10 +105,28 @@ endif()
|
||||
# provide a namespaced alias for clients to 'link' against if catch is included as a sub-project
|
||||
add_library(Catch2::Catch2 ALIAS Catch2)
|
||||
|
||||
# Hacky support for compiling the impl into a static lib
|
||||
if (CATCH_BUILD_STATIC_LIBRARY)
|
||||
add_library(Catch2WithMain ${CMAKE_CURRENT_LIST_DIR}/src/catch_with_main.cpp)
|
||||
target_link_libraries(Catch2WithMain PUBLIC Catch2)
|
||||
add_library(Catch2::Catch2WithMain ALIAS Catch2WithMain)
|
||||
|
||||
# Make the build reproducible on versions of g++ and clang that supports -ffile-prefix-map
|
||||
if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 8) OR
|
||||
("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 10))
|
||||
target_compile_options(Catch2WithMain PRIVATE "-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.")
|
||||
endif()
|
||||
|
||||
if (CATCH_CONFIG_DEFAULT_REPORTER)
|
||||
target_compile_definitions(Catch2WithMain PRIVATE CATCH_CONFIG_DEFAULT_REPORTER=${CATCH_CONFIG_DEFAULT_REPORTER})
|
||||
endif()
|
||||
endif(CATCH_BUILD_STATIC_LIBRARY)
|
||||
|
||||
# Only perform the installation steps when Catch is not being used as
|
||||
# a subproject via `add_subdirectory`, or the destinations will break,
|
||||
# see https://github.com/catchorg/Catch2/issues/1373
|
||||
if (NOT_SUBPROJECT)
|
||||
include(CMakePackageConfigHelpers)
|
||||
set(CATCH_CMAKE_CONFIG_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Catch2")
|
||||
|
||||
configure_package_config_file(
|
||||
@ -116,11 +136,17 @@ if (NOT_SUBPROJECT)
|
||||
${CATCH_CMAKE_CONFIG_DESTINATION}
|
||||
)
|
||||
|
||||
# Workaround lack of generator expressions in install(TARGETS
|
||||
set(InstallationTargets Catch2)
|
||||
if (TARGET Catch2WithMain)
|
||||
list(APPEND InstallationTargets Catch2WithMain)
|
||||
endif()
|
||||
|
||||
|
||||
# create and install an export set for catch target as Catch2::Catch
|
||||
install(
|
||||
TARGETS
|
||||
Catch2
|
||||
${InstallationTargets}
|
||||
EXPORT
|
||||
Catch2Targets
|
||||
DESTINATION
|
||||
|
@ -2,14 +2,14 @@
|
||||

|
||||
|
||||
[](https://github.com/catchorg/catch2/releases)
|
||||
[](https://travis-ci.org/catchorg/Catch2)
|
||||
[](https://travis-ci.org/catchorg/Catch2)
|
||||
[](https://ci.appveyor.com/project/catchorg/catch2)
|
||||
[](https://codecov.io/gh/catchorg/Catch2)
|
||||
[](https://wandbox.org/permlink/oT7SOoJ9ua6JsdEB)
|
||||
[](https://codecov.io/gh/catchorg/Catch2)
|
||||
[](https://wandbox.org/permlink/6JUH8Eybx4CtvkJS)
|
||||
[](https://discord.gg/4CWS9zD)
|
||||
|
||||
|
||||
<a href="https://github.com/catchorg/Catch2/releases/download/v2.12.0/catch.hpp">The latest version of the single header can be downloaded directly using this link</a>
|
||||
<a href="https://github.com/catchorg/Catch2/releases/download/v2.13.10/catch.hpp">The latest version of the single header can be downloaded directly using this link</a>
|
||||
|
||||
## Catch2 is released!
|
||||
|
||||
|
@ -19,7 +19,7 @@ coverage:
|
||||
|
||||
|
||||
codecov:
|
||||
branch: master
|
||||
branch: v2.x
|
||||
|
||||
comment:
|
||||
layout: "diff"
|
||||
|
@ -10,7 +10,7 @@ class CatchConan(ConanFile):
|
||||
homepage = url
|
||||
license = "BSL-1.0"
|
||||
exports = "LICENSE.txt"
|
||||
exports_sources = ("single_include/*", "CMakeLists.txt", "CMake/*", "contrib/*")
|
||||
exports_sources = ("single_include/*", "CMakeLists.txt", "CMake/*", "contrib/*", "src/*")
|
||||
generators = "cmake"
|
||||
|
||||
def package(self):
|
||||
@ -25,3 +25,6 @@ class CatchConan(ConanFile):
|
||||
|
||||
def package_id(self):
|
||||
self.info.header_only()
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.builddirs.append("lib/cmake/Catch2")
|
||||
|
@ -33,6 +33,10 @@ same as the Catch name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``.
|
||||
[TEST_SUFFIX suffix]
|
||||
[PROPERTIES name1 value1...]
|
||||
[TEST_LIST var]
|
||||
[REPORTER reporter]
|
||||
[OUTPUT_DIR dir]
|
||||
[OUTPUT_PREFIX prefix}
|
||||
[OUTPUT_SUFFIX suffix]
|
||||
)
|
||||
|
||||
``catch_discover_tests`` sets up a post-build command on the test executable
|
||||
@ -90,6 +94,28 @@ same as the Catch name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``.
|
||||
executable is being used in multiple calls to ``catch_discover_tests()``.
|
||||
Note that this variable is only available in CTest.
|
||||
|
||||
``REPORTER reporter``
|
||||
Use the specified reporter when running the test case. The reporter will
|
||||
be passed to the Catch executable as ``--reporter reporter``.
|
||||
|
||||
``OUTPUT_DIR dir``
|
||||
If specified, the parameter is passed along as
|
||||
``--out dir/<test_name>`` to Catch executable. The actual file name is the
|
||||
same as the test name. This should be used instead of
|
||||
``EXTRA_ARGS --out foo`` to avoid race conditions writing the result output
|
||||
when using parallel test execution.
|
||||
|
||||
``OUTPUT_PREFIX prefix``
|
||||
May be used in conjunction with ``OUTPUT_DIR``.
|
||||
If specified, ``prefix`` is added to each output file name, like so
|
||||
``--out dir/prefix<test_name>``.
|
||||
|
||||
``OUTPUT_SUFFIX suffix``
|
||||
May be used in conjunction with ``OUTPUT_DIR``.
|
||||
If specified, ``suffix`` is added to each output file name, like so
|
||||
``--out dir/<test_name>suffix``. This can be used to add a file extension to
|
||||
the output e.g. ".xml".
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -97,7 +123,7 @@ function(catch_discover_tests TARGET)
|
||||
cmake_parse_arguments(
|
||||
""
|
||||
""
|
||||
"TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST"
|
||||
"TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST;REPORTER;OUTPUT_DIR;OUTPUT_PREFIX;OUTPUT_SUFFIX"
|
||||
"TEST_SPEC;EXTRA_ARGS;PROPERTIES"
|
||||
${ARGN}
|
||||
)
|
||||
@ -110,7 +136,7 @@ function(catch_discover_tests TARGET)
|
||||
endif()
|
||||
|
||||
## Generate a unique name based on the extra arguments
|
||||
string(SHA1 args_hash "${_TEST_SPEC} ${_EXTRA_ARGS}")
|
||||
string(SHA1 args_hash "${_TEST_SPEC} ${_EXTRA_ARGS} ${_REPORTER} ${_OUTPUT_DIR} ${_OUTPUT_PREFIX} ${_OUTPUT_SUFFIX}")
|
||||
string(SUBSTRING ${args_hash} 0 7 args_hash)
|
||||
|
||||
# Define rule to generate test list for aforementioned test executable
|
||||
@ -134,6 +160,10 @@ function(catch_discover_tests TARGET)
|
||||
-D "TEST_PREFIX=${_TEST_PREFIX}"
|
||||
-D "TEST_SUFFIX=${_TEST_SUFFIX}"
|
||||
-D "TEST_LIST=${_TEST_LIST}"
|
||||
-D "TEST_REPORTER=${_REPORTER}"
|
||||
-D "TEST_OUTPUT_DIR=${_OUTPUT_DIR}"
|
||||
-D "TEST_OUTPUT_PREFIX=${_OUTPUT_PREFIX}"
|
||||
-D "TEST_OUTPUT_SUFFIX=${_OUTPUT_SUFFIX}"
|
||||
-D "CTEST_FILE=${ctest_tests_file}"
|
||||
-P "${_CATCH_DISCOVER_TESTS_SCRIPT}"
|
||||
VERBATIM
|
||||
@ -172,4 +202,5 @@ endfunction()
|
||||
|
||||
set(_CATCH_DISCOVER_TESTS_SCRIPT
|
||||
${CMAKE_CURRENT_LIST_DIR}/CatchAddTests.cmake
|
||||
CACHE INTERNAL "Catch2 full path to CatchAddTests.cmake helper file"
|
||||
)
|
||||
|
@ -6,13 +6,20 @@ set(suffix "${TEST_SUFFIX}")
|
||||
set(spec ${TEST_SPEC})
|
||||
set(extra_args ${TEST_EXTRA_ARGS})
|
||||
set(properties ${TEST_PROPERTIES})
|
||||
set(reporter ${TEST_REPORTER})
|
||||
set(output_dir ${TEST_OUTPUT_DIR})
|
||||
set(output_prefix ${TEST_OUTPUT_PREFIX})
|
||||
set(output_suffix ${TEST_OUTPUT_SUFFIX})
|
||||
set(script)
|
||||
set(suite)
|
||||
set(tests)
|
||||
|
||||
function(add_command NAME)
|
||||
set(_args "")
|
||||
foreach(_arg ${ARGN})
|
||||
# use ARGV* instead of ARGN, because ARGN splits arrays into multiple arguments
|
||||
math(EXPR _last_arg ${ARGC}-1)
|
||||
foreach(_n RANGE 1 ${_last_arg})
|
||||
set(_arg "${ARGV${_n}}")
|
||||
if(_arg MATCHES "[^-./:a-zA-Z0-9_]")
|
||||
set(_args "${_args} [==[${_arg}]==]") # form a bracket_argument
|
||||
else()
|
||||
@ -32,6 +39,7 @@ execute_process(
|
||||
COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} --list-test-names-only
|
||||
OUTPUT_VARIABLE output
|
||||
RESULT_VARIABLE result
|
||||
WORKING_DIRECTORY "${TEST_WORKING_DIR}"
|
||||
)
|
||||
# Catch --list-test-names-only reports the number of tests, so 0 is... surprising
|
||||
if(${result} EQUAL 0)
|
||||
@ -48,6 +56,44 @@ endif()
|
||||
|
||||
string(REPLACE "\n" ";" output "${output}")
|
||||
|
||||
# Run test executable to get list of available reporters
|
||||
execute_process(
|
||||
COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} --list-reporters
|
||||
OUTPUT_VARIABLE reporters_output
|
||||
RESULT_VARIABLE reporters_result
|
||||
WORKING_DIRECTORY "${TEST_WORKING_DIR}"
|
||||
)
|
||||
if(${reporters_result} EQUAL 0)
|
||||
message(WARNING
|
||||
"Test executable '${TEST_EXECUTABLE}' contains no reporters!\n"
|
||||
)
|
||||
elseif(${reporters_result} LESS 0)
|
||||
message(FATAL_ERROR
|
||||
"Error running test executable '${TEST_EXECUTABLE}':\n"
|
||||
" Result: ${reporters_result}\n"
|
||||
" Output: ${reporters_output}\n"
|
||||
)
|
||||
endif()
|
||||
string(FIND "${reporters_output}" "${reporter}" reporter_is_valid)
|
||||
if(reporter AND ${reporter_is_valid} EQUAL -1)
|
||||
message(FATAL_ERROR
|
||||
"\"${reporter}\" is not a valid reporter!\n"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Prepare reporter
|
||||
if(reporter)
|
||||
set(reporter_arg "--reporter ${reporter}")
|
||||
endif()
|
||||
|
||||
# Prepare output dir
|
||||
if(output_dir AND NOT IS_ABSOLUTE ${output_dir})
|
||||
set(output_dir "${TEST_WORKING_DIR}/${output_dir}")
|
||||
if(NOT EXISTS ${output_dir})
|
||||
file(MAKE_DIRECTORY ${output_dir})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Parse output
|
||||
foreach(line ${output})
|
||||
set(test ${line})
|
||||
@ -56,6 +102,12 @@ foreach(line ${output})
|
||||
foreach(char , [ ])
|
||||
string(REPLACE ${char} "\\${char}" test_name ${test_name})
|
||||
endforeach(char)
|
||||
# ...add output dir
|
||||
if(output_dir)
|
||||
string(REGEX REPLACE "[^A-Za-z0-9_]" "_" test_name_clean ${test_name})
|
||||
set(output_dir_arg "--out ${output_dir}/${output_prefix}${test_name_clean}${output_suffix}")
|
||||
endif()
|
||||
|
||||
# ...and add to script
|
||||
add_command(add_test
|
||||
"${prefix}${test}${suffix}"
|
||||
@ -63,6 +115,8 @@ foreach(line ${output})
|
||||
"${TEST_EXECUTABLE}"
|
||||
"${test_name}"
|
||||
${extra_args}
|
||||
"${reporter_arg}"
|
||||
"${output_dir_arg}"
|
||||
)
|
||||
add_command(set_tests_properties
|
||||
"${prefix}${test}${suffix}"
|
||||
|
@ -1,9 +1,11 @@
|
||||
#==================================================================================================#
|
||||
# supported macros #
|
||||
# - TEST_CASE, #
|
||||
# - TEMPLATE_TEST_CASE #
|
||||
# - SCENARIO, #
|
||||
# - TEST_CASE_METHOD, #
|
||||
# - CATCH_TEST_CASE, #
|
||||
# - CATCH_TEMPLATE_TEST_CASE #
|
||||
# - CATCH_SCENARIO, #
|
||||
# - CATCH_TEST_CASE_METHOD. #
|
||||
# #
|
||||
@ -106,7 +108,8 @@ function(ParseAndAddCatchTests_ParseFile SourceFile TestTarget)
|
||||
ParseAndAddCatchTests_RemoveComments(Contents)
|
||||
|
||||
# Find definition of test names
|
||||
string(REGEX MATCHALL "[ \t]*(CATCH_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)[ \t]*\\([^\)]+\\)+[ \t\n]*{+[ \t]*(//[^\n]*[Tt][Ii][Mm][Ee][Oo][Uu][Tt][ \t]*[0-9]+)*" Tests "${Contents}")
|
||||
# https://regex101.com/r/JygOND/1
|
||||
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}")
|
||||
|
||||
if(PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS AND Tests)
|
||||
ParseAndAddCatchTests_PrintDebugMessage("Adding ${SourceFile} to CMAKE_CONFIGURE_DEPENDS property")
|
||||
@ -117,13 +120,21 @@ function(ParseAndAddCatchTests_ParseFile SourceFile TestTarget)
|
||||
)
|
||||
endif()
|
||||
|
||||
# check CMP0110 policy for new add_test() behavior
|
||||
if(POLICY CMP0110)
|
||||
cmake_policy(GET CMP0110 _cmp0110_value) # new add_test() behavior
|
||||
else()
|
||||
# just to be thorough explicitly set the variable
|
||||
set(_cmp0110_value)
|
||||
endif()
|
||||
|
||||
foreach(TestName ${Tests})
|
||||
# Strip newlines
|
||||
string(REGEX REPLACE "\\\\\n|\n" "" TestName "${TestName}")
|
||||
|
||||
# Get test type and fixture if applicable
|
||||
string(REGEX MATCH "(CATCH_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)[ \t]*\\([^,^\"]*" TestTypeAndFixture "${TestName}")
|
||||
string(REGEX MATCH "(CATCH_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)" TestType "${TestTypeAndFixture}")
|
||||
string(REGEX MATCH "(CATCH_)?(TEMPLATE_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)[ \t]*\\([^,^\"]*" TestTypeAndFixture "${TestName}")
|
||||
string(REGEX MATCH "(CATCH_)?(TEMPLATE_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)" TestType "${TestTypeAndFixture}")
|
||||
string(REGEX REPLACE "${TestType}\\([ \t]*" "" TestFixture "${TestTypeAndFixture}")
|
||||
|
||||
# Get string parts of test definition
|
||||
@ -189,24 +200,39 @@ function(ParseAndAddCatchTests_ParseFile SourceFile TestTarget)
|
||||
# Escape commas in the test spec
|
||||
string(REPLACE "," "\\," Name ${Name})
|
||||
|
||||
# Work around CMake 3.18.0 change in `add_test()`, before the escaped quotes were necessary,
|
||||
# only with CMake 3.18.0 the escaped double quotes confuse the call. This change is reverted in 3.18.1
|
||||
# And properly introduced in 3.19 with the CMP0110 policy
|
||||
if(_cmp0110_value STREQUAL "NEW" OR ${CMAKE_VERSION} VERSION_EQUAL "3.18")
|
||||
ParseAndAddCatchTests_PrintDebugMessage("CMP0110 set to NEW, no need for add_test(\"\") workaround")
|
||||
else()
|
||||
ParseAndAddCatchTests_PrintDebugMessage("CMP0110 set to OLD adding \"\" for add_test() workaround")
|
||||
set(CTestName "\"${CTestName}\"")
|
||||
endif()
|
||||
|
||||
# Handle template test cases
|
||||
if("${TestTypeAndFixture}" MATCHES ".*TEMPLATE_.*")
|
||||
set(Name "${Name} - *")
|
||||
endif()
|
||||
|
||||
# Add the test and set its properties
|
||||
add_test(NAME "\"${CTestName}\"" COMMAND ${OptionalCatchTestLauncher} $<TARGET_FILE:${TestTarget}> ${Name} ${AdditionalCatchParameters})
|
||||
add_test(NAME "${CTestName}" COMMAND ${OptionalCatchTestLauncher} $<TARGET_FILE:${TestTarget}> ${Name} ${AdditionalCatchParameters})
|
||||
# Old CMake versions do not document VERSION_GREATER_EQUAL, so we use VERSION_GREATER with 3.8 instead
|
||||
if(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS AND ${HiddenTagFound} AND ${CMAKE_VERSION} VERSION_GREATER "3.8")
|
||||
ParseAndAddCatchTests_PrintDebugMessage("Setting DISABLED test property")
|
||||
set_tests_properties("\"${CTestName}\"" PROPERTIES DISABLED ON)
|
||||
set_tests_properties("${CTestName}" PROPERTIES DISABLED ON)
|
||||
else()
|
||||
set_tests_properties("\"${CTestName}\"" PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran"
|
||||
set_tests_properties("${CTestName}" PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran"
|
||||
LABELS "${Labels}")
|
||||
endif()
|
||||
set_property(
|
||||
TARGET ${TestTarget}
|
||||
APPEND
|
||||
PROPERTY ParseAndAddCatchTests_TESTS "\"${CTestName}\"")
|
||||
PROPERTY ParseAndAddCatchTests_TESTS "${CTestName}")
|
||||
set_property(
|
||||
SOURCE ${SourceFile}
|
||||
APPEND
|
||||
PROPERTY ParseAndAddCatchTests_TESTS "\"${CTestName}\"")
|
||||
PROPERTY ParseAndAddCatchTests_TESTS "${CTestName}")
|
||||
endif()
|
||||
|
||||
|
||||
@ -215,6 +241,7 @@ endfunction()
|
||||
|
||||
# entry point
|
||||
function(ParseAndAddCatchTests TestTarget)
|
||||
message(DEPRECATION "ParseAndAddCatchTest: function deprecated because of possibility of missed test cases. Consider using 'catch_discover_tests' from 'Catch.cmake'")
|
||||
ParseAndAddCatchTests_PrintDebugMessage("Started parsing ${TestTarget}")
|
||||
get_target_property(SourceFiles ${TestTarget} SOURCES)
|
||||
ParseAndAddCatchTests_PrintDebugMessage("Found the following sources: ${SourceFiles}")
|
||||
|
@ -36,6 +36,21 @@ add_subdirectory(lib/Catch2)
|
||||
target_link_libraries(tests Catch2::Catch2)
|
||||
```
|
||||
|
||||
Another possibility is to use [FetchContent](https://cmake.org/cmake/help/latest/module/FetchContent.html):
|
||||
```cmake
|
||||
Include(FetchContent)
|
||||
|
||||
FetchContent_Declare(
|
||||
Catch2
|
||||
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
||||
GIT_TAG v2.13.9 # or a later release
|
||||
)
|
||||
|
||||
FetchContent_MakeAvailable(Catch2)
|
||||
|
||||
target_link_libraries(tests Catch2::Catch2)
|
||||
```
|
||||
|
||||
## Automatic test registration
|
||||
|
||||
Catch2's repository also contains two CMake scripts that help users
|
||||
@ -43,7 +58,7 @@ with automatically registering their `TEST_CASE`s with CTest. They
|
||||
can be found in the `contrib` folder, and are
|
||||
|
||||
1) `Catch.cmake` (and its dependency `CatchAddTests.cmake`)
|
||||
2) `ParseAndAddCatchTests.cmake`
|
||||
2) `ParseAndAddCatchTests.cmake` (deprecated)
|
||||
|
||||
If Catch2 has been installed in system, both of these can be used after
|
||||
doing `find_package(Catch2 REQUIRED)`. Otherwise you need to add them
|
||||
@ -83,6 +98,10 @@ catch_discover_tests(target
|
||||
[TEST_SUFFIX suffix]
|
||||
[PROPERTIES name1 value1...]
|
||||
[TEST_LIST var]
|
||||
[REPORTER reporter]
|
||||
[OUTPUT_DIR dir]
|
||||
[OUTPUT_PREFIX prefix]
|
||||
[OUTPUT_SUFFIX suffix]
|
||||
)
|
||||
```
|
||||
|
||||
@ -129,13 +148,46 @@ default `<target>_TESTS`. This can be useful when the same test
|
||||
executable is being used in multiple calls to `catch_discover_tests()`.
|
||||
Note that this variable is only available in CTest.
|
||||
|
||||
* `REPORTER reporter`
|
||||
|
||||
Use the specified reporter when running the test case. The reporter will
|
||||
be passed to the test runner as `--reporter reporter`.
|
||||
|
||||
* `OUTPUT_DIR dir`
|
||||
|
||||
If specified, the parameter is passed along as
|
||||
`--out dir/<test_name>` to test executable. The actual file name is the
|
||||
same as the test name. This should be used instead of
|
||||
`EXTRA_ARGS --out foo` to avoid race conditions writing the result output
|
||||
when using parallel test execution.
|
||||
|
||||
* `OUTPUT_PREFIX prefix`
|
||||
|
||||
May be used in conjunction with `OUTPUT_DIR`.
|
||||
If specified, `prefix` is added to each output file name, like so
|
||||
`--out dir/prefix<test_name>`.
|
||||
|
||||
* `OUTPUT_SUFFIX suffix`
|
||||
|
||||
May be used in conjunction with `OUTPUT_DIR`.
|
||||
If specified, `suffix` is added to each output file name, like so
|
||||
`--out dir/<test_name>suffix`. This can be used to add a file extension to
|
||||
the output file name e.g. ".xml".
|
||||
|
||||
|
||||
### `ParseAndAddCatchTests.cmake`
|
||||
|
||||
⚠ This script is [deprecated](https://github.com/catchorg/Catch2/pull/2120)
|
||||
in Catch 2.13.4 and superseded by the above approach using `catch_discover_tests`.
|
||||
See [#2092](https://github.com/catchorg/Catch2/issues/2092) for details.
|
||||
|
||||
`ParseAndAddCatchTests` works by parsing all implementation files
|
||||
associated with the provided target, and registering them via CTest's
|
||||
`add_test`. This approach has some limitations, such as the fact that
|
||||
commented-out tests will be registered anyway.
|
||||
commented-out tests will be registered anyway. More serious, only a
|
||||
subset of the assertion macros currently available in Catch can be
|
||||
detected by this script and tests with any macros that cannot be
|
||||
parsed are *silently ignored*.
|
||||
|
||||
|
||||
#### Usage
|
||||
|
@ -222,6 +222,16 @@ available warnings
|
||||
|
||||
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.
|
||||
|
||||
<pre>-D, --min-duration <value></pre>
|
||||
|
||||
> `--min-duration` was [introduced](https://github.com/catchorg/Catch2/pull/1910) in Catch 2.13.0
|
||||
|
||||
When set, Catch will report the duration of each test case that took more
|
||||
than <value> seconds, in milliseconds. This option is overriden by both
|
||||
`-d yes` and `-d no`, so that either all durations are reported, or none
|
||||
are.
|
||||
|
||||
|
||||
<a id="input-file"></a>
|
||||
## Load test names to run from a file
|
||||
<pre>-f, --input-file <filename></pre>
|
||||
|
@ -1,100 +1,134 @@
|
||||
<a id="top"></a>
|
||||
# Contributing to Catch
|
||||
# Contributing to Catch2
|
||||
|
||||
**Contents**<br>
|
||||
[Branches](#branches)<br>
|
||||
[Directory structure](#directory-structure)<br>
|
||||
[Using Git(Hub)](#using-github)<br>
|
||||
[Testing your changes](#testing-your-changes)<br>
|
||||
[Documenting your code](#documenting-your-code)<br>
|
||||
[Code constructs to watch out for](#code-constructs-to-watch-out-for)<br>
|
||||
[Writing documentation](#writing-documentation)<br>
|
||||
[Writing code](#writing-code)<br>
|
||||
[CoC](#coc)<br>
|
||||
|
||||
So you want to contribute something to Catch? That's great! Whether it's a bug fix, a new feature, support for
|
||||
additional compilers - or just a fix to the documentation - all contributions are very welcome and very much appreciated.
|
||||
Of course so are bug reports and other comments and questions.
|
||||
So you want to contribute something to Catch2? That's great! Whether it's
|
||||
a bug fix, a new feature, support for additional compilers - or just
|
||||
a fix to the documentation - all contributions are very welcome and very
|
||||
much appreciated. Of course so are bug reports, other comments, and
|
||||
questions, but generally it is a better idea to ask questions in our
|
||||
[Discord](https://discord.gg/4CWS9zD), than in the issue tracker.
|
||||
|
||||
If you are contributing to the code base there are a few simple guidelines to keep in mind. This also includes notes to
|
||||
help you find your way around. As this is liable to drift out of date please raise an issue or, better still, a pull
|
||||
request for this file, if you notice that.
|
||||
|
||||
## Branches
|
||||
This page covers some guidelines and helpful tips for contributing
|
||||
to the codebase itself.
|
||||
|
||||
Ongoing development is currently on _master_. At some point an integration branch will be set-up and PRs should target
|
||||
that - but for now it's all against master. You may see feature branches come and go from time to time, too.
|
||||
## Using Git(Hub)
|
||||
|
||||
## Directory structure
|
||||
Ongoing development happens in the `v2.x` branch for Catch2 v2, and in
|
||||
`devel` for the next major version, v3.
|
||||
|
||||
_Users_ of Catch primarily use the single header version. _Maintainers_ should work with the full source (which is still,
|
||||
primarily, in headers). This can be found in the `include` folder. There are a set of test files, currently under
|
||||
`projects/SelfTest`. The test app can be built via CMake from the `CMakeLists.txt` file in the root, or you can generate
|
||||
project files for Visual Studio, XCode, and others (instructions in the `projects` folder). If you have access to CLion,
|
||||
it can work with the CMake file directly.
|
||||
Commits should be small and atomic. A commit is atomic when, after it is
|
||||
applied, the codebase, tests and all, still works as expected. Small
|
||||
commits are also preferred, as they make later operations with git history,
|
||||
whether it is bisecting, reverting, or something else, easier.
|
||||
|
||||
As well as the runtime test files you'll also see a `SurrogateCpps` directory under `projects/SelfTest`.
|
||||
This contains a set of .cpp files that each `#include` a single header.
|
||||
While these files are not essential to compilation they help to keep the implementation headers self-contained.
|
||||
At time of writing this set is not complete but has reasonable coverage.
|
||||
If you add additional headers please try to remember to add a surrogate cpp for it.
|
||||
_When submitting a pull request please do not include changes to the
|
||||
single include. This means do not include them in your git commits!_
|
||||
|
||||
The other directories are `scripts` which contains a set of python scripts to help in testing Catch as well as
|
||||
generating the single include, and `docs`, which contains the documentation as a set of markdown files.
|
||||
|
||||
__When submitting a pull request please do not include changes to the single include, or to the version number file
|
||||
as these are managed by the scripts!__
|
||||
When addressing review comments in a MR, please do not rebase/squash the
|
||||
commits immediately. Doing so makes it harder to review the new changes,
|
||||
slowing down the process of merging a MR. Instead, when addressing review
|
||||
comments, you should append new commits to the branch and only squash
|
||||
them into other commits when the MR is ready to be merged. We recommend
|
||||
creating new commits with `git commit --fixup` (or `--squash`) and then
|
||||
later squashing them with `git rebase --autosquash` to make things easier.
|
||||
|
||||
|
||||
|
||||
## Testing your changes
|
||||
|
||||
Obviously all changes to Catch's code should be tested. If you added new
|
||||
functionality, you should add tests covering and showcasing it. Even if you have
|
||||
only made changes to Catch internals (i.e. you implemented some performance
|
||||
improvements), you should still test your changes.
|
||||
_Note: Running Catch2's tests requires Python3_
|
||||
|
||||
This means 2 things
|
||||
|
||||
* Compiling Catch's SelfTest project:
|
||||
Catch2 has multiple layers of tests that are then run as part of our CI.
|
||||
The most obvious one are the unit tests compiled into the `SelfTest`
|
||||
binary. These are then used in "Approval tests", which run (almost) all
|
||||
tests from `SelfTest` through a specific reporter and then compare the
|
||||
generated output with a known good output ("Baseline"). By default, new
|
||||
tests should be placed here.
|
||||
|
||||
However, not all tests can be written as plain unit tests. For example,
|
||||
checking that Catch2 orders tests randomly when asked to, and that this
|
||||
random ordering is subset-invariant, is better done as an integration
|
||||
test using an external check script. Catch2 integration tests are written
|
||||
using CTest, either as a direct command invocation + pass/fail regex,
|
||||
or by delegating the check to a Python script.
|
||||
|
||||
There are also two more kinds of tests, examples and "ExtraTests".
|
||||
Examples serve as a compilation test on the single-header distribution,
|
||||
and present a small and self-contained snippets of using Catch2 for
|
||||
writing tests. ExtraTests then are tests that either take a long time
|
||||
to run, or require separate compilation, e.g. because of testing compile
|
||||
time configuration options, and take a long time because of that.
|
||||
|
||||
Both of these are compiled against the single-header distribution of
|
||||
Catch2, and thus might require you to regenerate it manually. This is
|
||||
done by calling the `generateSingleHeader.py` script in `scripts`.
|
||||
|
||||
Examples and ExtraTests are not compiled by default. To compile them,
|
||||
add `-DCATCH_BUILD_EXAMPLES=ON` and `-DCATCH_BUILD_EXTRA_TESTS=ON` to
|
||||
the invocation of CMake configuration step.
|
||||
|
||||
Bringing this all together, the steps below should configure, build,
|
||||
and run all tests in the `Debug` compilation.
|
||||
|
||||
1. Regenerate the single header distribution
|
||||
```
|
||||
$ cd Catch2
|
||||
$ cmake -Bdebug-build -H. -DCMAKE_BUILD_TYPE=Debug
|
||||
$ ./scripts/generateSingleHeader.py
|
||||
```
|
||||
2. Configure the full test build
|
||||
```
|
||||
$ cmake -Bdebug-build -H. -DCMAKE_BUILD_TYPE=Debug -DCATCH_BUILD_EXAMPLES=ON -DCATCH_BUILD_EXTRA_TESTS=ON
|
||||
```
|
||||
3. Run the actual build
|
||||
```
|
||||
$ cmake --build debug-build
|
||||
```
|
||||
because code that does not compile is evidently incorrect. Obviously,
|
||||
you are not expected to have access to all the compilers and platforms
|
||||
supported by Catch2, but you should at least smoke test your changes
|
||||
on your platform. Our CI pipeline will check your PR against most of
|
||||
the supported platforms, but it takes an hour to finish -- compiling
|
||||
locally takes just a few minutes.
|
||||
|
||||
|
||||
* Running the tests via CTest:
|
||||
4. Run the tests using CTest
|
||||
```
|
||||
$ cd debug-build
|
||||
$ ctest -j 2 --output-on-failure
|
||||
$ ctest -j 4 --output-on-failure -C Debug
|
||||
```
|
||||
__Note:__ When running your tests with multi-configuration generators like
|
||||
Visual Studio, you might get errors "Test not available without configuration."
|
||||
You then have to pick one configuration (e.g. ` -C Debug`) in the `ctest` call.
|
||||
|
||||
If you added new tests, approval tests are very likely to fail. If they
|
||||
do not, it means that your changes weren't run as part of them. This
|
||||
_might_ be intentional, but usually is not.
|
||||
|
||||
The approval tests compare current output of the SelfTest binary in various
|
||||
configurations against known good outputs. The reason it fails is,
|
||||
_usually_, that you've added new tests but have not yet approved the changes
|
||||
they introduce. This is done with the `scripts/approve.py` script, but
|
||||
before you do so, you need to check that the introduced changes are indeed
|
||||
intentional.
|
||||
|
||||
|
||||
## Documenting your code
|
||||
## Writing documentation
|
||||
|
||||
If you have added new feature to Catch2, it needs documentation, so that
|
||||
other people can use it as well. This section collects some technical
|
||||
information that you will need for updating Catch2's documentation, and
|
||||
possibly some generic advise as well.
|
||||
|
||||
### Technicalities
|
||||
|
||||
First, the technicalities:
|
||||
|
||||
* If you have introduced a new document, there is a simple template you
|
||||
should use. It provides you with the top anchor mentioned to link to
|
||||
(more below), and also with a backlink to the top of the documentation:
|
||||
```markdown
|
||||
<a id="top"></a>
|
||||
# Cool feature
|
||||
|
||||
Text that explains how to use the cool feature.
|
||||
|
||||
|
||||
---
|
||||
|
||||
[Home](Readme.md#top)
|
||||
```
|
||||
|
||||
* Crosslinks to different pages should target the `top` anchor, like this
|
||||
`[link to contributing](contributing.md#top)`.
|
||||
|
||||
* We introduced version tags to the documentation, which show users in
|
||||
which version a specific feature was introduced. This means that newly
|
||||
written documentation should be tagged with a placeholder, that will
|
||||
@ -106,23 +140,8 @@ tags for other features).
|
||||
placeholder is usually used after a section heading
|
||||
* `> X (Y and Z) was [introduced](link-to-issue-or-PR) in Catch X.Y.Z`
|
||||
- this placeholder is used when you need to tag a subpart of something,
|
||||
e.g. list
|
||||
* Crosslinks to different pages should target the `top` anchor, like this
|
||||
`[link to contributing](contributing.md#top)`.
|
||||
* If you have introduced a new document, there is a simple template you
|
||||
should use. It provides you with the top anchor mentioned above, and also
|
||||
with a backlink to the top of the documentation:
|
||||
```markdown
|
||||
<a id="top"></a>
|
||||
# Cool feature
|
||||
e.g. a list
|
||||
|
||||
Text that explains how to use the cool feature.
|
||||
|
||||
|
||||
---
|
||||
|
||||
[Home](Readme.md#top)
|
||||
```
|
||||
* For pages with more than 4 subheadings, we provide a table of contents
|
||||
(ToC) at the top of the page. Because GitHub markdown does not support
|
||||
automatic generation of ToC, it has to be handled semi-manually. Thus,
|
||||
@ -130,21 +149,54 @@ if you've added a new subheading to some page, you should add it to the
|
||||
ToC. This can be done either manually, or by running the
|
||||
`updateDocumentToC.py` script in the `scripts/` folder.
|
||||
|
||||
### Contents
|
||||
|
||||
Now, for the generic tips:
|
||||
* Usage examples are good
|
||||
* Don't be afraid to introduce new pages
|
||||
* Try to be reasonably consistent with the surrounding documentation
|
||||
Now, for some content tips:
|
||||
|
||||
* Usage examples are good. However, having large code snippets inline
|
||||
can make the documentation less readable, and so the inline snippets
|
||||
should be kept reasonably short. To provide more complex compilable
|
||||
examples, consider adding new .cpp file to `examples/`.
|
||||
|
||||
* Don't be afraid to introduce new pages. The current documentation
|
||||
tends towards long pages, but a lot of that is caused by legacy, and
|
||||
we know that some of the pages are overly big and unfocused.
|
||||
|
||||
* When adding information to an existing page, please try to keep your
|
||||
formatting, style and changes consistent with the rest of the page.
|
||||
|
||||
* Any documentation has multiple different audiences, that desire
|
||||
different information from the text. The 3 basic user-types to try and
|
||||
cover are:
|
||||
* A beginner to Catch2, who requires closer guidance for the usage of Catch2.
|
||||
* Advanced user of Catch2, who want to customize their usage.
|
||||
* Experts, looking for full reference of Catch2's capabilities.
|
||||
|
||||
|
||||
## Writing code
|
||||
|
||||
If want to contribute code, this section contains some simple rules
|
||||
and tips on things like code formatting, code constructions to avoid,
|
||||
and so on.
|
||||
|
||||
|
||||
## Code constructs to watch out for
|
||||
### Formatting
|
||||
|
||||
To make code formatting simpler for the contributors, Catch2 provides
|
||||
its own config for `clang-format`. However, because it is currently
|
||||
impossible to replicate existing Catch2's formatting in clang-format,
|
||||
using it to reformat a whole file would cause massive diffs. To keep
|
||||
the size of your diffs reasonable, you should only use clang-format
|
||||
on the newly changed code.
|
||||
|
||||
|
||||
### Code constructs to watch out for
|
||||
|
||||
This section is a (sadly incomplete) listing of various constructs that
|
||||
are problematic and are not always caught by our CI infrastructure.
|
||||
|
||||
### Naked exceptions and exceptions-related function
|
||||
|
||||
#### Naked exceptions and exceptions-related function
|
||||
|
||||
If you are throwing an exception, it should be done via `CATCH_ERROR`
|
||||
or `CATCH_RUNTIME_ERROR` in `catch_enforce.h`. These macros will handle
|
||||
@ -155,7 +207,8 @@ CI, but luckily there should not be too many reasons to use these.
|
||||
However, if you do, they should be kept behind a
|
||||
`CATCH_CONFIG_DISABLE_EXCEPTIONS` macro.
|
||||
|
||||
### Unqualified usage of functions from C's stdlib
|
||||
|
||||
#### Unqualified usage of functions from C's stdlib
|
||||
|
||||
If you are using a function from C's stdlib, please include the header
|
||||
as `<cfoo>` and call the function qualified. The common knowledge that
|
||||
@ -163,7 +216,12 @@ there is no difference is wrong, QNX and VxWorks won't compile if you
|
||||
include the header as `<cfoo>` and call the function unqualified.
|
||||
|
||||
|
||||
----
|
||||
## CoC
|
||||
|
||||
This project has a [CoC](../CODE_OF_CONDUCT.md). Please adhere to it
|
||||
while contributing to Catch2.
|
||||
|
||||
-----------
|
||||
|
||||
_This documentation will always be in-progress as new information comes
|
||||
up, but we are trying to keep it as up to date as possible._
|
||||
|
@ -72,6 +72,13 @@ Instead you will have to write this:
|
||||
REQUIRE_THAT(foo(), m1 || m2 || m3);
|
||||
```
|
||||
|
||||
### `ParseAndAddCatchTests.cmake`
|
||||
|
||||
The CMake/CTest integration using `ParseAndAddCatchTests.cmake` is deprecated,
|
||||
as it can be replaced by `Catch.cmake` that provides the function
|
||||
`catch_discover_tests` to get tests directly from a CMake target via the
|
||||
command line interface instead of parsing C++ code with regular expressions.
|
||||
|
||||
|
||||
## Planned changes
|
||||
|
||||
|
@ -12,23 +12,88 @@ are run once per each value in a generator.
|
||||
This is best explained with an example:
|
||||
```cpp
|
||||
TEST_CASE("Generators") {
|
||||
auto i = GENERATE(1, 2, 3);
|
||||
SECTION("one") {
|
||||
auto j = GENERATE( -3, -2, -1 );
|
||||
REQUIRE(j < i);
|
||||
}
|
||||
auto i = GENERATE(1, 3, 5);
|
||||
REQUIRE(is_odd(i));
|
||||
}
|
||||
```
|
||||
|
||||
The assertion in this test case will be run 9 times, because there
|
||||
are 3 possible values for `i` (1, 2, and 3) and there are 3 possible
|
||||
values for `j` (-3, -2, and -1).
|
||||
The "Generators" `TEST_CASE` will be entered 3 times, and the value of
|
||||
`i` will be 1, 3, and 5 in turn. `GENERATE`s can also be used multiple
|
||||
times at the same scope, in which case the result will be a cartesian
|
||||
product of all elements in the generators. This means that in the snippet
|
||||
below, the test case will be run 6 (2\*3) times.
|
||||
|
||||
```cpp
|
||||
TEST_CASE("Generators") {
|
||||
auto i = GENERATE(1, 2);
|
||||
auto j = GENERATE(3, 4, 5);
|
||||
}
|
||||
```
|
||||
|
||||
There are 2 parts to generators in Catch2, the `GENERATE` macro together
|
||||
with the already provided generators, and the `IGenerator<T>` interface
|
||||
that allows users to implement their own generators.
|
||||
|
||||
|
||||
## Combining `GENERATE` and `SECTION`.
|
||||
|
||||
`GENERATE` can be seen as an implicit `SECTION`, that goes from the place
|
||||
`GENERATE` is used, to the end of the scope. This can be used for various
|
||||
effects. The simplest usage is shown below, where the `SECTION` "one"
|
||||
runs 4 (2\*2) times, and `SECTION` "two" is run 6 times (2\*3).
|
||||
|
||||
```cpp
|
||||
TEST_CASE("Generators") {
|
||||
auto i = GENERATE(1, 2);
|
||||
SECTION("one") {
|
||||
auto j = GENERATE(-3, -2);
|
||||
REQUIRE(j < i);
|
||||
}
|
||||
SECTION("two") {
|
||||
auto k = GENERATE(4, 5, 6);
|
||||
REQUIRE(i != k);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The specific order of the `SECTION`s will be "one", "one", "two", "two",
|
||||
"two", "one"...
|
||||
|
||||
|
||||
The fact that `GENERATE` introduces a virtual `SECTION` can also be used
|
||||
to make a generator replay only some `SECTION`s, without having to
|
||||
explicitly add a `SECTION`. As an example, the code below reports 3
|
||||
assertions, because the "first" section is run once, but the "second"
|
||||
section is run twice.
|
||||
|
||||
```cpp
|
||||
TEST_CASE("GENERATE between SECTIONs") {
|
||||
SECTION("first") { REQUIRE(true); }
|
||||
auto _ = GENERATE(1, 2);
|
||||
SECTION("second") { REQUIRE(true); }
|
||||
}
|
||||
```
|
||||
|
||||
This can lead to surprisingly complex test flows. As an example, the test
|
||||
below will report 14 assertions:
|
||||
|
||||
```cpp
|
||||
TEST_CASE("Complex mix of sections and generates") {
|
||||
auto i = GENERATE(1, 2);
|
||||
SECTION("A") {
|
||||
SUCCEED("A");
|
||||
}
|
||||
auto j = GENERATE(3, 4);
|
||||
SECTION("B") {
|
||||
SUCCEED("B");
|
||||
}
|
||||
auto k = GENERATE(5, 6);
|
||||
SUCCEED();
|
||||
}
|
||||
```
|
||||
|
||||
> The ability to place `GENERATE` between two `SECTION`s was [introduced](https://github.com/catchorg/Catch2/issues/1938) in Catch 2.13.0.
|
||||
|
||||
## Provided generators
|
||||
|
||||
Catch2's provided generator functionality consists of three parts,
|
||||
|
@ -104,6 +104,20 @@ Both of these solutions have their problems, but should let you wring parallelis
|
||||
## 3rd party bugs
|
||||
This section outlines known bugs in 3rd party components (this means compilers, standard libraries, standard runtimes).
|
||||
|
||||
### Visual Studio 2015 -- `GENERATE` does not compile if it would deduce char array
|
||||
|
||||
VS 2015 refuses to compile `GENERATE` statements that would deduce to a
|
||||
char array with known size, e.g. this:
|
||||
```cpp
|
||||
TEST_CASE("Deducing string lit") {
|
||||
auto param = GENERATE("start", "stop");
|
||||
}
|
||||
```
|
||||
|
||||
A workaround for this is to use the `as` helper and force deduction of
|
||||
either a `char const*` or a `std::string`.
|
||||
|
||||
|
||||
### Visual Studio 2017 -- raw string literal in assert fails to compile
|
||||
There is a known bug in Visual Studio 2017 (VC 15), that causes compilation error when preprocessor attempts to stringize a raw string literal (`#` preprocessor is applied to it). This snippet is sufficient to trigger the compilation error:
|
||||
```cpp
|
||||
|
@ -16,6 +16,7 @@
|
||||
- Configuration: [Provide your own output streams](../examples/231-Cfg-OutputStreams.cpp)
|
||||
- Generators: [Create your own generator](../examples/300-Gen-OwnGenerator.cpp)
|
||||
- Generators: [Use map to convert types in GENERATE expression](../examples/301-Gen-MapTypeConversion.cpp)
|
||||
- Generators: [Run test with a table of input values](../examples/302-Gen-Table.cpp)
|
||||
- Generators: [Use variables in generator expressions](../examples/310-Gen-VariablesInGenerators.cpp)
|
||||
- Generators: [Use custom variable capture in generator expressions](../examples/311-Gen-CustomCapture.cpp)
|
||||
|
||||
|
@ -94,6 +94,9 @@ A thread-safe header-only mocking framework for C++14.
|
||||
|
||||
## Applications & Tools
|
||||
|
||||
### [App Mesh](https://github.com/laoshanxi/app-mesh)
|
||||
A high available cloud native micro-service application management platform implemented by modern C++.
|
||||
|
||||
### [ArangoDB](https://github.com/arangodb/arangodb)
|
||||
ArangoDB is a native multi-model database with flexible data models for documents, graphs, and key-values.
|
||||
|
||||
|
@ -121,7 +121,7 @@ constructor, or before Catch2's session is created in user's own main._
|
||||
|
||||
`ANON_TEST_CASE` is a `TEST_CASE` replacement that will autogenerate
|
||||
unique name. The advantage of this is that you do not have to think
|
||||
of a name for the test case,`the disadvantage is that the name doesn't
|
||||
of a name for the test case, the disadvantage is that the name doesn't
|
||||
necessarily remain stable across different links, and thus it might be
|
||||
hard to run directly.
|
||||
|
||||
|
@ -11,9 +11,9 @@ The easiest way to use Catch is to let it supply ```main()``` for you and handle
|
||||
|
||||
This is achieved by writing ```#define CATCH_CONFIG_MAIN``` before the ```#include "catch.hpp"``` in *exactly one* source file.
|
||||
|
||||
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.
|
||||
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:
|
||||
|
||||
You now have a lot of flexibility - but here are three recipes to get your started:
|
||||
**Important note: you can only provide `main` in the same file you defined `CATCH_CONFIG_RUNNER`.**
|
||||
|
||||
## Let Catch take full control of args and config
|
||||
|
||||
|
@ -2,6 +2,21 @@
|
||||
|
||||
# Release notes
|
||||
**Contents**<br>
|
||||
[2.13.10](#21310)<br>
|
||||
[2.13.9](#2139)<br>
|
||||
[2.13.8](#2138)<br>
|
||||
[2.13.7](#2137)<br>
|
||||
[2.13.6](#2136)<br>
|
||||
[2.13.5](#2135)<br>
|
||||
[2.13.4](#2134)<br>
|
||||
[2.13.3](#2133)<br>
|
||||
[2.13.2](#2132)<br>
|
||||
[2.13.1](#2131)<br>
|
||||
[2.13.0](#2130)<br>
|
||||
[2.12.4](#2124)<br>
|
||||
[2.12.3](#2123)<br>
|
||||
[2.12.2](#2122)<br>
|
||||
[2.12.1](#2121)<br>
|
||||
[2.12.0](#2120)<br>
|
||||
[2.11.3](#2113)<br>
|
||||
[2.11.2](#2112)<br>
|
||||
@ -35,6 +50,194 @@
|
||||
[Older versions](#older-versions)<br>
|
||||
[Even Older versions](#even-older-versions)<br>
|
||||
|
||||
|
||||
## 2.13.10
|
||||
|
||||
### Fixes
|
||||
* Fixed issue with `catch_discover_tests` when there is multiple of 256 tests (#2401, #2503)
|
||||
* Catch2-provided `main` and `wmain` are explicitly marked as `__cdecl` when compiled with MSVC (#2486, #2487)
|
||||
* Improved break-into-debugger behaviour for ARM Macs. It should now be possible to step execution after the break (#2422)
|
||||
* Replaced deprecated `std::aligned_storage` (#2419, #2420)
|
||||
|
||||
|
||||
## 2.13.9
|
||||
|
||||
### Fixes
|
||||
* Fixed issue with `-#` (filename-as-tag) flag when `__FILE__` expands into filename without directories (#2328, #2393)
|
||||
* Fixed `CAPTURE` macro not being variadic when disabled through `CATCH_CONFIG_DISABLE` (#2316, #2378)
|
||||
|
||||
|
||||
## 2.13.8
|
||||
|
||||
### Fixes
|
||||
* Made `Approx::operator()` const (#2288)
|
||||
* Improved pkg-config files (#2284)
|
||||
* Fixed warning suppression leaking out of Catch2 when compiled with clang.exe (#2280)
|
||||
* The macro-generated names for things like `TEST_CASE` no longer create reserved identifiers (#2336)
|
||||
|
||||
### Improvements
|
||||
* Clang-tidy should no longer warn about missing virtual dispatch in `FilterGenerator`'s constructor (#2314)
|
||||
|
||||
|
||||
## 2.13.7
|
||||
|
||||
### Fixes
|
||||
* Added missing `<iterator>` include in benchmarking. (#2231)
|
||||
* Fixed noexcept build with benchmarking enabled (#2235)
|
||||
* Fixed build for compilers with C++17 support but without C++17 library support (#2195)
|
||||
* JUnit only uses 3 decimal places when reporting durations (#2221)
|
||||
* `!mayfail` tagged tests are now marked as `skipped` in JUnit reporter output (#2116)
|
||||
|
||||
|
||||
## 2.13.6
|
||||
|
||||
### Fixes
|
||||
* Disabling all signal handlers no longer breaks compilation (#2212, #2213)
|
||||
|
||||
### Miscellaneous
|
||||
* `catch_discover_tests` should handle escaped semicolon (`;`) better (#2214, #2215)
|
||||
|
||||
|
||||
## 2.13.5
|
||||
|
||||
### Improvements
|
||||
* Detection of MAC and IPHONE platforms has been improved (#2140, #2157)
|
||||
* Added workaround for bug in XLC 16.1.0.1 (#2155)
|
||||
* Add detection for LCC when it is masquerading as GCC (#2199)
|
||||
* Modified posix signal handling so it supports newer libcs (#2178)
|
||||
* `MINSIGSTKSZ` was no longer usable in constexpr context.
|
||||
|
||||
### Fixes
|
||||
* Fixed compilation of benchmarking when `min` and `max` macros are defined (#2159)
|
||||
* Including `windows.h` without `NOMINMAX` remains a really bad idea, don't do it
|
||||
|
||||
### Miscellaneous
|
||||
* `Catch2WithMain` target (static library) is no longer built by default (#2142)
|
||||
* Building it by default was at best unnecessary overhead for people not using it, and at worst it caused trouble with install paths
|
||||
* To have it built, set CMake option `CATCH_BUILD_STATIC_LIBRARY` to `ON`
|
||||
* The check whether Catch2 is being built as a subproject is now more reliable (#2202, #2204)
|
||||
* 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.
|
||||
|
||||
|
||||
## 2.13.4
|
||||
|
||||
### Improvements
|
||||
* Improved the hashing algorithm used for shuffling test cases (#2070)
|
||||
* `TEST_CASE`s that differ only in the last character should be properly shuffled
|
||||
* 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.
|
||||
|
||||
### Miscellaneous
|
||||
* Deprecated `ParseAndAddCatchTests` CMake integration (#2092)
|
||||
* It is impossible to implement it properly for all the different test case variants Catch2 provides, and there are better options provided.
|
||||
* Use `catch_discover_tests` instead, which uses runtime information about available tests.
|
||||
* Fixed bug in `catch_discover_tests` that would cause it to fail when used in specific project structures (#2119)
|
||||
* Added Bazel build file
|
||||
* Added an experimental static library target to CMake
|
||||
|
||||
|
||||
## 2.13.3
|
||||
|
||||
### Fixes
|
||||
* Fixed possible infinite loop when combining generators with section filter (`-c` option) (#2025)
|
||||
|
||||
### Miscellaneous
|
||||
* Fixed `ParseAndAddCatchTests` not finding `TEST_CASE`s without tags (#2055, #2056)
|
||||
* `ParseAndAddCatchTests` supports `CMP0110` policy for changing behaviour of `add_test` (#2057)
|
||||
* This was the shortlived change in CMake 3.18.0 that temporarily broke `ParseAndAddCatchTests`
|
||||
|
||||
|
||||
## 2.13.2
|
||||
|
||||
### Improvements
|
||||
* Implemented workaround for AppleClang shadowing bug (#2030)
|
||||
* Implemented workaround for NVCC ICE (#2005, #2027)
|
||||
|
||||
### Fixes
|
||||
* Fixed detection of `std::uncaught_exceptions` support under non-msvc platforms (#2021)
|
||||
* Fixed the experimental stdout/stderr capture under Windows (#2013)
|
||||
|
||||
### Miscellaneous
|
||||
* `catch_discover_tests` has been improved significantly (#2023, #2039)
|
||||
* You can now specify which reporter should be used
|
||||
* You can now modify where the output will be written
|
||||
* `WORKING_DIRECTORY` setting is respected
|
||||
* `ParseAndAddCatchTests` now supports `TEMPLATE_TEST_CASE` macros (#2031)
|
||||
* Various documentation fixes and improvements (#2022, #2028, #2034)
|
||||
|
||||
|
||||
## 2.13.1
|
||||
|
||||
### Improvements
|
||||
* `ParseAndAddCatchTests` handles CMake v3.18.0 correctly (#1984)
|
||||
* Improved autodetection of `std::byte` (#1992)
|
||||
* Simplified implementation of templated test cases (#2007)
|
||||
* This should have a tiny positive effect on its compilation throughput
|
||||
|
||||
### Fixes
|
||||
* Automatic stringification of ranges handles sentinel ranges properly (#2004)
|
||||
|
||||
|
||||
## 2.13.0
|
||||
|
||||
### Improvements
|
||||
* `GENERATE` can now follow a `SECTION` at the same level of nesting (#1938)
|
||||
* The `SECTION`(s) before the `GENERATE` will not be run multiple times, the following ones will.
|
||||
* Added `-D`/`--min-duration` command line flag (#1910)
|
||||
* If a test takes longer to finish than the provided value, its name and duration will be printed.
|
||||
* This flag is overriden by setting `-d`/`--duration`.
|
||||
|
||||
### Fixes
|
||||
* `TAPReporter` no longer skips successful assertions (#1983)
|
||||
|
||||
|
||||
## 2.12.4
|
||||
|
||||
### Improvements
|
||||
* Added support for MacOS on ARM (#1971)
|
||||
|
||||
|
||||
## 2.12.3
|
||||
|
||||
### Fixes
|
||||
* `GENERATE` nested in a for loop no longer creates multiple generators (#1913)
|
||||
* Fixed copy paste error breaking `TEMPLATE_TEST_CASE_SIG` for 6 or more arguments (#1954)
|
||||
* Fixed potential UB when handling non-ASCII characters in CLI args (#1943)
|
||||
|
||||
### Improvements
|
||||
* There can be multiple calls to `GENERATE` on a single line
|
||||
* Improved `fno-except` support for platforms that do not provide shims for exception-related std functions (#1950)
|
||||
* E.g. the Green Hills C++ compiler
|
||||
* XmlReporter now also reports test-case-level statistics (#1958)
|
||||
* This is done via a new element, `OverallResultsCases`
|
||||
|
||||
### Miscellaneous
|
||||
* Added `.clang-format` file to the repo (#1182, #1920)
|
||||
* Rewrote contributing docs
|
||||
* They should explain the different levels of testing and so on much better
|
||||
|
||||
|
||||
## 2.12.2
|
||||
|
||||
### Fixes
|
||||
* Fixed compilation failure if `is_range` ADL found deleted function (#1929)
|
||||
* Fixed potential UB in `CAPTURE` if the expression contained non-ASCII characters (#1925)
|
||||
|
||||
### Improvements
|
||||
* `std::result_of` is not used if `std::invoke_result` is available (#1934)
|
||||
* JUnit reporter writes out `status` attribute for tests (#1899)
|
||||
* Suppresed clang-tidy's `hicpp-vararg` warning (#1921)
|
||||
* Catch2 was already suppressing the `cppcoreguidelines-pro-type-vararg` alias of the warning
|
||||
|
||||
|
||||
## 2.12.1
|
||||
|
||||
### Fixes
|
||||
* Vector matchers now support initializer list literals better
|
||||
|
||||
### Improvements
|
||||
* Added support for `^` (bitwise xor) to `CHECK` and `REQUIRE`
|
||||
|
||||
|
||||
## 2.12.0
|
||||
|
||||
### Improvements
|
||||
@ -566,7 +769,7 @@ than `single_include/catch.hpp`.**
|
||||
* CLR objects (`T^`) can now be stringified (#1216)
|
||||
* This affects code compiled as C++/CLI
|
||||
* Added `PredicateMatcher`, a matcher that takes an arbitrary predicate function (#1236)
|
||||
* See [documentation for details](https://github.com/catchorg/Catch2/blob/master/docs/matchers.md)
|
||||
* See [documentation for details](https://github.com/catchorg/Catch2/blob/v2.x/docs/matchers.md)
|
||||
|
||||
### Others
|
||||
* Modified CMake-installed pkg-config to allow `#include <catch.hpp>`(#1239)
|
||||
@ -594,7 +797,7 @@ than `single_include/catch.hpp`.**
|
||||
* Added an option to warn (+ exit with error) when no tests were ran (#1158)
|
||||
* Use as `-w NoTests`
|
||||
* Added provisional support for Emscripten (#1114)
|
||||
* [Added a way to override the fallback stringifier](https://github.com/catchorg/Catch2/blob/master/docs/configuration.md#fallback-stringifier) (#1024)
|
||||
* [Added a way to override the fallback stringifier](https://github.com/catchorg/Catch2/blob/v2.x/docs/configuration.md#fallback-stringifier) (#1024)
|
||||
* This allows project's own stringification machinery to be easily reused for Catch
|
||||
* `Catch::Session::run()` now accepts `char const * const *`, allowing it to accept array of string literals (#1031, #1178)
|
||||
* The embedded version of Clara was bumped to v1.1.3
|
||||
|
@ -5,6 +5,7 @@
|
||||
[Short answer](#short-answer)<br>
|
||||
[Long answer](#long-answer)<br>
|
||||
[Practical example](#practical-example)<br>
|
||||
[Using the static library Catch2WithMain](#using-the-static-library-catch2withmain)<br>
|
||||
[Other possible solutions](#other-possible-solutions)<br>
|
||||
|
||||
Several people have reported that test code written with Catch takes much longer to compile than they would expect. Why is that?
|
||||
@ -64,6 +65,39 @@ tests-factorial.cpp:11: failed: Factorial(0) == 1 for: 0 == 1
|
||||
Failed 1 test case, failed 1 assertion.
|
||||
```
|
||||
|
||||
|
||||
## Using the static library Catch2WithMain
|
||||
|
||||
Catch2 also provides a static library that implements the runner. Note
|
||||
that this support is experimental, due to interactions between Catch2 v2
|
||||
implementation and C++ linking limitations.
|
||||
|
||||
As with the `Catch2` target, the `Catch2WithMain` CMake target can be used
|
||||
either from a subdirectory, or from installed build.
|
||||
|
||||
|
||||
### CMake
|
||||
```cmake
|
||||
add_executable(tests-factorial tests-factorial.cpp)
|
||||
|
||||
target_link_libraries(tests-factorial Catch2::Catch2WithMain)
|
||||
```
|
||||
|
||||
### bazel
|
||||
```python
|
||||
cc_test(
|
||||
name = "hello_world_test",
|
||||
srcs = [
|
||||
"test/hello_world_test.cpp",
|
||||
],
|
||||
deps = [
|
||||
"lib_hello_world",
|
||||
"@catch2//:catch2_with_main",
|
||||
],
|
||||
)
|
||||
```
|
||||
|
||||
|
||||
## Other possible solutions
|
||||
You can also opt to sacrifice some features in order to speed-up Catch's compilation times. For details see the [documentation on Catch's compile-time configuration](configuration.md#other-toggles).
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
## Getting Catch2
|
||||
|
||||
The simplest way to get Catch2 is to download the latest [single header version](https://raw.githubusercontent.com/catchorg/Catch2/master/single_include/catch2/catch.hpp). The single header is generated by merging a set of individual headers but it is still just normal source code in a header file.
|
||||
The simplest way to get Catch2 is to download the latest [single header version](https://raw.githubusercontent.com/catchorg/Catch2/v2.x/single_include/catch2/catch.hpp). The single header is generated by merging a set of individual headers but it is still just normal source code in a header file.
|
||||
|
||||
Alternative ways of getting Catch2 include using your system package
|
||||
manager, or installing it using [its CMake package](cmake-integration.md#installing-catch2-from-git-repository).
|
||||
|
@ -1,7 +1,9 @@
|
||||
// 301-Gen-MapTypeConversion.cpp
|
||||
// Shows how to use map to modify generator's return type.
|
||||
|
||||
// TODO
|
||||
// Specifically we wrap a std::string returning generator with a generator
|
||||
// that converts the strings using stoi, so the returned type is actually
|
||||
// an int.
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
|
54
examples/302-Gen-Table.cpp
Normal file
54
examples/302-Gen-Table.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
// 302-Gen-Table.cpp
|
||||
// Shows how to use table to run a test many times with different inputs. Lifted from examples on
|
||||
// issue #850.
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
#include <string>
|
||||
|
||||
struct TestSubject {
|
||||
// this is the method we are going to test. It returns the length of the
|
||||
// input string.
|
||||
size_t GetLength( const std::string& input ) const { return input.size(); }
|
||||
};
|
||||
|
||||
|
||||
TEST_CASE("Table allows pre-computed test inputs and outputs", "[example][generator]") {
|
||||
using std::make_tuple;
|
||||
// do setup here as normal
|
||||
TestSubject subj;
|
||||
|
||||
SECTION("This section is run for each row in the table") {
|
||||
std::string test_input;
|
||||
size_t expected_output;
|
||||
std::tie( test_input, expected_output ) =
|
||||
GENERATE( table<std::string, size_t>(
|
||||
{ /* In this case one of the parameters to our test case is the
|
||||
* expected output, but this is not required. There could be
|
||||
* multiple expected values in the table, which can have any
|
||||
* (fixed) number of columns.
|
||||
*/
|
||||
make_tuple( "one", 3 ),
|
||||
make_tuple( "two", 3 ),
|
||||
make_tuple( "three", 5 ),
|
||||
make_tuple( "four", 4 ) } ) );
|
||||
|
||||
// run the test
|
||||
auto result = subj.GetLength(test_input);
|
||||
// capture the input data to go with the outputs.
|
||||
CAPTURE(test_input);
|
||||
// check it matches the pre-calculated data
|
||||
REQUIRE(result == expected_output);
|
||||
} // end section
|
||||
}
|
||||
|
||||
/* Possible simplifications where less legacy toolchain support is needed:
|
||||
*
|
||||
* - With libstdc++6 or newer, the make_tuple() calls can be omitted
|
||||
* (technically C++17 but does not require -std in GCC/Clang). See
|
||||
* https://stackoverflow.com/questions/12436586/tuple-vector-and-initializer-list
|
||||
*
|
||||
* - In C++17 mode std::tie() and the preceeding variable delcarations can be
|
||||
* replaced by structured bindings: auto [test_input, expected] = GENERATE(
|
||||
* table<std::string, size_t>({ ...
|
||||
*/
|
||||
// Compiling and running this file will result in 4 successful assertions
|
@ -23,11 +23,11 @@ TEST_CASE("Generate random doubles across different ranges",
|
||||
}));
|
||||
|
||||
auto r2(r1);
|
||||
|
||||
|
||||
// This will take r1 by reference and r2 by value.
|
||||
// Note that there are no advantages for doing so in this example,
|
||||
// it is done only for expository purposes.
|
||||
auto number = Catch::Generators::generate( CATCH_INTERNAL_LINEINFO,
|
||||
auto number = Catch::Generators::generate( "custom capture generator", CATCH_INTERNAL_LINEINFO,
|
||||
[&r1, r2]{
|
||||
using namespace Catch::Generators;
|
||||
return makeGenerators(take(50, random(std::get<0>(r1), std::get<1>(r2))));
|
||||
|
@ -46,6 +46,7 @@ set( SOURCES_IDIOMATIC_TESTS
|
||||
210-Evt-EventListeners.cpp
|
||||
300-Gen-OwnGenerator.cpp
|
||||
301-Gen-MapTypeConversion.cpp
|
||||
302-Gen-Table.cpp
|
||||
310-Gen-VariablesInGenerators.cpp
|
||||
311-Gen-CustomCapture.cpp
|
||||
)
|
||||
|
@ -10,8 +10,8 @@
|
||||
#define TWOBLUECUBES_CATCH_HPP_INCLUDED
|
||||
|
||||
#define CATCH_VERSION_MAJOR 2
|
||||
#define CATCH_VERSION_MINOR 12
|
||||
#define CATCH_VERSION_PATCH 0
|
||||
#define CATCH_VERSION_MINOR 13
|
||||
#define CATCH_VERSION_PATCH 10
|
||||
|
||||
#ifdef __clang__
|
||||
# pragma clang system_header
|
||||
@ -195,9 +195,9 @@
|
||||
|
||||
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
|
||||
#define CATCH_BENCHMARK(...) \
|
||||
INTERNAL_CATCH_BENCHMARK(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____B_E_N_C_H____), INTERNAL_CATCH_GET_1_ARG(__VA_ARGS__,,), INTERNAL_CATCH_GET_2_ARG(__VA_ARGS__,,))
|
||||
INTERNAL_CATCH_BENCHMARK(INTERNAL_CATCH_UNIQUE_NAME(C_A_T_C_H_B_E_N_C_H_), INTERNAL_CATCH_GET_1_ARG(__VA_ARGS__,,), INTERNAL_CATCH_GET_2_ARG(__VA_ARGS__,,))
|
||||
#define CATCH_BENCHMARK_ADVANCED(name) \
|
||||
INTERNAL_CATCH_BENCHMARK_ADVANCED(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____B_E_N_C_H____), name)
|
||||
INTERNAL_CATCH_BENCHMARK_ADVANCED(INTERNAL_CATCH_UNIQUE_NAME(C_A_T_C_H_B_E_N_C_H_), name)
|
||||
#endif // CATCH_CONFIG_ENABLE_BENCHMARKING
|
||||
|
||||
// If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required
|
||||
@ -301,9 +301,9 @@
|
||||
|
||||
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
|
||||
#define BENCHMARK(...) \
|
||||
INTERNAL_CATCH_BENCHMARK(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____B_E_N_C_H____), INTERNAL_CATCH_GET_1_ARG(__VA_ARGS__,,), INTERNAL_CATCH_GET_2_ARG(__VA_ARGS__,,))
|
||||
INTERNAL_CATCH_BENCHMARK(INTERNAL_CATCH_UNIQUE_NAME(C_A_T_C_H_B_E_N_C_H_), INTERNAL_CATCH_GET_1_ARG(__VA_ARGS__,,), INTERNAL_CATCH_GET_2_ARG(__VA_ARGS__,,))
|
||||
#define BENCHMARK_ADVANCED(name) \
|
||||
INTERNAL_CATCH_BENCHMARK_ADVANCED(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____B_E_N_C_H____), name)
|
||||
INTERNAL_CATCH_BENCHMARK_ADVANCED(INTERNAL_CATCH_UNIQUE_NAME(C_A_T_C_H_B_E_N_C_H_), name)
|
||||
#endif // CATCH_CONFIG_ENABLE_BENCHMARKING
|
||||
|
||||
using Catch::Detail::Approx;
|
||||
@ -350,8 +350,8 @@ using Catch::Detail::Approx;
|
||||
#define CATCH_WARN( msg ) (void)(0)
|
||||
#define CATCH_CAPTURE( msg ) (void)(0)
|
||||
|
||||
#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
|
||||
#define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
|
||||
#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ))
|
||||
#define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ))
|
||||
#define CATCH_METHOD_AS_TEST_CASE( method, ... )
|
||||
#define CATCH_REGISTER_TEST_CASE( Function, ... ) (void)(0)
|
||||
#define CATCH_SECTION( ... )
|
||||
@ -360,7 +360,7 @@ using Catch::Detail::Approx;
|
||||
#define CATCH_FAIL_CHECK( ... ) (void)(0)
|
||||
#define CATCH_SUCCEED( ... ) (void)(0)
|
||||
|
||||
#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
|
||||
#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ))
|
||||
|
||||
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__)
|
||||
@ -383,8 +383,8 @@ using Catch::Detail::Approx;
|
||||
#endif
|
||||
|
||||
// "BDD-style" convenience wrappers
|
||||
#define CATCH_SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
|
||||
#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), className )
|
||||
#define CATCH_SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ))
|
||||
#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ), className )
|
||||
#define CATCH_GIVEN( desc )
|
||||
#define CATCH_AND_GIVEN( desc )
|
||||
#define CATCH_WHEN( desc )
|
||||
@ -433,10 +433,10 @@ using Catch::Detail::Approx;
|
||||
#define INFO( msg ) (void)(0)
|
||||
#define UNSCOPED_INFO( msg ) (void)(0)
|
||||
#define WARN( msg ) (void)(0)
|
||||
#define CAPTURE( msg ) (void)(0)
|
||||
#define CAPTURE( ... ) (void)(0)
|
||||
|
||||
#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
|
||||
#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
|
||||
#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ))
|
||||
#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ))
|
||||
#define METHOD_AS_TEST_CASE( method, ... )
|
||||
#define REGISTER_TEST_CASE( Function, ... ) (void)(0)
|
||||
#define SECTION( ... )
|
||||
@ -444,7 +444,7 @@ using Catch::Detail::Approx;
|
||||
#define FAIL( ... ) (void)(0)
|
||||
#define FAIL_CHECK( ... ) (void)(0)
|
||||
#define SUCCEED( ... ) (void)(0)
|
||||
#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
|
||||
#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ))
|
||||
|
||||
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__)
|
||||
@ -474,8 +474,8 @@ using Catch::Detail::Approx;
|
||||
#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature )
|
||||
|
||||
// "BDD-style" convenience wrappers
|
||||
#define SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ) )
|
||||
#define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), className )
|
||||
#define SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ) )
|
||||
#define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ), className )
|
||||
|
||||
#define GIVEN( desc )
|
||||
#define AND_GIVEN( desc )
|
||||
|
2
include/external/clara.hpp
vendored
2
include/external/clara.hpp
vendored
@ -667,7 +667,7 @@ namespace detail {
|
||||
}
|
||||
inline auto convertInto( std::string const &source, bool &target ) -> ParserResult {
|
||||
std::string srcLC = source;
|
||||
std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( char c ) { return static_cast<char>( std::tolower(c) ); } );
|
||||
std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( unsigned char c ) { return static_cast<char>( std::tolower(c) ); } );
|
||||
if (srcLC == "y" || srcLC == "1" || srcLC == "true" || srcLC == "yes" || srcLC == "on")
|
||||
target = true;
|
||||
else if (srcLC == "n" || srcLC == "0" || srcLC == "false" || srcLC == "no" || srcLC == "off")
|
||||
|
@ -19,8 +19,6 @@ namespace Catch {
|
||||
template <typename T, bool Destruct>
|
||||
struct ObjectStorage
|
||||
{
|
||||
using TStorage = typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type;
|
||||
|
||||
ObjectStorage() : data() {}
|
||||
|
||||
ObjectStorage(const ObjectStorage& other)
|
||||
@ -64,7 +62,7 @@ namespace Catch {
|
||||
}
|
||||
|
||||
|
||||
TStorage data;
|
||||
struct { alignas(T) unsigned char data[sizeof(T)]; } data;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "detail/catch_run_for_at_least.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
||||
namespace Catch {
|
||||
namespace Benchmark {
|
||||
|
@ -12,6 +12,7 @@
|
||||
#define TWOBLUECUBES_CATCH_DETAIL_COMPLETE_INVOKE_HPP_INCLUDED
|
||||
|
||||
#include "../../catch_enforce.h"
|
||||
#include "../../catch_meta.hpp"
|
||||
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
@ -42,20 +43,18 @@ namespace Catch {
|
||||
return {};
|
||||
}
|
||||
};
|
||||
template <typename Sig>
|
||||
using ResultOf_t = typename std::result_of<Sig>::type;
|
||||
|
||||
// invoke and not return void :(
|
||||
template <typename Fun, typename... Args>
|
||||
CompleteType_t<ResultOf_t<Fun(Args...)>> complete_invoke(Fun&& fun, Args&&... args) {
|
||||
return CompleteInvoker<ResultOf_t<Fun(Args...)>>::invoke(std::forward<Fun>(fun), std::forward<Args>(args)...);
|
||||
CompleteType_t<FunctionReturnType<Fun, Args...>> complete_invoke(Fun&& fun, Args&&... args) {
|
||||
return CompleteInvoker<FunctionReturnType<Fun, Args...>>::invoke(std::forward<Fun>(fun), std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
const std::string benchmarkErrorMsg = "a benchmark failed to run successfully";
|
||||
} // namespace Detail
|
||||
|
||||
template <typename Fun>
|
||||
Detail::CompleteType_t<Detail::ResultOf_t<Fun()>> user_code(Fun&& fun) {
|
||||
Detail::CompleteType_t<FunctionReturnType<Fun>> user_code(Fun&& fun) {
|
||||
CATCH_TRY{
|
||||
return Detail::complete_invoke(std::forward<Fun>(fun));
|
||||
} CATCH_CATCH_ALL{
|
||||
|
@ -68,7 +68,9 @@ namespace Catch {
|
||||
}
|
||||
template <typename Clock>
|
||||
EnvironmentEstimate<FloatDuration<Clock>> estimate_clock_cost(FloatDuration<Clock> resolution) {
|
||||
auto time_limit = std::min(resolution * clock_cost_estimation_tick_limit, FloatDuration<Clock>(clock_cost_estimation_time_limit));
|
||||
auto time_limit = (std::min)(
|
||||
resolution * clock_cost_estimation_tick_limit,
|
||||
FloatDuration<Clock>(clock_cost_estimation_time_limit));
|
||||
auto time_clock = [](int k) {
|
||||
return Detail::measure<Clock>([k] {
|
||||
for (int i = 0; i < k; ++i) {
|
||||
|
@ -21,7 +21,7 @@ namespace Catch {
|
||||
namespace Benchmark {
|
||||
namespace Detail {
|
||||
template <typename Clock, typename Fun, typename... Args>
|
||||
TimingOf<Clock, Fun(Args...)> measure(Fun&& fun, Args&&... args) {
|
||||
TimingOf<Clock, Fun, Args...> measure(Fun&& fun, Args&&... args) {
|
||||
auto start = Clock::now();
|
||||
auto&& r = Detail::complete_invoke(fun, std::forward<Args>(args)...);
|
||||
auto end = Clock::now();
|
||||
|
@ -25,11 +25,11 @@ namespace Catch {
|
||||
namespace Benchmark {
|
||||
namespace Detail {
|
||||
template <typename Clock, typename Fun>
|
||||
TimingOf<Clock, Fun(int)> measure_one(Fun&& fun, int iters, std::false_type) {
|
||||
TimingOf<Clock, Fun, int> measure_one(Fun&& fun, int iters, std::false_type) {
|
||||
return Detail::measure<Clock>(fun, iters);
|
||||
}
|
||||
template <typename Clock, typename Fun>
|
||||
TimingOf<Clock, Fun(Chronometer)> measure_one(Fun&& fun, int iters, std::true_type) {
|
||||
TimingOf<Clock, Fun, Chronometer> measure_one(Fun&& fun, int iters, std::true_type) {
|
||||
Detail::ChronometerModel<Clock> meter;
|
||||
auto&& result = Detail::complete_invoke(fun, Chronometer(meter, iters));
|
||||
|
||||
@ -46,7 +46,7 @@ namespace Catch {
|
||||
};
|
||||
|
||||
template <typename Clock, typename Fun>
|
||||
TimingOf<Clock, Fun(run_for_at_least_argument_t<Clock, Fun>)> run_for_at_least(ClockDuration<Clock> how_long, int seed, Fun&& fun) {
|
||||
TimingOf<Clock, Fun, run_for_at_least_argument_t<Clock, Fun>> run_for_at_least(ClockDuration<Clock> how_long, int seed, Fun&& fun) {
|
||||
auto iters = seed;
|
||||
while (iters < (1 << 30)) {
|
||||
auto&& Timing = measure_one<Clock>(fun, iters, is_callable<Fun(Chronometer)>());
|
||||
@ -56,7 +56,7 @@ namespace Catch {
|
||||
}
|
||||
iters *= 2;
|
||||
}
|
||||
throw optimized_away_error{};
|
||||
Catch::throw_exception(optimized_away_error{});
|
||||
}
|
||||
} // namespace Detail
|
||||
} // namespace Benchmark
|
||||
|
@ -152,7 +152,7 @@ namespace Catch {
|
||||
double sb = stddev.point;
|
||||
double mn = mean.point / n;
|
||||
double mg_min = mn / 2.;
|
||||
double sg = std::min(mg_min / 4., sb / std::sqrt(n));
|
||||
double sg = (std::min)(mg_min / 4., sb / std::sqrt(n));
|
||||
double sg2 = sg * sg;
|
||||
double sb2 = sb * sb;
|
||||
|
||||
@ -171,7 +171,7 @@ namespace Catch {
|
||||
return (nc / n) * (sb2 - nc * sg2);
|
||||
};
|
||||
|
||||
return std::min(var_out(1), var_out(std::min(c_max(0.), c_max(mg_min)))) / sb2;
|
||||
return (std::min)(var_out(1), var_out((std::min)(c_max(0.), c_max(mg_min)))) / sb2;
|
||||
}
|
||||
|
||||
|
||||
|
@ -138,8 +138,8 @@ namespace Catch {
|
||||
double b2 = bias - z1;
|
||||
double a1 = a(b1);
|
||||
double a2 = a(b2);
|
||||
auto lo = std::max(cumn(a1), 0);
|
||||
auto hi = std::min(cumn(a2), n - 1);
|
||||
auto lo = (std::max)(cumn(a1), 0);
|
||||
auto hi = (std::min)(cumn(a2), n - 1);
|
||||
|
||||
return { point, resample[lo], resample[hi], confidence_level };
|
||||
}
|
||||
|
@ -25,8 +25,8 @@ namespace Catch {
|
||||
Result result;
|
||||
int iterations;
|
||||
};
|
||||
template <typename Clock, typename Sig>
|
||||
using TimingOf = Timing<ClockDuration<Clock>, Detail::CompleteType_t<Detail::ResultOf_t<Sig>>>;
|
||||
template <typename Clock, typename Func, typename... Args>
|
||||
using TimingOf = Timing<ClockDuration<Clock>, Detail::CompleteType_t<FunctionReturnType<Func, Args...>>>;
|
||||
} // namespace Benchmark
|
||||
} // namespace Catch
|
||||
|
||||
|
@ -33,7 +33,7 @@ namespace Detail {
|
||||
Approx operator-() const;
|
||||
|
||||
template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
|
||||
Approx operator()( T const& value ) {
|
||||
Approx operator()( T const& value ) const {
|
||||
Approx approx( static_cast<double>(value) );
|
||||
approx.m_epsilon = m_epsilon;
|
||||
approx.m_margin = m_margin;
|
||||
|
@ -170,6 +170,9 @@ namespace Catch {
|
||||
| Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, "yes|no" )
|
||||
["-d"]["--durations"]
|
||||
( "show test durations" )
|
||||
| Opt( config.minDuration, "seconds" )
|
||||
["-D"]["--min-duration"]
|
||||
( "show test durations for tests taking at least the given number of seconds" )
|
||||
| Opt( loadTestNamesFromFile, "filename" )
|
||||
["-f"]["--input-file"]
|
||||
( "load test names to run from a file" )
|
||||
|
@ -39,13 +39,9 @@
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__cpp_lib_uncaught_exceptions)
|
||||
# define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
// We have to avoid both ICC and Clang, because they try to mask themselves
|
||||
// as gcc, and we want only GCC in this block
|
||||
#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC)
|
||||
// Only GCC compiler should be used in this block, so other compilers trying to
|
||||
// mask themselves as GCC should be ignored.
|
||||
#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && !defined(__CUDACC__) && !defined(__LCC__)
|
||||
# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic push" )
|
||||
# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic pop" )
|
||||
|
||||
@ -69,8 +65,8 @@
|
||||
// ```
|
||||
//
|
||||
// Therefore, `CATCH_INTERNAL_IGNORE_BUT_WARN` is not implemented.
|
||||
# if !defined(__ibmxl__)
|
||||
# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) /* NOLINT(cppcoreguidelines-pro-type-vararg) */
|
||||
# if !defined(__ibmxl__) && !defined(__CUDACC__)
|
||||
# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) /* NOLINT(cppcoreguidelines-pro-type-vararg, hicpp-vararg) */
|
||||
# endif
|
||||
|
||||
|
||||
@ -150,13 +146,6 @@
|
||||
// Visual C++
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma( warning(push) )
|
||||
# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION __pragma( warning(pop) )
|
||||
|
||||
# if _MSC_VER >= 1900 // Visual Studio 2015 or newer
|
||||
# define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
|
||||
# endif
|
||||
|
||||
// Universal Windows platform does not support SEH
|
||||
// Or console colours (or console at all...)
|
||||
# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
|
||||
@ -165,13 +154,18 @@
|
||||
# define CATCH_INTERNAL_CONFIG_WINDOWS_SEH
|
||||
# endif
|
||||
|
||||
# if !defined(__clang__) // Handle Clang masquerading for msvc
|
||||
|
||||
// MSVC traditional preprocessor needs some workaround for __VA_ARGS__
|
||||
// _MSVC_TRADITIONAL == 0 means new conformant preprocessor
|
||||
// _MSVC_TRADITIONAL == 1 means old traditional non-conformant preprocessor
|
||||
# if !defined(__clang__) // Handle Clang masquerading for msvc
|
||||
# if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL)
|
||||
# define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
# endif // MSVC_TRADITIONAL
|
||||
|
||||
// Only do this if we're not using clang on Windows, which uses `diagnostic push` & `diagnostic pop`
|
||||
# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma( warning(push) )
|
||||
# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION __pragma( warning(pop) )
|
||||
# endif // __clang__
|
||||
|
||||
#endif // _MSC_VER
|
||||
@ -240,7 +234,10 @@
|
||||
|
||||
// Check if byte is available and usable
|
||||
# if __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER)
|
||||
# define CATCH_INTERNAL_CONFIG_CPP17_BYTE
|
||||
# include <cstddef>
|
||||
# if defined(__cpp_lib_byte) && (__cpp_lib_byte > 0)
|
||||
# define CATCH_INTERNAL_CONFIG_CPP17_BYTE
|
||||
# endif
|
||||
# endif // __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER)
|
||||
|
||||
// Check if variant is available and usable
|
||||
@ -284,10 +281,6 @@
|
||||
# define CATCH_CONFIG_CPP17_OPTIONAL
|
||||
#endif
|
||||
|
||||
#if defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) && !defined(CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS) && !defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
|
||||
# define CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
#if defined(CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_NO_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_CPP17_STRING_VIEW)
|
||||
# define CATCH_CONFIG_CPP17_STRING_VIEW
|
||||
#endif
|
||||
|
@ -64,6 +64,7 @@ namespace Catch {
|
||||
bool Config::warnAboutMissingAssertions() const { return !!(m_data.warnings & WarnAbout::NoAssertions); }
|
||||
bool Config::warnAboutNoTests() const { return !!(m_data.warnings & WarnAbout::NoTests); }
|
||||
ShowDurations::OrNot Config::showDurations() const { return m_data.showDurations; }
|
||||
double Config::minDuration() const { return m_data.minDuration; }
|
||||
RunTests::InWhatOrder Config::runOrder() const { return m_data.runOrder; }
|
||||
unsigned int Config::rngSeed() const { return m_data.rngSeed; }
|
||||
UseColour::YesOrNo Config::useColour() const { return m_data.useColour; }
|
||||
|
@ -52,6 +52,7 @@ namespace Catch {
|
||||
Verbosity verbosity = Verbosity::Normal;
|
||||
WarnAbout::What warnings = WarnAbout::Nothing;
|
||||
ShowDurations::OrNot showDurations = ShowDurations::DefaultForReporter;
|
||||
double minDuration = -1;
|
||||
RunTests::InWhatOrder runOrder = RunTests::InDeclarationOrder;
|
||||
UseColour::YesOrNo useColour = UseColour::Auto;
|
||||
WaitForKeypress::When waitForKeypress = WaitForKeypress::Never;
|
||||
@ -103,6 +104,7 @@ namespace Catch {
|
||||
bool warnAboutMissingAssertions() const override;
|
||||
bool warnAboutNoTests() const override;
|
||||
ShowDurations::OrNot showDurations() const override;
|
||||
double minDuration() const override;
|
||||
RunTests::InWhatOrder runOrder() const override;
|
||||
unsigned int rngSeed() const override;
|
||||
UseColour::YesOrNo useColour() const override;
|
||||
|
44
include/internal/catch_config_uncaught_exceptions.hpp
Normal file
44
include/internal/catch_config_uncaught_exceptions.hpp
Normal file
@ -0,0 +1,44 @@
|
||||
|
||||
// Copyright Catch2 Authors
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
/** \file
|
||||
* Wrapper for UNCAUGHT_EXCEPTIONS configuration option
|
||||
*
|
||||
* For some functionality, Catch2 requires to know whether there is
|
||||
* an active exception. Because `std::uncaught_exception` is deprecated
|
||||
* in C++17, we want to use `std::uncaught_exceptions` if possible.
|
||||
*/
|
||||
|
||||
#ifndef CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP
|
||||
#define CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# if _MSC_VER >= 1900 // Visual Studio 2015 or newer
|
||||
# define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#include <exception>
|
||||
|
||||
#if defined(__cpp_lib_uncaught_exceptions) \
|
||||
&& !defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
|
||||
|
||||
# define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
|
||||
#endif // __cpp_lib_uncaught_exceptions
|
||||
|
||||
|
||||
#if defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) \
|
||||
&& !defined(CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS) \
|
||||
&& !defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
|
||||
|
||||
# define CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
|
||||
#endif // CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP
|
@ -17,7 +17,11 @@ namespace Catch {
|
||||
|
||||
#ifdef CATCH_PLATFORM_MAC
|
||||
|
||||
#define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */
|
||||
#elif defined(__aarch64__)
|
||||
#define CATCH_TRAP() __asm__(".inst 0xd43e0000")
|
||||
#endif
|
||||
|
||||
#elif defined(CATCH_PLATFORM_IPHONE)
|
||||
|
||||
|
@ -208,6 +208,10 @@ namespace Catch {
|
||||
auto operator & (RhsT const& rhs) -> BinaryExpr<LhsT, RhsT const&> const {
|
||||
return { static_cast<bool>(m_lhs & rhs), m_lhs, "&", rhs };
|
||||
}
|
||||
template <typename RhsT>
|
||||
auto operator ^ (RhsT const& rhs) -> BinaryExpr<LhsT, RhsT const&> const {
|
||||
return { static_cast<bool>(m_lhs ^ rhs), m_lhs, "^", rhs };
|
||||
}
|
||||
|
||||
template<typename RhsT>
|
||||
auto operator && ( RhsT const& ) -> BinaryExpr<LhsT, RhsT const&> const {
|
||||
|
@ -13,12 +13,20 @@
|
||||
|
||||
#ifndef __OBJC__
|
||||
|
||||
#ifndef CATCH_INTERNAL_CDECL
|
||||
#ifdef _MSC_VER
|
||||
#define CATCH_INTERNAL_CDECL __cdecl
|
||||
#else
|
||||
#define CATCH_INTERNAL_CDECL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(CATCH_CONFIG_WCHAR) && defined(CATCH_PLATFORM_WINDOWS) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN)
|
||||
// Standard C/C++ Win32 Unicode wmain entry point
|
||||
extern "C" int wmain (int argc, wchar_t * argv[], wchar_t * []) {
|
||||
extern "C" int CATCH_INTERNAL_CDECL wmain (int argc, wchar_t * argv[], wchar_t * []) {
|
||||
#else
|
||||
// Standard C/C++ main entry point
|
||||
int main (int argc, char * argv[]) {
|
||||
int CATCH_INTERNAL_CDECL main (int argc, char * argv[]) {
|
||||
#endif
|
||||
|
||||
return Catch::Session().run( argc, argv );
|
||||
|
@ -22,7 +22,7 @@ namespace Catch {
|
||||
// Extracts the actual name part of an enum instance
|
||||
// In other words, it returns the Blue part of Bikeshed::Colour::Blue
|
||||
StringRef extractInstanceName(StringRef enumInstance) {
|
||||
// Find last occurence of ":"
|
||||
// Find last occurrence of ":"
|
||||
size_t name_start = enumInstance.size();
|
||||
while (name_start > 0 && enumInstance[name_start - 1] != ':') {
|
||||
--name_start;
|
||||
|
@ -7,30 +7,72 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* This file provides platform specific implementations of FatalConditionHandler
|
||||
*
|
||||
* This means that there is a lot of conditional compilation, and platform
|
||||
* specific code. Currently, Catch2 supports a dummy handler (if no
|
||||
* handler is desired), and 2 platform specific handlers:
|
||||
* * Windows' SEH
|
||||
* * POSIX signals
|
||||
*
|
||||
* Consequently, various pieces of code below are compiled if either of
|
||||
* the platform specific handlers is enabled, or if none of them are
|
||||
* enabled. It is assumed that both cannot be enabled at the same time,
|
||||
* and doing so should cause a compilation error.
|
||||
*
|
||||
* If another platform specific handler is added, the compile guards
|
||||
* below will need to be updated taking these assumptions into account.
|
||||
*/
|
||||
|
||||
#include "catch_fatal_condition.h"
|
||||
|
||||
#include "catch_context.h"
|
||||
#include "catch_interfaces_capture.h"
|
||||
#include "catch_enforce.h"
|
||||
#include "catch_run_context.h"
|
||||
#include "catch_windows_h_proxy.h"
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||
#endif
|
||||
#include <algorithm>
|
||||
|
||||
#if !defined( CATCH_CONFIG_WINDOWS_SEH ) && !defined( CATCH_CONFIG_POSIX_SIGNALS )
|
||||
|
||||
namespace Catch {
|
||||
|
||||
// If neither SEH nor signal handling is required, the handler impls
|
||||
// do not have to do anything, and can be empty.
|
||||
void FatalConditionHandler::engage_platform() {}
|
||||
void FatalConditionHandler::disengage_platform() {}
|
||||
FatalConditionHandler::FatalConditionHandler() = default;
|
||||
FatalConditionHandler::~FatalConditionHandler() = default;
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
#endif // !CATCH_CONFIG_WINDOWS_SEH && !CATCH_CONFIG_POSIX_SIGNALS
|
||||
|
||||
#if defined( CATCH_CONFIG_WINDOWS_SEH ) && defined( CATCH_CONFIG_POSIX_SIGNALS )
|
||||
#error "Inconsistent configuration: Windows' SEH handling and POSIX signals cannot be enabled at the same time"
|
||||
#endif // CATCH_CONFIG_WINDOWS_SEH && CATCH_CONFIG_POSIX_SIGNALS
|
||||
|
||||
#if defined( CATCH_CONFIG_WINDOWS_SEH ) || defined( CATCH_CONFIG_POSIX_SIGNALS )
|
||||
|
||||
namespace {
|
||||
// Report the error condition
|
||||
//! Signals fatal error message to the run context
|
||||
void reportFatal( char const * const message ) {
|
||||
Catch::getCurrentContext().getResultCapture()->handleFatalErrorCondition( message );
|
||||
}
|
||||
}
|
||||
|
||||
#endif // signals/SEH handling
|
||||
//! Minimal size Catch2 needs for its own fatal error handling.
|
||||
//! Picked anecdotally, so it might not be sufficient on all
|
||||
//! platforms, and for all configurations.
|
||||
constexpr std::size_t minStackSizeForErrors = 32 * 1024;
|
||||
} // end unnamed namespace
|
||||
|
||||
#endif // CATCH_CONFIG_WINDOWS_SEH || CATCH_CONFIG_POSIX_SIGNALS
|
||||
|
||||
#if defined( CATCH_CONFIG_WINDOWS_SEH )
|
||||
|
||||
namespace Catch {
|
||||
|
||||
struct SignalDefs { DWORD id; const char* name; };
|
||||
|
||||
// There is no 1-1 mapping between signals and windows exceptions.
|
||||
@ -43,7 +85,7 @@ namespace Catch {
|
||||
{ static_cast<DWORD>(EXCEPTION_INT_DIVIDE_BY_ZERO), "Divide by zero error" },
|
||||
};
|
||||
|
||||
LONG CALLBACK FatalConditionHandler::handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo) {
|
||||
static LONG CALLBACK handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo) {
|
||||
for (auto const& def : signalDefs) {
|
||||
if (ExceptionInfo->ExceptionRecord->ExceptionCode == def.id) {
|
||||
reportFatal(def.name);
|
||||
@ -54,39 +96,52 @@ namespace Catch {
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
FatalConditionHandler::FatalConditionHandler() {
|
||||
isSet = true;
|
||||
// 32k seems enough for Catch to handle stack overflow,
|
||||
// but the value was found experimentally, so there is no strong guarantee
|
||||
guaranteeSize = 32 * 1024;
|
||||
exceptionHandlerHandle = nullptr;
|
||||
// Register as first handler in current chain
|
||||
exceptionHandlerHandle = AddVectoredExceptionHandler(1, handleVectoredException);
|
||||
// Pass in guarantee size to be filled
|
||||
SetThreadStackGuarantee(&guaranteeSize);
|
||||
}
|
||||
// Since we do not support multiple instantiations, we put these
|
||||
// into global variables and rely on cleaning them up in outlined
|
||||
// constructors/destructors
|
||||
static PVOID exceptionHandlerHandle = nullptr;
|
||||
|
||||
void FatalConditionHandler::reset() {
|
||||
if (isSet) {
|
||||
RemoveVectoredExceptionHandler(exceptionHandlerHandle);
|
||||
SetThreadStackGuarantee(&guaranteeSize);
|
||||
exceptionHandlerHandle = nullptr;
|
||||
isSet = false;
|
||||
|
||||
// For MSVC, we reserve part of the stack memory for handling
|
||||
// memory overflow structured exception.
|
||||
FatalConditionHandler::FatalConditionHandler() {
|
||||
ULONG guaranteeSize = static_cast<ULONG>(minStackSizeForErrors);
|
||||
if (!SetThreadStackGuarantee(&guaranteeSize)) {
|
||||
// We do not want to fully error out, because needing
|
||||
// the stack reserve should be rare enough anyway.
|
||||
Catch::cerr()
|
||||
<< "Failed to reserve piece of stack."
|
||||
<< " Stack overflows will not be reported successfully.";
|
||||
}
|
||||
}
|
||||
|
||||
FatalConditionHandler::~FatalConditionHandler() {
|
||||
reset();
|
||||
// We do not attempt to unset the stack guarantee, because
|
||||
// Windows does not support lowering the stack size guarantee.
|
||||
FatalConditionHandler::~FatalConditionHandler() = default;
|
||||
|
||||
|
||||
void FatalConditionHandler::engage_platform() {
|
||||
// Register as first handler in current chain
|
||||
exceptionHandlerHandle = AddVectoredExceptionHandler(1, handleVectoredException);
|
||||
if (!exceptionHandlerHandle) {
|
||||
CATCH_RUNTIME_ERROR("Could not register vectored exception handler");
|
||||
}
|
||||
}
|
||||
|
||||
bool FatalConditionHandler::isSet = false;
|
||||
ULONG FatalConditionHandler::guaranteeSize = 0;
|
||||
PVOID FatalConditionHandler::exceptionHandlerHandle = nullptr;
|
||||
void FatalConditionHandler::disengage_platform() {
|
||||
if (!RemoveVectoredExceptionHandler(exceptionHandlerHandle)) {
|
||||
CATCH_RUNTIME_ERROR("Could not unregister vectored exception handler");
|
||||
}
|
||||
exceptionHandlerHandle = nullptr;
|
||||
}
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
} // namespace Catch
|
||||
#endif // CATCH_CONFIG_WINDOWS_SEH
|
||||
|
||||
#elif defined( CATCH_CONFIG_POSIX_SIGNALS )
|
||||
#if defined( CATCH_CONFIG_POSIX_SIGNALS )
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
@ -94,10 +149,6 @@ namespace Catch {
|
||||
int id;
|
||||
const char* name;
|
||||
};
|
||||
|
||||
// 32kb for the alternate stack seems to be sufficient. However, this value
|
||||
// is experimentally determined, so that's not guaranteed.
|
||||
static constexpr std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
|
||||
|
||||
static SignalDefs signalDefs[] = {
|
||||
{ SIGINT, "SIGINT - Terminal interrupt signal" },
|
||||
@ -108,8 +159,32 @@ namespace Catch {
|
||||
{ SIGABRT, "SIGABRT - Abort (abnormal termination) signal" }
|
||||
};
|
||||
|
||||
// Older GCCs trigger -Wmissing-field-initializers for T foo = {}
|
||||
// which is zero initialization, but not explicit. We want to avoid
|
||||
// that.
|
||||
#if defined(__GNUC__)
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||
#endif
|
||||
|
||||
void FatalConditionHandler::handleSignal( int sig ) {
|
||||
static char* altStackMem = nullptr;
|
||||
static std::size_t altStackSize = 0;
|
||||
static stack_t oldSigStack{};
|
||||
static struct sigaction oldSigActions[sizeof(signalDefs) / sizeof(SignalDefs)]{};
|
||||
|
||||
static void restorePreviousSignalHandlers() {
|
||||
// We set signal handlers back to the previous ones. Hopefully
|
||||
// nobody overwrote them in the meantime, and doesn't expect
|
||||
// their signal handlers to live past ours given that they
|
||||
// installed them after ours..
|
||||
for (std::size_t i = 0; i < sizeof(signalDefs) / sizeof(SignalDefs); ++i) {
|
||||
sigaction(signalDefs[i].id, &oldSigActions[i], nullptr);
|
||||
}
|
||||
// Return the old stack
|
||||
sigaltstack(&oldSigStack, nullptr);
|
||||
}
|
||||
|
||||
static void handleSignal( int sig ) {
|
||||
char const * name = "<unknown signal>";
|
||||
for (auto const& def : signalDefs) {
|
||||
if (sig == def.id) {
|
||||
@ -117,16 +192,33 @@ namespace Catch {
|
||||
break;
|
||||
}
|
||||
}
|
||||
reset();
|
||||
reportFatal(name);
|
||||
// We need to restore previous signal handlers and let them do
|
||||
// their thing, so that the users can have the debugger break
|
||||
// when a signal is raised, and so on.
|
||||
restorePreviousSignalHandlers();
|
||||
reportFatal( name );
|
||||
raise( sig );
|
||||
}
|
||||
|
||||
FatalConditionHandler::FatalConditionHandler() {
|
||||
isSet = true;
|
||||
assert(!altStackMem && "Cannot initialize POSIX signal handler when one already exists");
|
||||
if (altStackSize == 0) {
|
||||
altStackSize = std::max(static_cast<size_t>(SIGSTKSZ), minStackSizeForErrors);
|
||||
}
|
||||
altStackMem = new char[altStackSize]();
|
||||
}
|
||||
|
||||
FatalConditionHandler::~FatalConditionHandler() {
|
||||
delete[] altStackMem;
|
||||
// We signal that another instance can be constructed by zeroing
|
||||
// out the pointer.
|
||||
altStackMem = nullptr;
|
||||
}
|
||||
|
||||
void FatalConditionHandler::engage_platform() {
|
||||
stack_t sigStack;
|
||||
sigStack.ss_sp = altStackMem;
|
||||
sigStack.ss_size = sigStackSize;
|
||||
sigStack.ss_size = altStackSize;
|
||||
sigStack.ss_flags = 0;
|
||||
sigaltstack(&sigStack, &oldSigStack);
|
||||
struct sigaction sa = { };
|
||||
@ -138,39 +230,15 @@ namespace Catch {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FatalConditionHandler::~FatalConditionHandler() {
|
||||
reset();
|
||||
}
|
||||
|
||||
void FatalConditionHandler::reset() {
|
||||
if( isSet ) {
|
||||
// Set signals back to previous values -- hopefully nobody overwrote them in the meantime
|
||||
for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) {
|
||||
sigaction(signalDefs[i].id, &oldSigActions[i], nullptr);
|
||||
}
|
||||
// Return the old stack
|
||||
sigaltstack(&oldSigStack, nullptr);
|
||||
isSet = false;
|
||||
}
|
||||
}
|
||||
|
||||
bool FatalConditionHandler::isSet = false;
|
||||
struct sigaction FatalConditionHandler::oldSigActions[sizeof(signalDefs)/sizeof(SignalDefs)] = {};
|
||||
stack_t FatalConditionHandler::oldSigStack = {};
|
||||
char FatalConditionHandler::altStackMem[sigStackSize] = {};
|
||||
|
||||
|
||||
} // namespace Catch
|
||||
|
||||
#else
|
||||
|
||||
namespace Catch {
|
||||
void FatalConditionHandler::reset() {}
|
||||
}
|
||||
|
||||
#endif // signals/SEH handling
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
|
||||
void FatalConditionHandler::disengage_platform() {
|
||||
restorePreviousSignalHandlers();
|
||||
}
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
#endif // CATCH_CONFIG_POSIX_SIGNALS
|
||||
|
@ -11,59 +11,58 @@
|
||||
|
||||
#include "catch_platform.h"
|
||||
#include "catch_compiler_capabilities.h"
|
||||
#include "catch_windows_h_proxy.h"
|
||||
|
||||
|
||||
#if defined( CATCH_CONFIG_WINDOWS_SEH )
|
||||
#include <cassert>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
struct FatalConditionHandler {
|
||||
|
||||
static LONG CALLBACK handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo);
|
||||
FatalConditionHandler();
|
||||
static void reset();
|
||||
~FatalConditionHandler();
|
||||
|
||||
private:
|
||||
static bool isSet;
|
||||
static ULONG guaranteeSize;
|
||||
static PVOID exceptionHandlerHandle;
|
||||
};
|
||||
|
||||
} // namespace Catch
|
||||
|
||||
#elif defined ( CATCH_CONFIG_POSIX_SIGNALS )
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
struct FatalConditionHandler {
|
||||
|
||||
static bool isSet;
|
||||
static struct sigaction oldSigActions[];
|
||||
static stack_t oldSigStack;
|
||||
static char altStackMem[];
|
||||
|
||||
static void handleSignal( int sig );
|
||||
// Wrapper for platform-specific fatal error (signals/SEH) handlers
|
||||
//
|
||||
// Tries to be cooperative with other handlers, and not step over
|
||||
// other handlers. This means that unknown structured exceptions
|
||||
// are passed on, previous signal handlers are called, and so on.
|
||||
//
|
||||
// Can only be instantiated once, and assumes that once a signal
|
||||
// is caught, the binary will end up terminating. Thus, there
|
||||
class FatalConditionHandler {
|
||||
bool m_started = false;
|
||||
|
||||
// Install/disengage implementation for specific platform.
|
||||
// Should be if-defed to work on current platform, can assume
|
||||
// engage-disengage 1:1 pairing.
|
||||
void engage_platform();
|
||||
void disengage_platform();
|
||||
public:
|
||||
// Should also have platform-specific implementations as needed
|
||||
FatalConditionHandler();
|
||||
~FatalConditionHandler();
|
||||
static void reset();
|
||||
|
||||
void engage() {
|
||||
assert(!m_started && "Handler cannot be installed twice.");
|
||||
m_started = true;
|
||||
engage_platform();
|
||||
}
|
||||
|
||||
void disengage() {
|
||||
assert(m_started && "Handler cannot be uninstalled without being installed first");
|
||||
m_started = false;
|
||||
disengage_platform();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace Catch
|
||||
|
||||
|
||||
#else
|
||||
|
||||
namespace Catch {
|
||||
struct FatalConditionHandler {
|
||||
void reset();
|
||||
//! Simple RAII guard for (dis)engaging the FatalConditionHandler
|
||||
class FatalConditionHandlerGuard {
|
||||
FatalConditionHandler* m_handler;
|
||||
public:
|
||||
FatalConditionHandlerGuard(FatalConditionHandler* handler):
|
||||
m_handler(handler) {
|
||||
m_handler->engage();
|
||||
}
|
||||
~FatalConditionHandlerGuard() {
|
||||
m_handler->disengage();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
} // end namespace Catch
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_FATAL_CONDITION_H_INCLUDED
|
||||
|
@ -24,8 +24,8 @@ namespace Generators {
|
||||
|
||||
GeneratorUntypedBase::~GeneratorUntypedBase() {}
|
||||
|
||||
auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& {
|
||||
return getResultCapture().acquireGeneratorTracker( lineInfo );
|
||||
auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& {
|
||||
return getResultCapture().acquireGeneratorTracker( generatorName, lineInfo );
|
||||
}
|
||||
|
||||
} // namespace Generators
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "catch_interfaces_generatortracker.h"
|
||||
#include "catch_common.h"
|
||||
#include "catch_enforce.h"
|
||||
#include "catch_stringref.h"
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
@ -181,16 +182,16 @@ namespace Generators {
|
||||
return makeGenerators( value( T( std::forward<U>( val ) ) ), std::forward<Gs>( moreGenerators )... );
|
||||
}
|
||||
|
||||
auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker&;
|
||||
auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker&;
|
||||
|
||||
template<typename L>
|
||||
// Note: The type after -> is weird, because VS2015 cannot parse
|
||||
// the expression used in the typedef inside, when it is in
|
||||
// return type. Yeah.
|
||||
auto generate( SourceLineInfo const& lineInfo, L const& generatorExpression ) -> decltype(std::declval<decltype(generatorExpression())>().get()) {
|
||||
auto generate( StringRef generatorName, SourceLineInfo const& lineInfo, L const& generatorExpression ) -> decltype(std::declval<decltype(generatorExpression())>().get()) {
|
||||
using UnderlyingType = typename decltype(generatorExpression())::type;
|
||||
|
||||
IGeneratorTracker& tracker = acquireGeneratorTracker( lineInfo );
|
||||
IGeneratorTracker& tracker = acquireGeneratorTracker( generatorName, lineInfo );
|
||||
if (!tracker.hasGenerator()) {
|
||||
tracker.setGenerator(pf::make_unique<Generators<UnderlyingType>>(generatorExpression()));
|
||||
}
|
||||
@ -203,10 +204,16 @@ namespace Generators {
|
||||
} // namespace Catch
|
||||
|
||||
#define GENERATE( ... ) \
|
||||
Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [ ]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace)
|
||||
Catch::Generators::generate( INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \
|
||||
CATCH_INTERNAL_LINEINFO, \
|
||||
[ ]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace)
|
||||
#define GENERATE_COPY( ... ) \
|
||||
Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [=]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace)
|
||||
Catch::Generators::generate( INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \
|
||||
CATCH_INTERNAL_LINEINFO, \
|
||||
[=]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace)
|
||||
#define GENERATE_REF( ... ) \
|
||||
Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, [&]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace)
|
||||
Catch::Generators::generate( INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \
|
||||
CATCH_INTERNAL_LINEINFO, \
|
||||
[&]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace)
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_GENERATORS_HPP_INCLUDED
|
||||
|
@ -63,7 +63,7 @@ namespace Generators {
|
||||
if (!m_predicate(m_generator.get())) {
|
||||
// It might happen that there are no values that pass the
|
||||
// filter. In that case we throw an exception.
|
||||
auto has_initial_value = next();
|
||||
auto has_initial_value = nextImpl();
|
||||
if (!has_initial_value) {
|
||||
Catch::throw_exception(GeneratorException("No valid value found in filtered generator"));
|
||||
}
|
||||
@ -75,6 +75,11 @@ namespace Generators {
|
||||
}
|
||||
|
||||
bool next() override {
|
||||
return nextImpl();
|
||||
}
|
||||
|
||||
private:
|
||||
bool nextImpl() {
|
||||
bool success = m_generator.next();
|
||||
if (!success) {
|
||||
return false;
|
||||
|
@ -44,7 +44,7 @@ namespace Catch {
|
||||
virtual void sectionEnded( SectionEndInfo const& endInfo ) = 0;
|
||||
virtual void sectionEndedEarly( SectionEndInfo const& endInfo ) = 0;
|
||||
|
||||
virtual auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& = 0;
|
||||
virtual auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& = 0;
|
||||
|
||||
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
|
||||
virtual void benchmarkPreparing( std::string const& name ) = 0;
|
||||
|
@ -69,6 +69,7 @@ namespace Catch {
|
||||
virtual int abortAfter() const = 0;
|
||||
virtual bool showInvisibles() const = 0;
|
||||
virtual ShowDurations::OrNot showDurations() const = 0;
|
||||
virtual double minDuration() const = 0;
|
||||
virtual TestSpec const& testSpec() const = 0;
|
||||
virtual bool hasTestFilters() const = 0;
|
||||
virtual std::vector<std::string> const& getTestsOrTags() const = 0;
|
||||
|
@ -21,6 +21,8 @@
|
||||
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
|
||||
#include "benchmark/catch_estimate.hpp"
|
||||
#include "benchmark/catch_outlier_classification.hpp"
|
||||
|
||||
#include <iterator>
|
||||
#endif // CATCH_CONFIG_ENABLE_BENCHMARKING
|
||||
|
||||
|
||||
|
@ -55,7 +55,8 @@ namespace {
|
||||
return lhs == rhs;
|
||||
}
|
||||
|
||||
auto ulpDiff = std::abs(lc - rc);
|
||||
// static cast as a workaround for IBM XLC
|
||||
auto ulpDiff = std::abs(static_cast<FP>(lc - rc));
|
||||
return static_cast<uint64_t>(ulpDiff) <= maxUlpDiff;
|
||||
}
|
||||
|
||||
@ -234,4 +235,3 @@ Floating::WithinRelMatcher WithinRel(float target) {
|
||||
|
||||
} // namespace Matchers
|
||||
} // namespace Catch
|
||||
|
||||
|
@ -131,8 +131,6 @@ namespace Matchers {
|
||||
struct UnorderedEqualsMatcher : MatcherBase<std::vector<T, AllocMatch>> {
|
||||
UnorderedEqualsMatcher(std::vector<T, AllocComp> const& target) : m_target(target) {}
|
||||
bool match(std::vector<T, AllocMatch> const& vec) const override {
|
||||
// Note: This is a reimplementation of std::is_permutation,
|
||||
// because I don't want to include <algorithm> inside the common path
|
||||
if (m_target.size() != vec.size()) {
|
||||
return false;
|
||||
}
|
||||
@ -151,7 +149,7 @@ namespace Matchers {
|
||||
// The following functions create the actual matcher objects.
|
||||
// This allows the types to be inferred
|
||||
|
||||
template<typename T, typename AllocComp, typename AllocMatch = AllocComp>
|
||||
template<typename T, typename AllocComp = std::allocator<T>, typename AllocMatch = AllocComp>
|
||||
Vector::ContainsMatcher<T, AllocComp, AllocMatch> Contains( std::vector<T, AllocComp> const& comparator ) {
|
||||
return Vector::ContainsMatcher<T, AllocComp, AllocMatch>( comparator );
|
||||
}
|
||||
@ -161,17 +159,17 @@ namespace Matchers {
|
||||
return Vector::ContainsElementMatcher<T, Alloc>( comparator );
|
||||
}
|
||||
|
||||
template<typename T, typename AllocComp, typename AllocMatch = AllocComp>
|
||||
template<typename T, typename AllocComp = std::allocator<T>, typename AllocMatch = AllocComp>
|
||||
Vector::EqualsMatcher<T, AllocComp, AllocMatch> Equals( std::vector<T, AllocComp> const& comparator ) {
|
||||
return Vector::EqualsMatcher<T, AllocComp, AllocMatch>( comparator );
|
||||
}
|
||||
|
||||
template<typename T, typename AllocComp, typename AllocMatch = AllocComp>
|
||||
template<typename T, typename AllocComp = std::allocator<T>, typename AllocMatch = AllocComp>
|
||||
Vector::ApproxMatcher<T, AllocComp, AllocMatch> Approx( std::vector<T, AllocComp> const& comparator ) {
|
||||
return Vector::ApproxMatcher<T, AllocComp, AllocMatch>( comparator );
|
||||
}
|
||||
|
||||
template<typename T, typename AllocComp, typename AllocMatch = AllocComp>
|
||||
template<typename T, typename AllocComp = std::allocator<T>, typename AllocMatch = AllocComp>
|
||||
Vector::UnorderedEqualsMatcher<T, AllocComp, AllocMatch> UnorderedEquals(std::vector<T, AllocComp> const& target) {
|
||||
return Vector::UnorderedEqualsMatcher<T, AllocComp, AllocMatch>( target );
|
||||
}
|
||||
|
@ -69,10 +69,10 @@ namespace Catch {
|
||||
|
||||
Capturer::Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names ) {
|
||||
auto trimmed = [&] (size_t start, size_t end) {
|
||||
while (names[start] == ',' || isspace(names[start])) {
|
||||
while (names[start] == ',' || isspace(static_cast<unsigned char>(names[start]))) {
|
||||
++start;
|
||||
}
|
||||
while (names[end] == ',' || isspace(names[end])) {
|
||||
while (names[end] == ',' || isspace(static_cast<unsigned char>(names[end]))) {
|
||||
--end;
|
||||
}
|
||||
return names.substr(start, end - start + 1);
|
||||
|
@ -32,13 +32,13 @@ namespace Catch {
|
||||
|
||||
#if defined(__cpp_lib_is_invocable) && __cpp_lib_is_invocable >= 201703
|
||||
// std::result_of is deprecated in C++17 and removed in C++20. Hence, it is
|
||||
// replaced with std::invoke_result here. Also *_t format is preferred over
|
||||
// typename *::type format.
|
||||
template <typename Func, typename U>
|
||||
using FunctionReturnType = std::remove_reference_t<std::remove_cv_t<std::invoke_result_t<Func, U>>>;
|
||||
// replaced with std::invoke_result here.
|
||||
template <typename Func, typename... U>
|
||||
using FunctionReturnType = std::remove_reference_t<std::remove_cv_t<std::invoke_result_t<Func, U...>>>;
|
||||
#else
|
||||
template <typename Func, typename U>
|
||||
using FunctionReturnType = typename std::remove_reference<typename std::remove_cv<typename std::result_of<Func(U)>::type>::type>::type;
|
||||
// Keep ::type here because we still support C++11
|
||||
template <typename Func, typename... U>
|
||||
using FunctionReturnType = typename std::remove_reference<typename std::remove_cv<typename std::result_of<Func(U...)>::type>::type>::type;
|
||||
#endif
|
||||
|
||||
} // namespace Catch
|
||||
|
@ -66,7 +66,7 @@ namespace Catch {
|
||||
if (tmpnam_s(m_buffer)) {
|
||||
CATCH_RUNTIME_ERROR("Could not get a temp filename");
|
||||
}
|
||||
if (fopen_s(&m_file, m_buffer, "w")) {
|
||||
if (fopen_s(&m_file, m_buffer, "w+")) {
|
||||
char buffer[100];
|
||||
if (strerror_s(buffer, errno)) {
|
||||
CATCH_RUNTIME_ERROR("Could not translate errno to a string");
|
||||
|
@ -9,13 +9,16 @@
|
||||
#ifndef TWOBLUECUBES_CATCH_PLATFORM_H_INCLUDED
|
||||
#define TWOBLUECUBES_CATCH_PLATFORM_H_INCLUDED
|
||||
|
||||
// See e.g.:
|
||||
// https://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-18.1/TargetConditionals.h.auto.html
|
||||
#ifdef __APPLE__
|
||||
# include <TargetConditionals.h>
|
||||
# if TARGET_OS_OSX == 1
|
||||
# define CATCH_PLATFORM_MAC
|
||||
# elif TARGET_OS_IPHONE == 1
|
||||
# define CATCH_PLATFORM_IPHONE
|
||||
# endif
|
||||
# include <TargetConditionals.h>
|
||||
# if (defined(TARGET_OS_OSX) && TARGET_OS_OSX == 1) || \
|
||||
(defined(TARGET_OS_MAC) && TARGET_OS_MAC == 1)
|
||||
# define CATCH_PLATFORM_MAC
|
||||
# elif (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE == 1)
|
||||
# define CATCH_PLATFORM_IPHONE
|
||||
# endif
|
||||
|
||||
#elif defined(linux) || defined(__linux) || defined(__linux__)
|
||||
# define CATCH_PLATFORM_LINUX
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
/*
|
||||
* Created by Jozef on 12/11/2018.
|
||||
* Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
|
||||
@ -90,7 +91,7 @@
|
||||
#define INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_0, _1, _2, _3) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_1, _2, _3)
|
||||
#define INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_0, _1, _2, _3, _4) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_1, _2, _3, _4)
|
||||
#define INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_0, _1, _2, _3, _4, _5) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_1, _2, _3, _4, _5)
|
||||
#define INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_0, _1, _2, _3, _4, _5, _6) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_1, _2, _4, _5, _6)
|
||||
#define INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_0, _1, _2, _3, _4, _5, _6) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_1, _2, _3, _4, _5, _6)
|
||||
#define INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_0, _1, _2, _3, _4, _5, _6, _7) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_1, _2, _3, _4, _5, _6, _7)
|
||||
#define INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_1, _2, _3, _4, _5, _6, _7, _8)
|
||||
#define INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9)
|
||||
|
@ -59,7 +59,11 @@ namespace Catch {
|
||||
m_tagAliasRegistry.add( alias, tag, lineInfo );
|
||||
}
|
||||
void registerStartupException() noexcept override {
|
||||
#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
|
||||
m_exceptionRegistry.add(std::current_exception());
|
||||
#else
|
||||
CATCH_INTERNAL_ERROR("Attempted to register active exception under CATCH_CONFIG_DISABLE_EXCEPTIONS!");
|
||||
#endif
|
||||
}
|
||||
IMutableEnumValuesRegistry& getMutableEnumValuesRegistry() override {
|
||||
return m_enumValuesRegistry;
|
||||
|
@ -25,17 +25,32 @@ namespace Catch {
|
||||
std::shared_ptr<GeneratorTracker> tracker;
|
||||
|
||||
ITracker& currentTracker = ctx.currentTracker();
|
||||
if( TestCaseTracking::ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) {
|
||||
// Under specific circumstances, the generator we want
|
||||
// to acquire is also the current tracker. If this is
|
||||
// the case, we have to avoid looking through current
|
||||
// tracker's children, and instead return the current
|
||||
// tracker.
|
||||
// A case where this check is important is e.g.
|
||||
// for (int i = 0; i < 5; ++i) {
|
||||
// int n = GENERATE(1, 2);
|
||||
// }
|
||||
//
|
||||
// without it, the code above creates 5 nested generators.
|
||||
if (currentTracker.nameAndLocation() == nameAndLocation) {
|
||||
auto thisTracker = currentTracker.parent().findChild(nameAndLocation);
|
||||
assert(thisTracker);
|
||||
assert(thisTracker->isGeneratorTracker());
|
||||
tracker = std::static_pointer_cast<GeneratorTracker>(thisTracker);
|
||||
} else if ( TestCaseTracking::ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) {
|
||||
assert( childTracker );
|
||||
assert( childTracker->isGeneratorTracker() );
|
||||
tracker = std::static_pointer_cast<GeneratorTracker>( childTracker );
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
tracker = std::make_shared<GeneratorTracker>( nameAndLocation, ctx, ¤tTracker );
|
||||
currentTracker.addChild( tracker );
|
||||
}
|
||||
|
||||
if( !ctx.completedCycle() && !tracker->isComplete() ) {
|
||||
if( !tracker->isComplete() ) {
|
||||
tracker->open();
|
||||
}
|
||||
|
||||
@ -49,8 +64,68 @@ namespace Catch {
|
||||
}
|
||||
void close() override {
|
||||
TrackerBase::close();
|
||||
// Generator interface only finds out if it has another item on atual move
|
||||
if (m_runState == CompletedSuccessfully && m_generator->next()) {
|
||||
// If a generator has a child (it is followed by a section)
|
||||
// and none of its children have started, then we must wait
|
||||
// until later to start consuming its values.
|
||||
// This catches cases where `GENERATE` is placed between two
|
||||
// `SECTION`s.
|
||||
// **The check for m_children.empty cannot be removed**.
|
||||
// doing so would break `GENERATE` _not_ followed by `SECTION`s.
|
||||
const bool should_wait_for_child = [&]() {
|
||||
// No children -> nobody to wait for
|
||||
if ( m_children.empty() ) {
|
||||
return false;
|
||||
}
|
||||
// If at least one child started executing, don't wait
|
||||
if ( std::find_if(
|
||||
m_children.begin(),
|
||||
m_children.end(),
|
||||
[]( TestCaseTracking::ITrackerPtr tracker ) {
|
||||
return tracker->hasStarted();
|
||||
} ) != m_children.end() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// No children have started. We need to check if they _can_
|
||||
// start, and thus we should wait for them, or they cannot
|
||||
// start (due to filters), and we shouldn't wait for them
|
||||
auto* parent = m_parent;
|
||||
// This is safe: there is always at least one section
|
||||
// tracker in a test case tracking tree
|
||||
while ( !parent->isSectionTracker() ) {
|
||||
parent = &( parent->parent() );
|
||||
}
|
||||
assert( parent &&
|
||||
"Missing root (test case) level section" );
|
||||
|
||||
auto const& parentSection =
|
||||
static_cast<SectionTracker&>( *parent );
|
||||
auto const& filters = parentSection.getFilters();
|
||||
// No filters -> no restrictions on running sections
|
||||
if ( filters.empty() ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for ( auto const& child : m_children ) {
|
||||
if ( child->isSectionTracker() &&
|
||||
std::find( filters.begin(),
|
||||
filters.end(),
|
||||
static_cast<SectionTracker&>( *child )
|
||||
.trimmedName() ) !=
|
||||
filters.end() ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}();
|
||||
|
||||
// This check is a bit tricky, because m_generator->next()
|
||||
// has a side-effect, where it consumes generator's current
|
||||
// value, but we do not want to invoke the side-effect if
|
||||
// this generator is still waiting for any child to start.
|
||||
if ( should_wait_for_child ||
|
||||
( m_runState == CompletedSuccessfully &&
|
||||
m_generator->next() ) ) {
|
||||
m_children.clear();
|
||||
m_runState = Executing;
|
||||
}
|
||||
@ -187,10 +262,10 @@ namespace Catch {
|
||||
|
||||
return true;
|
||||
}
|
||||
auto RunContext::acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& {
|
||||
auto RunContext::acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& {
|
||||
using namespace Generators;
|
||||
GeneratorTracker& tracker = GeneratorTracker::acquire( m_trackerContext, TestCaseTracking::NameAndLocation( "generator", lineInfo ) );
|
||||
assert( tracker.isOpen() );
|
||||
GeneratorTracker& tracker = GeneratorTracker::acquire(m_trackerContext,
|
||||
TestCaseTracking::NameAndLocation( static_cast<std::string>(generatorName), lineInfo ) );
|
||||
m_lastAssertionInfo.lineInfo = lineInfo;
|
||||
return tracker;
|
||||
}
|
||||
@ -233,17 +308,17 @@ namespace Catch {
|
||||
|
||||
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
|
||||
void RunContext::benchmarkPreparing(std::string const& name) {
|
||||
m_reporter->benchmarkPreparing(name);
|
||||
}
|
||||
m_reporter->benchmarkPreparing(name);
|
||||
}
|
||||
void RunContext::benchmarkStarting( BenchmarkInfo const& info ) {
|
||||
m_reporter->benchmarkStarting( info );
|
||||
}
|
||||
void RunContext::benchmarkEnded( BenchmarkStats<> const& stats ) {
|
||||
m_reporter->benchmarkEnded( stats );
|
||||
}
|
||||
void RunContext::benchmarkFailed(std::string const & error) {
|
||||
m_reporter->benchmarkFailed(error);
|
||||
}
|
||||
void RunContext::benchmarkFailed(std::string const & error) {
|
||||
m_reporter->benchmarkFailed(error);
|
||||
}
|
||||
#endif // CATCH_CONFIG_ENABLE_BENCHMARKING
|
||||
|
||||
void RunContext::pushScopedMessage(MessageInfo const & message) {
|
||||
@ -377,9 +452,8 @@ namespace Catch {
|
||||
}
|
||||
|
||||
void RunContext::invokeActiveTestCase() {
|
||||
FatalConditionHandler fatalConditionHandler; // Handle signals
|
||||
FatalConditionHandlerGuard _(&m_fatalConditionhandler);
|
||||
m_activeTestCase->invoke();
|
||||
fatalConditionHandler.reset();
|
||||
}
|
||||
|
||||
void RunContext::handleUnfinishedSections() {
|
||||
|
@ -80,7 +80,7 @@ namespace Catch {
|
||||
void sectionEnded( SectionEndInfo const& endInfo ) override;
|
||||
void sectionEndedEarly( SectionEndInfo const& endInfo ) override;
|
||||
|
||||
auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& override;
|
||||
auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& override;
|
||||
|
||||
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
|
||||
void benchmarkPreparing( std::string const& name ) override;
|
||||
@ -146,6 +146,7 @@ namespace Catch {
|
||||
std::vector<SectionEndInfo> m_unfinishedSections;
|
||||
std::vector<ITracker*> m_activeSections;
|
||||
TrackerContext m_trackerContext;
|
||||
FatalConditionHandler m_fatalConditionhandler;
|
||||
bool m_lastAssertionPassed = false;
|
||||
bool m_shouldReportUnexpected = true;
|
||||
bool m_includeSuccessfulResults;
|
||||
|
@ -127,6 +127,10 @@ namespace Catch {
|
||||
filename.erase(0, lastSlash);
|
||||
filename[0] = '#';
|
||||
}
|
||||
else
|
||||
{
|
||||
filename.insert(0, "#");
|
||||
}
|
||||
|
||||
auto lastDot = filename.find_last_of('.');
|
||||
if (lastDot != std::string::npos) {
|
||||
@ -289,7 +293,7 @@ namespace Catch {
|
||||
|
||||
// Handle list request
|
||||
if( Option<std::size_t> listed = list( m_config ) )
|
||||
return static_cast<int>( *listed );
|
||||
return (std::min) (MaxExitCode, static_cast<int>(*listed));
|
||||
|
||||
TestGroup tests { m_config };
|
||||
auto const totals = tests.execute();
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "catch_startup_exception_registry.h"
|
||||
#include "catch_compiler_capabilities.h"
|
||||
|
||||
#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
|
||||
namespace Catch {
|
||||
void StartupExceptionRegistry::add( std::exception_ptr const& exception ) noexcept {
|
||||
CATCH_TRY {
|
||||
@ -24,3 +25,4 @@ void StartupExceptionRegistry::add( std::exception_ptr const& exception ) noexce
|
||||
}
|
||||
|
||||
} // end namespace Catch
|
||||
#endif
|
||||
|
@ -15,11 +15,13 @@
|
||||
namespace Catch {
|
||||
|
||||
class StartupExceptionRegistry {
|
||||
#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
|
||||
public:
|
||||
void add(std::exception_ptr const& exception) noexcept;
|
||||
std::vector<std::exception_ptr> const& getExceptions() const noexcept;
|
||||
private:
|
||||
std::vector<std::exception_ptr> m_exceptions;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // end namespace Catch
|
||||
|
@ -18,7 +18,7 @@ namespace Catch {
|
||||
|
||||
namespace {
|
||||
char toLowerCh(char c) {
|
||||
return static_cast<char>( std::tolower( c ) );
|
||||
return static_cast<char>( std::tolower( static_cast<unsigned char>(c) ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,24 +22,28 @@ namespace Catch {
|
||||
|
||||
namespace {
|
||||
struct TestHasher {
|
||||
explicit TestHasher(Catch::SimplePcg32& rng) {
|
||||
basis = rng();
|
||||
basis <<= 32;
|
||||
basis |= rng();
|
||||
}
|
||||
using hash_t = uint64_t;
|
||||
|
||||
uint64_t basis;
|
||||
explicit TestHasher( hash_t hashSuffix ):
|
||||
m_hashSuffix{ hashSuffix } {}
|
||||
|
||||
uint64_t operator()(TestCase const& t) const {
|
||||
// Modified FNV-1a hash
|
||||
static constexpr uint64_t prime = 1099511628211;
|
||||
uint64_t hash = basis;
|
||||
for (const char c : t.name) {
|
||||
uint32_t operator()( TestCase const& t ) const {
|
||||
// FNV-1a hash with multiplication fold.
|
||||
const hash_t prime = 1099511628211u;
|
||||
hash_t hash = 14695981039346656037u;
|
||||
for ( const char c : t.name ) {
|
||||
hash ^= c;
|
||||
hash *= prime;
|
||||
}
|
||||
return hash;
|
||||
hash ^= m_hashSuffix;
|
||||
hash *= prime;
|
||||
const uint32_t low{ static_cast<uint32_t>( hash ) };
|
||||
const uint32_t high{ static_cast<uint32_t>( hash >> 32 ) };
|
||||
return low * high;
|
||||
}
|
||||
|
||||
private:
|
||||
hash_t m_hashSuffix;
|
||||
};
|
||||
} // end unnamed namespace
|
||||
|
||||
@ -58,9 +62,9 @@ namespace Catch {
|
||||
|
||||
case RunTests::InRandomOrder: {
|
||||
seedRng( config );
|
||||
TestHasher h( rng() );
|
||||
TestHasher h{ config.rngSeed() };
|
||||
|
||||
using hashedTest = std::pair<uint64_t, TestCase const*>;
|
||||
using hashedTest = std::pair<TestHasher::hash_t, TestCase const*>;
|
||||
std::vector<hashedTest> indexed_tests;
|
||||
indexed_tests.reserve( unsortedTestCases.size() );
|
||||
|
||||
|
@ -65,15 +65,12 @@ namespace TestCaseTracking {
|
||||
}
|
||||
|
||||
|
||||
TrackerBase::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent )
|
||||
: m_nameAndLocation( nameAndLocation ),
|
||||
TrackerBase::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ):
|
||||
ITracker(nameAndLocation),
|
||||
m_ctx( ctx ),
|
||||
m_parent( parent )
|
||||
{}
|
||||
|
||||
NameAndLocation const& TrackerBase::nameAndLocation() const {
|
||||
return m_nameAndLocation;
|
||||
}
|
||||
bool TrackerBase::isComplete() const {
|
||||
return m_runState == CompletedSuccessfully || m_runState == Failed;
|
||||
}
|
||||
@ -190,7 +187,8 @@ namespace TestCaseTracking {
|
||||
bool SectionTracker::isComplete() const {
|
||||
bool complete = true;
|
||||
|
||||
if ((m_filters.empty() || m_filters[0] == "")
|
||||
if (m_filters.empty()
|
||||
|| m_filters[0] == ""
|
||||
|| std::find(m_filters.begin(), m_filters.end(), m_trimmed_name) != m_filters.end()) {
|
||||
complete = TrackerBase::isComplete();
|
||||
}
|
||||
@ -235,6 +233,14 @@ namespace TestCaseTracking {
|
||||
m_filters.insert( m_filters.end(), filters.begin()+1, filters.end() );
|
||||
}
|
||||
|
||||
std::vector<std::string> const& SectionTracker::getFilters() const {
|
||||
return m_filters;
|
||||
}
|
||||
|
||||
std::string const& SectionTracker::trimmedName() const {
|
||||
return m_trimmed_name;
|
||||
}
|
||||
|
||||
} // namespace TestCaseTracking
|
||||
|
||||
using TestCaseTracking::ITracker;
|
||||
|
@ -23,23 +23,39 @@ namespace TestCaseTracking {
|
||||
SourceLineInfo location;
|
||||
|
||||
NameAndLocation( std::string const& _name, SourceLineInfo const& _location );
|
||||
friend bool operator==(NameAndLocation const& lhs, NameAndLocation const& rhs) {
|
||||
return lhs.name == rhs.name
|
||||
&& lhs.location == rhs.location;
|
||||
}
|
||||
};
|
||||
|
||||
struct ITracker;
|
||||
class ITracker;
|
||||
|
||||
using ITrackerPtr = std::shared_ptr<ITracker>;
|
||||
|
||||
struct ITracker {
|
||||
virtual ~ITracker();
|
||||
class ITracker {
|
||||
NameAndLocation m_nameAndLocation;
|
||||
|
||||
public:
|
||||
ITracker(NameAndLocation const& nameAndLoc) :
|
||||
m_nameAndLocation(nameAndLoc)
|
||||
{}
|
||||
|
||||
|
||||
// static queries
|
||||
virtual NameAndLocation const& nameAndLocation() const = 0;
|
||||
NameAndLocation const& nameAndLocation() const {
|
||||
return m_nameAndLocation;
|
||||
}
|
||||
|
||||
virtual ~ITracker();
|
||||
|
||||
|
||||
// dynamic queries
|
||||
virtual bool isComplete() const = 0; // Successfully completed or failed
|
||||
virtual bool isSuccessfullyCompleted() const = 0;
|
||||
virtual bool isOpen() const = 0; // Started but not complete
|
||||
virtual bool hasChildren() const = 0;
|
||||
virtual bool hasStarted() const = 0;
|
||||
|
||||
virtual ITracker& parent() = 0;
|
||||
|
||||
@ -94,7 +110,6 @@ namespace TestCaseTracking {
|
||||
};
|
||||
|
||||
using Children = std::vector<ITrackerPtr>;
|
||||
NameAndLocation m_nameAndLocation;
|
||||
TrackerContext& m_ctx;
|
||||
ITracker* m_parent;
|
||||
Children m_children;
|
||||
@ -103,12 +118,13 @@ namespace TestCaseTracking {
|
||||
public:
|
||||
TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent );
|
||||
|
||||
NameAndLocation const& nameAndLocation() const override;
|
||||
bool isComplete() const override;
|
||||
bool isSuccessfullyCompleted() const override;
|
||||
bool isOpen() const override;
|
||||
bool hasChildren() const override;
|
||||
|
||||
bool hasStarted() const override {
|
||||
return m_runState != NotStarted;
|
||||
}
|
||||
|
||||
void addChild( ITrackerPtr const& child ) override;
|
||||
|
||||
@ -147,6 +163,10 @@ namespace TestCaseTracking {
|
||||
|
||||
void addInitialFilters( std::vector<std::string> const& filters );
|
||||
void addNextFilters( std::vector<std::string> const& filters );
|
||||
//! Returns filters active in this tracker
|
||||
std::vector<std::string> const& getFilters() const;
|
||||
//! Returns whitespace-trimmed name of the tracked section
|
||||
std::string const& trimmedName() const;
|
||||
};
|
||||
|
||||
} // namespace TestCaseTracking
|
||||
|
@ -71,34 +71,34 @@ struct AutoReg : NonCopyable {
|
||||
|
||||
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(Name, Tags, ...) \
|
||||
INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename TestType, __VA_ARGS__ )
|
||||
INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, typename TestType, __VA_ARGS__ )
|
||||
#else
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(Name, Tags, ...) \
|
||||
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename TestType, __VA_ARGS__ ) )
|
||||
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, typename TestType, __VA_ARGS__ ) )
|
||||
#endif
|
||||
|
||||
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(Name, Tags, Signature, ...) \
|
||||
INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ )
|
||||
INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, Signature, __VA_ARGS__ )
|
||||
#else
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(Name, Tags, Signature, ...) \
|
||||
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ ) )
|
||||
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, Signature, __VA_ARGS__ ) )
|
||||
#endif
|
||||
|
||||
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION( ClassName, Name, Tags,... ) \
|
||||
INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ )
|
||||
INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ )
|
||||
#else
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION( ClassName, Name, Tags,... ) \
|
||||
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) )
|
||||
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) )
|
||||
#endif
|
||||
|
||||
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION( ClassName, Name, Tags, Signature, ... ) \
|
||||
INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ )
|
||||
INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ )
|
||||
#else
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION( ClassName, Name, Tags, Signature, ... ) \
|
||||
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) )
|
||||
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) )
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -111,7 +111,7 @@ struct AutoReg : NonCopyable {
|
||||
CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \
|
||||
static void TestName()
|
||||
#define INTERNAL_CATCH_TESTCASE( ... ) \
|
||||
INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), __VA_ARGS__ )
|
||||
INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ), __VA_ARGS__ )
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \
|
||||
@ -133,7 +133,7 @@ struct AutoReg : NonCopyable {
|
||||
CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \
|
||||
void TestName::test()
|
||||
#define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... ) \
|
||||
INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, __VA_ARGS__ )
|
||||
INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ), ClassName, __VA_ARGS__ )
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \
|
||||
@ -160,7 +160,7 @@ struct AutoReg : NonCopyable {
|
||||
int index = 0; \
|
||||
constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\
|
||||
using expander = int[];\
|
||||
(void)expander{(reg_test(Types{}, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++, 0)... };/* NOLINT */ \
|
||||
(void)expander{(reg_test(Types{}, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++)... };/* NOLINT */ \
|
||||
}\
|
||||
};\
|
||||
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
|
||||
@ -174,18 +174,18 @@ struct AutoReg : NonCopyable {
|
||||
|
||||
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \
|
||||
INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename TestType, __VA_ARGS__ )
|
||||
INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, typename TestType, __VA_ARGS__ )
|
||||
#else
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \
|
||||
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename TestType, __VA_ARGS__ ) )
|
||||
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, typename TestType, __VA_ARGS__ ) )
|
||||
#endif
|
||||
|
||||
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG(Name, Tags, Signature, ...) \
|
||||
INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ )
|
||||
INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, Signature, __VA_ARGS__ )
|
||||
#else
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG(Name, Tags, Signature, ...) \
|
||||
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ ) )
|
||||
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, Signature, __VA_ARGS__ ) )
|
||||
#endif
|
||||
|
||||
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(TestName, TestFuncName, Name, Tags, Signature, TmplTypes, TypesList) \
|
||||
@ -206,7 +206,7 @@ struct AutoReg : NonCopyable {
|
||||
constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};\
|
||||
constexpr char const* types_list[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};\
|
||||
constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);\
|
||||
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFuncName<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + "<" + std::string(types_list[index % num_types]) + ">", Tags } ), index++, 0)... };/* NOLINT */\
|
||||
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFuncName<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + "<" + std::string(types_list[index % num_types]) + ">", Tags } ), index++)... };/* NOLINT */\
|
||||
} \
|
||||
}; \
|
||||
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \
|
||||
@ -223,18 +223,18 @@ struct AutoReg : NonCopyable {
|
||||
|
||||
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE(Name, Tags, ...)\
|
||||
INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename T,__VA_ARGS__)
|
||||
INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, typename T,__VA_ARGS__)
|
||||
#else
|
||||
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE(Name, Tags, ...)\
|
||||
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename T, __VA_ARGS__ ) )
|
||||
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, typename T, __VA_ARGS__ ) )
|
||||
#endif
|
||||
|
||||
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG(Name, Tags, Signature, ...)\
|
||||
INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__)
|
||||
INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, Signature, __VA_ARGS__)
|
||||
#else
|
||||
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG(Name, Tags, Signature, ...)\
|
||||
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ ) )
|
||||
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, Signature, __VA_ARGS__ ) )
|
||||
#endif
|
||||
|
||||
#define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2(TestName, TestFunc, Name, Tags, TmplList)\
|
||||
@ -250,7 +250,7 @@ struct AutoReg : NonCopyable {
|
||||
void reg_tests() { \
|
||||
int index = 0; \
|
||||
using expander = int[]; \
|
||||
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFunc<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + " - " + std::to_string(index), Tags } ), index++, 0)... };/* NOLINT */\
|
||||
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFunc<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + " - " + std::to_string(index), Tags } ), index++)... };/* NOLINT */\
|
||||
} \
|
||||
};\
|
||||
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \
|
||||
@ -265,7 +265,7 @@ struct AutoReg : NonCopyable {
|
||||
static void TestFunc()
|
||||
|
||||
#define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE(Name, Tags, TmplList) \
|
||||
INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, TmplList )
|
||||
INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, TmplList )
|
||||
|
||||
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, Signature, ... ) \
|
||||
@ -285,7 +285,7 @@ struct AutoReg : NonCopyable {
|
||||
int index = 0; \
|
||||
constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\
|
||||
using expander = int[];\
|
||||
(void)expander{(reg_test(Types{}, #ClassName, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++, 0)... };/* NOLINT */ \
|
||||
(void)expander{(reg_test(Types{}, #ClassName, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++)... };/* NOLINT */ \
|
||||
}\
|
||||
};\
|
||||
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
|
||||
@ -299,18 +299,18 @@ struct AutoReg : NonCopyable {
|
||||
|
||||
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \
|
||||
INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ )
|
||||
INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ )
|
||||
#else
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \
|
||||
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) )
|
||||
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) )
|
||||
#endif
|
||||
|
||||
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... ) \
|
||||
INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ )
|
||||
INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ )
|
||||
#else
|
||||
#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... ) \
|
||||
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) )
|
||||
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) )
|
||||
#endif
|
||||
|
||||
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2(TestNameClass, TestName, ClassName, Name, Tags, Signature, TmplTypes, TypesList)\
|
||||
@ -334,7 +334,7 @@ struct AutoReg : NonCopyable {
|
||||
constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};\
|
||||
constexpr char const* types_list[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};\
|
||||
constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);\
|
||||
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + "<" + std::string(types_list[index % num_types]) + ">", Tags } ), index++, 0)... };/* NOLINT */ \
|
||||
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + "<" + std::string(types_list[index % num_types]) + ">", Tags } ), index++)... };/* NOLINT */ \
|
||||
}\
|
||||
};\
|
||||
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
|
||||
@ -351,18 +351,18 @@ struct AutoReg : NonCopyable {
|
||||
|
||||
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( ClassName, Name, Tags, ... )\
|
||||
INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, typename T, __VA_ARGS__ )
|
||||
INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), ClassName, Name, Tags, typename T, __VA_ARGS__ )
|
||||
#else
|
||||
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( ClassName, Name, Tags, ... )\
|
||||
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, typename T,__VA_ARGS__ ) )
|
||||
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), ClassName, Name, Tags, typename T,__VA_ARGS__ ) )
|
||||
#endif
|
||||
|
||||
#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... )\
|
||||
INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, Signature, __VA_ARGS__ )
|
||||
INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), ClassName, Name, Tags, Signature, __VA_ARGS__ )
|
||||
#else
|
||||
#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... )\
|
||||
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, Signature,__VA_ARGS__ ) )
|
||||
INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), ClassName, Name, Tags, Signature,__VA_ARGS__ ) )
|
||||
#endif
|
||||
|
||||
#define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, TmplList) \
|
||||
@ -381,7 +381,7 @@ struct AutoReg : NonCopyable {
|
||||
void reg_tests(){\
|
||||
int index = 0;\
|
||||
using expander = int[];\
|
||||
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + " - " + std::to_string(index), Tags } ), index++, 0)... };/* NOLINT */ \
|
||||
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + " - " + std::to_string(index), Tags } ), index++)... };/* NOLINT */ \
|
||||
}\
|
||||
};\
|
||||
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
|
||||
@ -396,7 +396,7 @@ struct AutoReg : NonCopyable {
|
||||
void TestName<TestType>::test()
|
||||
|
||||
#define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD(ClassName, Name, Tags, TmplList) \
|
||||
INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, TmplList )
|
||||
INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), ClassName, Name, Tags, TmplList )
|
||||
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_TEST_REGISTRY_HPP_INCLUDED
|
||||
|
@ -309,8 +309,8 @@ namespace Catch {
|
||||
#endif
|
||||
|
||||
namespace Detail {
|
||||
template<typename InputIterator>
|
||||
std::string rangeToString(InputIterator first, InputIterator last) {
|
||||
template<typename InputIterator, typename Sentinel = InputIterator>
|
||||
std::string rangeToString(InputIterator first, Sentinel last) {
|
||||
ReusableStringStream rss;
|
||||
rss << "{ ";
|
||||
if (first != last) {
|
||||
@ -469,20 +469,27 @@ namespace Catch {
|
||||
#endif // CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER
|
||||
|
||||
namespace Catch {
|
||||
struct not_this_one {}; // Tag type for detecting which begin/ end are being selected
|
||||
|
||||
// Import begin/ end from std here so they are considered alongside the fallback (...) overloads in this namespace
|
||||
// Import begin/ end from std here
|
||||
using std::begin;
|
||||
using std::end;
|
||||
|
||||
not_this_one begin( ... );
|
||||
not_this_one end( ... );
|
||||
namespace detail {
|
||||
template <typename...>
|
||||
struct void_type {
|
||||
using type = void;
|
||||
};
|
||||
|
||||
template <typename T, typename = void>
|
||||
struct is_range_impl : std::false_type {
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct is_range_impl<T, typename void_type<decltype(begin(std::declval<T>()))>::type> : std::true_type {
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
template <typename T>
|
||||
struct is_range {
|
||||
static const bool value =
|
||||
!std::is_same<decltype(begin(std::declval<T>())), not_this_one>::value &&
|
||||
!std::is_same<decltype(end(std::declval<T>())), not_this_one>::value;
|
||||
struct is_range : detail::is_range_impl<T> {
|
||||
};
|
||||
|
||||
#if defined(_MANAGED) // Managed types are never ranges
|
||||
|
@ -8,11 +8,15 @@
|
||||
|
||||
#include "catch_compiler_capabilities.h"
|
||||
#include "catch_uncaught_exceptions.h"
|
||||
#include "catch_config_uncaught_exceptions.hpp"
|
||||
|
||||
#include <exception>
|
||||
|
||||
namespace Catch {
|
||||
bool uncaught_exceptions() {
|
||||
#if defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
|
||||
#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
|
||||
return false;
|
||||
#elif defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
|
||||
return std::uncaught_exceptions() > 0;
|
||||
#else
|
||||
return std::uncaught_exception();
|
||||
|
@ -37,7 +37,7 @@ namespace Catch {
|
||||
}
|
||||
|
||||
Version const& libraryVersion() {
|
||||
static Version version( 2, 12, 0, "", 0 );
|
||||
static Version version( 2, 13, 10, "", 0 );
|
||||
return version;
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,17 @@ namespace Catch {
|
||||
return std::string(buffer);
|
||||
}
|
||||
|
||||
bool shouldShowDuration( IConfig const& config, double duration ) {
|
||||
if ( config.showDurations() == ShowDurations::Always ) {
|
||||
return true;
|
||||
}
|
||||
if ( config.showDurations() == ShowDurations::Never ) {
|
||||
return false;
|
||||
}
|
||||
const double min = config.minDuration();
|
||||
return min >= 0 && duration >= min;
|
||||
}
|
||||
|
||||
std::string serializeFilters( std::vector<std::string> const& container ) {
|
||||
ReusableStringStream oss;
|
||||
bool first = true;
|
||||
|
@ -25,6 +25,9 @@ namespace Catch {
|
||||
// Returns double formatted as %.3f (format expected on output)
|
||||
std::string getFormattedDuration( double duration );
|
||||
|
||||
//! Should the reporter show
|
||||
bool shouldShowDuration( IConfig const& config, double duration );
|
||||
|
||||
std::string serializeFilters( std::vector<std::string> const& container );
|
||||
|
||||
template<typename DerivedT>
|
||||
@ -52,7 +55,7 @@ namespace Catch {
|
||||
void noMatchingTestCases(std::string const&) override {}
|
||||
|
||||
void reportInvalidArguments(std::string const&) override {}
|
||||
|
||||
|
||||
void testRunStarting(TestRunInfo const& _testRunInfo) override {
|
||||
currentTestRunInfo = _testRunInfo;
|
||||
}
|
||||
|
@ -245,10 +245,6 @@ private:
|
||||
return "Reports test results on a single line, suitable for IDEs";
|
||||
}
|
||||
|
||||
ReporterPreferences CompactReporter::getPreferences() const {
|
||||
return m_reporterPrefs;
|
||||
}
|
||||
|
||||
void CompactReporter::noMatchingTestCases( std::string const& spec ) {
|
||||
stream << "No test cases matched '" << spec << '\'' << std::endl;
|
||||
}
|
||||
@ -275,8 +271,9 @@ private:
|
||||
}
|
||||
|
||||
void CompactReporter::sectionEnded(SectionStats const& _sectionStats) {
|
||||
if (m_config->showDurations() == ShowDurations::Always) {
|
||||
stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl;
|
||||
double dur = _sectionStats.durationInSeconds;
|
||||
if ( shouldShowDuration( *m_config, dur ) ) {
|
||||
stream << getFormattedDuration( dur ) << " s: " << _sectionStats.sectionInfo.name << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,8 +22,6 @@ namespace Catch {
|
||||
|
||||
static std::string getDescription();
|
||||
|
||||
ReporterPreferences getPreferences() const override;
|
||||
|
||||
void noMatchingTestCases(std::string const& spec) override;
|
||||
|
||||
void assertionStarting(AssertionInfo const&) override;
|
||||
|
@ -418,8 +418,9 @@ void ConsoleReporter::sectionEnded(SectionStats const& _sectionStats) {
|
||||
stream << "\nNo assertions in test case";
|
||||
stream << " '" << _sectionStats.sectionInfo.name << "'\n" << std::endl;
|
||||
}
|
||||
if (m_config->showDurations() == ShowDurations::Always) {
|
||||
stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl;
|
||||
double dur = _sectionStats.durationInSeconds;
|
||||
if (shouldShowDuration(*m_config, dur)) {
|
||||
stream << getFormattedDuration(dur) << " s: " << _sectionStats.sectionInfo.name << std::endl;
|
||||
}
|
||||
if (m_headerPrinted) {
|
||||
m_headerPrinted = false;
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <sstream>
|
||||
#include <ctime>
|
||||
#include <algorithm>
|
||||
#include <iomanip>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
@ -45,7 +46,7 @@ namespace Catch {
|
||||
#else
|
||||
std::strftime(timeStamp, timeStampSize, fmt, timeInfo);
|
||||
#endif
|
||||
return std::string(timeStamp);
|
||||
return std::string(timeStamp, timeStampSize-1);
|
||||
}
|
||||
|
||||
std::string fileNameTag(const std::vector<std::string> &tags) {
|
||||
@ -56,6 +57,17 @@ namespace Catch {
|
||||
return it->substr(1);
|
||||
return std::string();
|
||||
}
|
||||
|
||||
// Formats the duration in seconds to 3 decimal places.
|
||||
// This is done because some genius defined Maven Surefire schema
|
||||
// in a way that only accepts 3 decimal places, and tools like
|
||||
// Jenkins use that schema for validation JUnit reporter output.
|
||||
std::string formatDuration( double seconds ) {
|
||||
ReusableStringStream rss;
|
||||
rss << std::fixed << std::setprecision( 3 ) << seconds;
|
||||
return rss.str();
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
JunitReporter::JunitReporter( ReporterConfig const& _config )
|
||||
@ -125,7 +137,7 @@ namespace Catch {
|
||||
if( m_config->showDurations() == ShowDurations::Never )
|
||||
xml.writeAttribute( "time", "" );
|
||||
else
|
||||
xml.writeAttribute( "time", suiteTime );
|
||||
xml.writeAttribute( "time", formatDuration( suiteTime ) );
|
||||
xml.writeAttribute( "timestamp", getCurrentTimestamp() );
|
||||
|
||||
// Write properties if there are any
|
||||
@ -170,12 +182,13 @@ namespace Catch {
|
||||
if ( !m_config->name().empty() )
|
||||
className = m_config->name() + "." + className;
|
||||
|
||||
writeSection( className, "", rootSection );
|
||||
writeSection( className, "", rootSection, stats.testInfo.okToFail() );
|
||||
}
|
||||
|
||||
void JunitReporter::writeSection( std::string const& className,
|
||||
std::string const& rootName,
|
||||
SectionNode const& sectionNode ) {
|
||||
void JunitReporter::writeSection( std::string const& className,
|
||||
std::string const& rootName,
|
||||
SectionNode const& sectionNode,
|
||||
bool testOkToFail) {
|
||||
std::string name = trim( sectionNode.stats.sectionInfo.name );
|
||||
if( !rootName.empty() )
|
||||
name = rootName + '/' + name;
|
||||
@ -192,10 +205,21 @@ namespace Catch {
|
||||
xml.writeAttribute( "classname", className );
|
||||
xml.writeAttribute( "name", name );
|
||||
}
|
||||
xml.writeAttribute( "time", ::Catch::Detail::stringify( sectionNode.stats.durationInSeconds ) );
|
||||
xml.writeAttribute( "time", formatDuration( sectionNode.stats.durationInSeconds ) );
|
||||
// This is not ideal, but it should be enough to mimic gtest's
|
||||
// junit output.
|
||||
// Ideally the JUnit reporter would also handle `skipTest`
|
||||
// events and write those out appropriately.
|
||||
xml.writeAttribute( "status", "run" );
|
||||
|
||||
if (sectionNode.stats.assertions.failedButOk) {
|
||||
xml.scopedElement("skipped")
|
||||
.writeAttribute("message", "TEST_CASE tagged with !mayfail");
|
||||
}
|
||||
|
||||
writeAssertions( sectionNode );
|
||||
|
||||
|
||||
if( !sectionNode.stdOut.empty() )
|
||||
xml.scopedElement( "system-out" ).writeText( trim( sectionNode.stdOut ), XmlFormatting::Newline );
|
||||
if( !sectionNode.stdErr.empty() )
|
||||
@ -203,9 +227,9 @@ namespace Catch {
|
||||
}
|
||||
for( auto const& childNode : sectionNode.childSections )
|
||||
if( className.empty() )
|
||||
writeSection( name, "", *childNode );
|
||||
writeSection( name, "", *childNode, testOkToFail );
|
||||
else
|
||||
writeSection( className, name, *childNode );
|
||||
writeSection( className, name, *childNode, testOkToFail );
|
||||
}
|
||||
|
||||
void JunitReporter::writeAssertions( SectionNode const& sectionNode ) {
|
||||
|
@ -41,9 +41,10 @@ namespace Catch {
|
||||
|
||||
void writeTestCase(TestCaseNode const& testCaseNode);
|
||||
|
||||
void writeSection(std::string const& className,
|
||||
std::string const& rootName,
|
||||
SectionNode const& sectionNode);
|
||||
void writeSection( std::string const& className,
|
||||
std::string const& rootName,
|
||||
SectionNode const& sectionNode,
|
||||
bool testOkToFail );
|
||||
|
||||
void writeAssertions(SectionNode const& sectionNode);
|
||||
void writeAssertion(AssertionStats const& stats);
|
||||
|
@ -23,16 +23,17 @@ namespace Catch {
|
||||
|
||||
using StreamingReporterBase::StreamingReporterBase;
|
||||
|
||||
TAPReporter( ReporterConfig const& config ):
|
||||
StreamingReporterBase( config ) {
|
||||
m_reporterPrefs.shouldReportAllAssertions = true;
|
||||
}
|
||||
|
||||
~TAPReporter() override;
|
||||
|
||||
static std::string getDescription() {
|
||||
return "Reports test results in TAP format, suitable for test harnesses";
|
||||
}
|
||||
|
||||
ReporterPreferences getPreferences() const override {
|
||||
return m_reporterPrefs;
|
||||
}
|
||||
|
||||
void noMatchingTestCases( std::string const& spec ) override {
|
||||
stream << "# No test cases matched '" << spec << "'" << std::endl;
|
||||
}
|
||||
@ -203,16 +204,15 @@ namespace Catch {
|
||||
return;
|
||||
}
|
||||
|
||||
// using messages.end() directly (or auto) yields compilation error:
|
||||
std::vector<MessageInfo>::const_iterator itEnd = messages.end();
|
||||
const std::size_t N = static_cast<std::size_t>( std::distance( itMessage, itEnd ) );
|
||||
const auto itEnd = messages.cend();
|
||||
const auto N = static_cast<std::size_t>( std::distance( itMessage, itEnd ) );
|
||||
|
||||
{
|
||||
Colour colourGuard( colour );
|
||||
stream << " with " << pluralise( N, "message" ) << ":";
|
||||
}
|
||||
|
||||
for(; itMessage != itEnd; ) {
|
||||
while( itMessage != itEnd ) {
|
||||
// If this assertion is a warning ignore any INFO messages
|
||||
if( printInfoMessages || itMessage->type != ResultWas::Info ) {
|
||||
stream << " '" << itMessage->message << "'";
|
||||
@ -220,7 +220,9 @@ namespace Catch {
|
||||
Colour colourGuard( dimColour() );
|
||||
stream << " and";
|
||||
}
|
||||
continue;
|
||||
}
|
||||
++itMessage;
|
||||
}
|
||||
}
|
||||
|
||||
@ -234,10 +236,9 @@ namespace Catch {
|
||||
};
|
||||
|
||||
void printTotals( const Totals& totals ) const {
|
||||
stream << "1.." << totals.assertions.total();
|
||||
if( totals.testCases.total() == 0 ) {
|
||||
stream << "1..0 # Skipped: No tests ran.";
|
||||
} else {
|
||||
stream << "1.." << counter;
|
||||
stream << " # Skipped: No tests ran.";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -207,6 +207,10 @@ namespace Catch {
|
||||
.writeAttribute( "successes", testGroupStats.totals.assertions.passed )
|
||||
.writeAttribute( "failures", testGroupStats.totals.assertions.failed )
|
||||
.writeAttribute( "expectedFailures", testGroupStats.totals.assertions.failedButOk );
|
||||
m_xml.scopedElement( "OverallResultsCases")
|
||||
.writeAttribute( "successes", testGroupStats.totals.testCases.passed )
|
||||
.writeAttribute( "failures", testGroupStats.totals.testCases.failed )
|
||||
.writeAttribute( "expectedFailures", testGroupStats.totals.testCases.failedButOk );
|
||||
m_xml.endElement();
|
||||
}
|
||||
|
||||
@ -216,6 +220,10 @@ namespace Catch {
|
||||
.writeAttribute( "successes", testRunStats.totals.assertions.passed )
|
||||
.writeAttribute( "failures", testRunStats.totals.assertions.failed )
|
||||
.writeAttribute( "expectedFailures", testRunStats.totals.assertions.failedButOk );
|
||||
m_xml.scopedElement( "OverallResultsCases")
|
||||
.writeAttribute( "successes", testRunStats.totals.testCases.passed )
|
||||
.writeAttribute( "failures", testRunStats.totals.testCases.failed )
|
||||
.writeAttribute( "expectedFailures", testRunStats.totals.testCases.failedButOk );
|
||||
m_xml.endElement();
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@ set(TEST_SOURCES
|
||||
${SELF_TEST_DIR}/IntrospectiveTests/StringManip.tests.cpp
|
||||
${SELF_TEST_DIR}/IntrospectiveTests/Xml.tests.cpp
|
||||
${SELF_TEST_DIR}/IntrospectiveTests/ToString.tests.cpp
|
||||
${SELF_TEST_DIR}/TimingTests/Sleep.tests.cpp
|
||||
${SELF_TEST_DIR}/UsageTests/Approx.tests.cpp
|
||||
${SELF_TEST_DIR}/UsageTests/BDD.tests.cpp
|
||||
${SELF_TEST_DIR}/UsageTests/Benchmark.tests.cpp
|
||||
@ -123,6 +124,7 @@ set(INTERNAL_HEADERS
|
||||
${HEADER_DIR}/internal/catch_common.h
|
||||
${HEADER_DIR}/internal/catch_compiler_capabilities.h
|
||||
${HEADER_DIR}/internal/catch_config.hpp
|
||||
${HEADER_DIR}/internal/catch_config_uncaught_exceptions.hpp
|
||||
${HEADER_DIR}/internal/catch_console_colour.h
|
||||
${HEADER_DIR}/internal/catch_context.h
|
||||
${HEADER_DIR}/internal/catch_debug_console.h
|
||||
@ -352,7 +354,7 @@ endif()
|
||||
if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang|GNU" )
|
||||
target_compile_options( SelfTest PRIVATE -Wall -Wextra -Wunreachable-code -Wpedantic -Wmissing-declarations )
|
||||
if (CATCH_ENABLE_WERROR)
|
||||
target_compile_options( SelfTest PRIVATE -Werror )
|
||||
target_compile_options( SelfTest PRIVATE -Werror -Wno-error=pragmas )
|
||||
endif()
|
||||
endif()
|
||||
# Clang specific options go here
|
||||
@ -417,6 +419,33 @@ set_tests_properties(FilteredSection-1 PROPERTIES FAIL_REGULAR_EXPRESSION "No te
|
||||
add_test(NAME FilteredSection-2 COMMAND $<TARGET_FILE:SelfTest> \#1394\ nested -c NestedRunSection -c s1)
|
||||
set_tests_properties(FilteredSection-2 PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran")
|
||||
|
||||
add_test(
|
||||
NAME
|
||||
FilteredSection::GeneratorsDontCauseInfiniteLoop-1
|
||||
COMMAND
|
||||
$<TARGET_FILE:SelfTest> "#2025: original repro" -c "fov_0"
|
||||
)
|
||||
set_tests_properties(FilteredSection::GeneratorsDontCauseInfiniteLoop-1
|
||||
PROPERTIES
|
||||
PASS_REGULAR_EXPRESSION "inside with fov: 0" # This should happen
|
||||
FAIL_REGULAR_EXPRESSION "inside with fov: 1" # This would mean there was no filtering
|
||||
)
|
||||
|
||||
# GENERATE between filtered sections (both are selected)
|
||||
add_test(
|
||||
NAME
|
||||
FilteredSection::GeneratorsDontCauseInfiniteLoop-2
|
||||
COMMAND
|
||||
$<TARGET_FILE:SelfTest> "#2025: same-level sections"
|
||||
-c "A"
|
||||
-c "B"
|
||||
)
|
||||
set_tests_properties(FilteredSection::GeneratorsDontCauseInfiniteLoop-2
|
||||
PROPERTIES
|
||||
PASS_REGULAR_EXPRESSION "All tests passed \\(4 assertions in 1 test case\\)"
|
||||
)
|
||||
|
||||
|
||||
# AppVeyor has a Python 2.7 in path, but doesn't have .py files as autorunnable
|
||||
add_test(NAME ApprovalTests COMMAND ${PYTHON_EXECUTABLE} ${CATCH_DIR}/scripts/approvalTests.py $<TARGET_FILE:SelfTest>)
|
||||
set_tests_properties(ApprovalTests PROPERTIES FAIL_REGULAR_EXPRESSION "Results differed")
|
||||
|
@ -10,6 +10,40 @@ project( Catch2ExtraTests LANGUAGES CXX )
|
||||
|
||||
message( STATUS "Extra tests included" )
|
||||
|
||||
# The MinDuration reporting tests do not need separate compilation, but
|
||||
# they have non-trivial execution time, so they are categorized as
|
||||
# extra tests, so that they are run less.
|
||||
add_test(NAME MinDuration::SimpleThreshold COMMAND $<TARGET_FILE:SelfTest> --min-duration 0.22 [min_duration_test])
|
||||
set_tests_properties(
|
||||
MinDuration::SimpleThreshold
|
||||
PROPERTIES
|
||||
PASS_REGULAR_EXPRESSION "s: sleep_for_250ms"
|
||||
FAIL_REGULAR_EXPRESSION "sleep_for_100ms"
|
||||
RUN_SERIAL ON # The test is timing sensitive, so we want to run it
|
||||
# serially to avoid false positives on oversubscribed machines
|
||||
)
|
||||
|
||||
# -d yes overrides the threshold, so we should see the faster test even
|
||||
# with a ridiculous high min duration threshold
|
||||
add_test(NAME MinDuration::DurationOverrideYes COMMAND $<TARGET_FILE:SelfTest> --min-duration 1.0 -d yes [min_duration_test])
|
||||
set_tests_properties(
|
||||
MinDuration::DurationOverrideYes
|
||||
PROPERTIES
|
||||
PASS_REGULAR_EXPRESSION "s: sleep_for_100ms"
|
||||
)
|
||||
|
||||
# -d no overrides the threshold, so we should never see any tests even
|
||||
# with ridiculously low min duration threshold
|
||||
add_test(NAME MinDuration::DurationOverrideNo COMMAND $<TARGET_FILE:SelfTest> --min-duration 0.0001 -d no [min_duration_test])
|
||||
set_tests_properties(
|
||||
MinDuration::DurationOverrideNo
|
||||
PROPERTIES
|
||||
FAIL_REGULAR_EXPRESSION "sleep_for_250ms"
|
||||
)
|
||||
|
||||
|
||||
# ------------ end of duration reporting tests
|
||||
|
||||
# define folders used:
|
||||
|
||||
set( TESTS_DIR ${CATCH_DIR}/projects/ExtraTests )
|
||||
|
@ -53,6 +53,7 @@ CATCH_TEST_CASE("PrefixedMacros") {
|
||||
CATCH_SECTION("some section") {
|
||||
int i = 1;
|
||||
CATCH_CAPTURE( i );
|
||||
CATCH_CAPTURE( i, i + 1 );
|
||||
CATCH_DYNAMIC_SECTION("Dynamic section: " << i) {
|
||||
CATCH_FAIL_CHECK( "failure" );
|
||||
}
|
||||
|
@ -26,6 +26,10 @@ foo f;
|
||||
|
||||
// This test should not be run, because it won't be registered
|
||||
TEST_CASE( "Disabled Macros" ) {
|
||||
|
||||
CAPTURE( 1 );
|
||||
CAPTURE( 1, "captured" );
|
||||
|
||||
std::cout << "This should not happen\n";
|
||||
FAIL();
|
||||
}
|
||||
|
@ -30,6 +30,57 @@ CmdLine.tests.cpp:<line number>: passed: spec.matches(fakeTestCase(R"(spec {a} c
|
||||
CmdLine.tests.cpp:<line number>: passed: spec.matches(fakeTestCase(R"(spec [a] char)")) for: true
|
||||
CmdLine.tests.cpp:<line number>: passed: !(spec.matches(fakeTestCase("differs but has similar tag", "[a]"))) for: !false
|
||||
CmdLine.tests.cpp:<line number>: passed: spec.matches(fakeTestCase(R"(spec \ char)")) for: true
|
||||
Generators.tests.cpp:<line number>: passed: counter < 7 for: 3 < 7
|
||||
Generators.tests.cpp:<line number>: passed: counter < 7 for: 6 < 7
|
||||
Generators.tests.cpp:<line number>: passed: i != j for: 1 != 3
|
||||
Generators.tests.cpp:<line number>: passed: i != j for: 1 != 4
|
||||
Generators.tests.cpp:<line number>: passed: i != j for: 2 != 3
|
||||
Generators.tests.cpp:<line number>: passed: i != j for: 2 != 4
|
||||
PartTracker.tests.cpp:<line number>: passed: with 1 message: 'A'
|
||||
PartTracker.tests.cpp:<line number>: passed: m for: 1
|
||||
PartTracker.tests.cpp:<line number>: passed: m for: 2
|
||||
PartTracker.tests.cpp:<line number>: passed: m for: 3
|
||||
PartTracker.tests.cpp:<line number>: passed: 1
|
||||
PartTracker.tests.cpp:<line number>: passed: m for: 2
|
||||
PartTracker.tests.cpp:<line number>: passed: m for: 3
|
||||
PartTracker.tests.cpp:<line number>: passed: m for: 1
|
||||
PartTracker.tests.cpp:<line number>: passed: m for: 2
|
||||
PartTracker.tests.cpp:<line number>: passed: m for: 3
|
||||
PartTracker.tests.cpp:<line number>: passed: with 1 message: 'A'
|
||||
PartTracker.tests.cpp:<line number>: passed: with 3 messages: 'i := 1' and 'j := 3' and 'k := 5'
|
||||
PartTracker.tests.cpp:<line number>: passed: with 1 message: 'B'
|
||||
PartTracker.tests.cpp:<line number>: passed: with 3 messages: 'i := 1' and 'j := 3' and 'k := 6'
|
||||
PartTracker.tests.cpp:<line number>: passed: with 1 message: 'B'
|
||||
PartTracker.tests.cpp:<line number>: passed: with 3 messages: 'i := 1' and 'j := 4' and 'k := 5'
|
||||
PartTracker.tests.cpp:<line number>: passed: with 3 messages: 'i := 1' and 'j := 4' and 'k := 6'
|
||||
PartTracker.tests.cpp:<line number>: passed: with 1 message: 'A'
|
||||
PartTracker.tests.cpp:<line number>: passed: with 3 messages: 'i := 2' and 'j := 3' and 'k := 5'
|
||||
PartTracker.tests.cpp:<line number>: passed: with 1 message: 'B'
|
||||
PartTracker.tests.cpp:<line number>: passed: with 3 messages: 'i := 2' and 'j := 3' and 'k := 6'
|
||||
PartTracker.tests.cpp:<line number>: passed: with 1 message: 'B'
|
||||
PartTracker.tests.cpp:<line number>: passed: with 3 messages: 'i := 2' and 'j := 4' and 'k := 5'
|
||||
PartTracker.tests.cpp:<line number>: passed: with 3 messages: 'i := 2' and 'j := 4' and 'k := 6'
|
||||
PartTracker.tests.cpp:<line number>: passed: m for: 1
|
||||
PartTracker.tests.cpp:<line number>: passed: n for: 1
|
||||
PartTracker.tests.cpp:<line number>: passed: m for: 1
|
||||
PartTracker.tests.cpp:<line number>: passed: n for: 2
|
||||
PartTracker.tests.cpp:<line number>: passed: m for: 1
|
||||
PartTracker.tests.cpp:<line number>: passed: n for: 3
|
||||
PartTracker.tests.cpp:<line number>: passed: m for: 2
|
||||
PartTracker.tests.cpp:<line number>: passed: n for: 1
|
||||
PartTracker.tests.cpp:<line number>: passed: m for: 2
|
||||
PartTracker.tests.cpp:<line number>: passed: n for: 2
|
||||
PartTracker.tests.cpp:<line number>: passed: m for: 2
|
||||
PartTracker.tests.cpp:<line number>: passed: n for: 3
|
||||
PartTracker.tests.cpp:<line number>: passed: m for: 3
|
||||
PartTracker.tests.cpp:<line number>: passed: n for: 1
|
||||
PartTracker.tests.cpp:<line number>: passed: m for: 3
|
||||
PartTracker.tests.cpp:<line number>: passed: n for: 2
|
||||
PartTracker.tests.cpp:<line number>: passed: m for: 3
|
||||
PartTracker.tests.cpp:<line number>: passed: n for: 3
|
||||
Misc.tests.cpp:<line number>: passed:
|
||||
Misc.tests.cpp:<line number>: passed:
|
||||
Misc.tests.cpp:<line number>: passed:
|
||||
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'answer := 42' with 1 message: 'expected exception'
|
||||
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'answer := 42'; expression was: thisThrows() with 1 message: 'expected exception'
|
||||
Exception.tests.cpp:<line number>: passed: thisThrows() with 1 message: 'answer := 42'
|
||||
@ -247,6 +298,8 @@ Matchers.tests.cpp:<line number>: passed: "This wouldn't pass", !Predicate<std::
|
||||
Compilation.tests.cpp:<line number>: passed: lhs | rhs for: Val: 1 | Val: 2
|
||||
Compilation.tests.cpp:<line number>: passed: !(lhs & rhs) for: !(Val: 1 & Val: 2)
|
||||
Compilation.tests.cpp:<line number>: passed: HasBitOperators{ 1 } & HasBitOperators{ 1 } for: Val: 1 & Val: 1
|
||||
Compilation.tests.cpp:<line number>: passed: lhs ^ rhs for: Val: 1 ^ Val: 2
|
||||
Compilation.tests.cpp:<line number>: passed: !(lhs ^ lhs) for: !(Val: 1 ^ Val: 1)
|
||||
Tricky.tests.cpp:<line number>: passed: true
|
||||
Tricky.tests.cpp:<line number>: passed: true
|
||||
Tricky.tests.cpp:<line number>: passed: true
|
||||
@ -324,6 +377,12 @@ Condition.tests.cpp:<line number>: passed: 6 == uc for: 6 == 6
|
||||
Condition.tests.cpp:<line number>: passed: (std::numeric_limits<uint32_t>::max)() > ul for: 4294967295 (0x<hex digits>) > 4
|
||||
Matchers.tests.cpp:<line number>: passed: testStringForMatching2(), !composed1 for: "some completely different text that contains one common word" not ( contains: "string" or contains: "random" )
|
||||
Matchers.tests.cpp:<line number>: passed: testStringForMatching2(), composed2 for: "some completely different text that contains one common word" ( contains: "string" or contains: "random" or contains: "different" )
|
||||
Matchers.tests.cpp:<line number>: passed: 1, !(first && second) for: 1 not ( CheckedTestingMatcher set to fail and CheckedTestingMatcher set to fail )
|
||||
Matchers.tests.cpp:<line number>: passed: first.matchCalled for: true
|
||||
Matchers.tests.cpp:<line number>: passed: !second.matchCalled for: true
|
||||
Matchers.tests.cpp:<line number>: passed: 1, first || second for: 1 ( CheckedTestingMatcher set to succeed or CheckedTestingMatcher set to fail )
|
||||
Matchers.tests.cpp:<line number>: passed: first.matchCalled for: true
|
||||
Matchers.tests.cpp:<line number>: passed: !second.matchCalled for: true
|
||||
Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Contains("not there", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" contains: "not there" (case insensitive)
|
||||
Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Contains("STRING") for: "this string contains 'abc' as a substring" contains: "STRING"
|
||||
Generators.tests.cpp:<line number>: passed: elem % 2 == 1 for: 1 == 1
|
||||
@ -569,6 +628,7 @@ GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true
|
||||
GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 3 for: 3 == 3
|
||||
GeneratorsImpl.tests.cpp:<line number>: passed: !(gen.next()) for: !false
|
||||
GeneratorsImpl.tests.cpp:<line number>: passed: filter([] (int) { return false; }, value(1)), Catch::GeneratorException
|
||||
GeneratorsImpl.tests.cpp:<line number>: passed: filter( []( int ) { return false; }, values( { 1, 2, 3 } ) ), Catch::GeneratorException
|
||||
GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 1 for: 1 == 1
|
||||
GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true
|
||||
GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 2 for: 2 == 2
|
||||
@ -787,6 +847,10 @@ Matchers.tests.cpp:<line number>: passed: testStringForMatching(), (Contains("st
|
||||
Matchers.tests.cpp:<line number>: failed: testStringForMatching(), (Contains("string") || Contains("different")) && Contains("random") for: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" )
|
||||
Matchers.tests.cpp:<line number>: passed: testStringForMatching(), !Contains("different") for: "this string contains 'abc' as a substring" not contains: "different"
|
||||
Matchers.tests.cpp:<line number>: failed: testStringForMatching(), !Contains("substring") for: "this string contains 'abc' as a substring" not contains: "substring"
|
||||
Condition.tests.cpp:<line number>: failed: explicitly
|
||||
Condition.tests.cpp:<line number>: failed: explicitly
|
||||
Condition.tests.cpp:<line number>: failed: explicitly
|
||||
Condition.tests.cpp:<line number>: failed: explicitly
|
||||
Exception.tests.cpp:<line number>: passed: thisThrows(), "expected exception" for: "expected exception" equals: "expected exception"
|
||||
Exception.tests.cpp:<line number>: failed: thisThrows(), "should fail" for: "expected exception" equals: "should fail"
|
||||
Generators.tests.cpp:<line number>: passed: values > -6 for: 3 > -6
|
||||
@ -1144,6 +1208,7 @@ CmdLine.tests.cpp:<line number>: passed: config.benchmarkWarmupTime == 10 for: 1
|
||||
Misc.tests.cpp:<line number>: passed: std::tuple_size<TestType>::value >= 1 for: 3 >= 1
|
||||
Misc.tests.cpp:<line number>: passed: std::tuple_size<TestType>::value >= 1 for: 2 >= 1
|
||||
Misc.tests.cpp:<line number>: passed: std::tuple_size<TestType>::value >= 1 for: 1 >= 1
|
||||
ToString.tests.cpp:<line number>: passed: Catch::Detail::stringify(UsesSentinel{}) == "{ }" for: "{ }" == "{ }"
|
||||
Decomposition.tests.cpp:<line number>: failed: truthy(false) for: Hey, its truthy!
|
||||
Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Matches("this STRING contains 'abc' as a substring") for: "this string contains 'abc' as a substring" matches "this STRING contains 'abc' as a substring" case sensitively
|
||||
Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Matches("contains 'abc' as a substring") for: "this string contains 'abc' as a substring" matches "contains 'abc' as a substring" case sensitively
|
||||
@ -1529,6 +1594,7 @@ Approx.tests.cpp:<line number>: passed: approx( d ) != 1.25 for: Approx( 1.23 )
|
||||
VariadicMacros.tests.cpp:<line number>: passed: with 1 message: 'no assertions'
|
||||
Matchers.tests.cpp:<line number>: passed: empty, Approx(empty) for: { } is approx: { }
|
||||
Matchers.tests.cpp:<line number>: passed: v1, Approx(v1) for: { 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 }
|
||||
Matchers.tests.cpp:<line number>: passed: v1, Approx<double>({ 1., 2., 3. }) for: { 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 }
|
||||
Matchers.tests.cpp:<line number>: passed: v1, !Approx(temp) for: { 1.0, 2.0, 3.0 } not is approx: { 1.0, 2.0, 3.0, 4.0 }
|
||||
Matchers.tests.cpp:<line number>: passed: v1, !Approx(v2) for: { 1.0, 2.0, 3.0 } not is approx: { 1.5, 2.5, 3.5 }
|
||||
Matchers.tests.cpp:<line number>: passed: v1, Approx(v2).margin(0.5) for: { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 }
|
||||
@ -1540,6 +1606,7 @@ Matchers.tests.cpp:<line number>: passed: v, VectorContains(1) for: { 1, 2, 3 }
|
||||
Matchers.tests.cpp:<line number>: passed: v, VectorContains(2) for: { 1, 2, 3 } Contains: 2
|
||||
Matchers.tests.cpp:<line number>: passed: v5, (VectorContains<int, CustomAllocator<int>>(2)) for: { 1, 2, 3 } Contains: 2
|
||||
Matchers.tests.cpp:<line number>: passed: v, Contains(v2) for: { 1, 2, 3 } Contains: { 1, 2 }
|
||||
Matchers.tests.cpp:<line number>: passed: v, Contains<int>({ 1, 2 }) for: { 1, 2, 3 } Contains: { 1, 2 }
|
||||
Matchers.tests.cpp:<line number>: passed: v5, (Contains<int, std::allocator<int>, CustomAllocator<int>>(v2)) for: { 1, 2, 3 } Contains: { 1, 2 }
|
||||
Matchers.tests.cpp:<line number>: passed: v, Contains(v2) for: { 1, 2, 3 } Contains: { 1, 2, 3 }
|
||||
Matchers.tests.cpp:<line number>: passed: v, Contains(empty) for: { 1, 2, 3 } Contains: { }
|
||||
@ -1549,10 +1616,12 @@ Matchers.tests.cpp:<line number>: passed: v5, Contains(v6) for: { 1, 2, 3 } Cont
|
||||
Matchers.tests.cpp:<line number>: passed: v, VectorContains(1) && VectorContains(2) for: { 1, 2, 3 } ( Contains: 1 and Contains: 2 )
|
||||
Matchers.tests.cpp:<line number>: passed: v, Equals(v) for: { 1, 2, 3 } Equals: { 1, 2, 3 }
|
||||
Matchers.tests.cpp:<line number>: passed: empty, Equals(empty) for: { } Equals: { }
|
||||
Matchers.tests.cpp:<line number>: passed: v, Equals<int>({ 1, 2, 3 }) for: { 1, 2, 3 } Equals: { 1, 2, 3 }
|
||||
Matchers.tests.cpp:<line number>: passed: v, Equals(v2) for: { 1, 2, 3 } Equals: { 1, 2, 3 }
|
||||
Matchers.tests.cpp:<line number>: passed: v5, (Equals<int, std::allocator<int>, CustomAllocator<int>>(v2)) for: { 1, 2, 3 } Equals: { 1, 2, 3 }
|
||||
Matchers.tests.cpp:<line number>: passed: v5, Equals(v6) for: { 1, 2, 3 } Equals: { 1, 2, 3 }
|
||||
Matchers.tests.cpp:<line number>: passed: v, UnorderedEquals(v) for: { 1, 2, 3 } UnorderedEquals: { 1, 2, 3 }
|
||||
Matchers.tests.cpp:<line number>: passed: v, UnorderedEquals<int>({ 3, 2, 1 }) for: { 1, 2, 3 } UnorderedEquals: { 3, 2, 1 }
|
||||
Matchers.tests.cpp:<line number>: passed: empty, UnorderedEquals(empty) for: { } UnorderedEquals: { }
|
||||
Matchers.tests.cpp:<line number>: passed: permuted, UnorderedEquals(v) for: { 1, 3, 2 } UnorderedEquals: { 1, 2, 3 }
|
||||
Matchers.tests.cpp:<line number>: passed: permuted, UnorderedEquals(v) for: { 2, 3, 1 } UnorderedEquals: { 1, 2, 3 }
|
||||
|
@ -694,6 +694,46 @@ Matchers.tests.cpp:<line number>: FAILED:
|
||||
with expansion:
|
||||
"this string contains 'abc' as a substring" not contains: "substring"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Mayfail test case with nested sections
|
||||
A
|
||||
1
|
||||
-------------------------------------------------------------------------------
|
||||
Condition.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Condition.tests.cpp:<line number>: FAILED:
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Mayfail test case with nested sections
|
||||
A
|
||||
2
|
||||
-------------------------------------------------------------------------------
|
||||
Condition.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Condition.tests.cpp:<line number>: FAILED:
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Mayfail test case with nested sections
|
||||
B
|
||||
1
|
||||
-------------------------------------------------------------------------------
|
||||
Condition.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Condition.tests.cpp:<line number>: FAILED:
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Mayfail test case with nested sections
|
||||
B
|
||||
2
|
||||
-------------------------------------------------------------------------------
|
||||
Condition.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Condition.tests.cpp:<line number>: FAILED:
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Mismatching exception messages failing the test
|
||||
-------------------------------------------------------------------------------
|
||||
@ -1380,6 +1420,6 @@ due to unexpected exception with message:
|
||||
Why would you throw a std::string?
|
||||
|
||||
===============================================================================
|
||||
test cases: 310 | 236 passed | 70 failed | 4 failed as expected
|
||||
assertions: 1695 | 1543 passed | 131 failed | 21 failed as expected
|
||||
test cases: 323 | 248 passed | 70 failed | 5 failed as expected
|
||||
assertions: 1764 | 1608 passed | 131 failed | 25 failed as expected
|
||||
|
||||
|
@ -243,6 +243,514 @@ CmdLine.tests.cpp:<line number>: PASSED:
|
||||
with expansion:
|
||||
true
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1913 - GENERATE inside a for loop should not keep recreating the generator
|
||||
-------------------------------------------------------------------------------
|
||||
Generators.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Generators.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( counter < 7 )
|
||||
with expansion:
|
||||
3 < 7
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1913 - GENERATE inside a for loop should not keep recreating the generator
|
||||
-------------------------------------------------------------------------------
|
||||
Generators.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Generators.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( counter < 7 )
|
||||
with expansion:
|
||||
6 < 7
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1913 - GENERATEs can share a line
|
||||
-------------------------------------------------------------------------------
|
||||
Generators.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Generators.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( i != j )
|
||||
with expansion:
|
||||
1 != 3
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1913 - GENERATEs can share a line
|
||||
-------------------------------------------------------------------------------
|
||||
Generators.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Generators.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( i != j )
|
||||
with expansion:
|
||||
1 != 4
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1913 - GENERATEs can share a line
|
||||
-------------------------------------------------------------------------------
|
||||
Generators.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Generators.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( i != j )
|
||||
with expansion:
|
||||
2 != 3
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1913 - GENERATEs can share a line
|
||||
-------------------------------------------------------------------------------
|
||||
Generators.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Generators.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( i != j )
|
||||
with expansion:
|
||||
2 != 4
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - GENERATE after a section
|
||||
A
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
A
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - GENERATE after a section
|
||||
B
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
1
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - GENERATE after a section
|
||||
B
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
2
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - GENERATE after a section
|
||||
B
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
3
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - Section followed by flat generate
|
||||
A
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( 1 )
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - Section followed by flat generate
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
2
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - Section followed by flat generate
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
3
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - flat generate
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
1
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - flat generate
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
2
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - flat generate
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
3
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - mixed sections and generates
|
||||
A
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
A
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - mixed sections and generates
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with messages:
|
||||
i := 1
|
||||
j := 3
|
||||
k := 5
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - mixed sections and generates
|
||||
B
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
B
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - mixed sections and generates
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with messages:
|
||||
i := 1
|
||||
j := 3
|
||||
k := 6
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - mixed sections and generates
|
||||
B
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
B
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - mixed sections and generates
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with messages:
|
||||
i := 1
|
||||
j := 4
|
||||
k := 5
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - mixed sections and generates
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with messages:
|
||||
i := 1
|
||||
j := 4
|
||||
k := 6
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - mixed sections and generates
|
||||
A
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
A
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - mixed sections and generates
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with messages:
|
||||
i := 2
|
||||
j := 3
|
||||
k := 5
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - mixed sections and generates
|
||||
B
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
B
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - mixed sections and generates
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with messages:
|
||||
i := 2
|
||||
j := 3
|
||||
k := 6
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - mixed sections and generates
|
||||
B
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
B
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - mixed sections and generates
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with messages:
|
||||
i := 2
|
||||
j := 4
|
||||
k := 5
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - mixed sections and generates
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with messages:
|
||||
i := 2
|
||||
j := 4
|
||||
k := 6
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - nested generate
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
1
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( n )
|
||||
with expansion:
|
||||
1
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - nested generate
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
1
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( n )
|
||||
with expansion:
|
||||
2
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - nested generate
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
1
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( n )
|
||||
with expansion:
|
||||
3
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - nested generate
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
2
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( n )
|
||||
with expansion:
|
||||
1
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - nested generate
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
2
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( n )
|
||||
with expansion:
|
||||
2
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - nested generate
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
2
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( n )
|
||||
with expansion:
|
||||
3
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - nested generate
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
3
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( n )
|
||||
with expansion:
|
||||
1
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - nested generate
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
3
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( n )
|
||||
with expansion:
|
||||
2
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - nested generate
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
3
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( n )
|
||||
with expansion:
|
||||
3
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1954 - 7 arg template test case sig compiles - 1, 1, 1, 1, 1, 0, 0
|
||||
-------------------------------------------------------------------------------
|
||||
Misc.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Misc.tests.cpp:<line number>: PASSED:
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1954 - 7 arg template test case sig compiles - 5, 1, 1, 1, 1, 0, 0
|
||||
-------------------------------------------------------------------------------
|
||||
Misc.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Misc.tests.cpp:<line number>: PASSED:
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1954 - 7 arg template test case sig compiles - 5, 3, 1, 1, 1, 0, 0
|
||||
-------------------------------------------------------------------------------
|
||||
Misc.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Misc.tests.cpp:<line number>: PASSED:
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#748 - captures with unexpected exceptions
|
||||
outside assertions
|
||||
@ -1955,6 +2463,16 @@ Compilation.tests.cpp:<line number>: PASSED:
|
||||
with expansion:
|
||||
Val: 1 & Val: 1
|
||||
|
||||
Compilation.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( lhs ^ rhs )
|
||||
with expansion:
|
||||
Val: 1 ^ Val: 2
|
||||
|
||||
Compilation.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE_FALSE( lhs ^ lhs )
|
||||
with expansion:
|
||||
!(Val: 1 ^ Val: 1)
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Assertions then sections
|
||||
-------------------------------------------------------------------------------
|
||||
@ -2484,6 +3002,52 @@ with expansion:
|
||||
"some completely different text that contains one common word" ( contains:
|
||||
"string" or contains: "random" or contains: "different" )
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Composed matchers shortcircuit
|
||||
&&
|
||||
-------------------------------------------------------------------------------
|
||||
Matchers.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Matchers.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( 1, !(first && second) )
|
||||
with expansion:
|
||||
1 not ( CheckedTestingMatcher set to fail and CheckedTestingMatcher set to
|
||||
fail )
|
||||
|
||||
Matchers.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( first.matchCalled )
|
||||
with expansion:
|
||||
true
|
||||
|
||||
Matchers.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( !second.matchCalled )
|
||||
with expansion:
|
||||
true
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Composed matchers shortcircuit
|
||||
||
|
||||
-------------------------------------------------------------------------------
|
||||
Matchers.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Matchers.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( 1, first || second )
|
||||
with expansion:
|
||||
1 ( CheckedTestingMatcher set to succeed or CheckedTestingMatcher set to fail
|
||||
)
|
||||
|
||||
Matchers.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( first.matchCalled )
|
||||
with expansion:
|
||||
true
|
||||
|
||||
Matchers.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( !second.matchCalled )
|
||||
with expansion:
|
||||
true
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Contains string matcher
|
||||
-------------------------------------------------------------------------------
|
||||
@ -4404,6 +4968,9 @@ with expansion:
|
||||
GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE_THROWS_AS( filter([] (int) { return false; }, value(1)), Catch::GeneratorException )
|
||||
|
||||
GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE_THROWS_AS( filter( []( int ) { return false; }, values( { 1, 2, 3 } ) ), Catch::GeneratorException )
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Generators internals
|
||||
Take generator
|
||||
@ -5928,6 +6495,46 @@ Matchers.tests.cpp:<line number>: FAILED:
|
||||
with expansion:
|
||||
"this string contains 'abc' as a substring" not contains: "substring"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Mayfail test case with nested sections
|
||||
A
|
||||
1
|
||||
-------------------------------------------------------------------------------
|
||||
Condition.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Condition.tests.cpp:<line number>: FAILED:
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Mayfail test case with nested sections
|
||||
A
|
||||
2
|
||||
-------------------------------------------------------------------------------
|
||||
Condition.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Condition.tests.cpp:<line number>: FAILED:
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Mayfail test case with nested sections
|
||||
B
|
||||
1
|
||||
-------------------------------------------------------------------------------
|
||||
Condition.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Condition.tests.cpp:<line number>: FAILED:
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Mayfail test case with nested sections
|
||||
B
|
||||
2
|
||||
-------------------------------------------------------------------------------
|
||||
Condition.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Condition.tests.cpp:<line number>: FAILED:
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Mismatching exception messages failing the test
|
||||
-------------------------------------------------------------------------------
|
||||
@ -8331,6 +8938,17 @@ Misc.tests.cpp:<line number>: PASSED:
|
||||
with expansion:
|
||||
1 >= 1
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Range type with sentinel
|
||||
-------------------------------------------------------------------------------
|
||||
ToString.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
ToString.tests.cpp:<line number>: PASSED:
|
||||
CHECK( Catch::Detail::stringify(UsesSentinel{}) == "{ }" )
|
||||
with expansion:
|
||||
"{ }" == "{ }"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Reconstruction should be based on stringification: #914
|
||||
-------------------------------------------------------------------------------
|
||||
@ -11177,6 +11795,11 @@ Matchers.tests.cpp:<line number>: PASSED:
|
||||
with expansion:
|
||||
{ 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 }
|
||||
|
||||
Matchers.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE_THAT( v1, Approx<double>({ 1., 2., 3. }) )
|
||||
with expansion:
|
||||
{ 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 }
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Vector Approx matcher
|
||||
Vectors with elements
|
||||
@ -11276,6 +11899,11 @@ Matchers.tests.cpp:<line number>: PASSED:
|
||||
with expansion:
|
||||
{ 1, 2, 3 } Contains: { 1, 2 }
|
||||
|
||||
Matchers.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( v, Contains<int>({ 1, 2 }) )
|
||||
with expansion:
|
||||
{ 1, 2, 3 } Contains: { 1, 2 }
|
||||
|
||||
Matchers.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( v5, (Contains<int, std::allocator<int>, CustomAllocator<int>>(v2)) )
|
||||
with expansion:
|
||||
@ -11335,6 +11963,11 @@ Matchers.tests.cpp:<line number>: PASSED:
|
||||
with expansion:
|
||||
{ } Equals: { }
|
||||
|
||||
Matchers.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( v, Equals<int>({ 1, 2, 3 }) )
|
||||
with expansion:
|
||||
{ 1, 2, 3 } Equals: { 1, 2, 3 }
|
||||
|
||||
Matchers.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( v, Equals(v2) )
|
||||
with expansion:
|
||||
@ -11362,6 +11995,11 @@ Matchers.tests.cpp:<line number>: PASSED:
|
||||
with expansion:
|
||||
{ 1, 2, 3 } UnorderedEquals: { 1, 2, 3 }
|
||||
|
||||
Matchers.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( v, UnorderedEquals<int>({ 3, 2, 1 }) )
|
||||
with expansion:
|
||||
{ 1, 2, 3 } UnorderedEquals: { 3, 2, 1 }
|
||||
|
||||
Matchers.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( empty, UnorderedEquals(empty) )
|
||||
with expansion:
|
||||
@ -13543,6 +14181,6 @@ Misc.tests.cpp:<line number>
|
||||
Misc.tests.cpp:<line number>: PASSED:
|
||||
|
||||
===============================================================================
|
||||
test cases: 310 | 220 passed | 86 failed | 4 failed as expected
|
||||
assertions: 1712 | 1543 passed | 148 failed | 21 failed as expected
|
||||
test cases: 323 | 232 passed | 86 failed | 5 failed as expected
|
||||
assertions: 1781 | 1608 passed | 148 failed | 25 failed as expected
|
||||
|
||||
|
@ -243,6 +243,514 @@ CmdLine.tests.cpp:<line number>: PASSED:
|
||||
with expansion:
|
||||
true
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1913 - GENERATE inside a for loop should not keep recreating the generator
|
||||
-------------------------------------------------------------------------------
|
||||
Generators.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Generators.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( counter < 7 )
|
||||
with expansion:
|
||||
3 < 7
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1913 - GENERATE inside a for loop should not keep recreating the generator
|
||||
-------------------------------------------------------------------------------
|
||||
Generators.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Generators.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( counter < 7 )
|
||||
with expansion:
|
||||
6 < 7
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1913 - GENERATEs can share a line
|
||||
-------------------------------------------------------------------------------
|
||||
Generators.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Generators.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( i != j )
|
||||
with expansion:
|
||||
1 != 3
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1913 - GENERATEs can share a line
|
||||
-------------------------------------------------------------------------------
|
||||
Generators.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Generators.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( i != j )
|
||||
with expansion:
|
||||
1 != 4
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1913 - GENERATEs can share a line
|
||||
-------------------------------------------------------------------------------
|
||||
Generators.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Generators.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( i != j )
|
||||
with expansion:
|
||||
2 != 3
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1913 - GENERATEs can share a line
|
||||
-------------------------------------------------------------------------------
|
||||
Generators.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Generators.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( i != j )
|
||||
with expansion:
|
||||
2 != 4
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - GENERATE after a section
|
||||
A
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
A
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - GENERATE after a section
|
||||
B
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
1
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - GENERATE after a section
|
||||
B
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
2
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - GENERATE after a section
|
||||
B
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
3
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - Section followed by flat generate
|
||||
A
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( 1 )
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - Section followed by flat generate
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
2
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - Section followed by flat generate
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
3
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - flat generate
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
1
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - flat generate
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
2
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - flat generate
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
3
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - mixed sections and generates
|
||||
A
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
A
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - mixed sections and generates
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with messages:
|
||||
i := 1
|
||||
j := 3
|
||||
k := 5
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - mixed sections and generates
|
||||
B
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
B
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - mixed sections and generates
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with messages:
|
||||
i := 1
|
||||
j := 3
|
||||
k := 6
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - mixed sections and generates
|
||||
B
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
B
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - mixed sections and generates
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with messages:
|
||||
i := 1
|
||||
j := 4
|
||||
k := 5
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - mixed sections and generates
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with messages:
|
||||
i := 1
|
||||
j := 4
|
||||
k := 6
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - mixed sections and generates
|
||||
A
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
A
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - mixed sections and generates
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with messages:
|
||||
i := 2
|
||||
j := 3
|
||||
k := 5
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - mixed sections and generates
|
||||
B
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
B
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - mixed sections and generates
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with messages:
|
||||
i := 2
|
||||
j := 3
|
||||
k := 6
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - mixed sections and generates
|
||||
B
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
B
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - mixed sections and generates
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with messages:
|
||||
i := 2
|
||||
j := 4
|
||||
k := 5
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - mixed sections and generates
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
with messages:
|
||||
i := 2
|
||||
j := 4
|
||||
k := 6
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - nested generate
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
1
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( n )
|
||||
with expansion:
|
||||
1
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - nested generate
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
1
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( n )
|
||||
with expansion:
|
||||
2
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - nested generate
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
1
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( n )
|
||||
with expansion:
|
||||
3
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - nested generate
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
2
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( n )
|
||||
with expansion:
|
||||
1
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - nested generate
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
2
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( n )
|
||||
with expansion:
|
||||
2
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - nested generate
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
2
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( n )
|
||||
with expansion:
|
||||
3
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - nested generate
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
3
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( n )
|
||||
with expansion:
|
||||
1
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - nested generate
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
3
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( n )
|
||||
with expansion:
|
||||
2
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1938 - nested generate
|
||||
-------------------------------------------------------------------------------
|
||||
PartTracker.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( m )
|
||||
with expansion:
|
||||
3
|
||||
|
||||
PartTracker.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( n )
|
||||
with expansion:
|
||||
3
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1954 - 7 arg template test case sig compiles - 1, 1, 1, 1, 1, 0, 0
|
||||
-------------------------------------------------------------------------------
|
||||
Misc.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Misc.tests.cpp:<line number>: PASSED:
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1954 - 7 arg template test case sig compiles - 5, 1, 1, 1, 1, 0, 0
|
||||
-------------------------------------------------------------------------------
|
||||
Misc.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Misc.tests.cpp:<line number>: PASSED:
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#1954 - 7 arg template test case sig compiles - 5, 3, 1, 1, 1, 0, 0
|
||||
-------------------------------------------------------------------------------
|
||||
Misc.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Misc.tests.cpp:<line number>: PASSED:
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
#748 - captures with unexpected exceptions
|
||||
outside assertions
|
||||
@ -423,6 +931,6 @@ Condition.tests.cpp:<line number>: FAILED:
|
||||
CHECK( true != true )
|
||||
|
||||
===============================================================================
|
||||
test cases: 21 | 16 passed | 3 failed | 2 failed as expected
|
||||
assertions: 49 | 42 passed | 4 failed | 3 failed as expected
|
||||
test cases: 31 | 26 passed | 3 failed | 2 failed as expected
|
||||
assertions: 100 | 93 passed | 4 failed | 3 failed as expected
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user