1
0
mirror of https://github.com/catchorg/Catch2.git synced 2025-01-15 14:48:00 +00:00

Compare commits

...

21 Commits

Author SHA1 Message Date
Martin Hořeňovský
ebeeaaeec6
Reenable appveyor for CI 2019-12-16 00:15:30 +01:00
Martin Hořeňovský
69bd213c40
Reenable travis for CI 2019-12-16 00:15:10 +01:00
Martin Hořeňovský
5fbf04cd59
Redo how the separate compilation tests are handled 2019-12-15 20:33:39 +01:00
Martin Hořeňovský
8b42acc328
Reintegrate extra tests 2019-12-09 10:04:26 +01:00
Martin Hořeňovský
29b441949c
Port the last example 2019-12-08 20:58:52 +01:00
Martin Hořeňovský
70ef2f7f12
Update building of examples for static lib 2019-12-08 15:55:04 +01:00
Martin Hořeňovský
248f922465
Cleanup impl and main from the main header 2019-12-08 11:31:47 +01:00
Martin Hořeňovský
91ee07e08c
Moved scripts/ to tools/scripts/ 2019-12-06 11:53:31 +01:00
Martin Hořeňovský
6eb04667ad
Move misc/ to tools/misc 2019-12-06 11:40:53 +01:00
Martin Hořeňovský
604ededf77
Move artwork/ to data/artwork/ 2019-12-06 11:36:12 +01:00
Martin Hořeňovský
918aa327fa
Rename contrib/ to extras/ 2019-12-05 16:24:57 +01:00
Martin Hořeňovský
0fea081ad1
Move tests from projects/ to tests/ 2019-12-05 16:00:20 +01:00
Martin Hořeňovský
90e2549cec
Rewrite includes in tests to use library's include paths 2019-12-02 12:23:10 +01:00
Martin Hořeňovský
82cc5bc034
Rewrite includes inside the library to use <catch2/> form 2019-12-02 12:04:55 +01:00
Martin Hořeňovský
fef4f217b1
Unit tests build and run (todo: projects, includes, extras) 2019-11-30 20:45:34 +01:00
Martin Hořeňovský
e341b11467
WIP: CMake changes to build static lib + tests separately 2019-11-30 17:41:41 +01:00
Martin Hořeňovský
443fa0fc88
Fixing paths in SelfTest 2019-11-30 17:41:17 +01:00
Martin Hořeňovský
4385951a55
Move files into catch2/ subdir 2019-11-30 17:30:32 +01:00
Martin Hořeňovský
7c6de33977
Fixed up include paths 2019-11-30 17:13:22 +01:00
Martin Hořeňovský
e1a43b5b0f Move files from internal/ up a level 2019-11-30 12:23:37 +01:00
Martin Hořeňovský
8e56b8b0ec Rename include/ to src/ 2019-11-30 12:17:16 +01:00
329 changed files with 3915 additions and 4180 deletions

View File

@ -158,24 +158,22 @@ matrix:
# Special builds, e.g. conan
- language: python
python:
- "3.7"
install:
- pip install conan-package-tools
env:
- CONAN_GCC_VERSIONS=8
- CONAN_DOCKER_IMAGE=conanio/gcc8
- CPP14=1
script:
- python .conan/build.py
# # Special builds, e.g. conan
# - language: python
# python:
# - "3.7"
# install:
# - pip install conan-package-tools
# env:
# - CONAN_GCC_VERSIONS=8
# - CONAN_DOCKER_IMAGE=conanio/gcc8
# - CPP14=1
# script:
# - python .conan/build.py
before_script:
- export CXX=${COMPILER}
- cd ${TRAVIS_BUILD_DIR}
# Regenerate single header file, so it is tested in the examples...
- python scripts/generateSingleHeader.py
- |
if [[ ${CPP17} -eq 1 ]]; then

View File

@ -6,6 +6,11 @@ if(NOT DEFINED PROJECT_NAME)
set(NOT_SUBPROJECT ON)
endif()
option(CATCH_BUILD_TESTING "Build SelfTest project" ON)
option(CATCH_BUILD_EXAMPLES "Build documentation examples" OFF)
option(CATCH_BUILD_EXTRA_TESTS "Build extra tests" OFF)
# Catch2's build breaks if done in-tree. You probably should not build
# things in tree anyway, but we can allow projects that include Catch2
# as a subproject to build in-tree as long as it is not in our tree.
@ -23,34 +28,23 @@ include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
include(CTest)
option(CATCH_USE_VALGRIND "Perform SelfTests with Valgrind" OFF)
option(CATCH_BUILD_TESTING "Build SelfTest project" ON)
option(CATCH_BUILD_EXAMPLES "Build documentation examples" OFF)
option(CATCH_BUILD_EXTRA_TESTS "Build extra tests" OFF)
option(CATCH_ENABLE_COVERAGE "Generate coverage for codecov.io" OFF)
option(CATCH_ENABLE_WERROR "Enable all warnings as errors" ON)
option(CATCH_INSTALL_DOCS "Install documentation alongside library" ON)
option(CATCH_INSTALL_HELPERS "Install contrib alongside library" ON)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# define some folders
# Basic paths
set(CATCH_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(SELF_TEST_DIR ${CATCH_DIR}/projects/SelfTest)
set(BENCHMARK_DIR ${CATCH_DIR}/projects/Benchmark)
set(HEADER_DIR ${CATCH_DIR}/include)
set(SOURCES_DIR ${CATCH_DIR}/src/catch2)
set(SELF_TEST_DIR ${CATCH_DIR}/tests/SelfTest)
set(BENCHMARK_DIR ${CATCH_DIR}/tests/Benchmark)
set(EXAMPLES_DIR ${CATCH_DIR}/examples)
if(USE_WMAIN)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:wmainCRTStartup")
endif()
# We need to bring-in the variables defined there to this scope
add_subdirectory(src)
# Build tests only if requested
if (BUILD_TESTING AND CATCH_BUILD_TESTING AND NOT_SUBPROJECT)
find_package(PythonInterp)
if (NOT PYTHONINTERP_FOUND)
message(FATAL_ERROR "Python not found, but required for tests")
endif()
add_subdirectory(projects)
add_subdirectory(tests)
endif()
if(CATCH_BUILD_EXAMPLES)
@ -58,176 +52,200 @@ if(CATCH_BUILD_EXAMPLES)
endif()
if(CATCH_BUILD_EXTRA_TESTS)
add_subdirectory(projects/ExtraTests)
add_subdirectory(tests/ExtraTests)
endif()
# add catch as a 'linkable' target
add_library(Catch2 INTERFACE)
# depend on some obvious c++11 features so the dependency is transitively added dependents
target_compile_features(Catch2
INTERFACE
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}>
)
if (ANDROID)
target_link_libraries(Catch2 INTERFACE log)
endif()
# provide a namespaced alias for clients to 'link' against if catch is included as a sub-project
add_library(Catch2::Catch2 ALIAS Catch2)
# Only perform the installation steps when Catch is not being used as
# a subproject via `add_subdirectory`, or the destinations will break,
# see https://github.com/catchorg/Catch2/issues/1373
if (NOT_SUBPROJECT)
set(CATCH_CMAKE_CONFIG_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Catch2")
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}
)
# By default, FooConfigVersion is tied to architecture that it was
# generated on. Because Catch2 is header-only, it is arch-independent
# and thus Catch2ConfigVersion should not be tied to the architecture
# it was generated on.
#
# CMake does not provide a direct customization point for this in
# `write_basic_package_version_file`, but it can be accomplished
# indirectly by temporarily redefining `CMAKE_SIZEOF_VOID_P` to an
# empty string. Note that just undefining the variable could be
# insufficient in cases where the variable was already in CMake cache
set(CATCH2_CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
set(CMAKE_SIZEOF_VOID_P "")
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/Catch2ConfigVersion.cmake"
COMPATIBILITY
SameMajorVersion
)
set(CMAKE_SIZEOF_VOID_P ${CATCH2_CMAKE_SIZEOF_VOID_P})
install(
DIRECTORY
"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}
)
# CPack/CMake started taking the package version from project version 3.12
# So we need to set the version manually for older CMake versions
if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
endif()
set(CPACK_PACKAGE_CONTACT "https://github.com/catchorg/Catch2/")
include( CPack )
endif(NOT_SUBPROJECT)
#option(CATCH_USE_VALGRIND "Perform SelfTests with Valgrind" OFF)
#option(CATCH_ENABLE_COVERAGE "Generate coverage for codecov.io" OFF)
#option(CATCH_ENABLE_WERROR "Enable all warnings as errors" ON)
#option(CATCH_INSTALL_DOCS "Install documentation alongside library" ON)
#option(CATCH_INSTALL_EXTRAS "Install extras alongside library" ON)
#
#set_property(GLOBAL PROPERTY USE_FOLDERS ON)
#
#if(USE_WMAIN)
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:wmainCRTStartup")
#endif()
#
#if (BUILD_TESTING AND CATCH_BUILD_TESTING AND NOT_SUBPROJECT)
# find_package(PythonInterp)
# if (NOT PYTHONINTERP_FOUND)
# message(FATAL_ERROR "Python not found, but required for tests")
# endif()
# add_subdirectory(projects)
#endif()
#
#if(CATCH_BUILD_EXTRA_TESTS)
# add_subdirectory(projects/ExtraTests)
#endif()
#
## add catch as a 'linkable' target
#add_library(Catch2 INTERFACE)
#
#
#
## depend on some obvious c++11 features so the dependency is transitively added dependents
#target_compile_features(Catch2
# INTERFACE
# 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}>
#)
#
#if (ANDROID)
# target_link_libraries(Catch2 INTERFACE log)
#endif()
#
## provide a namespaced alias for clients to 'link' against if catch is included as a sub-project
#add_library(Catch2::Catch2 ALIAS Catch2)
#
## Only perform the installation steps when Catch is not being used as
## a subproject via `add_subdirectory`, or the destinations will break,
## see https://github.com/catchorg/Catch2/issues/1373
#if (NOT_SUBPROJECT)
# set(CATCH_CMAKE_CONFIG_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Catch2")
#
# 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}
# )
#
# # By default, FooConfigVersion is tied to architecture that it was
# # generated on. Because Catch2 is header-only, it is arch-independent
# # and thus Catch2ConfigVersion should not be tied to the architecture
# # it was generated on.
# #
# # CMake does not provide a direct customization point for this in
# # `write_basic_package_version_file`, but it can be accomplished
# # indirectly by temporarily redefining `CMAKE_SIZEOF_VOID_P` to an
# # empty string. Note that just undefining the variable could be
# # insufficient in cases where the variable was already in CMake cache
# set(CATCH2_CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
# set(CMAKE_SIZEOF_VOID_P "")
# write_basic_package_version_file(
# "${CMAKE_CURRENT_BINARY_DIR}/Catch2ConfigVersion.cmake"
# COMPATIBILITY
# SameMajorVersion
# )
# set(CMAKE_SIZEOF_VOID_P ${CATCH2_CMAKE_SIZEOF_VOID_P})
#
# install(
# DIRECTORY
# "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
# "extras/ParseAndAddCatchTests.cmake"
# "extras/Catch.cmake"
# "extras/CatchAddTests.cmake"
# DESTINATION
# ${CATCH_CMAKE_CONFIG_DESTINATION}
# )
#
# # Install debugger helpers
# install(
# FILES
# "extras/gdbinit"
# "extras/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}
# )
#
# # CPack/CMake started taking the package version from project version 3.12
# # So we need to set the version manually for older CMake versions
# if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
# set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
# endif()
#
# set(CPACK_PACKAGE_CONTACT "https://github.com/catchorg/Catch2/")
#
#
# include( CPack )
#
#endif(NOT_SUBPROJECT)

View File

@ -1,5 +1,5 @@
<a id="top"></a>
![catch logo](artwork/catch2-logo-small.png)
![catch logo](data/artwork/catch2-logo-small.png)
[![Github Releases](https://img.shields.io/github/release/catchorg/catch2.svg)](https://github.com/catchorg/catch2/releases)
[![Build Status](https://travis-ci.org/catchorg/Catch2.svg?branch=master)](https://travis-ci.org/catchorg/Catch2)

View File

@ -18,7 +18,7 @@ init:
install:
- ps: if (($env:CONFIGURATION) -eq "Debug" -And ($env:coverage) -eq "1" ) { pip --disable-pip-version-check install codecov }
- ps: if (($env:CONFIGURATION) -eq "Debug" -And ($env:coverage) -eq "1" ) { .\misc\installOpenCppCoverage.ps1 }
- ps: if (($env:CONFIGURATION) -eq "Debug" -And ($env:coverage) -eq "1" ) { .\tools\misc\installOpenCppCoverage.ps1 }
before_build:
@ -26,7 +26,7 @@ before_build:
# Indirection because appveyor doesn't handle multiline batch scripts properly
# https://stackoverflow.com/questions/37627248/how-to-split-a-command-over-multiple-lines-in-appveyor-yml/37647169#37647169
# https://help.appveyor.com/discussions/questions/3888-multi-line-cmd-or-powershell-warning-ignore
- cmd: .\misc\appveyorBuildConfigurationScript.bat
- cmd: .\tools\misc\appveyorBuildConfigurationScript.bat
# build with MSBuild
@ -37,7 +37,7 @@ build:
test_script:
- set CTEST_OUTPUT_ON_FAILURE=1
- cmd: .\misc\appveyorTestRunScript.bat
- cmd: .\tools\misc\appveyorTestRunScript.bat
# Sadly we cannot use the standard "dimensions" based approach towards

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -35,7 +35,7 @@ While these files are not essential to compilation they help to keep the impleme
At time of writing this set is not complete but has reasonable coverage.
If you add additional headers please try to remember to add a surrogate cpp for it.
The other directories are `scripts` which contains a set of python scripts to help in testing Catch as well as
The other directories are `tools/scripts` which contains a set of python scripts to help in testing Catch as well as
generating the single include, and `docs`, which contains the documentation as a set of markdown files.
__When submitting a pull request please do not include changes to the single include, or to the version number file

View File

@ -10,8 +10,6 @@
- Fixture: [Sections](../examples/100-Fix-Section.cpp)
- Fixture: [Class-based fixtures](../examples/110-Fix-ClassFixture.cpp)
- BDD: [SCENARIO, GIVEN, WHEN, THEN](../examples/120-Bdd-ScenarioGivenWhenThen.cpp)
- Report: [Catch-provided main](../examples/200-Rpt-CatchMain.cpp)
- Report: [TeamCity reporter](../examples/207-Rpt-TeamCityReporter.cpp)
- Listener: [Listeners](../examples/210-Evt-EventListeners.cpp)
- Configuration: [Provide your own output streams](../examples/231-Cfg-OutputStreams.cpp)
- Generators: [Create your own generator](../examples/300-Gen-OwnGenerator.cpp)

View File

@ -1,7 +1,7 @@
<a id="top"></a>
# How to release
When enough changes have accumulated, it is time to release new version of Catch. This document describes the process in doing so, that no steps are forgotten. Note that all referenced scripts can be found in the `scripts/` directory.
When enough changes have accumulated, it is time to release new version of Catch. This document describes the process in doing so, that no steps are forgotten. Note that all referenced scripts can be found in the `tools/scripts/` directory.
## Necessary steps

View File

@ -1,12 +1,10 @@
// 000-CatchMain.cpp
// In a Catch project with multiple files, dedicate one file to compile the
// source code of Catch itself and reuse the resulting object file for linking.
// It is generally recommended to have a single file provide the main
// of a testing binary, and other test files to link against it.
// Let Catch provide main():
#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
#include <catch2/catch_default_main.hpp>
// That's it

View File

@ -1,8 +1,9 @@
// 010-TestCase.cpp
// Let Catch provide main():
#define CATCH_CONFIG_MAIN
#include <catch2/catch_default_main.hpp>
// And write tests in the same file:
#include <catch2/catch.hpp>
int Factorial( int number ) {

View File

@ -4,7 +4,7 @@
// source code of Catch itself and reuse the resulting object file for linking.
// Let Catch provide main():
#define CATCH_CONFIG_MAIN
#include <catch2/catch_default_main.hpp>
#include <catch2/catch.hpp>

View File

@ -1,27 +0,0 @@
// 200-Rpt-CatchMain.cpp
// In a Catch project with multiple files, dedicate one file to compile the
// source code of Catch itself and reuse the resulting object file for linking.
// Let Catch provide main():
#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
#ifdef CATCH_EXAMPLE_RPT_1
#include CATCH_EXAMPLE_RPT_1
#endif
#ifdef CATCH_EXAMPLE_RPT_2
#include CATCH_EXAMPLE_RPT_2
#endif
#ifdef CATCH_EXAMPLE_RPT_3
#include CATCH_EXAMPLE_RPT_3
#endif
// That's it
// Compile implementation of Catch for use with files that do contain tests:
// - g++ -std=c++11 -Wall -I$(CATCH_ROOT) -DCATCH_EXAMPLE_RPT_1=\"include/reporters/catch_reporter_teamcity.hpp\" -o 200-Rpt-CatchMainTeamCity.o -c 200-Rpt-CatchMain.cpp
// cl -EHsc -I%CATCH_ROOT% -DCATCH_EXAMPLE_RPT_1=\"include/reporters/catch_reporter_teamcity.hpp\" -Fo200-Rpt-CatchMainTeamCity.obj -c 200-Rpt-CatchMain.cpp

View File

@ -1,171 +0,0 @@
// 207-Rpt-TeamCityReporter.cpp
// Catch has built-in and external reporters:
// Built-in:
// - compact
// - console
// - junit
// - xml
// External:
// - automake
// - tap
// - teamcity (this example)
// main() and reporter code provided in 200-Rpt-CatchMain.cpp
#include <catch2/catch.hpp>
#ifdef _MSC_VER
# pragma warning (disable : 4702) // Disable warning: unreachable code
#endif
TEST_CASE( "TeamCity passes unconditionally succeeding assertion", "[teamcity]" ) {
SUCCEED();
}
TEST_CASE( "TeamCity reports unconditionally failing assertion", "[teamcity]" ) {
FAIL();
}
TEST_CASE( "TeamCity reports failing check", "[teamcity]" ) {
REQUIRE( 3 == 7 );
}
TEST_CASE( "TeamCity reports failing check-false", "[teamcity]" ) {
REQUIRE_FALSE( 3 == 3 );
}
TEST_CASE( "TeamCity reports failing check-that", "[teamcity]" ) {
using namespace Catch;
REQUIRE_THAT( "hello", Contains( "world" ) );
}
TEST_CASE( "TeamCity reports unexpected exception", "[teamcity]" ) {
REQUIRE( (throw std::runtime_error("surprise!"), true) );
}
TEST_CASE( "TeamCity reports undesired exception", "[teamcity]" ) {
REQUIRE_NOTHROW( (throw std::runtime_error("surprise!"), true) );
}
TEST_CASE( "TeamCity reports missing expected exception", "[teamcity]" ) {
REQUIRE_THROWS( true );
}
TEST_CASE( "TeamCity reports missing specific expected exception", "[teamcity]" ) {
REQUIRE_THROWS_AS( throw std::bad_alloc(), std::runtime_error );
}
TEST_CASE( "TeamCity reports unexpected message in expected exception", "[teamcity]" ) {
using namespace Catch;
CHECK_THROWS_WITH( throw std::runtime_error("hello"), "world" );
CHECK_THROWS_WITH( throw std::runtime_error("hello"), Contains("world") );
}
struct MyException: public std::runtime_error
{
MyException( char const * text )
: std::runtime_error( text ) {}
~MyException() override;
};
// prevent -Wweak-vtables:
MyException::~MyException() = default;
struct MyExceptionMatcher : Catch::MatcherBase< std::runtime_error >
{
std::string m_text;
MyExceptionMatcher( char const * text )
: m_text( text )
{}
~MyExceptionMatcher() override;
bool match( std::runtime_error const & arg ) const override
{
return m_text == arg.what() ;
}
std::string describe() const override
{
return "it's me";
}
};
// prevent -Wweak-vtables:
MyExceptionMatcher::~MyExceptionMatcher() = default;
TEST_CASE( "TeamCity failing check-throws-matches", "[teamcity]" ) {
CHECK_THROWS_MATCHES( throw MyException("hello"), MyException, MyExceptionMatcher("world") );
}
// [!throws] - lets Catch know that this test is likely to throw an exception even if successful.
// This causes the test to be excluded when running with -e or --nothrow.
// No special effects for the reporter.
TEST_CASE( "TeamCity throwing exception with tag [!throws]", "[teamcity][!throws]" ) {
REQUIRE_THROWS( throw std::runtime_error("unsurprisingly") );
}
// [!mayfail] - doesn't fail the test if any given assertion fails (but still reports it). This can be useful to flag a work-in-progress, or a known issue that you don't want to immediately fix but still want to track in your tests.
TEST_CASE( "TeamCity failing assertion with tag [!mayfail]", "[teamcity][!mayfail] " ) {
REQUIRE( 3 == 7 ); // doesn't fail test case this time, reports: testIgnored
REQUIRE( 3 == 3 );
}
// [!shouldfail] - like [!mayfail] but fails the test if it passes.
// This can be useful if you want to be notified of accidental, or third-party, fixes.
TEST_CASE( "TeamCity succeeding assertion with tag [!shouldfail]", "[teamcity][!shouldfail]" ) {
SUCCEED( "Marked [!shouldfail]" );
}
// Compile & run:
// - g++ -std=c++11 -Wall -I$(CATCH_ROOT) -DCATCH_EXAMPLE_RPT_1=\"include/reporters/catch_reporter_teamcity.hpp\" -o 200-Rpt-CatchMainTeamCity.o -c 200-Rpt-CatchMain.cpp
// - g++ -std=c++11 -Wall -I$(CATCH_ROOT) -o 207-Rpt-TeamCityReporter 207-Rpt-TeamCityReporter.cpp 200-Rpt-CatchMainTeamCity.o && 207-Rpt-TeamCityReporter --list-reporters
//
// - cl -EHsc -I%CATCH_ROOT% -DCATCH_EXAMPLE_RPT_1=\"include/reporters/catch_reporter_teamcity.hpp\" -Fo200-Rpt-CatchMainTeamCity.obj -c 200-Rpt-CatchMain.cpp
// - cl -EHsc -I%CATCH_ROOT% 207-Rpt-TeamCityReporter.cpp 200-Rpt-CatchMainTeamCity.o && 207-Rpt-TeamCityReporter --list-reporters
// Compilation output (--list-reporters):
// Available reporters:
// compact: Reports test results on a single line, suitable for IDEs
// console: Reports test results as plain lines of text
// junit: Reports test results in an XML format that looks like Ant's
// junitreport target
// teamcity: Reports test results as TeamCity service messages
// xml: Reports test results as an XML document
// Expected output (abbreviated and broken into shorter lines):
//
// prompt> 207-Rpt-TeamCityReporter.exe --reporter teamcity
// ##teamcity[testSuiteStarted name='207-Rpt-TeamCityReporter.exe']
// ##teamcity[testStarted name='TeamCity passes unconditionally succeeding assertion']
// ##teamcity[testFinished name='TeamCity passes unconditionally succeeding assertion' duration='1']
// ##teamcity[testStarted name='TeamCity reports unconditionally failing assertion']
// ##teamcity[testFailed name='TeamCity reports unconditionally failing assertion' /
// message='.../examples/207-Rpt-TeamCityReporter.cpp:23|n/
// ...............................................................................|n|n/
// .../examples/207-Rpt-TeamCityReporter.cpp:25|nexplicit failure']
// ##teamcity[testFinished name='TeamCity reports unconditionally failing assertion' duration='3']
// ...

View File

@ -6,10 +6,12 @@
// there is no important difference between having `std::cerr` buffered
// or unbuffered.
#define CATCH_CONFIG_NOSTDOUT
#define CATCH_CONFIG_MAIN
#include <catch2/catch_default_main.hpp>
#include <catch2/catch.hpp>
#include <sstream>
#include <cstdio>
class out_buff : public std::stringbuf {
std::FILE* m_stream;

View File

@ -1,44 +1,30 @@
#
# Build examples.
#
# Requires CATCH_BUILD_EXAMPLES to be defined 'true', see ../CMakeLists.txt.
#
cmake_minimum_required( VERSION 3.5 )
cmake_minimum_required( VERSION 3.0 )
project( CatchExamples CXX )
project( Catch2Examples LANGUAGES CXX )
message( STATUS "Examples included" )
# define folders used:
set( EXAMPLES_DIR ${CATCH_DIR}/examples )
set( HEADER_DIR ${CATCH_DIR}/single_include )
set( REPORTER_HEADER_DIR ${CATCH_DIR}/include/reporters )
# Some one-offs first:
# 1) Tests and main in one file
add_executable( 010-TestCase
010-TestCase.cpp
)
# single-file sources:
# 2) Tests and main across two files
add_executable( 020-MultiFile
020-TestCase-1.cpp
020-TestCase-2.cpp
)
set( SOURCES_SINGLE_FILE
010-TestCase.cpp
add_executable(231-Cfg_OutputStreams
231-Cfg-OutputStreams.cpp
)
target_link_libraries(231-Cfg_OutputStreams Catch2_buildall_interface)
target_compile_definitions(231-Cfg_OutputStreams PUBLIC CATCH_CONFIG_NOSTDOUT)
# multiple-file modules:
set( SOURCES_020
020-TestCase-1.cpp
020-TestCase-2.cpp
)
# main for idiomatic test sources:
set( SOURCES_IDIOMATIC_MAIN
000-CatchMain.cpp
)
# sources to combine with 000-CatchMain.cpp:
set( SOURCES_IDIOMATIC_TESTS
# These examples use the standard separate compilation
set( SOURCES_IDIOMATIC_EXAMPLES
030-Asn-Require-Check.cpp
100-Fix-Section.cpp
110-Fix-ClassFixture.cpp
@ -50,94 +36,24 @@ set( SOURCES_IDIOMATIC_TESTS
311-Gen-CustomCapture.cpp
)
# main-s for reporter-specific test sources:
string( REPLACE ".cpp" "" BASENAMES_IDIOMATIC_EXAMPLES "${SOURCES_IDIOMATIC_EXAMPLES}" )
set( TARGETS_IDIOMATIC_EXAMPLES ${BASENAMES_IDIOMATIC_EXAMPLES} )
set( SOURCES_REPORTERS_MAIN
200-Rpt-CatchMain.cpp
)
string( REPLACE ".cpp" "" BASENAMES_REPORTERS_MAIN 200-Rpt-CatchMain.cpp )
set( NAMES_REPORTERS TeamCity )
foreach( reporter ${NAMES_REPORTERS} )
list( APPEND SOURCES_SPECIFIC_REPORTERS_MAIN ${BASENAMES_REPORTERS_MAIN}${reporter}.cpp )
foreach( name ${TARGETS_IDIOMATIC_EXAMPLES} )
add_executable( ${name}
000-CatchMain.cpp
${EXAMPLES_DIR}/${name}.cpp )
endforeach()
# sources to combine with 200-Rpt-CatchMain{Reporter}.cpp:
set( SOURCES_REPORTERS_TESTS
207-Rpt-TeamCityReporter.cpp
set(ALL_EXAMPLE_TARGETS
${TARGETS_IDIOMATIC_EXAMPLES}
010-TestCase
020-MultiFile
)
# check if all sources are listed, warn if not:
set( SOURCES_ALL
${SOURCES_020}
${SOURCES_SINGLE_FILE}
${SOURCES_IDIOMATIC_MAIN}
${SOURCES_IDIOMATIC_TESTS}
${SOURCES_REPORTERS_MAIN}
${SOURCES_REPORTERS_TESTS}
)
foreach( name ${SOURCES_ALL} )
list( APPEND SOURCES_ALL_PATH ${EXAMPLES_DIR}/${name} )
endforeach()
CheckFileList( SOURCES_ALL_PATH ${EXAMPLES_DIR} )
# create target names:
string( REPLACE ".cpp" "" BASENAMES_SINGLE_FILE "${SOURCES_SINGLE_FILE}" )
string( REPLACE ".cpp" "" BASENAMES_IDIOMATIC_TESTS "${SOURCES_IDIOMATIC_TESTS}" )
string( REPLACE ".cpp" "" BASENAMES_REPORTERS_TESTS "${SOURCES_REPORTERS_TESTS}" )
string( REPLACE ".cpp" "" BASENAMES_REPORTERS_MAIN "${SOURCES_REPORTERS_MAIN}" )
set( TARGETS_SINGLE_FILE ${BASENAMES_SINGLE_FILE} )
set( TARGETS_IDIOMATIC_TESTS ${BASENAMES_IDIOMATIC_TESTS} )
set( TARGETS_REPORTERS_TESTS ${BASENAMES_REPORTERS_TESTS} )
set( TARGETS_REPORTERS_MAIN ${BASENAMES_REPORTERS_MAIN} )
set( TARGETS_ALL
${TARGETS_SINGLE_FILE}
020-TestCase
${TARGETS_IDIOMATIC_TESTS} CatchMain
${TARGETS_REPORTERS_TESTS} CatchMainTeamCity
)
# define program targets:
add_library( CatchMain OBJECT ${EXAMPLES_DIR}/${SOURCES_IDIOMATIC_MAIN} ${HEADER_DIR}/catch2/catch.hpp )
#add_library( CatchMainAutomake OBJECT ${EXAMPLES_DIR}/200-Rpt-CatchMain.cpp ${HEADER_DIR}/catch2/catch.hpp )
#add_library( CatchMainTap OBJECT ${EXAMPLES_DIR}/200-Rpt-CatchMain.cpp ${HEADER_DIR}/catch2/catch.hpp )
add_library( CatchMainTeamCity OBJECT ${EXAMPLES_DIR}/200-Rpt-CatchMain.cpp ${HEADER_DIR}/catch2/catch.hpp )
#target_compile_definitions( CatchMainAutomake PRIVATE CATCH_EXAMPLE_RPT_1=\"include/reporters/catch_reporter_automake.hpp\" )
#target_compile_definitions( CatchMainTap PRIVATE CATCH_EXAMPLE_RPT_1=\"include/reporters/catch_reporter_tap.hpp\" )
target_compile_definitions( CatchMainTeamCity PRIVATE CATCH_EXAMPLE_RPT_1=\"include/reporters/catch_reporter_teamcity.hpp\" )
foreach( name ${TARGETS_SINGLE_FILE} )
add_executable( ${name} ${EXAMPLES_DIR}/${name}.cpp ${HEADER_DIR}/catch2/catch.hpp )
endforeach()
foreach( name ${TARGETS_IDIOMATIC_TESTS} )
add_executable( ${name} ${EXAMPLES_DIR}/${name}.cpp $<TARGET_OBJECTS:CatchMain> ${HEADER_DIR}/catch2/catch.hpp )
endforeach()
add_executable( 020-TestCase ${EXAMPLES_DIR}/020-TestCase-1.cpp ${EXAMPLES_DIR}/020-TestCase-2.cpp ${HEADER_DIR}/catch2/catch.hpp )
#add_executable( 207-Rpt-AutomakeReporter ${EXAMPLES_DIR}/207-Rpt-AutomakeReporter.cpp $<TARGET_OBJECTS:CatchMainAutomake> ${HEADER_DIR}/catch2/catch.hpp )
#add_executable( 207-Rpt-TapReporter ${EXAMPLES_DIR}/207-Rpt-TapReporter.cpp $<TARGET_OBJECTS:CatchMainTap> ${HEADER_DIR}/catch2/catch.hpp )
add_executable( 207-Rpt-TeamCityReporter ${EXAMPLES_DIR}/207-Rpt-TeamCityReporter.cpp $<TARGET_OBJECTS:CatchMainTeamCity> ${HEADER_DIR}/catch2/catch.hpp )
#foreach( name ${TARGETS_REPORTERS_TESTS} )
# add_executable( ${name} ${EXAMPLES_DIR}/${name}.cpp $<TARGET_OBJECTS:CatchMain> ${HEADER_DIR}/catch2/catch.hpp )
#endforeach()
foreach( name ${TARGETS_ALL} )
target_include_directories( ${name} PRIVATE ${HEADER_DIR} ${CATCH_DIR} )
foreach( name ${ALL_EXAMPLE_TARGETS} )
target_link_libraries( ${name} Catch2 )
set_property(TARGET ${name} PROPERTY CXX_STANDARD 14)
set_property(TARGET ${name} PROPERTY CXX_EXTENSIONS OFF)
@ -154,4 +70,3 @@ foreach( name ${TARGETS_ALL} )
target_compile_options( ${name} PRIVATE /W4 /w44265 /WX )
endif()
endforeach()

View File

@ -1,34 +0,0 @@
/*
* Created by Martin on 31/08/2017.
*
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include "catch_reporter_registry.h"
namespace Catch {
ReporterRegistry::~ReporterRegistry() = default;
IStreamingReporterPtr ReporterRegistry::create( std::string const& name, IConfigPtr const& config ) const {
auto it = m_factories.find( name );
if( it == m_factories.end() )
return nullptr;
return it->second->create( ReporterConfig( config ) );
}
void ReporterRegistry::registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) {
m_factories.emplace(name, factory);
}
void ReporterRegistry::registerListener( IReporterFactoryPtr const& factory ) {
m_listeners.push_back( factory );
}
IReporterRegistry::FactoryMap const& ReporterRegistry::getFactories() const {
return m_factories;
}
IReporterRegistry::Listeners const& ReporterRegistry::getListeners() const {
return m_listeners;
}
}

View File

@ -1,482 +0,0 @@
include(MiscFunctions)
####
# Temporary workaround for VS toolset changes in 2017
# We need to disable <UseFullPaths> property, but CMake doesn't support it
# until 3.13 (not yet released)
####
if (MSVC)
configure_file(${CATCH_DIR}/misc/SelfTest.vcxproj.user
${CMAKE_BINARY_DIR}/projects
COPYONLY)
endif(MSVC) #Temporary workaround
# 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/Details.tests.cpp
${SELF_TEST_DIR}/IntrospectiveTests/GeneratorsImpl.tests.cpp
${SELF_TEST_DIR}/IntrospectiveTests/InternalBenchmark.tests.cpp
${SELF_TEST_DIR}/IntrospectiveTests/PartTracker.tests.cpp
${SELF_TEST_DIR}/IntrospectiveTests/RandomNumberGeneration.tests.cpp
${SELF_TEST_DIR}/IntrospectiveTests/Tag.tests.cpp
${SELF_TEST_DIR}/IntrospectiveTests/String.tests.cpp
${SELF_TEST_DIR}/IntrospectiveTests/StringManip.tests.cpp
${SELF_TEST_DIR}/IntrospectiveTests/Xml.tests.cpp
${SELF_TEST_DIR}/IntrospectiveTests/ToString.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/Generators.tests.cpp
${SELF_TEST_DIR}/UsageTests/Message.tests.cpp
${SELF_TEST_DIR}/UsageTests/Misc.tests.cpp
${SELF_TEST_DIR}/UsageTests/ToStringByte.tests.cpp
${SELF_TEST_DIR}/UsageTests/ToStringChrono.tests.cpp
${SELF_TEST_DIR}/UsageTests/ToStringGeneral.tests.cpp
${SELF_TEST_DIR}/UsageTests/ToStringOptional.tests.cpp
${SELF_TEST_DIR}/UsageTests/ToStringPair.tests.cpp
${SELF_TEST_DIR}/UsageTests/ToStringTuple.tests.cpp
${SELF_TEST_DIR}/UsageTests/ToStringVariant.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
)
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(BENCHMARK_HEADERS
${HEADER_DIR}/internal/benchmark/catch_benchmark.hpp
${HEADER_DIR}/internal/benchmark/catch_chronometer.hpp
${HEADER_DIR}/internal/benchmark/catch_clock.hpp
${HEADER_DIR}/internal/benchmark/catch_constructor.hpp
${HEADER_DIR}/internal/benchmark/catch_environment.hpp
${HEADER_DIR}/internal/benchmark/catch_estimate.hpp
${HEADER_DIR}/internal/benchmark/catch_execution_plan.hpp
${HEADER_DIR}/internal/benchmark/catch_optimizer.hpp
${HEADER_DIR}/internal/benchmark/catch_outlier_classification.hpp
${HEADER_DIR}/internal/benchmark/catch_sample_analysis.hpp
${HEADER_DIR}/internal/benchmark/detail/catch_analyse.hpp
${HEADER_DIR}/internal/benchmark/detail/catch_benchmark_function.hpp
${HEADER_DIR}/internal/benchmark/detail/catch_complete_invoke.hpp
${HEADER_DIR}/internal/benchmark/detail/catch_estimate_clock.hpp
${HEADER_DIR}/internal/benchmark/detail/catch_measure.hpp
${HEADER_DIR}/internal/benchmark/detail/catch_repeat.hpp
${HEADER_DIR}/internal/benchmark/detail/catch_run_for_at_least.hpp
${HEADER_DIR}/internal/benchmark/detail/catch_stats.hpp
${HEADER_DIR}/internal/benchmark/detail/catch_timing.hpp
)
set(BENCHMARK_SOURCES
${HEADER_DIR}/internal/benchmark/detail/catch_stats.cpp
)
SOURCE_GROUP("benchmark" FILES ${BENCHMARK_HEADERS} ${BENCHMARK_SOURCES})
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_enum_values_registry.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_generators.hpp
${HEADER_DIR}/internal/catch_generators_generic.hpp
${HEADER_DIR}/internal/catch_generators_specific.hpp
${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_enum_values_registry.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_exception.hpp
${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_meta.hpp
${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_polyfills.hpp
${HEADER_DIR}/internal/catch_preprocessor.hpp
${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_section.h
${HEADER_DIR}/internal/catch_section_info.h
${HEADER_DIR}/internal/catch_session.h
${HEADER_DIR}/internal/catch_singletons.hpp
${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_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_enforce.cpp
${HEADER_DIR}/internal/catch_enum_values_registry.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_generators.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_generatortracker.h
${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_exception.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_polyfills.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_session.cpp
${HEADER_DIR}/internal/catch_singletons.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
${HEADER_DIR}/reporters/catch_reporter_sonarqube.hpp
)
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}
${BENCHMARK_HEADERS}
${BENCHMARK_SOURCES}
)
# 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})
# It took CMake until 3.8 to abandon the doomed approach of enumerating
# required features so we just list bunch of C++11 and C++14 features.
target_compile_features(SelfTest
PRIVATE
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
cxx_variable_templates
)
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 -Wmissing-declarations )
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 /w45038 )
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>)
set_tests_properties(RunTests PROPERTIES
FAIL_REGULAR_EXPRESSION "Filters:"
)
# Because CTest does not allow us to check both return code _and_ expected
# output in one test, we run these commands twice. First time we check
# the output, the second time we check the exit code.
add_test(NAME List::Tests::Output COMMAND $<TARGET_FILE:SelfTest> --list-tests --verbosity high)
set_tests_properties(List::Tests::Output PROPERTIES
PASS_REGULAR_EXPRESSION "[0-9]+ test cases"
FAIL_REGULAR_EXPRESSION "Hidden Test"
)
add_test(NAME List::Tests::ExitCode COMMAND $<TARGET_FILE:SelfTest> --list-tests --verbosity high)
add_test(NAME List::Tests::XmlOutput COMMAND $<TARGET_FILE:SelfTest> --list-tests --verbosity high -r xml)
set_tests_properties(List::Tests::XmlOutput PROPERTIES
PASS_REGULAR_EXPRESSION "<Line>[0-9]+</Line>"
FAIL_REGULAR_EXPRESSION "[0-9]+ test cases"
)
add_test(NAME List::Tags::Output COMMAND $<TARGET_FILE:SelfTest> --list-tags)
set_tests_properties(List::Tags::Output PROPERTIES
PASS_REGULAR_EXPRESSION "[0-9]+ tags"
FAIL_REGULAR_EXPRESSION "\\[\\.\\]")
add_test(NAME List::Tags::ExitCode COMMAND $<TARGET_FILE:SelfTest> --list-tags)
add_test(NAME List::Tags::XmlOutput COMMAND $<TARGET_FILE:SelfTest> --list-tags -r xml)
set_tests_properties(List::Tags::XmlOutput PROPERTIES
PASS_REGULAR_EXPRESSION "<Count>18</Count>"
FAIL_REGULAR_EXPRESSION "[0-9]+ tags"
)
add_test(NAME List::Reporters::Output COMMAND $<TARGET_FILE:SelfTest> --list-reporters)
set_tests_properties(List::Reporters::Output PROPERTIES PASS_REGULAR_EXPRESSION "Available reporters:")
add_test(NAME List::Reporters::ExitCode COMMAND $<TARGET_FILE:SelfTest> --list-reporters)
add_test(NAME List::Reporters::XmlOutput COMMAND $<TARGET_FILE:SelfTest> --list-reporters -r xml)
set_tests_properties(List::Reporters::XmlOutput PROPERTIES
PASS_REGULAR_EXPRESSION "<Name>compact</Name>"
FAIL_REGULAR_EXPRESSION "Available reporters:"
)
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> Tracker, "___nonexistent_test___")
set_tests_properties(NoTest PROPERTIES
PASS_REGULAR_EXPRESSION "No test cases matched '___nonexistent_test___'"
FAIL_REGULAR_EXPRESSION "No tests ran"
)
add_test(NAME WarnAboutNoTests COMMAND ${CMAKE_COMMAND} -P ${CATCH_DIR}/projects/SelfTest/WarnAboutNoTests.cmake $<TARGET_FILE:SelfTest>)
add_test(NAME UnmatchedOutputFilter COMMAND $<TARGET_FILE:SelfTest> [this-tag-does-not-exist] -w NoTests)
set_tests_properties(UnmatchedOutputFilter
PROPERTIES
PASS_REGULAR_EXPRESSION "No test cases matched '\\[this-tag-does-not-exist\\]'"
)
add_test(NAME FilteredSection-1 COMMAND $<TARGET_FILE:SelfTest> \#1394 -c RunSection)
set_tests_properties(FilteredSection-1 PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran")
add_test(NAME FilteredSection-2 COMMAND $<TARGET_FILE:SelfTest> \#1394\ nested -c NestedRunSection -c s1)
set_tests_properties(FilteredSection-2 PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran")
# AppVeyor has a Python 2.7 in path, but doesn't have .py files as autorunnable
add_test(NAME ApprovalTests COMMAND ${PYTHON_EXECUTABLE} ${CATCH_DIR}/scripts/approvalTests.py $<TARGET_FILE:SelfTest>)
set_tests_properties(ApprovalTests PROPERTIES FAIL_REGULAR_EXPRESSION "Results differed")
add_test(NAME RegressionCheck-1670 COMMAND $<TARGET_FILE:SelfTest> "#1670 regression check" -c A -r compact)
set_tests_properties(RegressionCheck-1670 PROPERTIES PASS_REGULAR_EXPRESSION "Passed 1 test case with 2 assertions.")
add_test(NAME VersionCheck COMMAND $<TARGET_FILE:SelfTest> -h)
set_tests_properties(VersionCheck PROPERTIES PASS_REGULAR_EXPRESSION "Catch v${PROJECT_VERSION}")
add_test(NAME LibIdentityTest COMMAND $<TARGET_FILE:SelfTest> --libidentify)
set_tests_properties(LibIdentityTest PROPERTIES PASS_REGULAR_EXPRESSION "description: A Catch2 test executable")
add_test(NAME FilenameAsTagsTest COMMAND $<TARGET_FILE:SelfTest> -\# --list-tags)
set_tests_properties(FilenameAsTagsTest PROPERTIES PASS_REGULAR_EXPRESSION "\\[#Approx.tests\\]")
add_test(NAME EscapeSpecialCharactersInTestNames COMMAND $<TARGET_FILE:SelfTest> "Test with special\\, characters \"in name")
set_tests_properties(EscapeSpecialCharactersInTestNames PROPERTIES PASS_REGULAR_EXPRESSION "1 assertion in 1 test case")
add_test(NAME NegativeSpecNoHiddenTests COMMAND $<TARGET_FILE:SelfTest> --list-tests ~[approval])
set_tests_properties(NegativeSpecNoHiddenTests PROPERTIES FAIL_REGULAR_EXPRESSION "\\[\\.\\]")
add_test(NAME TestsInFile::SimpleSpecs COMMAND $<TARGET_FILE:SelfTest> "-f ${CATCH_DIR}/projects/SelfTest/Misc/plain-old-tests.input")
set_tests_properties(TestsInFile::SimpleSpecs PROPERTIES PASS_REGULAR_EXPRESSION "6 assertions in 2 test cases")
add_test(NAME TestsInFile::EscapeSpecialCharacters COMMAND $<TARGET_FILE:SelfTest> "-f ${CATCH_DIR}/projects/SelfTest/Misc/special-characters-in-file.input")
set_tests_properties(TestsInFile::EscapeSpecialCharacters PROPERTIES PASS_REGULAR_EXPRESSION "1 assertion in 1 test case")
# CTest does not allow us to create an AND of required regular expressions,
# so we have to split the test into 2 parts and look for parts of the expected
# output separately.
add_test(NAME TestsInFile::InvalidTestNames-1 COMMAND $<TARGET_FILE:SelfTest> "-f ${CATCH_DIR}/projects/SelfTest/Misc/invalid-test-names.input")
set_tests_properties(TestsInFile::InvalidTestNames-1 PROPERTIES PASS_REGULAR_EXPRESSION "Invalid Filter: \"Test with special, characters in \\\\\" name\"")
add_test(NAME TestsInFile::InvalidTestNames-2 COMMAND $<TARGET_FILE:SelfTest> "-f ${CATCH_DIR}/projects/SelfTest/Misc/invalid-test-names.input")
set_tests_properties(TestsInFile::InvalidTestNames-2 PROPERTIES PASS_REGULAR_EXPRESSION "No tests ran")
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()

View File

@ -1,3 +0,0 @@
// This file is only here to verify (to the extent possible) the self sufficiency of the header
#include "internal/catch_suppress_warnings.h"
#include "internal/catch_console_colour.h"

View File

@ -1,2 +0,0 @@
#include "internal/catch_suppress_warnings.h"
#include "internal/catch_interfaces_reporter.h"

View File

@ -1,3 +0,0 @@
// This file is only here to verify (to the extent possible) the self sufficiency of the header
#include "internal/catch_suppress_warnings.h"
#include "internal/catch_test_spec.h"

View File

@ -1,4 +0,0 @@
// This file is only here to verify (to the extent possible) the self sufficiency of the header
#include "internal/catch_suppress_warnings.h"
#include "internal/catch_xmlwriter.h"
#include "internal/catch_reenable_warnings.h"

249
src/CMakeLists.txt Normal file
View File

@ -0,0 +1,249 @@
include(MiscFunctions)
# Please keep these ordered alphabetically
set(BENCHMARK_HEADERS
${SOURCES_DIR}/benchmark/catch_benchmark.hpp
${SOURCES_DIR}/benchmark/catch_chronometer.hpp
${SOURCES_DIR}/benchmark/catch_clock.hpp
${SOURCES_DIR}/benchmark/catch_constructor.hpp
${SOURCES_DIR}/benchmark/catch_environment.hpp
${SOURCES_DIR}/benchmark/catch_estimate.hpp
${SOURCES_DIR}/benchmark/catch_execution_plan.hpp
${SOURCES_DIR}/benchmark/catch_optimizer.hpp
${SOURCES_DIR}/benchmark/catch_outlier_classification.hpp
${SOURCES_DIR}/benchmark/catch_sample_analysis.hpp
${SOURCES_DIR}/benchmark/detail/catch_analyse.hpp
${SOURCES_DIR}/benchmark/detail/catch_benchmark_function.hpp
${SOURCES_DIR}/benchmark/detail/catch_complete_invoke.hpp
${SOURCES_DIR}/benchmark/detail/catch_estimate_clock.hpp
${SOURCES_DIR}/benchmark/detail/catch_measure.hpp
${SOURCES_DIR}/benchmark/detail/catch_repeat.hpp
${SOURCES_DIR}/benchmark/detail/catch_run_for_at_least.hpp
${SOURCES_DIR}/benchmark/detail/catch_stats.hpp
${SOURCES_DIR}/benchmark/detail/catch_timing.hpp
)
set(BENCHMARK_SOURCES
${SOURCES_DIR}/benchmark/detail/catch_stats.cpp
)
SOURCE_GROUP("benchmark" FILES ${BENCHMARK_HEADERS} ${BENCHMARK_SOURCES})
set(INTERNAL_HEADERS
${SOURCES_DIR}/catch_approx.h
${SOURCES_DIR}/catch_assertionhandler.h
${SOURCES_DIR}/catch_assertioninfo.h
${SOURCES_DIR}/catch_assertionresult.h
${SOURCES_DIR}/catch_capture.hpp
${SOURCES_DIR}/catch_capture_matchers.h
${SOURCES_DIR}/catch_clara.h
${SOURCES_DIR}/catch_commandline.h
${SOURCES_DIR}/catch_common.h
${SOURCES_DIR}/catch_compiler_capabilities.h
${SOURCES_DIR}/catch_config.hpp
${SOURCES_DIR}/catch_console_colour.h
${SOURCES_DIR}/catch_context.h
${SOURCES_DIR}/catch_debug_console.h
${SOURCES_DIR}/catch_debugger.h
${SOURCES_DIR}/catch_decomposer.h
${SOURCES_DIR}/catch_default_main.hpp
${SOURCES_DIR}/catch_enforce.h
${SOURCES_DIR}/catch_enum_values_registry.h
${SOURCES_DIR}/catch_errno_guard.h
${SOURCES_DIR}/catch_exception_translator_registry.h
${SOURCES_DIR}/catch_external_interfaces.h
${SOURCES_DIR}/catch_fatal_condition.h
${SOURCES_DIR}/catch_generators.hpp
${SOURCES_DIR}/catch_generators_generic.hpp
${SOURCES_DIR}/catch_generators_specific.hpp
${SOURCES_DIR}/catch_impl.hpp
${SOURCES_DIR}/catch_interfaces_capture.h
${SOURCES_DIR}/catch_interfaces_config.h
${SOURCES_DIR}/catch_interfaces_enum_values_registry.h
${SOURCES_DIR}/catch_interfaces_exception.h
${SOURCES_DIR}/catch_interfaces_registry_hub.h
${SOURCES_DIR}/catch_interfaces_reporter.h
${SOURCES_DIR}/catch_interfaces_runner.h
${SOURCES_DIR}/catch_interfaces_tag_alias_registry.h
${SOURCES_DIR}/catch_interfaces_testcase.h
${SOURCES_DIR}/catch_leak_detector.h
${SOURCES_DIR}/catch_list.h
${SOURCES_DIR}/catch_matchers.h
${SOURCES_DIR}/catch_matchers_exception.hpp
${SOURCES_DIR}/catch_matchers_floating.h
${SOURCES_DIR}/catch_matchers_generic.hpp
${SOURCES_DIR}/catch_matchers_string.h
${SOURCES_DIR}/catch_matchers_vector.h
${SOURCES_DIR}/catch_message.h
${SOURCES_DIR}/catch_meta.hpp
${SOURCES_DIR}/catch_objc.hpp
${SOURCES_DIR}/catch_objc_arc.hpp
${SOURCES_DIR}/catch_option.hpp
${SOURCES_DIR}/catch_output_redirect.h
${SOURCES_DIR}/catch_platform.h
${SOURCES_DIR}/catch_polyfills.hpp
${SOURCES_DIR}/catch_preprocessor.hpp
${SOURCES_DIR}/catch_random_number_generator.h
${SOURCES_DIR}/catch_reenable_warnings.h
${SOURCES_DIR}/catch_reporter_registrars.hpp
${SOURCES_DIR}/catch_reporter_registry.h
${SOURCES_DIR}/catch_result_type.h
${SOURCES_DIR}/catch_run_context.h
${SOURCES_DIR}/catch_section.h
${SOURCES_DIR}/catch_section_info.h
${SOURCES_DIR}/catch_session.h
${SOURCES_DIR}/catch_singletons.hpp
${SOURCES_DIR}/catch_startup_exception_registry.h
${SOURCES_DIR}/catch_stream.h
${SOURCES_DIR}/catch_stringref.h
${SOURCES_DIR}/catch_string_manip.h
${SOURCES_DIR}/catch_suppress_warnings.h
${SOURCES_DIR}/catch_tag_alias.h
${SOURCES_DIR}/catch_tag_alias_autoregistrar.h
${SOURCES_DIR}/catch_tag_alias_registry.h
${SOURCES_DIR}/catch_test_case_info.h
${SOURCES_DIR}/catch_test_case_registry_impl.h
${SOURCES_DIR}/catch_test_case_tracker.h
${SOURCES_DIR}/catch_test_registry.h
${SOURCES_DIR}/catch_test_spec.h
${SOURCES_DIR}/catch_test_spec_parser.h
${SOURCES_DIR}/catch_text.h
${SOURCES_DIR}/catch_timer.h
${SOURCES_DIR}/catch_to_string.hpp
${SOURCES_DIR}/catch_tostring.h
${SOURCES_DIR}/catch_totals.h
${SOURCES_DIR}/catch_uncaught_exceptions.h
${SOURCES_DIR}/catch_user_interfaces.h
${SOURCES_DIR}/catch_version.h
${SOURCES_DIR}/catch_wildcard_pattern.h
${SOURCES_DIR}/catch_windows_h_proxy.h
${SOURCES_DIR}/catch_xmlwriter.h
)
set(IMPL_SOURCES
${SOURCES_DIR}/catch_approx.cpp
${SOURCES_DIR}/catch_assertionhandler.cpp
${SOURCES_DIR}/catch_assertionresult.cpp
${SOURCES_DIR}/catch_capture_matchers.cpp
${SOURCES_DIR}/catch_commandline.cpp
${SOURCES_DIR}/catch_common.cpp
${SOURCES_DIR}/catch_config.cpp
${SOURCES_DIR}/catch_console_colour.cpp
${SOURCES_DIR}/catch_context.cpp
${SOURCES_DIR}/catch_debug_console.cpp
${SOURCES_DIR}/catch_debugger.cpp
${SOURCES_DIR}/catch_decomposer.cpp
${SOURCES_DIR}/catch_enforce.cpp
${SOURCES_DIR}/catch_enum_values_registry.cpp
${SOURCES_DIR}/catch_errno_guard.cpp
${SOURCES_DIR}/catch_exception_translator_registry.cpp
${SOURCES_DIR}/catch_fatal_condition.cpp
${SOURCES_DIR}/catch_generators.cpp
${SOURCES_DIR}/catch_interfaces_capture.cpp
${SOURCES_DIR}/catch_interfaces_config.cpp
${SOURCES_DIR}/catch_interfaces_exception.cpp
${SOURCES_DIR}/catch_interfaces_generatortracker.h
${SOURCES_DIR}/catch_interfaces_registry_hub.cpp
${SOURCES_DIR}/catch_interfaces_runner.cpp
${SOURCES_DIR}/catch_interfaces_testcase.cpp
${SOURCES_DIR}/catch_list.cpp
${SOURCES_DIR}/catch_leak_detector.cpp
${SOURCES_DIR}/catch_matchers.cpp
${SOURCES_DIR}/catch_matchers_exception.cpp
${SOURCES_DIR}/catch_matchers_floating.cpp
${SOURCES_DIR}/catch_matchers_generic.cpp
${SOURCES_DIR}/catch_matchers_string.cpp
${SOURCES_DIR}/catch_message.cpp
${SOURCES_DIR}/catch_output_redirect.cpp
${SOURCES_DIR}/catch_registry_hub.cpp
${SOURCES_DIR}/catch_interfaces_reporter.cpp
${SOURCES_DIR}/catch_polyfills.cpp
${SOURCES_DIR}/catch_random_number_generator.cpp
${SOURCES_DIR}/catch_reporter_registry.cpp
${SOURCES_DIR}/catch_result_type.cpp
${SOURCES_DIR}/catch_run_context.cpp
${SOURCES_DIR}/catch_section.cpp
${SOURCES_DIR}/catch_session.cpp
${SOURCES_DIR}/catch_singletons.cpp
${SOURCES_DIR}/catch_startup_exception_registry.cpp
${SOURCES_DIR}/catch_stream.cpp
${SOURCES_DIR}/catch_stringref.cpp
${SOURCES_DIR}/catch_string_manip.cpp
${SOURCES_DIR}/catch_tag_alias.cpp
${SOURCES_DIR}/catch_tag_alias_autoregistrar.cpp
${SOURCES_DIR}/catch_tag_alias_registry.cpp
${SOURCES_DIR}/catch_test_case_info.cpp
${SOURCES_DIR}/catch_test_case_registry_impl.cpp
${SOURCES_DIR}/catch_test_case_tracker.cpp
${SOURCES_DIR}/catch_test_registry.cpp
${SOURCES_DIR}/catch_test_spec.cpp
${SOURCES_DIR}/catch_test_spec_parser.cpp
${SOURCES_DIR}/catch_timer.cpp
${SOURCES_DIR}/catch_tostring.cpp
${SOURCES_DIR}/catch_totals.cpp
${SOURCES_DIR}/catch_uncaught_exceptions.cpp
${SOURCES_DIR}/catch_version.cpp
${SOURCES_DIR}/catch_wildcard_pattern.cpp
${SOURCES_DIR}/catch_xmlwriter.cpp
)
set(INTERNAL_FILES ${IMPL_SOURCES} ${INTERNAL_HEADERS})
CheckFileList(INTERNAL_FILES ${SOURCES_DIR}/internal)
# Please keep these ordered alphabetically
set(REPORTER_HEADERS
${SOURCES_DIR}/reporters/catch_reporter_automake.hpp
${SOURCES_DIR}/reporters/catch_reporter_bases.hpp
${SOURCES_DIR}/reporters/catch_reporter_compact.h
${SOURCES_DIR}/reporters/catch_reporter_console.h
${SOURCES_DIR}/reporters/catch_reporter_junit.h
${SOURCES_DIR}/reporters/catch_reporter_listening.h
${SOURCES_DIR}/reporters/catch_reporter_sonarqube.hpp
${SOURCES_DIR}/reporters/catch_reporter_tap.hpp
${SOURCES_DIR}/reporters/catch_reporter_teamcity.hpp
${SOURCES_DIR}/reporters/catch_reporter_xml.h
)
set(REPORTER_SOURCES
${SOURCES_DIR}/reporters/catch_reporter_automake.cpp
${SOURCES_DIR}/reporters/catch_reporter_bases.cpp
${SOURCES_DIR}/reporters/catch_reporter_compact.cpp
${SOURCES_DIR}/reporters/catch_reporter_console.cpp
${SOURCES_DIR}/reporters/catch_reporter_junit.cpp
${SOURCES_DIR}/reporters/catch_reporter_listening.cpp
${SOURCES_DIR}/reporters/catch_reporter_sonarqube.cpp
${SOURCES_DIR}/reporters/catch_reporter_tap.cpp
${SOURCES_DIR}/reporters/catch_reporter_teamcity.cpp
${SOURCES_DIR}/reporters/catch_reporter_xml.cpp
)
set(REPORTER_FILES ${REPORTER_HEADERS} ${REPORTER_SOURCES})
CheckFileList(REPORTER_FILES ${SOURCES_DIR}/reporters)
# Fixme: STATIC because for dynamic, we would need to handle visibility
# and I don't want to do the annotations right now
add_library(Catch2 STATIC
${REPORTER_FILES}
${INTERNAL_FILES}
${BENCHMARK_HEADERS}
${BENCHMARK_SOURCES}
)
target_include_directories(Catch2
PUBLIC
$<BUILD_INTERFACE:${SOURCES_DIR}/..>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
# Some tests require a full recompilation of Catch2 lib with different
# compilation flags. They can link against this target to recompile all
# the sources into the binary.
if (CATCH_BUILD_EXAMPLES OR CATCH_BUILD_EXTRA_TESTS)
add_library(Catch2_buildall_interface INTERFACE)
target_sources(Catch2_buildall_interface INTERFACE
${REPORTER_FILES}
${INTERNAL_FILES}
${BENCHMARK_HEADERS}
${BENCHMARK_SOURCES}
)
target_include_directories(Catch2_buildall_interface
INTERFACE
$<BUILD_INTERFACE:${SOURCES_DIR}/..>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
endif()

View File

@ -10,20 +10,20 @@
#ifndef TWOBLUECUBES_CATCH_BENCHMARK_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_BENCHMARK_HPP_INCLUDED
#include "../catch_config.hpp"
#include "../catch_context.h"
#include "../catch_interfaces_reporter.h"
#include "../catch_test_registry.h"
#include <catch2/catch_config.hpp>
#include <catch2/catch_context.h>
#include <catch2/catch_interfaces_reporter.h>
#include <catch2/catch_test_registry.h>
#include "catch_chronometer.hpp"
#include "catch_clock.hpp"
#include "catch_environment.hpp"
#include "catch_execution_plan.hpp"
#include "detail/catch_estimate_clock.hpp"
#include "detail/catch_complete_invoke.hpp"
#include "detail/catch_analyse.hpp"
#include "detail/catch_benchmark_function.hpp"
#include "detail/catch_run_for_at_least.hpp"
#include <catch2/benchmark/catch_chronometer.hpp>
#include <catch2/benchmark/catch_clock.hpp>
#include <catch2/benchmark/catch_environment.hpp>
#include <catch2/benchmark/catch_execution_plan.hpp>
#include <catch2/benchmark/detail/catch_estimate_clock.hpp>
#include <catch2/benchmark/detail/catch_complete_invoke.hpp>
#include <catch2/benchmark/detail/catch_analyse.hpp>
#include <catch2/benchmark/detail/catch_benchmark_function.hpp>
#include <catch2/benchmark/detail/catch_run_for_at_least.hpp>
#include <algorithm>
#include <functional>

View File

@ -11,10 +11,10 @@
#ifndef TWOBLUECUBES_CATCH_CHRONOMETER_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_CHRONOMETER_HPP_INCLUDED
#include "catch_clock.hpp"
#include "catch_optimizer.hpp"
#include "detail/catch_complete_invoke.hpp"
#include "../catch_meta.hpp"
#include <catch2/benchmark/catch_clock.hpp>
#include <catch2/benchmark/catch_optimizer.hpp>
#include <catch2/benchmark/detail/catch_complete_invoke.hpp>
#include <catch2/catch_meta.hpp>
namespace Catch {
namespace Benchmark {

View File

@ -11,8 +11,8 @@
#ifndef TWOBLUECUBES_CATCH_ENVIRONMENT_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_ENVIRONMENT_HPP_INCLUDED
#include "catch_clock.hpp"
#include "catch_outlier_classification.hpp"
#include <catch2/benchmark/catch_clock.hpp>
#include <catch2/benchmark/catch_outlier_classification.hpp>
namespace Catch {
namespace Benchmark {

View File

@ -11,12 +11,12 @@
#ifndef TWOBLUECUBES_CATCH_EXECUTION_PLAN_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_EXECUTION_PLAN_HPP_INCLUDED
#include "../catch_config.hpp"
#include "catch_clock.hpp"
#include "catch_environment.hpp"
#include "detail/catch_benchmark_function.hpp"
#include "detail/catch_repeat.hpp"
#include "detail/catch_run_for_at_least.hpp"
#include <catch2/catch_config.hpp>
#include <catch2/benchmark/catch_clock.hpp>
#include <catch2/benchmark/catch_environment.hpp>
#include <catch2/benchmark/detail/catch_benchmark_function.hpp>
#include <catch2/benchmark/detail/catch_repeat.hpp>
#include <catch2/benchmark/detail/catch_run_for_at_least.hpp>
#include <algorithm>

View File

@ -11,9 +11,9 @@
#ifndef TWOBLUECUBES_CATCH_BENCHMARK_RESULTS_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_BENCHMARK_RESULTS_HPP_INCLUDED
#include "catch_clock.hpp"
#include "catch_estimate.hpp"
#include "catch_outlier_classification.hpp"
#include <catch2/benchmark/catch_clock.hpp>
#include <catch2/benchmark/catch_estimate.hpp>
#include <catch2/benchmark/catch_outlier_classification.hpp>
#include <algorithm>
#include <vector>

View File

@ -11,9 +11,9 @@
#ifndef TWOBLUECUBES_CATCH_DETAIL_ANALYSE_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_DETAIL_ANALYSE_HPP_INCLUDED
#include "../catch_clock.hpp"
#include "../catch_sample_analysis.hpp"
#include "catch_stats.hpp"
#include <catch2/benchmark/catch_clock.hpp>
#include <catch2/benchmark/catch_sample_analysis.hpp>
#include <catch2/benchmark/detail/catch_stats.hpp>
#include <algorithm>
#include <iterator>

View File

@ -11,9 +11,9 @@
#ifndef TWOBLUECUBES_CATCH_DETAIL_BENCHMARK_FUNCTION_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_DETAIL_BENCHMARK_FUNCTION_HPP_INCLUDED
#include "../catch_chronometer.hpp"
#include "catch_complete_invoke.hpp"
#include "../../catch_meta.hpp"
#include <catch2/benchmark/catch_chronometer.hpp>
#include <catch2/benchmark/detail/catch_complete_invoke.hpp>
#include <catch2/catch_meta.hpp>
#include <cassert>
#include <type_traits>

View File

@ -11,7 +11,7 @@
#ifndef TWOBLUECUBES_CATCH_DETAIL_COMPLETE_INVOKE_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_DETAIL_COMPLETE_INVOKE_HPP_INCLUDED
#include "../../catch_enforce.h"
#include <catch2/catch_enforce.h>
#include <type_traits>
#include <utility>

View File

@ -11,12 +11,12 @@
#ifndef TWOBLUECUBES_CATCH_DETAIL_ESTIMATE_CLOCK_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_DETAIL_ESTIMATE_CLOCK_HPP_INCLUDED
#include "../catch_clock.hpp"
#include "../catch_environment.hpp"
#include "catch_stats.hpp"
#include "catch_measure.hpp"
#include "catch_run_for_at_least.hpp"
#include "../catch_clock.hpp"
#include <catch2/benchmark/catch_clock.hpp>
#include <catch2/benchmark/catch_environment.hpp>
#include <catch2/benchmark/detail/catch_stats.hpp>
#include <catch2/benchmark/detail/catch_measure.hpp>
#include <catch2/benchmark/detail/catch_run_for_at_least.hpp>
#include <catch2/benchmark/catch_clock.hpp>
#include <algorithm>
#include <iterator>

View File

@ -11,9 +11,9 @@
#ifndef TWOBLUECUBES_CATCH_DETAIL_MEASURE_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_DETAIL_MEASURE_HPP_INCLUDED
#include "../catch_clock.hpp"
#include "catch_complete_invoke.hpp"
#include "catch_timing.hpp"
#include <catch2/benchmark/catch_clock.hpp>
#include <catch2/benchmark/detail/catch_complete_invoke.hpp>
#include <catch2/benchmark/detail/catch_timing.hpp>
#include <utility>

View File

@ -11,12 +11,12 @@
#ifndef TWOBLUECUBES_CATCH_RUN_FOR_AT_LEAST_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_RUN_FOR_AT_LEAST_HPP_INCLUDED
#include "../catch_clock.hpp"
#include "../catch_chronometer.hpp"
#include "catch_measure.hpp"
#include "catch_complete_invoke.hpp"
#include "catch_timing.hpp"
#include "../../catch_meta.hpp"
#include <catch2/benchmark/catch_clock.hpp>
#include <catch2/benchmark/catch_chronometer.hpp>
#include <catch2/benchmark/detail/catch_measure.hpp>
#include <catch2/benchmark/detail/catch_complete_invoke.hpp>
#include <catch2/benchmark/detail/catch_timing.hpp>
#include <catch2/catch_meta.hpp>
#include <utility>
#include <type_traits>

View File

@ -10,9 +10,9 @@
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
#include "catch_stats.hpp"
#include <catch2/benchmark/detail/catch_stats.hpp>
#include "../../catch_compiler_capabilities.h"
#include <catch2/catch_compiler_capabilities.h>
#include <cassert>
#include <random>

View File

@ -11,9 +11,9 @@
#ifndef TWOBLUECUBES_CATCH_DETAIL_ANALYSIS_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_DETAIL_ANALYSIS_HPP_INCLUDED
#include "../catch_clock.hpp"
#include "../catch_estimate.hpp"
#include "../catch_outlier_classification.hpp"
#include <catch2/benchmark/catch_clock.hpp>
#include <catch2/benchmark/catch_estimate.hpp>
#include <catch2/benchmark/catch_outlier_classification.hpp>
#include <algorithm>
#include <functional>

View File

@ -11,8 +11,8 @@
#ifndef TWOBLUECUBES_CATCH_DETAIL_TIMING_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_DETAIL_TIMING_HPP_INCLUDED
#include "../catch_clock.hpp"
#include "catch_complete_invoke.hpp"
#include <catch2/benchmark/catch_clock.hpp>
#include <catch2/benchmark/detail/catch_complete_invoke.hpp>
#include <tuple>
#include <type_traits>

View File

@ -19,81 +19,45 @@
# pragma GCC system_header
#endif
#include "internal/catch_suppress_warnings.h"
#if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER)
# define CATCH_IMPL
# define CATCH_CONFIG_ALL_PARTS
#endif
// In the impl file, we want to have access to all parts of the headers
// Can also be used to sanely support PCHs
#if defined(CATCH_CONFIG_ALL_PARTS)
# define CATCH_CONFIG_EXTERNAL_INTERFACES
# if defined(CATCH_CONFIG_DISABLE_MATCHERS)
# undef CATCH_CONFIG_DISABLE_MATCHERS
# endif
# if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER)
# define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
# endif
#endif
#include <catch2/catch_suppress_warnings.h>
#if !defined(CATCH_CONFIG_IMPL_ONLY)
#include "internal/catch_platform.h"
#include <catch2/catch_platform.h>
#ifdef CATCH_IMPL
# ifndef CLARA_CONFIG_MAIN
# define CLARA_CONFIG_MAIN_NOT_DEFINED
# define CLARA_CONFIG_MAIN
# endif
#endif
#include "internal/catch_user_interfaces.h"
#include "internal/catch_tag_alias_autoregistrar.h"
#include "internal/catch_test_registry.h"
#include "internal/catch_capture.hpp"
#include "internal/catch_section.h"
#include "internal/catch_interfaces_exception.h"
#include "internal/catch_approx.h"
#include "internal/catch_compiler_capabilities.h"
#include "internal/catch_string_manip.h"
#include <catch2/catch_user_interfaces.h>
#include <catch2/catch_tag_alias_autoregistrar.h>
#include <catch2/catch_test_registry.h>
#include <catch2/catch_capture.hpp>
#include <catch2/catch_section.h>
#include <catch2/catch_interfaces_exception.h>
#include <catch2/catch_approx.h>
#include <catch2/catch_compiler_capabilities.h>
#include <catch2/catch_string_manip.h>
#ifndef CATCH_CONFIG_DISABLE_MATCHERS
#include "internal/catch_capture_matchers.h"
#include <catch2/catch_capture_matchers.h>
#endif
#include "internal/catch_generators.hpp"
#include "internal/catch_generators_generic.hpp"
#include "internal/catch_generators_specific.hpp"
#include <catch2/catch_generators.hpp>
#include <catch2/catch_generators_generic.hpp>
#include <catch2/catch_generators_specific.hpp>
// These files are included here so the single_include script doesn't put them
// in the conditionally compiled sections
#include "internal/catch_test_case_info.h"
#include "internal/catch_interfaces_runner.h"
#include <catch2/catch_test_case_info.h>
#include <catch2/catch_interfaces_runner.h>
#ifdef __OBJC__
#include "internal/catch_objc.hpp"
#include <catch2/catch_objc.hpp>
#endif
// Benchmarking needs the externally-facing parts of reporters to work
#if defined(CATCH_CONFIG_EXTERNAL_INTERFACES) || defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
#include "internal/catch_external_interfaces.h"
#endif
#include <catch2/catch_external_interfaces.h>
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
#include "internal/benchmark/catch_benchmark.hpp"
#include <catch2/benchmark/catch_benchmark.hpp>
#endif
#endif // ! CATCH_CONFIG_IMPL_ONLY
#ifdef CATCH_IMPL
#include "internal/catch_impl.hpp"
#endif
#ifdef CATCH_CONFIG_MAIN
#include "internal/catch_default_main.hpp"
#endif
#if !defined(CATCH_CONFIG_IMPL_ONLY)
#ifdef CLARA_CONFIG_MAIN_NOT_DEFINED
@ -485,6 +449,6 @@ using Catch::Detail::Approx;
#endif // ! CATCH_CONFIG_IMPL_ONLY
#include "internal/catch_reenable_warnings.h"
#include <catch2/catch_reenable_warnings.h>
#endif // TWOBLUECUBES_CATCH_HPP_INCLUDED

View File

@ -6,8 +6,8 @@
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include "catch_approx.h"
#include "catch_enforce.h"
#include <catch2/catch_approx.h>
#include <catch2/catch_enforce.h>
#include <cmath>
#include <limits>

View File

@ -8,7 +8,7 @@
#ifndef TWOBLUECUBES_CATCH_APPROX_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_APPROX_HPP_INCLUDED
#include "catch_tostring.h"
#include <catch2/catch_tostring.h>
#include <type_traits>

View File

@ -6,15 +6,16 @@
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include "catch_assertionhandler.h"
#include "catch_assertionresult.h"
#include "catch_interfaces_runner.h"
#include "catch_interfaces_config.h"
#include "catch_context.h"
#include "catch_debugger.h"
#include "catch_interfaces_registry_hub.h"
#include "catch_capture_matchers.h"
#include "catch_run_context.h"
#include <catch2/catch_assertionhandler.h>
#include <catch2/catch_assertionresult.h>
#include <catch2/catch_interfaces_runner.h>
#include <catch2/catch_interfaces_config.h>
#include <catch2/catch_context.h>
#include <catch2/catch_enforce.h>
#include <catch2/catch_debugger.h>
#include <catch2/catch_interfaces_registry_hub.h>
#include <catch2/catch_capture_matchers.h>
#include <catch2/catch_run_context.h>
namespace Catch {

View File

@ -8,9 +8,9 @@
#ifndef TWOBLUECUBES_CATCH_ASSERTIONHANDLER_H_INCLUDED
#define TWOBLUECUBES_CATCH_ASSERTIONHANDLER_H_INCLUDED
#include "catch_assertioninfo.h"
#include "catch_decomposer.h"
#include "catch_interfaces_capture.h"
#include <catch2/catch_assertioninfo.h>
#include <catch2/catch_decomposer.h>
#include <catch2/catch_interfaces_capture.h>
namespace Catch {

View File

@ -8,9 +8,9 @@
#ifndef TWOBLUECUBES_CATCH_ASSERTIONINFO_H_INCLUDED
#define TWOBLUECUBES_CATCH_ASSERTIONINFO_H_INCLUDED
#include "catch_result_type.h"
#include "catch_common.h"
#include "catch_stringref.h"
#include <catch2/catch_result_type.h>
#include <catch2/catch_common.h>
#include <catch2/catch_stringref.h>
namespace Catch {

View File

@ -6,7 +6,7 @@
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include "catch_assertionresult.h"
#include <catch2/catch_assertionresult.h>
namespace Catch {
AssertionResultData::AssertionResultData(ResultWas::OfType _resultType, LazyExpression const & _lazyExpression):

View File

@ -9,11 +9,11 @@
#define TWOBLUECUBES_CATCH_ASSERTIONRESULT_H_INCLUDED
#include <string>
#include "catch_assertioninfo.h"
#include "catch_result_type.h"
#include "catch_common.h"
#include "catch_stringref.h"
#include "catch_assertionhandler.h"
#include <catch2/catch_assertioninfo.h>
#include <catch2/catch_result_type.h>
#include <catch2/catch_common.h>
#include <catch2/catch_stringref.h>
#include <catch2/catch_assertionhandler.h>
namespace Catch {

View File

@ -8,10 +8,10 @@
#ifndef TWOBLUECUBES_CATCH_CAPTURE_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_CAPTURE_HPP_INCLUDED
#include "catch_assertionhandler.h"
#include "catch_interfaces_capture.h"
#include "catch_message.h"
#include "catch_stringref.h"
#include <catch2/catch_assertionhandler.h>
#include <catch2/catch_interfaces_capture.h>
#include <catch2/catch_message.h>
#include <catch2/catch_stringref.h>
#if !defined(CATCH_CONFIG_DISABLE)

View File

@ -5,8 +5,8 @@
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include "catch_capture_matchers.h"
#include "catch_interfaces_registry_hub.h"
#include <catch2/catch_capture_matchers.h>
#include <catch2/catch_interfaces_registry_hub.h>
namespace Catch {

View File

@ -8,14 +8,14 @@
#ifndef TWOBLUECUBES_CATCH_CAPTURE_MATCHERS_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_CAPTURE_MATCHERS_HPP_INCLUDED
#include "catch_capture.hpp"
#include "catch_matchers.h"
#include "catch_matchers_exception.hpp"
#include "catch_matchers_floating.h"
#include "catch_matchers_generic.hpp"
#include "catch_matchers_string.h"
#include "catch_matchers_vector.h"
#include "catch_stringref.h"
#include <catch2/catch_capture.hpp>
#include <catch2/catch_matchers.h>
#include <catch2/catch_matchers_exception.hpp>
#include <catch2/catch_matchers_floating.h>
#include <catch2/catch_matchers_generic.hpp>
#include <catch2/catch_matchers_string.h>
#include <catch2/catch_matchers_vector.h>
#include <catch2/catch_stringref.h>
namespace Catch {

View File

@ -23,7 +23,7 @@
#pragma clang diagnostic ignored "-Wshadow"
#endif
#include "../external/clara.hpp"
#include <catch2/external/clara.hpp>
#ifdef __clang__
#pragma clang diagnostic pop

View File

@ -6,12 +6,12 @@
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include "catch_commandline.h"
#include <catch2/catch_commandline.h>
#include "catch_string_manip.h"
#include <catch2/catch_string_manip.h>
#include "catch_interfaces_registry_hub.h"
#include "catch_interfaces_reporter.h"
#include <catch2/catch_interfaces_registry_hub.h>
#include <catch2/catch_interfaces_reporter.h>
#include <fstream>
#include <ctime>

View File

@ -8,8 +8,8 @@
#ifndef TWOBLUECUBES_CATCH_COMMANDLINE_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_COMMANDLINE_HPP_INCLUDED
#include "catch_config.hpp"
#include "catch_clara.h"
#include <catch2/catch_config.hpp>
#include <catch2/catch_clara.h>
namespace Catch {

View File

@ -6,9 +6,9 @@
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include "catch_common.h"
#include "catch_context.h"
#include "catch_interfaces_config.h"
#include <catch2/catch_common.h>
#include <catch2/catch_context.h>
#include <catch2/catch_interfaces_config.h>
#include <cstring>
#include <ostream>

View File

@ -8,7 +8,7 @@
#ifndef TWOBLUECUBES_CATCH_COMMON_H_INCLUDED
#define TWOBLUECUBES_CATCH_COMMON_H_INCLUDED
#include "catch_compiler_capabilities.h"
#include <catch2/catch_compiler_capabilities.h>
#define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line
#define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line )

View File

@ -25,7 +25,7 @@
// Many features, at point of detection, define an _INTERNAL_ macro, so they
// can be combined, en-mass, with the _NO_ forms later.
#include "catch_platform.h"
#include <catch2/catch_platform.h>
#ifdef __cplusplus

View File

@ -5,9 +5,9 @@
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include "catch_config.hpp"
#include "catch_enforce.h"
#include "catch_stringref.h"
#include <catch2/catch_config.hpp>
#include <catch2/catch_enforce.h>
#include <catch2/catch_stringref.h>
namespace Catch {

View File

@ -8,11 +8,11 @@
#ifndef TWOBLUECUBES_CATCH_CONFIG_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_CONFIG_HPP_INCLUDED
#include "catch_test_spec_parser.h"
#include "catch_interfaces_config.h"
#include <catch2/catch_test_spec_parser.h>
#include <catch2/catch_interfaces_config.h>
// Libstdc++ doesn't like incomplete classes for unique_ptr
#include "catch_stream.h"
#include <catch2/catch_stream.h>
#include <memory>
#include <vector>

View File

@ -13,15 +13,15 @@
#endif
#include "catch_console_colour.h"
#include "catch_enforce.h"
#include "catch_errno_guard.h"
#include "catch_interfaces_config.h"
#include "catch_stream.h"
#include "catch_context.h"
#include "catch_platform.h"
#include "catch_debugger.h"
#include "catch_windows_h_proxy.h"
#include <catch2/catch_console_colour.h>
#include <catch2/catch_enforce.h>
#include <catch2/catch_errno_guard.h>
#include <catch2/catch_interfaces_config.h>
#include <catch2/catch_stream.h>
#include <catch2/catch_context.h>
#include <catch2/catch_platform.h>
#include <catch2/catch_debugger.h>
#include <catch2/catch_windows_h_proxy.h>
#include <sstream>

View File

@ -8,7 +8,7 @@
#ifndef TWOBLUECUBES_CATCH_CONSOLE_COLOUR_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_CONSOLE_COLOUR_HPP_INCLUDED
#include "catch_common.h"
#include <catch2/catch_common.h>
namespace Catch {

View File

@ -5,9 +5,9 @@
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include "catch_context.h"
#include "catch_common.h"
#include "catch_random_number_generator.h"
#include <catch2/catch_context.h>
#include <catch2/catch_common.h>
#include <catch2/catch_random_number_generator.h>
namespace Catch {

View File

@ -6,11 +6,11 @@
*
*/
#include "catch_debug_console.h"
#include "catch_compiler_capabilities.h"
#include "catch_stream.h"
#include "catch_platform.h"
#include "catch_windows_h_proxy.h"
#include <catch2/catch_debug_console.h>
#include <catch2/catch_compiler_capabilities.h>
#include <catch2/catch_stream.h>
#include <catch2/catch_platform.h>
#include <catch2/catch_windows_h_proxy.h>
#if defined(CATCH_CONFIG_ANDROID_LOGWRITE)
#include <android/log.h>

View File

@ -7,10 +7,10 @@
*
*/
#include "catch_debugger.h"
#include "catch_errno_guard.h"
#include "catch_stream.h"
#include "catch_platform.h"
#include <catch2/catch_debugger.h>
#include <catch2/catch_errno_guard.h>
#include <catch2/catch_stream.h>
#include <catch2/catch_platform.h>
#ifdef CATCH_PLATFORM_MAC

View File

@ -9,7 +9,7 @@
#ifndef TWOBLUECUBES_CATCH_DEBUGGER_H_INCLUDED
#define TWOBLUECUBES_CATCH_DEBUGGER_H_INCLUDED
#include "catch_platform.h"
#include <catch2/catch_platform.h>
namespace Catch {
bool isDebuggerActive();

View File

@ -6,8 +6,8 @@
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include "catch_decomposer.h"
#include "catch_config.hpp"
#include <catch2/catch_decomposer.h>
#include <catch2/catch_config.hpp>
namespace Catch {

View File

@ -8,9 +8,9 @@
#ifndef TWOBLUECUBES_CATCH_DECOMPOSER_H_INCLUDED
#define TWOBLUECUBES_CATCH_DECOMPOSER_H_INCLUDED
#include "catch_tostring.h"
#include "catch_stringref.h"
#include "catch_meta.hpp"
#include <catch2/catch_tostring.h>
#include <catch2/catch_stringref.h>
#include <catch2/catch_meta.hpp>
#include <iosfwd>

View File

@ -8,7 +8,7 @@
#ifndef TWOBLUECUBES_CATCH_DEFAULT_MAIN_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_DEFAULT_MAIN_HPP_INCLUDED
#include "catch_session.h"
#include <catch2/catch_session.h>
#ifndef __OBJC__

View File

@ -5,7 +5,7 @@
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include "catch_enforce.h"
#include <catch2/catch_enforce.h>
#include <stdexcept>

View File

@ -7,9 +7,9 @@
#ifndef TWOBLUECUBES_CATCH_ENFORCE_H_INCLUDED
#define TWOBLUECUBES_CATCH_ENFORCE_H_INCLUDED
#include "catch_common.h"
#include "catch_compiler_capabilities.h"
#include "catch_stream.h"
#include <catch2/catch_common.h>
#include <catch2/catch_compiler_capabilities.h>
#include <catch2/catch_stream.h>
#include <exception>

View File

@ -5,9 +5,9 @@
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include "catch_enum_values_registry.h"
#include "catch_string_manip.h"
#include "catch_stream.h"
#include <catch2/catch_enum_values_registry.h>
#include <catch2/catch_string_manip.h>
#include <catch2/catch_stream.h>
#include <map>
#include <cassert>

View File

@ -8,7 +8,7 @@
#ifndef TWOBLUECUBES_CATCH_ENUMVALUESREGISTRY_H_INCLUDED
#define TWOBLUECUBES_CATCH_ENUMVALUESREGISTRY_H_INCLUDED
#include "catch_interfaces_enum_values_registry.h"
#include <catch2/catch_interfaces_enum_values_registry.h>
#include <vector>
#include <memory>

View File

@ -5,7 +5,7 @@
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include "catch_errno_guard.h"
#include <catch2/catch_errno_guard.h>
#include <cerrno>

View File

@ -6,10 +6,10 @@
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include "catch_exception_translator_registry.h"
#include "catch_assertionhandler.h"
#include "catch_compiler_capabilities.h"
#include "catch_enforce.h"
#include <catch2/catch_exception_translator_registry.h>
#include <catch2/catch_assertionhandler.h>
#include <catch2/catch_compiler_capabilities.h>
#include <catch2/catch_enforce.h>
#ifdef __OBJC__
#import "Foundation/Foundation.h"

View File

@ -8,7 +8,7 @@
#ifndef TWOBLUECUBES_CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED
#include "catch_interfaces_exception.h"
#include <catch2/catch_interfaces_exception.h>
#include <vector>
#include <string>
#include <memory>

View File

@ -7,14 +7,14 @@
#ifndef TWOBLUECUBES_CATCH_EXTERNAL_INTERFACES_H_INCLUDED
#define TWOBLUECUBES_CATCH_EXTERNAL_INTERFACES_H_INCLUDED
#include "../reporters/catch_reporter_bases.hpp"
#include "catch_console_colour.h"
#include "catch_reporter_registrars.hpp"
#include <catch2/reporters/catch_reporter_bases.hpp>
#include <catch2/catch_console_colour.h>
#include <catch2/catch_reporter_registrars.hpp>
// Allow users to base their work off existing reporters
#include "../reporters/catch_reporter_compact.h"
#include "../reporters/catch_reporter_console.h"
#include "../reporters/catch_reporter_junit.h"
#include "../reporters/catch_reporter_xml.h"
#include <catch2/reporters/catch_reporter_compact.h>
#include <catch2/reporters/catch_reporter_console.h>
#include <catch2/reporters/catch_reporter_junit.h>
#include <catch2/reporters/catch_reporter_xml.h>
#endif // TWOBLUECUBES_CATCH_EXTERNAL_INTERFACES_H_INCLUDED

View File

@ -7,10 +7,10 @@
*
*/
#include "catch_fatal_condition.h"
#include <catch2/catch_fatal_condition.h>
#include "catch_context.h"
#include "catch_interfaces_capture.h"
#include <catch2/catch_context.h>
#include <catch2/catch_interfaces_capture.h>
#if defined(__GNUC__)
# pragma GCC diagnostic push

View File

@ -9,9 +9,9 @@
#ifndef TWOBLUECUBES_CATCH_FATAL_CONDITION_H_INCLUDED
#define TWOBLUECUBES_CATCH_FATAL_CONDITION_H_INCLUDED
#include "catch_platform.h"
#include "catch_compiler_capabilities.h"
#include "catch_windows_h_proxy.h"
#include <catch2/catch_platform.h>
#include <catch2/catch_compiler_capabilities.h>
#include <catch2/catch_windows_h_proxy.h>
#if defined( CATCH_CONFIG_WINDOWS_SEH )

View File

@ -5,9 +5,9 @@
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include "catch_generators.hpp"
#include "catch_random_number_generator.h"
#include "catch_interfaces_capture.h"
#include <catch2/catch_generators.hpp>
#include <catch2/catch_random_number_generator.h>
#include <catch2/catch_interfaces_capture.h>
#include <limits>
#include <set>

View File

@ -7,9 +7,9 @@
#ifndef TWOBLUECUBES_CATCH_GENERATORS_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_GENERATORS_HPP_INCLUDED
#include "catch_interfaces_generatortracker.h"
#include "catch_common.h"
#include "catch_enforce.h"
#include <catch2/catch_interfaces_generatortracker.h>
#include <catch2/catch_common.h>
#include <catch2/catch_enforce.h>
#include <memory>
#include <vector>

View File

@ -7,8 +7,8 @@
#ifndef TWOBLUECUBES_CATCH_GENERATORS_GENERIC_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_GENERATORS_GENERIC_HPP_INCLUDED
#include "catch_generators.hpp"
#include "catch_meta.hpp"
#include <catch2/catch_generators.hpp>
#include <catch2/catch_meta.hpp>
namespace Catch {
namespace Generators {

View File

@ -7,10 +7,10 @@
#ifndef TWOBLUECUBES_CATCH_GENERATORS_SPECIFIC_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_GENERATORS_SPECIFIC_HPP_INCLUDED
#include "catch_context.h"
#include "catch_generators.hpp"
#include "catch_interfaces_config.h"
#include "catch_random_number_generator.h"
#include <catch2/catch_context.h>
#include <catch2/catch_generators.hpp>
#include <catch2/catch_interfaces_config.h>
#include <catch2/catch_random_number_generator.h>
#include <random>

View File

@ -14,10 +14,10 @@
#endif
// Keep these here for external reporters
#include "catch_test_spec.h"
#include "catch_test_case_tracker.h"
#include <catch2/catch_test_spec.h>
#include <catch2/catch_test_case_tracker.h>
#include "catch_leak_detector.h"
#include <catch2/catch_leak_detector.h>
// Cpp files will be included in the single-header file here
// ~*~* CATCH_CPP_STITCH_PLACE *~*~

View File

@ -1,4 +1,4 @@
#include "catch_interfaces_capture.h"
#include <catch2/catch_interfaces_capture.h>
namespace Catch {
IResultCapture::~IResultCapture() = default;

View File

@ -11,8 +11,8 @@
#include <string>
#include <chrono>
#include "catch_stringref.h"
#include "catch_result_type.h"
#include <catch2/catch_stringref.h>
#include <catch2/catch_result_type.h>
namespace Catch {

View File

@ -1,4 +1,4 @@
#include "catch_interfaces_config.h"
#include <catch2/catch_interfaces_config.h>
namespace Catch {
IConfig::~IConfig() = default;

View File

@ -8,8 +8,8 @@
#ifndef TWOBLUECUBES_CATCH_INTERFACES_CONFIG_H_INCLUDED
#define TWOBLUECUBES_CATCH_INTERFACES_CONFIG_H_INCLUDED
#include "catch_common.h"
#include "catch_option.hpp"
#include <catch2/catch_common.h>
#include <catch2/catch_option.hpp>
#include <iosfwd>
#include <string>

View File

@ -8,7 +8,7 @@
#ifndef TWOBLUECUBES_CATCH_INTERFACESENUMVALUESREGISTRY_H_INCLUDED
#define TWOBLUECUBES_CATCH_INTERFACESENUMVALUESREGISTRY_H_INCLUDED
#include "catch_stringref.h"
#include <catch2/catch_stringref.h>
#include <vector>

Some files were not shown because too many files have changed in this diff Show More