mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-13 17:05:39 +02:00
Compare commits
20 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
87074da73e | ||
![]() |
e6f5e05ebc | ||
![]() |
44900d5371 | ||
![]() |
7c75ecaef4 | ||
![]() |
fba0feeba1 | ||
![]() |
3e8800beb1 | ||
![]() |
314a05d809 | ||
![]() |
eadf4e32b6 | ||
![]() |
f9620d11be | ||
![]() |
00db4fb497 | ||
![]() |
2fc83e7e9c | ||
![]() |
a2e5ce2418 | ||
![]() |
fd9f5ac661 | ||
![]() |
f0dc4d9be0 | ||
![]() |
284672cc84 | ||
![]() |
2b34b5c7d0 | ||
![]() |
708487d201 | ||
![]() |
6859c683e0 | ||
![]() |
de3a208e16 | ||
![]() |
229cc4823c |
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5)
|
|||||||
# detect if Catch is being bundled,
|
# detect if Catch is being bundled,
|
||||||
# disable testsuite in that case
|
# disable testsuite in that case
|
||||||
if(NOT DEFINED PROJECT_NAME)
|
if(NOT DEFINED PROJECT_NAME)
|
||||||
set(NOT_SUBPROJECT ON)
|
set(NOT_SUBPROJECT ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Catch2's build breaks if done in-tree. You probably should not build
|
# Catch2's build breaks if done in-tree. You probably should not build
|
||||||
@@ -14,14 +14,12 @@ if (CMAKE_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
project(Catch2 LANGUAGES CXX VERSION 2.13.0)
|
project(Catch2 LANGUAGES CXX VERSION 2.13.2)
|
||||||
|
|
||||||
# Provide path for scripts
|
# Provide path for scripts
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake")
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
include(CMakePackageConfigHelpers)
|
|
||||||
include(CTest)
|
|
||||||
|
|
||||||
option(CATCH_USE_VALGRIND "Perform SelfTests with Valgrind" OFF)
|
option(CATCH_USE_VALGRIND "Perform SelfTests with Valgrind" OFF)
|
||||||
option(CATCH_BUILD_TESTING "Build SelfTest project" ON)
|
option(CATCH_BUILD_TESTING "Build SelfTest project" ON)
|
||||||
@@ -33,8 +31,6 @@ option(CATCH_INSTALL_DOCS "Install documentation alongside library" ON)
|
|||||||
option(CATCH_INSTALL_HELPERS "Install contrib alongside library" ON)
|
option(CATCH_INSTALL_HELPERS "Install contrib alongside library" ON)
|
||||||
|
|
||||||
|
|
||||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|
||||||
|
|
||||||
# define some folders
|
# define some folders
|
||||||
set(CATCH_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
set(CATCH_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
set(SELF_TEST_DIR ${CATCH_DIR}/projects/SelfTest)
|
set(SELF_TEST_DIR ${CATCH_DIR}/projects/SelfTest)
|
||||||
@@ -45,12 +41,16 @@ if(USE_WMAIN)
|
|||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:wmainCRTStartup")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:wmainCRTStartup")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (BUILD_TESTING AND CATCH_BUILD_TESTING AND NOT_SUBPROJECT)
|
if(NOT_SUBPROJECT)
|
||||||
find_package(PythonInterp)
|
include(CTest)
|
||||||
if (NOT PYTHONINTERP_FOUND)
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
message(FATAL_ERROR "Python not found, but required for tests")
|
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()
|
endif()
|
||||||
add_subdirectory(projects)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CATCH_BUILD_EXAMPLES)
|
if(CATCH_BUILD_EXAMPLES)
|
||||||
@@ -107,6 +107,7 @@ add_library(Catch2::Catch2 ALIAS Catch2)
|
|||||||
# a subproject via `add_subdirectory`, or the destinations will break,
|
# a subproject via `add_subdirectory`, or the destinations will break,
|
||||||
# see https://github.com/catchorg/Catch2/issues/1373
|
# see https://github.com/catchorg/Catch2/issues/1373
|
||||||
if (NOT_SUBPROJECT)
|
if (NOT_SUBPROJECT)
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
set(CATCH_CMAKE_CONFIG_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Catch2")
|
set(CATCH_CMAKE_CONFIG_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Catch2")
|
||||||
|
|
||||||
configure_package_config_file(
|
configure_package_config_file(
|
||||||
|
@@ -5,11 +5,11 @@
|
|||||||
[](https://travis-ci.org/catchorg/Catch2)
|
[](https://travis-ci.org/catchorg/Catch2)
|
||||||
[](https://ci.appveyor.com/project/catchorg/catch2)
|
[](https://ci.appveyor.com/project/catchorg/catch2)
|
||||||
[](https://codecov.io/gh/catchorg/Catch2)
|
[](https://codecov.io/gh/catchorg/Catch2)
|
||||||
[](https://wandbox.org/permlink/aavJBzemrxUgGV9S)
|
[](https://wandbox.org/permlink/6JUH8Eybx4CtvkJS)
|
||||||
[](https://discord.gg/4CWS9zD)
|
[](https://discord.gg/4CWS9zD)
|
||||||
|
|
||||||
|
|
||||||
<a href="https://github.com/catchorg/Catch2/releases/download/v2.13.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.2/catch.hpp">The latest version of the single header can be downloaded directly using this link</a>
|
||||||
|
|
||||||
## Catch2 is released!
|
## Catch2 is released!
|
||||||
|
|
||||||
|
@@ -33,6 +33,10 @@ same as the Catch name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``.
|
|||||||
[TEST_SUFFIX suffix]
|
[TEST_SUFFIX suffix]
|
||||||
[PROPERTIES name1 value1...]
|
[PROPERTIES name1 value1...]
|
||||||
[TEST_LIST var]
|
[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
|
``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()``.
|
executable is being used in multiple calls to ``catch_discover_tests()``.
|
||||||
Note that this variable is only available in CTest.
|
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(
|
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"
|
"TEST_SPEC;EXTRA_ARGS;PROPERTIES"
|
||||||
${ARGN}
|
${ARGN}
|
||||||
)
|
)
|
||||||
@@ -110,7 +136,7 @@ function(catch_discover_tests TARGET)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
## Generate a unique name based on the extra arguments
|
## 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)
|
string(SUBSTRING ${args_hash} 0 7 args_hash)
|
||||||
|
|
||||||
# Define rule to generate test list for aforementioned test executable
|
# 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_PREFIX=${_TEST_PREFIX}"
|
||||||
-D "TEST_SUFFIX=${_TEST_SUFFIX}"
|
-D "TEST_SUFFIX=${_TEST_SUFFIX}"
|
||||||
-D "TEST_LIST=${_TEST_LIST}"
|
-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}"
|
-D "CTEST_FILE=${ctest_tests_file}"
|
||||||
-P "${_CATCH_DISCOVER_TESTS_SCRIPT}"
|
-P "${_CATCH_DISCOVER_TESTS_SCRIPT}"
|
||||||
VERBATIM
|
VERBATIM
|
||||||
|
@@ -6,6 +6,10 @@ set(suffix "${TEST_SUFFIX}")
|
|||||||
set(spec ${TEST_SPEC})
|
set(spec ${TEST_SPEC})
|
||||||
set(extra_args ${TEST_EXTRA_ARGS})
|
set(extra_args ${TEST_EXTRA_ARGS})
|
||||||
set(properties ${TEST_PROPERTIES})
|
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(script)
|
||||||
set(suite)
|
set(suite)
|
||||||
set(tests)
|
set(tests)
|
||||||
@@ -32,6 +36,7 @@ execute_process(
|
|||||||
COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} --list-test-names-only
|
COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} --list-test-names-only
|
||||||
OUTPUT_VARIABLE output
|
OUTPUT_VARIABLE output
|
||||||
RESULT_VARIABLE result
|
RESULT_VARIABLE result
|
||||||
|
WORKING_DIRECTORY "${TEST_WORKING_DIR}"
|
||||||
)
|
)
|
||||||
# Catch --list-test-names-only reports the number of tests, so 0 is... surprising
|
# Catch --list-test-names-only reports the number of tests, so 0 is... surprising
|
||||||
if(${result} EQUAL 0)
|
if(${result} EQUAL 0)
|
||||||
@@ -48,6 +53,44 @@ endif()
|
|||||||
|
|
||||||
string(REPLACE "\n" ";" output "${output}")
|
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
|
# Parse output
|
||||||
foreach(line ${output})
|
foreach(line ${output})
|
||||||
set(test ${line})
|
set(test ${line})
|
||||||
@@ -56,6 +99,12 @@ foreach(line ${output})
|
|||||||
foreach(char , [ ])
|
foreach(char , [ ])
|
||||||
string(REPLACE ${char} "\\${char}" test_name ${test_name})
|
string(REPLACE ${char} "\\${char}" test_name ${test_name})
|
||||||
endforeach(char)
|
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
|
# ...and add to script
|
||||||
add_command(add_test
|
add_command(add_test
|
||||||
"${prefix}${test}${suffix}"
|
"${prefix}${test}${suffix}"
|
||||||
@@ -63,6 +112,8 @@ foreach(line ${output})
|
|||||||
"${TEST_EXECUTABLE}"
|
"${TEST_EXECUTABLE}"
|
||||||
"${test_name}"
|
"${test_name}"
|
||||||
${extra_args}
|
${extra_args}
|
||||||
|
"${reporter_arg}"
|
||||||
|
"${output_dir_arg}"
|
||||||
)
|
)
|
||||||
add_command(set_tests_properties
|
add_command(set_tests_properties
|
||||||
"${prefix}${test}${suffix}"
|
"${prefix}${test}${suffix}"
|
||||||
|
@@ -1,9 +1,11 @@
|
|||||||
#==================================================================================================#
|
#==================================================================================================#
|
||||||
# supported macros #
|
# supported macros #
|
||||||
# - TEST_CASE, #
|
# - TEST_CASE, #
|
||||||
|
# - TEMPLATE_TEST_CASE #
|
||||||
# - SCENARIO, #
|
# - SCENARIO, #
|
||||||
# - TEST_CASE_METHOD, #
|
# - TEST_CASE_METHOD, #
|
||||||
# - CATCH_TEST_CASE, #
|
# - CATCH_TEST_CASE, #
|
||||||
|
# - CATCH_TEMPLATE_TEST_CASE #
|
||||||
# - CATCH_SCENARIO, #
|
# - CATCH_SCENARIO, #
|
||||||
# - CATCH_TEST_CASE_METHOD. #
|
# - CATCH_TEST_CASE_METHOD. #
|
||||||
# #
|
# #
|
||||||
@@ -106,7 +108,7 @@ function(ParseAndAddCatchTests_ParseFile SourceFile TestTarget)
|
|||||||
ParseAndAddCatchTests_RemoveComments(Contents)
|
ParseAndAddCatchTests_RemoveComments(Contents)
|
||||||
|
|
||||||
# Find definition of test names
|
# 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}")
|
string(REGEX MATCHALL "[ \t]*(CATCH_)?(TEMPLATE_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)[ \t]*\\([ \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)
|
if(PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS AND Tests)
|
||||||
ParseAndAddCatchTests_PrintDebugMessage("Adding ${SourceFile} to CMAKE_CONFIGURE_DEPENDS property")
|
ParseAndAddCatchTests_PrintDebugMessage("Adding ${SourceFile} to CMAKE_CONFIGURE_DEPENDS property")
|
||||||
@@ -122,8 +124,8 @@ function(ParseAndAddCatchTests_ParseFile SourceFile TestTarget)
|
|||||||
string(REGEX REPLACE "\\\\\n|\n" "" TestName "${TestName}")
|
string(REGEX REPLACE "\\\\\n|\n" "" TestName "${TestName}")
|
||||||
|
|
||||||
# Get test type and fixture if applicable
|
# Get test type and fixture if applicable
|
||||||
string(REGEX MATCH "(CATCH_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)[ \t]*\\([^,^\"]*" TestTypeAndFixture "${TestName}")
|
string(REGEX MATCH "(CATCH_)?(TEMPLATE_)?(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)" TestType "${TestTypeAndFixture}")
|
||||||
string(REGEX REPLACE "${TestType}\\([ \t]*" "" TestFixture "${TestTypeAndFixture}")
|
string(REGEX REPLACE "${TestType}\\([ \t]*" "" TestFixture "${TestTypeAndFixture}")
|
||||||
|
|
||||||
# Get string parts of test definition
|
# Get string parts of test definition
|
||||||
@@ -189,24 +191,35 @@ function(ParseAndAddCatchTests_ParseFile SourceFile TestTarget)
|
|||||||
# Escape commas in the test spec
|
# Escape commas in the test spec
|
||||||
string(REPLACE "," "\\," Name ${Name})
|
string(REPLACE "," "\\," Name ${Name})
|
||||||
|
|
||||||
|
# Work around CMake 3.18.0 change in `add_test()`, before the escaped quotes were neccessary,
|
||||||
|
# only with CMake 3.18.0 the escaped double quotes confuse the call. This change is reverted in 3.18.1
|
||||||
|
if(NOT ${CMAKE_VERSION} VERSION_EQUAL "3.18")
|
||||||
|
set(CTestName "\"${CTestName}\"")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Handle template test cases
|
||||||
|
if("${TestTypeAndFixture}" MATCHES ".*TEMPLATE_.*")
|
||||||
|
set(Name "${Name} - *")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Add the test and set its properties
|
# 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
|
# 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")
|
if(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS AND ${HiddenTagFound} AND ${CMAKE_VERSION} VERSION_GREATER "3.8")
|
||||||
ParseAndAddCatchTests_PrintDebugMessage("Setting DISABLED test property")
|
ParseAndAddCatchTests_PrintDebugMessage("Setting DISABLED test property")
|
||||||
set_tests_properties("\"${CTestName}\"" PROPERTIES DISABLED ON)
|
set_tests_properties("${CTestName}" PROPERTIES DISABLED ON)
|
||||||
else()
|
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}")
|
LABELS "${Labels}")
|
||||||
endif()
|
endif()
|
||||||
set_property(
|
set_property(
|
||||||
TARGET ${TestTarget}
|
TARGET ${TestTarget}
|
||||||
APPEND
|
APPEND
|
||||||
PROPERTY ParseAndAddCatchTests_TESTS "\"${CTestName}\"")
|
PROPERTY ParseAndAddCatchTests_TESTS "${CTestName}")
|
||||||
set_property(
|
set_property(
|
||||||
SOURCE ${SourceFile}
|
SOURCE ${SourceFile}
|
||||||
APPEND
|
APPEND
|
||||||
PROPERTY ParseAndAddCatchTests_TESTS "\"${CTestName}\"")
|
PROPERTY ParseAndAddCatchTests_TESTS "${CTestName}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
@@ -36,6 +36,20 @@ add_subdirectory(lib/Catch2)
|
|||||||
target_link_libraries(tests Catch2::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.1)
|
||||||
|
|
||||||
|
FetchContent_MakeAvailable(Catch2)
|
||||||
|
|
||||||
|
target_link_libraries(tests Catch2::Catch2)
|
||||||
|
```
|
||||||
|
|
||||||
## Automatic test registration
|
## Automatic test registration
|
||||||
|
|
||||||
Catch2's repository also contains two CMake scripts that help users
|
Catch2's repository also contains two CMake scripts that help users
|
||||||
@@ -83,6 +97,10 @@ catch_discover_tests(target
|
|||||||
[TEST_SUFFIX suffix]
|
[TEST_SUFFIX suffix]
|
||||||
[PROPERTIES name1 value1...]
|
[PROPERTIES name1 value1...]
|
||||||
[TEST_LIST var]
|
[TEST_LIST var]
|
||||||
|
[REPORTER reporter]
|
||||||
|
[OUTPUT_DIR dir]
|
||||||
|
[OUTPUT_PREFIX prefix]
|
||||||
|
[OUTPUT_SUFFIX suffix]
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -129,6 +147,32 @@ default `<target>_TESTS`. This can be useful when the same test
|
|||||||
executable is being used in multiple calls to `catch_discover_tests()`.
|
executable is being used in multiple calls to `catch_discover_tests()`.
|
||||||
Note that this variable is only available in CTest.
|
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`
|
### `ParseAndAddCatchTests.cmake`
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@ that allows users to implement their own generators.
|
|||||||
effects. The simplest usage is shown below, where the `SECTION` "one"
|
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).
|
runs 4 (2\*2) times, and `SECTION` "two" is run 6 times (2\*3).
|
||||||
|
|
||||||
```
|
```cpp
|
||||||
TEST_CASE("Generators") {
|
TEST_CASE("Generators") {
|
||||||
auto i = GENERATE(1, 2);
|
auto i = GENERATE(1, 2);
|
||||||
SECTION("one") {
|
SECTION("one") {
|
||||||
@@ -51,7 +51,7 @@ TEST_CASE("Generators") {
|
|||||||
}
|
}
|
||||||
SECTION("two") {
|
SECTION("two") {
|
||||||
auto k = GENERATE(4, 5, 6);
|
auto k = GENERATE(4, 5, 6);
|
||||||
REQUIRE(j != k);
|
REQUIRE(i != k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -60,7 +60,7 @@ The specific order of the `SECTION`s will be "one", "one", "two", "two",
|
|||||||
"two", "one"...
|
"two", "one"...
|
||||||
|
|
||||||
|
|
||||||
The fact that `GENERATE` introduces a virtual `SECTION` can als obe used
|
The fact that `GENERATE` introduces a virtual `SECTION` can also be used
|
||||||
to make a generator replay only some `SECTION`s, without having to
|
to make a generator replay only some `SECTION`s, without having to
|
||||||
explicitly add a `SECTION`. As an example, the code below reports 3
|
explicitly add a `SECTION`. As an example, the code below reports 3
|
||||||
assertions, because the "first" section is run once, but the "second"
|
assertions, because the "first" section is run once, but the "second"
|
||||||
|
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
# Release notes
|
# Release notes
|
||||||
**Contents**<br>
|
**Contents**<br>
|
||||||
|
[2.13.2](#2132)<br>
|
||||||
|
[2.13.1](#2131)<br>
|
||||||
[2.13.0](#2130)<br>
|
[2.13.0](#2130)<br>
|
||||||
[2.12.4](#2124)<br>
|
[2.12.4](#2124)<br>
|
||||||
[2.12.3](#2123)<br>
|
[2.12.3](#2123)<br>
|
||||||
@@ -40,6 +42,38 @@
|
|||||||
[Older versions](#older-versions)<br>
|
[Older versions](#older-versions)<br>
|
||||||
[Even Older versions](#even-older-versions)<br>
|
[Even Older versions](#even-older-versions)<br>
|
||||||
|
|
||||||
|
|
||||||
|
## 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
|
## 2.13.0
|
||||||
|
|
||||||
### Improvements
|
### Improvements
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#define CATCH_VERSION_MAJOR 2
|
#define CATCH_VERSION_MAJOR 2
|
||||||
#define CATCH_VERSION_MINOR 13
|
#define CATCH_VERSION_MINOR 13
|
||||||
#define CATCH_VERSION_PATCH 0
|
#define CATCH_VERSION_PATCH 2
|
||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
# pragma clang system_header
|
# pragma clang system_header
|
||||||
|
@@ -39,13 +39,9 @@
|
|||||||
|
|
||||||
#endif
|
#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
|
// We have to avoid both ICC and Clang, because they try to mask themselves
|
||||||
// as gcc, and we want only GCC in this block
|
// as gcc, and we want only GCC in this block
|
||||||
#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC)
|
#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && !defined(__CUDACC__)
|
||||||
# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic push" )
|
# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic push" )
|
||||||
# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic pop" )
|
# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic pop" )
|
||||||
|
|
||||||
@@ -69,7 +65,7 @@
|
|||||||
// ```
|
// ```
|
||||||
//
|
//
|
||||||
// Therefore, `CATCH_INTERNAL_IGNORE_BUT_WARN` is not implemented.
|
// Therefore, `CATCH_INTERNAL_IGNORE_BUT_WARN` is not implemented.
|
||||||
# if !defined(__ibmxl__)
|
# if !defined(__ibmxl__) && !defined(__CUDACC__)
|
||||||
# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) /* NOLINT(cppcoreguidelines-pro-type-vararg, hicpp-vararg) */
|
# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) /* NOLINT(cppcoreguidelines-pro-type-vararg, hicpp-vararg) */
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
@@ -153,9 +149,6 @@
|
|||||||
# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma( warning(push) )
|
# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma( warning(push) )
|
||||||
# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION __pragma( warning(pop) )
|
# 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
|
// Universal Windows platform does not support SEH
|
||||||
// Or console colours (or console at all...)
|
// Or console colours (or console at all...)
|
||||||
@@ -240,7 +233,10 @@
|
|||||||
|
|
||||||
// Check if byte is available and usable
|
// Check if byte is available and usable
|
||||||
# if __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER)
|
# if __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER)
|
||||||
# define CATCH_INTERNAL_CONFIG_CPP17_BYTE
|
# include <cstddef>
|
||||||
|
# if __cpp_lib_byte > 0
|
||||||
|
# define CATCH_INTERNAL_CONFIG_CPP17_BYTE
|
||||||
|
# endif
|
||||||
# endif // __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER)
|
# endif // __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER)
|
||||||
|
|
||||||
// Check if variant is available and usable
|
// Check if variant is available and usable
|
||||||
@@ -284,10 +280,6 @@
|
|||||||
# define CATCH_CONFIG_CPP17_OPTIONAL
|
# define CATCH_CONFIG_CPP17_OPTIONAL
|
||||||
#endif
|
#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)
|
#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
|
# define CATCH_CONFIG_CPP17_STRING_VIEW
|
||||||
#endif
|
#endif
|
||||||
|
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
|
@@ -66,7 +66,7 @@ namespace Catch {
|
|||||||
if (tmpnam_s(m_buffer)) {
|
if (tmpnam_s(m_buffer)) {
|
||||||
CATCH_RUNTIME_ERROR("Could not get a temp filename");
|
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];
|
char buffer[100];
|
||||||
if (strerror_s(buffer, errno)) {
|
if (strerror_s(buffer, errno)) {
|
||||||
CATCH_RUNTIME_ERROR("Could not translate errno to a string");
|
CATCH_RUNTIME_ERROR("Could not translate errno to a string");
|
||||||
|
@@ -22,10 +22,10 @@ namespace Catch {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct TestHasher {
|
struct TestHasher {
|
||||||
explicit TestHasher(Catch::SimplePcg32& rng) {
|
explicit TestHasher(Catch::SimplePcg32& rng_instance) {
|
||||||
basis = rng();
|
basis = rng_instance();
|
||||||
basis <<= 32;
|
basis <<= 32;
|
||||||
basis |= rng();
|
basis |= rng_instance();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t basis;
|
uint64_t basis;
|
||||||
|
@@ -160,7 +160,7 @@ struct AutoReg : NonCopyable {
|
|||||||
int index = 0; \
|
int index = 0; \
|
||||||
constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\
|
constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\
|
||||||
using expander = int[];\
|
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 ) = [](){\
|
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
|
||||||
@@ -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* 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 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]);\
|
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 ) = [](){ \
|
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \
|
||||||
@@ -250,7 +250,7 @@ struct AutoReg : NonCopyable {
|
|||||||
void reg_tests() { \
|
void reg_tests() { \
|
||||||
int index = 0; \
|
int index = 0; \
|
||||||
using expander = int[]; \
|
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 ) = [](){ \
|
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \
|
||||||
@@ -285,7 +285,7 @@ struct AutoReg : NonCopyable {
|
|||||||
int index = 0; \
|
int index = 0; \
|
||||||
constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\
|
constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\
|
||||||
using expander = int[];\
|
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 ) = [](){\
|
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
|
||||||
@@ -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* 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 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]);\
|
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 ) = [](){\
|
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
|
||||||
@@ -381,7 +381,7 @@ struct AutoReg : NonCopyable {
|
|||||||
void reg_tests(){\
|
void reg_tests(){\
|
||||||
int index = 0;\
|
int index = 0;\
|
||||||
using expander = int[];\
|
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 ) = [](){\
|
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
|
||||||
|
@@ -309,8 +309,8 @@ namespace Catch {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Detail {
|
namespace Detail {
|
||||||
template<typename InputIterator>
|
template<typename InputIterator, typename Sentinel = InputIterator>
|
||||||
std::string rangeToString(InputIterator first, InputIterator last) {
|
std::string rangeToString(InputIterator first, Sentinel last) {
|
||||||
ReusableStringStream rss;
|
ReusableStringStream rss;
|
||||||
rss << "{ ";
|
rss << "{ ";
|
||||||
if (first != last) {
|
if (first != last) {
|
||||||
|
@@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
#include "catch_compiler_capabilities.h"
|
#include "catch_compiler_capabilities.h"
|
||||||
#include "catch_uncaught_exceptions.h"
|
#include "catch_uncaught_exceptions.h"
|
||||||
|
#include "catch_config_uncaught_exceptions.hpp"
|
||||||
|
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
@@ -37,7 +37,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Version const& libraryVersion() {
|
Version const& libraryVersion() {
|
||||||
static Version version( 2, 13, 0, "", 0 );
|
static Version version( 2, 13, 2, "", 0 );
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -124,6 +124,7 @@ set(INTERNAL_HEADERS
|
|||||||
${HEADER_DIR}/internal/catch_common.h
|
${HEADER_DIR}/internal/catch_common.h
|
||||||
${HEADER_DIR}/internal/catch_compiler_capabilities.h
|
${HEADER_DIR}/internal/catch_compiler_capabilities.h
|
||||||
${HEADER_DIR}/internal/catch_config.hpp
|
${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_console_colour.h
|
||||||
${HEADER_DIR}/internal/catch_context.h
|
${HEADER_DIR}/internal/catch_context.h
|
||||||
${HEADER_DIR}/internal/catch_debug_console.h
|
${HEADER_DIR}/internal/catch_debug_console.h
|
||||||
|
@@ -1203,6 +1203,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: 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: 2 >= 1
|
||||||
Misc.tests.cpp:<line number>: passed: std::tuple_size<TestType>::value >= 1 for: 1 >= 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!
|
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("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
|
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
|
||||||
|
@@ -1380,6 +1380,6 @@ due to unexpected exception with message:
|
|||||||
Why would you throw a std::string?
|
Why would you throw a std::string?
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
test cases: 321 | 247 passed | 70 failed | 4 failed as expected
|
test cases: 322 | 248 passed | 70 failed | 4 failed as expected
|
||||||
assertions: 1758 | 1606 passed | 131 failed | 21 failed as expected
|
assertions: 1759 | 1607 passed | 131 failed | 21 failed as expected
|
||||||
|
|
||||||
|
@@ -8895,6 +8895,17 @@ Misc.tests.cpp:<line number>: PASSED:
|
|||||||
with expansion:
|
with expansion:
|
||||||
1 >= 1
|
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
|
Reconstruction should be based on stringification: #914
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@@ -14127,6 +14138,6 @@ Misc.tests.cpp:<line number>
|
|||||||
Misc.tests.cpp:<line number>: PASSED:
|
Misc.tests.cpp:<line number>: PASSED:
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
test cases: 321 | 231 passed | 86 failed | 4 failed as expected
|
test cases: 322 | 232 passed | 86 failed | 4 failed as expected
|
||||||
assertions: 1775 | 1606 passed | 148 failed | 21 failed as expected
|
assertions: 1776 | 1607 passed | 148 failed | 21 failed as expected
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<testsuitesloose text artifact
|
<testsuitesloose text artifact
|
||||||
>
|
>
|
||||||
<testsuite name="<exe-name>" errors="17" failures="132" tests="1776" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
<testsuite name="<exe-name>" errors="17" failures="132" tests="1777" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="filters" value="~[!nonportable]~[!benchmark]~[approvals]"/>
|
<property name="filters" value="~[!nonportable]~[!benchmark]~[approvals]"/>
|
||||||
<property name="random-seed" value="1"/>
|
<property name="random-seed" value="1"/>
|
||||||
@@ -1045,6 +1045,7 @@ Message.tests.cpp:<line number>
|
|||||||
<testcase classname="<exe-name>.global" name="Product with differing arities - std::tuple<int, double, float>" time="{duration}" status="run"/>
|
<testcase classname="<exe-name>.global" name="Product with differing arities - std::tuple<int, double, float>" time="{duration}" status="run"/>
|
||||||
<testcase classname="<exe-name>.global" name="Product with differing arities - std::tuple<int, double>" time="{duration}" status="run"/>
|
<testcase classname="<exe-name>.global" name="Product with differing arities - std::tuple<int, double>" time="{duration}" status="run"/>
|
||||||
<testcase classname="<exe-name>.global" name="Product with differing arities - std::tuple<int>" time="{duration}" status="run"/>
|
<testcase classname="<exe-name>.global" name="Product with differing arities - std::tuple<int>" time="{duration}" status="run"/>
|
||||||
|
<testcase classname="<exe-name>.global" name="Range type with sentinel" time="{duration}" status="run"/>
|
||||||
<testcase classname="<exe-name>.global" name="Reconstruction should be based on stringification: #914" time="{duration}" status="run">
|
<testcase classname="<exe-name>.global" name="Reconstruction should be based on stringification: #914" time="{duration}" status="run">
|
||||||
<failure message="truthy(false)" type="CHECK">
|
<failure message="truthy(false)" type="CHECK">
|
||||||
FAILED:
|
FAILED:
|
||||||
|
@@ -162,6 +162,7 @@
|
|||||||
</file>
|
</file>
|
||||||
<file path="projects/<exe-name>/IntrospectiveTests/ToString.tests.cpp">
|
<file path="projects/<exe-name>/IntrospectiveTests/ToString.tests.cpp">
|
||||||
<testCase name="Directly creating an EnumInfo" duration="{duration}"/>
|
<testCase name="Directly creating an EnumInfo" duration="{duration}"/>
|
||||||
|
<testCase name="Range type with sentinel" duration="{duration}"/>
|
||||||
<testCase name="parseEnums/No enums" duration="{duration}"/>
|
<testCase name="parseEnums/No enums" duration="{duration}"/>
|
||||||
<testCase name="parseEnums/One enum value" duration="{duration}"/>
|
<testCase name="parseEnums/One enum value" duration="{duration}"/>
|
||||||
<testCase name="parseEnums/Multiple enum values" duration="{duration}"/>
|
<testCase name="parseEnums/Multiple enum values" duration="{duration}"/>
|
||||||
|
@@ -10962,6 +10962,17 @@ Nor would this
|
|||||||
</Expression>
|
</Expression>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
|
<TestCase name="Range type with sentinel" filename="projects/<exe-name>/IntrospectiveTests/ToString.tests.cpp" >
|
||||||
|
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/ToString.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
Catch::Detail::stringify(UsesSentinel{}) == "{ }"
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
"{ }" == "{ }"
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<OverallResult success="true"/>
|
||||||
|
</TestCase>
|
||||||
<TestCase name="Reconstruction should be based on stringification: #914" tags="[!hide][.][Decomposition][failing]" filename="projects/<exe-name>/UsageTests/Decomposition.tests.cpp" >
|
<TestCase name="Reconstruction should be based on stringification: #914" tags="[!hide][.][Decomposition][failing]" filename="projects/<exe-name>/UsageTests/Decomposition.tests.cpp" >
|
||||||
<Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Decomposition.tests.cpp" >
|
<Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Decomposition.tests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
@@ -16711,9 +16722,9 @@ loose text artifact
|
|||||||
</Section>
|
</Section>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<OverallResults successes="1606" failures="149" expectedFailures="21"/>
|
<OverallResults successes="1607" failures="149" expectedFailures="21"/>
|
||||||
<OverallResultsCases successes="231" failures="86" expectedFailures="4"/>
|
<OverallResultsCases successes="232" failures="86" expectedFailures="4"/>
|
||||||
</Group>
|
</Group>
|
||||||
<OverallResults successes="1606" failures="148" expectedFailures="21"/>
|
<OverallResults successes="1607" failures="148" expectedFailures="21"/>
|
||||||
<OverallResultsCases successes="231" failures="86" expectedFailures="4"/>
|
<OverallResultsCases successes="232" failures="86" expectedFailures="4"/>
|
||||||
</Catch>
|
</Catch>
|
||||||
|
@@ -4,6 +4,13 @@
|
|||||||
|
|
||||||
enum class EnumClass3 { Value1, Value2, Value3, Value4 };
|
enum class EnumClass3 { Value1, Value2, Value3, Value4 };
|
||||||
|
|
||||||
|
struct UsesSentinel {
|
||||||
|
using const_iterator = int const*;
|
||||||
|
using const_sentinel = std::nullptr_t;
|
||||||
|
|
||||||
|
const_iterator begin() const { return nullptr; }
|
||||||
|
const_iterator end() const { return nullptr; }
|
||||||
|
};
|
||||||
|
|
||||||
TEST_CASE( "parseEnums", "[Strings][enums]" ) {
|
TEST_CASE( "parseEnums", "[Strings][enums]" ) {
|
||||||
using namespace Catch::Matchers;
|
using namespace Catch::Matchers;
|
||||||
@@ -40,3 +47,7 @@ TEST_CASE( "Directly creating an EnumInfo" ) {
|
|||||||
CHECK( enumInfo->lookup(1) == "Value2" );
|
CHECK( enumInfo->lookup(1) == "Value2" );
|
||||||
CHECK( enumInfo->lookup(3) == "{** unexpected enum value **}" );
|
CHECK( enumInfo->lookup(3) == "{** unexpected enum value **}" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Range type with sentinel") {
|
||||||
|
CHECK( Catch::Detail::stringify(UsesSentinel{}) == "{ }" );
|
||||||
|
}
|
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Catch v2.13.0
|
* Catch v2.13.2
|
||||||
* Generated: 2020-07-12 20:07:49.015950
|
* Generated: 2020-10-07 11:32:53.302017
|
||||||
* ----------------------------------------------------------
|
* ----------------------------------------------------------
|
||||||
* This file has been merged from multiple headers. Please don't edit it directly
|
* This file has been merged from multiple headers. Please don't edit it directly
|
||||||
* Copyright (c) 2020 Two Blue Cubes Ltd. All rights reserved.
|
* Copyright (c) 2020 Two Blue Cubes Ltd. All rights reserved.
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#define CATCH_VERSION_MAJOR 2
|
#define CATCH_VERSION_MAJOR 2
|
||||||
#define CATCH_VERSION_MINOR 13
|
#define CATCH_VERSION_MINOR 13
|
||||||
#define CATCH_VERSION_PATCH 0
|
#define CATCH_VERSION_PATCH 2
|
||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
# pragma clang system_header
|
# pragma clang system_header
|
||||||
@@ -132,13 +132,9 @@ namespace Catch {
|
|||||||
|
|
||||||
#endif
|
#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
|
// We have to avoid both ICC and Clang, because they try to mask themselves
|
||||||
// as gcc, and we want only GCC in this block
|
// as gcc, and we want only GCC in this block
|
||||||
#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC)
|
#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && !defined(__CUDACC__)
|
||||||
# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic push" )
|
# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic push" )
|
||||||
# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic pop" )
|
# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic pop" )
|
||||||
|
|
||||||
@@ -162,7 +158,7 @@ namespace Catch {
|
|||||||
// ```
|
// ```
|
||||||
//
|
//
|
||||||
// Therefore, `CATCH_INTERNAL_IGNORE_BUT_WARN` is not implemented.
|
// Therefore, `CATCH_INTERNAL_IGNORE_BUT_WARN` is not implemented.
|
||||||
# if !defined(__ibmxl__)
|
# if !defined(__ibmxl__) && !defined(__CUDACC__)
|
||||||
# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) /* NOLINT(cppcoreguidelines-pro-type-vararg, hicpp-vararg) */
|
# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) /* NOLINT(cppcoreguidelines-pro-type-vararg, hicpp-vararg) */
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
@@ -244,10 +240,6 @@ namespace Catch {
|
|||||||
# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma( warning(push) )
|
# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma( warning(push) )
|
||||||
# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION __pragma( warning(pop) )
|
# 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
|
// Universal Windows platform does not support SEH
|
||||||
// Or console colours (or console at all...)
|
// Or console colours (or console at all...)
|
||||||
# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
|
# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
|
||||||
@@ -330,7 +322,10 @@ namespace Catch {
|
|||||||
|
|
||||||
// Check if byte is available and usable
|
// Check if byte is available and usable
|
||||||
# if __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER)
|
# if __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER)
|
||||||
# define CATCH_INTERNAL_CONFIG_CPP17_BYTE
|
# include <cstddef>
|
||||||
|
# if __cpp_lib_byte > 0
|
||||||
|
# define CATCH_INTERNAL_CONFIG_CPP17_BYTE
|
||||||
|
# endif
|
||||||
# endif // __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER)
|
# endif // __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER)
|
||||||
|
|
||||||
// Check if variant is available and usable
|
// Check if variant is available and usable
|
||||||
@@ -373,10 +368,6 @@ namespace Catch {
|
|||||||
# define CATCH_CONFIG_CPP17_OPTIONAL
|
# define CATCH_CONFIG_CPP17_OPTIONAL
|
||||||
#endif
|
#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)
|
#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
|
# define CATCH_CONFIG_CPP17_STRING_VIEW
|
||||||
#endif
|
#endif
|
||||||
@@ -1105,7 +1096,7 @@ struct AutoReg : NonCopyable {
|
|||||||
int index = 0; \
|
int index = 0; \
|
||||||
constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\
|
constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\
|
||||||
using expander = int[];\
|
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 ) = [](){\
|
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
|
||||||
@@ -1151,7 +1142,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* 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 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]);\
|
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 ) = [](){ \
|
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \
|
||||||
@@ -1195,7 +1186,7 @@ struct AutoReg : NonCopyable {
|
|||||||
void reg_tests() { \
|
void reg_tests() { \
|
||||||
int index = 0; \
|
int index = 0; \
|
||||||
using expander = int[]; \
|
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 ) = [](){ \
|
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \
|
||||||
@@ -1229,7 +1220,7 @@ struct AutoReg : NonCopyable {
|
|||||||
int index = 0; \
|
int index = 0; \
|
||||||
constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\
|
constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\
|
||||||
using expander = int[];\
|
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 ) = [](){\
|
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
|
||||||
@@ -1278,7 +1269,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* 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 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]);\
|
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 ) = [](){\
|
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
|
||||||
@@ -1325,7 +1316,7 @@ struct AutoReg : NonCopyable {
|
|||||||
void reg_tests(){\
|
void reg_tests(){\
|
||||||
int index = 0;\
|
int index = 0;\
|
||||||
using expander = int[];\
|
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 ) = [](){\
|
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
|
||||||
@@ -1829,8 +1820,8 @@ namespace Catch {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Detail {
|
namespace Detail {
|
||||||
template<typename InputIterator>
|
template<typename InputIterator, typename Sentinel = InputIterator>
|
||||||
std::string rangeToString(InputIterator first, InputIterator last) {
|
std::string rangeToString(InputIterator first, Sentinel last) {
|
||||||
ReusableStringStream rss;
|
ReusableStringStream rss;
|
||||||
rss << "{ ";
|
rss << "{ ";
|
||||||
if (first != last) {
|
if (first != last) {
|
||||||
@@ -12042,7 +12033,7 @@ namespace Catch {
|
|||||||
if (tmpnam_s(m_buffer)) {
|
if (tmpnam_s(m_buffer)) {
|
||||||
CATCH_RUNTIME_ERROR("Could not get a temp filename");
|
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];
|
char buffer[100];
|
||||||
if (strerror_s(buffer, errno)) {
|
if (strerror_s(buffer, errno)) {
|
||||||
CATCH_RUNTIME_ERROR("Could not translate errno to a string");
|
CATCH_RUNTIME_ERROR("Could not translate errno to a string");
|
||||||
@@ -14091,10 +14082,10 @@ namespace Catch {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct TestHasher {
|
struct TestHasher {
|
||||||
explicit TestHasher(Catch::SimplePcg32& rng) {
|
explicit TestHasher(Catch::SimplePcg32& rng_instance) {
|
||||||
basis = rng();
|
basis = rng_instance();
|
||||||
basis <<= 32;
|
basis <<= 32;
|
||||||
basis |= rng();
|
basis |= rng_instance();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t basis;
|
uint64_t basis;
|
||||||
@@ -15192,6 +15183,41 @@ namespace Catch {
|
|||||||
// end catch_totals.cpp
|
// end catch_totals.cpp
|
||||||
// start catch_uncaught_exceptions.cpp
|
// start catch_uncaught_exceptions.cpp
|
||||||
|
|
||||||
|
// start catch_config_uncaught_exceptions.hpp
|
||||||
|
|
||||||
|
// 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
|
||||||
|
|
||||||
|
#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
|
||||||
|
// end catch_config_uncaught_exceptions.hpp
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
@@ -15238,7 +15264,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Version const& libraryVersion() {
|
Version const& libraryVersion() {
|
||||||
static Version version( 2, 13, 0, "", 0 );
|
static Version version( 2, 13, 2, "", 0 );
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user