mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-18 03:26:10 +01:00
Merge branch 'master' of https://github.com/catchorg/Catch2
This commit is contained in:
commit
d3f5224041
@ -249,7 +249,7 @@ install:
|
|||||||
- mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}
|
- mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}
|
||||||
- |
|
- |
|
||||||
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
|
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
|
||||||
CMAKE_URL="http://www.cmake.org/files/v3.3/cmake-3.3.2-Linux-x86_64.tar.gz"
|
CMAKE_URL="http://www.cmake.org/files/v3.5/cmake-3.5.2-Linux-x86_64.tar.gz"
|
||||||
mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
|
mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
|
||||||
export PATH=${DEPS_DIR}/cmake/bin:${PATH}
|
export PATH=${DEPS_DIR}/cmake/bin:${PATH}
|
||||||
elif [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
|
elif [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
|
||||||
|
10
CMake/Catch2Config.cmake.in
Normal file
10
CMake/Catch2Config.cmake.in
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
@PACKAGE_INIT@
|
||||||
|
|
||||||
|
|
||||||
|
# Avoid repeatedly including the targets
|
||||||
|
if(NOT TARGET Catch2::Catch2)
|
||||||
|
# Provide path for scripts
|
||||||
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
|
||||||
|
|
||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/Catch2Targets.cmake)
|
||||||
|
endif()
|
26
CMake/MiscFunctions.cmake
Normal file
26
CMake/MiscFunctions.cmake
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#checks that the given hard-coded list contains all headers + sources in the given folder
|
||||||
|
function(CheckFileList LIST_VAR FOLDER)
|
||||||
|
set(MESSAGE " should be added to the variable ${LIST_VAR}")
|
||||||
|
set(MESSAGE "${MESSAGE} in ${CMAKE_CURRENT_LIST_FILE}\n")
|
||||||
|
file(GLOB GLOBBED_LIST "${FOLDER}/*.cpp"
|
||||||
|
"${FOLDER}/*.hpp"
|
||||||
|
"${FOLDER}/*.h")
|
||||||
|
list(REMOVE_ITEM GLOBBED_LIST ${${LIST_VAR}})
|
||||||
|
foreach(EXTRA_ITEM ${GLOBBED_LIST})
|
||||||
|
string(REPLACE "${CATCH_DIR}/" "" RELATIVE_FILE_NAME "${EXTRA_ITEM}")
|
||||||
|
message(AUTHOR_WARNING "The file \"${RELATIVE_FILE_NAME}\"${MESSAGE}")
|
||||||
|
endforeach()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(CheckFileListRec LIST_VAR FOLDER)
|
||||||
|
set(MESSAGE " should be added to the variable ${LIST_VAR}")
|
||||||
|
set(MESSAGE "${MESSAGE} in ${CMAKE_CURRENT_LIST_FILE}\n")
|
||||||
|
file(GLOB_RECURSE GLOBBED_LIST "${FOLDER}/*.cpp"
|
||||||
|
"${FOLDER}/*.hpp"
|
||||||
|
"${FOLDER}/*.h")
|
||||||
|
list(REMOVE_ITEM GLOBBED_LIST ${${LIST_VAR}})
|
||||||
|
foreach(EXTRA_ITEM ${GLOBBED_LIST})
|
||||||
|
string(REPLACE "${CATCH_DIR}/" "" RELATIVE_FILE_NAME "${EXTRA_ITEM}")
|
||||||
|
message(AUTHOR_WARNING "The file \"${RELATIVE_FILE_NAME}\"${MESSAGE}")
|
||||||
|
endforeach()
|
||||||
|
endfunction()
|
7
CMake/catch2.pc.in
Normal file
7
CMake/catch2.pc.in
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
|
||||||
|
|
||||||
|
Name: Catch2
|
||||||
|
Description: A modern, C++-native, header-only, test framework for C++11
|
||||||
|
URL: https://github.com/catchorg/Catch2
|
||||||
|
Version: @Catch2_VERSION@
|
||||||
|
Cflags: -I${includedir}
|
548
CMakeLists.txt
548
CMakeLists.txt
@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.1)
|
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
|
||||||
@ -8,12 +8,20 @@ endif()
|
|||||||
|
|
||||||
project(Catch2 LANGUAGES CXX VERSION 2.2.3)
|
project(Catch2 LANGUAGES CXX VERSION 2.2.3)
|
||||||
|
|
||||||
|
# Provide path for scripts
|
||||||
|
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_EXAMPLES "Build documentation examples" OFF)
|
option(CATCH_BUILD_EXAMPLES "Build documentation examples" OFF)
|
||||||
option(CATCH_ENABLE_COVERAGE "Generate coverage for codecov.io" OFF)
|
option(CATCH_ENABLE_COVERAGE "Generate coverage for codecov.io" OFF)
|
||||||
option(CATCH_ENABLE_WERROR "Enable all warnings as errors" ON)
|
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)
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
|
|
||||||
@ -27,433 +35,149 @@ 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()
|
||||||
|
|
||||||
#checks that the given hard-coded list contains all headers + sources in the given folder
|
|
||||||
function(CheckFileList LIST_VAR FOLDER)
|
|
||||||
set(MESSAGE " should be added to the variable ${LIST_VAR}")
|
|
||||||
set(MESSAGE "${MESSAGE} in ${CMAKE_CURRENT_LIST_FILE}\n")
|
|
||||||
file(GLOB GLOBBED_LIST "${FOLDER}/*.cpp"
|
|
||||||
"${FOLDER}/*.hpp"
|
|
||||||
"${FOLDER}/*.h")
|
|
||||||
list(REMOVE_ITEM GLOBBED_LIST ${${LIST_VAR}})
|
|
||||||
foreach(EXTRA_ITEM ${GLOBBED_LIST})
|
|
||||||
string(REPLACE "${CATCH_DIR}/" "" RELATIVE_FILE_NAME "${EXTRA_ITEM}")
|
|
||||||
message(AUTHOR_WARNING "The file \"${RELATIVE_FILE_NAME}\"${MESSAGE}")
|
|
||||||
endforeach()
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(CheckFileListRec LIST_VAR FOLDER)
|
|
||||||
set(MESSAGE " should be added to the variable ${LIST_VAR}")
|
|
||||||
set(MESSAGE "${MESSAGE} in ${CMAKE_CURRENT_LIST_FILE}\n")
|
|
||||||
file(GLOB_RECURSE GLOBBED_LIST "${FOLDER}/*.cpp"
|
|
||||||
"${FOLDER}/*.hpp"
|
|
||||||
"${FOLDER}/*.h")
|
|
||||||
list(REMOVE_ITEM GLOBBED_LIST ${${LIST_VAR}})
|
|
||||||
foreach(EXTRA_ITEM ${GLOBBED_LIST})
|
|
||||||
string(REPLACE "${CATCH_DIR}/" "" RELATIVE_FILE_NAME "${EXTRA_ITEM}")
|
|
||||||
message(AUTHOR_WARNING "The file \"${RELATIVE_FILE_NAME}\"${MESSAGE}")
|
|
||||||
endforeach()
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
# define the sources of the self test
|
|
||||||
# Please keep these ordered alphabetically
|
|
||||||
set(TEST_SOURCES
|
|
||||||
${SELF_TEST_DIR}/TestMain.cpp
|
|
||||||
${SELF_TEST_DIR}/IntrospectiveTests/CmdLine.tests.cpp
|
|
||||||
${SELF_TEST_DIR}/IntrospectiveTests/PartTracker.tests.cpp
|
|
||||||
${SELF_TEST_DIR}/IntrospectiveTests/TagAlias.tests.cpp
|
|
||||||
${SELF_TEST_DIR}/IntrospectiveTests/String.tests.cpp
|
|
||||||
${SELF_TEST_DIR}/IntrospectiveTests/Xml.tests.cpp
|
|
||||||
${SELF_TEST_DIR}/UsageTests/Approx.tests.cpp
|
|
||||||
${SELF_TEST_DIR}/UsageTests/BDD.tests.cpp
|
|
||||||
${SELF_TEST_DIR}/UsageTests/Benchmark.tests.cpp
|
|
||||||
${SELF_TEST_DIR}/UsageTests/Class.tests.cpp
|
|
||||||
${SELF_TEST_DIR}/UsageTests/Compilation.tests.cpp
|
|
||||||
${SELF_TEST_DIR}/UsageTests/Condition.tests.cpp
|
|
||||||
${SELF_TEST_DIR}/UsageTests/Decomposition.tests.cpp
|
|
||||||
${SELF_TEST_DIR}/UsageTests/EnumToString.tests.cpp
|
|
||||||
${SELF_TEST_DIR}/UsageTests/Exception.tests.cpp
|
|
||||||
${SELF_TEST_DIR}/UsageTests/Message.tests.cpp
|
|
||||||
${SELF_TEST_DIR}/UsageTests/Misc.tests.cpp
|
|
||||||
${SELF_TEST_DIR}/UsageTests/ToStringChrono.tests.cpp
|
|
||||||
${SELF_TEST_DIR}/UsageTests/ToStringGeneral.tests.cpp
|
|
||||||
${SELF_TEST_DIR}/UsageTests/ToStringPair.tests.cpp
|
|
||||||
${SELF_TEST_DIR}/UsageTests/ToStringTuple.tests.cpp
|
|
||||||
${SELF_TEST_DIR}/UsageTests/ToStringVector.tests.cpp
|
|
||||||
${SELF_TEST_DIR}/UsageTests/ToStringWhich.tests.cpp
|
|
||||||
${SELF_TEST_DIR}/UsageTests/Tricky.tests.cpp
|
|
||||||
${SELF_TEST_DIR}/UsageTests/VariadicMacros.tests.cpp
|
|
||||||
${SELF_TEST_DIR}/UsageTests/Matchers.tests.cpp
|
|
||||||
)
|
|
||||||
CheckFileList(TEST_SOURCES ${SELF_TEST_DIR})
|
|
||||||
|
|
||||||
# A set of impl files that just #include a single header
|
|
||||||
# Please keep these ordered alphabetically
|
|
||||||
set(SURROGATE_SOURCES
|
|
||||||
${SELF_TEST_DIR}/SurrogateCpps/catch_console_colour.cpp
|
|
||||||
${SELF_TEST_DIR}/SurrogateCpps/catch_debugger.cpp
|
|
||||||
${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_reporter.cpp
|
|
||||||
${SELF_TEST_DIR}/SurrogateCpps/catch_option.cpp
|
|
||||||
${SELF_TEST_DIR}/SurrogateCpps/catch_stream.cpp
|
|
||||||
${SELF_TEST_DIR}/SurrogateCpps/catch_test_case_tracker.cpp
|
|
||||||
${SELF_TEST_DIR}/SurrogateCpps/catch_test_spec.cpp
|
|
||||||
${SELF_TEST_DIR}/SurrogateCpps/catch_xmlwriter.cpp
|
|
||||||
)
|
|
||||||
CheckFileList(SURROGATE_SOURCES ${SELF_TEST_DIR}/SurrogateCpps)
|
|
||||||
|
|
||||||
|
|
||||||
# Please keep these ordered alphabetically
|
|
||||||
set(TOP_LEVEL_HEADERS
|
|
||||||
${HEADER_DIR}/catch.hpp
|
|
||||||
${HEADER_DIR}/catch_with_main.hpp
|
|
||||||
)
|
|
||||||
CheckFileList(TOP_LEVEL_HEADERS ${HEADER_DIR})
|
|
||||||
|
|
||||||
# Please keep these ordered alphabetically
|
|
||||||
set(EXTERNAL_HEADERS
|
|
||||||
${HEADER_DIR}/external/clara.hpp
|
|
||||||
)
|
|
||||||
CheckFileList(EXTERNAL_HEADERS ${HEADER_DIR}/external)
|
|
||||||
|
|
||||||
|
|
||||||
# Please keep these ordered alphabetically
|
|
||||||
set(INTERNAL_HEADERS
|
|
||||||
${HEADER_DIR}/internal/catch_approx.h
|
|
||||||
${HEADER_DIR}/internal/catch_assertionhandler.h
|
|
||||||
${HEADER_DIR}/internal/catch_assertioninfo.h
|
|
||||||
${HEADER_DIR}/internal/catch_assertionresult.h
|
|
||||||
${HEADER_DIR}/internal/catch_capture.hpp
|
|
||||||
${HEADER_DIR}/internal/catch_capture_matchers.h
|
|
||||||
${HEADER_DIR}/internal/catch_clara.h
|
|
||||||
${HEADER_DIR}/internal/catch_commandline.h
|
|
||||||
${HEADER_DIR}/internal/catch_common.h
|
|
||||||
${HEADER_DIR}/internal/catch_compiler_capabilities.h
|
|
||||||
${HEADER_DIR}/internal/catch_config.hpp
|
|
||||||
${HEADER_DIR}/internal/catch_console_colour.h
|
|
||||||
${HEADER_DIR}/internal/catch_context.h
|
|
||||||
${HEADER_DIR}/internal/catch_debug_console.h
|
|
||||||
${HEADER_DIR}/internal/catch_debugger.h
|
|
||||||
${HEADER_DIR}/internal/catch_decomposer.h
|
|
||||||
${HEADER_DIR}/internal/catch_default_main.hpp
|
|
||||||
${HEADER_DIR}/internal/catch_enforce.h
|
|
||||||
${HEADER_DIR}/internal/catch_errno_guard.h
|
|
||||||
${HEADER_DIR}/internal/catch_exception_translator_registry.h
|
|
||||||
${HEADER_DIR}/internal/catch_external_interfaces.h
|
|
||||||
${HEADER_DIR}/internal/catch_fatal_condition.h
|
|
||||||
${HEADER_DIR}/internal/catch_impl.hpp
|
|
||||||
${HEADER_DIR}/internal/catch_interfaces_capture.h
|
|
||||||
${HEADER_DIR}/internal/catch_interfaces_config.h
|
|
||||||
${HEADER_DIR}/internal/catch_interfaces_exception.h
|
|
||||||
${HEADER_DIR}/internal/catch_interfaces_registry_hub.h
|
|
||||||
${HEADER_DIR}/internal/catch_interfaces_reporter.h
|
|
||||||
${HEADER_DIR}/internal/catch_interfaces_runner.h
|
|
||||||
${HEADER_DIR}/internal/catch_interfaces_tag_alias_registry.h
|
|
||||||
${HEADER_DIR}/internal/catch_interfaces_testcase.h
|
|
||||||
${HEADER_DIR}/internal/catch_leak_detector.h
|
|
||||||
${HEADER_DIR}/internal/catch_list.h
|
|
||||||
${HEADER_DIR}/internal/catch_matchers.h
|
|
||||||
${HEADER_DIR}/internal/catch_matchers_floating.h
|
|
||||||
${HEADER_DIR}/internal/catch_matchers_generic.hpp
|
|
||||||
${HEADER_DIR}/internal/catch_matchers_string.h
|
|
||||||
${HEADER_DIR}/internal/catch_matchers_vector.h
|
|
||||||
${HEADER_DIR}/internal/catch_message.h
|
|
||||||
${HEADER_DIR}/internal/catch_objc.hpp
|
|
||||||
${HEADER_DIR}/internal/catch_objc_arc.hpp
|
|
||||||
${HEADER_DIR}/internal/catch_option.hpp
|
|
||||||
${HEADER_DIR}/internal/catch_output_redirect.h
|
|
||||||
${HEADER_DIR}/internal/catch_platform.h
|
|
||||||
${HEADER_DIR}/internal/catch_random_number_generator.h
|
|
||||||
${HEADER_DIR}/internal/catch_reenable_warnings.h
|
|
||||||
${HEADER_DIR}/internal/catch_reporter_registrars.hpp
|
|
||||||
${HEADER_DIR}/internal/catch_reporter_registry.h
|
|
||||||
${HEADER_DIR}/internal/catch_result_type.h
|
|
||||||
${HEADER_DIR}/internal/catch_run_context.h
|
|
||||||
${HEADER_DIR}/internal/catch_benchmark.h
|
|
||||||
${HEADER_DIR}/internal/catch_section.h
|
|
||||||
${HEADER_DIR}/internal/catch_section_info.h
|
|
||||||
${HEADER_DIR}/internal/catch_session.h
|
|
||||||
${HEADER_DIR}/internal/catch_startup_exception_registry.h
|
|
||||||
${HEADER_DIR}/internal/catch_stream.h
|
|
||||||
${HEADER_DIR}/internal/catch_stringref.h
|
|
||||||
${HEADER_DIR}/internal/catch_string_manip.h
|
|
||||||
${HEADER_DIR}/internal/catch_suppress_warnings.h
|
|
||||||
${HEADER_DIR}/internal/catch_tag_alias.h
|
|
||||||
${HEADER_DIR}/internal/catch_tag_alias_autoregistrar.h
|
|
||||||
${HEADER_DIR}/internal/catch_tag_alias_registry.h
|
|
||||||
${HEADER_DIR}/internal/catch_test_case_info.h
|
|
||||||
${HEADER_DIR}/internal/catch_test_case_registry_impl.h
|
|
||||||
${HEADER_DIR}/internal/catch_test_case_tracker.h
|
|
||||||
${HEADER_DIR}/internal/catch_test_registry.h
|
|
||||||
${HEADER_DIR}/internal/catch_test_spec.h
|
|
||||||
${HEADER_DIR}/internal/catch_test_spec_parser.h
|
|
||||||
${HEADER_DIR}/internal/catch_text.h
|
|
||||||
${HEADER_DIR}/internal/catch_timer.h
|
|
||||||
${HEADER_DIR}/internal/catch_to_string.hpp
|
|
||||||
${HEADER_DIR}/internal/catch_tostring.h
|
|
||||||
${HEADER_DIR}/internal/catch_totals.h
|
|
||||||
${HEADER_DIR}/internal/catch_uncaught_exceptions.h
|
|
||||||
${HEADER_DIR}/internal/catch_user_interfaces.h
|
|
||||||
${HEADER_DIR}/internal/catch_version.h
|
|
||||||
${HEADER_DIR}/internal/catch_wildcard_pattern.h
|
|
||||||
${HEADER_DIR}/internal/catch_windows_h_proxy.h
|
|
||||||
${HEADER_DIR}/internal/catch_xmlwriter.h
|
|
||||||
)
|
|
||||||
set(IMPL_SOURCES
|
|
||||||
${HEADER_DIR}/internal/catch_approx.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_assertionhandler.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_assertionresult.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_benchmark.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_capture_matchers.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_commandline.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_common.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_config.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_console_colour.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_context.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_debug_console.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_debugger.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_decomposer.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_errno_guard.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_exception_translator_registry.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_fatal_condition.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_interfaces_capture.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_interfaces_config.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_interfaces_exception.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_interfaces_registry_hub.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_interfaces_runner.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_interfaces_testcase.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_list.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_leak_detector.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_matchers.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_matchers_floating.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_matchers_generic.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_matchers_string.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_message.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_output_redirect.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_registry_hub.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_interfaces_reporter.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_random_number_generator.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_reporter_registry.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_result_type.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_run_context.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_section.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_section_info.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_session.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_startup_exception_registry.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_stream.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_stringref.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_string_manip.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_tag_alias.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_tag_alias_autoregistrar.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_tag_alias_registry.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_test_case_info.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_test_case_registry_impl.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_test_case_tracker.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_test_registry.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_test_spec.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_test_spec_parser.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_timer.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_tostring.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_totals.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_uncaught_exceptions.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_version.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_wildcard_pattern.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_xmlwriter.cpp
|
|
||||||
)
|
|
||||||
set(INTERNAL_FILES ${IMPL_SOURCES} ${INTERNAL_HEADERS})
|
|
||||||
CheckFileList(INTERNAL_FILES ${HEADER_DIR}/internal)
|
|
||||||
|
|
||||||
# Please keep these ordered alphabetically
|
|
||||||
set(REPORTER_HEADERS
|
|
||||||
${HEADER_DIR}/reporters/catch_reporter_automake.hpp
|
|
||||||
${HEADER_DIR}/reporters/catch_reporter_bases.hpp
|
|
||||||
${HEADER_DIR}/reporters/catch_reporter_compact.h
|
|
||||||
${HEADER_DIR}/reporters/catch_reporter_console.h
|
|
||||||
${HEADER_DIR}/reporters/catch_reporter_junit.h
|
|
||||||
${HEADER_DIR}/reporters/catch_reporter_listening.h
|
|
||||||
${HEADER_DIR}/reporters/catch_reporter_tap.hpp
|
|
||||||
${HEADER_DIR}/reporters/catch_reporter_teamcity.hpp
|
|
||||||
${HEADER_DIR}/reporters/catch_reporter_xml.h
|
|
||||||
)
|
|
||||||
set(REPORTER_SOURCES
|
|
||||||
${HEADER_DIR}/reporters/catch_reporter_bases.cpp
|
|
||||||
${HEADER_DIR}/reporters/catch_reporter_compact.cpp
|
|
||||||
${HEADER_DIR}/reporters/catch_reporter_console.cpp
|
|
||||||
${HEADER_DIR}/reporters/catch_reporter_junit.cpp
|
|
||||||
${HEADER_DIR}/reporters/catch_reporter_listening.cpp
|
|
||||||
${HEADER_DIR}/reporters/catch_reporter_xml.cpp
|
|
||||||
)
|
|
||||||
set(REPORTER_FILES ${REPORTER_HEADERS} ${REPORTER_SOURCES})
|
|
||||||
CheckFileList(REPORTER_FILES ${HEADER_DIR}/reporters)
|
|
||||||
|
|
||||||
# Specify the headers, too, so CLion recognises them as project files
|
|
||||||
set(HEADERS
|
|
||||||
${TOP_LEVEL_HEADERS}
|
|
||||||
${EXTERNAL_HEADERS}
|
|
||||||
${INTERNAL_HEADERS}
|
|
||||||
${REPORTER_HEADERS}
|
|
||||||
)
|
|
||||||
|
|
||||||
# Provide some groupings for IDEs
|
|
||||||
SOURCE_GROUP("Tests" FILES ${TEST_SOURCES})
|
|
||||||
SOURCE_GROUP("Surrogates" FILES ${SURROGATE_SOURCES})
|
|
||||||
|
|
||||||
|
|
||||||
# Projects consuming Catch via ExternalProject_Add might want to use install step
|
|
||||||
# without building all of our selftests.
|
|
||||||
|
|
||||||
if(DEFINED NO_SELFTEST)
|
|
||||||
message(DEPRECATION "*** CMake option NO_SELFTEST is deprecated; use BUILD_TESTING instead")
|
|
||||||
if (NO_SELFTEST)
|
|
||||||
set(BUILD_TESTING OFF CACHE BOOL "Disable Catch2 internal testsuite" FORCE)
|
|
||||||
else()
|
|
||||||
set(BUILD_TESTING ON CACHE BOOL "Disable Catch2 internal testsuite" FORCE)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include(CTest)
|
|
||||||
|
|
||||||
if (BUILD_TESTING AND NOT_SUBPROJECT)
|
if (BUILD_TESTING AND NOT_SUBPROJECT)
|
||||||
add_executable(SelfTest ${TEST_SOURCES} ${IMPL_SOURCES} ${REPORTER_SOURCES} ${SURROGATE_SOURCES} ${HEADERS})
|
add_subdirectory(projects)
|
||||||
target_include_directories(SelfTest PRIVATE ${HEADER_DIR})
|
endif()
|
||||||
|
|
||||||
if(USE_CPP14)
|
|
||||||
message(STATUS "Enabling C++14")
|
|
||||||
set_property(TARGET SelfTest PROPERTY CXX_STANDARD 14)
|
|
||||||
else()
|
|
||||||
message(STATUS "Enabling C++11")
|
|
||||||
set_property(TARGET SelfTest PROPERTY CXX_STANDARD 11)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set_property(TARGET SelfTest PROPERTY CXX_STANDARD_REQUIRED ON)
|
|
||||||
set_property(TARGET SelfTest PROPERTY CXX_EXTENSIONS OFF)
|
|
||||||
|
|
||||||
if (CATCH_ENABLE_COVERAGE)
|
|
||||||
set(ENABLE_COVERAGE ON CACHE BOOL "Enable coverage build." FORCE)
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake")
|
|
||||||
find_package(codecov)
|
|
||||||
add_coverage(SelfTest)
|
|
||||||
list(APPEND LCOV_REMOVE_PATTERNS "'/usr/*'")
|
|
||||||
coverage_evaluate()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Add per compiler options
|
|
||||||
if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang|GNU" )
|
|
||||||
target_compile_options( SelfTest PRIVATE -Wall -Wextra -Wunreachable-code -Wpedantic)
|
|
||||||
if (CATCH_ENABLE_WERROR)
|
|
||||||
target_compile_options( SelfTest PRIVATE -Werror)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
# Clang specific options go here
|
|
||||||
if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
|
||||||
target_compile_options( SelfTest PRIVATE -Wweak-vtables -Wexit-time-destructors -Wglobal-constructors -Wmissing-noreturn )
|
|
||||||
endif()
|
|
||||||
if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" )
|
|
||||||
STRING(REGEX REPLACE "/W[0-9]" "/W4" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # override default warning level
|
|
||||||
target_compile_options( SelfTest PRIVATE /w44265 /w44061 /w44062 )
|
|
||||||
if (CATCH_ENABLE_WERROR)
|
|
||||||
target_compile_options( SelfTest PRIVATE /WX)
|
|
||||||
endif()
|
|
||||||
# Force MSVC to consider everything as encoded in utf-8
|
|
||||||
target_compile_options( SelfTest PRIVATE /utf-8 )
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
# configure unit tests via CTest
|
|
||||||
include(CTest)
|
|
||||||
add_test(NAME RunTests COMMAND $<TARGET_FILE:SelfTest>)
|
|
||||||
|
|
||||||
add_test(NAME ListTests COMMAND $<TARGET_FILE:SelfTest> --list-tests --verbosity high)
|
|
||||||
set_tests_properties(ListTests PROPERTIES
|
|
||||||
PASS_REGULAR_EXPRESSION "[0-9]+ test cases"
|
|
||||||
FAIL_REGULAR_EXPRESSION "Hidden Test"
|
|
||||||
)
|
|
||||||
|
|
||||||
add_test(NAME ListTags COMMAND $<TARGET_FILE:SelfTest> --list-tags)
|
|
||||||
set_tests_properties(ListTags PROPERTIES
|
|
||||||
PASS_REGULAR_EXPRESSION "[0-9]+ tags"
|
|
||||||
FAIL_REGULAR_EXPRESSION "[.]")
|
|
||||||
|
|
||||||
add_test(NAME ListReporters COMMAND $<TARGET_FILE:SelfTest> --list-reporters)
|
|
||||||
set_tests_properties(ListReporters PROPERTIES PASS_REGULAR_EXPRESSION "Available reporters:")
|
|
||||||
|
|
||||||
add_test(NAME ListTestNamesOnly COMMAND $<TARGET_FILE:SelfTest> --list-test-names-only)
|
|
||||||
set_tests_properties(ListTestNamesOnly PROPERTIES
|
|
||||||
PASS_REGULAR_EXPRESSION "Regex string matcher"
|
|
||||||
FAIL_REGULAR_EXPRESSION "Hidden Test")
|
|
||||||
|
|
||||||
add_test(NAME NoAssertions COMMAND $<TARGET_FILE:SelfTest> -w NoAssertions)
|
|
||||||
set_tests_properties(NoAssertions PROPERTIES PASS_REGULAR_EXPRESSION "No assertions in test case")
|
|
||||||
|
|
||||||
add_test(NAME NoTest COMMAND $<TARGET_FILE:SelfTest> -w NoTests "___nonexistent_test___")
|
|
||||||
set_tests_properties(NoTest PROPERTIES PASS_REGULAR_EXPRESSION "No test cases matched")
|
|
||||||
|
|
||||||
# AppVeyor has a Python 2.7 in path, but doesn't have .py files as autorunnable
|
|
||||||
add_test(NAME ApprovalTests COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/scripts/approvalTests.py $<TARGET_FILE:SelfTest>)
|
|
||||||
set_tests_properties(ApprovalTests PROPERTIES FAIL_REGULAR_EXPRESSION "Results differed")
|
|
||||||
|
|
||||||
if (CATCH_USE_VALGRIND)
|
|
||||||
add_test(NAME ValgrindRunTests COMMAND valgrind --leak-check=full --error-exitcode=1 $<TARGET_FILE:SelfTest>)
|
|
||||||
add_test(NAME ValgrindListTests COMMAND valgrind --leak-check=full --error-exitcode=1 $<TARGET_FILE:SelfTest> --list-tests --verbosity high)
|
|
||||||
set_tests_properties(ValgrindListTests PROPERTIES PASS_REGULAR_EXPRESSION "definitely lost: 0 bytes in 0 blocks")
|
|
||||||
add_test(NAME ValgrindListTags COMMAND valgrind --leak-check=full --error-exitcode=1 $<TARGET_FILE:SelfTest> --list-tags)
|
|
||||||
set_tests_properties(ValgrindListTags PROPERTIES PASS_REGULAR_EXPRESSION "definitely lost: 0 bytes in 0 blocks")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
endif() # !NO_SELFTEST
|
|
||||||
|
|
||||||
|
|
||||||
if(CATCH_BUILD_EXAMPLES)
|
if(CATCH_BUILD_EXAMPLES)
|
||||||
add_subdirectory(examples)
|
add_subdirectory(examples)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(DIRECTORY "single_include/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/catch")
|
|
||||||
|
|
||||||
install(DIRECTORY docs/ DESTINATION "${CMAKE_INSTALL_DOCDIR}")
|
|
||||||
|
|
||||||
## Provide some pkg-config integration
|
|
||||||
# Don't bother on Windows
|
|
||||||
if(NOT WIN32 OR NOT CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
|
|
||||||
|
|
||||||
set(PKGCONFIG_INSTALL_DIR
|
|
||||||
"${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig"
|
|
||||||
CACHE PATH "Path where catch.pc is installed"
|
|
||||||
)
|
|
||||||
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/catch.pc.in ${CMAKE_CURRENT_BINARY_DIR}/catch.pc @ONLY)
|
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/catch.pc DESTINATION ${PKGCONFIG_INSTALL_DIR})
|
|
||||||
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# add catch as a 'linkable' target
|
# add catch as a 'linkable' target
|
||||||
add_library(Catch INTERFACE)
|
add_library(Catch2 INTERFACE)
|
||||||
|
|
||||||
# depend on some obvious c++11 features so the dependency is transitively added dependants
|
|
||||||
target_compile_features(Catch INTERFACE cxx_auto_type cxx_constexpr cxx_noexcept)
|
|
||||||
|
|
||||||
target_include_directories(Catch
|
|
||||||
INTERFACE
|
# depend on some obvious c++11 features so the dependency is transitively added dependents
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/single_include>
|
target_compile_features(Catch2
|
||||||
$<INSTALL_INTERFACE:include/catch>
|
INTERFACE
|
||||||
$<INSTALL_INTERFACE:include>)
|
cxx_alignas
|
||||||
|
cxx_alignof
|
||||||
|
cxx_attributes
|
||||||
|
cxx_auto_type
|
||||||
|
cxx_constexpr
|
||||||
|
cxx_defaulted_functions
|
||||||
|
cxx_deleted_functions
|
||||||
|
cxx_final
|
||||||
|
cxx_lambdas
|
||||||
|
cxx_noexcept
|
||||||
|
cxx_override
|
||||||
|
cxx_range_for
|
||||||
|
cxx_rvalue_references
|
||||||
|
cxx_static_assert
|
||||||
|
cxx_strong_enums
|
||||||
|
cxx_trailing_return_types
|
||||||
|
cxx_unicode_literals
|
||||||
|
cxx_user_literals
|
||||||
|
cxx_variadic_macros
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(Catch2
|
||||||
|
INTERFACE
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/single_include>
|
||||||
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||||
|
)
|
||||||
|
|
||||||
# provide a namespaced alias for clients to 'link' against if catch is included as a sub-project
|
# provide a namespaced alias for clients to 'link' against if catch is included as a sub-project
|
||||||
add_library(Catch2::Catch ALIAS Catch)
|
add_library(Catch2::Catch2 ALIAS Catch2)
|
||||||
|
|
||||||
set(CATCH_CMAKE_CONFIG_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Catch2")
|
set(CATCH_CMAKE_CONFIG_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Catch2")
|
||||||
|
|
||||||
# create and install an export set for catch target as Catch2::Catch
|
|
||||||
install(TARGETS Catch EXPORT Catch2Config DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
||||||
|
|
||||||
install(EXPORT Catch2Config
|
|
||||||
NAMESPACE Catch2::
|
|
||||||
DESTINATION ${CATCH_CMAKE_CONFIG_DESTINATION})
|
|
||||||
|
|
||||||
# install Catch2ConfigVersion.cmake file to handle versions in find_package
|
|
||||||
include(CMakePackageConfigHelpers)
|
include(CMakePackageConfigHelpers)
|
||||||
|
configure_package_config_file(
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/CMake/Catch2Config.cmake.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/Catch2Config.cmake
|
||||||
|
INSTALL_DESTINATION
|
||||||
|
${CATCH_CMAKE_CONFIG_DESTINATION}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# create and install an export set for catch target as Catch2::Catch
|
||||||
|
install(
|
||||||
|
TARGETS
|
||||||
|
Catch2
|
||||||
|
EXPORT
|
||||||
|
Catch2Targets
|
||||||
|
DESTINATION
|
||||||
|
${CMAKE_INSTALL_LIBDIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
install(
|
||||||
|
EXPORT
|
||||||
|
Catch2Targets
|
||||||
|
NAMESPACE
|
||||||
|
Catch2::
|
||||||
|
DESTINATION
|
||||||
|
${CATCH_CMAKE_CONFIG_DESTINATION}
|
||||||
|
)
|
||||||
|
|
||||||
write_basic_package_version_file(
|
write_basic_package_version_file(
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/Catch2ConfigVersion.cmake"
|
"${CMAKE_CURRENT_BINARY_DIR}/Catch2ConfigVersion.cmake"
|
||||||
COMPATIBILITY SameMajorVersion)
|
COMPATIBILITY
|
||||||
|
SameMajorVersion
|
||||||
|
)
|
||||||
|
|
||||||
install(FILES
|
install(
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/Catch2ConfigVersion.cmake"
|
DIRECTORY
|
||||||
DESTINATION ${CATCH_CMAKE_CONFIG_DESTINATION})
|
"single_include/"
|
||||||
|
DESTINATION
|
||||||
|
"${CMAKE_INSTALL_INCLUDEDIR}"
|
||||||
|
)
|
||||||
|
|
||||||
|
install(
|
||||||
|
FILES
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/Catch2Config.cmake"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/Catch2ConfigVersion.cmake"
|
||||||
|
DESTINATION
|
||||||
|
${CATCH_CMAKE_CONFIG_DESTINATION}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Install documentation
|
||||||
|
if(CATCH_INSTALL_DOCS)
|
||||||
|
install(
|
||||||
|
DIRECTORY
|
||||||
|
docs/
|
||||||
|
DESTINATION
|
||||||
|
"${CMAKE_INSTALL_DOCDIR}"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CATCH_INSTALL_HELPERS)
|
||||||
|
# Install CMake scripts
|
||||||
|
install(
|
||||||
|
FILES
|
||||||
|
"contrib/ParseAndAddCatchTests.cmake"
|
||||||
|
"contrib/Catch.cmake"
|
||||||
|
"contrib/CatchAddTests.cmake"
|
||||||
|
DESTINATION
|
||||||
|
${CATCH_CMAKE_CONFIG_DESTINATION}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Install debugger helpers
|
||||||
|
install(
|
||||||
|
FILES
|
||||||
|
"contrib/gdbinit"
|
||||||
|
"contrib/lldbinit"
|
||||||
|
DESTINATION
|
||||||
|
${CMAKE_INSTALL_DATAROOTDIR}/Catch2
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
## Provide some pkg-config integration
|
||||||
|
set(PKGCONFIG_INSTALL_DIR
|
||||||
|
"${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig"
|
||||||
|
CACHE PATH "Path where catch2.pc is installed"
|
||||||
|
)
|
||||||
|
configure_file(
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/CMake/catch2.pc.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/catch2.pc
|
||||||
|
@ONLY
|
||||||
|
)
|
||||||
|
install(
|
||||||
|
FILES
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/catch2.pc"
|
||||||
|
DESTINATION
|
||||||
|
${PKGCONFIG_INSTALL_DIR}
|
||||||
|
)
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
|
|
||||||
|
|
||||||
Name: Catch
|
|
||||||
Description: Testing library for C++
|
|
||||||
Version: @Catch2_VERSION@
|
|
||||||
Cflags: -I${includedir} -I${includedir}/catch
|
|
22
conanfile.py
22
conanfile.py
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
from conans import ConanFile
|
from conans import ConanFile, CMake
|
||||||
|
|
||||||
|
|
||||||
class CatchConan(ConanFile):
|
class CatchConan(ConanFile):
|
||||||
@ -8,12 +8,24 @@ class CatchConan(ConanFile):
|
|||||||
description = "A modern, C++-native, header-only, framework for unit-tests, TDD and BDD"
|
description = "A modern, C++-native, header-only, framework for unit-tests, TDD and BDD"
|
||||||
author = "philsquared"
|
author = "philsquared"
|
||||||
generators = "cmake"
|
generators = "cmake"
|
||||||
exports_sources = "single_include/*"
|
# Only needed until conan 1.5 is released
|
||||||
url = "https://github.com/philsquared/Catch"
|
settings = "compiler", "arch"
|
||||||
|
exports_sources = "single_include/*", "CMakeLists.txt", "CMake/catch2.pc.in", "LICENSE.txt"
|
||||||
|
url = "https://github.com/catchorg/Catch2"
|
||||||
license = "Boost Software License - Version 1.0. http://www.boost.org/LICENSE_1_0.txt"
|
license = "Boost Software License - Version 1.0. http://www.boost.org/LICENSE_1_0.txt"
|
||||||
|
|
||||||
|
def build(self):
|
||||||
|
pass
|
||||||
|
|
||||||
def package(self):
|
def package(self):
|
||||||
self.copy(pattern="catch.hpp", src="single_include", dst="include")
|
cmake = CMake(self)
|
||||||
|
cmake.definitions["BUILD_TESTING"] = "OFF"
|
||||||
|
cmake.definitions["CATCH_INSTALL_DOCS"] = "OFF"
|
||||||
|
cmake.definitions["CATCH_INSTALL_HELPERS"] = "OFF"
|
||||||
|
cmake.configure()
|
||||||
|
cmake.install()
|
||||||
|
|
||||||
|
self.copy(pattern="LICENSE.txt", dst="licenses")
|
||||||
|
|
||||||
def package_id(self):
|
def package_id(self):
|
||||||
self.info.header_only()
|
self.info.header_only()
|
||||||
|
@ -20,7 +20,10 @@ Fine tuning:
|
|||||||
|
|
||||||
Running:
|
Running:
|
||||||
* [Command line](command-line.md#top)
|
* [Command line](command-line.md#top)
|
||||||
* [CI and Build system integration](build-systems.md#top)
|
|
||||||
|
Odds and ends:
|
||||||
|
* [CMake integration](cmake-integration.md#top)
|
||||||
|
* [CI and other miscellaneous pieces](ci-and-misc.md#top)
|
||||||
|
|
||||||
FAQ:
|
FAQ:
|
||||||
* [Why are my tests slow to compile?](slow-compiles.md#top)
|
* [Why are my tests slow to compile?](slow-compiles.md#top)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<a id="top"></a>
|
<a id="top"></a>
|
||||||
# CI and build system integration
|
# CI and other odd pieces
|
||||||
|
|
||||||
|
This page talks about how Catch integrates with Continuous Integration
|
||||||
Build Systems may refer to low-level tools, like CMake, or larger systems that run on servers, like Jenkins or TeamCity. This page will talk about both.
|
Build Systems may refer to low-level tools, like CMake, or larger systems that run on servers, like Jenkins or TeamCity. This page will talk about both.
|
||||||
|
|
||||||
## Continuous Integration systems
|
## Continuous Integration systems
|
||||||
@ -71,105 +72,31 @@ Catch offers prototypal support for being included in precompiled headers, but b
|
|||||||
* include "catch.hpp" again
|
* include "catch.hpp" again
|
||||||
|
|
||||||
|
|
||||||
### CMake
|
|
||||||
|
|
||||||
In general we recommend "vendoring" Catch's single-include releases inside your own repository. If you do this, the following example shows a minimal CMake project:
|
|
||||||
```CMake
|
|
||||||
cmake_minimum_required(VERSION 3.0)
|
|
||||||
|
|
||||||
project(cmake_test)
|
|
||||||
|
|
||||||
# Prepare "Catch" library for other executables
|
|
||||||
set(CATCH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/catch)
|
|
||||||
add_library(Catch INTERFACE)
|
|
||||||
target_include_directories(Catch INTERFACE ${CATCH_INCLUDE_DIR})
|
|
||||||
|
|
||||||
# Make test executable
|
|
||||||
set(TEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp)
|
|
||||||
add_executable(tests ${TEST_SOURCES})
|
|
||||||
target_link_libraries(tests Catch)
|
|
||||||
```
|
|
||||||
Note that it assumes that the path to the Catch's header is `catch/catch.hpp` from the `CMakeLists.txt` file.
|
|
||||||
|
|
||||||
|
|
||||||
You can also use the following CMake snippet to automatically fetch the entire Catch repository from github and configure it as an external project:
|
|
||||||
```CMake
|
|
||||||
cmake_minimum_required(VERSION 2.8.8)
|
|
||||||
project(catch_builder CXX)
|
|
||||||
include(ExternalProject)
|
|
||||||
find_package(Git REQUIRED)
|
|
||||||
|
|
||||||
ExternalProject_Add(
|
|
||||||
catch
|
|
||||||
PREFIX ${CMAKE_BINARY_DIR}/catch
|
|
||||||
GIT_REPOSITORY https://github.com/philsquared/Catch.git
|
|
||||||
TIMEOUT 10
|
|
||||||
UPDATE_COMMAND ${GIT_EXECUTABLE} pull
|
|
||||||
CONFIGURE_COMMAND ""
|
|
||||||
BUILD_COMMAND ""
|
|
||||||
INSTALL_COMMAND ""
|
|
||||||
LOG_DOWNLOAD ON
|
|
||||||
)
|
|
||||||
|
|
||||||
# Expose required variable (CATCH_INCLUDE_DIR) to parent scope
|
|
||||||
ExternalProject_Get_Property(catch source_dir)
|
|
||||||
set(CATCH_INCLUDE_DIR ${source_dir}/single_include CACHE INTERNAL "Path to include folder for Catch")
|
|
||||||
```
|
|
||||||
|
|
||||||
If you put it in, e.g., `${PROJECT_SRC_DIR}/${EXT_PROJECTS_DIR}/catch/`, you can use it in your project by adding the following to your root CMake file:
|
|
||||||
|
|
||||||
```CMake
|
|
||||||
# Includes Catch in the project:
|
|
||||||
add_subdirectory(${EXT_PROJECTS_DIR}/catch)
|
|
||||||
include_directories(${CATCH_INCLUDE_DIR} ${COMMON_INCLUDES})
|
|
||||||
enable_testing(true) # Enables unit-testing.
|
|
||||||
```
|
|
||||||
|
|
||||||
The advantage of this approach is that you can always automatically update Catch to the latest release. The disadvantage is that it means bringing in lot more than you need.
|
|
||||||
|
|
||||||
|
|
||||||
### Automatic test registration
|
|
||||||
We provide 2 CMake scripts that can automatically register Catch-based
|
|
||||||
tests with CTest,
|
|
||||||
* `contrib/ParseAndAddCatchTests.cmake`
|
|
||||||
* `contrib/CatchAddTests.cmake`
|
|
||||||
|
|
||||||
The first is based on parsing the test implementation files, and attempts
|
|
||||||
to register all `TEST_CASE`s using their tags as labels. This means that
|
|
||||||
these:
|
|
||||||
|
|
||||||
```cpp
|
|
||||||
TEST_CASE("Test1", "[unit]") {
|
|
||||||
int a = 1;
|
|
||||||
int b = 2;
|
|
||||||
REQUIRE(a == b);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("Test2") {
|
|
||||||
int a = 1;
|
|
||||||
int b = 2;
|
|
||||||
REQUIRE(a == b);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("Test3", "[a][b][c]") {
|
|
||||||
int a = 1;
|
|
||||||
int b = 2;
|
|
||||||
REQUIRE(a == b);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
would be registered as 3 tests, `Test1`, `Test2` and `Test3`,
|
|
||||||
and 4 CTest labels would be created, `a`, `b`, `c` and `unit`.
|
|
||||||
|
|
||||||
|
|
||||||
The second is based on parsing the output of a Catch binary given
|
|
||||||
`--list-test-names-only`. This means that it deals with inactive
|
|
||||||
(e.g. commented-out) tests better, but requires CMake 3.10 for full
|
|
||||||
functionality.
|
|
||||||
|
|
||||||
### CodeCoverage module (GCOV, LCOV...)
|
### CodeCoverage module (GCOV, LCOV...)
|
||||||
|
|
||||||
If you are using GCOV tool to get testing coverage of your code, and are not sure how to integrate it with CMake and Catch, there should be an external example over at https://github.com/fkromer/catch_cmake_coverage
|
If you are using GCOV tool to get testing coverage of your code, and are not sure how to integrate it with CMake and Catch, there should be an external example over at https://github.com/fkromer/catch_cmake_coverage
|
||||||
|
|
||||||
|
|
||||||
|
### pkg-config
|
||||||
|
|
||||||
|
Catch2 provides a rudimentary pkg-config integration, by registering itself
|
||||||
|
under the name `catch2`. This means that after Catch2 is installed, you
|
||||||
|
can use `pkg-config` to get its include path: `pkg-config --cflags catch2`.
|
||||||
|
|
||||||
|
### gdb and lldb scripts
|
||||||
|
|
||||||
|
Catch2's `contrib` folder also contains two simple debugger scripts,
|
||||||
|
`gdbinit` for `gdb` and `lldbinit` for `lldb`. If loaded into their
|
||||||
|
respective debugger, these will tell it to step over Catch2's internals
|
||||||
|
when stepping through code.
|
||||||
|
|
||||||
|
|
||||||
|
## CMake
|
||||||
|
|
||||||
|
[As it has been getting kinda long, the documentation of Catch2's
|
||||||
|
integration with CMake has been moved to its own page.](cmake-integration.md#top)
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
[Home](Readme.md#top)
|
[Home](Readme.md#top)
|
185
docs/cmake-integration.md
Normal file
185
docs/cmake-integration.md
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
<a id="top"></a>
|
||||||
|
# CMake integration
|
||||||
|
|
||||||
|
Because we use CMake to build Catch2, we also provide a couple of
|
||||||
|
integration points for our users.
|
||||||
|
|
||||||
|
1) Catch2 exports a (namespaced) CMake target
|
||||||
|
2) Catch2's repository contains CMake scripts for automatic registration
|
||||||
|
of `TEST_CASE`s in CTest
|
||||||
|
|
||||||
|
## CMake target
|
||||||
|
|
||||||
|
Catch2's CMake build exports an interface target `Catch2::Catch2`. Linking
|
||||||
|
against it will add the proper include path and all necessary capabilities
|
||||||
|
to the resulting binary.
|
||||||
|
|
||||||
|
This means that if Catch2 has been installed on the system, it should be
|
||||||
|
enough to do:
|
||||||
|
```cmake
|
||||||
|
find_package(Catch2 REQUIRED)
|
||||||
|
target_link_libraries(tests Catch2::Catch2)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
This target is also provided when Catch2 is used as a subdirectory.
|
||||||
|
Assuming that Catch2 has been cloned to `lib/Catch2`:
|
||||||
|
```cmake
|
||||||
|
add_subdirectory(lib/Catch2)
|
||||||
|
target_link_libraries(tests Catch2::Catch2)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Automatic test registration
|
||||||
|
|
||||||
|
Catch2's repository also contains two CMake scripts that help users
|
||||||
|
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`
|
||||||
|
|
||||||
|
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
|
||||||
|
to your CMake module path.
|
||||||
|
|
||||||
|
### `Catch.cmake` and `AddCatchTests.cmake`
|
||||||
|
|
||||||
|
`Catch.cmake` provides function `catch_discover_tests` to get tests from
|
||||||
|
a target. This function works by running the resulting executable with
|
||||||
|
`--list-test-names-only` flag, and then parsing the output to find all
|
||||||
|
existing tests.
|
||||||
|
|
||||||
|
#### Usage
|
||||||
|
```cmake
|
||||||
|
cmake_minimum_required(VERSION 3.5)
|
||||||
|
|
||||||
|
project(baz LANGUAGES CXX VERSION 0.0.1)
|
||||||
|
|
||||||
|
find_package(Catch2 REQUIRED)
|
||||||
|
add_executable(foo test.cpp)
|
||||||
|
target_link_libraries(foo Catch2::Catch2)
|
||||||
|
|
||||||
|
include(CTest)
|
||||||
|
include(Catch)
|
||||||
|
catch_discover_tests(foo)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Customization
|
||||||
|
`catch_discover_tests` can be given several extra argumets:
|
||||||
|
```cmake
|
||||||
|
catch_discover_tests(target
|
||||||
|
[TEST_SPEC arg1...]
|
||||||
|
[EXTRA_ARGS arg1...]
|
||||||
|
[WORKING_DIRECTORY dir]
|
||||||
|
[TEST_PREFIX prefix]
|
||||||
|
[TEST_SUFFIX suffix]
|
||||||
|
[PROPERTIES name1 value1...]
|
||||||
|
[TEST_LIST var]
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
* `TEST_SPEC arg1...`
|
||||||
|
|
||||||
|
Specifies test cases, wildcarded test cases, tags and tag expressions to
|
||||||
|
pass to the Catch executable alongside the `--list-test-names-only` flag.
|
||||||
|
|
||||||
|
|
||||||
|
* `EXTRA_ARGS arg1...`
|
||||||
|
|
||||||
|
Any extra arguments to pass on the command line to each test case.
|
||||||
|
|
||||||
|
|
||||||
|
* `WORKING_DIRECTORY dir`
|
||||||
|
|
||||||
|
Specifies the directory in which to run the discovered test cases. If this
|
||||||
|
option is not provided, the current binary directory is used.
|
||||||
|
|
||||||
|
|
||||||
|
* `TEST_PREFIX prefix`
|
||||||
|
|
||||||
|
Specifies a _prefix_ to be added to the name of each discovered test case.
|
||||||
|
This can be useful when the same test executable is being used in multiple
|
||||||
|
calls to `catch_discover_tests()`, with different `TEST_SPEC` or `EXTRA_ARGS`.
|
||||||
|
|
||||||
|
|
||||||
|
* `TEST_SUFFIX suffix`
|
||||||
|
|
||||||
|
Same as `TEST_PREFIX`, except it specific the _suffix_ for the test names.
|
||||||
|
Both `TEST_PREFIX` and `TEST_SUFFIX` can be specified at the same time.
|
||||||
|
|
||||||
|
|
||||||
|
* `PROPERTIES name1 value1...`
|
||||||
|
|
||||||
|
Specifies additional properties to be set on all tests discovered by this
|
||||||
|
invocation of `catch_discover_tests`.
|
||||||
|
|
||||||
|
|
||||||
|
* `TEST_LIST var`
|
||||||
|
|
||||||
|
Make the list of tests available in the variable `var`, rather than the
|
||||||
|
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.
|
||||||
|
|
||||||
|
|
||||||
|
### `ParseAndAddCatchTests.cmake`
|
||||||
|
|
||||||
|
`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.
|
||||||
|
|
||||||
|
|
||||||
|
#### Usage
|
||||||
|
|
||||||
|
```cmake
|
||||||
|
cmake_minimum_required(VERSION 3.5)
|
||||||
|
|
||||||
|
project(baz LANGUAGES CXX VERSION 0.0.1)
|
||||||
|
|
||||||
|
find_package(Catch2 REQUIRED)
|
||||||
|
add_executable(foo test.cpp)
|
||||||
|
target_link_libraries(foo Catch2::Catch2)
|
||||||
|
|
||||||
|
include(CTest)
|
||||||
|
include(ParseAndAddCatchTests)
|
||||||
|
ParseAndAddCatchTests(foo)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Customization
|
||||||
|
|
||||||
|
`ParseAndAddCatchTests` provides some customization points:
|
||||||
|
* `PARSE_CATCH_TESTS_VERBOSE` -- When `ON`, the script prints debug
|
||||||
|
messages. Defaults to `OFF`.
|
||||||
|
* `PARSE_CATCH_TESTS_NO_HIDDEN_TESTS` -- When `ON`, hidden tests (tests
|
||||||
|
tagged with any of `[!hide]`, `[.]` or `[.foo]`) will not be registered.
|
||||||
|
Defaults to `OFF`.
|
||||||
|
* `PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME` -- When `ON`, adds fixture
|
||||||
|
class name to the test name in CTest. Defaults to `ON`.
|
||||||
|
* `PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME` -- When `ON`, adds target
|
||||||
|
name to the test name in CTest. Defaults to `ON`.
|
||||||
|
* `PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS` -- When `ON`, adds test
|
||||||
|
file to `CMAKE_CONFIGURE_DEPENDS`. This means that the CMake configuration
|
||||||
|
step will be re-ran when the test files change, letting new tests be
|
||||||
|
automatically discovered. Defaults to `OFF`.
|
||||||
|
|
||||||
|
|
||||||
|
## CMake project options
|
||||||
|
|
||||||
|
Catch2's CMake project also provides some options for other projects
|
||||||
|
that consume it. These are
|
||||||
|
|
||||||
|
* `CATCH_BUILD_EXAMPLES` -- When `ON`, Catch2's usage examples will be
|
||||||
|
built. Defaults to `OFF`.
|
||||||
|
* `CATCH_INSTALL_DOCS` -- When `ON`, Catch2's documentation will be
|
||||||
|
included in the installation. Defaults to `ON`.
|
||||||
|
* `CATCH_INSTALL_HELPERS` -- When `ON`, Catch2's contrib folder will be
|
||||||
|
included in the installation. Defaults to `ON`.
|
||||||
|
* `BUILD_TESTING` -- When `ON` and the project is not used as a subproject,
|
||||||
|
Catch2's test binary will be built. Defaults to `ON`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
[Home](Readme.md#top)
|
@ -14,6 +14,9 @@
|
|||||||
|
|
||||||
The simplest way to get Catch2 is to download the latest [single header version](https://raw.githubusercontent.com/CatchOrg/Catch2/master/single_include/catch.hpp). The single header is generated by merging a set of individual headers but it is still just normal source code in a header file.
|
The simplest way to get Catch2 is to download the latest [single header version](https://raw.githubusercontent.com/CatchOrg/Catch2/master/single_include/catch.hpp). The single header is generated by merging a set of individual headers but it is still just normal source code in a header file.
|
||||||
|
|
||||||
|
Alternative ways of getting Catch2 include using your system package
|
||||||
|
manager, or installing it using its CMake package.
|
||||||
|
|
||||||
The full source for Catch2, including test projects, documentation, and other things, is hosted on GitHub. [http://catch-lib.net](http://catch-lib.net) will redirect you there.
|
The full source for Catch2, including test projects, documentation, and other things, is hosted on GitHub. [http://catch-lib.net](http://catch-lib.net) will redirect you there.
|
||||||
|
|
||||||
|
|
||||||
@ -23,6 +26,9 @@ Catch2 is header only. All you need to do is drop the file somewhere reachable f
|
|||||||
|
|
||||||
The rest of this tutorial will assume that the Catch2 single-include header (or the include folder) is available unqualified - but you may need to prefix it with a folder name if necessary.
|
The rest of this tutorial will assume that the Catch2 single-include header (or the include folder) is available unqualified - but you may need to prefix it with a folder name if necessary.
|
||||||
|
|
||||||
|
_If you have installed Catch2 from system package manager, or CMake
|
||||||
|
package, you need to include the header as `#include <catch2/catch.hpp>`_
|
||||||
|
|
||||||
## Writing tests
|
## Writing tests
|
||||||
|
|
||||||
Let's start with a really simple example ([code](../examples/010-TestCase.cpp)). Say you have written a function to calculate factorials and now you want to test it (let's leave aside TDD for now).
|
Let's start with a really simple example ([code](../examples/010-TestCase.cpp)). Say you have written a function to calculate factorials and now you want to test it (let's leave aside TDD for now).
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
// Let Catch provide main():
|
// Let Catch provide main():
|
||||||
#define CATCH_CONFIG_MAIN
|
#define CATCH_CONFIG_MAIN
|
||||||
|
|
||||||
#include "catch.hpp"
|
#include <catch2/catch.hpp>
|
||||||
|
|
||||||
// That's it
|
// That's it
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
// Let Catch provide main():
|
// Let Catch provide main():
|
||||||
#define CATCH_CONFIG_MAIN
|
#define CATCH_CONFIG_MAIN
|
||||||
|
|
||||||
#include "catch.hpp"
|
#include <catch2/catch.hpp>
|
||||||
|
|
||||||
int Factorial( int number ) {
|
int Factorial( int number ) {
|
||||||
return number <= 1 ? number : Factorial( number - 1 ) * number; // fail
|
return number <= 1 ? number : Factorial( number - 1 ) * number; // fail
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
// Let Catch provide main():
|
// Let Catch provide main():
|
||||||
#define CATCH_CONFIG_MAIN
|
#define CATCH_CONFIG_MAIN
|
||||||
|
|
||||||
#include "catch.hpp"
|
#include <catch2/catch.hpp>
|
||||||
|
|
||||||
TEST_CASE( "1: All test cases reside in other .cpp files (empty)", "[multi-file:1]" ) {
|
TEST_CASE( "1: All test cases reside in other .cpp files (empty)", "[multi-file:1]" ) {
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
// main() provided by Catch in file 020-TestCase-1.cpp.
|
// main() provided by Catch in file 020-TestCase-1.cpp.
|
||||||
|
|
||||||
#include "catch.hpp"
|
#include <catch2/catch.hpp>
|
||||||
|
|
||||||
int Factorial( int number ) {
|
int Factorial( int number ) {
|
||||||
return number <= 1 ? number : Factorial( number - 1 ) * number; // fail
|
return number <= 1 ? number : Factorial( number - 1 ) * number; // fail
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
// main() provided in 000-CatchMain.cpp
|
// main() provided in 000-CatchMain.cpp
|
||||||
|
|
||||||
#include "catch.hpp"
|
#include <catch2/catch.hpp>
|
||||||
|
|
||||||
std::string one() {
|
std::string one() {
|
||||||
return "1";
|
return "1";
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
// main() provided in 000-CatchMain.cpp
|
// main() provided in 000-CatchMain.cpp
|
||||||
|
|
||||||
#include "catch.hpp"
|
#include <catch2/catch.hpp>
|
||||||
|
|
||||||
TEST_CASE( "vectors can be sized and resized", "[vector]" ) {
|
TEST_CASE( "vectors can be sized and resized", "[vector]" ) {
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
// main() provided in 000-CatchMain.cpp
|
// main() provided in 000-CatchMain.cpp
|
||||||
|
|
||||||
#include "catch.hpp"
|
#include <catch2/catch.hpp>
|
||||||
|
|
||||||
class DBConnection
|
class DBConnection
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
// main() provided in 000-CatchMain.cpp
|
// main() provided in 000-CatchMain.cpp
|
||||||
|
|
||||||
#include "catch.hpp"
|
#include <catch2/catch.hpp>
|
||||||
|
|
||||||
SCENARIO( "vectors can be sized and resized", "[vector]" ) {
|
SCENARIO( "vectors can be sized and resized", "[vector]" ) {
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
// Let Catch provide the required interfaces:
|
// Let Catch provide the required interfaces:
|
||||||
#define CATCH_CONFIG_EXTERNAL_INTERFACES
|
#define CATCH_CONFIG_EXTERNAL_INTERFACES
|
||||||
|
|
||||||
#include "catch.hpp"
|
#include <catch2/catch.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
@ -187,8 +187,7 @@ void print( std::ostream& os, int const level, std::string const& title, Catch::
|
|||||||
|
|
||||||
void print( std::ostream& os, int const level, std::string const& title, Catch::SectionInfo const& info ) {
|
void print( std::ostream& os, int const level, std::string const& title, Catch::SectionInfo const& info ) {
|
||||||
os << ws(level ) << title << ":\n"
|
os << ws(level ) << title << ":\n"
|
||||||
<< ws(level+1) << "- name: " << info.name << "\n"
|
<< ws(level+1) << "- name: " << info.name << "\n";
|
||||||
<< ws(level+1) << "- description: '" << info.description << "'\n";
|
|
||||||
print( os, level+1 , "- lineInfo", info.lineInfo );
|
print( os, level+1 , "- lineInfo", info.lineInfo );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,16 +68,16 @@ set( TARGETS_ALL ${TARGETS_SINGLE_FILE} ${TARGETS_IDIOMATIC_TESTS} 0
|
|||||||
|
|
||||||
# define program targets:
|
# define program targets:
|
||||||
|
|
||||||
add_library( CatchMain OBJECT ${EXAMPLES_DIR}/${SOURCES_IDIOMATIC_MAIN} ${HEADER_DIR}/catch.hpp )
|
add_library( CatchMain OBJECT ${EXAMPLES_DIR}/${SOURCES_IDIOMATIC_MAIN} ${HEADER_DIR}/catch2/catch.hpp )
|
||||||
|
|
||||||
add_executable( 020-TestCase ${EXAMPLES_DIR}/020-TestCase-1.cpp ${EXAMPLES_DIR}/020-TestCase-2.cpp ${HEADER_DIR}/catch.hpp )
|
add_executable( 020-TestCase ${EXAMPLES_DIR}/020-TestCase-1.cpp ${EXAMPLES_DIR}/020-TestCase-2.cpp ${HEADER_DIR}/catch2/catch.hpp )
|
||||||
|
|
||||||
foreach( name ${TARGETS_SINGLE_FILE} )
|
foreach( name ${TARGETS_SINGLE_FILE} )
|
||||||
add_executable( ${name} ${EXAMPLES_DIR}/${name}.cpp ${HEADER_DIR}/catch.hpp )
|
add_executable( ${name} ${EXAMPLES_DIR}/${name}.cpp ${HEADER_DIR}/catch2/catch.hpp )
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
foreach( name ${TARGETS_IDIOMATIC_TESTS} )
|
foreach( name ${TARGETS_IDIOMATIC_TESTS} )
|
||||||
add_executable( ${name} ${EXAMPLES_DIR}/${name}.cpp $<TARGET_OBJECTS:CatchMain> ${HEADER_DIR}/catch.hpp )
|
add_executable( ${name} ${EXAMPLES_DIR}/${name}.cpp $<TARGET_OBJECTS:CatchMain> ${HEADER_DIR}/catch2/catch.hpp )
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
foreach( name ${TARGETS_ALL} )
|
foreach( name ${TARGETS_ALL} )
|
||||||
|
@ -135,6 +135,7 @@
|
|||||||
#define CATCH_METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
|
#define CATCH_METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
|
||||||
#define CATCH_REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ )
|
#define CATCH_REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ )
|
||||||
#define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
|
#define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
|
||||||
|
#define CATCH_DYNAMIC_SECTION( ... ) INTERNAL_CATCH_DYNAMIC_SECTION( __VA_ARGS__ )
|
||||||
#define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ )
|
#define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ )
|
||||||
#define CATCH_FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
#define CATCH_FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
||||||
#define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( "CATCH_SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
#define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( "CATCH_SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
||||||
@ -144,11 +145,11 @@
|
|||||||
// "BDD-style" convenience wrappers
|
// "BDD-style" convenience wrappers
|
||||||
#define CATCH_SCENARIO( ... ) CATCH_TEST_CASE( "Scenario: " __VA_ARGS__ )
|
#define CATCH_SCENARIO( ... ) CATCH_TEST_CASE( "Scenario: " __VA_ARGS__ )
|
||||||
#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " __VA_ARGS__ )
|
#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " __VA_ARGS__ )
|
||||||
#define CATCH_GIVEN( desc ) CATCH_SECTION( std::string( "Given: ") + desc )
|
#define CATCH_GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " Given: " << desc )
|
||||||
#define CATCH_WHEN( desc ) CATCH_SECTION( std::string( " When: ") + desc )
|
#define CATCH_WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " When: " << desc )
|
||||||
#define CATCH_AND_WHEN( desc ) CATCH_SECTION( std::string( " And: ") + desc )
|
#define CATCH_AND_WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( "And when: " << desc )
|
||||||
#define CATCH_THEN( desc ) CATCH_SECTION( std::string( " Then: ") + desc )
|
#define CATCH_THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " Then: " << desc )
|
||||||
#define CATCH_AND_THEN( desc ) CATCH_SECTION( std::string( " And: ") + desc )
|
#define CATCH_AND_THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And: " << desc )
|
||||||
|
|
||||||
// If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required
|
// If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required
|
||||||
#else
|
#else
|
||||||
@ -194,6 +195,7 @@
|
|||||||
#define METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
|
#define METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )
|
||||||
#define REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ )
|
#define REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ )
|
||||||
#define SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
|
#define SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )
|
||||||
|
#define DYNAMIC_SECTION( ... ) INTERNAL_CATCH_DYNAMIC_SECTION( __VA_ARGS__ )
|
||||||
#define FAIL( ... ) INTERNAL_CATCH_MSG( "FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ )
|
#define FAIL( ... ) INTERNAL_CATCH_MSG( "FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ )
|
||||||
#define FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
#define FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
||||||
#define SUCCEED( ... ) INTERNAL_CATCH_MSG( "SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
#define SUCCEED( ... ) INTERNAL_CATCH_MSG( "SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
||||||
@ -207,15 +209,16 @@
|
|||||||
#define SCENARIO( ... ) TEST_CASE( "Scenario: " __VA_ARGS__ )
|
#define SCENARIO( ... ) TEST_CASE( "Scenario: " __VA_ARGS__ )
|
||||||
#define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " __VA_ARGS__ )
|
#define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " __VA_ARGS__ )
|
||||||
|
|
||||||
#define GIVEN( desc ) SECTION( std::string(" Given: ") + desc )
|
#define GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " Given: " << desc )
|
||||||
#define WHEN( desc ) SECTION( std::string(" When: ") + desc )
|
#define WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " When: " << desc )
|
||||||
#define AND_WHEN( desc ) SECTION( std::string("And when: ") + desc )
|
#define AND_WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( "And when: " << desc )
|
||||||
#define THEN( desc ) SECTION( std::string(" Then: ") + desc )
|
#define THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " Then: " << desc )
|
||||||
#define AND_THEN( desc ) SECTION( std::string(" And: ") + desc )
|
#define AND_THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And: " << desc )
|
||||||
|
|
||||||
using Catch::Detail::Approx;
|
using Catch::Detail::Approx;
|
||||||
|
|
||||||
#else
|
#else // CATCH_CONFIG_DISABLE
|
||||||
|
|
||||||
//////
|
//////
|
||||||
// If this config identifier is defined then all CATCH macros are prefixed with CATCH_
|
// If this config identifier is defined then all CATCH macros are prefixed with CATCH_
|
||||||
#ifdef CATCH_CONFIG_PREFIX_ALL
|
#ifdef CATCH_CONFIG_PREFIX_ALL
|
||||||
@ -260,6 +263,7 @@ using Catch::Detail::Approx;
|
|||||||
#define CATCH_METHOD_AS_TEST_CASE( method, ... )
|
#define CATCH_METHOD_AS_TEST_CASE( method, ... )
|
||||||
#define CATCH_REGISTER_TEST_CASE( Function, ... ) (void)(0)
|
#define CATCH_REGISTER_TEST_CASE( Function, ... ) (void)(0)
|
||||||
#define CATCH_SECTION( ... )
|
#define CATCH_SECTION( ... )
|
||||||
|
#define CATCH_DYNAMIC_SECTION( ... )
|
||||||
#define CATCH_FAIL( ... ) (void)(0)
|
#define CATCH_FAIL( ... ) (void)(0)
|
||||||
#define CATCH_FAIL_CHECK( ... ) (void)(0)
|
#define CATCH_FAIL_CHECK( ... ) (void)(0)
|
||||||
#define CATCH_SUCCEED( ... ) (void)(0)
|
#define CATCH_SUCCEED( ... ) (void)(0)
|
||||||
@ -319,6 +323,7 @@ using Catch::Detail::Approx;
|
|||||||
#define METHOD_AS_TEST_CASE( method, ... )
|
#define METHOD_AS_TEST_CASE( method, ... )
|
||||||
#define REGISTER_TEST_CASE( Function, ... ) (void)(0)
|
#define REGISTER_TEST_CASE( Function, ... ) (void)(0)
|
||||||
#define SECTION( ... )
|
#define SECTION( ... )
|
||||||
|
#define DYNAMIC_SECTION( ... )
|
||||||
#define FAIL( ... ) (void)(0)
|
#define FAIL( ... ) (void)(0)
|
||||||
#define FAIL_CHECK( ... ) (void)(0)
|
#define FAIL_CHECK( ... ) (void)(0)
|
||||||
#define SUCCEED( ... ) (void)(0)
|
#define SUCCEED( ... ) (void)(0)
|
||||||
|
@ -9,23 +9,21 @@
|
|||||||
#include "catch_context.h"
|
#include "catch_context.h"
|
||||||
#include "catch_interfaces_config.h"
|
#include "catch_interfaces_config.h"
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
void seedRng( IConfig const& config ) {
|
std::mt19937& rng() {
|
||||||
if( config.rngSeed() != 0 )
|
static std::mt19937 s_rng;
|
||||||
std::srand( config.rngSeed() );
|
return s_rng;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void seedRng( IConfig const& config ) {
|
||||||
|
if( config.rngSeed() != 0 ) {
|
||||||
|
std::srand( config.rngSeed() );
|
||||||
|
rng().seed( config.rngSeed() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int rngSeed() {
|
unsigned int rngSeed() {
|
||||||
return getCurrentContext().getConfig()->rngSeed();
|
return getCurrentContext().getConfig()->rngSeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
RandomNumberGenerator::result_type RandomNumberGenerator::operator()( result_type n ) const {
|
|
||||||
return std::rand() % n;
|
|
||||||
}
|
|
||||||
RandomNumberGenerator::result_type RandomNumberGenerator::operator()() const {
|
|
||||||
return std::rand() % (max)();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,31 +8,16 @@
|
|||||||
#define TWOBLUECUBES_CATCH_RANDOM_NUMBER_GENERATOR_H_INCLUDED
|
#define TWOBLUECUBES_CATCH_RANDOM_NUMBER_GENERATOR_H_INCLUDED
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <random>
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
struct IConfig;
|
struct IConfig;
|
||||||
|
|
||||||
|
std::mt19937& rng();
|
||||||
void seedRng( IConfig const& config );
|
void seedRng( IConfig const& config );
|
||||||
|
|
||||||
unsigned int rngSeed();
|
unsigned int rngSeed();
|
||||||
|
|
||||||
struct RandomNumberGenerator {
|
|
||||||
using result_type = unsigned int;
|
|
||||||
|
|
||||||
static constexpr result_type (min)() { return 0; }
|
|
||||||
static constexpr result_type (max)() { return 1000000; }
|
|
||||||
|
|
||||||
result_type operator()( result_type n ) const;
|
|
||||||
result_type operator()() const;
|
|
||||||
|
|
||||||
template<typename V>
|
|
||||||
static void shuffle( V& vector ) {
|
|
||||||
RandomNumberGenerator rng;
|
|
||||||
std::shuffle( vector.begin(), vector.end(), rng );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_RANDOM_NUMBER_GENERATOR_H_INCLUDED
|
#endif // TWOBLUECUBES_CATCH_RANDOM_NUMBER_GENERATOR_H_INCLUDED
|
||||||
|
@ -208,7 +208,7 @@ namespace Catch {
|
|||||||
|
|
||||||
// Recreate section for test case (as we will lose the one that was in scope)
|
// Recreate section for test case (as we will lose the one that was in scope)
|
||||||
auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo();
|
auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo();
|
||||||
SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name, testCaseInfo.description);
|
SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name);
|
||||||
|
|
||||||
Counts assertions;
|
Counts assertions;
|
||||||
assertions.failed = 1;
|
assertions.failed = 1;
|
||||||
@ -246,7 +246,7 @@ namespace Catch {
|
|||||||
|
|
||||||
void RunContext::runCurrentTest(std::string & redirectedCout, std::string & redirectedCerr) {
|
void RunContext::runCurrentTest(std::string & redirectedCout, std::string & redirectedCerr) {
|
||||||
auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo();
|
auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo();
|
||||||
SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name, testCaseInfo.description);
|
SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name);
|
||||||
m_reporter->sectionStarting(testCaseSection);
|
m_reporter->sectionStarting(testCaseSection);
|
||||||
Counts prevAssertions = m_totals.assertions;
|
Counts prevAssertions = m_totals.assertions;
|
||||||
double duration = 0;
|
double duration = 0;
|
||||||
|
@ -21,7 +21,7 @@ namespace Catch {
|
|||||||
|
|
||||||
Section::~Section() {
|
Section::~Section() {
|
||||||
if( m_sectionIncluded ) {
|
if( m_sectionIncluded ) {
|
||||||
SectionEndInfo endInfo( m_info, m_assertions, m_timer.getElapsedSeconds() );
|
SectionEndInfo endInfo{ m_info, m_assertions, m_timer.getElapsedSeconds() };
|
||||||
if( uncaught_exceptions() )
|
if( uncaught_exceptions() )
|
||||||
getResultCapture().sectionEndedEarly( endInfo );
|
getResultCapture().sectionEndedEarly( endInfo );
|
||||||
else
|
else
|
||||||
|
@ -35,7 +35,10 @@ namespace Catch {
|
|||||||
|
|
||||||
} // end namespace Catch
|
} // end namespace Catch
|
||||||
|
|
||||||
#define INTERNAL_CATCH_SECTION( ... ) \
|
#define INTERNAL_CATCH_SECTION( ... ) \
|
||||||
if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) )
|
if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) )
|
||||||
|
|
||||||
|
#define INTERNAL_CATCH_DYNAMIC_SECTION( ... ) \
|
||||||
|
if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, (Catch::ReusableStringStream() << __VA_ARGS__).str() ) )
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_SECTION_H_INCLUDED
|
#endif // TWOBLUECUBES_CATCH_SECTION_H_INCLUDED
|
||||||
|
@ -11,15 +11,9 @@ namespace Catch {
|
|||||||
|
|
||||||
SectionInfo::SectionInfo
|
SectionInfo::SectionInfo
|
||||||
( SourceLineInfo const& _lineInfo,
|
( SourceLineInfo const& _lineInfo,
|
||||||
std::string const& _name,
|
std::string const& _name )
|
||||||
std::string const& _description )
|
|
||||||
: name( _name ),
|
: name( _name ),
|
||||||
description( _description ),
|
|
||||||
lineInfo( _lineInfo )
|
lineInfo( _lineInfo )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
SectionEndInfo::SectionEndInfo( SectionInfo const& _sectionInfo, Counts const& _prevAssertions, double _durationInSeconds )
|
|
||||||
: sectionInfo( _sectionInfo ), prevAssertions( _prevAssertions ), durationInSeconds( _durationInSeconds )
|
|
||||||
{}
|
|
||||||
|
|
||||||
} // end namespace Catch
|
} // end namespace Catch
|
||||||
|
@ -16,19 +16,22 @@
|
|||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
struct SectionInfo {
|
struct SectionInfo {
|
||||||
|
SectionInfo
|
||||||
|
( SourceLineInfo const& _lineInfo,
|
||||||
|
std::string const& _name );
|
||||||
|
|
||||||
|
// Deprecated
|
||||||
SectionInfo
|
SectionInfo
|
||||||
( SourceLineInfo const& _lineInfo,
|
( SourceLineInfo const& _lineInfo,
|
||||||
std::string const& _name,
|
std::string const& _name,
|
||||||
std::string const& _description = std::string() );
|
std::string const& ) : SectionInfo( _lineInfo, _name ) {}
|
||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string description;
|
std::string description; // !Deprecated: this will always be empty
|
||||||
SourceLineInfo lineInfo;
|
SourceLineInfo lineInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SectionEndInfo {
|
struct SectionEndInfo {
|
||||||
SectionEndInfo( SectionInfo const& _sectionInfo, Counts const& _prevAssertions, double _durationInSeconds );
|
|
||||||
|
|
||||||
SectionInfo sectionInfo;
|
SectionInfo sectionInfo;
|
||||||
Counts prevAssertions;
|
Counts prevAssertions;
|
||||||
double durationInSeconds;
|
double durationInSeconds;
|
||||||
|
@ -28,7 +28,7 @@ namespace Catch {
|
|||||||
break;
|
break;
|
||||||
case RunTests::InRandomOrder:
|
case RunTests::InRandomOrder:
|
||||||
seedRng( config );
|
seedRng( config );
|
||||||
RandomNumberGenerator::shuffle( sorted );
|
std::shuffle( sorted.begin(), sorted.end(), rng() );
|
||||||
break;
|
break;
|
||||||
case RunTests::InDeclarationOrder:
|
case RunTests::InDeclarationOrder:
|
||||||
// already in declaration order
|
// already in declaration order
|
||||||
|
@ -73,8 +73,8 @@ namespace TestCaseTracking {
|
|||||||
TrackerBase::TrackerHasName::TrackerHasName( NameAndLocation const& nameAndLocation ) : m_nameAndLocation( nameAndLocation ) {}
|
TrackerBase::TrackerHasName::TrackerHasName( NameAndLocation const& nameAndLocation ) : m_nameAndLocation( nameAndLocation ) {}
|
||||||
bool TrackerBase::TrackerHasName::operator ()( ITrackerPtr const& tracker ) const {
|
bool TrackerBase::TrackerHasName::operator ()( ITrackerPtr const& tracker ) const {
|
||||||
return
|
return
|
||||||
tracker->nameAndLocation().name == m_nameAndLocation.name &&
|
tracker->nameAndLocation().location == m_nameAndLocation.location &&
|
||||||
tracker->nameAndLocation().location == m_nameAndLocation.location;
|
tracker->nameAndLocation().name == m_nameAndLocation.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
TrackerBase::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent )
|
TrackerBase::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent )
|
||||||
|
@ -80,8 +80,7 @@ namespace Catch {
|
|||||||
StreamingReporterBase::sectionStarting( sectionInfo );
|
StreamingReporterBase::sectionStarting( sectionInfo );
|
||||||
if( m_sectionDepth++ > 0 ) {
|
if( m_sectionDepth++ > 0 ) {
|
||||||
m_xml.startElement( "Section" )
|
m_xml.startElement( "Section" )
|
||||||
.writeAttribute( "name", trim( sectionInfo.name ) )
|
.writeAttribute( "name", trim( sectionInfo.name ) );
|
||||||
.writeAttribute( "description", sectionInfo.description );
|
|
||||||
writeSourceInfo( sectionInfo.lineInfo );
|
writeSourceInfo( sectionInfo.lineInfo );
|
||||||
m_xml.ensureTagClosed();
|
m_xml.ensureTagClosed();
|
||||||
}
|
}
|
||||||
|
329
projects/CMakeLists.txt
Normal file
329
projects/CMakeLists.txt
Normal file
@ -0,0 +1,329 @@
|
|||||||
|
include(MiscFunctions)
|
||||||
|
|
||||||
|
# define the sources of the self test
|
||||||
|
# Please keep these ordered alphabetically
|
||||||
|
set(TEST_SOURCES
|
||||||
|
${SELF_TEST_DIR}/TestMain.cpp
|
||||||
|
${SELF_TEST_DIR}/IntrospectiveTests/CmdLine.tests.cpp
|
||||||
|
${SELF_TEST_DIR}/IntrospectiveTests/PartTracker.tests.cpp
|
||||||
|
${SELF_TEST_DIR}/IntrospectiveTests/TagAlias.tests.cpp
|
||||||
|
${SELF_TEST_DIR}/IntrospectiveTests/String.tests.cpp
|
||||||
|
${SELF_TEST_DIR}/IntrospectiveTests/Xml.tests.cpp
|
||||||
|
${SELF_TEST_DIR}/UsageTests/Approx.tests.cpp
|
||||||
|
${SELF_TEST_DIR}/UsageTests/BDD.tests.cpp
|
||||||
|
${SELF_TEST_DIR}/UsageTests/Benchmark.tests.cpp
|
||||||
|
${SELF_TEST_DIR}/UsageTests/Class.tests.cpp
|
||||||
|
${SELF_TEST_DIR}/UsageTests/Compilation.tests.cpp
|
||||||
|
${SELF_TEST_DIR}/UsageTests/Condition.tests.cpp
|
||||||
|
${SELF_TEST_DIR}/UsageTests/Decomposition.tests.cpp
|
||||||
|
${SELF_TEST_DIR}/UsageTests/EnumToString.tests.cpp
|
||||||
|
${SELF_TEST_DIR}/UsageTests/Exception.tests.cpp
|
||||||
|
${SELF_TEST_DIR}/UsageTests/Message.tests.cpp
|
||||||
|
${SELF_TEST_DIR}/UsageTests/Misc.tests.cpp
|
||||||
|
${SELF_TEST_DIR}/UsageTests/ToStringChrono.tests.cpp
|
||||||
|
${SELF_TEST_DIR}/UsageTests/ToStringGeneral.tests.cpp
|
||||||
|
${SELF_TEST_DIR}/UsageTests/ToStringPair.tests.cpp
|
||||||
|
${SELF_TEST_DIR}/UsageTests/ToStringTuple.tests.cpp
|
||||||
|
${SELF_TEST_DIR}/UsageTests/ToStringVector.tests.cpp
|
||||||
|
${SELF_TEST_DIR}/UsageTests/ToStringWhich.tests.cpp
|
||||||
|
${SELF_TEST_DIR}/UsageTests/Tricky.tests.cpp
|
||||||
|
${SELF_TEST_DIR}/UsageTests/VariadicMacros.tests.cpp
|
||||||
|
${SELF_TEST_DIR}/UsageTests/Matchers.tests.cpp
|
||||||
|
)
|
||||||
|
CheckFileList(TEST_SOURCES ${SELF_TEST_DIR})
|
||||||
|
|
||||||
|
# A set of impl files that just #include a single header
|
||||||
|
# Please keep these ordered alphabetically
|
||||||
|
set(SURROGATE_SOURCES
|
||||||
|
${SELF_TEST_DIR}/SurrogateCpps/catch_console_colour.cpp
|
||||||
|
${SELF_TEST_DIR}/SurrogateCpps/catch_debugger.cpp
|
||||||
|
${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_reporter.cpp
|
||||||
|
${SELF_TEST_DIR}/SurrogateCpps/catch_option.cpp
|
||||||
|
${SELF_TEST_DIR}/SurrogateCpps/catch_stream.cpp
|
||||||
|
${SELF_TEST_DIR}/SurrogateCpps/catch_test_case_tracker.cpp
|
||||||
|
${SELF_TEST_DIR}/SurrogateCpps/catch_test_spec.cpp
|
||||||
|
${SELF_TEST_DIR}/SurrogateCpps/catch_xmlwriter.cpp
|
||||||
|
)
|
||||||
|
CheckFileList(SURROGATE_SOURCES ${SELF_TEST_DIR}/SurrogateCpps)
|
||||||
|
|
||||||
|
|
||||||
|
# Please keep these ordered alphabetically
|
||||||
|
set(TOP_LEVEL_HEADERS
|
||||||
|
${HEADER_DIR}/catch.hpp
|
||||||
|
${HEADER_DIR}/catch_with_main.hpp
|
||||||
|
)
|
||||||
|
CheckFileList(TOP_LEVEL_HEADERS ${HEADER_DIR})
|
||||||
|
|
||||||
|
# Please keep these ordered alphabetically
|
||||||
|
set(EXTERNAL_HEADERS
|
||||||
|
${HEADER_DIR}/external/clara.hpp
|
||||||
|
)
|
||||||
|
CheckFileList(EXTERNAL_HEADERS ${HEADER_DIR}/external)
|
||||||
|
|
||||||
|
|
||||||
|
# Please keep these ordered alphabetically
|
||||||
|
set(INTERNAL_HEADERS
|
||||||
|
${HEADER_DIR}/internal/catch_approx.h
|
||||||
|
${HEADER_DIR}/internal/catch_assertionhandler.h
|
||||||
|
${HEADER_DIR}/internal/catch_assertioninfo.h
|
||||||
|
${HEADER_DIR}/internal/catch_assertionresult.h
|
||||||
|
${HEADER_DIR}/internal/catch_capture.hpp
|
||||||
|
${HEADER_DIR}/internal/catch_capture_matchers.h
|
||||||
|
${HEADER_DIR}/internal/catch_clara.h
|
||||||
|
${HEADER_DIR}/internal/catch_commandline.h
|
||||||
|
${HEADER_DIR}/internal/catch_common.h
|
||||||
|
${HEADER_DIR}/internal/catch_compiler_capabilities.h
|
||||||
|
${HEADER_DIR}/internal/catch_config.hpp
|
||||||
|
${HEADER_DIR}/internal/catch_console_colour.h
|
||||||
|
${HEADER_DIR}/internal/catch_context.h
|
||||||
|
${HEADER_DIR}/internal/catch_debug_console.h
|
||||||
|
${HEADER_DIR}/internal/catch_debugger.h
|
||||||
|
${HEADER_DIR}/internal/catch_decomposer.h
|
||||||
|
${HEADER_DIR}/internal/catch_default_main.hpp
|
||||||
|
${HEADER_DIR}/internal/catch_enforce.h
|
||||||
|
${HEADER_DIR}/internal/catch_errno_guard.h
|
||||||
|
${HEADER_DIR}/internal/catch_exception_translator_registry.h
|
||||||
|
${HEADER_DIR}/internal/catch_external_interfaces.h
|
||||||
|
${HEADER_DIR}/internal/catch_fatal_condition.h
|
||||||
|
${HEADER_DIR}/internal/catch_impl.hpp
|
||||||
|
${HEADER_DIR}/internal/catch_interfaces_capture.h
|
||||||
|
${HEADER_DIR}/internal/catch_interfaces_config.h
|
||||||
|
${HEADER_DIR}/internal/catch_interfaces_exception.h
|
||||||
|
${HEADER_DIR}/internal/catch_interfaces_registry_hub.h
|
||||||
|
${HEADER_DIR}/internal/catch_interfaces_reporter.h
|
||||||
|
${HEADER_DIR}/internal/catch_interfaces_runner.h
|
||||||
|
${HEADER_DIR}/internal/catch_interfaces_tag_alias_registry.h
|
||||||
|
${HEADER_DIR}/internal/catch_interfaces_testcase.h
|
||||||
|
${HEADER_DIR}/internal/catch_leak_detector.h
|
||||||
|
${HEADER_DIR}/internal/catch_list.h
|
||||||
|
${HEADER_DIR}/internal/catch_matchers.h
|
||||||
|
${HEADER_DIR}/internal/catch_matchers_floating.h
|
||||||
|
${HEADER_DIR}/internal/catch_matchers_generic.hpp
|
||||||
|
${HEADER_DIR}/internal/catch_matchers_string.h
|
||||||
|
${HEADER_DIR}/internal/catch_matchers_vector.h
|
||||||
|
${HEADER_DIR}/internal/catch_message.h
|
||||||
|
${HEADER_DIR}/internal/catch_objc.hpp
|
||||||
|
${HEADER_DIR}/internal/catch_objc_arc.hpp
|
||||||
|
${HEADER_DIR}/internal/catch_option.hpp
|
||||||
|
${HEADER_DIR}/internal/catch_output_redirect.h
|
||||||
|
${HEADER_DIR}/internal/catch_platform.h
|
||||||
|
${HEADER_DIR}/internal/catch_random_number_generator.h
|
||||||
|
${HEADER_DIR}/internal/catch_reenable_warnings.h
|
||||||
|
${HEADER_DIR}/internal/catch_reporter_registrars.hpp
|
||||||
|
${HEADER_DIR}/internal/catch_reporter_registry.h
|
||||||
|
${HEADER_DIR}/internal/catch_result_type.h
|
||||||
|
${HEADER_DIR}/internal/catch_run_context.h
|
||||||
|
${HEADER_DIR}/internal/catch_benchmark.h
|
||||||
|
${HEADER_DIR}/internal/catch_section.h
|
||||||
|
${HEADER_DIR}/internal/catch_section_info.h
|
||||||
|
${HEADER_DIR}/internal/catch_session.h
|
||||||
|
${HEADER_DIR}/internal/catch_startup_exception_registry.h
|
||||||
|
${HEADER_DIR}/internal/catch_stream.h
|
||||||
|
${HEADER_DIR}/internal/catch_stringref.h
|
||||||
|
${HEADER_DIR}/internal/catch_string_manip.h
|
||||||
|
${HEADER_DIR}/internal/catch_suppress_warnings.h
|
||||||
|
${HEADER_DIR}/internal/catch_tag_alias.h
|
||||||
|
${HEADER_DIR}/internal/catch_tag_alias_autoregistrar.h
|
||||||
|
${HEADER_DIR}/internal/catch_tag_alias_registry.h
|
||||||
|
${HEADER_DIR}/internal/catch_test_case_info.h
|
||||||
|
${HEADER_DIR}/internal/catch_test_case_registry_impl.h
|
||||||
|
${HEADER_DIR}/internal/catch_test_case_tracker.h
|
||||||
|
${HEADER_DIR}/internal/catch_test_registry.h
|
||||||
|
${HEADER_DIR}/internal/catch_test_spec.h
|
||||||
|
${HEADER_DIR}/internal/catch_test_spec_parser.h
|
||||||
|
${HEADER_DIR}/internal/catch_text.h
|
||||||
|
${HEADER_DIR}/internal/catch_timer.h
|
||||||
|
${HEADER_DIR}/internal/catch_to_string.hpp
|
||||||
|
${HEADER_DIR}/internal/catch_tostring.h
|
||||||
|
${HEADER_DIR}/internal/catch_totals.h
|
||||||
|
${HEADER_DIR}/internal/catch_uncaught_exceptions.h
|
||||||
|
${HEADER_DIR}/internal/catch_user_interfaces.h
|
||||||
|
${HEADER_DIR}/internal/catch_version.h
|
||||||
|
${HEADER_DIR}/internal/catch_wildcard_pattern.h
|
||||||
|
${HEADER_DIR}/internal/catch_windows_h_proxy.h
|
||||||
|
${HEADER_DIR}/internal/catch_xmlwriter.h
|
||||||
|
)
|
||||||
|
set(IMPL_SOURCES
|
||||||
|
${HEADER_DIR}/internal/catch_approx.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_assertionhandler.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_assertionresult.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_benchmark.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_capture_matchers.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_commandline.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_common.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_config.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_console_colour.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_context.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_debug_console.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_debugger.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_decomposer.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_errno_guard.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_exception_translator_registry.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_fatal_condition.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_interfaces_capture.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_interfaces_config.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_interfaces_exception.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_interfaces_registry_hub.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_interfaces_runner.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_interfaces_testcase.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_list.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_leak_detector.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_matchers.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_matchers_floating.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_matchers_generic.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_matchers_string.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_message.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_output_redirect.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_registry_hub.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_interfaces_reporter.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_random_number_generator.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_reporter_registry.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_result_type.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_run_context.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_section.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_section_info.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_session.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_startup_exception_registry.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_stream.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_stringref.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_string_manip.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_tag_alias.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_tag_alias_autoregistrar.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_tag_alias_registry.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_test_case_info.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_test_case_registry_impl.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_test_case_tracker.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_test_registry.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_test_spec.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_test_spec_parser.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_timer.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_tostring.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_totals.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_uncaught_exceptions.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_version.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_wildcard_pattern.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_xmlwriter.cpp
|
||||||
|
)
|
||||||
|
set(INTERNAL_FILES ${IMPL_SOURCES} ${INTERNAL_HEADERS})
|
||||||
|
CheckFileList(INTERNAL_FILES ${HEADER_DIR}/internal)
|
||||||
|
|
||||||
|
# Please keep these ordered alphabetically
|
||||||
|
set(REPORTER_HEADERS
|
||||||
|
${HEADER_DIR}/reporters/catch_reporter_automake.hpp
|
||||||
|
${HEADER_DIR}/reporters/catch_reporter_bases.hpp
|
||||||
|
${HEADER_DIR}/reporters/catch_reporter_compact.h
|
||||||
|
${HEADER_DIR}/reporters/catch_reporter_console.h
|
||||||
|
${HEADER_DIR}/reporters/catch_reporter_junit.h
|
||||||
|
${HEADER_DIR}/reporters/catch_reporter_listening.h
|
||||||
|
${HEADER_DIR}/reporters/catch_reporter_tap.hpp
|
||||||
|
${HEADER_DIR}/reporters/catch_reporter_teamcity.hpp
|
||||||
|
${HEADER_DIR}/reporters/catch_reporter_xml.h
|
||||||
|
)
|
||||||
|
set(REPORTER_SOURCES
|
||||||
|
${HEADER_DIR}/reporters/catch_reporter_bases.cpp
|
||||||
|
${HEADER_DIR}/reporters/catch_reporter_compact.cpp
|
||||||
|
${HEADER_DIR}/reporters/catch_reporter_console.cpp
|
||||||
|
${HEADER_DIR}/reporters/catch_reporter_junit.cpp
|
||||||
|
${HEADER_DIR}/reporters/catch_reporter_listening.cpp
|
||||||
|
${HEADER_DIR}/reporters/catch_reporter_xml.cpp
|
||||||
|
)
|
||||||
|
set(REPORTER_FILES ${REPORTER_HEADERS} ${REPORTER_SOURCES})
|
||||||
|
CheckFileList(REPORTER_FILES ${HEADER_DIR}/reporters)
|
||||||
|
|
||||||
|
# Specify the headers, too, so CLion recognises them as project files
|
||||||
|
set(HEADERS
|
||||||
|
${TOP_LEVEL_HEADERS}
|
||||||
|
${EXTERNAL_HEADERS}
|
||||||
|
${INTERNAL_HEADERS}
|
||||||
|
${REPORTER_HEADERS}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Provide some groupings for IDEs
|
||||||
|
SOURCE_GROUP("Tests" FILES ${TEST_SOURCES})
|
||||||
|
SOURCE_GROUP("Surrogates" FILES ${SURROGATE_SOURCES})
|
||||||
|
|
||||||
|
include(CTest)
|
||||||
|
|
||||||
|
add_executable(SelfTest ${TEST_SOURCES} ${IMPL_SOURCES} ${REPORTER_SOURCES} ${SURROGATE_SOURCES} ${HEADERS})
|
||||||
|
target_include_directories(SelfTest PRIVATE ${HEADER_DIR})
|
||||||
|
|
||||||
|
if(USE_CPP14)
|
||||||
|
message(STATUS "Enabling C++14")
|
||||||
|
set_property(TARGET SelfTest PROPERTY CXX_STANDARD 14)
|
||||||
|
else()
|
||||||
|
message(STATUS "Enabling C++11")
|
||||||
|
set_property(TARGET SelfTest PROPERTY CXX_STANDARD 11)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set_property(TARGET SelfTest PROPERTY CXX_STANDARD_REQUIRED ON)
|
||||||
|
set_property(TARGET SelfTest PROPERTY CXX_EXTENSIONS OFF)
|
||||||
|
|
||||||
|
if (CATCH_ENABLE_COVERAGE)
|
||||||
|
set(ENABLE_COVERAGE ON CACHE BOOL "Enable coverage build." FORCE)
|
||||||
|
find_package(codecov)
|
||||||
|
add_coverage(SelfTest)
|
||||||
|
list(APPEND LCOV_REMOVE_PATTERNS "'/usr/*'")
|
||||||
|
coverage_evaluate()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Add per compiler options
|
||||||
|
if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang|GNU" )
|
||||||
|
target_compile_options( SelfTest PRIVATE -Wall -Wextra -Wunreachable-code -Wpedantic)
|
||||||
|
if (CATCH_ENABLE_WERROR)
|
||||||
|
target_compile_options( SelfTest PRIVATE -Werror)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
# Clang specific options go here
|
||||||
|
if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||||
|
target_compile_options( SelfTest PRIVATE -Wweak-vtables -Wexit-time-destructors -Wglobal-constructors -Wmissing-noreturn )
|
||||||
|
endif()
|
||||||
|
if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" )
|
||||||
|
STRING(REGEX REPLACE "/W[0-9]" "/W4" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # override default warning level
|
||||||
|
target_compile_options( SelfTest PRIVATE /w44265 /w44061 /w44062 )
|
||||||
|
if (CATCH_ENABLE_WERROR)
|
||||||
|
target_compile_options( SelfTest PRIVATE /WX)
|
||||||
|
endif()
|
||||||
|
# Force MSVC to consider everything as encoded in utf-8
|
||||||
|
target_compile_options( SelfTest PRIVATE /utf-8 )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
# configure unit tests via CTest
|
||||||
|
add_test(NAME RunTests COMMAND $<TARGET_FILE:SelfTest>)
|
||||||
|
|
||||||
|
add_test(NAME ListTests COMMAND $<TARGET_FILE:SelfTest> --list-tests --verbosity high)
|
||||||
|
set_tests_properties(ListTests PROPERTIES
|
||||||
|
PASS_REGULAR_EXPRESSION "[0-9]+ test cases"
|
||||||
|
FAIL_REGULAR_EXPRESSION "Hidden Test"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_test(NAME ListTags COMMAND $<TARGET_FILE:SelfTest> --list-tags)
|
||||||
|
set_tests_properties(ListTags PROPERTIES
|
||||||
|
PASS_REGULAR_EXPRESSION "[0-9]+ tags"
|
||||||
|
FAIL_REGULAR_EXPRESSION "[.]")
|
||||||
|
|
||||||
|
add_test(NAME ListReporters COMMAND $<TARGET_FILE:SelfTest> --list-reporters)
|
||||||
|
set_tests_properties(ListReporters PROPERTIES PASS_REGULAR_EXPRESSION "Available reporters:")
|
||||||
|
|
||||||
|
add_test(NAME ListTestNamesOnly COMMAND $<TARGET_FILE:SelfTest> --list-test-names-only)
|
||||||
|
set_tests_properties(ListTestNamesOnly PROPERTIES
|
||||||
|
PASS_REGULAR_EXPRESSION "Regex string matcher"
|
||||||
|
FAIL_REGULAR_EXPRESSION "Hidden Test")
|
||||||
|
|
||||||
|
add_test(NAME NoAssertions COMMAND $<TARGET_FILE:SelfTest> -w NoAssertions)
|
||||||
|
set_tests_properties(NoAssertions PROPERTIES PASS_REGULAR_EXPRESSION "No assertions in test case")
|
||||||
|
|
||||||
|
add_test(NAME NoTest COMMAND $<TARGET_FILE:SelfTest> -w NoTests "___nonexistent_test___")
|
||||||
|
set_tests_properties(NoTest PROPERTIES PASS_REGULAR_EXPRESSION "No test cases matched")
|
||||||
|
|
||||||
|
# AppVeyor has a Python 2.7 in path, but doesn't have .py files as autorunnable
|
||||||
|
add_test(NAME ApprovalTests COMMAND python ${CATCH_DIR}/scripts/approvalTests.py $<TARGET_FILE:SelfTest>)
|
||||||
|
set_tests_properties(ApprovalTests PROPERTIES FAIL_REGULAR_EXPRESSION "Results differed")
|
||||||
|
|
||||||
|
if (CATCH_USE_VALGRIND)
|
||||||
|
add_test(NAME ValgrindRunTests COMMAND valgrind --leak-check=full --error-exitcode=1 $<TARGET_FILE:SelfTest>)
|
||||||
|
add_test(NAME ValgrindListTests COMMAND valgrind --leak-check=full --error-exitcode=1 $<TARGET_FILE:SelfTest> --list-tests --verbosity high)
|
||||||
|
set_tests_properties(ValgrindListTests PROPERTIES PASS_REGULAR_EXPRESSION "definitely lost: 0 bytes in 0 blocks")
|
||||||
|
add_test(NAME ValgrindListTags COMMAND valgrind --leak-check=full --error-exitcode=1 $<TARGET_FILE:SelfTest> --list-tags)
|
||||||
|
set_tests_properties(ValgrindListTags PROPERTIES PASS_REGULAR_EXPRESSION "definitely lost: 0 bytes in 0 blocks")
|
||||||
|
endif()
|
@ -988,6 +988,15 @@ Misc.tests.cpp:<line number>: passed: l == std::numeric_limits<long long>::max()
|
|||||||
==
|
==
|
||||||
9223372036854775807 (0x<hex digits>)
|
9223372036854775807 (0x<hex digits>)
|
||||||
Misc.tests.cpp:<line number>: failed: b > a for: 0 > 1
|
Misc.tests.cpp:<line number>: failed: b > a for: 0 > 1
|
||||||
|
Misc.tests.cpp:<line number>: failed: b > a for: 1 > 1
|
||||||
|
Misc.tests.cpp:<line number>: passed: b > a for: 2 > 1
|
||||||
|
Misc.tests.cpp:<line number>: passed: b > a for: 3 > 1
|
||||||
|
Misc.tests.cpp:<line number>: passed: b > a for: 4 > 1
|
||||||
|
Misc.tests.cpp:<line number>: passed: b > a for: 5 > 1
|
||||||
|
Misc.tests.cpp:<line number>: passed: b > a for: 6 > 1
|
||||||
|
Misc.tests.cpp:<line number>: passed: b > a for: 7 > 1
|
||||||
|
Misc.tests.cpp:<line number>: passed: b > a for: 8 > 1
|
||||||
|
Misc.tests.cpp:<line number>: passed: b > a for: 9 > 1
|
||||||
Misc.tests.cpp:<line number>: failed: ( fib[i] % 2 ) == 0 for: 1 == 0 with 1 message: 'Testing if fib[0] (1) is even'
|
Misc.tests.cpp:<line number>: failed: ( fib[i] % 2 ) == 0 for: 1 == 0 with 1 message: 'Testing if fib[0] (1) is even'
|
||||||
Misc.tests.cpp:<line number>: failed: ( fib[i] % 2 ) == 0 for: 1 == 0 with 1 message: 'Testing if fib[1] (1) is even'
|
Misc.tests.cpp:<line number>: failed: ( fib[i] % 2 ) == 0 for: 1 == 0 with 1 message: 'Testing if fib[1] (1) is even'
|
||||||
Misc.tests.cpp:<line number>: passed: ( fib[i] % 2 ) == 0 for: 0 == 0 with 1 message: 'Testing if fib[2] (2) is even'
|
Misc.tests.cpp:<line number>: passed: ( fib[i] % 2 ) == 0 for: 0 == 0 with 1 message: 'Testing if fib[2] (2) is even'
|
||||||
@ -1144,5 +1153,5 @@ Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5
|
|||||||
Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
|
Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
|
||||||
Misc.tests.cpp:<line number>: passed:
|
Misc.tests.cpp:<line number>: passed:
|
||||||
Misc.tests.cpp:<line number>: passed:
|
Misc.tests.cpp:<line number>: passed:
|
||||||
Failed 62 test cases, failed 121 assertions.
|
Failed 62 test cases, failed 122 assertions.
|
||||||
|
|
||||||
|
@ -968,7 +968,7 @@ explicitly with message:
|
|||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
looped SECTION tests
|
looped SECTION tests
|
||||||
s1
|
b is currently: 0
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Misc.tests.cpp:<line number>
|
Misc.tests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
@ -978,6 +978,18 @@ Misc.tests.cpp:<line number>: FAILED:
|
|||||||
with expansion:
|
with expansion:
|
||||||
0 > 1
|
0 > 1
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
looped SECTION tests
|
||||||
|
b is currently: 1
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Misc.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Misc.tests.cpp:<line number>: FAILED:
|
||||||
|
CHECK( b > a )
|
||||||
|
with expansion:
|
||||||
|
1 > 1
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
looped tests
|
looped tests
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@ -1028,8 +1040,8 @@ with message:
|
|||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
more nested SECTION tests
|
more nested SECTION tests
|
||||||
s1
|
doesn't equal
|
||||||
s2
|
equal
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Misc.tests.cpp:<line number>
|
Misc.tests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
@ -1085,5 +1097,5 @@ due to unexpected exception with message:
|
|||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
test cases: 208 | 155 passed | 49 failed | 4 failed as expected
|
test cases: 208 | 155 passed | 49 failed | 4 failed as expected
|
||||||
assertions: 1065 | 937 passed | 107 failed | 21 failed as expected
|
assertions: 1074 | 945 passed | 108 failed | 21 failed as expected
|
||||||
|
|
||||||
|
@ -4130,7 +4130,7 @@ with expansion:
|
|||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Process can be configured on command line
|
Process can be configured on command line
|
||||||
test lists
|
test lists
|
||||||
1 test
|
Specify one test case using
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
CmdLine.tests.cpp:<line number>
|
CmdLine.tests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
@ -7754,7 +7754,7 @@ with expansion:
|
|||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
looped SECTION tests
|
looped SECTION tests
|
||||||
s1
|
b is currently: 0
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Misc.tests.cpp:<line number>
|
Misc.tests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
@ -7764,6 +7764,122 @@ Misc.tests.cpp:<line number>: FAILED:
|
|||||||
with expansion:
|
with expansion:
|
||||||
0 > 1
|
0 > 1
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
looped SECTION tests
|
||||||
|
b is currently: 1
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Misc.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Misc.tests.cpp:<line number>: FAILED:
|
||||||
|
CHECK( b > a )
|
||||||
|
with expansion:
|
||||||
|
1 > 1
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
looped SECTION tests
|
||||||
|
b is currently: 2
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Misc.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Misc.tests.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
CHECK( b > a )
|
||||||
|
with expansion:
|
||||||
|
2 > 1
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
looped SECTION tests
|
||||||
|
b is currently: 3
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Misc.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Misc.tests.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
CHECK( b > a )
|
||||||
|
with expansion:
|
||||||
|
3 > 1
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
looped SECTION tests
|
||||||
|
b is currently: 4
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Misc.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Misc.tests.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
CHECK( b > a )
|
||||||
|
with expansion:
|
||||||
|
4 > 1
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
looped SECTION tests
|
||||||
|
b is currently: 5
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Misc.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Misc.tests.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
CHECK( b > a )
|
||||||
|
with expansion:
|
||||||
|
5 > 1
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
looped SECTION tests
|
||||||
|
b is currently: 6
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Misc.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Misc.tests.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
CHECK( b > a )
|
||||||
|
with expansion:
|
||||||
|
6 > 1
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
looped SECTION tests
|
||||||
|
b is currently: 7
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Misc.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Misc.tests.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
CHECK( b > a )
|
||||||
|
with expansion:
|
||||||
|
7 > 1
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
looped SECTION tests
|
||||||
|
b is currently: 8
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Misc.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Misc.tests.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
CHECK( b > a )
|
||||||
|
with expansion:
|
||||||
|
8 > 1
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
looped SECTION tests
|
||||||
|
b is currently: 9
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Misc.tests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
Misc.tests.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
CHECK( b > a )
|
||||||
|
with expansion:
|
||||||
|
9 > 1
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
looped tests
|
looped tests
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@ -7830,8 +7946,8 @@ with message:
|
|||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
more nested SECTION tests
|
more nested SECTION tests
|
||||||
s1
|
doesn't equal
|
||||||
s2
|
equal
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Misc.tests.cpp:<line number>
|
Misc.tests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
@ -7843,8 +7959,8 @@ with expansion:
|
|||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
more nested SECTION tests
|
more nested SECTION tests
|
||||||
s1
|
doesn't equal
|
||||||
s3
|
not equal
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Misc.tests.cpp:<line number>
|
Misc.tests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
@ -7857,8 +7973,8 @@ with expansion:
|
|||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
more nested SECTION tests
|
more nested SECTION tests
|
||||||
s1
|
doesn't equal
|
||||||
s4
|
less than
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Misc.tests.cpp:<line number>
|
Misc.tests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
@ -7871,7 +7987,7 @@ with expansion:
|
|||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
nested SECTION tests
|
nested SECTION tests
|
||||||
s1
|
doesn't equal
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Misc.tests.cpp:<line number>
|
Misc.tests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
@ -7890,8 +8006,8 @@ with expansion:
|
|||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
nested SECTION tests
|
nested SECTION tests
|
||||||
s1
|
doesn't equal
|
||||||
s2
|
not equal
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Misc.tests.cpp:<line number>
|
Misc.tests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
@ -7993,7 +8109,7 @@ with expansion:
|
|||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
random SECTION tests
|
random SECTION tests
|
||||||
s1
|
doesn't equal
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Misc.tests.cpp:<line number>
|
Misc.tests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
@ -8012,7 +8128,7 @@ with expansion:
|
|||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
random SECTION tests
|
random SECTION tests
|
||||||
s2
|
not equal
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Misc.tests.cpp:<line number>
|
Misc.tests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
@ -8973,7 +9089,9 @@ with expansion:
|
|||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
xmlentitycheck
|
xmlentitycheck
|
||||||
embedded xml
|
embedded xml: <test>it should be possible to embed xml characters, such as <,
|
||||||
|
" or &, or even whole <xml>documents</xml> within an attribute</test>
|
||||||
|
</test>
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Misc.tests.cpp:<line number>
|
Misc.tests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
@ -8983,7 +9101,7 @@ PASSED:
|
|||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
xmlentitycheck
|
xmlentitycheck
|
||||||
encoded chars
|
encoded chars: these should all be encoded: &&&"""<<<&"<<&"
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Misc.tests.cpp:<line number>
|
Misc.tests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
@ -8993,5 +9111,5 @@ PASSED:
|
|||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
test cases: 208 | 142 passed | 62 failed | 4 failed as expected
|
test cases: 208 | 142 passed | 62 failed | 4 failed as expected
|
||||||
assertions: 1079 | 937 passed | 121 failed | 21 failed as expected
|
assertions: 1088 | 945 passed | 122 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="105" tests="1080" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
<testsuite name="<exe-name>" errors="17" failures="106" tests="1089" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||||
<testcase classname="<exe-name>.global" name="# A test name that starts with a #" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="# A test name that starts with a #" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="#1005: Comparing pointer to int and long (NULL can be either on various systems)" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="#1005: Comparing pointer to int and long (NULL can be either on various systems)" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="#1027" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="#1027" time="{duration}"/>
|
||||||
@ -485,7 +485,7 @@ Message.tests.cpp:<line number>
|
|||||||
<testcase classname="<exe-name>.global" name="Process can be configured on command line" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="Process can be configured on command line" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="Process can be configured on command line/empty args don't cause a crash" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="Process can be configured on command line/empty args don't cause a crash" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="Process can be configured on command line/default - no arguments" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="Process can be configured on command line/default - no arguments" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="Process can be configured on command line/test lists/1 test" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="Process can be configured on command line/test lists/Specify one test case using" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="Process can be configured on command line/test lists/Specify one test case exclusion using exclude:" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="Process can be configured on command line/test lists/Specify one test case exclusion using exclude:" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="Process can be configured on command line/test lists/Specify one test case exclusion using ~" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="Process can be configured on command line/test lists/Specify one test case exclusion using ~" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/-r/console" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/-r/console" time="{duration}"/>
|
||||||
@ -784,11 +784,24 @@ Message.tests.cpp:<line number>
|
|||||||
<testcase classname="<exe-name>.global" name="just info" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="just info" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="long long" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="long long" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="looped SECTION tests" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="looped SECTION tests" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="looped SECTION tests/s1" time="{duration}">
|
<testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 0" time="{duration}">
|
||||||
<failure message="0 > 1" type="CHECK">
|
<failure message="0 > 1" type="CHECK">
|
||||||
Misc.tests.cpp:<line number>
|
Misc.tests.cpp:<line number>
|
||||||
</failure>
|
</failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
|
<testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 1" time="{duration}">
|
||||||
|
<failure message="1 > 1" type="CHECK">
|
||||||
|
Misc.tests.cpp:<line number>
|
||||||
|
</failure>
|
||||||
|
</testcase>
|
||||||
|
<testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 2" time="{duration}"/>
|
||||||
|
<testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 3" time="{duration}"/>
|
||||||
|
<testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 4" time="{duration}"/>
|
||||||
|
<testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 5" time="{duration}"/>
|
||||||
|
<testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 6" time="{duration}"/>
|
||||||
|
<testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 7" time="{duration}"/>
|
||||||
|
<testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 8" time="{duration}"/>
|
||||||
|
<testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 9" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="looped tests" time="{duration}">
|
<testcase classname="<exe-name>.global" name="looped tests" time="{duration}">
|
||||||
<failure message="1 == 0" type="CHECK">
|
<failure message="1 == 0" type="CHECK">
|
||||||
Testing if fib[0] (1) is even
|
Testing if fib[0] (1) is even
|
||||||
@ -816,16 +829,16 @@ Misc.tests.cpp:<line number>
|
|||||||
</failure>
|
</failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
<testcase classname="<exe-name>.global" name="more nested SECTION tests" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="more nested SECTION tests" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="more nested SECTION tests/s2/s1" time="{duration}">
|
<testcase classname="<exe-name>.global" name="more nested SECTION tests/equal/doesn't equal" time="{duration}">
|
||||||
<failure message="1 == 2" type="REQUIRE">
|
<failure message="1 == 2" type="REQUIRE">
|
||||||
Misc.tests.cpp:<line number>
|
Misc.tests.cpp:<line number>
|
||||||
</failure>
|
</failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
<testcase classname="<exe-name>.global" name="more nested SECTION tests/s1/s3" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="more nested SECTION tests/doesn't equal/not equal" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="more nested SECTION tests/s1/s4" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="more nested SECTION tests/doesn't equal/less than" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="nested SECTION tests" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="nested SECTION tests" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="nested SECTION tests/s1" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="nested SECTION tests/doesn't equal" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="nested SECTION tests/s1/s2" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="nested SECTION tests/doesn't equal/not equal" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="non streamable - with conv. op" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="non streamable - with conv. op" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="non-copyable objects" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="non-copyable objects" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="not allowed" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="not allowed" time="{duration}"/>
|
||||||
@ -834,8 +847,8 @@ Misc.tests.cpp:<line number>
|
|||||||
<testcase classname="<exe-name>.global" name="pair<pair<int,const char *,pair<std::string,int> > -> toString" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="pair<pair<int,const char *,pair<std::string,int> > -> toString" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="pointer to class" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="pointer to class" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="random SECTION tests" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="random SECTION tests" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="random SECTION tests/s1" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="random SECTION tests/doesn't equal" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="random SECTION tests/s2" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="random SECTION tests/not equal" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="replaceInPlace" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="replaceInPlace" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="replaceInPlace/replace single char" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="replaceInPlace/replace single char" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="replaceInPlace/replace two chars" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="replaceInPlace/replace two chars" time="{duration}"/>
|
||||||
@ -915,8 +928,8 @@ Exception.tests.cpp:<line number>
|
|||||||
<testcase classname="<exe-name>.global" name="vectors can be sized and resized/reserving bigger changes capacity but not size" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="vectors can be sized and resized/reserving bigger changes capacity but not size" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="vectors can be sized and resized/reserving smaller does not change size or capacity" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="vectors can be sized and resized/reserving smaller does not change size or capacity" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="xmlentitycheck" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="xmlentitycheck" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="xmlentitycheck/embedded xml" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="xmlentitycheck/embedded xml: <test>it should be possible to embed xml characters, such as <, " or &, or even whole <xml>documents</xml> within an attribute</test>" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="xmlentitycheck/encoded chars" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="xmlentitycheck/encoded chars: these should all be encoded: &&&"""<<<&"<<&"" time="{duration}"/>
|
||||||
<system-out>
|
<system-out>
|
||||||
A string sent directly to stdout
|
A string sent directly to stdout
|
||||||
Message from section one
|
Message from section one
|
||||||
|
@ -4808,7 +4808,7 @@
|
|||||||
<OverallResults successes="7" failures="0" expectedFailures="0"/>
|
<OverallResults successes="7" failures="0" expectedFailures="0"/>
|
||||||
</Section>
|
</Section>
|
||||||
<Section name="test lists" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
<Section name="test lists" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
||||||
<Section name="1 test" description="Specify one test case using" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
<Section name="Specify one test case using" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
||||||
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
<Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
result
|
result
|
||||||
@ -8691,7 +8691,7 @@ loose text artifact
|
|||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="looped SECTION tests" tags="[.][failing][sections]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
<TestCase name="looped SECTION tests" tags="[.][failing][sections]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
<Section name="s1" description="b is currently: 0" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
<Section name="b is currently: 0" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
<Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
<Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
b > a
|
b > a
|
||||||
@ -8702,6 +8702,105 @@ loose text artifact
|
|||||||
</Expression>
|
</Expression>
|
||||||
<OverallResults successes="0" failures="1" expectedFailures="0"/>
|
<OverallResults successes="0" failures="1" expectedFailures="0"/>
|
||||||
</Section>
|
</Section>
|
||||||
|
<Section name="b is currently: 1" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
|
<Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
b > a
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
1 > 1
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<OverallResults successes="0" failures="1" expectedFailures="0"/>
|
||||||
|
</Section>
|
||||||
|
<Section name="b is currently: 2" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
|
<Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
b > a
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
2 > 1
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||||
|
</Section>
|
||||||
|
<Section name="b is currently: 3" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
|
<Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
b > a
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
3 > 1
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||||
|
</Section>
|
||||||
|
<Section name="b is currently: 4" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
|
<Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
b > a
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
4 > 1
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||||
|
</Section>
|
||||||
|
<Section name="b is currently: 5" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
|
<Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
b > a
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
5 > 1
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||||
|
</Section>
|
||||||
|
<Section name="b is currently: 6" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
|
<Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
b > a
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
6 > 1
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||||
|
</Section>
|
||||||
|
<Section name="b is currently: 7" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
|
<Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
b > a
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
7 > 1
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||||
|
</Section>
|
||||||
|
<Section name="b is currently: 8" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
|
<Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
b > a
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
8 > 1
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||||
|
</Section>
|
||||||
|
<Section name="b is currently: 9" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
|
<Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
|
<Original>
|
||||||
|
b > a
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
9 > 1
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||||
|
</Section>
|
||||||
<OverallResult success="false"/>
|
<OverallResult success="false"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="looped tests" tags="[.][failing]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
<TestCase name="looped tests" tags="[.][failing]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
@ -8796,8 +8895,8 @@ loose text artifact
|
|||||||
<OverallResult success="false"/>
|
<OverallResult success="false"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="more nested SECTION tests" tags="[.][failing][sections]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
<TestCase name="more nested SECTION tests" tags="[.][failing][sections]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
<Section name="s1" description="doesn't equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
<Section name="doesn't equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
<Section name="s2" description="equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
<Section name="equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
<Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
<Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
a == b
|
a == b
|
||||||
@ -8810,8 +8909,8 @@ loose text artifact
|
|||||||
</Section>
|
</Section>
|
||||||
<OverallResults successes="0" failures="1" expectedFailures="0"/>
|
<OverallResults successes="0" failures="1" expectedFailures="0"/>
|
||||||
</Section>
|
</Section>
|
||||||
<Section name="s1" description="doesn't equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
<Section name="doesn't equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
<Section name="s3" description="not equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
<Section name="not equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
a != b
|
a != b
|
||||||
@ -8824,8 +8923,8 @@ loose text artifact
|
|||||||
</Section>
|
</Section>
|
||||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||||
</Section>
|
</Section>
|
||||||
<Section name="s1" description="doesn't equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
<Section name="doesn't equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
<Section name="s4" description="less than" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
<Section name="less than" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
a < b
|
a < b
|
||||||
@ -8841,7 +8940,7 @@ loose text artifact
|
|||||||
<OverallResult success="false"/>
|
<OverallResult success="false"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="nested SECTION tests" tags="[.][failing][sections]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
<TestCase name="nested SECTION tests" tags="[.][failing][sections]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
<Section name="s1" description="doesn't equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
<Section name="doesn't equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
a != b
|
a != b
|
||||||
@ -8858,7 +8957,7 @@ loose text artifact
|
|||||||
2 != 1
|
2 != 1
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<Section name="s2" description="not equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
<Section name="not equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
a != b
|
a != b
|
||||||
@ -8953,7 +9052,7 @@ loose text artifact
|
|||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="random SECTION tests" tags="[.][failing][sections]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
<TestCase name="random SECTION tests" tags="[.][failing][sections]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
<Section name="s1" description="doesn't equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
<Section name="doesn't equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
a != b
|
a != b
|
||||||
@ -8972,7 +9071,7 @@ loose text artifact
|
|||||||
</Expression>
|
</Expression>
|
||||||
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
<OverallResults successes="2" failures="0" expectedFailures="0"/>
|
||||||
</Section>
|
</Section>
|
||||||
<Section name="s2" description="not equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
<Section name="not equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
a != b
|
a != b
|
||||||
@ -9928,15 +10027,15 @@ loose text artifact
|
|||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="xmlentitycheck" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
<TestCase name="xmlentitycheck" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
<Section name="embedded xml" description="<test>it should be possible to embed xml characters, such as <, " or &, or even whole <xml>documents</xml> within an attribute</test>" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
<Section name="embedded xml: <test>it should be possible to embed xml characters, such as <, " or &, or even whole <xml>documents</xml> within an attribute</test>" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||||
</Section>
|
</Section>
|
||||||
<Section name="encoded chars" description="these should all be encoded: &&&"""<<<&"<<&"" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
<Section name="encoded chars: these should all be encoded: &&&"""<<<&"<<&"" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
|
||||||
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||||
</Section>
|
</Section>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<OverallResults successes="937" failures="122" expectedFailures="21"/>
|
<OverallResults successes="945" failures="123" expectedFailures="21"/>
|
||||||
</Group>
|
</Group>
|
||||||
<OverallResults successes="937" failures="121" expectedFailures="21"/>
|
<OverallResults successes="945" failures="122" expectedFailures="21"/>
|
||||||
</Catch>
|
</Catch>
|
||||||
|
@ -295,7 +295,7 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
|
|||||||
}
|
}
|
||||||
|
|
||||||
SECTION("test lists") {
|
SECTION("test lists") {
|
||||||
SECTION("1 test", "Specify one test case using") {
|
SECTION("Specify one test case using") {
|
||||||
auto result = cli.parse({"test", "test1"});
|
auto result = cli.parse({"test", "test1"});
|
||||||
CHECK(result);
|
CHECK(result);
|
||||||
|
|
||||||
|
@ -67,12 +67,12 @@ TEST_CASE( "random SECTION tests", "[.][sections][failing]" ) {
|
|||||||
int a = 1;
|
int a = 1;
|
||||||
int b = 2;
|
int b = 2;
|
||||||
|
|
||||||
SECTION( "s1", "doesn't equal" ) {
|
SECTION( "doesn't equal" ) {
|
||||||
REQUIRE( a != b );
|
REQUIRE( a != b );
|
||||||
REQUIRE( b != a );
|
REQUIRE( b != a );
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION( "s2", "not equal" ) {
|
SECTION( "not equal" ) {
|
||||||
REQUIRE( a != b);
|
REQUIRE( a != b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -81,11 +81,11 @@ TEST_CASE( "nested SECTION tests", "[.][sections][failing]" ) {
|
|||||||
int a = 1;
|
int a = 1;
|
||||||
int b = 2;
|
int b = 2;
|
||||||
|
|
||||||
SECTION( "s1", "doesn't equal" ) {
|
SECTION( "doesn't equal" ) {
|
||||||
REQUIRE( a != b );
|
REQUIRE( a != b );
|
||||||
REQUIRE( b != a );
|
REQUIRE( b != a );
|
||||||
|
|
||||||
SECTION( "s2", "not equal" ) {
|
SECTION( "not equal" ) {
|
||||||
REQUIRE( a != b);
|
REQUIRE( a != b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -95,15 +95,15 @@ TEST_CASE( "more nested SECTION tests", "[sections][failing][.]" ) {
|
|||||||
int a = 1;
|
int a = 1;
|
||||||
int b = 2;
|
int b = 2;
|
||||||
|
|
||||||
SECTION( "s1", "doesn't equal" ) {
|
SECTION( "doesn't equal" ) {
|
||||||
SECTION( "s2", "equal" ) {
|
SECTION( "equal" ) {
|
||||||
REQUIRE( a == b );
|
REQUIRE( a == b );
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION( "s3", "not equal" ) {
|
SECTION( "not equal" ) {
|
||||||
REQUIRE( a != b );
|
REQUIRE( a != b );
|
||||||
}
|
}
|
||||||
SECTION( "s4", "less than" ) {
|
SECTION( "less than" ) {
|
||||||
REQUIRE( a < b );
|
REQUIRE( a < b );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -112,16 +112,16 @@ TEST_CASE( "more nested SECTION tests", "[sections][failing][.]" ) {
|
|||||||
TEST_CASE( "even more nested SECTION tests", "[sections]" ) {
|
TEST_CASE( "even more nested SECTION tests", "[sections]" ) {
|
||||||
SECTION( "c" ) {
|
SECTION( "c" ) {
|
||||||
SECTION( "d (leaf)" ) {
|
SECTION( "d (leaf)" ) {
|
||||||
SUCCEED(""); // avoid failing due to no tests
|
SUCCEED(); // avoid failing due to no tests
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION( "e (leaf)" ) {
|
SECTION( "e (leaf)" ) {
|
||||||
SUCCEED(""); // avoid failing due to no tests
|
SUCCEED(); // avoid failing due to no tests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION( "f (leaf)" ) {
|
SECTION( "f (leaf)" ) {
|
||||||
SUCCEED(""); // avoid failing due to no tests
|
SUCCEED(); // avoid failing due to no tests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,9 +129,7 @@ TEST_CASE( "looped SECTION tests", "[.][failing][sections]" ) {
|
|||||||
int a = 1;
|
int a = 1;
|
||||||
|
|
||||||
for( int b = 0; b < 10; ++b ) {
|
for( int b = 0; b < 10; ++b ) {
|
||||||
std::ostringstream oss;
|
DYNAMIC_SECTION( "b is currently: " << b ) {
|
||||||
oss << "b is currently: " << b;
|
|
||||||
SECTION( "s1", oss.str() ) {
|
|
||||||
CHECK( b > a );
|
CHECK( b > a );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -174,11 +172,11 @@ TEST_CASE( "checkedElse, failing", "[failing][.]" ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE( "xmlentitycheck" ) {
|
TEST_CASE( "xmlentitycheck" ) {
|
||||||
SECTION( "embedded xml", "<test>it should be possible to embed xml characters, such as <, \" or &, or even whole <xml>documents</xml> within an attribute</test>" ) {
|
SECTION( "embedded xml: <test>it should be possible to embed xml characters, such as <, \" or &, or even whole <xml>documents</xml> within an attribute</test>" ) {
|
||||||
SUCCEED(""); // We need this here to stop it failing due to no tests
|
SUCCEED(); // We need this here to stop it failing due to no tests
|
||||||
}
|
}
|
||||||
SECTION( "encoded chars", "these should all be encoded: &&&\"\"\"<<<&\"<<&\"" ) {
|
SECTION( "encoded chars: these should all be encoded: &&&\"\"\"<<<&\"<<&\"" ) {
|
||||||
SUCCEED(""); // We need this here to stop it failing due to no tests
|
SUCCEED(); // We need this here to stop it failing due to no tests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,8 +263,8 @@ TEST_CASE( "vectors can be sized and resized", "[vector]" ) {
|
|||||||
|
|
||||||
// https://github.com/philsquared/Catch/issues/166
|
// https://github.com/philsquared/Catch/issues/166
|
||||||
TEST_CASE("A couple of nested sections followed by a failure", "[failing][.]") {
|
TEST_CASE("A couple of nested sections followed by a failure", "[failing][.]") {
|
||||||
SECTION("Outer", "")
|
SECTION("Outer")
|
||||||
SECTION("Inner", "")
|
SECTION("Inner")
|
||||||
SUCCEED("that's not flying - that's failing in style");
|
SUCCEED("that's not flying - that's failing in style");
|
||||||
|
|
||||||
FAIL("to infinity and beyond");
|
FAIL("to infinity and beyond");
|
||||||
@ -274,7 +272,7 @@ TEST_CASE("A couple of nested sections followed by a failure", "[failing][.]") {
|
|||||||
|
|
||||||
TEST_CASE("not allowed", "[!throws]") {
|
TEST_CASE("not allowed", "[!throws]") {
|
||||||
// This test case should not be included if you run with -e on the command line
|
// This test case should not be included if you run with -e on the command line
|
||||||
SUCCEED( "" );
|
SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
//TEST_CASE( "Is big endian" ) {
|
//TEST_CASE( "Is big endian" ) {
|
||||||
|
@ -232,28 +232,28 @@ struct is_true
|
|||||||
|
|
||||||
TEST_CASE( "(unimplemented) static bools can be evaluated", "[Tricky]" )
|
TEST_CASE( "(unimplemented) static bools can be evaluated", "[Tricky]" )
|
||||||
{
|
{
|
||||||
SECTION("compare to true","")
|
SECTION("compare to true")
|
||||||
{
|
{
|
||||||
REQUIRE( is_true<true>::value == true );
|
REQUIRE( is_true<true>::value == true );
|
||||||
REQUIRE( true == is_true<true>::value );
|
REQUIRE( true == is_true<true>::value );
|
||||||
}
|
}
|
||||||
SECTION("compare to false","")
|
SECTION("compare to false")
|
||||||
{
|
{
|
||||||
REQUIRE( is_true<false>::value == false );
|
REQUIRE( is_true<false>::value == false );
|
||||||
REQUIRE( false == is_true<false>::value );
|
REQUIRE( false == is_true<false>::value );
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("negation", "")
|
SECTION("negation")
|
||||||
{
|
{
|
||||||
REQUIRE( !is_true<false>::value );
|
REQUIRE( !is_true<false>::value );
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("double negation","")
|
SECTION("double negation")
|
||||||
{
|
{
|
||||||
REQUIRE( !!is_true<true>::value );
|
REQUIRE( !!is_true<true>::value );
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("direct","")
|
SECTION("direct")
|
||||||
{
|
{
|
||||||
REQUIRE( is_true<true>::value );
|
REQUIRE( is_true<true>::value );
|
||||||
REQUIRE_FALSE( is_true<false>::value );
|
REQUIRE_FALSE( is_true<false>::value );
|
||||||
|
@ -24,7 +24,7 @@ def generate(v):
|
|||||||
|
|
||||||
seenHeaders = set([])
|
seenHeaders = set([])
|
||||||
rootPath = os.path.join( catchPath, 'include/' )
|
rootPath = os.path.join( catchPath, 'include/' )
|
||||||
outputPath = os.path.join( catchPath, 'single_include/catch.hpp' )
|
outputPath = os.path.join( catchPath, 'single_include/catch2/catch.hpp' )
|
||||||
|
|
||||||
globals = {
|
globals = {
|
||||||
'includeImpl' : True,
|
'includeImpl' : True,
|
||||||
|
@ -169,7 +169,7 @@ def performUpdates(version):
|
|||||||
import shutil
|
import shutil
|
||||||
for rep in ('automake', 'tap', 'teamcity'):
|
for rep in ('automake', 'tap', 'teamcity'):
|
||||||
sourceFile = os.path.join(catchPath, 'include/reporters/catch_reporter_{}.hpp'.format(rep))
|
sourceFile = os.path.join(catchPath, 'include/reporters/catch_reporter_{}.hpp'.format(rep))
|
||||||
destFile = os.path.join(catchPath, 'single_include/catch_reporter_{}.hpp'.format(rep))
|
destFile = os.path.join(catchPath, 'single_include', 'catch2', 'catch_reporter_{}.hpp'.format(rep))
|
||||||
shutil.copyfile(sourceFile, destFile)
|
shutil.copyfile(sourceFile, destFile)
|
||||||
|
|
||||||
updateReadmeFile(version)
|
updateReadmeFile(version)
|
||||||
|
@ -6,7 +6,7 @@ import subprocess
|
|||||||
catchPath = os.path.dirname(os.path.realpath( os.path.dirname(sys.argv[0])))
|
catchPath = os.path.dirname(os.path.realpath( os.path.dirname(sys.argv[0])))
|
||||||
|
|
||||||
def getBuildExecutable():
|
def getBuildExecutable():
|
||||||
dir = os.environ.get('CATCH_DEV_OUT_DIR', "cmake-build-debug/SelfTest")
|
dir = os.environ.get('CATCH_DEV_OUT_DIR', "cmake-build-debug/projects/SelfTest")
|
||||||
return dir
|
return dir
|
||||||
|
|
||||||
def runAndCapture( args ):
|
def runAndCapture( args ):
|
||||||
|
@ -34,7 +34,7 @@ def uploadFiles():
|
|||||||
'code': main_file,
|
'code': main_file,
|
||||||
'codes': [{
|
'codes': [{
|
||||||
'file': 'catch.hpp',
|
'file': 'catch.hpp',
|
||||||
'code': open(os.path.join(catchPath, 'single_include', 'catch.hpp')).read()
|
'code': open(os.path.join(catchPath, 'single_include', 'catch2', 'catch.hpp')).read()
|
||||||
}],
|
}],
|
||||||
'options': 'c++11,cpp-no-pedantic,boost-nothing',
|
'options': 'c++11,cpp-no-pedantic,boost-nothing',
|
||||||
'compiler-option-raw': '-DCATCH_CONFIG_FAST_COMPILE',
|
'compiler-option-raw': '-DCATCH_CONFIG_FAST_COMPILE',
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Catch v2.2.3
|
* Catch v2.2.3
|
||||||
* Generated: 2018-06-06 23:11:57.601416
|
* Generated: 2018-06-11 22:16:30.128800
|
||||||
* ----------------------------------------------------------
|
* ----------------------------------------------------------
|
||||||
* 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) 2018 Two Blue Cubes Ltd. All rights reserved.
|
* Copyright (c) 2018 Two Blue Cubes Ltd. All rights reserved.
|
@ -6,7 +6,7 @@
|
|||||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
#define CATCH_CONFIG_MAIN
|
#define CATCH_CONFIG_MAIN
|
||||||
#include "catch.hpp"
|
#include <catch2/catch.hpp>
|
||||||
|
|
||||||
unsigned int Factorial( unsigned int number ) {
|
unsigned int Factorial( unsigned int number ) {
|
||||||
return number > 1 ? Factorial(number-1)*number : 1;
|
return number > 1 ? Factorial(number-1)*number : 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user