Merge commit 'upstream-master' into master am: e9e7ff4367
am: 1d2253f11e
Change-Id: I59bcb03fad4c8bfb447c2b2ca90de3f6ecf6de6f
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..9e88eb4
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,17 @@
+# This sets the default behaviour, overriding core.autocrlf
+* text=auto
+
+# All source files should have unix line-endings in the repository,
+# but convert to native line-endings on checkout
+*.cpp text
+*.h text
+*.hpp text
+
+# Windows specific files should retain windows line-endings
+*.sln text eol=crlf
+
+# Keep the single include header with LFs to make sure it is uploaded,
+# hashed etc with LF
+single_include/*.hpp eol=lf
+# Also keep the LICENCE file with LFs for the same reason
+LICENCE.txt eol=lf
diff --git a/.github/issue_template.md b/.github/issue_template.md
new file mode 100644
index 0000000..051b5e5
--- /dev/null
+++ b/.github/issue_template.md
@@ -0,0 +1,29 @@
+## Description
+<!--
+If your issue is a bugreport, this means describing what you did,
+what did you want to happen and what actually did happen.
+
+If your issue is a feature request, describe the feature and why do you
+want it.
+-->
+
+
+### Steps to reproduce
+<!--
+This is only relevant for bug reports, but if you do have one,
+please provide a minimal set of steps to reproduce the problem.
+
+Usually this means providing a small and self-contained code using Catch
+and specifying compiler flags/tools used if relevant.
+-->
+
+
+### Extra information
+<!--
+Fill in any extra information that might be important for your issue.
+
+If your issue is a bugreport, definitely fill out at least the following.
+-->
+* Catch version: **v42.42.42**
+* Operating System: **Joe's discount operating system**
+* Compiler+version: **Hidden Dragon v1.2.3**
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
new file mode 100644
index 0000000..368f41f
--- /dev/null
+++ b/.github/pull_request_template.md
@@ -0,0 +1,28 @@
+<!--
+Please do not submit pull requests changing the `version.hpp`
+or the single-include `catch.hpp` file, these are changed
+only when a new release is made.
+
+Before submitting a PR you should probably read the contributor documentation
+at docs/contributing.md. It will tell you how to properly test your changes.
+-->
+
+
+## Description
+<!--
+Describe the what and the why of your pull request. Remember that these two
+are usually a bit different. As an example, if you have made various changes
+to decrease the number of new strings allocated, thats what. The why probably
+was that you have a large set of tests and found that this speeds them up.
+-->
+
+## GitHub Issues
+<!--
+If this PR was motivated by some existing issues, reference them here.
+
+If it is a simple bug-fix, please also add a line like 'Closes #123'
+to your commit message, so that it is automatically closed.
+If it is not, don't, as it might take several iterations for a feature
+to be done properly. If in doubt, leave it open and reference it in the
+PR itself, so that maintainers can decide.
+-->
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ffce8e9
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,29 @@
+*.build
+*.pbxuser
+*.mode1v3
+*.ncb
+*.suo
+Debug
+Release
+*.user
+*.xcuserstate
+.DS_Store
+xcuserdata
+CatchSelfTest.xcscheme
+Breakpoints.xcbkptlist
+projects/VS2010/TestCatch/_UpgradeReport_Files/
+projects/VS2010/TestCatch/TestCatch/TestCatch.vcxproj.filters
+projects/VisualStudio/TestCatch/UpgradeLog.XML
+projects/CMake/.idea
+projects/CMake/cmake-build-debug
+UpgradeLog.XML
+Resources/DWARF
+projects/Generated
+*.pyc
+DerivedData
+*.xccheckout
+Build
+.idea
+.vs
+cmake-build-*
+benchmark-dir
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..1da1c0f
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,226 @@
+language: cpp
+sudo: false
+
+common_sources: &all_sources
+ - ubuntu-toolchain-r-test
+ - llvm-toolchain-trusty
+ - llvm-toolchain-trusty-3.9
+ - llvm-toolchain-trusty-4.0
+ - llvm-toolchain-trusty-5.0
+
+matrix:
+ include:
+
+ # 1/ Linux Clang Builds
+ - os: linux
+ compiler: clang
+ addons:
+ apt:
+ sources: *all_sources
+ packages: ['valgrind', 'lcov', 'clang-3.5']
+ env: COMPILER='clang++-3.5' VALGRIND=1
+
+ - os: linux
+ compiler: clang
+ addons:
+ apt:
+ sources: *all_sources
+ packages: ['valgrind', 'lcov', 'clang-3.6']
+ env: COMPILER='clang++-3.6' VALGRIND=1
+
+# Travis's containers do not seem to have Clang 3.7 in apt, no matter what sources I add.
+# - os: linux
+# compiler: clang
+# addons:
+# apt:
+# sources: *all_sources
+# packages: ['valgrind', 'clang-3.7']
+# env: COMPILER='clang++-3.7' VALGRIND=1
+
+ - os: linux
+ compiler: clang
+ addons:
+ apt:
+ sources: *all_sources
+ packages: ['valgrind', 'lcov', 'clang-3.8']
+ env: COMPILER='clang++-3.8' VALGRIND=1
+
+ - os: linux
+ compiler: clang
+ addons:
+ apt:
+ sources: *all_sources
+ packages: ['clang-3.9', 'valgrind', 'lcov']
+ env: COMPILER='clang++-3.9' VALGRIND=1
+
+ - os: linux
+ compiler: clang
+ addons:
+ apt:
+ sources: *all_sources
+ packages: ['clang-4.0', 'valgrind', 'lcov']
+ env: COMPILER='clang++-4.0' VALGRIND=1
+
+ - os: linux
+ compiler: clang
+ addons:
+ apt:
+ sources: *all_sources
+ packages: ['clang-5.0', 'valgrind', 'lcov']
+ env: COMPILER='clang++-5.0' VALGRIND=1
+
+ # 2/ Linux GCC Builds
+ - os: linux
+ compiler: gcc
+ addons:
+ apt:
+ sources: ['ubuntu-toolchain-r-test']
+ packages: ['valgrind', 'lcov', 'g++-4.8']
+ env: COMPILER='g++-4.8' VALGRIND=1
+
+ - os: linux
+ compiler: gcc
+ addons:
+ apt:
+ sources: *all_sources
+ packages: ['valgrind', 'lcov', 'g++-4.9']
+ env: COMPILER='g++-4.9' VALGRIND=1
+
+ - os: linux
+ compiler: gcc
+ addons:
+ apt:
+ sources: *all_sources
+ packages: ['valgrind', 'lcov', 'g++-5']
+ env: COMPILER='g++-5' VALGRIND=1
+
+ - os: linux
+ compiler: gcc
+ addons: &gcc6
+ apt:
+ sources: *all_sources
+ packages: ['valgrind', 'lcov', 'g++-6']
+ env: COMPILER='g++-6' VALGRIND=1
+
+ - os: linux
+ compiler: gcc
+ addons: &gcc7
+ apt:
+ sources: *all_sources
+ packages: ['valgrind', 'lcov', 'g++-7']
+ env: COMPILER='g++-7' VALGRIND=1
+
+ # 3b/ Linux C++14 Clang builds
+ - os: linux
+ compiler: clang
+ addons:
+ apt:
+ packages: ['clang-3.8', 'valgrind', 'lcov', 'libstdc++-6-dev']
+ sources:
+ - ubuntu-toolchain-r-test
+ - llvm-toolchain-trusty
+ env: COMPILER='clang++-3.8' CPP14=1 VALGRIND=1
+
+ - os: linux
+ compiler: clang
+ addons:
+ apt:
+ sources: *all_sources
+ packages: ['clang-3.9', 'valgrind', 'lcov', 'libstdc++-6-dev']
+ env: COMPILER='clang++-3.9' CPP14=1 VALGRIND=1
+
+ - os: linux
+ compiler: clang
+ addons:
+ apt:
+ sources: *all_sources
+ packages: ['clang-4.0', 'valgrind', 'lcov', 'libstdc++-6-dev']
+ env: COMPILER='clang++-4.0' CPP14=1 VALGRIND=1
+
+ - os: linux
+ compiler: clang
+ addons:
+ apt:
+ sources: *all_sources
+ packages: ['clang-5.0', 'valgrind', 'lcov', 'libstdc++-6-dev']
+ env: COMPILER='clang++-5.0' CPP14=1 VALGRIND=1
+
+
+ # 4a/ Linux C++14 GCC builds
+ - os: linux
+ compiler: gcc
+ addons: *gcc6
+ env: COMPILER='g++-6' CPP14=1 VALGRIND=1
+
+ - os: linux
+ compiler: gcc
+ addons: *gcc7
+ env: COMPILER='g++-7' CPP14=1 VALGRIND=1
+
+ # 5/ OSX Clang Builds
+ - os: osx
+ osx_image: xcode7.3
+ compiler: clang
+ env: COMPILER='clang++'
+
+ - os: osx
+ osx_image: xcode8
+ compiler: clang
+ env: COMPILER='clang++'
+
+ - os: osx
+ osx_image: xcode9
+ compiler: clang
+ env: COMPILER='clang++'
+
+ - os: osx
+ osx_image: xcode9.1
+ compiler: clang
+ env: COMPILER='clang++'
+
+ - os: osx
+ osx_image: xcode9.1
+ compiler: clang
+ env: COMPILER='clang++' USE_CPP14=1
+
+
+install:
+ - DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
+ - mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}
+ - |
+ if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
+ CMAKE_URL="http://www.cmake.org/files/v3.3/cmake-3.3.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
+ export PATH=${DEPS_DIR}/cmake/bin:${PATH}
+ elif [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
+ which cmake || brew install cmake;
+ fi
+
+before_script:
+ - export CXX=${COMPILER}
+ - cd ${TRAVIS_BUILD_DIR}
+ # Regenerate single header file, so it is tested in the examples...
+ - python scripts/generateSingleHeader.py
+
+ - |
+ # Use Debug builds for running Valgrind and building examples
+ cmake -H. -BBuild-Debug -DCMAKE_BUILD_TYPE=Debug -Wdev -DUSE_CPP14=${CPP14} -DCATCH_USE_VALGRIND=${VALGRIND} -DCATCH_BUILD_EXAMPLES=ON -DCATCH_ENABLE_COVERAGE=ON
+ # Don't bother with release build for coverage build
+ cmake -H. -BBuild-Release -DCMAKE_BUILD_TYPE=Release -Wdev -DUSE_CPP14=${CPP14}
+
+
+script:
+ - |
+ cd Build-Debug
+ make -j 2
+ CTEST_OUTPUT_ON_FAILURE=1 ctest -j 2
+ # Coverage collection does not work for OS X atm
+ if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
+ make gcov
+ make lcov
+ bash <(curl -s https://codecov.io/bash) -X gcov || echo "Codecov did not collect coverage reports"
+ fi
+ # Go to release build
+ cd ../Build-Release
+ make -j 2
+ CTEST_OUTPUT_ON_FAILURE=1 ctest -j 2
diff --git a/CMake/FindGcov.cmake b/CMake/FindGcov.cmake
new file mode 100644
index 0000000..6ffd6ea
--- /dev/null
+++ b/CMake/FindGcov.cmake
@@ -0,0 +1,157 @@
+# This file is part of CMake-codecov.
+#
+# Copyright (c)
+# 2015-2017 RWTH Aachen University, Federal Republic of Germany
+#
+# See the LICENSE file in the package base directory for details
+#
+# Written by Alexander Haase, alexander.haase@rwth-aachen.de
+#
+
+
+# include required Modules
+include(FindPackageHandleStandardArgs)
+
+
+# Search for gcov binary.
+set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
+set(CMAKE_REQUIRED_QUIET ${codecov_FIND_QUIETLY})
+
+get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
+foreach (LANG ${ENABLED_LANGUAGES})
+ # Gcov evaluation is dependend on the used compiler. Check gcov support for
+ # each compiler that is used. If gcov binary was already found for this
+ # compiler, do not try to find it again.
+ if (NOT GCOV_${CMAKE_${LANG}_COMPILER_ID}_BIN)
+ get_filename_component(COMPILER_PATH "${CMAKE_${LANG}_COMPILER}" PATH)
+
+ if ("${CMAKE_${LANG}_COMPILER_ID}" STREQUAL "GNU")
+ # Some distributions like OSX (homebrew) ship gcov with the compiler
+ # version appended as gcov-x. To find this binary we'll build the
+ # suggested binary name with the compiler version.
+ string(REGEX MATCH "^[0-9]+" GCC_VERSION
+ "${CMAKE_${LANG}_COMPILER_VERSION}")
+
+ find_program(GCOV_BIN NAMES gcov-${GCC_VERSION} gcov
+ HINTS ${COMPILER_PATH})
+
+ elseif ("${CMAKE_${LANG}_COMPILER_ID}" STREQUAL "Clang")
+ # Some distributions like Debian ship llvm-cov with the compiler
+ # version appended as llvm-cov-x.y. To find this binary we'll build
+ # the suggested binary name with the compiler version.
+ string(REGEX MATCH "^[0-9]+.[0-9]+" LLVM_VERSION
+ "${CMAKE_${LANG}_COMPILER_VERSION}")
+
+ # llvm-cov prior version 3.5 seems to be not working with coverage
+ # evaluation tools, but these versions are compatible with the gcc
+ # gcov tool.
+ if(LLVM_VERSION VERSION_GREATER 3.4)
+ find_program(LLVM_COV_BIN NAMES "llvm-cov-${LLVM_VERSION}"
+ "llvm-cov" HINTS ${COMPILER_PATH})
+ mark_as_advanced(LLVM_COV_BIN)
+
+ if (LLVM_COV_BIN)
+ find_program(LLVM_COV_WRAPPER "llvm-cov-wrapper" PATHS
+ ${CMAKE_MODULE_PATH})
+ if (LLVM_COV_WRAPPER)
+ set(GCOV_BIN "${LLVM_COV_WRAPPER}" CACHE FILEPATH "")
+
+ # set additional parameters
+ set(GCOV_${CMAKE_${LANG}_COMPILER_ID}_ENV
+ "LLVM_COV_BIN=${LLVM_COV_BIN}" CACHE STRING
+ "Environment variables for llvm-cov-wrapper.")
+ mark_as_advanced(GCOV_${CMAKE_${LANG}_COMPILER_ID}_ENV)
+ endif ()
+ endif ()
+ endif ()
+
+ if (NOT GCOV_BIN)
+ # Fall back to gcov binary if llvm-cov was not found or is
+ # incompatible. This is the default on OSX, but may crash on
+ # recent Linux versions.
+ find_program(GCOV_BIN gcov HINTS ${COMPILER_PATH})
+ endif ()
+ endif ()
+
+
+ if (GCOV_BIN)
+ set(GCOV_${CMAKE_${LANG}_COMPILER_ID}_BIN "${GCOV_BIN}" CACHE STRING
+ "${LANG} gcov binary.")
+
+ if (NOT CMAKE_REQUIRED_QUIET)
+ message("-- Found gcov evaluation for "
+ "${CMAKE_${LANG}_COMPILER_ID}: ${GCOV_BIN}")
+ endif()
+
+ unset(GCOV_BIN CACHE)
+ endif ()
+ endif ()
+endforeach ()
+
+
+
+
+# Add a new global target for all gcov targets. This target could be used to
+# generate the gcov files for the whole project instead of calling <TARGET>-gcov
+# for each target.
+if (NOT TARGET gcov)
+ add_custom_target(gcov)
+endif (NOT TARGET gcov)
+
+
+
+# This function will add gcov evaluation for target <TNAME>. Only sources of
+# this target will be evaluated and no dependencies will be added. It will call
+# Gcov on any source file of <TNAME> once and store the gcov file in the same
+# directory.
+function (add_gcov_target TNAME)
+ set(TDIR ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TNAME}.dir)
+
+ # We don't have to check, if the target has support for coverage, thus this
+ # will be checked by add_coverage_target in Findcoverage.cmake. Instead we
+ # have to determine which gcov binary to use.
+ get_target_property(TSOURCES ${TNAME} SOURCES)
+ set(SOURCES "")
+ set(TCOMPILER "")
+ foreach (FILE ${TSOURCES})
+ codecov_path_of_source(${FILE} FILE)
+ if (NOT "${FILE}" STREQUAL "")
+ codecov_lang_of_source(${FILE} LANG)
+ if (NOT "${LANG}" STREQUAL "")
+ list(APPEND SOURCES "${FILE}")
+ set(TCOMPILER ${CMAKE_${LANG}_COMPILER_ID})
+ endif ()
+ endif ()
+ endforeach ()
+
+ # If no gcov binary was found, coverage data can't be evaluated.
+ if (NOT GCOV_${TCOMPILER}_BIN)
+ message(WARNING "No coverage evaluation binary found for ${TCOMPILER}.")
+ return()
+ endif ()
+
+ set(GCOV_BIN "${GCOV_${TCOMPILER}_BIN}")
+ set(GCOV_ENV "${GCOV_${TCOMPILER}_ENV}")
+
+
+ set(BUFFER "")
+ foreach(FILE ${SOURCES})
+ get_filename_component(FILE_PATH "${TDIR}/${FILE}" PATH)
+
+ # call gcov
+ add_custom_command(OUTPUT ${TDIR}/${FILE}.gcov
+ COMMAND ${GCOV_ENV} ${GCOV_BIN} ${TDIR}/${FILE}.gcno > /dev/null
+ DEPENDS ${TNAME} ${TDIR}/${FILE}.gcno
+ WORKING_DIRECTORY ${FILE_PATH}
+ )
+
+ list(APPEND BUFFER ${TDIR}/${FILE}.gcov)
+ endforeach()
+
+
+ # add target for gcov evaluation of <TNAME>
+ add_custom_target(${TNAME}-gcov DEPENDS ${BUFFER})
+
+ # add evaluation target to the global gcov target.
+ add_dependencies(gcov ${TNAME}-gcov)
+endfunction (add_gcov_target)
diff --git a/CMake/FindLcov.cmake b/CMake/FindLcov.cmake
new file mode 100644
index 0000000..beb925a
--- /dev/null
+++ b/CMake/FindLcov.cmake
@@ -0,0 +1,354 @@
+# This file is part of CMake-codecov.
+#
+# Copyright (c)
+# 2015-2017 RWTH Aachen University, Federal Republic of Germany
+#
+# See the LICENSE file in the package base directory for details
+#
+# Written by Alexander Haase, alexander.haase@rwth-aachen.de
+#
+
+
+# configuration
+set(LCOV_DATA_PATH "${CMAKE_BINARY_DIR}/lcov/data")
+set(LCOV_DATA_PATH_INIT "${LCOV_DATA_PATH}/init")
+set(LCOV_DATA_PATH_CAPTURE "${LCOV_DATA_PATH}/capture")
+set(LCOV_HTML_PATH "${CMAKE_BINARY_DIR}/lcov/html")
+
+
+
+
+# Search for Gcov which is used by Lcov.
+find_package(Gcov)
+
+
+
+
+# This function will add lcov evaluation for target <TNAME>. Only sources of
+# this target will be evaluated and no dependencies will be added. It will call
+# geninfo on any source file of <TNAME> once and store the info file in the same
+# directory.
+#
+# Note: This function is only a wrapper to define this function always, even if
+# coverage is not supported by the compiler or disabled. This function must
+# be defined here, because the module will be exited, if there is no coverage
+# support by the compiler or it is disabled by the user.
+function (add_lcov_target TNAME)
+ if (LCOV_FOUND)
+ # capture initial coverage data
+ lcov_capture_initial_tgt(${TNAME})
+
+ # capture coverage data after execution
+ lcov_capture_tgt(${TNAME})
+ endif ()
+endfunction (add_lcov_target)
+
+
+
+
+# include required Modules
+include(FindPackageHandleStandardArgs)
+
+# Search for required lcov binaries.
+find_program(LCOV_BIN lcov)
+find_program(GENINFO_BIN geninfo)
+find_program(GENHTML_BIN genhtml)
+find_package_handle_standard_args(lcov
+ REQUIRED_VARS LCOV_BIN GENINFO_BIN GENHTML_BIN
+)
+
+# enable genhtml C++ demangeling, if c++filt is found.
+set(GENHTML_CPPFILT_FLAG "")
+find_program(CPPFILT_BIN c++filt)
+if (NOT CPPFILT_BIN STREQUAL "")
+ set(GENHTML_CPPFILT_FLAG "--demangle-cpp")
+endif (NOT CPPFILT_BIN STREQUAL "")
+
+# enable no-external flag for lcov, if available.
+if (GENINFO_BIN AND NOT DEFINED GENINFO_EXTERN_FLAG)
+ set(FLAG "")
+ execute_process(COMMAND ${GENINFO_BIN} --help OUTPUT_VARIABLE GENINFO_HELP)
+ string(REGEX MATCH "external" GENINFO_RES "${GENINFO_HELP}")
+ if (GENINFO_RES)
+ set(FLAG "--no-external")
+ endif ()
+
+ set(GENINFO_EXTERN_FLAG "${FLAG}"
+ CACHE STRING "Geninfo flag to exclude system sources.")
+endif ()
+
+# If Lcov was not found, exit module now.
+if (NOT LCOV_FOUND)
+ return()
+endif (NOT LCOV_FOUND)
+
+
+
+
+# Create directories to be used.
+file(MAKE_DIRECTORY ${LCOV_DATA_PATH_INIT})
+file(MAKE_DIRECTORY ${LCOV_DATA_PATH_CAPTURE})
+
+set(LCOV_REMOVE_PATTERNS "")
+
+# This function will merge lcov files to a single target file. Additional lcov
+# flags may be set with setting LCOV_EXTRA_FLAGS before calling this function.
+function (lcov_merge_files OUTFILE ...)
+ # Remove ${OUTFILE} from ${ARGV} and generate lcov parameters with files.
+ list(REMOVE_AT ARGV 0)
+
+ # Generate merged file.
+ string(REPLACE "${CMAKE_BINARY_DIR}/" "" FILE_REL "${OUTFILE}")
+ add_custom_command(OUTPUT "${OUTFILE}.raw"
+ COMMAND cat ${ARGV} > ${OUTFILE}.raw
+ DEPENDS ${ARGV}
+ COMMENT "Generating ${FILE_REL}"
+ )
+
+ add_custom_command(OUTPUT "${OUTFILE}"
+ COMMAND ${LCOV_BIN} --quiet -a ${OUTFILE}.raw --output-file ${OUTFILE}
+ --base-directory ${PROJECT_SOURCE_DIR} ${LCOV_EXTRA_FLAGS}
+ COMMAND ${LCOV_BIN} --quiet -r ${OUTFILE} ${LCOV_REMOVE_PATTERNS}
+ --output-file ${OUTFILE} ${LCOV_EXTRA_FLAGS}
+ DEPENDS ${OUTFILE}.raw
+ COMMENT "Post-processing ${FILE_REL}"
+ )
+endfunction ()
+
+
+
+
+# Add a new global target to generate initial coverage reports for all targets.
+# This target will be used to generate the global initial info file, which is
+# used to gather even empty report data.
+if (NOT TARGET lcov-capture-init)
+ add_custom_target(lcov-capture-init)
+ set(LCOV_CAPTURE_INIT_FILES "" CACHE INTERNAL "")
+endif (NOT TARGET lcov-capture-init)
+
+
+# This function will add initial capture of coverage data for target <TNAME>,
+# which is needed to get also data for objects, which were not loaded at
+# execution time. It will call geninfo for every source file of <TNAME> once and
+# store the info file in the same directory.
+function (lcov_capture_initial_tgt TNAME)
+ # We don't have to check, if the target has support for coverage, thus this
+ # will be checked by add_coverage_target in Findcoverage.cmake. Instead we
+ # have to determine which gcov binary to use.
+ get_target_property(TSOURCES ${TNAME} SOURCES)
+ set(SOURCES "")
+ set(TCOMPILER "")
+ foreach (FILE ${TSOURCES})
+ codecov_path_of_source(${FILE} FILE)
+ if (NOT "${FILE}" STREQUAL "")
+ codecov_lang_of_source(${FILE} LANG)
+ if (NOT "${LANG}" STREQUAL "")
+ list(APPEND SOURCES "${FILE}")
+ set(TCOMPILER ${CMAKE_${LANG}_COMPILER_ID})
+ endif ()
+ endif ()
+ endforeach ()
+
+ # If no gcov binary was found, coverage data can't be evaluated.
+ if (NOT GCOV_${TCOMPILER}_BIN)
+ message(WARNING "No coverage evaluation binary found for ${TCOMPILER}.")
+ return()
+ endif ()
+
+ set(GCOV_BIN "${GCOV_${TCOMPILER}_BIN}")
+ set(GCOV_ENV "${GCOV_${TCOMPILER}_ENV}")
+
+
+ set(TDIR ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TNAME}.dir)
+ set(GENINFO_FILES "")
+ foreach(FILE ${SOURCES})
+ # generate empty coverage files
+ set(OUTFILE "${TDIR}/${FILE}.info.init")
+ list(APPEND GENINFO_FILES ${OUTFILE})
+
+ add_custom_command(OUTPUT ${OUTFILE} COMMAND ${GCOV_ENV} ${GENINFO_BIN}
+ --quiet --base-directory ${PROJECT_SOURCE_DIR} --initial
+ --gcov-tool ${GCOV_BIN} --output-filename ${OUTFILE}
+ ${GENINFO_EXTERN_FLAG} ${TDIR}/${FILE}.gcno
+ DEPENDS ${TNAME}
+ COMMENT "Capturing initial coverage data for ${FILE}"
+ )
+ endforeach()
+
+ # Concatenate all files generated by geninfo to a single file per target.
+ set(OUTFILE "${LCOV_DATA_PATH_INIT}/${TNAME}.info")
+ set(LCOV_EXTRA_FLAGS "--initial")
+ lcov_merge_files("${OUTFILE}" ${GENINFO_FILES})
+ add_custom_target(${TNAME}-capture-init ALL DEPENDS ${OUTFILE})
+
+ # add geninfo file generation to global lcov-geninfo target
+ add_dependencies(lcov-capture-init ${TNAME}-capture-init)
+ set(LCOV_CAPTURE_INIT_FILES "${LCOV_CAPTURE_INIT_FILES}"
+ "${OUTFILE}" CACHE INTERNAL ""
+ )
+endfunction (lcov_capture_initial_tgt)
+
+
+# This function will generate the global info file for all targets. It has to be
+# called after all other CMake functions in the root CMakeLists.txt file, to get
+# a full list of all targets that generate coverage data.
+function (lcov_capture_initial)
+ # Skip this function (and do not create the following targets), if there are
+ # no input files.
+ if ("${LCOV_CAPTURE_INIT_FILES}" STREQUAL "")
+ return()
+ endif ()
+
+ # Add a new target to merge the files of all targets.
+ set(OUTFILE "${LCOV_DATA_PATH_INIT}/all_targets.info")
+ lcov_merge_files("${OUTFILE}" ${LCOV_CAPTURE_INIT_FILES})
+ add_custom_target(lcov-geninfo-init ALL DEPENDS ${OUTFILE}
+ lcov-capture-init
+ )
+endfunction (lcov_capture_initial)
+
+
+
+
+# Add a new global target to generate coverage reports for all targets. This
+# target will be used to generate the global info file.
+if (NOT TARGET lcov-capture)
+ add_custom_target(lcov-capture)
+ set(LCOV_CAPTURE_FILES "" CACHE INTERNAL "")
+endif (NOT TARGET lcov-capture)
+
+
+# This function will add capture of coverage data for target <TNAME>, which is
+# needed to get also data for objects, which were not loaded at execution time.
+# It will call geninfo for every source file of <TNAME> once and store the info
+# file in the same directory.
+function (lcov_capture_tgt TNAME)
+ # We don't have to check, if the target has support for coverage, thus this
+ # will be checked by add_coverage_target in Findcoverage.cmake. Instead we
+ # have to determine which gcov binary to use.
+ get_target_property(TSOURCES ${TNAME} SOURCES)
+ set(SOURCES "")
+ set(TCOMPILER "")
+ foreach (FILE ${TSOURCES})
+ codecov_path_of_source(${FILE} FILE)
+ if (NOT "${FILE}" STREQUAL "")
+ codecov_lang_of_source(${FILE} LANG)
+ if (NOT "${LANG}" STREQUAL "")
+ list(APPEND SOURCES "${FILE}")
+ set(TCOMPILER ${CMAKE_${LANG}_COMPILER_ID})
+ endif ()
+ endif ()
+ endforeach ()
+
+ # If no gcov binary was found, coverage data can't be evaluated.
+ if (NOT GCOV_${TCOMPILER}_BIN)
+ message(WARNING "No coverage evaluation binary found for ${TCOMPILER}.")
+ return()
+ endif ()
+
+ set(GCOV_BIN "${GCOV_${TCOMPILER}_BIN}")
+ set(GCOV_ENV "${GCOV_${TCOMPILER}_ENV}")
+
+
+ set(TDIR ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TNAME}.dir)
+ set(GENINFO_FILES "")
+ foreach(FILE ${SOURCES})
+ # Generate coverage files. If no .gcda file was generated during
+ # execution, the empty coverage file will be used instead.
+ set(OUTFILE "${TDIR}/${FILE}.info")
+ list(APPEND GENINFO_FILES ${OUTFILE})
+
+ add_custom_command(OUTPUT ${OUTFILE}
+ COMMAND test -f "${TDIR}/${FILE}.gcda"
+ && ${GCOV_ENV} ${GENINFO_BIN} --quiet --base-directory
+ ${PROJECT_SOURCE_DIR} --gcov-tool ${GCOV_BIN}
+ --output-filename ${OUTFILE} ${GENINFO_EXTERN_FLAG}
+ ${TDIR}/${FILE}.gcda
+ || cp ${OUTFILE}.init ${OUTFILE}
+ DEPENDS ${TNAME} ${TNAME}-capture-init
+ COMMENT "Capturing coverage data for ${FILE}"
+ )
+ endforeach()
+
+ # Concatenate all files generated by geninfo to a single file per target.
+ set(OUTFILE "${LCOV_DATA_PATH_CAPTURE}/${TNAME}.info")
+ lcov_merge_files("${OUTFILE}" ${GENINFO_FILES})
+ add_custom_target(${TNAME}-geninfo DEPENDS ${OUTFILE})
+
+ # add geninfo file generation to global lcov-capture target
+ add_dependencies(lcov-capture ${TNAME}-geninfo)
+ set(LCOV_CAPTURE_FILES "${LCOV_CAPTURE_FILES}" "${OUTFILE}" CACHE INTERNAL
+ ""
+ )
+
+ # Add target for generating html output for this target only.
+ file(MAKE_DIRECTORY ${LCOV_HTML_PATH}/${TNAME})
+ add_custom_target(${TNAME}-genhtml
+ COMMAND ${GENHTML_BIN} --quiet --sort --prefix ${PROJECT_SOURCE_DIR}
+ --baseline-file ${LCOV_DATA_PATH_INIT}/${TNAME}.info
+ --output-directory ${LCOV_HTML_PATH}/${TNAME}
+ --title "${CMAKE_PROJECT_NAME} - target ${TNAME}"
+ ${GENHTML_CPPFILT_FLAG} ${OUTFILE}
+ DEPENDS ${TNAME}-geninfo ${TNAME}-capture-init
+ )
+endfunction (lcov_capture_tgt)
+
+
+# This function will generate the global info file for all targets. It has to be
+# called after all other CMake functions in the root CMakeLists.txt file, to get
+# a full list of all targets that generate coverage data.
+function (lcov_capture)
+ # Skip this function (and do not create the following targets), if there are
+ # no input files.
+ if ("${LCOV_CAPTURE_FILES}" STREQUAL "")
+ return()
+ endif ()
+
+ # Add a new target to merge the files of all targets.
+ set(OUTFILE "${LCOV_DATA_PATH_CAPTURE}/all_targets.info")
+ lcov_merge_files("${OUTFILE}" ${LCOV_CAPTURE_FILES})
+ add_custom_target(lcov-geninfo DEPENDS ${OUTFILE} lcov-capture)
+
+ # Add a new global target for all lcov targets. This target could be used to
+ # generate the lcov html output for the whole project instead of calling
+ # <TARGET>-geninfo and <TARGET>-genhtml for each target. It will also be
+ # used to generate a html site for all project data together instead of one
+ # for each target.
+ if (NOT TARGET lcov)
+ file(MAKE_DIRECTORY ${LCOV_HTML_PATH}/all_targets)
+ add_custom_target(lcov
+ COMMAND ${GENHTML_BIN} --quiet --sort
+ --baseline-file ${LCOV_DATA_PATH_INIT}/all_targets.info
+ --output-directory ${LCOV_HTML_PATH}/all_targets
+ --title "${CMAKE_PROJECT_NAME}" --prefix "${PROJECT_SOURCE_DIR}"
+ ${GENHTML_CPPFILT_FLAG} ${OUTFILE}
+ DEPENDS lcov-geninfo-init lcov-geninfo
+ )
+ endif ()
+endfunction (lcov_capture)
+
+
+
+
+# Add a new global target to generate the lcov html report for the whole project
+# instead of calling <TARGET>-genhtml for each target (to create an own report
+# for each target). Instead of the lcov target it does not require geninfo for
+# all targets, so you have to call <TARGET>-geninfo to generate the info files
+# the targets you'd like to have in your report or lcov-geninfo for generating
+# info files for all targets before calling lcov-genhtml.
+file(MAKE_DIRECTORY ${LCOV_HTML_PATH}/selected_targets)
+if (NOT TARGET lcov-genhtml)
+ add_custom_target(lcov-genhtml
+ COMMAND ${GENHTML_BIN}
+ --quiet
+ --output-directory ${LCOV_HTML_PATH}/selected_targets
+ --title \"${CMAKE_PROJECT_NAME} - targets `find
+ ${LCOV_DATA_PATH_CAPTURE} -name \"*.info\" ! -name
+ \"all_targets.info\" -exec basename {} .info \\\;`\"
+ --prefix ${PROJECT_SOURCE_DIR}
+ --sort
+ ${GENHTML_CPPFILT_FLAG}
+ `find ${LCOV_DATA_PATH_CAPTURE} -name \"*.info\" ! -name
+ \"all_targets.info\"`
+ )
+endif (NOT TARGET lcov-genhtml)
diff --git a/CMake/Findcodecov.cmake b/CMake/Findcodecov.cmake
new file mode 100644
index 0000000..fa135fa
--- /dev/null
+++ b/CMake/Findcodecov.cmake
@@ -0,0 +1,258 @@
+# This file is part of CMake-codecov.
+#
+# Copyright (c)
+# 2015-2017 RWTH Aachen University, Federal Republic of Germany
+#
+# See the LICENSE file in the package base directory for details
+#
+# Written by Alexander Haase, alexander.haase@rwth-aachen.de
+#
+
+
+# Add an option to choose, if coverage should be enabled or not. If enabled
+# marked targets will be build with coverage support and appropriate targets
+# will be added. If disabled coverage will be ignored for *ALL* targets.
+option(ENABLE_COVERAGE "Enable coverage build." OFF)
+
+set(COVERAGE_FLAG_CANDIDATES
+ # gcc and clang
+ "-O0 -g -fprofile-arcs -ftest-coverage"
+
+ # gcc and clang fallback
+ "-O0 -g --coverage"
+)
+
+
+# Add coverage support for target ${TNAME} and register target for coverage
+# evaluation. If coverage is disabled or not supported, this function will
+# simply do nothing.
+#
+# Note: This function is only a wrapper to define this function always, even if
+# coverage is not supported by the compiler or disabled. This function must
+# be defined here, because the module will be exited, if there is no coverage
+# support by the compiler or it is disabled by the user.
+function (add_coverage TNAME)
+ # only add coverage for target, if coverage is support and enabled.
+ if (ENABLE_COVERAGE)
+ foreach (TNAME ${ARGV})
+ add_coverage_target(${TNAME})
+ endforeach ()
+ endif ()
+endfunction (add_coverage)
+
+
+# Add global target to gather coverage information after all targets have been
+# added. Other evaluation functions could be added here, after checks for the
+# specific module have been passed.
+#
+# Note: This function is only a wrapper to define this function always, even if
+# coverage is not supported by the compiler or disabled. This function must
+# be defined here, because the module will be exited, if there is no coverage
+# support by the compiler or it is disabled by the user.
+function (coverage_evaluate)
+ # add lcov evaluation
+ if (LCOV_FOUND)
+ lcov_capture_initial()
+ lcov_capture()
+ endif (LCOV_FOUND)
+endfunction ()
+
+
+# Exit this module, if coverage is disabled. add_coverage is defined before this
+# return, so this module can be exited now safely without breaking any build-
+# scripts.
+if (NOT ENABLE_COVERAGE)
+ return()
+endif ()
+
+
+
+
+# Find the reuired flags foreach language.
+set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
+set(CMAKE_REQUIRED_QUIET ${codecov_FIND_QUIETLY})
+
+get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
+foreach (LANG ${ENABLED_LANGUAGES})
+ # Coverage flags are not dependend on language, but the used compiler. So
+ # instead of searching flags foreach language, search flags foreach compiler
+ # used.
+ set(COMPILER ${CMAKE_${LANG}_COMPILER_ID})
+ if (NOT COVERAGE_${COMPILER}_FLAGS)
+ foreach (FLAG ${COVERAGE_FLAG_CANDIDATES})
+ if(NOT CMAKE_REQUIRED_QUIET)
+ message(STATUS "Try ${COMPILER} code coverage flag = [${FLAG}]")
+ endif()
+
+ set(CMAKE_REQUIRED_FLAGS "${FLAG}")
+ unset(COVERAGE_FLAG_DETECTED CACHE)
+
+ if (${LANG} STREQUAL "C")
+ include(CheckCCompilerFlag)
+ check_c_compiler_flag("${FLAG}" COVERAGE_FLAG_DETECTED)
+
+ elseif (${LANG} STREQUAL "CXX")
+ include(CheckCXXCompilerFlag)
+ check_cxx_compiler_flag("${FLAG}" COVERAGE_FLAG_DETECTED)
+
+ elseif (${LANG} STREQUAL "Fortran")
+ # CheckFortranCompilerFlag was introduced in CMake 3.x. To be
+ # compatible with older Cmake versions, we will check if this
+ # module is present before we use it. Otherwise we will define
+ # Fortran coverage support as not available.
+ include(CheckFortranCompilerFlag OPTIONAL
+ RESULT_VARIABLE INCLUDED)
+ if (INCLUDED)
+ check_fortran_compiler_flag("${FLAG}"
+ COVERAGE_FLAG_DETECTED)
+ elseif (NOT CMAKE_REQUIRED_QUIET)
+ message("-- Performing Test COVERAGE_FLAG_DETECTED")
+ message("-- Performing Test COVERAGE_FLAG_DETECTED - Failed"
+ " (Check not supported)")
+ endif ()
+ endif()
+
+ if (COVERAGE_FLAG_DETECTED)
+ set(COVERAGE_${COMPILER}_FLAGS "${FLAG}"
+ CACHE STRING "${COMPILER} flags for code coverage.")
+ mark_as_advanced(COVERAGE_${COMPILER}_FLAGS)
+ break()
+ else ()
+ message(WARNING "Code coverage is not available for ${COMPILER}"
+ " compiler. Targets using this compiler will be "
+ "compiled without it.")
+ endif ()
+ endforeach ()
+ endif ()
+endforeach ()
+
+set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
+
+
+
+
+# Helper function to get the language of a source file.
+function (codecov_lang_of_source FILE RETURN_VAR)
+ get_filename_component(FILE_EXT "${FILE}" EXT)
+ string(TOLOWER "${FILE_EXT}" FILE_EXT)
+ string(SUBSTRING "${FILE_EXT}" 1 -1 FILE_EXT)
+
+ get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
+ foreach (LANG ${ENABLED_LANGUAGES})
+ list(FIND CMAKE_${LANG}_SOURCE_FILE_EXTENSIONS "${FILE_EXT}" TEMP)
+ if (NOT ${TEMP} EQUAL -1)
+ set(${RETURN_VAR} "${LANG}" PARENT_SCOPE)
+ return()
+ endif ()
+ endforeach()
+
+ set(${RETURN_VAR} "" PARENT_SCOPE)
+endfunction ()
+
+
+# Helper function to get the relative path of the source file destination path.
+# This path is needed by FindGcov and FindLcov cmake files to locate the
+# captured data.
+function (codecov_path_of_source FILE RETURN_VAR)
+ string(REGEX MATCH "TARGET_OBJECTS:([^ >]+)" _source ${FILE})
+
+ # If expression was found, SOURCEFILE is a generator-expression for an
+ # object library. Currently we found no way to call this function automatic
+ # for the referenced target, so it must be called in the directoryso of the
+ # object library definition.
+ if (NOT "${_source}" STREQUAL "")
+ set(${RETURN_VAR} "" PARENT_SCOPE)
+ return()
+ endif ()
+
+
+ string(REPLACE "${CMAKE_CURRENT_BINARY_DIR}/" "" FILE "${FILE}")
+ if(IS_ABSOLUTE ${FILE})
+ file(RELATIVE_PATH FILE ${CMAKE_CURRENT_SOURCE_DIR} ${FILE})
+ endif()
+
+ # get the right path for file
+ string(REPLACE ".." "__" PATH "${FILE}")
+
+ set(${RETURN_VAR} "${PATH}" PARENT_SCOPE)
+endfunction()
+
+
+
+
+# Add coverage support for target ${TNAME} and register target for coverage
+# evaluation.
+function(add_coverage_target TNAME)
+ # Check if all sources for target use the same compiler. If a target uses
+ # e.g. C and Fortran mixed and uses different compilers (e.g. clang and
+ # gfortran) this can trigger huge problems, because different compilers may
+ # use different implementations for code coverage.
+ get_target_property(TSOURCES ${TNAME} SOURCES)
+ set(TARGET_COMPILER "")
+ set(ADDITIONAL_FILES "")
+ foreach (FILE ${TSOURCES})
+ # If expression was found, FILE is a generator-expression for an object
+ # library. Object libraries will be ignored.
+ string(REGEX MATCH "TARGET_OBJECTS:([^ >]+)" _file ${FILE})
+ if ("${_file}" STREQUAL "")
+ codecov_lang_of_source(${FILE} LANG)
+ if (LANG)
+ list(APPEND TARGET_COMPILER ${CMAKE_${LANG}_COMPILER_ID})
+
+ list(APPEND ADDITIONAL_FILES "${FILE}.gcno")
+ list(APPEND ADDITIONAL_FILES "${FILE}.gcda")
+ endif ()
+ endif ()
+ endforeach ()
+
+ list(REMOVE_DUPLICATES TARGET_COMPILER)
+ list(LENGTH TARGET_COMPILER NUM_COMPILERS)
+
+ if (NUM_COMPILERS GREATER 1)
+ message(WARNING "Can't use code coverage for target ${TNAME}, because "
+ "it will be compiled by incompatible compilers. Target will be "
+ "compiled without code coverage.")
+ return()
+
+ elseif (NUM_COMPILERS EQUAL 0)
+ message(WARNING "Can't use code coverage for target ${TNAME}, because "
+ "it uses an unknown compiler. Target will be compiled without "
+ "code coverage.")
+ return()
+
+ elseif (NOT DEFINED "COVERAGE_${TARGET_COMPILER}_FLAGS")
+ # A warning has been printed before, so just return if flags for this
+ # compiler aren't available.
+ return()
+ endif()
+
+
+ # enable coverage for target
+ set_property(TARGET ${TNAME} APPEND_STRING
+ PROPERTY COMPILE_FLAGS " ${COVERAGE_${TARGET_COMPILER}_FLAGS}")
+ set_property(TARGET ${TNAME} APPEND_STRING
+ PROPERTY LINK_FLAGS " ${COVERAGE_${TARGET_COMPILER}_FLAGS}")
+
+
+ # Add gcov files generated by compiler to clean target.
+ set(CLEAN_FILES "")
+ foreach (FILE ${ADDITIONAL_FILES})
+ codecov_path_of_source(${FILE} FILE)
+ list(APPEND CLEAN_FILES "CMakeFiles/${TNAME}.dir/${FILE}")
+ endforeach()
+
+ set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
+ "${CLEAN_FILES}")
+
+
+ add_gcov_target(${TNAME})
+ add_lcov_target(${TNAME})
+endfunction(add_coverage_target)
+
+
+
+
+# Include modules for parsing the collected data and output it in a readable
+# format (like gcov and lcov).
+find_package(Gcov)
+find_package(Lcov)
diff --git a/CMake/llvm-cov-wrapper b/CMake/llvm-cov-wrapper
new file mode 100755
index 0000000..2ac3310
--- /dev/null
+++ b/CMake/llvm-cov-wrapper
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+# This file is part of CMake-codecov.
+#
+# Copyright (c)
+# 2015-2017 RWTH Aachen University, Federal Republic of Germany
+#
+# See the LICENSE file in the package base directory for details
+#
+# Written by Alexander Haase, alexander.haase@rwth-aachen.de
+#
+
+if [ -z "$LLVM_COV_BIN" ]
+then
+ echo "LLVM_COV_BIN not set!" >& 2
+ exit 1
+fi
+
+
+# Get LLVM version to find out.
+LLVM_VERSION=$($LLVM_COV_BIN -version | grep -i "LLVM version" \
+ | sed "s/^\([A-Za-z ]*\)\([0-9]\).\([0-9]\).*$/\2.\3/g")
+
+if [ "$1" = "-v" ]
+then
+ echo "llvm-cov-wrapper $LLVM_VERSION"
+ exit 0
+fi
+
+
+if [ -n "$LLVM_VERSION" ]
+then
+ MAJOR=$(echo $LLVM_VERSION | cut -d'.' -f1)
+ MINOR=$(echo $LLVM_VERSION | cut -d'.' -f2)
+
+ if [ $MAJOR -eq 3 ] && [ $MINOR -le 4 ]
+ then
+ if [ -f "$1" ]
+ then
+ filename=$(basename "$1")
+ extension="${filename##*.}"
+
+ case "$extension" in
+ "gcno") exec $LLVM_COV_BIN --gcno="$1" ;;
+ "gcda") exec $LLVM_COV_BIN --gcda="$1" ;;
+ esac
+ fi
+ fi
+
+ if [ $MAJOR -eq 3 ] && [ $MINOR -le 5 ]
+ then
+ exec $LLVM_COV_BIN $@
+ fi
+fi
+
+exec $LLVM_COV_BIN gcov $@
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..19472de
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,407 @@
+cmake_minimum_required(VERSION 3.0)
+
+# detect if Catch is being bundled,
+# disable testsuite in that case
+if(NOT DEFINED PROJECT_NAME)
+ set(NOT_SUBPROJECT ON)
+endif()
+
+project(Catch2 LANGUAGES CXX VERSION 2.1.1)
+
+include(GNUInstallDirs)
+
+option(CATCH_USE_VALGRIND "Perform SelfTests with Valgrind" OFF)
+option(CATCH_BUILD_EXAMPLES "Build documentation examples" OFF)
+option(CATCH_ENABLE_COVERAGE "Generate coverage for codecov.io" OFF)
+option(CATCH_ENABLE_WERROR "Enable all warnings as errors" ON)
+
+set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+
+# define some folders
+set(CATCH_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+set(SELF_TEST_DIR ${CATCH_DIR}/projects/SelfTest)
+set(BENCHMARK_DIR ${CATCH_DIR}/projects/Benchmark)
+set(HEADER_DIR ${CATCH_DIR}/include)
+
+if(USE_WMAIN)
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:wmainCRTStartup")
+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_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_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_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_string.cpp
+ ${HEADER_DIR}/internal/catch_message.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_multi.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_multi.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)
+ 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)
+ 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 desired warnings
+ 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 warning go here
+ if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
+ # Actually keep these
+ 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()
+ 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")
+
+ add_test(NAME ListTags COMMAND $<TARGET_FILE:SelfTest> --list-tags)
+ set_tests_properties(ListTags PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ tags")
+
+ 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")
+
+
+
+ # 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)
+ add_subdirectory(examples)
+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()
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 0000000..be1a688
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,46 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at github@philnash.me. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
+
+[homepage]: http://contributor-covenant.org
+[version]: http://contributor-covenant.org/version/1/4/
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..36b7cd9
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,23 @@
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..1c2c03b
--- /dev/null
+++ b/README.md
@@ -0,0 +1,36 @@
+<a id="top"></a>
+
+
+[](https://github.com/catchorg/catch2/releases)
+[](https://travis-ci.org/catchorg/Catch2)
+[](https://ci.appveyor.com/project/catchorg/catch2)
+[](https://codecov.io/gh/catchorg/Catch2)
+[](https://wandbox.org/permlink/TpIcJaLaH4WrKlhS)
+
+<a href="https://github.com/catchorg/Catch2/releases/download/v2.1.1/catch.hpp">The latest version of the single header can be downloaded directly using this link</a>
+
+## Catch2 is released!
+
+If you've been using an earlier version of Catch, please see the
+Breaking Changes section of [the release notes](https://github.com/catchorg/Catch2/releases/tag/v2.0.1)
+before moving to Catch2. You might also like to read [this blog post](http://www.levelofindirection.com/journal/2017/11/3/catch2-released.html) for more details.
+
+## What's the Catch?
+
+Catch2 stands for C++ Automated Test Cases in a Header and is a
+multi-paradigm test framework for C++. which also supports Objective-C
+(and maybe C).
+It is primarily distributed as a single header file, although certain
+extensions may require additional headers.
+
+## How to use it
+This documentation comprises these three parts:
+
+* [Why do we need yet another C++ Test Framework?](docs/why-catch.md#top)
+* [Tutorial](docs/tutorial.md#top) - getting started
+* [Reference section](docs/Readme.md#top) - all the details
+
+## More
+* Issues and bugs can be raised on the [Issue tracker on GitHub](https://github.com/catchorg/Catch2/issues)
+* For discussion or questions please use [the dedicated Google Groups forum](https://groups.google.com/forum/?fromgroups#!forum/catch-forum)
+* See [who else is using Catch2](docs/opensource-users.md#top)
diff --git a/appveyor.yml b/appveyor.yml
new file mode 100644
index 0000000..2d68172
--- /dev/null
+++ b/appveyor.yml
@@ -0,0 +1,63 @@
+# version string format -- This will be overwritten later anyway
+version: "{build}"
+
+branches:
+ except:
+ - /dev-travis.+/
+
+os:
+ - Visual Studio 2017
+ - Visual Studio 2015
+
+environment:
+ matrix:
+ - additional_flags: "/permissive- /std:c++latest"
+ wmain: 0
+
+ - additional_flags: ""
+ wmain: 0
+
+ - additional_flags: "/D_UNICODE /DUNICODE"
+ wmain: 1
+
+matrix:
+ exclude:
+ - os: Visual Studio 2015
+ additional_flags: "/permissive- /std:c++latest"
+
+init:
+ - git config --global core.autocrlf input
+
+install:
+ - ps: if (($env:CONFIGURATION) -eq "Debug" ) { python -m pip install codecov }
+ - ps: if (($env:CONFIGURATION) -eq "Debug" ) { .\misc\installOpenCppCoverage.ps1 }
+
+# Win32 and x64 are CMake-compatible solution platform names.
+# This allows us to pass %PLATFORM% to CMake -A.
+platform:
+ - Win32
+ - x64
+
+# build Configurations, i.e. Debug, Release, etc.
+configuration:
+ - Debug
+ - Release
+
+#Cmake will autodetect the compiler, but we set the arch
+before_build:
+ - set CXXFLAGS=%additional_flags%
+ # 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
+
+
+# build with MSBuild
+build:
+ project: Build\Catch2.sln # path to Visual Studio solution or project
+ parallel: true # enable MSBuild parallel builds
+ verbosity: normal # MSBuild verbosity level {quiet|minimal|normal|detailed}
+
+test_script:
+ - set CTEST_OUTPUT_ON_FAILURE=1
+ - cmd: .\misc\appveyorTestRunScript.bat
diff --git a/artwork/catch2-c-logo.png b/artwork/catch2-c-logo.png
new file mode 100644
index 0000000..bab400f
--- /dev/null
+++ b/artwork/catch2-c-logo.png
Binary files differ
diff --git a/artwork/catch2-hand-logo.png b/artwork/catch2-hand-logo.png
new file mode 100644
index 0000000..5a5e142
--- /dev/null
+++ b/artwork/catch2-hand-logo.png
Binary files differ
diff --git a/artwork/catch2-logo-small.png b/artwork/catch2-logo-small.png
new file mode 100644
index 0000000..f2118be
--- /dev/null
+++ b/artwork/catch2-logo-small.png
Binary files differ
diff --git a/catch.pc.in b/catch.pc.in
new file mode 100644
index 0000000..abd0b66
--- /dev/null
+++ b/catch.pc.in
@@ -0,0 +1,6 @@
+includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
+
+Name: Catch
+Description: Testing library for C++
+Version: @Catch2_VERSION@
+Cflags: -I${includedir}
diff --git a/codecov.yml b/codecov.yml
new file mode 100644
index 0000000..7fd12df
--- /dev/null
+++ b/codecov.yml
@@ -0,0 +1,22 @@
+coverage:
+ precision: 2
+ round: nearest
+ range: "60...90"
+ status:
+ project:
+ default:
+ threshold: 2%
+
+codecov:
+ branch: master
+
+comment:
+ layout: "diff"
+
+coverage:
+ ignore:
+ - "projects/SelfTest"
+ - "**/catch_reporter_tap.hpp"
+ - "**/catch_reporter_automake.hpp"
+ - "**/catch_reporter_teamcity.hpp"
+ - "**/external/clara.hpp"
diff --git a/conanfile.py b/conanfile.py
new file mode 100644
index 0000000..fa9fdce
--- /dev/null
+++ b/conanfile.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+from conans import ConanFile
+
+
+class CatchConan(ConanFile):
+ name = "Catch"
+ version = "2.1.1"
+ description = "A modern, C++-native, header-only, framework for unit-tests, TDD and BDD"
+ author = "philsquared"
+ generators = "cmake"
+ exports_sources = "single_include/*"
+ url = "https://github.com/philsquared/Catch"
+ license = "Boost Software License - Version 1.0. http://www.boost.org/LICENSE_1_0.txt"
+
+ def package(self):
+ self.copy(pattern="catch.hpp", src="single_include", dst="include")
+
+ def package_id(self):
+ self.info.header_only()
diff --git a/contrib/Catch.cmake b/contrib/Catch.cmake
new file mode 100644
index 0000000..486e323
--- /dev/null
+++ b/contrib/Catch.cmake
@@ -0,0 +1,175 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+#[=======================================================================[.rst:
+Catch
+-----
+
+This module defines a function to help use the Catch test framework.
+
+The :command:`catch_discover_tests` discovers tests by asking the compiled test
+executable to enumerate its tests. This does not require CMake to be re-run
+when tests change. However, it may not work in a cross-compiling environment,
+and setting test properties is less convenient.
+
+This command is intended to replace use of :command:`add_test` to register
+tests, and will create a separate CTest test for each Catch test case. Note
+that this is in some cases less efficient, as common set-up and tear-down logic
+cannot be shared by multiple test cases executing in the same instance.
+However, it provides more fine-grained pass/fail information to CTest, which is
+usually considered as more beneficial. By default, the CTest test name is the
+same as the Catch name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``.
+
+.. command:: catch_discover_tests
+
+ Automatically add tests with CTest by querying the compiled test executable
+ for available tests::
+
+ 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]
+ )
+
+ ``catch_discover_tests`` sets up a post-build command on the test executable
+ that generates the list of tests by parsing the output from running the test
+ with the ``--list-test-names-only`` argument. This ensures that the full
+ list of tests is obtained. Since test discovery occurs at build time, it is
+ not necessary to re-run CMake when the list of tests changes.
+ However, it requires that :prop_tgt:`CROSSCOMPILING_EMULATOR` is properly set
+ in order to function in a cross-compiling environment.
+
+ Additionally, setting properties on tests is somewhat less convenient, since
+ the tests are not available at CMake time. Additional test properties may be
+ assigned to the set of tests as a whole using the ``PROPERTIES`` option. If
+ more fine-grained test control is needed, custom content may be provided
+ through an external CTest script using the :prop_dir:`TEST_INCLUDE_FILES`
+ directory property. The set of discovered tests is made accessible to such a
+ script via the ``<target>_TESTS`` variable.
+
+ The options are:
+
+ ``target``
+ Specifies the Catch executable, which must be a known CMake executable
+ target. CMake will substitute the location of the built executable when
+ running the test.
+
+ ``TEST_SPEC arg1...``
+ Specifies test cases, wildcarded test cases, tags and tag expressions to
+ pass to the Catch executable with the ``--list-test-names-only`` argument.
+
+ ``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 prepended 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()`` but with different
+ ``TEST_SPEC`` or ``EXTRA_ARGS``.
+
+ ``TEST_SUFFIX suffix``
+ Similar to ``TEST_PREFIX`` except the ``suffix`` is appended to the name of
+ every discovered test case. Both ``TEST_PREFIX`` and ``TEST_SUFFIX`` may
+ be specified.
+
+ ``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.
+
+#]=======================================================================]
+
+#------------------------------------------------------------------------------
+function(catch_discover_tests TARGET)
+ cmake_parse_arguments(
+ ""
+ ""
+ "TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST"
+ "TEST_SPEC;EXTRA_ARGS;PROPERTIES"
+ ${ARGN}
+ )
+
+ if(NOT _WORKING_DIRECTORY)
+ set(_WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
+ endif()
+ if(NOT _TEST_LIST)
+ set(_TEST_LIST ${TARGET}_TESTS)
+ endif()
+
+ ## Generate a unique name based on the extra arguments
+ string(SHA1 args_hash "${_TEST_SPEC} ${_EXTRA_ARGS}")
+ string(SUBSTRING ${args_hash} 0 7 args_hash)
+
+ # Define rule to generate test list for aforementioned test executable
+ set(ctest_include_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_include-${args_hash}.cmake")
+ set(ctest_tests_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_tests-${args_hash}.cmake")
+ get_property(crosscompiling_emulator
+ TARGET ${TARGET}
+ PROPERTY CROSSCOMPILING_EMULATOR
+ )
+ add_custom_command(
+ TARGET ${TARGET} POST_BUILD
+ BYPRODUCTS "${ctest_tests_file}"
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_TARGET=${TARGET}"
+ -D "TEST_EXECUTABLE=$<TARGET_FILE:${TARGET}>"
+ -D "TEST_EXECUTOR=${crosscompiling_emulator}"
+ -D "TEST_WORKING_DIR=${_WORKING_DIRECTORY}"
+ -D "TEST_SPEC=${_TEST_SPEC}"
+ -D "TEST_EXTRA_ARGS=${_EXTRA_ARGS}"
+ -D "TEST_PROPERTIES=${_PROPERTIES}"
+ -D "TEST_PREFIX=${_TEST_PREFIX}"
+ -D "TEST_SUFFIX=${_TEST_SUFFIX}"
+ -D "TEST_LIST=${_TEST_LIST}"
+ -D "CTEST_FILE=${ctest_tests_file}"
+ -P "${_CATCH_DISCOVER_TESTS_SCRIPT}"
+ VERBATIM
+ )
+
+ file(WRITE "${ctest_include_file}"
+ "if(EXISTS \"${ctest_tests_file}\")\n"
+ " include(\"${ctest_tests_file}\")\n"
+ "else()\n"
+ " add_test(${TARGET}_NOT_BUILT-${args_hash} ${TARGET}_NOT_BUILT-${args_hash})\n"
+ "endif()\n"
+ )
+
+ if(NOT ${CMAKE_VERSION} VERSION_LESS "3.10.0")
+ # Add discovered tests to directory TEST_INCLUDE_FILES
+ set_property(DIRECTORY
+ APPEND PROPERTY TEST_INCLUDE_FILES "${ctest_include_file}"
+ )
+ else()
+ # Add discovered tests as directory TEST_INCLUDE_FILE if possible
+ get_property(test_include_file_set DIRECTORY PROPERTY TEST_INCLUDE_FILE SET)
+ if (NOT ${test_include_file_set})
+ set_property(DIRECTORY
+ PROPERTY TEST_INCLUDE_FILE "${ctest_include_file}"
+ )
+ else()
+ message(FATAL_ERROR
+ "Cannot set more than one TEST_INCLUDE_FILE"
+ )
+ endif()
+ endif()
+
+endfunction()
+
+###############################################################################
+
+set(_CATCH_DISCOVER_TESTS_SCRIPT
+ ${CMAKE_CURRENT_LIST_DIR}/CatchAddTests.cmake
+)
diff --git a/contrib/CatchAddTests.cmake b/contrib/CatchAddTests.cmake
new file mode 100644
index 0000000..c68921e
--- /dev/null
+++ b/contrib/CatchAddTests.cmake
@@ -0,0 +1,77 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+set(prefix "${TEST_PREFIX}")
+set(suffix "${TEST_SUFFIX}")
+set(spec ${TEST_SPEC})
+set(extra_args ${TEST_EXTRA_ARGS})
+set(properties ${TEST_PROPERTIES})
+set(script)
+set(suite)
+set(tests)
+
+function(add_command NAME)
+ set(_args "")
+ foreach(_arg ${ARGN})
+ if(_arg MATCHES "[^-./:a-zA-Z0-9_]")
+ set(_args "${_args} [==[${_arg}]==]") # form a bracket_argument
+ else()
+ set(_args "${_args} ${_arg}")
+ endif()
+ endforeach()
+ set(script "${script}${NAME}(${_args})\n" PARENT_SCOPE)
+endfunction()
+
+# Run test executable to get list of available tests
+if(NOT EXISTS "${TEST_EXECUTABLE}")
+ message(FATAL_ERROR
+ "Specified test executable '${TEST_EXECUTABLE}' does not exist"
+ )
+endif()
+execute_process(
+ COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} --list-test-names-only
+ OUTPUT_VARIABLE output
+ RESULT_VARIABLE result
+)
+# Catch --list-test-names-only reports the number of tests, so 0 is... surprising
+if(${result} EQUAL 0)
+ message(WARNING
+ "Test executable '${TEST_EXECUTABLE}' contains no tests!\n"
+ )
+elseif(${result} LESS 0)
+ message(FATAL_ERROR
+ "Error running test executable '${TEST_EXECUTABLE}':\n"
+ " Result: ${result}\n"
+ " Output: ${output}\n"
+ )
+endif()
+
+string(REPLACE "\n" ";" output "${output}")
+
+# Parse output
+foreach(line ${output})
+ # Test name; strip spaces to get just the name...
+ string(REGEX REPLACE " +" "" test "${line}")
+ # ...and add to script
+ add_command(add_test
+ "${prefix}${test}${suffix}"
+ ${TEST_EXECUTOR}
+ "${TEST_EXECUTABLE}"
+ "${test}"
+ ${extra_args}
+ )
+ add_command(set_tests_properties
+ "${prefix}${test}${suffix}"
+ PROPERTIES
+ WORKING_DIRECTORY "${TEST_WORKING_DIR}"
+ ${properties}
+ )
+ list(APPEND tests "${prefix}${test}${suffix}")
+endforeach()
+
+# Create a list of all discovered tests, which users may use to e.g. set
+# properties on the tests
+add_command(set ${TEST_LIST} ${tests})
+
+# Write CTest script
+file(WRITE "${CTEST_FILE}" "${script}")
diff --git a/contrib/ParseAndAddCatchTests.cmake b/contrib/ParseAndAddCatchTests.cmake
new file mode 100644
index 0000000..cb2846d
--- /dev/null
+++ b/contrib/ParseAndAddCatchTests.cmake
@@ -0,0 +1,185 @@
+#==================================================================================================#
+# supported macros #
+# - TEST_CASE, #
+# - SCENARIO, #
+# - TEST_CASE_METHOD, #
+# - CATCH_TEST_CASE, #
+# - CATCH_SCENARIO, #
+# - CATCH_TEST_CASE_METHOD. #
+# #
+# Usage #
+# 1. make sure this module is in the path or add this otherwise: #
+# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake.modules/") #
+# 2. make sure that you've enabled testing option for the project by the call: #
+# enable_testing() #
+# 3. add the lines to the script for testing target (sample CMakeLists.txt): #
+# project(testing_target) #
+# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake.modules/") #
+# enable_testing() #
+# #
+# find_path(CATCH_INCLUDE_DIR "catch.hpp") #
+# include_directories(${INCLUDE_DIRECTORIES} ${CATCH_INCLUDE_DIR}) #
+# #
+# file(GLOB SOURCE_FILES "*.cpp") #
+# add_executable(${PROJECT_NAME} ${SOURCE_FILES}) #
+# #
+# include(ParseAndAddCatchTests) #
+# ParseAndAddCatchTests(${PROJECT_NAME}) #
+# #
+# The following variables affect the behavior of the script: #
+# #
+# PARSE_CATCH_TESTS_VERBOSE (Default OFF) #
+# -- enables debug messages #
+# PARSE_CATCH_TESTS_NO_HIDDEN_TESTS (Default OFF) #
+# -- excludes tests marked with [!hide], [.] or [.foo] tags #
+# PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME (Default ON) #
+# -- adds fixture class name to the test name #
+# PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME (Default ON) #
+# -- adds cmake target name to the test name #
+# PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS (Default OFF) #
+# -- causes CMake to rerun when file with tests changes so that new tests will be discovered #
+# #
+#==================================================================================================#
+
+cmake_minimum_required(VERSION 2.8.8)
+
+option(PARSE_CATCH_TESTS_VERBOSE "Print Catch to CTest parser debug messages" OFF)
+option(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS "Exclude tests with [!hide], [.] or [.foo] tags" OFF)
+option(PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME "Add fixture class name to the test name" ON)
+option(PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME "Add target name to the test name" ON)
+option(PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS "Add test file to CMAKE_CONFIGURE_DEPENDS property" OFF)
+
+function(PrintDebugMessage)
+ if(PARSE_CATCH_TESTS_VERBOSE)
+ message(STATUS "ParseAndAddCatchTests: ${ARGV}")
+ endif()
+endfunction()
+
+# This removes the contents between
+# - block comments (i.e. /* ... */)
+# - full line comments (i.e. // ... )
+# contents have been read into '${CppCode}'.
+# !keep partial line comments
+function(RemoveComments CppCode)
+ string(ASCII 2 CMakeBeginBlockComment)
+ string(ASCII 3 CMakeEndBlockComment)
+ string(REGEX REPLACE "/\\*" "${CMakeBeginBlockComment}" ${CppCode} "${${CppCode}}")
+ string(REGEX REPLACE "\\*/" "${CMakeEndBlockComment}" ${CppCode} "${${CppCode}}")
+ string(REGEX REPLACE "${CMakeBeginBlockComment}[^${CMakeEndBlockComment}]*${CMakeEndBlockComment}" "" ${CppCode} "${${CppCode}}")
+ string(REGEX REPLACE "\n[ \t]*//+[^\n]+" "\n" ${CppCode} "${${CppCode}}")
+
+ set(${CppCode} "${${CppCode}}" PARENT_SCOPE)
+endfunction()
+
+# Worker function
+function(ParseFile SourceFile TestTarget)
+ # According to CMake docs EXISTS behavior is well-defined only for full paths.
+ get_filename_component(SourceFile ${SourceFile} ABSOLUTE)
+ if(NOT EXISTS ${SourceFile})
+ message(WARNING "Cannot find source file: ${SourceFile}")
+ return()
+ endif()
+ PrintDebugMessage("parsing ${SourceFile}")
+ file(STRINGS ${SourceFile} Contents NEWLINE_CONSUME)
+
+ # Remove block and fullline comments
+ RemoveComments(Contents)
+
+ # Find definition of test names
+ string(REGEX MATCHALL "[ \t]*(CATCH_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)[ \t]*\\([^\)]+\\)+[ \t\n]*{+[ \t]*(//[^\n]*[Tt][Ii][Mm][Ee][Oo][Uu][Tt][ \t]*[0-9]+)*" Tests "${Contents}")
+
+ if(PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS AND Tests)
+ PrintDebugMessage("Adding ${SourceFile} to CMAKE_CONFIGURE_DEPENDS property")
+ set_property(
+ DIRECTORY
+ APPEND
+ PROPERTY CMAKE_CONFIGURE_DEPENDS ${SourceFile}
+ )
+ endif()
+
+ foreach(TestName ${Tests})
+ # Strip newlines
+ string(REGEX REPLACE "\\\\\n|\n" "" TestName "${TestName}")
+
+ # Get test type and fixture if applicable
+ string(REGEX MATCH "(CATCH_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)[ \t]*\\([^,^\"]*" TestTypeAndFixture "${TestName}")
+ string(REGEX MATCH "(CATCH_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)" TestType "${TestTypeAndFixture}")
+ string(REPLACE "${TestType}(" "" TestFixture "${TestTypeAndFixture}")
+
+ # Get string parts of test definition
+ string(REGEX MATCHALL "\"+([^\\^\"]|\\\\\")+\"+" TestStrings "${TestName}")
+
+ # Strip wrapping quotation marks
+ string(REGEX REPLACE "^\"(.*)\"$" "\\1" TestStrings "${TestStrings}")
+ string(REPLACE "\";\"" ";" TestStrings "${TestStrings}")
+
+ # Validate that a test name and tags have been provided
+ list(LENGTH TestStrings TestStringsLength)
+ if(TestStringsLength GREATER 2 OR TestStringsLength LESS 1)
+ message(FATAL_ERROR "You must provide a valid test name and tags for all tests in ${SourceFile}")
+ endif()
+
+ # Assign name and tags
+ list(GET TestStrings 0 Name)
+ if("${TestType}" STREQUAL "SCENARIO")
+ set(Name "Scenario: ${Name}")
+ endif()
+ if(PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME AND TestFixture)
+ set(CTestName "${TestFixture}:${Name}")
+ else()
+ set(CTestName "${Name}")
+ endif()
+ if(PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME)
+ set(CTestName "${TestTarget}:${CTestName}")
+ endif()
+ # add target to labels to enable running all tests added from this target
+ set(Labels ${TestTarget})
+ if(TestStringsLength EQUAL 2)
+ list(GET TestStrings 1 Tags)
+ string(TOLOWER "${Tags}" Tags)
+ # remove target from labels if the test is hidden
+ if("${Tags}" MATCHES ".*\\[!?(hide|\\.)\\].*")
+ list(REMOVE_ITEM Labels ${TestTarget})
+ endif()
+ string(REPLACE "]" ";" Tags "${Tags}")
+ string(REPLACE "[" "" Tags "${Tags}")
+ endif()
+
+ list(APPEND Labels ${Tags})
+
+ list(FIND Labels "!hide" IndexOfHideLabel)
+ set(HiddenTagFound OFF)
+ foreach(label ${Labels})
+ string(REGEX MATCH "^!hide|^\\." result ${label})
+ if(result)
+ set(HiddenTagFound ON)
+ break()
+ endif(result)
+ endforeach(label)
+ if(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS AND ${HiddenTagFound})
+ PrintDebugMessage("Skipping test \"${CTestName}\" as it has [!hide], [.] or [.foo] label")
+ else()
+ PrintDebugMessage("Adding test \"${CTestName}\"")
+ if(Labels)
+ PrintDebugMessage("Setting labels to ${Labels}")
+ endif()
+
+ # Add the test and set its properties
+ add_test(NAME "\"${CTestName}\"" COMMAND ${TestTarget} ${Name} ${AdditionalCatchParameters})
+ set_tests_properties("\"${CTestName}\"" PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran"
+ LABELS "${Labels}")
+ endif()
+
+ endforeach()
+endfunction()
+
+# entry point
+function(ParseAndAddCatchTests TestTarget)
+ PrintDebugMessage("Started parsing ${TestTarget}")
+ get_target_property(SourceFiles ${TestTarget} SOURCES)
+ PrintDebugMessage("Found the following sources: ${SourceFiles}")
+ foreach(SourceFile ${SourceFiles})
+ ParseFile(${SourceFile} ${TestTarget})
+ endforeach()
+ PrintDebugMessage("Finished parsing ${TestTarget}")
+endfunction()
diff --git a/docs/Readme.md b/docs/Readme.md
new file mode 100644
index 0000000..be7d1cd
--- /dev/null
+++ b/docs/Readme.md
@@ -0,0 +1,33 @@
+<a id="top"></a>
+# Reference
+
+To get the most out of Catch2, start with the [tutorial](tutorial.md#top).
+Once you're up and running consider the following reference material.
+
+Writing tests:
+* [Assertion macros](assertions.md#top)
+* [Matchers](matchers.md#top)
+* [Logging macros](logging.md#top)
+* [Test cases and sections](test-cases-and-sections.md#top)
+* [Test fixtures](test-fixtures.md#top)
+* [Reporters](reporters.md#top)
+* [Event Listeners](event-listeners.md#top)
+
+Fine tuning:
+* [Supplying your own main()](own-main.md#top)
+* [Compile-time configuration](configuration.md#top)
+* [String Conversions](tostring.md#top)
+
+Running:
+* [Command line](command-line.md#top)
+* [CI and Build system integration](build-systems.md#top)
+
+FAQ:
+* [Why are my tests slow to compile?](slow-compiles.md#top)
+* [Known limitations](limitations.md#top)
+
+Other:
+* [Why Catch?](why-catch.md#top)
+* [Open Source Projects using Catch](opensource-users.md#top)
+* [Contributing](contributing.md#top)
+* [Release Notes](release-notes.md#top)
diff --git a/docs/assertions.md b/docs/assertions.md
new file mode 100644
index 0000000..ece4e10
--- /dev/null
+++ b/docs/assertions.md
@@ -0,0 +1,160 @@
+<a id="top"></a>
+# Assertion Macros
+
+**Contents**<br>
+[Natural Expressions](#natural-expressions)<br>
+[Exceptions](#exceptions)<br>
+[Matcher expressions](#matcher-expressions)<br>
+[Thread Safety](#thread-safety)<br>
+
+Most test frameworks have a large collection of assertion macros to capture all possible conditional forms (```_EQUALS```, ```_NOTEQUALS```, ```_GREATER_THAN``` etc).
+
+Catch is different. Because it decomposes natural C-style conditional expressions most of these forms are reduced to one or two that you will use all the time. That said there are a rich set of auxilliary macros as well. We'll describe all of these here.
+
+Most of these macros come in two forms:
+
+## Natural Expressions
+
+The ```REQUIRE``` family of macros tests an expression and aborts the test case if it fails.
+The ```CHECK``` family are equivalent but execution continues in the same test case even if the assertion fails. This is useful if you have a series of essentially orthogonal assertions and it is useful to see all the results rather than stopping at the first failure.
+
+* **REQUIRE(** _expression_ **)** and
+* **CHECK(** _expression_ **)**
+
+Evaluates the expression and records the result. If an exception is thrown, it is caught, reported, and counted as a failure. These are the macros you will use most of the time.
+
+Examples:
+```
+CHECK( str == "string value" );
+CHECK( thisReturnsTrue() );
+REQUIRE( i == 42 );
+```
+
+* **REQUIRE_FALSE(** _expression_ **)** and
+* **CHECK_FALSE(** _expression_ **)**
+
+Evaluates the expression and records the _logical NOT_ of the result. If an exception is thrown it is caught, reported, and counted as a failure.
+(these forms exist as a workaround for the fact that ! prefixed expressions cannot be decomposed).
+
+Example:
+```
+REQUIRE_FALSE( thisReturnsFalse() );
+```
+
+Do note that "overly complex" expressions cannot be decomposed and thus will not compile. This is done partly for practical reasons (to keep the underlying expression template machinery to minimum) and partly for philosophical reasons (assertions should be simple and deterministic).
+
+Examples:
+* `CHECK(a == 1 && b == 2);`
+This expression is too complex because of the `&&` operator. If you want to check that 2 or more properties hold, you can either put the expression into parenthesis, which stops decomposition from working, or you need to decompose the expression into two assertions: `CHECK( a == 1 ); CHECK( b == 2);`
+* `CHECK( a == 2 || b == 1 );`
+This expression is too complex because of the `||` operator. If you want to check that one of several properties hold, you can put the expression into parenthesis (unlike with `&&`, expression decomposition into several `CHECK`s is not possible).
+
+
+### Floating point comparisons
+
+When comparing floating point numbers - especially if at least one of them has been computed - great care must be taken to allow for rounding errors and inexact representations.
+
+Catch provides a way to perform tolerant comparisons of floating point values through use of a wrapper class called ```Approx```. ```Approx``` can be used on either side of a comparison expression. It overloads the comparisons operators to take a tolerance into account. Here's a simple example:
+
+```
+REQUIRE( performComputation() == Approx( 2.1 ) );
+```
+
+This way `Approx` is constructed with reasonable defaults, covering most simple cases of rounding errors. If these are insufficient, each `Approx` instance has 3 tuning knobs, that can be used to customize it for your computation.
+
+* __epsilon__ - epsilon serves to set the percentage by which a result can be erroneous, before it is rejected. By default set to `std::numeric_limits<float>::epsilon()*100`.
+* __margin__ - margin serves to set the the absolute value by which a result can be erroneous before it is rejected. By default set to `0.0`.
+* __scale__ - scale serves to adjust the epsilon's multiplicator. By default set to `0.0`.
+
+#### epsilon example
+```cpp
+Approx target = Approx(100).epsilon(0.01);
+100.0 == target; // Obviously true
+200.0 == target; // Obviously still false
+100.5 == target; // True, because we set target to allow up to 1% error
+```
+
+#### margin example
+_Margin check is used only if the relative (epsilon and scale based) check fails._
+```cpp
+Approx target = Approx(100).margin(5);
+100.0 == target; // Obviously true
+200.0 == target; // Obviously still false
+104.0 == target; // True, because we set target to allow absolute error up to 5
+```
+
+#### scale
+Scale can be useful if the computation leading to the result worked
+on different scale than is used by the results. Since allowed difference
+between Approx's value and compared value is based primarily on Approx's value
+(the allowed difference is computed as
+`(Approx::scale + Approx::value) * epsilon`), the resulting comparison could
+need rescaling to be correct.
+
+
+## Exceptions
+
+* **REQUIRE_NOTHROW(** _expression_ **)** and
+* **CHECK_NOTHROW(** _expression_ **)**
+
+Expects that no exception is thrown during evaluation of the expression.
+
+* **REQUIRE_THROWS(** _expression_ **)** and
+* **CHECK_THROWS(** _expression_ **)**
+
+Expects that an exception (of any type) is be thrown during evaluation of the expression.
+
+* **REQUIRE_THROWS_AS(** _expression_, _exception type_ **)** and
+* **CHECK_THROWS_AS(** _expression_, _exception type_ **)**
+
+Expects that an exception of the _specified type_ is thrown during evaluation of the expression. Note that the _exception type_ is extended with `const&` and you should not include it yourself.
+
+* **REQUIRE_THROWS_WITH(** _expression_, _string or string matcher_ **)** and
+* **CHECK_THROWS_WITH(** _expression_, _string or string matcher_ **)**
+
+Expects that an exception is thrown that, when converted to a string, matches the _string_ or _string matcher_ provided (see next section for Matchers).
+
+e.g.
+```cpp
+REQUIRE_THROWS_WITH( openThePodBayDoors(), Contains( "afraid" ) && Contains( "can't do that" ) );
+REQUIRE_THROWS_WITH( dismantleHal(), "My mind is going" );
+```
+
+* **REQUIRE_THROWS_MATCHES(** _expression_, _exception type_, _matcher for given exception type_ **)** and
+* **CHECK_THROWS_MATCHES(** _expression_, _exception type_, _matcher for given exception type_ **)**
+
+Expects that exception of _exception type_ is thrown and it matches provided matcher (see next section for Matchers).
+
+
+_Please note that the `THROW` family of assertions expects to be passed a single expression, not a statement or series of statements. If you want to check a more complicated sequence of operations, you can use a C++11 lambda function._
+
+```cpp
+REQUIRE_NOTHROW([&](){
+ int i = 1;
+ int j = 2;
+ auto k = i + j;
+ if (k == 3) {
+ throw 1;
+ }
+}());
+```
+
+
+
+## Matcher expressions
+
+To support Matchers a slightly different form is used. Matchers have [their own documentation](matchers.md#top).
+
+* **REQUIRE_THAT(** _lhs_, _matcher expression_ **)** and
+* **CHECK_THAT(** _lhs_, _matcher expression_ **)**
+
+Matchers can be composed using `&&`, `||` and `!` operators.
+
+## Thread Safety
+
+Currently assertions in Catch are not thread safe.
+For more details, along with workarounds, see the section on [the limitations page](limitations.md#thread-safe-assertions).
+
+---
+
+[Home](Readme.md#top)
diff --git a/docs/build-systems.md b/docs/build-systems.md
new file mode 100644
index 0000000..2873bc6
--- /dev/null
+++ b/docs/build-systems.md
@@ -0,0 +1,175 @@
+<a id="top"></a>
+# CI and build system 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.
+
+## Continuous Integration systems
+
+Probably the most important aspect to using Catch with a build server is the use of different reporters. Catch comes bundled with three reporters that should cover the majority of build servers out there - although adding more for better integration with some is always a possibility (currently we also offer TeamCity, TAP and Automake reporters).
+
+Two of these reporters are built in (XML and JUnit) and the third (TeamCity) is included as a separate header. It's possible that the other two may be split out in the future too - as that would make the core of Catch smaller for those that don't need them.
+
+### XML Reporter
+```-r xml```
+
+The XML Reporter writes in an XML format that is specific to Catch.
+
+The advantage of this format is that it corresponds well to the way Catch works (especially the more unusual features, such as nested sections) and is a fully streaming format - that is it writes output as it goes, without having to store up all its results before it can start writing.
+
+The disadvantage is that, being specific to Catch, no existing build servers understand the format natively. It can be used as input to an XSLT transformation that could convert it to, say, HTML - although this loses the streaming advantage, of course.
+
+### JUnit Reporter
+```-r junit```
+
+The JUnit Reporter writes in an XML format that mimics the JUnit ANT schema.
+
+The advantage of this format is that the JUnit Ant schema is widely understood by most build servers and so can usually be consumed with no additional work.
+
+The disadvantage is that this schema was designed to correspond to how JUnit works - and there is a significant mismatch with how Catch works. Additionally the format is not streamable (because opening elements hold counts of failed and passing tests as attributes) - so the whole test run must complete before it can be written.
+
+## Other reporters
+Other reporters are not part of the single-header distribution and need
+to be downloaded and included separately. All reporters are stored in
+`single_include` directory in the git repository, and are named
+`catch_reporter_*.hpp`. For example, to use the TeamCity reporter you
+need to download `single_include/catch_reporter_teamcity.hpp` and include
+it after Catch itself.
+
+```cpp
+#define CATCH_CONFIG_MAIN
+#include "catch.hpp"
+#include "catch_reporter_teamcity.hpp"
+```
+
+### TeamCity Reporter
+```-r teamcity```
+
+The TeamCity Reporter writes TeamCity service messages to stdout. In order to be able to use this reporter an additional header must also be included.
+
+Being specific to TeamCity this is the best reporter to use with it - but it is completely unsuitable for any other purpose. It is a streaming format (it writes as it goes) - although test results don't appear in the TeamCity interface until the completion of a suite (usually the whole test run).
+
+### Automake Reporter
+```-r automake```
+
+The Automake Reporter writes out the [meta tags](https://www.gnu.org/software/automake/manual/html_node/Log-files-generation-and-test-results-recording.html#Log-files-generation-and-test-results-recording) expected by automake via `make check`.
+
+### TAP (Test Anything Protocol) Reporter
+```-r tap```
+
+Because of the incremental nature of Catch's test suites and ability to run specific tests, our implementation of TAP reporter writes out the number of tests in a suite last.
+
+## Low-level tools
+
+### Precompiled headers (PCHs)
+
+Catch offers prototypal support for being included in precompiled headers, but because of its single-header nature it does need some actions by the user:
+* The precompiled header needs to define `CATCH_CONFIG_ALL_PARTS`
+* The implementation file needs to
+ * undefine `TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED`
+ * define `CATCH_CONFIG_IMPL_ONLY`
+ * define `CATCH_CONFIG_MAIN` or `CATCH_CONFIG_RUNNER`
+ * 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...)
+
+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
+
+---
+
+[Home](Readme.md#top)
diff --git a/docs/command-line.md b/docs/command-line.md
new file mode 100644
index 0000000..8afcb7d
--- /dev/null
+++ b/docs/command-line.md
@@ -0,0 +1,328 @@
+<a id="top"></a>
+# Command line
+
+**Contents**<br>
+[Specifying which tests to run](#specifying-which-tests-to-run)<br>
+[Choosing a reporter to use](#choosing-a-reporter-to-use)<br>
+[Breaking into the debugger](#breaking-into-the-debugger)<br>
+[Showing results for successful tests](#showing-results-for-successful-tests)<br>
+[Aborting after a certain number of failures](#aborting-after-a-certain-number-of-failures)<br>
+[Listing available tests, tags or reporters](#listing-available-tests-tags-or-reporters)<br>
+[Sending output to a file](#sending-output-to-a-file)<br>
+[Naming a test run](#naming-a-test-run)<br>
+[Eliding assertions expected to throw](#eliding-assertions-expected-to-throw)<br>
+[Make whitespace visible](#make-whitespace-visible)<br>
+[Warnings](#warnings)<br>
+[Reporting timings](#reporting-timings)<br>
+[Load test names to run from a file](#load-test-names-to-run-from-a-file)<br>
+[Just test names](#just-test-names)<br>
+[Specify the order test cases are run](#specify-the-order-test-cases-are-run)<br>
+[Specify a seed for the Random Number Generator](#specify-a-seed-for-the-random-number-generator)<br>
+[Identify framework and version according to the libIdentify standard](#identify-framework-and-version-according-to-the-libidentify-standard)<br>
+[Wait for key before continuing](#wait-for-key-before-continuing)<br>
+[Specify multiples of clock resolution to run benchmarks for](#specify-multiples-of-clock-resolution-to-run-benchmarks-for)<br>
+[Usage](#usage)<br>
+[Specify the section to run](#specify-the-section-to-run)<br>
+[Filenames as tags](#filenames-as-tags)<br>
+
+Catch works quite nicely without any command line options at all - but for those times when you want greater control the following options are available.
+Click one of the followings links to take you straight to that option - or scroll on to browse the available options.
+
+<a href="#specifying-which-tests-to-run"> ` <test-spec> ...`</a><br />
+<a href="#usage"> ` -h, -?, --help`</a><br />
+<a href="#listing-available-tests-tags-or-reporters"> ` -l, --list-tests`</a><br />
+<a href="#listing-available-tests-tags-or-reporters"> ` -t, --list-tags`</a><br />
+<a href="#showing-results-for-successful-tests"> ` -s, --success`</a><br />
+<a href="#breaking-into-the-debugger"> ` -b, --break`</a><br />
+<a href="#eliding-assertions-expected-to-throw"> ` -e, --nothrow`</a><br />
+<a href="#invisibles"> ` -i, --invisibles`</a><br />
+<a href="#sending-output-to-a-file"> ` -o, --out`</a><br />
+<a href="#choosing-a-reporter-to-use"> ` -r, --reporter`</a><br />
+<a href="#naming-a-test-run"> ` -n, --name`</a><br />
+<a href="#aborting-after-a-certain-number-of-failures"> ` -a, --abort`</a><br />
+<a href="#aborting-after-a-certain-number-of-failures"> ` -x, --abortx`</a><br />
+<a href="#warnings"> ` -w, --warn`</a><br />
+<a href="#reporting-timings"> ` -d, --durations`</a><br />
+<a href="#input-file"> ` -f, --input-file`</a><br />
+<a href="#run-section"> ` -c, --section`</a><br />
+<a href="#filenames-as-tags"> ` -#, --filenames-as-tags`</a><br />
+
+
+</br>
+
+<a href="#list-test-names-only"> ` --list-test-names-only`</a><br />
+<a href="#listing-available-tests-tags-or-reporters"> ` --list-reporters`</a><br />
+<a href="#order"> ` --order`</a><br />
+<a href="#rng-seed"> ` --rng-seed`</a><br />
+<a href="#libidentify"> ` --libidentify`</a><br />
+<a href="#wait-for-keypress"> ` --wait-for-keypress`</a><br />
+<a href="#benchmark-resolution-multiple"> ` --benchmark-resolution-multiple`</a><br />
+
+</br>
+
+
+
+<a id="specifying-which-tests-to-run"></a>
+## Specifying which tests to run
+
+<pre><test-spec> ...</pre>
+
+Test cases, wildcarded test cases, tags and tag expressions are all passed directly as arguments. Tags are distinguished by being enclosed in square brackets.
+
+If no test specs are supplied then all test cases, except "hidden" tests, are run.
+A test is hidden by giving it any tag starting with (or just) a period (```.```) - or, in the deprecated case, tagged ```[hide]``` or given name starting with `'./'`. To specify hidden tests from the command line ```[.]``` or ```[hide]``` can be used *regardless of how they were declared*.
+
+Specs must be enclosed in quotes if they contain spaces. If they do not contain spaces the quotes are optional.
+
+Wildcards consist of the `*` character at the beginning and/or end of test case names and can substitute for any number of any characters (including none).
+
+Test specs are case insensitive.
+
+If a spec is prefixed with `exclude:` or the `~` character then the pattern matches an exclusion. This means that tests matching the pattern are excluded from the set - even if a prior inclusion spec included them. Subsequent inclusion specs will take precendence, however.
+Inclusions and exclusions are evaluated in left-to-right order.
+
+Test case examples:
+
+<pre>thisTestOnly Matches the test case called, 'thisTestOnly'
+"this test only" Matches the test case called, 'this test only'
+these* Matches all cases starting with 'these'
+exclude:notThis Matches all tests except, 'notThis'
+~notThis Matches all tests except, 'notThis'
+~*private* Matches all tests except those that contain 'private'
+a* ~ab* abc Matches all tests that start with 'a', except those that
+ start with 'ab', except 'abc', which is included
+</pre>
+
+Names within square brackets are interpreted as tags.
+A series of tags form an AND expression wheras a comma-separated sequence forms an OR expression. e.g.:
+
+<pre>[one][two],[three]</pre>
+This matches all tests tagged `[one]` and `[two]`, as well as all tests tagged `[three]`
+
+Test names containing special characters, such as `,` or `[` can specify them on the command line using `\`.
+`\` also escapes itself.
+
+<a id="choosing-a-reporter-to-use"></a>
+## Choosing a reporter to use
+
+<pre>-r, --reporter <reporter></pre>
+
+A reporter is an object that formats and structures the output of running tests, and potentially summarises the results. By default a console reporter is used that writes, IDE friendly, textual output. Catch comes bundled with some alternative reporters, but more can be added in client code.<br />
+The bundled reporters are:
+
+<pre>-r console
+-r compact
+-r xml
+-r junit
+</pre>
+
+The JUnit reporter is an xml format that follows the structure of the JUnit XML Report ANT task, as consumed by a number of third-party tools, including Continuous Integration servers such as Hudson. If not otherwise needed, the standard XML reporter is preferred as this is a streaming reporter, whereas the Junit reporter needs to hold all its results until the end so it can write the overall results into attributes of the root node.
+
+<a id="breaking-into-the-debugger"></a>
+## Breaking into the debugger
+<pre>-b, --break</pre>
+
+In some IDEs (currently XCode and Visual Studio) it is possible for Catch to break into the debugger on a test failure. This can be very helpful during debug sessions - especially when there is more than one path through a particular test.
+
+<a id="showing-results-for-successful-tests"></a>
+## Showing results for successful tests
+<pre>-s, --success</pre>
+
+Usually you only want to see reporting for failed tests. Sometimes it's useful to see *all* the output (especially when you don't trust that that test you just added worked first time!).
+To see successful, as well as failing, test results just pass this option. Note that each reporter may treat this option differently. The Junit reporter, for example, logs all results regardless.
+
+<a id="aborting-after-a-certain-number-of-failures"></a>
+## Aborting after a certain number of failures
+<pre>-a, --abort
+-x, --abortx [<failure threshold>]
+</pre>
+
+If a ```REQUIRE``` assertion fails the test case aborts, but subsequent test cases are still run.
+If a ```CHECK``` assertion fails even the current test case is not aborted.
+
+Sometimes this results in a flood of failure messages and you'd rather just see the first few. Specifying ```-a``` or ```--abort``` on its own will abort the whole test run on the first failed assertion of any kind. Use ```-x``` or ```--abortx``` followed by a number to abort after that number of assertion failures.
+
+<a id="listing-available-tests-tags-or-reporters"></a>
+## Listing available tests, tags or reporters
+<pre>-l, --list-tests
+-t, --list-tags
+--list-reporters
+</pre>
+
+```-l``` or ```--list-tests``` will list all registered tests, along with any tags.
+If one or more test-specs have been supplied too then only the matching tests will be listed.
+
+```-t``` or ```--list-tags``` lists all available tags, along with the number of test cases they match. Again, supplying test specs limits the tags that match.
+
+```--list-reporters``` lists the available reporters.
+
+<a id="sending-output-to-a-file"></a>
+## Sending output to a file
+<pre>-o, --out <filename>
+</pre>
+
+Use this option to send all output to a file. By default output is sent to stdout (note that uses of stdout and stderr *from within test cases* are redirected and included in the report - so even stderr will effectively end up on stdout).
+
+<a id="naming-a-test-run"></a>
+## Naming a test run
+<pre>-n, --name <name for test run></pre>
+
+If a name is supplied it will be used by the reporter to provide an overall name for the test run. This can be useful if you are sending to a file, for example, and need to distinguish different test runs - either from different Catch executables or runs of the same executable with different options. If not supplied the name is defaulted to the name of the executable.
+
+<a id="eliding-assertions-expected-to-throw"></a>
+## Eliding assertions expected to throw
+<pre>-e, --nothrow</pre>
+
+Skips all assertions that test that an exception is thrown, e.g. ```REQUIRE_THROWS```.
+
+These can be a nuisance in certain debugging environments that may break when exceptions are thrown (while this is usually optional for handled exceptions, it can be useful to have enabled if you are trying to track down something unexpected).
+
+Sometimes exceptions are expected outside of one of the assertions that tests for them (perhaps thrown and caught within the code-under-test). The whole test case can be skipped when using ```-e``` by marking it with the ```[!throws]``` tag.
+
+When running with this option any throw checking assertions are skipped so as not to contribute additional noise. Be careful if this affects the behaviour of subsequent tests.
+
+<a id="invisibles"></a>
+## Make whitespace visible
+<pre>-i, --invisibles</pre>
+
+If a string comparison fails due to differences in whitespace - especially leading or trailing whitespace - it can be hard to see what's going on.
+This option transforms tabs and newline characters into ```\t``` and ```\n``` respectively when printing.
+
+<a id="warnings"></a>
+## Warnings
+<pre>-w, --warn <warning name></pre>
+
+Enables reporting of warnings (only one, at time of this writing). If a warning is issued it fails the test.
+
+The ony available warning, presently, is ```NoAssertions```. This warning fails a test case, or (leaf) section if no assertions (```REQUIRE```/ ```CHECK``` etc) are encountered.
+
+<a id="reporting-timings"></a>
+## Reporting timings
+<pre>-d, --durations <yes/no></pre>
+
+When set to ```yes``` Catch will report the duration of each test case, in milliseconds. Note that it does this regardless of whether a test case passes or fails. Note, also, the certain reporters (e.g. Junit) always report test case durations regardless of this option being set or not.
+
+<a id="input-file"></a>
+## Load test names to run from a file
+<pre>-f, --input-file <filename></pre>
+
+Provide the name of a file that contains a list of test case names - one per line. Blank lines are skipped and anything after the comment character, ```#```, is ignored.
+
+A useful way to generate an initial instance of this file is to use the <a href="#list-test-names-only">list-test-names-only</a> option. This can then be manually curated to specify a specific subset of tests - or in a specific order.
+
+<a id="list-test-names-only"></a>
+## Just test names
+<pre>--list-test-names-only</pre>
+
+This option lists all available tests in a non-indented form, one on each line. This makes it ideal for saving to a file and feeding back into the <a href="#input-file">```-f``` or ```--input-file```</a> option.
+
+
+<a id="order"></a>
+## Specify the order test cases are run
+<pre>--order <decl|lex|rand></pre>
+
+Test cases are ordered one of three ways:
+
+
+### decl
+Declaration order. The order the tests were originally declared in. Note that ordering between files is not guaranteed and is implementation dependent.
+
+### lex
+Lexicographically sorted. Tests are sorted, alpha-numerically, by name.
+
+### rand
+Randomly sorted. Test names are sorted using ```std::random_shuffle()```. By default the random number generator is seeded with 0 - and so the order is repeatable. To control the random seed see <a href="#rng-seed">rng-seed</a>.
+
+<a id="rng-seed"></a>
+## Specify a seed for the Random Number Generator
+<pre>--rng-seed <'time'|number></pre>
+
+Sets a seed for the random number generator using ```std::srand()```.
+If a number is provided this is used directly as the seed so the random pattern is repeatable.
+Alternatively if the keyword ```time``` is provided then the result of calling ```std::time(0)``` is used and so the pattern becomes unpredictable.
+
+In either case the actual value for the seed is printed as part of Catch's output so if an issue is discovered that is sensitive to test ordering the ordering can be reproduced - even if it was originally seeded from ```std::time(0)```.
+
+<a id="libidentify"></a>
+## Identify framework and version according to the libIdentify standard
+<pre>--libidentify</pre>
+
+See [The LibIdentify repo for more information and examples](https://github.com/janwilmans/LibIdentify).
+
+<a id="wait-for-keypress"></a>
+## Wait for key before continuing
+<pre>--wait-for-keypress <start|exit|both></pre>
+
+Will cause the executable to print a message and wait until the return/ enter key is pressed before continuing -
+either before running any tests, after running all tests - or both, depending on the argument.
+
+<a id="benchmark-resolution-multiple"></a>
+## Specify multiples of clock resolution to run benchmarks for
+<pre>--benchmark-resolution-multiple <multiplier></pre>
+
+When running benchmarks the clock resolution is estimated. Benchmarks are then run for exponentially increasing
+numbers of iterations until some multiple of the estimated resolution is exceed. By default that multiple is 100, but
+it can be overriden here.
+
+<a id="usage"></a>
+## Usage
+<pre>-h, -?, --help</pre>
+
+Prints the command line arguments to stdout
+
+
+<a id="run-section"></a>
+## Specify the section to run
+<pre>-c, --section <section name></pre>
+
+To limit execution to a specific section within a test case, use this option one or more times.
+To narrow to sub-sections use multiple instances, where each subsequent instance specifies a deeper nesting level.
+
+E.g. if you have:
+
+<pre>
+TEST_CASE( "Test" ) {
+ SECTION( "sa" ) {
+ SECTION( "sb" ) {
+ /*...*/
+ }
+ SECTION( "sc" ) {
+ /*...*/
+ }
+ }
+ SECTION( "sd" ) {
+ /*...*/
+ }
+}
+</pre>
+
+Then you can run `sb` with:
+<pre>./MyExe Test -c sa -c sb</pre>
+
+Or run just `sd` with:
+<pre>./MyExe Test -c sd</pre>
+
+To run all of `sa`, including `sb` and `sc` use:
+<pre>./MyExe Test -c sa</pre>
+
+There are some limitations of this feature to be aware of:
+- Code outside of sections being skipped will still be executed - e.g. any set-up code in the TEST_CASE before the
+start of the first section.</br>
+- At time of writing, wildcards are not supported in section names.
+- If you specify a section without narrowing to a test case first then all test cases will be executed
+(but only matching sections within them).
+
+
+<a id="filenames-as-tags"></a>
+## Filenames as tags
+<pre>-#, --filenames-as-tags</pre>
+
+When this option is used then every test is given an additional tag which is formed of the unqualified
+filename it is found in, with any extension stripped, prefixed with the `#` character.
+
+So, for example, tests within the file `~\Dev\MyProject\Ferrets.cpp` would be tagged `[#Ferrets]`.
+
+
+---
+
+[Home](Readme.md#top)
diff --git a/docs/commercial-users.md b/docs/commercial-users.md
new file mode 100644
index 0000000..e4d789f
--- /dev/null
+++ b/docs/commercial-users.md
@@ -0,0 +1,17 @@
+<a id="top"></a>
+# Commercial users of Catch
+
+As well as [Open Source](opensource-users.md#top) users Catch is widely used within proprietary code bases too.
+Many organisations like to keep this information internal, and that's fine,
+but if you're more open it would be great if we could list the names of as
+many organisations as possible that use Catch somewhere in their codebase.
+Enterprise environments often tend to be far more conservative in their tool adoption -
+and being aware that other companies are using Catch can ease the path in.
+
+So if you are aware of Catch usage in your organisation, and are fairly confident there is no issue with sharing this
+fact then please let us know - either directly, via a PR or
+[issue](https://github.com/philsquared/Catch/issues), or on the [forums](https://groups.google.com/forum/?fromgroups#!forum/catch-forum).
+
+ - Bloomberg
+ - NASA
+ - [Inscopix Inc.](https://www.inscopix.com/)
diff --git a/docs/configuration.md b/docs/configuration.md
new file mode 100644
index 0000000..3e59e76
--- /dev/null
+++ b/docs/configuration.md
@@ -0,0 +1,138 @@
+<a id="top"></a>
+# Compile-time configuration
+
+**Contents**<br>
+[main()/ implementation](#main-implementation)<br>
+[Prefixing Catch macros](#prefixing-catch-macros)<br>
+[Terminal colour](#terminal-colour)<br>
+[Console width](#console-width)<br>
+[stdout](#stdout)<br>
+[Other toggles](#other-toggles)<br>
+[Windows header clutter](#windows-header-clutter)<br>
+[Enabling stringification](#enabling-stringification)<br>
+
+Catch is designed to "just work" as much as possible. For most people the only configuration needed is telling Catch which source file should host all the implementation code (```CATCH_CONFIG_MAIN```).
+
+Nonetheless there are still some occasions where finer control is needed. For these occasions Catch exposes a set of macros for configuring how it is built.
+
+## main()/ implementation
+
+ CATCH_CONFIG_MAIN // Designates this as implementation file and defines main()
+ CATCH_CONFIG_RUNNER // Designates this as implementation file
+
+Although Catch is header only it still, internally, maintains a distinction between interface headers and headers that contain implementation. Only one source file in your test project should compile the implementation headers and this is controlled through the use of one of these macros - one of these identifiers should be defined before including Catch in *exactly one implementation file in your project*.
+
+# Reporter / Listener interfaces
+
+ CATCH_CONFIG_EXTERNAL_INTERFACES // Brings in neccessary headers for Reporter/Listener implementation
+
+Brings in various parts of Catch that are required for user defined Reporters and Listeners. This means that new Reporters and Listeners can be defined in this file as well as in the main file.
+
+Implied by both `CATCH_CONFIG_MAIN` and `CATCH_CONFIG_RUNNER`.
+
+## Prefixing Catch macros
+
+ CATCH_CONFIG_PREFIX_ALL
+
+To keep test code clean and uncluttered Catch uses short macro names (e.g. ```TEST_CASE``` and ```REQUIRE```). Occasionally these may conflict with identifiers from platform headers or the system under test. In this case the above identifier can be defined. This will cause all the Catch user macros to be prefixed with ```CATCH_``` (e.g. ```CATCH_TEST_CASE``` and ```CATCH_REQUIRE```).
+
+
+## Terminal colour
+
+ CATCH_CONFIG_COLOUR_NONE // completely disables all text colouring
+ CATCH_CONFIG_COLOUR_WINDOWS // forces the Win32 console API to be used
+ CATCH_CONFIG_COLOUR_ANSI // forces ANSI colour codes to be used
+
+Yes, I am English, so I will continue to spell "colour" with a 'u'.
+
+When sending output to the terminal, if it detects that it can, Catch will use colourised text. On Windows the Win32 API, ```SetConsoleTextAttribute```, is used. On POSIX systems ANSI colour escape codes are inserted into the stream.
+
+For finer control you can define one of the above identifiers (these are mutually exclusive - but that is not checked so may behave unexpectedly if you mix them):
+
+Note that when ANSI colour codes are used "unistd.h" must be includable - along with a definition of ```isatty()```
+
+Typically you should place the ```#define``` before #including "catch.hpp" in your main source file - but if you prefer you can define it for your whole project by whatever your IDE or build system provides for you to do so.
+
+## Console width
+
+ CATCH_CONFIG_CONSOLE_WIDTH = x // where x is a number
+
+Catch formats output intended for the console to fit within a fixed number of characters. This is especially important as indentation is used extensively and uncontrolled line wraps break this.
+By default a console width of 80 is assumed but this can be controlled by defining the above identifier to be a different value.
+
+## stdout
+
+ CATCH_CONFIG_NOSTDOUT
+
+Catch does not use ```std::cout```, ```std::cerr``` and ```std::clog``` directly but gets them from ```Catch::cout()```, ```Catch::cerr()``` and ```Catch::clog``` respectively. If the above identifier is defined these functions are left unimplemented and you must implement them yourself. Their signatures are:
+
+ std::ostream& cout();
+ std::ostream& cerr();
+ std::ostream& clog();
+
+This can be useful on certain platforms that do not provide the standard iostreams, such as certain embedded systems.
+
+
+
+## Other toggles
+
+ CATCH_CONFIG_COUNTER // Use __COUNTER__ to generate unique names for test cases
+ CATCH_CONFIG_WINDOWS_SEH // Enable SEH handling on Windows
+ CATCH_CONFIG_FAST_COMPILE // Sacrifices some (rather minor) features for compilation speed
+ CATCH_CONFIG_DISABLE_MATCHERS // Do not compile Matchers in this compilation unit
+ CATCH_CONFIG_POSIX_SIGNALS // Enable handling POSIX signals
+ CATCH_CONFIG_WINDOWS_CRTDBG // Enable leak checking using Windows's CRT Debug Heap
+ CATCH_CONFIG_DISABLE_STRINGIFICATION // Disable stringifying the original expression
+ CATCH_CONFIG_DISABLE // Disables assertions and test case registration
+
+Currently Catch enables `CATCH_CONFIG_WINDOWS_SEH` only when compiled with MSVC, because some versions of MinGW do not have the necessary Win32 API support.
+
+`CATCH_CONFIG_POSIX_SIGNALS` is on by default, except when Catch is compiled under `Cygwin`, where it is disabled by default (but can be force-enabled by defining `CATCH_CONFIG_POSIX_SIGNALS`).
+
+`CATCH_CONFIG_WINDOWS_CRTDBG` is off by default. If enabled, Windows's CRT is used to check for memory leaks, and displays them after the tests finish running.
+
+These toggles can be disabled by using `_NO_` form of the toggle, e.g. `CATCH_CONFIG_NO_WINDOWS_SEH`.
+
+### `CATCH_CONFIG_FAST_COMPILE`
+Defining this flag speeds up compilation of test files by ~20%, by making 2 changes:
+* The `-b` (`--break`) flag no longer makes Catch break into debugger in the same stack frame as the failed test, but rather in a stack frame *below*.
+* Non-exception family of macros ({`REQUIRE`,`CHECK`}{`_`,`_FALSE`, `_FALSE`}, no longer use local try-cache block. This disables exception translation, but should not lead to false negatives.
+
+`CATCH_CONFIG_FAST_COMPILE` has to be either defined, or not defined, in all translation units that are linked into single test binary, or the behaviour of setting `-b` flag and throwing unexpected exceptions will be unpredictable.
+
+### `CATCH_CONFIG_DISABLE_MATCHERS`
+When `CATCH_CONFIG_DISABLE_MATCHERS` is defined, all mentions of Catch's Matchers are ifdef-ed away from the translation unit. Doing so will speed up compilation of that TU.
+
+_Note: If you define `CATCH_CONFIG_DISABLE_MATCHERS` in the same file as Catch's main is implemented, your test executable will fail to link if you use Matchers anywhere._
+
+### `CATCH_CONFIG_DISABLE_STRINGIFICATION`
+This toggle enables a workaround for VS 2017 bug. For details see [known limitations](limitations.md#visual-studio-2017----raw-string-literal-in-assert-fails-to-compile).
+
+### `CATCH_CONFIG_DISABLE`
+This toggle removes most of Catch from given file. This means that `TEST_CASE`s are not registered and assertions are turned into no-ops. Useful for keeping tests within implementation files (ie for functions with internal linkage), instead of in external files.
+
+This feature is considered experimental and might change at any point.
+
+_Inspired by Doctest's `DOCTEST_CONFIG_DISABLE`_
+
+## Windows header clutter
+
+On Windows Catch includes `windows.h`. To minimize global namespace clutter in the implementation file, it defines `NOMINMAX` and `WIN32_LEAN_AND_MEAN` before including it. You can control this behaviour via two macros:
+
+ CATCH_CONFIG_NO_NOMINMAX // Stops Catch from using NOMINMAX macro
+ CATCH_CONFIG_NO_WIN32_LEAN_AND_MEAN // Stops Catch from using WIN32_LEAN_AND_MEAN macro
+
+
+## Enabling stringification
+
+By default, Catch does not stringify some types from the standard library. This is done to avoid dragging in various standard library headers by default. However, Catch does contain these and can be configured to provide them, using these macros:
+
+ CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER // Provide StringMaker specialization for std::pair
+ CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER // Provide StringMaker specialization for std::tuple
+ CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER // Provide StringMaker specialization for std::chrono::duration, std::chrono::timepoint
+ CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS // Defines all of the above
+
+
+---
+
+[Home](Readme.md#top)
diff --git a/docs/contributing.md b/docs/contributing.md
new file mode 100644
index 0000000..b615037
--- /dev/null
+++ b/docs/contributing.md
@@ -0,0 +1,61 @@
+<a id="top"></a>
+# Contributing to Catch
+
+So you want to contribute something to Catch? That's great! Whether it's a bug fix, a new feature, support for
+additional compilers - or just a fix to the documentation - all contributions are very welcome and very much appreciated.
+Of course so are bug reports and other comments and questions.
+
+If you are contributing to the code base there are a few simple guidelines to keep in mind. This also includes notes to
+help you find your way around. As this is liable to drift out of date please raise an issue or, better still, a pull
+request for this file, if you notice that.
+
+## Branches
+
+Ongoing development is currently on _master_. At some point an integration branch will be set-up and PRs should target
+ that - but for now it's all against master. You may see feature branches come and go from time to time, too.
+
+## Directory structure
+
+_Users_ of Catch primarily use the single header version. _Maintainers_ should work with the full source (which is still,
+primarily, in headers). This can be found in the `include` folder. There are a set of test files, currently under
+`projects/SelfTest`. The test app can be built via CMake from the `CMakeLists.txt` file in the root, or you can generate
+project files for Visual Studio, XCode, and others (instructions in the `projects` folder). If you have access to CLion,
+it can work with the CMake file directly.
+
+As well as the runtime test files you'll also see a `SurrogateCpps` directory under `projects/SelfTest`.
+This contains a set of .cpp files that each `#include` a single header.
+While these files are not essential to compilation they help to keep the implementation headers self-contained.
+At time of writing this set is not complete but has reasonable coverage.
+If you add additional headers please try to remember to add a surrogate cpp for it.
+
+The other directories are `scripts` which contains a set of python scripts to help in testing Catch as well as
+generating the single include, and `docs`, which contains the documentation as a set of markdown files.
+
+__When submitting a pull request please do not include changes to the single include, or to the version number file
+as these are managed by the scripts!__
+
+
+## Testing your changes
+
+Obviously all changes to Catch's code should be tested. If you added new functionality, you should add tests covering and
+showcasing it. Even if you have only made changes to Catch internals (ie you implemented some performance improvements),
+you should still test your changes.
+
+This means 3 things
+
+* Compiling Catch's SelfTest project -- code that does not compile is evidently incorrect. Obviously, you are not expected to
+have access to all compilers and platforms Catch supports, Catch's CI pipeline will compile your code using supported compilers
+once you open a PR.
+* Running the SelfTest binary. There should be no unexpected failures on simple run.
+* Running Catch's approval tests. Approval tests compare current output of the SelfTest binary in various configurations against
+known good output. Catch's repository provides utility scripts `approvalTests.py` to help you with this. It needs to be passed
+the SelfTest binary compiled with your changes, like so: `$ ./scripts/approvalTests.py clang-build/SelfTest`. The output should
+be fairly self-explanatory.
+
+
+
+ *this document is still in-progress...*
+
+---
+
+[Home](Readme.md#top)
diff --git a/docs/event-listeners.md b/docs/event-listeners.md
new file mode 100644
index 0000000..1ddef0f
--- /dev/null
+++ b/docs/event-listeners.md
@@ -0,0 +1,75 @@
+<a id="top"></a>
+# Event Listeners
+
+A `Listener` is a class you can register with Catch that will then be passed events,
+such as a test case starting or ending, as they happen during a test run.
+`Listeners` are actually types of `Reporters`, with a few small differences:
+
+1. Once registered in code they are automatically used - you don't need to specify them on the command line
+2. They are called in addition to (just before) any reporters, and you can register multiple listeners.
+3. They derive from `Catch::TestEventListenerBase`, which has default stubs for all the events,
+so you are not forced to implement events you're not interested in.
+4. You register a listener with `CATCH_REGISTER_LISTENER`
+
+
+## Implementing a Listener
+Simply derive a class from `Catch::TestEventListenerBase` and implement the methods you are interested in, either in
+the main source file (i.e. the one that defines `CATCH_CONFIG_MAIN` or `CATCH_CONFIG_RUNNER`), or in a
+file that defines `CATCH_CONFIG_EXTERNAL_INTERFACES`.
+
+Then register it using `CATCH_REGISTER_LISTENER`.
+
+For example ([complete source code](../examples/210-Evt-EventListeners.cpp)):
+
+```c++
+#define CATCH_CONFIG_MAIN
+#include "catch.hpp"
+
+struct MyListener : Catch::TestEventListenerBase {
+
+ using TestEventListenerBase::TestEventListenerBase; // inherit constructor
+
+ virtual void testCaseStarting( Catch::TestCaseInfo const& testInfo ) override {
+ // Perform some setup before a test case is run
+ }
+
+ virtual void testCaseEnded( Catch::TestCaseStats const& testCaseStats ) override {
+ // Tear-down after a test case is run
+ }
+};
+CATCH_REGISTER_LISTENER( MyListener )
+```
+
+_Note that you should not use any assertion macros within a Listener!_
+
+## Events that can be hooked
+
+The following are the methods that can be overriden in the Listener:
+
+```c++
+// The whole test run, starting and ending
+virtual void testRunStarting( TestRunInfo const& testRunInfo );
+virtual void testRunEnded( TestRunStats const& testRunStats );
+
+// Test cases starting and ending
+virtual void testCaseStarting( TestCaseInfo const& testInfo );
+virtual void testCaseEnded( TestCaseStats const& testCaseStats );
+
+// Sections starting and ending
+virtual void sectionStarting( SectionInfo const& sectionInfo );
+virtual void sectionEnded( SectionStats const& sectionStats );
+
+// Assertions before/ after
+virtual void assertionStarting( AssertionInfo const& assertionInfo );
+virtual bool assertionEnded( AssertionStats const& assertionStats );
+
+// A test is being skipped (because it is "hidden")
+virtual void skipTest( TestCaseInfo const& testInfo );
+```
+
+More information about the events (e.g. name of the test case) is contained in the structs passed as arguments -
+just look in the source code to see what fields are available.
+
+---
+
+[Home](Readme.md#top)
diff --git a/docs/limitations.md b/docs/limitations.md
new file mode 100644
index 0000000..bcdbab0
--- /dev/null
+++ b/docs/limitations.md
@@ -0,0 +1,129 @@
+<a id="top"></a>
+# Known limitations
+
+Catch has some known limitations, that we are not planning to change. Some of these are caused by our desire to support C++98 compilers, some of these are caused by our desire to keep Catch crossplatform, some exist because their priority is seen as low compared to the development effort they would need and some other yet are compiler/runtime bugs.
+
+## Implementation limits
+### Sections nested in loops
+
+If you are using `SECTION`s inside loops, you have to create them with different name per loop's iteration. The recommended way to do so is to incorporate the loop's counter into section's name, like so
+```cpp
+TEST_CASE( "Looped section" ) {
+ for (char i = '0'; i < '5'; ++i) {
+ SECTION(std::string("Looped section ") + i) {
+ SUCCEED( "Everything is OK" );
+ }
+ }
+}
+```
+
+## Features
+This section outlines some missing features, what is their status and their possible workarounds.
+
+### Thread safe assertions
+Because threading support in standard C++98 is limited (well, non-existent), assertion macros in Catch are not thread safe. This does not mean that you cannot use threads inside Catch's test, but that only single thread can interact with Catch's assertions and other macros.
+
+This means that this is ok
+```cpp
+ std::vector<std::thread> threads;
+ std::atomic<int> cnt{ 0 };
+ for (int i = 0; i < 4; ++i) {
+ threads.emplace_back([&]() {
+ ++cnt; ++cnt; ++cnt; ++cnt;
+ });
+ }
+ for (auto& t : threads) { t.join(); }
+ REQUIRE(cnt == 16);
+```
+because only one thread passes the `REQUIRE` macro and this is not
+```cpp
+ std::vector<std::thread> threads;
+ std::atomic<int> cnt{ 0 };
+ for (int i = 0; i < 4; ++i) {
+ threads.emplace_back([&]() {
+ ++cnt; ++cnt; ++cnt; ++cnt;
+ CHECK(cnt == 16);
+ });
+ }
+ for (auto& t : threads) { t.join(); }
+ REQUIRE(cnt == 16);
+```
+
+
+_This limitation is highly unlikely to be lifted before Catch 2 is released._
+
+### Process isolation in a test
+Catch does not support running tests in isolated (forked) processes. While this might in the future, the fact that Windows does not support forking and only allows full-on process creation and the desire to keep code as similar as possible across platforms, mean that this is likely to take significant development time, that is not currently available.
+
+### Running multiple tests in parallel
+Catch's test execution is strictly serial. If you find yourself with a test suite that takes too long to run and you want to make it parallel, there are 2 feasible solutions
+ * You can split your tests into multiple binaries and then run these binaries in parallel.
+ * You can have Catch list contained test cases and then run the same test binary multiple times in parallel, passing each instance list of test cases it should run.
+
+Both of these solutions have their problems, but should let you wring parallelism out of your test suite.
+
+## 3rd party bugs
+This section outlines known bugs in 3rd party components (this means compilers, standard libraries, standard runtimes).
+
+### Visual Studio 2017 -- raw string literal in assert fails to compile
+There is a known bug in Visual Studio 2017 (VC 15), that causes compilation error when preprocessor attempts to stringize a raw string literal (`#` preprocessor is applied to it). This snippet is sufficient to trigger the compilation error:
+```cpp
+#define CATCH_CONFIG_MAIN
+#include "catch.hpp"
+
+TEST_CASE("test") {
+ CHECK(std::string(R"("\)") == "\"\\");
+}
+```
+
+Catch provides a workaround, it is possible to disable stringification of original expressions by defining `CATCH_CONFIG_DISABLE_STRINGIFICATION`:
+```cpp
+#define CATCH_CONFIG_FAST_COMPILE
+#define CATCH_CONFIG_DISABLE_STRINGIFICATION
+#include "catch.hpp"
+
+TEST_CASE("test") {
+ CHECK(std::string(R"("\)") == "\"\\");
+}
+```
+
+_Do note that this changes the output somewhat_
+```
+catchwork\test1.cpp(6):
+PASSED:
+ CHECK( Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION )
+with expansion:
+ ""\" == ""\"
+```
+
+
+
+### Visual Studio 2015 -- Wrong line number reported in debug mode
+VS 2015 has a known bug where `__LINE__` macro can be improperly expanded under certain circumstances, while compiling multi-file project in Debug mode.
+
+A workaround is to compile the binary in Release mode.
+
+### Clang/G++ -- skipping leaf sections after an exception
+Some versions of `libc++` and `libstdc++` (or their runtimes) have a bug with `std::uncaught_exception()` getting stuck returning `true` after rethrow, even if there are no active exceptions. One such case is this snippet, which skipped the sections "a" and "b", when compiled against `libcxxrt` from master
+```cpp
+#define CATCH_CONFIG_MAIN
+#include <catch.hpp>
+
+TEST_CASE("a") {
+ CHECK_THROWS(throw 3);
+}
+
+TEST_CASE("b") {
+ int i = 0;
+ SECTION("a") { i = 1; }
+ SECTION("b") { i = 2; }
+ CHECK(i > 0);
+}
+```
+
+If you are seeing a problem like this, i.e. a weird test paths that trigger only under Clang with `libc++`, or only under very specific version of `libstdc++`, it is very likely you are seeing this. The only known workaround is to use a fixed version of your standard library.
+
+### Clang/G++ -- `Matches` string matcher always returns false
+This is a bug in `libstdc++-4.8`, where all matching methods from `<regex>` return false. Since `Matches` uses `<regex>` internally, if the underlying implementation does not work, it doesn't work either.
+
+Workaround: Use newer version of `libstdc++`.
diff --git a/docs/list-of-examples.md b/docs/list-of-examples.md
new file mode 100644
index 0000000..6517d5d
--- /dev/null
+++ b/docs/list-of-examples.md
@@ -0,0 +1,31 @@
+<a id="top"></a>
+# List of examples
+
+- Test Case: [Single-file](../examples/010-TestCase.cpp)
+- Test Case: [Multiple-file 1](../examples/020-TestCase-1.cpp), [2](../examples/020-TestCase-1.cpp)
+- Assertion: [REQUIRE, CHECK](../examples/030-Asn-Require-Check.cpp)
+- Assertion: [REQUIRE_THAT and Matchers](../examples/040-Asn-RequireThat.cpp)
+- Assertion: [REQUIRE_NO_THROW](../examples/050-Asn-RequireNoThrow.cpp)
+- Assertion: [REQUIRE_THROWS](../examples/050-Asn-RequireThrows.cpp)
+- Assertion: [REQUIRE_THROWS_AS](../examples/070-Asn-RequireThrowsAs.cpp)
+- Assertion: [REQUIRE_THROWS_WITH](../examples/080-Asn-RequireThrowsWith.cpp)
+- Assertion: [REQUIRE_THROWS_MATCHES](../examples/090-Asn-RequireThrowsMatches.cpp)
+- 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)
+- Floating point: [Approx - Comparisons](../examples/130-Fpt-Approx.cpp)
+- Logging: [CAPTURE - Capture expression](../examples/140-Log-Capture.cpp)
+- Logging: [INFO - Provide information with failure](../examples/150-Log-Info.cpp)
+- Logging: [WARN - Issue warning](../examples/160-Log-Warn.cpp)
+- Logging: [FAIL, FAIL_CHECK - Issue message and force failure/continue](../examples/170-Log-Fail.cpp)
+- Logging: [SUCCEED - Issue message and continue](../examples/180-Log-Succeed.cpp)
+- Report: [User-defined type](../examples/190-Rpt-ReportUserDefinedType.cpp)
+- Report: [Reporter](../examples/200-Rpt-UserDefinedReporter.cpp)
+- Listener: [Listeners](../examples/210-Evt-EventListeners.cpp)
+- Configuration: [Provide your own main()](../examples/220-Cfg-OwnMain.cpp)
+- Configuration: [Compile-time configuration](../examples/230-Cfg-CompileTimeConfiguration.cpp)
+- Configuration: [Run-time configuration](../examples/240-Cfg-RunTimeConfiguration.cpp)
+
+---
+
+[Home](Readme.md#top)
diff --git a/docs/logging.md b/docs/logging.md
new file mode 100644
index 0000000..7ae54aa
--- /dev/null
+++ b/docs/logging.md
@@ -0,0 +1,83 @@
+<a id="top"></a>
+# Logging macros
+
+Additional messages can be logged during a test case. Note that the messages are scoped and thus will not be reported if failure occurs in scope preceding the message declaration. An example:
+
+```cpp
+TEST_CASE("Foo") {
+ INFO("Test case start");
+ for (int i = 0; i < 2; ++i) {
+ INFO("The number is " << i);
+ CHECK(i == 0);
+ }
+}
+
+TEST_CASE("Bar") {
+ INFO("Test case start");
+ for (int i = 0; i < 2; ++i) {
+ INFO("The number is " << i);
+ CHECK(i == i);
+ }
+ CHECK(false);
+}
+```
+When the `CHECK` fails in the "Foo" test case, then two messages will be printed.
+```
+Test case start
+The number is 1
+```
+When the last `CHECK` fails in the "Bar" test case, then only one message will be printed: `Test case start`.
+
+
+## Streaming macros
+
+All these macros allow heterogenous sequences of values to be streaming using the insertion operator (```<<```) in the same way that std::ostream, std::cout, etc support it.
+
+E.g.:
+```c++
+INFO( "The number is " << i );
+```
+
+(Note that there is no initial ```<<``` - instead the insertion sequence is placed in parentheses.)
+These macros come in three forms:
+
+**INFO(** _message expression_ **)**
+
+The message is logged to a buffer, but only reported with the next assertion that is logged. This allows you to log contextual information in case of failures which is not shown during a successful test run (for the console reporter, without -s). Messages are removed from the buffer at the end of their scope, so may be used, for example, in loops.
+
+**WARN(** _message expression_ **)**
+
+The message is always reported but does not fail the test.
+
+**FAIL(** _message expression_ **)**
+
+The message is reported and the test case fails.
+
+**FAIL_CHECK(** _message expression_ **)**
+
+AS `FAIL`, but does not abort the test
+
+## Quickly capture a variable value
+
+**CAPTURE(** _expression_ **)**
+
+Sometimes you just want to log the name and value of a variable. While you can easily do this with the INFO macro, above, as a convenience the CAPTURE macro handles the stringising of the variable name for you (actually it works with any expression, not just variables).
+
+E.g.
+```c++
+CAPTURE( theAnswer );
+```
+
+This would log something like:
+
+<pre>"theAnswer := 42"</pre>
+
+## Deprecated macros
+
+**SCOPED_INFO and SCOPED_CAPTURE**
+
+These macros are now deprecated and are just aliases for INFO and CAPTURE (which were not previously scoped).
+
+---
+
+[Home](Readme.md#top)
diff --git a/docs/matchers.md b/docs/matchers.md
new file mode 100644
index 0000000..fb95ce2
--- /dev/null
+++ b/docs/matchers.md
@@ -0,0 +1,117 @@
+<a id="top"></a>
+# Matchers
+
+Matchers are an alternative way to do assertions which are easily extensible and composable.
+This makes them well suited to use with more complex types (such as collections) or your own custom types.
+Matchers were first popularised by the [Hamcrest](https://en.wikipedia.org/wiki/Hamcrest) family of frameworks.
+
+## In use
+
+Matchers are introduced with the `REQUIRE_THAT` or `CHECK_THAT` macros, which take two arguments.
+The first argument is the thing (object or value) under test. The second part is a match _expression_,
+which consists of either a single matcher or one or more matchers combined using `&&`, `||` or `!` operators.
+
+For example, to assert that a string ends with a certain substring:
+
+ ```c++
+using Catch::Matchers::EndsWith; // or Catch::EndsWith
+std::string str = getStringFromSomewhere();
+REQUIRE_THAT( str, EndsWith( "as a service" ) );
+ ```
+
+The matcher objects can take multiple arguments, allowing more fine tuning.
+The built-in string matchers, for example, take a second argument specifying whether the comparison is
+case sensitive or not:
+
+```c++
+REQUIRE_THAT( str, EndsWith( "as a service", Catch::CaseSensitive::No ) );
+ ```
+
+And matchers can be combined:
+
+```c++
+REQUIRE_THAT( str,
+ EndsWith( "as a service" ) ||
+ (StartsWith( "Big data" ) && !Contains( "web scale" ) ) );
+```
+
+## Built in matchers
+Catch currently provides some matchers, they are in the `Catch::Matchers` and `Catch` namespaces.
+
+### String matchers
+The string matchers are `StartsWith`, `EndsWith`, `Contains`, `Equals` and `Matches`. The first four match a literal (sub)string against a result, while `Matches` takes and matches an ECMAScript regex. Do note that `Matches` matches the string as a whole, meaning that "abc" will not match against "abcd", but "abc.*" will.
+
+Each of the provided `std::string` matchers also takes an optional second argument, that decides case sensitivity (by-default, they are case sensitive).
+
+
+### Vector matchers
+The vector matchers are `Contains`, `VectorContains` and `Equals`. `VectorContains` looks for a single element in the matched vector, `Contains` looks for a set (vector) of elements inside the matched vector.
+
+### Floating point matchers
+The floating point matchers are `WithinULP` and `WithinAbs`. `WithinAbs` accepts floating point numbers that are within a certain margin of target. `WithinULP` performs an [ULP](https://en.wikipedia.org/wiki/Unit_in_the_last_place)-based comparison of two floating point numbers and accepts them if they are less than certain number of ULPs apart.
+
+Do note that ULP-based checks only make sense when both compared numbers are of the same type and `WithinULP` will use type of its argument as the target type. This means that `WithinULP(1.f, 1)` will expect to compare `float`s, but `WithinULP(1., 1)` will expect to compare `double`s.
+
+
+## Custom matchers
+It's easy to provide your own matchers to extend Catch or just to work with your own types.
+
+You need to provide two things:
+1. A matcher class, derived from `Catch::MatcherBase<T>` - where `T` is the type being tested.
+The constructor takes and stores any arguments needed (e.g. something to compare against) and you must
+override two methods: `match()` and `describe()`.
+2. A simple builder function. This is what is actually called from the test code and allows overloading.
+
+Here's an example for asserting that an integer falls within a given range
+(note that it is all inline for the sake of keeping the example short):
+
+```c++
+// The matcher class
+class IntRange : public Catch::MatcherBase<int> {
+ int m_begin, m_end;
+public:
+ IntRange( int begin, int end ) : m_begin( begin ), m_end( end ) {}
+
+ // Performs the test for this matcher
+ virtual bool match( int const& i ) const override {
+ return i >= m_begin && i <= m_end;
+ }
+
+ // Produces a string describing what this matcher does. It should
+ // include any provided data (the begin/ end in this case) and
+ // be written as if it were stating a fact (in the output it will be
+ // preceded by the value under test).
+ virtual std::string describe() const {
+ std::ostringstream ss;
+ ss << "is between " << m_begin << " and " << m_end;
+ return ss.str();
+ }
+};
+
+// The builder function
+inline IntRange IsBetween( int begin, int end ) {
+ return IntRange( begin, end );
+}
+
+// ...
+
+// Usage
+TEST_CASE("Integers are within a range")
+{
+ CHECK_THAT( 3, IsBetween( 1, 10 ) );
+ CHECK_THAT( 100, IsBetween( 1, 10 ) );
+}
+```
+
+Running this test gives the following in the console:
+
+```
+/**/TestFile.cpp:123: FAILED:
+ CHECK_THAT( 100, IsBetween( 1, 10 ) )
+with expansion:
+ 100 is between 1 and 10
+```
+
+---
+
+[Home](Readme.md#top)
diff --git a/docs/opensource-users.md b/docs/opensource-users.md
new file mode 100644
index 0000000..43596cc
--- /dev/null
+++ b/docs/opensource-users.md
@@ -0,0 +1,99 @@
+<a id="top"></a>
+# Open Source projects using Catch
+
+Catch is great for open source. With its [liberal license](../LICENSE.txt) and single-header, dependency-free, distribution
+it's easy to just drop the header into your project and start writing tests - what's not to like?
+
+As a result Catch is now being used in many Open Source projects, including some quite well known ones.
+This page is an attempt to track those projects. Obviously it can never be complete.
+This effort largely relies on the maintainers of the projects themselves updating this page and submitting a PR
+(or, if you prefer contact one of the maintainers of Catch directly, use the
+[forums](https://groups.google.com/forum/?fromgroups#!forum/catch-forum)), or raise an [issue](https://github.com/philsquared/Catch/issues) to let us know).
+Of course users of those projects might want to update this page too. That's fine - as long you're confident the project maintainers won't mind.
+If you're an Open Source project maintainer and see your project listed here but would rather it wasn't -
+just let us know via any of the previously mentioned means - although I'm sure there won't be many who feel that way.
+
+Listing a project here does not imply endorsement and the plan is to keep these ordered alphabetically to avoid an implication of relative importance.
+
+## Libraries & Frameworks
+
+### [Azmq](https://github.com/zeromq/azmq)
+Boost Asio style bindings for ZeroMQ
+
+### [ChakraCore](https://github.com/Microsoft/ChakraCore)
+The core part of the Chakra Javascript engine that powers Microsoft Edge
+
+### [ChaiScript](https://github.com/ChaiScript/ChaiScript)
+A, header-only, embedded scripting language designed from the ground up to directly target C++ and take advantage of modern C++ development techniques
+
+### [Clara](https://github.com/philsquared/Clara)
+A, single-header-only, type-safe, command line parser - which also prints formatted usage strings.
+
+### [Couchbase-lite-core](https://github.com/couchbase/couchbase-lite-core)
+The next-generation core storage and query engine for Couchbase Lite
+
+### [DtCraft](https://github.com/twhuang-uiuc/DtCraft)
+A High-performance Cluster Computing Engine
+
+### [forest](https://github.com/xorz57/forest)
+Forest is an open-source, template library of tree data structures written in C++11.
+
+### [Fuxedo](https://github.com/fuxedo/fuxedo)
+Open source Oracle Tuxedo-like XATMI middleware for C and C++.
+
+### [Inja](https://github.com/pantor/inja)
+A header-only template engine for modern C++.
+
+### [JSON for Modern C++](https://github.com/nlohmann/json)
+A, single-header, JSON parsing library that takes advantage of what C++ has to offer.
+
+### [MNMLSTC Core](https://github.com/mnmlstc/core)
+A small and easy to use C++11 library that adds a functionality set that will be available in C++14 and later, as well as some useful additions.
+
+### [nanodbc](https://github.com/lexicalunit/nanodbc/)
+A small C++ library wrapper for the native C ODBC API.
+
+### [Nonius](https://github.com/libnonius/nonius)
+A header-only framework for benchmarking small snippets of C++ code.
+
+### [SOCI](https://github.com/SOCI/soci)
+The C++ Database Access Library
+
+### [polymorphic_value](https://github.com/jbcoe/polymorphic_value)
+A polymorphic value-type for C++
+
+### [Ppconsul](https://github.com/oliora/ppconsul)
+A C++ client library for Consul. Consul is a distributed tool for discovering and configuring services in your infrastructure
+
+### [Reactive-Extensions/ RxCpp](https://github.com/Reactive-Extensions/RxCpp)
+A library of algorithms for values-distributed-in-time
+
+### [TextFlowCpp](https://github.com/philsquared/textflowcpp)
+A small, single-header-only, library for wrapping and composing columns of text
+
+### [Trompeloeil](https://github.com/rollbear/trompeloeil)
+A thread safe header only mocking framework for C++14
+
+### [args](https://github.com/Taywee/args)
+A simple header-only C++ argument parser library.
+
+## Applications & Tools
+
+### [ArangoDB](https://github.com/arangodb/arangodb)
+ArangoDB is a native multi-model database with flexible data models for documents, graphs, and key-values.
+
+### [Giada - Your Hardcore Loop Machine](https://github.com/monocasual/giada)
+Minimal, open-source and cross-platform audio tool for live music production.
+
+### [MAME](https://github.com/mamedev/mame)
+MAME originally stood for Multiple Arcade Machine Emulator
+
+### [Newsbeuter](https://github.com/akrennmair/newsbeuter)
+Newsbeuter is an open-source RSS/Atom feed reader for text terminals.
+
+### [Standardese](https://github.com/foonathan/standardese)
+Standardese aims to be a nextgen Doxygen
+
+---
+
+[Home](Readme.md#top)
diff --git a/docs/own-main.md b/docs/own-main.md
new file mode 100644
index 0000000..18d1b7d
--- /dev/null
+++ b/docs/own-main.md
@@ -0,0 +1,125 @@
+<a id="top"></a>
+# Supplying main() yourself
+
+The easiest way to use Catch is to let it supply ```main()``` for you and handle configuring itself from the command line.
+
+This is achieved by writing ```#define CATCH_CONFIG_MAIN``` before the ```#include "catch.hpp"``` in *exactly one* source file.
+
+Sometimes, though, you need to write your own version of main(). You can do this by writing ```#define CATCH_CONFIG_RUNNER``` instead. Now you are free to write ```main()``` as normal and call into Catch yourself manually.
+
+You now have a lot of flexibility - but here are three recipes to get your started:
+
+## Let Catch take full control of args and config
+
+If you just need to have code that executes before and/ or after Catch this is the simplest option.
+
+```c++
+#define CATCH_CONFIG_RUNNER
+#include "catch.hpp"
+
+int main( int argc, char* argv[] ) {
+ // global setup...
+
+ int result = Catch::Session().run( argc, argv );
+
+ // global clean-up...
+
+ return result;
+}
+```
+
+## Amending the config
+
+If you still want Catch to process the command line, but you want to programatically tweak the config, you can do so in one of two ways:
+
+```c++
+#define CATCH_CONFIG_RUNNER
+#include "catch.hpp"
+
+int main( int argc, char* argv[] )
+{
+ Catch::Session session; // There must be exactly one instance
+
+ // writing to session.configData() here sets defaults
+ // this is the preferred way to set them
+
+ int returnCode = session.applyCommandLine( argc, argv );
+ if( returnCode != 0 ) // Indicates a command line error
+ return returnCode;
+
+ // writing to session.configData() or session.Config() here
+ // overrides command line args
+ // only do this if you know you need to
+
+ int numFailed = session.run();
+
+ // numFailed is clamped to 255 as some unices only use the lower 8 bits.
+ // This clamping has already been applied, so just return it here
+ // You can also do any post run clean-up here
+ return numFailed;
+}
+```
+
+Take a look at the definitions of Config and ConfigData to see what you can do with them.
+
+To take full control of the config simply omit the call to ```applyCommandLine()```.
+
+## Adding your own command line options
+
+Catch embeds a powerful command line parser called [Clara](https://github.com/philsquared/Clara).
+As of Catch2 (and Clara 1.0) Clara allows you to write _composable_ option and argument parsers,
+so extending Catch's own command line options is now easy.
+
+```c++
+#define CATCH_CONFIG_RUNNER
+#include "catch.hpp"
+
+int main( int argc, char* argv[] )
+{
+ Catch::Session session; // There must be exactly one instance
+
+ int height = 0; // Some user variable you want to be able to set
+
+ // Build a new parser on top of Catch's
+ using namespace Catch::clara;
+ auto cli
+ = session.cli() // Get Catch's composite command line parser
+ | Opt( height, "height" ) // bind variable to a new option, with a hint string
+ ["-g"]["--height"] // the option names it will respond to
+ ("how high?"); // description string for the help output
+
+ // Now pass the new composite back to Catch so it uses that
+ session.cli( cli );
+
+ // Let Catch (using Clara) parse the command line
+ int returnCode = session.applyCommandLine( argc, argv );
+ if( returnCode != 0 ) // Indicates a command line error
+ return returnCode;
+
+ // if set on the command line then 'height' is now set at this point
+ if( height > 0 )
+ std::cout << "height: " << height << std::endl;
+
+ return session.run();
+}
+```
+
+See the [Clara documentation](https://github.com/philsquared/Clara/blob/master/README.md) for more details.
+
+
+## Version detection
+
+Catch provides a triplet of macros providing the header's version,
+
+* `CATCH_VERSION_MAJOR`
+* `CATCH_VERSION_MINOR`
+* `CATCH_VERSION_PATCH`
+
+these macros expand into a single number, that corresponds to the appropriate
+part of the version. As an example, given single header version v2.3.4,
+the macros would expand into `2`, `3`, and `4` respectively.
+
+
+---
+
+[Home](Readme.md#top)
diff --git a/docs/release-notes.md b/docs/release-notes.md
new file mode 100644
index 0000000..565d6cd
--- /dev/null
+++ b/docs/release-notes.md
@@ -0,0 +1,484 @@
+<a id="top"></a>
+
+# 2.1.1
+
+## Improvements
+* Static arrays are now properly stringified like ranges across MSVC/GCC/Clang
+* Embedded newer version of Clara -- v1.1.1
+ * This should fix some warnings dragged in from Clara
+* MSVC's CLR exceptions are supported
+
+
+## Fixes
+* Fixed compilation when comparison operators do not return bool (#1147)
+* Fixed CLR exceptions blowing up the executable during translation (#1138)
+
+
+## Other changes
+* Many CMake changes
+ * `NO_SELFTEST` option is deprecated, use `BUILD_TESTING` instead.
+ * Catch specific CMake options were prefixed with `CATCH_` for namespacing purposes
+ * Other changes to simplify Catch2's packaging
+
+
+
+# 2.1.0
+
+## Improvements
+* Various performance improvements
+ * On top of the performance regression fixes
+* Experimental support for PCH was added (#1061)
+* `CATCH_CONFIG_EXTERNAL_INTERFACES` now brings in declarations of Console, Compact, XML and JUnit reporters
+* `MatcherBase` no longer has a pointless second template argument
+* Reduced the number of warning suppressions that leak into user's code
+ * Bugs in g++ 4.x and 5.x mean that some of them have to be left in
+
+
+## Fixes
+* Fixed performance regression from Catch classic
+ * One of the performance improvement patches for Catch classic was not applied to Catch2
+* Fixed platform detection for iOS (#1084)
+* Fixed compilation when `g++` is used together with `libc++` (#1110)
+* Fixed TeamCity reporter compilation with the single header version
+ * To fix the underlying issue we will be versioning reporters in single_include folder per release
+* The XML reporter will now report `WARN` messages even when not used with `-s`
+* Fixed compilation when `VectorContains` matcher was combined using `&&` (#1092)
+* Fixed test duration overflowing after 10 seconds (#1125, #1129)
+* Fixed `std::uncaught_exception` deprecation warning (#1124)
+
+
+## New features
+* New Matchers
+ * Regex matcher for strings, `Matches`.
+ * Set-equal matcher for vectors, `UnorderedEquals`
+ * Floating point matchers, `WithinAbs` and `WithinULP`.
+* Stringification now attempts to decompose all containers (#606)
+ * Containers are objects that respond to ADL `begin(T)` and `end(T)`.
+
+
+## Other changes
+* Reporters will now be versioned in the `single_include` folder to ensure their compatibility with the last released version
+
+
+
+
+# 2.0.1
+
+## Breaking changes
+* Removed C++98 support
+* Removed legacy reporter support
+* Removed legacy generator support
+ * Generator support will come back later, reworked
+* Removed `Catch::toString` support
+ * The new stringification machinery uses `Catch::StringMaker` specializations first and `operator<<` overloads second.
+* Removed legacy `SCOPED_MSG` and `SCOPED_INFO` macros
+* Removed `INTERNAL_CATCH_REGISTER_REPORTER`
+ * `CATCH_REGISTER_REPORTER` should be used to register reporters
+* Removed legacy `[hide]` tag
+ * `[.]`, `[.foo]` and `[!hide]` are still supported
+* Output into debugger is now colourized
+* `*_THROWS_AS(expr, exception_type)` now unconditionally appends `const&` to the exception type.
+* `CATCH_CONFIG_FAST_COMPILE` now affects the `CHECK_` family of assertions as well as `REQUIRE_` family of assertions
+ * This is most noticeable in `CHECK(throws())`, which would previously report failure, properly stringify the exception and continue. Now it will report failure and stop executing current section.
+* Removed deprecated matcher utility functions `Not`, `AllOf` and `AnyOf`.
+ * They are superseded by operators `!`, `&&` and `||`, which are natural and do not have limited arity
+* Removed support for non-const comparison operators
+ * Non-const comparison operators are an abomination that should not exist
+ * They were breaking support for comparing function to function pointer
+* `std::pair` and `std::tuple` are no longer stringified by default
+ * This is done to avoid dragging in `<tuple>` and `<utility>` headers in common path
+ * Their stringification can be enabled per-file via new configuration macros
+* `Approx` is subtly different and hopefully behaves more as users would expect
+ * `Approx::scale` defaults to `0.0`
+ * `Approx::epsilon` no longer applies to the larger of the two compared values, but only to the `Approx`'s value
+ * `INFINITY == Approx(INFINITY)` returns true
+
+
+## Improvements
+* Reporters and Listeners can be defined in files different from the main file
+ * The file has to define `CATCH_CONFIG_EXTERNAL_INTERFACES` before including catch.hpp.
+* Errors that happen during set up before main are now caught and properly reported once main is entered
+ * If you are providing your own main, you can access and use these as well.
+* New assertion macros, *_THROWS_MATCHES(expr, exception_type, matcher) are provided
+ * As the arguments suggest, these allow you to assert that an expression throws desired type of exception and pass the exception to a matcher.
+* JUnit reporter no longer has significantly different output for test cases with and without sections
+* Most assertions now support expressions containing commas (ie `REQUIRE(foo() == std::vector<int>{1, 2, 3});`)
+* Catch now contains experimental micro benchmarking support
+ * See `projects/SelfTest/Benchmark.tests.cpp` for examples
+ * The support being experiment means that it can be changed without prior notice
+* Catch uses new CLI parsing library (Clara)
+ * Users can now easily add new command line options to the final executable
+ * This also leads to some changes in `Catch::Session` interface
+* All parts of matchers can be removed from a TU by defining `CATCH_CONFIG_DISABLE_MATCHERS`
+ * This can be used to somewhat speed up compilation times
+* An experimental implementation of `CATCH_CONFIG_DISABLE` has been added
+ * Inspired by Doctest's `DOCTEST_CONFIG_DISABLE`
+ * Useful for implementing tests in source files
+ * ie for functions in anonymous namespaces
+ * Removes all assertions
+ * Prevents `TEST_CASE` registrations
+ * Exception translators are not registered
+ * Reporters are not registered
+ * Listeners are not registered
+* Reporters/Listeners are now notified of fatal errors
+ * This means specific signals or structured exceptions
+ * The Reporter/Listener interface provides default, empty, implementation to preserve backward compatibility
+* Stringification of `std::chrono::duration` and `std::chrono::time_point` is now supported
+ * Needs to be enabled by a per-file compile time configuration option
+* Add `pkg-config` support to CMake install command
+
+
+## Fixes
+* Don't use console colour if running in XCode
+* Explicit constructor in reporter base class
+* Swept out `-Wweak-vtables`, `-Wexit-time-destructors`, `-Wglobal-constructors` warnings
+* Compilation for Universal Windows Platform (UWP) is supported
+ * SEH handling and colorized output are disabled when compiling for UWP
+* Implemented a workaround for `std::uncaught_exception` issues in libcxxrt
+ * These issues caused incorrect section traversals
+ * The workaround is only partial, user's test can still trigger the issue by using `throw;` to rethrow an exception
+* Suppressed C4061 warning under MSVC
+
+
+## Internal changes
+* The development version now uses .cpp files instead of header files containing implementation.
+ * This makes partial rebuilds much faster during development
+* The expression decomposition layer has been rewritten
+* The evaluation layer has been rewritten
+* New library (TextFlow) is used for formatting text to output
+
+
+# Older versions
+
+## 1.11.x
+
+### 1.11.0
+
+#### Fixes
+* The original expression in `REQUIRE_FALSE( expr )` is now reporter properly as `!( expr )` (#1051)
+ * Previously the parentheses were missing and `x != y` would be expanded as `!x != x`
+* `Approx::Margin` is now inclusive (#952)
+ * Previously it was meant and documented as inclusive, but the check itself wasn't
+ * This means that `REQUIRE( 0.25f == Approx( 0.0f ).margin( 0.25f ) )` passes, instead of fails
+* `RandomNumberGenerator::result_type` is now unsigned (#1050)
+
+#### Improvements
+* `__JETBRAINS_IDE__` macro handling is now CLion version specific (#1017)
+ * When CLion 2017.3 or newer is detected, `__COUNTER__` is used instead of
+* TeamCity reporter now explicitly flushes output stream after each report (#1057)
+ * On some platforms, output from redirected streams would show up only after the tests finished running
+* `ParseAndAddCatchTests` now can add test files as dependency to CMake configuration
+ * This means you do not have to manually rerun CMake configuration step to detect new tests
+
+## 1.10.x
+
+### 1.10.0
+
+#### Fixes
+* Evaluation layer has been rewritten (backported from Catch 2)
+ * The new layer is much simpler and fixes some issues (#981)
+* Implemented workaround for VS 2017 raw string literal stringification bug (#995)
+* Fixed interaction between `[!shouldfail]` and `[!mayfail]` tags and sections
+ * Previously sections with failing assertions would be marked as failed, not failed-but-ok
+
+#### Improvements
+* Added [libidentify](https://github.com/janwilmans/LibIdentify) support
+* Added "wait-for-keypress" option
+
+## 1.9.x
+
+### 1.9.6
+
+#### Improvements
+* Catch's runtime overhead has been significantly decreased (#937, #939)
+* Added `--list-extra-info` cli option (#934).
+ * It lists all tests together with extra information, ie filename, line number and description.
+
+
+
+### 1.9.5
+
+#### Fixes
+* Truthy expressions are now reconstructed properly, not as booleans (#914)
+* Various warnings are no longer erroneously suppressed in test files (files that include `catch.hpp`, but do not define `CATCH_CONFIG_MAIN` or `CATCH_CONFIG_RUNNER`) (#871)
+* Catch no longer fails to link when main is compiled as C++, but linked against Objective-C (#855)
+* Fixed incorrect gcc version detection when deciding to use `__COUNTER__` (#928)
+ * Previously any GCC with minor version less than 3 would be incorrectly classified as not supporting `__COUNTER__`.
+* Suppressed C4996 warning caused by upcoming updated to MSVC 2017, marking `std::uncaught_exception` as deprecated. (#927)
+
+#### Improvements
+* CMake integration script now incorporates debug messages and registers tests in an improved way (#911)
+* Various documentation improvements
+
+
+
+### 1.9.4
+
+#### Fixes
+* `CATCH_FAIL` macro no longer causes compilation error without variadic macro support
+* `INFO` messages are no longer cleared after being reported once
+
+#### Improvements and minor changes
+* Catch now uses `wmain` when compiled under Windows and `UNICODE` is defined.
+ * Note that Catch still officially supports only ASCII
+
+### 1.9.3
+
+#### Fixes
+* Completed the fix for (lack of) uint64_t in earlier Visual Studios
+
+### 1.9.2
+
+#### Improvements and minor changes
+* All of `Approx`'s member functions now accept strong typedefs in C++11 mode (#888)
+ * Previously `Approx::scale`, `Approx::epsilon`, `Approx::margin` and `Approx::operator()` didn't.
+
+
+#### Fixes
+* POSIX signals are now disabled by default under QNX (#889)
+ * QNX does not support current enough (2001) POSIX specification
+* JUnit no longer counts exceptions as failures if given test case is marked as ok to fail.
+* `Catch::Option` should now have its storage properly aligned.
+* Catch no longer attempts to define `uint64_t` on windows (#862)
+ * This was causing trouble when compiled under Cygwin
+
+#### Other
+* Catch is now compiled under MSVC 2017 using `std:c++latest` (C++17 mode) in CI
+* We now provide cmake script that autoregisters Catch tests into ctest.
+ * See `contrib` folder.
+
+
+### 1.9.1
+
+#### Fixes
+* Unexpected exceptions are no longer ignored by default (#885, #887)
+
+
+### 1.9.0
+
+
+#### Improvements and minor changes
+* Catch no longer attempts to ensure the exception type passed by user in `REQUIRE_THROWS_AS` is a constant reference.
+ * It was causing trouble when `REQUIRE_THROWS_AS` was used inside templated functions
+ * This actually reverts changes made in v1.7.2
+* Catch's `Version` struct should no longer be double freed when multiple instances of Catch tests are loaded into single program (#858)
+ * It is now a static variable in an inline function instead of being an `extern`ed struct.
+* Attempt to register invalid tag or tag alias now throws instead of calling `exit()`.
+ * Because this happen before entering main, it still aborts execution
+ * Further improvements to this are coming
+* `CATCH_CONFIG_FAST_COMPILE` now speeds-up compilation of `REQUIRE*` assertions by further ~15%.
+ * The trade-off is disabling translation of unexpected exceptions into text.
+* When Catch is compiled using C++11, `Approx` is now constructible with anything that can be explicitly converted to `double`.
+* Captured messages are now printed on unexpected exceptions
+
+#### Fixes:
+* Clang's `-Wexit-time-destructors` should be suppressed for Catch's internals
+* GCC's `-Wparentheses` is now suppressed for all TU's that include `catch.hpp`.
+ * This is functionally a revert of changes made in 1.8.0, where we tried using `_Pragma` based suppression. This should have kept the suppression local to Catch's assertions, but bugs in GCC's handling of `_Pragma`s in C++ mode meant that it did not always work.
+* You can now tell Catch to use C++11-based check when checking whether a type can be streamed to output.
+ * This fixes cases when an unstreamable type has streamable private base (#877)
+ * [Details can be found in documentation](configuration.md#catch_config_cpp11_stream_insertable_check)
+
+
+#### Other notes:
+* We have added VS 2017 to our CI
+* Work on Catch 2 should start soon
+
+
+
+## 1.8.x
+
+### 1.8.2
+
+
+#### Improvements and minor changes
+* TAP reporter now behaves as if `-s` was always set
+ * This should be more consistent with the protocol desired behaviour.
+* Compact reporter now obeys `-d yes` argument (#780)
+ * The format is "XXX.123 s: <section-name>" (3 decimal places are always present).
+ * Before it did not report the durations at all.
+* XML reporter now behaves the same way as Console reporter in regards to `INFO`
+ * This means it reports `INFO` messages on success, if output on success (`-s`) is enabled.
+ * Previously it only reported `INFO` messages on failure.
+* `CAPTURE(expr)` now stringifies `expr` in the same way assertion macros do (#639)
+* Listeners are now finally [documented](event-listeners.md#top).
+ * Listeners provide a way to hook into events generated by running your tests, including start and end of run, every test case, every section and every assertion.
+
+
+#### Fixes:
+* Catch no longer attempts to reconstruct expression that led to a fatal error (#810)
+ * This fixes possible signal/SEH loop when processing expressions, where the signal was triggered by expression decomposition.
+* Fixed (C4265) missing virtual destructor warning in Matchers (#844)
+* `std::string`s are now taken by `const&` everywhere (#842).
+ * Previously some places were taking them by-value.
+* Catch should no longer change errno (#835).
+ * This was caused by libstdc++ bug that we now work around.
+* Catch now provides `FAIL_CHECK( ... )` macro (#765).
+ * Same as `FAIL( ... )`, but does not abort the test.
+* Functions like `fabs`, `tolower`, `memset`, `isalnum` are now used with `std::` qualification (#543).
+* Clara no longer assumes first argument (binary name) is always present (#729)
+ * If it is missing, empty string is used as default.
+* Clara no longer reads 1 character past argument string (#830)
+* Regression in Objective-C bindings (Matchers) fixed (#854)
+
+
+#### Other notes:
+* We have added VS 2013 and 2015 to our CI
+* Catch Classic (1.x.x) now contains its own, forked, version of Clara (the argument parser).
+
+
+
+### 1.8.1
+
+#### Fixes
+
+Cygwin issue with `gettimeofday` - `#define` was not early enough
+
+### 1.8.0
+
+#### New features/ minor changes
+
+* Matchers have new, simpler (and documented) interface.
+ * Catch provides string and vector matchers.
+ * For details see [Matchers documentation](matchers.md#top).
+* Changed console reporter test duration reporting format (#322)
+ * Old format: `Some simple comparisons between doubles completed in 0.000123s`
+ * New format: `xxx.123s: Some simple comparisons between doubles` _(There will always be exactly 3 decimal places)_
+* Added opt-in leak detection under MSVC + Windows (#439)
+ * Enable it by compiling Catch's main with `CATCH_CONFIG_WINDOWS_CRTDBG`
+* Introduced new compile-time flag, `CATCH_CONFIG_FAST_COMPILE`, trading features for compilation speed.
+ * Moves debug breaks out of tests and into implementation, speeding up test compilation time (~10% on linux).
+ * _More changes are coming_
+* Added [TAP (Test Anything Protocol)](https://testanything.org/) and [Automake](https://www.gnu.org/software/automake/manual/html_node/Log-files-generation-and-test-results-recording.html#Log-files-generation-and-test-results-recording) reporters.
+ * These are not present in the default single-include header and need to be downloaded from GitHub separately.
+ * For details see [documentation about integrating with build systems](build-systems.md#top).
+* XML reporter now reports filename as part of the `Section` and `TestCase` tags.
+* `Approx` now supports an optional margin of absolute error
+ * It has also received [new documentation](assertions.md#top).
+
+#### Fixes
+* Silenced C4312 ("conversion from int to 'ClassName *") warnings in the evaluate layer.
+* Fixed C4512 ("assignment operator could not be generated") warnings under VS2013.
+* Cygwin compatibility fixes
+ * Signal handling is no longer compiled by default.
+ * Usage of `gettimeofday` inside Catch should no longer cause compilation errors.
+* Improved `-Wparentheses` supression for gcc (#674)
+ * When compiled with gcc 4.8 or newer, the supression is localized to assertions only
+ * Otherwise it is supressed for the whole TU
+* Fixed test spec parser issue (with escapes in multiple names)
+
+#### Other
+* Various documentation fixes and improvements
+
+
+## 1.7.x
+
+### 1.7.2
+
+#### Fixes and minor improvements
+Xml:
+
+(technically the first two are breaking changes but are also fixes and arguably break few if any people)
+* C-escape control characters instead of XML encoding them (which requires XML 1.1)
+* Revert XML output to XML 1.0
+* Can provide stylesheet references by extending the XML reporter
+* Added description and tags attribites to XML Reporter
+* Tags are closed and the stream flushed more eagerly to avoid stdout interpolation
+
+
+Other:
+* `REQUIRE_THROWS_AS` now catches exception by `const&` and reports expected type
+* In `SECTION`s the file/ line is now of the `SECTION`. not the `TEST_CASE`
+* Added std:: qualification to some functions from C stdlib
+* Removed use of RTTI (`dynamic_cast`) that had crept back in
+* Silenced a few more warnings in different circumstances
+* Travis improvements
+
+### 1.7.1
+
+#### Fixes:
+* Fixed inconsistency in defining `NOMINMAX` and `WIN32_LEAN_AND_MEAN` inside `catch.hpp`.
+* Fixed SEH-related compilation error under older MinGW compilers, by making Windows SEH handling opt-in for compilers other than MSVC.
+ * For specifics, look into the [documentation](configuration.md#top).
+* Fixed compilation error under MinGW caused by improper compiler detection.
+* Fixed XML reporter sometimes leaving an empty output file when a test ends with signal/structured exception.
+* Fixed XML reporter not reporting captured stdout/stderr.
+* Fixed possible infinite recursion in Windows SEH.
+* Fixed possible compilation error caused by Catch's operator overloads being ambiguous in regards to user-defined templated operators.
+
+### 1.7.0
+
+#### Features/ Changes:
+* Catch now runs significantly faster for passing tests
+ * Microbenchmark focused on Catch's overhead went from ~3.4s to ~0.7s.
+ * Real world test using [JSON for Modern C++](https://github.com/nlohmann/json)'s test suite went from ~6m 25s to ~4m 14s.
+* Catch can now run specific sections within test cases.
+ * For now the support is only basic (no wildcards or tags), for details see the [documentation](command-line.md#top).
+* Catch now supports SEH on Windows as well as signals on Linux.
+ * After receiving a signal, Catch reports failing assertion and then passes the signal onto the previous handler.
+* Approx can be used to compare values against strong typedefs (available in C++11 mode only).
+ * Strong typedefs mean types that are explicitly convertible to double.
+* CHECK macro no longer stops executing section if an exception happens.
+* Certain characters (space, tab, etc) are now pretty printed.
+ * This means that a `char c = ' '; REQUIRE(c == '\t');` would be printed as `' ' == '\t'`, instead of ` == 9`.
+
+#### Fixes:
+* Text formatting no longer attempts to access out-of-bounds characters under certain conditions.
+* THROW family of assertions no longer trigger `-Wunused-value` on expressions containing explicit cast.
+* Breaking into debugger under OS X works again and no longer required `DEBUG` to be defined.
+* Compilation no longer breaks under certain compiler if a lambda is used inside assertion macro.
+
+#### Other:
+* Catch's CMakeLists now defines install command.
+* Catch's CMakeLists now generates projects with warnings enabled.
+
+
+## 1.6.x
+
+### 1.6.1
+
+#### Features/ Changes:
+* Catch now supports breaking into debugger on Linux
+
+#### Fixes:
+* Generators no longer leak memory (generators are still unsupported in general)
+* JUnit reporter now reports UTC timestamps, instead of "tbd"
+* `CHECK_THAT` macro is now properly defined as `CATCH_CHECK_THAT` when using `CATCH_` prefixed macros
+
+#### Other:
+* Types with overloaded `&&` operator are no longer evaluated twice when used in an assertion macro.
+* The use of `__COUNTER__` is supressed when Catch is parsed by CLion
+ * This change is not active when compiling a binary
+* Approval tests can now be run on Windows
+* CMake will now warn if a file is present in the `include` folder but not is not enumerated as part of the project
+* Catch now defines `NOMINMAX` and `WIN32_LEAN_AND_MEAN` before including `windows.h`
+ * This can be disabled if needed, see [documentation](configuration.md#top) for details.
+
+
+### 1.6.0
+
+#### Cmake/ projects:
+* Moved CMakeLists.txt to root, made it friendlier for CLion and generating XCode and VS projects, and removed the manually maintained XCode and VS projects.
+
+#### Features/ Changes:
+* Approx now supports `>=` and `<=`
+* Can now use `\` to escape chars in test names on command line
+* Standardize C++11 feature toggles
+
+#### Fixes:
+* Blue shell colour
+* Missing argument to `CATCH_CHECK_THROWS`
+* Don't encode extended ASCII in XML
+* use `std::shuffle` on more compilers (fixes deprecation warning/error)
+* Use `__COUNTER__` more consistently (where available)
+
+#### Other:
+* Tweaks and changes to scripts - particularly for Approval test - to make them more portable
+
+
+# Even Older versions
+Release notes were not maintained prior to v1.6.0, but you should be able to work them out from the Git history
+
+---
+
+[Home](Readme.md#top)
diff --git a/docs/release-process.md b/docs/release-process.md
new file mode 100644
index 0000000..433777b
--- /dev/null
+++ b/docs/release-process.md
@@ -0,0 +1,65 @@
+<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 proces in doing so, that no steps are forgotten. Note that all referenced scripts can be found in the `scripts/` directory.
+
+## Neccessary steps
+
+These steps are neccessary and have to be performed before each new release. They serve to make sure that the new release is correct and linked-to from the standard places.
+
+
+### Approval testing
+
+Catch's releases are primarily validated against output from previous release, stored in `projects/SelfTest/Baselines`. To validate current sources, build the SelfTest binary and pass it to the `approvalTests.py` script: `approvalTests.py <path/to/SelfTest>`.
+
+There should be no differences, as Approval tests should be updated when changes to Catch are made, but if there are, then they need to be manually reviewed and either approved (using `approve.py`) or Catch requires other fixes.
+
+
+### Incrementing version number
+
+Catch uses a variant of [semantic versioning](http://semver.org/), with breaking API changes (and thus major version increments) being very rare. Thus, the release will usually increment the patch version, when it only contains couple of bugfixes, or minor version, when it contains new functionality, or larger changes in implementation of current functionality.
+
+After deciding which part of version number should be incremented, you can use one of the `*Release.py` scripts to perform the required changes to Catch.
+
+This will take care of generating the single include header, updating
+version numbers everywhere and pushing the new version to Wandbox.
+
+
+### Release notes
+
+Once a release is ready, release notes need to be written. They should summarize changes done since last release. For rough idea of expected notes see previous releases. Once written, release notes should be placed in `docs/release-notes.md`.
+
+
+### Commit and push update to GitHub
+
+After version number is incremented, single-include header is regenerated and release notes are updated, changes should be commited and pushed to GitHub.
+
+
+### Release on GitHub
+
+After pushing changes to GitHub, GitHub release *needs* to be created.
+Tag version and release title should be same as the new version,
+description should contain the release notes for the current release.
+Single header version of `catch.hpp` *needs* to be attached as a binary,
+as that is where the official download link links to. Preferably
+it should use linux line endings. All non-bundled reporters (Automake,
+TAP, TeamCity) should also be attached as binaries, as they are dependent
+on a specific version of the single-include header.
+
+
+## Optional steps
+
+The following steps are optional, and do not have to be performed when releasing new version of Catch. However, they *should* happen, but they can happen the next day without losing anything significant.
+
+
+### vcpkg update
+
+Catch is maintaining its own port in Microsoft's package manager [vcpkg](https://github.com/Microsoft/vcpkg). This means that when new version of Catch is released, it should be posted there as well. `updateVcpkgPackage.py` can do a lot of neccessary work for you, it creates a branch and commits neccessary changes. You should review these changes, push and open a PR against vcpkg's upstream.
+
+Note that the script assumes you have your fork of vcpkg checked out in a directory next to the directory where you have checked out Catch, like so:
+```
+GitHub
+ Catch
+ vcpkg
+```
+
diff --git a/docs/reporters.md b/docs/reporters.md
new file mode 100644
index 0000000..78e78ee
--- /dev/null
+++ b/docs/reporters.md
@@ -0,0 +1,46 @@
+<a id="top"></a>
+# Reporters
+
+Catch has a modular reporting system and comes bundled with a handful of useful reporters built in.
+You can also write your own reporters.
+
+## Using different reporters
+
+The reporter to use can easily be controlled from the command line.
+To specify a reporter use [`-r` or `--reporter`](command-line.md#choosing-a-reporter-to-use), followed by the name of the reporter, e.g.:
+
+```
+-r xml
+```
+
+If you don't specify a reporter then the console reporter is used by default.
+There are four reporters built in to the single include:
+
+* `console` writes as lines of text, formatted to a typical terminal width, with colours if a capable terminal is detected.
+* `compact` similar to `console` but optimised for minimal output - each entry on one line
+* `junit` writes xml that corresponds to Ant's [junitreport](http://help.catchsoftware.com/display/ET/JUnit+Format) target. Useful for build systems that understand Junit.
+Because of the way the junit format is structured the run must complete before anything is written.
+* `xml` writes an xml format tailored to Catch. Unlike `junit` this is a streaming format so results are delivered progressively.
+
+There are a few additional reporters, for specific build systems, in the Catch repository (in `include\reporters`) which you can `#include` in your project if you would like to make use of them.
+Do this in one source file - the same one you have `CATCH_CONFIG_MAIN` or `CATCH_CONFIG_RUNNER`.
+
+* `teamcity` writes the native, streaming, format that [TeamCity](https://www.jetbrains.com/teamcity/) understands.
+Use this when building as part of a TeamCity build to see results as they happen.
+* `tap` writes in the TAP ([Test Anything Protocol](https://en.wikipedia.org/wiki/Test_Anything_Protocol)) format.
+* `automake` writes in a format that correspond to [automake .trs](https://www.gnu.org/software/automake/manual/html_node/Log-files-generation-and-test-results-recording.html) files
+
+You see what reporters are available from the command line by running with `--list-reporters`.
+
+By default all these reports are written to stdout, but can be redirected to a file with [`-o` or `--out`](command-line.md#sending-output-to-a-file)
+
+## Writing your own reporter
+
+You can write your own custom reporter and register it with Catch.
+At time of writing the interface is subject to some changes so is not, yet, documented here.
+If you are determined you shouldn't have too much trouble working it out from the existing implementations -
+but do keep in mind upcoming changes (these will be minor, simplifying, changes such as not needing to forward calls to the base class).
+
+---
+
+[Home](Readme.md#top)
diff --git a/docs/slow-compiles.md b/docs/slow-compiles.md
new file mode 100644
index 0000000..0853b66
--- /dev/null
+++ b/docs/slow-compiles.md
@@ -0,0 +1,71 @@
+<a id="top"></a>
+# Why do my tests take so long to compile?
+
+**Contents**<br>
+[Short answer](#short-answer)<br>
+[Long answer](#long-answer)<br>
+[Practical example](#practical-example)<br>
+[Other possible solutions](#other-possible-solutions)<br>
+
+Several people have reported that test code written with Catch takes much longer to compile than they would expect. Why is that?
+
+Catch is implemented entirely in headers. There is a little overhead due to this - but not as much as you might think - and you can minimise it simply by organising your test code as follows:
+
+## Short answer
+Exactly one source file must ```#define``` either ```CATCH_CONFIG_MAIN``` or ```CATCH_CONFIG_RUNNER``` before ```#include```-ing Catch. In this file *do not write any test cases*! In most cases that means this file will just contain two lines (the ```#define``` and the ```#include```).
+
+## Long answer
+
+Usually C++ code is split between a header file, containing declarations and prototypes, and an implementation file (.cpp) containing the definition, or implementation, code. Each implementation file, along with all the headers that it includes (and which those headers include, etc), is expanded into a single entity called a translation unit - which is then passed to the compiler and compiled down to an object file.
+
+But functions and methods can also be written inline in header files. The downside to this is that these definitions will then be compiled in *every* translation unit that includes the header.
+
+Because Catch is implemented *entirely* in headers you might think that the whole of Catch must be compiled into every translation unit that uses it! Actually it's not quite as bad as that. Catch mitigates this situation by effectively maintaining the traditional separation between the implementation code and declarations. Internally the implementation code is protected by ```#ifdef```s and is conditionally compiled into only one translation unit. This translation unit is that one that ```#define```s ```CATCH_CONFIG_MAIN``` or ```CATCH_CONFIG_RUNNER```. Let's call this the main source file.
+
+As a result the main source file *does* compile the whole of Catch every time! So it makes sense to dedicate this file to *only* ```#define```-ing the identifier and ```#include```-ing Catch (and implementing the runner code, if you're doing that). Keep all your test cases in other files. This way you won't pay the recompilation cost for the whole of Catch
+
+## Practical example
+Assume you have the `Factorial` function from the [tutorial](tutorial.md#top) in `factorial.cpp` (with forward declaration in `factorial.h`) and want to test it and keep the compile times down when adding new tests. Then you should have 2 files, `tests-main.cpp` and `tests-factorial.cpp`:
+
+```cpp
+// tests-main.cpp
+#define CATCH_CONFIG_MAIN
+#include "catch.hpp"
+```
+
+```cpp
+// tests-factorial.cpp
+#include "catch.hpp"
+
+#include "factorial.h"
+
+TEST_CASE( "Factorials are computed", "[factorial]" ) {
+ REQUIRE( Factorial(1) == 1 );
+ REQUIRE( Factorial(2) == 2 );
+ REQUIRE( Factorial(3) == 6 );
+ REQUIRE( Factorial(10) == 3628800 );
+}
+```
+
+After compiling `tests-main.cpp` once, it is enough to link it with separately compiled `tests-factorial.cpp`. This means that adding more tests to `tests-factorial.cpp`, will not result in recompiling Catch's main and the resulting compilation times will decrease substantially.
+
+```
+$ g++ tests-main.cpp -c
+$ g++ tests-main.o tests-factorial.cpp -o tests && ./tests -r compact
+Passed 1 test case with 4 assertions.
+```
+
+Now, the next time we change the file `tests-factorial.cpp` (say we add `REQUIRE( Factorial(0) == 1)`), it is enough to recompile the tests instead of recompiling main as well:
+
+```
+$ g++ tests-main.o tests-factorial.cpp -o tests && ./tests -r compact
+tests-factorial.cpp:11: failed: Factorial(0) == 1 for: 0 == 1
+Failed 1 test case, failed 1 assertion.
+```
+
+## Other possible solutions
+You can also opt to sacrifice some features in order to speed-up Catch's compilation times. For details see the [documentation on Catch's compile-time configuration](configuration.md#other-toggles).
+
+---
+
+[Home](Readme.md#top)
diff --git a/docs/test-cases-and-sections.md b/docs/test-cases-and-sections.md
new file mode 100644
index 0000000..68944f5
--- /dev/null
+++ b/docs/test-cases-and-sections.md
@@ -0,0 +1,91 @@
+<a id="top"></a>
+# Test cases and sections
+
+While Catch fully supports the traditional, xUnit, style of class-based fixtures containing test case methods this is not the preferred style.
+
+Instead Catch provides a powerful mechanism for nesting test case sections within a test case. For a more detailed discussion see the [tutorial](tutorial.md#test-cases-and-sections).
+
+Test cases and sections are very easy to use in practice:
+
+* **TEST_CASE(** _test name_ \[, _tags_ \] **)**
+* **SECTION(** _section name_ **)**
+
+_test name_ and _section name_ are free form, quoted, strings. The optional _tags_ argument is a quoted string containing one or more tags enclosed in square brackets. Tags are discussed below. Test names must be unique within the Catch executable.
+
+For examples see the [Tutorial](tutorial.md#top)
+
+## Tags
+
+Tags allow an arbitrary number of additional strings to be associated with a test case. Test cases can be selected (for running, or just for listing) by tag - or even by an expression that combines several tags. At their most basic level they provide a simple way to group several related tests together.
+
+As an example - given the following test cases:
+
+ TEST_CASE( "A", "[widget]" ) { /* ... */ }
+ TEST_CASE( "B", "[widget]" ) { /* ... */ }
+ TEST_CASE( "C", "[gadget]" ) { /* ... */ }
+ TEST_CASE( "D", "[widget][gadget]" ) { /* ... */ }
+
+The tag expression, ```"[widget]"``` selects A, B & D. ```"[gadget]"``` selects C & D. ```"[widget][gadget]"``` selects just D and ```"[widget],[gadget]"``` selects all four test cases.
+
+For more detail on command line selection see [the command line docs](command-line.md#specifying-which-tests-to-run)
+
+Tag names are not case sensitive and can contain any ASCII characters. This means that tags `[tag with spaces]` and `[I said "good day"]` are both allowed tags and can be filtered on. Escapes are not supported however and `[\]]` is not a valid tag.
+
+### Special Tags
+
+All tag names beginning with non-alphanumeric characters are reserved by Catch. Catch defines a number of "special" tags, which have meaning to the test runner itself. These special tags all begin with a symbol character. Following is a list of currently defined special tags and their meanings.
+
+* `[!hide]` or `[.]` - causes test cases to be skipped from the default list (i.e. when no test cases have been explicitly selected through tag expressions or name wildcards). The hide tag is often combined with another, user, tag (for example `[.][integration]` - so all integration tests are excluded from the default run but can be run by passing `[integration]` on the command line). As a short-cut you can combine these by simply prefixing your user tag with a `.` - e.g. `[.integration]`. Because the hide tag has evolved to have several forms, all forms are added as tags if you use one of them.
+
+* `[!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`.
+
+* `[!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.
+
+* `[!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.
+
+* `[!nonportable]` - Indicates that behaviour may vary between platforms or compilers.
+
+* `[#<filename>]` - running with `-#` or `--filenames-as-tags` causes Catch to add the filename, prefixed with `#` (and with any extension stripped), as a tag to all contained tests, e.g. tests in testfile.cpp would all be tagged `[#testfile]`.
+
+* `[@<alias>]` - tag aliases all begin with `@` (see below).
+
+* `[!benchmark]` - this test case is actually a benchmark. This is an experimental feature, and currently has no documentation. If you want to try it out, look at `projects/SelfTest/Benchmark.tests.cpp` for details.
+
+## Tag aliases
+
+Between tag expressions and wildcarded test names (as well as combinations of the two) quite complex patterns can be constructed to direct which test cases are run. If a complex pattern is used often it is convenient to be able to create an alias for the expression. This can be done, in code, using the following form:
+
+ CATCH_REGISTER_TAG_ALIAS( <alias string>, <tag expression> )
+
+Aliases must begin with the `@` character. An example of a tag alias is:
+
+ CATCH_REGISTER_TAG_ALIAS( "[@nhf]", "[failing]~[.]" )
+
+Now when `[@nhf]` is used on the command line this matches all tests that are tagged `[failing]`, but which are not also hidden.
+
+## BDD-style test cases
+
+In addition to Catch's take on the classic style of test cases, Catch supports an alternative syntax that allow tests to be written as "executable specifications" (one of the early goals of [Behaviour Driven Development](http://dannorth.net/introducing-bdd/)). This set of macros map on to ```TEST_CASE```s and ```SECTION```s, with a little internal support to make them smoother to work with.
+
+* **SCENARIO(** _scenario name_ \[, _tags_ \] **)**
+
+This macro maps onto ```TEST_CASE``` and works in the same way, except that the test case name will be prefixed by "Scenario: "
+
+* **GIVEN(** _something_ **)**
+* **WHEN(** _something_ **)**
+* **THEN(** _something_ **)**
+
+These macros map onto ```SECTION```s except that the section names are the _something_s prefixed by "given: ", "when: " or "then: " respectively.
+
+* **AND_WHEN(** _something_ **)**
+* **AND_THEN(** _something_ **)**
+
+Similar to ```WHEN``` and ```THEN``` except that the prefixes start with "and ". These are used to chain ```WHEN```s and ```THEN```s together.
+
+When any of these macros are used the console reporter recognises them and formats the test case header such that the Givens, Whens and Thens are aligned to aid readability.
+
+Other than the additional prefixes and the formatting in the console reporter these macros behave exactly as ```TEST_CASE```s and ```SECTION```s. As such there is nothing enforcing the correct sequencing of these macros - that's up to the programmer!
+
+---
+
+[Home](Readme.md#top)
diff --git a/docs/test-fixtures.md b/docs/test-fixtures.md
new file mode 100644
index 0000000..1dc7bab
--- /dev/null
+++ b/docs/test-fixtures.md
@@ -0,0 +1,35 @@
+<a id="top"></a>
+# Test fixtures
+
+Although Catch allows you to group tests together as sections within a test case, it can still be convenient, sometimes, to group them using a more traditional test fixture. Catch fully supports this too. You define the test fixture as a simple structure:
+
+```c++
+class UniqueTestsFixture {
+ private:
+ static int uniqueID;
+ protected:
+ DBConnection conn;
+ public:
+ UniqueTestsFixture() : conn(DBConnection::createConnection("myDB")) {
+ }
+ protected:
+ int getID() {
+ return ++uniqueID;
+ }
+ };
+
+ int UniqueTestsFixture::uniqueID = 0;
+
+ TEST_CASE_METHOD(UniqueTestsFixture, "Create Employee/No Name", "[create]") {
+ REQUIRE_THROWS(conn.executeSQL("INSERT INTO employee (id, name) VALUES (?, ?)", getID(), ""));
+ }
+ TEST_CASE_METHOD(UniqueTestsFixture, "Create Employee/Normal", "[create]") {
+ REQUIRE(conn.executeSQL("INSERT INTO employee (id, name) VALUES (?, ?)", getID(), "Joe Bloggs"));
+ }
+```
+
+The two test cases here will create uniquely-named derived classes of UniqueTestsFixture and thus can access the `getID()` protected method and `conn` member variables. This ensures that both the test cases are able to create a DBConnection using the same method (DRY principle) and that any ID's created are unique such that the order that tests are executed does not matter.
+
+---
+
+[Home](Readme.md#top)
diff --git a/docs/tostring.md b/docs/tostring.md
new file mode 100644
index 0000000..568c1c2
--- /dev/null
+++ b/docs/tostring.md
@@ -0,0 +1,65 @@
+<a id="top"></a>
+# String conversions
+
+Catch needs to be able to convert types you use in assertions and logging expressions into strings (for logging and reporting purposes).
+Most built-in or std types are supported out of the box but there are two ways that you can tell Catch how to convert your own types (or other, third-party types) into strings.
+
+## operator << overload for std::ostream
+
+This is the standard way of providing string conversions in C++ - and the chances are you may already provide this for your own purposes. If you're not familiar with this idiom it involves writing a free function of the form:
+
+```
+std::ostream& operator << ( std::ostream& os, T const& value ) {
+ os << convertMyTypeToString( value );
+ return os;
+}
+```
+
+(where ```T``` is your type and ```convertMyTypeToString``` is where you'll write whatever code is necessary to make your type printable - it doesn't have to be in another function).
+
+You should put this function in the same namespace as your type and have it declared before including Catch's header.
+
+## Catch::StringMaker<T> specialisation
+If you don't want to provide an ```operator <<``` overload, or you want to convert your type differently for testing purposes, you can provide a specialization for `Catch::StringMaker<T>`:
+
+```
+namespace Catch {
+ template<>
+ struct StringMaker<T> {
+ static std::string convert( T const& value ) {
+ return convertMyTypeToString( value );
+ }
+ };
+}
+```
+
+## Catch::is_range<T> specialisation
+As a fallback, Catch attempts to detect if the type can be iterated
+(`begin(T)` and `end(T)` are valid) and if it can be, it is stringified
+as a range. For certain types this can lead to infinite recursion, so
+it can be disabled by specializing `Catch::is_range` like so:
+
+```cpp
+namespace Catch {
+ template<>
+ struct is_range<T> {
+ static const bool value = false;
+ };
+}
+
+```
+
+
+## Exceptions
+
+By default all exceptions deriving from `std::exception` will be translated to strings by calling the `what()` method. For exception types that do not derive from `std::exception` - or if `what()` does not return a suitable string - use `CATCH_TRANSLATE_EXCEPTION`. This defines a function that takes your exception type, by reference, and returns a string. It can appear anywhere in the code - it doesn't have to be in the same translation unit. For example:
+
+```
+CATCH_TRANSLATE_EXCEPTION( MyType& ex ) {
+ return ex.message();
+}
+```
+
+---
+
+[Home](Readme.md#top)
diff --git a/docs/tutorial.md b/docs/tutorial.md
new file mode 100644
index 0000000..d55355c
--- /dev/null
+++ b/docs/tutorial.md
@@ -0,0 +1,261 @@
+<a id="top"></a>
+# Tutorial
+
+**Contents**<br>
+[Getting Catch2](#getting-catch2)<br>
+[Where to put it?](#where-to-put-it)<br>
+[Writing tests](#writing-tests)<br>
+[Test cases and sections](#test-cases-and-sections)<br>
+[BDD-Style](#bdd-style)<br>
+[Scaling up](#scaling-up)<br>
+[Next steps](#next-steps)<br>
+
+## Getting Catch2
+
+The simplest way to get Catch2 is to download the latest [single header version](https://raw.githubusercontent.com/CatchOrg/Catch2/master/single_include/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 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.
+
+
+## Where to put it?
+
+Catch2 is header only. All you need to do is drop the file somewhere reachable from your project - either in some central location you can set your header search path to find, or directly into your project tree itself! This is a particularly good option for other Open-Source projects that want to use Catch for their test suite. See [this blog entry for more on that](http://www.levelofindirection.com/journal/2011/5/27/unit-testing-in-c-and-objective-c-just-got-ridiculously-easi.html).
+
+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.
+
+## 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).
+
+```c++
+unsigned int Factorial( unsigned int number ) {
+ return number <= 1 ? number : Factorial(number-1)*number;
+}
+```
+
+To keep things simple we'll put everything in a single file (<a href="#scaling-up">see later for more on how to structure your test files</a>).
+
+```c++
+#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file
+#include "catch.hpp"
+
+unsigned int Factorial( unsigned int number ) {
+ return number <= 1 ? number : Factorial(number-1)*number;
+}
+
+TEST_CASE( "Factorials are computed", "[factorial]" ) {
+ REQUIRE( Factorial(1) == 1 );
+ REQUIRE( Factorial(2) == 2 );
+ REQUIRE( Factorial(3) == 6 );
+ REQUIRE( Factorial(10) == 3628800 );
+}
+```
+
+This will compile to a complete executable which responds to [command line arguments](command-line.md#top). If you just run it with no arguments it will execute all test cases (in this case there is just one), report any failures, report a summary of how many tests passed and failed and return the number of failed tests (useful for if you just want a yes/ no answer to: "did it work").
+
+If you run this as written it will pass. Everything is good. Right?
+Well, there is still a bug here. In fact the first version of this tutorial I posted here genuinely had the bug in! So it's not completely contrived (thanks to Daryle Walker (```@CTMacUser```) for pointing this out).
+
+What is the bug? Well what is the factorial of zero?
+[The factorial of zero is one](http://mathforum.org/library/drmath/view/57128.html) - which is just one of those things you have to know (and remember!).
+
+Let's add that to the test case:
+
+```c++
+TEST_CASE( "Factorials are computed", "[factorial]" ) {
+ REQUIRE( Factorial(0) == 1 );
+ REQUIRE( Factorial(1) == 1 );
+ REQUIRE( Factorial(2) == 2 );
+ REQUIRE( Factorial(3) == 6 );
+ REQUIRE( Factorial(10) == 3628800 );
+}
+```
+
+Now we get a failure - something like:
+
+```
+Example.cpp:9: FAILED:
+ REQUIRE( Factorial(0) == 1 )
+with expansion:
+ 0 == 1
+```
+
+Note that we get the actual return value of Factorial(0) printed for us (0) - even though we used a natural expression with the == operator. That lets us immediately see what the problem is.
+
+Let's change the factorial function to:
+
+```c++
+unsigned int Factorial( unsigned int number ) {
+ return number > 1 ? Factorial(number-1)*number : 1;
+}
+```
+
+Now all the tests pass.
+
+Of course there are still more issues to deal with. For example we'll hit problems when the return value starts to exceed the range of an unsigned int. With factorials that can happen quite quickly. You might want to add tests for such cases and decide how to handle them. We'll stop short of doing that here.
+
+### What did we do here?
+
+Although this was a simple test it's been enough to demonstrate a few things about how Catch is used. Let's take moment to consider those before we move on.
+
+1. All we did was ```#define``` one identifier and ```#include``` one header and we got everything - even an implementation of ```main()``` that will [respond to command line arguments](command-line.md#top). You can only use that ```#define``` in one implementation file, for (hopefully) obvious reasons. Once you have more than one file with unit tests in you'll just ```#include "catch.hpp"``` and go. Usually it's a good idea to have a dedicated implementation file that just has ```#define CATCH_CONFIG_MAIN``` and ```#include "catch.hpp"```. You can also provide your own implementation of main and drive Catch yourself (see [Supplying-your-own-main()](own-main.md#top)).
+2. We introduce test cases with the ```TEST_CASE``` macro. This macro takes one or two arguments - a free form test name and, optionally, one or more tags (for more see <a href="#test-cases-and-sections">Test cases and Sections</a>, ). The test name must be unique. You can run sets of tests by specifying a wildcarded test name or a tag expression. See the [command line docs](command-line.md#top) for more information on running tests.
+3. The name and tags arguments are just strings. We haven't had to declare a function or method - or explicitly register the test case anywhere. Behind the scenes a function with a generated name is defined for you, and automatically registered using static registry classes. By abstracting the function name away we can name our tests without the constraints of identifier names.
+4. We write our individual test assertions using the ```REQUIRE``` macro. Rather than a separate macro for each type of condition we express the condition naturally using C/C++ syntax. Behind the scenes a simple set of expression templates captures the left-hand-side and right-hand-side of the expression so we can display the values in our test report. As we'll see later there _are_ other assertion macros - but because of this technique the number of them is drastically reduced.
+
+<a id="test-cases-and-sections"></a>
+## Test cases and sections
+
+Most test frameworks have a class-based fixture mechanism. That is, test cases map to methods on a class and common setup and teardown can be performed in ```setup()``` and ```teardown()``` methods (or constructor/ destructor in languages, like C++, that support deterministic destruction).
+
+While Catch fully supports this way of working there are a few problems with the approach. In particular the way your code must be split up, and the blunt granularity of it, may cause problems. You can only have one setup/ teardown pair across a set of methods, but sometimes you want slightly different setup in each method, or you may even want several levels of setup (a concept which we will clarify later on in this tutorial). It was <a href="http://jamesnewkirk.typepad.com/posts/2007/09/why-you-should-.html">problems like these</a> that led James Newkirk, who led the team that built NUnit, to start again from scratch and <a href="http://jamesnewkirk.typepad.com/posts/2007/09/announcing-xuni.html">build xUnit</a>).
+
+Catch takes a different approach (to both NUnit and xUnit) that is a more natural fit for C++ and the C family of languages. This is best explained through an example ([code](../examples/100-Fix-Section.cpp)):
+
+```c++
+TEST_CASE( "vectors can be sized and resized", "[vector]" ) {
+
+ std::vector<int> v( 5 );
+
+ REQUIRE( v.size() == 5 );
+ REQUIRE( v.capacity() >= 5 );
+
+ SECTION( "resizing bigger changes size and capacity" ) {
+ v.resize( 10 );
+
+ REQUIRE( v.size() == 10 );
+ REQUIRE( v.capacity() >= 10 );
+ }
+ SECTION( "resizing smaller changes size but not capacity" ) {
+ v.resize( 0 );
+
+ REQUIRE( v.size() == 0 );
+ REQUIRE( v.capacity() >= 5 );
+ }
+ SECTION( "reserving bigger changes capacity but not size" ) {
+ v.reserve( 10 );
+
+ REQUIRE( v.size() == 5 );
+ REQUIRE( v.capacity() >= 10 );
+ }
+ SECTION( "reserving smaller does not change size or capacity" ) {
+ v.reserve( 0 );
+
+ REQUIRE( v.size() == 5 );
+ REQUIRE( v.capacity() >= 5 );
+ }
+}
+```
+
+For each ```SECTION``` the ```TEST_CASE``` is executed from the start - so as we enter each section we know that size is 5 and capacity is at least 5. We enforced those requirements with the ```REQUIRE```s at the top level so we can be confident in them.
+This works because the ```SECTION``` macro contains an if statement that calls back into Catch to see if the section should be executed. One leaf section is executed on each run through a ```TEST_CASE```. The other sections are skipped. Next time through the next section is executed, and so on until no new sections are encountered.
+
+So far so good - this is already an improvement on the setup/teardown approach because now we see our setup code inline and use the stack.
+
+The power of sections really shows, however, when we need to execute a sequence of, checked, operations. Continuing the vector example, we might want to verify that attempting to reserve a capacity smaller than the current capacity of the vector changes nothing. We can do that, naturally, like so:
+
+```c++
+ SECTION( "reserving bigger changes capacity but not size" ) {
+ v.reserve( 10 );
+
+ REQUIRE( v.size() == 5 );
+ REQUIRE( v.capacity() >= 10 );
+
+ SECTION( "reserving smaller again does not change capacity" ) {
+ v.reserve( 7 );
+
+ REQUIRE( v.capacity() >= 10 );
+ }
+ }
+```
+
+Sections can be nested to an arbitrary depth (limited only by your stack size). Each leaf section (i.e. a section that contains no nested sections) will be executed exactly once, on a separate path of execution from any other leaf section (so no leaf section can interfere with another). A failure in a parent section will prevent nested sections from running - but then that's the idea.
+
+## BDD-Style
+
+If you name your test cases and sections appropriately you can achieve a BDD-style specification structure. This became such a useful way of working that first class support has been added to Catch. Scenarios can be specified using ```SCENARIO```, ```GIVEN```, ```WHEN``` and ```THEN``` macros, which map on to ```TEST_CASE```s and ```SECTION```s, respectively. For more details see [Test cases and sections](test-cases-and-sections.md#top).
+
+The vector example can be adjusted to use these macros like so ([example code](../examples/120-Bdd-ScenarioGivenWhenThen.cpp)):
+
+```c++
+SCENARIO( "vectors can be sized and resized", "[vector]" ) {
+
+ GIVEN( "A vector with some items" ) {
+ std::vector<int> v( 5 );
+
+ REQUIRE( v.size() == 5 );
+ REQUIRE( v.capacity() >= 5 );
+
+ WHEN( "the size is increased" ) {
+ v.resize( 10 );
+
+ THEN( "the size and capacity change" ) {
+ REQUIRE( v.size() == 10 );
+ REQUIRE( v.capacity() >= 10 );
+ }
+ }
+ WHEN( "the size is reduced" ) {
+ v.resize( 0 );
+
+ THEN( "the size changes but not capacity" ) {
+ REQUIRE( v.size() == 0 );
+ REQUIRE( v.capacity() >= 5 );
+ }
+ }
+ WHEN( "more capacity is reserved" ) {
+ v.reserve( 10 );
+
+ THEN( "the capacity changes but not the size" ) {
+ REQUIRE( v.size() == 5 );
+ REQUIRE( v.capacity() >= 10 );
+ }
+ }
+ WHEN( "less capacity is reserved" ) {
+ v.reserve( 0 );
+
+ THEN( "neither size nor capacity are changed" ) {
+ REQUIRE( v.size() == 5 );
+ REQUIRE( v.capacity() >= 5 );
+ }
+ }
+ }
+}
+```
+
+Conveniently, these tests will be reported as follows when run:
+
+```
+Scenario: vectors can be sized and resized
+ Given: A vector with some items
+ When: more capacity is reserved
+ Then: the capacity changes but not the size
+```
+
+<a id="scaling-up"></a>
+## Scaling up
+
+To keep the tutorial simple we put all our code in a single file. This is fine to get started - and makes jumping into Catch even quicker and easier. As you write more real-world tests, though, this is not really the best approach.
+
+The requirement is that the following block of code ([or equivalent](own-main.md#top)):
+
+```c++
+#define CATCH_CONFIG_MAIN
+#include "catch.hpp"
+```
+
+appears in _exactly one_ source file. Use as many additional cpp files (or whatever you call your implementation files) as you need for your tests, partitioned however makes most sense for your way of working. Each additional file need only ```#include "catch.hpp"``` - do not repeat the ```#define```!
+
+In fact it is usually a good idea to put the block with the ```#define``` [in its own source file](slow-compiles.md#top) (code example [main](../examples/020-TestCase-1.cpp), [tests](../examples/020-TestCase-2.cpp)).
+
+Do not write your tests in header files!
+
+
+## Next steps
+
+This has been a brief introduction to get you up and running with Catch, and to point out some of the key differences between Catch and other frameworks you may already be familiar with. This will get you going quite far already and you are now in a position to dive in and write some tests.
+
+Of course there is more to learn - most of which you should be able to page-fault in as you go. Please see the ever-growing [Reference section](Readme.md#top) for what's available.
+
+---
+
+[Home](Readme.md#top)
diff --git a/docs/why-catch.md b/docs/why-catch.md
new file mode 100644
index 0000000..45f58a6
--- /dev/null
+++ b/docs/why-catch.md
@@ -0,0 +1,46 @@
+<a id="top"></a>
+# Why do we need yet another C++ test framework?
+
+Good question. For C++ there are quite a number of established frameworks,
+including (but not limited to),
+[Google Test](http://code.google.com/p/googletest/),
+[Boost.Test](http://www.boost.org/doc/libs/1_49_0/libs/test/doc/html/index.html),
+[CppUnit](http://sourceforge.net/apps/mediawiki/cppunit/index.php?title=Main_Page),
+[Cute](http://r2.ifs.hsr.ch/cute),
+[many, many more](http://en.wikipedia.org/wiki/List_of_unit_testing_frameworks#C.2B.2B).
+
+So what does Catch bring to the party that differentiates it from these? Apart from a Catchy name, of course.
+
+## Key Features
+
+* Quick and Really easy to get started. Just download catch.hpp, `#include` it and you're away.
+* No external dependencies. As long as you can compile C++11 and have a C++ standard library available.
+* Write test cases as, self-registering, functions (or methods, if you prefer).
+* Divide test cases into sections, each of which is run in isolation (eliminates the need for fixtures).
+* Use BDD-style Given-When-Then sections as well as traditional unit test cases.
+* Only one core assertion macro for comparisons. Standard C/C++ operators are used for the comparison - yet the full expression is decomposed and lhs and rhs values are logged.
+* Tests are named using free-form strings - no more couching names in legal identifiers.
+
+## Other core features
+
+* Tests can be tagged for easily running ad-hoc groups of tests.
+* Failures can (optionally) break into the debugger on Windows and Mac.
+* Output is through modular reporter objects. Basic textual and XML reporters are included. Custom reporters can easily be added.
+* JUnit xml output is supported for integration with third-party tools, such as CI servers.
+* A default main() function is provided, but you can supply your own for complete control (e.g. integration into your own test runner GUI).
+* A command line parser is provided and can still be used if you choose to provided your own main() function.
+* Catch can test itself.
+* Alternative assertion macro(s) report failures but don't abort the test case
+* Floating point tolerance comparisons are built in using an expressive Approx() syntax.
+* Internal and friendly macros are isolated so name clashes can be managed
+* Matchers
+
+## Who else is using Catch?
+
+See the list of [open source projects using Catch](opensource-users.md#top).
+
+See the [tutorial](tutorial.md#top) to get more of a taste of using Catch in practice
+
+---
+
+[Home](Readme.md#top)
diff --git a/examples/000-CatchMain.cpp b/examples/000-CatchMain.cpp
new file mode 100644
index 0000000..c8bf91e
--- /dev/null
+++ b/examples/000-CatchMain.cpp
@@ -0,0 +1,15 @@
+// 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.
+
+// Let Catch provide main():
+#define CATCH_CONFIG_MAIN
+
+#include "catch.hpp"
+
+// That's it
+
+// Compile implementation of Catch for use with files that do contain tests:
+// - g++ -std=c++11 -Wall -I$(CATCH_SINGLE_INCLUDE) -c 000-CatchMain.cpp
+// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% -c 000-CatchMain.cpp
diff --git a/examples/010-TestCase.cpp b/examples/010-TestCase.cpp
new file mode 100644
index 0000000..16a212a
--- /dev/null
+++ b/examples/010-TestCase.cpp
@@ -0,0 +1,36 @@
+// 010-TestCase.cpp
+
+// Let Catch provide main():
+#define CATCH_CONFIG_MAIN
+
+#include "catch.hpp"
+
+int Factorial( int number ) {
+ return number <= 1 ? number : Factorial( number - 1 ) * number; // fail
+// return number <= 1 ? 1 : Factorial( number - 1 ) * number; // pass
+}
+
+TEST_CASE( "Factorial of 0 is 1 (fail)", "[single-file]" ) {
+ REQUIRE( Factorial(0) == 1 );
+}
+
+TEST_CASE( "Factorials of 1 and higher are computed (pass)", "[single-file]" ) {
+ REQUIRE( Factorial(1) == 1 );
+ REQUIRE( Factorial(2) == 2 );
+ REQUIRE( Factorial(3) == 6 );
+ REQUIRE( Factorial(10) == 3628800 );
+}
+
+// Compile & run:
+// - g++ -std=c++11 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 010-TestCase 010-TestCase.cpp && 010-TestCase --success
+// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 010-TestCase.cpp && 010-TestCase --success
+
+// Expected compact output (all assertions):
+//
+// prompt> 010-TestCase --reporter compact --success
+// 010-TestCase.cpp:14: failed: Factorial(0) == 1 for: 0 == 1
+// 010-TestCase.cpp:18: passed: Factorial(1) == 1 for: 1 == 1
+// 010-TestCase.cpp:19: passed: Factorial(2) == 2 for: 2 == 2
+// 010-TestCase.cpp:20: passed: Factorial(3) == 6 for: 6 == 6
+// 010-TestCase.cpp:21: passed: Factorial(10) == 3628800 for: 3628800 (0x375f00) == 3628800 (0x375f00)
+// Failed 1 test case, failed 1 assertion.
diff --git a/examples/020-TestCase-1.cpp b/examples/020-TestCase-1.cpp
new file mode 100644
index 0000000..0d10276
--- /dev/null
+++ b/examples/020-TestCase-1.cpp
@@ -0,0 +1,35 @@
+// 020-TestCase-1.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 "catch.hpp"
+
+TEST_CASE( "1: All test cases reside in other .cpp files (empty)", "[multi-file:1]" ) {
+}
+
+// ^^^
+// Normally no TEST_CASEs in this file.
+// Here just to show there are two source files via option --list-tests.
+
+// Compile & run:
+// - g++ -std=c++11 -Wall -I$(CATCH_SINGLE_INCLUDE) -c 020-TestCase-1.cpp
+// - g++ -std=c++11 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 020-TestCase TestCase-1.o 020-TestCase-2.cpp && 020-TestCase --success
+//
+// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% -c 020-TestCase-1.cpp
+// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% -Fe020-TestCase.exe 020-TestCase-1.obj 020-TestCase-2.cpp && 020-TestCase --success
+
+// Expected test case listing:
+//
+// prompt> 020-TestCase --list-tests *
+// Matching test cases:
+// 1: All test cases reside in other .cpp files (empty)
+// [multi-file:1]
+// 2: Factorial of 0 is computed (fail)
+// [multi-file:2]
+// 2: Factorials of 1 and higher are computed (pass)
+// [multi-file:2]
+// 3 matching test cases
diff --git a/examples/020-TestCase-2.cpp b/examples/020-TestCase-2.cpp
new file mode 100644
index 0000000..2cca362
--- /dev/null
+++ b/examples/020-TestCase-2.cpp
@@ -0,0 +1,33 @@
+// 020-TestCase-2.cpp
+
+// main() provided by Catch in file 020-TestCase-1.cpp.
+
+#include "catch.hpp"
+
+int Factorial( int number ) {
+ return number <= 1 ? number : Factorial( number - 1 ) * number; // fail
+// return number <= 1 ? 1 : Factorial( number - 1 ) * number; // pass
+}
+
+TEST_CASE( "2: Factorial of 0 is 1 (fail)", "[multi-file:2]" ) {
+ REQUIRE( Factorial(0) == 1 );
+}
+
+TEST_CASE( "2: Factorials of 1 and higher are computed (pass)", "[multi-file:2]" ) {
+ REQUIRE( Factorial(1) == 1 );
+ REQUIRE( Factorial(2) == 2 );
+ REQUIRE( Factorial(3) == 6 );
+ REQUIRE( Factorial(10) == 3628800 );
+}
+
+// Compile: see 020-TestCase-1.cpp
+
+// Expected compact output (all assertions):
+//
+// prompt> 020-TestCase --reporter compact --success
+// 020-TestCase-2.cpp:13: failed: Factorial(0) == 1 for: 0 == 1
+// 020-TestCase-2.cpp:17: passed: Factorial(1) == 1 for: 1 == 1
+// 020-TestCase-2.cpp:18: passed: Factorial(2) == 2 for: 2 == 2
+// 020-TestCase-2.cpp:19: passed: Factorial(3) == 6 for: 6 == 6
+// 020-TestCase-2.cpp:20: passed: Factorial(10) == 3628800 for: 3628800 (0x375f00) == 3628800 (0x375f00)
+// Failed 1 test case, failed 1 assertion.
diff --git a/examples/030-Asn-Require-Check.cpp b/examples/030-Asn-Require-Check.cpp
new file mode 100644
index 0000000..35f2ff7
--- /dev/null
+++ b/examples/030-Asn-Require-Check.cpp
@@ -0,0 +1,74 @@
+// 030-Asn-Require-Check.cpp
+
+// Catch has two natural expression assertion macro's:
+// - REQUIRE() stops at first failure.
+// - CHECK() continues after failure.
+
+// There are two variants to support decomposing negated expressions:
+// - REQUIRE_FALSE() stops at first failure.
+// - CHECK_FALSE() continues after failure.
+
+// main() provided in 000-CatchMain.cpp
+
+#include "catch.hpp"
+
+std::string one() {
+ return "1";
+}
+
+TEST_CASE( "Assert that something is true (pass)", "[require]" ) {
+ REQUIRE( one() == "1" );
+}
+
+TEST_CASE( "Assert that something is true (fail)", "[require]" ) {
+ REQUIRE( one() == "x" );
+}
+
+TEST_CASE( "Assert that something is true (stop at first failure)", "[require]" ) {
+ WARN( "REQUIRE stops at first failure:" );
+
+ REQUIRE( one() == "x" );
+ REQUIRE( one() == "1" );
+}
+
+TEST_CASE( "Assert that something is true (continue after failure)", "[check]" ) {
+ WARN( "CHECK continues after failure:" );
+
+ CHECK( one() == "x" );
+ REQUIRE( one() == "1" );
+}
+
+TEST_CASE( "Assert that something is false (stops at first failure)", "[require-false]" ) {
+ WARN( "REQUIRE_FALSE stops at first failure:" );
+
+ REQUIRE_FALSE( one() == "1" );
+ REQUIRE_FALSE( one() != "1" );
+}
+
+TEST_CASE( "Assert that something is false (continue after failure)", "[check-false]" ) {
+ WARN( "CHECK_FALSE continues after failure:" );
+
+ CHECK_FALSE( one() == "1" );
+ REQUIRE_FALSE( one() != "1" );
+}
+
+// Compile & run:
+// - g++ -std=c++11 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 030-Asn-Require-Check 030-Asn-Require-Check.cpp 000-CatchMain.o && 030-Asn-Require-Check --success
+// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 030-Asn-Require-Check.cpp 000-CatchMain.obj && 030-Asn-Require-Check --success
+
+// Expected compact output (all assertions):
+//
+// prompt> 030-Asn-Require-Check.exe --reporter compact --success
+// 030-Asn-Require-Check.cpp:20: passed: one() == "1" for: "1" == "1"
+// 030-Asn-Require-Check.cpp:24: failed: one() == "x" for: "1" == "x"
+// 030-Asn-Require-Check.cpp:28: warning: 'REQUIRE stops at first failure:'
+// 030-Asn-Require-Check.cpp:30: failed: one() == "x" for: "1" == "x"
+// 030-Asn-Require-Check.cpp:35: warning: 'CHECK continues after failure:'
+// 030-Asn-Require-Check.cpp:37: failed: one() == "x" for: "1" == "x"
+// 030-Asn-Require-Check.cpp:38: passed: one() == "1" for: "1" == "1"
+// 030-Asn-Require-Check.cpp:42: warning: 'REQUIRE_FALSE stops at first failure:'
+// 030-Asn-Require-Check.cpp:44: failed: !(one() == "1") for: !("1" == "1")
+// 030-Asn-Require-Check.cpp:49: warning: 'CHECK_FALSE continues after failure:'
+// 030-Asn-Require-Check.cpp:51: failed: !(one() == "1") for: !("1" == "1")
+// 030-Asn-Require-Check.cpp:52: passed: !(one() != "1") for: !("1" != "1")
+// Failed 5 test cases, failed 5 assertions.
diff --git a/examples/100-Fix-Section.cpp b/examples/100-Fix-Section.cpp
new file mode 100644
index 0000000..8cb94bf
--- /dev/null
+++ b/examples/100-Fix-Section.cpp
@@ -0,0 +1,69 @@
+// 100-Fix-Section.cpp
+
+// Catch has two ways to express fixtures:
+// - Sections (this file)
+// - Traditional class-based fixtures
+
+// main() provided in 000-CatchMain.cpp
+
+#include "catch.hpp"
+
+TEST_CASE( "vectors can be sized and resized", "[vector]" ) {
+
+ // For each section, vector v is anew:
+
+ std::vector<int> v( 5 );
+
+ REQUIRE( v.size() == 5 );
+ REQUIRE( v.capacity() >= 5 );
+
+ SECTION( "resizing bigger changes size and capacity" ) {
+ v.resize( 10 );
+
+ REQUIRE( v.size() == 10 );
+ REQUIRE( v.capacity() >= 10 );
+ }
+ SECTION( "resizing smaller changes size but not capacity" ) {
+ v.resize( 0 );
+
+ REQUIRE( v.size() == 0 );
+ REQUIRE( v.capacity() >= 5 );
+ }
+ SECTION( "reserving bigger changes capacity but not size" ) {
+ v.reserve( 10 );
+
+ REQUIRE( v.size() == 5 );
+ REQUIRE( v.capacity() >= 10 );
+ }
+ SECTION( "reserving smaller does not change size or capacity" ) {
+ v.reserve( 0 );
+
+ REQUIRE( v.size() == 5 );
+ REQUIRE( v.capacity() >= 5 );
+ }
+}
+
+// Compile & run:
+// - g++ -std=c++11 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 100-Fix-Section 100-Fix-Section.cpp 000-CatchMain.o && 100-Fix-Section --success
+// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 100-Fix-Section.cpp 000-CatchMain.obj && 100-Fix-Section --success
+
+// Expected compact output (all assertions):
+//
+// prompt> 100-Fix-Section.exe --reporter compact --success
+// 100-Fix-Section.cpp:17: passed: v.size() == 5 for: 5 == 5
+// 100-Fix-Section.cpp:18: passed: v.capacity() >= 5 for: 5 >= 5
+// 100-Fix-Section.cpp:23: passed: v.size() == 10 for: 10 == 10
+// 100-Fix-Section.cpp:24: passed: v.capacity() >= 10 for: 10 >= 10
+// 100-Fix-Section.cpp:17: passed: v.size() == 5 for: 5 == 5
+// 100-Fix-Section.cpp:18: passed: v.capacity() >= 5 for: 5 >= 5
+// 100-Fix-Section.cpp:29: passed: v.size() == 0 for: 0 == 0
+// 100-Fix-Section.cpp:30: passed: v.capacity() >= 5 for: 5 >= 5
+// 100-Fix-Section.cpp:17: passed: v.size() == 5 for: 5 == 5
+// 100-Fix-Section.cpp:18: passed: v.capacity() >= 5 for: 5 >= 5
+// 100-Fix-Section.cpp:35: passed: v.size() == 5 for: 5 == 5
+// 100-Fix-Section.cpp:36: passed: v.capacity() >= 10 for: 10 >= 10
+// 100-Fix-Section.cpp:17: passed: v.size() == 5 for: 5 == 5
+// 100-Fix-Section.cpp:18: passed: v.capacity() >= 5 for: 5 >= 5
+// 100-Fix-Section.cpp:41: passed: v.size() == 5 for: 5 == 5
+// 100-Fix-Section.cpp:42: passed: v.capacity() >= 5 for: 5 >= 5
+// Passed 1 test case with 16 assertions.
diff --git a/examples/110-Fix-ClassFixture.cpp b/examples/110-Fix-ClassFixture.cpp
new file mode 100644
index 0000000..06c2cf3
--- /dev/null
+++ b/examples/110-Fix-ClassFixture.cpp
@@ -0,0 +1,63 @@
+// 110-Fix-ClassFixture.cpp
+
+// Catch has two ways to express fixtures:
+// - Sections
+// - Traditional class-based fixtures (this file)
+
+// main() provided in 000-CatchMain.cpp
+
+#include "catch.hpp"
+
+class DBConnection
+{
+public:
+ static DBConnection createConnection( std::string const & /*dbName*/ ) {
+ return DBConnection();
+ }
+
+ bool executeSQL( std::string const & /*query*/, int const /*id*/, std::string const & arg ) {
+ if ( arg.length() == 0 ) {
+ throw std::logic_error("empty SQL query argument");
+ }
+ return true; // ok
+ }
+};
+
+class UniqueTestsFixture
+{
+protected:
+ UniqueTestsFixture()
+ : conn( DBConnection::createConnection( "myDB" ) )
+ {}
+
+ int getID() {
+ return ++uniqueID;
+ }
+
+protected:
+ DBConnection conn;
+
+private:
+ static int uniqueID;
+};
+
+int UniqueTestsFixture::uniqueID = 0;
+
+TEST_CASE_METHOD( UniqueTestsFixture, "Create Employee/No Name", "[create]" ) {
+ REQUIRE_THROWS( conn.executeSQL( "INSERT INTO employee (id, name) VALUES (?, ?)", getID(), "") );
+}
+
+TEST_CASE_METHOD( UniqueTestsFixture, "Create Employee/Normal", "[create]" ) {
+ REQUIRE( conn.executeSQL( "INSERT INTO employee (id, name) VALUES (?, ?)", getID(), "Joe Bloggs" ) );
+}
+
+// Compile & run:
+// - g++ -std=c++11 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 110-Fix-ClassFixture 110-Fix-ClassFixture.cpp 000-CatchMain.o && 110-Fix-ClassFixture --success
+// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 110-Fix-ClassFixture.cpp 000-CatchMain.obj && 110-Fix-ClassFixture --success
+
+// Expected compact output (all assertions):
+//
+// prompt> 110-Fix-ClassFixture.exe --reporter compact --success
+// 110-Fix-ClassFixture.cpp:47: passed: conn.executeSQL( "INSERT INTO employee (id, name) VALUES (?, ?)", getID(), "")
+// 110-Fix-ClassFixture.cpp:51: passed: conn.executeSQL( "INSERT INTO employee (id, name) VALUES (?, ?)", getID(), "Joe Bloggs" ) for: true
+// Passed both 2 test cases with 2 assertions.
diff --git a/examples/120-Bdd-ScenarioGivenWhenThen.cpp b/examples/120-Bdd-ScenarioGivenWhenThen.cpp
new file mode 100644
index 0000000..c45f1f2
--- /dev/null
+++ b/examples/120-Bdd-ScenarioGivenWhenThen.cpp
@@ -0,0 +1,73 @@
+// 120-Bdd-ScenarioGivenWhenThen.cpp
+
+// main() provided in 000-CatchMain.cpp
+
+#include "catch.hpp"
+
+SCENARIO( "vectors can be sized and resized", "[vector]" ) {
+
+ GIVEN( "A vector with some items" ) {
+ std::vector<int> v( 5 );
+
+ REQUIRE( v.size() == 5 );
+ REQUIRE( v.capacity() >= 5 );
+
+ WHEN( "the size is increased" ) {
+ v.resize( 10 );
+
+ THEN( "the size and capacity change" ) {
+ REQUIRE( v.size() == 10 );
+ REQUIRE( v.capacity() >= 10 );
+ }
+ }
+ WHEN( "the size is reduced" ) {
+ v.resize( 0 );
+
+ THEN( "the size changes but not capacity" ) {
+ REQUIRE( v.size() == 0 );
+ REQUIRE( v.capacity() >= 5 );
+ }
+ }
+ WHEN( "more capacity is reserved" ) {
+ v.reserve( 10 );
+
+ THEN( "the capacity changes but not the size" ) {
+ REQUIRE( v.size() == 5 );
+ REQUIRE( v.capacity() >= 10 );
+ }
+ }
+ WHEN( "less capacity is reserved" ) {
+ v.reserve( 0 );
+
+ THEN( "neither size nor capacity are changed" ) {
+ REQUIRE( v.size() == 5 );
+ REQUIRE( v.capacity() >= 5 );
+ }
+ }
+ }
+}
+
+// Compile & run:
+// - g++ -std=c++11 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 120-Bdd-ScenarioGivenWhenThen 120-Bdd-ScenarioGivenWhenThen.cpp 000-CatchMain.o && 120-Bdd-ScenarioGivenWhenThen --success
+// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 120-Bdd-ScenarioGivenWhenThen.cpp 000-CatchMain.obj && 120-Bdd-ScenarioGivenWhenThen --success
+
+// Expected compact output (all assertions):
+//
+// prompt> 120-Bdd-ScenarioGivenWhenThen.exe --reporter compact --success
+// 120-Bdd-ScenarioGivenWhenThen.cpp:12: passed: v.size() == 5 for: 5 == 5
+// 120-Bdd-ScenarioGivenWhenThen.cpp:13: passed: v.capacity() >= 5 for: 5 >= 5
+// 120-Bdd-ScenarioGivenWhenThen.cpp:19: passed: v.size() == 10 for: 10 == 10
+// 120-Bdd-ScenarioGivenWhenThen.cpp:20: passed: v.capacity() >= 10 for: 10 >= 10
+// 120-Bdd-ScenarioGivenWhenThen.cpp:12: passed: v.size() == 5 for: 5 == 5
+// 120-Bdd-ScenarioGivenWhenThen.cpp:13: passed: v.capacity() >= 5 for: 5 >= 5
+// 120-Bdd-ScenarioGivenWhenThen.cpp:27: passed: v.size() == 0 for: 0 == 0
+// 120-Bdd-ScenarioGivenWhenThen.cpp:28: passed: v.capacity() >= 5 for: 5 >= 5
+// 120-Bdd-ScenarioGivenWhenThen.cpp:12: passed: v.size() == 5 for: 5 == 5
+// 120-Bdd-ScenarioGivenWhenThen.cpp:13: passed: v.capacity() >= 5 for: 5 >= 5
+// 120-Bdd-ScenarioGivenWhenThen.cpp:35: passed: v.size() == 5 for: 5 == 5
+// 120-Bdd-ScenarioGivenWhenThen.cpp:36: passed: v.capacity() >= 10 for: 10 >= 10
+// 120-Bdd-ScenarioGivenWhenThen.cpp:12: passed: v.size() == 5 for: 5 == 5
+// 120-Bdd-ScenarioGivenWhenThen.cpp:13: passed: v.capacity() >= 5 for: 5 >= 5
+// 120-Bdd-ScenarioGivenWhenThen.cpp:43: passed: v.size() == 5 for: 5 == 5
+// 120-Bdd-ScenarioGivenWhenThen.cpp:44: passed: v.capacity() >= 5 for: 5 >= 5
+// Passed 1 test case with 16 assertions.
diff --git a/examples/210-Evt-EventListeners.cpp b/examples/210-Evt-EventListeners.cpp
new file mode 100644
index 0000000..8ba360f
--- /dev/null
+++ b/examples/210-Evt-EventListeners.cpp
@@ -0,0 +1,423 @@
+// 210-Evt-EventListeners.cpp
+
+// Contents:
+// 1. Printing of listener data
+// 2. My listener and registration
+// 3. Test cases
+
+// main() provided in 000-CatchMain.cpp
+
+// Let Catch provide the required interfaces:
+#define CATCH_CONFIG_EXTERNAL_INTERFACES
+
+#include "catch.hpp"
+#include <iostream>
+
+// -----------------------------------------------------------------------
+// 1. Printing of listener data:
+//
+
+std::string ws(int const level) {
+ return std::string( 2 * level, ' ' );
+}
+
+template< typename T >
+std::ostream& operator<<( std::ostream& os, std::vector<T> const& v ) {
+ os << "{ ";
+ for ( auto x : v )
+ os << x << ", ";
+ return os << "}";
+}
+
+// struct SourceLineInfo {
+// char const* file;
+// std::size_t line;
+// };
+
+void print( std::ostream& os, int const level, std::string const& title, Catch::SourceLineInfo const& info ) {
+ os << ws(level ) << title << ":\n"
+ << ws(level+1) << "- file: " << info.file << "\n"
+ << ws(level+1) << "- line: " << info.line << "\n";
+}
+
+//struct MessageInfo {
+// std::string macroName;
+// std::string message;
+// SourceLineInfo lineInfo;
+// ResultWas::OfType type;
+// unsigned int sequence;
+//};
+
+void print( std::ostream& os, int const level, Catch::MessageInfo const& info ) {
+ os << ws(level+1) << "- macroName: '" << info.macroName << "'\n"
+ << ws(level+1) << "- message '" << info.message << "'\n";
+ print( os,level+1 , "- lineInfo", info.lineInfo );
+ os << ws(level+1) << "- sequence " << info.sequence << "\n";
+}
+
+void print( std::ostream& os, int const level, std::string const& title, std::vector<Catch::MessageInfo> const& v ) {
+ os << ws(level ) << title << ":\n";
+ for ( auto x : v )
+ {
+ os << ws(level+1) << "{\n";
+ print( os, level+2, x );
+ os << ws(level+1) << "}\n";
+ }
+// os << ws(level+1) << "\n";
+}
+
+// struct TestRunInfo {
+// std::string name;
+// };
+
+void print( std::ostream& os, int const level, std::string const& title, Catch::TestRunInfo const& info ) {
+ os << ws(level ) << title << ":\n"
+ << ws(level+1) << "- name: " << info.name << "\n";
+}
+
+// struct Counts {
+// std::size_t total() const;
+// bool allPassed() const;
+// bool allOk() const;
+//
+// std::size_t passed = 0;
+// std::size_t failed = 0;
+// std::size_t failedButOk = 0;
+// };
+
+void print( std::ostream& os, int const level, std::string const& title, Catch::Counts const& info ) {
+ os << ws(level ) << title << ":\n"
+ << ws(level+1) << "- total(): " << info.total() << "\n"
+ << ws(level+1) << "- allPassed(): " << info.allPassed() << "\n"
+ << ws(level+1) << "- allOk(): " << info.allOk() << "\n"
+ << ws(level+1) << "- passed: " << info.passed << "\n"
+ << ws(level+1) << "- failed: " << info.failed << "\n"
+ << ws(level+1) << "- failedButOk: " << info.failedButOk << "\n";
+}
+
+// struct Totals {
+// Counts assertions;
+// Counts testCases;
+// };
+
+void print( std::ostream& os, int const level, std::string const& title, Catch::Totals const& info ) {
+ os << ws(level) << title << ":\n";
+ print( os, level+1, "- assertions", info.assertions );
+ print( os, level+1, "- testCases" , info.testCases );
+}
+
+// struct TestRunStats {
+// TestRunInfo runInfo;
+// Totals totals;
+// bool aborting;
+// };
+
+void print( std::ostream& os, int const level, std::string const& title, Catch::TestRunStats const& info ) {
+ os << ws(level) << title << ":\n";
+ print( os, level+1 , "- runInfo", info.runInfo );
+ print( os, level+1 , "- totals" , info.totals );
+ os << ws(level+1) << "- aborting: " << info.aborting << "\n";
+}
+
+// struct TestCaseInfo {
+// enum SpecialProperties{
+// None = 0,
+// IsHidden = 1 << 1,
+// ShouldFail = 1 << 2,
+// MayFail = 1 << 3,
+// Throws = 1 << 4,
+// NonPortable = 1 << 5,
+// Benchmark = 1 << 6
+// };
+//
+// bool isHidden() const;
+// bool throws() const;
+// bool okToFail() const;
+// bool expectedToFail() const;
+//
+// std::string tagsAsString() const;
+//
+// std::string name;
+// std::string className;
+// std::string description;
+// std::vector<std::string> tags;
+// std::vector<std::string> lcaseTags;
+// SourceLineInfo lineInfo;
+// SpecialProperties properties;
+// };
+
+void print( std::ostream& os, int const level, std::string const& title, Catch::TestCaseInfo const& info ) {
+ os << ws(level ) << title << ":\n"
+ << ws(level+1) << "- isHidden(): " << info.isHidden() << "\n"
+ << ws(level+1) << "- throws(): " << info.throws() << "\n"
+ << ws(level+1) << "- okToFail(): " << info.okToFail() << "\n"
+ << ws(level+1) << "- expectedToFail(): " << info.expectedToFail() << "\n"
+ << ws(level+1) << "- tagsAsString(): '" << info.tagsAsString() << "'\n"
+ << ws(level+1) << "- name: '" << info.name << "'\n"
+ << ws(level+1) << "- className: '" << info.className << "'\n"
+ << ws(level+1) << "- description: '" << info.description << "'\n"
+ << ws(level+1) << "- tags: " << info.tags << "\n"
+ << ws(level+1) << "- lcaseTags: " << info.lcaseTags << "\n";
+ print( os, level+1 , "- lineInfo", info.lineInfo );
+ os << ws(level+1) << "- properties (flags): 0x" << std::hex << info.properties << std::dec << "\n";
+}
+
+// struct TestCaseStats {
+// TestCaseInfo testInfo;
+// Totals totals;
+// std::string stdOut;
+// std::string stdErr;
+// bool aborting;
+// };
+
+void print( std::ostream& os, int const level, std::string const& title, Catch::TestCaseStats const& info ) {
+ os << ws(level ) << title << ":\n";
+ print( os, level+1 , "- testInfo", info.testInfo );
+ print( os, level+1 , "- totals" , info.totals );
+ os << ws(level+1) << "- stdOut: " << info.stdOut << "\n"
+ << ws(level+1) << "- stdErr: " << info.stdErr << "\n"
+ << ws(level+1) << "- aborting: " << info.aborting << "\n";
+}
+
+// struct SectionInfo {
+// std::string name;
+// std::string description;
+// SourceLineInfo lineInfo;
+// };
+
+void print( std::ostream& os, int const level, std::string const& title, Catch::SectionInfo const& info ) {
+ os << ws(level ) << title << ":\n"
+ << ws(level+1) << "- name: " << info.name << "\n"
+ << ws(level+1) << "- description: '" << info.description << "'\n";
+ print( os, level+1 , "- lineInfo", info.lineInfo );
+}
+
+// struct SectionStats {
+// SectionInfo sectionInfo;
+// Counts assertions;
+// double durationInSeconds;
+// bool missingAssertions;
+// };
+
+void print( std::ostream& os, int const level, std::string const& title, Catch::SectionStats const& info ) {
+ os << ws(level ) << title << ":\n";
+ print( os, level+1 , "- sectionInfo", info.sectionInfo );
+ print( os, level+1 , "- assertions" , info.assertions );
+ os << ws(level+1) << "- durationInSeconds: " << info.durationInSeconds << "\n"
+ << ws(level+1) << "- missingAssertions: " << info.missingAssertions << "\n";
+}
+
+// struct AssertionInfo
+// {
+// StringRef macroName;
+// SourceLineInfo lineInfo;
+// StringRef capturedExpression;
+// ResultDisposition::Flags resultDisposition;
+// };
+
+void print( std::ostream& os, int const level, std::string const& title, Catch::AssertionInfo const& info ) {
+ os << ws(level ) << title << ":\n"
+ << ws(level+1) << "- macroName: '" << info.macroName << "'\n";
+ print( os, level+1 , "- lineInfo" , info.lineInfo );
+ os << ws(level+1) << "- capturedExpression: '" << info.capturedExpression << "'\n"
+ << ws(level+1) << "- resultDisposition (flags): 0x" << std::hex << info.resultDisposition << std::dec << "\n";
+}
+
+//struct AssertionResultData
+//{
+// std::string reconstructExpression() const;
+//
+// std::string message;
+// mutable std::string reconstructedExpression;
+// LazyExpression lazyExpression;
+// ResultWas::OfType resultType;
+//};
+
+void print( std::ostream& os, int const level, std::string const& title, Catch::AssertionResultData const& info ) {
+ os << ws(level ) << title << ":\n"
+ << ws(level+1) << "- reconstructExpression(): '" << info.reconstructExpression() << "'\n"
+ << ws(level+1) << "- message: '" << info.message << "'\n"
+ << ws(level+1) << "- lazyExpression: '" << "(info.lazyExpression)" << "'\n"
+ << ws(level+1) << "- resultType: '" << info.resultType << "'\n";
+}
+
+//class AssertionResult {
+// bool isOk() const;
+// bool succeeded() const;
+// ResultWas::OfType getResultType() const;
+// bool hasExpression() const;
+// bool hasMessage() const;
+// std::string getExpression() const;
+// std::string getExpressionInMacro() const;
+// bool hasExpandedExpression() const;
+// std::string getExpandedExpression() const;
+// std::string getMessage() const;
+// SourceLineInfo getSourceInfo() const;
+// std::string getTestMacroName() const;
+//
+// AssertionInfo m_info;
+// AssertionResultData m_resultData;
+//};
+
+void print( std::ostream& os, int const level, std::string const& title, Catch::AssertionResult const& info ) {
+ os << ws(level ) << title << ":\n"
+ << ws(level+1) << "- isOk(): " << info.isOk() << "\n"
+ << ws(level+1) << "- succeeded(): " << info.succeeded() << "\n"
+ << ws(level+1) << "- getResultType(): " << info.getResultType() << "\n"
+ << ws(level+1) << "- hasExpression(): " << info.hasExpression() << "\n"
+ << ws(level+1) << "- hasMessage(): " << info.hasMessage() << "\n"
+ << ws(level+1) << "- getExpression(): '" << info.getExpression() << "'\n"
+ << ws(level+1) << "- getExpressionInMacro(): '" << info.getExpressionInMacro() << "'\n"
+ << ws(level+1) << "- hasExpandedExpression(): " << info.hasExpandedExpression() << "\n"
+ << ws(level+1) << "- getExpandedExpression(): " << info.getExpandedExpression() << "'\n"
+ << ws(level+1) << "- getMessage(): '" << info.getMessage() << "'\n";
+ print( os, level+1 , "- getSourceInfo(): ", info.getSourceInfo() );
+ os << ws(level+1) << "- getTestMacroName(): '" << info.getTestMacroName() << "'\n";
+
+// print( os, level+1 , "- *** m_info (AssertionInfo)", info.m_info );
+// print( os, level+1 , "- *** m_resultData (AssertionResultData)", info.m_resultData );
+}
+
+// struct AssertionStats {
+// AssertionResult assertionResult;
+// std::vector<MessageInfo> infoMessages;
+// Totals totals;
+// };
+
+void print( std::ostream& os, int const level, std::string const& title, Catch::AssertionStats const& info ) {
+ os << ws(level ) << title << ":\n";
+ print( os, level+1 , "- assertionResult", info.assertionResult );
+ print( os, level+1 , "- infoMessages", info.infoMessages );
+ print( os, level+1 , "- totals", info.totals );
+}
+
+// -----------------------------------------------------------------------
+// 2. My listener and registration:
+//
+
+char const * dashed_line =
+ "--------------------------------------------------------------------------";
+
+struct MyListener : Catch::TestEventListenerBase {
+
+ using TestEventListenerBase::TestEventListenerBase; // inherit constructor
+
+ // Get rid of Wweak-tables
+ ~MyListener();
+
+ // The whole test run starting
+ virtual void testRunStarting( Catch::TestRunInfo const& testRunInfo ) override {
+ std::cout
+ << std::boolalpha
+ << "\nEvent: testRunStarting:\n";
+ print( std::cout, 1, "- testRunInfo", testRunInfo );
+ }
+
+ // The whole test run ending
+ virtual void testRunEnded( Catch::TestRunStats const& testRunStats ) override {
+ std::cout
+ << dashed_line
+ << "\nEvent: testRunEnded:\n";
+ print( std::cout, 1, "- testRunStats", testRunStats );
+ }
+
+ // A test is being skipped (because it is "hidden")
+ virtual void skipTest( Catch::TestCaseInfo const& testInfo ) override {
+ std::cout
+ << dashed_line
+ << "\nEvent: skipTest:\n";
+ print( std::cout, 1, "- testInfo", testInfo );
+ }
+
+ // Test cases starting
+ virtual void testCaseStarting( Catch::TestCaseInfo const& testInfo ) override {
+ std::cout
+ << dashed_line
+ << "\nEvent: testCaseStarting:\n";
+ print( std::cout, 1, "- testInfo", testInfo );
+ }
+
+ // Test cases ending
+ virtual void testCaseEnded( Catch::TestCaseStats const& testCaseStats ) override {
+ std::cout << "\nEvent: testCaseEnded:\n";
+ print( std::cout, 1, "testCaseStats", testCaseStats );
+ }
+
+ // Sections starting
+ virtual void sectionStarting( Catch::SectionInfo const& sectionInfo ) override {
+ std::cout << "\nEvent: sectionStarting:\n";
+ print( std::cout, 1, "- sectionInfo", sectionInfo );
+ }
+
+ // Sections ending
+ virtual void sectionEnded( Catch::SectionStats const& sectionStats ) override {
+ std::cout << "\nEvent: sectionEnded:\n";
+ print( std::cout, 1, "- sectionStats", sectionStats );
+ }
+
+ // Assertions before/ after
+ virtual void assertionStarting( Catch::AssertionInfo const& assertionInfo ) override {
+ std::cout << "\nEvent: assertionStarting:\n";
+ print( std::cout, 1, "- assertionInfo", assertionInfo );
+ }
+
+ virtual bool assertionEnded( Catch::AssertionStats const& assertionStats ) override {
+ std::cout << "\nEvent: assertionEnded:\n";
+ print( std::cout, 1, "- assertionStats", assertionStats );
+ return true;
+ }
+};
+
+CATCH_REGISTER_LISTENER( MyListener )
+
+// Get rid of Wweak-tables
+MyListener::~MyListener() {}
+
+
+// -----------------------------------------------------------------------
+// 3. Test cases:
+//
+
+TEST_CASE( "1: Hidden testcase", "[.hidden]" ) {
+}
+
+TEST_CASE( "2: Testcase with sections", "[tag-A][tag-B]" ) {
+
+ int i = 42;
+
+ REQUIRE( i == 42 );
+
+ SECTION("Section 1") {
+ INFO("Section 1")
+ i = 7;
+ SECTION("Section 1.1") {
+ INFO("Section 1.1")
+ REQUIRE( i == 42 );
+ }
+ }
+
+ SECTION("Section 2") {
+ INFO("Section 2")
+ REQUIRE( i == 42 );
+ }
+ WARN("At end of test case");
+}
+
+struct Fixture {
+ int fortytwo() const {
+ return 42;
+ }
+};
+
+TEST_CASE_METHOD( Fixture, "3: Testcase with class-based fixture", "[tag-C][tag-D]" ) {
+ REQUIRE( fortytwo() == 42 );
+}
+
+// Compile & run:
+// - g++ -std=c++11 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 210-Evt-EventListeners 210-Evt-EventListeners.cpp 000-CatchMain.o && 210-Evt-EventListeners --success
+// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 210-Evt-EventListeners.cpp 000-CatchMain.obj && 210-Evt-EventListeners --success
+
+// Expected compact output (all assertions):
+//
+// prompt> 210-Evt-EventListeners --reporter compact --success
+// result omitted for brevity.
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
new file mode 100644
index 0000000..7270e93
--- /dev/null
+++ b/examples/CMakeLists.txt
@@ -0,0 +1,100 @@
+#
+# Build examples.
+#
+# Requires CATCH_BUILD_EXAMPLES to be defined 'true', see ../CMakeLists.txt.
+#
+
+cmake_minimum_required( VERSION 3.0 )
+
+project( CatchExamples CXX )
+
+# define folders used:
+
+set( EXAMPLES_DIR ${CATCH_DIR}/examples )
+set( HEADER_DIR ${CATCH_DIR}/single_include )
+
+# single-file sources:
+
+set( SOURCES_SINGLE_FILE
+ 010-TestCase.cpp
+)
+
+# 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
+ 030-Asn-Require-Check.cpp
+ 100-Fix-Section.cpp
+ 110-Fix-ClassFixture.cpp
+ 120-Bdd-ScenarioGivenWhenThen.cpp
+ 210-Evt-EventListeners.cpp
+)
+
+# check if all sources are listed, warn if not:
+
+set( SOURCES_ALL
+ ${SOURCES_020}
+ ${SOURCES_SINGLE_FILE}
+ ${SOURCES_IDIOMATIC_MAIN}
+ ${SOURCES_IDIOMATIC_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}" )
+
+set( TARGETS_SINGLE_FILE ${BASENAMES_SINGLE_FILE} )
+set( TARGETS_IDIOMATIC_TESTS ${BASENAMES_IDIOMATIC_TESTS} )
+set( TARGETS_ALL ${TARGETS_SINGLE_FILE} ${TARGETS_IDIOMATIC_TESTS} 020-TestCase CatchMain )
+
+# define program targets:
+
+add_library( CatchMain OBJECT ${EXAMPLES_DIR}/${SOURCES_IDIOMATIC_MAIN} ${HEADER_DIR}/catch.hpp )
+
+add_executable( 020-TestCase ${EXAMPLES_DIR}/020-TestCase-1.cpp ${EXAMPLES_DIR}/020-TestCase-2.cpp ${HEADER_DIR}/catch.hpp )
+
+foreach( name ${TARGETS_SINGLE_FILE} )
+ add_executable( ${name} ${EXAMPLES_DIR}/${name}.cpp ${HEADER_DIR}/catch.hpp )
+endforeach()
+
+foreach( name ${TARGETS_IDIOMATIC_TESTS} )
+ add_executable( ${name} ${EXAMPLES_DIR}/${name}.cpp $<TARGET_OBJECTS:CatchMain> ${HEADER_DIR}/catch.hpp )
+endforeach()
+
+foreach( name ${TARGETS_ALL} )
+ target_include_directories( ${name} PRIVATE ${HEADER_DIR} )
+
+ set_property(TARGET ${name} PROPERTY CXX_STANDARD 11)
+
+ # Add desired warnings
+ if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang|GNU" )
+ target_compile_options( ${name} PRIVATE -Wall -Wextra -Wunreachable-code )
+ endif()
+ # Clang specific warning go here
+ if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
+ # Actually keep these
+ target_compile_options( ${name} PRIVATE -Wweak-vtables -Wexit-time-destructors -Wglobal-constructors -Wmissing-noreturn )
+ endif()
+ if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" )
+ target_compile_options( ${name} PRIVATE /W4 /w44265 /WX )
+ endif()
+endforeach()
diff --git a/include/catch.hpp b/include/catch.hpp
new file mode 100644
index 0000000..0a4711b
--- /dev/null
+++ b/include/catch.hpp
@@ -0,0 +1,350 @@
+/*
+ * Created by Phil on 22/10/2010.
+ * Copyright 2010 Two Blue Cubes Ltd
+ *
+ * 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)
+ */
+
+#ifndef TWOBLUECUBES_CATCH_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_HPP_INCLUDED
+
+#define CATCH_VERSION_MAJOR 2
+#define CATCH_VERSION_MINOR 1
+#define CATCH_VERSION_PATCH 1
+
+#ifdef __clang__
+# pragma clang system_header
+#elif defined __GNUC__
+# 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
+# define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
+#endif
+
+#if !defined(CATCH_CONFIG_IMPL_ONLY)
+#include "internal/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_benchmark.h"
+#include "internal/catch_interfaces_exception.h"
+#include "internal/catch_approx.h"
+#include "internal/catch_compiler_capabilities.h"
+#include "internal/catch_string_manip.h"
+
+#ifndef CATCH_CONFIG_DISABLE_MATCHERS
+#include "internal/catch_capture_matchers.h"
+#endif
+
+// 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"
+
+#ifdef __OBJC__
+#include "internal/catch_objc.hpp"
+#endif
+
+#ifdef CATCH_CONFIG_EXTERNAL_INTERFACES
+#include "internal/catch_external_interfaces.h"
+#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
+# undef CLARA_CONFIG_MAIN
+#endif
+
+#if !defined(CATCH_CONFIG_DISABLE)
+//////
+// If this config identifier is defined then all CATCH macros are prefixed with CATCH_
+#ifdef CATCH_CONFIG_PREFIX_ALL
+
+#define CATCH_REQUIRE( ... ) INTERNAL_CATCH_TEST( "CATCH_REQUIRE", Catch::ResultDisposition::Normal, __VA_ARGS__ )
+#define CATCH_REQUIRE_FALSE( ... ) INTERNAL_CATCH_TEST( "CATCH_REQUIRE_FALSE", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )
+
+#define CATCH_REQUIRE_THROWS( ... ) INTERNAL_CATCH_THROWS( "CATCH_REQUIRE_THROWS", Catch::ResultDisposition::Normal, "", __VA_ARGS__ )
+#define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CATCH_REQUIRE_THROWS_AS", exceptionType, Catch::ResultDisposition::Normal, expr )
+#define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CATCH_REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr )
+#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
+#define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CATCH_REQUIRE_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::Normal, matcher, expr )
+#endif// CATCH_CONFIG_DISABLE_MATCHERS
+#define CATCH_REQUIRE_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CATCH_REQUIRE_NOTHROW", Catch::ResultDisposition::Normal, __VA_ARGS__ )
+
+#define CATCH_CHECK( ... ) INTERNAL_CATCH_TEST( "CATCH_CHECK", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
+#define CATCH_CHECK_FALSE( ... ) INTERNAL_CATCH_TEST( "CATCH_CHECK_FALSE", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )
+#define CATCH_CHECKED_IF( ... ) INTERNAL_CATCH_IF( "CATCH_CHECKED_IF", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
+#define CATCH_CHECKED_ELSE( ... ) INTERNAL_CATCH_ELSE( "CATCH_CHECKED_ELSE", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
+#define CATCH_CHECK_NOFAIL( ... ) INTERNAL_CATCH_TEST( "CATCH_CHECK_NOFAIL", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ )
+
+#define CATCH_CHECK_THROWS( ... ) INTERNAL_CATCH_THROWS( "CATCH_CHECK_THROWS", Catch::ResultDisposition::ContinueOnFailure, "", __VA_ARGS__ )
+#define CATCH_CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CATCH_CHECK_THROWS_AS", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr )
+#define CATCH_CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CATCH_CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
+#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
+#define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CATCH_CHECK_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
+#endif // CATCH_CONFIG_DISABLE_MATCHERS
+#define CATCH_CHECK_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CATCH_CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
+
+#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
+#define CATCH_CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CATCH_CHECK_THAT", matcher, Catch::ResultDisposition::ContinueOnFailure, arg )
+
+#define CATCH_REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CATCH_REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg )
+#endif // CATCH_CONFIG_DISABLE_MATCHERS
+
+#define CATCH_INFO( msg ) INTERNAL_CATCH_INFO( "CATCH_INFO", msg )
+#define CATCH_WARN( msg ) INTERNAL_CATCH_MSG( "CATCH_WARN", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg )
+#define CATCH_CAPTURE( msg ) INTERNAL_CATCH_INFO( "CATCH_CAPTURE", #msg " := " << ::Catch::Detail::stringify(msg) )
+
+#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )
+#define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __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_SECTION( ... ) INTERNAL_CATCH_SECTION( __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_SUCCEED( ... ) INTERNAL_CATCH_MSG( "CATCH_SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
+
+#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE()
+
+// "BDD-style" convenience wrappers
+#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_GIVEN( desc ) CATCH_SECTION( std::string( "Given: ") + desc )
+#define CATCH_WHEN( desc ) CATCH_SECTION( std::string( " When: ") + desc )
+#define CATCH_AND_WHEN( desc ) CATCH_SECTION( std::string( " And: ") + desc )
+#define CATCH_THEN( desc ) CATCH_SECTION( std::string( " Then: ") + desc )
+#define CATCH_AND_THEN( desc ) CATCH_SECTION( std::string( " And: ") + desc )
+
+// If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required
+#else
+
+#define REQUIRE( ... ) INTERNAL_CATCH_TEST( "REQUIRE", Catch::ResultDisposition::Normal, __VA_ARGS__ )
+#define REQUIRE_FALSE( ... ) INTERNAL_CATCH_TEST( "REQUIRE_FALSE", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )
+
+#define REQUIRE_THROWS( ... ) INTERNAL_CATCH_THROWS( "REQUIRE_THROWS", Catch::ResultDisposition::Normal, __VA_ARGS__ )
+#define REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "REQUIRE_THROWS_AS", exceptionType, Catch::ResultDisposition::Normal, expr )
+#define REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr )
+#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
+#define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "REQUIRE_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::Normal, matcher, expr )
+#endif // CATCH_CONFIG_DISABLE_MATCHERS
+#define REQUIRE_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "REQUIRE_NOTHROW", Catch::ResultDisposition::Normal, __VA_ARGS__ )
+
+#define CHECK( ... ) INTERNAL_CATCH_TEST( "CHECK", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
+#define CHECK_FALSE( ... ) INTERNAL_CATCH_TEST( "CHECK_FALSE", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )
+#define CHECKED_IF( ... ) INTERNAL_CATCH_IF( "CHECKED_IF", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
+#define CHECKED_ELSE( ... ) INTERNAL_CATCH_ELSE( "CHECKED_ELSE", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
+#define CHECK_NOFAIL( ... ) INTERNAL_CATCH_TEST( "CHECK_NOFAIL", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ )
+
+#define CHECK_THROWS( ... ) INTERNAL_CATCH_THROWS( "CHECK_THROWS", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
+#define CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CHECK_THROWS_AS", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr )
+#define CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
+#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
+#define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CHECK_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
+#endif // CATCH_CONFIG_DISABLE_MATCHERS
+#define CHECK_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
+
+
+#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
+#define CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CHECK_THAT", matcher, Catch::ResultDisposition::ContinueOnFailure, arg )
+
+#define REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg )
+#endif // CATCH_CONFIG_DISABLE_MATCHERS
+
+#define INFO( msg ) INTERNAL_CATCH_INFO( "INFO", msg )
+#define WARN( msg ) INTERNAL_CATCH_MSG( "WARN", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg )
+#define CAPTURE( msg ) INTERNAL_CATCH_INFO( "CAPTURE", #msg " := " << ::Catch::Detail::stringify(msg) )
+
+#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )
+#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __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 SECTION( ... ) INTERNAL_CATCH_SECTION( __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 SUCCEED( ... ) INTERNAL_CATCH_MSG( "SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
+#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE()
+
+#endif
+
+#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature )
+
+// "BDD-style" convenience wrappers
+#define SCENARIO( ... ) TEST_CASE( "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 WHEN( desc ) SECTION( std::string(" When: ") + desc )
+#define AND_WHEN( desc ) SECTION( std::string("And when: ") + desc )
+#define THEN( desc ) SECTION( std::string(" Then: ") + desc )
+#define AND_THEN( desc ) SECTION( std::string(" And: ") + desc )
+
+using Catch::Detail::Approx;
+
+#else
+//////
+// If this config identifier is defined then all CATCH macros are prefixed with CATCH_
+#ifdef CATCH_CONFIG_PREFIX_ALL
+
+#define CATCH_REQUIRE( ... ) (void)(0)
+#define CATCH_REQUIRE_FALSE( ... ) (void)(0)
+
+#define CATCH_REQUIRE_THROWS( ... ) (void)(0)
+#define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0)
+#define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) (void)(0)
+#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
+#define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
+#endif// CATCH_CONFIG_DISABLE_MATCHERS
+#define CATCH_REQUIRE_NOTHROW( ... ) (void)(0)
+
+#define CATCH_CHECK( ... ) (void)(0)
+#define CATCH_CHECK_FALSE( ... ) (void)(0)
+#define CATCH_CHECKED_IF( ... ) if (__VA_ARGS__)
+#define CATCH_CHECKED_ELSE( ... ) if (!(__VA_ARGS__))
+#define CATCH_CHECK_NOFAIL( ... ) (void)(0)
+
+#define CATCH_CHECK_THROWS( ... ) (void)(0)
+#define CATCH_CHECK_THROWS_AS( expr, exceptionType ) (void)(0)
+#define CATCH_CHECK_THROWS_WITH( expr, matcher ) (void)(0)
+#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
+#define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
+#endif // CATCH_CONFIG_DISABLE_MATCHERS
+#define CATCH_CHECK_NOTHROW( ... ) (void)(0)
+
+#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
+#define CATCH_CHECK_THAT( arg, matcher ) (void)(0)
+
+#define CATCH_REQUIRE_THAT( arg, matcher ) (void)(0)
+#endif // CATCH_CONFIG_DISABLE_MATCHERS
+
+#define CATCH_INFO( msg ) (void)(0)
+#define CATCH_WARN( msg ) (void)(0)
+#define CATCH_CAPTURE( msg ) (void)(0)
+
+#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
+#define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
+#define CATCH_METHOD_AS_TEST_CASE( method, ... )
+#define CATCH_REGISTER_TEST_CASE( Function, ... ) (void)(0)
+#define CATCH_SECTION( ... )
+#define CATCH_FAIL( ... ) (void)(0)
+#define CATCH_FAIL_CHECK( ... ) (void)(0)
+#define CATCH_SUCCEED( ... ) (void)(0)
+
+#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
+
+// "BDD-style" convenience wrappers
+#define CATCH_SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
+#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), className )
+#define CATCH_GIVEN( desc )
+#define CATCH_WHEN( desc )
+#define CATCH_AND_WHEN( desc )
+#define CATCH_THEN( desc )
+#define CATCH_AND_THEN( desc )
+
+// If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required
+#else
+
+#define REQUIRE( ... ) (void)(0)
+#define REQUIRE_FALSE( ... ) (void)(0)
+
+#define REQUIRE_THROWS( ... ) (void)(0)
+#define REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0)
+#define REQUIRE_THROWS_WITH( expr, matcher ) (void)(0)
+#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
+#define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
+#endif // CATCH_CONFIG_DISABLE_MATCHERS
+#define REQUIRE_NOTHROW( ... ) (void)(0)
+
+#define CHECK( ... ) (void)(0)
+#define CHECK_FALSE( ... ) (void)(0)
+#define CHECKED_IF( ... ) if (__VA_ARGS__)
+#define CHECKED_ELSE( ... ) if (!(__VA_ARGS__))
+#define CHECK_NOFAIL( ... ) (void)(0)
+
+#define CHECK_THROWS( ... ) (void)(0)
+#define CHECK_THROWS_AS( expr, exceptionType ) (void)(0)
+#define CHECK_THROWS_WITH( expr, matcher ) (void)(0)
+#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
+#define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
+#endif // CATCH_CONFIG_DISABLE_MATCHERS
+#define CHECK_NOTHROW( ... ) (void)(0)
+
+
+#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
+#define CHECK_THAT( arg, matcher ) (void)(0)
+
+#define REQUIRE_THAT( arg, matcher ) (void)(0)
+#endif // CATCH_CONFIG_DISABLE_MATCHERS
+
+#define INFO( msg ) (void)(0)
+#define WARN( msg ) (void)(0)
+#define CAPTURE( msg ) (void)(0)
+
+#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
+#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
+#define METHOD_AS_TEST_CASE( method, ... )
+#define REGISTER_TEST_CASE( Function, ... ) (void)(0)
+#define SECTION( ... )
+#define FAIL( ... ) (void)(0)
+#define FAIL_CHECK( ... ) (void)(0)
+#define SUCCEED( ... ) (void)(0)
+#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
+
+#endif
+
+#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature )
+
+// "BDD-style" convenience wrappers
+#define SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ) )
+#define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), className )
+
+#define GIVEN( desc )
+#define WHEN( desc )
+#define AND_WHEN( desc )
+#define THEN( desc )
+#define AND_THEN( desc )
+
+using Catch::Detail::Approx;
+
+
+#endif
+
+#endif // ! CATCH_CONFIG_IMPL_ONLY
+
+#include "internal/catch_reenable_warnings.h"
+
+#endif // TWOBLUECUBES_CATCH_HPP_INCLUDED
diff --git a/include/catch_with_main.hpp b/include/catch_with_main.hpp
new file mode 100644
index 0000000..54aa651
--- /dev/null
+++ b/include/catch_with_main.hpp
@@ -0,0 +1,14 @@
+ /*
+ * Created by Phil on 01/11/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_WITH_MAIN_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_WITH_MAIN_HPP_INCLUDED
+
+#define CATCH_CONFIG_MAIN
+#include "catch.hpp"
+
+#endif // TWOBLUECUBES_CATCH_WITH_MAIN_HPP_INCLUDED
diff --git a/include/external/clara.hpp b/include/external/clara.hpp
new file mode 100644
index 0000000..7dab7e2
--- /dev/null
+++ b/include/external/clara.hpp
@@ -0,0 +1,1238 @@
+// Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
+//
+// 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)
+//
+// See https://github.com/philsquared/Clara for more details
+
+// Clara v1.1.1
+
+#ifndef CATCH_CLARA_HPP_INCLUDED
+#define CATCH_CLARA_HPP_INCLUDED
+
+#ifndef CATCH_CLARA_CONFIG_CONSOLE_WIDTH
+#define CATCH_CLARA_CONFIG_CONSOLE_WIDTH 80
+#endif
+
+#ifndef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH
+#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_CLARA_CONFIG_CONSOLE_WIDTH
+#endif
+
+// ----------- #included from clara_textflow.hpp -----------
+
+// TextFlowCpp
+//
+// A single-header library for wrapping and laying out basic text, by Phil Nash
+//
+// This work is licensed under the BSD 2-Clause license.
+// See the accompanying LICENSE file, or the one at https://opensource.org/licenses/BSD-2-Clause
+//
+// This project is hosted at https://github.com/philsquared/textflowcpp
+
+#ifndef CATCH_CLARA_TEXTFLOW_HPP_INCLUDED
+#define CATCH_CLARA_TEXTFLOW_HPP_INCLUDED
+
+#include <cassert>
+#include <ostream>
+#include <sstream>
+#include <vector>
+
+#ifndef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH
+#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH 80
+#endif
+
+
+namespace Catch { namespace clara { namespace TextFlow {
+
+ inline auto isWhitespace( char c ) -> bool {
+ static std::string chars = " \t\n\r";
+ return chars.find( c ) != std::string::npos;
+ }
+ inline auto isBreakableBefore( char c ) -> bool {
+ static std::string chars = "[({<|";
+ return chars.find( c ) != std::string::npos;
+ }
+ inline auto isBreakableAfter( char c ) -> bool {
+ static std::string chars = "])}>.,:;*+-=&/\\";
+ return chars.find( c ) != std::string::npos;
+ }
+
+ class Columns;
+
+ class Column {
+ std::vector<std::string> m_strings;
+ size_t m_width = CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH;
+ size_t m_indent = 0;
+ size_t m_initialIndent = std::string::npos;
+
+ public:
+ class iterator {
+ friend Column;
+
+ Column const& m_column;
+ size_t m_stringIndex = 0;
+ size_t m_pos = 0;
+
+ size_t m_len = 0;
+ size_t m_end = 0;
+ bool m_suffix = false;
+
+ iterator( Column const& column, size_t stringIndex )
+ : m_column( column ),
+ m_stringIndex( stringIndex )
+ {}
+
+ auto line() const -> std::string const& { return m_column.m_strings[m_stringIndex]; }
+
+ auto isBoundary( size_t at ) const -> bool {
+ assert( at > 0 );
+ assert( at <= line().size() );
+
+ return at == line().size() ||
+ ( isWhitespace( line()[at] ) && !isWhitespace( line()[at-1] ) ) ||
+ isBreakableBefore( line()[at] ) ||
+ isBreakableAfter( line()[at-1] );
+ }
+
+ void calcLength() {
+ assert( m_stringIndex < m_column.m_strings.size() );
+
+ m_suffix = false;
+ auto width = m_column.m_width-indent();
+ m_end = m_pos;
+ while( m_end < line().size() && line()[m_end] != '\n' )
+ ++m_end;
+
+ if( m_end < m_pos + width ) {
+ m_len = m_end - m_pos;
+ }
+ else {
+ size_t len = width;
+ while (len > 0 && !isBoundary(m_pos + len))
+ --len;
+ while (len > 0 && isWhitespace( line()[m_pos + len - 1] ))
+ --len;
+
+ if (len > 0) {
+ m_len = len;
+ } else {
+ m_suffix = true;
+ m_len = width - 1;
+ }
+ }
+ }
+
+ auto indent() const -> size_t {
+ auto initial = m_pos == 0 && m_stringIndex == 0 ? m_column.m_initialIndent : std::string::npos;
+ return initial == std::string::npos ? m_column.m_indent : initial;
+ }
+
+ auto addIndentAndSuffix(std::string const &plain) const -> std::string {
+ return std::string( indent(), ' ' ) + (m_suffix ? plain + "-" : plain);
+ }
+
+ public:
+ explicit iterator( Column const& column ) : m_column( column ) {
+ assert( m_column.m_width > m_column.m_indent );
+ assert( m_column.m_initialIndent == std::string::npos || m_column.m_width > m_column.m_initialIndent );
+ calcLength();
+ if( m_len == 0 )
+ m_stringIndex++; // Empty string
+ }
+
+ auto operator *() const -> std::string {
+ assert( m_stringIndex < m_column.m_strings.size() );
+ assert( m_pos <= m_end );
+ if( m_pos + m_column.m_width < m_end )
+ return addIndentAndSuffix(line().substr(m_pos, m_len));
+ else
+ return addIndentAndSuffix(line().substr(m_pos, m_end - m_pos));
+ }
+
+ auto operator ++() -> iterator& {
+ m_pos += m_len;
+ if( m_pos < line().size() && line()[m_pos] == '\n' )
+ m_pos += 1;
+ else
+ while( m_pos < line().size() && isWhitespace( line()[m_pos] ) )
+ ++m_pos;
+
+ if( m_pos == line().size() ) {
+ m_pos = 0;
+ ++m_stringIndex;
+ }
+ if( m_stringIndex < m_column.m_strings.size() )
+ calcLength();
+ return *this;
+ }
+ auto operator ++(int) -> iterator {
+ iterator prev( *this );
+ operator++();
+ return prev;
+ }
+
+ auto operator ==( iterator const& other ) const -> bool {
+ return
+ m_pos == other.m_pos &&
+ m_stringIndex == other.m_stringIndex &&
+ &m_column == &other.m_column;
+ }
+ auto operator !=( iterator const& other ) const -> bool {
+ return !operator==( other );
+ }
+ };
+ using const_iterator = iterator;
+
+ explicit Column( std::string const& text ) { m_strings.push_back( text ); }
+
+ auto width( size_t newWidth ) -> Column& {
+ assert( newWidth > 0 );
+ m_width = newWidth;
+ return *this;
+ }
+ auto indent( size_t newIndent ) -> Column& {
+ m_indent = newIndent;
+ return *this;
+ }
+ auto initialIndent( size_t newIndent ) -> Column& {
+ m_initialIndent = newIndent;
+ return *this;
+ }
+
+ auto width() const -> size_t { return m_width; }
+ auto begin() const -> iterator { return iterator( *this ); }
+ auto end() const -> iterator { return { *this, m_strings.size() }; }
+
+ inline friend std::ostream& operator << ( std::ostream& os, Column const& col ) {
+ bool first = true;
+ for( auto line : col ) {
+ if( first )
+ first = false;
+ else
+ os << "\n";
+ os << line;
+ }
+ return os;
+ }
+
+ auto operator + ( Column const& other ) -> Columns;
+
+ auto toString() const -> std::string {
+ std::ostringstream oss;
+ oss << *this;
+ return oss.str();
+ }
+ };
+
+ class Spacer : public Column {
+
+ public:
+ explicit Spacer( size_t spaceWidth ) : Column( "" ) {
+ width( spaceWidth );
+ }
+ };
+
+ class Columns {
+ std::vector<Column> m_columns;
+
+ public:
+
+ class iterator {
+ friend Columns;
+ struct EndTag {};
+
+ std::vector<Column> const& m_columns;
+ std::vector<Column::iterator> m_iterators;
+ size_t m_activeIterators;
+
+ iterator( Columns const& columns, EndTag )
+ : m_columns( columns.m_columns ),
+ m_activeIterators( 0 )
+ {
+ m_iterators.reserve( m_columns.size() );
+
+ for( auto const& col : m_columns )
+ m_iterators.push_back( col.end() );
+ }
+
+ public:
+ explicit iterator( Columns const& columns )
+ : m_columns( columns.m_columns ),
+ m_activeIterators( m_columns.size() )
+ {
+ m_iterators.reserve( m_columns.size() );
+
+ for( auto const& col : m_columns )
+ m_iterators.push_back( col.begin() );
+ }
+
+ auto operator ==( iterator const& other ) const -> bool {
+ return m_iterators == other.m_iterators;
+ }
+ auto operator !=( iterator const& other ) const -> bool {
+ return m_iterators != other.m_iterators;
+ }
+ auto operator *() const -> std::string {
+ std::string row, padding;
+
+ for( size_t i = 0; i < m_columns.size(); ++i ) {
+ auto width = m_columns[i].width();
+ if( m_iterators[i] != m_columns[i].end() ) {
+ std::string col = *m_iterators[i];
+ row += padding + col;
+ if( col.size() < width )
+ padding = std::string( width - col.size(), ' ' );
+ else
+ padding = "";
+ }
+ else {
+ padding += std::string( width, ' ' );
+ }
+ }
+ return row;
+ }
+ auto operator ++() -> iterator& {
+ for( size_t i = 0; i < m_columns.size(); ++i ) {
+ if (m_iterators[i] != m_columns[i].end())
+ ++m_iterators[i];
+ }
+ return *this;
+ }
+ auto operator ++(int) -> iterator {
+ iterator prev( *this );
+ operator++();
+ return prev;
+ }
+ };
+ using const_iterator = iterator;
+
+ auto begin() const -> iterator { return iterator( *this ); }
+ auto end() const -> iterator { return { *this, iterator::EndTag() }; }
+
+ auto operator += ( Column const& col ) -> Columns& {
+ m_columns.push_back( col );
+ return *this;
+ }
+ auto operator + ( Column const& col ) -> Columns {
+ Columns combined = *this;
+ combined += col;
+ return combined;
+ }
+
+ inline friend std::ostream& operator << ( std::ostream& os, Columns const& cols ) {
+
+ bool first = true;
+ for( auto line : cols ) {
+ if( first )
+ first = false;
+ else
+ os << "\n";
+ os << line;
+ }
+ return os;
+ }
+
+ auto toString() const -> std::string {
+ std::ostringstream oss;
+ oss << *this;
+ return oss.str();
+ }
+ };
+
+ inline auto Column::operator + ( Column const& other ) -> Columns {
+ Columns cols;
+ cols += *this;
+ cols += other;
+ return cols;
+ }
+}}} // namespace Catch::clara::TextFlow
+
+#endif // CATCH_CLARA_TEXTFLOW_HPP_INCLUDED
+
+// ----------- end of #include from clara_textflow.hpp -----------
+// ........... back in clara.hpp
+
+
+#include <memory>
+#include <set>
+#include <algorithm>
+
+#if !defined(CATCH_PLATFORM_WINDOWS) && ( defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) )
+#define CATCH_PLATFORM_WINDOWS
+#endif
+
+namespace Catch { namespace clara {
+namespace detail {
+
+ // Traits for extracting arg and return type of lambdas (for single argument lambdas)
+ template<typename L>
+ struct UnaryLambdaTraits : UnaryLambdaTraits<decltype( &L::operator() )> {};
+
+ template<typename ClassT, typename ReturnT, typename... Args>
+ struct UnaryLambdaTraits<ReturnT( ClassT::* )( Args... ) const> {
+ static const bool isValid = false;
+ };
+
+ template<typename ClassT, typename ReturnT, typename ArgT>
+ struct UnaryLambdaTraits<ReturnT( ClassT::* )( ArgT ) const> {
+ static const bool isValid = true;
+ using ArgType = typename std::remove_const<typename std::remove_reference<ArgT>::type>::type;
+ using ReturnType = ReturnT;
+ };
+
+ class TokenStream;
+
+ // Transport for raw args (copied from main args, or supplied via init list for testing)
+ class Args {
+ friend TokenStream;
+ std::string m_exeName;
+ std::vector<std::string> m_args;
+
+ public:
+ Args( int argc, char *argv[] ) {
+ m_exeName = argv[0];
+ for( int i = 1; i < argc; ++i )
+ m_args.push_back( argv[i] );
+ }
+
+ Args( std::initializer_list<std::string> args )
+ : m_exeName( *args.begin() ),
+ m_args( args.begin()+1, args.end() )
+ {}
+
+ auto exeName() const -> std::string {
+ return m_exeName;
+ }
+ };
+
+ // Wraps a token coming from a token stream. These may not directly correspond to strings as a single string
+ // may encode an option + its argument if the : or = form is used
+ enum class TokenType {
+ Option, Argument
+ };
+ struct Token {
+ TokenType type;
+ std::string token;
+ };
+
+ inline auto isOptPrefix( char c ) -> bool {
+ return c == '-'
+#ifdef CATCH_PLATFORM_WINDOWS
+ || c == '/'
+#endif
+ ;
+ }
+
+ // Abstracts iterators into args as a stream of tokens, with option arguments uniformly handled
+ class TokenStream {
+ using Iterator = std::vector<std::string>::const_iterator;
+ Iterator it;
+ Iterator itEnd;
+ std::vector<Token> m_tokenBuffer;
+
+ void loadBuffer() {
+ m_tokenBuffer.resize( 0 );
+
+ // Skip any empty strings
+ while( it != itEnd && it->empty() )
+ ++it;
+
+ if( it != itEnd ) {
+ auto const &next = *it;
+ if( isOptPrefix( next[0] ) ) {
+ auto delimiterPos = next.find_first_of( " :=" );
+ if( delimiterPos != std::string::npos ) {
+ m_tokenBuffer.push_back( { TokenType::Option, next.substr( 0, delimiterPos ) } );
+ m_tokenBuffer.push_back( { TokenType::Argument, next.substr( delimiterPos + 1 ) } );
+ } else {
+ if( next[1] != '-' && next.size() > 2 ) {
+ std::string opt = "- ";
+ for( size_t i = 1; i < next.size(); ++i ) {
+ opt[1] = next[i];
+ m_tokenBuffer.push_back( { TokenType::Option, opt } );
+ }
+ } else {
+ m_tokenBuffer.push_back( { TokenType::Option, next } );
+ }
+ }
+ } else {
+ m_tokenBuffer.push_back( { TokenType::Argument, next } );
+ }
+ }
+ }
+
+ public:
+ explicit TokenStream( Args const &args ) : TokenStream( args.m_args.begin(), args.m_args.end() ) {}
+
+ TokenStream( Iterator it, Iterator itEnd ) : it( it ), itEnd( itEnd ) {
+ loadBuffer();
+ }
+
+ explicit operator bool() const {
+ return !m_tokenBuffer.empty() || it != itEnd;
+ }
+
+ auto count() const -> size_t { return m_tokenBuffer.size() + (itEnd - it); }
+
+ auto operator*() const -> Token {
+ assert( !m_tokenBuffer.empty() );
+ return m_tokenBuffer.front();
+ }
+
+ auto operator->() const -> Token const * {
+ assert( !m_tokenBuffer.empty() );
+ return &m_tokenBuffer.front();
+ }
+
+ auto operator++() -> TokenStream & {
+ if( m_tokenBuffer.size() >= 2 ) {
+ m_tokenBuffer.erase( m_tokenBuffer.begin() );
+ } else {
+ if( it != itEnd )
+ ++it;
+ loadBuffer();
+ }
+ return *this;
+ }
+ };
+
+
+ class ResultBase {
+ public:
+ enum Type {
+ Ok, LogicError, RuntimeError
+ };
+
+ protected:
+ ResultBase( Type type ) : m_type( type ) {}
+ virtual ~ResultBase() = default;
+
+ virtual void enforceOk() const = 0;
+
+ Type m_type;
+ };
+
+ template<typename T>
+ class ResultValueBase : public ResultBase {
+ public:
+ auto value() const -> T const & {
+ enforceOk();
+ return m_value;
+ }
+
+ protected:
+ ResultValueBase( Type type ) : ResultBase( type ) {}
+
+ ResultValueBase( ResultValueBase const &other ) : ResultBase( other ) {
+ if( m_type == ResultBase::Ok )
+ new( &m_value ) T( other.m_value );
+ }
+
+ ResultValueBase( Type, T const &value ) : ResultBase( Ok ) {
+ new( &m_value ) T( value );
+ }
+
+ auto operator=( ResultValueBase const &other ) -> ResultValueBase & {
+ if( m_type == ResultBase::Ok )
+ m_value.~T();
+ ResultBase::operator=(other);
+ if( m_type == ResultBase::Ok )
+ new( &m_value ) T( other.m_value );
+ return *this;
+ }
+
+ ~ResultValueBase() override {
+ if( m_type == Ok )
+ m_value.~T();
+ }
+
+ union {
+ T m_value;
+ };
+ };
+
+ template<>
+ class ResultValueBase<void> : public ResultBase {
+ protected:
+ using ResultBase::ResultBase;
+ };
+
+ template<typename T = void>
+ class BasicResult : public ResultValueBase<T> {
+ public:
+ template<typename U>
+ explicit BasicResult( BasicResult<U> const &other )
+ : ResultValueBase<T>( other.type() ),
+ m_errorMessage( other.errorMessage() )
+ {
+ assert( type() != ResultBase::Ok );
+ }
+
+ template<typename U>
+ static auto ok( U const &value ) -> BasicResult { return { ResultBase::Ok, value }; }
+ static auto ok() -> BasicResult { return { ResultBase::Ok }; }
+ static auto logicError( std::string const &message ) -> BasicResult { return { ResultBase::LogicError, message }; }
+ static auto runtimeError( std::string const &message ) -> BasicResult { return { ResultBase::RuntimeError, message }; }
+
+ explicit operator bool() const { return m_type == ResultBase::Ok; }
+ auto type() const -> ResultBase::Type { return m_type; }
+ auto errorMessage() const -> std::string { return m_errorMessage; }
+
+ protected:
+ void enforceOk() const override {
+ // !TBD: If no exceptions, std::terminate here or something
+ switch( m_type ) {
+ case ResultBase::LogicError:
+ throw std::logic_error( m_errorMessage );
+ case ResultBase::RuntimeError:
+ throw std::runtime_error( m_errorMessage );
+ case ResultBase::Ok:
+ break;
+ }
+ }
+
+ std::string m_errorMessage; // Only populated if resultType is an error
+
+ BasicResult( ResultBase::Type type, std::string const &message )
+ : ResultValueBase<T>(type),
+ m_errorMessage(message)
+ {
+ assert( m_type != ResultBase::Ok );
+ }
+
+ using ResultValueBase<T>::ResultValueBase;
+ using ResultBase::m_type;
+ };
+
+ enum class ParseResultType {
+ Matched, NoMatch, ShortCircuitAll, ShortCircuitSame
+ };
+
+ class ParseState {
+ public:
+
+ ParseState( ParseResultType type, TokenStream const &remainingTokens )
+ : m_type(type),
+ m_remainingTokens( remainingTokens )
+ {}
+
+ auto type() const -> ParseResultType { return m_type; }
+ auto remainingTokens() const -> TokenStream { return m_remainingTokens; }
+
+ private:
+ ParseResultType m_type;
+ TokenStream m_remainingTokens;
+ };
+
+ using Result = BasicResult<void>;
+ using ParserResult = BasicResult<ParseResultType>;
+ using InternalParseResult = BasicResult<ParseState>;
+
+ struct HelpColumns {
+ std::string left;
+ std::string right;
+ };
+
+ template<typename T>
+ inline auto convertInto( std::string const &source, T& target ) -> ParserResult {
+ std::stringstream ss;
+ ss << source;
+ ss >> target;
+ if( ss.fail() )
+ return ParserResult::runtimeError( "Unable to convert '" + source + "' to destination type" );
+ else
+ return ParserResult::ok( ParseResultType::Matched );
+ }
+ inline auto convertInto( std::string const &source, std::string& target ) -> ParserResult {
+ target = source;
+ return ParserResult::ok( ParseResultType::Matched );
+ }
+ inline auto convertInto( std::string const &source, bool &target ) -> ParserResult {
+ std::string srcLC = source;
+ std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( char c ) { return static_cast<char>( ::tolower(c) ); } );
+ if (srcLC == "y" || srcLC == "1" || srcLC == "true" || srcLC == "yes" || srcLC == "on")
+ target = true;
+ else if (srcLC == "n" || srcLC == "0" || srcLC == "false" || srcLC == "no" || srcLC == "off")
+ target = false;
+ else
+ return ParserResult::runtimeError( "Expected a boolean value but did not recognise: '" + source + "'" );
+ return ParserResult::ok( ParseResultType::Matched );
+ }
+
+ struct NonCopyable {
+ NonCopyable() = default;
+ NonCopyable( NonCopyable const & ) = delete;
+ NonCopyable( NonCopyable && ) = delete;
+ NonCopyable &operator=( NonCopyable const & ) = delete;
+ NonCopyable &operator=( NonCopyable && ) = delete;
+ };
+
+ struct BoundRef : NonCopyable {
+ virtual ~BoundRef() = default;
+ virtual auto isContainer() const -> bool { return false; }
+ };
+ struct BoundValueRefBase : BoundRef {
+ virtual auto setValue( std::string const &arg ) -> ParserResult = 0;
+ };
+ struct BoundFlagRefBase : BoundRef {
+ virtual auto setFlag( bool flag ) -> ParserResult = 0;
+ };
+
+ template<typename T>
+ struct BoundValueRef : BoundValueRefBase {
+ T &m_ref;
+
+ explicit BoundValueRef( T &ref ) : m_ref( ref ) {}
+
+ auto setValue( std::string const &arg ) -> ParserResult override {
+ return convertInto( arg, m_ref );
+ }
+ };
+
+ template<typename T>
+ struct BoundValueRef<std::vector<T>> : BoundValueRefBase {
+ std::vector<T> &m_ref;
+
+ explicit BoundValueRef( std::vector<T> &ref ) : m_ref( ref ) {}
+
+ auto isContainer() const -> bool override { return true; }
+
+ auto setValue( std::string const &arg ) -> ParserResult override {
+ T temp;
+ auto result = convertInto( arg, temp );
+ if( result )
+ m_ref.push_back( temp );
+ return result;
+ }
+ };
+
+ struct BoundFlagRef : BoundFlagRefBase {
+ bool &m_ref;
+
+ explicit BoundFlagRef( bool &ref ) : m_ref( ref ) {}
+
+ auto setFlag( bool flag ) -> ParserResult override {
+ m_ref = flag;
+ return ParserResult::ok( ParseResultType::Matched );
+ }
+ };
+
+ template<typename ReturnType>
+ struct LambdaInvoker {
+ static_assert( std::is_same<ReturnType, ParserResult>::value, "Lambda must return void or clara::ParserResult" );
+
+ template<typename L, typename ArgType>
+ static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult {
+ return lambda( arg );
+ }
+ };
+
+ template<>
+ struct LambdaInvoker<void> {
+ template<typename L, typename ArgType>
+ static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult {
+ lambda( arg );
+ return ParserResult::ok( ParseResultType::Matched );
+ }
+ };
+
+ template<typename ArgType, typename L>
+ inline auto invokeLambda( L const &lambda, std::string const &arg ) -> ParserResult {
+ ArgType temp{};
+ auto result = convertInto( arg, temp );
+ return !result
+ ? result
+ : LambdaInvoker<typename UnaryLambdaTraits<L>::ReturnType>::invoke( lambda, temp );
+ }
+
+
+ template<typename L>
+ struct BoundLambda : BoundValueRefBase {
+ L m_lambda;
+
+ static_assert( UnaryLambdaTraits<L>::isValid, "Supplied lambda must take exactly one argument" );
+ explicit BoundLambda( L const &lambda ) : m_lambda( lambda ) {}
+
+ auto setValue( std::string const &arg ) -> ParserResult override {
+ return invokeLambda<typename UnaryLambdaTraits<L>::ArgType>( m_lambda, arg );
+ }
+ };
+
+ template<typename L>
+ struct BoundFlagLambda : BoundFlagRefBase {
+ L m_lambda;
+
+ static_assert( UnaryLambdaTraits<L>::isValid, "Supplied lambda must take exactly one argument" );
+ static_assert( std::is_same<typename UnaryLambdaTraits<L>::ArgType, bool>::value, "flags must be boolean" );
+
+ explicit BoundFlagLambda( L const &lambda ) : m_lambda( lambda ) {}
+
+ auto setFlag( bool flag ) -> ParserResult override {
+ return LambdaInvoker<typename UnaryLambdaTraits<L>::ReturnType>::invoke( m_lambda, flag );
+ }
+ };
+
+ enum class Optionality { Optional, Required };
+
+ struct Parser;
+
+ class ParserBase {
+ public:
+ virtual ~ParserBase() = default;
+ virtual auto validate() const -> Result { return Result::ok(); }
+ virtual auto parse( std::string const& exeName, TokenStream const &tokens) const -> InternalParseResult = 0;
+ virtual auto cardinality() const -> size_t { return 1; }
+
+ auto parse( Args const &args ) const -> InternalParseResult {
+ return parse( args.exeName(), TokenStream( args ) );
+ }
+ };
+
+ template<typename DerivedT>
+ class ComposableParserImpl : public ParserBase {
+ public:
+ template<typename T>
+ auto operator|( T const &other ) const -> Parser;
+
+ template<typename T>
+ auto operator+( T const &other ) const -> Parser;
+ };
+
+ // Common code and state for Args and Opts
+ template<typename DerivedT>
+ class ParserRefImpl : public ComposableParserImpl<DerivedT> {
+ protected:
+ Optionality m_optionality = Optionality::Optional;
+ std::shared_ptr<BoundRef> m_ref;
+ std::string m_hint;
+ std::string m_description;
+
+ explicit ParserRefImpl( std::shared_ptr<BoundRef> const &ref ) : m_ref( ref ) {}
+
+ public:
+ template<typename T>
+ ParserRefImpl( T &ref, std::string const &hint )
+ : m_ref( std::make_shared<BoundValueRef<T>>( ref ) ),
+ m_hint( hint )
+ {}
+
+ template<typename LambdaT>
+ ParserRefImpl( LambdaT const &ref, std::string const &hint )
+ : m_ref( std::make_shared<BoundLambda<LambdaT>>( ref ) ),
+ m_hint(hint)
+ {}
+
+ auto operator()( std::string const &description ) -> DerivedT & {
+ m_description = description;
+ return static_cast<DerivedT &>( *this );
+ }
+
+ auto optional() -> DerivedT & {
+ m_optionality = Optionality::Optional;
+ return static_cast<DerivedT &>( *this );
+ };
+
+ auto required() -> DerivedT & {
+ m_optionality = Optionality::Required;
+ return static_cast<DerivedT &>( *this );
+ };
+
+ auto isOptional() const -> bool {
+ return m_optionality == Optionality::Optional;
+ }
+
+ auto cardinality() const -> size_t override {
+ if( m_ref->isContainer() )
+ return 0;
+ else
+ return 1;
+ }
+
+ auto hint() const -> std::string { return m_hint; }
+ };
+
+ class ExeName : public ComposableParserImpl<ExeName> {
+ std::shared_ptr<std::string> m_name;
+ std::shared_ptr<BoundValueRefBase> m_ref;
+
+ template<typename LambdaT>
+ static auto makeRef(LambdaT const &lambda) -> std::shared_ptr<BoundValueRefBase> {
+ return std::make_shared<BoundLambda<LambdaT>>( lambda) ;
+ }
+
+ public:
+ ExeName() : m_name( std::make_shared<std::string>( "<executable>" ) ) {}
+
+ explicit ExeName( std::string &ref ) : ExeName() {
+ m_ref = std::make_shared<BoundValueRef<std::string>>( ref );
+ }
+
+ template<typename LambdaT>
+ explicit ExeName( LambdaT const& lambda ) : ExeName() {
+ m_ref = std::make_shared<BoundLambda<LambdaT>>( lambda );
+ }
+
+ // The exe name is not parsed out of the normal tokens, but is handled specially
+ auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override {
+ return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) );
+ }
+
+ auto name() const -> std::string { return *m_name; }
+ auto set( std::string const& newName ) -> ParserResult {
+
+ auto lastSlash = newName.find_last_of( "\\/" );
+ auto filename = ( lastSlash == std::string::npos )
+ ? newName
+ : newName.substr( lastSlash+1 );
+
+ *m_name = filename;
+ if( m_ref )
+ return m_ref->setValue( filename );
+ else
+ return ParserResult::ok( ParseResultType::Matched );
+ }
+ };
+
+ class Arg : public ParserRefImpl<Arg> {
+ public:
+ using ParserRefImpl::ParserRefImpl;
+
+ auto parse( std::string const &, TokenStream const &tokens ) const -> InternalParseResult override {
+ auto validationResult = validate();
+ if( !validationResult )
+ return InternalParseResult( validationResult );
+
+ auto remainingTokens = tokens;
+ auto const &token = *remainingTokens;
+ if( token.type != TokenType::Argument )
+ return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) );
+
+ assert( dynamic_cast<detail::BoundValueRefBase*>( m_ref.get() ) );
+ auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() );
+
+ auto result = valueRef->setValue( remainingTokens->token );
+ if( !result )
+ return InternalParseResult( result );
+ else
+ return InternalParseResult::ok( ParseState( ParseResultType::Matched, ++remainingTokens ) );
+ }
+ };
+
+ inline auto normaliseOpt( std::string const &optName ) -> std::string {
+#ifdef CATCH_PLATFORM_WINDOWS
+ if( optName[0] == '/' )
+ return "-" + optName.substr( 1 );
+ else
+#endif
+ return optName;
+ }
+
+ class Opt : public ParserRefImpl<Opt> {
+ protected:
+ std::vector<std::string> m_optNames;
+
+ public:
+ template<typename LambdaT>
+ explicit Opt( LambdaT const &ref ) : ParserRefImpl( std::make_shared<BoundFlagLambda<LambdaT>>( ref ) ) {}
+
+ explicit Opt( bool &ref ) : ParserRefImpl( std::make_shared<BoundFlagRef>( ref ) ) {}
+
+ template<typename LambdaT>
+ Opt( LambdaT const &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {}
+
+ template<typename T>
+ Opt( T &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {}
+
+ auto operator[]( std::string const &optName ) -> Opt & {
+ m_optNames.push_back( optName );
+ return *this;
+ }
+
+ auto getHelpColumns() const -> std::vector<HelpColumns> {
+ std::ostringstream oss;
+ bool first = true;
+ for( auto const &opt : m_optNames ) {
+ if (first)
+ first = false;
+ else
+ oss << ", ";
+ oss << opt;
+ }
+ if( !m_hint.empty() )
+ oss << " <" << m_hint << ">";
+ return { { oss.str(), m_description } };
+ }
+
+ auto isMatch( std::string const &optToken ) const -> bool {
+ auto normalisedToken = normaliseOpt( optToken );
+ for( auto const &name : m_optNames ) {
+ if( normaliseOpt( name ) == normalisedToken )
+ return true;
+ }
+ return false;
+ }
+
+ using ParserBase::parse;
+
+ auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override {
+ auto validationResult = validate();
+ if( !validationResult )
+ return InternalParseResult( validationResult );
+
+ auto remainingTokens = tokens;
+ if( remainingTokens && remainingTokens->type == TokenType::Option ) {
+ auto const &token = *remainingTokens;
+ if( isMatch(token.token ) ) {
+ if( auto flagRef = dynamic_cast<detail::BoundFlagRefBase*>( m_ref.get() ) ) {
+ auto result = flagRef->setFlag( true );
+ if( !result )
+ return InternalParseResult( result );
+ if( result.value() == ParseResultType::ShortCircuitAll )
+ return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) );
+ } else {
+ assert( dynamic_cast<detail::BoundValueRefBase*>( m_ref.get() ) );
+ auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() );
+ ++remainingTokens;
+ if( !remainingTokens )
+ return InternalParseResult::runtimeError( "Expected argument following " + token.token );
+ auto const &argToken = *remainingTokens;
+ if( argToken.type != TokenType::Argument )
+ return InternalParseResult::runtimeError( "Expected argument following " + token.token );
+ auto result = valueRef->setValue( argToken.token );
+ if( !result )
+ return InternalParseResult( result );
+ if( result.value() == ParseResultType::ShortCircuitAll )
+ return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) );
+ }
+ return InternalParseResult::ok( ParseState( ParseResultType::Matched, ++remainingTokens ) );
+ }
+ }
+ return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) );
+ }
+
+ auto validate() const -> Result override {
+ if( m_optNames.empty() )
+ return Result::logicError( "No options supplied to Opt" );
+ for( auto const &name : m_optNames ) {
+ if( name.empty() )
+ return Result::logicError( "Option name cannot be empty" );
+#ifdef CATCH_PLATFORM_WINDOWS
+ if( name[0] != '-' && name[0] != '/' )
+ return Result::logicError( "Option name must begin with '-' or '/'" );
+#else
+ if( name[0] != '-' )
+ return Result::logicError( "Option name must begin with '-'" );
+#endif
+ }
+ return ParserRefImpl::validate();
+ }
+ };
+
+ struct Help : Opt {
+ Help( bool &showHelpFlag )
+ : Opt([&]( bool flag ) {
+ showHelpFlag = flag;
+ return ParserResult::ok( ParseResultType::ShortCircuitAll );
+ })
+ {
+ static_cast<Opt &>( *this )
+ ("display usage information")
+ ["-?"]["-h"]["--help"]
+ .optional();
+ }
+ };
+
+
+ struct Parser : ParserBase {
+
+ mutable ExeName m_exeName;
+ std::vector<Opt> m_options;
+ std::vector<Arg> m_args;
+
+ auto operator|=( ExeName const &exeName ) -> Parser & {
+ m_exeName = exeName;
+ return *this;
+ }
+
+ auto operator|=( Arg const &arg ) -> Parser & {
+ m_args.push_back(arg);
+ return *this;
+ }
+
+ auto operator|=( Opt const &opt ) -> Parser & {
+ m_options.push_back(opt);
+ return *this;
+ }
+
+ auto operator|=( Parser const &other ) -> Parser & {
+ m_options.insert(m_options.end(), other.m_options.begin(), other.m_options.end());
+ m_args.insert(m_args.end(), other.m_args.begin(), other.m_args.end());
+ return *this;
+ }
+
+ template<typename T>
+ auto operator|( T const &other ) const -> Parser {
+ return Parser( *this ) |= other;
+ }
+
+ // Forward deprecated interface with '+' instead of '|'
+ template<typename T>
+ auto operator+=( T const &other ) -> Parser & { return operator|=( other ); }
+ template<typename T>
+ auto operator+( T const &other ) const -> Parser { return operator|( other ); }
+
+ auto getHelpColumns() const -> std::vector<HelpColumns> {
+ std::vector<HelpColumns> cols;
+ for (auto const &o : m_options) {
+ auto childCols = o.getHelpColumns();
+ cols.insert( cols.end(), childCols.begin(), childCols.end() );
+ }
+ return cols;
+ }
+
+ void writeToStream( std::ostream &os ) const {
+ if (!m_exeName.name().empty()) {
+ os << "usage:\n" << " " << m_exeName.name() << " ";
+ bool required = true, first = true;
+ for( auto const &arg : m_args ) {
+ if (first)
+ first = false;
+ else
+ os << " ";
+ if( arg.isOptional() && required ) {
+ os << "[";
+ required = false;
+ }
+ os << "<" << arg.hint() << ">";
+ if( arg.cardinality() == 0 )
+ os << " ... ";
+ }
+ if( !required )
+ os << "]";
+ if( !m_options.empty() )
+ os << " options";
+ os << "\n\nwhere options are:" << std::endl;
+ }
+
+ auto rows = getHelpColumns();
+ size_t consoleWidth = CATCH_CLARA_CONFIG_CONSOLE_WIDTH;
+ size_t optWidth = 0;
+ for( auto const &cols : rows )
+ optWidth = (std::max)(optWidth, cols.left.size() + 2);
+
+ optWidth = (std::min)(optWidth, consoleWidth/2);
+
+ for( auto const &cols : rows ) {
+ auto row =
+ TextFlow::Column( cols.left ).width( optWidth ).indent( 2 ) +
+ TextFlow::Spacer(4) +
+ TextFlow::Column( cols.right ).width( consoleWidth - 7 - optWidth );
+ os << row << std::endl;
+ }
+ }
+
+ friend auto operator<<( std::ostream &os, Parser const &parser ) -> std::ostream& {
+ parser.writeToStream( os );
+ return os;
+ }
+
+ auto validate() const -> Result override {
+ for( auto const &opt : m_options ) {
+ auto result = opt.validate();
+ if( !result )
+ return result;
+ }
+ for( auto const &arg : m_args ) {
+ auto result = arg.validate();
+ if( !result )
+ return result;
+ }
+ return Result::ok();
+ }
+
+ using ParserBase::parse;
+
+ auto parse( std::string const& exeName, TokenStream const &tokens ) const -> InternalParseResult override {
+
+ struct ParserInfo {
+ ParserBase const* parser = nullptr;
+ size_t count = 0;
+ };
+ const size_t totalParsers = m_options.size() + m_args.size();
+ assert( totalParsers < 512 );
+ // ParserInfo parseInfos[totalParsers]; // <-- this is what we really want to do
+ ParserInfo parseInfos[512];
+
+ {
+ size_t i = 0;
+ for (auto const &opt : m_options) parseInfos[i++].parser = &opt;
+ for (auto const &arg : m_args) parseInfos[i++].parser = &arg;
+ }
+
+ m_exeName.set( exeName );
+
+ auto result = InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) );
+ while( result.value().remainingTokens() ) {
+ bool tokenParsed = false;
+
+ for( size_t i = 0; i < totalParsers; ++i ) {
+ auto& parseInfo = parseInfos[i];
+ if( parseInfo.parser->cardinality() == 0 || parseInfo.count < parseInfo.parser->cardinality() ) {
+ result = parseInfo.parser->parse(exeName, result.value().remainingTokens());
+ if (!result)
+ return result;
+ if (result.value().type() != ParseResultType::NoMatch) {
+ tokenParsed = true;
+ ++parseInfo.count;
+ break;
+ }
+ }
+ }
+
+ if( result.value().type() == ParseResultType::ShortCircuitAll )
+ return result;
+ if( !tokenParsed )
+ return InternalParseResult::runtimeError( "Unrecognised token: " + result.value().remainingTokens()->token );
+ }
+ // !TBD Check missing required options
+ return result;
+ }
+ };
+
+ template<typename DerivedT>
+ template<typename T>
+ auto ComposableParserImpl<DerivedT>::operator|( T const &other ) const -> Parser {
+ return Parser() | static_cast<DerivedT const &>( *this ) | other;
+ }
+} // namespace detail
+
+
+// A Combined parser
+using detail::Parser;
+
+// A parser for options
+using detail::Opt;
+
+// A parser for arguments
+using detail::Arg;
+
+// Wrapper for argc, argv from main()
+using detail::Args;
+
+// Specifies the name of the executable
+using detail::ExeName;
+
+// Convenience wrapper for option parser that specifies the help option
+using detail::Help;
+
+// enum of result types from a parse
+using detail::ParseResultType;
+
+// Result type for parser operation
+using detail::ParserResult;
+
+
+}} // namespace Catch::clara
+
+
+#endif // CATCH_CLARA_HPP_INCLUDED
diff --git a/include/internal/catch_approx.cpp b/include/internal/catch_approx.cpp
new file mode 100644
index 0000000..20f7b16
--- /dev/null
+++ b/include/internal/catch_approx.cpp
@@ -0,0 +1,56 @@
+/*
+ * Created by Martin on 19/07/2017.
+ * Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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_approx.h"
+
+#include <cmath>
+#include <limits>
+
+namespace {
+
+// Performs equivalent check of std::fabs(lhs - rhs) <= margin
+// But without the subtraction to allow for INFINITY in comparison
+bool marginComparison(double lhs, double rhs, double margin) {
+ return (lhs + margin >= rhs) && (rhs + margin >= lhs);
+}
+
+}
+
+namespace Catch {
+namespace Detail {
+
+ Approx::Approx ( double value )
+ : m_epsilon( std::numeric_limits<float>::epsilon()*100 ),
+ m_margin( 0.0 ),
+ m_scale( 0.0 ),
+ m_value( value )
+ {}
+
+ Approx Approx::custom() {
+ return Approx( 0 );
+ }
+
+ std::string Approx::toString() const {
+ ReusableStringStream rss;
+ rss << "Approx( " << ::Catch::Detail::stringify( m_value ) << " )";
+ return rss.str();
+ }
+
+ bool Approx::equalityComparisonImpl(const double other) const {
+ // First try with fixed margin, then compute margin based on epsilon, scale and Approx's value
+ // Thanks to Richard Harris for his help refining the scaled margin value
+ return marginComparison(m_value, other, m_margin) || marginComparison(m_value, other, m_epsilon * (m_scale + std::fabs(m_value)));
+ }
+
+} // end namespace Detail
+
+std::string StringMaker<Catch::Detail::Approx>::convert(Catch::Detail::Approx const& value) {
+ return value.toString();
+}
+
+} // end namespace Catch
diff --git a/include/internal/catch_approx.h b/include/internal/catch_approx.h
new file mode 100644
index 0000000..2706887
--- /dev/null
+++ b/include/internal/catch_approx.h
@@ -0,0 +1,133 @@
+/*
+ * Created by Phil on 28/04/2011.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_APPROX_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_APPROX_HPP_INCLUDED
+
+#include "catch_tostring.h"
+
+#include <type_traits>
+#include <stdexcept>
+
+namespace Catch {
+namespace Detail {
+
+ class Approx {
+ private:
+ bool equalityComparisonImpl(double other) const;
+
+ public:
+ explicit Approx ( double value );
+
+ static Approx custom();
+
+ template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+ Approx operator()( T const& value ) {
+ Approx approx( static_cast<double>(value) );
+ approx.epsilon( m_epsilon );
+ approx.margin( m_margin );
+ approx.scale( m_scale );
+ return approx;
+ }
+
+ template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+ explicit Approx( T const& value ): Approx(static_cast<double>(value))
+ {}
+
+
+ template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+ friend bool operator == ( const T& lhs, Approx const& rhs ) {
+ auto lhs_v = static_cast<double>(lhs);
+ return rhs.equalityComparisonImpl(lhs_v);
+ }
+
+ template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+ friend bool operator == ( Approx const& lhs, const T& rhs ) {
+ return operator==( rhs, lhs );
+ }
+
+ template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+ friend bool operator != ( T const& lhs, Approx const& rhs ) {
+ return !operator==( lhs, rhs );
+ }
+
+ template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+ friend bool operator != ( Approx const& lhs, T const& rhs ) {
+ return !operator==( rhs, lhs );
+ }
+
+ template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+ friend bool operator <= ( T const& lhs, Approx const& rhs ) {
+ return static_cast<double>(lhs) < rhs.m_value || lhs == rhs;
+ }
+
+ template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+ friend bool operator <= ( Approx const& lhs, T const& rhs ) {
+ return lhs.m_value < static_cast<double>(rhs) || lhs == rhs;
+ }
+
+ template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+ friend bool operator >= ( T const& lhs, Approx const& rhs ) {
+ return static_cast<double>(lhs) > rhs.m_value || lhs == rhs;
+ }
+
+ template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+ friend bool operator >= ( Approx const& lhs, T const& rhs ) {
+ return lhs.m_value > static_cast<double>(rhs) || lhs == rhs;
+ }
+
+ template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+ Approx& epsilon( T const& newEpsilon ) {
+ double epsilonAsDouble = static_cast<double>(newEpsilon);
+ if( epsilonAsDouble < 0 || epsilonAsDouble > 1.0 ) {
+ throw std::domain_error
+ ( "Invalid Approx::epsilon: " +
+ Catch::Detail::stringify( epsilonAsDouble ) +
+ ", Approx::epsilon has to be between 0 and 1" );
+ }
+ m_epsilon = epsilonAsDouble;
+ return *this;
+ }
+
+ template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+ Approx& margin( T const& newMargin ) {
+ double marginAsDouble = static_cast<double>(newMargin);
+ if( marginAsDouble < 0 ) {
+ throw std::domain_error
+ ( "Invalid Approx::margin: " +
+ Catch::Detail::stringify( marginAsDouble ) +
+ ", Approx::Margin has to be non-negative." );
+
+ }
+ m_margin = marginAsDouble;
+ return *this;
+ }
+
+ template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+ Approx& scale( T const& newScale ) {
+ m_scale = static_cast<double>(newScale);
+ return *this;
+ }
+
+ std::string toString() const;
+
+ private:
+ double m_epsilon;
+ double m_margin;
+ double m_scale;
+ double m_value;
+ };
+}
+
+template<>
+struct StringMaker<Catch::Detail::Approx> {
+ static std::string convert(Catch::Detail::Approx const& value);
+};
+
+} // end namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_APPROX_HPP_INCLUDED
diff --git a/include/internal/catch_assertionhandler.cpp b/include/internal/catch_assertionhandler.cpp
new file mode 100644
index 0000000..c6818c1
--- /dev/null
+++ b/include/internal/catch_assertionhandler.cpp
@@ -0,0 +1,114 @@
+/*
+ * Created by Phil on 8/8/2017.
+ * Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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_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"
+
+namespace Catch {
+
+ auto operator <<( std::ostream& os, ITransientExpression const& expr ) -> std::ostream& {
+ expr.streamReconstructedExpression( os );
+ return os;
+ }
+
+ LazyExpression::LazyExpression( bool isNegated )
+ : m_isNegated( isNegated )
+ {}
+
+ LazyExpression::LazyExpression( LazyExpression const& other ) : m_isNegated( other.m_isNegated ) {}
+
+ LazyExpression::operator bool() const {
+ return m_transientExpression != nullptr;
+ }
+
+ auto operator << ( std::ostream& os, LazyExpression const& lazyExpr ) -> std::ostream& {
+ if( lazyExpr.m_isNegated )
+ os << "!";
+
+ if( lazyExpr ) {
+ if( lazyExpr.m_isNegated && lazyExpr.m_transientExpression->isBinaryExpression() )
+ os << "(" << *lazyExpr.m_transientExpression << ")";
+ else
+ os << *lazyExpr.m_transientExpression;
+ }
+ else {
+ os << "{** error - unchecked empty expression requested **}";
+ }
+ return os;
+ }
+
+ AssertionHandler::AssertionHandler
+ ( StringRef macroName,
+ SourceLineInfo const& lineInfo,
+ StringRef capturedExpression,
+ ResultDisposition::Flags resultDisposition )
+ : m_assertionInfo{ macroName, lineInfo, capturedExpression, resultDisposition },
+ m_resultCapture( getResultCapture() )
+ {}
+
+ void AssertionHandler::handleExpr( ITransientExpression const& expr ) {
+ m_resultCapture.handleExpr( m_assertionInfo, expr, m_reaction );
+ }
+ void AssertionHandler::handleMessage(ResultWas::OfType resultType, StringRef const& message) {
+ m_resultCapture.handleMessage( m_assertionInfo, resultType, message, m_reaction );
+ }
+
+ auto AssertionHandler::allowThrows() const -> bool {
+ return getCurrentContext().getConfig()->allowThrows();
+ }
+
+ void AssertionHandler::complete() {
+ setCompleted();
+ if( m_reaction.shouldDebugBreak ) {
+
+ // If you find your debugger stopping you here then go one level up on the
+ // call-stack for the code that caused it (typically a failed assertion)
+
+ // (To go back to the test and change execution, jump over the throw, next)
+ CATCH_BREAK_INTO_DEBUGGER();
+ }
+ if( m_reaction.shouldThrow )
+ throw Catch::TestFailureException();
+ }
+ void AssertionHandler::setCompleted() {
+ m_completed = true;
+ }
+
+ void AssertionHandler::handleUnexpectedInflightException() {
+ m_resultCapture.handleUnexpectedInflightException( m_assertionInfo, Catch::translateActiveException(), m_reaction );
+ }
+
+ void AssertionHandler::handleExceptionThrownAsExpected() {
+ m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction);
+ }
+ void AssertionHandler::handleExceptionNotThrownAsExpected() {
+ m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction);
+ }
+
+ void AssertionHandler::handleUnexpectedExceptionNotThrown() {
+ m_resultCapture.handleUnexpectedExceptionNotThrown( m_assertionInfo, m_reaction );
+ }
+
+ void AssertionHandler::handleThrowingCallSkipped() {
+ m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction);
+ }
+
+ // This is the overload that takes a string and infers the Equals matcher from it
+ // The more general overload, that takes any string matcher, is in catch_capture_matchers.cpp
+ void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef matcherString ) {
+ handleExceptionMatchExpr( handler, Matchers::Equals( str ), matcherString );
+ }
+
+} // namespace Catch
diff --git a/include/internal/catch_assertionhandler.h b/include/internal/catch_assertionhandler.h
new file mode 100644
index 0000000..cadc78f
--- /dev/null
+++ b/include/internal/catch_assertionhandler.h
@@ -0,0 +1,88 @@
+/*
+ * Created by Phil on 8/8/2017.
+ * Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#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"
+
+namespace Catch {
+
+ struct TestFailureException{};
+ struct AssertionResultData;
+ struct IResultCapture;
+ class RunContext;
+
+ class LazyExpression {
+ friend class AssertionHandler;
+ friend struct AssertionStats;
+ friend class RunContext;
+
+ ITransientExpression const* m_transientExpression = nullptr;
+ bool m_isNegated;
+ public:
+ LazyExpression( bool isNegated );
+ LazyExpression( LazyExpression const& other );
+ LazyExpression& operator = ( LazyExpression const& ) = delete;
+
+ explicit operator bool() const;
+
+ friend auto operator << ( std::ostream& os, LazyExpression const& lazyExpr ) -> std::ostream&;
+ };
+
+ struct AssertionReaction {
+ bool shouldDebugBreak = false;
+ bool shouldThrow = false;
+ };
+
+ class AssertionHandler {
+ AssertionInfo m_assertionInfo;
+ AssertionReaction m_reaction;
+ bool m_completed = false;
+ IResultCapture& m_resultCapture;
+
+ public:
+ AssertionHandler
+ ( StringRef macroName,
+ SourceLineInfo const& lineInfo,
+ StringRef capturedExpression,
+ ResultDisposition::Flags resultDisposition );
+ ~AssertionHandler() {
+ if ( !m_completed ) {
+ m_resultCapture.handleIncomplete( m_assertionInfo );
+ }
+ }
+
+
+ template<typename T>
+ void handleExpr( ExprLhs<T> const& expr ) {
+ handleExpr( expr.makeUnaryExpr() );
+ }
+ void handleExpr( ITransientExpression const& expr );
+
+ void handleMessage(ResultWas::OfType resultType, StringRef const& message);
+
+ void handleExceptionThrownAsExpected();
+ void handleUnexpectedExceptionNotThrown();
+ void handleExceptionNotThrownAsExpected();
+ void handleThrowingCallSkipped();
+ void handleUnexpectedInflightException();
+
+ void complete();
+ void setCompleted();
+
+ // query
+ auto allowThrows() const -> bool;
+ };
+
+ void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef matcherString );
+
+} // namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_ASSERTIONHANDLER_H_INCLUDED
diff --git a/include/internal/catch_assertioninfo.h b/include/internal/catch_assertioninfo.h
new file mode 100644
index 0000000..5f136bf
--- /dev/null
+++ b/include/internal/catch_assertioninfo.h
@@ -0,0 +1,31 @@
+/*
+ * Created by Phil on 8/8/2017.
+ * Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#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"
+
+namespace Catch {
+
+ struct AssertionInfo
+ {
+ StringRef macroName;
+ SourceLineInfo lineInfo;
+ StringRef capturedExpression;
+ ResultDisposition::Flags resultDisposition;
+
+ // We want to delete this constructor but a compiler bug in 4.8 means
+ // the struct is then treated as non-aggregate
+ //AssertionInfo() = delete;
+ };
+
+} // end namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_ASSERTIONINFO_H_INCLUDED
diff --git a/include/internal/catch_assertionresult.cpp b/include/internal/catch_assertionresult.cpp
new file mode 100644
index 0000000..ec32c66
--- /dev/null
+++ b/include/internal/catch_assertionresult.cpp
@@ -0,0 +1,98 @@
+/*
+ * Created by Phil on 8/8/12
+ * Copyright 2012 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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_assertionresult.h"
+
+namespace Catch {
+ AssertionResultData::AssertionResultData(ResultWas::OfType _resultType, LazyExpression const & _lazyExpression):
+ lazyExpression(_lazyExpression),
+ resultType(_resultType) {}
+
+ std::string AssertionResultData::reconstructExpression() const {
+
+ if( reconstructedExpression.empty() ) {
+ if( lazyExpression ) {
+ ReusableStringStream rss;
+ rss << lazyExpression;
+ reconstructedExpression = rss.str();
+ }
+ }
+ return reconstructedExpression;
+ }
+
+ AssertionResult::AssertionResult( AssertionInfo const& info, AssertionResultData const& data )
+ : m_info( info ),
+ m_resultData( data )
+ {}
+
+ // Result was a success
+ bool AssertionResult::succeeded() const {
+ return Catch::isOk( m_resultData.resultType );
+ }
+
+ // Result was a success, or failure is suppressed
+ bool AssertionResult::isOk() const {
+ return Catch::isOk( m_resultData.resultType ) || shouldSuppressFailure( m_info.resultDisposition );
+ }
+
+ ResultWas::OfType AssertionResult::getResultType() const {
+ return m_resultData.resultType;
+ }
+
+ bool AssertionResult::hasExpression() const {
+ return m_info.capturedExpression[0] != 0;
+ }
+
+ bool AssertionResult::hasMessage() const {
+ return !m_resultData.message.empty();
+ }
+
+ std::string AssertionResult::getExpression() const {
+ if( isFalseTest( m_info.resultDisposition ) )
+ return "!(" + m_info.capturedExpression + ")";
+ else
+ return m_info.capturedExpression;
+ }
+
+ std::string AssertionResult::getExpressionInMacro() const {
+ std::string expr;
+ if( m_info.macroName[0] == 0 )
+ expr = m_info.capturedExpression;
+ else {
+ expr.reserve( m_info.macroName.size() + m_info.capturedExpression.size() + 4 );
+ expr += m_info.macroName.c_str();
+ expr += "( ";
+ expr += m_info.capturedExpression.c_str();
+ expr += " )";
+ }
+ return expr;
+ }
+
+ bool AssertionResult::hasExpandedExpression() const {
+ return hasExpression() && getExpandedExpression() != getExpression();
+ }
+
+ std::string AssertionResult::getExpandedExpression() const {
+ std::string expr = m_resultData.reconstructExpression();
+ return expr.empty()
+ ? getExpression()
+ : expr;
+ }
+
+ std::string AssertionResult::getMessage() const {
+ return m_resultData.message;
+ }
+ SourceLineInfo AssertionResult::getSourceInfo() const {
+ return m_info.lineInfo;
+ }
+
+ StringRef AssertionResult::getTestMacroName() const {
+ return m_info.macroName;
+ }
+
+} // end namespace Catch
diff --git a/include/internal/catch_assertionresult.h b/include/internal/catch_assertionresult.h
new file mode 100644
index 0000000..3c91ea5
--- /dev/null
+++ b/include/internal/catch_assertionresult.h
@@ -0,0 +1,59 @@
+/*
+ * Created by Phil on 28/10/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_ASSERTIONRESULT_H_INCLUDED
+#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"
+
+namespace Catch {
+
+ struct AssertionResultData
+ {
+ AssertionResultData() = delete;
+
+ AssertionResultData( ResultWas::OfType _resultType, LazyExpression const& _lazyExpression );
+
+ std::string message;
+ mutable std::string reconstructedExpression;
+ LazyExpression lazyExpression;
+ ResultWas::OfType resultType;
+
+ std::string reconstructExpression() const;
+ };
+
+ class AssertionResult {
+ public:
+ AssertionResult() = delete;
+ AssertionResult( AssertionInfo const& info, AssertionResultData const& data );
+
+ bool isOk() const;
+ bool succeeded() const;
+ ResultWas::OfType getResultType() const;
+ bool hasExpression() const;
+ bool hasMessage() const;
+ std::string getExpression() const;
+ std::string getExpressionInMacro() const;
+ bool hasExpandedExpression() const;
+ std::string getExpandedExpression() const;
+ std::string getMessage() const;
+ SourceLineInfo getSourceInfo() const;
+ StringRef getTestMacroName() const;
+
+ //protected:
+ AssertionInfo m_info;
+ AssertionResultData m_resultData;
+ };
+
+} // end namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_ASSERTIONRESULT_H_INCLUDED
diff --git a/include/internal/catch_benchmark.cpp b/include/internal/catch_benchmark.cpp
new file mode 100644
index 0000000..742418f
--- /dev/null
+++ b/include/internal/catch_benchmark.cpp
@@ -0,0 +1,36 @@
+/*
+ * Created by Phil on 04/07/2017.
+ * Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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_benchmark.h"
+#include "catch_capture.hpp"
+#include "catch_interfaces_reporter.h"
+#include "catch_context.h"
+
+namespace Catch {
+
+ auto BenchmarkLooper::getResolution() -> uint64_t {
+ return getEstimatedClockResolution() * getCurrentContext().getConfig()->benchmarkResolutionMultiple();
+ }
+
+ void BenchmarkLooper::reportStart() {
+ getResultCapture().benchmarkStarting( { m_name } );
+ }
+ auto BenchmarkLooper::needsMoreIterations() -> bool {
+ auto elapsed = m_timer.getElapsedNanoseconds();
+
+ // Exponentially increasing iterations until we're confident in our timer resolution
+ if( elapsed < m_resolution ) {
+ m_iterationsToRun *= 10;
+ return true;
+ }
+
+ getResultCapture().benchmarkEnded( { { m_name }, m_count, elapsed } );
+ return false;
+ }
+
+} // end namespace Catch
diff --git a/include/internal/catch_benchmark.h b/include/internal/catch_benchmark.h
new file mode 100644
index 0000000..e546713
--- /dev/null
+++ b/include/internal/catch_benchmark.h
@@ -0,0 +1,57 @@
+/*
+ * Created by Phil on 04/07/2017.
+ * Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_BENCHMARK_H_INCLUDED
+#define TWOBLUECUBES_CATCH_BENCHMARK_H_INCLUDED
+
+#include "catch_stringref.h"
+#include "catch_timer.h"
+
+#include <cstdint>
+#include <string>
+
+namespace Catch {
+
+ class BenchmarkLooper {
+
+ std::string m_name;
+ std::size_t m_count = 0;
+ std::size_t m_iterationsToRun = 1;
+ uint64_t m_resolution;
+ Timer m_timer;
+
+ static auto getResolution() -> uint64_t;
+ public:
+ // Keep most of this inline as it's on the code path that is being timed
+ BenchmarkLooper( StringRef name )
+ : m_name( name ),
+ m_resolution( getResolution() )
+ {
+ reportStart();
+ m_timer.start();
+ }
+
+ explicit operator bool() {
+ if( m_count < m_iterationsToRun )
+ return true;
+ return needsMoreIterations();
+ }
+
+ void increment() {
+ ++m_count;
+ }
+
+ void reportStart();
+ auto needsMoreIterations() -> bool;
+ };
+
+} // end namespace Catch
+
+#define BENCHMARK( name ) \
+ for( Catch::BenchmarkLooper looper( name ); looper; looper.increment() )
+
+#endif // TWOBLUECUBES_CATCH_BENCHMARK_H_INCLUDED
diff --git a/include/internal/catch_capture.hpp b/include/internal/catch_capture.hpp
new file mode 100644
index 0000000..e4600f7
--- /dev/null
+++ b/include/internal/catch_capture.hpp
@@ -0,0 +1,147 @@
+/*
+ * Created by Phil on 18/10/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_CAPTURE_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_CAPTURE_HPP_INCLUDED
+
+#include "catch_assertionhandler.h"
+#include "catch_message.h"
+#include "catch_interfaces_capture.h"
+
+#if !defined(CATCH_CONFIG_DISABLE)
+
+#if !defined(CATCH_CONFIG_DISABLE_STRINGIFICATION)
+ #define CATCH_INTERNAL_STRINGIFY(...) #__VA_ARGS__
+#else
+ #define CATCH_INTERNAL_STRINGIFY(...) "Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION"
+#endif
+
+#if defined(CATCH_CONFIG_FAST_COMPILE)
+
+///////////////////////////////////////////////////////////////////////////////
+// Another way to speed-up compilation is to omit local try-catch for REQUIRE*
+// macros.
+#define INTERNAL_CATCH_TRY
+#define INTERNAL_CATCH_CATCH( capturer )
+
+#else // CATCH_CONFIG_FAST_COMPILE
+
+#define INTERNAL_CATCH_TRY try
+#define INTERNAL_CATCH_CATCH( handler ) catch(...) { handler.handleUnexpectedInflightException(); }
+
+#endif
+
+#define INTERNAL_CATCH_REACT( handler ) handler.complete();
+
+///////////////////////////////////////////////////////////////////////////////
+#define INTERNAL_CATCH_TEST( macroName, resultDisposition, ... ) \
+ do { \
+ Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \
+ INTERNAL_CATCH_TRY { \
+ CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \
+ catchAssertionHandler.handleExpr( Catch::Decomposer() <= __VA_ARGS__ ); \
+ CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \
+ } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \
+ INTERNAL_CATCH_REACT( catchAssertionHandler ) \
+ } while( (void)0, false && static_cast<bool>( !!(__VA_ARGS__) ) ) // the expression here is never evaluated at runtime but it forces the compiler to give it a look
+ // The double negation silences MSVC's C4800 warning, the static_cast forces short-circuit evaluation if the type has overloaded &&.
+
+///////////////////////////////////////////////////////////////////////////////
+#define INTERNAL_CATCH_IF( macroName, resultDisposition, ... ) \
+ INTERNAL_CATCH_TEST( macroName, resultDisposition, __VA_ARGS__ ); \
+ if( Catch::getResultCapture().lastAssertionPassed() )
+
+///////////////////////////////////////////////////////////////////////////////
+#define INTERNAL_CATCH_ELSE( macroName, resultDisposition, ... ) \
+ INTERNAL_CATCH_TEST( macroName, resultDisposition, __VA_ARGS__ ); \
+ if( !Catch::getResultCapture().lastAssertionPassed() )
+
+///////////////////////////////////////////////////////////////////////////////
+#define INTERNAL_CATCH_NO_THROW( macroName, resultDisposition, ... ) \
+ do { \
+ Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \
+ try { \
+ static_cast<void>(__VA_ARGS__); \
+ catchAssertionHandler.handleExceptionNotThrownAsExpected(); \
+ } \
+ catch( ... ) { \
+ catchAssertionHandler.handleUnexpectedInflightException(); \
+ } \
+ INTERNAL_CATCH_REACT( catchAssertionHandler ) \
+ } while( false )
+
+///////////////////////////////////////////////////////////////////////////////
+#define INTERNAL_CATCH_THROWS( macroName, resultDisposition, ... ) \
+ do { \
+ Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition); \
+ if( catchAssertionHandler.allowThrows() ) \
+ try { \
+ static_cast<void>(__VA_ARGS__); \
+ catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \
+ } \
+ catch( ... ) { \
+ catchAssertionHandler.handleExceptionThrownAsExpected(); \
+ } \
+ else \
+ catchAssertionHandler.handleThrowingCallSkipped(); \
+ INTERNAL_CATCH_REACT( catchAssertionHandler ) \
+ } while( false )
+
+///////////////////////////////////////////////////////////////////////////////
+#define INTERNAL_CATCH_THROWS_AS( macroName, exceptionType, resultDisposition, expr ) \
+ do { \
+ Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(expr) ", " CATCH_INTERNAL_STRINGIFY(exceptionType), resultDisposition ); \
+ if( catchAssertionHandler.allowThrows() ) \
+ try { \
+ static_cast<void>(expr); \
+ catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \
+ } \
+ catch( exceptionType const& ) { \
+ catchAssertionHandler.handleExceptionThrownAsExpected(); \
+ } \
+ catch( ... ) { \
+ catchAssertionHandler.handleUnexpectedInflightException(); \
+ } \
+ else \
+ catchAssertionHandler.handleThrowingCallSkipped(); \
+ INTERNAL_CATCH_REACT( catchAssertionHandler ) \
+ } while( false )
+
+
+///////////////////////////////////////////////////////////////////////////////
+#define INTERNAL_CATCH_MSG( macroName, messageType, resultDisposition, ... ) \
+ do { \
+ Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, "", resultDisposition ); \
+ catchAssertionHandler.handleMessage( messageType, ( Catch::MessageStream() << __VA_ARGS__ + ::Catch::StreamEndStop() ).m_stream.str() ); \
+ INTERNAL_CATCH_REACT( catchAssertionHandler ) \
+ } while( false )
+
+///////////////////////////////////////////////////////////////////////////////
+#define INTERNAL_CATCH_INFO( macroName, log ) \
+ Catch::ScopedMessage INTERNAL_CATCH_UNIQUE_NAME( scopedMessage )( Catch::MessageBuilder( macroName, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log );
+
+///////////////////////////////////////////////////////////////////////////////
+// Although this is matcher-based, it can be used with just a string
+#define INTERNAL_CATCH_THROWS_STR_MATCHES( macroName, resultDisposition, matcher, ... ) \
+ do { \
+ Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \
+ if( catchAssertionHandler.allowThrows() ) \
+ try { \
+ static_cast<void>(__VA_ARGS__); \
+ catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \
+ } \
+ catch( ... ) { \
+ Catch::handleExceptionMatchExpr( catchAssertionHandler, matcher, #matcher ); \
+ } \
+ else \
+ catchAssertionHandler.handleThrowingCallSkipped(); \
+ INTERNAL_CATCH_REACT( catchAssertionHandler ) \
+ } while( false )
+
+#endif // CATCH_CONFIG_DISABLE
+
+#endif // TWOBLUECUBES_CATCH_CAPTURE_HPP_INCLUDED
diff --git a/include/internal/catch_capture_matchers.cpp b/include/internal/catch_capture_matchers.cpp
new file mode 100644
index 0000000..7ef1597
--- /dev/null
+++ b/include/internal/catch_capture_matchers.cpp
@@ -0,0 +1,24 @@
+/*
+ * Created by Phil on 9/8/2017.
+ * Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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"
+
+namespace Catch {
+
+ using StringMatcher = Matchers::Impl::MatcherBase<std::string>;
+
+ // This is the general overload that takes a any string matcher
+ // There is another overload, in catch_assertinhandler.h/.cpp, that only takes a string and infers
+ // the Equals matcher (so the header does not mention matchers)
+ void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef matcherString ) {
+ std::string exceptionMessage = Catch::translateActiveException();
+ MatchExpr<std::string, StringMatcher const&> expr( exceptionMessage, matcher, matcherString );
+ handler.handleExpr( expr );
+ }
+
+} // namespace Catch
diff --git a/include/internal/catch_capture_matchers.h b/include/internal/catch_capture_matchers.h
new file mode 100644
index 0000000..358bbc3
--- /dev/null
+++ b/include/internal/catch_capture_matchers.h
@@ -0,0 +1,85 @@
+/*
+ * Created by Phil on 9/8/2017
+ * Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#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_floating.h"
+#include "catch_matchers_string.h"
+#include "catch_matchers_vector.h"
+
+namespace Catch {
+
+ template<typename ArgT, typename MatcherT>
+ class MatchExpr : public ITransientExpression {
+ ArgT const& m_arg;
+ MatcherT m_matcher;
+ StringRef m_matcherString;
+ public:
+ MatchExpr( ArgT const& arg, MatcherT const& matcher, StringRef matcherString )
+ : ITransientExpression{ true, matcher.match( arg ) },
+ m_arg( arg ),
+ m_matcher( matcher ),
+ m_matcherString( matcherString )
+ {}
+
+ void streamReconstructedExpression( std::ostream &os ) const override {
+ auto matcherAsString = m_matcher.toString();
+ os << Catch::Detail::stringify( m_arg ) << ' ';
+ if( matcherAsString == Detail::unprintableString )
+ os << m_matcherString;
+ else
+ os << matcherAsString;
+ }
+ };
+
+ using StringMatcher = Matchers::Impl::MatcherBase<std::string>;
+
+ void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef matcherString );
+
+ template<typename ArgT, typename MatcherT>
+ auto makeMatchExpr( ArgT const& arg, MatcherT const& matcher, StringRef matcherString ) -> MatchExpr<ArgT, MatcherT> {
+ return MatchExpr<ArgT, MatcherT>( arg, matcher, matcherString );
+ }
+
+} // namespace Catch
+
+
+///////////////////////////////////////////////////////////////////////////////
+#define INTERNAL_CHECK_THAT( macroName, matcher, resultDisposition, arg ) \
+ do { \
+ Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(arg) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \
+ INTERNAL_CATCH_TRY { \
+ catchAssertionHandler.handleExpr( Catch::makeMatchExpr( arg, matcher, #matcher ) ); \
+ } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \
+ INTERNAL_CATCH_REACT( catchAssertionHandler ) \
+ } while( false )
+
+
+///////////////////////////////////////////////////////////////////////////////
+#define INTERNAL_CATCH_THROWS_MATCHES( macroName, exceptionType, resultDisposition, matcher, ... ) \
+ do { \
+ Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) ", " CATCH_INTERNAL_STRINGIFY(exceptionType) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \
+ if( catchAssertionHandler.allowThrows() ) \
+ try { \
+ static_cast<void>(__VA_ARGS__ ); \
+ catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \
+ } \
+ catch( exceptionType const& ex ) { \
+ catchAssertionHandler.handleExpr( Catch::makeMatchExpr( ex, matcher, #matcher ) ); \
+ } \
+ catch( ... ) { \
+ catchAssertionHandler.handleUnexpectedInflightException(); \
+ } \
+ else \
+ catchAssertionHandler.handleThrowingCallSkipped(); \
+ INTERNAL_CATCH_REACT( catchAssertionHandler ) \
+ } while( false )
+
+#endif // TWOBLUECUBES_CATCH_CAPTURE_MATCHERS_HPP_INCLUDED
diff --git a/include/internal/catch_clara.h b/include/internal/catch_clara.h
new file mode 100644
index 0000000..bdf7025
--- /dev/null
+++ b/include/internal/catch_clara.h
@@ -0,0 +1,38 @@
+/*
+ * Created by Phil on 10/2/2014.
+ * Copyright 2014 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ *
+ */
+#ifndef TWOBLUECUBES_CATCH_CLARA_H_INCLUDED
+#define TWOBLUECUBES_CATCH_CLARA_H_INCLUDED
+
+// Use Catch's value for console width (store Clara's off to the side, if present)
+#ifdef CLARA_CONFIG_CONSOLE_WIDTH
+#define CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH
+#undef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH
+#endif
+#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_CONFIG_CONSOLE_WIDTH-1
+
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wweak-vtables"
+#pragma clang diagnostic ignored "-Wexit-time-destructors"
+#pragma clang diagnostic ignored "-Wshadow"
+#endif
+
+#include "../external/clara.hpp"
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
+// Restore Clara's value for console width, if present
+#ifdef CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH
+#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH
+#undef CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH
+#endif
+
+#endif // TWOBLUECUBES_CATCH_CLARA_H_INCLUDED
diff --git a/include/internal/catch_commandline.cpp b/include/internal/catch_commandline.cpp
new file mode 100644
index 0000000..c0231d1
--- /dev/null
+++ b/include/internal/catch_commandline.cpp
@@ -0,0 +1,184 @@
+/*
+ * Created by Phil on 02/11/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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_commandline.h"
+
+#include "catch_string_manip.h"
+
+#include <fstream>
+#include <ctime>
+
+namespace Catch {
+
+ clara::Parser makeCommandLineParser( ConfigData& config ) {
+
+ using namespace clara;
+
+ auto const setWarning = [&]( std::string const& warning ) {
+ if( warning != "NoAssertions" )
+ return ParserResult::runtimeError( "Unrecognised warning: '" + warning + "'" );
+ config.warnings = static_cast<WarnAbout::What>( config.warnings | WarnAbout::NoAssertions );
+ return ParserResult::ok( ParseResultType::Matched );
+ };
+ auto const loadTestNamesFromFile = [&]( std::string const& filename ) {
+ std::ifstream f( filename.c_str() );
+ if( !f.is_open() )
+ return ParserResult::runtimeError( "Unable to load input file: '" + filename + "'" );
+
+ std::string line;
+ while( std::getline( f, line ) ) {
+ line = trim(line);
+ if( !line.empty() && !startsWith( line, '#' ) ) {
+ if( !startsWith( line, '"' ) )
+ line = '"' + line + '"';
+ config.testsOrTags.push_back( line + ',' );
+ }
+ }
+ return ParserResult::ok( ParseResultType::Matched );
+ };
+ auto const setTestOrder = [&]( std::string const& order ) {
+ if( startsWith( "declared", order ) )
+ config.runOrder = RunTests::InDeclarationOrder;
+ else if( startsWith( "lexical", order ) )
+ config.runOrder = RunTests::InLexicographicalOrder;
+ else if( startsWith( "random", order ) )
+ config.runOrder = RunTests::InRandomOrder;
+ else
+ return clara::ParserResult::runtimeError( "Unrecognised ordering: '" + order + "'" );
+ return ParserResult::ok( ParseResultType::Matched );
+ };
+ auto const setRngSeed = [&]( std::string const& seed ) {
+ if( seed != "time" )
+ return clara::detail::convertInto( seed, config.rngSeed );
+ config.rngSeed = static_cast<unsigned int>( std::time(nullptr) );
+ return ParserResult::ok( ParseResultType::Matched );
+ };
+ auto const setColourUsage = [&]( std::string const& useColour ) {
+ auto mode = toLower( useColour );
+
+ if( mode == "yes" )
+ config.useColour = UseColour::Yes;
+ else if( mode == "no" )
+ config.useColour = UseColour::No;
+ else if( mode == "auto" )
+ config.useColour = UseColour::Auto;
+ else
+ return ParserResult::runtimeError( "colour mode must be one of: auto, yes or no. '" + useColour + "' not recognised" );
+ return ParserResult::ok( ParseResultType::Matched );
+ };
+ auto const setWaitForKeypress = [&]( std::string const& keypress ) {
+ auto keypressLc = toLower( keypress );
+ if( keypressLc == "start" )
+ config.waitForKeypress = WaitForKeypress::BeforeStart;
+ else if( keypressLc == "exit" )
+ config.waitForKeypress = WaitForKeypress::BeforeExit;
+ else if( keypressLc == "both" )
+ config.waitForKeypress = WaitForKeypress::BeforeStartAndExit;
+ else
+ return ParserResult::runtimeError( "keypress argument must be one of: start, exit or both. '" + keypress + "' not recognised" );
+ return ParserResult::ok( ParseResultType::Matched );
+ };
+ auto const setVerbosity = [&]( std::string const& verbosity ) {
+ auto lcVerbosity = toLower( verbosity );
+ if( lcVerbosity == "quiet" )
+ config.verbosity = Verbosity::Quiet;
+ else if( lcVerbosity == "normal" )
+ config.verbosity = Verbosity::Normal;
+ else if( lcVerbosity == "high" )
+ config.verbosity = Verbosity::High;
+ else
+ return ParserResult::runtimeError( "Unrecognised verbosity, '" + verbosity + "'" );
+ return ParserResult::ok( ParseResultType::Matched );
+ };
+
+ auto cli
+ = ExeName( config.processName )
+ | Help( config.showHelp )
+ | Opt( config.listTests )
+ ["-l"]["--list-tests"]
+ ( "list all/matching test cases" )
+ | Opt( config.listTags )
+ ["-t"]["--list-tags"]
+ ( "list all/matching tags" )
+ | Opt( config.showSuccessfulTests )
+ ["-s"]["--success"]
+ ( "include successful tests in output" )
+ | Opt( config.shouldDebugBreak )
+ ["-b"]["--break"]
+ ( "break into debugger on failure" )
+ | Opt( config.noThrow )
+ ["-e"]["--nothrow"]
+ ( "skip exception tests" )
+ | Opt( config.showInvisibles )
+ ["-i"]["--invisibles"]
+ ( "show invisibles (tabs, newlines)" )
+ | Opt( config.outputFilename, "filename" )
+ ["-o"]["--out"]
+ ( "output filename" )
+ | Opt( config.reporterNames, "name" )
+ ["-r"]["--reporter"]
+ ( "reporter to use (defaults to console)" )
+ | Opt( config.name, "name" )
+ ["-n"]["--name"]
+ ( "suite name" )
+ | Opt( [&]( bool ){ config.abortAfter = 1; } )
+ ["-a"]["--abort"]
+ ( "abort at first failure" )
+ | Opt( [&]( int x ){ config.abortAfter = x; }, "no. failures" )
+ ["-x"]["--abortx"]
+ ( "abort after x failures" )
+ | Opt( setWarning, "warning name" )
+ ["-w"]["--warn"]
+ ( "enable warnings" )
+ | Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, "yes|no" )
+ ["-d"]["--durations"]
+ ( "show test durations" )
+ | Opt( loadTestNamesFromFile, "filename" )
+ ["-f"]["--input-file"]
+ ( "load test names to run from a file" )
+ | Opt( config.filenamesAsTags )
+ ["-#"]["--filenames-as-tags"]
+ ( "adds a tag for the filename" )
+ | Opt( config.sectionsToRun, "section name" )
+ ["-c"]["--section"]
+ ( "specify section to run" )
+ | Opt( setVerbosity, "quiet|normal|high" )
+ ["-v"]["--verbosity"]
+ ( "set output verbosity" )
+ | Opt( config.listTestNamesOnly )
+ ["--list-test-names-only"]
+ ( "list all/matching test cases names only" )
+ | Opt( config.listReporters )
+ ["--list-reporters"]
+ ( "list all reporters" )
+ | Opt( setTestOrder, "decl|lex|rand" )
+ ["--order"]
+ ( "test case order (defaults to decl)" )
+ | Opt( setRngSeed, "'time'|number" )
+ ["--rng-seed"]
+ ( "set a specific seed for random numbers" )
+ | Opt( setColourUsage, "yes|no" )
+ ["--use-colour"]
+ ( "should output be colourised" )
+ | Opt( config.libIdentify )
+ ["--libidentify"]
+ ( "report name and version according to libidentify standard" )
+ | Opt( setWaitForKeypress, "start|exit|both" )
+ ["--wait-for-keypress"]
+ ( "waits for a keypress before exiting" )
+ | Opt( config.benchmarkResolutionMultiple, "multiplier" )
+ ["--benchmark-resolution-multiple"]
+ ( "multiple of clock resolution to run benchmarks" )
+
+ | Arg( config.testsOrTags, "test name|pattern|tags" )
+ ( "which test or tests to use" );
+
+ return cli;
+ }
+
+} // end namespace Catch
diff --git a/include/internal/catch_commandline.h b/include/internal/catch_commandline.h
new file mode 100644
index 0000000..b73cfa2
--- /dev/null
+++ b/include/internal/catch_commandline.h
@@ -0,0 +1,20 @@
+/*
+ * Created by Phil on 02/11/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_COMMANDLINE_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_COMMANDLINE_HPP_INCLUDED
+
+#include "catch_config.hpp"
+#include "catch_clara.h"
+
+namespace Catch {
+
+ clara::Parser makeCommandLineParser( ConfigData& config );
+
+} // end namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_COMMANDLINE_HPP_INCLUDED
diff --git a/include/internal/catch_common.cpp b/include/internal/catch_common.cpp
new file mode 100644
index 0000000..c271146
--- /dev/null
+++ b/include/internal/catch_common.cpp
@@ -0,0 +1,44 @@
+/*
+ * Created by Phil on 27/11/2013.
+ * Copyright 2013 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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_common.h"
+#include "catch_context.h"
+#include "catch_interfaces_config.h"
+
+#include <cstring>
+#include <ostream>
+
+namespace Catch {
+
+ bool SourceLineInfo::empty() const noexcept {
+ return file[0] == '\0';
+ }
+ bool SourceLineInfo::operator == ( SourceLineInfo const& other ) const noexcept {
+ return line == other.line && (file == other.file || std::strcmp(file, other.file) == 0);
+ }
+ bool SourceLineInfo::operator < ( SourceLineInfo const& other ) const noexcept {
+ return line < other.line || ( line == other.line && (std::strcmp(file, other.file) < 0));
+ }
+
+ std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) {
+#ifndef __GNUG__
+ os << info.file << '(' << info.line << ')';
+#else
+ os << info.file << ':' << info.line;
+#endif
+ return os;
+ }
+
+ std::string StreamEndStop::operator+() const {
+ return std::string();
+ }
+
+ NonCopyable::NonCopyable() = default;
+ NonCopyable::~NonCopyable() = default;
+
+}
diff --git a/include/internal/catch_common.h b/include/internal/catch_common.h
new file mode 100644
index 0000000..4aaf80c
--- /dev/null
+++ b/include/internal/catch_common.h
@@ -0,0 +1,83 @@
+/*
+ * Created by Phil on 29/10/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_COMMON_H_INCLUDED
+#define TWOBLUECUBES_CATCH_COMMON_H_INCLUDED
+
+#include "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 )
+#ifdef CATCH_CONFIG_COUNTER
+# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ )
+#else
+# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ )
+#endif
+
+#include <iosfwd>
+#include <string>
+#include <cstdint>
+
+namespace Catch {
+
+ struct CaseSensitive { enum Choice {
+ Yes,
+ No
+ }; };
+
+ class NonCopyable {
+ NonCopyable( NonCopyable const& ) = delete;
+ NonCopyable( NonCopyable && ) = delete;
+ NonCopyable& operator = ( NonCopyable const& ) = delete;
+ NonCopyable& operator = ( NonCopyable && ) = delete;
+
+ protected:
+ NonCopyable();
+ virtual ~NonCopyable();
+ };
+
+ struct SourceLineInfo {
+
+ SourceLineInfo() = delete;
+ SourceLineInfo( char const* _file, std::size_t _line ) noexcept
+ : file( _file ),
+ line( _line )
+ {}
+
+ SourceLineInfo( SourceLineInfo const& other ) = default;
+ SourceLineInfo( SourceLineInfo && ) = default;
+ SourceLineInfo& operator = ( SourceLineInfo const& ) = default;
+ SourceLineInfo& operator = ( SourceLineInfo && ) = default;
+
+ bool empty() const noexcept;
+ bool operator == ( SourceLineInfo const& other ) const noexcept;
+ bool operator < ( SourceLineInfo const& other ) const noexcept;
+
+ char const* file;
+ std::size_t line;
+ };
+
+ std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info );
+
+ // Use this in variadic streaming macros to allow
+ // >> +StreamEndStop
+ // as well as
+ // >> stuff +StreamEndStop
+ struct StreamEndStop {
+ std::string operator+() const;
+ };
+ template<typename T>
+ T const& operator + ( T const& value, StreamEndStop ) {
+ return value;
+ }
+}
+
+#define CATCH_INTERNAL_LINEINFO \
+ ::Catch::SourceLineInfo( __FILE__, static_cast<std::size_t>( __LINE__ ) )
+
+#endif // TWOBLUECUBES_CATCH_COMMON_H_INCLUDED
+
diff --git a/include/internal/catch_compiler_capabilities.h b/include/internal/catch_compiler_capabilities.h
new file mode 100644
index 0000000..bb40982
--- /dev/null
+++ b/include/internal/catch_compiler_capabilities.h
@@ -0,0 +1,144 @@
+/*
+ * Created by Phil on 15/04/2013.
+ * Copyright 2013 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED
+
+// Detect a number of compiler features - by compiler
+// The following features are defined:
+//
+// CATCH_CONFIG_COUNTER : is the __COUNTER__ macro supported?
+// CATCH_CONFIG_WINDOWS_SEH : is Windows SEH supported?
+// CATCH_CONFIG_POSIX_SIGNALS : are POSIX signals supported?
+// ****************
+// Note to maintainers: if new toggles are added please document them
+// in configuration.md, too
+// ****************
+
+// In general each macro has a _NO_<feature name> form
+// (e.g. CATCH_CONFIG_NO_POSIX_SIGNALS) which disables the feature.
+// Many features, at point of detection, define an _INTERNAL_ macro, so they
+// can be combined, en-mass, with the _NO_ forms later.
+
+
+#ifdef __cplusplus
+
+# if __cplusplus >= 201402L
+# define CATCH_CPP14_OR_GREATER
+# endif
+
+# if __cplusplus >= 201703L
+# define CATCH_CPP17_OR_GREATER
+# endif
+
+#endif
+
+#if defined(CATCH_CPP17_OR_GREATER)
+# define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
+#endif
+
+#ifdef __clang__
+
+# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
+ _Pragma( "clang diagnostic push" ) \
+ _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) \
+ _Pragma( "clang diagnostic ignored \"-Wglobal-constructors\"")
+# define CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
+ _Pragma( "clang diagnostic pop" )
+
+# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \
+ _Pragma( "clang diagnostic push" ) \
+ _Pragma( "clang diagnostic ignored \"-Wparentheses\"" )
+# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \
+ _Pragma( "clang diagnostic pop" )
+
+#endif // __clang__
+
+
+////////////////////////////////////////////////////////////////////////////////
+// We know some environments not to support full POSIX signals
+#if defined(__CYGWIN__) || defined(__QNX__)
+
+# if !defined(CATCH_CONFIG_POSIX_SIGNALS)
+# define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS
+# endif
+
+#endif
+
+#ifdef __OS400__
+# define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS
+# define CATCH_CONFIG_COLOUR_NONE
+#endif
+
+////////////////////////////////////////////////////////////////////////////////
+// Cygwin
+#ifdef __CYGWIN__
+
+// Required for some versions of Cygwin to declare gettimeofday
+// see: http://stackoverflow.com/questions/36901803/gettimeofday-not-declared-in-this-scope-cygwin
+# define _BSD_SOURCE
+
+#endif // __CYGWIN__
+
+////////////////////////////////////////////////////////////////////////////////
+// Visual C++
+#ifdef _MSC_VER
+
+
+# if _MSC_VER >= 1900 // Visual Studio 2015 or newer
+# define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
+# endif
+
+// Universal Windows platform does not support SEH
+// Or console colours (or console at all...)
+# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
+# define CATCH_CONFIG_COLOUR_NONE
+# else
+# define CATCH_INTERNAL_CONFIG_WINDOWS_SEH
+# endif
+
+#endif // _MSC_VER
+
+////////////////////////////////////////////////////////////////////////////////
+
+// Use of __COUNTER__ is suppressed during code analysis in
+// CLion/AppCode 2017.2.x and former, because __COUNTER__ is not properly
+// handled by it.
+// Otherwise all supported compilers support COUNTER macro,
+// but user still might want to turn it off
+#if ( !defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L )
+ #define CATCH_INTERNAL_CONFIG_COUNTER
+#endif
+
+#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER)
+# define CATCH_CONFIG_COUNTER
+#endif
+#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH)
+# define CATCH_CONFIG_WINDOWS_SEH
+#endif
+// This is set by default, because we assume that unix compilers are posix-signal-compatible by default.
+#if !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS)
+# define CATCH_CONFIG_POSIX_SIGNALS
+#endif
+
+#if defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) && !defined(CATCH_INTERNAL_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS) && !defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
+# define CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
+#endif
+
+
+#if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS)
+# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS
+# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS
+#endif
+#if !defined(CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS)
+# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
+# define CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS
+#endif
+
+
+#endif // TWOBLUECUBES_CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED
+
diff --git a/include/internal/catch_config.cpp b/include/internal/catch_config.cpp
new file mode 100644
index 0000000..67d2b27
--- /dev/null
+++ b/include/internal/catch_config.cpp
@@ -0,0 +1,64 @@
+/*
+ * Created by Martin on 19/07/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_config.hpp"
+#include "catch_enforce.h"
+#include "catch_stringref.h"
+
+namespace Catch {
+
+ Config::Config( ConfigData const& data )
+ : m_data( data ),
+ m_stream( openStream() )
+ {
+ if( !data.testsOrTags.empty() ) {
+ TestSpecParser parser( ITagAliasRegistry::get() );
+ for( auto const& testOrTags : data.testsOrTags )
+ parser.parse( testOrTags );
+ m_testSpec = parser.testSpec();
+ }
+ }
+
+ std::string const& Config::getFilename() const {
+ return m_data.outputFilename ;
+ }
+
+ bool Config::listTests() const { return m_data.listTests; }
+ bool Config::listTestNamesOnly() const { return m_data.listTestNamesOnly; }
+ bool Config::listTags() const { return m_data.listTags; }
+ bool Config::listReporters() const { return m_data.listReporters; }
+
+ std::string Config::getProcessName() const { return m_data.processName; }
+
+ std::vector<std::string> const& Config::getReporterNames() const { return m_data.reporterNames; }
+ std::vector<std::string> const& Config::getSectionsToRun() const { return m_data.sectionsToRun; }
+
+ TestSpec const& Config::testSpec() const { return m_testSpec; }
+
+ bool Config::showHelp() const { return m_data.showHelp; }
+
+ // IConfig interface
+ bool Config::allowThrows() const { return !m_data.noThrow; }
+ std::ostream& Config::stream() const { return m_stream->stream(); }
+ std::string Config::name() const { return m_data.name.empty() ? m_data.processName : m_data.name; }
+ bool Config::includeSuccessfulResults() const { return m_data.showSuccessfulTests; }
+ bool Config::warnAboutMissingAssertions() const { return m_data.warnings & WarnAbout::NoAssertions; }
+ ShowDurations::OrNot Config::showDurations() const { return m_data.showDurations; }
+ RunTests::InWhatOrder Config::runOrder() const { return m_data.runOrder; }
+ unsigned int Config::rngSeed() const { return m_data.rngSeed; }
+ int Config::benchmarkResolutionMultiple() const { return m_data.benchmarkResolutionMultiple; }
+ UseColour::YesOrNo Config::useColour() const { return m_data.useColour; }
+ bool Config::shouldDebugBreak() const { return m_data.shouldDebugBreak; }
+ int Config::abortAfter() const { return m_data.abortAfter; }
+ bool Config::showInvisibles() const { return m_data.showInvisibles; }
+ Verbosity Config::verbosity() const { return m_data.verbosity; }
+
+ IStream const* Config::openStream() {
+ return Catch::makeStream(m_data.outputFilename);
+ }
+
+} // end namespace Catch
diff --git a/include/internal/catch_config.hpp b/include/internal/catch_config.hpp
new file mode 100644
index 0000000..fcaa050
--- /dev/null
+++ b/include/internal/catch_config.hpp
@@ -0,0 +1,114 @@
+/*
+ * Created by Phil on 08/11/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_CONFIG_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_CONFIG_HPP_INCLUDED
+
+#include "catch_test_spec_parser.h"
+#include "catch_interfaces_config.h"
+
+// Libstdc++ doesn't like incomplete classes for unique_ptr
+#include "catch_stream.h"
+
+#include <memory>
+#include <vector>
+#include <string>
+
+#ifndef CATCH_CONFIG_CONSOLE_WIDTH
+#define CATCH_CONFIG_CONSOLE_WIDTH 80
+#endif
+
+namespace Catch {
+
+ struct IStream;
+
+ struct ConfigData {
+ bool listTests = false;
+ bool listTags = false;
+ bool listReporters = false;
+ bool listTestNamesOnly = false;
+
+ bool showSuccessfulTests = false;
+ bool shouldDebugBreak = false;
+ bool noThrow = false;
+ bool showHelp = false;
+ bool showInvisibles = false;
+ bool filenamesAsTags = false;
+ bool libIdentify = false;
+
+ int abortAfter = -1;
+ unsigned int rngSeed = 0;
+ int benchmarkResolutionMultiple = 100;
+
+ Verbosity verbosity = Verbosity::Normal;
+ WarnAbout::What warnings = WarnAbout::Nothing;
+ ShowDurations::OrNot showDurations = ShowDurations::DefaultForReporter;
+ RunTests::InWhatOrder runOrder = RunTests::InDeclarationOrder;
+ UseColour::YesOrNo useColour = UseColour::Auto;
+ WaitForKeypress::When waitForKeypress = WaitForKeypress::Never;
+
+ std::string outputFilename;
+ std::string name;
+ std::string processName;
+
+ std::vector<std::string> reporterNames;
+ std::vector<std::string> testsOrTags;
+ std::vector<std::string> sectionsToRun;
+ };
+
+
+ class Config : public IConfig {
+ public:
+
+ Config() = default;
+ Config( ConfigData const& data );
+ virtual ~Config() = default;
+
+ std::string const& getFilename() const;
+
+ bool listTests() const;
+ bool listTestNamesOnly() const;
+ bool listTags() const;
+ bool listReporters() const;
+
+ std::string getProcessName() const;
+
+ std::vector<std::string> const& getReporterNames() const;
+ std::vector<std::string> const& getSectionsToRun() const override;
+
+ virtual TestSpec const& testSpec() const override;
+
+ bool showHelp() const;
+
+ // IConfig interface
+ bool allowThrows() const override;
+ std::ostream& stream() const override;
+ std::string name() const override;
+ bool includeSuccessfulResults() const override;
+ bool warnAboutMissingAssertions() const override;
+ ShowDurations::OrNot showDurations() const override;
+ RunTests::InWhatOrder runOrder() const override;
+ unsigned int rngSeed() const override;
+ int benchmarkResolutionMultiple() const override;
+ UseColour::YesOrNo useColour() const override;
+ bool shouldDebugBreak() const override;
+ int abortAfter() const override;
+ bool showInvisibles() const override;
+ Verbosity verbosity() const override;
+
+ private:
+
+ IStream const* openStream();
+ ConfigData m_data;
+
+ std::unique_ptr<IStream const> m_stream;
+ TestSpec m_testSpec;
+ };
+
+} // end namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_CONFIG_HPP_INCLUDED
diff --git a/include/internal/catch_console_colour.cpp b/include/internal/catch_console_colour.cpp
new file mode 100644
index 0000000..f692b5c
--- /dev/null
+++ b/include/internal/catch_console_colour.cpp
@@ -0,0 +1,231 @@
+/*
+ * Created by Phil on 25/2/2012.
+ * Copyright 2012 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+
+
+#if defined(__clang__)
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wexit-time-destructors"
+#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 <sstream>
+
+namespace Catch {
+ namespace {
+
+ struct IColourImpl {
+ virtual ~IColourImpl() = default;
+ virtual void use( Colour::Code _colourCode ) = 0;
+ };
+
+ struct NoColourImpl : IColourImpl {
+ void use( Colour::Code ) {}
+
+ static IColourImpl* instance() {
+ static NoColourImpl s_instance;
+ return &s_instance;
+ }
+ };
+
+ } // anon namespace
+} // namespace Catch
+
+#if !defined( CATCH_CONFIG_COLOUR_NONE ) && !defined( CATCH_CONFIG_COLOUR_WINDOWS ) && !defined( CATCH_CONFIG_COLOUR_ANSI )
+# ifdef CATCH_PLATFORM_WINDOWS
+# define CATCH_CONFIG_COLOUR_WINDOWS
+# else
+# define CATCH_CONFIG_COLOUR_ANSI
+# endif
+#endif
+
+
+#if defined ( CATCH_CONFIG_COLOUR_WINDOWS ) /////////////////////////////////////////
+
+namespace Catch {
+namespace {
+
+ class Win32ColourImpl : public IColourImpl {
+ public:
+ Win32ColourImpl() : stdoutHandle( GetStdHandle(STD_OUTPUT_HANDLE) )
+ {
+ CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
+ GetConsoleScreenBufferInfo( stdoutHandle, &csbiInfo );
+ originalForegroundAttributes = csbiInfo.wAttributes & ~( BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_BLUE | BACKGROUND_INTENSITY );
+ originalBackgroundAttributes = csbiInfo.wAttributes & ~( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY );
+ }
+
+ virtual void use( Colour::Code _colourCode ) override {
+ switch( _colourCode ) {
+ case Colour::None: return setTextAttribute( originalForegroundAttributes );
+ case Colour::White: return setTextAttribute( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE );
+ case Colour::Red: return setTextAttribute( FOREGROUND_RED );
+ case Colour::Green: return setTextAttribute( FOREGROUND_GREEN );
+ case Colour::Blue: return setTextAttribute( FOREGROUND_BLUE );
+ case Colour::Cyan: return setTextAttribute( FOREGROUND_BLUE | FOREGROUND_GREEN );
+ case Colour::Yellow: return setTextAttribute( FOREGROUND_RED | FOREGROUND_GREEN );
+ case Colour::Grey: return setTextAttribute( 0 );
+
+ case Colour::LightGrey: return setTextAttribute( FOREGROUND_INTENSITY );
+ case Colour::BrightRed: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_RED );
+ case Colour::BrightGreen: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN );
+ case Colour::BrightWhite: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE );
+ case Colour::BrightYellow: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN );
+
+ case Colour::Bright: CATCH_INTERNAL_ERROR( "not a colour" );
+
+ default:
+ CATCH_ERROR( "Unknown colour requested" );
+ }
+ }
+
+ private:
+ void setTextAttribute( WORD _textAttribute ) {
+ SetConsoleTextAttribute( stdoutHandle, _textAttribute | originalBackgroundAttributes );
+ }
+ HANDLE stdoutHandle;
+ WORD originalForegroundAttributes;
+ WORD originalBackgroundAttributes;
+ };
+
+ IColourImpl* platformColourInstance() {
+ static Win32ColourImpl s_instance;
+
+ IConfigPtr config = getCurrentContext().getConfig();
+ UseColour::YesOrNo colourMode = config
+ ? config->useColour()
+ : UseColour::Auto;
+ if( colourMode == UseColour::Auto )
+ colourMode = UseColour::Yes;
+ return colourMode == UseColour::Yes
+ ? &s_instance
+ : NoColourImpl::instance();
+ }
+
+} // end anon namespace
+} // end namespace Catch
+
+#elif defined( CATCH_CONFIG_COLOUR_ANSI ) //////////////////////////////////////
+
+#include <unistd.h>
+
+namespace Catch {
+namespace {
+
+ // use POSIX/ ANSI console terminal codes
+ // Thanks to Adam Strzelecki for original contribution
+ // (http://github.com/nanoant)
+ // https://github.com/philsquared/Catch/pull/131
+ class PosixColourImpl : public IColourImpl {
+ public:
+ virtual void use( Colour::Code _colourCode ) override {
+ switch( _colourCode ) {
+ case Colour::None:
+ case Colour::White: return setColour( "[0m" );
+ case Colour::Red: return setColour( "[0;31m" );
+ case Colour::Green: return setColour( "[0;32m" );
+ case Colour::Blue: return setColour( "[0;34m" );
+ case Colour::Cyan: return setColour( "[0;36m" );
+ case Colour::Yellow: return setColour( "[0;33m" );
+ case Colour::Grey: return setColour( "[1;30m" );
+
+ case Colour::LightGrey: return setColour( "[0;37m" );
+ case Colour::BrightRed: return setColour( "[1;31m" );
+ case Colour::BrightGreen: return setColour( "[1;32m" );
+ case Colour::BrightWhite: return setColour( "[1;37m" );
+ case Colour::BrightYellow: return setColour( "[1;33m" );
+
+ case Colour::Bright: CATCH_INTERNAL_ERROR( "not a colour" );
+ default: CATCH_INTERNAL_ERROR( "Unknown colour requested" );
+ }
+ }
+ static IColourImpl* instance() {
+ static PosixColourImpl s_instance;
+ return &s_instance;
+ }
+
+ private:
+ void setColour( const char* _escapeCode ) {
+ Catch::cout() << '\033' << _escapeCode;
+ }
+ };
+
+ bool useColourOnPlatform() {
+ return
+#ifdef CATCH_PLATFORM_MAC
+ !isDebuggerActive() &&
+#endif
+ isatty(STDOUT_FILENO);
+ }
+ IColourImpl* platformColourInstance() {
+ ErrnoGuard guard;
+ IConfigPtr config = getCurrentContext().getConfig();
+ UseColour::YesOrNo colourMode = config
+ ? config->useColour()
+ : UseColour::Auto;
+ if( colourMode == UseColour::Auto )
+ colourMode = useColourOnPlatform()
+ ? UseColour::Yes
+ : UseColour::No;
+ return colourMode == UseColour::Yes
+ ? PosixColourImpl::instance()
+ : NoColourImpl::instance();
+ }
+
+} // end anon namespace
+} // end namespace Catch
+
+#else // not Windows or ANSI ///////////////////////////////////////////////
+
+namespace Catch {
+
+ static IColourImpl* platformColourInstance() { return NoColourImpl::instance(); }
+
+} // end namespace Catch
+
+#endif // Windows/ ANSI/ None
+
+namespace Catch {
+
+ Colour::Colour( Code _colourCode ) { use( _colourCode ); }
+ Colour::Colour( Colour&& rhs ) noexcept {
+ m_moved = rhs.m_moved;
+ rhs.m_moved = true;
+ }
+ Colour& Colour::operator=( Colour&& rhs ) noexcept {
+ m_moved = rhs.m_moved;
+ rhs.m_moved = true;
+ return *this;
+ }
+
+ Colour::~Colour(){ if( !m_moved ) use( None ); }
+
+ void Colour::use( Code _colourCode ) {
+ static IColourImpl* impl = platformColourInstance();
+ impl->use( _colourCode );
+ }
+
+ std::ostream& operator << ( std::ostream& os, Colour const& ) {
+ return os;
+ }
+
+} // end namespace Catch
+
+#if defined(__clang__)
+# pragma clang diagnostic pop
+#endif
+
diff --git a/include/internal/catch_console_colour.h b/include/internal/catch_console_colour.h
new file mode 100644
index 0000000..ec65342
--- /dev/null
+++ b/include/internal/catch_console_colour.h
@@ -0,0 +1,69 @@
+/*
+ * Created by Phil on 25/2/2012.
+ * Copyright 2012 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_CONSOLE_COLOUR_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_CONSOLE_COLOUR_HPP_INCLUDED
+
+#include "catch_common.h"
+
+namespace Catch {
+
+ struct Colour {
+ enum Code {
+ None = 0,
+
+ White,
+ Red,
+ Green,
+ Blue,
+ Cyan,
+ Yellow,
+ Grey,
+
+ Bright = 0x10,
+
+ BrightRed = Bright | Red,
+ BrightGreen = Bright | Green,
+ LightGrey = Bright | Grey,
+ BrightWhite = Bright | White,
+ BrightYellow = Bright | Yellow,
+
+ // By intention
+ FileName = LightGrey,
+ Warning = BrightYellow,
+ ResultError = BrightRed,
+ ResultSuccess = BrightGreen,
+ ResultExpectedFailure = Warning,
+
+ Error = BrightRed,
+ Success = Green,
+
+ OriginalExpression = Cyan,
+ ReconstructedExpression = BrightYellow,
+
+ SecondaryText = LightGrey,
+ Headers = White
+ };
+
+ // Use constructed object for RAII guard
+ Colour( Code _colourCode );
+ Colour( Colour&& other ) noexcept;
+ Colour& operator=( Colour&& other ) noexcept;
+ ~Colour();
+
+ // Use static method for one-shot changes
+ static void use( Code _colourCode );
+
+ private:
+ bool m_moved = false;
+ };
+
+ std::ostream& operator << ( std::ostream& os, Colour const& );
+
+} // end namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_CONSOLE_COLOUR_HPP_INCLUDED
diff --git a/include/internal/catch_context.cpp b/include/internal/catch_context.cpp
new file mode 100644
index 0000000..e116f28
--- /dev/null
+++ b/include/internal/catch_context.cpp
@@ -0,0 +1,62 @@
+/*
+ * Created by Phil on 31/12/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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"
+
+namespace Catch {
+
+ class Context : public IMutableContext, NonCopyable {
+
+ public: // IContext
+ virtual IResultCapture* getResultCapture() override {
+ return m_resultCapture;
+ }
+ virtual IRunner* getRunner() override {
+ return m_runner;
+ }
+
+ virtual IConfigPtr const& getConfig() const override {
+ return m_config;
+ }
+
+ virtual ~Context() override;
+
+ public: // IMutableContext
+ virtual void setResultCapture( IResultCapture* resultCapture ) override {
+ m_resultCapture = resultCapture;
+ }
+ virtual void setRunner( IRunner* runner ) override {
+ m_runner = runner;
+ }
+ virtual void setConfig( IConfigPtr const& config ) override {
+ m_config = config;
+ }
+
+ friend IMutableContext& getCurrentMutableContext();
+
+ private:
+ IConfigPtr m_config;
+ IRunner* m_runner = nullptr;
+ IResultCapture* m_resultCapture = nullptr;
+ };
+
+ IMutableContext *IMutableContext::currentContext = nullptr;
+
+ void IMutableContext::createContext()
+ {
+ currentContext = new Context();
+ }
+
+ void cleanUpContext() {
+ delete IMutableContext::currentContext;
+ IMutableContext::currentContext = nullptr;
+ }
+ IContext::~IContext() = default;
+ IMutableContext::~IMutableContext() = default;
+ Context::~Context() = default;
+}
diff --git a/include/internal/catch_context.h b/include/internal/catch_context.h
new file mode 100644
index 0000000..3d3c6ba
--- /dev/null
+++ b/include/internal/catch_context.h
@@ -0,0 +1,60 @@
+/*
+ * Created by Phil on 31/12/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_CONTEXT_H_INCLUDED
+#define TWOBLUECUBES_CATCH_CONTEXT_H_INCLUDED
+
+#include <memory>
+
+namespace Catch {
+
+ struct IResultCapture;
+ struct IRunner;
+ struct IConfig;
+ struct IMutableContext;
+
+ using IConfigPtr = std::shared_ptr<IConfig const>;
+
+ struct IContext
+ {
+ virtual ~IContext();
+
+ virtual IResultCapture* getResultCapture() = 0;
+ virtual IRunner* getRunner() = 0;
+ virtual IConfigPtr const& getConfig() const = 0;
+ };
+
+ struct IMutableContext : IContext
+ {
+ virtual ~IMutableContext();
+ virtual void setResultCapture( IResultCapture* resultCapture ) = 0;
+ virtual void setRunner( IRunner* runner ) = 0;
+ virtual void setConfig( IConfigPtr const& config ) = 0;
+
+ private:
+ static IMutableContext *currentContext;
+ friend IMutableContext& getCurrentMutableContext();
+ friend void cleanUpContext();
+ static void createContext();
+ };
+
+ inline IMutableContext& getCurrentMutableContext()
+ {
+ if( !IMutableContext::currentContext )
+ IMutableContext::createContext();
+ return *IMutableContext::currentContext;
+ }
+
+ inline IContext& getCurrentContext()
+ {
+ return getCurrentMutableContext();
+ }
+
+ void cleanUpContext();
+}
+
+#endif // TWOBLUECUBES_CATCH_CONTEXT_H_INCLUDED
diff --git a/include/internal/catch_debug_console.cpp b/include/internal/catch_debug_console.cpp
new file mode 100644
index 0000000..d817c56
--- /dev/null
+++ b/include/internal/catch_debug_console.cpp
@@ -0,0 +1,29 @@
+/*
+ * Created by Martin on 29/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_debug_console.h"
+#include "catch_stream.h"
+#include "catch_platform.h"
+
+#ifdef CATCH_PLATFORM_WINDOWS
+
+#include "catch_windows_h_proxy.h"
+
+ namespace Catch {
+ void writeToDebugConsole( std::string const& text ) {
+ ::OutputDebugStringA( text.c_str() );
+ }
+ }
+#else
+ namespace Catch {
+ void writeToDebugConsole( std::string const& text ) {
+ // !TBD: Need a version for Mac/ XCode and other IDEs
+ Catch::cout() << text;
+ }
+ }
+#endif // Platform
diff --git a/include/internal/catch_debug_console.h b/include/internal/catch_debug_console.h
new file mode 100644
index 0000000..2c229a8
--- /dev/null
+++ b/include/internal/catch_debug_console.h
@@ -0,0 +1,17 @@
+/*
+ * Created by Martin on 29/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)
+ *
+ */
+#ifndef TWOBLUECUBES_CATCH_DEBUG_CONSOLE_H_INCLUDED
+#define TWOBLUECUBES_CATCH_DEBUG_CONSOLE_H_INCLUDED
+
+#include <string>
+
+namespace Catch {
+ void writeToDebugConsole( std::string const& text );
+}
+
+#endif // TWOBLUECUBES_CATCH_DEBUG_CONSOLE_H_INCLUDED
diff --git a/include/internal/catch_debugger.cpp b/include/internal/catch_debugger.cpp
new file mode 100644
index 0000000..71dc650
--- /dev/null
+++ b/include/internal/catch_debugger.cpp
@@ -0,0 +1,113 @@
+/*
+ * Created by Phil on 27/12/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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_debugger.h"
+#include "catch_errno_guard.h"
+#include "catch_stream.h"
+#include "catch_platform.h"
+
+#ifdef CATCH_PLATFORM_MAC
+
+# include <assert.h>
+# include <stdbool.h>
+# include <sys/types.h>
+# include <unistd.h>
+# include <sys/sysctl.h>
+# include <cstddef>
+# include <ostream>
+
+namespace Catch {
+
+ // The following function is taken directly from the following technical note:
+ // http://developer.apple.com/library/mac/#qa/qa2004/qa1361.html
+
+ // Returns true if the current process is being debugged (either
+ // running under the debugger or has a debugger attached post facto).
+ bool isDebuggerActive(){
+
+ int mib[4];
+ struct kinfo_proc info;
+ std::size_t size;
+
+ // Initialize the flags so that, if sysctl fails for some bizarre
+ // reason, we get a predictable result.
+
+ info.kp_proc.p_flag = 0;
+
+ // Initialize mib, which tells sysctl the info we want, in this case
+ // we're looking for information about a specific process ID.
+
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_PROC;
+ mib[2] = KERN_PROC_PID;
+ mib[3] = getpid();
+
+ // Call sysctl.
+
+ size = sizeof(info);
+ if( sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, nullptr, 0) != 0 ) {
+ Catch::cerr() << "\n** Call to sysctl failed - unable to determine if debugger is active **\n" << std::endl;
+ return false;
+ }
+
+ // We're being debugged if the P_TRACED flag is set.
+
+ return ( (info.kp_proc.p_flag & P_TRACED) != 0 );
+ }
+ } // namespace Catch
+
+#elif defined(CATCH_PLATFORM_LINUX)
+ #include <fstream>
+ #include <string>
+
+ namespace Catch{
+ // The standard POSIX way of detecting a debugger is to attempt to
+ // ptrace() the process, but this needs to be done from a child and not
+ // this process itself to still allow attaching to this process later
+ // if wanted, so is rather heavy. Under Linux we have the PID of the
+ // "debugger" (which doesn't need to be gdb, of course, it could also
+ // be strace, for example) in /proc/$PID/status, so just get it from
+ // there instead.
+ bool isDebuggerActive(){
+ // Libstdc++ has a bug, where std::ifstream sets errno to 0
+ // This way our users can properly assert over errno values
+ ErrnoGuard guard;
+ std::ifstream in("/proc/self/status");
+ for( std::string line; std::getline(in, line); ) {
+ static const int PREFIX_LEN = 11;
+ if( line.compare(0, PREFIX_LEN, "TracerPid:\t") == 0 ) {
+ // We're traced if the PID is not 0 and no other PID starts
+ // with 0 digit, so it's enough to check for just a single
+ // character.
+ return line.length() > PREFIX_LEN && line[PREFIX_LEN] != '0';
+ }
+ }
+
+ return false;
+ }
+ } // namespace Catch
+#elif defined(_MSC_VER)
+ extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent();
+ namespace Catch {
+ bool isDebuggerActive() {
+ return IsDebuggerPresent() != 0;
+ }
+ }
+#elif defined(__MINGW32__)
+ extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent();
+ namespace Catch {
+ bool isDebuggerActive() {
+ return IsDebuggerPresent() != 0;
+ }
+ }
+#else
+ namespace Catch {
+ bool isDebuggerActive() { return false; }
+ }
+#endif // Platform
diff --git a/include/internal/catch_debugger.h b/include/internal/catch_debugger.h
new file mode 100644
index 0000000..7541984
--- /dev/null
+++ b/include/internal/catch_debugger.h
@@ -0,0 +1,49 @@
+/*
+ * Created by Phil on 3/12/2013.
+ * Copyright 2013 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ *
+ */
+#ifndef TWOBLUECUBES_CATCH_DEBUGGER_H_INCLUDED
+#define TWOBLUECUBES_CATCH_DEBUGGER_H_INCLUDED
+
+#include "catch_platform.h"
+
+namespace Catch {
+ bool isDebuggerActive();
+}
+
+#ifdef CATCH_PLATFORM_MAC
+
+ #define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */
+
+#elif defined(CATCH_PLATFORM_LINUX)
+ // If we can use inline assembler, do it because this allows us to break
+ // directly at the location of the failing check instead of breaking inside
+ // raise() called from it, i.e. one stack frame below.
+ #if defined(__GNUC__) && (defined(__i386) || defined(__x86_64))
+ #define CATCH_TRAP() asm volatile ("int $3") /* NOLINT */
+ #else // Fall back to the generic way.
+ #include <signal.h>
+
+ #define CATCH_TRAP() raise(SIGTRAP)
+ #endif
+#elif defined(_MSC_VER)
+ #define CATCH_TRAP() __debugbreak()
+#elif defined(__MINGW32__)
+ extern "C" __declspec(dllimport) void __stdcall DebugBreak();
+ #define CATCH_TRAP() DebugBreak()
+#endif
+
+#ifdef CATCH_TRAP
+ #define CATCH_BREAK_INTO_DEBUGGER() if( Catch::isDebuggerActive() ) { CATCH_TRAP(); }
+#else
+ namespace Catch {
+ inline void doNothing() {}
+ }
+ #define CATCH_BREAK_INTO_DEBUGGER() Catch::doNothing()
+#endif
+
+#endif // TWOBLUECUBES_CATCH_DEBUGGER_H_INCLUDED
diff --git a/include/internal/catch_decomposer.cpp b/include/internal/catch_decomposer.cpp
new file mode 100644
index 0000000..8c19629
--- /dev/null
+++ b/include/internal/catch_decomposer.cpp
@@ -0,0 +1,24 @@
+/*
+ * Created by Phil Nash on 8/8/2017.
+ * Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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_decomposer.h"
+#include "catch_config.hpp"
+
+namespace Catch {
+
+ ITransientExpression::~ITransientExpression() = default;
+
+ void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ) {
+ if( lhs.size() + rhs.size() < 40 &&
+ lhs.find('\n') == std::string::npos &&
+ rhs.find('\n') == std::string::npos )
+ os << lhs << " " << op << " " << rhs;
+ else
+ os << lhs << "\n" << op << "\n" << rhs;
+ }
+}
diff --git a/include/internal/catch_decomposer.h b/include/internal/catch_decomposer.h
new file mode 100644
index 0000000..618a250
--- /dev/null
+++ b/include/internal/catch_decomposer.h
@@ -0,0 +1,175 @@
+/*
+ * Created by Phil Nash on 8/8/2017.
+ * Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_DECOMPOSER_H_INCLUDED
+#define TWOBLUECUBES_CATCH_DECOMPOSER_H_INCLUDED
+
+#include "catch_tostring.h"
+#include "catch_stringref.h"
+
+#include <iosfwd>
+
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4389) // '==' : signed/unsigned mismatch
+#pragma warning(disable:4018) // more "signed/unsigned mismatch"
+#pragma warning(disable:4312) // Converting int to T* using reinterpret_cast (issue on x64 platform)
+#pragma warning(disable:4180) // qualifier applied to function type has no meaning
+#endif
+
+namespace Catch {
+
+ struct ITransientExpression {
+ auto isBinaryExpression() const -> bool { return m_isBinaryExpression; }
+ auto getResult() const -> bool { return m_result; }
+ virtual void streamReconstructedExpression( std::ostream &os ) const = 0;
+
+ ITransientExpression( bool isBinaryExpression, bool result )
+ : m_isBinaryExpression( isBinaryExpression ),
+ m_result( result )
+ {}
+
+ // We don't actually need a virtual destructor, but many static analysers
+ // complain if it's not here :-(
+ virtual ~ITransientExpression();
+
+ bool m_isBinaryExpression;
+ bool m_result;
+
+ };
+
+ void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs );
+
+ template<typename LhsT, typename RhsT>
+ class BinaryExpr : public ITransientExpression {
+ LhsT m_lhs;
+ StringRef m_op;
+ RhsT m_rhs;
+
+ void streamReconstructedExpression( std::ostream &os ) const override {
+ formatReconstructedExpression
+ ( os, Catch::Detail::stringify( m_lhs ), m_op, Catch::Detail::stringify( m_rhs ) );
+ }
+
+ public:
+ BinaryExpr( bool comparisonResult, LhsT lhs, StringRef op, RhsT rhs )
+ : ITransientExpression{ true, comparisonResult },
+ m_lhs( lhs ),
+ m_op( op ),
+ m_rhs( rhs )
+ {}
+ };
+
+ template<typename LhsT>
+ class UnaryExpr : public ITransientExpression {
+ LhsT m_lhs;
+
+ void streamReconstructedExpression( std::ostream &os ) const override {
+ os << Catch::Detail::stringify( m_lhs );
+ }
+
+ public:
+ explicit UnaryExpr( LhsT lhs )
+ : ITransientExpression{ false, lhs ? true : false },
+ m_lhs( lhs )
+ {}
+ };
+
+
+ // Specialised comparison functions to handle equality comparisons between ints and pointers (NULL deduces as an int)
+ template<typename LhsT, typename RhsT>
+ auto compareEqual( LhsT const& lhs, RhsT const& rhs ) -> bool { return static_cast<bool>(lhs == rhs); }
+ template<typename T>
+ auto compareEqual( T* const& lhs, int rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); }
+ template<typename T>
+ auto compareEqual( T* const& lhs, long rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); }
+ template<typename T>
+ auto compareEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; }
+ template<typename T>
+ auto compareEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; }
+
+ template<typename LhsT, typename RhsT>
+ auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return static_cast<bool>(lhs != rhs); }
+ template<typename T>
+ auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); }
+ template<typename T>
+ auto compareNotEqual( T* const& lhs, long rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); }
+ template<typename T>
+ auto compareNotEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) != rhs; }
+ template<typename T>
+ auto compareNotEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) != rhs; }
+
+
+ template<typename LhsT>
+ class ExprLhs {
+ LhsT m_lhs;
+ public:
+ explicit ExprLhs( LhsT lhs ) : m_lhs( lhs ) {}
+
+ template<typename RhsT>
+ auto operator == ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
+ return { compareEqual( m_lhs, rhs ), m_lhs, "==", rhs };
+ }
+ auto operator == ( bool rhs ) -> BinaryExpr<LhsT, bool> const {
+ return { m_lhs == rhs, m_lhs, "==", rhs };
+ }
+
+ template<typename RhsT>
+ auto operator != ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
+ return { compareNotEqual( m_lhs, rhs ), m_lhs, "!=", rhs };
+ }
+ auto operator != ( bool rhs ) -> BinaryExpr<LhsT, bool> const {
+ return { m_lhs != rhs, m_lhs, "!=", rhs };
+ }
+
+ template<typename RhsT>
+ auto operator > ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
+ return { static_cast<bool>(m_lhs > rhs), m_lhs, ">", rhs };
+ }
+ template<typename RhsT>
+ auto operator < ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
+ return { static_cast<bool>(m_lhs < rhs), m_lhs, "<", rhs };
+ }
+ template<typename RhsT>
+ auto operator >= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
+ return { static_cast<bool>(m_lhs >= rhs), m_lhs, ">=", rhs };
+ }
+ template<typename RhsT>
+ auto operator <= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
+ return { static_cast<bool>(m_lhs <= rhs), m_lhs, "<=", rhs };
+ }
+
+ auto makeUnaryExpr() const -> UnaryExpr<LhsT> {
+ return UnaryExpr<LhsT>{ m_lhs };
+ }
+ };
+
+ void handleExpression( ITransientExpression const& expr );
+
+ template<typename T>
+ void handleExpression( ExprLhs<T> const& expr ) {
+ handleExpression( expr.makeUnaryExpr() );
+ }
+
+ struct Decomposer {
+ template<typename T>
+ auto operator <= ( T const& lhs ) -> ExprLhs<T const&> {
+ return ExprLhs<T const&>{ lhs };
+ }
+
+ auto operator <=( bool value ) -> ExprLhs<bool> {
+ return ExprLhs<bool>{ value };
+ }
+ };
+
+} // end namespace Catch
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+#endif // TWOBLUECUBES_CATCH_DECOMPOSER_H_INCLUDED
diff --git a/include/internal/catch_default_main.hpp b/include/internal/catch_default_main.hpp
new file mode 100644
index 0000000..4372e9c
--- /dev/null
+++ b/include/internal/catch_default_main.hpp
@@ -0,0 +1,46 @@
+/*
+ * Created by Phil on 20/05/2011.
+ * Copyright 2011 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_DEFAULT_MAIN_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_DEFAULT_MAIN_HPP_INCLUDED
+
+#include "catch_session.h"
+
+#ifndef __OBJC__
+
+#if defined(WIN32) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN)
+// Standard C/C++ Win32 Unicode wmain entry point
+extern "C" int wmain (int argc, wchar_t * argv[], wchar_t * []) {
+#else
+// Standard C/C++ main entry point
+int main (int argc, char * argv[]) {
+#endif
+
+ return Catch::Session().run( argc, argv );
+}
+
+#else // __OBJC__
+
+// Objective-C entry point
+int main (int argc, char * const argv[]) {
+#if !CATCH_ARC_ENABLED
+ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
+#endif
+
+ Catch::registerTestMethods();
+ int result = Catch::Session().run( argc, (char**)argv );
+
+#if !CATCH_ARC_ENABLED
+ [pool drain];
+#endif
+
+ return result;
+}
+
+#endif // __OBJC__
+
+#endif // TWOBLUECUBES_CATCH_DEFAULT_MAIN_HPP_INCLUDED
diff --git a/include/internal/catch_enforce.h b/include/internal/catch_enforce.h
new file mode 100644
index 0000000..7dc3e3d
--- /dev/null
+++ b/include/internal/catch_enforce.h
@@ -0,0 +1,25 @@
+/*
+ * Created by Martin on 01/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)
+ */
+#ifndef TWOBLUECUBES_CATCH_ENFORCE_H_INCLUDED
+#define TWOBLUECUBES_CATCH_ENFORCE_H_INCLUDED
+
+#include "catch_common.h"
+#include "catch_stream.h"
+
+#include <stdexcept>
+#include <iosfwd>
+
+#define CATCH_PREPARE_EXCEPTION( type, msg ) \
+ type( static_cast<std::ostringstream&&>( Catch::ReusableStringStream().get() << msg ).str() )
+#define CATCH_INTERNAL_ERROR( msg ) \
+ throw CATCH_PREPARE_EXCEPTION( std::logic_error, CATCH_INTERNAL_LINEINFO << ": Internal Catch error: " << msg);
+#define CATCH_ERROR( msg ) \
+ throw CATCH_PREPARE_EXCEPTION( std::domain_error, msg )
+#define CATCH_ENFORCE( condition, msg ) \
+ do{ if( !(condition) ) CATCH_ERROR( msg ); } while(false)
+
+#endif // TWOBLUECUBES_CATCH_ENFORCE_H_INCLUDED
diff --git a/include/internal/catch_errno_guard.cpp b/include/internal/catch_errno_guard.cpp
new file mode 100644
index 0000000..070583b
--- /dev/null
+++ b/include/internal/catch_errno_guard.cpp
@@ -0,0 +1,15 @@
+/*
+ * Created by Martin on 06/03/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_errno_guard.h"
+
+#include <cerrno>
+
+namespace Catch {
+ ErrnoGuard::ErrnoGuard():m_oldErrno(errno){}
+ ErrnoGuard::~ErrnoGuard() { errno = m_oldErrno; }
+}
diff --git a/include/internal/catch_errno_guard.h b/include/internal/catch_errno_guard.h
new file mode 100644
index 0000000..b1d1fc1
--- /dev/null
+++ b/include/internal/catch_errno_guard.h
@@ -0,0 +1,22 @@
+/*
+ * Created by Martin on 06/03/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)
+ */
+#ifndef TWOBLUECUBES_CATCH_ERRNO_GUARD_H_INCLUDED
+#define TWOBLUECUBES_CATCH_ERRNO_GUARD_H_INCLUDED
+
+namespace Catch {
+
+ class ErrnoGuard {
+ public:
+ ErrnoGuard();
+ ~ErrnoGuard();
+ private:
+ int m_oldErrno;
+ };
+
+}
+
+#endif // TWOBLUECUBES_CATCH_ERRNO_GUARD_H_INCLUDED
diff --git a/include/internal/catch_exception_translator_registry.cpp b/include/internal/catch_exception_translator_registry.cpp
new file mode 100644
index 0000000..78b9c57
--- /dev/null
+++ b/include/internal/catch_exception_translator_registry.cpp
@@ -0,0 +1,73 @@
+/*
+ * Created by Phil on 20/04/2011.
+ * Copyright 2011 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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_assertionhandler.h"
+#include "catch_exception_translator_registry.h"
+
+#ifdef __OBJC__
+#import "Foundation/Foundation.h"
+#endif
+
+namespace Catch {
+
+ ExceptionTranslatorRegistry::~ExceptionTranslatorRegistry() {
+ }
+
+ void ExceptionTranslatorRegistry::registerTranslator( const IExceptionTranslator* translator ) {
+ m_translators.push_back( std::unique_ptr<const IExceptionTranslator>( translator ) );
+ }
+
+ std::string ExceptionTranslatorRegistry::translateActiveException() const {
+ try {
+#ifdef __OBJC__
+ // In Objective-C try objective-c exceptions first
+ @try {
+ return tryTranslators();
+ }
+ @catch (NSException *exception) {
+ return Catch::Detail::stringify( [exception description] );
+ }
+#else
+ // Compiling a mixed mode project with MSVC means that CLR
+ // exceptions will be caught in (...) as well. However, these
+ // do not fill-in std::current_exception and thus lead to crash
+ // when attempting rethrow.
+ // /EHa switch also causes structured exceptions to be caught
+ // here, but they fill-in current_exception properly, so
+ // at worst the output should be a little weird, instead of
+ // causing a crash.
+ if (std::current_exception() == nullptr) {
+ return "Non C++ exception. Possibly a CLR exception.";
+ }
+ return tryTranslators();
+#endif
+ }
+ catch( TestFailureException& ) {
+ std::rethrow_exception(std::current_exception());
+ }
+ catch( std::exception& ex ) {
+ return ex.what();
+ }
+ catch( std::string& msg ) {
+ return msg;
+ }
+ catch( const char* msg ) {
+ return msg;
+ }
+ catch(...) {
+ return "Unknown exception";
+ }
+ }
+
+ std::string ExceptionTranslatorRegistry::tryTranslators() const {
+ if( m_translators.empty() )
+ std::rethrow_exception(std::current_exception());
+ else
+ return m_translators[0]->translate( m_translators.begin()+1, m_translators.end() );
+ }
+}
diff --git a/include/internal/catch_exception_translator_registry.h b/include/internal/catch_exception_translator_registry.h
new file mode 100644
index 0000000..da2f4f1
--- /dev/null
+++ b/include/internal/catch_exception_translator_registry.h
@@ -0,0 +1,30 @@
+/*
+ * Created by Phil on 20/04/2011.
+ * Copyright 2011 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED
+
+#include "catch_interfaces_exception.h"
+#include <vector>
+#include <string>
+#include <memory>
+
+namespace Catch {
+
+ class ExceptionTranslatorRegistry : public IExceptionTranslatorRegistry {
+ public:
+ ~ExceptionTranslatorRegistry();
+ virtual void registerTranslator( const IExceptionTranslator* translator );
+ virtual std::string translateActiveException() const override;
+ std::string tryTranslators() const;
+
+ private:
+ std::vector<std::unique_ptr<IExceptionTranslator const>> m_translators;
+ };
+}
+
+#endif // TWOBLUECUBES_CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED
diff --git a/include/internal/catch_external_interfaces.h b/include/internal/catch_external_interfaces.h
new file mode 100644
index 0000000..d025494
--- /dev/null
+++ b/include/internal/catch_external_interfaces.h
@@ -0,0 +1,20 @@
+/*
+ * Created by Martin on 17/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)
+ */
+#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"
+
+// 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"
+
+#endif // TWOBLUECUBES_CATCH_EXTERNAL_INTERFACES_H_INCLUDED
diff --git a/include/internal/catch_fatal_condition.cpp b/include/internal/catch_fatal_condition.cpp
new file mode 100644
index 0000000..55ee539
--- /dev/null
+++ b/include/internal/catch_fatal_condition.cpp
@@ -0,0 +1,187 @@
+/*
+ * Created by Phil on 21/08/2014
+ * Copyright 2014 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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_fatal_condition.h"
+
+#include "catch_context.h"
+#include "catch_interfaces_capture.h"
+
+#if defined(__GNUC__)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wmissing-field-initializers"
+#endif
+
+#if (defined(CATCH_PLATFORM_WINDOWS) && defined(CATCH_CONFIG_WINDOWS_SEH)) || defined(CATCH_CONFIG_POSIX_SIGNALS)
+namespace {
+ // Report the error condition
+ void reportFatal( char const * const message ) {
+ Catch::getCurrentContext().getResultCapture()->handleFatalErrorCondition( message );
+ }
+}
+#endif
+
+#if defined ( CATCH_PLATFORM_WINDOWS ) /////////////////////////////////////////
+
+# if !defined ( CATCH_CONFIG_WINDOWS_SEH )
+
+namespace Catch {
+ void FatalConditionHandler::reset() {}
+}
+
+# else // CATCH_CONFIG_WINDOWS_SEH is defined
+
+namespace Catch {
+ struct SignalDefs { DWORD id; const char* name; };
+
+ // There is no 1-1 mapping between signals and windows exceptions.
+ // Windows can easily distinguish between SO and SigSegV,
+ // but SigInt, SigTerm, etc are handled differently.
+ static SignalDefs signalDefs[] = {
+ { EXCEPTION_ILLEGAL_INSTRUCTION, "SIGILL - Illegal instruction signal" },
+ { EXCEPTION_STACK_OVERFLOW, "SIGSEGV - Stack overflow" },
+ { EXCEPTION_ACCESS_VIOLATION, "SIGSEGV - Segmentation violation signal" },
+ { EXCEPTION_INT_DIVIDE_BY_ZERO, "Divide by zero error" },
+ };
+
+ LONG CALLBACK FatalConditionHandler::handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo) {
+ for (auto const& def : signalDefs) {
+ if (ExceptionInfo->ExceptionRecord->ExceptionCode == def.id) {
+ reportFatal(def.name);
+ }
+ }
+ // If its not an exception we care about, pass it along.
+ // This stops us from eating debugger breaks etc.
+ return EXCEPTION_CONTINUE_SEARCH;
+ }
+
+ FatalConditionHandler::FatalConditionHandler() {
+ isSet = true;
+ // 32k seems enough for Catch to handle stack overflow,
+ // but the value was found experimentally, so there is no strong guarantee
+ guaranteeSize = 32 * 1024;
+ exceptionHandlerHandle = nullptr;
+ // Register as first handler in current chain
+ exceptionHandlerHandle = AddVectoredExceptionHandler(1, handleVectoredException);
+ // Pass in guarantee size to be filled
+ SetThreadStackGuarantee(&guaranteeSize);
+ }
+
+ void FatalConditionHandler::reset() {
+ if (isSet) {
+ // Unregister handler and restore the old guarantee
+ RemoveVectoredExceptionHandler(exceptionHandlerHandle);
+ SetThreadStackGuarantee(&guaranteeSize);
+ exceptionHandlerHandle = nullptr;
+ isSet = false;
+ }
+ }
+
+ FatalConditionHandler::~FatalConditionHandler() {
+ reset();
+ }
+
+bool FatalConditionHandler::isSet = false;
+ULONG FatalConditionHandler::guaranteeSize = 0;
+PVOID FatalConditionHandler::exceptionHandlerHandle = nullptr;
+
+
+} // namespace Catch
+
+# endif // CATCH_CONFIG_WINDOWS_SEH
+
+#else // Not Windows - assumed to be POSIX compatible //////////////////////////
+
+# if !defined(CATCH_CONFIG_POSIX_SIGNALS)
+
+namespace Catch {
+ void FatalConditionHandler::reset() {}
+}
+
+
+# else // CATCH_CONFIG_POSIX_SIGNALS is defined
+
+#include <signal.h>
+
+namespace Catch {
+
+ struct SignalDefs {
+ int id;
+ const char* name;
+ };
+ static SignalDefs signalDefs[] = {
+ { SIGINT, "SIGINT - Terminal interrupt signal" },
+ { SIGILL, "SIGILL - Illegal instruction signal" },
+ { SIGFPE, "SIGFPE - Floating point error signal" },
+ { SIGSEGV, "SIGSEGV - Segmentation violation signal" },
+ { SIGTERM, "SIGTERM - Termination request signal" },
+ { SIGABRT, "SIGABRT - Abort (abnormal termination) signal" }
+ };
+
+
+ void FatalConditionHandler::handleSignal( int sig ) {
+ char const * name = "<unknown signal>";
+ for (auto const& def : signalDefs) {
+ if (sig == def.id) {
+ name = def.name;
+ break;
+ }
+ }
+ reset();
+ reportFatal(name);
+ raise( sig );
+ }
+
+ FatalConditionHandler::FatalConditionHandler() {
+ isSet = true;
+ stack_t sigStack;
+ sigStack.ss_sp = altStackMem;
+ sigStack.ss_size = SIGSTKSZ;
+ sigStack.ss_flags = 0;
+ sigaltstack(&sigStack, &oldSigStack);
+ struct sigaction sa = { };
+
+ sa.sa_handler = handleSignal;
+ sa.sa_flags = SA_ONSTACK;
+ for (std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i) {
+ sigaction(signalDefs[i].id, &sa, &oldSigActions[i]);
+ }
+ }
+
+
+ FatalConditionHandler::~FatalConditionHandler() {
+ reset();
+ }
+
+ void FatalConditionHandler::reset() {
+ if( isSet ) {
+ // Set signals back to previous values -- hopefully nobody overwrote them in the meantime
+ for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) {
+ sigaction(signalDefs[i].id, &oldSigActions[i], nullptr);
+ }
+ // Return the old stack
+ sigaltstack(&oldSigStack, nullptr);
+ isSet = false;
+ }
+ }
+
+ bool FatalConditionHandler::isSet = false;
+ struct sigaction FatalConditionHandler::oldSigActions[sizeof(signalDefs)/sizeof(SignalDefs)] = {};
+ stack_t FatalConditionHandler::oldSigStack = {};
+ char FatalConditionHandler::altStackMem[SIGSTKSZ] = {};
+
+
+} // namespace Catch
+
+# endif // CATCH_CONFIG_POSIX_SIGNALS
+
+#endif // not Windows
+
+#if defined(__GNUC__)
+# pragma GCC diagnostic pop
+#endif
diff --git a/include/internal/catch_fatal_condition.h b/include/internal/catch_fatal_condition.h
new file mode 100644
index 0000000..9977702
--- /dev/null
+++ b/include/internal/catch_fatal_condition.h
@@ -0,0 +1,86 @@
+/*
+ * Created by Phil on 21/08/2014
+ * Copyright 2014 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ *
+ */
+#ifndef TWOBLUECUBES_CATCH_FATAL_CONDITION_H_INCLUDED
+#define TWOBLUECUBES_CATCH_FATAL_CONDITION_H_INCLUDED
+
+#include <string>
+#include "catch_platform.h"
+#include "catch_compiler_capabilities.h"
+
+
+#if defined ( CATCH_PLATFORM_WINDOWS ) /////////////////////////////////////////
+#include "catch_windows_h_proxy.h"
+
+# if !defined ( CATCH_CONFIG_WINDOWS_SEH )
+
+namespace Catch {
+ struct FatalConditionHandler {
+ void reset();
+ };
+}
+
+# else // CATCH_CONFIG_WINDOWS_SEH is defined
+
+namespace Catch {
+
+ struct FatalConditionHandler {
+
+ static LONG CALLBACK handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo);
+ FatalConditionHandler();
+ static void reset();
+ ~FatalConditionHandler();
+
+ private:
+ static bool isSet;
+ static ULONG guaranteeSize;
+ static PVOID exceptionHandlerHandle;
+ };
+
+} // namespace Catch
+
+# endif // CATCH_CONFIG_WINDOWS_SEH
+
+#else // Not Windows - assumed to be POSIX compatible //////////////////////////
+
+# if !defined(CATCH_CONFIG_POSIX_SIGNALS)
+
+namespace Catch {
+ struct FatalConditionHandler {
+ void reset();
+ };
+}
+
+
+# else // CATCH_CONFIG_POSIX_SIGNALS is defined
+
+#include <signal.h>
+
+namespace Catch {
+
+ struct FatalConditionHandler {
+
+ static bool isSet;
+ static struct sigaction oldSigActions[];// [sizeof(signalDefs) / sizeof(SignalDefs)];
+ static stack_t oldSigStack;
+ static char altStackMem[];
+
+ static void handleSignal( int sig );
+
+ FatalConditionHandler();
+ ~FatalConditionHandler();
+ static void reset();
+ };
+
+} // namespace Catch
+
+# endif // CATCH_CONFIG_POSIX_SIGNALS
+
+#endif // not Windows
+
+#endif // TWOBLUECUBES_CATCH_FATAL_CONDITION_H_INCLUDED
diff --git a/include/internal/catch_impl.hpp b/include/internal/catch_impl.hpp
new file mode 100644
index 0000000..0b29a39
--- /dev/null
+++ b/include/internal/catch_impl.hpp
@@ -0,0 +1,33 @@
+/*
+ * Created by Phil on 5/8/2012.
+ * Copyright 2012 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_IMPL_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_IMPL_HPP_INCLUDED
+
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wweak-vtables"
+#endif
+
+// Keep these here for external reporters
+#include "catch_test_spec.h"
+#include "catch_test_case_tracker.h"
+
+#include "catch_leak_detector.h"
+
+// Cpp files will be included in the single-header file here
+// ~*~* CATCH_CPP_STITCH_PLACE *~*~
+
+namespace Catch {
+ LeakDetector leakDetector;
+}
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
+#endif // TWOBLUECUBES_CATCH_IMPL_HPP_INCLUDED
diff --git a/include/internal/catch_interfaces_capture.cpp b/include/internal/catch_interfaces_capture.cpp
new file mode 100644
index 0000000..3c090bf
--- /dev/null
+++ b/include/internal/catch_interfaces_capture.cpp
@@ -0,0 +1,5 @@
+#include "catch_interfaces_capture.h"
+
+namespace Catch {
+ IResultCapture::~IResultCapture() = default;
+}
diff --git a/include/internal/catch_interfaces_capture.h b/include/internal/catch_interfaces_capture.h
new file mode 100644
index 0000000..4d091f8
--- /dev/null
+++ b/include/internal/catch_interfaces_capture.h
@@ -0,0 +1,84 @@
+/*
+ * Created by Phil on 07/01/2011.
+ * Copyright 2011 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_INTERFACES_CAPTURE_H_INCLUDED
+#define TWOBLUECUBES_CATCH_INTERFACES_CAPTURE_H_INCLUDED
+
+#include <string>
+
+#include "catch_stringref.h"
+#include "catch_result_type.h"
+
+namespace Catch {
+
+ class AssertionResult;
+ struct AssertionInfo;
+ struct SectionInfo;
+ struct SectionEndInfo;
+ struct MessageInfo;
+ struct Counts;
+ struct BenchmarkInfo;
+ struct BenchmarkStats;
+ struct AssertionReaction;
+
+ struct ITransientExpression;
+
+ struct IResultCapture {
+
+ virtual ~IResultCapture();
+
+ virtual bool sectionStarted( SectionInfo const& sectionInfo,
+ Counts& assertions ) = 0;
+ virtual void sectionEnded( SectionEndInfo const& endInfo ) = 0;
+ virtual void sectionEndedEarly( SectionEndInfo const& endInfo ) = 0;
+
+ virtual void benchmarkStarting( BenchmarkInfo const& info ) = 0;
+ virtual void benchmarkEnded( BenchmarkStats const& stats ) = 0;
+
+ virtual void pushScopedMessage( MessageInfo const& message ) = 0;
+ virtual void popScopedMessage( MessageInfo const& message ) = 0;
+
+ virtual void handleFatalErrorCondition( StringRef message ) = 0;
+
+ virtual void handleExpr
+ ( AssertionInfo const& info,
+ ITransientExpression const& expr,
+ AssertionReaction& reaction ) = 0;
+ virtual void handleMessage
+ ( AssertionInfo const& info,
+ ResultWas::OfType resultType,
+ StringRef const& message,
+ AssertionReaction& reaction ) = 0;
+ virtual void handleUnexpectedExceptionNotThrown
+ ( AssertionInfo const& info,
+ AssertionReaction& reaction ) = 0;
+ virtual void handleUnexpectedInflightException
+ ( AssertionInfo const& info,
+ std::string const& message,
+ AssertionReaction& reaction ) = 0;
+ virtual void handleIncomplete
+ ( AssertionInfo const& info ) = 0;
+ virtual void handleNonExpr
+ ( AssertionInfo const &info,
+ ResultWas::OfType resultType,
+ AssertionReaction &reaction ) = 0;
+
+
+
+ virtual bool lastAssertionPassed() = 0;
+ virtual void assertionPassed() = 0;
+
+ // Deprecated, do not use:
+ virtual std::string getCurrentTestName() const = 0;
+ virtual const AssertionResult* getLastResult() const = 0;
+ virtual void exceptionEarlyReported() = 0;
+ };
+
+ IResultCapture& getResultCapture();
+}
+
+#endif // TWOBLUECUBES_CATCH_INTERFACES_CAPTURE_H_INCLUDED
diff --git a/include/internal/catch_interfaces_config.cpp b/include/internal/catch_interfaces_config.cpp
new file mode 100644
index 0000000..b6f5daa
--- /dev/null
+++ b/include/internal/catch_interfaces_config.cpp
@@ -0,0 +1,5 @@
+#include "internal/catch_interfaces_config.h"
+
+namespace Catch {
+ IConfig::~IConfig() = default;
+}
diff --git a/include/internal/catch_interfaces_config.h b/include/internal/catch_interfaces_config.h
new file mode 100644
index 0000000..2584ccc
--- /dev/null
+++ b/include/internal/catch_interfaces_config.h
@@ -0,0 +1,80 @@
+/*
+ * Created by Phil on 05/06/2012.
+ * Copyright 2012 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_INTERFACES_CONFIG_H_INCLUDED
+#define TWOBLUECUBES_CATCH_INTERFACES_CONFIG_H_INCLUDED
+
+#include "catch_common.h"
+
+#include <iosfwd>
+#include <string>
+#include <vector>
+#include <memory>
+
+namespace Catch {
+
+ enum class Verbosity {
+ Quiet = 0,
+ Normal,
+ High
+ };
+
+ struct WarnAbout { enum What {
+ Nothing = 0x00,
+ NoAssertions = 0x01
+ }; };
+
+ struct ShowDurations { enum OrNot {
+ DefaultForReporter,
+ Always,
+ Never
+ }; };
+ struct RunTests { enum InWhatOrder {
+ InDeclarationOrder,
+ InLexicographicalOrder,
+ InRandomOrder
+ }; };
+ struct UseColour { enum YesOrNo {
+ Auto,
+ Yes,
+ No
+ }; };
+ struct WaitForKeypress { enum When {
+ Never,
+ BeforeStart = 1,
+ BeforeExit = 2,
+ BeforeStartAndExit = BeforeStart | BeforeExit
+ }; };
+
+ class TestSpec;
+
+ struct IConfig : NonCopyable {
+
+ virtual ~IConfig();
+
+ virtual bool allowThrows() const = 0;
+ virtual std::ostream& stream() const = 0;
+ virtual std::string name() const = 0;
+ virtual bool includeSuccessfulResults() const = 0;
+ virtual bool shouldDebugBreak() const = 0;
+ virtual bool warnAboutMissingAssertions() const = 0;
+ virtual int abortAfter() const = 0;
+ virtual bool showInvisibles() const = 0;
+ virtual ShowDurations::OrNot showDurations() const = 0;
+ virtual TestSpec const& testSpec() const = 0;
+ virtual RunTests::InWhatOrder runOrder() const = 0;
+ virtual unsigned int rngSeed() const = 0;
+ virtual int benchmarkResolutionMultiple() const = 0;
+ virtual UseColour::YesOrNo useColour() const = 0;
+ virtual std::vector<std::string> const& getSectionsToRun() const = 0;
+ virtual Verbosity verbosity() const = 0;
+ };
+
+ using IConfigPtr = std::shared_ptr<IConfig const>;
+}
+
+#endif // TWOBLUECUBES_CATCH_INTERFACES_CONFIG_H_INCLUDED
diff --git a/include/internal/catch_interfaces_exception.cpp b/include/internal/catch_interfaces_exception.cpp
new file mode 100644
index 0000000..8494a2c
--- /dev/null
+++ b/include/internal/catch_interfaces_exception.cpp
@@ -0,0 +1,6 @@
+#include "internal/catch_interfaces_exception.h"
+
+namespace Catch {
+ IExceptionTranslator::~IExceptionTranslator() = default;
+ IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() = default;
+}
diff --git a/include/internal/catch_interfaces_exception.h b/include/internal/catch_interfaces_exception.h
new file mode 100644
index 0000000..430701c
--- /dev/null
+++ b/include/internal/catch_interfaces_exception.h
@@ -0,0 +1,83 @@
+/*
+ * Created by Phil on 20/04/2011.
+ * Copyright 2011 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_INTERFACES_EXCEPTION_H_INCLUDED
+#define TWOBLUECUBES_CATCH_INTERFACES_EXCEPTION_H_INCLUDED
+
+#include "catch_interfaces_registry_hub.h"
+
+#if defined(CATCH_CONFIG_DISABLE)
+ #define INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( translatorName, signature) \
+ static std::string translatorName( signature )
+#endif
+
+#include <exception>
+#include <string>
+#include <vector>
+
+namespace Catch {
+ using exceptionTranslateFunction = std::string(*)();
+
+ struct IExceptionTranslator;
+ using ExceptionTranslators = std::vector<std::unique_ptr<IExceptionTranslator const>>;
+
+ struct IExceptionTranslator {
+ virtual ~IExceptionTranslator();
+ virtual std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const = 0;
+ };
+
+ struct IExceptionTranslatorRegistry {
+ virtual ~IExceptionTranslatorRegistry();
+
+ virtual std::string translateActiveException() const = 0;
+ };
+
+ class ExceptionTranslatorRegistrar {
+ template<typename T>
+ class ExceptionTranslator : public IExceptionTranslator {
+ public:
+
+ ExceptionTranslator( std::string(*translateFunction)( T& ) )
+ : m_translateFunction( translateFunction )
+ {}
+
+ std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const override {
+ try {
+ if( it == itEnd )
+ std::rethrow_exception(std::current_exception());
+ else
+ return (*it)->translate( it+1, itEnd );
+ }
+ catch( T& ex ) {
+ return m_translateFunction( ex );
+ }
+ }
+
+ protected:
+ std::string(*m_translateFunction)( T& );
+ };
+
+ public:
+ template<typename T>
+ ExceptionTranslatorRegistrar( std::string(*translateFunction)( T& ) ) {
+ getMutableRegistryHub().registerTranslator
+ ( new ExceptionTranslator<T>( translateFunction ) );
+ }
+ };
+}
+
+///////////////////////////////////////////////////////////////////////////////
+#define INTERNAL_CATCH_TRANSLATE_EXCEPTION2( translatorName, signature ) \
+ static std::string translatorName( signature ); \
+ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
+ namespace{ Catch::ExceptionTranslatorRegistrar INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionRegistrar )( &translatorName ); } \
+ CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
+ static std::string translatorName( signature )
+
+#define INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION2( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature )
+
+#endif // TWOBLUECUBES_CATCH_INTERFACES_EXCEPTION_H_INCLUDED
diff --git a/include/internal/catch_interfaces_registry_hub.cpp b/include/internal/catch_interfaces_registry_hub.cpp
new file mode 100644
index 0000000..bd5b808
--- /dev/null
+++ b/include/internal/catch_interfaces_registry_hub.cpp
@@ -0,0 +1,6 @@
+#include "internal/catch_interfaces_registry_hub.h"
+
+namespace Catch {
+ IRegistryHub::~IRegistryHub() = default;
+ IMutableRegistryHub::~IMutableRegistryHub() = default;
+}
diff --git a/include/internal/catch_interfaces_registry_hub.h b/include/internal/catch_interfaces_registry_hub.h
new file mode 100644
index 0000000..1afbbec
--- /dev/null
+++ b/include/internal/catch_interfaces_registry_hub.h
@@ -0,0 +1,59 @@
+/*
+ * Created by Phil on 5/8/2012.
+ * Copyright 2012 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_INTERFACES_REGISTRY_HUB_H_INCLUDED
+#define TWOBLUECUBES_CATCH_INTERFACES_REGISTRY_HUB_H_INCLUDED
+
+#include "catch_common.h"
+
+#include <string>
+#include <memory>
+
+namespace Catch {
+
+ class TestCase;
+ struct ITestCaseRegistry;
+ struct IExceptionTranslatorRegistry;
+ struct IExceptionTranslator;
+ struct IReporterRegistry;
+ struct IReporterFactory;
+ struct ITagAliasRegistry;
+ class StartupExceptionRegistry;
+
+ using IReporterFactoryPtr = std::shared_ptr<IReporterFactory>;
+
+ struct IRegistryHub {
+ virtual ~IRegistryHub();
+
+ virtual IReporterRegistry const& getReporterRegistry() const = 0;
+ virtual ITestCaseRegistry const& getTestCaseRegistry() const = 0;
+ virtual ITagAliasRegistry const& getTagAliasRegistry() const = 0;
+
+ virtual IExceptionTranslatorRegistry& getExceptionTranslatorRegistry() = 0;
+
+
+ virtual StartupExceptionRegistry const& getStartupExceptionRegistry() const = 0;
+ };
+
+ struct IMutableRegistryHub {
+ virtual ~IMutableRegistryHub();
+ virtual void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) = 0;
+ virtual void registerListener( IReporterFactoryPtr const& factory ) = 0;
+ virtual void registerTest( TestCase const& testInfo ) = 0;
+ virtual void registerTranslator( const IExceptionTranslator* translator ) = 0;
+ virtual void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) = 0;
+ virtual void registerStartupException() noexcept = 0;
+ };
+
+ IRegistryHub& getRegistryHub();
+ IMutableRegistryHub& getMutableRegistryHub();
+ void cleanUp();
+ std::string translateActiveException();
+
+}
+
+#endif // TWOBLUECUBES_CATCH_INTERFACES_REGISTRY_HUB_H_INCLUDED
diff --git a/include/internal/catch_interfaces_reporter.cpp b/include/internal/catch_interfaces_reporter.cpp
new file mode 100644
index 0000000..129a5f4
--- /dev/null
+++ b/include/internal/catch_interfaces_reporter.cpp
@@ -0,0 +1,135 @@
+/*
+ * Created by Martin on 19/07/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_interfaces_reporter.h"
+#include "../reporters/catch_reporter_multi.h"
+
+namespace Catch {
+
+ ReporterConfig::ReporterConfig( IConfigPtr const& _fullConfig )
+ : m_stream( &_fullConfig->stream() ), m_fullConfig( _fullConfig ) {}
+
+ ReporterConfig::ReporterConfig( IConfigPtr const& _fullConfig, std::ostream& _stream )
+ : m_stream( &_stream ), m_fullConfig( _fullConfig ) {}
+
+ std::ostream& ReporterConfig::stream() const { return *m_stream; }
+ IConfigPtr ReporterConfig::fullConfig() const { return m_fullConfig; }
+
+
+ TestRunInfo::TestRunInfo( std::string const& _name ) : name( _name ) {}
+
+ GroupInfo::GroupInfo( std::string const& _name,
+ std::size_t _groupIndex,
+ std::size_t _groupsCount )
+ : name( _name ),
+ groupIndex( _groupIndex ),
+ groupsCounts( _groupsCount )
+ {}
+
+ AssertionStats::AssertionStats( AssertionResult const& _assertionResult,
+ std::vector<MessageInfo> const& _infoMessages,
+ Totals const& _totals )
+ : assertionResult( _assertionResult ),
+ infoMessages( _infoMessages ),
+ totals( _totals )
+ {
+ assertionResult.m_resultData.lazyExpression.m_transientExpression = _assertionResult.m_resultData.lazyExpression.m_transientExpression;
+
+ if( assertionResult.hasMessage() ) {
+ // Copy message into messages list.
+ // !TBD This should have been done earlier, somewhere
+ MessageBuilder builder( assertionResult.getTestMacroName(), assertionResult.getSourceInfo(), assertionResult.getResultType() );
+ builder << assertionResult.getMessage();
+ builder.m_info.message = builder.m_stream.str();
+
+ infoMessages.push_back( builder.m_info );
+ }
+ }
+
+ AssertionStats::~AssertionStats() = default;
+
+ SectionStats::SectionStats( SectionInfo const& _sectionInfo,
+ Counts const& _assertions,
+ double _durationInSeconds,
+ bool _missingAssertions )
+ : sectionInfo( _sectionInfo ),
+ assertions( _assertions ),
+ durationInSeconds( _durationInSeconds ),
+ missingAssertions( _missingAssertions )
+ {}
+
+ SectionStats::~SectionStats() = default;
+
+
+ TestCaseStats::TestCaseStats( TestCaseInfo const& _testInfo,
+ Totals const& _totals,
+ std::string const& _stdOut,
+ std::string const& _stdErr,
+ bool _aborting )
+ : testInfo( _testInfo ),
+ totals( _totals ),
+ stdOut( _stdOut ),
+ stdErr( _stdErr ),
+ aborting( _aborting )
+ {}
+
+ TestCaseStats::~TestCaseStats() = default;
+
+
+ TestGroupStats::TestGroupStats( GroupInfo const& _groupInfo,
+ Totals const& _totals,
+ bool _aborting )
+ : groupInfo( _groupInfo ),
+ totals( _totals ),
+ aborting( _aborting )
+ {}
+
+ TestGroupStats::TestGroupStats( GroupInfo const& _groupInfo )
+ : groupInfo( _groupInfo ),
+ aborting( false )
+ {}
+
+ TestGroupStats::~TestGroupStats() = default;
+
+ TestRunStats::TestRunStats( TestRunInfo const& _runInfo,
+ Totals const& _totals,
+ bool _aborting )
+ : runInfo( _runInfo ),
+ totals( _totals ),
+ aborting( _aborting )
+ {}
+
+ TestRunStats::~TestRunStats() = default;
+
+ void IStreamingReporter::fatalErrorEncountered( StringRef ) {}
+ bool IStreamingReporter::isMulti() const { return false; }
+
+ IReporterFactory::~IReporterFactory() = default;
+ IReporterRegistry::~IReporterRegistry() = default;
+
+ void addReporter( IStreamingReporterPtr& existingReporter, IStreamingReporterPtr&& additionalReporter ) {
+
+ if( !existingReporter ) {
+ existingReporter = std::move( additionalReporter );
+ return;
+ }
+
+ MultipleReporters* multi = nullptr;
+
+ if( existingReporter->isMulti() ) {
+ multi = static_cast<MultipleReporters*>( existingReporter.get() );
+ }
+ else {
+ auto newMulti = std::unique_ptr<MultipleReporters>( new MultipleReporters );
+ newMulti->add( std::move( existingReporter ) );
+ multi = newMulti.get();
+ existingReporter = std::move( newMulti );
+ }
+ multi->add( std::move( additionalReporter ) );
+ }
+
+} // end namespace Catch
diff --git a/include/internal/catch_interfaces_reporter.h b/include/internal/catch_interfaces_reporter.h
new file mode 100644
index 0000000..b620abb
--- /dev/null
+++ b/include/internal/catch_interfaces_reporter.h
@@ -0,0 +1,233 @@
+/*
+ * Created by Phil on 31/12/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_INTERFACES_REPORTER_H_INCLUDED
+#define TWOBLUECUBES_CATCH_INTERFACES_REPORTER_H_INCLUDED
+
+#include "catch_section_info.h"
+#include "catch_common.h"
+#include "catch_config.hpp"
+#include "catch_totals.h"
+#include "catch_test_case_info.h"
+#include "catch_assertionresult.h"
+#include "catch_message.h"
+#include "catch_option.hpp"
+#include "catch_stringref.h"
+
+
+#include <string>
+#include <iosfwd>
+#include <map>
+#include <set>
+#include <memory>
+
+namespace Catch {
+
+ struct ReporterConfig {
+ explicit ReporterConfig( IConfigPtr const& _fullConfig );
+
+ ReporterConfig( IConfigPtr const& _fullConfig, std::ostream& _stream );
+
+ std::ostream& stream() const;
+ IConfigPtr fullConfig() const;
+
+ private:
+ std::ostream* m_stream;
+ IConfigPtr m_fullConfig;
+ };
+
+ struct ReporterPreferences {
+ bool shouldRedirectStdOut = false;
+ };
+
+ template<typename T>
+ struct LazyStat : Option<T> {
+ LazyStat& operator=( T const& _value ) {
+ Option<T>::operator=( _value );
+ used = false;
+ return *this;
+ }
+ void reset() {
+ Option<T>::reset();
+ used = false;
+ }
+ bool used = false;
+ };
+
+ struct TestRunInfo {
+ TestRunInfo( std::string const& _name );
+ std::string name;
+ };
+ struct GroupInfo {
+ GroupInfo( std::string const& _name,
+ std::size_t _groupIndex,
+ std::size_t _groupsCount );
+
+ std::string name;
+ std::size_t groupIndex;
+ std::size_t groupsCounts;
+ };
+
+ struct AssertionStats {
+ AssertionStats( AssertionResult const& _assertionResult,
+ std::vector<MessageInfo> const& _infoMessages,
+ Totals const& _totals );
+
+ AssertionStats( AssertionStats const& ) = default;
+ AssertionStats( AssertionStats && ) = default;
+ AssertionStats& operator = ( AssertionStats const& ) = default;
+ AssertionStats& operator = ( AssertionStats && ) = default;
+ virtual ~AssertionStats();
+
+ AssertionResult assertionResult;
+ std::vector<MessageInfo> infoMessages;
+ Totals totals;
+ };
+
+ struct SectionStats {
+ SectionStats( SectionInfo const& _sectionInfo,
+ Counts const& _assertions,
+ double _durationInSeconds,
+ bool _missingAssertions );
+ SectionStats( SectionStats const& ) = default;
+ SectionStats( SectionStats && ) = default;
+ SectionStats& operator = ( SectionStats const& ) = default;
+ SectionStats& operator = ( SectionStats && ) = default;
+ virtual ~SectionStats();
+
+ SectionInfo sectionInfo;
+ Counts assertions;
+ double durationInSeconds;
+ bool missingAssertions;
+ };
+
+ struct TestCaseStats {
+ TestCaseStats( TestCaseInfo const& _testInfo,
+ Totals const& _totals,
+ std::string const& _stdOut,
+ std::string const& _stdErr,
+ bool _aborting );
+
+ TestCaseStats( TestCaseStats const& ) = default;
+ TestCaseStats( TestCaseStats && ) = default;
+ TestCaseStats& operator = ( TestCaseStats const& ) = default;
+ TestCaseStats& operator = ( TestCaseStats && ) = default;
+ virtual ~TestCaseStats();
+
+ TestCaseInfo testInfo;
+ Totals totals;
+ std::string stdOut;
+ std::string stdErr;
+ bool aborting;
+ };
+
+ struct TestGroupStats {
+ TestGroupStats( GroupInfo const& _groupInfo,
+ Totals const& _totals,
+ bool _aborting );
+ TestGroupStats( GroupInfo const& _groupInfo );
+
+ TestGroupStats( TestGroupStats const& ) = default;
+ TestGroupStats( TestGroupStats && ) = default;
+ TestGroupStats& operator = ( TestGroupStats const& ) = default;
+ TestGroupStats& operator = ( TestGroupStats && ) = default;
+ virtual ~TestGroupStats();
+
+ GroupInfo groupInfo;
+ Totals totals;
+ bool aborting;
+ };
+
+ struct TestRunStats {
+ TestRunStats( TestRunInfo const& _runInfo,
+ Totals const& _totals,
+ bool _aborting );
+
+ TestRunStats( TestRunStats const& ) = default;
+ TestRunStats( TestRunStats && ) = default;
+ TestRunStats& operator = ( TestRunStats const& ) = default;
+ TestRunStats& operator = ( TestRunStats && ) = default;
+ virtual ~TestRunStats();
+
+ TestRunInfo runInfo;
+ Totals totals;
+ bool aborting;
+ };
+
+ struct BenchmarkInfo {
+ std::string name;
+ };
+ struct BenchmarkStats {
+ BenchmarkInfo info;
+ std::size_t iterations;
+ uint64_t elapsedTimeInNanoseconds;
+ };
+
+ struct IStreamingReporter {
+ virtual ~IStreamingReporter() = default;
+
+ // Implementing class must also provide the following static methods:
+ // static std::string getDescription();
+ // static std::set<Verbosity> getSupportedVerbosities()
+
+ virtual ReporterPreferences getPreferences() const = 0;
+
+ virtual void noMatchingTestCases( std::string const& spec ) = 0;
+
+ virtual void testRunStarting( TestRunInfo const& testRunInfo ) = 0;
+ virtual void testGroupStarting( GroupInfo const& groupInfo ) = 0;
+
+ virtual void testCaseStarting( TestCaseInfo const& testInfo ) = 0;
+ virtual void sectionStarting( SectionInfo const& sectionInfo ) = 0;
+
+ // *** experimental ***
+ virtual void benchmarkStarting( BenchmarkInfo const& ) {}
+
+ virtual void assertionStarting( AssertionInfo const& assertionInfo ) = 0;
+
+ // The return value indicates if the messages buffer should be cleared:
+ virtual bool assertionEnded( AssertionStats const& assertionStats ) = 0;
+
+ // *** experimental ***
+ virtual void benchmarkEnded( BenchmarkStats const& ) {}
+
+ virtual void sectionEnded( SectionStats const& sectionStats ) = 0;
+ virtual void testCaseEnded( TestCaseStats const& testCaseStats ) = 0;
+ virtual void testGroupEnded( TestGroupStats const& testGroupStats ) = 0;
+ virtual void testRunEnded( TestRunStats const& testRunStats ) = 0;
+
+ virtual void skipTest( TestCaseInfo const& testInfo ) = 0;
+
+ // Default empty implementation provided
+ virtual void fatalErrorEncountered( StringRef name );
+
+ virtual bool isMulti() const;
+ };
+ using IStreamingReporterPtr = std::unique_ptr<IStreamingReporter>;
+
+ struct IReporterFactory {
+ virtual ~IReporterFactory();
+ virtual IStreamingReporterPtr create( ReporterConfig const& config ) const = 0;
+ virtual std::string getDescription() const = 0;
+ };
+ using IReporterFactoryPtr = std::shared_ptr<IReporterFactory>;
+
+ struct IReporterRegistry {
+ using FactoryMap = std::map<std::string, IReporterFactoryPtr>;
+ using Listeners = std::vector<IReporterFactoryPtr>;
+
+ virtual ~IReporterRegistry();
+ virtual IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const = 0;
+ virtual FactoryMap const& getFactories() const = 0;
+ virtual Listeners const& getListeners() const = 0;
+ };
+
+ void addReporter( IStreamingReporterPtr& existingReporter, IStreamingReporterPtr&& additionalReporter );
+
+} // end namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_INTERFACES_REPORTER_H_INCLUDED
diff --git a/include/internal/catch_interfaces_runner.cpp b/include/internal/catch_interfaces_runner.cpp
new file mode 100644
index 0000000..2b052eb
--- /dev/null
+++ b/include/internal/catch_interfaces_runner.cpp
@@ -0,0 +1,5 @@
+#include "internal/catch_interfaces_runner.h"
+
+namespace Catch {
+ IRunner::~IRunner() = default;
+}
diff --git a/include/internal/catch_interfaces_runner.h b/include/internal/catch_interfaces_runner.h
new file mode 100644
index 0000000..a0deaf7
--- /dev/null
+++ b/include/internal/catch_interfaces_runner.h
@@ -0,0 +1,19 @@
+/*
+ * Created by Phil on 07/01/2011.
+ * Copyright 2011 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_INTERFACES_RUNNER_H_INCLUDED
+#define TWOBLUECUBES_CATCH_INTERFACES_RUNNER_H_INCLUDED
+
+namespace Catch {
+
+ struct IRunner {
+ virtual ~IRunner();
+ virtual bool aborting() const = 0;
+ };
+}
+
+#endif // TWOBLUECUBES_CATCH_INTERFACES_RUNNER_H_INCLUDED
diff --git a/include/internal/catch_interfaces_tag_alias_registry.h b/include/internal/catch_interfaces_tag_alias_registry.h
new file mode 100644
index 0000000..24bc535
--- /dev/null
+++ b/include/internal/catch_interfaces_tag_alias_registry.h
@@ -0,0 +1,28 @@
+/*
+ * Created by Phil on 27/6/2014.
+ * Copyright 2014 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_INTERFACES_TAG_ALIAS_REGISTRY_H_INCLUDED
+#define TWOBLUECUBES_CATCH_INTERFACES_TAG_ALIAS_REGISTRY_H_INCLUDED
+
+#include <string>
+
+namespace Catch {
+
+ struct TagAlias;
+
+ struct ITagAliasRegistry {
+ virtual ~ITagAliasRegistry();
+ // Nullptr if not present
+ virtual TagAlias const* find( std::string const& alias ) const = 0;
+ virtual std::string expandAliases( std::string const& unexpandedTestSpec ) const = 0;
+
+ static ITagAliasRegistry const& get();
+ };
+
+} // end namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_INTERFACES_TAG_ALIAS_REGISTRY_H_INCLUDED
diff --git a/include/internal/catch_interfaces_testcase.cpp b/include/internal/catch_interfaces_testcase.cpp
new file mode 100644
index 0000000..35c3db0
--- /dev/null
+++ b/include/internal/catch_interfaces_testcase.cpp
@@ -0,0 +1,6 @@
+#include "internal/catch_interfaces_testcase.h"
+
+namespace Catch {
+ ITestInvoker::~ITestInvoker() = default;
+ ITestCaseRegistry::~ITestCaseRegistry() = default;
+}
diff --git a/include/internal/catch_interfaces_testcase.h b/include/internal/catch_interfaces_testcase.h
new file mode 100644
index 0000000..9e02b14
--- /dev/null
+++ b/include/internal/catch_interfaces_testcase.h
@@ -0,0 +1,40 @@
+/*
+ * Created by Phil on 07/01/2011.
+ * Copyright 2011 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_INTERFACES_TESTCASE_H_INCLUDED
+#define TWOBLUECUBES_CATCH_INTERFACES_TESTCASE_H_INCLUDED
+
+#include <vector>
+#include <memory>
+
+namespace Catch {
+
+ class TestSpec;
+
+ struct ITestInvoker {
+ virtual void invoke () const = 0;
+ virtual ~ITestInvoker();
+ };
+
+ using ITestCasePtr = std::shared_ptr<ITestInvoker>;
+
+ class TestCase;
+ struct IConfig;
+
+ struct ITestCaseRegistry {
+ virtual ~ITestCaseRegistry();
+ virtual std::vector<TestCase> const& getAllTests() const = 0;
+ virtual std::vector<TestCase> const& getAllTestsSorted( IConfig const& config ) const = 0;
+ };
+
+ bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config );
+ std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config );
+ std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config );
+
+}
+
+#endif // TWOBLUECUBES_CATCH_INTERFACES_TESTCASE_H_INCLUDED
diff --git a/include/internal/catch_leak_detector.cpp b/include/internal/catch_leak_detector.cpp
new file mode 100644
index 0000000..36aba6a
--- /dev/null
+++ b/include/internal/catch_leak_detector.cpp
@@ -0,0 +1,32 @@
+/*
+ * Created by Martin on 12/07/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_leak_detector.h"
+
+
+#ifdef CATCH_CONFIG_WINDOWS_CRTDBG
+#include <crtdbg.h>
+
+namespace Catch {
+
+ LeakDetector::LeakDetector() {
+ int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
+ flag |= _CRTDBG_LEAK_CHECK_DF;
+ flag |= _CRTDBG_ALLOC_MEM_DF;
+ _CrtSetDbgFlag(flag);
+ _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+ _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
+ // Change this to leaking allocation's number to break there
+ _CrtSetBreakAlloc(-1);
+ }
+}
+
+#else
+
+ Catch::LeakDetector::LeakDetector() {}
+
+#endif
diff --git a/include/internal/catch_leak_detector.h b/include/internal/catch_leak_detector.h
new file mode 100644
index 0000000..bfb0b42
--- /dev/null
+++ b/include/internal/catch_leak_detector.h
@@ -0,0 +1,17 @@
+/*
+ * Created by Martin on 12/07/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)
+ */
+#ifndef TWOBLUECUBES_CATCH_LEAK_DETECTOR_H_INCLUDED
+#define TWOBLUECUBES_CATCH_LEAK_DETECTOR_H_INCLUDED
+
+namespace Catch {
+
+ struct LeakDetector {
+ LeakDetector();
+ };
+
+}
+#endif // TWOBLUECUBES_CATCH_LEAK_DETECTOR_H_INCLUDED
diff --git a/include/internal/catch_list.cpp b/include/internal/catch_list.cpp
new file mode 100644
index 0000000..3efad0b
--- /dev/null
+++ b/include/internal/catch_list.cpp
@@ -0,0 +1,166 @@
+/*
+ * Created by Phil on 5/11/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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_list.h"
+
+#include "catch_interfaces_registry_hub.h"
+#include "catch_interfaces_reporter.h"
+#include "catch_interfaces_testcase.h"
+
+#include "catch_stream.h"
+#include "catch_text.h"
+
+#include "catch_console_colour.h"
+#include "catch_test_spec_parser.h"
+#include "catch_tostring.h"
+#include "catch_string_manip.h"
+
+#include <limits>
+#include <algorithm>
+#include <iomanip>
+
+namespace Catch {
+
+ std::size_t listTests( Config const& config ) {
+ TestSpec testSpec = config.testSpec();
+ if( config.testSpec().hasFilters() )
+ Catch::cout() << "Matching test cases:\n";
+ else {
+ Catch::cout() << "All available test cases:\n";
+ testSpec = TestSpecParser( ITagAliasRegistry::get() ).parse( "*" ).testSpec();
+ }
+
+ auto matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config );
+ for( auto const& testCaseInfo : matchedTestCases ) {
+ Colour::Code colour = testCaseInfo.isHidden()
+ ? Colour::SecondaryText
+ : Colour::None;
+ Colour colourGuard( colour );
+
+ Catch::cout() << Column( testCaseInfo.name ).initialIndent( 2 ).indent( 4 ) << "\n";
+ if( config.verbosity() >= Verbosity::High ) {
+ Catch::cout() << Column( Catch::Detail::stringify( testCaseInfo.lineInfo ) ).indent(4) << std::endl;
+ std::string description = testCaseInfo.description;
+ if( description.empty() )
+ description = "(NO DESCRIPTION)";
+ Catch::cout() << Column( description ).indent(4) << std::endl;
+ }
+ if( !testCaseInfo.tags.empty() )
+ Catch::cout() << Column( testCaseInfo.tagsAsString() ).indent( 6 ) << "\n";
+ }
+
+ if( !config.testSpec().hasFilters() )
+ Catch::cout() << pluralise( matchedTestCases.size(), "test case" ) << '\n' << std::endl;
+ else
+ Catch::cout() << pluralise( matchedTestCases.size(), "matching test case" ) << '\n' << std::endl;
+ return matchedTestCases.size();
+ }
+
+ std::size_t listTestsNamesOnly( Config const& config ) {
+ TestSpec testSpec = config.testSpec();
+ if( !config.testSpec().hasFilters() )
+ testSpec = TestSpecParser( ITagAliasRegistry::get() ).parse( "*" ).testSpec();
+ std::size_t matchedTests = 0;
+ std::vector<TestCase> matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config );
+ for( auto const& testCaseInfo : matchedTestCases ) {
+ matchedTests++;
+ if( startsWith( testCaseInfo.name, '#' ) )
+ Catch::cout() << '"' << testCaseInfo.name << '"';
+ else
+ Catch::cout() << testCaseInfo.name;
+ if ( config.verbosity() >= Verbosity::High )
+ Catch::cout() << "\t@" << testCaseInfo.lineInfo;
+ Catch::cout() << std::endl;
+ }
+ return matchedTests;
+ }
+
+ void TagInfo::add( std::string const& spelling ) {
+ ++count;
+ spellings.insert( spelling );
+ }
+
+ std::string TagInfo::all() const {
+ std::string out;
+ for( auto const& spelling : spellings )
+ out += "[" + spelling + "]";
+ return out;
+ }
+
+ std::size_t listTags( Config const& config ) {
+ TestSpec testSpec = config.testSpec();
+ if( config.testSpec().hasFilters() )
+ Catch::cout() << "Tags for matching test cases:\n";
+ else {
+ Catch::cout() << "All available tags:\n";
+ testSpec = TestSpecParser( ITagAliasRegistry::get() ).parse( "*" ).testSpec();
+ }
+
+ std::map<std::string, TagInfo> tagCounts;
+
+ std::vector<TestCase> matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config );
+ for( auto const& testCase : matchedTestCases ) {
+ for( auto const& tagName : testCase.getTestCaseInfo().tags ) {
+ std::string lcaseTagName = toLower( tagName );
+ auto countIt = tagCounts.find( lcaseTagName );
+ if( countIt == tagCounts.end() )
+ countIt = tagCounts.insert( std::make_pair( lcaseTagName, TagInfo() ) ).first;
+ countIt->second.add( tagName );
+ }
+ }
+
+ for( auto const& tagCount : tagCounts ) {
+ ReusableStringStream rss;
+ rss << " " << std::setw(2) << tagCount.second.count << " ";
+ auto str = rss.str();
+ auto wrapper = Column( tagCount.second.all() )
+ .initialIndent( 0 )
+ .indent( str.size() )
+ .width( CATCH_CONFIG_CONSOLE_WIDTH-10 );
+ Catch::cout() << str << wrapper << '\n';
+ }
+ Catch::cout() << pluralise( tagCounts.size(), "tag" ) << '\n' << std::endl;
+ return tagCounts.size();
+ }
+
+ std::size_t listReporters( Config const& /*config*/ ) {
+ Catch::cout() << "Available reporters:\n";
+ IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories();
+ std::size_t maxNameLen = 0;
+ for( auto const& factoryKvp : factories )
+ maxNameLen = (std::max)( maxNameLen, factoryKvp.first.size() );
+
+ for( auto const& factoryKvp : factories ) {
+ Catch::cout()
+ << Column( factoryKvp.first + ":" )
+ .indent(2)
+ .width( 5+maxNameLen )
+ + Column( factoryKvp.second->getDescription() )
+ .initialIndent(0)
+ .indent(2)
+ .width( CATCH_CONFIG_CONSOLE_WIDTH - maxNameLen-8 )
+ << "\n";
+ }
+ Catch::cout() << std::endl;
+ return factories.size();
+ }
+
+ Option<std::size_t> list( Config const& config ) {
+ Option<std::size_t> listedCount;
+ if( config.listTests() )
+ listedCount = listedCount.valueOr(0) + listTests( config );
+ if( config.listTestNamesOnly() )
+ listedCount = listedCount.valueOr(0) + listTestsNamesOnly( config );
+ if( config.listTags() )
+ listedCount = listedCount.valueOr(0) + listTags( config );
+ if( config.listReporters() )
+ listedCount = listedCount.valueOr(0) + listReporters( config );
+ return listedCount;
+ }
+
+} // end namespace Catch
diff --git a/include/internal/catch_list.h b/include/internal/catch_list.h
new file mode 100644
index 0000000..4bc96ec
--- /dev/null
+++ b/include/internal/catch_list.h
@@ -0,0 +1,38 @@
+/*
+ * Created by Phil on 5/11/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_LIST_H_INCLUDED
+#define TWOBLUECUBES_CATCH_LIST_H_INCLUDED
+
+#include "catch_option.hpp"
+#include "catch_config.hpp"
+
+#include <set>
+
+namespace Catch {
+
+ std::size_t listTests( Config const& config );
+
+ std::size_t listTestsNamesOnly( Config const& config );
+
+ struct TagInfo {
+ void add( std::string const& spelling );
+ std::string all() const;
+
+ std::set<std::string> spellings;
+ std::size_t count = 0;
+ };
+
+ std::size_t listTags( Config const& config );
+
+ std::size_t listReporters( Config const& /*config*/ );
+
+ Option<std::size_t> list( Config const& config );
+
+} // end namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_LIST_H_INCLUDED
diff --git a/include/internal/catch_matchers.cpp b/include/internal/catch_matchers.cpp
new file mode 100644
index 0000000..32104a1
--- /dev/null
+++ b/include/internal/catch_matchers.cpp
@@ -0,0 +1,28 @@
+/*
+ * Created by Phil Nash on 19/07/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_matchers.h"
+
+namespace Catch {
+namespace Matchers {
+ namespace Impl {
+
+ std::string MatcherUntypedBase::toString() const {
+ if( m_cachedToString.empty() )
+ m_cachedToString = describe();
+ return m_cachedToString;
+ }
+
+ MatcherUntypedBase::~MatcherUntypedBase() = default;
+
+ } // namespace Impl
+} // namespace Matchers
+
+using namespace Matchers;
+using Matchers::Impl::MatcherBase;
+
+} // namespace Catch
diff --git a/include/internal/catch_matchers.h b/include/internal/catch_matchers.h
new file mode 100644
index 0000000..f2e3aee
--- /dev/null
+++ b/include/internal/catch_matchers.h
@@ -0,0 +1,158 @@
+/*
+ * Created by Phil Nash on 04/03/2012.
+ * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_MATCHERS_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_MATCHERS_HPP_INCLUDED
+
+#include "catch_common.h"
+
+#include <string>
+#include <vector>
+
+namespace Catch {
+namespace Matchers {
+ namespace Impl {
+
+ template<typename ArgT> struct MatchAllOf;
+ template<typename ArgT> struct MatchAnyOf;
+ template<typename ArgT> struct MatchNotOf;
+
+ class MatcherUntypedBase {
+ public:
+ MatcherUntypedBase() = default;
+ MatcherUntypedBase ( MatcherUntypedBase const& ) = default;
+ MatcherUntypedBase& operator = ( MatcherUntypedBase const& ) = delete;
+ std::string toString() const;
+
+ protected:
+ virtual ~MatcherUntypedBase();
+ virtual std::string describe() const = 0;
+ mutable std::string m_cachedToString;
+ };
+
+ template<typename ObjectT>
+ struct MatcherMethod {
+ virtual bool match( ObjectT const& arg ) const = 0;
+ };
+ template<typename PtrT>
+ struct MatcherMethod<PtrT*> {
+ virtual bool match( PtrT* arg ) const = 0;
+ };
+
+ template<typename T>
+ struct MatcherBase : MatcherUntypedBase, MatcherMethod<T> {
+
+
+ MatchAllOf<T> operator && ( MatcherBase const& other ) const;
+ MatchAnyOf<T> operator || ( MatcherBase const& other ) const;
+ MatchNotOf<T> operator ! () const;
+ };
+
+ template<typename ArgT>
+ struct MatchAllOf : MatcherBase<ArgT> {
+ bool match( ArgT const& arg ) const override {
+ for( auto matcher : m_matchers ) {
+ if (!matcher->match(arg))
+ return false;
+ }
+ return true;
+ }
+ std::string describe() const override {
+ std::string description;
+ description.reserve( 4 + m_matchers.size()*32 );
+ description += "( ";
+ bool first = true;
+ for( auto matcher : m_matchers ) {
+ if( first )
+ first = false;
+ else
+ description += " and ";
+ description += matcher->toString();
+ }
+ description += " )";
+ return description;
+ }
+
+ MatchAllOf<ArgT>& operator && ( MatcherBase<ArgT> const& other ) {
+ m_matchers.push_back( &other );
+ return *this;
+ }
+
+ std::vector<MatcherBase<ArgT> const*> m_matchers;
+ };
+ template<typename ArgT>
+ struct MatchAnyOf : MatcherBase<ArgT> {
+
+ bool match( ArgT const& arg ) const override {
+ for( auto matcher : m_matchers ) {
+ if (matcher->match(arg))
+ return true;
+ }
+ return false;
+ }
+ std::string describe() const override {
+ std::string description;
+ description.reserve( 4 + m_matchers.size()*32 );
+ description += "( ";
+ bool first = true;
+ for( auto matcher : m_matchers ) {
+ if( first )
+ first = false;
+ else
+ description += " or ";
+ description += matcher->toString();
+ }
+ description += " )";
+ return description;
+ }
+
+ MatchAnyOf<ArgT>& operator || ( MatcherBase<ArgT> const& other ) {
+ m_matchers.push_back( &other );
+ return *this;
+ }
+
+ std::vector<MatcherBase<ArgT> const*> m_matchers;
+ };
+
+ template<typename ArgT>
+ struct MatchNotOf : MatcherBase<ArgT> {
+
+ MatchNotOf( MatcherBase<ArgT> const& underlyingMatcher ) : m_underlyingMatcher( underlyingMatcher ) {}
+
+ bool match( ArgT const& arg ) const override {
+ return !m_underlyingMatcher.match( arg );
+ }
+
+ std::string describe() const override {
+ return "not " + m_underlyingMatcher.toString();
+ }
+ MatcherBase<ArgT> const& m_underlyingMatcher;
+ };
+
+ template<typename T>
+ MatchAllOf<T> MatcherBase<T>::operator && ( MatcherBase const& other ) const {
+ return MatchAllOf<T>() && *this && other;
+ }
+ template<typename T>
+ MatchAnyOf<T> MatcherBase<T>::operator || ( MatcherBase const& other ) const {
+ return MatchAnyOf<T>() || *this || other;
+ }
+ template<typename T>
+ MatchNotOf<T> MatcherBase<T>::operator ! () const {
+ return MatchNotOf<T>( *this );
+ }
+
+ } // namespace Impl
+
+} // namespace Matchers
+
+using namespace Matchers;
+using Matchers::Impl::MatcherBase;
+
+} // namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_MATCHERS_HPP_INCLUDED
diff --git a/include/internal/catch_matchers_floating.cpp b/include/internal/catch_matchers_floating.cpp
new file mode 100644
index 0000000..c6d2b1d
--- /dev/null
+++ b/include/internal/catch_matchers_floating.cpp
@@ -0,0 +1,139 @@
+/*
+ * Created by Martin on 07/11/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_matchers_floating.h"
+#include "catch_tostring.h"
+
+#include <cstdlib>
+#include <cstdint>
+#include <cstring>
+#include <stdexcept>
+
+namespace Catch {
+namespace Matchers {
+namespace Floating {
+enum class FloatingPointKind : uint8_t {
+ Float,
+ Double
+};
+}
+}
+}
+
+namespace {
+
+template <typename T>
+struct Converter;
+
+template <>
+struct Converter<float> {
+ static_assert(sizeof(float) == sizeof(int32_t), "Important ULP matcher assumption violated");
+ Converter(float f) {
+ std::memcpy(&i, &f, sizeof(f));
+ }
+ int32_t i;
+};
+
+template <>
+struct Converter<double> {
+ static_assert(sizeof(double) == sizeof(int64_t), "Important ULP matcher assumption violated");
+ Converter(double d) {
+ std::memcpy(&i, &d, sizeof(d));
+ }
+ int64_t i;
+};
+
+template <typename T>
+auto convert(T t) -> Converter<T> {
+ return Converter<T>(t);
+}
+
+template <typename FP>
+bool almostEqualUlps(FP lhs, FP rhs, int maxUlpDiff) {
+ // Comparison with NaN should always be false.
+ // This way we can rule it out before getting into the ugly details
+ if (std::isnan(lhs) || std::isnan(rhs)) {
+ return false;
+ }
+
+ auto lc = convert(lhs);
+ auto rc = convert(rhs);
+
+ if ((lc.i < 0) != (rc.i < 0)) {
+ // Potentially we can have +0 and -0
+ return lhs == rhs;
+ }
+
+ auto ulpDiff = std::abs(lc.i - rc.i);
+ return ulpDiff <= maxUlpDiff;
+}
+
+}
+
+
+namespace Catch {
+namespace Matchers {
+namespace Floating {
+ WithinAbsMatcher::WithinAbsMatcher(double target, double margin)
+ :m_target{ target }, m_margin{ margin } {
+ if (m_margin < 0) {
+ throw std::domain_error("Allowed margin difference has to be >= 0");
+ }
+ }
+
+ // Performs equivalent check of std::fabs(lhs - rhs) <= margin
+ // But without the subtraction to allow for INFINITY in comparison
+ bool WithinAbsMatcher::match(double const& matchee) const {
+ return (matchee + m_margin >= m_target) && (m_target + m_margin >= m_margin);
+ }
+
+ std::string WithinAbsMatcher::describe() const {
+ return "is within " + ::Catch::Detail::stringify(m_margin) + " of " + ::Catch::Detail::stringify(m_target);
+ }
+
+
+ WithinUlpsMatcher::WithinUlpsMatcher(double target, int ulps, FloatingPointKind baseType)
+ :m_target{ target }, m_ulps{ ulps }, m_type{ baseType } {
+ if (m_ulps < 0) {
+ throw std::domain_error("Allowed ulp difference has to be >= 0");
+ }
+ }
+
+ bool WithinUlpsMatcher::match(double const& matchee) const {
+ switch (m_type) {
+ case FloatingPointKind::Float:
+ return almostEqualUlps<float>(static_cast<float>(matchee), static_cast<float>(m_target), m_ulps);
+ case FloatingPointKind::Double:
+ return almostEqualUlps<double>(matchee, m_target, m_ulps);
+ default:
+ throw std::domain_error("Unknown FloatingPointKind value");
+ }
+ }
+
+ std::string WithinUlpsMatcher::describe() const {
+ return "is within " + std::to_string(m_ulps) + " ULPs of " + ::Catch::Detail::stringify(m_target) + ((m_type == FloatingPointKind::Float)? "f" : "");
+ }
+
+}// namespace Floating
+
+
+
+Floating::WithinUlpsMatcher WithinULP(double target, int maxUlpDiff) {
+ return Floating::WithinUlpsMatcher(target, maxUlpDiff, Floating::FloatingPointKind::Double);
+}
+
+Floating::WithinUlpsMatcher WithinULP(float target, int maxUlpDiff) {
+ return Floating::WithinUlpsMatcher(target, maxUlpDiff, Floating::FloatingPointKind::Float);
+}
+
+Floating::WithinAbsMatcher WithinAbs(double target, double margin) {
+ return Floating::WithinAbsMatcher(target, margin);
+}
+
+} // namespace Matchers
+} // namespace Catch
+
diff --git a/include/internal/catch_matchers_floating.h b/include/internal/catch_matchers_floating.h
new file mode 100644
index 0000000..ee07752
--- /dev/null
+++ b/include/internal/catch_matchers_floating.h
@@ -0,0 +1,53 @@
+/*
+ * Created by Martin on 07/11/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)
+ */
+#ifndef TWOBLUECUBES_CATCH_MATCHERS_FLOATING_H_INCLUDED
+#define TWOBLUECUBES_CATCH_MATCHERS_FLOATING_H_INCLUDED
+
+#include "catch_matchers.h"
+
+#include <type_traits>
+#include <cmath>
+
+namespace Catch {
+namespace Matchers {
+
+ namespace Floating {
+
+ enum class FloatingPointKind : uint8_t;
+
+ struct WithinAbsMatcher : MatcherBase<double> {
+ WithinAbsMatcher(double target, double margin);
+ bool match(double const& matchee) const override;
+ std::string describe() const override;
+ private:
+ double m_target;
+ double m_margin;
+ };
+
+ struct WithinUlpsMatcher : MatcherBase<double> {
+ WithinUlpsMatcher(double target, int ulps, FloatingPointKind baseType);
+ bool match(double const& matchee) const override;
+ std::string describe() const override;
+ private:
+ double m_target;
+ int m_ulps;
+ FloatingPointKind m_type;
+ };
+
+
+ } // namespace Floating
+
+ // The following functions create the actual matcher objects.
+ // This allows the types to be inferred
+ Floating::WithinUlpsMatcher WithinULP(double target, int maxUlpDiff);
+ Floating::WithinUlpsMatcher WithinULP(float target, int maxUlpDiff);
+ Floating::WithinAbsMatcher WithinAbs(double target, double margin);
+
+} // namespace Matchers
+} // namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_MATCHERS_FLOATING_H_INCLUDED
diff --git a/include/internal/catch_matchers_string.cpp b/include/internal/catch_matchers_string.cpp
new file mode 100644
index 0000000..1e3e72f
--- /dev/null
+++ b/include/internal/catch_matchers_string.cpp
@@ -0,0 +1,118 @@
+/*
+ * Created by Phil Nash on 08/02/2017.
+ * Copyright (c) 2017 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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_matchers_string.h"
+#include "catch_string_manip.h"
+#include "catch_tostring.h"
+
+#include <regex>
+
+namespace Catch {
+namespace Matchers {
+
+ namespace StdString {
+
+ CasedString::CasedString( std::string const& str, CaseSensitive::Choice caseSensitivity )
+ : m_caseSensitivity( caseSensitivity ),
+ m_str( adjustString( str ) )
+ {}
+ std::string CasedString::adjustString( std::string const& str ) const {
+ return m_caseSensitivity == CaseSensitive::No
+ ? toLower( str )
+ : str;
+ }
+ std::string CasedString::caseSensitivitySuffix() const {
+ return m_caseSensitivity == CaseSensitive::No
+ ? " (case insensitive)"
+ : std::string();
+ }
+
+
+ StringMatcherBase::StringMatcherBase( std::string const& operation, CasedString const& comparator )
+ : m_comparator( comparator ),
+ m_operation( operation ) {
+ }
+
+ std::string StringMatcherBase::describe() const {
+ std::string description;
+ description.reserve(5 + m_operation.size() + m_comparator.m_str.size() +
+ m_comparator.caseSensitivitySuffix().size());
+ description += m_operation;
+ description += ": \"";
+ description += m_comparator.m_str;
+ description += "\"";
+ description += m_comparator.caseSensitivitySuffix();
+ return description;
+ }
+
+ EqualsMatcher::EqualsMatcher( CasedString const& comparator ) : StringMatcherBase( "equals", comparator ) {}
+
+ bool EqualsMatcher::match( std::string const& source ) const {
+ return m_comparator.adjustString( source ) == m_comparator.m_str;
+ }
+
+
+ ContainsMatcher::ContainsMatcher( CasedString const& comparator ) : StringMatcherBase( "contains", comparator ) {}
+
+ bool ContainsMatcher::match( std::string const& source ) const {
+ return contains( m_comparator.adjustString( source ), m_comparator.m_str );
+ }
+
+
+ StartsWithMatcher::StartsWithMatcher( CasedString const& comparator ) : StringMatcherBase( "starts with", comparator ) {}
+
+ bool StartsWithMatcher::match( std::string const& source ) const {
+ return startsWith( m_comparator.adjustString( source ), m_comparator.m_str );
+ }
+
+
+ EndsWithMatcher::EndsWithMatcher( CasedString const& comparator ) : StringMatcherBase( "ends with", comparator ) {}
+
+ bool EndsWithMatcher::match( std::string const& source ) const {
+ return endsWith( m_comparator.adjustString( source ), m_comparator.m_str );
+ }
+
+
+
+ RegexMatcher::RegexMatcher(std::string regex, CaseSensitive::Choice caseSensitivity): m_regex(std::move(regex)), m_caseSensitivity(caseSensitivity) {}
+
+ bool RegexMatcher::match(std::string const& matchee) const {
+ auto flags = std::regex::ECMAScript; // ECMAScript is the default syntax option anyway
+ if (m_caseSensitivity == CaseSensitive::Choice::No) {
+ flags |= std::regex::icase;
+ }
+ auto reg = std::regex(m_regex, flags);
+ return std::regex_match(matchee, reg);
+ }
+
+ std::string RegexMatcher::describe() const {
+ return "matches " + ::Catch::Detail::stringify(m_regex) + ((m_caseSensitivity == CaseSensitive::Choice::Yes)? " case sensitively" : " case insensitively");
+ }
+
+ } // namespace StdString
+
+
+ StdString::EqualsMatcher Equals( std::string const& str, CaseSensitive::Choice caseSensitivity ) {
+ return StdString::EqualsMatcher( StdString::CasedString( str, caseSensitivity) );
+ }
+ StdString::ContainsMatcher Contains( std::string const& str, CaseSensitive::Choice caseSensitivity ) {
+ return StdString::ContainsMatcher( StdString::CasedString( str, caseSensitivity) );
+ }
+ StdString::EndsWithMatcher EndsWith( std::string const& str, CaseSensitive::Choice caseSensitivity ) {
+ return StdString::EndsWithMatcher( StdString::CasedString( str, caseSensitivity) );
+ }
+ StdString::StartsWithMatcher StartsWith( std::string const& str, CaseSensitive::Choice caseSensitivity ) {
+ return StdString::StartsWithMatcher( StdString::CasedString( str, caseSensitivity) );
+ }
+
+ StdString::RegexMatcher Matches(std::string const& regex, CaseSensitive::Choice caseSensitivity) {
+ return StdString::RegexMatcher(regex, caseSensitivity);
+ }
+
+} // namespace Matchers
+} // namespace Catch
diff --git a/include/internal/catch_matchers_string.h b/include/internal/catch_matchers_string.h
new file mode 100644
index 0000000..fdbc03c
--- /dev/null
+++ b/include/internal/catch_matchers_string.h
@@ -0,0 +1,80 @@
+/*
+ * Created by Phil Nash on 08/02/2017.
+ * Copyright (c) 2017 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_MATCHERS_STRING_H_INCLUDED
+#define TWOBLUECUBES_CATCH_MATCHERS_STRING_H_INCLUDED
+
+#include "catch_matchers.h"
+
+#include <string>
+
+namespace Catch {
+namespace Matchers {
+
+ namespace StdString {
+
+ struct CasedString
+ {
+ CasedString( std::string const& str, CaseSensitive::Choice caseSensitivity );
+ std::string adjustString( std::string const& str ) const;
+ std::string caseSensitivitySuffix() const;
+
+ CaseSensitive::Choice m_caseSensitivity;
+ std::string m_str;
+ };
+
+ struct StringMatcherBase : MatcherBase<std::string> {
+ StringMatcherBase( std::string const& operation, CasedString const& comparator );
+ std::string describe() const override;
+
+ CasedString m_comparator;
+ std::string m_operation;
+ };
+
+ struct EqualsMatcher : StringMatcherBase {
+ EqualsMatcher( CasedString const& comparator );
+ bool match( std::string const& source ) const override;
+ };
+ struct ContainsMatcher : StringMatcherBase {
+ ContainsMatcher( CasedString const& comparator );
+ bool match( std::string const& source ) const override;
+ };
+ struct StartsWithMatcher : StringMatcherBase {
+ StartsWithMatcher( CasedString const& comparator );
+ bool match( std::string const& source ) const override;
+ };
+ struct EndsWithMatcher : StringMatcherBase {
+ EndsWithMatcher( CasedString const& comparator );
+ bool match( std::string const& source ) const override;
+ };
+
+ struct RegexMatcher : MatcherBase<std::string> {
+ RegexMatcher( std::string regex, CaseSensitive::Choice caseSensitivity );
+ bool match( std::string const& matchee ) const override;
+ std::string describe() const override;
+
+ private:
+ std::string m_regex;
+ CaseSensitive::Choice m_caseSensitivity;
+ };
+
+ } // namespace StdString
+
+
+ // The following functions create the actual matcher objects.
+ // This allows the types to be inferred
+
+ StdString::EqualsMatcher Equals( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes );
+ StdString::ContainsMatcher Contains( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes );
+ StdString::EndsWithMatcher EndsWith( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes );
+ StdString::StartsWithMatcher StartsWith( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes );
+ StdString::RegexMatcher Matches( std::string const& regex, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes );
+
+} // namespace Matchers
+} // namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_MATCHERS_STRING_H_INCLUDED
diff --git a/include/internal/catch_matchers_vector.h b/include/internal/catch_matchers_vector.h
new file mode 100644
index 0000000..833d7dc
--- /dev/null
+++ b/include/internal/catch_matchers_vector.h
@@ -0,0 +1,183 @@
+/*
+ * Created by Phil Nash on 21/02/2017.
+ * Copyright (c) 2017 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_MATCHERS_VECTOR_H_INCLUDED
+#define TWOBLUECUBES_CATCH_MATCHERS_VECTOR_H_INCLUDED
+
+#include "catch_matchers.h"
+
+#include <algorithm>
+
+namespace Catch {
+namespace Matchers {
+
+ namespace Vector {
+ namespace Detail {
+ template <typename InputIterator, typename T>
+ size_t count(InputIterator first, InputIterator last, T const& item) {
+ size_t cnt = 0;
+ for (; first != last; ++first) {
+ if (*first == item) {
+ ++cnt;
+ }
+ }
+ return cnt;
+ }
+ template <typename InputIterator, typename T>
+ bool contains(InputIterator first, InputIterator last, T const& item) {
+ for (; first != last; ++first) {
+ if (*first == item) {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+
+ template<typename T>
+ struct ContainsElementMatcher : MatcherBase<std::vector<T>> {
+
+ ContainsElementMatcher(T const &comparator) : m_comparator( comparator) {}
+
+ bool match(std::vector<T> const &v) const override {
+ for (auto const& el : v) {
+ if (el == m_comparator) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ std::string describe() const override {
+ return "Contains: " + ::Catch::Detail::stringify( m_comparator );
+ }
+
+ T const& m_comparator;
+ };
+
+ template<typename T>
+ struct ContainsMatcher : MatcherBase<std::vector<T>> {
+
+ ContainsMatcher(std::vector<T> const &comparator) : m_comparator( comparator ) {}
+
+ bool match(std::vector<T> const &v) const override {
+ // !TBD: see note in EqualsMatcher
+ if (m_comparator.size() > v.size())
+ return false;
+ for (auto const& comparator : m_comparator) {
+ auto present = false;
+ for (const auto& el : v) {
+ if (el == comparator) {
+ present = true;
+ break;
+ }
+ }
+ if (!present) {
+ return false;
+ }
+ }
+ return true;
+ }
+ std::string describe() const override {
+ return "Contains: " + ::Catch::Detail::stringify( m_comparator );
+ }
+
+ std::vector<T> const& m_comparator;
+ };
+
+ template<typename T>
+ struct EqualsMatcher : MatcherBase<std::vector<T>> {
+
+ EqualsMatcher(std::vector<T> const &comparator) : m_comparator( comparator ) {}
+
+ bool match(std::vector<T> const &v) const override {
+ // !TBD: This currently works if all elements can be compared using !=
+ // - a more general approach would be via a compare template that defaults
+ // to using !=. but could be specialised for, e.g. std::vector<T> etc
+ // - then just call that directly
+ if (m_comparator.size() != v.size())
+ return false;
+ for (std::size_t i = 0; i < v.size(); ++i)
+ if (m_comparator[i] != v[i])
+ return false;
+ return true;
+ }
+ std::string describe() const override {
+ return "Equals: " + ::Catch::Detail::stringify( m_comparator );
+ }
+ std::vector<T> const& m_comparator;
+ };
+
+ template<typename T>
+ struct UnorderedEqualsMatcher : MatcherBase<std::vector<T>> {
+ UnorderedEqualsMatcher(std::vector<T> const& target) : m_target(target) {}
+ bool match(std::vector<T> const& vec) const override {
+ // Note: This is a reimplementation of std::is_permutation,
+ // because I don't want to include <algorithm> inside the common path
+ if (m_target.size() != vec.size()) {
+ return false;
+ }
+ auto lfirst = m_target.begin(), llast = m_target.end();
+ auto rfirst = vec.begin(), rlast = vec.end();
+ // Cut common prefix to optimize checking of permuted parts
+ while (lfirst != llast && *lfirst != *rfirst) {
+ ++lfirst; ++rfirst;
+ }
+ if (lfirst == llast) {
+ return true;
+ }
+
+ for (auto mid = lfirst; mid != llast; ++mid) {
+ // Skip already counted items
+ if (Detail::contains(lfirst, mid, *mid)) {
+ continue;
+ }
+ size_t num_vec = Detail::count(rfirst, rlast, *mid);
+ if (num_vec == 0 || Detail::count(lfirst, llast, *mid) != num_vec) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ std::string describe() const override {
+ return "UnorderedEquals: " + ::Catch::Detail::stringify(m_target);
+ }
+ private:
+ std::vector<T> const& m_target;
+ };
+
+ } // namespace Vector
+
+ // The following functions create the actual matcher objects.
+ // This allows the types to be inferred
+
+ template<typename T>
+ Vector::ContainsMatcher<T> Contains( std::vector<T> const& comparator ) {
+ return Vector::ContainsMatcher<T>( comparator );
+ }
+
+ template<typename T>
+ Vector::ContainsElementMatcher<T> VectorContains( T const& comparator ) {
+ return Vector::ContainsElementMatcher<T>( comparator );
+ }
+
+ template<typename T>
+ Vector::EqualsMatcher<T> Equals( std::vector<T> const& comparator ) {
+ return Vector::EqualsMatcher<T>( comparator );
+ }
+
+ template<typename T>
+ Vector::UnorderedEqualsMatcher<T> UnorderedEquals(std::vector<T> const& target) {
+ return Vector::UnorderedEqualsMatcher<T>(target);
+ }
+
+} // namespace Matchers
+} // namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_MATCHERS_VECTOR_H_INCLUDED
diff --git a/include/internal/catch_message.cpp b/include/internal/catch_message.cpp
new file mode 100644
index 0000000..8684970
--- /dev/null
+++ b/include/internal/catch_message.cpp
@@ -0,0 +1,58 @@
+/*
+ * Created by Phil Nash on 1/2/2013.
+ * Copyright 2013 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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_message.h"
+#include "catch_interfaces_capture.h"
+#include "catch_uncaught_exceptions.h"
+
+namespace Catch {
+
+ MessageInfo::MessageInfo( std::string const& _macroName,
+ SourceLineInfo const& _lineInfo,
+ ResultWas::OfType _type )
+ : macroName( _macroName ),
+ lineInfo( _lineInfo ),
+ type( _type ),
+ sequence( ++globalCount )
+ {}
+
+ bool MessageInfo::operator==( MessageInfo const& other ) const {
+ return sequence == other.sequence;
+ }
+
+ bool MessageInfo::operator<( MessageInfo const& other ) const {
+ return sequence < other.sequence;
+ }
+
+ // This may need protecting if threading support is added
+ unsigned int MessageInfo::globalCount = 0;
+
+
+ ////////////////////////////////////////////////////////////////////////////
+
+ Catch::MessageBuilder::MessageBuilder( std::string const& macroName,
+ SourceLineInfo const& lineInfo,
+ ResultWas::OfType type )
+ :m_info(macroName, lineInfo, type) {}
+
+ ////////////////////////////////////////////////////////////////////////////
+
+
+ ScopedMessage::ScopedMessage( MessageBuilder const& builder )
+ : m_info( builder.m_info )
+ {
+ m_info.message = builder.m_stream.str();
+ getResultCapture().pushScopedMessage( m_info );
+ }
+
+ ScopedMessage::~ScopedMessage() {
+ if ( !uncaught_exceptions() ){
+ getResultCapture().popScopedMessage(m_info);
+ }
+ }
+} // end namespace Catch
diff --git a/include/internal/catch_message.h b/include/internal/catch_message.h
new file mode 100644
index 0000000..0a512ed
--- /dev/null
+++ b/include/internal/catch_message.h
@@ -0,0 +1,70 @@
+/*
+ * Created by Phil Nash on 1/2/2013.
+ * Copyright 2013 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_MESSAGE_H_INCLUDED
+#define TWOBLUECUBES_CATCH_MESSAGE_H_INCLUDED
+
+#include <string>
+#include "catch_result_type.h"
+#include "catch_common.h"
+#include "catch_stream.h"
+
+namespace Catch {
+
+ struct MessageInfo {
+ MessageInfo( std::string const& _macroName,
+ SourceLineInfo const& _lineInfo,
+ ResultWas::OfType _type );
+
+ std::string macroName;
+ std::string message;
+ SourceLineInfo lineInfo;
+ ResultWas::OfType type;
+ unsigned int sequence;
+
+ bool operator == ( MessageInfo const& other ) const;
+ bool operator < ( MessageInfo const& other ) const;
+ private:
+ static unsigned int globalCount;
+ };
+
+ struct MessageStream {
+
+ template<typename T>
+ MessageStream& operator << ( T const& value ) {
+ m_stream << value;
+ return *this;
+ }
+
+ ReusableStringStream m_stream;
+ };
+
+ struct MessageBuilder : MessageStream {
+ MessageBuilder( std::string const& macroName,
+ SourceLineInfo const& lineInfo,
+ ResultWas::OfType type );
+
+ template<typename T>
+ MessageBuilder& operator << ( T const& value ) {
+ m_stream << value;
+ return *this;
+ }
+
+ MessageInfo m_info;
+ };
+
+ class ScopedMessage {
+ public:
+ explicit ScopedMessage( MessageBuilder const& builder );
+ ~ScopedMessage();
+
+ MessageInfo m_info;
+ };
+
+} // end namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_MESSAGE_H_INCLUDED
diff --git a/include/internal/catch_objc.hpp b/include/internal/catch_objc.hpp
new file mode 100644
index 0000000..b43f335
--- /dev/null
+++ b/include/internal/catch_objc.hpp
@@ -0,0 +1,215 @@
+/*
+ * Created by Phil on 14/11/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_OBJC_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_OBJC_HPP_INCLUDED
+
+#include "catch_objc_arc.hpp"
+
+#import <objc/runtime.h>
+
+#include <string>
+
+// NB. Any general catch headers included here must be included
+// in catch.hpp first to make sure they are included by the single
+// header for non obj-usage
+#include "catch_test_case_info.h"
+#include "catch_string_manip.h"
+#include "catch_tostring.h"
+
+///////////////////////////////////////////////////////////////////////////////
+// This protocol is really only here for (self) documenting purposes, since
+// all its methods are optional.
+@protocol OcFixture
+
+@optional
+
+-(void) setUp;
+-(void) tearDown;
+
+@end
+
+namespace Catch {
+
+ class OcMethod : public ITestInvoker {
+
+ public:
+ OcMethod( Class cls, SEL sel ) : m_cls( cls ), m_sel( sel ) {}
+
+ virtual void invoke() const {
+ id obj = [[m_cls alloc] init];
+
+ performOptionalSelector( obj, @selector(setUp) );
+ performOptionalSelector( obj, m_sel );
+ performOptionalSelector( obj, @selector(tearDown) );
+
+ arcSafeRelease( obj );
+ }
+ private:
+ virtual ~OcMethod() {}
+
+ Class m_cls;
+ SEL m_sel;
+ };
+
+ namespace Detail{
+
+
+ inline std::string getAnnotation( Class cls,
+ std::string const& annotationName,
+ std::string const& testCaseName ) {
+ NSString* selStr = [[NSString alloc] initWithFormat:@"Catch_%s_%s", annotationName.c_str(), testCaseName.c_str()];
+ SEL sel = NSSelectorFromString( selStr );
+ arcSafeRelease( selStr );
+ id value = performOptionalSelector( cls, sel );
+ if( value )
+ return [(NSString*)value UTF8String];
+ return "";
+ }
+ }
+
+ inline std::size_t registerTestMethods() {
+ std::size_t noTestMethods = 0;
+ int noClasses = objc_getClassList( nullptr, 0 );
+
+ Class* classes = (CATCH_UNSAFE_UNRETAINED Class *)malloc( sizeof(Class) * noClasses);
+ objc_getClassList( classes, noClasses );
+
+ for( int c = 0; c < noClasses; c++ ) {
+ Class cls = classes[c];
+ {
+ u_int count;
+ Method* methods = class_copyMethodList( cls, &count );
+ for( u_int m = 0; m < count ; m++ ) {
+ SEL selector = method_getName(methods[m]);
+ std::string methodName = sel_getName(selector);
+ if( startsWith( methodName, "Catch_TestCase_" ) ) {
+ std::string testCaseName = methodName.substr( 15 );
+ std::string name = Detail::getAnnotation( cls, "Name", testCaseName );
+ std::string desc = Detail::getAnnotation( cls, "Description", testCaseName );
+ const char* className = class_getName( cls );
+
+ getMutableRegistryHub().registerTest( makeTestCase( new OcMethod( cls, selector ), className, name.c_str(), desc.c_str(), SourceLineInfo("",0) ) );
+ noTestMethods++;
+ }
+ }
+ free(methods);
+ }
+ }
+ return noTestMethods;
+ }
+
+#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
+
+ namespace Matchers {
+ namespace Impl {
+ namespace NSStringMatchers {
+
+ struct StringHolder : MatcherBase<NSString*>{
+ StringHolder( NSString* substr ) : m_substr( [substr copy] ){}
+ StringHolder( StringHolder const& other ) : m_substr( [other.m_substr copy] ){}
+ StringHolder() {
+ arcSafeRelease( m_substr );
+ }
+
+ bool match( NSString* arg ) const override {
+ return false;
+ }
+
+ NSString* CATCH_ARC_STRONG m_substr;
+ };
+
+ struct Equals : StringHolder {
+ Equals( NSString* substr ) : StringHolder( substr ){}
+
+ bool match( NSString* str ) const override {
+ return (str != nil || m_substr == nil ) &&
+ [str isEqualToString:m_substr];
+ }
+
+ std::string describe() const override {
+ return "equals string: " + Catch::Detail::stringify( m_substr );
+ }
+ };
+
+ struct Contains : StringHolder {
+ Contains( NSString* substr ) : StringHolder( substr ){}
+
+ bool match( NSString* str ) const {
+ return (str != nil || m_substr == nil ) &&
+ [str rangeOfString:m_substr].location != NSNotFound;
+ }
+
+ std::string describe() const override {
+ return "contains string: " + Catch::Detail::stringify( m_substr );
+ }
+ };
+
+ struct StartsWith : StringHolder {
+ StartsWith( NSString* substr ) : StringHolder( substr ){}
+
+ bool match( NSString* str ) const override {
+ return (str != nil || m_substr == nil ) &&
+ [str rangeOfString:m_substr].location == 0;
+ }
+
+ std::string describe() const override {
+ return "starts with: " + Catch::Detail::stringify( m_substr );
+ }
+ };
+ struct EndsWith : StringHolder {
+ EndsWith( NSString* substr ) : StringHolder( substr ){}
+
+ bool match( NSString* str ) const override {
+ return (str != nil || m_substr == nil ) &&
+ [str rangeOfString:m_substr].location == [str length] - [m_substr length];
+ }
+
+ std::string describe() const override {
+ return "ends with: " + Catch::Detail::stringify( m_substr );
+ }
+ };
+
+ } // namespace NSStringMatchers
+ } // namespace Impl
+
+ inline Impl::NSStringMatchers::Equals
+ Equals( NSString* substr ){ return Impl::NSStringMatchers::Equals( substr ); }
+
+ inline Impl::NSStringMatchers::Contains
+ Contains( NSString* substr ){ return Impl::NSStringMatchers::Contains( substr ); }
+
+ inline Impl::NSStringMatchers::StartsWith
+ StartsWith( NSString* substr ){ return Impl::NSStringMatchers::StartsWith( substr ); }
+
+ inline Impl::NSStringMatchers::EndsWith
+ EndsWith( NSString* substr ){ return Impl::NSStringMatchers::EndsWith( substr ); }
+
+ } // namespace Matchers
+
+ using namespace Matchers;
+
+#endif // CATCH_CONFIG_DISABLE_MATCHERS
+
+} // namespace Catch
+
+///////////////////////////////////////////////////////////////////////////////
+#define OC_MAKE_UNIQUE_NAME( root, uniqueSuffix ) root##uniqueSuffix
+#define OC_TEST_CASE2( name, desc, uniqueSuffix ) \
++(NSString*) OC_MAKE_UNIQUE_NAME( Catch_Name_test_, uniqueSuffix ) \
+{ \
+return @ name; \
+} \
++(NSString*) OC_MAKE_UNIQUE_NAME( Catch_Description_test_, uniqueSuffix ) \
+{ \
+return @ desc; \
+} \
+-(void) OC_MAKE_UNIQUE_NAME( Catch_TestCase_test_, uniqueSuffix )
+
+#define OC_TEST_CASE( name, desc ) OC_TEST_CASE2( name, desc, __LINE__ )
+
+#endif // TWOBLUECUBES_CATCH_OBJC_HPP_INCLUDED
diff --git a/include/internal/catch_objc_arc.hpp b/include/internal/catch_objc_arc.hpp
new file mode 100644
index 0000000..6bcd6b8
--- /dev/null
+++ b/include/internal/catch_objc_arc.hpp
@@ -0,0 +1,51 @@
+/*
+ * Created by Phil on 1/08/2012.
+ * Copyright 2012 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_OBJC_ARC_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_OBJC_ARC_HPP_INCLUDED
+
+#import <Foundation/Foundation.h>
+
+#ifdef __has_feature
+#define CATCH_ARC_ENABLED __has_feature(objc_arc)
+#else
+#define CATCH_ARC_ENABLED 0
+#endif
+
+void arcSafeRelease( NSObject* obj );
+id performOptionalSelector( id obj, SEL sel );
+
+#if !CATCH_ARC_ENABLED
+inline void arcSafeRelease( NSObject* obj ) {
+ [obj release];
+}
+inline id performOptionalSelector( id obj, SEL sel ) {
+ if( [obj respondsToSelector: sel] )
+ return [obj performSelector: sel];
+ return nil;
+}
+#define CATCH_UNSAFE_UNRETAINED
+#define CATCH_ARC_STRONG
+#else
+inline void arcSafeRelease( NSObject* ){}
+inline id performOptionalSelector( id obj, SEL sel ) {
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
+#endif
+ if( [obj respondsToSelector: sel] )
+ return [obj performSelector: sel];
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+ return nil;
+}
+#define CATCH_UNSAFE_UNRETAINED __unsafe_unretained
+#define CATCH_ARC_STRONG __strong
+#endif
+
+#endif // TWOBLUECUBES_CATCH_OBJC_ARC_HPP_INCLUDED
diff --git a/include/internal/catch_option.hpp b/include/internal/catch_option.hpp
new file mode 100644
index 0000000..d790b24
--- /dev/null
+++ b/include/internal/catch_option.hpp
@@ -0,0 +1,73 @@
+/*
+ * Created by Phil on 02/12/2012.
+ * Copyright 2012 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_OPTION_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_OPTION_HPP_INCLUDED
+
+namespace Catch {
+
+ // An optional type
+ template<typename T>
+ class Option {
+ public:
+ Option() : nullableValue( nullptr ) {}
+ Option( T const& _value )
+ : nullableValue( new( storage ) T( _value ) )
+ {}
+ Option( Option const& _other )
+ : nullableValue( _other ? new( storage ) T( *_other ) : nullptr )
+ {}
+
+ ~Option() {
+ reset();
+ }
+
+ Option& operator= ( Option const& _other ) {
+ if( &_other != this ) {
+ reset();
+ if( _other )
+ nullableValue = new( storage ) T( *_other );
+ }
+ return *this;
+ }
+ Option& operator = ( T const& _value ) {
+ reset();
+ nullableValue = new( storage ) T( _value );
+ return *this;
+ }
+
+ void reset() {
+ if( nullableValue )
+ nullableValue->~T();
+ nullableValue = nullptr;
+ }
+
+ T& operator*() { return *nullableValue; }
+ T const& operator*() const { return *nullableValue; }
+ T* operator->() { return nullableValue; }
+ const T* operator->() const { return nullableValue; }
+
+ T valueOr( T const& defaultValue ) const {
+ return nullableValue ? *nullableValue : defaultValue;
+ }
+
+ bool some() const { return nullableValue != nullptr; }
+ bool none() const { return nullableValue == nullptr; }
+
+ bool operator !() const { return nullableValue == nullptr; }
+ explicit operator bool() const {
+ return some();
+ }
+
+ private:
+ T *nullableValue;
+ alignas(alignof(T)) char storage[sizeof(T)];
+ };
+
+} // end namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_OPTION_HPP_INCLUDED
diff --git a/include/internal/catch_platform.h b/include/internal/catch_platform.h
new file mode 100644
index 0000000..cbf1792
--- /dev/null
+++ b/include/internal/catch_platform.h
@@ -0,0 +1,27 @@
+/*
+ * Created by Phil on 16/8/2013.
+ * Copyright 2013 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ *
+ */
+#ifndef TWOBLUECUBES_CATCH_PLATFORM_H_INCLUDED
+#define TWOBLUECUBES_CATCH_PLATFORM_H_INCLUDED
+
+#ifdef __APPLE__
+# include <TargetConditionals.h>
+# if TARGET_OS_OSX == 1
+# define CATCH_PLATFORM_MAC
+# elif TARGET_OS_IPHONE == 1
+# define CATCH_PLATFORM_IPHONE
+# endif
+
+#elif defined(linux) || defined(__linux) || defined(__linux__)
+# define CATCH_PLATFORM_LINUX
+
+#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER)
+# define CATCH_PLATFORM_WINDOWS
+#endif
+
+#endif // TWOBLUECUBES_CATCH_PLATFORM_H_INCLUDED
diff --git a/include/internal/catch_random_number_generator.cpp b/include/internal/catch_random_number_generator.cpp
new file mode 100644
index 0000000..412faeb
--- /dev/null
+++ b/include/internal/catch_random_number_generator.cpp
@@ -0,0 +1,31 @@
+/*
+ * Created by Martin on 30/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_random_number_generator.h"
+#include "catch_context.h"
+#include "catch_interfaces_config.h"
+
+#include <cstdlib>
+
+namespace Catch {
+
+ void seedRng( IConfig const& config ) {
+ if( config.rngSeed() != 0 )
+ std::srand( config.rngSeed() );
+ }
+ unsigned int 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)();
+ }
+
+}
diff --git a/include/internal/catch_random_number_generator.h b/include/internal/catch_random_number_generator.h
new file mode 100644
index 0000000..d18cffd
--- /dev/null
+++ b/include/internal/catch_random_number_generator.h
@@ -0,0 +1,38 @@
+/*
+ * Created by Martin on 30/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)
+ */
+#ifndef TWOBLUECUBES_CATCH_RANDOM_NUMBER_GENERATOR_H_INCLUDED
+#define TWOBLUECUBES_CATCH_RANDOM_NUMBER_GENERATOR_H_INCLUDED
+
+#include <algorithm>
+
+namespace Catch {
+
+ struct IConfig;
+
+ void seedRng( IConfig const& config );
+
+ 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
diff --git a/include/internal/catch_reenable_warnings.h b/include/internal/catch_reenable_warnings.h
new file mode 100644
index 0000000..33574e0
--- /dev/null
+++ b/include/internal/catch_reenable_warnings.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2014 Two Blue Cubes Ltd
+ *
+ * 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)
+ */
+
+#ifndef TWOBLUECUBES_CATCH_REENABLE_WARNINGS_H_INCLUDED
+#define TWOBLUECUBES_CATCH_REENABLE_WARNINGS_H_INCLUDED
+
+#ifdef __clang__
+# ifdef __ICC // icpc defines the __clang__ macro
+# pragma warning(pop)
+# else
+# pragma clang diagnostic pop
+# endif
+#elif defined __GNUC__
+# pragma GCC diagnostic pop
+#endif
+
+#endif // TWOBLUECUBES_CATCH_REENABLE_WARNINGS_H_INCLUDED
diff --git a/include/internal/catch_registry_hub.cpp b/include/internal/catch_registry_hub.cpp
new file mode 100644
index 0000000..d98708c
--- /dev/null
+++ b/include/internal/catch_registry_hub.cpp
@@ -0,0 +1,97 @@
+/*
+ * Created by Phil on 5/8/2012.
+ * Copyright 2012 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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_interfaces_registry_hub.h"
+
+#include "catch_context.h"
+#include "catch_test_case_registry_impl.h"
+#include "catch_reporter_registry.h"
+#include "catch_exception_translator_registry.h"
+#include "catch_tag_alias_registry.h"
+#include "catch_startup_exception_registry.h"
+
+namespace Catch {
+
+ namespace {
+
+ class RegistryHub : public IRegistryHub, public IMutableRegistryHub,
+ private NonCopyable {
+
+ public: // IRegistryHub
+ RegistryHub() = default;
+ IReporterRegistry const& getReporterRegistry() const override {
+ return m_reporterRegistry;
+ }
+ ITestCaseRegistry const& getTestCaseRegistry() const override {
+ return m_testCaseRegistry;
+ }
+ IExceptionTranslatorRegistry& getExceptionTranslatorRegistry() override {
+ return m_exceptionTranslatorRegistry;
+ }
+ ITagAliasRegistry const& getTagAliasRegistry() const override {
+ return m_tagAliasRegistry;
+ }
+ StartupExceptionRegistry const& getStartupExceptionRegistry() const override {
+ return m_exceptionRegistry;
+ }
+
+ public: // IMutableRegistryHub
+ void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) override {
+ m_reporterRegistry.registerReporter( name, factory );
+ }
+ void registerListener( IReporterFactoryPtr const& factory ) override {
+ m_reporterRegistry.registerListener( factory );
+ }
+ void registerTest( TestCase const& testInfo ) override {
+ m_testCaseRegistry.registerTest( testInfo );
+ }
+ void registerTranslator( const IExceptionTranslator* translator ) override {
+ m_exceptionTranslatorRegistry.registerTranslator( translator );
+ }
+ void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) override {
+ m_tagAliasRegistry.add( alias, tag, lineInfo );
+ }
+ void registerStartupException() noexcept override {
+ m_exceptionRegistry.add(std::current_exception());
+ }
+
+ private:
+ TestRegistry m_testCaseRegistry;
+ ReporterRegistry m_reporterRegistry;
+ ExceptionTranslatorRegistry m_exceptionTranslatorRegistry;
+ TagAliasRegistry m_tagAliasRegistry;
+ StartupExceptionRegistry m_exceptionRegistry;
+ };
+
+ // Single, global, instance
+ RegistryHub*& getTheRegistryHub() {
+ static RegistryHub* theRegistryHub = nullptr;
+ if( !theRegistryHub )
+ theRegistryHub = new RegistryHub();
+ return theRegistryHub;
+ }
+ }
+
+ IRegistryHub& getRegistryHub() {
+ return *getTheRegistryHub();
+ }
+ IMutableRegistryHub& getMutableRegistryHub() {
+ return *getTheRegistryHub();
+ }
+ void cleanUp() {
+ delete getTheRegistryHub();
+ getTheRegistryHub() = nullptr;
+ cleanUpContext();
+ ReusableStringStream::cleanup();
+ }
+ std::string translateActiveException() {
+ return getRegistryHub().getExceptionTranslatorRegistry().translateActiveException();
+ }
+
+
+} // end namespace Catch
diff --git a/include/internal/catch_reporter_registrars.hpp b/include/internal/catch_reporter_registrars.hpp
new file mode 100644
index 0000000..943fba6
--- /dev/null
+++ b/include/internal/catch_reporter_registrars.hpp
@@ -0,0 +1,76 @@
+
+/*
+ * Created by Phil on 31/12/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_REPORTER_REGISTRARS_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_REPORTER_REGISTRARS_HPP_INCLUDED
+
+#include "catch_interfaces_registry_hub.h"
+
+namespace Catch {
+
+ template<typename T>
+ class ReporterRegistrar {
+
+ class ReporterFactory : public IReporterFactory {
+
+ virtual IStreamingReporterPtr create( ReporterConfig const& config ) const override {
+ return std::unique_ptr<T>( new T( config ) );
+ }
+
+ virtual std::string getDescription() const override {
+ return T::getDescription();
+ }
+ };
+
+ public:
+
+ explicit ReporterRegistrar( std::string const& name ) {
+ getMutableRegistryHub().registerReporter( name, std::make_shared<ReporterFactory>() );
+ }
+ };
+
+ template<typename T>
+ class ListenerRegistrar {
+
+ class ListenerFactory : public IReporterFactory {
+
+ virtual IStreamingReporterPtr create( ReporterConfig const& config ) const override {
+ return std::unique_ptr<T>( new T( config ) );
+ }
+ virtual std::string getDescription() const override {
+ return std::string();
+ }
+ };
+
+ public:
+
+ ListenerRegistrar() {
+ getMutableRegistryHub().registerListener( std::make_shared<ListenerFactory>() );
+ }
+ };
+}
+
+#if !defined(CATCH_CONFIG_DISABLE)
+
+#define CATCH_REGISTER_REPORTER( name, reporterType ) \
+ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
+ namespace{ Catch::ReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name ); } \
+ CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS
+
+#define CATCH_REGISTER_LISTENER( listenerType ) \
+ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
+ namespace{ Catch::ListenerRegistrar<listenerType> catch_internal_RegistrarFor##listenerType; } \
+ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
+#else // CATCH_CONFIG_DISABLE
+
+#define CATCH_REGISTER_REPORTER(name, reporterType)
+#define CATCH_REGISTER_LISTENER(listenerType)
+
+#endif // CATCH_CONFIG_DISABLE
+
+#endif // TWOBLUECUBES_CATCH_REPORTER_REGISTRARS_HPP_INCLUDED
diff --git a/include/internal/catch_reporter_registry.cpp b/include/internal/catch_reporter_registry.cpp
new file mode 100644
index 0000000..f017e05
--- /dev/null
+++ b/include/internal/catch_reporter_registry.cpp
@@ -0,0 +1,34 @@
+/*
+ * 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;
+ }
+
+}
diff --git a/include/internal/catch_reporter_registry.h b/include/internal/catch_reporter_registry.h
new file mode 100644
index 0000000..916e924
--- /dev/null
+++ b/include/internal/catch_reporter_registry.h
@@ -0,0 +1,37 @@
+/*
+ * Created by Phil on 29/10/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_REPORTER_REGISTRY_H_INCLUDED
+#define TWOBLUECUBES_CATCH_REPORTER_REGISTRY_H_INCLUDED
+
+#include "catch_interfaces_reporter.h"
+
+#include <map>
+
+namespace Catch {
+
+ class ReporterRegistry : public IReporterRegistry {
+
+ public:
+
+ ~ReporterRegistry() override;
+
+ IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const override;
+
+ void registerReporter( std::string const& name, IReporterFactoryPtr const& factory );
+ void registerListener( IReporterFactoryPtr const& factory );
+
+ FactoryMap const& getFactories() const override;
+ Listeners const& getListeners() const override;
+
+ private:
+ FactoryMap m_factories;
+ Listeners m_listeners;
+ };
+}
+
+#endif // TWOBLUECUBES_CATCH_REPORTER_REGISTRY_H_INCLUDED
diff --git a/include/internal/catch_result_type.cpp b/include/internal/catch_result_type.cpp
new file mode 100644
index 0000000..0f62f1b
--- /dev/null
+++ b/include/internal/catch_result_type.cpp
@@ -0,0 +1,27 @@
+/*
+ * Created by Phil on 07/01/2011.
+ * Copyright 2011 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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_result_type.h"
+
+namespace Catch {
+
+ bool isOk( ResultWas::OfType resultType ) {
+ return ( resultType & ResultWas::FailureBit ) == 0;
+ }
+ bool isJustInfo( int flags ) {
+ return flags == ResultWas::Info;
+ }
+
+ ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs ) {
+ return static_cast<ResultDisposition::Flags>( static_cast<int>( lhs ) | static_cast<int>( rhs ) );
+ }
+
+ bool shouldContinueOnFailure( int flags ) { return ( flags & ResultDisposition::ContinueOnFailure ) != 0; }
+ bool shouldSuppressFailure( int flags ) { return ( flags & ResultDisposition::SuppressFail ) != 0; }
+
+} // end namespace Catch
diff --git a/include/internal/catch_result_type.h b/include/internal/catch_result_type.h
new file mode 100644
index 0000000..000b4f3
--- /dev/null
+++ b/include/internal/catch_result_type.h
@@ -0,0 +1,55 @@
+/*
+ * Created by Phil on 07/01/2011.
+ * Copyright 2011 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_RESULT_TYPE_H_INCLUDED
+#define TWOBLUECUBES_CATCH_RESULT_TYPE_H_INCLUDED
+
+namespace Catch {
+
+ // ResultWas::OfType enum
+ struct ResultWas { enum OfType {
+ Unknown = -1,
+ Ok = 0,
+ Info = 1,
+ Warning = 2,
+
+ FailureBit = 0x10,
+
+ ExpressionFailed = FailureBit | 1,
+ ExplicitFailure = FailureBit | 2,
+
+ Exception = 0x100 | FailureBit,
+
+ ThrewException = Exception | 1,
+ DidntThrowException = Exception | 2,
+
+ FatalErrorCondition = 0x200 | FailureBit
+
+ }; };
+
+ bool isOk( ResultWas::OfType resultType );
+ bool isJustInfo( int flags );
+
+
+ // ResultDisposition::Flags enum
+ struct ResultDisposition { enum Flags {
+ Normal = 0x01,
+
+ ContinueOnFailure = 0x02, // Failures fail test, but execution continues
+ FalseTest = 0x04, // Prefix expression with !
+ SuppressFail = 0x08 // Failures are reported but do not fail the test
+ }; };
+
+ ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs );
+
+ bool shouldContinueOnFailure( int flags );
+ inline bool isFalseTest( int flags ) { return ( flags & ResultDisposition::FalseTest ) != 0; }
+ bool shouldSuppressFailure( int flags );
+
+} // end namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_RESULT_TYPE_H_INCLUDED
diff --git a/include/internal/catch_run_context.cpp b/include/internal/catch_run_context.cpp
new file mode 100644
index 0000000..ca78bfb
--- /dev/null
+++ b/include/internal/catch_run_context.cpp
@@ -0,0 +1,465 @@
+#include "catch_run_context.h"
+#include "catch_context.h"
+#include "catch_enforce.h"
+#include "catch_random_number_generator.h"
+#include "catch_stream.h"
+
+#include <cassert>
+#include <algorithm>
+#include <sstream>
+
+namespace Catch {
+
+ class RedirectedStream {
+ std::ostream& m_originalStream;
+ std::ostream& m_redirectionStream;
+ std::streambuf* m_prevBuf;
+
+ public:
+ RedirectedStream( std::ostream& originalStream, std::ostream& redirectionStream )
+ : m_originalStream( originalStream ),
+ m_redirectionStream( redirectionStream ),
+ m_prevBuf( m_originalStream.rdbuf() )
+ {
+ m_originalStream.rdbuf( m_redirectionStream.rdbuf() );
+ }
+ ~RedirectedStream() {
+ m_originalStream.rdbuf( m_prevBuf );
+ }
+ };
+
+ class RedirectedStdOut {
+ ReusableStringStream m_rss;
+ RedirectedStream m_cout;
+ public:
+ RedirectedStdOut() : m_cout( Catch::cout(), m_rss.get() ) {}
+ auto str() const -> std::string { return m_rss.str(); }
+ };
+
+ // StdErr has two constituent streams in C++, std::cerr and std::clog
+ // This means that we need to redirect 2 streams into 1 to keep proper
+ // order of writes
+ class RedirectedStdErr {
+ ReusableStringStream m_rss;
+ RedirectedStream m_cerr;
+ RedirectedStream m_clog;
+ public:
+ RedirectedStdErr()
+ : m_cerr( Catch::cerr(), m_rss.get() ),
+ m_clog( Catch::clog(), m_rss.get() )
+ {}
+ auto str() const -> std::string { return m_rss.str(); }
+ };
+
+
+ RunContext::RunContext(IConfigPtr const& _config, IStreamingReporterPtr&& reporter)
+ : m_runInfo(_config->name()),
+ m_context(getCurrentMutableContext()),
+ m_config(_config),
+ m_reporter(std::move(reporter)),
+ m_lastAssertionInfo{ "", SourceLineInfo("",0), "", ResultDisposition::Normal },
+ m_includeSuccessfulResults( m_config->includeSuccessfulResults() )
+ {
+ m_context.setRunner(this);
+ m_context.setConfig(m_config);
+ m_context.setResultCapture(this);
+ m_reporter->testRunStarting(m_runInfo);
+ }
+
+ RunContext::~RunContext() {
+ m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, aborting()));
+ }
+
+ void RunContext::testGroupStarting(std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount) {
+ m_reporter->testGroupStarting(GroupInfo(testSpec, groupIndex, groupsCount));
+ }
+
+ void RunContext::testGroupEnded(std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount) {
+ m_reporter->testGroupEnded(TestGroupStats(GroupInfo(testSpec, groupIndex, groupsCount), totals, aborting()));
+ }
+
+ Totals RunContext::runTest(TestCase const& testCase) {
+ Totals prevTotals = m_totals;
+
+ std::string redirectedCout;
+ std::string redirectedCerr;
+
+ TestCaseInfo testInfo = testCase.getTestCaseInfo();
+
+ m_reporter->testCaseStarting(testInfo);
+
+ m_activeTestCase = &testCase;
+
+
+ ITracker& rootTracker = m_trackerContext.startRun();
+ assert(rootTracker.isSectionTracker());
+ static_cast<SectionTracker&>(rootTracker).addInitialFilters(m_config->getSectionsToRun());
+ do {
+ m_trackerContext.startCycle();
+ m_testCaseTracker = &SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocation(testInfo.name, testInfo.lineInfo));
+ runCurrentTest(redirectedCout, redirectedCerr);
+ } while (!m_testCaseTracker->isSuccessfullyCompleted() && !aborting());
+
+ Totals deltaTotals = m_totals.delta(prevTotals);
+ if (testInfo.expectedToFail() && deltaTotals.testCases.passed > 0) {
+ deltaTotals.assertions.failed++;
+ deltaTotals.testCases.passed--;
+ deltaTotals.testCases.failed++;
+ }
+ m_totals.testCases += deltaTotals.testCases;
+ m_reporter->testCaseEnded(TestCaseStats(testInfo,
+ deltaTotals,
+ redirectedCout,
+ redirectedCerr,
+ aborting()));
+
+ m_activeTestCase = nullptr;
+ m_testCaseTracker = nullptr;
+
+ return deltaTotals;
+ }
+
+ IConfigPtr RunContext::config() const {
+ return m_config;
+ }
+
+ IStreamingReporter& RunContext::reporter() const {
+ return *m_reporter;
+ }
+
+ void RunContext::assertionEnded(AssertionResult const & result) {
+ if (result.getResultType() == ResultWas::Ok) {
+ m_totals.assertions.passed++;
+ m_lastAssertionPassed = true;
+ } else if (!result.isOk()) {
+ m_lastAssertionPassed = false;
+ if( m_activeTestCase->getTestCaseInfo().okToFail() )
+ m_totals.assertions.failedButOk++;
+ else
+ m_totals.assertions.failed++;
+ }
+ else {
+ m_lastAssertionPassed = true;
+ }
+
+ // We have no use for the return value (whether messages should be cleared), because messages were made scoped
+ // and should be let to clear themselves out.
+ static_cast<void>(m_reporter->assertionEnded(AssertionStats(result, m_messages, m_totals)));
+
+ // Reset working state
+ resetAssertionInfo();
+ m_lastResult = result;
+ }
+ void RunContext::resetAssertionInfo() {
+ m_lastAssertionInfo.macroName = StringRef();
+ m_lastAssertionInfo.capturedExpression = "{Unknown expression after the reported line}"_sr;
+ }
+
+ bool RunContext::sectionStarted(SectionInfo const & sectionInfo, Counts & assertions) {
+ ITracker& sectionTracker = SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocation(sectionInfo.name, sectionInfo.lineInfo));
+ if (!sectionTracker.isOpen())
+ return false;
+ m_activeSections.push_back(§ionTracker);
+
+ m_lastAssertionInfo.lineInfo = sectionInfo.lineInfo;
+
+ m_reporter->sectionStarting(sectionInfo);
+
+ assertions = m_totals.assertions;
+
+ return true;
+ }
+
+ bool RunContext::testForMissingAssertions(Counts& assertions) {
+ if (assertions.total() != 0)
+ return false;
+ if (!m_config->warnAboutMissingAssertions())
+ return false;
+ if (m_trackerContext.currentTracker().hasChildren())
+ return false;
+ m_totals.assertions.failed++;
+ assertions.failed++;
+ return true;
+ }
+
+ void RunContext::sectionEnded(SectionEndInfo const & endInfo) {
+ Counts assertions = m_totals.assertions - endInfo.prevAssertions;
+ bool missingAssertions = testForMissingAssertions(assertions);
+
+ if (!m_activeSections.empty()) {
+ m_activeSections.back()->close();
+ m_activeSections.pop_back();
+ }
+
+ m_reporter->sectionEnded(SectionStats(endInfo.sectionInfo, assertions, endInfo.durationInSeconds, missingAssertions));
+ m_messages.clear();
+ }
+
+ void RunContext::sectionEndedEarly(SectionEndInfo const & endInfo) {
+ if (m_unfinishedSections.empty())
+ m_activeSections.back()->fail();
+ else
+ m_activeSections.back()->close();
+ m_activeSections.pop_back();
+
+ m_unfinishedSections.push_back(endInfo);
+ }
+ void RunContext::benchmarkStarting( BenchmarkInfo const& info ) {
+ m_reporter->benchmarkStarting( info );
+ }
+ void RunContext::benchmarkEnded( BenchmarkStats const& stats ) {
+ m_reporter->benchmarkEnded( stats );
+ }
+
+ void RunContext::pushScopedMessage(MessageInfo const & message) {
+ m_messages.push_back(message);
+ }
+
+ void RunContext::popScopedMessage(MessageInfo const & message) {
+ m_messages.erase(std::remove(m_messages.begin(), m_messages.end(), message), m_messages.end());
+ }
+
+ std::string RunContext::getCurrentTestName() const {
+ return m_activeTestCase
+ ? m_activeTestCase->getTestCaseInfo().name
+ : std::string();
+ }
+
+ const AssertionResult * RunContext::getLastResult() const {
+ return &(*m_lastResult);
+ }
+
+ void RunContext::exceptionEarlyReported() {
+ m_shouldReportUnexpected = false;
+ }
+
+ void RunContext::handleFatalErrorCondition( StringRef message ) {
+ // First notify reporter that bad things happened
+ m_reporter->fatalErrorEncountered(message);
+
+ // Don't rebuild the result -- the stringification itself can cause more fatal errors
+ // Instead, fake a result data.
+ AssertionResultData tempResult( ResultWas::FatalErrorCondition, { false } );
+ tempResult.message = message;
+ AssertionResult result(m_lastAssertionInfo, tempResult);
+
+ assertionEnded(result);
+
+ handleUnfinishedSections();
+
+ // Recreate section for test case (as we will lose the one that was in scope)
+ auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo();
+ SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name, testCaseInfo.description);
+
+ Counts assertions;
+ assertions.failed = 1;
+ SectionStats testCaseSectionStats(testCaseSection, assertions, 0, false);
+ m_reporter->sectionEnded(testCaseSectionStats);
+
+ auto const& testInfo = m_activeTestCase->getTestCaseInfo();
+
+ Totals deltaTotals;
+ deltaTotals.testCases.failed = 1;
+ deltaTotals.assertions.failed = 1;
+ m_reporter->testCaseEnded(TestCaseStats(testInfo,
+ deltaTotals,
+ std::string(),
+ std::string(),
+ false));
+ m_totals.testCases.failed++;
+ testGroupEnded(std::string(), m_totals, 1, 1);
+ m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, false));
+ }
+
+ bool RunContext::lastAssertionPassed() {
+ return m_lastAssertionPassed;
+ }
+
+ void RunContext::assertionPassed() {
+ m_lastAssertionPassed = true;
+ ++m_totals.assertions.passed;
+ resetAssertionInfo();
+ }
+
+ bool RunContext::aborting() const {
+ return m_totals.assertions.failed == static_cast<std::size_t>(m_config->abortAfter());
+ }
+
+ void RunContext::runCurrentTest(std::string & redirectedCout, std::string & redirectedCerr) {
+ auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo();
+ SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name, testCaseInfo.description);
+ m_reporter->sectionStarting(testCaseSection);
+ Counts prevAssertions = m_totals.assertions;
+ double duration = 0;
+ m_shouldReportUnexpected = true;
+ m_lastAssertionInfo = { "TEST_CASE", testCaseInfo.lineInfo, "", ResultDisposition::Normal };
+
+ seedRng(*m_config);
+
+ Timer timer;
+ try {
+ if (m_reporter->getPreferences().shouldRedirectStdOut) {
+ RedirectedStdOut redirectedStdOut;
+ RedirectedStdErr redirectedStdErr;
+ timer.start();
+ invokeActiveTestCase();
+ redirectedCout += redirectedStdOut.str();
+ redirectedCerr += redirectedStdErr.str();
+
+ } else {
+ timer.start();
+ invokeActiveTestCase();
+ }
+ duration = timer.getElapsedSeconds();
+ } catch (TestFailureException&) {
+ // This just means the test was aborted due to failure
+ } catch (...) {
+ // Under CATCH_CONFIG_FAST_COMPILE, unexpected exceptions under REQUIRE assertions
+ // are reported without translation at the point of origin.
+ if( m_shouldReportUnexpected ) {
+ AssertionReaction dummyReaction;
+ handleUnexpectedInflightException( m_lastAssertionInfo, translateActiveException(), dummyReaction );
+ }
+ }
+ Counts assertions = m_totals.assertions - prevAssertions;
+ bool missingAssertions = testForMissingAssertions(assertions);
+
+ m_testCaseTracker->close();
+ handleUnfinishedSections();
+ m_messages.clear();
+
+ SectionStats testCaseSectionStats(testCaseSection, assertions, duration, missingAssertions);
+ m_reporter->sectionEnded(testCaseSectionStats);
+ }
+
+ void RunContext::invokeActiveTestCase() {
+ FatalConditionHandler fatalConditionHandler; // Handle signals
+ m_activeTestCase->invoke();
+ fatalConditionHandler.reset();
+ }
+
+ void RunContext::handleUnfinishedSections() {
+ // If sections ended prematurely due to an exception we stored their
+ // infos here so we can tear them down outside the unwind process.
+ for (auto it = m_unfinishedSections.rbegin(),
+ itEnd = m_unfinishedSections.rend();
+ it != itEnd;
+ ++it)
+ sectionEnded(*it);
+ m_unfinishedSections.clear();
+ }
+
+ void RunContext::handleExpr(
+ AssertionInfo const& info,
+ ITransientExpression const& expr,
+ AssertionReaction& reaction
+ ) {
+ m_reporter->assertionStarting( info );
+
+ bool negated = isFalseTest( info.resultDisposition );
+ bool result = expr.getResult() != negated;
+
+ if( result ) {
+ if (!m_includeSuccessfulResults) {
+ assertionPassed();
+ }
+ else {
+ reportExpr(info, ResultWas::Ok, &expr, negated);
+ }
+ }
+ else {
+ reportExpr(info, ResultWas::ExpressionFailed, &expr, negated );
+ populateReaction( reaction );
+ }
+ }
+ void RunContext::reportExpr(
+ AssertionInfo const &info,
+ ResultWas::OfType resultType,
+ ITransientExpression const *expr,
+ bool negated ) {
+
+ m_lastAssertionInfo = info;
+ AssertionResultData data( resultType, LazyExpression( negated ) );
+
+ AssertionResult assertionResult{ info, data };
+ assertionResult.m_resultData.lazyExpression.m_transientExpression = expr;
+
+ assertionEnded( assertionResult );
+ }
+
+ void RunContext::handleMessage(
+ AssertionInfo const& info,
+ ResultWas::OfType resultType,
+ StringRef const& message,
+ AssertionReaction& reaction
+ ) {
+ m_reporter->assertionStarting( info );
+
+ m_lastAssertionInfo = info;
+
+ AssertionResultData data( resultType, LazyExpression( false ) );
+ data.message = message;
+ AssertionResult assertionResult{ m_lastAssertionInfo, data };
+ assertionEnded( assertionResult );
+ if( !assertionResult.isOk() )
+ populateReaction( reaction );
+ }
+ void RunContext::handleUnexpectedExceptionNotThrown(
+ AssertionInfo const& info,
+ AssertionReaction& reaction
+ ) {
+ handleNonExpr(info, Catch::ResultWas::DidntThrowException, reaction);
+ }
+
+ void RunContext::handleUnexpectedInflightException(
+ AssertionInfo const& info,
+ std::string const& message,
+ AssertionReaction& reaction
+ ) {
+ m_lastAssertionInfo = info;
+
+ AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) );
+ data.message = message;
+ AssertionResult assertionResult{ info, data };
+ assertionEnded( assertionResult );
+ populateReaction( reaction );
+ }
+
+ void RunContext::populateReaction( AssertionReaction& reaction ) {
+ reaction.shouldDebugBreak = m_config->shouldDebugBreak();
+ reaction.shouldThrow = aborting() || (m_lastAssertionInfo.resultDisposition & ResultDisposition::Normal);
+ }
+
+ void RunContext::handleIncomplete(
+ AssertionInfo const& info
+ ) {
+ m_lastAssertionInfo = info;
+
+ AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) );
+ data.message = "Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE";
+ AssertionResult assertionResult{ info, data };
+ assertionEnded( assertionResult );
+ }
+ void RunContext::handleNonExpr(
+ AssertionInfo const &info,
+ ResultWas::OfType resultType,
+ AssertionReaction &reaction
+ ) {
+ m_lastAssertionInfo = info;
+
+ AssertionResultData data( resultType, LazyExpression( false ) );
+ AssertionResult assertionResult{ info, data };
+ assertionEnded( assertionResult );
+
+ if( !assertionResult.isOk() )
+ populateReaction( reaction );
+ }
+
+
+ IResultCapture& getResultCapture() {
+ if (auto* capture = getCurrentContext().getResultCapture())
+ return *capture;
+ else
+ CATCH_INTERNAL_ERROR("No result capture instance");
+ }
+}
diff --git a/include/internal/catch_run_context.h b/include/internal/catch_run_context.h
new file mode 100644
index 0000000..d0007a3
--- /dev/null
+++ b/include/internal/catch_run_context.h
@@ -0,0 +1,146 @@
+ /*
+ * Created by Phil on 22/10/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_RUNNER_IMPL_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_RUNNER_IMPL_HPP_INCLUDED
+
+#include "catch_interfaces_runner.h"
+#include "catch_interfaces_reporter.h"
+#include "catch_interfaces_exception.h"
+#include "catch_config.hpp"
+#include "catch_test_registry.h"
+#include "catch_test_case_info.h"
+#include "catch_capture.hpp"
+#include "catch_totals.h"
+#include "catch_test_spec.h"
+#include "catch_test_case_tracker.h"
+#include "catch_timer.h"
+#include "catch_assertionhandler.h"
+#include "catch_fatal_condition.h"
+
+#include <string>
+
+namespace Catch {
+
+ struct IMutableContext;
+
+ ///////////////////////////////////////////////////////////////////////////
+
+ class RunContext : public IResultCapture, public IRunner {
+
+ public:
+ RunContext( RunContext const& ) = delete;
+ RunContext& operator =( RunContext const& ) = delete;
+
+ explicit RunContext( IConfigPtr const& _config, IStreamingReporterPtr&& reporter );
+
+ ~RunContext() override;
+
+ void testGroupStarting( std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount );
+ void testGroupEnded( std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount );
+
+ Totals runTest(TestCase const& testCase);
+
+ IConfigPtr config() const;
+ IStreamingReporter& reporter() const;
+
+ public: // IResultCapture
+
+ // Assertion handlers
+ void handleExpr
+ ( AssertionInfo const& info,
+ ITransientExpression const& expr,
+ AssertionReaction& reaction ) override;
+ void handleMessage
+ ( AssertionInfo const& info,
+ ResultWas::OfType resultType,
+ StringRef const& message,
+ AssertionReaction& reaction ) override;
+ void handleUnexpectedExceptionNotThrown
+ ( AssertionInfo const& info,
+ AssertionReaction& reaction ) override;
+ void handleUnexpectedInflightException
+ ( AssertionInfo const& info,
+ std::string const& message,
+ AssertionReaction& reaction ) override;
+ void handleIncomplete
+ ( AssertionInfo const& info ) override;
+ void handleNonExpr
+ ( AssertionInfo const &info,
+ ResultWas::OfType resultType,
+ AssertionReaction &reaction ) override;
+
+ bool sectionStarted( SectionInfo const& sectionInfo, Counts& assertions ) override;
+
+ void sectionEnded( SectionEndInfo const& endInfo ) override;
+ void sectionEndedEarly( SectionEndInfo const& endInfo ) override;
+
+ void benchmarkStarting( BenchmarkInfo const& info ) override;
+ void benchmarkEnded( BenchmarkStats const& stats ) override;
+
+ void pushScopedMessage( MessageInfo const& message ) override;
+ void popScopedMessage( MessageInfo const& message ) override;
+
+ std::string getCurrentTestName() const override;
+
+ const AssertionResult* getLastResult() const override;
+
+ void exceptionEarlyReported() override;
+
+ void handleFatalErrorCondition( StringRef message ) override;
+
+ bool lastAssertionPassed() override;
+
+ void assertionPassed() override;
+
+ public:
+ // !TBD We need to do this another way!
+ bool aborting() const override;
+
+ private:
+
+ void runCurrentTest( std::string& redirectedCout, std::string& redirectedCerr );
+ void invokeActiveTestCase();
+
+ void resetAssertionInfo();
+ bool testForMissingAssertions( Counts& assertions );
+
+ void assertionEnded( AssertionResult const& result );
+ void reportExpr
+ ( AssertionInfo const &info,
+ ResultWas::OfType resultType,
+ ITransientExpression const *expr,
+ bool negated );
+
+ void populateReaction( AssertionReaction& reaction );
+
+ private:
+
+ void handleUnfinishedSections();
+
+ TestRunInfo m_runInfo;
+ IMutableContext& m_context;
+ TestCase const* m_activeTestCase = nullptr;
+ ITracker* m_testCaseTracker;
+ Option<AssertionResult> m_lastResult;
+
+ IConfigPtr m_config;
+ Totals m_totals;
+ IStreamingReporterPtr m_reporter;
+ std::vector<MessageInfo> m_messages;
+ AssertionInfo m_lastAssertionInfo;
+ std::vector<SectionEndInfo> m_unfinishedSections;
+ std::vector<ITracker*> m_activeSections;
+ TrackerContext m_trackerContext;
+ bool m_lastAssertionPassed = false;
+ bool m_shouldReportUnexpected = true;
+ bool m_includeSuccessfulResults;
+ };
+
+} // end namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_RUNNER_IMPL_HPP_INCLUDED
diff --git a/include/internal/catch_section.cpp b/include/internal/catch_section.cpp
new file mode 100644
index 0000000..72a57d5
--- /dev/null
+++ b/include/internal/catch_section.cpp
@@ -0,0 +1,38 @@
+/*
+ * Created by Phil on 03/11/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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_section.h"
+#include "catch_capture.hpp"
+#include "catch_uncaught_exceptions.h"
+
+namespace Catch {
+
+ Section::Section( SectionInfo const& info )
+ : m_info( info ),
+ m_sectionIncluded( getResultCapture().sectionStarted( m_info, m_assertions ) )
+ {
+ m_timer.start();
+ }
+
+ Section::~Section() {
+ if( m_sectionIncluded ) {
+ SectionEndInfo endInfo( m_info, m_assertions, m_timer.getElapsedSeconds() );
+ if( uncaught_exceptions() )
+ getResultCapture().sectionEndedEarly( endInfo );
+ else
+ getResultCapture().sectionEnded( endInfo );
+ }
+ }
+
+ // This indicates whether the section should be executed or not
+ Section::operator bool() const {
+ return m_sectionIncluded;
+ }
+
+
+} // end namespace Catch
diff --git a/include/internal/catch_section.h b/include/internal/catch_section.h
new file mode 100644
index 0000000..1e5b1c3
--- /dev/null
+++ b/include/internal/catch_section.h
@@ -0,0 +1,41 @@
+/*
+ * Created by Phil on 03/12/2013.
+ * Copyright 2013 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_SECTION_H_INCLUDED
+#define TWOBLUECUBES_CATCH_SECTION_H_INCLUDED
+
+#include "catch_section_info.h"
+#include "catch_totals.h"
+#include "catch_timer.h"
+
+#include <string>
+
+namespace Catch {
+
+ class Section : NonCopyable {
+ public:
+ Section( SectionInfo const& info );
+ ~Section();
+
+ // This indicates whether the section should be executed or not
+ explicit operator bool() const;
+
+ private:
+ SectionInfo m_info;
+
+ std::string m_name;
+ Counts m_assertions;
+ bool m_sectionIncluded;
+ Timer m_timer;
+ };
+
+} // end namespace Catch
+
+ #define INTERNAL_CATCH_SECTION( ... ) \
+ if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) )
+
+#endif // TWOBLUECUBES_CATCH_SECTION_H_INCLUDED
diff --git a/include/internal/catch_section_info.cpp b/include/internal/catch_section_info.cpp
new file mode 100644
index 0000000..e2846b8
--- /dev/null
+++ b/include/internal/catch_section_info.cpp
@@ -0,0 +1,25 @@
+/*
+ * Created by Martin on 01/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_section_info.h"
+
+namespace Catch {
+
+ SectionInfo::SectionInfo
+ ( SourceLineInfo const& _lineInfo,
+ std::string const& _name,
+ std::string const& _description )
+ : name( _name ),
+ description( _description ),
+ lineInfo( _lineInfo )
+ {}
+
+ SectionEndInfo::SectionEndInfo( SectionInfo const& _sectionInfo, Counts const& _prevAssertions, double _durationInSeconds )
+ : sectionInfo( _sectionInfo ), prevAssertions( _prevAssertions ), durationInSeconds( _durationInSeconds )
+ {}
+
+} // end namespace Catch
diff --git a/include/internal/catch_section_info.h b/include/internal/catch_section_info.h
new file mode 100644
index 0000000..86681ba
--- /dev/null
+++ b/include/internal/catch_section_info.h
@@ -0,0 +1,39 @@
+/*
+ * Created by Phil on 03/11/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_SECTION_INFO_H_INCLUDED
+#define TWOBLUECUBES_CATCH_SECTION_INFO_H_INCLUDED
+
+#include "catch_common.h"
+#include "catch_totals.h"
+
+#include <string>
+
+namespace Catch {
+
+ struct SectionInfo {
+ SectionInfo
+ ( SourceLineInfo const& _lineInfo,
+ std::string const& _name,
+ std::string const& _description = std::string() );
+
+ std::string name;
+ std::string description;
+ SourceLineInfo lineInfo;
+ };
+
+ struct SectionEndInfo {
+ SectionEndInfo( SectionInfo const& _sectionInfo, Counts const& _prevAssertions, double _durationInSeconds );
+
+ SectionInfo sectionInfo;
+ Counts prevAssertions;
+ double durationInSeconds;
+ };
+
+} // end namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_SECTION_INFO_H_INCLUDED
diff --git a/include/internal/catch_session.cpp b/include/internal/catch_session.cpp
new file mode 100644
index 0000000..1d3ce06
--- /dev/null
+++ b/include/internal/catch_session.cpp
@@ -0,0 +1,273 @@
+/*
+ * 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_session.h"
+#include "catch_commandline.h"
+#include "catch_console_colour.h"
+#include "catch_enforce.h"
+#include "catch_list.h"
+#include "catch_run_context.h"
+#include "catch_stream.h"
+#include "catch_test_spec.h"
+#include "catch_version.h"
+#include "catch_interfaces_reporter.h"
+#include "catch_random_number_generator.h"
+#include "catch_startup_exception_registry.h"
+#include "catch_text.h"
+
+#include <cstdlib>
+#include <iomanip>
+
+namespace Catch {
+
+ namespace {
+ const int MaxExitCode = 255;
+
+ IStreamingReporterPtr createReporter(std::string const& reporterName, IConfigPtr const& config) {
+ auto reporter = Catch::getRegistryHub().getReporterRegistry().create(reporterName, config);
+ CATCH_ENFORCE(reporter, "No reporter registered with name: '" << reporterName << "'");
+
+ return reporter;
+ }
+
+#ifndef CATCH_CONFIG_DEFAULT_REPORTER
+#define CATCH_CONFIG_DEFAULT_REPORTER "console"
+#endif
+
+ IStreamingReporterPtr makeReporter(std::shared_ptr<Config> const& config) {
+ auto const& reporterNames = config->getReporterNames();
+ if (reporterNames.empty())
+ return createReporter(CATCH_CONFIG_DEFAULT_REPORTER, config);
+
+ IStreamingReporterPtr reporter;
+ for (auto const& name : reporterNames)
+ addReporter(reporter, createReporter(name, config));
+ return reporter;
+ }
+
+#undef CATCH_CONFIG_DEFAULT_REPORTER
+
+ void addListeners(IStreamingReporterPtr& reporters, IConfigPtr const& config) {
+ auto const& listeners = Catch::getRegistryHub().getReporterRegistry().getListeners();
+ for (auto const& listener : listeners)
+ addReporter(reporters, listener->create(Catch::ReporterConfig(config)));
+ }
+
+
+ Catch::Totals runTests(std::shared_ptr<Config> const& config) {
+ IStreamingReporterPtr reporter = makeReporter(config);
+ addListeners(reporter, config);
+
+ RunContext context(config, std::move(reporter));
+
+ Totals totals;
+
+ context.testGroupStarting(config->name(), 1, 1);
+
+ TestSpec testSpec = config->testSpec();
+ if (!testSpec.hasFilters())
+ testSpec = TestSpecParser(ITagAliasRegistry::get()).parse("~[.]").testSpec(); // All not hidden tests
+
+ auto const& allTestCases = getAllTestCasesSorted(*config);
+ for (auto const& testCase : allTestCases) {
+ if (!context.aborting() && matchTest(testCase, testSpec, *config))
+ totals += context.runTest(testCase);
+ else
+ context.reporter().skipTest(testCase);
+ }
+
+ context.testGroupEnded(config->name(), totals, 1, 1);
+ return totals;
+ }
+
+ void applyFilenamesAsTags(Catch::IConfig const& config) {
+ auto& tests = const_cast<std::vector<TestCase>&>(getAllTestCasesSorted(config));
+ for (auto& testCase : tests) {
+ auto tags = testCase.tags;
+
+ std::string filename = testCase.lineInfo.file;
+ auto lastSlash = filename.find_last_of("\\/");
+ if (lastSlash != std::string::npos) {
+ filename.erase(0, lastSlash);
+ filename[0] = '#';
+ }
+
+ auto lastDot = filename.find_last_of('.');
+ if (lastDot != std::string::npos) {
+ filename.erase(lastDot);
+ }
+
+ tags.push_back(std::move(filename));
+ setTags(testCase, tags);
+ }
+ }
+
+ } // anon namespace
+
+ Session::Session() {
+ static bool alreadyInstantiated = false;
+ if( alreadyInstantiated ) {
+ try { CATCH_INTERNAL_ERROR( "Only one instance of Catch::Session can ever be used" ); }
+ catch(...) { getMutableRegistryHub().registerStartupException(); }
+ }
+
+ const auto& exceptions = getRegistryHub().getStartupExceptionRegistry().getExceptions();
+ if ( !exceptions.empty() ) {
+ m_startupExceptions = true;
+ Colour colourGuard( Colour::Red );
+ Catch::cerr() << "Errors occured during startup!" << '\n';
+ // iterate over all exceptions and notify user
+ for ( const auto& ex_ptr : exceptions ) {
+ try {
+ std::rethrow_exception(ex_ptr);
+ } catch ( std::exception const& ex ) {
+ Catch::cerr() << Column( ex.what() ).indent(2) << '\n';
+ }
+ }
+ }
+
+ alreadyInstantiated = true;
+ m_cli = makeCommandLineParser( m_configData );
+ }
+ Session::~Session() {
+ Catch::cleanUp();
+ }
+
+ void Session::showHelp() const {
+ Catch::cout()
+ << "\nCatch v" << libraryVersion() << "\n"
+ << m_cli << std::endl
+ << "For more detailed usage please see the project docs\n" << std::endl;
+ }
+ void Session::libIdentify() {
+ Catch::cout()
+ << std::left << std::setw(16) << "description: " << "A Catch test executable\n"
+ << std::left << std::setw(16) << "category: " << "testframework\n"
+ << std::left << std::setw(16) << "framework: " << "Catch Test\n"
+ << std::left << std::setw(16) << "version: " << libraryVersion() << std::endl;
+ }
+
+ int Session::applyCommandLine( int argc, char* argv[] ) {
+ if( m_startupExceptions )
+ return 1;
+
+ auto result = m_cli.parse( clara::Args( argc, argv ) );
+ if( !result ) {
+ Catch::cerr()
+ << Colour( Colour::Red )
+ << "\nError(s) in input:\n"
+ << Column( result.errorMessage() ).indent( 2 )
+ << "\n\n";
+ Catch::cerr() << "Run with -? for usage\n" << std::endl;
+ return MaxExitCode;
+ }
+
+ if( m_configData.showHelp )
+ showHelp();
+ if( m_configData.libIdentify )
+ libIdentify();
+ m_config.reset();
+ return 0;
+ }
+
+ void Session::useConfigData( ConfigData const& configData ) {
+ m_configData = configData;
+ m_config.reset();
+ }
+
+ int Session::run( int argc, char* argv[] ) {
+ if( m_startupExceptions )
+ return 1;
+ int returnCode = applyCommandLine( argc, argv );
+ if( returnCode == 0 )
+ returnCode = run();
+ return returnCode;
+ }
+
+#if defined(WIN32) && defined(UNICODE)
+ int Session::run( int argc, wchar_t* const argv[] ) {
+
+ char **utf8Argv = new char *[ argc ];
+
+ for ( int i = 0; i < argc; ++i ) {
+ int bufSize = WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, NULL, 0, NULL, NULL );
+
+ utf8Argv[ i ] = new char[ bufSize ];
+
+ WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, utf8Argv[i], bufSize, NULL, NULL );
+ }
+
+ int returnCode = run( argc, utf8Argv );
+
+ for ( int i = 0; i < argc; ++i )
+ delete [] utf8Argv[ i ];
+
+ delete [] utf8Argv;
+
+ return returnCode;
+ }
+#endif
+ int Session::run() {
+ if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeStart ) != 0 ) {
+ Catch::cout() << "...waiting for enter/ return before starting" << std::endl;
+ static_cast<void>(std::getchar());
+ }
+ int exitCode = runInternal();
+ if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeExit ) != 0 ) {
+ Catch::cout() << "...waiting for enter/ return before exiting, with code: " << exitCode << std::endl;
+ static_cast<void>(std::getchar());
+ }
+ return exitCode;
+ }
+
+ clara::Parser const& Session::cli() const {
+ return m_cli;
+ }
+ void Session::cli( clara::Parser const& newParser ) {
+ m_cli = newParser;
+ }
+ ConfigData& Session::configData() {
+ return m_configData;
+ }
+ Config& Session::config() {
+ if( !m_config )
+ m_config = std::make_shared<Config>( m_configData );
+ return *m_config;
+ }
+
+ int Session::runInternal() {
+ if( m_startupExceptions )
+ return 1;
+
+ if( m_configData.showHelp || m_configData.libIdentify )
+ return 0;
+
+ try
+ {
+ config(); // Force config to be constructed
+
+ seedRng( *m_config );
+
+ if( m_configData.filenamesAsTags )
+ applyFilenamesAsTags( *m_config );
+
+ // Handle list request
+ if( Option<std::size_t> listed = list( config() ) )
+ return static_cast<int>( *listed );
+
+ // Note that on unices only the lower 8 bits are usually used, clamping
+ // the return value to 255 prevents false negative when some multiple
+ // of 256 tests has failed
+ return (std::min)( MaxExitCode, static_cast<int>( runTests( m_config ).assertions.failed ) );
+ }
+ catch( std::exception& ex ) {
+ Catch::cerr() << ex.what() << std::endl;
+ return MaxExitCode;
+ }
+ }
+
+} // end namespace Catch
diff --git a/include/internal/catch_session.h b/include/internal/catch_session.h
new file mode 100644
index 0000000..b814aa6
--- /dev/null
+++ b/include/internal/catch_session.h
@@ -0,0 +1,53 @@
+/*
+ * Created by Phil on 31/10/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_RUNNER_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_RUNNER_HPP_INCLUDED
+
+#include "catch_commandline.h"
+#include "catch_config.hpp"
+#include "catch_text.h"
+
+#include <memory>
+
+namespace Catch {
+
+ class Session : NonCopyable {
+ public:
+
+ Session();
+ ~Session() override;
+
+ void showHelp() const;
+ void libIdentify();
+
+ int applyCommandLine( int argc, char* argv[] );
+
+ void useConfigData( ConfigData const& configData );
+
+ int run( int argc, char* argv[] );
+ #if defined(WIN32) && defined(UNICODE)
+ int run( int argc, wchar_t* const argv[] );
+ #endif
+ int run();
+
+ clara::Parser const& cli() const;
+ void cli( clara::Parser const& newParser );
+ ConfigData& configData();
+ Config& config();
+ private:
+ int runInternal();
+
+ clara::Parser m_cli;
+ ConfigData m_configData;
+ std::shared_ptr<Config> m_config;
+ bool m_startupExceptions = false;
+ };
+
+} // end namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_RUNNER_HPP_INCLUDED
diff --git a/include/internal/catch_startup_exception_registry.cpp b/include/internal/catch_startup_exception_registry.cpp
new file mode 100644
index 0000000..d58d18a
--- /dev/null
+++ b/include/internal/catch_startup_exception_registry.cpp
@@ -0,0 +1,26 @@
+/*
+ * Created by Martin on 04/06/2017.
+ * Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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_startup_exception_registry.h"
+
+namespace Catch {
+ void StartupExceptionRegistry::add( std::exception_ptr const& exception ) noexcept {
+ try {
+ m_exceptions.push_back(exception);
+ }
+ catch(...) {
+ // If we run out of memory during start-up there's really not a lot more we can do about it
+ std::terminate();
+ }
+ }
+
+ std::vector<std::exception_ptr> const& StartupExceptionRegistry::getExceptions() const noexcept {
+ return m_exceptions;
+ }
+
+} // end namespace Catch
diff --git a/include/internal/catch_startup_exception_registry.h b/include/internal/catch_startup_exception_registry.h
new file mode 100644
index 0000000..feb5660
--- /dev/null
+++ b/include/internal/catch_startup_exception_registry.h
@@ -0,0 +1,27 @@
+/*
+ * Created by Martin on 04/06/2017.
+ * Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_STARTUP_EXCEPTION_REGISTRY_H_INCLUDED
+#define TWOBLUECUBES_CATCH_STARTUP_EXCEPTION_REGISTRY_H_INCLUDED
+
+
+#include <vector>
+#include <exception>
+
+namespace Catch {
+
+ class StartupExceptionRegistry {
+ public:
+ void add(std::exception_ptr const& exception) noexcept;
+ std::vector<std::exception_ptr> const& getExceptions() const noexcept;
+ private:
+ std::vector<std::exception_ptr> m_exceptions;
+ };
+
+} // end namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_STARTUP_EXCEPTION_REGISTRY_H_INCLUDED
diff --git a/include/internal/catch_stream.cpp b/include/internal/catch_stream.cpp
new file mode 100644
index 0000000..125fd47
--- /dev/null
+++ b/include/internal/catch_stream.cpp
@@ -0,0 +1,213 @@
+/*
+ * Created by Phil on 17/01/2011.
+ * Copyright 2011 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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_common.h"
+#include "catch_enforce.h"
+#include "catch_stream.h"
+#include "catch_debug_console.h"
+#include "catch_stringref.h"
+
+#include <cstdio>
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <vector>
+#include <memory>
+
+#if defined(__clang__)
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wexit-time-destructors"
+#endif
+
+namespace Catch {
+
+ Catch::IStream::~IStream() = default;
+
+ namespace detail { namespace {
+ template<typename WriterF, std::size_t bufferSize=256>
+ class StreamBufImpl : public std::streambuf {
+ char data[bufferSize];
+ WriterF m_writer;
+
+ public:
+ StreamBufImpl() {
+ setp( data, data + sizeof(data) );
+ }
+
+ ~StreamBufImpl() noexcept {
+ StreamBufImpl::sync();
+ }
+
+ private:
+ int overflow( int c ) override {
+ sync();
+
+ if( c != EOF ) {
+ if( pbase() == epptr() )
+ m_writer( std::string( 1, static_cast<char>( c ) ) );
+ else
+ sputc( static_cast<char>( c ) );
+ }
+ return 0;
+ }
+
+ int sync() override {
+ if( pbase() != pptr() ) {
+ m_writer( std::string( pbase(), static_cast<std::string::size_type>( pptr() - pbase() ) ) );
+ setp( pbase(), epptr() );
+ }
+ return 0;
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+
+ struct OutputDebugWriter {
+
+ void operator()( std::string const&str ) {
+ writeToDebugConsole( str );
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+
+ class FileStream : public IStream {
+ mutable std::ofstream m_ofs;
+ public:
+ FileStream( StringRef filename ) {
+ m_ofs.open( filename.c_str() );
+ CATCH_ENFORCE( !m_ofs.fail(), "Unable to open file: '" << filename << "'" );
+ }
+ ~FileStream() override = default;
+ public: // IStream
+ std::ostream& stream() const override {
+ return m_ofs;
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+
+ class CoutStream : public IStream {
+ mutable std::ostream m_os;
+ public:
+ // Store the streambuf from cout up-front because
+ // cout may get redirected when running tests
+ CoutStream() : m_os( Catch::cout().rdbuf() ) {}
+ ~CoutStream() override = default;
+
+ public: // IStream
+ std::ostream& stream() const override { return m_os; }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+
+ class DebugOutStream : public IStream {
+ std::unique_ptr<StreamBufImpl<OutputDebugWriter>> m_streamBuf;
+ mutable std::ostream m_os;
+ public:
+ DebugOutStream()
+ : m_streamBuf( new StreamBufImpl<OutputDebugWriter>() ),
+ m_os( m_streamBuf.get() )
+ {}
+
+ ~DebugOutStream() override = default;
+
+ public: // IStream
+ std::ostream& stream() const override { return m_os; }
+ };
+
+ }} // namespace anon::detail
+
+ ///////////////////////////////////////////////////////////////////////////
+
+ auto makeStream( StringRef const &filename ) -> IStream const* {
+ if( filename.empty() )
+ return new detail::CoutStream();
+ else if( filename[0] == '%' ) {
+ if( filename == "%debug" )
+ return new detail::DebugOutStream();
+ else
+ CATCH_ERROR( "Unrecognised stream: '" << filename << "'" );
+ }
+ else
+ return new detail::FileStream( filename );
+ }
+
+
+ // This class encapsulates the idea of a pool of ostringstreams that can be reused.
+ struct StringStreams {
+ std::vector<std::unique_ptr<std::ostringstream>> m_streams;
+ std::vector<std::size_t> m_unused;
+ std::ostringstream m_referenceStream; // Used for copy state/ flags from
+ static StringStreams* s_instance;
+
+ auto add() -> std::size_t {
+ if( m_unused.empty() ) {
+ m_streams.push_back( std::unique_ptr<std::ostringstream>( new std::ostringstream ) );
+ return m_streams.size()-1;
+ }
+ else {
+ auto index = m_unused.back();
+ m_unused.pop_back();
+ return index;
+ }
+ }
+
+ void release( std::size_t index ) {
+ m_streams[index]->copyfmt( m_referenceStream ); // Restore initial flags and other state
+ m_unused.push_back(index);
+ }
+
+ // !TBD: put in TLS
+ static auto instance() -> StringStreams& {
+ if( !s_instance )
+ s_instance = new StringStreams();
+ return *s_instance;
+ }
+ static void cleanup() {
+ delete s_instance;
+ s_instance = nullptr;
+ }
+ };
+
+ StringStreams* StringStreams::s_instance = nullptr;
+
+ void ReusableStringStream::cleanup() {
+ StringStreams::cleanup();
+ }
+
+ ReusableStringStream::ReusableStringStream()
+ : m_index( StringStreams::instance().add() ),
+ m_oss( StringStreams::instance().m_streams[m_index].get() )
+ {}
+
+ ReusableStringStream::~ReusableStringStream() {
+ static_cast<std::ostringstream*>( m_oss )->str("");
+ m_oss->clear();
+ StringStreams::instance().release( m_index );
+ }
+
+ auto ReusableStringStream::str() const -> std::string {
+ return static_cast<std::ostringstream*>( m_oss )->str();
+ }
+
+
+ ///////////////////////////////////////////////////////////////////////////
+
+
+#ifndef CATCH_CONFIG_NOSTDOUT // If you #define this you must implement these functions
+ std::ostream& cout() { return std::cout; }
+ std::ostream& cerr() { return std::cerr; }
+ std::ostream& clog() { return std::clog; }
+#endif
+}
+
+#if defined(__clang__)
+# pragma clang diagnostic pop
+#endif
diff --git a/include/internal/catch_stream.h b/include/internal/catch_stream.h
new file mode 100644
index 0000000..c5e78b2
--- /dev/null
+++ b/include/internal/catch_stream.h
@@ -0,0 +1,51 @@
+/*
+ * Created by Phil on 2/12/2013.
+ * Copyright 2013 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ *
+ */
+#ifndef TWOBLUECUBES_CATCH_STREAM_H_INCLUDED
+#define TWOBLUECUBES_CATCH_STREAM_H_INCLUDED
+
+#include <iosfwd>
+#include <cstddef>
+#include <ostream>
+
+namespace Catch {
+
+ std::ostream& cout();
+ std::ostream& cerr();
+ std::ostream& clog();
+
+ class StringRef;
+
+ struct IStream {
+ virtual ~IStream();
+ virtual std::ostream& stream() const = 0;
+ };
+
+ auto makeStream( StringRef const &filename ) -> IStream const*;
+
+ class ReusableStringStream {
+ std::size_t m_index;
+ std::ostream* m_oss;
+ public:
+ ReusableStringStream();
+ ~ReusableStringStream();
+
+ auto str() const -> std::string;
+
+ template<typename T>
+ auto operator << ( T const& value ) -> ReusableStringStream& {
+ *m_oss << value;
+ return *this;
+ }
+ auto get() -> std::ostream& { return *m_oss; }
+
+ static void cleanup();
+ };
+}
+
+#endif // TWOBLUECUBES_CATCH_STREAM_H_INCLUDED
diff --git a/include/internal/catch_string_manip.cpp b/include/internal/catch_string_manip.cpp
new file mode 100644
index 0000000..8476204
--- /dev/null
+++ b/include/internal/catch_string_manip.cpp
@@ -0,0 +1,77 @@
+/*
+ * Created by Martin on 25/07/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_string_manip.h"
+
+#include <algorithm>
+#include <ostream>
+#include <cstring>
+#include <cctype>
+
+namespace Catch {
+
+ bool startsWith( std::string const& s, std::string const& prefix ) {
+ return s.size() >= prefix.size() && std::equal(prefix.begin(), prefix.end(), s.begin());
+ }
+ bool startsWith( std::string const& s, char prefix ) {
+ return !s.empty() && s[0] == prefix;
+ }
+ bool endsWith( std::string const& s, std::string const& suffix ) {
+ return s.size() >= suffix.size() && std::equal(suffix.rbegin(), suffix.rend(), s.rbegin());
+ }
+ bool endsWith( std::string const& s, char suffix ) {
+ return !s.empty() && s[s.size()-1] == suffix;
+ }
+ bool contains( std::string const& s, std::string const& infix ) {
+ return s.find( infix ) != std::string::npos;
+ }
+ char toLowerCh(char c) {
+ return static_cast<char>( std::tolower( c ) );
+ }
+ void toLowerInPlace( std::string& s ) {
+ std::transform( s.begin(), s.end(), s.begin(), toLowerCh );
+ }
+ std::string toLower( std::string const& s ) {
+ std::string lc = s;
+ toLowerInPlace( lc );
+ return lc;
+ }
+ std::string trim( std::string const& str ) {
+ static char const* whitespaceChars = "\n\r\t ";
+ std::string::size_type start = str.find_first_not_of( whitespaceChars );
+ std::string::size_type end = str.find_last_not_of( whitespaceChars );
+
+ return start != std::string::npos ? str.substr( start, 1+end-start ) : std::string();
+ }
+
+ bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ) {
+ bool replaced = false;
+ std::size_t i = str.find( replaceThis );
+ while( i != std::string::npos ) {
+ replaced = true;
+ str = str.substr( 0, i ) + withThis + str.substr( i+replaceThis.size() );
+ if( i < str.size()-withThis.size() )
+ i = str.find( replaceThis, i+withThis.size() );
+ else
+ i = std::string::npos;
+ }
+ return replaced;
+ }
+
+ pluralise::pluralise( std::size_t count, std::string const& label )
+ : m_count( count ),
+ m_label( label )
+ {}
+
+ std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ) {
+ os << pluraliser.m_count << ' ' << pluraliser.m_label;
+ if( pluraliser.m_count != 1 )
+ os << 's';
+ return os;
+ }
+
+}
diff --git a/include/internal/catch_string_manip.h b/include/internal/catch_string_manip.h
new file mode 100644
index 0000000..6292cd5
--- /dev/null
+++ b/include/internal/catch_string_manip.h
@@ -0,0 +1,36 @@
+/*
+ * Created by Martin on 25/07/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)
+ */
+#ifndef TWOBLUECUBES_CATCH_STRING_MANIP_H_INCLUDED
+#define TWOBLUECUBES_CATCH_STRING_MANIP_H_INCLUDED
+
+#include <string>
+#include <iosfwd>
+
+namespace Catch {
+
+ bool startsWith( std::string const& s, std::string const& prefix );
+ bool startsWith( std::string const& s, char prefix );
+ bool endsWith( std::string const& s, std::string const& suffix );
+ bool endsWith( std::string const& s, char suffix );
+ bool contains( std::string const& s, std::string const& infix );
+ void toLowerInPlace( std::string& s );
+ std::string toLower( std::string const& s );
+ std::string trim( std::string const& str );
+ bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis );
+
+ struct pluralise {
+ pluralise( std::size_t count, std::string const& label );
+
+ friend std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser );
+
+ std::size_t m_count;
+ std::string m_label;
+ };
+}
+
+#endif // TWOBLUECUBES_CATCH_STRING_MANIP_H_INCLUDED
+
diff --git a/include/internal/catch_stringref.cpp b/include/internal/catch_stringref.cpp
new file mode 100644
index 0000000..b0b2f8e
--- /dev/null
+++ b/include/internal/catch_stringref.cpp
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2016 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+
+
+#if defined(__clang__)
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wexit-time-destructors"
+#endif
+
+#include "catch_stringref.h"
+
+#include <ostream>
+#include <cstring>
+#include <cstdint>
+
+namespace {
+ const uint32_t byte_2_lead = 0xC0;
+ const uint32_t byte_3_lead = 0xE0;
+ const uint32_t byte_4_lead = 0xF0;
+}
+
+namespace Catch {
+ StringRef::StringRef( char const* rawChars ) noexcept
+ : StringRef( rawChars, static_cast<StringRef::size_type>(std::strlen(rawChars) ) )
+ {}
+
+ StringRef::operator std::string() const {
+ return std::string( m_start, m_size );
+ }
+
+ void StringRef::swap( StringRef& other ) noexcept {
+ std::swap( m_start, other.m_start );
+ std::swap( m_size, other.m_size );
+ std::swap( m_data, other.m_data );
+ }
+
+ auto StringRef::c_str() const -> char const* {
+ if( isSubstring() )
+ const_cast<StringRef*>( this )->takeOwnership();
+ return m_start;
+ }
+ auto StringRef::data() const noexcept -> char const* {
+ return m_start;
+ }
+
+ auto StringRef::isOwned() const noexcept -> bool {
+ return m_data != nullptr;
+ }
+ auto StringRef::isSubstring() const noexcept -> bool {
+ return m_start[m_size] != '\0';
+ }
+
+ void StringRef::takeOwnership() {
+ if( !isOwned() ) {
+ m_data = new char[m_size+1];
+ memcpy( m_data, m_start, m_size );
+ m_data[m_size] = '\0';
+ m_start = m_data;
+ }
+ }
+ auto StringRef::substr( size_type start, size_type size ) const noexcept -> StringRef {
+ if( start < m_size )
+ return StringRef( m_start+start, size );
+ else
+ return StringRef();
+ }
+ auto StringRef::operator == ( StringRef const& other ) const noexcept -> bool {
+ return
+ size() == other.size() &&
+ (std::strncmp( m_start, other.m_start, size() ) == 0);
+ }
+ auto StringRef::operator != ( StringRef const& other ) const noexcept -> bool {
+ return !operator==( other );
+ }
+
+ auto StringRef::operator[](size_type index) const noexcept -> char {
+ return m_start[index];
+ }
+
+ auto StringRef::numberOfCharacters() const noexcept -> size_type {
+ size_type noChars = m_size;
+ // Make adjustments for uft encodings
+ for( size_type i=0; i < m_size; ++i ) {
+ char c = m_start[i];
+ if( ( c & byte_2_lead ) == byte_2_lead ) {
+ noChars--;
+ if (( c & byte_3_lead ) == byte_3_lead )
+ noChars--;
+ if( ( c & byte_4_lead ) == byte_4_lead )
+ noChars--;
+ }
+ }
+ return noChars;
+ }
+
+ auto operator + ( StringRef const& lhs, StringRef const& rhs ) -> std::string {
+ std::string str;
+ str.reserve( lhs.size() + rhs.size() );
+ str += lhs;
+ str += rhs;
+ return str;
+ }
+ auto operator + ( StringRef const& lhs, const char* rhs ) -> std::string {
+ return std::string( lhs ) + std::string( rhs );
+ }
+ auto operator + ( char const* lhs, StringRef const& rhs ) -> std::string {
+ return std::string( lhs ) + std::string( rhs );
+ }
+
+ auto operator << ( std::ostream& os, StringRef const& str ) -> std::ostream& {
+ return os << str.c_str();
+ }
+
+} // namespace Catch
+
+#if defined(__clang__)
+# pragma clang diagnostic pop
+#endif
diff --git a/include/internal/catch_stringref.h b/include/internal/catch_stringref.h
new file mode 100644
index 0000000..0f9e780
--- /dev/null
+++ b/include/internal/catch_stringref.h
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2016 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef CATCH_STRINGREF_H_INCLUDED
+#define CATCH_STRINGREF_H_INCLUDED
+
+#include <cstddef>
+#include <string>
+#include <iosfwd>
+
+namespace Catch {
+
+ class StringData;
+
+ /// A non-owning string class (similar to the forthcoming std::string_view)
+ /// Note that, because a StringRef may be a substring of another string,
+ /// it may not be null terminated. c_str() must return a null terminated
+ /// string, however, and so the StringRef will internally take ownership
+ /// (taking a copy), if necessary. In theory this ownership is not externally
+ /// visible - but it does mean (substring) StringRefs should not be shared between
+ /// threads.
+ class StringRef {
+ public:
+ using size_type = std::size_t;
+
+ private:
+ friend struct StringRefTestAccess;
+
+ char const* m_start;
+ size_type m_size;
+
+ char* m_data = nullptr;
+
+ void takeOwnership();
+
+ static constexpr char const* const s_empty = "";
+
+ public: // construction/ assignment
+ StringRef() noexcept
+ : StringRef( s_empty, 0 )
+ {}
+
+ StringRef( StringRef const& other ) noexcept
+ : m_start( other.m_start ),
+ m_size( other.m_size )
+ {}
+
+ StringRef( StringRef&& other ) noexcept
+ : m_start( other.m_start ),
+ m_size( other.m_size ),
+ m_data( other.m_data )
+ {
+ other.m_data = nullptr;
+ }
+
+ StringRef( char const* rawChars ) noexcept;
+
+ StringRef( char const* rawChars, size_type size ) noexcept
+ : m_start( rawChars ),
+ m_size( size )
+ {}
+
+ StringRef( std::string const& stdString ) noexcept
+ : m_start( stdString.c_str() ),
+ m_size( stdString.size() )
+ {}
+
+ ~StringRef() noexcept {
+ delete[] m_data;
+ }
+
+ auto operator = ( StringRef const &other ) noexcept -> StringRef& {
+ delete[] m_data;
+ m_data = nullptr;
+ m_start = other.m_start;
+ m_size = other.m_size;
+ return *this;
+ }
+
+ operator std::string() const;
+
+ void swap( StringRef& other ) noexcept;
+
+ public: // operators
+ auto operator == ( StringRef const& other ) const noexcept -> bool;
+ auto operator != ( StringRef const& other ) const noexcept -> bool;
+
+ auto operator[] ( size_type index ) const noexcept -> char;
+
+ public: // named queries
+ auto empty() const noexcept -> bool {
+ return m_size == 0;
+ }
+ auto size() const noexcept -> size_type {
+ return m_size;
+ }
+
+ auto numberOfCharacters() const noexcept -> size_type;
+ auto c_str() const -> char const*;
+
+ public: // substrings and searches
+ auto substr( size_type start, size_type size ) const noexcept -> StringRef;
+
+ private: // ownership queries - may not be consistent between calls
+ auto isOwned() const noexcept -> bool;
+ auto isSubstring() const noexcept -> bool;
+ auto data() const noexcept -> char const*;
+ };
+
+ auto operator + ( StringRef const& lhs, StringRef const& rhs ) -> std::string;
+ auto operator + ( StringRef const& lhs, char const* rhs ) -> std::string;
+ auto operator + ( char const* lhs, StringRef const& rhs ) -> std::string;
+
+ auto operator << ( std::ostream& os, StringRef const& sr ) -> std::ostream&;
+
+ inline auto operator "" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef {
+ return StringRef( rawChars, size );
+ }
+
+} // namespace Catch
+
+#endif // CATCH_STRINGREF_H_INCLUDED
diff --git a/include/internal/catch_suppress_warnings.h b/include/internal/catch_suppress_warnings.h
new file mode 100644
index 0000000..9280114
--- /dev/null
+++ b/include/internal/catch_suppress_warnings.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2014 Two Blue Cubes Ltd
+ *
+ * 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)
+ */
+
+#ifdef __clang__
+# ifdef __ICC // icpc defines the __clang__ macro
+# pragma warning(push)
+# pragma warning(disable: 161 1682)
+# else // __ICC
+# pragma clang diagnostic ignored "-Wunused-variable"
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wpadded"
+# pragma clang diagnostic ignored "-Wswitch-enum"
+# pragma clang diagnostic ignored "-Wcovered-switch-default"
+# endif
+#elif defined __GNUC__
+# pragma GCC diagnostic ignored "-Wunused-variable"
+# pragma GCC diagnostic ignored "-Wparentheses"
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wpadded"
+#endif
diff --git a/include/internal/catch_tag_alias.cpp b/include/internal/catch_tag_alias.cpp
new file mode 100644
index 0000000..2ea4540
--- /dev/null
+++ b/include/internal/catch_tag_alias.cpp
@@ -0,0 +1,5 @@
+#include "catch_tag_alias.h"
+
+namespace Catch {
+ TagAlias::TagAlias(std::string const & _tag, SourceLineInfo _lineInfo): tag(_tag), lineInfo(_lineInfo) {}
+}
diff --git a/include/internal/catch_tag_alias.h b/include/internal/catch_tag_alias.h
new file mode 100644
index 0000000..a9e6eb3
--- /dev/null
+++ b/include/internal/catch_tag_alias.h
@@ -0,0 +1,26 @@
+/*
+ * Created by Phil on 27/6/2014.
+ * Copyright 2014 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_TAG_ALIAS_H_INCLUDED
+#define TWOBLUECUBES_CATCH_TAG_ALIAS_H_INCLUDED
+
+#include "catch_common.h"
+
+#include <string>
+
+namespace Catch {
+
+ struct TagAlias {
+ TagAlias(std::string const& _tag, SourceLineInfo _lineInfo);
+
+ std::string tag;
+ SourceLineInfo lineInfo;
+ };
+
+} // end namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_TAG_ALIAS_H_INCLUDED
diff --git a/include/internal/catch_tag_alias_autoregistrar.cpp b/include/internal/catch_tag_alias_autoregistrar.cpp
new file mode 100644
index 0000000..35ed059
--- /dev/null
+++ b/include/internal/catch_tag_alias_autoregistrar.cpp
@@ -0,0 +1,15 @@
+#include "catch_tag_alias_autoregistrar.h"
+#include "catch_interfaces_registry_hub.h"
+
+namespace Catch {
+
+ RegistrarForTagAliases::RegistrarForTagAliases(char const* alias, char const* tag, SourceLineInfo const& lineInfo) {
+ try {
+ getMutableRegistryHub().registerTagAlias(alias, tag, lineInfo);
+ } catch (...) {
+ // Do not throw when constructing global objects, instead register the exception to be processed later
+ getMutableRegistryHub().registerStartupException();
+ }
+ }
+
+}
diff --git a/include/internal/catch_tag_alias_autoregistrar.h b/include/internal/catch_tag_alias_autoregistrar.h
new file mode 100644
index 0000000..32a5734
--- /dev/null
+++ b/include/internal/catch_tag_alias_autoregistrar.h
@@ -0,0 +1,25 @@
+/*
+ * Created by Martin on 27/07/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)
+ */
+#ifndef TWOBLUECUBES_CATCH_TAG_ALIAS_AUTOREGISTRAR_H_INCLUDED
+#define TWOBLUECUBES_CATCH_TAG_ALIAS_AUTOREGISTRAR_H_INCLUDED
+
+#include "catch_common.h"
+
+namespace Catch {
+
+ struct RegistrarForTagAliases {
+ RegistrarForTagAliases( char const* alias, char const* tag, SourceLineInfo const& lineInfo );
+ };
+
+} // end namespace Catch
+
+#define CATCH_REGISTER_TAG_ALIAS( alias, spec ) \
+ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
+ namespace{ Catch::RegistrarForTagAliases INTERNAL_CATCH_UNIQUE_NAME( AutoRegisterTagAlias )( alias, spec, CATCH_INTERNAL_LINEINFO ); } \
+ CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS
+
+#endif // TWOBLUECUBES_CATCH_TAG_ALIAS_AUTOREGISTRAR_H_INCLUDED
diff --git a/include/internal/catch_tag_alias_registry.cpp b/include/internal/catch_tag_alias_registry.cpp
new file mode 100644
index 0000000..98aea26
--- /dev/null
+++ b/include/internal/catch_tag_alias_registry.cpp
@@ -0,0 +1,58 @@
+/*
+ * Created by Phil on 27/6/2014.
+ * Copyright 2014 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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_tag_alias_registry.h"
+#include "catch_console_colour.h"
+#include "catch_enforce.h"
+#include "catch_interfaces_registry_hub.h"
+#include "catch_string_manip.h"
+
+#include <sstream>
+
+namespace Catch {
+
+ TagAliasRegistry::~TagAliasRegistry() {}
+
+ TagAlias const* TagAliasRegistry::find( std::string const& alias ) const {
+ auto it = m_registry.find( alias );
+ if( it != m_registry.end() )
+ return &(it->second);
+ else
+ return nullptr;
+ }
+
+ std::string TagAliasRegistry::expandAliases( std::string const& unexpandedTestSpec ) const {
+ std::string expandedTestSpec = unexpandedTestSpec;
+ for( auto const& registryKvp : m_registry ) {
+ std::size_t pos = expandedTestSpec.find( registryKvp.first );
+ if( pos != std::string::npos ) {
+ expandedTestSpec = expandedTestSpec.substr( 0, pos ) +
+ registryKvp.second.tag +
+ expandedTestSpec.substr( pos + registryKvp.first.size() );
+ }
+ }
+ return expandedTestSpec;
+ }
+
+ void TagAliasRegistry::add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) {
+ CATCH_ENFORCE( startsWith(alias, "[@") && endsWith(alias, ']'),
+ "error: tag alias, '" << alias << "' is not of the form [@alias name].\n" << lineInfo );
+
+ CATCH_ENFORCE( m_registry.insert(std::make_pair(alias, TagAlias(tag, lineInfo))).second,
+ "error: tag alias, '" << alias << "' already registered.\n"
+ << "\tFirst seen at: " << find(alias)->lineInfo << "\n"
+ << "\tRedefined at: " << lineInfo );
+ }
+
+ ITagAliasRegistry::~ITagAliasRegistry() {}
+
+ ITagAliasRegistry const& ITagAliasRegistry::get() {
+ return getRegistryHub().getTagAliasRegistry();
+ }
+
+} // end namespace Catch
diff --git a/include/internal/catch_tag_alias_registry.h b/include/internal/catch_tag_alias_registry.h
new file mode 100644
index 0000000..d3bb8ff
--- /dev/null
+++ b/include/internal/catch_tag_alias_registry.h
@@ -0,0 +1,31 @@
+/*
+ * Created by Phil on 27/6/2014.
+ * Copyright 2014 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_TAG_ALIAS_REGISTRY_H_INCLUDED
+#define TWOBLUECUBES_CATCH_TAG_ALIAS_REGISTRY_H_INCLUDED
+
+#include "catch_interfaces_tag_alias_registry.h"
+#include "catch_tag_alias.h"
+
+#include <map>
+
+namespace Catch {
+
+ class TagAliasRegistry : public ITagAliasRegistry {
+ public:
+ ~TagAliasRegistry() override;
+ TagAlias const* find( std::string const& alias ) const override;
+ std::string expandAliases( std::string const& unexpandedTestSpec ) const override;
+ void add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo );
+
+ private:
+ std::map<std::string, TagAlias> m_registry;
+ };
+
+} // end namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_TAG_ALIAS_REGISTRY_H_INCLUDED
diff --git a/include/internal/catch_test_case_info.cpp b/include/internal/catch_test_case_info.cpp
new file mode 100644
index 0000000..4ab9775
--- /dev/null
+++ b/include/internal/catch_test_case_info.cpp
@@ -0,0 +1,178 @@
+/*
+ * Created by Phil on 14/08/2012.
+ * Copyright 2012 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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_test_case_info.h"
+#include "catch_enforce.h"
+#include "catch_test_spec.h"
+#include "catch_interfaces_testcase.h"
+#include "catch_string_manip.h"
+
+#include <cctype>
+#include <exception>
+#include <algorithm>
+#include <sstream>
+
+namespace Catch {
+
+ TestCaseInfo::SpecialProperties parseSpecialTag( std::string const& tag ) {
+ if( startsWith( tag, '.' ) ||
+ tag == "!hide" )
+ return TestCaseInfo::IsHidden;
+ else if( tag == "!throws" )
+ return TestCaseInfo::Throws;
+ else if( tag == "!shouldfail" )
+ return TestCaseInfo::ShouldFail;
+ else if( tag == "!mayfail" )
+ return TestCaseInfo::MayFail;
+ else if( tag == "!nonportable" )
+ return TestCaseInfo::NonPortable;
+ else if( tag == "!benchmark" )
+ return static_cast<TestCaseInfo::SpecialProperties>( TestCaseInfo::Benchmark | TestCaseInfo::IsHidden );
+ else
+ return TestCaseInfo::None;
+ }
+ bool isReservedTag( std::string const& tag ) {
+ return parseSpecialTag( tag ) == TestCaseInfo::None && tag.size() > 0 && !std::isalnum( tag[0] );
+ }
+ void enforceNotReservedTag( std::string const& tag, SourceLineInfo const& _lineInfo ) {
+ CATCH_ENFORCE( !isReservedTag(tag),
+ "Tag name: [" << tag << "] is not allowed.\n"
+ << "Tag names starting with non alpha-numeric characters are reserved\n"
+ << _lineInfo );
+ }
+
+ TestCase makeTestCase( ITestInvoker* _testCase,
+ std::string const& _className,
+ std::string const& _name,
+ std::string const& _descOrTags,
+ SourceLineInfo const& _lineInfo )
+ {
+ bool isHidden = false;
+
+ // Parse out tags
+ std::vector<std::string> tags;
+ std::string desc, tag;
+ bool inTag = false;
+ for (char c : _descOrTags) {
+ if( !inTag ) {
+ if( c == '[' )
+ inTag = true;
+ else
+ desc += c;
+ }
+ else {
+ if( c == ']' ) {
+ TestCaseInfo::SpecialProperties prop = parseSpecialTag( tag );
+ if( ( prop & TestCaseInfo::IsHidden ) != 0 )
+ isHidden = true;
+ else if( prop == TestCaseInfo::None )
+ enforceNotReservedTag( tag, _lineInfo );
+
+ tags.push_back( tag );
+ tag.clear();
+ inTag = false;
+ }
+ else
+ tag += c;
+ }
+ }
+ if( isHidden ) {
+ tags.push_back( "." );
+ }
+
+ TestCaseInfo info( _name, _className, desc, tags, _lineInfo );
+ return TestCase( _testCase, info );
+ }
+
+ void setTags( TestCaseInfo& testCaseInfo, std::vector<std::string> tags ) {
+ std::sort(begin(tags), end(tags));
+ tags.erase(std::unique(begin(tags), end(tags)), end(tags));
+ testCaseInfo.lcaseTags.clear();
+
+ for( auto const& tag : tags ) {
+ std::string lcaseTag = toLower( tag );
+ testCaseInfo.properties = static_cast<TestCaseInfo::SpecialProperties>( testCaseInfo.properties | parseSpecialTag( lcaseTag ) );
+ testCaseInfo.lcaseTags.push_back( lcaseTag );
+ }
+ testCaseInfo.tags = std::move(tags);
+ }
+
+ TestCaseInfo::TestCaseInfo( std::string const& _name,
+ std::string const& _className,
+ std::string const& _description,
+ std::vector<std::string> const& _tags,
+ SourceLineInfo const& _lineInfo )
+ : name( _name ),
+ className( _className ),
+ description( _description ),
+ lineInfo( _lineInfo ),
+ properties( None )
+ {
+ setTags( *this, _tags );
+ }
+
+ bool TestCaseInfo::isHidden() const {
+ return ( properties & IsHidden ) != 0;
+ }
+ bool TestCaseInfo::throws() const {
+ return ( properties & Throws ) != 0;
+ }
+ bool TestCaseInfo::okToFail() const {
+ return ( properties & (ShouldFail | MayFail ) ) != 0;
+ }
+ bool TestCaseInfo::expectedToFail() const {
+ return ( properties & (ShouldFail ) ) != 0;
+ }
+
+ std::string TestCaseInfo::tagsAsString() const {
+ std::string ret;
+ // '[' and ']' per tag
+ std::size_t full_size = 2 * tags.size();
+ for (const auto& tag : tags) {
+ full_size += tag.size();
+ }
+ ret.reserve(full_size);
+ for (const auto& tag : tags) {
+ ret.push_back('[');
+ ret.append(tag);
+ ret.push_back(']');
+ }
+
+ return ret;
+ }
+
+
+ TestCase::TestCase( ITestInvoker* testCase, TestCaseInfo const& info ) : TestCaseInfo( info ), test( testCase ) {}
+
+
+ TestCase TestCase::withName( std::string const& _newName ) const {
+ TestCase other( *this );
+ other.name = _newName;
+ return other;
+ }
+
+ void TestCase::invoke() const {
+ test->invoke();
+ }
+
+ bool TestCase::operator == ( TestCase const& other ) const {
+ return test.get() == other.test.get() &&
+ name == other.name &&
+ className == other.className;
+ }
+
+ bool TestCase::operator < ( TestCase const& other ) const {
+ return name < other.name;
+ }
+
+ TestCaseInfo const& TestCase::getTestCaseInfo() const
+ {
+ return *this;
+ }
+
+} // end namespace Catch
diff --git a/include/internal/catch_test_case_info.h b/include/internal/catch_test_case_info.h
new file mode 100644
index 0000000..2a911b0
--- /dev/null
+++ b/include/internal/catch_test_case_info.h
@@ -0,0 +1,90 @@
+/*
+ * Created by Phil on 29/10/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_TEST_CASE_INFO_H_INCLUDED
+#define TWOBLUECUBES_CATCH_TEST_CASE_INFO_H_INCLUDED
+
+#include "catch_common.h"
+
+#include <string>
+#include <vector>
+#include <memory>
+
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpadded"
+#endif
+
+namespace Catch {
+
+ struct ITestInvoker;
+
+ struct TestCaseInfo {
+ enum SpecialProperties{
+ None = 0,
+ IsHidden = 1 << 1,
+ ShouldFail = 1 << 2,
+ MayFail = 1 << 3,
+ Throws = 1 << 4,
+ NonPortable = 1 << 5,
+ Benchmark = 1 << 6
+ };
+
+ TestCaseInfo( std::string const& _name,
+ std::string const& _className,
+ std::string const& _description,
+ std::vector<std::string> const& _tags,
+ SourceLineInfo const& _lineInfo );
+
+ friend void setTags( TestCaseInfo& testCaseInfo, std::vector<std::string> tags );
+
+ bool isHidden() const;
+ bool throws() const;
+ bool okToFail() const;
+ bool expectedToFail() const;
+
+ std::string tagsAsString() const;
+
+ std::string name;
+ std::string className;
+ std::string description;
+ std::vector<std::string> tags;
+ std::vector<std::string> lcaseTags;
+ SourceLineInfo lineInfo;
+ SpecialProperties properties;
+ };
+
+ class TestCase : public TestCaseInfo {
+ public:
+
+ TestCase( ITestInvoker* testCase, TestCaseInfo const& info );
+
+ TestCase withName( std::string const& _newName ) const;
+
+ void invoke() const;
+
+ TestCaseInfo const& getTestCaseInfo() const;
+
+ bool operator == ( TestCase const& other ) const;
+ bool operator < ( TestCase const& other ) const;
+
+ private:
+ std::shared_ptr<ITestInvoker> test;
+ };
+
+ TestCase makeTestCase( ITestInvoker* testCase,
+ std::string const& className,
+ std::string const& name,
+ std::string const& description,
+ SourceLineInfo const& lineInfo );
+}
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
+#endif // TWOBLUECUBES_CATCH_TEST_CASE_INFO_H_INCLUDED
diff --git a/include/internal/catch_test_case_registry_impl.cpp b/include/internal/catch_test_case_registry_impl.cpp
new file mode 100644
index 0000000..89c7239
--- /dev/null
+++ b/include/internal/catch_test_case_registry_impl.cpp
@@ -0,0 +1,112 @@
+/*
+ * Created by Martin on 25/07/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_test_case_registry_impl.h"
+
+#include "catch_context.h"
+#include "catch_enforce.h"
+#include "catch_interfaces_registry_hub.h"
+#include "catch_random_number_generator.h"
+#include "catch_string_manip.h"
+#include "catch_test_case_info.h"
+
+#include <sstream>
+
+namespace Catch {
+
+ std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases ) {
+
+ std::vector<TestCase> sorted = unsortedTestCases;
+
+ switch( config.runOrder() ) {
+ case RunTests::InLexicographicalOrder:
+ std::sort( sorted.begin(), sorted.end() );
+ break;
+ case RunTests::InRandomOrder:
+ seedRng( config );
+ RandomNumberGenerator::shuffle( sorted );
+ break;
+ case RunTests::InDeclarationOrder:
+ // already in declaration order
+ break;
+ }
+ return sorted;
+ }
+ bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ) {
+ return testSpec.matches( testCase ) && ( config.allowThrows() || !testCase.throws() );
+ }
+
+ void enforceNoDuplicateTestCases( std::vector<TestCase> const& functions ) {
+ std::set<TestCase> seenFunctions;
+ for( auto const& function : functions ) {
+ auto prev = seenFunctions.insert( function );
+ CATCH_ENFORCE( prev.second,
+ "error: TEST_CASE( \"" << function.name << "\" ) already defined.\n"
+ << "\tFirst seen at " << prev.first->getTestCaseInfo().lineInfo << "\n"
+ << "\tRedefined at " << function.getTestCaseInfo().lineInfo );
+ }
+ }
+
+ std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config ) {
+ std::vector<TestCase> filtered;
+ filtered.reserve( testCases.size() );
+ for( auto const& testCase : testCases )
+ if( matchTest( testCase, testSpec, config ) )
+ filtered.push_back( testCase );
+ return filtered;
+ }
+ std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config ) {
+ return getRegistryHub().getTestCaseRegistry().getAllTestsSorted( config );
+ }
+
+ void TestRegistry::registerTest( TestCase const& testCase ) {
+ std::string name = testCase.getTestCaseInfo().name;
+ if( name.empty() ) {
+ ReusableStringStream rss;
+ rss << "Anonymous test case " << ++m_unnamedCount;
+ return registerTest( testCase.withName( rss.str() ) );
+ }
+ m_functions.push_back( testCase );
+ }
+
+ std::vector<TestCase> const& TestRegistry::getAllTests() const {
+ return m_functions;
+ }
+ std::vector<TestCase> const& TestRegistry::getAllTestsSorted( IConfig const& config ) const {
+ if( m_sortedFunctions.empty() )
+ enforceNoDuplicateTestCases( m_functions );
+
+ if( m_currentSortOrder != config.runOrder() || m_sortedFunctions.empty() ) {
+ m_sortedFunctions = sortTests( config, m_functions );
+ m_currentSortOrder = config.runOrder();
+ }
+ return m_sortedFunctions;
+ }
+
+
+
+ ///////////////////////////////////////////////////////////////////////////
+ TestInvokerAsFunction::TestInvokerAsFunction( void(*testAsFunction)() ) noexcept : m_testAsFunction( testAsFunction ) {}
+
+ void TestInvokerAsFunction::invoke() const {
+ m_testAsFunction();
+ }
+
+ std::string extractClassName( std::string const& classOrQualifiedMethodName ) {
+ std::string className = classOrQualifiedMethodName;
+ if( startsWith( className, '&' ) )
+ {
+ std::size_t lastColons = className.rfind( "::" );
+ std::size_t penultimateColons = className.rfind( "::", lastColons-1 );
+ if( penultimateColons == std::string::npos )
+ penultimateColons = 1;
+ className = className.substr( penultimateColons, lastColons-penultimateColons );
+ }
+ return className;
+ }
+
+} // end namespace Catch
diff --git a/include/internal/catch_test_case_registry_impl.h b/include/internal/catch_test_case_registry_impl.h
new file mode 100644
index 0000000..ad45e5a
--- /dev/null
+++ b/include/internal/catch_test_case_registry_impl.h
@@ -0,0 +1,69 @@
+/*
+ * Created by Phil on 7/1/2011
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_TEST_CASE_REGISTRY_IMPL_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_TEST_CASE_REGISTRY_IMPL_HPP_INCLUDED
+
+#include "catch_test_registry.h"
+#include "catch_test_spec.h"
+#include "catch_interfaces_config.h"
+
+#include <vector>
+#include <set>
+#include <algorithm>
+#include <ios>
+
+namespace Catch {
+
+ class TestCase;
+ struct IConfig;
+
+ std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases );
+ bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config );
+
+ void enforceNoDuplicateTestCases( std::vector<TestCase> const& functions );
+
+ std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config );
+ std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config );
+
+ class TestRegistry : public ITestCaseRegistry {
+ public:
+ virtual ~TestRegistry() = default;
+
+ virtual void registerTest( TestCase const& testCase );
+
+ std::vector<TestCase> const& getAllTests() const override;
+ std::vector<TestCase> const& getAllTestsSorted( IConfig const& config ) const override;
+
+ private:
+ std::vector<TestCase> m_functions;
+ mutable RunTests::InWhatOrder m_currentSortOrder = RunTests::InDeclarationOrder;
+ mutable std::vector<TestCase> m_sortedFunctions;
+ std::size_t m_unnamedCount = 0;
+ std::ios_base::Init m_ostreamInit; // Forces cout/ cerr to be initialised
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+
+ class TestInvokerAsFunction : public ITestInvoker {
+ void(*m_testAsFunction)();
+ public:
+ TestInvokerAsFunction( void(*testAsFunction)() ) noexcept;
+
+ void invoke() const override;
+ };
+
+
+ std::string extractClassName( std::string const& classOrQualifiedMethodName );
+
+ ///////////////////////////////////////////////////////////////////////////
+
+
+} // end namespace Catch
+
+
+#endif // TWOBLUECUBES_CATCH_TEST_CASE_REGISTRY_IMPL_HPP_INCLUDED
diff --git a/include/internal/catch_test_case_tracker.cpp b/include/internal/catch_test_case_tracker.cpp
new file mode 100644
index 0000000..66da89e
--- /dev/null
+++ b/include/internal/catch_test_case_tracker.cpp
@@ -0,0 +1,287 @@
+/*
+ * Created by Martin on 19/07/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_test_case_tracker.h"
+
+#include "catch_enforce.h"
+
+#include <algorithm>
+#include <assert.h>
+#include <stdexcept>
+#include <memory>
+#include <sstream>
+
+#if defined(__clang__)
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wexit-time-destructors"
+#endif
+
+namespace Catch {
+namespace TestCaseTracking {
+
+ NameAndLocation::NameAndLocation( std::string const& _name, SourceLineInfo const& _location )
+ : name( _name ),
+ location( _location )
+ {}
+
+
+ ITracker::~ITracker() = default;
+
+
+ TrackerContext& TrackerContext::instance() {
+ static TrackerContext s_instance;
+ return s_instance;
+ }
+
+ ITracker& TrackerContext::startRun() {
+ m_rootTracker = std::make_shared<SectionTracker>( NameAndLocation( "{root}", CATCH_INTERNAL_LINEINFO ), *this, nullptr );
+ m_currentTracker = nullptr;
+ m_runState = Executing;
+ return *m_rootTracker;
+ }
+
+ void TrackerContext::endRun() {
+ m_rootTracker.reset();
+ m_currentTracker = nullptr;
+ m_runState = NotStarted;
+ }
+
+ void TrackerContext::startCycle() {
+ m_currentTracker = m_rootTracker.get();
+ m_runState = Executing;
+ }
+ void TrackerContext::completeCycle() {
+ m_runState = CompletedCycle;
+ }
+
+ bool TrackerContext::completedCycle() const {
+ return m_runState == CompletedCycle;
+ }
+ ITracker& TrackerContext::currentTracker() {
+ return *m_currentTracker;
+ }
+ void TrackerContext::setCurrentTracker( ITracker* tracker ) {
+ m_currentTracker = tracker;
+ }
+
+
+
+ TrackerBase::TrackerHasName::TrackerHasName( NameAndLocation const& nameAndLocation ) : m_nameAndLocation( nameAndLocation ) {}
+ bool TrackerBase::TrackerHasName::operator ()( ITrackerPtr const& tracker ) const {
+ return
+ tracker->nameAndLocation().name == m_nameAndLocation.name &&
+ tracker->nameAndLocation().location == m_nameAndLocation.location;
+ }
+
+ TrackerBase::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent )
+ : m_nameAndLocation( nameAndLocation ),
+ m_ctx( ctx ),
+ m_parent( parent )
+ {}
+
+ NameAndLocation const& TrackerBase::nameAndLocation() const {
+ return m_nameAndLocation;
+ }
+ bool TrackerBase::isComplete() const {
+ return m_runState == CompletedSuccessfully || m_runState == Failed;
+ }
+ bool TrackerBase::isSuccessfullyCompleted() const {
+ return m_runState == CompletedSuccessfully;
+ }
+ bool TrackerBase::isOpen() const {
+ return m_runState != NotStarted && !isComplete();
+ }
+ bool TrackerBase::hasChildren() const {
+ return !m_children.empty();
+ }
+
+
+ void TrackerBase::addChild( ITrackerPtr const& child ) {
+ m_children.push_back( child );
+ }
+
+ ITrackerPtr TrackerBase::findChild( NameAndLocation const& nameAndLocation ) {
+ auto it = std::find_if( m_children.begin(), m_children.end(), TrackerHasName( nameAndLocation ) );
+ return( it != m_children.end() )
+ ? *it
+ : nullptr;
+ }
+ ITracker& TrackerBase::parent() {
+ assert( m_parent ); // Should always be non-null except for root
+ return *m_parent;
+ }
+
+ void TrackerBase::openChild() {
+ if( m_runState != ExecutingChildren ) {
+ m_runState = ExecutingChildren;
+ if( m_parent )
+ m_parent->openChild();
+ }
+ }
+
+ bool TrackerBase::isSectionTracker() const { return false; }
+ bool TrackerBase::isIndexTracker() const { return false; }
+
+ void TrackerBase::open() {
+ m_runState = Executing;
+ moveToThis();
+ if( m_parent )
+ m_parent->openChild();
+ }
+
+ void TrackerBase::close() {
+
+ // Close any still open children (e.g. generators)
+ while( &m_ctx.currentTracker() != this )
+ m_ctx.currentTracker().close();
+
+ switch( m_runState ) {
+ case NeedsAnotherRun:
+ break;
+
+ case Executing:
+ m_runState = CompletedSuccessfully;
+ break;
+ case ExecutingChildren:
+ if( m_children.empty() || m_children.back()->isComplete() )
+ m_runState = CompletedSuccessfully;
+ break;
+
+ case NotStarted:
+ case CompletedSuccessfully:
+ case Failed:
+ CATCH_INTERNAL_ERROR( "Illogical state: " << m_runState );
+
+ default:
+ CATCH_INTERNAL_ERROR( "Unknown state: " << m_runState );
+ }
+ moveToParent();
+ m_ctx.completeCycle();
+ }
+ void TrackerBase::fail() {
+ m_runState = Failed;
+ if( m_parent )
+ m_parent->markAsNeedingAnotherRun();
+ moveToParent();
+ m_ctx.completeCycle();
+ }
+ void TrackerBase::markAsNeedingAnotherRun() {
+ m_runState = NeedsAnotherRun;
+ }
+
+ void TrackerBase::moveToParent() {
+ assert( m_parent );
+ m_ctx.setCurrentTracker( m_parent );
+ }
+ void TrackerBase::moveToThis() {
+ m_ctx.setCurrentTracker( this );
+ }
+
+ SectionTracker::SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent )
+ : TrackerBase( nameAndLocation, ctx, parent )
+ {
+ if( parent ) {
+ while( !parent->isSectionTracker() )
+ parent = &parent->parent();
+
+ SectionTracker& parentSection = static_cast<SectionTracker&>( *parent );
+ addNextFilters( parentSection.m_filters );
+ }
+ }
+
+ bool SectionTracker::isSectionTracker() const { return true; }
+
+ SectionTracker& SectionTracker::acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation ) {
+ std::shared_ptr<SectionTracker> section;
+
+ ITracker& currentTracker = ctx.currentTracker();
+ if( ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) {
+ assert( childTracker );
+ assert( childTracker->isSectionTracker() );
+ section = std::static_pointer_cast<SectionTracker>( childTracker );
+ }
+ else {
+ section = std::make_shared<SectionTracker>( nameAndLocation, ctx, ¤tTracker );
+ currentTracker.addChild( section );
+ }
+ if( !ctx.completedCycle() )
+ section->tryOpen();
+ return *section;
+ }
+
+ void SectionTracker::tryOpen() {
+ if( !isComplete() && (m_filters.empty() || m_filters[0].empty() || m_filters[0] == m_nameAndLocation.name ) )
+ open();
+ }
+
+ void SectionTracker::addInitialFilters( std::vector<std::string> const& filters ) {
+ if( !filters.empty() ) {
+ m_filters.push_back(""); // Root - should never be consulted
+ m_filters.push_back(""); // Test Case - not a section filter
+ m_filters.insert( m_filters.end(), filters.begin(), filters.end() );
+ }
+ }
+ void SectionTracker::addNextFilters( std::vector<std::string> const& filters ) {
+ if( filters.size() > 1 )
+ m_filters.insert( m_filters.end(), ++filters.begin(), filters.end() );
+ }
+
+ IndexTracker::IndexTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent, int size )
+ : TrackerBase( nameAndLocation, ctx, parent ),
+ m_size( size )
+ {}
+
+ bool IndexTracker::isIndexTracker() const { return true; }
+
+ IndexTracker& IndexTracker::acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation, int size ) {
+ std::shared_ptr<IndexTracker> tracker;
+
+ ITracker& currentTracker = ctx.currentTracker();
+ if( ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) {
+ assert( childTracker );
+ assert( childTracker->isIndexTracker() );
+ tracker = std::static_pointer_cast<IndexTracker>( childTracker );
+ }
+ else {
+ tracker = std::make_shared<IndexTracker>( nameAndLocation, ctx, ¤tTracker, size );
+ currentTracker.addChild( tracker );
+ }
+
+ if( !ctx.completedCycle() && !tracker->isComplete() ) {
+ if( tracker->m_runState != ExecutingChildren && tracker->m_runState != NeedsAnotherRun )
+ tracker->moveNext();
+ tracker->open();
+ }
+
+ return *tracker;
+ }
+
+ int IndexTracker::index() const { return m_index; }
+
+ void IndexTracker::moveNext() {
+ m_index++;
+ m_children.clear();
+ }
+
+ void IndexTracker::close() {
+ TrackerBase::close();
+ if( m_runState == CompletedSuccessfully && m_index < m_size-1 )
+ m_runState = Executing;
+ }
+
+} // namespace TestCaseTracking
+
+using TestCaseTracking::ITracker;
+using TestCaseTracking::TrackerContext;
+using TestCaseTracking::SectionTracker;
+using TestCaseTracking::IndexTracker;
+
+} // namespace Catch
+
+#if defined(__clang__)
+# pragma clang diagnostic pop
+#endif
diff --git a/include/internal/catch_test_case_tracker.h b/include/internal/catch_test_case_tracker.h
new file mode 100644
index 0000000..a4b0440
--- /dev/null
+++ b/include/internal/catch_test_case_tracker.h
@@ -0,0 +1,183 @@
+/*
+ * Created by Phil Nash on 23/7/2013
+ * Copyright 2013 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_TEST_CASE_TRACKER_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_TEST_CASE_TRACKER_HPP_INCLUDED
+
+#include "catch_compiler_capabilities.h"
+#include "catch_common.h"
+
+#include <string>
+#include <vector>
+#include <memory>
+
+namespace Catch {
+namespace TestCaseTracking {
+
+ struct NameAndLocation {
+ std::string name;
+ SourceLineInfo location;
+
+ NameAndLocation( std::string const& _name, SourceLineInfo const& _location );
+ };
+
+ struct ITracker;
+
+ using ITrackerPtr = std::shared_ptr<ITracker>;
+
+ struct ITracker {
+ virtual ~ITracker();
+
+ // static queries
+ virtual NameAndLocation const& nameAndLocation() const = 0;
+
+ // dynamic queries
+ virtual bool isComplete() const = 0; // Successfully completed or failed
+ virtual bool isSuccessfullyCompleted() const = 0;
+ virtual bool isOpen() const = 0; // Started but not complete
+ virtual bool hasChildren() const = 0;
+
+ virtual ITracker& parent() = 0;
+
+ // actions
+ virtual void close() = 0; // Successfully complete
+ virtual void fail() = 0;
+ virtual void markAsNeedingAnotherRun() = 0;
+
+ virtual void addChild( ITrackerPtr const& child ) = 0;
+ virtual ITrackerPtr findChild( NameAndLocation const& nameAndLocation ) = 0;
+ virtual void openChild() = 0;
+
+ // Debug/ checking
+ virtual bool isSectionTracker() const = 0;
+ virtual bool isIndexTracker() const = 0;
+ };
+
+ class TrackerContext {
+
+ enum RunState {
+ NotStarted,
+ Executing,
+ CompletedCycle
+ };
+
+ ITrackerPtr m_rootTracker;
+ ITracker* m_currentTracker = nullptr;
+ RunState m_runState = NotStarted;
+
+ public:
+
+ static TrackerContext& instance();
+
+ ITracker& startRun();
+ void endRun();
+
+ void startCycle();
+ void completeCycle();
+
+ bool completedCycle() const;
+ ITracker& currentTracker();
+ void setCurrentTracker( ITracker* tracker );
+ };
+
+ class TrackerBase : public ITracker {
+ protected:
+ enum CycleState {
+ NotStarted,
+ Executing,
+ ExecutingChildren,
+ NeedsAnotherRun,
+ CompletedSuccessfully,
+ Failed
+ };
+
+ class TrackerHasName {
+ NameAndLocation m_nameAndLocation;
+ public:
+ TrackerHasName( NameAndLocation const& nameAndLocation );
+ bool operator ()( ITrackerPtr const& tracker ) const;
+ };
+
+ using Children = std::vector<ITrackerPtr>;
+ NameAndLocation m_nameAndLocation;
+ TrackerContext& m_ctx;
+ ITracker* m_parent;
+ Children m_children;
+ CycleState m_runState = NotStarted;
+
+ public:
+ TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent );
+
+ NameAndLocation const& nameAndLocation() const override;
+ bool isComplete() const override;
+ bool isSuccessfullyCompleted() const override;
+ bool isOpen() const override;
+ bool hasChildren() const override;
+
+
+ void addChild( ITrackerPtr const& child ) override;
+
+ ITrackerPtr findChild( NameAndLocation const& nameAndLocation ) override;
+ ITracker& parent() override;
+
+ void openChild() override;
+
+ bool isSectionTracker() const override;
+ bool isIndexTracker() const override;
+
+ void open();
+
+ void close() override;
+ void fail() override;
+ void markAsNeedingAnotherRun() override;
+
+ private:
+ void moveToParent();
+ void moveToThis();
+ };
+
+ class SectionTracker : public TrackerBase {
+ std::vector<std::string> m_filters;
+ public:
+ SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent );
+
+ bool isSectionTracker() const override;
+
+ static SectionTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation );
+
+ void tryOpen();
+
+ void addInitialFilters( std::vector<std::string> const& filters );
+ void addNextFilters( std::vector<std::string> const& filters );
+ };
+
+ class IndexTracker : public TrackerBase {
+ int m_size;
+ int m_index = -1;
+ public:
+ IndexTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent, int size );
+
+ bool isIndexTracker() const override;
+ void close() override;
+
+ static IndexTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation, int size );
+
+ int index() const;
+
+ void moveNext();
+ };
+
+} // namespace TestCaseTracking
+
+using TestCaseTracking::ITracker;
+using TestCaseTracking::TrackerContext;
+using TestCaseTracking::SectionTracker;
+using TestCaseTracking::IndexTracker;
+
+} // namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_TEST_CASE_TRACKER_HPP_INCLUDED
diff --git a/include/internal/catch_test_registry.cpp b/include/internal/catch_test_registry.cpp
new file mode 100644
index 0000000..ec50e92
--- /dev/null
+++ b/include/internal/catch_test_registry.cpp
@@ -0,0 +1,37 @@
+/*
+ * Created by Martin on 25/07/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_test_registry.h"
+#include "catch_test_case_registry_impl.h"
+#include "catch_interfaces_registry_hub.h"
+
+namespace Catch {
+
+ auto makeTestInvoker( void(*testAsFunction)() ) noexcept -> ITestInvoker* {
+ return new(std::nothrow) TestInvokerAsFunction( testAsFunction );
+ }
+
+ NameAndTags::NameAndTags( StringRef name_ , StringRef tags_ ) noexcept : name( name_ ), tags( tags_ ) {}
+
+ AutoReg::AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef classOrMethod, NameAndTags const& nameAndTags ) noexcept {
+ try {
+ getMutableRegistryHub()
+ .registerTest(
+ makeTestCase(
+ invoker,
+ extractClassName( classOrMethod ),
+ nameAndTags.name,
+ nameAndTags.tags,
+ lineInfo));
+ } catch (...) {
+ // Do not throw when constructing global objects, instead register the exception to be processed later
+ getMutableRegistryHub().registerStartupException();
+ }
+ }
+
+ AutoReg::~AutoReg() = default;
+}
diff --git a/include/internal/catch_test_registry.h b/include/internal/catch_test_registry.h
new file mode 100644
index 0000000..8400101
--- /dev/null
+++ b/include/internal/catch_test_registry.h
@@ -0,0 +1,100 @@
+/*
+ * Created by Phil on 18/10/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_TEST_REGISTRY_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_TEST_REGISTRY_HPP_INCLUDED
+
+#include "catch_common.h"
+#include "catch_interfaces_testcase.h"
+#include "catch_compiler_capabilities.h"
+#include "catch_stringref.h"
+
+namespace Catch {
+
+template<typename C>
+class TestInvokerAsMethod : public ITestInvoker {
+ void (C::*m_testAsMethod)();
+public:
+ TestInvokerAsMethod( void (C::*testAsMethod)() ) noexcept : m_testAsMethod( testAsMethod ) {}
+
+ void invoke() const override {
+ C obj;
+ (obj.*m_testAsMethod)();
+ }
+};
+
+auto makeTestInvoker( void(*testAsFunction)() ) noexcept -> ITestInvoker*;
+
+template<typename C>
+auto makeTestInvoker( void (C::*testAsMethod)() ) noexcept -> ITestInvoker* {
+ return new(std::nothrow) TestInvokerAsMethod<C>( testAsMethod );
+}
+
+struct NameAndTags {
+ NameAndTags( StringRef name_ = StringRef(), StringRef tags_ = StringRef() ) noexcept;
+ StringRef name;
+ StringRef tags;
+};
+
+struct AutoReg : NonCopyable {
+ AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef classOrMethod, NameAndTags const& nameAndTags ) noexcept;
+ ~AutoReg();
+};
+
+} // end namespace Catch
+
+#if defined(CATCH_CONFIG_DISABLE)
+ #define INTERNAL_CATCH_TESTCASE_NO_REGISTRATION( TestName, ... ) \
+ static void TestName()
+ #define INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION( TestName, ClassName, ... ) \
+ namespace{ \
+ struct TestName : ClassName { \
+ void test(); \
+ }; \
+ } \
+ void TestName::test()
+
+#endif
+
+ ///////////////////////////////////////////////////////////////////////////////
+ #define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \
+ static void TestName(); \
+ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
+ namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &TestName ), CATCH_INTERNAL_LINEINFO, "", Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \
+ CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
+ static void TestName()
+ #define INTERNAL_CATCH_TESTCASE( ... ) \
+ INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), __VA_ARGS__ )
+
+ ///////////////////////////////////////////////////////////////////////////////
+ #define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \
+ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
+ namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &QualifiedMethod ), CATCH_INTERNAL_LINEINFO, "&" #QualifiedMethod, Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \
+ CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS
+
+ ///////////////////////////////////////////////////////////////////////////////
+ #define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\
+ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
+ namespace{ \
+ struct TestName : ClassName{ \
+ void test(); \
+ }; \
+ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( Catch::makeTestInvoker( &TestName::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \
+ } \
+ CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
+ void TestName::test()
+ #define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... ) \
+ INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, __VA_ARGS__ )
+
+ ///////////////////////////////////////////////////////////////////////////////
+ #define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \
+ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
+ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( Function ), CATCH_INTERNAL_LINEINFO, "", Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \
+ CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS
+
+
+#endif // TWOBLUECUBES_CATCH_TEST_REGISTRY_HPP_INCLUDED
diff --git a/include/internal/catch_test_spec.cpp b/include/internal/catch_test_spec.cpp
new file mode 100644
index 0000000..d9c149d
--- /dev/null
+++ b/include/internal/catch_test_spec.cpp
@@ -0,0 +1,59 @@
+/*
+ * Created by Martin on 19/07/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_test_spec.h"
+#include "catch_string_manip.h"
+
+#include <algorithm>
+#include <string>
+#include <vector>
+#include <memory>
+
+namespace Catch {
+
+ TestSpec::Pattern::~Pattern() = default;
+ TestSpec::NamePattern::~NamePattern() = default;
+ TestSpec::TagPattern::~TagPattern() = default;
+ TestSpec::ExcludedPattern::~ExcludedPattern() = default;
+
+ TestSpec::NamePattern::NamePattern( std::string const& name )
+ : m_wildcardPattern( toLower( name ), CaseSensitive::No )
+ {}
+ bool TestSpec::NamePattern::matches( TestCaseInfo const& testCase ) const {
+ return m_wildcardPattern.matches( toLower( testCase.name ) );
+ }
+
+ TestSpec::TagPattern::TagPattern( std::string const& tag ) : m_tag( toLower( tag ) ) {}
+ bool TestSpec::TagPattern::matches( TestCaseInfo const& testCase ) const {
+ return std::find(begin(testCase.lcaseTags),
+ end(testCase.lcaseTags),
+ m_tag) != end(testCase.lcaseTags);
+ }
+
+ TestSpec::ExcludedPattern::ExcludedPattern( PatternPtr const& underlyingPattern ) : m_underlyingPattern( underlyingPattern ) {}
+ bool TestSpec::ExcludedPattern::matches( TestCaseInfo const& testCase ) const { return !m_underlyingPattern->matches( testCase ); }
+
+ bool TestSpec::Filter::matches( TestCaseInfo const& testCase ) const {
+ // All patterns in a filter must match for the filter to be a match
+ for( auto const& pattern : m_patterns ) {
+ if( !pattern->matches( testCase ) )
+ return false;
+ }
+ return true;
+ }
+
+ bool TestSpec::hasFilters() const {
+ return !m_filters.empty();
+ }
+ bool TestSpec::matches( TestCaseInfo const& testCase ) const {
+ // A TestSpec matches if any filter matches
+ for( auto const& filter : m_filters )
+ if( filter.matches( testCase ) )
+ return true;
+ return false;
+ }
+}
diff --git a/include/internal/catch_test_spec.h b/include/internal/catch_test_spec.h
new file mode 100644
index 0000000..baf8b01
--- /dev/null
+++ b/include/internal/catch_test_spec.h
@@ -0,0 +1,80 @@
+/*
+ * Created by Phil on 14/8/2012.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_TEST_SPEC_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_TEST_SPEC_HPP_INCLUDED
+
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpadded"
+#endif
+
+#include "catch_wildcard_pattern.h"
+#include "catch_test_case_info.h"
+
+#include <string>
+#include <vector>
+#include <memory>
+
+namespace Catch {
+
+ class TestSpec {
+ struct Pattern {
+ virtual ~Pattern();
+ virtual bool matches( TestCaseInfo const& testCase ) const = 0;
+ };
+ using PatternPtr = std::shared_ptr<Pattern>;
+
+ class NamePattern : public Pattern {
+ public:
+ NamePattern( std::string const& name );
+ virtual ~NamePattern();
+ virtual bool matches( TestCaseInfo const& testCase ) const override;
+ private:
+ WildcardPattern m_wildcardPattern;
+ };
+
+ class TagPattern : public Pattern {
+ public:
+ TagPattern( std::string const& tag );
+ virtual ~TagPattern();
+ virtual bool matches( TestCaseInfo const& testCase ) const override;
+ private:
+ std::string m_tag;
+ };
+
+ class ExcludedPattern : public Pattern {
+ public:
+ ExcludedPattern( PatternPtr const& underlyingPattern );
+ virtual ~ExcludedPattern();
+ virtual bool matches( TestCaseInfo const& testCase ) const override;
+ private:
+ PatternPtr m_underlyingPattern;
+ };
+
+ struct Filter {
+ std::vector<PatternPtr> m_patterns;
+
+ bool matches( TestCaseInfo const& testCase ) const;
+ };
+
+ public:
+ bool hasFilters() const;
+ bool matches( TestCaseInfo const& testCase ) const;
+
+ private:
+ std::vector<Filter> m_filters;
+
+ friend class TestSpecParser;
+ };
+}
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
+#endif // TWOBLUECUBES_CATCH_TEST_SPEC_HPP_INCLUDED
diff --git a/include/internal/catch_test_spec_parser.cpp b/include/internal/catch_test_spec_parser.cpp
new file mode 100644
index 0000000..61c9e4d
--- /dev/null
+++ b/include/internal/catch_test_spec_parser.cpp
@@ -0,0 +1,87 @@
+/*
+ * Created by Martin on 19/07/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_test_spec_parser.h"
+
+namespace Catch {
+
+ TestSpecParser::TestSpecParser( ITagAliasRegistry const& tagAliases ) : m_tagAliases( &tagAliases ) {}
+
+ TestSpecParser& TestSpecParser::parse( std::string const& arg ) {
+ m_mode = None;
+ m_exclusion = false;
+ m_start = std::string::npos;
+ m_arg = m_tagAliases->expandAliases( arg );
+ m_escapeChars.clear();
+ for( m_pos = 0; m_pos < m_arg.size(); ++m_pos )
+ visitChar( m_arg[m_pos] );
+ if( m_mode == Name )
+ addPattern<TestSpec::NamePattern>();
+ return *this;
+ }
+ TestSpec TestSpecParser::testSpec() {
+ addFilter();
+ return m_testSpec;
+ }
+
+ void TestSpecParser::visitChar( char c ) {
+ if( m_mode == None ) {
+ switch( c ) {
+ case ' ': return;
+ case '~': m_exclusion = true; return;
+ case '[': return startNewMode( Tag, ++m_pos );
+ case '"': return startNewMode( QuotedName, ++m_pos );
+ case '\\': return escape();
+ default: startNewMode( Name, m_pos ); break;
+ }
+ }
+ if( m_mode == Name ) {
+ if( c == ',' ) {
+ addPattern<TestSpec::NamePattern>();
+ addFilter();
+ }
+ else if( c == '[' ) {
+ if( subString() == "exclude:" )
+ m_exclusion = true;
+ else
+ addPattern<TestSpec::NamePattern>();
+ startNewMode( Tag, ++m_pos );
+ }
+ else if( c == '\\' )
+ escape();
+ }
+ else if( m_mode == EscapedName )
+ m_mode = Name;
+ else if( m_mode == QuotedName && c == '"' )
+ addPattern<TestSpec::NamePattern>();
+ else if( m_mode == Tag && c == ']' )
+ addPattern<TestSpec::TagPattern>();
+ }
+ void TestSpecParser::startNewMode( Mode mode, std::size_t start ) {
+ m_mode = mode;
+ m_start = start;
+ }
+ void TestSpecParser::escape() {
+ if( m_mode == None )
+ m_start = m_pos;
+ m_mode = EscapedName;
+ m_escapeChars.push_back( m_pos );
+ }
+ std::string TestSpecParser::subString() const { return m_arg.substr( m_start, m_pos - m_start ); }
+
+ void TestSpecParser::addFilter() {
+ if( !m_currentFilter.m_patterns.empty() ) {
+ m_testSpec.m_filters.push_back( m_currentFilter );
+ m_currentFilter = TestSpec::Filter();
+ }
+ }
+
+ TestSpec parseTestSpec( std::string const& arg ) {
+ return TestSpecParser( ITagAliasRegistry::get() ).parse( arg ).testSpec();
+ }
+
+} // namespace Catch
diff --git a/include/internal/catch_test_spec_parser.h b/include/internal/catch_test_spec_parser.h
new file mode 100644
index 0000000..79ce889
--- /dev/null
+++ b/include/internal/catch_test_spec_parser.h
@@ -0,0 +1,75 @@
+/*
+ * Created by Phil on 15/5/2013.
+ * Copyright 2014 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_TEST_SPEC_PARSER_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_TEST_SPEC_PARSER_HPP_INCLUDED
+
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpadded"
+#endif
+
+#include "catch_test_spec.h"
+#include "catch_string_manip.h"
+#include "catch_interfaces_tag_alias_registry.h"
+
+namespace Catch {
+
+ class TestSpecParser {
+ enum Mode{ None, Name, QuotedName, Tag, EscapedName };
+ Mode m_mode = None;
+ bool m_exclusion = false;
+ std::size_t m_start = std::string::npos, m_pos = 0;
+ std::string m_arg;
+ std::vector<std::size_t> m_escapeChars;
+ TestSpec::Filter m_currentFilter;
+ TestSpec m_testSpec;
+ ITagAliasRegistry const* m_tagAliases = nullptr;
+
+ public:
+ TestSpecParser( ITagAliasRegistry const& tagAliases );
+
+ TestSpecParser& parse( std::string const& arg );
+ TestSpec testSpec();
+
+ private:
+ void visitChar( char c );
+ void startNewMode( Mode mode, std::size_t start );
+ void escape();
+ std::string subString() const;
+
+ template<typename T>
+ void addPattern() {
+ std::string token = subString();
+ for( std::size_t i = 0; i < m_escapeChars.size(); ++i )
+ token = token.substr( 0, m_escapeChars[i]-m_start-i ) + token.substr( m_escapeChars[i]-m_start-i+1 );
+ m_escapeChars.clear();
+ if( startsWith( token, "exclude:" ) ) {
+ m_exclusion = true;
+ token = token.substr( 8 );
+ }
+ if( !token.empty() ) {
+ TestSpec::PatternPtr pattern = std::make_shared<T>( token );
+ if( m_exclusion )
+ pattern = std::make_shared<TestSpec::ExcludedPattern>( pattern );
+ m_currentFilter.m_patterns.push_back( pattern );
+ }
+ m_exclusion = false;
+ m_mode = None;
+ }
+
+ void addFilter();
+ };
+ TestSpec parseTestSpec( std::string const& arg );
+
+} // namespace Catch
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
+#endif // TWOBLUECUBES_CATCH_TEST_SPEC_PARSER_HPP_INCLUDED
diff --git a/include/internal/catch_text.h b/include/internal/catch_text.h
new file mode 100644
index 0000000..eeafe8e
--- /dev/null
+++ b/include/internal/catch_text.h
@@ -0,0 +1,17 @@
+/*
+ * Created by Phil on 10/2/2014.
+ * Copyright 2014 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_TEXT_H_INCLUDED
+#define TWOBLUECUBES_CATCH_TEXT_H_INCLUDED
+
+#include "catch_clara.h"
+
+namespace Catch {
+ using namespace clara::TextFlow;
+}
+
+#endif // TWOBLUECUBES_CATCH_TEXT_H_INCLUDED
diff --git a/include/internal/catch_timer.cpp b/include/internal/catch_timer.cpp
new file mode 100644
index 0000000..b9ae688
--- /dev/null
+++ b/include/internal/catch_timer.cpp
@@ -0,0 +1,62 @@
+/*
+ * Created by Phil on 05/08/2013.
+ * Copyright 2013 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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_timer.h"
+
+#include <chrono>
+
+namespace Catch {
+
+ auto getCurrentNanosecondsSinceEpoch() -> uint64_t {
+ return std::chrono::duration_cast<std::chrono::nanoseconds>( std::chrono::high_resolution_clock::now().time_since_epoch() ).count();
+ }
+
+ auto estimateClockResolution() -> uint64_t {
+ uint64_t sum = 0;
+ static const uint64_t iterations = 1000000;
+
+ for( std::size_t i = 0; i < iterations; ++i ) {
+
+ uint64_t ticks;
+ uint64_t baseTicks = getCurrentNanosecondsSinceEpoch();
+ do {
+ ticks = getCurrentNanosecondsSinceEpoch();
+ }
+ while( ticks == baseTicks );
+
+ auto delta = ticks - baseTicks;
+ sum += delta;
+ }
+
+ // We're just taking the mean, here. To do better we could take the std. dev and exclude outliers
+ // - and potentially do more iterations if there's a high variance.
+ return sum/iterations;
+ }
+ auto getEstimatedClockResolution() -> uint64_t {
+ static auto s_resolution = estimateClockResolution();
+ return s_resolution;
+ }
+
+ void Timer::start() {
+ m_nanoseconds = getCurrentNanosecondsSinceEpoch();
+ }
+ auto Timer::getElapsedNanoseconds() const -> uint64_t {
+ return getCurrentNanosecondsSinceEpoch() - m_nanoseconds;
+ }
+ auto Timer::getElapsedMicroseconds() const -> uint64_t {
+ return getElapsedNanoseconds()/1000;
+ }
+ auto Timer::getElapsedMilliseconds() const -> unsigned int {
+ return static_cast<unsigned int>(getElapsedMicroseconds()/1000);
+ }
+ auto Timer::getElapsedSeconds() const -> double {
+ return getElapsedMicroseconds()/1000000.0;
+ }
+
+
+} // namespace Catch
diff --git a/include/internal/catch_timer.h b/include/internal/catch_timer.h
new file mode 100644
index 0000000..74ab428
--- /dev/null
+++ b/include/internal/catch_timer.h
@@ -0,0 +1,30 @@
+/*
+ * Created by Phil on 05/08/2013.
+ * Copyright 2013 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_TIMER_H_INCLUDED
+#define TWOBLUECUBES_CATCH_TIMER_H_INCLUDED
+
+#include <cstdint>
+
+namespace Catch {
+
+ auto getCurrentNanosecondsSinceEpoch() -> uint64_t;
+ auto getEstimatedClockResolution() -> uint64_t;
+
+ class Timer {
+ uint64_t m_nanoseconds = 0;
+ public:
+ void start();
+ auto getElapsedNanoseconds() const -> uint64_t;
+ auto getElapsedMicroseconds() const -> uint64_t;
+ auto getElapsedMilliseconds() const -> unsigned int;
+ auto getElapsedSeconds() const -> double;
+ };
+
+} // namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_TIMER_H_INCLUDED
diff --git a/include/internal/catch_tostring.cpp b/include/internal/catch_tostring.cpp
new file mode 100644
index 0000000..a9f7735
--- /dev/null
+++ b/include/internal/catch_tostring.cpp
@@ -0,0 +1,241 @@
+/*
+ * Created by Phil on 23/4/2014.
+ * Copyright 2014 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+
+#if defined(__clang__)
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wexit-time-destructors"
+# pragma clang diagnostic ignored "-Wglobal-constructors"
+#endif
+
+// Enable specific decls locally
+#if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER)
+#define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
+#endif
+
+#include "catch_tostring.h"
+#include "catch_interfaces_config.h"
+#include "catch_context.h"
+
+#include <cmath>
+#include <iomanip>
+
+namespace Catch {
+
+namespace Detail {
+
+ const std::string unprintableString = "{?}";
+
+ namespace {
+ const int hexThreshold = 255;
+
+ struct Endianness {
+ enum Arch { Big, Little };
+
+ static Arch which() {
+ union _{
+ int asInt;
+ char asChar[sizeof (int)];
+ } u;
+
+ u.asInt = 1;
+ return ( u.asChar[sizeof(int)-1] == 1 ) ? Big : Little;
+ }
+ };
+ }
+
+ std::string rawMemoryToString( const void *object, std::size_t size ) {
+ // Reverse order for little endian architectures
+ int i = 0, end = static_cast<int>( size ), inc = 1;
+ if( Endianness::which() == Endianness::Little ) {
+ i = end-1;
+ end = inc = -1;
+ }
+
+ unsigned char const *bytes = static_cast<unsigned char const *>(object);
+ ReusableStringStream rss;
+ rss << "0x" << std::setfill('0') << std::hex;
+ for( ; i != end; i += inc )
+ rss << std::setw(2) << static_cast<unsigned>(bytes[i]);
+ return rss.str();
+ }
+}
+
+
+template<typename T>
+std::string fpToString( T value, int precision ) {
+ if (std::isnan(value)) {
+ return "nan";
+ }
+
+ ReusableStringStream rss;
+ rss << std::setprecision( precision )
+ << std::fixed
+ << value;
+ std::string d = rss.str();
+ std::size_t i = d.find_last_not_of( '0' );
+ if( i != std::string::npos && i != d.size()-1 ) {
+ if( d[i] == '.' )
+ i++;
+ d = d.substr( 0, i+1 );
+ }
+ return d;
+}
+
+
+//// ======================================================= ////
+//
+// Out-of-line defs for full specialization of StringMaker
+//
+//// ======================================================= ////
+
+std::string StringMaker<std::string>::convert(const std::string& str) {
+ if (!getCurrentContext().getConfig()->showInvisibles()) {
+ return '"' + str + '"';
+ }
+
+ std::string s("\"");
+ for (char c : str) {
+ switch (c) {
+ case '\n':
+ s.append("\\n");
+ break;
+ case '\t':
+ s.append("\\t");
+ break;
+ default:
+ s.push_back(c);
+ break;
+ }
+ }
+ s.append("\"");
+ return s;
+}
+
+std::string StringMaker<std::wstring>::convert(const std::wstring& wstr) {
+ std::string s;
+ s.reserve(wstr.size());
+ for (auto c : wstr) {
+ s += (c <= 0xff) ? static_cast<char>(c) : '?';
+ }
+ return ::Catch::Detail::stringify(s);
+}
+
+std::string StringMaker<char const*>::convert(char const* str) {
+ if (str) {
+ return ::Catch::Detail::stringify(std::string{ str });
+ } else {
+ return{ "{null string}" };
+ }
+}
+std::string StringMaker<char*>::convert(char* str) {
+ if (str) {
+ return ::Catch::Detail::stringify(std::string{ str });
+ } else {
+ return{ "{null string}" };
+ }
+}
+std::string StringMaker<wchar_t const*>::convert(wchar_t const * str) {
+ if (str) {
+ return ::Catch::Detail::stringify(std::wstring{ str });
+ } else {
+ return{ "{null string}" };
+ }
+}
+std::string StringMaker<wchar_t *>::convert(wchar_t * str) {
+ if (str) {
+ return ::Catch::Detail::stringify(std::wstring{ str });
+ } else {
+ return{ "{null string}" };
+ }
+}
+
+
+std::string StringMaker<int>::convert(int value) {
+ return ::Catch::Detail::stringify(static_cast<long long>(value));
+}
+std::string StringMaker<long>::convert(long value) {
+ return ::Catch::Detail::stringify(static_cast<long long>(value));
+}
+std::string StringMaker<long long>::convert(long long value) {
+ ReusableStringStream rss;
+ rss << value;
+ if (value > Detail::hexThreshold) {
+ rss << " (0x" << std::hex << value << ')';
+ }
+ return rss.str();
+}
+
+std::string StringMaker<unsigned int>::convert(unsigned int value) {
+ return ::Catch::Detail::stringify(static_cast<unsigned long long>(value));
+}
+std::string StringMaker<unsigned long>::convert(unsigned long value) {
+ return ::Catch::Detail::stringify(static_cast<unsigned long long>(value));
+}
+std::string StringMaker<unsigned long long>::convert(unsigned long long value) {
+ ReusableStringStream rss;
+ rss << value;
+ if (value > Detail::hexThreshold) {
+ rss << " (0x" << std::hex << value << ')';
+ }
+ return rss.str();
+}
+
+
+std::string StringMaker<bool>::convert(bool b) {
+ return b ? "true" : "false";
+}
+
+std::string StringMaker<char>::convert(char value) {
+ if (value == '\r') {
+ return "'\\r'";
+ } else if (value == '\f') {
+ return "'\\f'";
+ } else if (value == '\n') {
+ return "'\\n'";
+ } else if (value == '\t') {
+ return "'\\t'";
+ } else if ('\0' <= value && value < ' ') {
+ return ::Catch::Detail::stringify(static_cast<unsigned int>(value));
+ } else {
+ char chstr[] = "' '";
+ chstr[1] = value;
+ return chstr;
+ }
+}
+std::string StringMaker<signed char>::convert(signed char c) {
+ return ::Catch::Detail::stringify(static_cast<char>(c));
+}
+std::string StringMaker<unsigned char>::convert(unsigned char c) {
+ return ::Catch::Detail::stringify(static_cast<char>(c));
+}
+
+std::string StringMaker<std::nullptr_t>::convert(std::nullptr_t) {
+ return "nullptr";
+}
+
+std::string StringMaker<float>::convert(float value) {
+ return fpToString(value, 5) + 'f';
+}
+std::string StringMaker<double>::convert(double value) {
+ return fpToString(value, 10);
+}
+
+std::string ratio_string<std::atto>::symbol() { return "a"; }
+std::string ratio_string<std::femto>::symbol() { return "f"; }
+std::string ratio_string<std::pico>::symbol() { return "p"; }
+std::string ratio_string<std::nano>::symbol() { return "n"; }
+std::string ratio_string<std::micro>::symbol() { return "u"; }
+std::string ratio_string<std::milli>::symbol() { return "m"; }
+
+
+} // end namespace Catch
+
+#if defined(__clang__)
+# pragma clang diagnostic pop
+#endif
+
diff --git a/include/internal/catch_tostring.h b/include/internal/catch_tostring.h
new file mode 100644
index 0000000..1e644a9
--- /dev/null
+++ b/include/internal/catch_tostring.h
@@ -0,0 +1,529 @@
+/*
+ * Created by Phil on 8/5/2012.
+ * Copyright 2012 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_TOSTRING_H_INCLUDED
+#define TWOBLUECUBES_CATCH_TOSTRING_H_INCLUDED
+
+
+#include <vector>
+#include <cstddef>
+#include <type_traits>
+#include <string>
+#include "catch_stream.h"
+
+#ifdef __OBJC__
+#include "catch_objc_arc.hpp"
+#endif
+
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4180) // We attempt to stream a function (address) by const&, which MSVC complains about but is harmless
+#endif
+
+
+// We need a dummy global operator<< so we can bring it into Catch namespace later
+struct Catch_global_namespace_dummy {};
+std::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy);
+
+namespace Catch {
+ // Bring in operator<< from global namespace into Catch namespace
+ using ::operator<<;
+
+ namespace Detail {
+
+ extern const std::string unprintableString;
+
+ std::string rawMemoryToString( const void *object, std::size_t size );
+
+ template<typename T>
+ std::string rawMemoryToString( const T& object ) {
+ return rawMemoryToString( &object, sizeof(object) );
+ }
+
+ template<typename T>
+ class IsStreamInsertable {
+ template<typename SS, typename TT>
+ static auto test(int)
+ -> decltype(std::declval<SS&>() << std::declval<TT>(), std::true_type());
+
+ template<typename, typename>
+ static auto test(...)->std::false_type;
+
+ public:
+ static const bool value = decltype(test<std::ostream, const T&>(0))::value;
+ };
+
+ template<typename E>
+ std::string convertUnknownEnumToString( E e );
+
+ template<typename T>
+ typename std::enable_if<!std::is_enum<T>::value, std::string>::type convertUnstreamable( T const& ) {
+ return Detail::unprintableString;
+ }
+ template<typename T>
+ typename std::enable_if<std::is_enum<T>::value, std::string>::type convertUnstreamable( T const& value ) {
+ return convertUnknownEnumToString( value );
+ }
+
+ } // namespace Detail
+
+
+ // If we decide for C++14, change these to enable_if_ts
+ template <typename T, typename = void>
+ struct StringMaker {
+ template <typename Fake = T>
+ static
+ typename std::enable_if<::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type
+ convert(const Fake& value) {
+ ReusableStringStream rss;
+ rss << value;
+ return rss.str();
+ }
+
+ template <typename Fake = T>
+ static
+ typename std::enable_if<!::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type
+ convert( const Fake& value ) {
+ return Detail::convertUnstreamable( value );
+ }
+ };
+
+ namespace Detail {
+
+ // This function dispatches all stringification requests inside of Catch.
+ // Should be preferably called fully qualified, like ::Catch::Detail::stringify
+ template <typename T>
+ std::string stringify(const T& e) {
+ return ::Catch::StringMaker<typename std::remove_cv<typename std::remove_reference<T>::type>::type>::convert(e);
+ }
+
+ template<typename E>
+ std::string convertUnknownEnumToString( E e ) {
+ return ::Catch::Detail::stringify(static_cast<typename std::underlying_type<E>::type>(e));
+ }
+
+ } // namespace Detail
+
+ // Some predefined specializations
+
+ template<>
+ struct StringMaker<std::string> {
+ static std::string convert(const std::string& str);
+ };
+ template<>
+ struct StringMaker<std::wstring> {
+ static std::string convert(const std::wstring& wstr);
+ };
+
+ template<>
+ struct StringMaker<char const *> {
+ static std::string convert(char const * str);
+ };
+ template<>
+ struct StringMaker<char *> {
+ static std::string convert(char * str);
+ };
+ template<>
+ struct StringMaker<wchar_t const *> {
+ static std::string convert(wchar_t const * str);
+ };
+ template<>
+ struct StringMaker<wchar_t *> {
+ static std::string convert(wchar_t * str);
+ };
+
+ template<int SZ>
+ struct StringMaker<char[SZ]> {
+ static std::string convert(const char* str) {
+ return ::Catch::Detail::stringify(std::string{ str });
+ }
+ };
+ template<int SZ>
+ struct StringMaker<signed char[SZ]> {
+ static std::string convert(const char* str) {
+ return ::Catch::Detail::stringify(std::string{ str });
+ }
+ };
+ template<int SZ>
+ struct StringMaker<unsigned char[SZ]> {
+ static std::string convert(const char* str) {
+ return ::Catch::Detail::stringify(std::string{ str });
+ }
+ };
+
+ template<>
+ struct StringMaker<int> {
+ static std::string convert(int value);
+ };
+ template<>
+ struct StringMaker<long> {
+ static std::string convert(long value);
+ };
+ template<>
+ struct StringMaker<long long> {
+ static std::string convert(long long value);
+ };
+ template<>
+ struct StringMaker<unsigned int> {
+ static std::string convert(unsigned int value);
+ };
+ template<>
+ struct StringMaker<unsigned long> {
+ static std::string convert(unsigned long value);
+ };
+ template<>
+ struct StringMaker<unsigned long long> {
+ static std::string convert(unsigned long long value);
+ };
+
+ template<>
+ struct StringMaker<bool> {
+ static std::string convert(bool b);
+ };
+
+ template<>
+ struct StringMaker<char> {
+ static std::string convert(char c);
+ };
+ template<>
+ struct StringMaker<signed char> {
+ static std::string convert(signed char c);
+ };
+ template<>
+ struct StringMaker<unsigned char> {
+ static std::string convert(unsigned char c);
+ };
+
+ template<>
+ struct StringMaker<std::nullptr_t> {
+ static std::string convert(std::nullptr_t);
+ };
+
+ template<>
+ struct StringMaker<float> {
+ static std::string convert(float value);
+ };
+ template<>
+ struct StringMaker<double> {
+ static std::string convert(double value);
+ };
+
+ template <typename T>
+ struct StringMaker<T*> {
+ template <typename U>
+ static std::string convert(U* p) {
+ if (p) {
+ return ::Catch::Detail::rawMemoryToString(p);
+ } else {
+ return "nullptr";
+ }
+ }
+ };
+
+ template <typename R, typename C>
+ struct StringMaker<R C::*> {
+ static std::string convert(R C::* p) {
+ if (p) {
+ return ::Catch::Detail::rawMemoryToString(p);
+ } else {
+ return "nullptr";
+ }
+ }
+ };
+
+ namespace Detail {
+ template<typename InputIterator>
+ std::string rangeToString(InputIterator first, InputIterator last) {
+ ReusableStringStream rss;
+ rss << "{ ";
+ if (first != last) {
+ rss << ::Catch::Detail::stringify(*first);
+ for (++first; first != last; ++first)
+ rss << ", " << ::Catch::Detail::stringify(*first);
+ }
+ rss << " }";
+ return rss.str();
+ }
+ }
+
+#ifdef __OBJC__
+ template<>
+ struct StringMaker<NSString*> {
+ static std::string convert(NSString * nsstring) {
+ if (!nsstring)
+ return "nil";
+ return std::string("@") + [nsstring UTF8String];
+ }
+ };
+ template<>
+ struct StringMaker<NSObject*> {
+ static std::string convert(NSObject* nsObject) {
+ return ::Catch::Detail::stringify([nsObject description]);
+ }
+
+ };
+ namespace Detail {
+ inline std::string stringify( NSString* nsstring ) {
+ return StringMaker<NSString*>::convert( nsstring );
+ }
+
+ } // namespace Detail
+#endif // __OBJC__
+
+} // namespace Catch
+
+//////////////////////////////////////////////////////
+// Separate std-lib types stringification, so it can be selectively enabled
+// This means that we do not bring in
+
+#if defined(CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS)
+# define CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER
+# define CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER
+# define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
+#endif
+
+// Separate std::pair specialization
+#if defined(CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER)
+#include <utility>
+namespace Catch {
+ template<typename T1, typename T2>
+ struct StringMaker<std::pair<T1, T2> > {
+ static std::string convert(const std::pair<T1, T2>& pair) {
+ ReusableStringStream rss;
+ rss << "{ "
+ << ::Catch::Detail::stringify(pair.first)
+ << ", "
+ << ::Catch::Detail::stringify(pair.second)
+ << " }";
+ return rss.str();
+ }
+ };
+}
+#endif // CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER
+
+// Separate std::tuple specialization
+#if defined(CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER)
+#include <tuple>
+namespace Catch {
+ namespace Detail {
+ template<
+ typename Tuple,
+ std::size_t N = 0,
+ bool = (N < std::tuple_size<Tuple>::value)
+ >
+ struct TupleElementPrinter {
+ static void print(const Tuple& tuple, std::ostream& os) {
+ os << (N ? ", " : " ")
+ << ::Catch::Detail::stringify(std::get<N>(tuple));
+ TupleElementPrinter<Tuple, N + 1>::print(tuple, os);
+ }
+ };
+
+ template<
+ typename Tuple,
+ std::size_t N
+ >
+ struct TupleElementPrinter<Tuple, N, false> {
+ static void print(const Tuple&, std::ostream&) {}
+ };
+
+ }
+
+
+ template<typename ...Types>
+ struct StringMaker<std::tuple<Types...>> {
+ static std::string convert(const std::tuple<Types...>& tuple) {
+ ReusableStringStream rss;
+ rss << '{';
+ Detail::TupleElementPrinter<std::tuple<Types...>>::print(tuple, rss.get());
+ rss << " }";
+ return rss.str();
+ }
+ };
+}
+#endif // CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER
+
+namespace Catch {
+ struct not_this_one {}; // Tag type for detecting which begin/ end are being selected
+
+ // Import begin/ end from std here so they are considered alongside the fallback (...) overloads in this namespace
+ using std::begin;
+ using std::end;
+
+ not_this_one begin( ... );
+ not_this_one end( ... );
+
+ template <typename T>
+ struct is_range {
+ static const bool value =
+ !std::is_same<decltype(begin(std::declval<T>())), not_this_one>::value &&
+ !std::is_same<decltype(end(std::declval<T>())), not_this_one>::value;
+ };
+
+ template<typename Range>
+ std::string rangeToString( Range const& range ) {
+ return ::Catch::Detail::rangeToString( begin( range ), end( range ) );
+ }
+
+ // Handle vector<bool> specially
+ template<typename Allocator>
+ std::string rangeToString( std::vector<bool, Allocator> const& v ) {
+ ReusableStringStream rss;
+ rss << "{ ";
+ bool first = true;
+ for( bool b : v ) {
+ if( first )
+ first = false;
+ else
+ rss << ", ";
+ rss << ::Catch::Detail::stringify( b );
+ }
+ rss << " }";
+ return rss.str();
+ }
+
+ template<typename R>
+ struct StringMaker<R, typename std::enable_if<is_range<R>::value && !::Catch::Detail::IsStreamInsertable<R>::value>::type> {
+ static std::string convert( R const& range ) {
+ return rangeToString( range );
+ }
+ };
+
+ template <typename T, int SZ>
+ struct StringMaker<T[SZ]> {
+ static std::string convert(T const(&arr)[SZ]) {
+ return rangeToString(arr);
+ }
+ };
+
+
+} // namespace Catch
+
+// Separate std::chrono::duration specialization
+#if defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER)
+#include <ctime>
+#include <ratio>
+#include <chrono>
+
+
+namespace Catch {
+
+template <class Ratio>
+struct ratio_string {
+ static std::string symbol();
+};
+
+template <class Ratio>
+std::string ratio_string<Ratio>::symbol() {
+ Catch::ReusableStringStream rss;
+ rss << '[' << Ratio::num << '/'
+ << Ratio::den << ']';
+ return rss.str();
+}
+template <>
+struct ratio_string<std::atto> {
+ static std::string symbol();
+};
+template <>
+struct ratio_string<std::femto> {
+ static std::string symbol();
+};
+template <>
+struct ratio_string<std::pico> {
+ static std::string symbol();
+};
+template <>
+struct ratio_string<std::nano> {
+ static std::string symbol();
+};
+template <>
+struct ratio_string<std::micro> {
+ static std::string symbol();
+};
+template <>
+struct ratio_string<std::milli> {
+ static std::string symbol();
+};
+
+ ////////////
+ // std::chrono::duration specializations
+ template<typename Value, typename Ratio>
+ struct StringMaker<std::chrono::duration<Value, Ratio>> {
+ static std::string convert(std::chrono::duration<Value, Ratio> const& duration) {
+ ReusableStringStream rss;
+ rss << duration.count() << ' ' << ratio_string<Ratio>::symbol() << 's';
+ return rss.str();
+ }
+ };
+ template<typename Value>
+ struct StringMaker<std::chrono::duration<Value, std::ratio<1>>> {
+ static std::string convert(std::chrono::duration<Value, std::ratio<1>> const& duration) {
+ ReusableStringStream rss;
+ rss << duration.count() << " s";
+ return rss.str();
+ }
+ };
+ template<typename Value>
+ struct StringMaker<std::chrono::duration<Value, std::ratio<60>>> {
+ static std::string convert(std::chrono::duration<Value, std::ratio<60>> const& duration) {
+ ReusableStringStream rss;
+ rss << duration.count() << " m";
+ return rss.str();
+ }
+ };
+ template<typename Value>
+ struct StringMaker<std::chrono::duration<Value, std::ratio<3600>>> {
+ static std::string convert(std::chrono::duration<Value, std::ratio<3600>> const& duration) {
+ ReusableStringStream rss;
+ rss << duration.count() << " h";
+ return rss.str();
+ }
+ };
+
+ ////////////
+ // std::chrono::time_point specialization
+ // Generic time_point cannot be specialized, only std::chrono::time_point<system_clock>
+ template<typename Clock, typename Duration>
+ struct StringMaker<std::chrono::time_point<Clock, Duration>> {
+ static std::string convert(std::chrono::time_point<Clock, Duration> const& time_point) {
+ return ::Catch::Detail::stringify(time_point.time_since_epoch()) + " since epoch";
+ }
+ };
+ // std::chrono::time_point<system_clock> specialization
+ template<typename Duration>
+ struct StringMaker<std::chrono::time_point<std::chrono::system_clock, Duration>> {
+ static std::string convert(std::chrono::time_point<std::chrono::system_clock, Duration> const& time_point) {
+ auto converted = std::chrono::system_clock::to_time_t(time_point);
+
+#ifdef _MSC_VER
+ std::tm timeInfo = {};
+ gmtime_s(&timeInfo, &converted);
+#else
+ std::tm* timeInfo = std::gmtime(&converted);
+#endif
+
+ auto const timeStampSize = sizeof("2017-01-16T17:06:45Z");
+ char timeStamp[timeStampSize];
+ const char * const fmt = "%Y-%m-%dT%H:%M:%SZ";
+
+#ifdef _MSC_VER
+ std::strftime(timeStamp, timeStampSize, fmt, &timeInfo);
+#else
+ std::strftime(timeStamp, timeStampSize, fmt, timeInfo);
+#endif
+ return std::string(timeStamp);
+ }
+ };
+}
+#endif // CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
+
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+#endif // TWOBLUECUBES_CATCH_TOSTRING_H_INCLUDED
diff --git a/include/internal/catch_totals.cpp b/include/internal/catch_totals.cpp
new file mode 100644
index 0000000..0391fe8
--- /dev/null
+++ b/include/internal/catch_totals.cpp
@@ -0,0 +1,61 @@
+/*
+ * Created by Martin on 19/07/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_totals.h"
+
+namespace Catch {
+
+ Counts Counts::operator - ( Counts const& other ) const {
+ Counts diff;
+ diff.passed = passed - other.passed;
+ diff.failed = failed - other.failed;
+ diff.failedButOk = failedButOk - other.failedButOk;
+ return diff;
+ }
+
+ Counts& Counts::operator += ( Counts const& other ) {
+ passed += other.passed;
+ failed += other.failed;
+ failedButOk += other.failedButOk;
+ return *this;
+ }
+
+ std::size_t Counts::total() const {
+ return passed + failed + failedButOk;
+ }
+ bool Counts::allPassed() const {
+ return failed == 0 && failedButOk == 0;
+ }
+ bool Counts::allOk() const {
+ return failed == 0;
+ }
+
+ Totals Totals::operator - ( Totals const& other ) const {
+ Totals diff;
+ diff.assertions = assertions - other.assertions;
+ diff.testCases = testCases - other.testCases;
+ return diff;
+ }
+
+ Totals& Totals::operator += ( Totals const& other ) {
+ assertions += other.assertions;
+ testCases += other.testCases;
+ return *this;
+ }
+
+ Totals Totals::delta( Totals const& prevTotals ) const {
+ Totals diff = *this - prevTotals;
+ if( diff.assertions.failed > 0 )
+ ++diff.testCases.failed;
+ else if( diff.assertions.failedButOk > 0 )
+ ++diff.testCases.failedButOk;
+ else
+ ++diff.testCases.passed;
+ return diff;
+ }
+
+}
diff --git a/include/internal/catch_totals.h b/include/internal/catch_totals.h
new file mode 100644
index 0000000..9507582
--- /dev/null
+++ b/include/internal/catch_totals.h
@@ -0,0 +1,41 @@
+/*
+ * Created by Phil Nash on 23/02/2012.
+ * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_TOTALS_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_TOTALS_HPP_INCLUDED
+
+#include <cstddef>
+
+namespace Catch {
+
+ struct Counts {
+ Counts operator - ( Counts const& other ) const;
+ Counts& operator += ( Counts const& other );
+
+ std::size_t total() const;
+ bool allPassed() const;
+ bool allOk() const;
+
+ std::size_t passed = 0;
+ std::size_t failed = 0;
+ std::size_t failedButOk = 0;
+ };
+
+ struct Totals {
+
+ Totals operator - ( Totals const& other ) const;
+ Totals& operator += ( Totals const& other );
+
+ Totals delta( Totals const& prevTotals ) const;
+
+
+ Counts assertions;
+ Counts testCases;
+ };
+}
+
+#endif // TWOBLUECUBES_CATCH_TOTALS_HPP_INCLUDED
diff --git a/include/internal/catch_uncaught_exceptions.cpp b/include/internal/catch_uncaught_exceptions.cpp
new file mode 100644
index 0000000..0e47a04
--- /dev/null
+++ b/include/internal/catch_uncaught_exceptions.cpp
@@ -0,0 +1,22 @@
+/*
+ * Created by Josh on 1/2/2018.
+ * Copyright 2018 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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_compiler_capabilities.h"
+#include "catch_uncaught_exceptions.h"
+#include <exception>
+
+namespace Catch {
+ bool uncaught_exceptions() {
+// https://github.com/catchorg/Catch2/issues/1162
+#if defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
+ return std::uncaught_exceptions() > 0;
+#else
+ return std::uncaught_exception();
+#endif
+ }
+} // end namespace Catch
diff --git a/include/internal/catch_uncaught_exceptions.h b/include/internal/catch_uncaught_exceptions.h
new file mode 100644
index 0000000..c68d680
--- /dev/null
+++ b/include/internal/catch_uncaught_exceptions.h
@@ -0,0 +1,15 @@
+/*
+ * Created by Josh on 1/2/2018.
+ * Copyright 2018 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_UNCAUGHT_EXCEPTIONS_H_INCLUDED
+#define TWOBLUECUBES_CATCH_UNCAUGHT_EXCEPTIONS_H_INCLUDED
+
+namespace Catch {
+ bool uncaught_exceptions();
+} // end namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_UNCAUGHT_EXCEPTIONS_H_INCLUDED
diff --git a/include/internal/catch_user_interfaces.h b/include/internal/catch_user_interfaces.h
new file mode 100644
index 0000000..35acb77
--- /dev/null
+++ b/include/internal/catch_user_interfaces.h
@@ -0,0 +1,18 @@
+/*
+ * Created by Martin on 21/11/2017.
+ *
+ * This file collects declaration that we want to expose to test files.
+ * These declarations are expected to be duplicated elsewhere,
+ * together with their implementation.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_USER_INTERFACES_H_INCLUDED
+#define TWOBLUECUBES_CATCH_USER_INTERFACES_H_INCLUDED
+
+namespace Catch {
+ unsigned int rngSeed();
+}
+
+#endif // TWOBLUECUBES_CATCH_USER_INTERFACES_H_INCLUDED
diff --git a/include/internal/catch_version.cpp b/include/internal/catch_version.cpp
new file mode 100644
index 0000000..fc196d9
--- /dev/null
+++ b/include/internal/catch_version.cpp
@@ -0,0 +1,44 @@
+/*
+ * Created by Phil on 14/11/2012.
+ * Copyright 2012 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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_version.h"
+#include <ostream>
+
+namespace Catch {
+
+ Version::Version
+ ( unsigned int _majorVersion,
+ unsigned int _minorVersion,
+ unsigned int _patchNumber,
+ char const * const _branchName,
+ unsigned int _buildNumber )
+ : majorVersion( _majorVersion ),
+ minorVersion( _minorVersion ),
+ patchNumber( _patchNumber ),
+ branchName( _branchName ),
+ buildNumber( _buildNumber )
+ {}
+
+ std::ostream& operator << ( std::ostream& os, Version const& version ) {
+ os << version.majorVersion << '.'
+ << version.minorVersion << '.'
+ << version.patchNumber;
+ // branchName is never null -> 0th char is \0 if it is empty
+ if (version.branchName[0]) {
+ os << '-' << version.branchName
+ << '.' << version.buildNumber;
+ }
+ return os;
+ }
+
+ Version const& libraryVersion() {
+ static Version version( 2, 1, 1, "", 0 );
+ return version;
+ }
+
+}
diff --git a/include/internal/catch_version.h b/include/internal/catch_version.h
new file mode 100644
index 0000000..018397f
--- /dev/null
+++ b/include/internal/catch_version.h
@@ -0,0 +1,39 @@
+/*
+ * Created by Phil on 13/11/2012.
+ * Copyright 2012 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_VERSION_H_INCLUDED
+#define TWOBLUECUBES_CATCH_VERSION_H_INCLUDED
+
+#include <iosfwd>
+
+namespace Catch {
+
+ // Versioning information
+ struct Version {
+ Version( Version const& ) = delete;
+ Version& operator=( Version const& ) = delete;
+ Version( unsigned int _majorVersion,
+ unsigned int _minorVersion,
+ unsigned int _patchNumber,
+ char const * const _branchName,
+ unsigned int _buildNumber );
+
+ unsigned int const majorVersion;
+ unsigned int const minorVersion;
+ unsigned int const patchNumber;
+
+ // buildNumber is only used if branchName is not null
+ char const * const branchName;
+ unsigned int const buildNumber;
+
+ friend std::ostream& operator << ( std::ostream& os, Version const& version );
+ };
+
+ Version const& libraryVersion();
+}
+
+#endif // TWOBLUECUBES_CATCH_VERSION_H_INCLUDED
diff --git a/include/internal/catch_wildcard_pattern.cpp b/include/internal/catch_wildcard_pattern.cpp
new file mode 100644
index 0000000..9bf20f0
--- /dev/null
+++ b/include/internal/catch_wildcard_pattern.cpp
@@ -0,0 +1,49 @@
+/*
+ * Created by Martin on 19/07/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_wildcard_pattern.h"
+#include "catch_enforce.h"
+#include "catch_string_manip.h"
+
+#include <sstream>
+
+namespace Catch {
+
+ WildcardPattern::WildcardPattern( std::string const& pattern,
+ CaseSensitive::Choice caseSensitivity )
+ : m_caseSensitivity( caseSensitivity ),
+ m_pattern( adjustCase( pattern ) )
+ {
+ if( startsWith( m_pattern, '*' ) ) {
+ m_pattern = m_pattern.substr( 1 );
+ m_wildcard = WildcardAtStart;
+ }
+ if( endsWith( m_pattern, '*' ) ) {
+ m_pattern = m_pattern.substr( 0, m_pattern.size()-1 );
+ m_wildcard = static_cast<WildcardPosition>( m_wildcard | WildcardAtEnd );
+ }
+ }
+
+ bool WildcardPattern::matches( std::string const& str ) const {
+ switch( m_wildcard ) {
+ case NoWildcard:
+ return m_pattern == adjustCase( str );
+ case WildcardAtStart:
+ return endsWith( adjustCase( str ), m_pattern );
+ case WildcardAtEnd:
+ return startsWith( adjustCase( str ), m_pattern );
+ case WildcardAtBothEnds:
+ return contains( adjustCase( str ), m_pattern );
+ default:
+ CATCH_INTERNAL_ERROR( "Unknown enum" );
+ }
+ }
+
+ std::string WildcardPattern::adjustCase( std::string const& str ) const {
+ return m_caseSensitivity == CaseSensitive::No ? toLower( str ) : str;
+ }
+}
diff --git a/include/internal/catch_wildcard_pattern.h b/include/internal/catch_wildcard_pattern.h
new file mode 100644
index 0000000..4dae717
--- /dev/null
+++ b/include/internal/catch_wildcard_pattern.h
@@ -0,0 +1,38 @@
+/*
+ * Created by Phil on 13/7/2015.
+ * Copyright 2015 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_WILDCARD_PATTERN_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_WILDCARD_PATTERN_HPP_INCLUDED
+
+#include "catch_common.h"
+
+
+namespace Catch
+{
+ class WildcardPattern {
+ enum WildcardPosition {
+ NoWildcard = 0,
+ WildcardAtStart = 1,
+ WildcardAtEnd = 2,
+ WildcardAtBothEnds = WildcardAtStart | WildcardAtEnd
+ };
+
+ public:
+
+ WildcardPattern( std::string const& pattern, CaseSensitive::Choice caseSensitivity );
+ virtual ~WildcardPattern() = default;
+ virtual bool matches( std::string const& str ) const;
+
+ private:
+ std::string adjustCase( std::string const& str ) const;
+ CaseSensitive::Choice m_caseSensitivity;
+ WildcardPosition m_wildcard = NoWildcard;
+ std::string m_pattern;
+ };
+}
+
+#endif // TWOBLUECUBES_CATCH_WILDCARD_PATTERN_HPP_INCLUDED
diff --git a/include/internal/catch_windows_h_proxy.h b/include/internal/catch_windows_h_proxy.h
new file mode 100644
index 0000000..a7a19c8
--- /dev/null
+++ b/include/internal/catch_windows_h_proxy.h
@@ -0,0 +1,39 @@
+/*
+ * Created by Martin on 16/01/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)
+ */
+
+#ifndef TWOBLUECUBES_CATCH_WINDOWS_H_PROXY_H_INCLUDED
+#define TWOBLUECUBES_CATCH_WINDOWS_H_PROXY_H_INCLUDED
+
+#include "catch_platform.h"
+
+#if defined(CATCH_PLATFORM_WINDOWS)
+
+#if !defined(NOMINMAX) && !defined(CATCH_CONFIG_NO_NOMINMAX)
+# define CATCH_DEFINED_NOMINMAX
+# define NOMINMAX
+#endif
+#if !defined(WIN32_LEAN_AND_MEAN) && !defined(CATCH_CONFIG_NO_WIN32_LEAN_AND_MEAN)
+# define CATCH_DEFINED_WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+#endif
+
+#ifdef __AFXDLL
+#include <AfxWin.h>
+#else
+#include <windows.h>
+#endif
+
+#ifdef CATCH_DEFINED_NOMINMAX
+# undef NOMINMAX
+#endif
+#ifdef CATCH_DEFINED_WIN32_LEAN_AND_MEAN
+# undef WIN32_LEAN_AND_MEAN
+#endif
+
+#endif // defined(CATCH_PLATFORM_WINDOWS)
+
+#endif // TWOBLUECUBES_CATCH_WINDOWS_H_PROXY_H_INCLUDED
diff --git a/include/internal/catch_xmlwriter.cpp b/include/internal/catch_xmlwriter.cpp
new file mode 100644
index 0000000..a3316f4
--- /dev/null
+++ b/include/internal/catch_xmlwriter.cpp
@@ -0,0 +1,190 @@
+/*
+ * Created by Phil on 19/07/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_xmlwriter.h"
+
+#include <iomanip>
+
+namespace Catch {
+
+ XmlEncode::XmlEncode( std::string const& str, ForWhat forWhat )
+ : m_str( str ),
+ m_forWhat( forWhat )
+ {}
+
+ void XmlEncode::encodeTo( std::ostream& os ) const {
+
+ // Apostrophe escaping not necessary if we always use " to write attributes
+ // (see: http://www.w3.org/TR/xml/#syntax)
+
+ for( std::size_t i = 0; i < m_str.size(); ++ i ) {
+ char c = m_str[i];
+ switch( c ) {
+ case '<': os << "<"; break;
+ case '&': os << "&"; break;
+
+ case '>':
+ // See: http://www.w3.org/TR/xml/#syntax
+ if( i > 2 && m_str[i-1] == ']' && m_str[i-2] == ']' )
+ os << ">";
+ else
+ os << c;
+ break;
+
+ case '\"':
+ if( m_forWhat == ForAttributes )
+ os << """;
+ else
+ os << c;
+ break;
+
+ default:
+ // Escape control chars - based on contribution by @espenalb in PR #465 and
+ // by @mrpi PR #588
+ if ( ( c >= 0 && c < '\x09' ) || ( c > '\x0D' && c < '\x20') || c=='\x7F' ) {
+ // see http://stackoverflow.com/questions/404107/why-are-control-characters-illegal-in-xml-1-0
+ os << "\\x" << std::uppercase << std::hex << std::setfill('0') << std::setw(2)
+ << static_cast<int>( c );
+ }
+ else
+ os << c;
+ }
+ }
+ }
+
+ std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode ) {
+ xmlEncode.encodeTo( os );
+ return os;
+ }
+
+ XmlWriter::ScopedElement::ScopedElement( XmlWriter* writer )
+ : m_writer( writer )
+ {}
+
+ XmlWriter::ScopedElement::ScopedElement( ScopedElement&& other ) noexcept
+ : m_writer( other.m_writer ){
+ other.m_writer = nullptr;
+ }
+ XmlWriter::ScopedElement& XmlWriter::ScopedElement::operator=( ScopedElement&& other ) noexcept {
+ if ( m_writer ) {
+ m_writer->endElement();
+ }
+ m_writer = other.m_writer;
+ other.m_writer = nullptr;
+ return *this;
+ }
+
+
+ XmlWriter::ScopedElement::~ScopedElement() {
+ if( m_writer )
+ m_writer->endElement();
+ }
+
+ XmlWriter::ScopedElement& XmlWriter::ScopedElement::writeText( std::string const& text, bool indent ) {
+ m_writer->writeText( text, indent );
+ return *this;
+ }
+
+ XmlWriter::XmlWriter( std::ostream& os ) : m_os( os )
+ {
+ writeDeclaration();
+ }
+
+ XmlWriter::~XmlWriter() {
+ while( !m_tags.empty() )
+ endElement();
+ }
+
+ XmlWriter& XmlWriter::startElement( std::string const& name ) {
+ ensureTagClosed();
+ newlineIfNecessary();
+ m_os << m_indent << '<' << name;
+ m_tags.push_back( name );
+ m_indent += " ";
+ m_tagIsOpen = true;
+ return *this;
+ }
+
+ XmlWriter::ScopedElement XmlWriter::scopedElement( std::string const& name ) {
+ ScopedElement scoped( this );
+ startElement( name );
+ return scoped;
+ }
+
+ XmlWriter& XmlWriter::endElement() {
+ newlineIfNecessary();
+ m_indent = m_indent.substr( 0, m_indent.size()-2 );
+ if( m_tagIsOpen ) {
+ m_os << "/>";
+ m_tagIsOpen = false;
+ }
+ else {
+ m_os << m_indent << "</" << m_tags.back() << ">";
+ }
+ m_os << std::endl;
+ m_tags.pop_back();
+ return *this;
+ }
+
+ XmlWriter& XmlWriter::writeAttribute( std::string const& name, std::string const& attribute ) {
+ if( !name.empty() && !attribute.empty() )
+ m_os << ' ' << name << "=\"" << XmlEncode( attribute, XmlEncode::ForAttributes ) << '"';
+ return *this;
+ }
+
+ XmlWriter& XmlWriter::writeAttribute( std::string const& name, bool attribute ) {
+ m_os << ' ' << name << "=\"" << ( attribute ? "true" : "false" ) << '"';
+ return *this;
+ }
+
+ XmlWriter& XmlWriter::writeText( std::string const& text, bool indent ) {
+ if( !text.empty() ){
+ bool tagWasOpen = m_tagIsOpen;
+ ensureTagClosed();
+ if( tagWasOpen && indent )
+ m_os << m_indent;
+ m_os << XmlEncode( text );
+ m_needsNewline = true;
+ }
+ return *this;
+ }
+
+ XmlWriter& XmlWriter::writeComment( std::string const& text ) {
+ ensureTagClosed();
+ m_os << m_indent << "<!--" << text << "-->";
+ m_needsNewline = true;
+ return *this;
+ }
+
+ void XmlWriter::writeStylesheetRef( std::string const& url ) {
+ m_os << "<?xml-stylesheet type=\"text/xsl\" href=\"" << url << "\"?>\n";
+ }
+
+ XmlWriter& XmlWriter::writeBlankLine() {
+ ensureTagClosed();
+ m_os << '\n';
+ return *this;
+ }
+
+ void XmlWriter::ensureTagClosed() {
+ if( m_tagIsOpen ) {
+ m_os << ">" << std::endl;
+ m_tagIsOpen = false;
+ }
+ }
+
+ void XmlWriter::writeDeclaration() {
+ m_os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
+ }
+
+ void XmlWriter::newlineIfNecessary() {
+ if( m_needsNewline ) {
+ m_os << std::endl;
+ m_needsNewline = false;
+ }
+ }
+}
diff --git a/include/internal/catch_xmlwriter.h b/include/internal/catch_xmlwriter.h
new file mode 100644
index 0000000..76456f9
--- /dev/null
+++ b/include/internal/catch_xmlwriter.h
@@ -0,0 +1,105 @@
+/*
+ * Created by Phil on 09/12/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_XMLWRITER_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_XMLWRITER_HPP_INCLUDED
+
+#include "catch_stream.h"
+#include "catch_compiler_capabilities.h"
+
+#include <vector>
+
+namespace Catch {
+
+ class XmlEncode {
+ public:
+ enum ForWhat { ForTextNodes, ForAttributes };
+
+ XmlEncode( std::string const& str, ForWhat forWhat = ForTextNodes );
+
+ void encodeTo( std::ostream& os ) const;
+
+ friend std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode );
+
+ private:
+ std::string m_str;
+ ForWhat m_forWhat;
+ };
+
+ class XmlWriter {
+ public:
+
+ class ScopedElement {
+ public:
+ ScopedElement( XmlWriter* writer );
+
+ ScopedElement( ScopedElement&& other ) noexcept;
+ ScopedElement& operator=( ScopedElement&& other ) noexcept;
+
+ ~ScopedElement();
+
+ ScopedElement& writeText( std::string const& text, bool indent = true );
+
+ template<typename T>
+ ScopedElement& writeAttribute( std::string const& name, T const& attribute ) {
+ m_writer->writeAttribute( name, attribute );
+ return *this;
+ }
+
+ private:
+ mutable XmlWriter* m_writer = nullptr;
+ };
+
+ XmlWriter( std::ostream& os = Catch::cout() );
+ ~XmlWriter();
+
+ XmlWriter( XmlWriter const& ) = delete;
+ XmlWriter& operator=( XmlWriter const& ) = delete;
+
+ XmlWriter& startElement( std::string const& name );
+
+ ScopedElement scopedElement( std::string const& name );
+
+ XmlWriter& endElement();
+
+ XmlWriter& writeAttribute( std::string const& name, std::string const& attribute );
+
+ XmlWriter& writeAttribute( std::string const& name, bool attribute );
+
+ template<typename T>
+ XmlWriter& writeAttribute( std::string const& name, T const& attribute ) {
+ ReusableStringStream rss;
+ rss << attribute;
+ return writeAttribute( name, rss.str() );
+ }
+
+ XmlWriter& writeText( std::string const& text, bool indent = true );
+
+ XmlWriter& writeComment( std::string const& text );
+
+ void writeStylesheetRef( std::string const& url );
+
+ XmlWriter& writeBlankLine();
+
+ void ensureTagClosed();
+
+ private:
+
+ void writeDeclaration();
+
+ void newlineIfNecessary();
+
+ bool m_tagIsOpen = false;
+ bool m_needsNewline = false;
+ std::vector<std::string> m_tags;
+ std::string m_indent;
+ std::ostream& m_os;
+ };
+
+}
+
+#endif // TWOBLUECUBES_CATCH_XMLWRITER_HPP_INCLUDED
diff --git a/include/reporters/catch_reporter_automake.hpp b/include/reporters/catch_reporter_automake.hpp
new file mode 100644
index 0000000..dbebe97
--- /dev/null
+++ b/include/reporters/catch_reporter_automake.hpp
@@ -0,0 +1,62 @@
+/*
+ * Created by Justin R. Wilson on 2/19/2017.
+ * Copyright 2017 Justin R. Wilson. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED
+
+// Don't #include any Catch headers here - we can assume they are already
+// included before this header.
+// This is not good practice in general but is necessary in this case so this
+// file can be distributed as a single header that works with the main
+// Catch single header.
+
+namespace Catch {
+
+ struct AutomakeReporter : StreamingReporterBase<AutomakeReporter> {
+ AutomakeReporter( ReporterConfig const& _config )
+ : StreamingReporterBase( _config )
+ {}
+
+ ~AutomakeReporter() override;
+
+ static std::string getDescription() {
+ return "Reports test results in the format of Automake .trs files";
+ }
+
+ void assertionStarting( AssertionInfo const& ) override {}
+
+ bool assertionEnded( AssertionStats const& /*_assertionStats*/ ) override { return true; }
+
+ void testCaseEnded( TestCaseStats const& _testCaseStats ) override {
+ // Possible values to emit are PASS, XFAIL, SKIP, FAIL, XPASS and ERROR.
+ stream << ":test-result: ";
+ if (_testCaseStats.totals.assertions.allPassed()) {
+ stream << "PASS";
+ } else if (_testCaseStats.totals.assertions.allOk()) {
+ stream << "XFAIL";
+ } else {
+ stream << "FAIL";
+ }
+ stream << ' ' << _testCaseStats.testInfo.name << '\n';
+ StreamingReporterBase::testCaseEnded( _testCaseStats );
+ }
+
+ void skipTest( TestCaseInfo const& testInfo ) override {
+ stream << ":test-result: SKIP " << testInfo.name << '\n';
+ }
+
+ };
+
+#ifdef CATCH_IMPL
+ AutomakeReporter::~AutomakeReporter() {}
+#endif
+
+ CATCH_REGISTER_REPORTER( "automake", AutomakeReporter)
+
+} // end namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED
diff --git a/include/reporters/catch_reporter_bases.cpp b/include/reporters/catch_reporter_bases.cpp
new file mode 100644
index 0000000..c2059b5
--- /dev/null
+++ b/include/reporters/catch_reporter_bases.cpp
@@ -0,0 +1,55 @@
+/*
+ * Created by Phil on 27/11/2013.
+ * Copyright 2013 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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 "../internal/catch_interfaces_reporter.h"
+#include "../internal/catch_errno_guard.h"
+#include "catch_reporter_bases.hpp"
+
+#include <cstring>
+#include <cfloat>
+#include <cstdio>
+#include <assert.h>
+#include <memory>
+
+namespace Catch {
+ void prepareExpandedExpression(AssertionResult& result) {
+ result.getExpandedExpression();
+ }
+
+ // Because formatting using c++ streams is stateful, drop down to C is required
+ // Alternatively we could use stringstream, but its performance is... not good.
+ std::string getFormattedDuration( double duration ) {
+ // Max exponent + 1 is required to represent the whole part
+ // + 1 for decimal point
+ // + 3 for the 3 decimal places
+ // + 1 for null terminator
+ const std::size_t maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1;
+ char buffer[maxDoubleSize];
+
+ // Save previous errno, to prevent sprintf from overwriting it
+ ErrnoGuard guard;
+#ifdef _MSC_VER
+ sprintf_s(buffer, "%.3f", duration);
+#else
+ sprintf(buffer, "%.3f", duration);
+#endif
+ return std::string(buffer);
+ }
+
+
+ TestEventListenerBase::TestEventListenerBase(ReporterConfig const & _config)
+ :StreamingReporterBase(_config) {}
+
+ void TestEventListenerBase::assertionStarting(AssertionInfo const &) {}
+
+ bool TestEventListenerBase::assertionEnded(AssertionStats const &) {
+ return false;
+ }
+
+
+} // end namespace Catch
diff --git a/include/reporters/catch_reporter_bases.hpp b/include/reporters/catch_reporter_bases.hpp
new file mode 100644
index 0000000..7b66ea0
--- /dev/null
+++ b/include/reporters/catch_reporter_bases.hpp
@@ -0,0 +1,274 @@
+/*
+ * Created by Phil on 27/11/2013.
+ * Copyright 2013 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_REPORTER_BASES_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_REPORTER_BASES_HPP_INCLUDED
+
+#include "../internal/catch_interfaces_reporter.h"
+
+#include <algorithm>
+#include <cstring>
+#include <cfloat>
+#include <cstdio>
+#include <assert.h>
+#include <memory>
+#include <ostream>
+
+namespace Catch {
+ void prepareExpandedExpression(AssertionResult& result);
+
+ // Returns double formatted as %.3f (format expected on output)
+ std::string getFormattedDuration( double duration );
+
+ template<typename DerivedT>
+ struct StreamingReporterBase : IStreamingReporter {
+
+ StreamingReporterBase( ReporterConfig const& _config )
+ : m_config( _config.fullConfig() ),
+ stream( _config.stream() )
+ {
+ m_reporterPrefs.shouldRedirectStdOut = false;
+ if( !DerivedT::getSupportedVerbosities().count( m_config->verbosity() ) )
+ throw std::domain_error( "Verbosity level not supported by this reporter" );
+ }
+
+ ReporterPreferences getPreferences() const override {
+ return m_reporterPrefs;
+ }
+
+ static std::set<Verbosity> getSupportedVerbosities() {
+ return { Verbosity::Normal };
+ }
+
+ ~StreamingReporterBase() override = default;
+
+ void noMatchingTestCases(std::string const&) override {}
+
+ void testRunStarting(TestRunInfo const& _testRunInfo) override {
+ currentTestRunInfo = _testRunInfo;
+ }
+ void testGroupStarting(GroupInfo const& _groupInfo) override {
+ currentGroupInfo = _groupInfo;
+ }
+
+ void testCaseStarting(TestCaseInfo const& _testInfo) override {
+ currentTestCaseInfo = _testInfo;
+ }
+ void sectionStarting(SectionInfo const& _sectionInfo) override {
+ m_sectionStack.push_back(_sectionInfo);
+ }
+
+ void sectionEnded(SectionStats const& /* _sectionStats */) override {
+ m_sectionStack.pop_back();
+ }
+ void testCaseEnded(TestCaseStats const& /* _testCaseStats */) override {
+ currentTestCaseInfo.reset();
+ }
+ void testGroupEnded(TestGroupStats const& /* _testGroupStats */) override {
+ currentGroupInfo.reset();
+ }
+ void testRunEnded(TestRunStats const& /* _testRunStats */) override {
+ currentTestCaseInfo.reset();
+ currentGroupInfo.reset();
+ currentTestRunInfo.reset();
+ }
+
+ void skipTest(TestCaseInfo const&) override {
+ // Don't do anything with this by default.
+ // It can optionally be overridden in the derived class.
+ }
+
+ IConfigPtr m_config;
+ std::ostream& stream;
+
+ LazyStat<TestRunInfo> currentTestRunInfo;
+ LazyStat<GroupInfo> currentGroupInfo;
+ LazyStat<TestCaseInfo> currentTestCaseInfo;
+
+ std::vector<SectionInfo> m_sectionStack;
+ ReporterPreferences m_reporterPrefs;
+ };
+
+ template<typename DerivedT>
+ struct CumulativeReporterBase : IStreamingReporter {
+ template<typename T, typename ChildNodeT>
+ struct Node {
+ explicit Node( T const& _value ) : value( _value ) {}
+ virtual ~Node() {}
+
+ using ChildNodes = std::vector<std::shared_ptr<ChildNodeT>>;
+ T value;
+ ChildNodes children;
+ };
+ struct SectionNode {
+ explicit SectionNode(SectionStats const& _stats) : stats(_stats) {}
+ virtual ~SectionNode() = default;
+
+ bool operator == (SectionNode const& other) const {
+ return stats.sectionInfo.lineInfo == other.stats.sectionInfo.lineInfo;
+ }
+ bool operator == (std::shared_ptr<SectionNode> const& other) const {
+ return operator==(*other);
+ }
+
+ SectionStats stats;
+ using ChildSections = std::vector<std::shared_ptr<SectionNode>>;
+ using Assertions = std::vector<AssertionStats>;
+ ChildSections childSections;
+ Assertions assertions;
+ std::string stdOut;
+ std::string stdErr;
+ };
+
+ struct BySectionInfo {
+ BySectionInfo( SectionInfo const& other ) : m_other( other ) {}
+ BySectionInfo( BySectionInfo const& other ) : m_other( other.m_other ) {}
+ bool operator() (std::shared_ptr<SectionNode> const& node) const {
+ return ((node->stats.sectionInfo.name == m_other.name) &&
+ (node->stats.sectionInfo.lineInfo == m_other.lineInfo));
+ }
+ void operator=(BySectionInfo const&) = delete;
+
+ private:
+ SectionInfo const& m_other;
+ };
+
+
+ using TestCaseNode = Node<TestCaseStats, SectionNode>;
+ using TestGroupNode = Node<TestGroupStats, TestCaseNode>;
+ using TestRunNode = Node<TestRunStats, TestGroupNode>;
+
+ CumulativeReporterBase( ReporterConfig const& _config )
+ : m_config( _config.fullConfig() ),
+ stream( _config.stream() )
+ {
+ m_reporterPrefs.shouldRedirectStdOut = false;
+ if( !DerivedT::getSupportedVerbosities().count( m_config->verbosity() ) )
+ throw std::domain_error( "Verbosity level not supported by this reporter" );
+ }
+ ~CumulativeReporterBase() override = default;
+
+ ReporterPreferences getPreferences() const override {
+ return m_reporterPrefs;
+ }
+
+ static std::set<Verbosity> getSupportedVerbosities() {
+ return { Verbosity::Normal };
+ }
+
+ void testRunStarting( TestRunInfo const& ) override {}
+ void testGroupStarting( GroupInfo const& ) override {}
+
+ void testCaseStarting( TestCaseInfo const& ) override {}
+
+ void sectionStarting( SectionInfo const& sectionInfo ) override {
+ SectionStats incompleteStats( sectionInfo, Counts(), 0, false );
+ std::shared_ptr<SectionNode> node;
+ if( m_sectionStack.empty() ) {
+ if( !m_rootSection )
+ m_rootSection = std::make_shared<SectionNode>( incompleteStats );
+ node = m_rootSection;
+ }
+ else {
+ SectionNode& parentNode = *m_sectionStack.back();
+ auto it =
+ std::find_if( parentNode.childSections.begin(),
+ parentNode.childSections.end(),
+ BySectionInfo( sectionInfo ) );
+ if( it == parentNode.childSections.end() ) {
+ node = std::make_shared<SectionNode>( incompleteStats );
+ parentNode.childSections.push_back( node );
+ }
+ else
+ node = *it;
+ }
+ m_sectionStack.push_back( node );
+ m_deepestSection = std::move(node);
+ }
+
+ void assertionStarting(AssertionInfo const&) override {}
+
+ bool assertionEnded(AssertionStats const& assertionStats) override {
+ assert(!m_sectionStack.empty());
+ // AssertionResult holds a pointer to a temporary DecomposedExpression,
+ // which getExpandedExpression() calls to build the expression string.
+ // Our section stack copy of the assertionResult will likely outlive the
+ // temporary, so it must be expanded or discarded now to avoid calling
+ // a destroyed object later.
+ prepareExpandedExpression(const_cast<AssertionResult&>( assertionStats.assertionResult ) );
+ SectionNode& sectionNode = *m_sectionStack.back();
+ sectionNode.assertions.push_back(assertionStats);
+ return true;
+ }
+ void sectionEnded(SectionStats const& sectionStats) override {
+ assert(!m_sectionStack.empty());
+ SectionNode& node = *m_sectionStack.back();
+ node.stats = sectionStats;
+ m_sectionStack.pop_back();
+ }
+ void testCaseEnded(TestCaseStats const& testCaseStats) override {
+ auto node = std::make_shared<TestCaseNode>(testCaseStats);
+ assert(m_sectionStack.size() == 0);
+ node->children.push_back(m_rootSection);
+ m_testCases.push_back(node);
+ m_rootSection.reset();
+
+ assert(m_deepestSection);
+ m_deepestSection->stdOut = testCaseStats.stdOut;
+ m_deepestSection->stdErr = testCaseStats.stdErr;
+ }
+ void testGroupEnded(TestGroupStats const& testGroupStats) override {
+ auto node = std::make_shared<TestGroupNode>(testGroupStats);
+ node->children.swap(m_testCases);
+ m_testGroups.push_back(node);
+ }
+ void testRunEnded(TestRunStats const& testRunStats) override {
+ auto node = std::make_shared<TestRunNode>(testRunStats);
+ node->children.swap(m_testGroups);
+ m_testRuns.push_back(node);
+ testRunEndedCumulative();
+ }
+ virtual void testRunEndedCumulative() = 0;
+
+ void skipTest(TestCaseInfo const&) override {}
+
+ IConfigPtr m_config;
+ std::ostream& stream;
+ std::vector<AssertionStats> m_assertions;
+ std::vector<std::vector<std::shared_ptr<SectionNode>>> m_sections;
+ std::vector<std::shared_ptr<TestCaseNode>> m_testCases;
+ std::vector<std::shared_ptr<TestGroupNode>> m_testGroups;
+
+ std::vector<std::shared_ptr<TestRunNode>> m_testRuns;
+
+ std::shared_ptr<SectionNode> m_rootSection;
+ std::shared_ptr<SectionNode> m_deepestSection;
+ std::vector<std::shared_ptr<SectionNode>> m_sectionStack;
+ ReporterPreferences m_reporterPrefs;
+ };
+
+ template<char C>
+ char const* getLineOfChars() {
+ static char line[CATCH_CONFIG_CONSOLE_WIDTH] = {0};
+ if( !*line ) {
+ std::memset( line, C, CATCH_CONFIG_CONSOLE_WIDTH-1 );
+ line[CATCH_CONFIG_CONSOLE_WIDTH-1] = 0;
+ }
+ return line;
+ }
+
+
+ struct TestEventListenerBase : StreamingReporterBase<TestEventListenerBase> {
+ TestEventListenerBase( ReporterConfig const& _config );
+
+ void assertionStarting(AssertionInfo const&) override;
+ bool assertionEnded(AssertionStats const&) override;
+ };
+
+} // end namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_REPORTER_BASES_HPP_INCLUDED
diff --git a/include/reporters/catch_reporter_compact.cpp b/include/reporters/catch_reporter_compact.cpp
new file mode 100644
index 0000000..caf4d3f
--- /dev/null
+++ b/include/reporters/catch_reporter_compact.cpp
@@ -0,0 +1,294 @@
+/*
+ * Created by Martin on 2017-11-14.
+ *
+ * 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_compact.h"
+
+#include "../internal/catch_reporter_registrars.hpp"
+#include "internal/catch_console_colour.h"
+
+namespace {
+
+#ifdef CATCH_PLATFORM_MAC
+ const char* failedString() { return "FAILED"; }
+ const char* passedString() { return "PASSED"; }
+#else
+ const char* failedString() { return "failed"; }
+ const char* passedString() { return "passed"; }
+#endif
+
+ // Colour::LightGrey
+ Catch::Colour::Code dimColour() { return Catch::Colour::FileName; }
+
+ std::string bothOrAll( std::size_t count ) {
+ return count == 1 ? std::string() :
+ count == 2 ? "both " : "all " ;
+ }
+
+} // anon namespace
+
+
+namespace Catch {
+namespace {
+// Colour, message variants:
+// - white: No tests ran.
+// - red: Failed [both/all] N test cases, failed [both/all] M assertions.
+// - white: Passed [both/all] N test cases (no assertions).
+// - red: Failed N tests cases, failed M assertions.
+// - green: Passed [both/all] N tests cases with M assertions.
+void printTotals(std::ostream& out, const Totals& totals) {
+ if (totals.testCases.total() == 0) {
+ out << "No tests ran.";
+ } else if (totals.testCases.failed == totals.testCases.total()) {
+ Colour colour(Colour::ResultError);
+ const std::string qualify_assertions_failed =
+ totals.assertions.failed == totals.assertions.total() ?
+ bothOrAll(totals.assertions.failed) : std::string();
+ out <<
+ "Failed " << bothOrAll(totals.testCases.failed)
+ << pluralise(totals.testCases.failed, "test case") << ", "
+ "failed " << qualify_assertions_failed <<
+ pluralise(totals.assertions.failed, "assertion") << '.';
+ } else if (totals.assertions.total() == 0) {
+ out <<
+ "Passed " << bothOrAll(totals.testCases.total())
+ << pluralise(totals.testCases.total(), "test case")
+ << " (no assertions).";
+ } else if (totals.assertions.failed) {
+ Colour colour(Colour::ResultError);
+ out <<
+ "Failed " << pluralise(totals.testCases.failed, "test case") << ", "
+ "failed " << pluralise(totals.assertions.failed, "assertion") << '.';
+ } else {
+ Colour colour(Colour::ResultSuccess);
+ out <<
+ "Passed " << bothOrAll(totals.testCases.passed)
+ << pluralise(totals.testCases.passed, "test case") <<
+ " with " << pluralise(totals.assertions.passed, "assertion") << '.';
+ }
+}
+
+// Implementation of CompactReporter formatting
+class AssertionPrinter {
+public:
+ AssertionPrinter& operator= (AssertionPrinter const&) = delete;
+ AssertionPrinter(AssertionPrinter const&) = delete;
+ AssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages)
+ : stream(_stream)
+ , result(_stats.assertionResult)
+ , messages(_stats.infoMessages)
+ , itMessage(_stats.infoMessages.begin())
+ , printInfoMessages(_printInfoMessages) {}
+
+ void print() {
+ printSourceInfo();
+
+ itMessage = messages.begin();
+
+ switch (result.getResultType()) {
+ case ResultWas::Ok:
+ printResultType(Colour::ResultSuccess, passedString());
+ printOriginalExpression();
+ printReconstructedExpression();
+ if (!result.hasExpression())
+ printRemainingMessages(Colour::None);
+ else
+ printRemainingMessages();
+ break;
+ case ResultWas::ExpressionFailed:
+ if (result.isOk())
+ printResultType(Colour::ResultSuccess, failedString() + std::string(" - but was ok"));
+ else
+ printResultType(Colour::Error, failedString());
+ printOriginalExpression();
+ printReconstructedExpression();
+ printRemainingMessages();
+ break;
+ case ResultWas::ThrewException:
+ printResultType(Colour::Error, failedString());
+ printIssue("unexpected exception with message:");
+ printMessage();
+ printExpressionWas();
+ printRemainingMessages();
+ break;
+ case ResultWas::FatalErrorCondition:
+ printResultType(Colour::Error, failedString());
+ printIssue("fatal error condition with message:");
+ printMessage();
+ printExpressionWas();
+ printRemainingMessages();
+ break;
+ case ResultWas::DidntThrowException:
+ printResultType(Colour::Error, failedString());
+ printIssue("expected exception, got none");
+ printExpressionWas();
+ printRemainingMessages();
+ break;
+ case ResultWas::Info:
+ printResultType(Colour::None, "info");
+ printMessage();
+ printRemainingMessages();
+ break;
+ case ResultWas::Warning:
+ printResultType(Colour::None, "warning");
+ printMessage();
+ printRemainingMessages();
+ break;
+ case ResultWas::ExplicitFailure:
+ printResultType(Colour::Error, failedString());
+ printIssue("explicitly");
+ printRemainingMessages(Colour::None);
+ break;
+ // These cases are here to prevent compiler warnings
+ case ResultWas::Unknown:
+ case ResultWas::FailureBit:
+ case ResultWas::Exception:
+ printResultType(Colour::Error, "** internal error **");
+ break;
+ }
+ }
+
+private:
+ void printSourceInfo() const {
+ Colour colourGuard(Colour::FileName);
+ stream << result.getSourceInfo() << ':';
+ }
+
+ void printResultType(Colour::Code colour, std::string const& passOrFail) const {
+ if (!passOrFail.empty()) {
+ {
+ Colour colourGuard(colour);
+ stream << ' ' << passOrFail;
+ }
+ stream << ':';
+ }
+ }
+
+ void printIssue(std::string const& issue) const {
+ stream << ' ' << issue;
+ }
+
+ void printExpressionWas() {
+ if (result.hasExpression()) {
+ stream << ';';
+ {
+ Colour colour(dimColour());
+ stream << " expression was:";
+ }
+ printOriginalExpression();
+ }
+ }
+
+ void printOriginalExpression() const {
+ if (result.hasExpression()) {
+ stream << ' ' << result.getExpression();
+ }
+ }
+
+ void printReconstructedExpression() const {
+ if (result.hasExpandedExpression()) {
+ {
+ Colour colour(dimColour());
+ stream << " for: ";
+ }
+ stream << result.getExpandedExpression();
+ }
+ }
+
+ void printMessage() {
+ if (itMessage != messages.end()) {
+ stream << " '" << itMessage->message << '\'';
+ ++itMessage;
+ }
+ }
+
+ void printRemainingMessages(Colour::Code colour = dimColour()) {
+ if (itMessage == messages.end())
+ return;
+
+ // using messages.end() directly yields (or auto) compilation error:
+ std::vector<MessageInfo>::const_iterator itEnd = messages.end();
+ const std::size_t N = static_cast<std::size_t>(std::distance(itMessage, itEnd));
+
+ {
+ Colour colourGuard(colour);
+ stream << " with " << pluralise(N, "message") << ':';
+ }
+
+ for (; itMessage != itEnd; ) {
+ // If this assertion is a warning ignore any INFO messages
+ if (printInfoMessages || itMessage->type != ResultWas::Info) {
+ stream << " '" << itMessage->message << '\'';
+ if (++itMessage != itEnd) {
+ Colour colourGuard(dimColour());
+ stream << " and";
+ }
+ }
+ }
+ }
+
+private:
+ std::ostream& stream;
+ AssertionResult const& result;
+ std::vector<MessageInfo> messages;
+ std::vector<MessageInfo>::const_iterator itMessage;
+ bool printInfoMessages;
+};
+
+} // anon namespace
+
+ std::string CompactReporter::getDescription() {
+ return "Reports test results on a single line, suitable for IDEs";
+ }
+
+ ReporterPreferences CompactReporter::getPreferences() const {
+ ReporterPreferences prefs;
+ prefs.shouldRedirectStdOut = false;
+ return prefs;
+ }
+
+ void CompactReporter::noMatchingTestCases( std::string const& spec ) {
+ stream << "No test cases matched '" << spec << '\'' << std::endl;
+ }
+
+ void CompactReporter::assertionStarting( AssertionInfo const& ) {}
+
+ bool CompactReporter::assertionEnded( AssertionStats const& _assertionStats ) {
+ AssertionResult const& result = _assertionStats.assertionResult;
+
+ bool printInfoMessages = true;
+
+ // Drop out if result was successful and we're not printing those
+ if( !m_config->includeSuccessfulResults() && result.isOk() ) {
+ if( result.getResultType() != ResultWas::Warning )
+ return false;
+ printInfoMessages = false;
+ }
+
+ AssertionPrinter printer( stream, _assertionStats, printInfoMessages );
+ printer.print();
+
+ stream << std::endl;
+ return true;
+ }
+
+ void CompactReporter::sectionEnded(SectionStats const& _sectionStats) {
+ if (m_config->showDurations() == ShowDurations::Always) {
+ stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl;
+ }
+ }
+
+ void CompactReporter::testRunEnded( TestRunStats const& _testRunStats ) {
+ printTotals( stream, _testRunStats.totals );
+ stream << '\n' << std::endl;
+ StreamingReporterBase::testRunEnded( _testRunStats );
+ }
+
+ CompactReporter::~CompactReporter() {}
+
+ CATCH_REGISTER_REPORTER( "compact", CompactReporter )
+
+} // end namespace Catch
diff --git a/include/reporters/catch_reporter_compact.h b/include/reporters/catch_reporter_compact.h
new file mode 100644
index 0000000..5002df7
--- /dev/null
+++ b/include/reporters/catch_reporter_compact.h
@@ -0,0 +1,41 @@
+/*
+ * Created by Martin Moene on 2013-12-05.
+ * Copyright 2012 Martin Moene. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_REPORTER_COMPACT_H_INCLUDED
+#define TWOBLUECUBES_CATCH_REPORTER_COMPACT_H_INCLUDED
+
+
+#include "catch_reporter_bases.hpp"
+
+
+namespace Catch {
+
+ struct CompactReporter : StreamingReporterBase<CompactReporter> {
+
+ using StreamingReporterBase::StreamingReporterBase;
+
+ ~CompactReporter() override;
+
+ static std::string getDescription();
+
+ ReporterPreferences getPreferences() const override;
+
+ void noMatchingTestCases(std::string const& spec) override;
+
+ void assertionStarting(AssertionInfo const&) override;
+
+ bool assertionEnded(AssertionStats const& _assertionStats) override;
+
+ void sectionEnded(SectionStats const& _sectionStats) override;
+
+ void testRunEnded(TestRunStats const& _testRunStats) override;
+
+ };
+
+} // end namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_REPORTER_COMPACT_H_INCLUDED
diff --git a/include/reporters/catch_reporter_console.cpp b/include/reporters/catch_reporter_console.cpp
new file mode 100644
index 0000000..54b62cd
--- /dev/null
+++ b/include/reporters/catch_reporter_console.cpp
@@ -0,0 +1,633 @@
+/*
+ * Created by Phil on 5/12/2012.
+ * Copyright 2012 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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_console.h"
+
+#include "../internal/catch_reporter_registrars.hpp"
+#include "internal/catch_console_colour.h"
+#include "../internal/catch_version.h"
+#include "../internal/catch_text.h"
+#include "../internal/catch_stringref.h"
+
+#include <cfloat>
+#include <cstdio>
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch
+ // Note that 4062 (not all labels are handled
+ // and default is missing) is enabled
+#endif
+
+
+namespace Catch {
+
+namespace {
+
+// Formatter impl for ConsoleReporter
+class ConsoleAssertionPrinter {
+public:
+ ConsoleAssertionPrinter& operator= (ConsoleAssertionPrinter const&) = delete;
+ ConsoleAssertionPrinter(ConsoleAssertionPrinter const&) = delete;
+ ConsoleAssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages)
+ : stream(_stream),
+ stats(_stats),
+ result(_stats.assertionResult),
+ colour(Colour::None),
+ message(result.getMessage()),
+ messages(_stats.infoMessages),
+ printInfoMessages(_printInfoMessages) {
+ switch (result.getResultType()) {
+ case ResultWas::Ok:
+ colour = Colour::Success;
+ passOrFail = "PASSED";
+ //if( result.hasMessage() )
+ if (_stats.infoMessages.size() == 1)
+ messageLabel = "with message";
+ if (_stats.infoMessages.size() > 1)
+ messageLabel = "with messages";
+ break;
+ case ResultWas::ExpressionFailed:
+ if (result.isOk()) {
+ colour = Colour::Success;
+ passOrFail = "FAILED - but was ok";
+ } else {
+ colour = Colour::Error;
+ passOrFail = "FAILED";
+ }
+ if (_stats.infoMessages.size() == 1)
+ messageLabel = "with message";
+ if (_stats.infoMessages.size() > 1)
+ messageLabel = "with messages";
+ break;
+ case ResultWas::ThrewException:
+ colour = Colour::Error;
+ passOrFail = "FAILED";
+ messageLabel = "due to unexpected exception with ";
+ if (_stats.infoMessages.size() == 1)
+ messageLabel += "message";
+ if (_stats.infoMessages.size() > 1)
+ messageLabel += "messages";
+ break;
+ case ResultWas::FatalErrorCondition:
+ colour = Colour::Error;
+ passOrFail = "FAILED";
+ messageLabel = "due to a fatal error condition";
+ break;
+ case ResultWas::DidntThrowException:
+ colour = Colour::Error;
+ passOrFail = "FAILED";
+ messageLabel = "because no exception was thrown where one was expected";
+ break;
+ case ResultWas::Info:
+ messageLabel = "info";
+ break;
+ case ResultWas::Warning:
+ messageLabel = "warning";
+ break;
+ case ResultWas::ExplicitFailure:
+ passOrFail = "FAILED";
+ colour = Colour::Error;
+ if (_stats.infoMessages.size() == 1)
+ messageLabel = "explicitly with message";
+ if (_stats.infoMessages.size() > 1)
+ messageLabel = "explicitly with messages";
+ break;
+ // These cases are here to prevent compiler warnings
+ case ResultWas::Unknown:
+ case ResultWas::FailureBit:
+ case ResultWas::Exception:
+ passOrFail = "** internal error **";
+ colour = Colour::Error;
+ break;
+ }
+ }
+
+ void print() const {
+ printSourceInfo();
+ if (stats.totals.assertions.total() > 0) {
+ if (result.isOk())
+ stream << '\n';
+ printResultType();
+ printOriginalExpression();
+ printReconstructedExpression();
+ } else {
+ stream << '\n';
+ }
+ printMessage();
+ }
+
+private:
+ void printResultType() const {
+ if (!passOrFail.empty()) {
+ Colour colourGuard(colour);
+ stream << passOrFail << ":\n";
+ }
+ }
+ void printOriginalExpression() const {
+ if (result.hasExpression()) {
+ Colour colourGuard(Colour::OriginalExpression);
+ stream << " ";
+ stream << result.getExpressionInMacro();
+ stream << '\n';
+ }
+ }
+ void printReconstructedExpression() const {
+ if (result.hasExpandedExpression()) {
+ stream << "with expansion:\n";
+ Colour colourGuard(Colour::ReconstructedExpression);
+ stream << Column(result.getExpandedExpression()).indent(2) << '\n';
+ }
+ }
+ void printMessage() const {
+ if (!messageLabel.empty())
+ stream << messageLabel << ':' << '\n';
+ for (auto const& msg : messages) {
+ // If this assertion is a warning ignore any INFO messages
+ if (printInfoMessages || msg.type != ResultWas::Info)
+ stream << Column(msg.message).indent(2) << '\n';
+ }
+ }
+ void printSourceInfo() const {
+ Colour colourGuard(Colour::FileName);
+ stream << result.getSourceInfo() << ": ";
+ }
+
+ std::ostream& stream;
+ AssertionStats const& stats;
+ AssertionResult const& result;
+ Colour::Code colour;
+ std::string passOrFail;
+ std::string messageLabel;
+ std::string message;
+ std::vector<MessageInfo> messages;
+ bool printInfoMessages;
+};
+
+std::size_t makeRatio(std::size_t number, std::size_t total) {
+ std::size_t ratio = total > 0 ? CATCH_CONFIG_CONSOLE_WIDTH * number / total : 0;
+ return (ratio == 0 && number > 0) ? 1 : ratio;
+}
+
+std::size_t& findMax(std::size_t& i, std::size_t& j, std::size_t& k) {
+ if (i > j && i > k)
+ return i;
+ else if (j > k)
+ return j;
+ else
+ return k;
+}
+
+struct ColumnInfo {
+ enum Justification { Left, Right };
+ std::string name;
+ int width;
+ Justification justification;
+};
+struct ColumnBreak {};
+struct RowBreak {};
+
+class Duration {
+ enum class Unit {
+ Auto,
+ Nanoseconds,
+ Microseconds,
+ Milliseconds,
+ Seconds,
+ Minutes
+ };
+ static const uint64_t s_nanosecondsInAMicrosecond = 1000;
+ static const uint64_t s_nanosecondsInAMillisecond = 1000 * s_nanosecondsInAMicrosecond;
+ static const uint64_t s_nanosecondsInASecond = 1000 * s_nanosecondsInAMillisecond;
+ static const uint64_t s_nanosecondsInAMinute = 60 * s_nanosecondsInASecond;
+
+ uint64_t m_inNanoseconds;
+ Unit m_units;
+
+public:
+ explicit Duration(uint64_t inNanoseconds, Unit units = Unit::Auto)
+ : m_inNanoseconds(inNanoseconds),
+ m_units(units) {
+ if (m_units == Unit::Auto) {
+ if (m_inNanoseconds < s_nanosecondsInAMicrosecond)
+ m_units = Unit::Nanoseconds;
+ else if (m_inNanoseconds < s_nanosecondsInAMillisecond)
+ m_units = Unit::Microseconds;
+ else if (m_inNanoseconds < s_nanosecondsInASecond)
+ m_units = Unit::Milliseconds;
+ else if (m_inNanoseconds < s_nanosecondsInAMinute)
+ m_units = Unit::Seconds;
+ else
+ m_units = Unit::Minutes;
+ }
+
+ }
+
+ auto value() const -> double {
+ switch (m_units) {
+ case Unit::Microseconds:
+ return m_inNanoseconds / static_cast<double>(s_nanosecondsInAMicrosecond);
+ case Unit::Milliseconds:
+ return m_inNanoseconds / static_cast<double>(s_nanosecondsInAMillisecond);
+ case Unit::Seconds:
+ return m_inNanoseconds / static_cast<double>(s_nanosecondsInASecond);
+ case Unit::Minutes:
+ return m_inNanoseconds / static_cast<double>(s_nanosecondsInAMinute);
+ default:
+ return static_cast<double>(m_inNanoseconds);
+ }
+ }
+ auto unitsAsString() const -> std::string {
+ switch (m_units) {
+ case Unit::Nanoseconds:
+ return "ns";
+ case Unit::Microseconds:
+ return "µs";
+ case Unit::Milliseconds:
+ return "ms";
+ case Unit::Seconds:
+ return "s";
+ case Unit::Minutes:
+ return "m";
+ default:
+ return "** internal error **";
+ }
+
+ }
+ friend auto operator << (std::ostream& os, Duration const& duration) -> std::ostream& {
+ return os << duration.value() << " " << duration.unitsAsString();
+ }
+};
+} // end anon namespace
+
+class TablePrinter {
+ std::ostream& m_os;
+ std::vector<ColumnInfo> m_columnInfos;
+ std::ostringstream m_oss;
+ int m_currentColumn = -1;
+ bool m_isOpen = false;
+
+public:
+ TablePrinter( std::ostream& os, std::vector<ColumnInfo> columnInfos )
+ : m_os( os ),
+ m_columnInfos( std::move( columnInfos ) ) {}
+
+ auto columnInfos() const -> std::vector<ColumnInfo> const& {
+ return m_columnInfos;
+ }
+
+ void open() {
+ if (!m_isOpen) {
+ m_isOpen = true;
+ *this << RowBreak();
+ for (auto const& info : m_columnInfos)
+ *this << info.name << ColumnBreak();
+ *this << RowBreak();
+ m_os << Catch::getLineOfChars<'-'>() << "\n";
+ }
+ }
+ void close() {
+ if (m_isOpen) {
+ *this << RowBreak();
+ m_os << std::endl;
+ m_isOpen = false;
+ }
+ }
+
+ template<typename T>
+ friend TablePrinter& operator << (TablePrinter& tp, T const& value) {
+ tp.m_oss << value;
+ return tp;
+ }
+
+ friend TablePrinter& operator << (TablePrinter& tp, ColumnBreak) {
+ auto colStr = tp.m_oss.str();
+ // This takes account of utf8 encodings
+ auto strSize = Catch::StringRef(colStr).numberOfCharacters();
+ tp.m_oss.str("");
+ tp.open();
+ if (tp.m_currentColumn == static_cast<int>(tp.m_columnInfos.size() - 1)) {
+ tp.m_currentColumn = -1;
+ tp.m_os << "\n";
+ }
+ tp.m_currentColumn++;
+
+ auto colInfo = tp.m_columnInfos[tp.m_currentColumn];
+ auto padding = (strSize + 2 < static_cast<std::size_t>(colInfo.width))
+ ? std::string(colInfo.width - (strSize + 2), ' ')
+ : std::string();
+ if (colInfo.justification == ColumnInfo::Left)
+ tp.m_os << colStr << padding << " ";
+ else
+ tp.m_os << padding << colStr << " ";
+ return tp;
+ }
+
+ friend TablePrinter& operator << (TablePrinter& tp, RowBreak) {
+ if (tp.m_currentColumn > 0) {
+ tp.m_os << "\n";
+ tp.m_currentColumn = -1;
+ }
+ return tp;
+ }
+};
+
+ConsoleReporter::ConsoleReporter(ReporterConfig const& config)
+ : StreamingReporterBase(config),
+ m_tablePrinter(new TablePrinter(config.stream(),
+ {
+ { "benchmark name", CATCH_CONFIG_CONSOLE_WIDTH - 32, ColumnInfo::Left },
+ { "iters", 8, ColumnInfo::Right },
+ { "elapsed ns", 14, ColumnInfo::Right },
+ { "average", 14, ColumnInfo::Right }
+ })) {}
+ConsoleReporter::~ConsoleReporter() = default;
+
+std::string ConsoleReporter::getDescription() {
+ return "Reports test results as plain lines of text";
+}
+
+void ConsoleReporter::noMatchingTestCases(std::string const& spec) {
+ stream << "No test cases matched '" << spec << '\'' << std::endl;
+}
+
+void ConsoleReporter::assertionStarting(AssertionInfo const&) {}
+
+bool ConsoleReporter::assertionEnded(AssertionStats const& _assertionStats) {
+ AssertionResult const& result = _assertionStats.assertionResult;
+
+ bool includeResults = m_config->includeSuccessfulResults() || !result.isOk();
+
+ // Drop out if result was successful but we're not printing them.
+ if (!includeResults && result.getResultType() != ResultWas::Warning)
+ return false;
+
+ lazyPrint();
+
+ ConsoleAssertionPrinter printer(stream, _assertionStats, includeResults);
+ printer.print();
+ stream << std::endl;
+ return true;
+}
+
+void ConsoleReporter::sectionStarting(SectionInfo const& _sectionInfo) {
+ m_headerPrinted = false;
+ StreamingReporterBase::sectionStarting(_sectionInfo);
+}
+void ConsoleReporter::sectionEnded(SectionStats const& _sectionStats) {
+ m_tablePrinter->close();
+ if (_sectionStats.missingAssertions) {
+ lazyPrint();
+ Colour colour(Colour::ResultError);
+ if (m_sectionStack.size() > 1)
+ stream << "\nNo assertions in section";
+ else
+ stream << "\nNo assertions in test case";
+ stream << " '" << _sectionStats.sectionInfo.name << "'\n" << std::endl;
+ }
+ if (m_config->showDurations() == ShowDurations::Always) {
+ stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl;
+ }
+ if (m_headerPrinted) {
+ m_headerPrinted = false;
+ }
+ StreamingReporterBase::sectionEnded(_sectionStats);
+}
+
+
+void ConsoleReporter::benchmarkStarting(BenchmarkInfo const& info) {
+ lazyPrintWithoutClosingBenchmarkTable();
+
+ auto nameCol = Column( info.name ).width( static_cast<std::size_t>( m_tablePrinter->columnInfos()[0].width - 2 ) );
+
+ bool firstLine = true;
+ for (auto line : nameCol) {
+ if (!firstLine)
+ (*m_tablePrinter) << ColumnBreak() << ColumnBreak() << ColumnBreak();
+ else
+ firstLine = false;
+
+ (*m_tablePrinter) << line << ColumnBreak();
+ }
+}
+void ConsoleReporter::benchmarkEnded(BenchmarkStats const& stats) {
+ Duration average(stats.elapsedTimeInNanoseconds / stats.iterations);
+ (*m_tablePrinter)
+ << stats.iterations << ColumnBreak()
+ << stats.elapsedTimeInNanoseconds << ColumnBreak()
+ << average << ColumnBreak();
+}
+
+void ConsoleReporter::testCaseEnded(TestCaseStats const& _testCaseStats) {
+ m_tablePrinter->close();
+ StreamingReporterBase::testCaseEnded(_testCaseStats);
+ m_headerPrinted = false;
+}
+void ConsoleReporter::testGroupEnded(TestGroupStats const& _testGroupStats) {
+ if (currentGroupInfo.used) {
+ printSummaryDivider();
+ stream << "Summary for group '" << _testGroupStats.groupInfo.name << "':\n";
+ printTotals(_testGroupStats.totals);
+ stream << '\n' << std::endl;
+ }
+ StreamingReporterBase::testGroupEnded(_testGroupStats);
+}
+void ConsoleReporter::testRunEnded(TestRunStats const& _testRunStats) {
+ printTotalsDivider(_testRunStats.totals);
+ printTotals(_testRunStats.totals);
+ stream << std::endl;
+ StreamingReporterBase::testRunEnded(_testRunStats);
+}
+
+void ConsoleReporter::lazyPrint() {
+
+ m_tablePrinter->close();
+ lazyPrintWithoutClosingBenchmarkTable();
+}
+
+void ConsoleReporter::lazyPrintWithoutClosingBenchmarkTable() {
+
+ if (!currentTestRunInfo.used)
+ lazyPrintRunInfo();
+ if (!currentGroupInfo.used)
+ lazyPrintGroupInfo();
+
+ if (!m_headerPrinted) {
+ printTestCaseAndSectionHeader();
+ m_headerPrinted = true;
+ }
+}
+void ConsoleReporter::lazyPrintRunInfo() {
+ stream << '\n' << getLineOfChars<'~'>() << '\n';
+ Colour colour(Colour::SecondaryText);
+ stream << currentTestRunInfo->name
+ << " is a Catch v" << libraryVersion() << " host application.\n"
+ << "Run with -? for options\n\n";
+
+ if (m_config->rngSeed() != 0)
+ stream << "Randomness seeded to: " << m_config->rngSeed() << "\n\n";
+
+ currentTestRunInfo.used = true;
+}
+void ConsoleReporter::lazyPrintGroupInfo() {
+ if (!currentGroupInfo->name.empty() && currentGroupInfo->groupsCounts > 1) {
+ printClosedHeader("Group: " + currentGroupInfo->name);
+ currentGroupInfo.used = true;
+ }
+}
+void ConsoleReporter::printTestCaseAndSectionHeader() {
+ assert(!m_sectionStack.empty());
+ printOpenHeader(currentTestCaseInfo->name);
+
+ if (m_sectionStack.size() > 1) {
+ Colour colourGuard(Colour::Headers);
+
+ auto
+ it = m_sectionStack.begin() + 1, // Skip first section (test case)
+ itEnd = m_sectionStack.end();
+ for (; it != itEnd; ++it)
+ printHeaderString(it->name, 2);
+ }
+
+ SourceLineInfo lineInfo = m_sectionStack.back().lineInfo;
+
+ if (!lineInfo.empty()) {
+ stream << getLineOfChars<'-'>() << '\n';
+ Colour colourGuard(Colour::FileName);
+ stream << lineInfo << '\n';
+ }
+ stream << getLineOfChars<'.'>() << '\n' << std::endl;
+}
+
+void ConsoleReporter::printClosedHeader(std::string const& _name) {
+ printOpenHeader(_name);
+ stream << getLineOfChars<'.'>() << '\n';
+}
+void ConsoleReporter::printOpenHeader(std::string const& _name) {
+ stream << getLineOfChars<'-'>() << '\n';
+ {
+ Colour colourGuard(Colour::Headers);
+ printHeaderString(_name);
+ }
+}
+
+// if string has a : in first line will set indent to follow it on
+// subsequent lines
+void ConsoleReporter::printHeaderString(std::string const& _string, std::size_t indent) {
+ std::size_t i = _string.find(": ");
+ if (i != std::string::npos)
+ i += 2;
+ else
+ i = 0;
+ stream << Column(_string).indent(indent + i).initialIndent(indent) << '\n';
+}
+
+struct SummaryColumn {
+
+ SummaryColumn( std::string _label, Colour::Code _colour )
+ : label( std::move( _label ) ),
+ colour( _colour ) {}
+ SummaryColumn addRow( std::size_t count ) {
+ ReusableStringStream rss;
+ rss << count;
+ std::string row = rss.str();
+ for (auto& oldRow : rows) {
+ while (oldRow.size() < row.size())
+ oldRow = ' ' + oldRow;
+ while (oldRow.size() > row.size())
+ row = ' ' + row;
+ }
+ rows.push_back(row);
+ return *this;
+ }
+
+ std::string label;
+ Colour::Code colour;
+ std::vector<std::string> rows;
+
+};
+
+void ConsoleReporter::printTotals( Totals const& totals ) {
+ if (totals.testCases.total() == 0) {
+ stream << Colour(Colour::Warning) << "No tests ran\n";
+ } else if (totals.assertions.total() > 0 && totals.testCases.allPassed()) {
+ stream << Colour(Colour::ResultSuccess) << "All tests passed";
+ stream << " ("
+ << pluralise(totals.assertions.passed, "assertion") << " in "
+ << pluralise(totals.testCases.passed, "test case") << ')'
+ << '\n';
+ } else {
+
+ std::vector<SummaryColumn> columns;
+ columns.push_back(SummaryColumn("", Colour::None)
+ .addRow(totals.testCases.total())
+ .addRow(totals.assertions.total()));
+ columns.push_back(SummaryColumn("passed", Colour::Success)
+ .addRow(totals.testCases.passed)
+ .addRow(totals.assertions.passed));
+ columns.push_back(SummaryColumn("failed", Colour::ResultError)
+ .addRow(totals.testCases.failed)
+ .addRow(totals.assertions.failed));
+ columns.push_back(SummaryColumn("failed as expected", Colour::ResultExpectedFailure)
+ .addRow(totals.testCases.failedButOk)
+ .addRow(totals.assertions.failedButOk));
+
+ printSummaryRow("test cases", columns, 0);
+ printSummaryRow("assertions", columns, 1);
+ }
+}
+void ConsoleReporter::printSummaryRow(std::string const& label, std::vector<SummaryColumn> const& cols, std::size_t row) {
+ for (auto col : cols) {
+ std::string value = col.rows[row];
+ if (col.label.empty()) {
+ stream << label << ": ";
+ if (value != "0")
+ stream << value;
+ else
+ stream << Colour(Colour::Warning) << "- none -";
+ } else if (value != "0") {
+ stream << Colour(Colour::LightGrey) << " | ";
+ stream << Colour(col.colour)
+ << value << ' ' << col.label;
+ }
+ }
+ stream << '\n';
+}
+
+void ConsoleReporter::printTotalsDivider(Totals const& totals) {
+ if (totals.testCases.total() > 0) {
+ std::size_t failedRatio = makeRatio(totals.testCases.failed, totals.testCases.total());
+ std::size_t failedButOkRatio = makeRatio(totals.testCases.failedButOk, totals.testCases.total());
+ std::size_t passedRatio = makeRatio(totals.testCases.passed, totals.testCases.total());
+ while (failedRatio + failedButOkRatio + passedRatio < CATCH_CONFIG_CONSOLE_WIDTH - 1)
+ findMax(failedRatio, failedButOkRatio, passedRatio)++;
+ while (failedRatio + failedButOkRatio + passedRatio > CATCH_CONFIG_CONSOLE_WIDTH - 1)
+ findMax(failedRatio, failedButOkRatio, passedRatio)--;
+
+ stream << Colour(Colour::Error) << std::string(failedRatio, '=');
+ stream << Colour(Colour::ResultExpectedFailure) << std::string(failedButOkRatio, '=');
+ if (totals.testCases.allPassed())
+ stream << Colour(Colour::ResultSuccess) << std::string(passedRatio, '=');
+ else
+ stream << Colour(Colour::Success) << std::string(passedRatio, '=');
+ } else {
+ stream << Colour(Colour::Warning) << std::string(CATCH_CONFIG_CONSOLE_WIDTH - 1, '=');
+ }
+ stream << '\n';
+}
+void ConsoleReporter::printSummaryDivider() {
+ stream << getLineOfChars<'-'>() << '\n';
+}
+
+CATCH_REGISTER_REPORTER("console", ConsoleReporter)
+
+} // end namespace Catch
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif
diff --git a/include/reporters/catch_reporter_console.h b/include/reporters/catch_reporter_console.h
new file mode 100644
index 0000000..10cea49
--- /dev/null
+++ b/include/reporters/catch_reporter_console.h
@@ -0,0 +1,83 @@
+/*
+ * Created by Phil on 5/12/2012.
+ * Copyright 2012 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_REPORTER_CONSOLE_H_INCLUDED
+#define TWOBLUECUBES_CATCH_REPORTER_CONSOLE_H_INCLUDED
+
+#include "catch_reporter_bases.hpp"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch
+ // Note that 4062 (not all labels are handled
+ // and default is missing) is enabled
+#endif
+
+
+namespace Catch {
+ // Fwd decls
+ struct SummaryColumn;
+ class TablePrinter;
+
+ struct ConsoleReporter : StreamingReporterBase<ConsoleReporter> {
+ std::unique_ptr<TablePrinter> m_tablePrinter;
+
+ ConsoleReporter(ReporterConfig const& config);
+ ~ConsoleReporter() override;
+ static std::string getDescription();
+
+ void noMatchingTestCases(std::string const& spec) override;
+
+ void assertionStarting(AssertionInfo const&) override;
+
+ bool assertionEnded(AssertionStats const& _assertionStats) override;
+
+ void sectionStarting(SectionInfo const& _sectionInfo) override;
+ void sectionEnded(SectionStats const& _sectionStats) override;
+
+
+ void benchmarkStarting(BenchmarkInfo const& info) override;
+ void benchmarkEnded(BenchmarkStats const& stats) override;
+
+ void testCaseEnded(TestCaseStats const& _testCaseStats) override;
+ void testGroupEnded(TestGroupStats const& _testGroupStats) override;
+ void testRunEnded(TestRunStats const& _testRunStats) override;
+
+ private:
+
+ void lazyPrint();
+
+ void lazyPrintWithoutClosingBenchmarkTable();
+ void lazyPrintRunInfo();
+ void lazyPrintGroupInfo();
+ void printTestCaseAndSectionHeader();
+
+ void printClosedHeader(std::string const& _name);
+ void printOpenHeader(std::string const& _name);
+
+ // if string has a : in first line will set indent to follow it on
+ // subsequent lines
+ void printHeaderString(std::string const& _string, std::size_t indent = 0);
+
+
+ void printTotals(Totals const& totals);
+ void printSummaryRow(std::string const& label, std::vector<SummaryColumn> const& cols, std::size_t row);
+
+ void printTotalsDivider(Totals const& totals);
+ void printSummaryDivider();
+
+ private:
+ bool m_headerPrinted = false;
+ };
+
+} // end namespace Catch
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif
+
+#endif // TWOBLUECUBES_CATCH_REPORTER_CONSOLE_H_INCLUDED
diff --git a/include/reporters/catch_reporter_junit.cpp b/include/reporters/catch_reporter_junit.cpp
new file mode 100644
index 0000000..d133b70
--- /dev/null
+++ b/include/reporters/catch_reporter_junit.cpp
@@ -0,0 +1,247 @@
+/*
+ * Created by Phil on 26/11/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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_bases.hpp"
+
+#include "catch_reporter_junit.h"
+
+#include "../internal/catch_tostring.h"
+#include "../internal/catch_reporter_registrars.hpp"
+
+#include <assert.h>
+#include <sstream>
+#include <ctime>
+#include <algorithm>
+
+namespace Catch {
+
+ namespace {
+ std::string getCurrentTimestamp() {
+ // Beware, this is not reentrant because of backward compatibility issues
+ // Also, UTC only, again because of backward compatibility (%z is C++11)
+ time_t rawtime;
+ std::time(&rawtime);
+ auto const timeStampSize = sizeof("2017-01-16T17:06:45Z");
+
+#ifdef _MSC_VER
+ std::tm timeInfo = {};
+ gmtime_s(&timeInfo, &rawtime);
+#else
+ std::tm* timeInfo;
+ timeInfo = std::gmtime(&rawtime);
+#endif
+
+ char timeStamp[timeStampSize];
+ const char * const fmt = "%Y-%m-%dT%H:%M:%SZ";
+
+#ifdef _MSC_VER
+ std::strftime(timeStamp, timeStampSize, fmt, &timeInfo);
+#else
+ std::strftime(timeStamp, timeStampSize, fmt, timeInfo);
+#endif
+ return std::string(timeStamp);
+ }
+
+ std::string fileNameTag(const std::vector<std::string> &tags) {
+ auto it = std::find_if(begin(tags),
+ end(tags),
+ [] (std::string const& tag) {return tag.front() == '#'; });
+ if (it != tags.end())
+ return it->substr(1);
+ return std::string();
+ }
+ } // anonymous namespace
+
+ JunitReporter::JunitReporter( ReporterConfig const& _config )
+ : CumulativeReporterBase( _config ),
+ xml( _config.stream() )
+ {
+ m_reporterPrefs.shouldRedirectStdOut = true;
+ }
+
+ JunitReporter::~JunitReporter() {}
+
+ std::string JunitReporter::getDescription() {
+ return "Reports test results in an XML format that looks like Ant's junitreport target";
+ }
+
+ void JunitReporter::noMatchingTestCases( std::string const& /*spec*/ ) {}
+
+ void JunitReporter::testRunStarting( TestRunInfo const& runInfo ) {
+ CumulativeReporterBase::testRunStarting( runInfo );
+ xml.startElement( "testsuites" );
+ }
+
+ void JunitReporter::testGroupStarting( GroupInfo const& groupInfo ) {
+ suiteTimer.start();
+ stdOutForSuite.clear();
+ stdErrForSuite.clear();
+ unexpectedExceptions = 0;
+ CumulativeReporterBase::testGroupStarting( groupInfo );
+ }
+
+ void JunitReporter::testCaseStarting( TestCaseInfo const& testCaseInfo ) {
+ m_okToFail = testCaseInfo.okToFail();
+ }
+
+ bool JunitReporter::assertionEnded( AssertionStats const& assertionStats ) {
+ if( assertionStats.assertionResult.getResultType() == ResultWas::ThrewException && !m_okToFail )
+ unexpectedExceptions++;
+ return CumulativeReporterBase::assertionEnded( assertionStats );
+ }
+
+ void JunitReporter::testCaseEnded( TestCaseStats const& testCaseStats ) {
+ stdOutForSuite += testCaseStats.stdOut;
+ stdErrForSuite += testCaseStats.stdErr;
+ CumulativeReporterBase::testCaseEnded( testCaseStats );
+ }
+
+ void JunitReporter::testGroupEnded( TestGroupStats const& testGroupStats ) {
+ double suiteTime = suiteTimer.getElapsedSeconds();
+ CumulativeReporterBase::testGroupEnded( testGroupStats );
+ writeGroup( *m_testGroups.back(), suiteTime );
+ }
+
+ void JunitReporter::testRunEndedCumulative() {
+ xml.endElement();
+ }
+
+ void JunitReporter::writeGroup( TestGroupNode const& groupNode, double suiteTime ) {
+ XmlWriter::ScopedElement e = xml.scopedElement( "testsuite" );
+ TestGroupStats const& stats = groupNode.value;
+ xml.writeAttribute( "name", stats.groupInfo.name );
+ xml.writeAttribute( "errors", unexpectedExceptions );
+ xml.writeAttribute( "failures", stats.totals.assertions.failed-unexpectedExceptions );
+ xml.writeAttribute( "tests", stats.totals.assertions.total() );
+ xml.writeAttribute( "hostname", "tbd" ); // !TBD
+ if( m_config->showDurations() == ShowDurations::Never )
+ xml.writeAttribute( "time", "" );
+ else
+ xml.writeAttribute( "time", suiteTime );
+ xml.writeAttribute( "timestamp", getCurrentTimestamp() );
+
+ // Write test cases
+ for( auto const& child : groupNode.children )
+ writeTestCase( *child );
+
+ xml.scopedElement( "system-out" ).writeText( trim( stdOutForSuite ), false );
+ xml.scopedElement( "system-err" ).writeText( trim( stdErrForSuite ), false );
+ }
+
+ void JunitReporter::writeTestCase( TestCaseNode const& testCaseNode ) {
+ TestCaseStats const& stats = testCaseNode.value;
+
+ // All test cases have exactly one section - which represents the
+ // test case itself. That section may have 0-n nested sections
+ assert( testCaseNode.children.size() == 1 );
+ SectionNode const& rootSection = *testCaseNode.children.front();
+
+ std::string className = stats.testInfo.className;
+
+ if( className.empty() ) {
+ className = fileNameTag(stats.testInfo.tags);
+ if ( className.empty() )
+ className = "global";
+ }
+
+ if ( !m_config->name().empty() )
+ className = m_config->name() + "." + className;
+
+ writeSection( className, "", rootSection );
+ }
+
+ void JunitReporter::writeSection( std::string const& className,
+ std::string const& rootName,
+ SectionNode const& sectionNode ) {
+ std::string name = trim( sectionNode.stats.sectionInfo.name );
+ if( !rootName.empty() )
+ name = rootName + '/' + name;
+
+ if( !sectionNode.assertions.empty() ||
+ !sectionNode.stdOut.empty() ||
+ !sectionNode.stdErr.empty() ) {
+ XmlWriter::ScopedElement e = xml.scopedElement( "testcase" );
+ if( className.empty() ) {
+ xml.writeAttribute( "classname", name );
+ xml.writeAttribute( "name", "root" );
+ }
+ else {
+ xml.writeAttribute( "classname", className );
+ xml.writeAttribute( "name", name );
+ }
+ xml.writeAttribute( "time", ::Catch::Detail::stringify( sectionNode.stats.durationInSeconds ) );
+
+ writeAssertions( sectionNode );
+
+ if( !sectionNode.stdOut.empty() )
+ xml.scopedElement( "system-out" ).writeText( trim( sectionNode.stdOut ), false );
+ if( !sectionNode.stdErr.empty() )
+ xml.scopedElement( "system-err" ).writeText( trim( sectionNode.stdErr ), false );
+ }
+ for( auto const& childNode : sectionNode.childSections )
+ if( className.empty() )
+ writeSection( name, "", *childNode );
+ else
+ writeSection( className, name, *childNode );
+ }
+
+ void JunitReporter::writeAssertions( SectionNode const& sectionNode ) {
+ for( auto const& assertion : sectionNode.assertions )
+ writeAssertion( assertion );
+ }
+
+ void JunitReporter::writeAssertion( AssertionStats const& stats ) {
+ AssertionResult const& result = stats.assertionResult;
+ if( !result.isOk() ) {
+ std::string elementName;
+ switch( result.getResultType() ) {
+ case ResultWas::ThrewException:
+ case ResultWas::FatalErrorCondition:
+ elementName = "error";
+ break;
+ case ResultWas::ExplicitFailure:
+ elementName = "failure";
+ break;
+ case ResultWas::ExpressionFailed:
+ elementName = "failure";
+ break;
+ case ResultWas::DidntThrowException:
+ elementName = "failure";
+ break;
+
+ // We should never see these here:
+ case ResultWas::Info:
+ case ResultWas::Warning:
+ case ResultWas::Ok:
+ case ResultWas::Unknown:
+ case ResultWas::FailureBit:
+ case ResultWas::Exception:
+ elementName = "internalError";
+ break;
+ }
+
+ XmlWriter::ScopedElement e = xml.scopedElement( elementName );
+
+ xml.writeAttribute( "message", result.getExpandedExpression() );
+ xml.writeAttribute( "type", result.getTestMacroName() );
+
+ ReusableStringStream rss;
+ if( !result.getMessage().empty() )
+ rss << result.getMessage() << '\n';
+ for( auto const& msg : stats.infoMessages )
+ if( msg.type == ResultWas::Info )
+ rss << msg.message << '\n';
+
+ rss << "at " << result.getSourceInfo();
+ xml.writeText( rss.str(), false );
+ }
+ }
+
+ CATCH_REGISTER_REPORTER( "junit", JunitReporter )
+
+} // end namespace Catch
diff --git a/include/reporters/catch_reporter_junit.h b/include/reporters/catch_reporter_junit.h
new file mode 100644
index 0000000..5ee3a57
--- /dev/null
+++ b/include/reporters/catch_reporter_junit.h
@@ -0,0 +1,61 @@
+/*
+ * Created by Martin on 14/11/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)
+ */
+#ifndef TWOBLUECUBES_CATCH_REPORTER_JUNIT_H_INCLUDED
+#define TWOBLUECUBES_CATCH_REPORTER_JUNIT_H_INCLUDED
+
+
+#include "catch_reporter_bases.hpp"
+#include "../internal/catch_xmlwriter.h"
+#include "../internal/catch_timer.h"
+
+namespace Catch {
+
+ class JunitReporter : public CumulativeReporterBase<JunitReporter> {
+ public:
+ JunitReporter(ReporterConfig const& _config);
+
+ ~JunitReporter() override;
+
+ static std::string getDescription();
+
+ void noMatchingTestCases(std::string const& /*spec*/) override;
+
+ void testRunStarting(TestRunInfo const& runInfo) override;
+
+ void testGroupStarting(GroupInfo const& groupInfo) override;
+
+ void testCaseStarting(TestCaseInfo const& testCaseInfo) override;
+ bool assertionEnded(AssertionStats const& assertionStats) override;
+
+ void testCaseEnded(TestCaseStats const& testCaseStats) override;
+
+ void testGroupEnded(TestGroupStats const& testGroupStats) override;
+
+ void testRunEndedCumulative() override;
+
+ void writeGroup(TestGroupNode const& groupNode, double suiteTime);
+
+ void writeTestCase(TestCaseNode const& testCaseNode);
+
+ void writeSection(std::string const& className,
+ std::string const& rootName,
+ SectionNode const& sectionNode);
+
+ void writeAssertions(SectionNode const& sectionNode);
+ void writeAssertion(AssertionStats const& stats);
+
+ XmlWriter xml;
+ Timer suiteTimer;
+ std::string stdOutForSuite;
+ std::string stdErrForSuite;
+ unsigned int unexpectedExceptions = 0;
+ bool m_okToFail = false;
+ };
+
+} // end namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_REPORTER_JUNIT_H_INCLUDED
diff --git a/include/reporters/catch_reporter_multi.cpp b/include/reporters/catch_reporter_multi.cpp
new file mode 100644
index 0000000..23bb160
--- /dev/null
+++ b/include/reporters/catch_reporter_multi.cpp
@@ -0,0 +1,104 @@
+/*
+ * Created by Phil on 5/08/2015.
+ * Copyright 2015 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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_multi.h"
+
+namespace Catch {
+
+ void MultipleReporters::add( IStreamingReporterPtr&& reporter ) {
+ m_reporters.push_back( std::move( reporter ) );
+ }
+
+ ReporterPreferences MultipleReporters::getPreferences() const {
+ return m_reporters[0]->getPreferences();
+ }
+
+ std::set<Verbosity> MultipleReporters::getSupportedVerbosities() {
+ return std::set<Verbosity>{ };
+ }
+
+
+ void MultipleReporters::noMatchingTestCases( std::string const& spec ) {
+ for( auto const& reporter : m_reporters )
+ reporter->noMatchingTestCases( spec );
+ }
+
+ void MultipleReporters::benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) {
+ for( auto const& reporter : m_reporters )
+ reporter->benchmarkStarting( benchmarkInfo );
+ }
+ void MultipleReporters::benchmarkEnded( BenchmarkStats const& benchmarkStats ) {
+ for( auto const& reporter : m_reporters )
+ reporter->benchmarkEnded( benchmarkStats );
+ }
+
+ void MultipleReporters::testRunStarting( TestRunInfo const& testRunInfo ) {
+ for( auto const& reporter : m_reporters )
+ reporter->testRunStarting( testRunInfo );
+ }
+
+ void MultipleReporters::testGroupStarting( GroupInfo const& groupInfo ) {
+ for( auto const& reporter : m_reporters )
+ reporter->testGroupStarting( groupInfo );
+ }
+
+
+ void MultipleReporters::testCaseStarting( TestCaseInfo const& testInfo ) {
+ for( auto const& reporter : m_reporters )
+ reporter->testCaseStarting( testInfo );
+ }
+
+ void MultipleReporters::sectionStarting( SectionInfo const& sectionInfo ) {
+ for( auto const& reporter : m_reporters )
+ reporter->sectionStarting( sectionInfo );
+ }
+
+ void MultipleReporters::assertionStarting( AssertionInfo const& assertionInfo ) {
+ for( auto const& reporter : m_reporters )
+ reporter->assertionStarting( assertionInfo );
+ }
+
+ // The return value indicates if the messages buffer should be cleared:
+ bool MultipleReporters::assertionEnded( AssertionStats const& assertionStats ) {
+ bool clearBuffer = false;
+ for( auto const& reporter : m_reporters )
+ clearBuffer |= reporter->assertionEnded( assertionStats );
+ return clearBuffer;
+ }
+
+ void MultipleReporters::sectionEnded( SectionStats const& sectionStats ) {
+ for( auto const& reporter : m_reporters )
+ reporter->sectionEnded( sectionStats );
+ }
+
+ void MultipleReporters::testCaseEnded( TestCaseStats const& testCaseStats ) {
+ for( auto const& reporter : m_reporters )
+ reporter->testCaseEnded( testCaseStats );
+ }
+
+ void MultipleReporters::testGroupEnded( TestGroupStats const& testGroupStats ) {
+ for( auto const& reporter : m_reporters )
+ reporter->testGroupEnded( testGroupStats );
+ }
+
+ void MultipleReporters::testRunEnded( TestRunStats const& testRunStats ) {
+ for( auto const& reporter : m_reporters )
+ reporter->testRunEnded( testRunStats );
+ }
+
+
+ void MultipleReporters::skipTest( TestCaseInfo const& testInfo ) {
+ for( auto const& reporter : m_reporters )
+ reporter->skipTest( testInfo );
+ }
+
+ bool MultipleReporters::isMulti() const {
+ return true;
+ }
+
+} // end namespace Catch
diff --git a/include/reporters/catch_reporter_multi.h b/include/reporters/catch_reporter_multi.h
new file mode 100644
index 0000000..985d442
--- /dev/null
+++ b/include/reporters/catch_reporter_multi.h
@@ -0,0 +1,52 @@
+/*
+ * Created by Martin on 19/07/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)
+ */
+#ifndef TWOBLUECUBES_CATCH_MULTI_REPORTER_H_INCLUDED
+#define TWOBLUECUBES_CATCH_MULTI_REPORTER_H_INCLUDED
+
+#include "../internal/catch_interfaces_reporter.h"
+
+namespace Catch {
+
+ class MultipleReporters : public IStreamingReporter {
+ using Reporters = std::vector<IStreamingReporterPtr>;
+ Reporters m_reporters;
+
+ public:
+ void add( IStreamingReporterPtr&& reporter );
+
+ public: // IStreamingReporter
+
+ ReporterPreferences getPreferences() const override;
+
+ void noMatchingTestCases( std::string const& spec ) override;
+
+ static std::set<Verbosity> getSupportedVerbosities();
+
+ void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override;
+ void benchmarkEnded( BenchmarkStats const& benchmarkStats ) override;
+
+ void testRunStarting( TestRunInfo const& testRunInfo ) override;
+ void testGroupStarting( GroupInfo const& groupInfo ) override;
+ void testCaseStarting( TestCaseInfo const& testInfo ) override;
+ void sectionStarting( SectionInfo const& sectionInfo ) override;
+ void assertionStarting( AssertionInfo const& assertionInfo ) override;
+
+ // The return value indicates if the messages buffer should be cleared:
+ bool assertionEnded( AssertionStats const& assertionStats ) override;
+ void sectionEnded( SectionStats const& sectionStats ) override;
+ void testCaseEnded( TestCaseStats const& testCaseStats ) override;
+ void testGroupEnded( TestGroupStats const& testGroupStats ) override;
+ void testRunEnded( TestRunStats const& testRunStats ) override;
+
+ void skipTest( TestCaseInfo const& testInfo ) override;
+ bool isMulti() const override;
+
+ };
+
+} // end namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_MULTI_REPORTER_H_INCLUDED
diff --git a/include/reporters/catch_reporter_tap.hpp b/include/reporters/catch_reporter_tap.hpp
new file mode 100644
index 0000000..edb75b5
--- /dev/null
+++ b/include/reporters/catch_reporter_tap.hpp
@@ -0,0 +1,255 @@
+/*
+ * Created by Colton Wolkins on 2015-08-15.
+ * Copyright 2015 Martin Moene. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_REPORTER_TAP_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_REPORTER_TAP_HPP_INCLUDED
+
+
+// Don't #include any Catch headers here - we can assume they are already
+// included before this header.
+// This is not good practice in general but is necessary in this case so this
+// file can be distributed as a single header that works with the main
+// Catch single header.
+
+#include <algorithm>
+
+namespace Catch {
+
+ struct TAPReporter : StreamingReporterBase<TAPReporter> {
+
+ using StreamingReporterBase::StreamingReporterBase;
+
+ ~TAPReporter() override;
+
+ static std::string getDescription() {
+ return "Reports test results in TAP format, suitable for test harneses";
+ }
+
+ ReporterPreferences getPreferences() const override {
+ ReporterPreferences prefs;
+ prefs.shouldRedirectStdOut = false;
+ return prefs;
+ }
+
+ void noMatchingTestCases( std::string const& spec ) override {
+ stream << "# No test cases matched '" << spec << "'" << std::endl;
+ }
+
+ void assertionStarting( AssertionInfo const& ) override {}
+
+ bool assertionEnded( AssertionStats const& _assertionStats ) override {
+ ++counter;
+
+ AssertionPrinter printer( stream, _assertionStats, counter );
+ printer.print();
+ stream << " # " << currentTestCaseInfo->name ;
+
+ stream << std::endl;
+ return true;
+ }
+
+ void testRunEnded( TestRunStats const& _testRunStats ) override {
+ printTotals( _testRunStats.totals );
+ stream << "\n" << std::endl;
+ StreamingReporterBase::testRunEnded( _testRunStats );
+ }
+
+ private:
+ std::size_t counter = 0;
+ class AssertionPrinter {
+ public:
+ AssertionPrinter& operator= ( AssertionPrinter const& ) = delete;
+ AssertionPrinter( AssertionPrinter const& ) = delete;
+ AssertionPrinter( std::ostream& _stream, AssertionStats const& _stats, std::size_t _counter )
+ : stream( _stream )
+ , result( _stats.assertionResult )
+ , messages( _stats.infoMessages )
+ , itMessage( _stats.infoMessages.begin() )
+ , printInfoMessages( true )
+ , counter(_counter)
+ {}
+
+ void print() {
+ itMessage = messages.begin();
+
+ switch( result.getResultType() ) {
+ case ResultWas::Ok:
+ printResultType( passedString() );
+ printOriginalExpression();
+ printReconstructedExpression();
+ if ( ! result.hasExpression() )
+ printRemainingMessages( Colour::None );
+ else
+ printRemainingMessages();
+ break;
+ case ResultWas::ExpressionFailed:
+ if (result.isOk()) {
+ printResultType(passedString());
+ } else {
+ printResultType(failedString());
+ }
+ printOriginalExpression();
+ printReconstructedExpression();
+ if (result.isOk()) {
+ printIssue(" # TODO");
+ }
+ printRemainingMessages();
+ break;
+ case ResultWas::ThrewException:
+ printResultType( failedString() );
+ printIssue( "unexpected exception with message:" );
+ printMessage();
+ printExpressionWas();
+ printRemainingMessages();
+ break;
+ case ResultWas::FatalErrorCondition:
+ printResultType( failedString() );
+ printIssue( "fatal error condition with message:" );
+ printMessage();
+ printExpressionWas();
+ printRemainingMessages();
+ break;
+ case ResultWas::DidntThrowException:
+ printResultType( failedString() );
+ printIssue( "expected exception, got none" );
+ printExpressionWas();
+ printRemainingMessages();
+ break;
+ case ResultWas::Info:
+ printResultType( "info" );
+ printMessage();
+ printRemainingMessages();
+ break;
+ case ResultWas::Warning:
+ printResultType( "warning" );
+ printMessage();
+ printRemainingMessages();
+ break;
+ case ResultWas::ExplicitFailure:
+ printResultType( failedString() );
+ printIssue( "explicitly" );
+ printRemainingMessages( Colour::None );
+ break;
+ // These cases are here to prevent compiler warnings
+ case ResultWas::Unknown:
+ case ResultWas::FailureBit:
+ case ResultWas::Exception:
+ printResultType( "** internal error **" );
+ break;
+ }
+ }
+
+ private:
+ static Colour::Code dimColour() { return Colour::FileName; }
+
+ static const char* failedString() { return "not ok"; }
+ static const char* passedString() { return "ok"; }
+
+ void printSourceInfo() const {
+ Colour colourGuard( dimColour() );
+ stream << result.getSourceInfo() << ":";
+ }
+
+ void printResultType( std::string const& passOrFail ) const {
+ if( !passOrFail.empty() ) {
+ stream << passOrFail << ' ' << counter << " -";
+ }
+ }
+
+ void printIssue( std::string const& issue ) const {
+ stream << " " << issue;
+ }
+
+ void printExpressionWas() {
+ if( result.hasExpression() ) {
+ stream << ";";
+ {
+ Colour colour( dimColour() );
+ stream << " expression was:";
+ }
+ printOriginalExpression();
+ }
+ }
+
+ void printOriginalExpression() const {
+ if( result.hasExpression() ) {
+ stream << " " << result.getExpression();
+ }
+ }
+
+ void printReconstructedExpression() const {
+ if( result.hasExpandedExpression() ) {
+ {
+ Colour colour( dimColour() );
+ stream << " for: ";
+ }
+ std::string expr = result.getExpandedExpression();
+ std::replace( expr.begin(), expr.end(), '\n', ' ');
+ stream << expr;
+ }
+ }
+
+ void printMessage() {
+ if ( itMessage != messages.end() ) {
+ stream << " '" << itMessage->message << "'";
+ ++itMessage;
+ }
+ }
+
+ void printRemainingMessages( Colour::Code colour = dimColour() ) {
+ if (itMessage == messages.end()) {
+ return;
+ }
+
+ // using messages.end() directly (or auto) yields compilation error:
+ std::vector<MessageInfo>::const_iterator itEnd = messages.end();
+ const std::size_t N = static_cast<std::size_t>( std::distance( itMessage, itEnd ) );
+
+ {
+ Colour colourGuard( colour );
+ stream << " with " << pluralise( N, "message" ) << ":";
+ }
+
+ for(; itMessage != itEnd; ) {
+ // If this assertion is a warning ignore any INFO messages
+ if( printInfoMessages || itMessage->type != ResultWas::Info ) {
+ stream << " '" << itMessage->message << "'";
+ if ( ++itMessage != itEnd ) {
+ Colour colourGuard( dimColour() );
+ stream << " and";
+ }
+ }
+ }
+ }
+
+ private:
+ std::ostream& stream;
+ AssertionResult const& result;
+ std::vector<MessageInfo> messages;
+ std::vector<MessageInfo>::const_iterator itMessage;
+ bool printInfoMessages;
+ std::size_t counter;
+ };
+
+ void printTotals( const Totals& totals ) const {
+ if( totals.testCases.total() == 0 ) {
+ stream << "1..0 # Skipped: No tests ran.";
+ } else {
+ stream << "1.." << counter;
+ }
+ }
+ };
+
+#ifdef CATCH_IMPL
+ TAPReporter::~TAPReporter() {}
+#endif
+
+ CATCH_REGISTER_REPORTER( "tap", TAPReporter )
+
+} // end namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_REPORTER_TAP_HPP_INCLUDED
diff --git a/include/reporters/catch_reporter_teamcity.hpp b/include/reporters/catch_reporter_teamcity.hpp
new file mode 100644
index 0000000..dbd0db5
--- /dev/null
+++ b/include/reporters/catch_reporter_teamcity.hpp
@@ -0,0 +1,220 @@
+/*
+ * Created by Phil Nash on 19th December 2014
+ * Copyright 2014 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_REPORTER_TEAMCITY_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_REPORTER_TEAMCITY_HPP_INCLUDED
+
+// Don't #include any Catch headers here - we can assume they are already
+// included before this header.
+// This is not good practice in general but is necessary in this case so this
+// file can be distributed as a single header that works with the main
+// Catch single header.
+
+#include <cstring>
+
+#ifdef __clang__
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wpadded"
+#endif
+
+namespace Catch {
+
+ struct TeamCityReporter : StreamingReporterBase<TeamCityReporter> {
+ TeamCityReporter( ReporterConfig const& _config )
+ : StreamingReporterBase( _config )
+ {
+ m_reporterPrefs.shouldRedirectStdOut = true;
+ }
+
+ static std::string escape( std::string const& str ) {
+ std::string escaped = str;
+ replaceInPlace( escaped, "|", "||" );
+ replaceInPlace( escaped, "'", "|'" );
+ replaceInPlace( escaped, "\n", "|n" );
+ replaceInPlace( escaped, "\r", "|r" );
+ replaceInPlace( escaped, "[", "|[" );
+ replaceInPlace( escaped, "]", "|]" );
+ return escaped;
+ }
+ ~TeamCityReporter() override;
+
+ static std::string getDescription() {
+ return "Reports test results as TeamCity service messages";
+ }
+
+ void skipTest( TestCaseInfo const& /* testInfo */ ) override {
+ }
+
+ void noMatchingTestCases( std::string const& /* spec */ ) override {}
+
+ void testGroupStarting( GroupInfo const& groupInfo ) override {
+ StreamingReporterBase::testGroupStarting( groupInfo );
+ stream << "##teamcity[testSuiteStarted name='"
+ << escape( groupInfo.name ) << "']\n";
+ }
+ void testGroupEnded( TestGroupStats const& testGroupStats ) override {
+ StreamingReporterBase::testGroupEnded( testGroupStats );
+ stream << "##teamcity[testSuiteFinished name='"
+ << escape( testGroupStats.groupInfo.name ) << "']\n";
+ }
+
+
+ void assertionStarting( AssertionInfo const& ) override {}
+
+ bool assertionEnded( AssertionStats const& assertionStats ) override {
+ AssertionResult const& result = assertionStats.assertionResult;
+ if( !result.isOk() ) {
+
+ ReusableStringStream msg;
+ if( !m_headerPrintedForThisSection )
+ printSectionHeader( msg.get() );
+ m_headerPrintedForThisSection = true;
+
+ msg << result.getSourceInfo() << "\n";
+
+ switch( result.getResultType() ) {
+ case ResultWas::ExpressionFailed:
+ msg << "expression failed";
+ break;
+ case ResultWas::ThrewException:
+ msg << "unexpected exception";
+ break;
+ case ResultWas::FatalErrorCondition:
+ msg << "fatal error condition";
+ break;
+ case ResultWas::DidntThrowException:
+ msg << "no exception was thrown where one was expected";
+ break;
+ case ResultWas::ExplicitFailure:
+ msg << "explicit failure";
+ break;
+
+ // We shouldn't get here because of the isOk() test
+ case ResultWas::Ok:
+ case ResultWas::Info:
+ case ResultWas::Warning:
+ throw std::domain_error( "Internal error in TeamCity reporter" );
+ // These cases are here to prevent compiler warnings
+ case ResultWas::Unknown:
+ case ResultWas::FailureBit:
+ case ResultWas::Exception:
+ throw std::domain_error( "Not implemented" );
+ }
+ if( assertionStats.infoMessages.size() == 1 )
+ msg << " with message:";
+ if( assertionStats.infoMessages.size() > 1 )
+ msg << " with messages:";
+ for( auto const& messageInfo : assertionStats.infoMessages )
+ msg << "\n \"" << messageInfo.message << "\"";
+
+
+ if( result.hasExpression() ) {
+ msg <<
+ "\n " << result.getExpressionInMacro() << "\n"
+ "with expansion:\n" <<
+ " " << result.getExpandedExpression() << "\n";
+ }
+
+ if( currentTestCaseInfo->okToFail() ) {
+ msg << "- failure ignore as test marked as 'ok to fail'\n";
+ stream << "##teamcity[testIgnored"
+ << " name='" << escape( currentTestCaseInfo->name )<< "'"
+ << " message='" << escape( msg.str() ) << "'"
+ << "]\n";
+ }
+ else {
+ stream << "##teamcity[testFailed"
+ << " name='" << escape( currentTestCaseInfo->name )<< "'"
+ << " message='" << escape( msg.str() ) << "'"
+ << "]\n";
+ }
+ }
+ stream.flush();
+ return true;
+ }
+
+ void sectionStarting( SectionInfo const& sectionInfo ) override {
+ m_headerPrintedForThisSection = false;
+ StreamingReporterBase::sectionStarting( sectionInfo );
+ }
+
+ void testCaseStarting( TestCaseInfo const& testInfo ) override {
+ m_testTimer.start();
+ StreamingReporterBase::testCaseStarting( testInfo );
+ stream << "##teamcity[testStarted name='"
+ << escape( testInfo.name ) << "']\n";
+ stream.flush();
+ }
+
+ void testCaseEnded( TestCaseStats const& testCaseStats ) override {
+ StreamingReporterBase::testCaseEnded( testCaseStats );
+ if( !testCaseStats.stdOut.empty() )
+ stream << "##teamcity[testStdOut name='"
+ << escape( testCaseStats.testInfo.name )
+ << "' out='" << escape( testCaseStats.stdOut ) << "']\n";
+ if( !testCaseStats.stdErr.empty() )
+ stream << "##teamcity[testStdErr name='"
+ << escape( testCaseStats.testInfo.name )
+ << "' out='" << escape( testCaseStats.stdErr ) << "']\n";
+ stream << "##teamcity[testFinished name='"
+ << escape( testCaseStats.testInfo.name ) << "' duration='"
+ << m_testTimer.getElapsedMilliseconds() << "']\n";
+ stream.flush();
+ }
+
+ private:
+ void printSectionHeader( std::ostream& os ) {
+ assert( !m_sectionStack.empty() );
+
+ if( m_sectionStack.size() > 1 ) {
+ os << getLineOfChars<'-'>() << "\n";
+
+ std::vector<SectionInfo>::const_iterator
+ it = m_sectionStack.begin()+1, // Skip first section (test case)
+ itEnd = m_sectionStack.end();
+ for( ; it != itEnd; ++it )
+ printHeaderString( os, it->name );
+ os << getLineOfChars<'-'>() << "\n";
+ }
+
+ SourceLineInfo lineInfo = m_sectionStack.front().lineInfo;
+
+ if( !lineInfo.empty() )
+ os << lineInfo << "\n";
+ os << getLineOfChars<'.'>() << "\n\n";
+ }
+
+ // if string has a : in first line will set indent to follow it on
+ // subsequent lines
+ static void printHeaderString( std::ostream& os, std::string const& _string, std::size_t indent = 0 ) {
+ std::size_t i = _string.find( ": " );
+ if( i != std::string::npos )
+ i+=2;
+ else
+ i = 0;
+ os << Column( _string )
+ .indent( indent+i)
+ .initialIndent( indent ) << "\n";
+ }
+ private:
+ bool m_headerPrintedForThisSection = false;
+ Timer m_testTimer;
+ };
+
+#ifdef CATCH_IMPL
+ TeamCityReporter::~TeamCityReporter() {}
+#endif
+
+ CATCH_REGISTER_REPORTER( "teamcity", TeamCityReporter )
+
+} // end namespace Catch
+
+#ifdef __clang__
+# pragma clang diagnostic pop
+#endif
+
+#endif // TWOBLUECUBES_CATCH_REPORTER_TEAMCITY_HPP_INCLUDED
diff --git a/include/reporters/catch_reporter_xml.cpp b/include/reporters/catch_reporter_xml.cpp
new file mode 100644
index 0000000..b721d44
--- /dev/null
+++ b/include/reporters/catch_reporter_xml.cpp
@@ -0,0 +1,223 @@
+/*
+ * Created by Phil on 28/10/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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_xml.h"
+
+#include "../internal/catch_capture.hpp"
+#include "../internal/catch_reporter_registrars.hpp"
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch
+ // Note that 4062 (not all labels are handled
+ // and default is missing) is enabled
+#endif
+
+namespace Catch {
+ XmlReporter::XmlReporter( ReporterConfig const& _config )
+ : StreamingReporterBase( _config ),
+ m_xml(_config.stream())
+ {
+ m_reporterPrefs.shouldRedirectStdOut = true;
+ }
+
+ XmlReporter::~XmlReporter() = default;
+
+ std::string XmlReporter::getDescription() {
+ return "Reports test results as an XML document";
+ }
+
+ std::string XmlReporter::getStylesheetRef() const {
+ return std::string();
+ }
+
+ void XmlReporter::writeSourceInfo( SourceLineInfo const& sourceInfo ) {
+ m_xml
+ .writeAttribute( "filename", sourceInfo.file )
+ .writeAttribute( "line", sourceInfo.line );
+ }
+
+ void XmlReporter::noMatchingTestCases( std::string const& s ) {
+ StreamingReporterBase::noMatchingTestCases( s );
+ }
+
+ void XmlReporter::testRunStarting( TestRunInfo const& testInfo ) {
+ StreamingReporterBase::testRunStarting( testInfo );
+ std::string stylesheetRef = getStylesheetRef();
+ if( !stylesheetRef.empty() )
+ m_xml.writeStylesheetRef( stylesheetRef );
+ m_xml.startElement( "Catch" );
+ if( !m_config->name().empty() )
+ m_xml.writeAttribute( "name", m_config->name() );
+ }
+
+ void XmlReporter::testGroupStarting( GroupInfo const& groupInfo ) {
+ StreamingReporterBase::testGroupStarting( groupInfo );
+ m_xml.startElement( "Group" )
+ .writeAttribute( "name", groupInfo.name );
+ }
+
+ void XmlReporter::testCaseStarting( TestCaseInfo const& testInfo ) {
+ StreamingReporterBase::testCaseStarting(testInfo);
+ m_xml.startElement( "TestCase" )
+ .writeAttribute( "name", trim( testInfo.name ) )
+ .writeAttribute( "description", testInfo.description )
+ .writeAttribute( "tags", testInfo.tagsAsString() );
+
+ writeSourceInfo( testInfo.lineInfo );
+
+ if ( m_config->showDurations() == ShowDurations::Always )
+ m_testCaseTimer.start();
+ m_xml.ensureTagClosed();
+ }
+
+ void XmlReporter::sectionStarting( SectionInfo const& sectionInfo ) {
+ StreamingReporterBase::sectionStarting( sectionInfo );
+ if( m_sectionDepth++ > 0 ) {
+ m_xml.startElement( "Section" )
+ .writeAttribute( "name", trim( sectionInfo.name ) )
+ .writeAttribute( "description", sectionInfo.description );
+ writeSourceInfo( sectionInfo.lineInfo );
+ m_xml.ensureTagClosed();
+ }
+ }
+
+ void XmlReporter::assertionStarting( AssertionInfo const& ) { }
+
+ bool XmlReporter::assertionEnded( AssertionStats const& assertionStats ) {
+
+ AssertionResult const& result = assertionStats.assertionResult;
+
+ bool includeResults = m_config->includeSuccessfulResults() || !result.isOk();
+
+ if( includeResults || result.getResultType() == ResultWas::Warning ) {
+ // Print any info messages in <Info> tags.
+ for( auto const& msg : assertionStats.infoMessages ) {
+ if( msg.type == ResultWas::Info && includeResults ) {
+ m_xml.scopedElement( "Info" )
+ .writeText( msg.message );
+ } else if ( msg.type == ResultWas::Warning ) {
+ m_xml.scopedElement( "Warning" )
+ .writeText( msg.message );
+ }
+ }
+ }
+
+ // Drop out if result was successful but we're not printing them.
+ if( !includeResults && result.getResultType() != ResultWas::Warning )
+ return true;
+
+
+ // Print the expression if there is one.
+ if( result.hasExpression() ) {
+ m_xml.startElement( "Expression" )
+ .writeAttribute( "success", result.succeeded() )
+ .writeAttribute( "type", result.getTestMacroName() );
+
+ writeSourceInfo( result.getSourceInfo() );
+
+ m_xml.scopedElement( "Original" )
+ .writeText( result.getExpression() );
+ m_xml.scopedElement( "Expanded" )
+ .writeText( result.getExpandedExpression() );
+ }
+
+ // And... Print a result applicable to each result type.
+ switch( result.getResultType() ) {
+ case ResultWas::ThrewException:
+ m_xml.startElement( "Exception" );
+ writeSourceInfo( result.getSourceInfo() );
+ m_xml.writeText( result.getMessage() );
+ m_xml.endElement();
+ break;
+ case ResultWas::FatalErrorCondition:
+ m_xml.startElement( "FatalErrorCondition" );
+ writeSourceInfo( result.getSourceInfo() );
+ m_xml.writeText( result.getMessage() );
+ m_xml.endElement();
+ break;
+ case ResultWas::Info:
+ m_xml.scopedElement( "Info" )
+ .writeText( result.getMessage() );
+ break;
+ case ResultWas::Warning:
+ // Warning will already have been written
+ break;
+ case ResultWas::ExplicitFailure:
+ m_xml.startElement( "Failure" );
+ writeSourceInfo( result.getSourceInfo() );
+ m_xml.writeText( result.getMessage() );
+ m_xml.endElement();
+ break;
+ default:
+ break;
+ }
+
+ if( result.hasExpression() )
+ m_xml.endElement();
+
+ return true;
+ }
+
+ void XmlReporter::sectionEnded( SectionStats const& sectionStats ) {
+ StreamingReporterBase::sectionEnded( sectionStats );
+ if( --m_sectionDepth > 0 ) {
+ XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResults" );
+ e.writeAttribute( "successes", sectionStats.assertions.passed );
+ e.writeAttribute( "failures", sectionStats.assertions.failed );
+ e.writeAttribute( "expectedFailures", sectionStats.assertions.failedButOk );
+
+ if ( m_config->showDurations() == ShowDurations::Always )
+ e.writeAttribute( "durationInSeconds", sectionStats.durationInSeconds );
+
+ m_xml.endElement();
+ }
+ }
+
+ void XmlReporter::testCaseEnded( TestCaseStats const& testCaseStats ) {
+ StreamingReporterBase::testCaseEnded( testCaseStats );
+ XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResult" );
+ e.writeAttribute( "success", testCaseStats.totals.assertions.allOk() );
+
+ if ( m_config->showDurations() == ShowDurations::Always )
+ e.writeAttribute( "durationInSeconds", m_testCaseTimer.getElapsedSeconds() );
+
+ if( !testCaseStats.stdOut.empty() )
+ m_xml.scopedElement( "StdOut" ).writeText( trim( testCaseStats.stdOut ), false );
+ if( !testCaseStats.stdErr.empty() )
+ m_xml.scopedElement( "StdErr" ).writeText( trim( testCaseStats.stdErr ), false );
+
+ m_xml.endElement();
+ }
+
+ void XmlReporter::testGroupEnded( TestGroupStats const& testGroupStats ) {
+ StreamingReporterBase::testGroupEnded( testGroupStats );
+ // TODO: Check testGroupStats.aborting and act accordingly.
+ m_xml.scopedElement( "OverallResults" )
+ .writeAttribute( "successes", testGroupStats.totals.assertions.passed )
+ .writeAttribute( "failures", testGroupStats.totals.assertions.failed )
+ .writeAttribute( "expectedFailures", testGroupStats.totals.assertions.failedButOk );
+ m_xml.endElement();
+ }
+
+ void XmlReporter::testRunEnded( TestRunStats const& testRunStats ) {
+ StreamingReporterBase::testRunEnded( testRunStats );
+ m_xml.scopedElement( "OverallResults" )
+ .writeAttribute( "successes", testRunStats.totals.assertions.passed )
+ .writeAttribute( "failures", testRunStats.totals.assertions.failed )
+ .writeAttribute( "expectedFailures", testRunStats.totals.assertions.failedButOk );
+ m_xml.endElement();
+ }
+
+ CATCH_REGISTER_REPORTER( "xml", XmlReporter )
+
+} // end namespace Catch
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif
diff --git a/include/reporters/catch_reporter_xml.h b/include/reporters/catch_reporter_xml.h
new file mode 100644
index 0000000..7926f93
--- /dev/null
+++ b/include/reporters/catch_reporter_xml.h
@@ -0,0 +1,61 @@
+/*
+ * Created by Martin on 14/11/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)
+ */
+#ifndef TWOBLUECUBES_CATCH_REPORTER_XML_H_INCLUDED
+#define TWOBLUECUBES_CATCH_REPORTER_XML_H_INCLUDED
+
+#include "catch_reporter_bases.hpp"
+
+#include "../internal/catch_xmlwriter.h"
+#include "../internal/catch_timer.h"
+
+
+namespace Catch {
+ class XmlReporter : public StreamingReporterBase<XmlReporter> {
+ public:
+ XmlReporter(ReporterConfig const& _config);
+
+ ~XmlReporter() override;
+
+ static std::string getDescription();
+
+ virtual std::string getStylesheetRef() const;
+
+ void writeSourceInfo(SourceLineInfo const& sourceInfo);
+
+ public: // StreamingReporterBase
+
+ void noMatchingTestCases(std::string const& s) override;
+
+ void testRunStarting(TestRunInfo const& testInfo) override;
+
+ void testGroupStarting(GroupInfo const& groupInfo) override;
+
+ void testCaseStarting(TestCaseInfo const& testInfo) override;
+
+ void sectionStarting(SectionInfo const& sectionInfo) override;
+
+ void assertionStarting(AssertionInfo const&) override;
+
+ bool assertionEnded(AssertionStats const& assertionStats) override;
+
+ void sectionEnded(SectionStats const& sectionStats) override;
+
+ void testCaseEnded(TestCaseStats const& testCaseStats) override;
+
+ void testGroupEnded(TestGroupStats const& testGroupStats) override;
+
+ void testRunEnded(TestRunStats const& testRunStats) override;
+
+ private:
+ Timer m_testCaseTimer;
+ XmlWriter m_xml;
+ int m_sectionDepth = 0;
+ };
+
+} // end namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_REPORTER_XML_H_INCLUDED
diff --git a/misc/CMakeLists.txt b/misc/CMakeLists.txt
new file mode 100644
index 0000000..bf80846
--- /dev/null
+++ b/misc/CMakeLists.txt
@@ -0,0 +1,11 @@
+cmake_minimum_required(VERSION 3.0)
+
+project(CatchCoverageHelper)
+
+add_executable(CoverageHelper coverage-helper.cpp)
+set_property(TARGET CoverageHelper PROPERTY CXX_STANDARD 11)
+set_property(TARGET CoverageHelper PROPERTY CXX_STANDARD_REQUIRED ON)
+set_property(TARGET CoverageHelper PROPERTY CXX_EXTENSIONS OFF)
+if (MSVC)
+ target_compile_options( CoverageHelper PRIVATE /W4 /w44265 /WX /w44061 /w44062 )
+endif()
diff --git a/misc/appveyorBuildConfigurationScript.bat b/misc/appveyorBuildConfigurationScript.bat
new file mode 100644
index 0000000..27efcd1
--- /dev/null
+++ b/misc/appveyorBuildConfigurationScript.bat
@@ -0,0 +1,13 @@
+@REM # In debug build, we want to
+@REM # 1) Prebuild memcheck redirecter
+@REM # 2) Regenerate single header include for examples
+@REM # 3) Enable building examples
+if "%CONFIGURATION%"=="Debug" (
+ python scripts\generateSingleHeader.py
+ cmake -Hmisc -Bbuild-misc -A%PLATFORM%
+ cmake --build build-misc
+ cmake -H. -BBuild -A%PLATFORM% -DUSE_WMAIN=%wmain% -DCATCH_BUILD_EXAMPLES=ON -DMEMORYCHECK_COMMAND=build-misc\Debug\CoverageHelper.exe -DMEMORYCHECK_COMMAND_OPTIONS=--sep-- -DMEMORYCHECK_TYPE=Valgrind
+)
+if "%CONFIGURATION%"=="Release" (
+ cmake -H. -BBuild -A%PLATFORM% -DUSE_WMAIN=%wmain%
+)
diff --git a/misc/appveyorMergeCoverageScript.py b/misc/appveyorMergeCoverageScript.py
new file mode 100644
index 0000000..a74e6e0
--- /dev/null
+++ b/misc/appveyorMergeCoverageScript.py
@@ -0,0 +1,9 @@
+#!/usr/bin/env python2
+
+import glob
+import subprocess
+
+if __name__ == '__main__':
+ cov_files = list(glob.glob('cov-report*.bin'))
+ base_cmd = ['OpenCppCoverage', '--quiet', '--export_type=cobertura:cobertura.xml'] + ['--input_coverage={}'.format(f) for f in cov_files]
+ subprocess.call(base_cmd)
diff --git a/misc/appveyorTestRunScript.bat b/misc/appveyorTestRunScript.bat
new file mode 100644
index 0000000..fdcc2ce
--- /dev/null
+++ b/misc/appveyorTestRunScript.bat
@@ -0,0 +1,9 @@
+cd Build
+if "%CONFIGURATION%"=="Debug" (
+ ctest -j 2 -C %CONFIGURATION% -D ExperimentalMemCheck
+ python ..\misc\appveyorMergeCoverageScript.py
+ codecov --root .. --no-color --disable gcov -f cobertura.xml -t %CODECOV_TOKEN%
+)
+if "%CONFIGURATION%"=="Release" (
+ ctest -j 2 -C %CONFIGURATION%
+)
diff --git a/misc/coverage-helper.cpp b/misc/coverage-helper.cpp
new file mode 100644
index 0000000..9783d69
--- /dev/null
+++ b/misc/coverage-helper.cpp
@@ -0,0 +1,100 @@
+#include <algorithm>
+#include <array>
+#include <cassert>
+#include <fstream>
+#include <iostream>
+#include <memory>
+#include <numeric>
+#include <regex>
+#include <string>
+#include <vector>
+
+
+void create_empty_file(std::string const& path) {
+ std::ofstream ofs(path);
+ ofs << '\n';
+}
+
+const std::string separator = "--sep--";
+const std::string logfile_prefix = "--log-file=";
+
+bool starts_with(std::string const& str, std::string const& pref) {
+ return str.find(pref) == 0;
+}
+
+int parse_log_file_arg(std::string const& arg) {
+ assert(starts_with(arg, logfile_prefix) && "Attempting to parse incorrect arg!");
+ auto fname = arg.substr(logfile_prefix.size());
+ create_empty_file(fname);
+ std::regex regex("MemoryChecker\\.(\\d+)\\.log", std::regex::icase);
+ std::smatch match;
+ if (std::regex_search(fname, match, regex)) {
+ return std::stoi(match[1]);
+ } else {
+ throw std::domain_error("Couldn't find desired expression in string: " + fname);
+ }
+}
+
+std::string catch_path(std::string path) {
+ auto start = path.find("catch");
+ // try capitalized instead
+ if (start == std::string::npos) {
+ start = path.find("Catch");
+ }
+ if (start == std::string::npos) {
+ throw std::domain_error("Couldn't find Catch's base path");
+ }
+ auto end = path.find_first_of("\\/", start);
+ return path.substr(0, end);
+}
+
+std::string windowsify_path(std::string path) {
+ for (auto& c : path) {
+ if (c == '/') {
+ c = '\\';
+ }
+ }
+ return path;
+}
+
+void exec_cmd(std::string const& cmd, int log_num, std::string const& path) {
+ std::array<char, 128> buffer;
+#if defined(_WIN32)
+ auto real_cmd = "OpenCppCoverage --export_type binary:cov-report" + std::to_string(log_num)
+ + ".bin --quiet " + "--sources " + path + " --cover_children -- " + cmd;
+ std::cout << "=== Marker ===: Cmd: " << real_cmd << '\n';
+ std::shared_ptr<FILE> pipe(_popen(real_cmd.c_str(), "r"), _pclose);
+#else // Just for testing, in the real world we will always work under WIN32
+ (void)log_num; (void)path;
+ std::shared_ptr<FILE> pipe(popen(cmd.c_str(), "r"), pclose);
+#endif
+
+ if (!pipe) {
+ throw std::runtime_error("popen() failed!");
+ }
+ while (!feof(pipe.get())) {
+ if (fgets(buffer.data(), 128, pipe.get()) != nullptr) {
+ std::cout << buffer.data();
+ }
+ }
+}
+
+// argv should be:
+// [0]: our path
+// [1]: "--log-file=<path>"
+// [2]: "--sep--"
+// [3]+: the actual command
+
+int main(int argc, char** argv) {
+ std::vector<std::string> args(argv, argv + argc);
+ auto sep = std::find(begin(args), end(args), separator);
+ assert(sep - begin(args) == 2 && "Structure differs from expected!");
+
+ auto num = parse_log_file_arg(args[1]);
+
+ auto cmdline = std::accumulate(++sep, end(args), std::string{}, [] (const std::string& lhs, const std::string& rhs) {
+ return lhs + ' ' + rhs;
+ });
+
+ exec_cmd(cmdline, num, windowsify_path(catch_path(args[0])));
+}
diff --git a/misc/installOpenCppCoverage.ps1 b/misc/installOpenCppCoverage.ps1
new file mode 100644
index 0000000..9dbffca
--- /dev/null
+++ b/misc/installOpenCppCoverage.ps1
@@ -0,0 +1,19 @@
+# Downloads are done from the oficial github release page links
+$downloadUrl = "https://github.com/OpenCppCoverage/OpenCppCoverage/releases/download/release-0.9.6.1/OpenCppCoverageSetup-x64-0.9.6.1.exe"
+$installerPath = [System.IO.Path]::Combine($Env:USERPROFILE, "Downloads", "OpenCppCoverageSetup.exe")
+
+if(-Not (Test-Path $installerPath)) {
+ Write-Host -ForegroundColor White ("Downloading OpenCppCoverage from: " + $downloadUrl)
+ Start-FileDownload $downloadUrl -FileName $installerPath
+}
+
+Write-Host -ForegroundColor White "About to install OpenCppCoverage..."
+
+$installProcess = (Start-Process $installerPath -ArgumentList '/VERYSILENT' -PassThru -Wait)
+if($installProcess.ExitCode -ne 0) {
+ throw [System.String]::Format("Failed to install OpenCppCoverage, ExitCode: {0}.", $installProcess.ExitCode)
+}
+
+# Assume standard, boring, installation path of ".../Program Files/OpenCppCoverage"
+$installPath = [System.IO.Path]::Combine(${Env:ProgramFiles}, "OpenCppCoverage")
+$env:Path="$env:Path;$installPath"
diff --git a/projects/Benchmark/BenchMain.cpp b/projects/Benchmark/BenchMain.cpp
new file mode 100644
index 0000000..32ef4ed
--- /dev/null
+++ b/projects/Benchmark/BenchMain.cpp
@@ -0,0 +1,9 @@
+/*
+ * Created by Martin on 16/01/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)
+ */
+
+#define CATCH_CONFIG_MAIN
+#include "catch.hpp"
diff --git a/projects/Benchmark/StringificationBench.cpp b/projects/Benchmark/StringificationBench.cpp
new file mode 100644
index 0000000..765b4e9
--- /dev/null
+++ b/projects/Benchmark/StringificationBench.cpp
@@ -0,0 +1,46 @@
+/*
+ * Created by Martin on 16/01/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.hpp"
+
+#include <vector>
+
+///////////////////////////////////////////////////////////////////////////////
+TEST_CASE("Successful tests -- REQUIRE", "[Success]") {
+ const std::size_t sz = 1 * 1024 * 1024;
+
+
+ std::vector<std::size_t> vec; vec.reserve(sz);
+ for (std::size_t i = 0; i < sz; ++i){
+ vec.push_back(i);
+ REQUIRE(vec.back() == i);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+TEST_CASE("Successful tests -- CHECK", "[Success]") {
+ const std::size_t sz = 1 * 1024 * 1024;
+
+
+ std::vector<std::size_t> vec; vec.reserve(sz);
+ for (std::size_t i = 0; i < sz; ++i){
+ vec.push_back(i);
+ CHECK(vec.back() == i);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+TEST_CASE("Unsuccessful tests -- CHECK", "[Failure]") {
+ const std::size_t sz = 1024 * 1024;
+
+
+ std::vector<std::size_t> vec; vec.reserve(sz);
+ for (std::size_t i = 0; i < sz; ++i){
+ vec.push_back(i);
+ CHECK(vec.size() == i);
+ }
+}
diff --git a/projects/Benchmark/readme.txt b/projects/Benchmark/readme.txt
new file mode 100644
index 0000000..c4d2fab
--- /dev/null
+++ b/projects/Benchmark/readme.txt
@@ -0,0 +1,4 @@
+This is very much a work in progress.
+The past results are standardized to a developer's machine,
+the benchmarking script is basic and there are only 3 benchmarks,
+but this should get better in time. For now, at least there is something to go by.
diff --git a/projects/Benchmark/results/2017-01-14T21-53-49-e3659cdddd43ba4df9e4846630be6a6a7bd85a07.result b/projects/Benchmark/results/2017-01-14T21-53-49-e3659cdddd43ba4df9e4846630be6a6a7bd85a07.result
new file mode 100644
index 0000000..4b6fc65
--- /dev/null
+++ b/projects/Benchmark/results/2017-01-14T21-53-49-e3659cdddd43ba4df9e4846630be6a6a7bd85a07.result
@@ -0,0 +1,3 @@
+Successful tests -- CHECK: median: 3.38116 (s), stddev: 0.11567366292001534 (s)
+Successful tests -- REQUIRE: median: 3.479955 (s), stddev: 0.16295972890734556 (s)
+Unsuccessful tests -- CHECK: median: 1.966895 (s), stddev: 0.06323488524716572 (s)
diff --git a/projects/Benchmark/results/2017-01-14T21-59-08-a1e9b841ff500b2f39ccfd4193ae450cb653da05.result b/projects/Benchmark/results/2017-01-14T21-59-08-a1e9b841ff500b2f39ccfd4193ae450cb653da05.result
new file mode 100644
index 0000000..98c8460
--- /dev/null
+++ b/projects/Benchmark/results/2017-01-14T21-59-08-a1e9b841ff500b2f39ccfd4193ae450cb653da05.result
@@ -0,0 +1,3 @@
+Successful tests -- CHECK: median: 1.30312 (s), stddev: 0.08759818557862176 (s)
+Successful tests -- REQUIRE: median: 1.341535 (s), stddev: 0.1479193390143576 (s)
+Unsuccessful tests -- CHECK: median: 1.967755 (s), stddev: 0.07921104121269959 (s)
diff --git a/projects/Benchmark/results/2017-01-15T09-35-14-3b98a0166f7b7196eba2ad518174d1a77165166d.result b/projects/Benchmark/results/2017-01-15T09-35-14-3b98a0166f7b7196eba2ad518174d1a77165166d.result
new file mode 100644
index 0000000..fe6366b
--- /dev/null
+++ b/projects/Benchmark/results/2017-01-15T09-35-14-3b98a0166f7b7196eba2ad518174d1a77165166d.result
@@ -0,0 +1,3 @@
+Successful tests -- CHECK: median: 1.2982 (s), stddev: 0.019540648829214084 (s)
+Successful tests -- REQUIRE: median: 1.30102 (s), stddev: 0.014758430547392974 (s)
+Unsuccessful tests -- CHECK: median: 15.520199999999999 (s), stddev: 0.09536359426485094 (s)
diff --git a/projects/Benchmark/results/2017-01-29T22-08-36-60f8ebec49c5bc58d3604bf1a72cd3f7d129bf2e.result b/projects/Benchmark/results/2017-01-29T22-08-36-60f8ebec49c5bc58d3604bf1a72cd3f7d129bf2e.result
new file mode 100644
index 0000000..c9b4d64
--- /dev/null
+++ b/projects/Benchmark/results/2017-01-29T22-08-36-60f8ebec49c5bc58d3604bf1a72cd3f7d129bf2e.result
@@ -0,0 +1,3 @@
+Successful tests -- CHECK: median: 0.7689014999999999 (s), stddev: 0.02127512078801068 (s)
+Successful tests -- REQUIRE: median: 0.772845 (s), stddev: 0.03011638381365052 (s)
+Unsuccessful tests -- CHECK: median: 15.49 (s), stddev: 0.536088571143903 (s)
diff --git a/projects/Benchmark/results/2017-01-29T23-13-35-bcaa2f9646c5ce50758f8582307c99501a932e1a.result b/projects/Benchmark/results/2017-01-29T23-13-35-bcaa2f9646c5ce50758f8582307c99501a932e1a.result
new file mode 100644
index 0000000..5b82330
--- /dev/null
+++ b/projects/Benchmark/results/2017-01-29T23-13-35-bcaa2f9646c5ce50758f8582307c99501a932e1a.result
@@ -0,0 +1,3 @@
+Successful tests -- CHECK: median: 0.775769 (s), stddev: 0.014802129132136525 (s)
+Successful tests -- REQUIRE: median: 0.785235 (s), stddev: 0.03532672836834896 (s)
+Unsuccessful tests -- CHECK: median: 15.156600000000001 (s), stddev: 0.2832375673450742 (s)
diff --git a/projects/SelfTest/Baselines/automake.std.approved.txt b/projects/SelfTest/Baselines/automake.std.approved.txt
new file mode 100644
index 0000000..85299f7
--- /dev/null
+++ b/projects/SelfTest/Baselines/automake.std.approved.txt
@@ -0,0 +1,168 @@
+:test-result: PASS # A test name that starts with a #
+:test-result: PASS #542
+:test-result: PASS #809
+:test-result: FAIL 'Not' checks that should fail
+:test-result: PASS 'Not' checks that should succeed
+:test-result: PASS (unimplemented) static bools can be evaluated
+:test-result: FAIL A METHOD_AS_TEST_CASE based test run that fails
+:test-result: PASS A METHOD_AS_TEST_CASE based test run that succeeds
+:test-result: FAIL A TEST_CASE_METHOD based test run that fails
+:test-result: PASS A TEST_CASE_METHOD based test run that succeeds
+:test-result: FAIL A couple of nested sections followed by a failure
+:test-result: FAIL A failing expression with a non streamable type is still captured
+:test-result: PASS AllOf matcher
+:test-result: PASS An empty test with no assertions
+:test-result: PASS An expression with side-effects should only be evaluated once
+:test-result: FAIL An unchecked exception reports the line of the last assertion
+:test-result: PASS Anonymous test case 1
+:test-result: PASS AnyOf matcher
+:test-result: PASS Approximate PI
+:test-result: PASS Approximate comparisons with different epsilons
+:test-result: PASS Approximate comparisons with floats
+:test-result: PASS Approximate comparisons with ints
+:test-result: PASS Approximate comparisons with mixed numeric types
+:test-result: PASS Assertions then sections
+:test-result: PASS Character pretty printing
+:test-result: PASS Comparing function pointers
+:test-result: PASS Comparing member function pointers
+:test-result: PASS Comparisons between ints where one side is computed
+:test-result: PASS Comparisons between unsigned ints and negative signed ints match c++ standard behaviour
+:test-result: PASS Comparisons with int literals don't warn when mixing signed/ unsigned
+:test-result: FAIL Contains string matcher
+:test-result: FAIL Custom exceptions can be translated when testing for nothrow
+:test-result: FAIL Custom exceptions can be translated when testing for throwing as something else
+:test-result: FAIL Custom std-exceptions can be custom translated
+:test-result: PASS Demonstrate that a non-const == is not used
+:test-result: FAIL EndsWith string matcher
+:test-result: XFAIL Equality checks that should fail
+:test-result: PASS Equality checks that should succeed
+:test-result: PASS Equals
+:test-result: FAIL Equals string matcher
+:test-result: PASS Exception messages can be tested for
+:test-result: FAIL Expected exceptions that don't throw or unexpected exceptions fail the test
+:test-result: FAIL FAIL aborts the test
+:test-result: FAIL FAIL does not require an argument
+:test-result: PASS Factorials are computed
+:test-result: PASS Generator over a range of pairs
+:test-result: PASS Generators over two ranges
+:test-result: PASS Greater-than inequalities with different epsilons
+:test-result: PASS INFO and WARN do not abort tests
+:test-result: FAIL INFO gets logged on failure
+:test-result: FAIL INFO gets logged on failure, even if captured before successful assertions
+:test-result: XFAIL Inequality checks that should fail
+:test-result: PASS Inequality checks that should succeed
+:test-result: PASS Less-than inequalities with different epsilons
+:test-result: PASS Long strings can be wrapped
+:test-result: PASS Long text is truncted
+:test-result: PASS ManuallyRegistered
+:test-result: PASS Matchers can be (AllOf) composed with the && operator
+:test-result: PASS Matchers can be (AnyOf) composed with the || operator
+:test-result: PASS Matchers can be composed with both && and ||
+:test-result: FAIL Matchers can be composed with both && and || - failing
+:test-result: PASS Matchers can be negated (Not) with the ! operator
+:test-result: FAIL Matchers can be negated (Not) with the ! operator - failing
+:test-result: FAIL Mismatching exception messages failing the test
+:test-result: PASS Nice descriptive name
+:test-result: FAIL Non-std exceptions can be translated
+:test-result: PASS NotImplemented exception
+:test-result: PASS Objects that evaluated in boolean contexts can be checked
+:test-result: PASS Operators at different namespace levels not hijacked by Koenig lookup
+:test-result: FAIL Ordering comparison checks that should fail
+:test-result: PASS Ordering comparison checks that should succeed
+:test-result: FAIL Output from all sections is reported
+:test-result: PASS Parse test names and tags
+:test-result: PASS Parsing a std::pair
+:test-result: PASS Pointers can be compared to null
+:test-result: PASS Pointers can be converted to strings
+:test-result: PASS Process can be configured on command line
+:test-result: FAIL SCOPED_INFO is reset for each loop
+:test-result: PASS SUCCEED counts as a test pass
+:test-result: PASS SUCCESS does not require an argument
+:test-result: PASS Scenario: BDD tests requiring Fixtures to provide commonly-accessed data or methods
+:test-result: PASS Scenario: Do that thing with the thing
+:test-result: PASS Scenario: This is a really long scenario name to see how the list command deals with wrapping
+:test-result: PASS Scenario: Vector resizing affects size and capacity
+A string sent directly to stdout
+A string sent directly to stderr
+:test-result: PASS Sends stuff to stdout and stderr
+:test-result: PASS Some simple comparisons between doubles
+Message from section one
+Message from section two
+:test-result: PASS Standard output from all sections is reported
+:test-result: FAIL StartsWith string matcher
+:test-result: PASS String matchers
+hello
+hello
+:test-result: PASS Strings can be rendered with colour
+:test-result: FAIL Tabs and newlines show in output
+:test-result: PASS Tag alias can be registered against tag patterns
+:test-result: PASS Test case with one argument
+:test-result: PASS Test enum bit values
+:test-result: PASS Text can be formatted using the Text class
+:test-result: PASS The NO_FAIL macro reports a failure but does not fail the test
+:test-result: FAIL This test 'should' fail but doesn't
+:test-result: PASS Tracker
+:test-result: FAIL Unexpected exceptions can be translated
+:test-result: PASS Use a custom approx
+:test-result: PASS Variadic macros
+:test-result: PASS When checked exceptions are thrown they can be expected or unexpected
+:test-result: FAIL When unchecked exceptions are thrown directly they are always failures
+:test-result: FAIL When unchecked exceptions are thrown during a CHECK the test should continue
+:test-result: FAIL When unchecked exceptions are thrown during a REQUIRE the test should abort fail
+:test-result: FAIL When unchecked exceptions are thrown from functions they are always failures
+:test-result: FAIL When unchecked exceptions are thrown from sections they are always failures
+:test-result: PASS When unchecked exceptions are thrown, but caught, they do not affect the test
+:test-result: PASS Where the LHS is not a simple value
+:test-result: PASS Where there is more to the expression after the RHS
+:test-result: PASS X/level/0/a
+:test-result: PASS X/level/0/b
+:test-result: PASS X/level/1/a
+:test-result: PASS X/level/1/b
+:test-result: PASS XmlEncode
+:test-result: PASS atomic if
+:test-result: PASS boolean member
+:test-result: PASS checkedElse
+:test-result: FAIL checkedElse, failing
+:test-result: PASS checkedIf
+:test-result: FAIL checkedIf, failing
+:test-result: PASS comparisons between const int variables
+:test-result: PASS comparisons between int variables
+:test-result: PASS even more nested SECTION tests
+:test-result: PASS first tag
+spanner:test-result: PASS has printf
+:test-result: FAIL just failure
+:test-result: PASS just info
+:test-result: FAIL looped SECTION tests
+:test-result: FAIL looped tests
+:test-result: FAIL more nested SECTION tests
+:test-result: PASS nested SECTION tests
+:test-result: PASS non streamable - with conv. op
+:test-result: PASS not allowed
+:test-result: PASS null strings
+:test-result: PASS pair<pair<int,const char *,pair<std::string,int> > -> toString
+:test-result: PASS pointer to class
+:test-result: PASS random SECTION tests
+:test-result: PASS replaceInPlace
+:test-result: PASS second tag
+:test-result: FAIL send a single char to INFO
+:test-result: FAIL sends information to INFO
+:test-result: PASS std::pair<int,const std::string> -> toString
+:test-result: PASS std::pair<int,std::string> -> toString
+:test-result: PASS std::vector<std::pair<std::string,int> > -> toString
+:test-result: FAIL string literals of different sizes can be compared
+:test-result: PASS toString on const wchar_t const pointer returns the string contents
+:test-result: PASS toString on const wchar_t pointer returns the string contents
+:test-result: PASS toString on wchar_t const pointer returns the string contents
+:test-result: PASS toString on wchar_t returns the string contents
+:test-result: PASS toString( has_maker )
+:test-result: PASS toString( has_maker_and_toString )
+:test-result: PASS toString( has_toString )
+:test-result: PASS toString( vectors<has_maker )
+:test-result: SKIP toString( vectors<has_maker_and_toString )
+:test-result: SKIP toString( vectors<has_toString )
+:test-result: PASS toString(enum w/operator<<)
+:test-result: PASS toString(enum)
+:test-result: PASS vector<int> -> toString
+:test-result: PASS vector<string> -> toString
+:test-result: PASS vectors can be sized and resized
+:test-result: PASS xmlentitycheck
diff --git a/projects/SelfTest/Baselines/compact.sw.approved.txt b/projects/SelfTest/Baselines/compact.sw.approved.txt
new file mode 100644
index 0000000..947ef42
--- /dev/null
+++ b/projects/SelfTest/Baselines/compact.sw.approved.txt
@@ -0,0 +1,1070 @@
+Misc.tests.cpp:<line number>: passed: with 1 message: 'yay'
+Decomposition.tests.cpp:<line number>: passed: fptr == 0 for: 0 == 0
+Decomposition.tests.cpp:<line number>: passed: fptr == 0l for: 0 == 0
+Compilation.tests.cpp:<line number>: passed: y.v == 0 for: 0 == 0
+Compilation.tests.cpp:<line number>: passed: 0 == y.v for: 0 == 0
+Compilation.tests.cpp:<line number>: passed: t1 == t2 for: {?} == {?}
+Compilation.tests.cpp:<line number>: passed: t1 != t2 for: {?} != {?}
+Compilation.tests.cpp:<line number>: passed: t1 < t2 for: {?} < {?}
+Compilation.tests.cpp:<line number>: passed: t1 > t2 for: {?} > {?}
+Compilation.tests.cpp:<line number>: passed: t1 <= t2 for: {?} <= {?}
+Compilation.tests.cpp:<line number>: passed: t1 >= t2 for: {?} >= {?}
+Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'answer := 42' with 1 message: 'expected exception'
+Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'answer := 42'; expression was: thisThrows() with 1 message: 'expected exception'
+Exception.tests.cpp:<line number>: passed: thisThrows() with 1 message: 'answer := 42'
+Compilation.tests.cpp:<line number>: passed: 42 == f for: 42 == {?}
+Compilation.tests.cpp:<line number>: passed: a == t for: 3 == 3
+Compilation.tests.cpp:<line number>: passed: a == t for: 3 == 3
+Compilation.tests.cpp:<line number>: passed: throws_int(true)
+Compilation.tests.cpp:<line number>: passed: throws_int(true), int
+Compilation.tests.cpp:<line number>: passed: throws_int(false)
+Compilation.tests.cpp:<line number>: passed: "aaa", Catch::EndsWith("aaa") for: "aaa" ends with: "aaa"
+Compilation.tests.cpp:<line number>: passed: templated_tests<int>(3) for: true
+Misc.tests.cpp:<line number>: failed: f() == 0 for: 1 == 0
+Misc.tests.cpp:<line number>: passed: errno == 1 for: 1 == 1
+Compilation.tests.cpp:<line number>: passed: x == 4 for: {?} == 4 with 1 message: 'dummy := 0'
+Misc.tests.cpp:<line number>: passed: with 1 message: 'Everything is OK'
+Misc.tests.cpp:<line number>: passed: with 1 message: 'Everything is OK'
+Misc.tests.cpp:<line number>: passed: with 1 message: 'Everything is OK'
+Misc.tests.cpp:<line number>: passed: with 1 message: 'Everything is OK'
+Misc.tests.cpp:<line number>: passed: with 1 message: 'Everything is OK'
+Condition.tests.cpp:<line number>: failed: false != false
+Condition.tests.cpp:<line number>: failed: true != true
+Condition.tests.cpp:<line number>: failed: !true for: false
+Condition.tests.cpp:<line number>: failed: !(true) for: !true
+Condition.tests.cpp:<line number>: failed: !trueValue for: false
+Condition.tests.cpp:<line number>: failed: !(trueValue) for: !true
+Condition.tests.cpp:<line number>: failed: !(1 == 1) for: false
+Condition.tests.cpp:<line number>: failed: !(1 == 1)
+Condition.tests.cpp:<line number>: passed: false == false
+Condition.tests.cpp:<line number>: passed: true == true
+Condition.tests.cpp:<line number>: passed: !false for: true
+Condition.tests.cpp:<line number>: passed: !(false) for: !false
+Condition.tests.cpp:<line number>: passed: !falseValue for: true
+Condition.tests.cpp:<line number>: passed: !(falseValue) for: !false
+Condition.tests.cpp:<line number>: passed: !(1 == 2) for: true
+Condition.tests.cpp:<line number>: passed: !(1 == 2)
+Tricky.tests.cpp:<line number>: passed: is_true<true>::value == true for: true == true
+Tricky.tests.cpp:<line number>: passed: true == is_true<true>::value for: true == true
+Tricky.tests.cpp:<line number>: passed: is_true<false>::value == false for: false == false
+Tricky.tests.cpp:<line number>: passed: false == is_true<false>::value for: false == false
+Tricky.tests.cpp:<line number>: passed: !is_true<false>::value for: true
+Tricky.tests.cpp:<line number>: passed: !!is_true<true>::value for: true
+Tricky.tests.cpp:<line number>: passed: is_true<true>::value for: true
+Tricky.tests.cpp:<line number>: passed: !(is_true<false>::value) for: !false
+Class.tests.cpp:<line number>: failed: s == "world" for: "hello" == "world"
+Class.tests.cpp:<line number>: passed: s == "hello" for: "hello" == "hello"
+Class.tests.cpp:<line number>: failed: m_a == 2 for: 1 == 2
+Class.tests.cpp:<line number>: passed: m_a == 1 for: 1 == 1
+Misc.tests.cpp:<line number>: passed: with 1 message: 'that's not flying - that's failing in style'
+Misc.tests.cpp:<line number>: failed: explicitly with 1 message: 'to infinity and beyond'
+Tricky.tests.cpp:<line number>: failed: &o1 == &o2 for: 0x<hex digits> == 0x<hex digits>
+Tricky.tests.cpp:<line number>: failed: o1 == o2 for: {?} == {?}
+Approx.tests.cpp:<line number>: passed: 104.0 != Approx(100.0) for: 104.0 != Approx( 100.0 )
+Approx.tests.cpp:<line number>: passed: 104.0 == Approx(100.0).margin(5) for: 104.0 == Approx( 100.0 )
+Approx.tests.cpp:<line number>: passed: 104.0 == Approx(100.0).margin(4) for: 104.0 == Approx( 100.0 )
+Approx.tests.cpp:<line number>: passed: 104.0 != Approx(100.0).margin(3) for: 104.0 != Approx( 100.0 )
+Approx.tests.cpp:<line number>: passed: 100.3 != Approx(100.0) for: 100.3 != Approx( 100.0 )
+Approx.tests.cpp:<line number>: passed: 100.3 == Approx(100.0).margin(0.5) for: 100.3 == Approx( 100.0 )
+Tricky.tests.cpp:<line number>: passed: i++ == 7 for: 7 == 7
+Tricky.tests.cpp:<line number>: passed: i++ == 8 for: 8 == 8
+Exception.tests.cpp:<line number>: passed: 1 == 1
+Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'unexpected exception'; expression was: {Unknown expression after the reported line}
+VariadicMacros.tests.cpp:<line number>: passed: with 1 message: 'anonymous test case'
+Approx.tests.cpp:<line number>: passed: Approx(0).margin(0)
+Approx.tests.cpp:<line number>: passed: Approx(0).margin(1234656)
+Approx.tests.cpp:<line number>: passed: Approx(0).margin(-2), std::domain_error
+Approx.tests.cpp:<line number>: passed: Approx(0).epsilon(0)
+Approx.tests.cpp:<line number>: passed: Approx(0).epsilon(1)
+Approx.tests.cpp:<line number>: passed: Approx(0).epsilon(-0.001), std::domain_error
+Approx.tests.cpp:<line number>: passed: Approx(0).epsilon(1.0001), std::domain_error
+Approx.tests.cpp:<line number>: passed: 0.25f == Approx(0.0f).margin(0.25f) for: 0.25f == Approx( 0.0 )
+Approx.tests.cpp:<line number>: passed: 0.0f == Approx(0.25f).margin(0.25f) for: 0.0f == Approx( 0.25 )
+Approx.tests.cpp:<line number>: passed: 0.5f == Approx(0.25f).margin(0.25f) for: 0.5f == Approx( 0.25 )
+Approx.tests.cpp:<line number>: passed: 245.0f == Approx(245.25f).margin(0.25f) for: 245.0f == Approx( 245.25 )
+Approx.tests.cpp:<line number>: passed: 245.5f == Approx(245.25f).margin(0.25f) for: 245.5f == Approx( 245.25 )
+Approx.tests.cpp:<line number>: passed: divide( 22, 7 ) == Approx( 3.141 ).epsilon( 0.001 ) for: 3.1428571429 == Approx( 3.141 )
+Approx.tests.cpp:<line number>: passed: divide( 22, 7 ) != Approx( 3.141 ).epsilon( 0.0001 ) for: 3.1428571429 != Approx( 3.141 )
+Approx.tests.cpp:<line number>: passed: d != Approx( 1.231 ) for: 1.23 != Approx( 1.231 )
+Approx.tests.cpp:<line number>: passed: d == Approx( 1.231 ).epsilon( 0.1 ) for: 1.23 == Approx( 1.231 )
+Approx.tests.cpp:<line number>: passed: 1.23f == Approx( 1.23f ) for: 1.23f == Approx( 1.2300000191 )
+Approx.tests.cpp:<line number>: passed: 0.0f == Approx( 0.0f ) for: 0.0f == Approx( 0.0 )
+Approx.tests.cpp:<line number>: passed: 1 == Approx( 1 ) for: 1 == Approx( 1.0 )
+Approx.tests.cpp:<line number>: passed: 0 == Approx( 0 ) for: 0 == Approx( 0.0 )
+Approx.tests.cpp:<line number>: passed: 1.0f == Approx( 1 ) for: 1.0f == Approx( 1.0 )
+Approx.tests.cpp:<line number>: passed: 0 == Approx( dZero) for: 0 == Approx( 0.0 )
+Approx.tests.cpp:<line number>: passed: 0 == Approx( dSmall ).margin( 0.001 ) for: 0 == Approx( 0.00001 )
+Approx.tests.cpp:<line number>: passed: 1.234f == Approx( dMedium ) for: 1.234f == Approx( 1.234 )
+Approx.tests.cpp:<line number>: passed: dMedium == Approx( 1.234f ) for: 1.234 == Approx( 1.2339999676 )
+Tricky.tests.cpp:<line number>: passed: true
+Tricky.tests.cpp:<line number>: passed: true
+Tricky.tests.cpp:<line number>: passed: true
+Tricky.tests.cpp:<line number>: passed: true
+Tricky.tests.cpp:<line number>: passed: true
+Tricky.tests.cpp:<line number>: passed: true
+Approx.tests.cpp:<line number>: passed: INFINITY == Approx(INFINITY) for: inff == Approx( inf )
+Approx.tests.cpp:<line number>: passed: NAN != Approx(NAN) for: nanf != Approx( nan )
+Approx.tests.cpp:<line number>: passed: !(NAN == Approx(NAN)) for: !(nanf == Approx( nan ))
+Tricky.tests.cpp:<line number>: passed: y.v == 0 for: 0 == 0
+Tricky.tests.cpp:<line number>: passed: 0 == y.v for: 0 == 0
+ToStringGeneral.tests.cpp:<line number>: passed: true with 1 message: 'i := 2'
+ToStringGeneral.tests.cpp:<line number>: passed: true with 1 message: '3'
+ToStringGeneral.tests.cpp:<line number>: passed: tab == '/t' for: '/t' == '/t'
+ToStringGeneral.tests.cpp:<line number>: passed: newline == '/n' for: '/n' == '/n'
+ToStringGeneral.tests.cpp:<line number>: passed: carr_return == '/r' for: '/r' == '/r'
+ToStringGeneral.tests.cpp:<line number>: passed: form_feed == '/f' for: '/f' == '/f'
+ToStringGeneral.tests.cpp:<line number>: passed: space == ' ' for: ' ' == ' '
+ToStringGeneral.tests.cpp:<line number>: passed: c == chars[i] for: 'a' == 'a'
+ToStringGeneral.tests.cpp:<line number>: passed: c == chars[i] for: 'z' == 'z'
+ToStringGeneral.tests.cpp:<line number>: passed: c == chars[i] for: 'A' == 'A'
+ToStringGeneral.tests.cpp:<line number>: passed: c == chars[i] for: 'Z' == 'Z'
+ToStringGeneral.tests.cpp:<line number>: passed: null_terminator == '/0' for: 0 == 0
+ToStringGeneral.tests.cpp:<line number>: passed: c == i for: 2 == 2
+ToStringGeneral.tests.cpp:<line number>: passed: c == i for: 3 == 3
+ToStringGeneral.tests.cpp:<line number>: passed: c == i for: 4 == 4
+ToStringGeneral.tests.cpp:<line number>: passed: c == i for: 5 == 5
+Tricky.tests.cpp:<line number>: passed: std::vector<constructor_throws>{constructor_throws{}, constructor_throws{}}
+Tricky.tests.cpp:<line number>: passed: std::vector<constructor_throws>{constructor_throws{}, constructor_throws{}}
+Tricky.tests.cpp:<line number>: passed: std::vector<int>{1, 2, 3} == std::vector<int>{1, 2, 3}
+Tricky.tests.cpp:<line number>: passed: std::vector<int>{1, 2, 3} == std::vector<int>{1, 2, 3}
+Tricky.tests.cpp:<line number>: passed: std::vector<int>{1, 2} == std::vector<int>{1, 2} for: { 1, 2 } == { 1, 2 }
+Tricky.tests.cpp:<line number>: passed: std::vector<int>{1, 2} == std::vector<int>{1, 2} for: { 1, 2 } == { 1, 2 }
+Tricky.tests.cpp:<line number>: passed: !(std::vector<int>{1, 2} == std::vector<int>{1, 2, 3}) for: !({ 1, 2 } == { 1, 2, 3 })
+Tricky.tests.cpp:<line number>: passed: !(std::vector<int>{1, 2} == std::vector<int>{1, 2, 3}) for: !({ 1, 2 } == { 1, 2, 3 })
+Tricky.tests.cpp:<line number>: passed: std::vector<int>{1, 2} == std::vector<int>{1, 2} for: { 1, 2 } == { 1, 2 }
+Tricky.tests.cpp:<line number>: passed: std::vector<int>{1, 2} == std::vector<int>{1, 2} for: { 1, 2 } == { 1, 2 }
+Tricky.tests.cpp:<line number>: passed: true
+Tricky.tests.cpp:<line number>: passed: std::vector<int>{1, 2} == std::vector<int>{1, 2} for: { 1, 2 } == { 1, 2 }
+Tricky.tests.cpp:<line number>: passed: a for: 0x<hex digits>
+Tricky.tests.cpp:<line number>: passed: a == &foo for: 0x<hex digits> == 0x<hex digits>
+Approx.tests.cpp:<line number>: passed: td == Approx(10.0) for: StrongDoubleTypedef(10) == Approx( 10.0 )
+Approx.tests.cpp:<line number>: passed: Approx(10.0) == td for: Approx( 10.0 ) == StrongDoubleTypedef(10)
+Approx.tests.cpp:<line number>: passed: td != Approx(11.0) for: StrongDoubleTypedef(10) != Approx( 11.0 )
+Approx.tests.cpp:<line number>: passed: Approx(11.0) != td for: Approx( 11.0 ) != StrongDoubleTypedef(10)
+Approx.tests.cpp:<line number>: passed: td <= Approx(10.0) for: StrongDoubleTypedef(10) <= Approx( 10.0 )
+Approx.tests.cpp:<line number>: passed: td <= Approx(11.0) for: StrongDoubleTypedef(10) <= Approx( 11.0 )
+Approx.tests.cpp:<line number>: passed: Approx(10.0) <= td for: Approx( 10.0 ) <= StrongDoubleTypedef(10)
+Approx.tests.cpp:<line number>: passed: Approx(9.0) <= td for: Approx( 9.0 ) <= StrongDoubleTypedef(10)
+Approx.tests.cpp:<line number>: passed: td >= Approx(9.0) for: StrongDoubleTypedef(10) >= Approx( 9.0 )
+Approx.tests.cpp:<line number>: passed: td >= Approx(td) for: StrongDoubleTypedef(10) >= Approx( 10.0 )
+Approx.tests.cpp:<line number>: passed: Approx(td) >= td for: Approx( 10.0 ) >= StrongDoubleTypedef(10)
+Approx.tests.cpp:<line number>: passed: Approx(11.0) >= td for: Approx( 11.0 ) >= StrongDoubleTypedef(10)
+Condition.tests.cpp:<line number>: passed: 54 == 6*9 for: 54 == 54
+Condition.tests.cpp:<line number>: passed: ( -1 > 2u ) for: true
+Condition.tests.cpp:<line number>: passed: -1 > 2u for: -1 > 2
+Condition.tests.cpp:<line number>: passed: ( 2u < -1 ) for: true
+Condition.tests.cpp:<line number>: passed: 2u < -1 for: 2 < -1
+Condition.tests.cpp:<line number>: passed: ( minInt > 2u ) for: true
+Condition.tests.cpp:<line number>: passed: minInt > 2u for: -2147483648 > 2
+Condition.tests.cpp:<line number>: passed: i == 1 for: 1 == 1
+Condition.tests.cpp:<line number>: passed: ui == 2 for: 2 == 2
+Condition.tests.cpp:<line number>: passed: l == 3 for: 3 == 3
+Condition.tests.cpp:<line number>: passed: ul == 4 for: 4 == 4
+Condition.tests.cpp:<line number>: passed: c == 5 for: 5 == 5
+Condition.tests.cpp:<line number>: passed: uc == 6 for: 6 == 6
+Condition.tests.cpp:<line number>: passed: 1 == i for: 1 == 1
+Condition.tests.cpp:<line number>: passed: 2 == ui for: 2 == 2
+Condition.tests.cpp:<line number>: passed: 3 == l for: 3 == 3
+Condition.tests.cpp:<line number>: passed: 4 == ul for: 4 == 4
+Condition.tests.cpp:<line number>: passed: 5 == c for: 5 == 5
+Condition.tests.cpp:<line number>: passed: 6 == uc for: 6 == 6
+Condition.tests.cpp:<line number>: passed: (std::numeric_limits<uint32_t>::max)() > ul for: 4294967295 (0x<hex digits>) > 4
+Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Contains("not there", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" contains: "not there" (case insensitive)
+Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Contains("STRING") for: "this string contains 'abc' as a substring" contains: "STRING"
+Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'custom exception - not std'; expression was: throwCustom()
+Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'custom exception - not std'; expression was: throwCustom(), std::exception
+Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'custom std exception'
+Approx.tests.cpp:<line number>: passed: 101.000001 != Approx(100).epsilon(0.01) for: 101.000001 != Approx( 100.0 )
+Approx.tests.cpp:<line number>: passed: std::pow(10, -5) != Approx(std::pow(10, -7)) for: 0.00001 != Approx( 0.0000001 )
+Matchers.tests.cpp:<line number>: failed: testStringForMatching(), EndsWith("Substring") for: "this string contains 'abc' as a substring" ends with: "Substring"
+Matchers.tests.cpp:<line number>: failed: testStringForMatching(), EndsWith("this", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" ends with: "this" (case insensitive)
+Approx.tests.cpp:<line number>: passed: 101.01 != Approx(100).epsilon(0.01) for: 101.01 != Approx( 100.0 )
+Condition.tests.cpp:<line number>: failed: data.int_seven == 6 for: 7 == 6
+Condition.tests.cpp:<line number>: failed: data.int_seven == 8 for: 7 == 8
+Condition.tests.cpp:<line number>: failed: data.int_seven == 0 for: 7 == 0
+Condition.tests.cpp:<line number>: failed: data.float_nine_point_one == Approx( 9.11f ) for: 9.1f == Approx( 9.1099996567 )
+Condition.tests.cpp:<line number>: failed: data.float_nine_point_one == Approx( 9.0f ) for: 9.1f == Approx( 9.0 )
+Condition.tests.cpp:<line number>: failed: data.float_nine_point_one == Approx( 1 ) for: 9.1f == Approx( 1.0 )
+Condition.tests.cpp:<line number>: failed: data.float_nine_point_one == Approx( 0 ) for: 9.1f == Approx( 0.0 )
+Condition.tests.cpp:<line number>: failed: data.double_pi == Approx( 3.1415 ) for: 3.1415926535 == Approx( 3.1415 )
+Condition.tests.cpp:<line number>: failed: data.str_hello == "goodbye" for: "hello" == "goodbye"
+Condition.tests.cpp:<line number>: failed: data.str_hello == "hell" for: "hello" == "hell"
+Condition.tests.cpp:<line number>: failed: data.str_hello == "hello1" for: "hello" == "hello1"
+Condition.tests.cpp:<line number>: failed: data.str_hello.size() == 6 for: 5 == 6
+Condition.tests.cpp:<line number>: failed: x == Approx( 1.301 ) for: 1.3 == Approx( 1.301 )
+Condition.tests.cpp:<line number>: passed: data.int_seven == 7 for: 7 == 7
+Condition.tests.cpp:<line number>: passed: data.float_nine_point_one == Approx( 9.1f ) for: 9.1f == Approx( 9.1000003815 )
+Condition.tests.cpp:<line number>: passed: data.double_pi == Approx( 3.1415926535 ) for: 3.1415926535 == Approx( 3.1415926535 )
+Condition.tests.cpp:<line number>: passed: data.str_hello == "hello" for: "hello" == "hello"
+Condition.tests.cpp:<line number>: passed: "hello" == data.str_hello for: "hello" == "hello"
+Condition.tests.cpp:<line number>: passed: data.str_hello.size() == 5 for: 5 == 5
+Condition.tests.cpp:<line number>: passed: x == Approx( 1.3 ) for: 1.3 == Approx( 1.3 )
+Matchers.tests.cpp:<line number>: passed: testStringForMatching(), Equals("this string contains 'abc' as a substring") for: "this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring"
+Matchers.tests.cpp:<line number>: passed: testStringForMatching(), Equals("this string contains 'ABC' as a substring", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring" (case insensitive)
+Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Equals("this string contains 'ABC' as a substring") for: "this string contains 'abc' as a substring" equals: "this string contains 'ABC' as a substring"
+Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Equals("something else", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" equals: "something else" (case insensitive)
+Matchers.tests.cpp:<line number>: failed: expected exception, got none; expression was: doesNotThrow(), SpecialException, ExceptionMatcher{1}
+Matchers.tests.cpp:<line number>: failed: expected exception, got none; expression was: doesNotThrow(), SpecialException, ExceptionMatcher{1}
+Matchers.tests.cpp:<line number>: failed: unexpected exception with message: 'Unknown exception'; expression was: throwsAsInt(1), SpecialException, ExceptionMatcher{1}
+Matchers.tests.cpp:<line number>: failed: unexpected exception with message: 'Unknown exception'; expression was: throwsAsInt(1), SpecialException, ExceptionMatcher{1}
+Matchers.tests.cpp:<line number>: failed: throws(3), SpecialException, ExceptionMatcher{1} for: {?} special exception has value of 1
+Matchers.tests.cpp:<line number>: failed: throws(4), SpecialException, ExceptionMatcher{1} for: {?} special exception has value of 1
+Matchers.tests.cpp:<line number>: passed: throws(1), SpecialException, ExceptionMatcher{1} for: {?} special exception has value of 1
+Matchers.tests.cpp:<line number>: passed: throws(2), SpecialException, ExceptionMatcher{2} for: {?} special exception has value of 2
+Exception.tests.cpp:<line number>: passed: thisThrows(), "expected exception" for: "expected exception" equals: "expected exception"
+Exception.tests.cpp:<line number>: passed: thisThrows(), Equals( "expecteD Exception", Catch::CaseSensitive::No ) for: "expected exception" equals: "expected exception" (case insensitive)
+Exception.tests.cpp:<line number>: passed: thisThrows(), StartsWith( "expected" ) for: "expected exception" starts with: "expected"
+Exception.tests.cpp:<line number>: passed: thisThrows(), EndsWith( "exception" ) for: "expected exception" ends with: "exception"
+Exception.tests.cpp:<line number>: passed: thisThrows(), Contains( "except" ) for: "expected exception" contains: "except"
+Exception.tests.cpp:<line number>: passed: thisThrows(), Contains( "exCept", Catch::CaseSensitive::No ) for: "expected exception" contains: "except" (case insensitive)
+Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'expected exception'; expression was: thisThrows(), std::string
+Exception.tests.cpp:<line number>: failed: expected exception, got none; expression was: thisDoesntThrow(), std::domain_error
+Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'expected exception'; expression was: thisThrows()
+Message.tests.cpp:<line number>: failed: explicitly with 1 message: 'This is a failure'
+Message.tests.cpp:<line number>: failed: explicitly
+Message.tests.cpp:<line number>: failed: explicitly with 1 message: 'This is a failure'
+Message.tests.cpp:<line number>: warning: 'This message appears in the output'
+Misc.tests.cpp:<line number>: passed: Factorial(0) == 1 for: 1 == 1
+Misc.tests.cpp:<line number>: passed: Factorial(1) == 1 for: 1 == 1
+Misc.tests.cpp:<line number>: passed: Factorial(2) == 2 for: 2 == 2
+Misc.tests.cpp:<line number>: passed: Factorial(3) == 6 for: 6 == 6
+Misc.tests.cpp:<line number>: passed: Factorial(10) == 3628800 for: 3628800 (0x<hex digits>) == 3628800 (0x<hex digits>)
+Matchers.tests.cpp:<line number>: passed: 1., WithinAbs(1., 0) for: 1.0 is within 0.0 of 1.0
+Matchers.tests.cpp:<line number>: passed: 0., WithinAbs(1., 1) for: 0.0 is within 1.0 of 1.0
+Matchers.tests.cpp:<line number>: passed: 0., !WithinAbs(1., 0.99) for: 0.0 not is within 0.99 of 1.0
+Matchers.tests.cpp:<line number>: passed: 0., !WithinAbs(1., 0.99) for: 0.0 not is within 0.99 of 1.0
+Matchers.tests.cpp:<line number>: passed: NAN, !WithinAbs(NAN, 0) for: nanf not is within 0.0 of nan
+Matchers.tests.cpp:<line number>: passed: 1., WithinULP(1., 0) for: 1.0 is within 0 ULPs of 1.0
+Matchers.tests.cpp:<line number>: passed: std::nextafter(1., 2.), WithinULP(1., 1) for: 1.0 is within 1 ULPs of 1.0
+Matchers.tests.cpp:<line number>: passed: std::nextafter(1., 0.), WithinULP(1., 1) for: 1.0 is within 1 ULPs of 1.0
+Matchers.tests.cpp:<line number>: passed: std::nextafter(1., 2.), !WithinULP(1., 0) for: 1.0 not is within 0 ULPs of 1.0
+Matchers.tests.cpp:<line number>: passed: 1., WithinULP(1., 0) for: 1.0 is within 0 ULPs of 1.0
+Matchers.tests.cpp:<line number>: passed: -0., WithinULP(0., 0) for: -0.0 is within 0 ULPs of 0.0
+Matchers.tests.cpp:<line number>: passed: NAN, !WithinULP(NAN, 123) for: nanf not is within 123 ULPs of nanf
+Matchers.tests.cpp:<line number>: passed: 1., WithinAbs(1., 0.5) || WithinULP(2., 1) for: 1.0 ( is within 0.5 of 1.0 or is within 1 ULPs of 2.0 )
+Matchers.tests.cpp:<line number>: passed: 1., WithinAbs(2., 0.5) || WithinULP(1., 0) for: 1.0 ( is within 0.5 of 2.0 or is within 0 ULPs of 1.0 )
+Matchers.tests.cpp:<line number>: passed: NAN, !(WithinAbs(NAN, 100) || WithinULP(NAN, 123)) for: nanf not ( is within 100.0 of nan or is within 123 ULPs of nanf )
+Matchers.tests.cpp:<line number>: passed: WithinAbs(1., 0.)
+Matchers.tests.cpp:<line number>: passed: WithinAbs(1., -1.), std::domain_error
+Matchers.tests.cpp:<line number>: passed: WithinULP(1., 0)
+Matchers.tests.cpp:<line number>: passed: WithinULP(1., -1), std::domain_error
+Matchers.tests.cpp:<line number>: passed: 1.f, WithinAbs(1.f, 0) for: 1.0f is within 0.0 of 1.0
+Matchers.tests.cpp:<line number>: passed: 0.f, WithinAbs(1.f, 1) for: 0.0f is within 1.0 of 1.0
+Matchers.tests.cpp:<line number>: passed: 0.f, !WithinAbs(1.f, 0.99f) for: 0.0f not is within 0.9900000095 of 1.0
+Matchers.tests.cpp:<line number>: passed: 0.f, !WithinAbs(1.f, 0.99f) for: 0.0f not is within 0.9900000095 of 1.0
+Matchers.tests.cpp:<line number>: passed: 0.f, WithinAbs(-0.f, 0) for: 0.0f is within 0.0 of -0.0
+Matchers.tests.cpp:<line number>: passed: NAN, !WithinAbs(NAN, 0) for: nanf not is within 0.0 of nan
+Matchers.tests.cpp:<line number>: passed: 1.f, WithinULP(1.f, 0) for: 1.0f is within 0 ULPs of 1.0f
+Matchers.tests.cpp:<line number>: passed: std::nextafter(1.f, 2.f), WithinULP(1.f, 1) for: 1.0f is within 1 ULPs of 1.0f
+Matchers.tests.cpp:<line number>: passed: std::nextafter(1.f, 0.f), WithinULP(1.f, 1) for: 1.0f is within 1 ULPs of 1.0f
+Matchers.tests.cpp:<line number>: passed: std::nextafter(1.f, 2.f), !WithinULP(1.f, 0) for: 1.0f not is within 0 ULPs of 1.0f
+Matchers.tests.cpp:<line number>: passed: 1.f, WithinULP(1.f, 0) for: 1.0f is within 0 ULPs of 1.0f
+Matchers.tests.cpp:<line number>: passed: -0.f, WithinULP(0.f, 0) for: -0.0f is within 0 ULPs of 0.0f
+Matchers.tests.cpp:<line number>: passed: NAN, !WithinULP(NAN, 123) for: nanf not is within 123 ULPs of nanf
+Matchers.tests.cpp:<line number>: passed: 1.f, WithinAbs(1.f, 0.5) || WithinULP(1.f, 1) for: 1.0f ( is within 0.5 of 1.0 or is within 1 ULPs of 1.0f )
+Matchers.tests.cpp:<line number>: passed: 1.f, WithinAbs(2.f, 0.5) || WithinULP(1.f, 0) for: 1.0f ( is within 0.5 of 2.0 or is within 0 ULPs of 1.0f )
+Matchers.tests.cpp:<line number>: passed: NAN, !(WithinAbs(NAN, 100) || WithinULP(NAN, 123)) for: nanf not ( is within 100.0 of nan or is within 123 ULPs of nanf )
+Matchers.tests.cpp:<line number>: passed: WithinAbs(1.f, 0.f)
+Matchers.tests.cpp:<line number>: passed: WithinAbs(1.f, -1.f), std::domain_error
+Matchers.tests.cpp:<line number>: passed: WithinULP(1.f, 0)
+Matchers.tests.cpp:<line number>: passed: WithinULP(1.f, -1), std::domain_error
+Approx.tests.cpp:<line number>: passed: d >= Approx( 1.22 ) for: 1.23 >= Approx( 1.22 )
+Approx.tests.cpp:<line number>: passed: d >= Approx( 1.23 ) for: 1.23 >= Approx( 1.23 )
+Approx.tests.cpp:<line number>: passed: !(d >= Approx( 1.24 )) for: !(1.23 >= Approx( 1.24 ))
+Approx.tests.cpp:<line number>: passed: d >= Approx( 1.24 ).epsilon(0.1) for: 1.23 >= Approx( 1.24 )
+Message.tests.cpp:<line number>: warning: 'this is a message' with 1 message: 'this is a warning'
+Message.tests.cpp:<line number>: failed: a == 1 for: 2 == 1 with 2 messages: 'this message should be logged' and 'so should this'
+Message.tests.cpp:<line number>: passed: a == 2 for: 2 == 2 with 1 message: 'this message may be logged later'
+Message.tests.cpp:<line number>: failed: a == 1 for: 2 == 1 with 2 messages: 'this message may be logged later' and 'this message should be logged'
+Message.tests.cpp:<line number>: failed: a == 0 for: 2 == 0 with 3 messages: 'this message may be logged later' and 'this message should be logged' and 'and this, but later'
+Message.tests.cpp:<line number>: passed: a == 2 for: 2 == 2 with 4 messages: 'this message may be logged later' and 'this message should be logged' and 'and this, but later' and 'but not this'
+Message.tests.cpp:<line number>: passed: i < 10 for: 0 < 10 with 2 messages: 'current counter 0' and 'i := 0'
+Message.tests.cpp:<line number>: passed: i < 10 for: 1 < 10 with 2 messages: 'current counter 1' and 'i := 1'
+Message.tests.cpp:<line number>: passed: i < 10 for: 2 < 10 with 2 messages: 'current counter 2' and 'i := 2'
+Message.tests.cpp:<line number>: passed: i < 10 for: 3 < 10 with 2 messages: 'current counter 3' and 'i := 3'
+Message.tests.cpp:<line number>: passed: i < 10 for: 4 < 10 with 2 messages: 'current counter 4' and 'i := 4'
+Message.tests.cpp:<line number>: passed: i < 10 for: 5 < 10 with 2 messages: 'current counter 5' and 'i := 5'
+Message.tests.cpp:<line number>: passed: i < 10 for: 6 < 10 with 2 messages: 'current counter 6' and 'i := 6'
+Message.tests.cpp:<line number>: passed: i < 10 for: 7 < 10 with 2 messages: 'current counter 7' and 'i := 7'
+Message.tests.cpp:<line number>: passed: i < 10 for: 8 < 10 with 2 messages: 'current counter 8' and 'i := 8'
+Message.tests.cpp:<line number>: passed: i < 10 for: 9 < 10 with 2 messages: 'current counter 9' and 'i := 9'
+Message.tests.cpp:<line number>: failed: i < 10 for: 10 < 10 with 2 messages: 'current counter 10' and 'i := 10'
+Condition.tests.cpp:<line number>: failed: data.int_seven != 7 for: 7 != 7
+Condition.tests.cpp:<line number>: failed: data.float_nine_point_one != Approx( 9.1f ) for: 9.1f != Approx( 9.1000003815 )
+Condition.tests.cpp:<line number>: failed: data.double_pi != Approx( 3.1415926535 ) for: 3.1415926535 != Approx( 3.1415926535 )
+Condition.tests.cpp:<line number>: failed: data.str_hello != "hello" for: "hello" != "hello"
+Condition.tests.cpp:<line number>: failed: data.str_hello.size() != 5 for: 5 != 5
+Condition.tests.cpp:<line number>: passed: data.int_seven != 6 for: 7 != 6
+Condition.tests.cpp:<line number>: passed: data.int_seven != 8 for: 7 != 8
+Condition.tests.cpp:<line number>: passed: data.float_nine_point_one != Approx( 9.11f ) for: 9.1f != Approx( 9.1099996567 )
+Condition.tests.cpp:<line number>: passed: data.float_nine_point_one != Approx( 9.0f ) for: 9.1f != Approx( 9.0 )
+Condition.tests.cpp:<line number>: passed: data.float_nine_point_one != Approx( 1 ) for: 9.1f != Approx( 1.0 )
+Condition.tests.cpp:<line number>: passed: data.float_nine_point_one != Approx( 0 ) for: 9.1f != Approx( 0.0 )
+Condition.tests.cpp:<line number>: passed: data.double_pi != Approx( 3.1415 ) for: 3.1415926535 != Approx( 3.1415 )
+Condition.tests.cpp:<line number>: passed: data.str_hello != "goodbye" for: "hello" != "goodbye"
+Condition.tests.cpp:<line number>: passed: data.str_hello != "hell" for: "hello" != "hell"
+Condition.tests.cpp:<line number>: passed: data.str_hello != "hello1" for: "hello" != "hello1"
+Condition.tests.cpp:<line number>: passed: data.str_hello.size() != 6 for: 5 != 6
+Approx.tests.cpp:<line number>: passed: d <= Approx( 1.24 ) for: 1.23 <= Approx( 1.24 )
+Approx.tests.cpp:<line number>: passed: d <= Approx( 1.23 ) for: 1.23 <= Approx( 1.23 )
+Approx.tests.cpp:<line number>: passed: !(d <= Approx( 1.22 )) for: !(1.23 <= Approx( 1.22 ))
+Approx.tests.cpp:<line number>: passed: d <= Approx( 1.22 ).epsilon(0.1) for: 1.23 <= Approx( 1.22 )
+Misc.tests.cpp:<line number>: passed: with 1 message: 'was called'
+Matchers.tests.cpp:<line number>: passed: testStringForMatching(), Contains("string") && Contains("abc") && Contains("substring") && Contains("contains") for: "this string contains 'abc' as a substring" ( contains: "string" and contains: "abc" and contains: "substring" and contains: "contains" )
+Matchers.tests.cpp:<line number>: passed: testStringForMatching(), Contains("string") || Contains("different") || Contains("random") for: "this string contains 'abc' as a substring" ( contains: "string" or contains: "different" or contains: "random" )
+Matchers.tests.cpp:<line number>: passed: testStringForMatching2(), Contains("string") || Contains("different") || Contains("random") for: "some completely different text that contains one common word" ( contains: "string" or contains: "different" or contains: "random" )
+Matchers.tests.cpp:<line number>: passed: testStringForMatching(), (Contains("string") || Contains("different")) && Contains("substring") for: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "substring" )
+Matchers.tests.cpp:<line number>: failed: testStringForMatching(), (Contains("string") || Contains("different")) && Contains("random") for: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" )
+Matchers.tests.cpp:<line number>: passed: testStringForMatching(), !Contains("different") for: "this string contains 'abc' as a substring" not contains: "different"
+Matchers.tests.cpp:<line number>: failed: testStringForMatching(), !Contains("substring") for: "this string contains 'abc' as a substring" not contains: "substring"
+Exception.tests.cpp:<line number>: passed: thisThrows(), "expected exception" for: "expected exception" equals: "expected exception"
+Exception.tests.cpp:<line number>: failed: thisThrows(), "should fail" for: "expected exception" equals: "should fail"
+Misc.tests.cpp:<line number>: warning: 'This one ran'
+Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'custom exception'
+Tricky.tests.cpp:<line number>: passed: True for: {?}
+Tricky.tests.cpp:<line number>: passed: !False for: true
+Tricky.tests.cpp:<line number>: passed: !(False) for: !{?}
+Condition.tests.cpp:<line number>: failed: data.int_seven > 7 for: 7 > 7
+Condition.tests.cpp:<line number>: failed: data.int_seven < 7 for: 7 < 7
+Condition.tests.cpp:<line number>: failed: data.int_seven > 8 for: 7 > 8
+Condition.tests.cpp:<line number>: failed: data.int_seven < 6 for: 7 < 6
+Condition.tests.cpp:<line number>: failed: data.int_seven < 0 for: 7 < 0
+Condition.tests.cpp:<line number>: failed: data.int_seven < -1 for: 7 < -1
+Condition.tests.cpp:<line number>: failed: data.int_seven >= 8 for: 7 >= 8
+Condition.tests.cpp:<line number>: failed: data.int_seven <= 6 for: 7 <= 6
+Condition.tests.cpp:<line number>: failed: data.float_nine_point_one < 9 for: 9.1f < 9
+Condition.tests.cpp:<line number>: failed: data.float_nine_point_one > 10 for: 9.1f > 10
+Condition.tests.cpp:<line number>: failed: data.float_nine_point_one > 9.2 for: 9.1f > 9.2
+Condition.tests.cpp:<line number>: failed: data.str_hello > "hello" for: "hello" > "hello"
+Condition.tests.cpp:<line number>: failed: data.str_hello < "hello" for: "hello" < "hello"
+Condition.tests.cpp:<line number>: failed: data.str_hello > "hellp" for: "hello" > "hellp"
+Condition.tests.cpp:<line number>: failed: data.str_hello > "z" for: "hello" > "z"
+Condition.tests.cpp:<line number>: failed: data.str_hello < "hellm" for: "hello" < "hellm"
+Condition.tests.cpp:<line number>: failed: data.str_hello < "a" for: "hello" < "a"
+Condition.tests.cpp:<line number>: failed: data.str_hello >= "z" for: "hello" >= "z"
+Condition.tests.cpp:<line number>: failed: data.str_hello <= "a" for: "hello" <= "a"
+Condition.tests.cpp:<line number>: passed: data.int_seven < 8 for: 7 < 8
+Condition.tests.cpp:<line number>: passed: data.int_seven > 6 for: 7 > 6
+Condition.tests.cpp:<line number>: passed: data.int_seven > 0 for: 7 > 0
+Condition.tests.cpp:<line number>: passed: data.int_seven > -1 for: 7 > -1
+Condition.tests.cpp:<line number>: passed: data.int_seven >= 7 for: 7 >= 7
+Condition.tests.cpp:<line number>: passed: data.int_seven >= 6 for: 7 >= 6
+Condition.tests.cpp:<line number>: passed: data.int_seven <= 7 for: 7 <= 7
+Condition.tests.cpp:<line number>: passed: data.int_seven <= 8 for: 7 <= 8
+Condition.tests.cpp:<line number>: passed: data.float_nine_point_one > 9 for: 9.1f > 9
+Condition.tests.cpp:<line number>: passed: data.float_nine_point_one < 10 for: 9.1f < 10
+Condition.tests.cpp:<line number>: passed: data.float_nine_point_one < 9.2 for: 9.1f < 9.2
+Condition.tests.cpp:<line number>: passed: data.str_hello <= "hello" for: "hello" <= "hello"
+Condition.tests.cpp:<line number>: passed: data.str_hello >= "hello" for: "hello" >= "hello"
+Condition.tests.cpp:<line number>: passed: data.str_hello < "hellp" for: "hello" < "hellp"
+Condition.tests.cpp:<line number>: passed: data.str_hello < "zebra" for: "hello" < "zebra"
+Condition.tests.cpp:<line number>: passed: data.str_hello > "hellm" for: "hello" > "hellm"
+Condition.tests.cpp:<line number>: passed: data.str_hello > "a" for: "hello" > "a"
+Message.tests.cpp:<line number>: failed: explicitly with 1 message: 'Message from section one'
+Message.tests.cpp:<line number>: failed: explicitly with 1 message: 'Message from section two'
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches(tcA ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: parseTestSpec( "*a" ).matches( tcA ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: parseTestSpec( "a*" ).matches( tcA ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: parseTestSpec( "*a*" ).matches( tcA ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.hasFilters() == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == true for: true == true
+Tricky.tests.cpp:<line number>: passed: (std::pair<int, int>( 1, 2 )) == aNicePair for: {?} == {?}
+Condition.tests.cpp:<line number>: passed: p == 0 for: 0 == 0
+Condition.tests.cpp:<line number>: passed: p == pNULL for: 0 == 0
+Condition.tests.cpp:<line number>: passed: p != 0 for: 0x<hex digits> != 0
+Condition.tests.cpp:<line number>: passed: cp != 0 for: 0x<hex digits> != 0
+Condition.tests.cpp:<line number>: passed: cpc != 0 for: 0x<hex digits> != 0
+Condition.tests.cpp:<line number>: passed: returnsNull() == 0 for: {null string} == 0
+Condition.tests.cpp:<line number>: passed: returnsConstNull() == 0 for: {null string} == 0
+Condition.tests.cpp:<line number>: passed: 0 != p for: 0 != 0x<hex digits>
+CmdLine.tests.cpp:<line number>: passed: result for: {?}
+CmdLine.tests.cpp:<line number>: passed: config.processName == "" for: "" == ""
+CmdLine.tests.cpp:<line number>: passed: result for: {?}
+CmdLine.tests.cpp:<line number>: passed: config.processName == "test" for: "test" == "test"
+CmdLine.tests.cpp:<line number>: passed: config.shouldDebugBreak == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: config.abortAfter == -1 for: -1 == -1
+CmdLine.tests.cpp:<line number>: passed: config.noThrow == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: config.reporterNames.empty() for: true
+CmdLine.tests.cpp:<line number>: passed: result for: {?}
+CmdLine.tests.cpp:<line number>: passed: cfg.testSpec().matches(fakeTestCase("notIncluded")) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: cfg.testSpec().matches(fakeTestCase("test1")) for: true
+CmdLine.tests.cpp:<line number>: passed: result for: {?}
+CmdLine.tests.cpp:<line number>: passed: cfg.testSpec().matches(fakeTestCase("test1")) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: cfg.testSpec().matches(fakeTestCase("alwaysIncluded")) for: true
+CmdLine.tests.cpp:<line number>: passed: result for: {?}
+CmdLine.tests.cpp:<line number>: passed: cfg.testSpec().matches(fakeTestCase("test1")) == false for: false == false
+CmdLine.tests.cpp:<line number>: passed: cfg.testSpec().matches(fakeTestCase("alwaysIncluded")) for: true
+CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "-r", "console"}) for: {?}
+CmdLine.tests.cpp:<line number>: passed: config.reporterNames[0] == "console" for: "console" == "console"
+CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "-r", "xml"}) for: {?}
+CmdLine.tests.cpp:<line number>: passed: config.reporterNames[0] == "xml" for: "xml" == "xml"
+CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "-r", "xml", "-r", "junit"}) for: {?}
+CmdLine.tests.cpp:<line number>: passed: config.reporterNames.size() == 2 for: 2 == 2
+CmdLine.tests.cpp:<line number>: passed: config.reporterNames[0] == "xml" for: "xml" == "xml"
+CmdLine.tests.cpp:<line number>: passed: config.reporterNames[1] == "junit" for: "junit" == "junit"
+CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--reporter", "junit"}) for: {?}
+CmdLine.tests.cpp:<line number>: passed: config.reporterNames[0] == "junit" for: "junit" == "junit"
+CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "-b"}) for: {?}
+CmdLine.tests.cpp:<line number>: passed: config.shouldDebugBreak == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--break"}) for: {?}
+CmdLine.tests.cpp:<line number>: passed: config.shouldDebugBreak for: true
+CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "-a"}) for: {?}
+CmdLine.tests.cpp:<line number>: passed: config.abortAfter == 1 for: 1 == 1
+CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "-x", "2"}) for: {?}
+CmdLine.tests.cpp:<line number>: passed: config.abortAfter == 2 for: 2 == 2
+CmdLine.tests.cpp:<line number>: passed: !result for: true
+CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), Contains("convert") && Contains("oops") for: "Unable to convert 'oops' to destination type" ( contains: "convert" and contains: "oops" )
+CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "-e"}) for: {?}
+CmdLine.tests.cpp:<line number>: passed: config.noThrow for: true
+CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--nothrow"}) for: {?}
+CmdLine.tests.cpp:<line number>: passed: config.noThrow for: true
+CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "-o", "filename.ext"}) for: {?}
+CmdLine.tests.cpp:<line number>: passed: config.outputFilename == "filename.ext" for: "filename.ext" == "filename.ext"
+CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--out", "filename.ext"}) for: {?}
+CmdLine.tests.cpp:<line number>: passed: config.outputFilename == "filename.ext" for: "filename.ext" == "filename.ext"
+CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "-abe"}) for: {?}
+CmdLine.tests.cpp:<line number>: passed: config.abortAfter == 1 for: 1 == 1
+CmdLine.tests.cpp:<line number>: passed: config.shouldDebugBreak for: true
+CmdLine.tests.cpp:<line number>: passed: config.noThrow == true for: true == true
+CmdLine.tests.cpp:<line number>: passed: cli.parse({"test"}) for: {?}
+CmdLine.tests.cpp:<line number>: passed: config.useColour == UseColour::Auto for: 0 == 0
+CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--use-colour", "auto"}) for: {?}
+CmdLine.tests.cpp:<line number>: passed: config.useColour == UseColour::Auto for: 0 == 0
+CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--use-colour", "yes"}) for: {?}
+CmdLine.tests.cpp:<line number>: passed: config.useColour == UseColour::Yes for: 1 == 1
+CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--use-colour", "no"}) for: {?}
+CmdLine.tests.cpp:<line number>: passed: config.useColour == UseColour::No for: 2 == 2
+CmdLine.tests.cpp:<line number>: passed: !result for: true
+CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), Contains( "colour mode must be one of" ) for: "colour mode must be one of: auto, yes or no. 'wrong' not recognised" contains: "colour mode must be one of"
+Decomposition.tests.cpp:<line number>: failed: truthy(false) for: Hey, its truthy!
+Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Matches("this STRING contains 'abc' as a substring") for: "this string contains 'abc' as a substring" matches "this STRING contains 'abc' as a substring" case sensitively
+Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Matches("contains 'abc' as a substring") for: "this string contains 'abc' as a substring" matches "contains 'abc' as a substring" case sensitively
+Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Matches("this string contains 'abc' as a") for: "this string contains 'abc' as a substring" matches "this string contains 'abc' as a" case sensitively
+Message.tests.cpp:<line number>: passed: with 1 message: 'this is a success'
+Message.tests.cpp:<line number>: passed:
+BDD.tests.cpp:<line number>: passed: before == 0 for: 0 == 0
+BDD.tests.cpp:<line number>: passed: after > before for: 1 > 0
+BDD.tests.cpp:<line number>: passed: itDoesThis() for: true
+BDD.tests.cpp:<line number>: passed: itDoesThat() for: true
+BDD.tests.cpp:<line number>: passed: with 1 message: 'boo!'
+BDD.tests.cpp:<line number>: passed: v.size() == 0 for: 0 == 0
+BDD.tests.cpp:<line number>: passed: v.size() == 10 for: 10 == 10
+BDD.tests.cpp:<line number>: passed: v.capacity() >= 10 for: 10 >= 10
+BDD.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5
+BDD.tests.cpp:<line number>: passed: v.capacity() >= 10 for: 10 >= 10
+BDD.tests.cpp:<line number>: passed: v.size() == 0 for: 0 == 0
+BDD.tests.cpp:<line number>: passed: v.capacity() >= 10 for: 10 >= 10
+BDD.tests.cpp:<line number>: passed: v.size() == 0 for: 0 == 0
+A string sent directly to stdout
+A string sent directly to stderr
+A string sent to stderr via clog
+Approx.tests.cpp:<line number>: passed: d == Approx( 1.23 ) for: 1.23 == Approx( 1.23 )
+Approx.tests.cpp:<line number>: passed: d != Approx( 1.22 ) for: 1.23 != Approx( 1.22 )
+Approx.tests.cpp:<line number>: passed: d != Approx( 1.24 ) for: 1.23 != Approx( 1.24 )
+Approx.tests.cpp:<line number>: passed: Approx( d ) == 1.23 for: Approx( 1.23 ) == 1.23
+Approx.tests.cpp:<line number>: passed: Approx( d ) != 1.22 for: Approx( 1.23 ) != 1.22
+Approx.tests.cpp:<line number>: passed: Approx( d ) != 1.24 for: Approx( 1.23 ) != 1.24
+Approx.tests.cpp:<line number>: passed: INFINITY == Approx(INFINITY) for: inff == Approx( inf )
+Message from section one
+Message from section two
+Matchers.tests.cpp:<line number>: failed: testStringForMatching(), StartsWith("This String") for: "this string contains 'abc' as a substring" starts with: "This String"
+Matchers.tests.cpp:<line number>: failed: testStringForMatching(), StartsWith("string", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" starts with: "string" (case insensitive)
+ToStringGeneral.tests.cpp:<line number>: passed: Catch::Detail::stringify(singular) == "{ 1 }" for: "{ 1 }" == "{ 1 }"
+ToStringGeneral.tests.cpp:<line number>: passed: Catch::Detail::stringify(arr) == "{ 3, 2, 1 }" for: "{ 3, 2, 1 }" == "{ 3, 2, 1 }"
+ToStringGeneral.tests.cpp:<line number>: passed: Catch::Detail::stringify(arr) == R"({ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } })" for: "{ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } }"
+==
+"{ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } }"
+Matchers.tests.cpp:<line number>: passed: testStringForMatching(), Contains("string") for: "this string contains 'abc' as a substring" contains: "string"
+Matchers.tests.cpp:<line number>: passed: testStringForMatching(), Contains("string", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" contains: "string" (case insensitive)
+Matchers.tests.cpp:<line number>: passed: testStringForMatching(), Contains("abc") for: "this string contains 'abc' as a substring" contains: "abc"
+Matchers.tests.cpp:<line number>: passed: testStringForMatching(), Contains("aBC", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" contains: "abc" (case insensitive)
+Matchers.tests.cpp:<line number>: passed: testStringForMatching(), StartsWith("this") for: "this string contains 'abc' as a substring" starts with: "this"
+Matchers.tests.cpp:<line number>: passed: testStringForMatching(), StartsWith("THIS", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" starts with: "this" (case insensitive)
+Matchers.tests.cpp:<line number>: passed: testStringForMatching(), EndsWith("substring") for: "this string contains 'abc' as a substring" ends with: "substring"
+Matchers.tests.cpp:<line number>: passed: testStringForMatching(), EndsWith(" SuBsTrInG", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" ends with: " substring" (case insensitive)
+String.tests.cpp:<line number>: passed: empty.empty() for: true
+String.tests.cpp:<line number>: passed: empty.size() == 0 for: 0 == 0
+String.tests.cpp:<line number>: passed: std::strcmp( empty.c_str(), "" ) == 0 for: 0 == 0
+String.tests.cpp:<line number>: passed: s.empty() == false for: false == false
+String.tests.cpp:<line number>: passed: s.size() == 5 for: 5 == 5
+String.tests.cpp:<line number>: passed: isSubstring( s ) == false for: false == false
+String.tests.cpp:<line number>: passed: std::strcmp( rawChars, "hello" ) == 0 for: 0 == 0
+String.tests.cpp:<line number>: passed: isOwned( s ) == false for: false == false
+String.tests.cpp:<line number>: passed: s.c_str() == rawChars for: "hello" == "hello"
+String.tests.cpp:<line number>: passed: isOwned( s ) == false for: false == false
+String.tests.cpp:<line number>: passed: original == "original"
+String.tests.cpp:<line number>: failed: isSubstring( original ) for: false
+String.tests.cpp:<line number>: passed: ss.empty() == false for: false == false
+String.tests.cpp:<line number>: passed: ss.size() == 5 for: 5 == 5
+String.tests.cpp:<line number>: passed: std::strcmp( ss.c_str(), "hello" ) == 0 for: 0 == 0
+String.tests.cpp:<line number>: passed: ss == "hello" for: hello == "hello"
+String.tests.cpp:<line number>: passed: isSubstring( ss ) for: true
+String.tests.cpp:<line number>: passed: isOwned( ss ) == false for: false == false
+String.tests.cpp:<line number>: passed: rawChars == data( s ) for: "hello world!" == "hello world!"
+String.tests.cpp:<line number>: passed: ss.c_str() != rawChars for: "hello" != "hello world!"
+String.tests.cpp:<line number>: passed: isSubstring( ss ) == false for: false == false
+String.tests.cpp:<line number>: passed: isOwned( ss ) for: true
+String.tests.cpp:<line number>: passed: data( ss ) != data( s ) for: "hello" != "hello world!"
+String.tests.cpp:<line number>: passed: ss.size() == 6 for: 6 == 6
+String.tests.cpp:<line number>: passed: std::strcmp( ss.c_str(), "world!" ) == 0 for: 0 == 0
+String.tests.cpp:<line number>: passed: s.c_str() == s2.c_str() for: "hello world!" == "hello world!"
+String.tests.cpp:<line number>: passed: s.c_str() != ss.c_str() for: "hello world!" != "hello"
+String.tests.cpp:<line number>: passed: StringRef("hello") == StringRef("hello") for: hello == hello
+String.tests.cpp:<line number>: passed: StringRef("hello") != StringRef("cello") for: hello != cello
+String.tests.cpp:<line number>: passed: sr == "a standard string" for: a standard string == "a standard string"
+String.tests.cpp:<line number>: passed: sr.size() == stdStr.size() for: 17 == 17
+String.tests.cpp:<line number>: passed: sr == "a standard string" for: a standard string == "a standard string"
+String.tests.cpp:<line number>: passed: sr.size() == stdStr.size() for: 17 == 17
+String.tests.cpp:<line number>: passed: sr == "a standard string" for: a standard string == "a standard string"
+String.tests.cpp:<line number>: passed: sr.size() == stdStr.size() for: 17 == 17
+String.tests.cpp:<line number>: passed: stdStr == "a stringref" for: "a stringref" == "a stringref"
+String.tests.cpp:<line number>: passed: stdStr.size() == sr.size() for: 11 == 11
+String.tests.cpp:<line number>: passed: stdStr == "a stringref" for: "a stringref" == "a stringref"
+String.tests.cpp:<line number>: passed: stdStr.size() == sr.size() for: 11 == 11
+String.tests.cpp:<line number>: passed: stdStr == "a stringref" for: "a stringref" == "a stringref"
+String.tests.cpp:<line number>: passed: stdStr.size() == sr.size() for: 11 == 11
+ToStringChrono.tests.cpp:<line number>: passed: minute == seconds for: 1 m == 60 s
+ToStringChrono.tests.cpp:<line number>: passed: hour != seconds for: 1 h != 60 s
+ToStringChrono.tests.cpp:<line number>: passed: micro != milli for: 1 us != 1 ms
+ToStringChrono.tests.cpp:<line number>: passed: nano != micro for: 1 ns != 1 us
+ToStringChrono.tests.cpp:<line number>: passed: half_minute != femto_second for: 1 [30/1]s != 1 fs
+ToStringChrono.tests.cpp:<line number>: passed: pico_second != atto_second for: 1 ps != 1 as
+ToStringChrono.tests.cpp:<line number>: passed: now != later for: {iso8601-timestamp}
+!=
+{iso8601-timestamp}
+Misc.tests.cpp:<line number>: failed: s1 == s2 for: "if ($b == 10) {
+ $a = 20;
+}"
+==
+"if ($b == 10) {
+ $a = 20;
+}
+"
+TagAlias.tests.cpp:<line number>: passed: what, Contains( "[@zzz]" ) for: "error: tag alias, '[@zzz]' already registered.
+ First seen at: file:2
+ Redefined at: file:10" contains: "[@zzz]"
+TagAlias.tests.cpp:<line number>: passed: what, Contains( "file" ) for: "error: tag alias, '[@zzz]' already registered.
+ First seen at: file:2
+ Redefined at: file:10" contains: "file"
+TagAlias.tests.cpp:<line number>: passed: what, Contains( "2" ) for: "error: tag alias, '[@zzz]' already registered.
+ First seen at: file:2
+ Redefined at: file:10" contains: "2"
+TagAlias.tests.cpp:<line number>: passed: what, Contains( "10" ) for: "error: tag alias, '[@zzz]' already registered.
+ First seen at: file:2
+ Redefined at: file:10" contains: "10"
+TagAlias.tests.cpp:<line number>: passed: registry.add( "[no ampersat]", "", Catch::SourceLineInfo( "file", 3 ) )
+TagAlias.tests.cpp:<line number>: passed: registry.add( "[the @ is not at the start]", "", Catch::SourceLineInfo( "file", 3 ) )
+TagAlias.tests.cpp:<line number>: passed: registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) )
+TagAlias.tests.cpp:<line number>: passed: registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) )
+VariadicMacros.tests.cpp:<line number>: passed: with 1 message: 'no assertions'
+Tricky.tests.cpp:<line number>: passed: 0x<hex digits> == bit30and31 for: 3221225472 (0x<hex digits>) == 3221225472
+Message.tests.cpp:<line number>: failed - but was ok: 1 == 2
+Misc.tests.cpp:<line number>: passed: with 1 message: 'oops!'
+PartTracker.tests.cpp:<line number>: passed: testCase.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: s1.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: s1.isSuccessfullyCompleted() for: true
+PartTracker.tests.cpp:<line number>: passed: testCase.isComplete() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: ctx.completedCycle() for: true
+PartTracker.tests.cpp:<line number>: passed: testCase.isSuccessfullyCompleted() for: true
+PartTracker.tests.cpp:<line number>: passed: testCase.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: s1.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: s1.isComplete() for: true
+PartTracker.tests.cpp:<line number>: passed: s1.isSuccessfullyCompleted() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: testCase.isComplete() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: ctx.completedCycle() for: true
+PartTracker.tests.cpp:<line number>: passed: testCase.isSuccessfullyCompleted() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: testCase2.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: s1b.isOpen() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: ctx.completedCycle() for: true
+PartTracker.tests.cpp:<line number>: passed: testCase.isComplete() for: true
+PartTracker.tests.cpp:<line number>: passed: testCase.isSuccessfullyCompleted() for: true
+PartTracker.tests.cpp:<line number>: passed: testCase.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: s1.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: s1.isComplete() for: true
+PartTracker.tests.cpp:<line number>: passed: s1.isSuccessfullyCompleted() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: testCase.isComplete() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: ctx.completedCycle() for: true
+PartTracker.tests.cpp:<line number>: passed: testCase.isSuccessfullyCompleted() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: testCase2.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: s1b.isOpen() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: s2.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: ctx.completedCycle() for: true
+PartTracker.tests.cpp:<line number>: passed: testCase.isComplete() for: true
+PartTracker.tests.cpp:<line number>: passed: testCase.isSuccessfullyCompleted() for: true
+PartTracker.tests.cpp:<line number>: passed: testCase.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: s1.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: s2.isOpen() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: testCase.isComplete() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: testCase2.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: s1b.isOpen() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: s2b.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: ctx.completedCycle() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: ctx.completedCycle() for: true
+PartTracker.tests.cpp:<line number>: passed: s2b.isSuccessfullyCompleted() for: true
+PartTracker.tests.cpp:<line number>: passed: testCase2.isComplete() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: testCase2.isSuccessfullyCompleted() for: true
+PartTracker.tests.cpp:<line number>: passed: testCase.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: s1.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: s2.isOpen() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: testCase.isComplete() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: testCase2.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: s1b.isOpen() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: s2b.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: ctx.completedCycle() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: ctx.completedCycle() for: true
+PartTracker.tests.cpp:<line number>: passed: s2b.isComplete() for: true
+PartTracker.tests.cpp:<line number>: passed: s2b.isSuccessfullyCompleted() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: testCase2.isSuccessfullyCompleted() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: testCase3.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: s1c.isOpen() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: s2c.isOpen() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: testCase3.isSuccessfullyCompleted() for: true
+PartTracker.tests.cpp:<line number>: passed: testCase.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: s1.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: s2.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: s2.isComplete() for: true
+PartTracker.tests.cpp:<line number>: passed: s1.isComplete() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: s1.isComplete() for: true
+PartTracker.tests.cpp:<line number>: passed: testCase.isComplete() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: testCase.isComplete() for: true
+PartTracker.tests.cpp:<line number>: passed: testCase.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: s1.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: g1.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: g1.index() == 0 for: 0 == 0
+PartTracker.tests.cpp:<line number>: passed: g1.isComplete() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: s1.isComplete() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: s1.isComplete() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: testCase.isSuccessfullyCompleted() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: testCase2.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: s1b.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: g1b.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: g1b.index() == 1 for: 1 == 1
+PartTracker.tests.cpp:<line number>: passed: s1.isComplete() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: s1b.isComplete() for: true
+PartTracker.tests.cpp:<line number>: passed: g1b.isComplete() for: true
+PartTracker.tests.cpp:<line number>: passed: testCase2.isComplete() for: true
+PartTracker.tests.cpp:<line number>: passed: testCase.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: s1.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: g1.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: g1.index() == 0 for: 0 == 0
+PartTracker.tests.cpp:<line number>: passed: g1.isComplete() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: s1.isComplete() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: s2.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: s2.isComplete() for: true
+PartTracker.tests.cpp:<line number>: passed: s1.isComplete() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: testCase.isComplete() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: testCase2.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: s1b.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: g1b.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: g1b.index() == 1 for: 1 == 1
+PartTracker.tests.cpp:<line number>: passed: s2b.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: s2b.isComplete() for: true
+PartTracker.tests.cpp:<line number>: passed: g1b.isComplete() for: true
+PartTracker.tests.cpp:<line number>: passed: s1b.isComplete() for: true
+PartTracker.tests.cpp:<line number>: passed: testCase2.isComplete() for: true
+PartTracker.tests.cpp:<line number>: passed: testCase.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: s1.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: g1.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: g1.index() == 0 for: 0 == 0
+PartTracker.tests.cpp:<line number>: passed: g1.isComplete() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: s1.isComplete() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: s2.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: s2.isComplete() for: true
+PartTracker.tests.cpp:<line number>: passed: s2.isSuccessfullyCompleted() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: s1.isComplete() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: testCase.isComplete() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: testCase2.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: s1b.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: g1b.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: g1b.index() == 0 for: 0 == 0
+PartTracker.tests.cpp:<line number>: passed: s2b.isOpen() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: g1b.isComplete() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: s1b.isComplete() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: testCase2.isComplete() == false for: false == false
+PartTracker.tests.cpp:<line number>: passed: testCase3.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: s1c.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: g1c.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: g1c.index() == 1 for: 1 == 1
+PartTracker.tests.cpp:<line number>: passed: s2c.isOpen() for: true
+PartTracker.tests.cpp:<line number>: passed: s2c.isComplete() for: true
+PartTracker.tests.cpp:<line number>: passed: g1c.isComplete() for: true
+PartTracker.tests.cpp:<line number>: passed: s1c.isComplete() for: true
+PartTracker.tests.cpp:<line number>: passed: testCase3.isComplete() for: true
+Exception.tests.cpp:<line number>: failed: unexpected exception with message: '3.14'
+Approx.tests.cpp:<line number>: passed: d == approx( 1.23 ) for: 1.23 == Approx( 1.23 )
+Approx.tests.cpp:<line number>: passed: d == approx( 1.22 ) for: 1.23 == Approx( 1.22 )
+Approx.tests.cpp:<line number>: passed: d == approx( 1.24 ) for: 1.23 == Approx( 1.24 )
+Approx.tests.cpp:<line number>: passed: d != approx( 1.25 ) for: 1.23 != Approx( 1.25 )
+Approx.tests.cpp:<line number>: passed: approx( d ) == 1.23 for: Approx( 1.23 ) == 1.23
+Approx.tests.cpp:<line number>: passed: approx( d ) == 1.22 for: Approx( 1.23 ) == 1.22
+Approx.tests.cpp:<line number>: passed: approx( d ) == 1.24 for: Approx( 1.23 ) == 1.24
+Approx.tests.cpp:<line number>: passed: approx( d ) != 1.25 for: Approx( 1.23 ) != 1.25
+VariadicMacros.tests.cpp:<line number>: passed: with 1 message: 'no assertions'
+Matchers.tests.cpp:<line number>: passed: v, VectorContains(1) for: { 1, 2, 3 } Contains: 1
+Matchers.tests.cpp:<line number>: passed: v, VectorContains(2) for: { 1, 2, 3 } Contains: 2
+Matchers.tests.cpp:<line number>: passed: v, Contains(v2) for: { 1, 2, 3 } Contains: { 1, 2 }
+Matchers.tests.cpp:<line number>: passed: v, Contains(v2) for: { 1, 2, 3 } Contains: { 1, 2, 3 }
+Matchers.tests.cpp:<line number>: passed: v, Contains(empty) for: { 1, 2, 3 } Contains: { }
+Matchers.tests.cpp:<line number>: passed: empty, Contains(empty) for: { } Contains: { }
+Matchers.tests.cpp:<line number>: passed: v, VectorContains(1) && VectorContains(2) for: { 1, 2, 3 } ( Contains: 1 and Contains: 2 )
+Matchers.tests.cpp:<line number>: passed: v, Equals(v) for: { 1, 2, 3 } Equals: { 1, 2, 3 }
+Matchers.tests.cpp:<line number>: passed: empty, Equals(empty) for: { } Equals: { }
+Matchers.tests.cpp:<line number>: passed: v, Equals(v2) for: { 1, 2, 3 } Equals: { 1, 2, 3 }
+Matchers.tests.cpp:<line number>: passed: v, UnorderedEquals(v) for: { 1, 2, 3 } UnorderedEquals: { 1, 2, 3 }
+Matchers.tests.cpp:<line number>: passed: empty, UnorderedEquals(empty) for: { } UnorderedEquals: { }
+Matchers.tests.cpp:<line number>: passed: permuted, UnorderedEquals(v) for: { 1, 3, 2 } UnorderedEquals: { 1, 2, 3 }
+Matchers.tests.cpp:<line number>: passed: permuted, UnorderedEquals(v) for: { 2, 3, 1 } UnorderedEquals: { 1, 2, 3 }
+Matchers.tests.cpp:<line number>: failed: v, VectorContains(-1) for: { 1, 2, 3 } Contains: -1
+Matchers.tests.cpp:<line number>: failed: empty, VectorContains(1) for: { } Contains: 1
+Matchers.tests.cpp:<line number>: failed: empty, Contains(v) for: { } Contains: { 1, 2, 3 }
+Matchers.tests.cpp:<line number>: failed: v, Contains(v2) for: { 1, 2, 3 } Contains: { 1, 2, 4 }
+Matchers.tests.cpp:<line number>: failed: v, Equals(v2) for: { 1, 2, 3 } Equals: { 1, 2 }
+Matchers.tests.cpp:<line number>: failed: v2, Equals(v) for: { 1, 2 } Equals: { 1, 2, 3 }
+Matchers.tests.cpp:<line number>: failed: empty, Equals(v) for: { } Equals: { 1, 2, 3 }
+Matchers.tests.cpp:<line number>: failed: v, Equals(empty) for: { 1, 2, 3 } Equals: { }
+Matchers.tests.cpp:<line number>: failed: v, UnorderedEquals(empty) for: { 1, 2, 3 } UnorderedEquals: { }
+Matchers.tests.cpp:<line number>: failed: empty, UnorderedEquals(v) for: { } UnorderedEquals: { 1, 2, 3 }
+Matchers.tests.cpp:<line number>: failed: permuted, UnorderedEquals(v) for: { 1, 3 } UnorderedEquals: { 1, 2, 3 }
+Matchers.tests.cpp:<line number>: failed: permuted, UnorderedEquals(v) for: { 3, 1 } UnorderedEquals: { 1, 2, 3 }
+Exception.tests.cpp:<line number>: passed: thisThrows(), std::domain_error
+Exception.tests.cpp:<line number>: passed: thisDoesntThrow()
+Exception.tests.cpp:<line number>: passed: thisThrows()
+Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'unexpected exception'
+Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'expected exception'; expression was: thisThrows() == 0
+Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'expected exception'; expression was: thisThrows() == 0
+Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'expected exception'; expression was: thisThrows() == 0
+Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'unexpected exception'
+Tricky.tests.cpp:<line number>: warning: 'Uncomment the code in this test to check that it gives a sensible compiler error'
+Tricky.tests.cpp:<line number>: warning: 'Uncomment the code in this test to check that it gives a sensible compiler error'
+Tricky.tests.cpp:<line number>: passed:
+Tricky.tests.cpp:<line number>: passed:
+Tricky.tests.cpp:<line number>: passed:
+Tricky.tests.cpp:<line number>: passed:
+Xml.tests.cpp:<line number>: passed: encode( "normal string" ) == "normal string" for: "normal string" == "normal string"
+Xml.tests.cpp:<line number>: passed: encode( "" ) == "" for: "" == ""
+Xml.tests.cpp:<line number>: passed: encode( "smith & jones" ) == "smith & jones" for: "smith & jones" == "smith & jones"
+Xml.tests.cpp:<line number>: passed: encode( "smith < jones" ) == "smith < jones" for: "smith < jones" == "smith < jones"
+Xml.tests.cpp:<line number>: passed: encode( "smith > jones" ) == "smith > jones" for: "smith > jones" == "smith > jones"
+Xml.tests.cpp:<line number>: passed: encode( "smith ]]> jones" ) == "smith ]]> jones" for: "smith ]]> jones"
+==
+"smith ]]> jones"
+Xml.tests.cpp:<line number>: passed: encode( stringWithQuotes ) == stringWithQuotes for: "don't "quote" me on that"
+==
+"don't "quote" me on that"
+Xml.tests.cpp:<line number>: passed: encode( stringWithQuotes, Catch::XmlEncode::ForAttributes ) == "don't "quote" me on that" for: "don't "quote" me on that"
+==
+"don't "quote" me on that"
+Xml.tests.cpp:<line number>: passed: encode( "[/x01]" ) == "[//x01]" for: "[/x01]" == "[/x01]"
+Xml.tests.cpp:<line number>: passed: encode( "[/x7F]" ) == "[//x7F]" for: "[/x7F]" == "[/x7F]"
+ToStringVector.tests.cpp:<line number>: passed: Catch::Detail::stringify( empty ) == "{ }" for: "{ }" == "{ }"
+ToStringVector.tests.cpp:<line number>: passed: Catch::Detail::stringify( oneValue ) == "{ 42 }" for: "{ 42 }" == "{ 42 }"
+ToStringVector.tests.cpp:<line number>: passed: Catch::Detail::stringify( twoValues ) == "{ 42, 250 }" for: "{ 42, 250 }" == "{ 42, 250 }"
+Misc.tests.cpp:<line number>: passed: x == 0 for: 0 == 0
+Tricky.tests.cpp:<line number>: passed: obj.prop != 0 for: 0x<hex digits> != 0
+Misc.tests.cpp:<line number>: passed: flag for: true
+Misc.tests.cpp:<line number>: passed: testCheckedElse( true ) for: true
+Misc.tests.cpp:<line number>: failed: flag for: false
+Misc.tests.cpp:<line number>: failed: testCheckedElse( false ) for: false
+Misc.tests.cpp:<line number>: passed: flag for: true
+Misc.tests.cpp:<line number>: passed: testCheckedIf( true ) for: true
+Misc.tests.cpp:<line number>: failed: flag for: false
+Misc.tests.cpp:<line number>: failed: testCheckedIf( false ) for: false
+Condition.tests.cpp:<line number>: passed: unsigned_char_var == 1 for: 1 == 1
+Condition.tests.cpp:<line number>: passed: unsigned_short_var == 1 for: 1 == 1
+Condition.tests.cpp:<line number>: passed: unsigned_int_var == 1 for: 1 == 1
+Condition.tests.cpp:<line number>: passed: unsigned_long_var == 1 for: 1 == 1
+Condition.tests.cpp:<line number>: passed: long_var == unsigned_char_var for: 1 == 1
+Condition.tests.cpp:<line number>: passed: long_var == unsigned_short_var for: 1 == 1
+Condition.tests.cpp:<line number>: passed: long_var == unsigned_int_var for: 1 == 1
+Condition.tests.cpp:<line number>: passed: long_var == unsigned_long_var for: 1 == 1
+Misc.tests.cpp:<line number>: passed:
+Misc.tests.cpp:<line number>: passed:
+Misc.tests.cpp:<line number>: passed:
+loose text artifact
+Message.tests.cpp:<line number>: failed: explicitly with 1 message: 'Previous info should not be seen'
+Misc.tests.cpp:<line number>: passed: l == std::numeric_limits<long long>::max() for: 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: ( 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>: passed: ( fib[i] % 2 ) == 0 for: 0 == 0 with 1 message: 'Testing if fib[2] (2) is even'
+Misc.tests.cpp:<line number>: failed: ( fib[i] % 2 ) == 0 for: 1 == 0 with 1 message: 'Testing if fib[3] (3) is even'
+Misc.tests.cpp:<line number>: failed: ( fib[i] % 2 ) == 0 for: 1 == 0 with 1 message: 'Testing if fib[4] (5) is even'
+Misc.tests.cpp:<line number>: passed: ( fib[i] % 2 ) == 0 for: 0 == 0 with 1 message: 'Testing if fib[5] (8) is even'
+Misc.tests.cpp:<line number>: failed: ( fib[i] % 2 ) == 0 for: 1 == 0 with 1 message: 'Testing if fib[6] (13) is even'
+Misc.tests.cpp:<line number>: failed: ( fib[i] % 2 ) == 0 for: 1 == 0 with 1 message: 'Testing if fib[7] (21) is even'
+Misc.tests.cpp:<line number>: failed: a == b for: 1 == 2
+Misc.tests.cpp:<line number>: passed: a != b for: 1 != 2
+Misc.tests.cpp:<line number>: passed: a < b for: 1 < 2
+Misc.tests.cpp:<line number>: passed: a != b for: 1 != 2
+Misc.tests.cpp:<line number>: passed: b != a for: 2 != 1
+Misc.tests.cpp:<line number>: passed: a != b for: 1 != 2
+Tricky.tests.cpp:<line number>: passed: s == "7" for: "7" == "7"
+Tricky.tests.cpp:<line number>: passed: ti == typeid(int) for: {?} == {?}
+Misc.tests.cpp:<line number>: passed:
+Misc.tests.cpp:<line number>: passed: makeString( false ) != static_cast<char*>(0) for: "valid string" != {null string}
+Misc.tests.cpp:<line number>: passed: makeString( true ) == static_cast<char*>(0) for: {null string} == {null string}
+Tricky.tests.cpp:<line number>: passed: ptr.get() == 0 for: 0 == 0
+ToStringPair.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( pair ) == "{ { 42, /"Arthur/" }, { /"Ford/", 24 } }" for: "{ { 42, "Arthur" }, { "Ford", 24 } }"
+==
+"{ { 42, "Arthur" }, { "Ford", 24 } }"
+Tricky.tests.cpp:<line number>: passed: p == 0 for: 0 == 0
+Misc.tests.cpp:<line number>: passed: a != b for: 1 != 2
+Misc.tests.cpp:<line number>: passed: b != a for: 2 != 1
+Misc.tests.cpp:<line number>: passed: a != b for: 1 != 2
+String.tests.cpp:<line number>: passed: Catch::replaceInPlace( letters, "b", "z" ) for: true
+String.tests.cpp:<line number>: passed: letters == "azcdefcg" for: "azcdefcg" == "azcdefcg"
+String.tests.cpp:<line number>: passed: Catch::replaceInPlace( letters, "c", "z" ) for: true
+String.tests.cpp:<line number>: passed: letters == "abzdefzg" for: "abzdefzg" == "abzdefzg"
+String.tests.cpp:<line number>: passed: Catch::replaceInPlace( letters, "a", "z" ) for: true
+String.tests.cpp:<line number>: passed: letters == "zbcdefcg" for: "zbcdefcg" == "zbcdefcg"
+String.tests.cpp:<line number>: passed: Catch::replaceInPlace( letters, "g", "z" ) for: true
+String.tests.cpp:<line number>: passed: letters == "abcdefcz" for: "abcdefcz" == "abcdefcz"
+String.tests.cpp:<line number>: passed: Catch::replaceInPlace( letters, letters, "replaced" ) for: true
+String.tests.cpp:<line number>: passed: letters == "replaced" for: "replaced" == "replaced"
+String.tests.cpp:<line number>: passed: !(Catch::replaceInPlace( letters, "x", "z" )) for: !false
+String.tests.cpp:<line number>: passed: letters == letters for: "abcdefcg" == "abcdefcg"
+String.tests.cpp:<line number>: passed: Catch::replaceInPlace( s, "'", "|'" ) for: true
+String.tests.cpp:<line number>: passed: s == "didn|'t" for: "didn|'t" == "didn|'t"
+Misc.tests.cpp:<line number>: failed: false with 1 message: '3'
+Message.tests.cpp:<line number>: failed: false with 2 messages: 'hi' and 'i := 7'
+ToStringGeneral.tests.cpp:<line number>: passed: Catch::Detail::stringify( emptyMap ) == "{ }" for: "{ }" == "{ }"
+ToStringGeneral.tests.cpp:<line number>: passed: Catch::Detail::stringify( map ) == "{ { /"one/", 1 } }" for: "{ { "one", 1 } }" == "{ { "one", 1 } }"
+ToStringGeneral.tests.cpp:<line number>: passed: Catch::Detail::stringify( map ) == "{ { /"abc/", 1 }, { /"def/", 2 }, { /"ghi/", 3 } }" for: "{ { "abc", 1 }, { "def", 2 }, { "ghi", 3 } }"
+==
+"{ { "abc", 1 }, { "def", 2 }, { "ghi", 3 } }"
+ToStringPair.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(value) == "{ 34, /"xyzzy/" }" for: "{ 34, "xyzzy" }" == "{ 34, "xyzzy" }"
+ToStringPair.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( value ) == "{ 34, /"xyzzy/" }" for: "{ 34, "xyzzy" }" == "{ 34, "xyzzy" }"
+ToStringGeneral.tests.cpp:<line number>: passed: Catch::Detail::stringify( emptySet ) == "{ }" for: "{ }" == "{ }"
+ToStringGeneral.tests.cpp:<line number>: passed: Catch::Detail::stringify( set ) == "{ /"one/" }" for: "{ "one" }" == "{ "one" }"
+ToStringGeneral.tests.cpp:<line number>: passed: Catch::Detail::stringify( set ) == "{ /"abc/", /"def/", /"ghi/" }" for: "{ "abc", "def", "ghi" }"
+==
+"{ "abc", "def", "ghi" }"
+ToStringPair.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( pr ) == "{ { /"green/", 55 } }" for: "{ { "green", 55 } }"
+==
+"{ { "green", 55 } }"
+Tricky.tests.cpp:<line number>: failed: std::string( "first" ) == "second" for: "first" == "second"
+ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( item ) == "StringMaker<has_maker>" for: "StringMaker<has_maker>"
+==
+"StringMaker<has_maker>"
+ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( item ) == "StringMaker<has_maker_and_operator>" for: "StringMaker<has_maker_and_operator>"
+==
+"StringMaker<has_maker_and_operator>"
+ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( item ) == "operator<<( has_operator )" for: "operator<<( has_operator )"
+==
+"operator<<( has_operator )"
+Misc.tests.cpp:<line number>: passed: result == "/"wide load/"" for: ""wide load"" == ""wide load""
+Misc.tests.cpp:<line number>: passed: result == "/"wide load/"" for: ""wide load"" == ""wide load""
+Misc.tests.cpp:<line number>: passed: result == "/"wide load/"" for: ""wide load"" == ""wide load""
+Misc.tests.cpp:<line number>: passed: result == "/"wide load/"" for: ""wide load"" == ""wide load""
+ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(streamable_range{}) == "op<<(streamable_range)" for: "op<<(streamable_range)"
+==
+"op<<(streamable_range)"
+ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(stringmaker_range{}) == "stringmaker(streamable_range)" for: "stringmaker(streamable_range)"
+==
+"stringmaker(streamable_range)"
+ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(just_range{}) == "{ 1, 2, 3, 4 }" for: "{ 1, 2, 3, 4 }" == "{ 1, 2, 3, 4 }"
+ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(disabled_range{}) == "{?}" for: "{?}" == "{?}"
+ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( v ) == "{ StringMaker<has_maker> }" for: "{ StringMaker<has_maker> }"
+==
+"{ StringMaker<has_maker> }"
+ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( v ) == "{ StringMaker<has_maker_and_operator> }" for: "{ StringMaker<has_maker_and_operator> }"
+==
+"{ StringMaker<has_maker_and_operator> }"
+ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( v ) == "{ operator<<( has_operator ) }" for: "{ operator<<( has_operator ) }"
+==
+"{ operator<<( has_operator ) }"
+EnumToString.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(e0) == "E2/V0" for: "E2/V0" == "E2/V0"
+EnumToString.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(e1) == "E2/V1" for: "E2/V1" == "E2/V1"
+EnumToString.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(e3) == "Unknown enum value 10" for: "Unknown enum value 10"
+==
+"Unknown enum value 10"
+EnumToString.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(e0) == "0" for: "0" == "0"
+EnumToString.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(e1) == "1" for: "1" == "1"
+EnumToString.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(e0) == "E2{0}" for: "E2{0}" == "E2{0}"
+EnumToString.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(e1) == "E2{1}" for: "E2{1}" == "E2{1}"
+EnumToString.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(e0) == "0" for: "0" == "0"
+EnumToString.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(e1) == "1" for: "1" == "1"
+ToStringTuple.tests.cpp:<line number>: passed: "{ }" == ::Catch::Detail::stringify(type{}) for: "{ }" == "{ }"
+ToStringTuple.tests.cpp:<line number>: passed: "{ }" == ::Catch::Detail::stringify(value) for: "{ }" == "{ }"
+ToStringTuple.tests.cpp:<line number>: passed: "1.2f" == ::Catch::Detail::stringify(float(1.2)) for: "1.2f" == "1.2f"
+ToStringTuple.tests.cpp:<line number>: passed: "{ 1.2f, 0 }" == ::Catch::Detail::stringify(type{1.2f,0}) for: "{ 1.2f, 0 }" == "{ 1.2f, 0 }"
+ToStringTuple.tests.cpp:<line number>: passed: "{ 0 }" == ::Catch::Detail::stringify(type{0}) for: "{ 0 }" == "{ 0 }"
+ToStringTuple.tests.cpp:<line number>: passed: "{ 0, 42, /"Catch me/" }" == ::Catch::Detail::stringify(value) for: "{ 0, 42, "Catch me" }"
+==
+"{ 0, 42, "Catch me" }"
+ToStringTuple.tests.cpp:<line number>: passed: "{ /"hello/", /"world/" }" == ::Catch::Detail::stringify(type{"hello","world"}) for: "{ "hello", "world" }"
+==
+"{ "hello", "world" }"
+ToStringTuple.tests.cpp:<line number>: passed: "{ { 42 }, { }, 1.2f }" == ::Catch::Detail::stringify(value) for: "{ { 42 }, { }, 1.2f }"
+==
+"{ { 42 }, { }, 1.2f }"
+ToStringVector.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(v) == "{ }" for: "{ }" == "{ }"
+ToStringVector.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(v) == "{ { /"hello/" }, { /"world/" } }" for: "{ { "hello" }, { "world" } }"
+==
+"{ { "hello" }, { "world" } }"
+ToStringVector.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(bools) == "{ }" for: "{ }" == "{ }"
+ToStringVector.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(bools) == "{ true }" for: "{ true }" == "{ true }"
+ToStringVector.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(bools) == "{ true, false }" for: "{ true, false }" == "{ true, false }"
+ToStringVector.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(vv) == "{ }" for: "{ }" == "{ }"
+ToStringVector.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(vv) == "{ 42 }" for: "{ 42 }" == "{ 42 }"
+ToStringVector.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(vv) == "{ 42, 250 }" for: "{ 42, 250 }" == "{ 42, 250 }"
+ToStringVector.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(vv) == "{ }" for: "{ }" == "{ }"
+ToStringVector.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(vv) == "{ 42 }" for: "{ 42 }" == "{ 42 }"
+ToStringVector.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(vv) == "{ 42, 250 }" for: "{ 42, 250 }" == "{ 42, 250 }"
+ToStringVector.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(vv) == "{ }" for: "{ }" == "{ }"
+ToStringVector.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(vv) == "{ /"hello/" }" for: "{ "hello" }" == "{ "hello" }"
+ToStringVector.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(vv) == "{ /"hello/", /"world/" }" for: "{ "hello", "world" }"
+==
+"{ "hello", "world" }"
+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.size() == 10 for: 10 == 10
+Misc.tests.cpp:<line number>: passed: v.capacity() >= 10 for: 10 >= 10
+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.size() == 0 for: 0 == 0
+Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5
+Misc.tests.cpp:<line number>: passed: v.capacity() == 0 for: 0 == 0
+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.size() == 5 for: 5 == 5
+Misc.tests.cpp:<line number>: passed: v.capacity() >= 10 for: 10 >= 10
+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.size() == 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:
+Failed 61 test cases, failed 120 assertions.
+
diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt
new file mode 100644
index 0000000..a94cc4f
--- /dev/null
+++ b/projects/SelfTest/Baselines/console.std.approved.txt
@@ -0,0 +1,1069 @@
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+<exe-name> is a <version> host application.
+Run with -? for options
+
+-------------------------------------------------------------------------------
+#748 - captures with unexpected exceptions
+ outside assertions
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+due to unexpected exception with messages:
+ answer := 42
+ expected exception
+
+-------------------------------------------------------------------------------
+#748 - captures with unexpected exceptions
+ inside REQUIRE_NOTHROW
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+ REQUIRE_NOTHROW( thisThrows() )
+due to unexpected exception with messages:
+ answer := 42
+ expected exception
+
+-------------------------------------------------------------------------------
+#835 -- errno should not be touched by Catch
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>: FAILED:
+ CHECK( f() == 0 )
+with expansion:
+ 1 == 0
+
+-------------------------------------------------------------------------------
+'Not' checks that should fail
+-------------------------------------------------------------------------------
+Condition.tests.cpp:<line number>
+...............................................................................
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( false != false )
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( true != true )
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( !true )
+with expansion:
+ false
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK_FALSE( true )
+with expansion:
+ !true
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( !trueValue )
+with expansion:
+ false
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK_FALSE( trueValue )
+with expansion:
+ !true
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( !(1 == 1) )
+with expansion:
+ false
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK_FALSE( 1 == 1 )
+
+-------------------------------------------------------------------------------
+A METHOD_AS_TEST_CASE based test run that fails
+-------------------------------------------------------------------------------
+Class.tests.cpp:<line number>
+...............................................................................
+
+Class.tests.cpp:<line number>: FAILED:
+ REQUIRE( s == "world" )
+with expansion:
+ "hello" == "world"
+
+-------------------------------------------------------------------------------
+A TEST_CASE_METHOD based test run that fails
+-------------------------------------------------------------------------------
+Class.tests.cpp:<line number>
+...............................................................................
+
+Class.tests.cpp:<line number>: FAILED:
+ REQUIRE( m_a == 2 )
+with expansion:
+ 1 == 2
+
+-------------------------------------------------------------------------------
+A couple of nested sections followed by a failure
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>: FAILED:
+explicitly with message:
+ to infinity and beyond
+
+-------------------------------------------------------------------------------
+A failing expression with a non streamable type is still captured
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>: FAILED:
+ CHECK( &o1 == &o2 )
+with expansion:
+ 0x<hex digits> == 0x<hex digits>
+
+Tricky.tests.cpp:<line number>: FAILED:
+ CHECK( o1 == o2 )
+with expansion:
+ {?} == {?}
+
+-------------------------------------------------------------------------------
+An unchecked exception reports the line of the last assertion
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+ {Unknown expression after the reported line}
+due to unexpected exception with message:
+ unexpected exception
+
+-------------------------------------------------------------------------------
+Contains string matcher
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( testStringForMatching(), Contains("not there", Catch::CaseSensitive::No) )
+with expansion:
+ "this string contains 'abc' as a substring" contains: "not there" (case
+ insensitive)
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( testStringForMatching(), Contains("STRING") )
+with expansion:
+ "this string contains 'abc' as a substring" contains: "STRING"
+
+-------------------------------------------------------------------------------
+Custom exceptions can be translated when testing for nothrow
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+ REQUIRE_NOTHROW( throwCustom() )
+due to unexpected exception with message:
+ custom exception - not std
+
+-------------------------------------------------------------------------------
+Custom exceptions can be translated when testing for throwing as something else
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+ REQUIRE_THROWS_AS( throwCustom(), std::exception )
+due to unexpected exception with message:
+ custom exception - not std
+
+-------------------------------------------------------------------------------
+Custom std-exceptions can be custom translated
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+due to unexpected exception with message:
+ custom std exception
+
+-------------------------------------------------------------------------------
+EndsWith string matcher
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( testStringForMatching(), EndsWith("Substring") )
+with expansion:
+ "this string contains 'abc' as a substring" ends with: "Substring"
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( testStringForMatching(), EndsWith("this", Catch::CaseSensitive::No) )
+with expansion:
+ "this string contains 'abc' as a substring" ends with: "this" (case
+ insensitive)
+
+-------------------------------------------------------------------------------
+Equality checks that should fail
+-------------------------------------------------------------------------------
+Condition.tests.cpp:<line number>
+...............................................................................
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.int_seven == 6 )
+with expansion:
+ 7 == 6
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.int_seven == 8 )
+with expansion:
+ 7 == 8
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.int_seven == 0 )
+with expansion:
+ 7 == 0
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.float_nine_point_one == Approx( 9.11f ) )
+with expansion:
+ 9.1f == Approx( 9.1099996567 )
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.float_nine_point_one == Approx( 9.0f ) )
+with expansion:
+ 9.1f == Approx( 9.0 )
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.float_nine_point_one == Approx( 1 ) )
+with expansion:
+ 9.1f == Approx( 1.0 )
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.float_nine_point_one == Approx( 0 ) )
+with expansion:
+ 9.1f == Approx( 0.0 )
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.double_pi == Approx( 3.1415 ) )
+with expansion:
+ 3.1415926535 == Approx( 3.1415 )
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.str_hello == "goodbye" )
+with expansion:
+ "hello" == "goodbye"
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.str_hello == "hell" )
+with expansion:
+ "hello" == "hell"
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.str_hello == "hello1" )
+with expansion:
+ "hello" == "hello1"
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.str_hello.size() == 6 )
+with expansion:
+ 5 == 6
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( x == Approx( 1.301 ) )
+with expansion:
+ 1.3 == Approx( 1.301 )
+
+-------------------------------------------------------------------------------
+Equals string matcher
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( testStringForMatching(), Equals("this string contains 'ABC' as a substring") )
+with expansion:
+ "this string contains 'abc' as a substring" equals: "this string contains
+ 'ABC' as a substring"
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( testStringForMatching(), Equals("something else", Catch::CaseSensitive::No) )
+with expansion:
+ "this string contains 'abc' as a substring" equals: "something else" (case
+ insensitive)
+
+-------------------------------------------------------------------------------
+Exception matchers that fail
+ No exception
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{1} )
+because no exception was thrown where one was expected:
+
+Matchers.tests.cpp:<line number>: FAILED:
+ REQUIRE_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{1} )
+because no exception was thrown where one was expected:
+
+-------------------------------------------------------------------------------
+Exception matchers that fail
+ Type mismatch
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THROWS_MATCHES( throwsAsInt(1), SpecialException, ExceptionMatcher{1} )
+due to unexpected exception with message:
+ Unknown exception
+
+Matchers.tests.cpp:<line number>: FAILED:
+ REQUIRE_THROWS_MATCHES( throwsAsInt(1), SpecialException, ExceptionMatcher{1} )
+due to unexpected exception with message:
+ Unknown exception
+
+-------------------------------------------------------------------------------
+Exception matchers that fail
+ Contents are wrong
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THROWS_MATCHES( throws(3), SpecialException, ExceptionMatcher{1} )
+with expansion:
+ {?} special exception has value of 1
+
+Matchers.tests.cpp:<line number>: FAILED:
+ REQUIRE_THROWS_MATCHES( throws(4), SpecialException, ExceptionMatcher{1} )
+with expansion:
+ {?} special exception has value of 1
+
+-------------------------------------------------------------------------------
+Expected exceptions that don't throw or unexpected exceptions fail the test
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+ CHECK_THROWS_AS( thisThrows(), std::string )
+due to unexpected exception with message:
+ expected exception
+
+Exception.tests.cpp:<line number>: FAILED:
+ CHECK_THROWS_AS( thisDoesntThrow(), std::domain_error )
+because no exception was thrown where one was expected:
+
+Exception.tests.cpp:<line number>: FAILED:
+ CHECK_NOTHROW( thisThrows() )
+due to unexpected exception with message:
+ expected exception
+
+-------------------------------------------------------------------------------
+FAIL aborts the test
+-------------------------------------------------------------------------------
+Message.tests.cpp:<line number>
+...............................................................................
+
+Message.tests.cpp:<line number>: FAILED:
+explicitly with message:
+ This is a failure
+
+-------------------------------------------------------------------------------
+FAIL does not require an argument
+-------------------------------------------------------------------------------
+Message.tests.cpp:<line number>
+...............................................................................
+
+Message.tests.cpp:<line number>: FAILED:
+
+-------------------------------------------------------------------------------
+FAIL_CHECK does not abort the test
+-------------------------------------------------------------------------------
+Message.tests.cpp:<line number>
+...............................................................................
+
+Message.tests.cpp:<line number>: FAILED:
+explicitly with message:
+ This is a failure
+
+Message.tests.cpp:<line number>:
+warning:
+ This message appears in the output
+
+-------------------------------------------------------------------------------
+INFO and WARN do not abort tests
+-------------------------------------------------------------------------------
+Message.tests.cpp:<line number>
+...............................................................................
+
+Message.tests.cpp:<line number>:
+warning:
+ this is a warning
+
+-------------------------------------------------------------------------------
+INFO gets logged on failure
+-------------------------------------------------------------------------------
+Message.tests.cpp:<line number>
+...............................................................................
+
+Message.tests.cpp:<line number>: FAILED:
+ REQUIRE( a == 1 )
+with expansion:
+ 2 == 1
+with messages:
+ this message should be logged
+ so should this
+
+-------------------------------------------------------------------------------
+INFO gets logged on failure, even if captured before successful assertions
+-------------------------------------------------------------------------------
+Message.tests.cpp:<line number>
+...............................................................................
+
+Message.tests.cpp:<line number>: FAILED:
+ CHECK( a == 1 )
+with expansion:
+ 2 == 1
+with messages:
+ this message may be logged later
+ this message should be logged
+
+Message.tests.cpp:<line number>: FAILED:
+ CHECK( a == 0 )
+with expansion:
+ 2 == 0
+with messages:
+ this message may be logged later
+ this message should be logged
+ and this, but later
+
+-------------------------------------------------------------------------------
+INFO is reset for each loop
+-------------------------------------------------------------------------------
+Message.tests.cpp:<line number>
+...............................................................................
+
+Message.tests.cpp:<line number>: FAILED:
+ REQUIRE( i < 10 )
+with expansion:
+ 10 < 10
+with messages:
+ current counter 10
+ i := 10
+
+-------------------------------------------------------------------------------
+Inequality checks that should fail
+-------------------------------------------------------------------------------
+Condition.tests.cpp:<line number>
+...............................................................................
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.int_seven != 7 )
+with expansion:
+ 7 != 7
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.float_nine_point_one != Approx( 9.1f ) )
+with expansion:
+ 9.1f != Approx( 9.1000003815 )
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.double_pi != Approx( 3.1415926535 ) )
+with expansion:
+ 3.1415926535 != Approx( 3.1415926535 )
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.str_hello != "hello" )
+with expansion:
+ "hello" != "hello"
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.str_hello.size() != 5 )
+with expansion:
+ 5 != 5
+
+-------------------------------------------------------------------------------
+Matchers can be composed with both && and || - failing
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( testStringForMatching(), (Contains("string") || Contains("different")) && Contains("random") )
+with expansion:
+ "this string contains 'abc' as a substring" ( ( contains: "string" or
+ contains: "different" ) and contains: "random" )
+
+-------------------------------------------------------------------------------
+Matchers can be negated (Not) with the ! operator - failing
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( testStringForMatching(), !Contains("substring") )
+with expansion:
+ "this string contains 'abc' as a substring" not contains: "substring"
+
+-------------------------------------------------------------------------------
+Mismatching exception messages failing the test
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+ REQUIRE_THROWS_WITH( thisThrows(), "should fail" )
+with expansion:
+ "expected exception" equals: "should fail"
+
+-------------------------------------------------------------------------------
+Nice descriptive name
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+warning:
+ This one ran
+
+-------------------------------------------------------------------------------
+Non-std exceptions can be translated
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+due to unexpected exception with message:
+ custom exception
+
+-------------------------------------------------------------------------------
+Ordering comparison checks that should fail
+-------------------------------------------------------------------------------
+Condition.tests.cpp:<line number>
+...............................................................................
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.int_seven > 7 )
+with expansion:
+ 7 > 7
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.int_seven < 7 )
+with expansion:
+ 7 < 7
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.int_seven > 8 )
+with expansion:
+ 7 > 8
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.int_seven < 6 )
+with expansion:
+ 7 < 6
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.int_seven < 0 )
+with expansion:
+ 7 < 0
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.int_seven < -1 )
+with expansion:
+ 7 < -1
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.int_seven >= 8 )
+with expansion:
+ 7 >= 8
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.int_seven <= 6 )
+with expansion:
+ 7 <= 6
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.float_nine_point_one < 9 )
+with expansion:
+ 9.1f < 9
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.float_nine_point_one > 10 )
+with expansion:
+ 9.1f > 10
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.float_nine_point_one > 9.2 )
+with expansion:
+ 9.1f > 9.2
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.str_hello > "hello" )
+with expansion:
+ "hello" > "hello"
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.str_hello < "hello" )
+with expansion:
+ "hello" < "hello"
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.str_hello > "hellp" )
+with expansion:
+ "hello" > "hellp"
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.str_hello > "z" )
+with expansion:
+ "hello" > "z"
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.str_hello < "hellm" )
+with expansion:
+ "hello" < "hellm"
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.str_hello < "a" )
+with expansion:
+ "hello" < "a"
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.str_hello >= "z" )
+with expansion:
+ "hello" >= "z"
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.str_hello <= "a" )
+with expansion:
+ "hello" <= "a"
+
+-------------------------------------------------------------------------------
+Output from all sections is reported
+ one
+-------------------------------------------------------------------------------
+Message.tests.cpp:<line number>
+...............................................................................
+
+Message.tests.cpp:<line number>: FAILED:
+explicitly with message:
+ Message from section one
+
+-------------------------------------------------------------------------------
+Output from all sections is reported
+ two
+-------------------------------------------------------------------------------
+Message.tests.cpp:<line number>
+...............................................................................
+
+Message.tests.cpp:<line number>: FAILED:
+explicitly with message:
+ Message from section two
+
+-------------------------------------------------------------------------------
+Reconstruction should be based on stringification: #914
+-------------------------------------------------------------------------------
+Decomposition.tests.cpp:<line number>
+...............................................................................
+
+Decomposition.tests.cpp:<line number>: FAILED:
+ CHECK( truthy(false) )
+with expansion:
+ Hey, its truthy!
+
+-------------------------------------------------------------------------------
+Regex string matcher
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( testStringForMatching(), Matches("this STRING contains 'abc' as a substring") )
+with expansion:
+ "this string contains 'abc' as a substring" matches "this STRING contains
+ 'abc' as a substring" case sensitively
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( testStringForMatching(), Matches("contains 'abc' as a substring") )
+with expansion:
+ "this string contains 'abc' as a substring" matches "contains 'abc' as a
+ substring" case sensitively
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( testStringForMatching(), Matches("this string contains 'abc' as a") )
+with expansion:
+ "this string contains 'abc' as a substring" matches "this string contains
+ 'abc' as a" case sensitively
+
+A string sent directly to stdout
+A string sent directly to stderr
+A string sent to stderr via clog
+Message from section one
+Message from section two
+-------------------------------------------------------------------------------
+StartsWith string matcher
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( testStringForMatching(), StartsWith("This String") )
+with expansion:
+ "this string contains 'abc' as a substring" starts with: "This String"
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( testStringForMatching(), StartsWith("string", Catch::CaseSensitive::No) )
+with expansion:
+ "this string contains 'abc' as a substring" starts with: "string" (case
+ insensitive)
+
+-------------------------------------------------------------------------------
+Tabs and newlines show in output
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>: FAILED:
+ CHECK( s1 == s2 )
+with expansion:
+ "if ($b == 10) {
+ $a = 20;
+ }"
+ ==
+ "if ($b == 10) {
+ $a = 20;
+ }
+ "
+
+-------------------------------------------------------------------------------
+Unexpected exceptions can be translated
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+due to unexpected exception with message:
+ 3.14
+
+-------------------------------------------------------------------------------
+Vector matchers that fail
+ Contains (element)
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( v, VectorContains(-1) )
+with expansion:
+ { 1, 2, 3 } Contains: -1
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( empty, VectorContains(1) )
+with expansion:
+ { } Contains: 1
+
+-------------------------------------------------------------------------------
+Vector matchers that fail
+ Contains (vector)
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( empty, Contains(v) )
+with expansion:
+ { } Contains: { 1, 2, 3 }
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( v, Contains(v2) )
+with expansion:
+ { 1, 2, 3 } Contains: { 1, 2, 4 }
+
+-------------------------------------------------------------------------------
+Vector matchers that fail
+ Equals
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( v, Equals(v2) )
+with expansion:
+ { 1, 2, 3 } Equals: { 1, 2 }
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( v2, Equals(v) )
+with expansion:
+ { 1, 2 } Equals: { 1, 2, 3 }
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( empty, Equals(v) )
+with expansion:
+ { } Equals: { 1, 2, 3 }
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( v, Equals(empty) )
+with expansion:
+ { 1, 2, 3 } Equals: { }
+
+-------------------------------------------------------------------------------
+Vector matchers that fail
+ UnorderedEquals
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( v, UnorderedEquals(empty) )
+with expansion:
+ { 1, 2, 3 } UnorderedEquals: { }
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( empty, UnorderedEquals(v) )
+with expansion:
+ { } UnorderedEquals: { 1, 2, 3 }
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( permuted, UnorderedEquals(v) )
+with expansion:
+ { 1, 3 } UnorderedEquals: { 1, 2, 3 }
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( permuted, UnorderedEquals(v) )
+with expansion:
+ { 3, 1 } UnorderedEquals: { 1, 2, 3 }
+
+-------------------------------------------------------------------------------
+When unchecked exceptions are thrown directly they are always failures
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+due to unexpected exception with message:
+ unexpected exception
+
+-------------------------------------------------------------------------------
+When unchecked exceptions are thrown during a CHECK the test should continue
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+ CHECK( thisThrows() == 0 )
+due to unexpected exception with message:
+ expected exception
+
+-------------------------------------------------------------------------------
+When unchecked exceptions are thrown during a REQUIRE the test should abort
+fail
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+ REQUIRE( thisThrows() == 0 )
+due to unexpected exception with message:
+ expected exception
+
+-------------------------------------------------------------------------------
+When unchecked exceptions are thrown from functions they are always failures
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+ CHECK( thisThrows() == 0 )
+due to unexpected exception with message:
+ expected exception
+
+-------------------------------------------------------------------------------
+When unchecked exceptions are thrown from sections they are always failures
+ section name
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+due to unexpected exception with message:
+ unexpected exception
+
+-------------------------------------------------------------------------------
+Where the LHS is not a simple value
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+warning:
+ Uncomment the code in this test to check that it gives a sensible compiler
+ error
+
+-------------------------------------------------------------------------------
+Where there is more to the expression after the RHS
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+warning:
+ Uncomment the code in this test to check that it gives a sensible compiler
+ error
+
+-------------------------------------------------------------------------------
+checkedElse, failing
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>: FAILED:
+ CHECKED_ELSE( flag )
+with expansion:
+ false
+
+Misc.tests.cpp:<line number>: FAILED:
+ REQUIRE( testCheckedElse( false ) )
+with expansion:
+ false
+
+-------------------------------------------------------------------------------
+checkedIf, failing
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>: FAILED:
+ CHECKED_IF( flag )
+with expansion:
+ false
+
+Misc.tests.cpp:<line number>: FAILED:
+ REQUIRE( testCheckedIf( false ) )
+with expansion:
+ false
+
+loose text artifact
+-------------------------------------------------------------------------------
+just failure
+-------------------------------------------------------------------------------
+Message.tests.cpp:<line number>
+...............................................................................
+
+Message.tests.cpp:<line number>: FAILED:
+explicitly with message:
+ Previous info should not be seen
+
+-------------------------------------------------------------------------------
+looped SECTION tests
+ s1
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>: FAILED:
+ CHECK( b > a )
+with expansion:
+ 0 > 1
+
+-------------------------------------------------------------------------------
+looped tests
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>: FAILED:
+ CHECK( ( fib[i] % 2 ) == 0 )
+with expansion:
+ 1 == 0
+with message:
+ Testing if fib[0] (1) is even
+
+Misc.tests.cpp:<line number>: FAILED:
+ CHECK( ( fib[i] % 2 ) == 0 )
+with expansion:
+ 1 == 0
+with message:
+ Testing if fib[1] (1) is even
+
+Misc.tests.cpp:<line number>: FAILED:
+ CHECK( ( fib[i] % 2 ) == 0 )
+with expansion:
+ 1 == 0
+with message:
+ Testing if fib[3] (3) is even
+
+Misc.tests.cpp:<line number>: FAILED:
+ CHECK( ( fib[i] % 2 ) == 0 )
+with expansion:
+ 1 == 0
+with message:
+ Testing if fib[4] (5) is even
+
+Misc.tests.cpp:<line number>: FAILED:
+ CHECK( ( fib[i] % 2 ) == 0 )
+with expansion:
+ 1 == 0
+with message:
+ Testing if fib[6] (13) is even
+
+Misc.tests.cpp:<line number>: FAILED:
+ CHECK( ( fib[i] % 2 ) == 0 )
+with expansion:
+ 1 == 0
+with message:
+ Testing if fib[7] (21) is even
+
+-------------------------------------------------------------------------------
+more nested SECTION tests
+ s1
+ s2
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>: FAILED:
+ REQUIRE( a == b )
+with expansion:
+ 1 == 2
+
+-------------------------------------------------------------------------------
+send a single char to INFO
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>: FAILED:
+ REQUIRE( false )
+with message:
+ 3
+
+-------------------------------------------------------------------------------
+sends information to INFO
+-------------------------------------------------------------------------------
+Message.tests.cpp:<line number>
+...............................................................................
+
+Message.tests.cpp:<line number>: FAILED:
+ REQUIRE( false )
+with messages:
+ hi
+ i := 7
+
+-------------------------------------------------------------------------------
+string literals of different sizes can be compared
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>: FAILED:
+ REQUIRE( std::string( "first" ) == "second" )
+with expansion:
+ "first" == "second"
+
+===============================================================================
+test cases: 198 | 147 passed | 47 failed | 4 failed as expected
+assertions: 996 | 870 passed | 105 failed | 21 failed as expected
+
diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt
new file mode 100644
index 0000000..2b7159e
--- /dev/null
+++ b/projects/SelfTest/Baselines/console.sw.approved.txt
@@ -0,0 +1,8446 @@
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+<exe-name> is a <version> host application.
+Run with -? for options
+
+-------------------------------------------------------------------------------
+# A test name that starts with a #
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+with message:
+ yay
+
+-------------------------------------------------------------------------------
+#1005: Comparing pointer to int and long (NULL can be either on various
+ systems)
+-------------------------------------------------------------------------------
+Decomposition.tests.cpp:<line number>
+...............................................................................
+
+Decomposition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( fptr == 0 )
+with expansion:
+ 0 == 0
+
+Decomposition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( fptr == 0l )
+with expansion:
+ 0 == 0
+
+-------------------------------------------------------------------------------
+#1027
+-------------------------------------------------------------------------------
+Compilation.tests.cpp:<line number>
+...............................................................................
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( y.v == 0 )
+with expansion:
+ 0 == 0
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( 0 == y.v )
+with expansion:
+ 0 == 0
+
+-------------------------------------------------------------------------------
+#1147
+-------------------------------------------------------------------------------
+Compilation.tests.cpp:<line number>
+...............................................................................
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( t1 == t2 )
+with expansion:
+ {?} == {?}
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( t1 != t2 )
+with expansion:
+ {?} != {?}
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( t1 < t2 )
+with expansion:
+ {?} < {?}
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( t1 > t2 )
+with expansion:
+ {?} > {?}
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( t1 <= t2 )
+with expansion:
+ {?} <= {?}
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( t1 >= t2 )
+with expansion:
+ {?} >= {?}
+
+-------------------------------------------------------------------------------
+#748 - captures with unexpected exceptions
+ outside assertions
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+due to unexpected exception with messages:
+ answer := 42
+ expected exception
+
+-------------------------------------------------------------------------------
+#748 - captures with unexpected exceptions
+ inside REQUIRE_NOTHROW
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+ REQUIRE_NOTHROW( thisThrows() )
+due to unexpected exception with messages:
+ answer := 42
+ expected exception
+
+-------------------------------------------------------------------------------
+#748 - captures with unexpected exceptions
+ inside REQUIRE_THROWS
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THROWS( thisThrows() )
+with message:
+ answer := 42
+
+-------------------------------------------------------------------------------
+#809
+-------------------------------------------------------------------------------
+Compilation.tests.cpp:<line number>
+...............................................................................
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( 42 == f )
+with expansion:
+ 42 == {?}
+
+-------------------------------------------------------------------------------
+#833
+-------------------------------------------------------------------------------
+Compilation.tests.cpp:<line number>
+...............................................................................
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( a == t )
+with expansion:
+ 3 == 3
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ CHECK( a == t )
+with expansion:
+ 3 == 3
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THROWS( throws_int(true) )
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ CHECK_THROWS_AS( throws_int(true), int )
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_NOTHROW( throws_int(false) )
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( "aaa", Catch::EndsWith("aaa") )
+with expansion:
+ "aaa" ends with: "aaa"
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( templated_tests<int>(3) )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+#835 -- errno should not be touched by Catch
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>: FAILED:
+ CHECK( f() == 0 )
+with expansion:
+ 1 == 0
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( errno == 1 )
+with expansion:
+ 1 == 1
+
+-------------------------------------------------------------------------------
+#872
+-------------------------------------------------------------------------------
+Compilation.tests.cpp:<line number>
+...............................................................................
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( x == 4 )
+with expansion:
+ {?} == 4
+with message:
+ dummy := 0
+
+-------------------------------------------------------------------------------
+#961 -- Dynamically created sections should all be reported
+ Looped section 0
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+with message:
+ Everything is OK
+
+-------------------------------------------------------------------------------
+#961 -- Dynamically created sections should all be reported
+ Looped section 1
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+with message:
+ Everything is OK
+
+-------------------------------------------------------------------------------
+#961 -- Dynamically created sections should all be reported
+ Looped section 2
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+with message:
+ Everything is OK
+
+-------------------------------------------------------------------------------
+#961 -- Dynamically created sections should all be reported
+ Looped section 3
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+with message:
+ Everything is OK
+
+-------------------------------------------------------------------------------
+#961 -- Dynamically created sections should all be reported
+ Looped section 4
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+with message:
+ Everything is OK
+
+-------------------------------------------------------------------------------
+'Not' checks that should fail
+-------------------------------------------------------------------------------
+Condition.tests.cpp:<line number>
+...............................................................................
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( false != false )
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( true != true )
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( !true )
+with expansion:
+ false
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK_FALSE( true )
+with expansion:
+ !true
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( !trueValue )
+with expansion:
+ false
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK_FALSE( trueValue )
+with expansion:
+ !true
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( !(1 == 1) )
+with expansion:
+ false
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK_FALSE( 1 == 1 )
+
+-------------------------------------------------------------------------------
+'Not' checks that should succeed
+-------------------------------------------------------------------------------
+Condition.tests.cpp:<line number>
+...............................................................................
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( false == false )
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( true == true )
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( !false )
+with expansion:
+ true
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_FALSE( false )
+with expansion:
+ !false
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( !falseValue )
+with expansion:
+ true
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_FALSE( falseValue )
+with expansion:
+ !false
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( !(1 == 2) )
+with expansion:
+ true
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_FALSE( 1 == 2 )
+
+-------------------------------------------------------------------------------
+(unimplemented) static bools can be evaluated
+ compare to true
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( is_true<true>::value == true )
+with expansion:
+ true == true
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( true == is_true<true>::value )
+with expansion:
+ true == true
+
+-------------------------------------------------------------------------------
+(unimplemented) static bools can be evaluated
+ compare to false
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( is_true<false>::value == false )
+with expansion:
+ false == false
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( false == is_true<false>::value )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+(unimplemented) static bools can be evaluated
+ negation
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( !is_true<false>::value )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+(unimplemented) static bools can be evaluated
+ double negation
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( !!is_true<true>::value )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+(unimplemented) static bools can be evaluated
+ direct
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( is_true<true>::value )
+with expansion:
+ true
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_FALSE( is_true<false>::value )
+with expansion:
+ !false
+
+-------------------------------------------------------------------------------
+A METHOD_AS_TEST_CASE based test run that fails
+-------------------------------------------------------------------------------
+Class.tests.cpp:<line number>
+...............................................................................
+
+Class.tests.cpp:<line number>: FAILED:
+ REQUIRE( s == "world" )
+with expansion:
+ "hello" == "world"
+
+-------------------------------------------------------------------------------
+A METHOD_AS_TEST_CASE based test run that succeeds
+-------------------------------------------------------------------------------
+Class.tests.cpp:<line number>
+...............................................................................
+
+Class.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s == "hello" )
+with expansion:
+ "hello" == "hello"
+
+-------------------------------------------------------------------------------
+A TEST_CASE_METHOD based test run that fails
+-------------------------------------------------------------------------------
+Class.tests.cpp:<line number>
+...............................................................................
+
+Class.tests.cpp:<line number>: FAILED:
+ REQUIRE( m_a == 2 )
+with expansion:
+ 1 == 2
+
+-------------------------------------------------------------------------------
+A TEST_CASE_METHOD based test run that succeeds
+-------------------------------------------------------------------------------
+Class.tests.cpp:<line number>
+...............................................................................
+
+Class.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( m_a == 1 )
+with expansion:
+ 1 == 1
+
+-------------------------------------------------------------------------------
+A couple of nested sections followed by a failure
+ Outer
+ Inner
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+with message:
+ that's not flying - that's failing in style
+
+-------------------------------------------------------------------------------
+A couple of nested sections followed by a failure
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>: FAILED:
+explicitly with message:
+ to infinity and beyond
+
+-------------------------------------------------------------------------------
+A failing expression with a non streamable type is still captured
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>: FAILED:
+ CHECK( &o1 == &o2 )
+with expansion:
+ 0x<hex digits> == 0x<hex digits>
+
+Tricky.tests.cpp:<line number>: FAILED:
+ CHECK( o1 == o2 )
+with expansion:
+ {?} == {?}
+
+-------------------------------------------------------------------------------
+Absolute margin
+-------------------------------------------------------------------------------
+Approx.tests.cpp:<line number>
+...............................................................................
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( 104.0 != Approx(100.0) )
+with expansion:
+ 104.0 != Approx( 100.0 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( 104.0 == Approx(100.0).margin(5) )
+with expansion:
+ 104.0 == Approx( 100.0 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( 104.0 == Approx(100.0).margin(4) )
+with expansion:
+ 104.0 == Approx( 100.0 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( 104.0 != Approx(100.0).margin(3) )
+with expansion:
+ 104.0 != Approx( 100.0 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( 100.3 != Approx(100.0) )
+with expansion:
+ 100.3 != Approx( 100.0 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( 100.3 == Approx(100.0).margin(0.5) )
+with expansion:
+ 100.3 == Approx( 100.0 )
+
+-------------------------------------------------------------------------------
+An empty test with no assertions
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+
+No assertions in test case 'An empty test with no assertions'
+
+-------------------------------------------------------------------------------
+An expression with side-effects should only be evaluated once
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( i++ == 7 )
+with expansion:
+ 7 == 7
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( i++ == 8 )
+with expansion:
+ 8 == 8
+
+-------------------------------------------------------------------------------
+An unchecked exception reports the line of the last assertion
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>:
+PASSED:
+ CHECK( 1 == 1 )
+
+Exception.tests.cpp:<line number>: FAILED:
+ {Unknown expression after the reported line}
+due to unexpected exception with message:
+ unexpected exception
+
+-------------------------------------------------------------------------------
+Anonymous test case 1
+-------------------------------------------------------------------------------
+VariadicMacros.tests.cpp:<line number>
+...............................................................................
+
+VariadicMacros.tests.cpp:<line number>:
+PASSED:
+with message:
+ anonymous test case
+
+-------------------------------------------------------------------------------
+Approx setters validate their arguments
+-------------------------------------------------------------------------------
+Approx.tests.cpp:<line number>
+...............................................................................
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_NOTHROW( Approx(0).margin(0) )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_NOTHROW( Approx(0).margin(1234656) )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THROWS_AS( Approx(0).margin(-2), std::domain_error )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_NOTHROW( Approx(0).epsilon(0) )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_NOTHROW( Approx(0).epsilon(1) )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THROWS_AS( Approx(0).epsilon(-0.001), std::domain_error )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THROWS_AS( Approx(0).epsilon(1.0001), std::domain_error )
+
+-------------------------------------------------------------------------------
+Approx with exactly-representable margin
+-------------------------------------------------------------------------------
+Approx.tests.cpp:<line number>
+...............................................................................
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ CHECK( 0.25f == Approx(0.0f).margin(0.25f) )
+with expansion:
+ 0.25f == Approx( 0.0 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ CHECK( 0.0f == Approx(0.25f).margin(0.25f) )
+with expansion:
+ 0.0f == Approx( 0.25 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ CHECK( 0.5f == Approx(0.25f).margin(0.25f) )
+with expansion:
+ 0.5f == Approx( 0.25 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ CHECK( 245.0f == Approx(245.25f).margin(0.25f) )
+with expansion:
+ 245.0f == Approx( 245.25 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ CHECK( 245.5f == Approx(245.25f).margin(0.25f) )
+with expansion:
+ 245.5f == Approx( 245.25 )
+
+-------------------------------------------------------------------------------
+Approximate PI
+-------------------------------------------------------------------------------
+Approx.tests.cpp:<line number>
+...............................................................................
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( divide( 22, 7 ) == Approx( 3.141 ).epsilon( 0.001 ) )
+with expansion:
+ 3.1428571429 == Approx( 3.141 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( divide( 22, 7 ) != Approx( 3.141 ).epsilon( 0.0001 ) )
+with expansion:
+ 3.1428571429 != Approx( 3.141 )
+
+-------------------------------------------------------------------------------
+Approximate comparisons with different epsilons
+-------------------------------------------------------------------------------
+Approx.tests.cpp:<line number>
+...............................................................................
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( d != Approx( 1.231 ) )
+with expansion:
+ 1.23 != Approx( 1.231 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( d == Approx( 1.231 ).epsilon( 0.1 ) )
+with expansion:
+ 1.23 == Approx( 1.231 )
+
+-------------------------------------------------------------------------------
+Approximate comparisons with floats
+-------------------------------------------------------------------------------
+Approx.tests.cpp:<line number>
+...............................................................................
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( 1.23f == Approx( 1.23f ) )
+with expansion:
+ 1.23f == Approx( 1.2300000191 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( 0.0f == Approx( 0.0f ) )
+with expansion:
+ 0.0f == Approx( 0.0 )
+
+-------------------------------------------------------------------------------
+Approximate comparisons with ints
+-------------------------------------------------------------------------------
+Approx.tests.cpp:<line number>
+...............................................................................
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( 1 == Approx( 1 ) )
+with expansion:
+ 1 == Approx( 1.0 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( 0 == Approx( 0 ) )
+with expansion:
+ 0 == Approx( 0.0 )
+
+-------------------------------------------------------------------------------
+Approximate comparisons with mixed numeric types
+-------------------------------------------------------------------------------
+Approx.tests.cpp:<line number>
+...............................................................................
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( 1.0f == Approx( 1 ) )
+with expansion:
+ 1.0f == Approx( 1.0 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( 0 == Approx( dZero) )
+with expansion:
+ 0 == Approx( 0.0 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( 0 == Approx( dSmall ).margin( 0.001 ) )
+with expansion:
+ 0 == Approx( 0.00001 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( 1.234f == Approx( dMedium ) )
+with expansion:
+ 1.234f == Approx( 1.234 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( dMedium == Approx( 1.234f ) )
+with expansion:
+ 1.234 == Approx( 1.2339999676 )
+
+-------------------------------------------------------------------------------
+Assertions then sections
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( true )
+
+-------------------------------------------------------------------------------
+Assertions then sections
+ A section
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( true )
+
+-------------------------------------------------------------------------------
+Assertions then sections
+ A section
+ Another section
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( true )
+
+-------------------------------------------------------------------------------
+Assertions then sections
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( true )
+
+-------------------------------------------------------------------------------
+Assertions then sections
+ A section
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( true )
+
+-------------------------------------------------------------------------------
+Assertions then sections
+ A section
+ Another other section
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( true )
+
+-------------------------------------------------------------------------------
+Assorted miscellaneous tests
+-------------------------------------------------------------------------------
+Approx.tests.cpp:<line number>
+...............................................................................
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( INFINITY == Approx(INFINITY) )
+with expansion:
+ inff == Approx( inf )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( NAN != Approx(NAN) )
+with expansion:
+ nanf != Approx( nan )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_FALSE( NAN == Approx(NAN) )
+with expansion:
+ !(nanf == Approx( nan ))
+
+-------------------------------------------------------------------------------
+Bitfields can be captured (#1027)
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( y.v == 0 )
+with expansion:
+ 0 == 0
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( 0 == y.v )
+with expansion:
+ 0 == 0
+
+-------------------------------------------------------------------------------
+Capture and info messages
+ Capture should stringify like assertions
+-------------------------------------------------------------------------------
+ToStringGeneral.tests.cpp:<line number>
+...............................................................................
+
+ToStringGeneral.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( true )
+with message:
+ i := 2
+
+-------------------------------------------------------------------------------
+Capture and info messages
+ Info should NOT stringify the way assertions do
+-------------------------------------------------------------------------------
+ToStringGeneral.tests.cpp:<line number>
+...............................................................................
+
+ToStringGeneral.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( true )
+with message:
+ 3
+
+-------------------------------------------------------------------------------
+Character pretty printing
+ Specifically escaped
+-------------------------------------------------------------------------------
+ToStringGeneral.tests.cpp:<line number>
+...............................................................................
+
+ToStringGeneral.tests.cpp:<line number>:
+PASSED:
+ CHECK( tab == '\t' )
+with expansion:
+ '\t' == '\t'
+
+ToStringGeneral.tests.cpp:<line number>:
+PASSED:
+ CHECK( newline == '\n' )
+with expansion:
+ '\n' == '\n'
+
+ToStringGeneral.tests.cpp:<line number>:
+PASSED:
+ CHECK( carr_return == '\r' )
+with expansion:
+ '\r' == '\r'
+
+ToStringGeneral.tests.cpp:<line number>:
+PASSED:
+ CHECK( form_feed == '\f' )
+with expansion:
+ '\f' == '\f'
+
+-------------------------------------------------------------------------------
+Character pretty printing
+ General chars
+-------------------------------------------------------------------------------
+ToStringGeneral.tests.cpp:<line number>
+...............................................................................
+
+ToStringGeneral.tests.cpp:<line number>:
+PASSED:
+ CHECK( space == ' ' )
+with expansion:
+ ' ' == ' '
+
+ToStringGeneral.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( c == chars[i] )
+with expansion:
+ 'a' == 'a'
+
+ToStringGeneral.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( c == chars[i] )
+with expansion:
+ 'z' == 'z'
+
+ToStringGeneral.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( c == chars[i] )
+with expansion:
+ 'A' == 'A'
+
+ToStringGeneral.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( c == chars[i] )
+with expansion:
+ 'Z' == 'Z'
+
+-------------------------------------------------------------------------------
+Character pretty printing
+ Low ASCII
+-------------------------------------------------------------------------------
+ToStringGeneral.tests.cpp:<line number>
+...............................................................................
+
+ToStringGeneral.tests.cpp:<line number>:
+PASSED:
+ CHECK( null_terminator == '\0' )
+with expansion:
+ 0 == 0
+
+ToStringGeneral.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( c == i )
+with expansion:
+ 2 == 2
+
+ToStringGeneral.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( c == i )
+with expansion:
+ 3 == 3
+
+ToStringGeneral.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( c == i )
+with expansion:
+ 4 == 4
+
+ToStringGeneral.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( c == i )
+with expansion:
+ 5 == 5
+
+-------------------------------------------------------------------------------
+Commas in various macros are allowed
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THROWS( std::vector<constructor_throws>{constructor_throws{}, constructor_throws{}} )
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ CHECK_THROWS( std::vector<constructor_throws>{constructor_throws{}, constructor_throws{}} )
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_NOTHROW( std::vector<int>{1, 2, 3} == std::vector<int>{1, 2, 3} )
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ CHECK_NOTHROW( std::vector<int>{1, 2, 3} == std::vector<int>{1, 2, 3} )
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( std::vector<int>{1, 2} == std::vector<int>{1, 2} )
+with expansion:
+ { 1, 2 } == { 1, 2 }
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ CHECK( std::vector<int>{1, 2} == std::vector<int>{1, 2} )
+with expansion:
+ { 1, 2 } == { 1, 2 }
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_FALSE( std::vector<int>{1, 2} == std::vector<int>{1, 2, 3} )
+with expansion:
+ !({ 1, 2 } == { 1, 2, 3 })
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ CHECK_FALSE( std::vector<int>{1, 2} == std::vector<int>{1, 2, 3} )
+with expansion:
+ !({ 1, 2 } == { 1, 2, 3 })
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ CHECK_NOFAIL( std::vector<int>{1, 2} == std::vector<int>{1, 2} )
+with expansion:
+ { 1, 2 } == { 1, 2 }
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ CHECKED_IF( std::vector<int>{1, 2} == std::vector<int>{1, 2} )
+with expansion:
+ { 1, 2 } == { 1, 2 }
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( true )
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ CHECKED_ELSE( std::vector<int>{1, 2} == std::vector<int>{1, 2} )
+with expansion:
+ { 1, 2 } == { 1, 2 }
+
+-------------------------------------------------------------------------------
+Comparing function pointers
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( a )
+with expansion:
+ 0x<hex digits>
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( a == &foo )
+with expansion:
+ 0x<hex digits> == 0x<hex digits>
+
+-------------------------------------------------------------------------------
+Comparison with explicitly convertible types
+-------------------------------------------------------------------------------
+Approx.tests.cpp:<line number>
+...............................................................................
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( td == Approx(10.0) )
+with expansion:
+ StrongDoubleTypedef(10) == Approx( 10.0 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( Approx(10.0) == td )
+with expansion:
+ Approx( 10.0 ) == StrongDoubleTypedef(10)
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( td != Approx(11.0) )
+with expansion:
+ StrongDoubleTypedef(10) != Approx( 11.0 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( Approx(11.0) != td )
+with expansion:
+ Approx( 11.0 ) != StrongDoubleTypedef(10)
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( td <= Approx(10.0) )
+with expansion:
+ StrongDoubleTypedef(10) <= Approx( 10.0 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( td <= Approx(11.0) )
+with expansion:
+ StrongDoubleTypedef(10) <= Approx( 11.0 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( Approx(10.0) <= td )
+with expansion:
+ Approx( 10.0 ) <= StrongDoubleTypedef(10)
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( Approx(9.0) <= td )
+with expansion:
+ Approx( 9.0 ) <= StrongDoubleTypedef(10)
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( td >= Approx(9.0) )
+with expansion:
+ StrongDoubleTypedef(10) >= Approx( 9.0 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( td >= Approx(td) )
+with expansion:
+ StrongDoubleTypedef(10) >= Approx( 10.0 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( Approx(td) >= td )
+with expansion:
+ Approx( 10.0 ) >= StrongDoubleTypedef(10)
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( Approx(11.0) >= td )
+with expansion:
+ Approx( 11.0 ) >= StrongDoubleTypedef(10)
+
+-------------------------------------------------------------------------------
+Comparisons between ints where one side is computed
+-------------------------------------------------------------------------------
+Condition.tests.cpp:<line number>
+...............................................................................
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ CHECK( 54 == 6*9 )
+with expansion:
+ 54 == 54
+
+-------------------------------------------------------------------------------
+Comparisons between unsigned ints and negative signed ints match c++ standard
+behaviour
+-------------------------------------------------------------------------------
+Condition.tests.cpp:<line number>
+...............................................................................
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ CHECK( ( -1 > 2u ) )
+with expansion:
+ true
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ CHECK( -1 > 2u )
+with expansion:
+ -1 > 2
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ CHECK( ( 2u < -1 ) )
+with expansion:
+ true
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ CHECK( 2u < -1 )
+with expansion:
+ 2 < -1
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ CHECK( ( minInt > 2u ) )
+with expansion:
+ true
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ CHECK( minInt > 2u )
+with expansion:
+ -2147483648 > 2
+
+-------------------------------------------------------------------------------
+Comparisons with int literals don't warn when mixing signed/ unsigned
+-------------------------------------------------------------------------------
+Condition.tests.cpp:<line number>
+...............................................................................
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( i == 1 )
+with expansion:
+ 1 == 1
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ui == 2 )
+with expansion:
+ 2 == 2
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( l == 3 )
+with expansion:
+ 3 == 3
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ul == 4 )
+with expansion:
+ 4 == 4
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( c == 5 )
+with expansion:
+ 5 == 5
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( uc == 6 )
+with expansion:
+ 6 == 6
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( 1 == i )
+with expansion:
+ 1 == 1
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( 2 == ui )
+with expansion:
+ 2 == 2
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( 3 == l )
+with expansion:
+ 3 == 3
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( 4 == ul )
+with expansion:
+ 4 == 4
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( 5 == c )
+with expansion:
+ 5 == 5
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( 6 == uc )
+with expansion:
+ 6 == 6
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( (std::numeric_limits<uint32_t>::max)() > ul )
+with expansion:
+ 4294967295 (0x<hex digits>) > 4
+
+-------------------------------------------------------------------------------
+Contains string matcher
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( testStringForMatching(), Contains("not there", Catch::CaseSensitive::No) )
+with expansion:
+ "this string contains 'abc' as a substring" contains: "not there" (case
+ insensitive)
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( testStringForMatching(), Contains("STRING") )
+with expansion:
+ "this string contains 'abc' as a substring" contains: "STRING"
+
+-------------------------------------------------------------------------------
+Custom exceptions can be translated when testing for nothrow
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+ REQUIRE_NOTHROW( throwCustom() )
+due to unexpected exception with message:
+ custom exception - not std
+
+-------------------------------------------------------------------------------
+Custom exceptions can be translated when testing for throwing as something else
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+ REQUIRE_THROWS_AS( throwCustom(), std::exception )
+due to unexpected exception with message:
+ custom exception - not std
+
+-------------------------------------------------------------------------------
+Custom std-exceptions can be custom translated
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+due to unexpected exception with message:
+ custom std exception
+
+-------------------------------------------------------------------------------
+Default scale is invisible to comparison
+-------------------------------------------------------------------------------
+Approx.tests.cpp:<line number>
+...............................................................................
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( 101.000001 != Approx(100).epsilon(0.01) )
+with expansion:
+ 101.000001 != Approx( 100.0 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( std::pow(10, -5) != Approx(std::pow(10, -7)) )
+with expansion:
+ 0.00001 != Approx( 0.0000001 )
+
+-------------------------------------------------------------------------------
+EndsWith string matcher
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( testStringForMatching(), EndsWith("Substring") )
+with expansion:
+ "this string contains 'abc' as a substring" ends with: "Substring"
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( testStringForMatching(), EndsWith("this", Catch::CaseSensitive::No) )
+with expansion:
+ "this string contains 'abc' as a substring" ends with: "this" (case
+ insensitive)
+
+-------------------------------------------------------------------------------
+Epsilon only applies to Approx's value
+-------------------------------------------------------------------------------
+Approx.tests.cpp:<line number>
+...............................................................................
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( 101.01 != Approx(100).epsilon(0.01) )
+with expansion:
+ 101.01 != Approx( 100.0 )
+
+-------------------------------------------------------------------------------
+Equality checks that should fail
+-------------------------------------------------------------------------------
+Condition.tests.cpp:<line number>
+...............................................................................
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.int_seven == 6 )
+with expansion:
+ 7 == 6
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.int_seven == 8 )
+with expansion:
+ 7 == 8
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.int_seven == 0 )
+with expansion:
+ 7 == 0
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.float_nine_point_one == Approx( 9.11f ) )
+with expansion:
+ 9.1f == Approx( 9.1099996567 )
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.float_nine_point_one == Approx( 9.0f ) )
+with expansion:
+ 9.1f == Approx( 9.0 )
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.float_nine_point_one == Approx( 1 ) )
+with expansion:
+ 9.1f == Approx( 1.0 )
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.float_nine_point_one == Approx( 0 ) )
+with expansion:
+ 9.1f == Approx( 0.0 )
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.double_pi == Approx( 3.1415 ) )
+with expansion:
+ 3.1415926535 == Approx( 3.1415 )
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.str_hello == "goodbye" )
+with expansion:
+ "hello" == "goodbye"
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.str_hello == "hell" )
+with expansion:
+ "hello" == "hell"
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.str_hello == "hello1" )
+with expansion:
+ "hello" == "hello1"
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.str_hello.size() == 6 )
+with expansion:
+ 5 == 6
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( x == Approx( 1.301 ) )
+with expansion:
+ 1.3 == Approx( 1.301 )
+
+-------------------------------------------------------------------------------
+Equality checks that should succeed
+-------------------------------------------------------------------------------
+Condition.tests.cpp:<line number>
+...............................................................................
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.int_seven == 7 )
+with expansion:
+ 7 == 7
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.float_nine_point_one == Approx( 9.1f ) )
+with expansion:
+ 9.1f == Approx( 9.1000003815 )
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.double_pi == Approx( 3.1415926535 ) )
+with expansion:
+ 3.1415926535 == Approx( 3.1415926535 )
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.str_hello == "hello" )
+with expansion:
+ "hello" == "hello"
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( "hello" == data.str_hello )
+with expansion:
+ "hello" == "hello"
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.str_hello.size() == 5 )
+with expansion:
+ 5 == 5
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( x == Approx( 1.3 ) )
+with expansion:
+ 1.3 == Approx( 1.3 )
+
+-------------------------------------------------------------------------------
+Equals
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( testStringForMatching(), Equals("this string contains 'abc' as a substring") )
+with expansion:
+ "this string contains 'abc' as a substring" equals: "this string contains
+ 'abc' as a substring"
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( testStringForMatching(), Equals("this string contains 'ABC' as a substring", Catch::CaseSensitive::No) )
+with expansion:
+ "this string contains 'abc' as a substring" equals: "this string contains
+ 'abc' as a substring" (case insensitive)
+
+-------------------------------------------------------------------------------
+Equals string matcher
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( testStringForMatching(), Equals("this string contains 'ABC' as a substring") )
+with expansion:
+ "this string contains 'abc' as a substring" equals: "this string contains
+ 'ABC' as a substring"
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( testStringForMatching(), Equals("something else", Catch::CaseSensitive::No) )
+with expansion:
+ "this string contains 'abc' as a substring" equals: "something else" (case
+ insensitive)
+
+-------------------------------------------------------------------------------
+Exception matchers that fail
+ No exception
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{1} )
+because no exception was thrown where one was expected:
+
+Matchers.tests.cpp:<line number>: FAILED:
+ REQUIRE_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{1} )
+because no exception was thrown where one was expected:
+
+-------------------------------------------------------------------------------
+Exception matchers that fail
+ Type mismatch
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THROWS_MATCHES( throwsAsInt(1), SpecialException, ExceptionMatcher{1} )
+due to unexpected exception with message:
+ Unknown exception
+
+Matchers.tests.cpp:<line number>: FAILED:
+ REQUIRE_THROWS_MATCHES( throwsAsInt(1), SpecialException, ExceptionMatcher{1} )
+due to unexpected exception with message:
+ Unknown exception
+
+-------------------------------------------------------------------------------
+Exception matchers that fail
+ Contents are wrong
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THROWS_MATCHES( throws(3), SpecialException, ExceptionMatcher{1} )
+with expansion:
+ {?} special exception has value of 1
+
+Matchers.tests.cpp:<line number>: FAILED:
+ REQUIRE_THROWS_MATCHES( throws(4), SpecialException, ExceptionMatcher{1} )
+with expansion:
+ {?} special exception has value of 1
+
+-------------------------------------------------------------------------------
+Exception matchers that succeed
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ CHECK_THROWS_MATCHES( throws(1), SpecialException, ExceptionMatcher{1} )
+with expansion:
+ {?} special exception has value of 1
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THROWS_MATCHES( throws(2), SpecialException, ExceptionMatcher{2} )
+with expansion:
+ {?} special exception has value of 2
+
+-------------------------------------------------------------------------------
+Exception messages can be tested for
+ exact match
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THROWS_WITH( thisThrows(), "expected exception" )
+with expansion:
+ "expected exception" equals: "expected exception"
+
+-------------------------------------------------------------------------------
+Exception messages can be tested for
+ different case
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THROWS_WITH( thisThrows(), Equals( "expecteD Exception", Catch::CaseSensitive::No ) )
+with expansion:
+ "expected exception" equals: "expected exception" (case insensitive)
+
+-------------------------------------------------------------------------------
+Exception messages can be tested for
+ wildcarded
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THROWS_WITH( thisThrows(), StartsWith( "expected" ) )
+with expansion:
+ "expected exception" starts with: "expected"
+
+Exception.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THROWS_WITH( thisThrows(), EndsWith( "exception" ) )
+with expansion:
+ "expected exception" ends with: "exception"
+
+Exception.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THROWS_WITH( thisThrows(), Contains( "except" ) )
+with expansion:
+ "expected exception" contains: "except"
+
+Exception.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THROWS_WITH( thisThrows(), Contains( "exCept", Catch::CaseSensitive::No ) )
+with expansion:
+ "expected exception" contains: "except" (case insensitive)
+
+-------------------------------------------------------------------------------
+Expected exceptions that don't throw or unexpected exceptions fail the test
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+ CHECK_THROWS_AS( thisThrows(), std::string )
+due to unexpected exception with message:
+ expected exception
+
+Exception.tests.cpp:<line number>: FAILED:
+ CHECK_THROWS_AS( thisDoesntThrow(), std::domain_error )
+because no exception was thrown where one was expected:
+
+Exception.tests.cpp:<line number>: FAILED:
+ CHECK_NOTHROW( thisThrows() )
+due to unexpected exception with message:
+ expected exception
+
+-------------------------------------------------------------------------------
+FAIL aborts the test
+-------------------------------------------------------------------------------
+Message.tests.cpp:<line number>
+...............................................................................
+
+Message.tests.cpp:<line number>: FAILED:
+explicitly with message:
+ This is a failure
+
+-------------------------------------------------------------------------------
+FAIL does not require an argument
+-------------------------------------------------------------------------------
+Message.tests.cpp:<line number>
+...............................................................................
+
+Message.tests.cpp:<line number>: FAILED:
+
+-------------------------------------------------------------------------------
+FAIL_CHECK does not abort the test
+-------------------------------------------------------------------------------
+Message.tests.cpp:<line number>
+...............................................................................
+
+Message.tests.cpp:<line number>: FAILED:
+explicitly with message:
+ This is a failure
+
+Message.tests.cpp:<line number>:
+warning:
+ This message appears in the output
+
+-------------------------------------------------------------------------------
+Factorials are computed
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( Factorial(0) == 1 )
+with expansion:
+ 1 == 1
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( Factorial(1) == 1 )
+with expansion:
+ 1 == 1
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( Factorial(2) == 2 )
+with expansion:
+ 2 == 2
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( Factorial(3) == 6 )
+with expansion:
+ 6 == 6
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( Factorial(10) == 3628800 )
+with expansion:
+ 3628800 (0x<hex digits>) == 3628800 (0x<hex digits>)
+
+-------------------------------------------------------------------------------
+Floating point matchers: double
+ Margin
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( 1., WithinAbs(1., 0) )
+with expansion:
+ 1.0 is within 0.0 of 1.0
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( 0., WithinAbs(1., 1) )
+with expansion:
+ 0.0 is within 1.0 of 1.0
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( 0., !WithinAbs(1., 0.99) )
+with expansion:
+ 0.0 not is within 0.99 of 1.0
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( 0., !WithinAbs(1., 0.99) )
+with expansion:
+ 0.0 not is within 0.99 of 1.0
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( NAN, !WithinAbs(NAN, 0) )
+with expansion:
+ nanf not is within 0.0 of nan
+
+-------------------------------------------------------------------------------
+Floating point matchers: double
+ ULPs
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( 1., WithinULP(1., 0) )
+with expansion:
+ 1.0 is within 0 ULPs of 1.0
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( std::nextafter(1., 2.), WithinULP(1., 1) )
+with expansion:
+ 1.0 is within 1 ULPs of 1.0
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( std::nextafter(1., 0.), WithinULP(1., 1) )
+with expansion:
+ 1.0 is within 1 ULPs of 1.0
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( std::nextafter(1., 2.), !WithinULP(1., 0) )
+with expansion:
+ 1.0 not is within 0 ULPs of 1.0
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( 1., WithinULP(1., 0) )
+with expansion:
+ 1.0 is within 0 ULPs of 1.0
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( -0., WithinULP(0., 0) )
+with expansion:
+ -0.0 is within 0 ULPs of 0.0
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( NAN, !WithinULP(NAN, 123) )
+with expansion:
+ nanf not is within 123 ULPs of nanf
+
+-------------------------------------------------------------------------------
+Floating point matchers: double
+ Composed
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( 1., WithinAbs(1., 0.5) || WithinULP(2., 1) )
+with expansion:
+ 1.0 ( is within 0.5 of 1.0 or is within 1 ULPs of 2.0 )
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( 1., WithinAbs(2., 0.5) || WithinULP(1., 0) )
+with expansion:
+ 1.0 ( is within 0.5 of 2.0 or is within 0 ULPs of 1.0 )
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( NAN, !(WithinAbs(NAN, 100) || WithinULP(NAN, 123)) )
+with expansion:
+ nanf not ( is within 100.0 of nan or is within 123 ULPs of nanf )
+
+-------------------------------------------------------------------------------
+Floating point matchers: double
+ Constructor validation
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_NOTHROW( WithinAbs(1., 0.) )
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THROWS_AS( WithinAbs(1., -1.), std::domain_error )
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_NOTHROW( WithinULP(1., 0) )
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THROWS_AS( WithinULP(1., -1), std::domain_error )
+
+-------------------------------------------------------------------------------
+Floating point matchers: float
+ Margin
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( 1.f, WithinAbs(1.f, 0) )
+with expansion:
+ 1.0f is within 0.0 of 1.0
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( 0.f, WithinAbs(1.f, 1) )
+with expansion:
+ 0.0f is within 1.0 of 1.0
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( 0.f, !WithinAbs(1.f, 0.99f) )
+with expansion:
+ 0.0f not is within 0.9900000095 of 1.0
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( 0.f, !WithinAbs(1.f, 0.99f) )
+with expansion:
+ 0.0f not is within 0.9900000095 of 1.0
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( 0.f, WithinAbs(-0.f, 0) )
+with expansion:
+ 0.0f is within 0.0 of -0.0
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( NAN, !WithinAbs(NAN, 0) )
+with expansion:
+ nanf not is within 0.0 of nan
+
+-------------------------------------------------------------------------------
+Floating point matchers: float
+ ULPs
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( 1.f, WithinULP(1.f, 0) )
+with expansion:
+ 1.0f is within 0 ULPs of 1.0f
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( std::nextafter(1.f, 2.f), WithinULP(1.f, 1) )
+with expansion:
+ 1.0f is within 1 ULPs of 1.0f
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( std::nextafter(1.f, 0.f), WithinULP(1.f, 1) )
+with expansion:
+ 1.0f is within 1 ULPs of 1.0f
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( std::nextafter(1.f, 2.f), !WithinULP(1.f, 0) )
+with expansion:
+ 1.0f not is within 0 ULPs of 1.0f
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( 1.f, WithinULP(1.f, 0) )
+with expansion:
+ 1.0f is within 0 ULPs of 1.0f
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( -0.f, WithinULP(0.f, 0) )
+with expansion:
+ -0.0f is within 0 ULPs of 0.0f
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( NAN, !WithinULP(NAN, 123) )
+with expansion:
+ nanf not is within 123 ULPs of nanf
+
+-------------------------------------------------------------------------------
+Floating point matchers: float
+ Composed
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( 1.f, WithinAbs(1.f, 0.5) || WithinULP(1.f, 1) )
+with expansion:
+ 1.0f ( is within 0.5 of 1.0 or is within 1 ULPs of 1.0f )
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( 1.f, WithinAbs(2.f, 0.5) || WithinULP(1.f, 0) )
+with expansion:
+ 1.0f ( is within 0.5 of 2.0 or is within 0 ULPs of 1.0f )
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( NAN, !(WithinAbs(NAN, 100) || WithinULP(NAN, 123)) )
+with expansion:
+ nanf not ( is within 100.0 of nan or is within 123 ULPs of nanf )
+
+-------------------------------------------------------------------------------
+Floating point matchers: float
+ Constructor validation
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_NOTHROW( WithinAbs(1.f, 0.f) )
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THROWS_AS( WithinAbs(1.f, -1.f), std::domain_error )
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_NOTHROW( WithinULP(1.f, 0) )
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THROWS_AS( WithinULP(1.f, -1), std::domain_error )
+
+-------------------------------------------------------------------------------
+Greater-than inequalities with different epsilons
+-------------------------------------------------------------------------------
+Approx.tests.cpp:<line number>
+...............................................................................
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( d >= Approx( 1.22 ) )
+with expansion:
+ 1.23 >= Approx( 1.22 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( d >= Approx( 1.23 ) )
+with expansion:
+ 1.23 >= Approx( 1.23 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_FALSE( d >= Approx( 1.24 ) )
+with expansion:
+ !(1.23 >= Approx( 1.24 ))
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( d >= Approx( 1.24 ).epsilon(0.1) )
+with expansion:
+ 1.23 >= Approx( 1.24 )
+
+-------------------------------------------------------------------------------
+INFO and WARN do not abort tests
+-------------------------------------------------------------------------------
+Message.tests.cpp:<line number>
+...............................................................................
+
+Message.tests.cpp:<line number>:
+warning:
+ this is a message
+ this is a warning
+
+
+No assertions in test case 'INFO and WARN do not abort tests'
+
+-------------------------------------------------------------------------------
+INFO gets logged on failure
+-------------------------------------------------------------------------------
+Message.tests.cpp:<line number>
+...............................................................................
+
+Message.tests.cpp:<line number>: FAILED:
+ REQUIRE( a == 1 )
+with expansion:
+ 2 == 1
+with messages:
+ this message should be logged
+ so should this
+
+-------------------------------------------------------------------------------
+INFO gets logged on failure, even if captured before successful assertions
+-------------------------------------------------------------------------------
+Message.tests.cpp:<line number>
+...............................................................................
+
+Message.tests.cpp:<line number>:
+PASSED:
+ CHECK( a == 2 )
+with expansion:
+ 2 == 2
+with message:
+ this message may be logged later
+
+Message.tests.cpp:<line number>: FAILED:
+ CHECK( a == 1 )
+with expansion:
+ 2 == 1
+with messages:
+ this message may be logged later
+ this message should be logged
+
+Message.tests.cpp:<line number>: FAILED:
+ CHECK( a == 0 )
+with expansion:
+ 2 == 0
+with messages:
+ this message may be logged later
+ this message should be logged
+ and this, but later
+
+Message.tests.cpp:<line number>:
+PASSED:
+ CHECK( a == 2 )
+with expansion:
+ 2 == 2
+with messages:
+ this message may be logged later
+ this message should be logged
+ and this, but later
+ but not this
+
+-------------------------------------------------------------------------------
+INFO is reset for each loop
+-------------------------------------------------------------------------------
+Message.tests.cpp:<line number>
+...............................................................................
+
+Message.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( i < 10 )
+with expansion:
+ 0 < 10
+with messages:
+ current counter 0
+ i := 0
+
+Message.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( i < 10 )
+with expansion:
+ 1 < 10
+with messages:
+ current counter 1
+ i := 1
+
+Message.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( i < 10 )
+with expansion:
+ 2 < 10
+with messages:
+ current counter 2
+ i := 2
+
+Message.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( i < 10 )
+with expansion:
+ 3 < 10
+with messages:
+ current counter 3
+ i := 3
+
+Message.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( i < 10 )
+with expansion:
+ 4 < 10
+with messages:
+ current counter 4
+ i := 4
+
+Message.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( i < 10 )
+with expansion:
+ 5 < 10
+with messages:
+ current counter 5
+ i := 5
+
+Message.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( i < 10 )
+with expansion:
+ 6 < 10
+with messages:
+ current counter 6
+ i := 6
+
+Message.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( i < 10 )
+with expansion:
+ 7 < 10
+with messages:
+ current counter 7
+ i := 7
+
+Message.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( i < 10 )
+with expansion:
+ 8 < 10
+with messages:
+ current counter 8
+ i := 8
+
+Message.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( i < 10 )
+with expansion:
+ 9 < 10
+with messages:
+ current counter 9
+ i := 9
+
+Message.tests.cpp:<line number>: FAILED:
+ REQUIRE( i < 10 )
+with expansion:
+ 10 < 10
+with messages:
+ current counter 10
+ i := 10
+
+-------------------------------------------------------------------------------
+Inequality checks that should fail
+-------------------------------------------------------------------------------
+Condition.tests.cpp:<line number>
+...............................................................................
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.int_seven != 7 )
+with expansion:
+ 7 != 7
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.float_nine_point_one != Approx( 9.1f ) )
+with expansion:
+ 9.1f != Approx( 9.1000003815 )
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.double_pi != Approx( 3.1415926535 ) )
+with expansion:
+ 3.1415926535 != Approx( 3.1415926535 )
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.str_hello != "hello" )
+with expansion:
+ "hello" != "hello"
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.str_hello.size() != 5 )
+with expansion:
+ 5 != 5
+
+-------------------------------------------------------------------------------
+Inequality checks that should succeed
+-------------------------------------------------------------------------------
+Condition.tests.cpp:<line number>
+...............................................................................
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.int_seven != 6 )
+with expansion:
+ 7 != 6
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.int_seven != 8 )
+with expansion:
+ 7 != 8
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.float_nine_point_one != Approx( 9.11f ) )
+with expansion:
+ 9.1f != Approx( 9.1099996567 )
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.float_nine_point_one != Approx( 9.0f ) )
+with expansion:
+ 9.1f != Approx( 9.0 )
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.float_nine_point_one != Approx( 1 ) )
+with expansion:
+ 9.1f != Approx( 1.0 )
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.float_nine_point_one != Approx( 0 ) )
+with expansion:
+ 9.1f != Approx( 0.0 )
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.double_pi != Approx( 3.1415 ) )
+with expansion:
+ 3.1415926535 != Approx( 3.1415 )
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.str_hello != "goodbye" )
+with expansion:
+ "hello" != "goodbye"
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.str_hello != "hell" )
+with expansion:
+ "hello" != "hell"
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.str_hello != "hello1" )
+with expansion:
+ "hello" != "hello1"
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.str_hello.size() != 6 )
+with expansion:
+ 5 != 6
+
+-------------------------------------------------------------------------------
+Less-than inequalities with different epsilons
+-------------------------------------------------------------------------------
+Approx.tests.cpp:<line number>
+...............................................................................
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( d <= Approx( 1.24 ) )
+with expansion:
+ 1.23 <= Approx( 1.24 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( d <= Approx( 1.23 ) )
+with expansion:
+ 1.23 <= Approx( 1.23 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_FALSE( d <= Approx( 1.22 ) )
+with expansion:
+ !(1.23 <= Approx( 1.22 ))
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( d <= Approx( 1.22 ).epsilon(0.1) )
+with expansion:
+ 1.23 <= Approx( 1.22 )
+
+-------------------------------------------------------------------------------
+ManuallyRegistered
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+with message:
+ was called
+
+-------------------------------------------------------------------------------
+Matchers can be (AllOf) composed with the && operator
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( testStringForMatching(), Contains("string") && Contains("abc") && Contains("substring") && Contains("contains") )
+with expansion:
+ "this string contains 'abc' as a substring" ( contains: "string" and
+ contains: "abc" and contains: "substring" and contains: "contains" )
+
+-------------------------------------------------------------------------------
+Matchers can be (AnyOf) composed with the || operator
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( testStringForMatching(), Contains("string") || Contains("different") || Contains("random") )
+with expansion:
+ "this string contains 'abc' as a substring" ( contains: "string" or contains:
+ "different" or contains: "random" )
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( testStringForMatching2(), Contains("string") || Contains("different") || Contains("random") )
+with expansion:
+ "some completely different text that contains one common word" ( contains:
+ "string" or contains: "different" or contains: "random" )
+
+-------------------------------------------------------------------------------
+Matchers can be composed with both && and ||
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( testStringForMatching(), (Contains("string") || Contains("different")) && Contains("substring") )
+with expansion:
+ "this string contains 'abc' as a substring" ( ( contains: "string" or
+ contains: "different" ) and contains: "substring" )
+
+-------------------------------------------------------------------------------
+Matchers can be composed with both && and || - failing
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( testStringForMatching(), (Contains("string") || Contains("different")) && Contains("random") )
+with expansion:
+ "this string contains 'abc' as a substring" ( ( contains: "string" or
+ contains: "different" ) and contains: "random" )
+
+-------------------------------------------------------------------------------
+Matchers can be negated (Not) with the ! operator
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( testStringForMatching(), !Contains("different") )
+with expansion:
+ "this string contains 'abc' as a substring" not contains: "different"
+
+-------------------------------------------------------------------------------
+Matchers can be negated (Not) with the ! operator - failing
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( testStringForMatching(), !Contains("substring") )
+with expansion:
+ "this string contains 'abc' as a substring" not contains: "substring"
+
+-------------------------------------------------------------------------------
+Mismatching exception messages failing the test
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THROWS_WITH( thisThrows(), "expected exception" )
+with expansion:
+ "expected exception" equals: "expected exception"
+
+Exception.tests.cpp:<line number>: FAILED:
+ REQUIRE_THROWS_WITH( thisThrows(), "should fail" )
+with expansion:
+ "expected exception" equals: "should fail"
+
+-------------------------------------------------------------------------------
+Nice descriptive name
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+warning:
+ This one ran
+
+
+No assertions in test case 'Nice descriptive name'
+
+-------------------------------------------------------------------------------
+Non-std exceptions can be translated
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+due to unexpected exception with message:
+ custom exception
+
+-------------------------------------------------------------------------------
+Objects that evaluated in boolean contexts can be checked
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ CHECK( True )
+with expansion:
+ {?}
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ CHECK( !False )
+with expansion:
+ true
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ CHECK_FALSE( False )
+with expansion:
+ !{?}
+
+-------------------------------------------------------------------------------
+Ordering comparison checks that should fail
+-------------------------------------------------------------------------------
+Condition.tests.cpp:<line number>
+...............................................................................
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.int_seven > 7 )
+with expansion:
+ 7 > 7
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.int_seven < 7 )
+with expansion:
+ 7 < 7
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.int_seven > 8 )
+with expansion:
+ 7 > 8
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.int_seven < 6 )
+with expansion:
+ 7 < 6
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.int_seven < 0 )
+with expansion:
+ 7 < 0
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.int_seven < -1 )
+with expansion:
+ 7 < -1
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.int_seven >= 8 )
+with expansion:
+ 7 >= 8
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.int_seven <= 6 )
+with expansion:
+ 7 <= 6
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.float_nine_point_one < 9 )
+with expansion:
+ 9.1f < 9
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.float_nine_point_one > 10 )
+with expansion:
+ 9.1f > 10
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.float_nine_point_one > 9.2 )
+with expansion:
+ 9.1f > 9.2
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.str_hello > "hello" )
+with expansion:
+ "hello" > "hello"
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.str_hello < "hello" )
+with expansion:
+ "hello" < "hello"
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.str_hello > "hellp" )
+with expansion:
+ "hello" > "hellp"
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.str_hello > "z" )
+with expansion:
+ "hello" > "z"
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.str_hello < "hellm" )
+with expansion:
+ "hello" < "hellm"
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.str_hello < "a" )
+with expansion:
+ "hello" < "a"
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.str_hello >= "z" )
+with expansion:
+ "hello" >= "z"
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( data.str_hello <= "a" )
+with expansion:
+ "hello" <= "a"
+
+-------------------------------------------------------------------------------
+Ordering comparison checks that should succeed
+-------------------------------------------------------------------------------
+Condition.tests.cpp:<line number>
+...............................................................................
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.int_seven < 8 )
+with expansion:
+ 7 < 8
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.int_seven > 6 )
+with expansion:
+ 7 > 6
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.int_seven > 0 )
+with expansion:
+ 7 > 0
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.int_seven > -1 )
+with expansion:
+ 7 > -1
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.int_seven >= 7 )
+with expansion:
+ 7 >= 7
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.int_seven >= 6 )
+with expansion:
+ 7 >= 6
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.int_seven <= 7 )
+with expansion:
+ 7 <= 7
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.int_seven <= 8 )
+with expansion:
+ 7 <= 8
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.float_nine_point_one > 9 )
+with expansion:
+ 9.1f > 9
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.float_nine_point_one < 10 )
+with expansion:
+ 9.1f < 10
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.float_nine_point_one < 9.2 )
+with expansion:
+ 9.1f < 9.2
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.str_hello <= "hello" )
+with expansion:
+ "hello" <= "hello"
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.str_hello >= "hello" )
+with expansion:
+ "hello" >= "hello"
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.str_hello < "hellp" )
+with expansion:
+ "hello" < "hellp"
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.str_hello < "zebra" )
+with expansion:
+ "hello" < "zebra"
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.str_hello > "hellm" )
+with expansion:
+ "hello" > "hellm"
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data.str_hello > "a" )
+with expansion:
+ "hello" > "a"
+
+-------------------------------------------------------------------------------
+Output from all sections is reported
+ one
+-------------------------------------------------------------------------------
+Message.tests.cpp:<line number>
+...............................................................................
+
+Message.tests.cpp:<line number>: FAILED:
+explicitly with message:
+ Message from section one
+
+-------------------------------------------------------------------------------
+Output from all sections is reported
+ two
+-------------------------------------------------------------------------------
+Message.tests.cpp:<line number>
+...............................................................................
+
+Message.tests.cpp:<line number>: FAILED:
+explicitly with message:
+ Message from section two
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ Empty test spec should have no filters
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == false )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ Test spec from empty string should have no filters
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches(tcA ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == false )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ Test spec from just a comma should have no filters
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == false )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ Test spec from name should have one filter
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == true )
+with expansion:
+ true == true
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ Test spec from quoted name should have one filter
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == true )
+with expansion:
+ true == true
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ Test spec from name should have one filter
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcC ) == false )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ Wildcard at the start
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcC ) == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcD ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( parseTestSpec( "*a" ).matches( tcA ) == true )
+with expansion:
+ true == true
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ Wildcard at the end
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcC ) == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcD ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( parseTestSpec( "a*" ).matches( tcA ) == true )
+with expansion:
+ true == true
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ Wildcard at both ends
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcC ) == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcD ) == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( parseTestSpec( "*a*" ).matches( tcA ) == true )
+with expansion:
+ true == true
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ Redundant wildcard at the start
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == false )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ Redundant wildcard at the end
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == false )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ Redundant wildcard at both ends
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == false )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ Wildcard at both ends, redundant at start
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcC ) == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcD ) == true )
+with expansion:
+ true == true
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ Just wildcard
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcC ) == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcD ) == true )
+with expansion:
+ true == true
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ Single tag
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcC ) == false )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ Single tag, two matches
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcC ) == true )
+with expansion:
+ true == true
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ Two tags
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcC ) == true )
+with expansion:
+ true == true
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ Two tags, spare separated
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcC ) == true )
+with expansion:
+ true == true
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ Wildcarded name and tag
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcC ) == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcD ) == false )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ Single tag exclusion
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcC ) == true )
+with expansion:
+ true == true
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ One tag exclusion and one tag inclusion
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcC ) == false )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ One tag exclusion and one wldcarded name inclusion
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcC ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcD ) == true )
+with expansion:
+ true == true
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ One tag exclusion, using exclude:, and one wldcarded name inclusion
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcC ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcD ) == true )
+with expansion:
+ true == true
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ name exclusion
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcC ) == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcD ) == true )
+with expansion:
+ true == true
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ wildcarded name exclusion
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcC ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcD ) == false )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ wildcarded name exclusion with tag inclusion
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcC ) == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcD ) == false )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ wildcarded name exclusion, using exclude:, with tag inclusion
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcC ) == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcD ) == false )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ two wildcarded names
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcC ) == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcD ) == false )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ empty tag
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcC ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcD ) == false )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ empty quoted name
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcC ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcD ) == false )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ quoted string followed by tag exclusion
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.hasFilters() == true )
+with expansion:
+ true == true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcA ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcB ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcC ) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( spec.matches( tcD ) == true )
+with expansion:
+ true == true
+
+-------------------------------------------------------------------------------
+Parsing a std::pair
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( (std::pair<int, int>( 1, 2 )) == aNicePair )
+with expansion:
+ {?} == {?}
+
+-------------------------------------------------------------------------------
+Pointers can be compared to null
+-------------------------------------------------------------------------------
+Condition.tests.cpp:<line number>
+...............................................................................
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( p == 0 )
+with expansion:
+ 0 == 0
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( p == pNULL )
+with expansion:
+ 0 == 0
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( p != 0 )
+with expansion:
+ 0x<hex digits> != 0
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( cp != 0 )
+with expansion:
+ 0x<hex digits> != 0
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( cpc != 0 )
+with expansion:
+ 0x<hex digits> != 0
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( returnsNull() == 0 )
+with expansion:
+ {null string} == 0
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( returnsConstNull() == 0 )
+with expansion:
+ {null string} == 0
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( 0 != p )
+with expansion:
+ 0 != 0x<hex digits>
+
+-------------------------------------------------------------------------------
+Process can be configured on command line
+ empty args don't cause a crash
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( result )
+with expansion:
+ {?}
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( config.processName == "" )
+with expansion:
+ "" == ""
+
+-------------------------------------------------------------------------------
+Process can be configured on command line
+ default - no arguments
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( result )
+with expansion:
+ {?}
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( config.processName == "test" )
+with expansion:
+ "test" == "test"
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( config.shouldDebugBreak == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( config.abortAfter == -1 )
+with expansion:
+ -1 == -1
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( config.noThrow == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( config.reporterNames.empty() )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+Process can be configured on command line
+ test lists
+ 1 test
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( result )
+with expansion:
+ {?}
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( cfg.testSpec().matches(fakeTestCase("notIncluded")) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( cfg.testSpec().matches(fakeTestCase("test1")) )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+Process can be configured on command line
+ test lists
+ Specify one test case exclusion using exclude:
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( result )
+with expansion:
+ {?}
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( cfg.testSpec().matches(fakeTestCase("test1")) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( cfg.testSpec().matches(fakeTestCase("alwaysIncluded")) )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+Process can be configured on command line
+ test lists
+ Specify one test case exclusion using ~
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( result )
+with expansion:
+ {?}
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( cfg.testSpec().matches(fakeTestCase("test1")) == false )
+with expansion:
+ false == false
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( cfg.testSpec().matches(fakeTestCase("alwaysIncluded")) )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+Process can be configured on command line
+ reporter
+ -r/console
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( cli.parse({"test", "-r", "console"}) )
+with expansion:
+ {?}
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( config.reporterNames[0] == "console" )
+with expansion:
+ "console" == "console"
+
+-------------------------------------------------------------------------------
+Process can be configured on command line
+ reporter
+ -r/xml
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( cli.parse({"test", "-r", "xml"}) )
+with expansion:
+ {?}
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( config.reporterNames[0] == "xml" )
+with expansion:
+ "xml" == "xml"
+
+-------------------------------------------------------------------------------
+Process can be configured on command line
+ reporter
+ -r xml and junit
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( cli.parse({"test", "-r", "xml", "-r", "junit"}) )
+with expansion:
+ {?}
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( config.reporterNames.size() == 2 )
+with expansion:
+ 2 == 2
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( config.reporterNames[0] == "xml" )
+with expansion:
+ "xml" == "xml"
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( config.reporterNames[1] == "junit" )
+with expansion:
+ "junit" == "junit"
+
+-------------------------------------------------------------------------------
+Process can be configured on command line
+ reporter
+ --reporter/junit
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( cli.parse({"test", "--reporter", "junit"}) )
+with expansion:
+ {?}
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( config.reporterNames[0] == "junit" )
+with expansion:
+ "junit" == "junit"
+
+-------------------------------------------------------------------------------
+Process can be configured on command line
+ debugger
+ -b
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( cli.parse({"test", "-b"}) )
+with expansion:
+ {?}
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( config.shouldDebugBreak == true )
+with expansion:
+ true == true
+
+-------------------------------------------------------------------------------
+Process can be configured on command line
+ debugger
+ --break
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( cli.parse({"test", "--break"}) )
+with expansion:
+ {?}
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( config.shouldDebugBreak )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+Process can be configured on command line
+ abort
+ -a aborts after first failure
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( cli.parse({"test", "-a"}) )
+with expansion:
+ {?}
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( config.abortAfter == 1 )
+with expansion:
+ 1 == 1
+
+-------------------------------------------------------------------------------
+Process can be configured on command line
+ abort
+ -x 2 aborts after two failures
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( cli.parse({"test", "-x", "2"}) )
+with expansion:
+ {?}
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( config.abortAfter == 2 )
+with expansion:
+ 2 == 2
+
+-------------------------------------------------------------------------------
+Process can be configured on command line
+ abort
+ -x must be numeric
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( !result )
+with expansion:
+ true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( result.errorMessage(), Contains("convert") && Contains("oops") )
+with expansion:
+ "Unable to convert 'oops' to destination type" ( contains: "convert" and
+ contains: "oops" )
+
+-------------------------------------------------------------------------------
+Process can be configured on command line
+ nothrow
+ -e
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( cli.parse({"test", "-e"}) )
+with expansion:
+ {?}
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( config.noThrow )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+Process can be configured on command line
+ nothrow
+ --nothrow
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( cli.parse({"test", "--nothrow"}) )
+with expansion:
+ {?}
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( config.noThrow )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+Process can be configured on command line
+ output filename
+ -o filename
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( cli.parse({"test", "-o", "filename.ext"}) )
+with expansion:
+ {?}
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( config.outputFilename == "filename.ext" )
+with expansion:
+ "filename.ext" == "filename.ext"
+
+-------------------------------------------------------------------------------
+Process can be configured on command line
+ output filename
+ --out
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( cli.parse({"test", "--out", "filename.ext"}) )
+with expansion:
+ {?}
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( config.outputFilename == "filename.ext" )
+with expansion:
+ "filename.ext" == "filename.ext"
+
+-------------------------------------------------------------------------------
+Process can be configured on command line
+ combinations
+ Single character flags can be combined
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( cli.parse({"test", "-abe"}) )
+with expansion:
+ {?}
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( config.abortAfter == 1 )
+with expansion:
+ 1 == 1
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( config.shouldDebugBreak )
+with expansion:
+ true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( config.noThrow == true )
+with expansion:
+ true == true
+
+-------------------------------------------------------------------------------
+Process can be configured on command line
+ use-colour
+ without option
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( cli.parse({"test"}) )
+with expansion:
+ {?}
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( config.useColour == UseColour::Auto )
+with expansion:
+ 0 == 0
+
+-------------------------------------------------------------------------------
+Process can be configured on command line
+ use-colour
+ auto
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( cli.parse({"test", "--use-colour", "auto"}) )
+with expansion:
+ {?}
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( config.useColour == UseColour::Auto )
+with expansion:
+ 0 == 0
+
+-------------------------------------------------------------------------------
+Process can be configured on command line
+ use-colour
+ yes
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( cli.parse({"test", "--use-colour", "yes"}) )
+with expansion:
+ {?}
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( config.useColour == UseColour::Yes )
+with expansion:
+ 1 == 1
+
+-------------------------------------------------------------------------------
+Process can be configured on command line
+ use-colour
+ no
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( cli.parse({"test", "--use-colour", "no"}) )
+with expansion:
+ {?}
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( config.useColour == UseColour::No )
+with expansion:
+ 2 == 2
+
+-------------------------------------------------------------------------------
+Process can be configured on command line
+ use-colour
+ error
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK( !result )
+with expansion:
+ true
+
+CmdLine.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( result.errorMessage(), Contains( "colour mode must be one of" ) )
+with expansion:
+ "colour mode must be one of: auto, yes or no. 'wrong' not recognised"
+ contains: "colour mode must be one of"
+
+-------------------------------------------------------------------------------
+Reconstruction should be based on stringification: #914
+-------------------------------------------------------------------------------
+Decomposition.tests.cpp:<line number>
+...............................................................................
+
+Decomposition.tests.cpp:<line number>: FAILED:
+ CHECK( truthy(false) )
+with expansion:
+ Hey, its truthy!
+
+-------------------------------------------------------------------------------
+Regex string matcher
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( testStringForMatching(), Matches("this STRING contains 'abc' as a substring") )
+with expansion:
+ "this string contains 'abc' as a substring" matches "this STRING contains
+ 'abc' as a substring" case sensitively
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( testStringForMatching(), Matches("contains 'abc' as a substring") )
+with expansion:
+ "this string contains 'abc' as a substring" matches "contains 'abc' as a
+ substring" case sensitively
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( testStringForMatching(), Matches("this string contains 'abc' as a") )
+with expansion:
+ "this string contains 'abc' as a substring" matches "this string contains
+ 'abc' as a" case sensitively
+
+-------------------------------------------------------------------------------
+SUCCEED counts as a test pass
+-------------------------------------------------------------------------------
+Message.tests.cpp:<line number>
+...............................................................................
+
+Message.tests.cpp:<line number>:
+PASSED:
+with message:
+ this is a success
+
+-------------------------------------------------------------------------------
+SUCCEED does not require an argument
+-------------------------------------------------------------------------------
+Message.tests.cpp:<line number>
+...............................................................................
+
+Message.tests.cpp:<line number>:
+PASSED:
+
+-------------------------------------------------------------------------------
+Scenario: BDD tests requiring Fixtures to provide commonly-accessed data or
+ methods
+ Given: No operations precede me
+-------------------------------------------------------------------------------
+BDD.tests.cpp:<line number>
+...............................................................................
+
+BDD.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( before == 0 )
+with expansion:
+ 0 == 0
+
+-------------------------------------------------------------------------------
+Scenario: BDD tests requiring Fixtures to provide commonly-accessed data or
+ methods
+ Given: No operations precede me
+ When: We get the count
+ Then: Subsequently values are higher
+-------------------------------------------------------------------------------
+BDD.tests.cpp:<line number>
+...............................................................................
+
+BDD.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( after > before )
+with expansion:
+ 1 > 0
+
+-------------------------------------------------------------------------------
+Scenario: Do that thing with the thing
+ Given: This stuff exists
+ When: I do this
+ Then: it should do this
+-------------------------------------------------------------------------------
+BDD.tests.cpp:<line number>
+...............................................................................
+
+BDD.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( itDoesThis() )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+Scenario: Do that thing with the thing
+ Given: This stuff exists
+ When: I do this
+ Then: it should do this
+ And: do that
+-------------------------------------------------------------------------------
+BDD.tests.cpp:<line number>
+...............................................................................
+
+BDD.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( itDoesThat() )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+Scenario: This is a really long scenario name to see how the list command deals
+ with wrapping
+ Given: A section name that is so long that it cannot fit in a single
+ console width
+ When: The test headers are printed as part of the normal running of the
+ scenario
+ Then: The, deliberately very long and overly verbose (you see what I did
+ there?) section names must wrap, along with an indent
+-------------------------------------------------------------------------------
+BDD.tests.cpp:<line number>
+...............................................................................
+
+BDD.tests.cpp:<line number>:
+PASSED:
+with message:
+ boo!
+
+-------------------------------------------------------------------------------
+Scenario: Vector resizing affects size and capacity
+ Given: an empty vector
+-------------------------------------------------------------------------------
+BDD.tests.cpp:<line number>
+...............................................................................
+
+BDD.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( v.size() == 0 )
+with expansion:
+ 0 == 0
+
+-------------------------------------------------------------------------------
+Scenario: Vector resizing affects size and capacity
+ Given: an empty vector
+ When: it is made larger
+ Then: the size and capacity go up
+-------------------------------------------------------------------------------
+BDD.tests.cpp:<line number>
+...............................................................................
+
+BDD.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( v.size() == 10 )
+with expansion:
+ 10 == 10
+
+BDD.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( v.capacity() >= 10 )
+with expansion:
+ 10 >= 10
+
+-------------------------------------------------------------------------------
+Scenario: Vector resizing affects size and capacity
+ Given: an empty vector
+ When: it is made larger
+ Then: the size and capacity go up
+ And when: it is made smaller again
+ Then: the size goes down but the capacity stays the same
+-------------------------------------------------------------------------------
+BDD.tests.cpp:<line number>
+...............................................................................
+
+BDD.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( v.size() == 5 )
+with expansion:
+ 5 == 5
+
+BDD.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( v.capacity() >= 10 )
+with expansion:
+ 10 >= 10
+
+-------------------------------------------------------------------------------
+Scenario: Vector resizing affects size and capacity
+ Given: an empty vector
+-------------------------------------------------------------------------------
+BDD.tests.cpp:<line number>
+...............................................................................
+
+BDD.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( v.size() == 0 )
+with expansion:
+ 0 == 0
+
+-------------------------------------------------------------------------------
+Scenario: Vector resizing affects size and capacity
+ Given: an empty vector
+ When: we reserve more space
+ Then: The capacity is increased but the size remains the same
+-------------------------------------------------------------------------------
+BDD.tests.cpp:<line number>
+...............................................................................
+
+BDD.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( v.capacity() >= 10 )
+with expansion:
+ 10 >= 10
+
+BDD.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( v.size() == 0 )
+with expansion:
+ 0 == 0
+
+A string sent directly to stdout
+A string sent directly to stderr
+A string sent to stderr via clog
+-------------------------------------------------------------------------------
+Sends stuff to stdout and stderr
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+
+No assertions in test case 'Sends stuff to stdout and stderr'
+
+-------------------------------------------------------------------------------
+Some simple comparisons between doubles
+-------------------------------------------------------------------------------
+Approx.tests.cpp:<line number>
+...............................................................................
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( d == Approx( 1.23 ) )
+with expansion:
+ 1.23 == Approx( 1.23 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( d != Approx( 1.22 ) )
+with expansion:
+ 1.23 != Approx( 1.22 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( d != Approx( 1.24 ) )
+with expansion:
+ 1.23 != Approx( 1.24 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( Approx( d ) == 1.23 )
+with expansion:
+ Approx( 1.23 ) == 1.23
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( Approx( d ) != 1.22 )
+with expansion:
+ Approx( 1.23 ) != 1.22
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( Approx( d ) != 1.24 )
+with expansion:
+ Approx( 1.23 ) != 1.24
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( INFINITY == Approx(INFINITY) )
+with expansion:
+ inff == Approx( inf )
+
+Message from section one
+-------------------------------------------------------------------------------
+Standard output from all sections is reported
+ one
+-------------------------------------------------------------------------------
+Message.tests.cpp:<line number>
+...............................................................................
+
+
+No assertions in section 'one'
+
+Message from section two
+-------------------------------------------------------------------------------
+Standard output from all sections is reported
+ two
+-------------------------------------------------------------------------------
+Message.tests.cpp:<line number>
+...............................................................................
+
+
+No assertions in section 'two'
+
+-------------------------------------------------------------------------------
+StartsWith string matcher
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( testStringForMatching(), StartsWith("This String") )
+with expansion:
+ "this string contains 'abc' as a substring" starts with: "This String"
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( testStringForMatching(), StartsWith("string", Catch::CaseSensitive::No) )
+with expansion:
+ "this string contains 'abc' as a substring" starts with: "string" (case
+ insensitive)
+
+-------------------------------------------------------------------------------
+Static arrays are convertible to string
+ Single item
+-------------------------------------------------------------------------------
+ToStringGeneral.tests.cpp:<line number>
+...............................................................................
+
+ToStringGeneral.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( Catch::Detail::stringify(singular) == "{ 1 }" )
+with expansion:
+ "{ 1 }" == "{ 1 }"
+
+-------------------------------------------------------------------------------
+Static arrays are convertible to string
+ Multiple
+-------------------------------------------------------------------------------
+ToStringGeneral.tests.cpp:<line number>
+...............................................................................
+
+ToStringGeneral.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( Catch::Detail::stringify(arr) == "{ 3, 2, 1 }" )
+with expansion:
+ "{ 3, 2, 1 }" == "{ 3, 2, 1 }"
+
+-------------------------------------------------------------------------------
+Static arrays are convertible to string
+ Non-trivial inner items
+-------------------------------------------------------------------------------
+ToStringGeneral.tests.cpp:<line number>
+...............................................................................
+
+ToStringGeneral.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( Catch::Detail::stringify(arr) == R"({ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } })" )
+with expansion:
+ "{ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } }"
+ ==
+ "{ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } }"
+
+-------------------------------------------------------------------------------
+String matchers
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( testStringForMatching(), Contains("string") )
+with expansion:
+ "this string contains 'abc' as a substring" contains: "string"
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( testStringForMatching(), Contains("string", Catch::CaseSensitive::No) )
+with expansion:
+ "this string contains 'abc' as a substring" contains: "string" (case
+ insensitive)
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( testStringForMatching(), Contains("abc") )
+with expansion:
+ "this string contains 'abc' as a substring" contains: "abc"
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( testStringForMatching(), Contains("aBC", Catch::CaseSensitive::No) )
+with expansion:
+ "this string contains 'abc' as a substring" contains: "abc" (case insensitive)
+ insensitive)
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( testStringForMatching(), StartsWith("this") )
+with expansion:
+ "this string contains 'abc' as a substring" starts with: "this"
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( testStringForMatching(), StartsWith("THIS", Catch::CaseSensitive::No) )
+with expansion:
+ "this string contains 'abc' as a substring" starts with: "this" (case
+ insensitive)
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( testStringForMatching(), EndsWith("substring") )
+with expansion:
+ "this string contains 'abc' as a substring" ends with: "substring"
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( testStringForMatching(), EndsWith(" SuBsTrInG", Catch::CaseSensitive::No) )
+with expansion:
+ "this string contains 'abc' as a substring" ends with: " substring" (case
+ insensitive)
+
+-------------------------------------------------------------------------------
+StringRef
+ Empty string
+-------------------------------------------------------------------------------
+String.tests.cpp:<line number>
+...............................................................................
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( empty.empty() )
+with expansion:
+ true
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( empty.size() == 0 )
+with expansion:
+ 0 == 0
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( std::strcmp( empty.c_str(), "" ) == 0 )
+with expansion:
+ 0 == 0
+
+-------------------------------------------------------------------------------
+StringRef
+ From string literal
+-------------------------------------------------------------------------------
+String.tests.cpp:<line number>
+...............................................................................
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s.empty() == false )
+with expansion:
+ false == false
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s.size() == 5 )
+with expansion:
+ 5 == 5
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( isSubstring( s ) == false )
+with expansion:
+ false == false
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( std::strcmp( rawChars, "hello" ) == 0 )
+with expansion:
+ 0 == 0
+
+-------------------------------------------------------------------------------
+StringRef
+ From string literal
+ c_str() does not cause copy
+-------------------------------------------------------------------------------
+String.tests.cpp:<line number>
+...............................................................................
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( isOwned( s ) == false )
+with expansion:
+ false == false
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s.c_str() == rawChars )
+with expansion:
+ "hello" == "hello"
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( isOwned( s ) == false )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+StringRef
+ From sub-string
+-------------------------------------------------------------------------------
+String.tests.cpp:<line number>
+...............................................................................
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( original == "original" )
+
+String.tests.cpp:<line number>: FAILED:
+ REQUIRE( isSubstring( original ) )
+with expansion:
+ false
+
+-------------------------------------------------------------------------------
+StringRef
+ Substrings
+ zero-based substring
+-------------------------------------------------------------------------------
+String.tests.cpp:<line number>
+...............................................................................
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ss.empty() == false )
+with expansion:
+ false == false
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ss.size() == 5 )
+with expansion:
+ 5 == 5
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( std::strcmp( ss.c_str(), "hello" ) == 0 )
+with expansion:
+ 0 == 0
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ss == "hello" )
+with expansion:
+ hello == "hello"
+
+-------------------------------------------------------------------------------
+StringRef
+ Substrings
+ c_str() causes copy
+-------------------------------------------------------------------------------
+String.tests.cpp:<line number>
+...............................................................................
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( isSubstring( ss ) )
+with expansion:
+ true
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( isOwned( ss ) == false )
+with expansion:
+ false == false
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( rawChars == data( s ) )
+with expansion:
+ "hello world!" == "hello world!"
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ss.c_str() != rawChars )
+with expansion:
+ "hello" != "hello world!"
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( isSubstring( ss ) == false )
+with expansion:
+ false == false
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( isOwned( ss ) )
+with expansion:
+ true
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( data( ss ) != data( s ) )
+with expansion:
+ "hello" != "hello world!"
+
+-------------------------------------------------------------------------------
+StringRef
+ Substrings
+ non-zero-based substring
+-------------------------------------------------------------------------------
+String.tests.cpp:<line number>
+...............................................................................
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ss.size() == 6 )
+with expansion:
+ 6 == 6
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( std::strcmp( ss.c_str(), "world!" ) == 0 )
+with expansion:
+ 0 == 0
+
+-------------------------------------------------------------------------------
+StringRef
+ Substrings
+ Pointer values of full refs should match
+-------------------------------------------------------------------------------
+String.tests.cpp:<line number>
+...............................................................................
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s.c_str() == s2.c_str() )
+with expansion:
+ "hello world!" == "hello world!"
+
+-------------------------------------------------------------------------------
+StringRef
+ Substrings
+ Pointer values of substring refs should not match
+-------------------------------------------------------------------------------
+String.tests.cpp:<line number>
+...............................................................................
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s.c_str() != ss.c_str() )
+with expansion:
+ "hello world!" != "hello"
+
+-------------------------------------------------------------------------------
+StringRef
+ Comparisons
+-------------------------------------------------------------------------------
+String.tests.cpp:<line number>
+...............................................................................
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( StringRef("hello") == StringRef("hello") )
+with expansion:
+ hello == hello
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( StringRef("hello") != StringRef("cello") )
+with expansion:
+ hello != cello
+
+-------------------------------------------------------------------------------
+StringRef
+ from std::string
+ implicitly constructed
+-------------------------------------------------------------------------------
+String.tests.cpp:<line number>
+...............................................................................
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( sr == "a standard string" )
+with expansion:
+ a standard string == "a standard string"
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( sr.size() == stdStr.size() )
+with expansion:
+ 17 == 17
+
+-------------------------------------------------------------------------------
+StringRef
+ from std::string
+ explicitly constructed
+-------------------------------------------------------------------------------
+String.tests.cpp:<line number>
+...............................................................................
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( sr == "a standard string" )
+with expansion:
+ a standard string == "a standard string"
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( sr.size() == stdStr.size() )
+with expansion:
+ 17 == 17
+
+-------------------------------------------------------------------------------
+StringRef
+ from std::string
+ assigned
+-------------------------------------------------------------------------------
+String.tests.cpp:<line number>
+...............................................................................
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( sr == "a standard string" )
+with expansion:
+ a standard string == "a standard string"
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( sr.size() == stdStr.size() )
+with expansion:
+ 17 == 17
+
+-------------------------------------------------------------------------------
+StringRef
+ to std::string
+ implicitly constructed
+-------------------------------------------------------------------------------
+String.tests.cpp:<line number>
+...............................................................................
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( stdStr == "a stringref" )
+with expansion:
+ "a stringref" == "a stringref"
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( stdStr.size() == sr.size() )
+with expansion:
+ 11 == 11
+
+-------------------------------------------------------------------------------
+StringRef
+ to std::string
+ explicitly constructed
+-------------------------------------------------------------------------------
+String.tests.cpp:<line number>
+...............................................................................
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( stdStr == "a stringref" )
+with expansion:
+ "a stringref" == "a stringref"
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( stdStr.size() == sr.size() )
+with expansion:
+ 11 == 11
+
+-------------------------------------------------------------------------------
+StringRef
+ to std::string
+ assigned
+-------------------------------------------------------------------------------
+String.tests.cpp:<line number>
+...............................................................................
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( stdStr == "a stringref" )
+with expansion:
+ "a stringref" == "a stringref"
+
+String.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( stdStr.size() == sr.size() )
+with expansion:
+ 11 == 11
+
+-------------------------------------------------------------------------------
+Stringifying std::chrono::duration helpers
+-------------------------------------------------------------------------------
+ToStringChrono.tests.cpp:<line number>
+...............................................................................
+
+ToStringChrono.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( minute == seconds )
+with expansion:
+ 1 m == 60 s
+
+ToStringChrono.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( hour != seconds )
+with expansion:
+ 1 h != 60 s
+
+ToStringChrono.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( micro != milli )
+with expansion:
+ 1 us != 1 ms
+
+ToStringChrono.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( nano != micro )
+with expansion:
+ 1 ns != 1 us
+
+-------------------------------------------------------------------------------
+Stringifying std::chrono::duration with weird ratios
+-------------------------------------------------------------------------------
+ToStringChrono.tests.cpp:<line number>
+...............................................................................
+
+ToStringChrono.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( half_minute != femto_second )
+with expansion:
+ 1 [30/1]s != 1 fs
+
+ToStringChrono.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( pico_second != atto_second )
+with expansion:
+ 1 ps != 1 as
+
+-------------------------------------------------------------------------------
+Stringifying std::chrono::time_point<system_clock>
+-------------------------------------------------------------------------------
+ToStringChrono.tests.cpp:<line number>
+...............................................................................
+
+ToStringChrono.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( now != later )
+with expansion:
+ {iso8601-timestamp}
+ !=
+ {iso8601-timestamp}
+
+-------------------------------------------------------------------------------
+Tabs and newlines show in output
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>: FAILED:
+ CHECK( s1 == s2 )
+with expansion:
+ "if ($b == 10) {
+ $a = 20;
+ }"
+ ==
+ "if ($b == 10) {
+ $a = 20;
+ }
+ "
+
+-------------------------------------------------------------------------------
+Tag alias can be registered against tag patterns
+ The same tag alias can only be registered once
+-------------------------------------------------------------------------------
+TagAlias.tests.cpp:<line number>
+...............................................................................
+
+TagAlias.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( what, Contains( "[@zzz]" ) )
+with expansion:
+ "error: tag alias, '[@zzz]' already registered.
+ First seen at: file:2
+ Redefined at: file:10" contains: "[@zzz]"
+
+TagAlias.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( what, Contains( "file" ) )
+with expansion:
+ "error: tag alias, '[@zzz]' already registered.
+ First seen at: file:2
+ Redefined at: file:10" contains: "file"
+
+TagAlias.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( what, Contains( "2" ) )
+with expansion:
+ "error: tag alias, '[@zzz]' already registered.
+ First seen at: file:2
+ Redefined at: file:10" contains: "2"
+
+TagAlias.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( what, Contains( "10" ) )
+with expansion:
+ "error: tag alias, '[@zzz]' already registered.
+ First seen at: file:2
+ Redefined at: file:10" contains: "10"
+
+-------------------------------------------------------------------------------
+Tag alias can be registered against tag patterns
+ Tag aliases must be of the form [@name]
+-------------------------------------------------------------------------------
+TagAlias.tests.cpp:<line number>
+...............................................................................
+
+TagAlias.tests.cpp:<line number>:
+PASSED:
+ CHECK_THROWS( registry.add( "[no ampersat]", "", Catch::SourceLineInfo( "file", 3 ) ) )
+
+TagAlias.tests.cpp:<line number>:
+PASSED:
+ CHECK_THROWS( registry.add( "[the @ is not at the start]", "", Catch::SourceLineInfo( "file", 3 ) ) )
+
+TagAlias.tests.cpp:<line number>:
+PASSED:
+ CHECK_THROWS( registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) ) )
+
+TagAlias.tests.cpp:<line number>:
+PASSED:
+ CHECK_THROWS( registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) ) )
+
+-------------------------------------------------------------------------------
+Test case with one argument
+-------------------------------------------------------------------------------
+VariadicMacros.tests.cpp:<line number>
+...............................................................................
+
+VariadicMacros.tests.cpp:<line number>:
+PASSED:
+with message:
+ no assertions
+
+-------------------------------------------------------------------------------
+Test enum bit values
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( 0x<hex digits> == bit30and31 )
+with expansion:
+ 3221225472 (0x<hex digits>) == 3221225472
+
+-------------------------------------------------------------------------------
+The NO_FAIL macro reports a failure but does not fail the test
+-------------------------------------------------------------------------------
+Message.tests.cpp:<line number>
+...............................................................................
+
+Message.tests.cpp:<line number>:
+FAILED - but was ok:
+ CHECK_NOFAIL( 1 == 2 )
+
+
+No assertions in test case 'The NO_FAIL macro reports a failure but does not fail the test'
+
+-------------------------------------------------------------------------------
+This test 'should' fail but doesn't
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+with message:
+ oops!
+
+-------------------------------------------------------------------------------
+Tracker
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1.isOpen() )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+Tracker
+ successfully close one section
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1.isSuccessfullyCompleted() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase.isComplete() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ctx.completedCycle() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase.isSuccessfullyCompleted() )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+Tracker
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1.isOpen() )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+Tracker
+ fail one section
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1.isComplete() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1.isSuccessfullyCompleted() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase.isComplete() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ctx.completedCycle() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase.isSuccessfullyCompleted() == false )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+Tracker
+ fail one section
+ re-enter after failed section
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase2.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1b.isOpen() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ctx.completedCycle() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase.isComplete() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase.isSuccessfullyCompleted() )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+Tracker
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1.isOpen() )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+Tracker
+ fail one section
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1.isComplete() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1.isSuccessfullyCompleted() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase.isComplete() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ctx.completedCycle() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase.isSuccessfullyCompleted() == false )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+Tracker
+ fail one section
+ re-enter after failed section and find next section
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase2.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1b.isOpen() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s2.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ctx.completedCycle() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase.isComplete() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase.isSuccessfullyCompleted() )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+Tracker
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1.isOpen() )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+Tracker
+ successfully close one section, then find another
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s2.isOpen() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase.isComplete() == false )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+Tracker
+ successfully close one section, then find another
+ Re-enter - skips S1 and enters S2
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase2.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1b.isOpen() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s2b.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ctx.completedCycle() == false )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+Tracker
+ successfully close one section, then find another
+ Re-enter - skips S1 and enters S2
+ Successfully close S2
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ctx.completedCycle() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s2b.isSuccessfullyCompleted() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase2.isComplete() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase2.isSuccessfullyCompleted() )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+Tracker
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1.isOpen() )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+Tracker
+ successfully close one section, then find another
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s2.isOpen() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase.isComplete() == false )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+Tracker
+ successfully close one section, then find another
+ Re-enter - skips S1 and enters S2
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase2.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1b.isOpen() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s2b.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ctx.completedCycle() == false )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+Tracker
+ successfully close one section, then find another
+ Re-enter - skips S1 and enters S2
+ fail S2
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ctx.completedCycle() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s2b.isComplete() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s2b.isSuccessfullyCompleted() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase2.isSuccessfullyCompleted() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase3.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1c.isOpen() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s2c.isOpen() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase3.isSuccessfullyCompleted() )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+Tracker
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1.isOpen() )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+Tracker
+ open a nested section
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s2.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s2.isComplete() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1.isComplete() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1.isComplete() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase.isComplete() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase.isComplete() )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+Tracker
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1.isOpen() )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+Tracker
+ start a generator
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( g1.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( g1.index() == 0 )
+with expansion:
+ 0 == 0
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( g1.isComplete() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1.isComplete() == false )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+Tracker
+ start a generator
+ close outer section
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1.isComplete() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase.isSuccessfullyCompleted() == false )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+Tracker
+ start a generator
+ close outer section
+ Re-enter for second generation
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase2.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1b.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( g1b.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( g1b.index() == 1 )
+with expansion:
+ 1 == 1
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1.isComplete() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1b.isComplete() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( g1b.isComplete() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase2.isComplete() )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+Tracker
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1.isOpen() )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+Tracker
+ start a generator
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( g1.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( g1.index() == 0 )
+with expansion:
+ 0 == 0
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( g1.isComplete() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1.isComplete() == false )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+Tracker
+ start a generator
+ Start a new inner section
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s2.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s2.isComplete() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1.isComplete() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase.isComplete() == false )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+Tracker
+ start a generator
+ Start a new inner section
+ Re-enter for second generation
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase2.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1b.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( g1b.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( g1b.index() == 1 )
+with expansion:
+ 1 == 1
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s2b.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s2b.isComplete() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( g1b.isComplete() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1b.isComplete() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase2.isComplete() )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+Tracker
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1.isOpen() )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+Tracker
+ start a generator
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( g1.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( g1.index() == 0 )
+with expansion:
+ 0 == 0
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( g1.isComplete() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1.isComplete() == false )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+Tracker
+ start a generator
+ Fail an inner section
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s2.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s2.isComplete() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s2.isSuccessfullyCompleted() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1.isComplete() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase.isComplete() == false )
+with expansion:
+ false == false
+
+-------------------------------------------------------------------------------
+Tracker
+ start a generator
+ Fail an inner section
+ Re-enter for second generation
+-------------------------------------------------------------------------------
+PartTracker.tests.cpp:<line number>
+...............................................................................
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase2.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1b.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( g1b.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( g1b.index() == 0 )
+with expansion:
+ 0 == 0
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s2b.isOpen() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( g1b.isComplete() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1b.isComplete() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase2.isComplete() == false )
+with expansion:
+ false == false
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase3.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1c.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( g1c.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( g1c.index() == 1 )
+with expansion:
+ 1 == 1
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s2c.isOpen() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s2c.isComplete() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( g1c.isComplete() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s1c.isComplete() )
+with expansion:
+ true
+
+PartTracker.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCase3.isComplete() )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+Unexpected exceptions can be translated
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+due to unexpected exception with message:
+ 3.14
+
+-------------------------------------------------------------------------------
+Use a custom approx
+-------------------------------------------------------------------------------
+Approx.tests.cpp:<line number>
+...............................................................................
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( d == approx( 1.23 ) )
+with expansion:
+ 1.23 == Approx( 1.23 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( d == approx( 1.22 ) )
+with expansion:
+ 1.23 == Approx( 1.22 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( d == approx( 1.24 ) )
+with expansion:
+ 1.23 == Approx( 1.24 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( d != approx( 1.25 ) )
+with expansion:
+ 1.23 != Approx( 1.25 )
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( approx( d ) == 1.23 )
+with expansion:
+ Approx( 1.23 ) == 1.23
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( approx( d ) == 1.22 )
+with expansion:
+ Approx( 1.23 ) == 1.22
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( approx( d ) == 1.24 )
+with expansion:
+ Approx( 1.23 ) == 1.24
+
+Approx.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( approx( d ) != 1.25 )
+with expansion:
+ Approx( 1.23 ) != 1.25
+
+-------------------------------------------------------------------------------
+Variadic macros
+ Section with one argument
+-------------------------------------------------------------------------------
+VariadicMacros.tests.cpp:<line number>
+...............................................................................
+
+VariadicMacros.tests.cpp:<line number>:
+PASSED:
+with message:
+ no assertions
+
+-------------------------------------------------------------------------------
+Vector matchers
+ Contains (element)
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( v, VectorContains(1) )
+with expansion:
+ { 1, 2, 3 } Contains: 1
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( v, VectorContains(2) )
+with expansion:
+ { 1, 2, 3 } Contains: 2
+
+-------------------------------------------------------------------------------
+Vector matchers
+ Contains (vector)
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( v, Contains(v2) )
+with expansion:
+ { 1, 2, 3 } Contains: { 1, 2 }
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( v, Contains(v2) )
+with expansion:
+ { 1, 2, 3 } Contains: { 1, 2, 3 }
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( v, Contains(empty) )
+with expansion:
+ { 1, 2, 3 } Contains: { }
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( empty, Contains(empty) )
+with expansion:
+ { } Contains: { }
+
+-------------------------------------------------------------------------------
+Vector matchers
+ Contains (element), composed
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( v, VectorContains(1) && VectorContains(2) )
+with expansion:
+ { 1, 2, 3 } ( Contains: 1 and Contains: 2 )
+
+-------------------------------------------------------------------------------
+Vector matchers
+ Equals
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( v, Equals(v) )
+with expansion:
+ { 1, 2, 3 } Equals: { 1, 2, 3 }
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( empty, Equals(empty) )
+with expansion:
+ { } Equals: { }
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( v, Equals(v2) )
+with expansion:
+ { 1, 2, 3 } Equals: { 1, 2, 3 }
+
+-------------------------------------------------------------------------------
+Vector matchers
+ UnorderedEquals
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( v, UnorderedEquals(v) )
+with expansion:
+ { 1, 2, 3 } UnorderedEquals: { 1, 2, 3 }
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ CHECK_THAT( empty, UnorderedEquals(empty) )
+with expansion:
+ { } UnorderedEquals: { }
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( permuted, UnorderedEquals(v) )
+with expansion:
+ { 1, 3, 2 } UnorderedEquals: { 1, 2, 3 }
+
+Matchers.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( permuted, UnorderedEquals(v) )
+with expansion:
+ { 2, 3, 1 } UnorderedEquals: { 1, 2, 3 }
+
+-------------------------------------------------------------------------------
+Vector matchers that fail
+ Contains (element)
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( v, VectorContains(-1) )
+with expansion:
+ { 1, 2, 3 } Contains: -1
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( empty, VectorContains(1) )
+with expansion:
+ { } Contains: 1
+
+-------------------------------------------------------------------------------
+Vector matchers that fail
+ Contains (vector)
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( empty, Contains(v) )
+with expansion:
+ { } Contains: { 1, 2, 3 }
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( v, Contains(v2) )
+with expansion:
+ { 1, 2, 3 } Contains: { 1, 2, 4 }
+
+-------------------------------------------------------------------------------
+Vector matchers that fail
+ Equals
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( v, Equals(v2) )
+with expansion:
+ { 1, 2, 3 } Equals: { 1, 2 }
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( v2, Equals(v) )
+with expansion:
+ { 1, 2 } Equals: { 1, 2, 3 }
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( empty, Equals(v) )
+with expansion:
+ { } Equals: { 1, 2, 3 }
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( v, Equals(empty) )
+with expansion:
+ { 1, 2, 3 } Equals: { }
+
+-------------------------------------------------------------------------------
+Vector matchers that fail
+ UnorderedEquals
+-------------------------------------------------------------------------------
+Matchers.tests.cpp:<line number>
+...............................................................................
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( v, UnorderedEquals(empty) )
+with expansion:
+ { 1, 2, 3 } UnorderedEquals: { }
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( empty, UnorderedEquals(v) )
+with expansion:
+ { } UnorderedEquals: { 1, 2, 3 }
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( permuted, UnorderedEquals(v) )
+with expansion:
+ { 1, 3 } UnorderedEquals: { 1, 2, 3 }
+
+Matchers.tests.cpp:<line number>: FAILED:
+ CHECK_THAT( permuted, UnorderedEquals(v) )
+with expansion:
+ { 3, 1 } UnorderedEquals: { 1, 2, 3 }
+
+-------------------------------------------------------------------------------
+When checked exceptions are thrown they can be expected or unexpected
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THROWS_AS( thisThrows(), std::domain_error )
+
+Exception.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_NOTHROW( thisDoesntThrow() )
+
+Exception.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THROWS( thisThrows() )
+
+-------------------------------------------------------------------------------
+When unchecked exceptions are thrown directly they are always failures
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+due to unexpected exception with message:
+ unexpected exception
+
+-------------------------------------------------------------------------------
+When unchecked exceptions are thrown during a CHECK the test should continue
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+ CHECK( thisThrows() == 0 )
+due to unexpected exception with message:
+ expected exception
+
+-------------------------------------------------------------------------------
+When unchecked exceptions are thrown during a REQUIRE the test should abort
+fail
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+ REQUIRE( thisThrows() == 0 )
+due to unexpected exception with message:
+ expected exception
+
+-------------------------------------------------------------------------------
+When unchecked exceptions are thrown from functions they are always failures
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+ CHECK( thisThrows() == 0 )
+due to unexpected exception with message:
+ expected exception
+
+-------------------------------------------------------------------------------
+When unchecked exceptions are thrown from sections they are always failures
+ section name
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+due to unexpected exception with message:
+ unexpected exception
+
+-------------------------------------------------------------------------------
+When unchecked exceptions are thrown, but caught, they do not affect the test
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+
+No assertions in test case 'When unchecked exceptions are thrown, but caught, they do not affect the test'
+
+-------------------------------------------------------------------------------
+Where the LHS is not a simple value
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+warning:
+ Uncomment the code in this test to check that it gives a sensible compiler
+ error
+
+
+No assertions in test case 'Where the LHS is not a simple value'
+
+-------------------------------------------------------------------------------
+Where there is more to the expression after the RHS
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+warning:
+ Uncomment the code in this test to check that it gives a sensible compiler
+ error
+
+
+No assertions in test case 'Where there is more to the expression after the RHS'
+
+-------------------------------------------------------------------------------
+X/level/0/a
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+
+-------------------------------------------------------------------------------
+X/level/0/b
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+
+-------------------------------------------------------------------------------
+X/level/1/a
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+
+-------------------------------------------------------------------------------
+X/level/1/b
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+
+-------------------------------------------------------------------------------
+XmlEncode
+ normal string
+-------------------------------------------------------------------------------
+Xml.tests.cpp:<line number>
+...............................................................................
+
+Xml.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( encode( "normal string" ) == "normal string" )
+with expansion:
+ "normal string" == "normal string"
+
+-------------------------------------------------------------------------------
+XmlEncode
+ empty string
+-------------------------------------------------------------------------------
+Xml.tests.cpp:<line number>
+...............................................................................
+
+Xml.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( encode( "" ) == "" )
+with expansion:
+ "" == ""
+
+-------------------------------------------------------------------------------
+XmlEncode
+ string with ampersand
+-------------------------------------------------------------------------------
+Xml.tests.cpp:<line number>
+...............................................................................
+
+Xml.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( encode( "smith & jones" ) == "smith & jones" )
+with expansion:
+ "smith & jones" == "smith & jones"
+
+-------------------------------------------------------------------------------
+XmlEncode
+ string with less-than
+-------------------------------------------------------------------------------
+Xml.tests.cpp:<line number>
+...............................................................................
+
+Xml.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( encode( "smith < jones" ) == "smith < jones" )
+with expansion:
+ "smith < jones" == "smith < jones"
+
+-------------------------------------------------------------------------------
+XmlEncode
+ string with greater-than
+-------------------------------------------------------------------------------
+Xml.tests.cpp:<line number>
+...............................................................................
+
+Xml.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( encode( "smith > jones" ) == "smith > jones" )
+with expansion:
+ "smith > jones" == "smith > jones"
+
+Xml.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( encode( "smith ]]> jones" ) == "smith ]]> jones" )
+with expansion:
+ "smith ]]> jones"
+ ==
+ "smith ]]> jones"
+
+-------------------------------------------------------------------------------
+XmlEncode
+ string with quotes
+-------------------------------------------------------------------------------
+Xml.tests.cpp:<line number>
+...............................................................................
+
+Xml.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( encode( stringWithQuotes ) == stringWithQuotes )
+with expansion:
+ "don't "quote" me on that"
+ ==
+ "don't "quote" me on that"
+
+Xml.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( encode( stringWithQuotes, Catch::XmlEncode::ForAttributes ) == "don't "quote" me on that" )
+with expansion:
+ "don't "quote" me on that"
+ ==
+ "don't "quote" me on that"
+
+-------------------------------------------------------------------------------
+XmlEncode
+ string with control char (1)
+-------------------------------------------------------------------------------
+Xml.tests.cpp:<line number>
+...............................................................................
+
+Xml.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( encode( "[\x01]" ) == "[\\x01]" )
+with expansion:
+ "[\x01]" == "[\x01]"
+
+-------------------------------------------------------------------------------
+XmlEncode
+ string with control char (x7F)
+-------------------------------------------------------------------------------
+Xml.tests.cpp:<line number>
+...............................................................................
+
+Xml.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( encode( "[\x7F]" ) == "[\\x7F]" )
+with expansion:
+ "[\x7F]" == "[\x7F]"
+
+-------------------------------------------------------------------------------
+array<int, N> -> toString
+-------------------------------------------------------------------------------
+ToStringVector.tests.cpp:<line number>
+...............................................................................
+
+ToStringVector.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( Catch::Detail::stringify( empty ) == "{ }" )
+with expansion:
+ "{ }" == "{ }"
+
+ToStringVector.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( Catch::Detail::stringify( oneValue ) == "{ 42 }" )
+with expansion:
+ "{ 42 }" == "{ 42 }"
+
+ToStringVector.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( Catch::Detail::stringify( twoValues ) == "{ 42, 250 }" )
+with expansion:
+ "{ 42, 250 }" == "{ 42, 250 }"
+
+-------------------------------------------------------------------------------
+atomic if
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( x == 0 )
+with expansion:
+ 0 == 0
+
+-------------------------------------------------------------------------------
+boolean member
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( obj.prop != 0 )
+with expansion:
+ 0x<hex digits> != 0
+
+-------------------------------------------------------------------------------
+checkedElse
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ CHECKED_ELSE( flag )
+with expansion:
+ true
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCheckedElse( true ) )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+checkedElse, failing
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>: FAILED:
+ CHECKED_ELSE( flag )
+with expansion:
+ false
+
+Misc.tests.cpp:<line number>: FAILED:
+ REQUIRE( testCheckedElse( false ) )
+with expansion:
+ false
+
+-------------------------------------------------------------------------------
+checkedIf
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ CHECKED_IF( flag )
+with expansion:
+ true
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( testCheckedIf( true ) )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+checkedIf, failing
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>: FAILED:
+ CHECKED_IF( flag )
+with expansion:
+ false
+
+Misc.tests.cpp:<line number>: FAILED:
+ REQUIRE( testCheckedIf( false ) )
+with expansion:
+ false
+
+-------------------------------------------------------------------------------
+comparisons between const int variables
+-------------------------------------------------------------------------------
+Condition.tests.cpp:<line number>
+...............................................................................
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( unsigned_char_var == 1 )
+with expansion:
+ 1 == 1
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( unsigned_short_var == 1 )
+with expansion:
+ 1 == 1
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( unsigned_int_var == 1 )
+with expansion:
+ 1 == 1
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( unsigned_long_var == 1 )
+with expansion:
+ 1 == 1
+
+-------------------------------------------------------------------------------
+comparisons between int variables
+-------------------------------------------------------------------------------
+Condition.tests.cpp:<line number>
+...............................................................................
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( long_var == unsigned_char_var )
+with expansion:
+ 1 == 1
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( long_var == unsigned_short_var )
+with expansion:
+ 1 == 1
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( long_var == unsigned_int_var )
+with expansion:
+ 1 == 1
+
+Condition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( long_var == unsigned_long_var )
+with expansion:
+ 1 == 1
+
+-------------------------------------------------------------------------------
+even more nested SECTION tests
+ c
+ d (leaf)
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+
+-------------------------------------------------------------------------------
+even more nested SECTION tests
+ c
+ e (leaf)
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+
+-------------------------------------------------------------------------------
+even more nested SECTION tests
+ f (leaf)
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+
+-------------------------------------------------------------------------------
+first tag
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+
+No assertions in test case 'first tag'
+
+loose text artifact
+-------------------------------------------------------------------------------
+has printf
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+
+No assertions in test case 'has printf'
+
+-------------------------------------------------------------------------------
+just failure
+-------------------------------------------------------------------------------
+Message.tests.cpp:<line number>
+...............................................................................
+
+Message.tests.cpp:<line number>: FAILED:
+explicitly with message:
+ Previous info should not be seen
+
+-------------------------------------------------------------------------------
+just info
+-------------------------------------------------------------------------------
+Message.tests.cpp:<line number>
+...............................................................................
+
+
+No assertions in test case 'just info'
+
+-------------------------------------------------------------------------------
+long long
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( l == std::numeric_limits<long long>::max() )
+with expansion:
+ 9223372036854775807 (0x<hex digits>)
+ ==
+ 9223372036854775807 (0x<hex digits>)
+
+-------------------------------------------------------------------------------
+looped SECTION tests
+ s1
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>: FAILED:
+ CHECK( b > a )
+with expansion:
+ 0 > 1
+
+-------------------------------------------------------------------------------
+looped tests
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>: FAILED:
+ CHECK( ( fib[i] % 2 ) == 0 )
+with expansion:
+ 1 == 0
+with message:
+ Testing if fib[0] (1) is even
+
+Misc.tests.cpp:<line number>: FAILED:
+ CHECK( ( fib[i] % 2 ) == 0 )
+with expansion:
+ 1 == 0
+with message:
+ Testing if fib[1] (1) is even
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ CHECK( ( fib[i] % 2 ) == 0 )
+with expansion:
+ 0 == 0
+with message:
+ Testing if fib[2] (2) is even
+
+Misc.tests.cpp:<line number>: FAILED:
+ CHECK( ( fib[i] % 2 ) == 0 )
+with expansion:
+ 1 == 0
+with message:
+ Testing if fib[3] (3) is even
+
+Misc.tests.cpp:<line number>: FAILED:
+ CHECK( ( fib[i] % 2 ) == 0 )
+with expansion:
+ 1 == 0
+with message:
+ Testing if fib[4] (5) is even
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ CHECK( ( fib[i] % 2 ) == 0 )
+with expansion:
+ 0 == 0
+with message:
+ Testing if fib[5] (8) is even
+
+Misc.tests.cpp:<line number>: FAILED:
+ CHECK( ( fib[i] % 2 ) == 0 )
+with expansion:
+ 1 == 0
+with message:
+ Testing if fib[6] (13) is even
+
+Misc.tests.cpp:<line number>: FAILED:
+ CHECK( ( fib[i] % 2 ) == 0 )
+with expansion:
+ 1 == 0
+with message:
+ Testing if fib[7] (21) is even
+
+-------------------------------------------------------------------------------
+more nested SECTION tests
+ s1
+ s2
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>: FAILED:
+ REQUIRE( a == b )
+with expansion:
+ 1 == 2
+
+-------------------------------------------------------------------------------
+more nested SECTION tests
+ s1
+ s3
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( a != b )
+with expansion:
+ 1 != 2
+
+-------------------------------------------------------------------------------
+more nested SECTION tests
+ s1
+ s4
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( a < b )
+with expansion:
+ 1 < 2
+
+-------------------------------------------------------------------------------
+nested SECTION tests
+ s1
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( a != b )
+with expansion:
+ 1 != 2
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( b != a )
+with expansion:
+ 2 != 1
+
+-------------------------------------------------------------------------------
+nested SECTION tests
+ s1
+ s2
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( a != b )
+with expansion:
+ 1 != 2
+
+-------------------------------------------------------------------------------
+non streamable - with conv. op
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( s == "7" )
+with expansion:
+ "7" == "7"
+
+-------------------------------------------------------------------------------
+non-copyable objects
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ CHECK( ti == typeid(int) )
+with expansion:
+ {?} == {?}
+
+-------------------------------------------------------------------------------
+not allowed
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+
+-------------------------------------------------------------------------------
+null strings
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( makeString( false ) != static_cast<char*>(0) )
+with expansion:
+ "valid string" != {null string}
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( makeString( true ) == static_cast<char*>(0) )
+with expansion:
+ {null string} == {null string}
+
+-------------------------------------------------------------------------------
+null_ptr
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ptr.get() == 0 )
+with expansion:
+ 0 == 0
+
+-------------------------------------------------------------------------------
+pair<pair<int,const char *,pair<std::string,int> > -> toString
+-------------------------------------------------------------------------------
+ToStringPair.tests.cpp:<line number>
+...............................................................................
+
+ToStringPair.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ::Catch::Detail::stringify( pair ) == "{ { 42, \"Arthur\" }, { \"Ford\", 24 } }" )
+with expansion:
+ "{ { 42, "Arthur" }, { "Ford", 24 } }"
+ ==
+ "{ { 42, "Arthur" }, { "Ford", 24 } }"
+
+-------------------------------------------------------------------------------
+pointer to class
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( p == 0 )
+with expansion:
+ 0 == 0
+
+-------------------------------------------------------------------------------
+random SECTION tests
+ s1
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( a != b )
+with expansion:
+ 1 != 2
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( b != a )
+with expansion:
+ 2 != 1
+
+-------------------------------------------------------------------------------
+random SECTION tests
+ s2
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( a != b )
+with expansion:
+ 1 != 2
+
+-------------------------------------------------------------------------------
+replaceInPlace
+ replace single char
+-------------------------------------------------------------------------------
+String.tests.cpp:<line number>
+...............................................................................
+
+String.tests.cpp:<line number>:
+PASSED:
+ CHECK( Catch::replaceInPlace( letters, "b", "z" ) )
+with expansion:
+ true
+
+String.tests.cpp:<line number>:
+PASSED:
+ CHECK( letters == "azcdefcg" )
+with expansion:
+ "azcdefcg" == "azcdefcg"
+
+-------------------------------------------------------------------------------
+replaceInPlace
+ replace two chars
+-------------------------------------------------------------------------------
+String.tests.cpp:<line number>
+...............................................................................
+
+String.tests.cpp:<line number>:
+PASSED:
+ CHECK( Catch::replaceInPlace( letters, "c", "z" ) )
+with expansion:
+ true
+
+String.tests.cpp:<line number>:
+PASSED:
+ CHECK( letters == "abzdefzg" )
+with expansion:
+ "abzdefzg" == "abzdefzg"
+
+-------------------------------------------------------------------------------
+replaceInPlace
+ replace first char
+-------------------------------------------------------------------------------
+String.tests.cpp:<line number>
+...............................................................................
+
+String.tests.cpp:<line number>:
+PASSED:
+ CHECK( Catch::replaceInPlace( letters, "a", "z" ) )
+with expansion:
+ true
+
+String.tests.cpp:<line number>:
+PASSED:
+ CHECK( letters == "zbcdefcg" )
+with expansion:
+ "zbcdefcg" == "zbcdefcg"
+
+-------------------------------------------------------------------------------
+replaceInPlace
+ replace last char
+-------------------------------------------------------------------------------
+String.tests.cpp:<line number>
+...............................................................................
+
+String.tests.cpp:<line number>:
+PASSED:
+ CHECK( Catch::replaceInPlace( letters, "g", "z" ) )
+with expansion:
+ true
+
+String.tests.cpp:<line number>:
+PASSED:
+ CHECK( letters == "abcdefcz" )
+with expansion:
+ "abcdefcz" == "abcdefcz"
+
+-------------------------------------------------------------------------------
+replaceInPlace
+ replace all chars
+-------------------------------------------------------------------------------
+String.tests.cpp:<line number>
+...............................................................................
+
+String.tests.cpp:<line number>:
+PASSED:
+ CHECK( Catch::replaceInPlace( letters, letters, "replaced" ) )
+with expansion:
+ true
+
+String.tests.cpp:<line number>:
+PASSED:
+ CHECK( letters == "replaced" )
+with expansion:
+ "replaced" == "replaced"
+
+-------------------------------------------------------------------------------
+replaceInPlace
+ replace no chars
+-------------------------------------------------------------------------------
+String.tests.cpp:<line number>
+...............................................................................
+
+String.tests.cpp:<line number>:
+PASSED:
+ CHECK_FALSE( Catch::replaceInPlace( letters, "x", "z" ) )
+with expansion:
+ !false
+
+String.tests.cpp:<line number>:
+PASSED:
+ CHECK( letters == letters )
+with expansion:
+ "abcdefcg" == "abcdefcg"
+
+-------------------------------------------------------------------------------
+replaceInPlace
+ escape '
+-------------------------------------------------------------------------------
+String.tests.cpp:<line number>
+...............................................................................
+
+String.tests.cpp:<line number>:
+PASSED:
+ CHECK( Catch::replaceInPlace( s, "'", "|'" ) )
+with expansion:
+ true
+
+String.tests.cpp:<line number>:
+PASSED:
+ CHECK( s == "didn|'t" )
+with expansion:
+ "didn|'t" == "didn|'t"
+
+-------------------------------------------------------------------------------
+second tag
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+
+No assertions in test case 'second tag'
+
+-------------------------------------------------------------------------------
+send a single char to INFO
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>: FAILED:
+ REQUIRE( false )
+with message:
+ 3
+
+-------------------------------------------------------------------------------
+sends information to INFO
+-------------------------------------------------------------------------------
+Message.tests.cpp:<line number>
+...............................................................................
+
+Message.tests.cpp:<line number>: FAILED:
+ REQUIRE( false )
+with messages:
+ hi
+ i := 7
+
+-------------------------------------------------------------------------------
+std::map is convertible string
+ empty
+-------------------------------------------------------------------------------
+ToStringGeneral.tests.cpp:<line number>
+...............................................................................
+
+ToStringGeneral.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( Catch::Detail::stringify( emptyMap ) == "{ }" )
+with expansion:
+ "{ }" == "{ }"
+
+-------------------------------------------------------------------------------
+std::map is convertible string
+ single item
+-------------------------------------------------------------------------------
+ToStringGeneral.tests.cpp:<line number>
+...............................................................................
+
+ToStringGeneral.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( Catch::Detail::stringify( map ) == "{ { \"one\", 1 } }" )
+with expansion:
+ "{ { "one", 1 } }" == "{ { "one", 1 } }"
+
+-------------------------------------------------------------------------------
+std::map is convertible string
+ several items
+-------------------------------------------------------------------------------
+ToStringGeneral.tests.cpp:<line number>
+...............................................................................
+
+ToStringGeneral.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( Catch::Detail::stringify( map ) == "{ { \"abc\", 1 }, { \"def\", 2 }, { \"ghi\", 3 } }" )
+with expansion:
+ "{ { "abc", 1 }, { "def", 2 }, { "ghi", 3 } }"
+ ==
+ "{ { "abc", 1 }, { "def", 2 }, { "ghi", 3 } }"
+
+-------------------------------------------------------------------------------
+std::pair<int,const std::string> -> toString
+-------------------------------------------------------------------------------
+ToStringPair.tests.cpp:<line number>
+...............................................................................
+
+ToStringPair.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ::Catch::Detail::stringify(value) == "{ 34, \"xyzzy\" }" )
+with expansion:
+ "{ 34, "xyzzy" }" == "{ 34, "xyzzy" }"
+
+-------------------------------------------------------------------------------
+std::pair<int,std::string> -> toString
+-------------------------------------------------------------------------------
+ToStringPair.tests.cpp:<line number>
+...............................................................................
+
+ToStringPair.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ::Catch::Detail::stringify( value ) == "{ 34, \"xyzzy\" }" )
+with expansion:
+ "{ 34, "xyzzy" }" == "{ 34, "xyzzy" }"
+
+-------------------------------------------------------------------------------
+std::set is convertible string
+ empty
+-------------------------------------------------------------------------------
+ToStringGeneral.tests.cpp:<line number>
+...............................................................................
+
+ToStringGeneral.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( Catch::Detail::stringify( emptySet ) == "{ }" )
+with expansion:
+ "{ }" == "{ }"
+
+-------------------------------------------------------------------------------
+std::set is convertible string
+ single item
+-------------------------------------------------------------------------------
+ToStringGeneral.tests.cpp:<line number>
+...............................................................................
+
+ToStringGeneral.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( Catch::Detail::stringify( set ) == "{ \"one\" }" )
+with expansion:
+ "{ "one" }" == "{ "one" }"
+
+-------------------------------------------------------------------------------
+std::set is convertible string
+ several items
+-------------------------------------------------------------------------------
+ToStringGeneral.tests.cpp:<line number>
+...............................................................................
+
+ToStringGeneral.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( Catch::Detail::stringify( set ) == "{ \"abc\", \"def\", \"ghi\" }" )
+with expansion:
+ "{ "abc", "def", "ghi" }"
+ ==
+ "{ "abc", "def", "ghi" }"
+
+-------------------------------------------------------------------------------
+std::vector<std::pair<std::string,int> > -> toString
+-------------------------------------------------------------------------------
+ToStringPair.tests.cpp:<line number>
+...............................................................................
+
+ToStringPair.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ::Catch::Detail::stringify( pr ) == "{ { \"green\", 55 } }" )
+with expansion:
+ "{ { "green", 55 } }"
+ ==
+ "{ { "green", 55 } }"
+
+-------------------------------------------------------------------------------
+string literals of different sizes can be compared
+-------------------------------------------------------------------------------
+Tricky.tests.cpp:<line number>
+...............................................................................
+
+Tricky.tests.cpp:<line number>: FAILED:
+ REQUIRE( std::string( "first" ) == "second" )
+with expansion:
+ "first" == "second"
+
+-------------------------------------------------------------------------------
+stringify( has_maker )
+-------------------------------------------------------------------------------
+ToStringWhich.tests.cpp:<line number>
+...............................................................................
+
+ToStringWhich.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ::Catch::Detail::stringify( item ) == "StringMaker<has_maker>" )
+with expansion:
+ "StringMaker<has_maker>"
+ ==
+ "StringMaker<has_maker>"
+
+-------------------------------------------------------------------------------
+stringify( has_maker_and_toString )
+-------------------------------------------------------------------------------
+ToStringWhich.tests.cpp:<line number>
+...............................................................................
+
+ToStringWhich.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ::Catch::Detail::stringify( item ) == "StringMaker<has_maker_and_operator>" )
+with expansion:
+ "StringMaker<has_maker_and_operator>"
+ ==
+ "StringMaker<has_maker_and_operator>"
+
+-------------------------------------------------------------------------------
+stringify( has_operator )
+-------------------------------------------------------------------------------
+ToStringWhich.tests.cpp:<line number>
+...............................................................................
+
+ToStringWhich.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ::Catch::Detail::stringify( item ) == "operator<<( has_operator )" )
+with expansion:
+ "operator<<( has_operator )"
+ ==
+ "operator<<( has_operator )"
+
+-------------------------------------------------------------------------------
+toString on const wchar_t const pointer returns the string contents
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ CHECK( result == "\"wide load\"" )
+with expansion:
+ ""wide load"" == ""wide load""
+
+-------------------------------------------------------------------------------
+toString on const wchar_t pointer returns the string contents
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ CHECK( result == "\"wide load\"" )
+with expansion:
+ ""wide load"" == ""wide load""
+
+-------------------------------------------------------------------------------
+toString on wchar_t const pointer returns the string contents
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ CHECK( result == "\"wide load\"" )
+with expansion:
+ ""wide load"" == ""wide load""
+
+-------------------------------------------------------------------------------
+toString on wchar_t returns the string contents
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ CHECK( result == "\"wide load\"" )
+with expansion:
+ ""wide load"" == ""wide load""
+
+-------------------------------------------------------------------------------
+toString streamable range
+-------------------------------------------------------------------------------
+ToStringWhich.tests.cpp:<line number>
+...............................................................................
+
+ToStringWhich.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ::Catch::Detail::stringify(streamable_range{}) == "op<<(streamable_range)" )
+with expansion:
+ "op<<(streamable_range)"
+ ==
+ "op<<(streamable_range)"
+
+ToStringWhich.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ::Catch::Detail::stringify(stringmaker_range{}) == "stringmaker(streamable_range)" )
+with expansion:
+ "stringmaker(streamable_range)"
+ ==
+ "stringmaker(streamable_range)"
+
+ToStringWhich.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ::Catch::Detail::stringify(just_range{}) == "{ 1, 2, 3, 4 }" )
+with expansion:
+ "{ 1, 2, 3, 4 }" == "{ 1, 2, 3, 4 }"
+
+ToStringWhich.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ::Catch::Detail::stringify(disabled_range{}) == "{?}" )
+with expansion:
+ "{?}" == "{?}"
+
+-------------------------------------------------------------------------------
+toString( vectors<has_maker> )
+-------------------------------------------------------------------------------
+ToStringWhich.tests.cpp:<line number>
+...............................................................................
+
+ToStringWhich.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ::Catch::Detail::stringify( v ) == "{ StringMaker<has_maker> }" )
+with expansion:
+ "{ StringMaker<has_maker> }"
+ ==
+ "{ StringMaker<has_maker> }"
+
+-------------------------------------------------------------------------------
+toString( vectors<has_maker_and_operator> )
+-------------------------------------------------------------------------------
+ToStringWhich.tests.cpp:<line number>
+...............................................................................
+
+ToStringWhich.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ::Catch::Detail::stringify( v ) == "{ StringMaker<has_maker_and_operator> }" )
+with expansion:
+ "{ StringMaker<has_maker_and_operator> }"
+ ==
+ "{ StringMaker<has_maker_and_operator> }"
+
+-------------------------------------------------------------------------------
+toString( vectors<has_operator> )
+-------------------------------------------------------------------------------
+ToStringWhich.tests.cpp:<line number>
+...............................................................................
+
+ToStringWhich.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ::Catch::Detail::stringify( v ) == "{ operator<<( has_operator ) }" )
+with expansion:
+ "{ operator<<( has_operator ) }"
+ ==
+ "{ operator<<( has_operator ) }"
+
+-------------------------------------------------------------------------------
+toString(enum class w/operator<<)
+-------------------------------------------------------------------------------
+EnumToString.tests.cpp:<line number>
+...............................................................................
+
+EnumToString.tests.cpp:<line number>:
+PASSED:
+ CHECK( ::Catch::Detail::stringify(e0) == "E2/V0" )
+with expansion:
+ "E2/V0" == "E2/V0"
+
+EnumToString.tests.cpp:<line number>:
+PASSED:
+ CHECK( ::Catch::Detail::stringify(e1) == "E2/V1" )
+with expansion:
+ "E2/V1" == "E2/V1"
+
+EnumToString.tests.cpp:<line number>:
+PASSED:
+ CHECK( ::Catch::Detail::stringify(e3) == "Unknown enum value 10" )
+with expansion:
+ "Unknown enum value 10"
+ ==
+ "Unknown enum value 10"
+
+-------------------------------------------------------------------------------
+toString(enum class)
+-------------------------------------------------------------------------------
+EnumToString.tests.cpp:<line number>
+...............................................................................
+
+EnumToString.tests.cpp:<line number>:
+PASSED:
+ CHECK( ::Catch::Detail::stringify(e0) == "0" )
+with expansion:
+ "0" == "0"
+
+EnumToString.tests.cpp:<line number>:
+PASSED:
+ CHECK( ::Catch::Detail::stringify(e1) == "1" )
+with expansion:
+ "1" == "1"
+
+-------------------------------------------------------------------------------
+toString(enum w/operator<<)
+-------------------------------------------------------------------------------
+EnumToString.tests.cpp:<line number>
+...............................................................................
+
+EnumToString.tests.cpp:<line number>:
+PASSED:
+ CHECK( ::Catch::Detail::stringify(e0) == "E2{0}" )
+with expansion:
+ "E2{0}" == "E2{0}"
+
+EnumToString.tests.cpp:<line number>:
+PASSED:
+ CHECK( ::Catch::Detail::stringify(e1) == "E2{1}" )
+with expansion:
+ "E2{1}" == "E2{1}"
+
+-------------------------------------------------------------------------------
+toString(enum)
+-------------------------------------------------------------------------------
+EnumToString.tests.cpp:<line number>
+...............................................................................
+
+EnumToString.tests.cpp:<line number>:
+PASSED:
+ CHECK( ::Catch::Detail::stringify(e0) == "0" )
+with expansion:
+ "0" == "0"
+
+EnumToString.tests.cpp:<line number>:
+PASSED:
+ CHECK( ::Catch::Detail::stringify(e1) == "1" )
+with expansion:
+ "1" == "1"
+
+-------------------------------------------------------------------------------
+tuple<>
+-------------------------------------------------------------------------------
+ToStringTuple.tests.cpp:<line number>
+...............................................................................
+
+ToStringTuple.tests.cpp:<line number>:
+PASSED:
+ CHECK( "{ }" == ::Catch::Detail::stringify(type{}) )
+with expansion:
+ "{ }" == "{ }"
+
+ToStringTuple.tests.cpp:<line number>:
+PASSED:
+ CHECK( "{ }" == ::Catch::Detail::stringify(value) )
+with expansion:
+ "{ }" == "{ }"
+
+-------------------------------------------------------------------------------
+tuple<float,int>
+-------------------------------------------------------------------------------
+ToStringTuple.tests.cpp:<line number>
+...............................................................................
+
+ToStringTuple.tests.cpp:<line number>:
+PASSED:
+ CHECK( "1.2f" == ::Catch::Detail::stringify(float(1.2)) )
+with expansion:
+ "1.2f" == "1.2f"
+
+ToStringTuple.tests.cpp:<line number>:
+PASSED:
+ CHECK( "{ 1.2f, 0 }" == ::Catch::Detail::stringify(type{1.2f,0}) )
+with expansion:
+ "{ 1.2f, 0 }" == "{ 1.2f, 0 }"
+
+-------------------------------------------------------------------------------
+tuple<int>
+-------------------------------------------------------------------------------
+ToStringTuple.tests.cpp:<line number>
+...............................................................................
+
+ToStringTuple.tests.cpp:<line number>:
+PASSED:
+ CHECK( "{ 0 }" == ::Catch::Detail::stringify(type{0}) )
+with expansion:
+ "{ 0 }" == "{ 0 }"
+
+-------------------------------------------------------------------------------
+tuple<0,int,const char *>
+-------------------------------------------------------------------------------
+ToStringTuple.tests.cpp:<line number>
+...............................................................................
+
+ToStringTuple.tests.cpp:<line number>:
+PASSED:
+ CHECK( "{ 0, 42, \"Catch me\" }" == ::Catch::Detail::stringify(value) )
+with expansion:
+ "{ 0, 42, "Catch me" }"
+ ==
+ "{ 0, 42, "Catch me" }"
+
+-------------------------------------------------------------------------------
+tuple<string,string>
+-------------------------------------------------------------------------------
+ToStringTuple.tests.cpp:<line number>
+...............................................................................
+
+ToStringTuple.tests.cpp:<line number>:
+PASSED:
+ CHECK( "{ \"hello\", \"world\" }" == ::Catch::Detail::stringify(type{"hello","world"}) )
+with expansion:
+ "{ "hello", "world" }"
+ ==
+ "{ "hello", "world" }"
+
+-------------------------------------------------------------------------------
+tuple<tuple<int>,tuple<>,float>
+-------------------------------------------------------------------------------
+ToStringTuple.tests.cpp:<line number>
+...............................................................................
+
+ToStringTuple.tests.cpp:<line number>:
+PASSED:
+ CHECK( "{ { 42 }, { }, 1.2f }" == ::Catch::Detail::stringify(value) )
+with expansion:
+ "{ { 42 }, { }, 1.2f }"
+ ==
+ "{ { 42 }, { }, 1.2f }"
+
+-------------------------------------------------------------------------------
+vec<vec<string,alloc>> -> toString
+-------------------------------------------------------------------------------
+ToStringVector.tests.cpp:<line number>
+...............................................................................
+
+ToStringVector.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ::Catch::Detail::stringify(v) == "{ }" )
+with expansion:
+ "{ }" == "{ }"
+
+ToStringVector.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ::Catch::Detail::stringify(v) == "{ { \"hello\" }, { \"world\" } }" )
+with expansion:
+ "{ { "hello" }, { "world" } }"
+ ==
+ "{ { "hello" }, { "world" } }"
+
+-------------------------------------------------------------------------------
+vector<bool> -> toString
+-------------------------------------------------------------------------------
+ToStringVector.tests.cpp:<line number>
+...............................................................................
+
+ToStringVector.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ::Catch::Detail::stringify(bools) == "{ }" )
+with expansion:
+ "{ }" == "{ }"
+
+ToStringVector.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ::Catch::Detail::stringify(bools) == "{ true }" )
+with expansion:
+ "{ true }" == "{ true }"
+
+ToStringVector.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ::Catch::Detail::stringify(bools) == "{ true, false }" )
+with expansion:
+ "{ true, false }" == "{ true, false }"
+
+-------------------------------------------------------------------------------
+vector<int,allocator> -> toString
+-------------------------------------------------------------------------------
+ToStringVector.tests.cpp:<line number>
+...............................................................................
+
+ToStringVector.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ::Catch::Detail::stringify(vv) == "{ }" )
+with expansion:
+ "{ }" == "{ }"
+
+ToStringVector.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ::Catch::Detail::stringify(vv) == "{ 42 }" )
+with expansion:
+ "{ 42 }" == "{ 42 }"
+
+ToStringVector.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ::Catch::Detail::stringify(vv) == "{ 42, 250 }" )
+with expansion:
+ "{ 42, 250 }" == "{ 42, 250 }"
+
+-------------------------------------------------------------------------------
+vector<int> -> toString
+-------------------------------------------------------------------------------
+ToStringVector.tests.cpp:<line number>
+...............................................................................
+
+ToStringVector.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ::Catch::Detail::stringify(vv) == "{ }" )
+with expansion:
+ "{ }" == "{ }"
+
+ToStringVector.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ::Catch::Detail::stringify(vv) == "{ 42 }" )
+with expansion:
+ "{ 42 }" == "{ 42 }"
+
+ToStringVector.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ::Catch::Detail::stringify(vv) == "{ 42, 250 }" )
+with expansion:
+ "{ 42, 250 }" == "{ 42, 250 }"
+
+-------------------------------------------------------------------------------
+vector<string> -> toString
+-------------------------------------------------------------------------------
+ToStringVector.tests.cpp:<line number>
+...............................................................................
+
+ToStringVector.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ::Catch::Detail::stringify(vv) == "{ }" )
+with expansion:
+ "{ }" == "{ }"
+
+ToStringVector.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ::Catch::Detail::stringify(vv) == "{ \"hello\" }" )
+with expansion:
+ "{ "hello" }" == "{ "hello" }"
+
+ToStringVector.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( ::Catch::Detail::stringify(vv) == "{ \"hello\", \"world\" }" )
+with expansion:
+ "{ "hello", "world" }"
+ ==
+ "{ "hello", "world" }"
+
+-------------------------------------------------------------------------------
+vectors can be sized and resized
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( v.size() == 5 )
+with expansion:
+ 5 == 5
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( v.capacity() >= 5 )
+with expansion:
+ 5 >= 5
+
+-------------------------------------------------------------------------------
+vectors can be sized and resized
+ resizing bigger changes size and capacity
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( v.size() == 10 )
+with expansion:
+ 10 == 10
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( v.capacity() >= 10 )
+with expansion:
+ 10 >= 10
+
+-------------------------------------------------------------------------------
+vectors can be sized and resized
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( v.size() == 5 )
+with expansion:
+ 5 == 5
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( v.capacity() >= 5 )
+with expansion:
+ 5 >= 5
+
+-------------------------------------------------------------------------------
+vectors can be sized and resized
+ resizing smaller changes size but not capacity
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( v.size() == 0 )
+with expansion:
+ 0 == 0
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( v.capacity() >= 5 )
+with expansion:
+ 5 >= 5
+
+-------------------------------------------------------------------------------
+vectors can be sized and resized
+ resizing smaller changes size but not capacity
+ We can use the 'swap trick' to reset the capacity
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( v.capacity() == 0 )
+with expansion:
+ 0 == 0
+
+-------------------------------------------------------------------------------
+vectors can be sized and resized
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( v.size() == 5 )
+with expansion:
+ 5 == 5
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( v.capacity() >= 5 )
+with expansion:
+ 5 >= 5
+
+-------------------------------------------------------------------------------
+vectors can be sized and resized
+ reserving bigger changes capacity but not size
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( v.size() == 5 )
+with expansion:
+ 5 == 5
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( v.capacity() >= 10 )
+with expansion:
+ 10 >= 10
+
+-------------------------------------------------------------------------------
+vectors can be sized and resized
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( v.size() == 5 )
+with expansion:
+ 5 == 5
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( v.capacity() >= 5 )
+with expansion:
+ 5 >= 5
+
+-------------------------------------------------------------------------------
+vectors can be sized and resized
+ reserving smaller does not change size or capacity
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( v.size() == 5 )
+with expansion:
+ 5 == 5
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( v.capacity() >= 5 )
+with expansion:
+ 5 >= 5
+
+-------------------------------------------------------------------------------
+xmlentitycheck
+ embedded xml
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+
+-------------------------------------------------------------------------------
+xmlentitycheck
+ encoded chars
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+
+===============================================================================
+test cases: 198 | 133 passed | 61 failed | 4 failed as expected
+assertions: 1007 | 866 passed | 120 failed | 21 failed as expected
+
diff --git a/projects/SelfTest/Baselines/console.swa4.approved.txt b/projects/SelfTest/Baselines/console.swa4.approved.txt
new file mode 100644
index 0000000..6232f8d
--- /dev/null
+++ b/projects/SelfTest/Baselines/console.swa4.approved.txt
@@ -0,0 +1,304 @@
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+<exe-name> is a <version> host application.
+Run with -? for options
+
+-------------------------------------------------------------------------------
+# A test name that starts with a #
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+with message:
+ yay
+
+-------------------------------------------------------------------------------
+#1005: Comparing pointer to int and long (NULL can be either on various
+ systems)
+-------------------------------------------------------------------------------
+Decomposition.tests.cpp:<line number>
+...............................................................................
+
+Decomposition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( fptr == 0 )
+with expansion:
+ 0 == 0
+
+Decomposition.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( fptr == 0l )
+with expansion:
+ 0 == 0
+
+-------------------------------------------------------------------------------
+#1027
+-------------------------------------------------------------------------------
+Compilation.tests.cpp:<line number>
+...............................................................................
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( y.v == 0 )
+with expansion:
+ 0 == 0
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( 0 == y.v )
+with expansion:
+ 0 == 0
+
+-------------------------------------------------------------------------------
+#1147
+-------------------------------------------------------------------------------
+Compilation.tests.cpp:<line number>
+...............................................................................
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( t1 == t2 )
+with expansion:
+ {?} == {?}
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( t1 != t2 )
+with expansion:
+ {?} != {?}
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( t1 < t2 )
+with expansion:
+ {?} < {?}
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( t1 > t2 )
+with expansion:
+ {?} > {?}
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( t1 <= t2 )
+with expansion:
+ {?} <= {?}
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( t1 >= t2 )
+with expansion:
+ {?} >= {?}
+
+-------------------------------------------------------------------------------
+#748 - captures with unexpected exceptions
+ outside assertions
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+due to unexpected exception with messages:
+ answer := 42
+ expected exception
+
+-------------------------------------------------------------------------------
+#748 - captures with unexpected exceptions
+ inside REQUIRE_NOTHROW
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>: FAILED:
+ REQUIRE_NOTHROW( thisThrows() )
+due to unexpected exception with messages:
+ answer := 42
+ expected exception
+
+-------------------------------------------------------------------------------
+#748 - captures with unexpected exceptions
+ inside REQUIRE_THROWS
+-------------------------------------------------------------------------------
+Exception.tests.cpp:<line number>
+...............................................................................
+
+Exception.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THROWS( thisThrows() )
+with message:
+ answer := 42
+
+-------------------------------------------------------------------------------
+#809
+-------------------------------------------------------------------------------
+Compilation.tests.cpp:<line number>
+...............................................................................
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( 42 == f )
+with expansion:
+ 42 == {?}
+
+-------------------------------------------------------------------------------
+#833
+-------------------------------------------------------------------------------
+Compilation.tests.cpp:<line number>
+...............................................................................
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( a == t )
+with expansion:
+ 3 == 3
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ CHECK( a == t )
+with expansion:
+ 3 == 3
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THROWS( throws_int(true) )
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ CHECK_THROWS_AS( throws_int(true), int )
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_NOTHROW( throws_int(false) )
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE_THAT( "aaa", Catch::EndsWith("aaa") )
+with expansion:
+ "aaa" ends with: "aaa"
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( templated_tests<int>(3) )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+#835 -- errno should not be touched by Catch
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>: FAILED:
+ CHECK( f() == 0 )
+with expansion:
+ 1 == 0
+
+Misc.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( errno == 1 )
+with expansion:
+ 1 == 1
+
+-------------------------------------------------------------------------------
+#872
+-------------------------------------------------------------------------------
+Compilation.tests.cpp:<line number>
+...............................................................................
+
+Compilation.tests.cpp:<line number>:
+PASSED:
+ REQUIRE( x == 4 )
+with expansion:
+ {?} == 4
+with message:
+ dummy := 0
+
+-------------------------------------------------------------------------------
+#961 -- Dynamically created sections should all be reported
+ Looped section 0
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+with message:
+ Everything is OK
+
+-------------------------------------------------------------------------------
+#961 -- Dynamically created sections should all be reported
+ Looped section 1
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+with message:
+ Everything is OK
+
+-------------------------------------------------------------------------------
+#961 -- Dynamically created sections should all be reported
+ Looped section 2
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+with message:
+ Everything is OK
+
+-------------------------------------------------------------------------------
+#961 -- Dynamically created sections should all be reported
+ Looped section 3
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+with message:
+ Everything is OK
+
+-------------------------------------------------------------------------------
+#961 -- Dynamically created sections should all be reported
+ Looped section 4
+-------------------------------------------------------------------------------
+Misc.tests.cpp:<line number>
+...............................................................................
+
+Misc.tests.cpp:<line number>:
+PASSED:
+with message:
+ Everything is OK
+
+-------------------------------------------------------------------------------
+'Not' checks that should fail
+-------------------------------------------------------------------------------
+Condition.tests.cpp:<line number>
+...............................................................................
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( false != false )
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( true != true )
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK( !true )
+with expansion:
+ false
+
+Condition.tests.cpp:<line number>: FAILED:
+ CHECK_FALSE( true )
+with expansion:
+ !true
+
+===============================================================================
+test cases: 11 | 8 passed | 1 failed | 2 failed as expected
+assertions: 34 | 27 passed | 4 failed | 3 failed as expected
+
diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt
new file mode 100644
index 0000000..b99f0b8
--- /dev/null
+++ b/projects/SelfTest/Baselines/junit.sw.approved.txt
@@ -0,0 +1,865 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<testsuitesloose text artifact
+>
+ <testsuite name="<exe-name>" errors="15" failures="106" tests="1008" 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="#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="#1147" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="#748 - captures with unexpected exceptions/outside assertions" time="{duration}">
+ <error type="TEST_CASE">
+expected exception
+answer := 42
+Exception.tests.cpp:<line number>
+ </error>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="#748 - captures with unexpected exceptions/inside REQUIRE_NOTHROW" time="{duration}">
+ <error message="thisThrows()" type="REQUIRE_NOTHROW">
+expected exception
+answer := 42
+Exception.tests.cpp:<line number>
+ </error>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="#748 - captures with unexpected exceptions/inside REQUIRE_THROWS" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="#809" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="#833" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="#835 -- errno should not be touched by Catch" time="{duration}">
+ <failure message="1 == 0" type="CHECK">
+Misc.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="#872" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="#961 -- Dynamically created sections should all be reported/Looped section 0" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="#961 -- Dynamically created sections should all be reported/Looped section 1" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="#961 -- Dynamically created sections should all be reported/Looped section 2" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="#961 -- Dynamically created sections should all be reported/Looped section 3" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="#961 -- Dynamically created sections should all be reported/Looped section 4" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="'Not' checks that should fail" time="{duration}">
+ <failure message="false != false" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message="true != true" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message="false" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message="!true" type="CHECK_FALSE">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message="false" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message="!true" type="CHECK_FALSE">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message="false" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message="!(1 == 1)" type="CHECK_FALSE">
+Condition.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="'Not' checks that should succeed" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="(unimplemented) static bools can be evaluated/compare to true" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="(unimplemented) static bools can be evaluated/compare to false" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="(unimplemented) static bools can be evaluated/negation" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="(unimplemented) static bools can be evaluated/double negation" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="(unimplemented) static bools can be evaluated/direct" time="{duration}"/>
+ <testcase classname="<exe-name>.TestClass" name="A METHOD_AS_TEST_CASE based test run that fails" time="{duration}">
+ <failure message=""hello" == "world"" type="REQUIRE">
+Class.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.TestClass" name="A METHOD_AS_TEST_CASE based test run that succeeds" time="{duration}"/>
+ <testcase classname="<exe-name>.Fixture" name="A TEST_CASE_METHOD based test run that fails" time="{duration}">
+ <failure message="1 == 2" type="REQUIRE">
+Class.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.Fixture" name="A TEST_CASE_METHOD based test run that succeeds" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="A couple of nested sections followed by a failure" time="{duration}">
+ <failure type="FAIL">
+to infinity and beyond
+Misc.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="A couple of nested sections followed by a failure/Outer/Inner" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="A failing expression with a non streamable type is still captured" time="{duration}">
+ <failure message="0x<hex digits> == 0x<hex digits>" type="CHECK">
+Tricky.tests.cpp:<line number>
+ </failure>
+ <failure message="{?} == {?}" type="CHECK">
+Tricky.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Absolute margin" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="An expression with side-effects should only be evaluated once" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="An unchecked exception reports the line of the last assertion" time="{duration}">
+ <error message="{Unknown expression after the reported line}">
+unexpected exception
+Exception.tests.cpp:<line number>
+ </error>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Anonymous test case 1" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Approx setters validate their arguments" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Approx with exactly-representable margin" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Approximate PI" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Approximate comparisons with different epsilons" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Approximate comparisons with floats" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Approximate comparisons with ints" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Approximate comparisons with mixed numeric types" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Assertions then sections" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Assertions then sections/A section" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Assertions then sections/A section/Another section" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Assertions then sections/A section/Another other section" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Assorted miscellaneous tests" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Bitfields can be captured (#1027)" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Capture and info messages/Capture should stringify like assertions" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Capture and info messages/Info should NOT stringify the way assertions do" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Character pretty printing/Specifically escaped" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Character pretty printing/General chars" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Character pretty printing/Low ASCII" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Commas in various macros are allowed" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Comparing function pointers" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Comparison with explicitly convertible types" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Comparisons between ints where one side is computed" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Comparisons between unsigned ints and negative signed ints match c++ standard behaviour" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Comparisons with int literals don't warn when mixing signed/ unsigned" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Contains string matcher" time="{duration}">
+ <failure message=""this string contains 'abc' as a substring" contains: "not there" (case insensitive)" type="CHECK_THAT">
+Matchers.tests.cpp:<line number>
+ </failure>
+ <failure message=""this string contains 'abc' as a substring" contains: "STRING"" type="CHECK_THAT">
+Matchers.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Custom exceptions can be translated when testing for nothrow" time="{duration}">
+ <error message="throwCustom()" type="REQUIRE_NOTHROW">
+custom exception - not std
+Exception.tests.cpp:<line number>
+ </error>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Custom exceptions can be translated when testing for throwing as something else" time="{duration}">
+ <error message="throwCustom(), std::exception" type="REQUIRE_THROWS_AS">
+custom exception - not std
+Exception.tests.cpp:<line number>
+ </error>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Custom std-exceptions can be custom translated" time="{duration}">
+ <error type="TEST_CASE">
+custom std exception
+Exception.tests.cpp:<line number>
+ </error>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Default scale is invisible to comparison" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="EndsWith string matcher" time="{duration}">
+ <failure message=""this string contains 'abc' as a substring" ends with: "Substring"" type="CHECK_THAT">
+Matchers.tests.cpp:<line number>
+ </failure>
+ <failure message=""this string contains 'abc' as a substring" ends with: "this" (case insensitive)" type="CHECK_THAT">
+Matchers.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Epsilon only applies to Approx's value" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Equality checks that should fail" time="{duration}">
+ <failure message="7 == 6" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message="7 == 8" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message="7 == 0" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message="9.1f == Approx( 9.1099996567 )" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message="9.1f == Approx( 9.0 )" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message="9.1f == Approx( 1.0 )" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message="9.1f == Approx( 0.0 )" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message="3.1415926535 == Approx( 3.1415 )" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message=""hello" == "goodbye"" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message=""hello" == "hell"" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message=""hello" == "hello1"" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message="5 == 6" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message="1.3 == Approx( 1.301 )" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Equality checks that should succeed" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Equals" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Equals string matcher" time="{duration}">
+ <failure message=""this string contains 'abc' as a substring" equals: "this string contains 'ABC' as a substring"" type="CHECK_THAT">
+Matchers.tests.cpp:<line number>
+ </failure>
+ <failure message=""this string contains 'abc' as a substring" equals: "something else" (case insensitive)" type="CHECK_THAT">
+Matchers.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Exception matchers that fail/No exception" time="{duration}">
+ <failure message="doesNotThrow(), SpecialException, ExceptionMatcher{1}" type="CHECK_THROWS_MATCHES">
+Matchers.tests.cpp:<line number>
+ </failure>
+ <failure message="doesNotThrow(), SpecialException, ExceptionMatcher{1}" type="REQUIRE_THROWS_MATCHES">
+Matchers.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Exception matchers that fail/Type mismatch" time="{duration}">
+ <error message="throwsAsInt(1), SpecialException, ExceptionMatcher{1}" type="CHECK_THROWS_MATCHES">
+Unknown exception
+Matchers.tests.cpp:<line number>
+ </error>
+ <error message="throwsAsInt(1), SpecialException, ExceptionMatcher{1}" type="REQUIRE_THROWS_MATCHES">
+Unknown exception
+Matchers.tests.cpp:<line number>
+ </error>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Exception matchers that fail/Contents are wrong" time="{duration}">
+ <failure message="{?} special exception has value of 1" type="CHECK_THROWS_MATCHES">
+Matchers.tests.cpp:<line number>
+ </failure>
+ <failure message="{?} special exception has value of 1" type="REQUIRE_THROWS_MATCHES">
+Matchers.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Exception matchers that succeed" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Exception messages can be tested for/exact match" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Exception messages can be tested for/different case" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Exception messages can be tested for/wildcarded" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Expected exceptions that don't throw or unexpected exceptions fail the test" time="{duration}">
+ <error message="thisThrows(), std::string" type="CHECK_THROWS_AS">
+expected exception
+Exception.tests.cpp:<line number>
+ </error>
+ <failure message="thisDoesntThrow(), std::domain_error" type="CHECK_THROWS_AS">
+Exception.tests.cpp:<line number>
+ </failure>
+ <error message="thisThrows()" type="CHECK_NOTHROW">
+expected exception
+Exception.tests.cpp:<line number>
+ </error>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="FAIL aborts the test" time="{duration}">
+ <failure type="FAIL">
+This is a failure
+Message.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="FAIL does not require an argument" time="{duration}">
+ <failure type="FAIL">
+Message.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="FAIL_CHECK does not abort the test" time="{duration}">
+ <failure type="FAIL_CHECK">
+This is a failure
+Message.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Factorials are computed" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Floating point matchers: double/Margin" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Floating point matchers: double/ULPs" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Floating point matchers: double/Composed" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Floating point matchers: double/Constructor validation" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Floating point matchers: float/Margin" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Floating point matchers: float/ULPs" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Floating point matchers: float/Composed" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Floating point matchers: float/Constructor validation" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Greater-than inequalities with different epsilons" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="INFO and WARN do not abort tests" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="INFO gets logged on failure" time="{duration}">
+ <failure message="2 == 1" type="REQUIRE">
+this message should be logged
+so should this
+Message.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="INFO gets logged on failure, even if captured before successful assertions" time="{duration}">
+ <failure message="2 == 1" type="CHECK">
+this message may be logged later
+this message should be logged
+Message.tests.cpp:<line number>
+ </failure>
+ <failure message="2 == 0" type="CHECK">
+this message may be logged later
+this message should be logged
+and this, but later
+Message.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="INFO is reset for each loop" time="{duration}">
+ <failure message="10 < 10" type="REQUIRE">
+current counter 10
+i := 10
+Message.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Inequality checks that should fail" time="{duration}">
+ <failure message="7 != 7" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message="9.1f != Approx( 9.1000003815 )" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message="3.1415926535 != Approx( 3.1415926535 )" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message=""hello" != "hello"" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message="5 != 5" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Inequality checks that should succeed" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Less-than inequalities with different epsilons" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="ManuallyRegistered" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Matchers can be (AllOf) composed with the && operator" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Matchers can be (AnyOf) composed with the || operator" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Matchers can be composed with both && and ||" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Matchers can be composed with both && and || - failing" time="{duration}">
+ <failure message=""this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" )" type="CHECK_THAT">
+Matchers.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Matchers can be negated (Not) with the ! operator" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Matchers can be negated (Not) with the ! operator - failing" time="{duration}">
+ <failure message=""this string contains 'abc' as a substring" not contains: "substring"" type="CHECK_THAT">
+Matchers.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Mismatching exception messages failing the test" time="{duration}">
+ <failure message=""expected exception" equals: "should fail"" type="REQUIRE_THROWS_WITH">
+Exception.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Nice descriptive name" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Non-std exceptions can be translated" time="{duration}">
+ <error type="TEST_CASE">
+custom exception
+Exception.tests.cpp:<line number>
+ </error>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Objects that evaluated in boolean contexts can be checked" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Ordering comparison checks that should fail" time="{duration}">
+ <failure message="7 > 7" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message="7 < 7" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message="7 > 8" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message="7 < 6" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message="7 < 0" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message="7 < -1" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message="7 >= 8" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message="7 <= 6" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message="9.1f < 9" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message="9.1f > 10" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message="9.1f > 9.2" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message=""hello" > "hello"" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message=""hello" < "hello"" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message=""hello" > "hellp"" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message=""hello" > "z"" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message=""hello" < "hellm"" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message=""hello" < "a"" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message=""hello" >= "z"" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ <failure message=""hello" <= "a"" type="CHECK">
+Condition.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Ordering comparison checks that should succeed" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Output from all sections is reported/one" time="{duration}">
+ <failure type="FAIL">
+Message from section one
+Message.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Output from all sections is reported/two" time="{duration}">
+ <failure type="FAIL">
+Message from section two
+Message.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/Empty test spec should have no filters" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/Test spec from empty string should have no filters" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/Test spec from just a comma should have no filters" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/Test spec from name should have one filter" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/Test spec from quoted name should have one filter" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/Test spec from name should have one filter" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/Wildcard at the start" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/Wildcard at the end" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/Wildcard at both ends" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/Redundant wildcard at the start" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/Redundant wildcard at the end" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/Redundant wildcard at both ends" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/Wildcard at both ends, redundant at start" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/Just wildcard" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/Single tag" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/Single tag, two matches" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/Two tags" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/Two tags, spare separated" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/Wildcarded name and tag" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/Single tag exclusion" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/One tag exclusion and one tag inclusion" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/One tag exclusion and one wldcarded name inclusion" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/One tag exclusion, using exclude:, and one wldcarded name inclusion" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/name exclusion" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/wildcarded name exclusion" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/wildcarded name exclusion with tag inclusion" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/wildcarded name exclusion, using exclude:, with tag inclusion" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/two wildcarded names" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/empty tag" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/empty quoted name" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/quoted string followed by tag exclusion" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parsing a std::pair" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Pointers can be compared to null" 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/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 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/reporter/-r/console" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/-r/xml" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/-r xml and junit" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/--reporter/junit" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Process can be configured on command line/debugger/-b" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Process can be configured on command line/debugger/--break" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Process can be configured on command line/abort/-a aborts after first failure" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Process can be configured on command line/abort/-x 2 aborts after two failures" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Process can be configured on command line/abort/-x must be numeric" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Process can be configured on command line/nothrow/-e" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Process can be configured on command line/nothrow/--nothrow" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Process can be configured on command line/output filename/-o filename" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Process can be configured on command line/output filename/--out" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Process can be configured on command line/combinations/Single character flags can be combined" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Process can be configured on command line/use-colour/without option" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Process can be configured on command line/use-colour/auto" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Process can be configured on command line/use-colour/yes" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Process can be configured on command line/use-colour/no" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Process can be configured on command line/use-colour/error" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Reconstruction should be based on stringification: #914" time="{duration}">
+ <failure message="Hey, its truthy!" type="CHECK">
+Decomposition.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Regex string matcher" time="{duration}">
+ <failure message=""this string contains 'abc' as a substring" matches "this STRING contains 'abc' as a substring" case sensitively" type="CHECK_THAT">
+Matchers.tests.cpp:<line number>
+ </failure>
+ <failure message=""this string contains 'abc' as a substring" matches "contains 'abc' as a substring" case sensitively" type="CHECK_THAT">
+Matchers.tests.cpp:<line number>
+ </failure>
+ <failure message=""this string contains 'abc' as a substring" matches "this string contains 'abc' as a" case sensitively" type="CHECK_THAT">
+Matchers.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="SUCCEED counts as a test pass" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="SUCCEED does not require an argument" time="{duration}"/>
+ <testcase classname="<exe-name>.Fixture" name="Scenario: BDD tests requiring Fixtures to provide commonly-accessed data or methods/Given: No operations precede me" time="{duration}"/>
+ <testcase classname="<exe-name>.Fixture" name="Scenario: BDD tests requiring Fixtures to provide commonly-accessed data or methods/Given: No operations precede me/When: We get the count/Then: Subsequently values are higher" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Scenario: Do that thing with the thing/Given: This stuff exists/When: I do this/Then: it should do this" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Scenario: Do that thing with the thing/Given: This stuff exists/When: I do this/Then: it should do this/And: do that" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Scenario: This is a really long scenario name to see how the list command deals with wrapping/Given: A section name that is so long that it cannot fit in a single console width/When: The test headers are printed as part of the normal running of the scenario/Then: The, deliberately very long and overly verbose (you see what I did there?) section names must wrap, along with an indent" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Scenario: Vector resizing affects size and capacity/Given: an empty vector" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Scenario: Vector resizing affects size and capacity/Given: an empty vector/When: it is made larger/Then: the size and capacity go up" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Scenario: Vector resizing affects size and capacity/Given: an empty vector/When: it is made larger/Then: the size and capacity go up/And when: it is made smaller again/Then: the size goes down but the capacity stays the same" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Scenario: Vector resizing affects size and capacity/Given: an empty vector/When: we reserve more space/Then: The capacity is increased but the size remains the same" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Sends stuff to stdout and stderr" time="{duration}">
+ <system-out>
+A string sent directly to stdout
+ </system-out>
+ <system-err>
+A string sent directly to stderr
+A string sent to stderr via clog
+ </system-err>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Some simple comparisons between doubles" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Standard output from all sections is reported/two" time="{duration}">
+ <system-out>
+Message from section one
+Message from section two
+ </system-out>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="StartsWith string matcher" time="{duration}">
+ <failure message=""this string contains 'abc' as a substring" starts with: "This String"" type="CHECK_THAT">
+Matchers.tests.cpp:<line number>
+ </failure>
+ <failure message=""this string contains 'abc' as a substring" starts with: "string" (case insensitive)" type="CHECK_THAT">
+Matchers.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Static arrays are convertible to string/Single item" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Static arrays are convertible to string/Multiple" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Static arrays are convertible to string/Non-trivial inner items" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="String matchers" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="StringRef/Empty string" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="StringRef/From string literal" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="StringRef/From string literal/c_str() does not cause copy" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="StringRef/From sub-string" time="{duration}">
+ <failure message="false" type="REQUIRE">
+String.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="StringRef/Substrings/zero-based substring" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="StringRef/Substrings/c_str() causes copy" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="StringRef/Substrings/non-zero-based substring" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="StringRef/Substrings/Pointer values of full refs should match" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="StringRef/Substrings/Pointer values of substring refs should not match" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="StringRef/Comparisons" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="StringRef/from std::string/implicitly constructed" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="StringRef/from std::string/explicitly constructed" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="StringRef/from std::string/assigned" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="StringRef/to std::string/implicitly constructed" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="StringRef/to std::string/explicitly constructed" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="StringRef/to std::string/assigned" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Stringifying std::chrono::duration helpers" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Stringifying std::chrono::duration with weird ratios" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Stringifying std::chrono::time_point<system_clock>" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Tabs and newlines show in output" time="{duration}">
+ <failure message=""if ($b == 10) {
+ $a = 20;
+}"
+==
+"if ($b == 10) {
+ $a = 20;
+}
+"" type="CHECK">
+Misc.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Tag alias can be registered against tag patterns/The same tag alias can only be registered once" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Tag alias can be registered against tag patterns/Tag aliases must be of the form [@name]" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Test case with one argument" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Test enum bit values" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="The NO_FAIL macro reports a failure but does not fail the test" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="This test 'should' fail but doesn't" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Tracker" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Tracker/successfully close one section" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Tracker/fail one section" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Tracker/fail one section/re-enter after failed section" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Tracker/fail one section/re-enter after failed section and find next section" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Tracker/successfully close one section, then find another" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Tracker/successfully close one section, then find another/Re-enter - skips S1 and enters S2" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Tracker/successfully close one section, then find another/Re-enter - skips S1 and enters S2/Successfully close S2" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Tracker/successfully close one section, then find another/Re-enter - skips S1 and enters S2/fail S2" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Tracker/open a nested section" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Tracker/start a generator" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Tracker/start a generator/close outer section" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Tracker/start a generator/close outer section/Re-enter for second generation" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Tracker/start a generator/Start a new inner section" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Tracker/start a generator/Start a new inner section/Re-enter for second generation" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Tracker/start a generator/Fail an inner section" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Tracker/start a generator/Fail an inner section/Re-enter for second generation" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Unexpected exceptions can be translated" time="{duration}">
+ <error type="TEST_CASE">
+3.14
+Exception.tests.cpp:<line number>
+ </error>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Use a custom approx" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Variadic macros/Section with one argument" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Vector matchers/Contains (element)" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Vector matchers/Contains (vector)" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Vector matchers/Contains (element), composed" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Vector matchers/Equals" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Vector matchers/UnorderedEquals" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Vector matchers that fail/Contains (element)" time="{duration}">
+ <failure message="{ 1, 2, 3 } Contains: -1" type="CHECK_THAT">
+Matchers.tests.cpp:<line number>
+ </failure>
+ <failure message="{ } Contains: 1" type="CHECK_THAT">
+Matchers.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Vector matchers that fail/Contains (vector)" time="{duration}">
+ <failure message="{ } Contains: { 1, 2, 3 }" type="CHECK_THAT">
+Matchers.tests.cpp:<line number>
+ </failure>
+ <failure message="{ 1, 2, 3 } Contains: { 1, 2, 4 }" type="CHECK_THAT">
+Matchers.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Vector matchers that fail/Equals" time="{duration}">
+ <failure message="{ 1, 2, 3 } Equals: { 1, 2 }" type="CHECK_THAT">
+Matchers.tests.cpp:<line number>
+ </failure>
+ <failure message="{ 1, 2 } Equals: { 1, 2, 3 }" type="CHECK_THAT">
+Matchers.tests.cpp:<line number>
+ </failure>
+ <failure message="{ } Equals: { 1, 2, 3 }" type="CHECK_THAT">
+Matchers.tests.cpp:<line number>
+ </failure>
+ <failure message="{ 1, 2, 3 } Equals: { }" type="CHECK_THAT">
+Matchers.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Vector matchers that fail/UnorderedEquals" time="{duration}">
+ <failure message="{ 1, 2, 3 } UnorderedEquals: { }" type="CHECK_THAT">
+Matchers.tests.cpp:<line number>
+ </failure>
+ <failure message="{ } UnorderedEquals: { 1, 2, 3 }" type="CHECK_THAT">
+Matchers.tests.cpp:<line number>
+ </failure>
+ <failure message="{ 1, 3 } UnorderedEquals: { 1, 2, 3 }" type="CHECK_THAT">
+Matchers.tests.cpp:<line number>
+ </failure>
+ <failure message="{ 3, 1 } UnorderedEquals: { 1, 2, 3 }" type="CHECK_THAT">
+Matchers.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="When checked exceptions are thrown they can be expected or unexpected" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="When unchecked exceptions are thrown directly they are always failures" time="{duration}">
+ <error type="TEST_CASE">
+unexpected exception
+Exception.tests.cpp:<line number>
+ </error>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="When unchecked exceptions are thrown during a CHECK the test should continue" time="{duration}">
+ <error message="thisThrows() == 0" type="CHECK">
+expected exception
+Exception.tests.cpp:<line number>
+ </error>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="When unchecked exceptions are thrown during a REQUIRE the test should abort fail" time="{duration}">
+ <error message="thisThrows() == 0" type="REQUIRE">
+expected exception
+Exception.tests.cpp:<line number>
+ </error>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="When unchecked exceptions are thrown from functions they are always failures" time="{duration}">
+ <error message="thisThrows() == 0" type="CHECK">
+expected exception
+Exception.tests.cpp:<line number>
+ </error>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="When unchecked exceptions are thrown from sections they are always failures/section name" time="{duration}">
+ <error type="TEST_CASE">
+unexpected exception
+Exception.tests.cpp:<line number>
+ </error>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="Where the LHS is not a simple value" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Where there is more to the expression after the RHS" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="X/level/0/a" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="X/level/0/b" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="X/level/1/a" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="X/level/1/b" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="XmlEncode/normal string" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="XmlEncode/empty string" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="XmlEncode/string with ampersand" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="XmlEncode/string with less-than" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="XmlEncode/string with greater-than" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="XmlEncode/string with quotes" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="XmlEncode/string with control char (1)" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="XmlEncode/string with control char (x7F)" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="array<int, N> -> toString" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="atomic if" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="boolean member" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="checkedElse" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="checkedElse, failing" time="{duration}">
+ <failure message="false" type="CHECKED_ELSE">
+Misc.tests.cpp:<line number>
+ </failure>
+ <failure message="false" type="REQUIRE">
+Misc.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="checkedIf" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="checkedIf, failing" time="{duration}">
+ <failure message="false" type="CHECKED_IF">
+Misc.tests.cpp:<line number>
+ </failure>
+ <failure message="false" type="REQUIRE">
+Misc.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="comparisons between const int variables" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="comparisons between int variables" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="even more nested SECTION tests/c/d (leaf)" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="even more nested SECTION tests/c/e (leaf)" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="even more nested SECTION tests/f (leaf)" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="just failure" time="{duration}">
+ <failure type="FAIL">
+Previous info should not be seen
+Message.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="long long" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="looped SECTION tests/s1" time="{duration}">
+ <failure message="0 > 1" type="CHECK">
+Misc.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="looped tests" time="{duration}">
+ <failure message="1 == 0" type="CHECK">
+Testing if fib[0] (1) is even
+Misc.tests.cpp:<line number>
+ </failure>
+ <failure message="1 == 0" type="CHECK">
+Testing if fib[1] (1) is even
+Misc.tests.cpp:<line number>
+ </failure>
+ <failure message="1 == 0" type="CHECK">
+Testing if fib[3] (3) is even
+Misc.tests.cpp:<line number>
+ </failure>
+ <failure message="1 == 0" type="CHECK">
+Testing if fib[4] (5) is even
+Misc.tests.cpp:<line number>
+ </failure>
+ <failure message="1 == 0" type="CHECK">
+Testing if fib[6] (13) is even
+Misc.tests.cpp:<line number>
+ </failure>
+ <failure message="1 == 0" type="CHECK">
+Testing if fib[7] (21) is even
+Misc.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="more nested SECTION tests/s2/s1" time="{duration}">
+ <failure message="1 == 2" type="REQUIRE">
+Misc.tests.cpp:<line number>
+ </failure>
+ </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/s1/s4" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="nested SECTION tests/s1" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="nested SECTION tests/s1/s2" 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="not allowed" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="null strings" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="null_ptr" 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="random SECTION tests/s1" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="random SECTION tests/s2" 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 first char" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="replaceInPlace/replace last char" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="replaceInPlace/replace all chars" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="replaceInPlace/replace no chars" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="replaceInPlace/escape '" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="send a single char to INFO" time="{duration}">
+ <failure message="false" type="REQUIRE">
+3
+Misc.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="sends information to INFO" time="{duration}">
+ <failure message="false" type="REQUIRE">
+hi
+i := 7
+Message.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="std::map is convertible string/empty" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="std::map is convertible string/single item" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="std::map is convertible string/several items" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="std::pair<int,const std::string> -> toString" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="std::pair<int,std::string> -> toString" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="std::set is convertible string/empty" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="std::set is convertible string/single item" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="std::set is convertible string/several items" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="std::vector<std::pair<std::string,int> > -> toString" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="string literals of different sizes can be compared" time="{duration}">
+ <failure message=""first" == "second"" type="REQUIRE">
+Tricky.tests.cpp:<line number>
+ </failure>
+ </testcase>
+ <testcase classname="<exe-name>.global" name="stringify( has_maker )" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="stringify( has_maker_and_toString )" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="stringify( has_operator )" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="toString on const wchar_t const pointer returns the string contents" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="toString on const wchar_t pointer returns the string contents" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="toString on wchar_t const pointer returns the string contents" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="toString on wchar_t returns the string contents" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="toString streamable range" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="toString( vectors<has_maker> )" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="toString( vectors<has_maker_and_operator> )" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="toString( vectors<has_operator> )" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="toString(enum class w/operator<<)" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="toString(enum class)" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="toString(enum w/operator<<)" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="toString(enum)" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="tuple<>" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="tuple<float,int>" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="tuple<int>" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="tuple<0,int,const char *>" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="tuple<string,string>" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="tuple<tuple<int>,tuple<>,float>" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="vec<vec<string,alloc>> -> toString" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="vector<bool> -> toString" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="vector<int,allocator> -> toString" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="vector<int> -> toString" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="vector<string> -> toString" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="vectors can be sized and resized" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="vectors can be sized and resized/resizing bigger changes size and capacity" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="vectors can be sized and resized/resizing smaller changes size but not capacity" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="vectors can be sized and resized/resizing smaller changes size but not capacity/We can use the 'swap trick' to reset the capacity" 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="xmlentitycheck/embedded xml" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="xmlentitycheck/encoded chars" time="{duration}"/>
+ <system-out>
+A string sent directly to stdout
+Message from section one
+Message from section two
+ </system-out>
+ <system-err>
+A string sent directly to stderr
+A string sent to stderr via clog
+ </system-err>
+ </testsuite>
+</testsuites>
diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt
new file mode 100644
index 0000000..ceac33b
--- /dev/null
+++ b/projects/SelfTest/Baselines/xml.sw.approved.txt
@@ -0,0 +1,9302 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Catch name="<exe-name>">
+ <Group name="<exe-name>">
+ <TestCase name="# A test name that starts with a #" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="#1005: Comparing pointer to int and long (NULL can be either on various systems)" tags="[Decomposition]" filename="projects/<exe-name>/UsageTests/Decomposition.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Decomposition.tests.cpp" >
+ <Original>
+ fptr == 0
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Decomposition.tests.cpp" >
+ <Original>
+ fptr == 0l
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="#1027" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
+ <Original>
+ y.v == 0
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
+ <Original>
+ 0 == y.v
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="#1147" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
+ <Original>
+ t1 == t2
+ </Original>
+ <Expanded>
+ {?} == {?}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
+ <Original>
+ t1 != t2
+ </Original>
+ <Expanded>
+ {?} != {?}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
+ <Original>
+ t1 < t2
+ </Original>
+ <Expanded>
+ {?} < {?}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
+ <Original>
+ t1 > t2
+ </Original>
+ <Expanded>
+ {?} > {?}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
+ <Original>
+ t1 <= t2
+ </Original>
+ <Expanded>
+ {?} <= {?}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
+ <Original>
+ t1 >= t2
+ </Original>
+ <Expanded>
+ {?} >= {?}
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="#748 - captures with unexpected exceptions" tags="[!shouldfail][!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Section name="outside assertions" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Info>
+ answer := 42
+ </Info>
+ <Exception filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ expected exception
+ </Exception>
+ <OverallResults successes="0" failures="0" expectedFailures="1"/>
+ </Section>
+ <Section name="inside REQUIRE_NOTHROW" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Info>
+ answer := 42
+ </Info>
+ <Expression success="false" type="REQUIRE_NOTHROW" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Original>
+ thisThrows()
+ </Original>
+ <Expanded>
+ thisThrows()
+ </Expanded>
+ <Exception filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ expected exception
+ </Exception>
+ </Expression>
+ <OverallResults successes="0" failures="0" expectedFailures="1"/>
+ </Section>
+ <Section name="inside REQUIRE_THROWS" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Info>
+ answer := 42
+ </Info>
+ <Expression success="true" type="REQUIRE_THROWS" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Original>
+ thisThrows()
+ </Original>
+ <Expanded>
+ thisThrows()
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="#809" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
+ <Original>
+ 42 == f
+ </Original>
+ <Expanded>
+ 42 == {?}
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="#833" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
+ <Original>
+ a == t
+ </Original>
+ <Expanded>
+ 3 == 3
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
+ <Original>
+ a == t
+ </Original>
+ <Expanded>
+ 3 == 3
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THROWS" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
+ <Original>
+ throws_int(true)
+ </Original>
+ <Expanded>
+ throws_int(true)
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_THROWS_AS" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
+ <Original>
+ throws_int(true), int
+ </Original>
+ <Expanded>
+ throws_int(true), int
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_NOTHROW" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
+ <Original>
+ throws_int(false)
+ </Original>
+ <Expanded>
+ throws_int(false)
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
+ <Original>
+ "aaa", Catch::EndsWith("aaa")
+ </Original>
+ <Expanded>
+ "aaa" ends with: "aaa"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
+ <Original>
+ templated_tests<int>(3)
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="#835 -- errno should not be touched by Catch" tags="[!shouldfail][.][failing]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ f() == 0
+ </Original>
+ <Expanded>
+ 1 == 0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ errno == 1
+ </Original>
+ <Expanded>
+ 1 == 1
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="#872" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
+ <Info>
+ dummy := 0
+ </Info>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Compilation.tests.cpp" >
+ <Original>
+ x == 4
+ </Original>
+ <Expanded>
+ {?} == 4
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="#961 -- Dynamically created sections should all be reported" tags="[.]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Section name="Looped section 0" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Looped section 1" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Looped section 2" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Looped section 3" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Looped section 4" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="'Not' checks that should fail" tags="[.][failing]" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ false != false
+ </Original>
+ <Expanded>
+ false != false
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ true != true
+ </Original>
+ <Expanded>
+ true != true
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ !true
+ </Original>
+ <Expanded>
+ false
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK_FALSE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ !(true)
+ </Original>
+ <Expanded>
+ !true
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ !trueValue
+ </Original>
+ <Expanded>
+ false
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK_FALSE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ !(trueValue)
+ </Original>
+ <Expanded>
+ !true
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ !(1 == 1)
+ </Original>
+ <Expanded>
+ false
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK_FALSE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ !(1 == 1)
+ </Original>
+ <Expanded>
+ !(1 == 1)
+ </Expanded>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="'Not' checks that should succeed" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ false == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ true == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ !false
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_FALSE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ !(false)
+ </Original>
+ <Expanded>
+ !false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ !falseValue
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_FALSE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ !(falseValue)
+ </Original>
+ <Expanded>
+ !false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ !(1 == 2)
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_FALSE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ !(1 == 2)
+ </Original>
+ <Expanded>
+ !(1 == 2)
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="(unimplemented) static bools can be evaluated" tags="[Tricky]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Section name="compare to true" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ is_true<true>::value == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ true == is_true<true>::value
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="compare to false" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ is_true<false>::value == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ false == is_true<false>::value
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="negation" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ !is_true<false>::value
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="double negation" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ !!is_true<true>::value
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="direct" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ is_true<true>::value
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_FALSE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ !(is_true<false>::value)
+ </Original>
+ <Expanded>
+ !false
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="A METHOD_AS_TEST_CASE based test run that fails" tags="[.][class][failing]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" >
+ <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" >
+ <Original>
+ s == "world"
+ </Original>
+ <Expanded>
+ "hello" == "world"
+ </Expanded>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="A METHOD_AS_TEST_CASE based test run that succeeds" tags="[class]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" >
+ <Original>
+ s == "hello"
+ </Original>
+ <Expanded>
+ "hello" == "hello"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="A TEST_CASE_METHOD based test run that fails" tags="[.][class][failing]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" >
+ <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" >
+ <Original>
+ m_a == 2
+ </Original>
+ <Expanded>
+ 1 == 2
+ </Expanded>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="A TEST_CASE_METHOD based test run that succeeds" tags="[class]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" >
+ <Original>
+ m_a == 1
+ </Original>
+ <Expanded>
+ 1 == 1
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="A couple of nested sections followed by a failure" tags="[.][failing]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Section name="Outer" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Section name="Inner" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <Failure filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ to infinity and beyond
+ </Failure>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="A failing expression with a non streamable type is still captured" tags="[.][Tricky][failing]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ &o1 == &o2
+ </Original>
+ <Expanded>
+ 0x<hex digits> == 0x<hex digits>
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ o1 == o2
+ </Original>
+ <Expanded>
+ {?} == {?}
+ </Expanded>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="Absolute margin" tags="[Approx]" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ 104.0 != Approx(100.0)
+ </Original>
+ <Expanded>
+ 104.0 != Approx( 100.0 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ 104.0 == Approx(100.0).margin(5)
+ </Original>
+ <Expanded>
+ 104.0 == Approx( 100.0 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ 104.0 == Approx(100.0).margin(4)
+ </Original>
+ <Expanded>
+ 104.0 == Approx( 100.0 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ 104.0 != Approx(100.0).margin(3)
+ </Original>
+ <Expanded>
+ 104.0 != Approx( 100.0 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ 100.3 != Approx(100.0)
+ </Original>
+ <Expanded>
+ 100.3 != Approx( 100.0 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ 100.3 == Approx(100.0).margin(0.5)
+ </Original>
+ <Expanded>
+ 100.3 == Approx( 100.0 )
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="An empty test with no assertions" tags="[empty]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="An expression with side-effects should only be evaluated once" tags="[Tricky]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ i++ == 7
+ </Original>
+ <Expanded>
+ 7 == 7
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ i++ == 8
+ </Original>
+ <Expanded>
+ 8 == 8
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="An unchecked exception reports the line of the last assertion" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Original>
+ 1 == 1
+ </Original>
+ <Expanded>
+ 1 == 1
+ </Expanded>
+ </Expression>
+ <Expression success="false" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Original>
+ {Unknown expression after the reported line}
+ </Original>
+ <Expanded>
+ {Unknown expression after the reported line}
+ </Expanded>
+ <Exception filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ unexpected exception
+ </Exception>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="Anonymous test case 1" filename="projects/<exe-name>/UsageTests/VariadicMacros.tests.cpp" >
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Approx setters validate their arguments" tags="[Approx]" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Expression success="true" type="REQUIRE_NOTHROW" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ Approx(0).margin(0)
+ </Original>
+ <Expanded>
+ Approx(0).margin(0)
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_NOTHROW" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ Approx(0).margin(1234656)
+ </Original>
+ <Expanded>
+ Approx(0).margin(1234656)
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THROWS_AS" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ Approx(0).margin(-2), std::domain_error
+ </Original>
+ <Expanded>
+ Approx(0).margin(-2), std::domain_error
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_NOTHROW" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ Approx(0).epsilon(0)
+ </Original>
+ <Expanded>
+ Approx(0).epsilon(0)
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_NOTHROW" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ Approx(0).epsilon(1)
+ </Original>
+ <Expanded>
+ Approx(0).epsilon(1)
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THROWS_AS" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ Approx(0).epsilon(-0.001), std::domain_error
+ </Original>
+ <Expanded>
+ Approx(0).epsilon(-0.001), std::domain_error
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THROWS_AS" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ Approx(0).epsilon(1.0001), std::domain_error
+ </Original>
+ <Expanded>
+ Approx(0).epsilon(1.0001), std::domain_error
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Approx with exactly-representable margin" tags="[Approx]" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ 0.25f == Approx(0.0f).margin(0.25f)
+ </Original>
+ <Expanded>
+ 0.25f == Approx( 0.0 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ 0.0f == Approx(0.25f).margin(0.25f)
+ </Original>
+ <Expanded>
+ 0.0f == Approx( 0.25 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ 0.5f == Approx(0.25f).margin(0.25f)
+ </Original>
+ <Expanded>
+ 0.5f == Approx( 0.25 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ 245.0f == Approx(245.25f).margin(0.25f)
+ </Original>
+ <Expanded>
+ 245.0f == Approx( 245.25 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ 245.5f == Approx(245.25f).margin(0.25f)
+ </Original>
+ <Expanded>
+ 245.5f == Approx( 245.25 )
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Approximate PI" tags="[Approx][PI]" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ divide( 22, 7 ) == Approx( 3.141 ).epsilon( 0.001 )
+ </Original>
+ <Expanded>
+ 3.1428571429 == Approx( 3.141 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ divide( 22, 7 ) != Approx( 3.141 ).epsilon( 0.0001 )
+ </Original>
+ <Expanded>
+ 3.1428571429 != Approx( 3.141 )
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Approximate comparisons with different epsilons" tags="[Approx]" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ d != Approx( 1.231 )
+ </Original>
+ <Expanded>
+ 1.23 != Approx( 1.231 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ d == Approx( 1.231 ).epsilon( 0.1 )
+ </Original>
+ <Expanded>
+ 1.23 == Approx( 1.231 )
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Approximate comparisons with floats" tags="[Approx]" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ 1.23f == Approx( 1.23f )
+ </Original>
+ <Expanded>
+ 1.23f == Approx( 1.2300000191 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ 0.0f == Approx( 0.0f )
+ </Original>
+ <Expanded>
+ 0.0f == Approx( 0.0 )
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Approximate comparisons with ints" tags="[Approx]" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ 1 == Approx( 1 )
+ </Original>
+ <Expanded>
+ 1 == Approx( 1.0 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ 0 == Approx( 0 )
+ </Original>
+ <Expanded>
+ 0 == Approx( 0.0 )
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Approximate comparisons with mixed numeric types" tags="[Approx]" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ 1.0f == Approx( 1 )
+ </Original>
+ <Expanded>
+ 1.0f == Approx( 1.0 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ 0 == Approx( dZero)
+ </Original>
+ <Expanded>
+ 0 == Approx( 0.0 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ 0 == Approx( dSmall ).margin( 0.001 )
+ </Original>
+ <Expanded>
+ 0 == Approx( 0.00001 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ 1.234f == Approx( dMedium )
+ </Original>
+ <Expanded>
+ 1.234f == Approx( 1.234 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ dMedium == Approx( 1.234f )
+ </Original>
+ <Expanded>
+ 1.234 == Approx( 1.2339999676 )
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Assertions then sections" tags="[Tricky]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ true
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Section name="A section" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ true
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Section name="Another section" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ true
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ true
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Section name="A section" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ true
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Section name="Another other section" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ true
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Assorted miscellaneous tests" tags="[Approx]" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ INFINITY == Approx(INFINITY)
+ </Original>
+ <Expanded>
+ inff == Approx( inf )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ NAN != Approx(NAN)
+ </Original>
+ <Expanded>
+ nanf != Approx( nan )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_FALSE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ !(NAN == Approx(NAN))
+ </Original>
+ <Expanded>
+ !(nanf == Approx( nan ))
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Bitfields can be captured (#1027)" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ y.v == 0
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ 0 == y.v
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Capture and info messages" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Section name="Capture should stringify like assertions" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Info>
+ i := 2
+ </Info>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Original>
+ true
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Info should NOT stringify the way assertions do" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Info>
+ 3
+ </Info>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Original>
+ true
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Character pretty printing" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Section name="Specifically escaped" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Original>
+ tab == '\t'
+ </Original>
+ <Expanded>
+ '\t' == '\t'
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Original>
+ newline == '\n'
+ </Original>
+ <Expanded>
+ '\n' == '\n'
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Original>
+ carr_return == '\r'
+ </Original>
+ <Expanded>
+ '\r' == '\r'
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Original>
+ form_feed == '\f'
+ </Original>
+ <Expanded>
+ '\f' == '\f'
+ </Expanded>
+ </Expression>
+ <OverallResults successes="4" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="General chars" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Original>
+ space == ' '
+ </Original>
+ <Expanded>
+ ' ' == ' '
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Original>
+ c == chars[i]
+ </Original>
+ <Expanded>
+ 'a' == 'a'
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Original>
+ c == chars[i]
+ </Original>
+ <Expanded>
+ 'z' == 'z'
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Original>
+ c == chars[i]
+ </Original>
+ <Expanded>
+ 'A' == 'A'
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Original>
+ c == chars[i]
+ </Original>
+ <Expanded>
+ 'Z' == 'Z'
+ </Expanded>
+ </Expression>
+ <OverallResults successes="5" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Low ASCII" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Original>
+ null_terminator == '\0'
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Original>
+ c == i
+ </Original>
+ <Expanded>
+ 2 == 2
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Original>
+ c == i
+ </Original>
+ <Expanded>
+ 3 == 3
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Original>
+ c == i
+ </Original>
+ <Expanded>
+ 4 == 4
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Original>
+ c == i
+ </Original>
+ <Expanded>
+ 5 == 5
+ </Expanded>
+ </Expression>
+ <OverallResults successes="5" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Commas in various macros are allowed" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Expression success="true" type="REQUIRE_THROWS" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ std::vector<constructor_throws>{constructor_throws{}, constructor_throws{}}
+ </Original>
+ <Expanded>
+ std::vector<constructor_throws>{constructor_throws{}, constructor_throws{}}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_THROWS" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ std::vector<constructor_throws>{constructor_throws{}, constructor_throws{}}
+ </Original>
+ <Expanded>
+ std::vector<constructor_throws>{constructor_throws{}, constructor_throws{}}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_NOTHROW" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ std::vector<int>{1, 2, 3} == std::vector<int>{1, 2, 3}
+ </Original>
+ <Expanded>
+ std::vector<int>{1, 2, 3} == std::vector<int>{1, 2, 3}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_NOTHROW" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ std::vector<int>{1, 2, 3} == std::vector<int>{1, 2, 3}
+ </Original>
+ <Expanded>
+ std::vector<int>{1, 2, 3} == std::vector<int>{1, 2, 3}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ std::vector<int>{1, 2} == std::vector<int>{1, 2}
+ </Original>
+ <Expanded>
+ { 1, 2 } == { 1, 2 }
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ std::vector<int>{1, 2} == std::vector<int>{1, 2}
+ </Original>
+ <Expanded>
+ { 1, 2 } == { 1, 2 }
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_FALSE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ !(std::vector<int>{1, 2} == std::vector<int>{1, 2, 3})
+ </Original>
+ <Expanded>
+ !({ 1, 2 } == { 1, 2, 3 })
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_FALSE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ !(std::vector<int>{1, 2} == std::vector<int>{1, 2, 3})
+ </Original>
+ <Expanded>
+ !({ 1, 2 } == { 1, 2, 3 })
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_NOFAIL" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ std::vector<int>{1, 2} == std::vector<int>{1, 2}
+ </Original>
+ <Expanded>
+ { 1, 2 } == { 1, 2 }
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECKED_IF" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ std::vector<int>{1, 2} == std::vector<int>{1, 2}
+ </Original>
+ <Expanded>
+ { 1, 2 } == { 1, 2 }
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ true
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECKED_ELSE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ std::vector<int>{1, 2} == std::vector<int>{1, 2}
+ </Original>
+ <Expanded>
+ { 1, 2 } == { 1, 2 }
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Comparing function pointers" tags="[Tricky][function pointer]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ a
+ </Original>
+ <Expanded>
+ 0x<hex digits>
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ a == &foo
+ </Original>
+ <Expanded>
+ 0x<hex digits> == 0x<hex digits>
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Comparison with explicitly convertible types" tags="[Approx]" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ td == Approx(10.0)
+ </Original>
+ <Expanded>
+ StrongDoubleTypedef(10) == Approx( 10.0 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ Approx(10.0) == td
+ </Original>
+ <Expanded>
+ Approx( 10.0 ) == StrongDoubleTypedef(10)
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ td != Approx(11.0)
+ </Original>
+ <Expanded>
+ StrongDoubleTypedef(10) != Approx( 11.0 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ Approx(11.0) != td
+ </Original>
+ <Expanded>
+ Approx( 11.0 ) != StrongDoubleTypedef(10)
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ td <= Approx(10.0)
+ </Original>
+ <Expanded>
+ StrongDoubleTypedef(10) <= Approx( 10.0 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ td <= Approx(11.0)
+ </Original>
+ <Expanded>
+ StrongDoubleTypedef(10) <= Approx( 11.0 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ Approx(10.0) <= td
+ </Original>
+ <Expanded>
+ Approx( 10.0 ) <= StrongDoubleTypedef(10)
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ Approx(9.0) <= td
+ </Original>
+ <Expanded>
+ Approx( 9.0 ) <= StrongDoubleTypedef(10)
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ td >= Approx(9.0)
+ </Original>
+ <Expanded>
+ StrongDoubleTypedef(10) >= Approx( 9.0 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ td >= Approx(td)
+ </Original>
+ <Expanded>
+ StrongDoubleTypedef(10) >= Approx( 10.0 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ Approx(td) >= td
+ </Original>
+ <Expanded>
+ Approx( 10.0 ) >= StrongDoubleTypedef(10)
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ Approx(11.0) >= td
+ </Original>
+ <Expanded>
+ Approx( 11.0 ) >= StrongDoubleTypedef(10)
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Comparisons between ints where one side is computed" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ 54 == 6*9
+ </Original>
+ <Expanded>
+ 54 == 54
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Comparisons between unsigned ints and negative signed ints match c++ standard behaviour" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ ( -1 > 2u )
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ -1 > 2u
+ </Original>
+ <Expanded>
+ -1 > 2
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ ( 2u < -1 )
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ 2u < -1
+ </Original>
+ <Expanded>
+ 2 < -1
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ ( minInt > 2u )
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ minInt > 2u
+ </Original>
+ <Expanded>
+ -2147483648 > 2
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Comparisons with int literals don't warn when mixing signed/ unsigned" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ i == 1
+ </Original>
+ <Expanded>
+ 1 == 1
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ ui == 2
+ </Original>
+ <Expanded>
+ 2 == 2
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ l == 3
+ </Original>
+ <Expanded>
+ 3 == 3
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ ul == 4
+ </Original>
+ <Expanded>
+ 4 == 4
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ c == 5
+ </Original>
+ <Expanded>
+ 5 == 5
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ uc == 6
+ </Original>
+ <Expanded>
+ 6 == 6
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ 1 == i
+ </Original>
+ <Expanded>
+ 1 == 1
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ 2 == ui
+ </Original>
+ <Expanded>
+ 2 == 2
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ 3 == l
+ </Original>
+ <Expanded>
+ 3 == 3
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ 4 == ul
+ </Original>
+ <Expanded>
+ 4 == 4
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ 5 == c
+ </Original>
+ <Expanded>
+ 5 == 5
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ 6 == uc
+ </Original>
+ <Expanded>
+ 6 == 6
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ (std::numeric_limits<uint32_t>::max)() > ul
+ </Original>
+ <Expanded>
+ 4294967295 (0x<hex digits>) > 4
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Contains string matcher" tags="[.][failing][matchers]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ testStringForMatching(), Contains("not there", Catch::CaseSensitive::No)
+ </Original>
+ <Expanded>
+ "this string contains 'abc' as a substring" contains: "not there" (case insensitive)
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ testStringForMatching(), Contains("STRING")
+ </Original>
+ <Expanded>
+ "this string contains 'abc' as a substring" contains: "STRING"
+ </Expanded>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="Custom exceptions can be translated when testing for nothrow" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Expression success="false" type="REQUIRE_NOTHROW" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Original>
+ throwCustom()
+ </Original>
+ <Expanded>
+ throwCustom()
+ </Expanded>
+ <Exception filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ custom exception - not std
+ </Exception>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="Custom exceptions can be translated when testing for throwing as something else" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Expression success="false" type="REQUIRE_THROWS_AS" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Original>
+ throwCustom(), std::exception
+ </Original>
+ <Expanded>
+ throwCustom(), std::exception
+ </Expanded>
+ <Exception filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ custom exception - not std
+ </Exception>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="Custom std-exceptions can be custom translated" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Exception filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ custom std exception
+ </Exception>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="Default scale is invisible to comparison" tags="[Approx]" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ 101.000001 != Approx(100).epsilon(0.01)
+ </Original>
+ <Expanded>
+ 101.000001 != Approx( 100.0 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ std::pow(10, -5) != Approx(std::pow(10, -7))
+ </Original>
+ <Expanded>
+ 0.00001 != Approx( 0.0000001 )
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="EndsWith string matcher" tags="[.][failing][matchers]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ testStringForMatching(), EndsWith("Substring")
+ </Original>
+ <Expanded>
+ "this string contains 'abc' as a substring" ends with: "Substring"
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ testStringForMatching(), EndsWith("this", Catch::CaseSensitive::No)
+ </Original>
+ <Expanded>
+ "this string contains 'abc' as a substring" ends with: "this" (case insensitive)
+ </Expanded>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="Epsilon only applies to Approx's value" tags="[Approx]" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ 101.01 != Approx(100).epsilon(0.01)
+ </Original>
+ <Expanded>
+ 101.01 != Approx( 100.0 )
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Equality checks that should fail" tags="[!mayfail][.][failing]" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.int_seven == 6
+ </Original>
+ <Expanded>
+ 7 == 6
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.int_seven == 8
+ </Original>
+ <Expanded>
+ 7 == 8
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.int_seven == 0
+ </Original>
+ <Expanded>
+ 7 == 0
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.float_nine_point_one == Approx( 9.11f )
+ </Original>
+ <Expanded>
+ 9.1f == Approx( 9.1099996567 )
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.float_nine_point_one == Approx( 9.0f )
+ </Original>
+ <Expanded>
+ 9.1f == Approx( 9.0 )
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.float_nine_point_one == Approx( 1 )
+ </Original>
+ <Expanded>
+ 9.1f == Approx( 1.0 )
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.float_nine_point_one == Approx( 0 )
+ </Original>
+ <Expanded>
+ 9.1f == Approx( 0.0 )
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.double_pi == Approx( 3.1415 )
+ </Original>
+ <Expanded>
+ 3.1415926535 == Approx( 3.1415 )
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.str_hello == "goodbye"
+ </Original>
+ <Expanded>
+ "hello" == "goodbye"
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.str_hello == "hell"
+ </Original>
+ <Expanded>
+ "hello" == "hell"
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.str_hello == "hello1"
+ </Original>
+ <Expanded>
+ "hello" == "hello1"
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.str_hello.size() == 6
+ </Original>
+ <Expanded>
+ 5 == 6
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ x == Approx( 1.301 )
+ </Original>
+ <Expanded>
+ 1.3 == Approx( 1.301 )
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Equality checks that should succeed" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.int_seven == 7
+ </Original>
+ <Expanded>
+ 7 == 7
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.float_nine_point_one == Approx( 9.1f )
+ </Original>
+ <Expanded>
+ 9.1f == Approx( 9.1000003815 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.double_pi == Approx( 3.1415926535 )
+ </Original>
+ <Expanded>
+ 3.1415926535 == Approx( 3.1415926535 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.str_hello == "hello"
+ </Original>
+ <Expanded>
+ "hello" == "hello"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ "hello" == data.str_hello
+ </Original>
+ <Expanded>
+ "hello" == "hello"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.str_hello.size() == 5
+ </Original>
+ <Expanded>
+ 5 == 5
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ x == Approx( 1.3 )
+ </Original>
+ <Expanded>
+ 1.3 == Approx( 1.3 )
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Equals" tags="[matchers]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ testStringForMatching(), Equals("this string contains 'abc' as a substring")
+ </Original>
+ <Expanded>
+ "this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ testStringForMatching(), Equals("this string contains 'ABC' as a substring", Catch::CaseSensitive::No)
+ </Original>
+ <Expanded>
+ "this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring" (case insensitive)
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Equals string matcher" tags="[.][failing][matchers]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ testStringForMatching(), Equals("this string contains 'ABC' as a substring")
+ </Original>
+ <Expanded>
+ "this string contains 'abc' as a substring" equals: "this string contains 'ABC' as a substring"
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ testStringForMatching(), Equals("something else", Catch::CaseSensitive::No)
+ </Original>
+ <Expanded>
+ "this string contains 'abc' as a substring" equals: "something else" (case insensitive)
+ </Expanded>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="Exception matchers that fail" tags="[!throws][.][.failing][exceptions][matchers]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Section name="No exception" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="false" type="CHECK_THROWS_MATCHES" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ doesNotThrow(), SpecialException, ExceptionMatcher{1}
+ </Original>
+ <Expanded>
+ doesNotThrow(), SpecialException, ExceptionMatcher{1}
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="REQUIRE_THROWS_MATCHES" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ doesNotThrow(), SpecialException, ExceptionMatcher{1}
+ </Original>
+ <Expanded>
+ doesNotThrow(), SpecialException, ExceptionMatcher{1}
+ </Expanded>
+ </Expression>
+ <OverallResults successes="0" failures="2" expectedFailures="0"/>
+ </Section>
+ <Section name="Type mismatch" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="false" type="CHECK_THROWS_MATCHES" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ throwsAsInt(1), SpecialException, ExceptionMatcher{1}
+ </Original>
+ <Expanded>
+ throwsAsInt(1), SpecialException, ExceptionMatcher{1}
+ </Expanded>
+ <Exception filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ Unknown exception
+ </Exception>
+ </Expression>
+ <Expression success="false" type="REQUIRE_THROWS_MATCHES" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ throwsAsInt(1), SpecialException, ExceptionMatcher{1}
+ </Original>
+ <Expanded>
+ throwsAsInt(1), SpecialException, ExceptionMatcher{1}
+ </Expanded>
+ <Exception filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ Unknown exception
+ </Exception>
+ </Expression>
+ <OverallResults successes="0" failures="2" expectedFailures="0"/>
+ </Section>
+ <Section name="Contents are wrong" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="false" type="CHECK_THROWS_MATCHES" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ throws(3), SpecialException, ExceptionMatcher{1}
+ </Original>
+ <Expanded>
+ {?} special exception has value of 1
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="REQUIRE_THROWS_MATCHES" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ throws(4), SpecialException, ExceptionMatcher{1}
+ </Original>
+ <Expanded>
+ {?} special exception has value of 1
+ </Expanded>
+ </Expression>
+ <OverallResults successes="0" failures="2" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="Exception matchers that succeed" tags="[!throws][exceptions][matchers]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="true" type="CHECK_THROWS_MATCHES" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ throws(1), SpecialException, ExceptionMatcher{1}
+ </Original>
+ <Expanded>
+ {?} special exception has value of 1
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THROWS_MATCHES" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ throws(2), SpecialException, ExceptionMatcher{2}
+ </Original>
+ <Expanded>
+ {?} special exception has value of 2
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Exception messages can be tested for" tags="[!throws]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Section name="exact match" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Expression success="true" type="REQUIRE_THROWS_WITH" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Original>
+ thisThrows(), "expected exception"
+ </Original>
+ <Expanded>
+ "expected exception" equals: "expected exception"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="different case" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Expression success="true" type="REQUIRE_THROWS_WITH" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Original>
+ thisThrows(), Equals( "expecteD Exception", Catch::CaseSensitive::No )
+ </Original>
+ <Expanded>
+ "expected exception" equals: "expected exception" (case insensitive)
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="wildcarded" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Expression success="true" type="REQUIRE_THROWS_WITH" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Original>
+ thisThrows(), StartsWith( "expected" )
+ </Original>
+ <Expanded>
+ "expected exception" starts with: "expected"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THROWS_WITH" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Original>
+ thisThrows(), EndsWith( "exception" )
+ </Original>
+ <Expanded>
+ "expected exception" ends with: "exception"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THROWS_WITH" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Original>
+ thisThrows(), Contains( "except" )
+ </Original>
+ <Expanded>
+ "expected exception" contains: "except"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THROWS_WITH" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Original>
+ thisThrows(), Contains( "exCept", Catch::CaseSensitive::No )
+ </Original>
+ <Expanded>
+ "expected exception" contains: "except" (case insensitive)
+ </Expanded>
+ </Expression>
+ <OverallResults successes="4" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Expected exceptions that don't throw or unexpected exceptions fail the test" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Expression success="false" type="CHECK_THROWS_AS" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Original>
+ thisThrows(), std::string
+ </Original>
+ <Expanded>
+ thisThrows(), std::string
+ </Expanded>
+ <Exception filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ expected exception
+ </Exception>
+ </Expression>
+ <Expression success="false" type="CHECK_THROWS_AS" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Original>
+ thisDoesntThrow(), std::domain_error
+ </Original>
+ <Expanded>
+ thisDoesntThrow(), std::domain_error
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK_NOTHROW" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Original>
+ thisThrows()
+ </Original>
+ <Expanded>
+ thisThrows()
+ </Expanded>
+ <Exception filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ expected exception
+ </Exception>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="FAIL aborts the test" tags="[.][failing][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Failure filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ This is a failure
+ </Failure>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="FAIL does not require an argument" tags="[.][failing][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Failure filename="projects/<exe-name>/UsageTests/Message.tests.cpp" />
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="FAIL_CHECK does not abort the test" tags="[.][failing][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Failure filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ This is a failure
+ </Failure>
+ <Warning>
+ This message appears in the output
+ </Warning>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="Factorials are computed" tags="[factorial]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ Factorial(0) == 1
+ </Original>
+ <Expanded>
+ 1 == 1
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ Factorial(1) == 1
+ </Original>
+ <Expanded>
+ 1 == 1
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ Factorial(2) == 2
+ </Original>
+ <Expanded>
+ 2 == 2
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ Factorial(3) == 6
+ </Original>
+ <Expanded>
+ 6 == 6
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ Factorial(10) == 3628800
+ </Original>
+ <Expanded>
+ 3628800 (0x<hex digits>) == 3628800 (0x<hex digits>)
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Floating point matchers: double" tags="[floating-point][matchers]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Section name="Margin" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ 1., WithinAbs(1., 0)
+ </Original>
+ <Expanded>
+ 1.0 is within 0.0 of 1.0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ 0., WithinAbs(1., 1)
+ </Original>
+ <Expanded>
+ 0.0 is within 1.0 of 1.0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ 0., !WithinAbs(1., 0.99)
+ </Original>
+ <Expanded>
+ 0.0 not is within 0.99 of 1.0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ 0., !WithinAbs(1., 0.99)
+ </Original>
+ <Expanded>
+ 0.0 not is within 0.99 of 1.0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ NAN, !WithinAbs(NAN, 0)
+ </Original>
+ <Expanded>
+ nanf not is within 0.0 of nan
+ </Expanded>
+ </Expression>
+ <OverallResults successes="5" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="ULPs" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ 1., WithinULP(1., 0)
+ </Original>
+ <Expanded>
+ 1.0 is within 0 ULPs of 1.0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ std::nextafter(1., 2.), WithinULP(1., 1)
+ </Original>
+ <Expanded>
+ 1.0 is within 1 ULPs of 1.0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ std::nextafter(1., 0.), WithinULP(1., 1)
+ </Original>
+ <Expanded>
+ 1.0 is within 1 ULPs of 1.0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ std::nextafter(1., 2.), !WithinULP(1., 0)
+ </Original>
+ <Expanded>
+ 1.0 not is within 0 ULPs of 1.0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ 1., WithinULP(1., 0)
+ </Original>
+ <Expanded>
+ 1.0 is within 0 ULPs of 1.0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ -0., WithinULP(0., 0)
+ </Original>
+ <Expanded>
+ -0.0 is within 0 ULPs of 0.0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ NAN, !WithinULP(NAN, 123)
+ </Original>
+ <Expanded>
+ nanf not is within 123 ULPs of nanf
+ </Expanded>
+ </Expression>
+ <OverallResults successes="7" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Composed" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ 1., WithinAbs(1., 0.5) || WithinULP(2., 1)
+ </Original>
+ <Expanded>
+ 1.0 ( is within 0.5 of 1.0 or is within 1 ULPs of 2.0 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ 1., WithinAbs(2., 0.5) || WithinULP(1., 0)
+ </Original>
+ <Expanded>
+ 1.0 ( is within 0.5 of 2.0 or is within 0 ULPs of 1.0 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ NAN, !(WithinAbs(NAN, 100) || WithinULP(NAN, 123))
+ </Original>
+ <Expanded>
+ nanf not ( is within 100.0 of nan or is within 123 ULPs of nanf )
+ </Expanded>
+ </Expression>
+ <OverallResults successes="3" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Constructor validation" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="true" type="REQUIRE_NOTHROW" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ WithinAbs(1., 0.)
+ </Original>
+ <Expanded>
+ WithinAbs(1., 0.)
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THROWS_AS" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ WithinAbs(1., -1.), std::domain_error
+ </Original>
+ <Expanded>
+ WithinAbs(1., -1.), std::domain_error
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_NOTHROW" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ WithinULP(1., 0)
+ </Original>
+ <Expanded>
+ WithinULP(1., 0)
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THROWS_AS" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ WithinULP(1., -1), std::domain_error
+ </Original>
+ <Expanded>
+ WithinULP(1., -1), std::domain_error
+ </Expanded>
+ </Expression>
+ <OverallResults successes="4" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Floating point matchers: float" tags="[floating-point][matchers]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Section name="Margin" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ 1.f, WithinAbs(1.f, 0)
+ </Original>
+ <Expanded>
+ 1.0f is within 0.0 of 1.0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ 0.f, WithinAbs(1.f, 1)
+ </Original>
+ <Expanded>
+ 0.0f is within 1.0 of 1.0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ 0.f, !WithinAbs(1.f, 0.99f)
+ </Original>
+ <Expanded>
+ 0.0f not is within 0.9900000095 of 1.0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ 0.f, !WithinAbs(1.f, 0.99f)
+ </Original>
+ <Expanded>
+ 0.0f not is within 0.9900000095 of 1.0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ 0.f, WithinAbs(-0.f, 0)
+ </Original>
+ <Expanded>
+ 0.0f is within 0.0 of -0.0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ NAN, !WithinAbs(NAN, 0)
+ </Original>
+ <Expanded>
+ nanf not is within 0.0 of nan
+ </Expanded>
+ </Expression>
+ <OverallResults successes="6" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="ULPs" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ 1.f, WithinULP(1.f, 0)
+ </Original>
+ <Expanded>
+ 1.0f is within 0 ULPs of 1.0f
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ std::nextafter(1.f, 2.f), WithinULP(1.f, 1)
+ </Original>
+ <Expanded>
+ 1.0f is within 1 ULPs of 1.0f
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ std::nextafter(1.f, 0.f), WithinULP(1.f, 1)
+ </Original>
+ <Expanded>
+ 1.0f is within 1 ULPs of 1.0f
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ std::nextafter(1.f, 2.f), !WithinULP(1.f, 0)
+ </Original>
+ <Expanded>
+ 1.0f not is within 0 ULPs of 1.0f
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ 1.f, WithinULP(1.f, 0)
+ </Original>
+ <Expanded>
+ 1.0f is within 0 ULPs of 1.0f
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ -0.f, WithinULP(0.f, 0)
+ </Original>
+ <Expanded>
+ -0.0f is within 0 ULPs of 0.0f
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ NAN, !WithinULP(NAN, 123)
+ </Original>
+ <Expanded>
+ nanf not is within 123 ULPs of nanf
+ </Expanded>
+ </Expression>
+ <OverallResults successes="7" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Composed" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ 1.f, WithinAbs(1.f, 0.5) || WithinULP(1.f, 1)
+ </Original>
+ <Expanded>
+ 1.0f ( is within 0.5 of 1.0 or is within 1 ULPs of 1.0f )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ 1.f, WithinAbs(2.f, 0.5) || WithinULP(1.f, 0)
+ </Original>
+ <Expanded>
+ 1.0f ( is within 0.5 of 2.0 or is within 0 ULPs of 1.0f )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ NAN, !(WithinAbs(NAN, 100) || WithinULP(NAN, 123))
+ </Original>
+ <Expanded>
+ nanf not ( is within 100.0 of nan or is within 123 ULPs of nanf )
+ </Expanded>
+ </Expression>
+ <OverallResults successes="3" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Constructor validation" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="true" type="REQUIRE_NOTHROW" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ WithinAbs(1.f, 0.f)
+ </Original>
+ <Expanded>
+ WithinAbs(1.f, 0.f)
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THROWS_AS" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ WithinAbs(1.f, -1.f), std::domain_error
+ </Original>
+ <Expanded>
+ WithinAbs(1.f, -1.f), std::domain_error
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_NOTHROW" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ WithinULP(1.f, 0)
+ </Original>
+ <Expanded>
+ WithinULP(1.f, 0)
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THROWS_AS" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ WithinULP(1.f, -1), std::domain_error
+ </Original>
+ <Expanded>
+ WithinULP(1.f, -1), std::domain_error
+ </Expanded>
+ </Expression>
+ <OverallResults successes="4" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Greater-than inequalities with different epsilons" tags="[Approx]" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ d >= Approx( 1.22 )
+ </Original>
+ <Expanded>
+ 1.23 >= Approx( 1.22 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ d >= Approx( 1.23 )
+ </Original>
+ <Expanded>
+ 1.23 >= Approx( 1.23 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_FALSE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ !(d >= Approx( 1.24 ))
+ </Original>
+ <Expanded>
+ !(1.23 >= Approx( 1.24 ))
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ d >= Approx( 1.24 ).epsilon(0.1)
+ </Original>
+ <Expanded>
+ 1.23 >= Approx( 1.24 )
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="INFO and WARN do not abort tests" tags="[.][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Info>
+ this is a message
+ </Info>
+ <Warning>
+ this is a warning
+ </Warning>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="INFO gets logged on failure" tags="[.][failing][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Info>
+ this message should be logged
+ </Info>
+ <Info>
+ so should this
+ </Info>
+ <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Original>
+ a == 1
+ </Original>
+ <Expanded>
+ 2 == 1
+ </Expanded>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="INFO gets logged on failure, even if captured before successful assertions" tags="[.][failing][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Info>
+ this message may be logged later
+ </Info>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Original>
+ a == 2
+ </Original>
+ <Expanded>
+ 2 == 2
+ </Expanded>
+ </Expression>
+ <Info>
+ this message may be logged later
+ </Info>
+ <Info>
+ this message should be logged
+ </Info>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Original>
+ a == 1
+ </Original>
+ <Expanded>
+ 2 == 1
+ </Expanded>
+ </Expression>
+ <Info>
+ this message may be logged later
+ </Info>
+ <Info>
+ this message should be logged
+ </Info>
+ <Info>
+ and this, but later
+ </Info>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Original>
+ a == 0
+ </Original>
+ <Expanded>
+ 2 == 0
+ </Expanded>
+ </Expression>
+ <Info>
+ this message may be logged later
+ </Info>
+ <Info>
+ this message should be logged
+ </Info>
+ <Info>
+ and this, but later
+ </Info>
+ <Info>
+ but not this
+ </Info>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Original>
+ a == 2
+ </Original>
+ <Expanded>
+ 2 == 2
+ </Expanded>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="INFO is reset for each loop" tags="[.][failing][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Info>
+ current counter 0
+ </Info>
+ <Info>
+ i := 0
+ </Info>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Original>
+ i < 10
+ </Original>
+ <Expanded>
+ 0 < 10
+ </Expanded>
+ </Expression>
+ <Info>
+ current counter 1
+ </Info>
+ <Info>
+ i := 1
+ </Info>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Original>
+ i < 10
+ </Original>
+ <Expanded>
+ 1 < 10
+ </Expanded>
+ </Expression>
+ <Info>
+ current counter 2
+ </Info>
+ <Info>
+ i := 2
+ </Info>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Original>
+ i < 10
+ </Original>
+ <Expanded>
+ 2 < 10
+ </Expanded>
+ </Expression>
+ <Info>
+ current counter 3
+ </Info>
+ <Info>
+ i := 3
+ </Info>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Original>
+ i < 10
+ </Original>
+ <Expanded>
+ 3 < 10
+ </Expanded>
+ </Expression>
+ <Info>
+ current counter 4
+ </Info>
+ <Info>
+ i := 4
+ </Info>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Original>
+ i < 10
+ </Original>
+ <Expanded>
+ 4 < 10
+ </Expanded>
+ </Expression>
+ <Info>
+ current counter 5
+ </Info>
+ <Info>
+ i := 5
+ </Info>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Original>
+ i < 10
+ </Original>
+ <Expanded>
+ 5 < 10
+ </Expanded>
+ </Expression>
+ <Info>
+ current counter 6
+ </Info>
+ <Info>
+ i := 6
+ </Info>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Original>
+ i < 10
+ </Original>
+ <Expanded>
+ 6 < 10
+ </Expanded>
+ </Expression>
+ <Info>
+ current counter 7
+ </Info>
+ <Info>
+ i := 7
+ </Info>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Original>
+ i < 10
+ </Original>
+ <Expanded>
+ 7 < 10
+ </Expanded>
+ </Expression>
+ <Info>
+ current counter 8
+ </Info>
+ <Info>
+ i := 8
+ </Info>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Original>
+ i < 10
+ </Original>
+ <Expanded>
+ 8 < 10
+ </Expanded>
+ </Expression>
+ <Info>
+ current counter 9
+ </Info>
+ <Info>
+ i := 9
+ </Info>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Original>
+ i < 10
+ </Original>
+ <Expanded>
+ 9 < 10
+ </Expanded>
+ </Expression>
+ <Info>
+ current counter 10
+ </Info>
+ <Info>
+ i := 10
+ </Info>
+ <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Original>
+ i < 10
+ </Original>
+ <Expanded>
+ 10 < 10
+ </Expanded>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="Inequality checks that should fail" tags="[!shouldfail][.][failing]" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.int_seven != 7
+ </Original>
+ <Expanded>
+ 7 != 7
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.float_nine_point_one != Approx( 9.1f )
+ </Original>
+ <Expanded>
+ 9.1f != Approx( 9.1000003815 )
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.double_pi != Approx( 3.1415926535 )
+ </Original>
+ <Expanded>
+ 3.1415926535 != Approx( 3.1415926535 )
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.str_hello != "hello"
+ </Original>
+ <Expanded>
+ "hello" != "hello"
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.str_hello.size() != 5
+ </Original>
+ <Expanded>
+ 5 != 5
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Inequality checks that should succeed" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.int_seven != 6
+ </Original>
+ <Expanded>
+ 7 != 6
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.int_seven != 8
+ </Original>
+ <Expanded>
+ 7 != 8
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.float_nine_point_one != Approx( 9.11f )
+ </Original>
+ <Expanded>
+ 9.1f != Approx( 9.1099996567 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.float_nine_point_one != Approx( 9.0f )
+ </Original>
+ <Expanded>
+ 9.1f != Approx( 9.0 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.float_nine_point_one != Approx( 1 )
+ </Original>
+ <Expanded>
+ 9.1f != Approx( 1.0 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.float_nine_point_one != Approx( 0 )
+ </Original>
+ <Expanded>
+ 9.1f != Approx( 0.0 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.double_pi != Approx( 3.1415 )
+ </Original>
+ <Expanded>
+ 3.1415926535 != Approx( 3.1415 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.str_hello != "goodbye"
+ </Original>
+ <Expanded>
+ "hello" != "goodbye"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.str_hello != "hell"
+ </Original>
+ <Expanded>
+ "hello" != "hell"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.str_hello != "hello1"
+ </Original>
+ <Expanded>
+ "hello" != "hello1"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.str_hello.size() != 6
+ </Original>
+ <Expanded>
+ 5 != 6
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Less-than inequalities with different epsilons" tags="[Approx]" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ d <= Approx( 1.24 )
+ </Original>
+ <Expanded>
+ 1.23 <= Approx( 1.24 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ d <= Approx( 1.23 )
+ </Original>
+ <Expanded>
+ 1.23 <= Approx( 1.23 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_FALSE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ !(d <= Approx( 1.22 ))
+ </Original>
+ <Expanded>
+ !(1.23 <= Approx( 1.22 ))
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ d <= Approx( 1.22 ).epsilon(0.1)
+ </Original>
+ <Expanded>
+ 1.23 <= Approx( 1.22 )
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="ManuallyRegistered" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Matchers can be (AllOf) composed with the && operator" tags="[matchers][operator&&][operators]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ testStringForMatching(), Contains("string") && Contains("abc") && Contains("substring") && Contains("contains")
+ </Original>
+ <Expanded>
+ "this string contains 'abc' as a substring" ( contains: "string" and contains: "abc" and contains: "substring" and contains: "contains" )
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Matchers can be (AnyOf) composed with the || operator" tags="[matchers][operators][operator||]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ testStringForMatching(), Contains("string") || Contains("different") || Contains("random")
+ </Original>
+ <Expanded>
+ "this string contains 'abc' as a substring" ( contains: "string" or contains: "different" or contains: "random" )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ testStringForMatching2(), Contains("string") || Contains("different") || Contains("random")
+ </Original>
+ <Expanded>
+ "some completely different text that contains one common word" ( contains: "string" or contains: "different" or contains: "random" )
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Matchers can be composed with both && and ||" tags="[matchers][operator&&][operators][operator||]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ testStringForMatching(), (Contains("string") || Contains("different")) && Contains("substring")
+ </Original>
+ <Expanded>
+ "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "substring" )
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Matchers can be composed with both && and || - failing" tags="[.][.failing][matchers][operator&&][operators][operator||]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ testStringForMatching(), (Contains("string") || Contains("different")) && Contains("random")
+ </Original>
+ <Expanded>
+ "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" )
+ </Expanded>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="Matchers can be negated (Not) with the ! operator" tags="[matchers][not][operators]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ testStringForMatching(), !Contains("different")
+ </Original>
+ <Expanded>
+ "this string contains 'abc' as a substring" not contains: "different"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Matchers can be negated (Not) with the ! operator - failing" tags="[.][.failing][matchers][not][operators]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ testStringForMatching(), !Contains("substring")
+ </Original>
+ <Expanded>
+ "this string contains 'abc' as a substring" not contains: "substring"
+ </Expanded>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="Mismatching exception messages failing the test" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Expression success="true" type="REQUIRE_THROWS_WITH" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Original>
+ thisThrows(), "expected exception"
+ </Original>
+ <Expanded>
+ "expected exception" equals: "expected exception"
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="REQUIRE_THROWS_WITH" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Original>
+ thisThrows(), "should fail"
+ </Original>
+ <Expanded>
+ "expected exception" equals: "should fail"
+ </Expanded>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="Nice descriptive name" tags="[.][tag1][tag2][tag3]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Warning>
+ This one ran
+ </Warning>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="Non-std exceptions can be translated" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Exception filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ custom exception
+ </Exception>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="Objects that evaluated in boolean contexts can be checked" tags="[SafeBool][Tricky]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ True
+ </Original>
+ <Expanded>
+ {?}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ !False
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_FALSE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ !(False)
+ </Original>
+ <Expanded>
+ !{?}
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Ordering comparison checks that should fail" tags="[.][failing]" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.int_seven > 7
+ </Original>
+ <Expanded>
+ 7 > 7
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.int_seven < 7
+ </Original>
+ <Expanded>
+ 7 < 7
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.int_seven > 8
+ </Original>
+ <Expanded>
+ 7 > 8
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.int_seven < 6
+ </Original>
+ <Expanded>
+ 7 < 6
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.int_seven < 0
+ </Original>
+ <Expanded>
+ 7 < 0
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.int_seven < -1
+ </Original>
+ <Expanded>
+ 7 < -1
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.int_seven >= 8
+ </Original>
+ <Expanded>
+ 7 >= 8
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.int_seven <= 6
+ </Original>
+ <Expanded>
+ 7 <= 6
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.float_nine_point_one < 9
+ </Original>
+ <Expanded>
+ 9.1f < 9
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.float_nine_point_one > 10
+ </Original>
+ <Expanded>
+ 9.1f > 10
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.float_nine_point_one > 9.2
+ </Original>
+ <Expanded>
+ 9.1f > 9.2
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.str_hello > "hello"
+ </Original>
+ <Expanded>
+ "hello" > "hello"
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.str_hello < "hello"
+ </Original>
+ <Expanded>
+ "hello" < "hello"
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.str_hello > "hellp"
+ </Original>
+ <Expanded>
+ "hello" > "hellp"
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.str_hello > "z"
+ </Original>
+ <Expanded>
+ "hello" > "z"
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.str_hello < "hellm"
+ </Original>
+ <Expanded>
+ "hello" < "hellm"
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.str_hello < "a"
+ </Original>
+ <Expanded>
+ "hello" < "a"
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.str_hello >= "z"
+ </Original>
+ <Expanded>
+ "hello" >= "z"
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.str_hello <= "a"
+ </Original>
+ <Expanded>
+ "hello" <= "a"
+ </Expanded>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="Ordering comparison checks that should succeed" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.int_seven < 8
+ </Original>
+ <Expanded>
+ 7 < 8
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.int_seven > 6
+ </Original>
+ <Expanded>
+ 7 > 6
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.int_seven > 0
+ </Original>
+ <Expanded>
+ 7 > 0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.int_seven > -1
+ </Original>
+ <Expanded>
+ 7 > -1
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.int_seven >= 7
+ </Original>
+ <Expanded>
+ 7 >= 7
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.int_seven >= 6
+ </Original>
+ <Expanded>
+ 7 >= 6
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.int_seven <= 7
+ </Original>
+ <Expanded>
+ 7 <= 7
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.int_seven <= 8
+ </Original>
+ <Expanded>
+ 7 <= 8
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.float_nine_point_one > 9
+ </Original>
+ <Expanded>
+ 9.1f > 9
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.float_nine_point_one < 10
+ </Original>
+ <Expanded>
+ 9.1f < 10
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.float_nine_point_one < 9.2
+ </Original>
+ <Expanded>
+ 9.1f < 9.2
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.str_hello <= "hello"
+ </Original>
+ <Expanded>
+ "hello" <= "hello"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.str_hello >= "hello"
+ </Original>
+ <Expanded>
+ "hello" >= "hello"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.str_hello < "hellp"
+ </Original>
+ <Expanded>
+ "hello" < "hellp"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.str_hello < "zebra"
+ </Original>
+ <Expanded>
+ "hello" < "zebra"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.str_hello > "hellm"
+ </Original>
+ <Expanded>
+ "hello" > "hellm"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ data.str_hello > "a"
+ </Original>
+ <Expanded>
+ "hello" > "a"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Output from all sections is reported" tags="[.][failing][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Section name="one" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Failure filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ Message from section one
+ </Failure>
+ <OverallResults successes="0" failures="1" expectedFailures="0"/>
+ </Section>
+ <Section name="two" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Failure filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ Message from section two
+ </Failure>
+ <OverallResults successes="0" failures="1" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="Parse test names and tags" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Section name="Empty test spec should have no filters" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <OverallResults successes="3" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Test spec from empty string should have no filters" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches(tcA ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <OverallResults successes="3" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Test spec from just a comma should have no filters" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <OverallResults successes="3" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Test spec from name should have one filter" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="3" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Test spec from quoted name should have one filter" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="3" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Test spec from name should have one filter" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcC ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <OverallResults successes="4" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Wildcard at the start" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcC ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcD ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ parseTestSpec( "*a" ).matches( tcA ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="6" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Wildcard at the end" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcC ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcD ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ parseTestSpec( "a*" ).matches( tcA ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="6" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Wildcard at both ends" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcC ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcD ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ parseTestSpec( "*a*" ).matches( tcA ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="6" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Redundant wildcard at the start" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <OverallResults successes="3" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Redundant wildcard at the end" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <OverallResults successes="3" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Redundant wildcard at both ends" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <OverallResults successes="3" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Wildcard at both ends, redundant at start" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcC ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcD ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="5" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Just wildcard" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcC ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcD ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="5" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Single tag" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcC ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <OverallResults successes="4" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Single tag, two matches" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcC ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="4" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Two tags" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcC ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="4" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Two tags, spare separated" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcC ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="4" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Wildcarded name and tag" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcC ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcD ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <OverallResults successes="5" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Single tag exclusion" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcC ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="4" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="One tag exclusion and one tag inclusion" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcC ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <OverallResults successes="4" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="One tag exclusion and one wldcarded name inclusion" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcC ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcD ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="5" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="One tag exclusion, using exclude:, and one wldcarded name inclusion" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcC ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcD ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="5" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="name exclusion" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcC ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcD ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="5" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="wildcarded name exclusion" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcC ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcD ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <OverallResults successes="5" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="wildcarded name exclusion with tag inclusion" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcC ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcD ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <OverallResults successes="5" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="wildcarded name exclusion, using exclude:, with tag inclusion" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcC ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcD ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <OverallResults successes="5" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="two wildcarded names" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcC ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcD ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <OverallResults successes="5" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="empty tag" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcC ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcD ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <OverallResults successes="5" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="empty quoted name" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcC ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcD ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <OverallResults successes="5" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="quoted string followed by tag exclusion" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.hasFilters() == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcA ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcB ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcC ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( tcD ) == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="5" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Parsing a std::pair" tags="[Tricky][std::pair]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ (std::pair<int, int>( 1, 2 )) == aNicePair
+ </Original>
+ <Expanded>
+ {?} == {?}
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Pointers can be compared to null" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ p == 0
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ p == pNULL
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ p != 0
+ </Original>
+ <Expanded>
+ 0x<hex digits> != 0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ cp != 0
+ </Original>
+ <Expanded>
+ 0x<hex digits> != 0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ cpc != 0
+ </Original>
+ <Expanded>
+ 0x<hex digits> != 0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ returnsNull() == 0
+ </Original>
+ <Expanded>
+ {null string} == 0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ returnsConstNull() == 0
+ </Original>
+ <Expanded>
+ {null string} == 0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ 0 != p
+ </Original>
+ <Expanded>
+ 0 != 0x<hex digits>
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Process can be configured on command line" tags="[command-line][config]" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Section name="empty args don't cause a crash" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ result
+ </Original>
+ <Expanded>
+ {?}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ config.processName == ""
+ </Original>
+ <Expanded>
+ "" == ""
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="default - no arguments" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ result
+ </Original>
+ <Expanded>
+ {?}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ config.processName == "test"
+ </Original>
+ <Expanded>
+ "test" == "test"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ config.shouldDebugBreak == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ config.abortAfter == -1
+ </Original>
+ <Expanded>
+ -1 == -1
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ config.noThrow == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ config.reporterNames.empty()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="6" failures="0" expectedFailures="0"/>
+ </Section>
+ <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" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ result
+ </Original>
+ <Expanded>
+ {?}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ cfg.testSpec().matches(fakeTestCase("notIncluded")) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ cfg.testSpec().matches(fakeTestCase("test1"))
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="3" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="3" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="test lists" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Section name="Specify one test case exclusion using exclude:" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ result
+ </Original>
+ <Expanded>
+ {?}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ cfg.testSpec().matches(fakeTestCase("test1")) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ cfg.testSpec().matches(fakeTestCase("alwaysIncluded"))
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="3" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="3" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="test lists" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Section name="Specify one test case exclusion using ~" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ result
+ </Original>
+ <Expanded>
+ {?}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ cfg.testSpec().matches(fakeTestCase("test1")) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ cfg.testSpec().matches(fakeTestCase("alwaysIncluded"))
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="3" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="3" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="reporter" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Section name="-r/console" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ cli.parse({"test", "-r", "console"})
+ </Original>
+ <Expanded>
+ {?}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ config.reporterNames[0] == "console"
+ </Original>
+ <Expanded>
+ "console" == "console"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="reporter" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Section name="-r/xml" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ cli.parse({"test", "-r", "xml"})
+ </Original>
+ <Expanded>
+ {?}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ config.reporterNames[0] == "xml"
+ </Original>
+ <Expanded>
+ "xml" == "xml"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="reporter" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Section name="-r xml and junit" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ cli.parse({"test", "-r", "xml", "-r", "junit"})
+ </Original>
+ <Expanded>
+ {?}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ config.reporterNames.size() == 2
+ </Original>
+ <Expanded>
+ 2 == 2
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ config.reporterNames[0] == "xml"
+ </Original>
+ <Expanded>
+ "xml" == "xml"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ config.reporterNames[1] == "junit"
+ </Original>
+ <Expanded>
+ "junit" == "junit"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="4" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="4" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="reporter" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Section name="--reporter/junit" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ cli.parse({"test", "--reporter", "junit"})
+ </Original>
+ <Expanded>
+ {?}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ config.reporterNames[0] == "junit"
+ </Original>
+ <Expanded>
+ "junit" == "junit"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="debugger" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Section name="-b" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ cli.parse({"test", "-b"})
+ </Original>
+ <Expanded>
+ {?}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ config.shouldDebugBreak == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="debugger" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Section name="--break" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ cli.parse({"test", "--break"})
+ </Original>
+ <Expanded>
+ {?}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ config.shouldDebugBreak
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="abort" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Section name="-a aborts after first failure" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ cli.parse({"test", "-a"})
+ </Original>
+ <Expanded>
+ {?}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ config.abortAfter == 1
+ </Original>
+ <Expanded>
+ 1 == 1
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="abort" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Section name="-x 2 aborts after two failures" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ cli.parse({"test", "-x", "2"})
+ </Original>
+ <Expanded>
+ {?}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ config.abortAfter == 2
+ </Original>
+ <Expanded>
+ 2 == 2
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="abort" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Section name="-x must be numeric" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ !result
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ result.errorMessage(), Contains("convert") && Contains("oops")
+ </Original>
+ <Expanded>
+ "Unable to convert 'oops' to destination type" ( contains: "convert" and contains: "oops" )
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="nothrow" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Section name="-e" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ cli.parse({"test", "-e"})
+ </Original>
+ <Expanded>
+ {?}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ config.noThrow
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="nothrow" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Section name="--nothrow" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ cli.parse({"test", "--nothrow"})
+ </Original>
+ <Expanded>
+ {?}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ config.noThrow
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="output filename" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Section name="-o filename" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ cli.parse({"test", "-o", "filename.ext"})
+ </Original>
+ <Expanded>
+ {?}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ config.outputFilename == "filename.ext"
+ </Original>
+ <Expanded>
+ "filename.ext" == "filename.ext"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="output filename" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Section name="--out" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ cli.parse({"test", "--out", "filename.ext"})
+ </Original>
+ <Expanded>
+ {?}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ config.outputFilename == "filename.ext"
+ </Original>
+ <Expanded>
+ "filename.ext" == "filename.ext"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="combinations" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Section name="Single character flags can be combined" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ cli.parse({"test", "-abe"})
+ </Original>
+ <Expanded>
+ {?}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ config.abortAfter == 1
+ </Original>
+ <Expanded>
+ 1 == 1
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ config.shouldDebugBreak
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ config.noThrow == true
+ </Original>
+ <Expanded>
+ true == true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="4" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="4" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="use-colour" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Section name="without option" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ cli.parse({"test"})
+ </Original>
+ <Expanded>
+ {?}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ config.useColour == UseColour::Auto
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="use-colour" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Section name="auto" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ cli.parse({"test", "--use-colour", "auto"})
+ </Original>
+ <Expanded>
+ {?}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ config.useColour == UseColour::Auto
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="use-colour" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Section name="yes" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ cli.parse({"test", "--use-colour", "yes"})
+ </Original>
+ <Expanded>
+ {?}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ config.useColour == UseColour::Yes
+ </Original>
+ <Expanded>
+ 1 == 1
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="use-colour" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Section name="no" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ cli.parse({"test", "--use-colour", "no"})
+ </Original>
+ <Expanded>
+ {?}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ config.useColour == UseColour::No
+ </Original>
+ <Expanded>
+ 2 == 2
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="use-colour" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Section name="error" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ !result
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ result.errorMessage(), Contains( "colour mode must be one of" )
+ </Original>
+ <Expanded>
+ "colour mode must be one of: auto, yes or no. 'wrong' not recognised" contains: "colour mode must be one of"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Reconstruction should be based on stringification: #914" tags="[.][Decomposition][failing]" filename="projects/<exe-name>/UsageTests/Decomposition.tests.cpp" >
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Decomposition.tests.cpp" >
+ <Original>
+ truthy(false)
+ </Original>
+ <Expanded>
+ Hey, its truthy!
+ </Expanded>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="Regex string matcher" tags="[.][.failing][matchers]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ testStringForMatching(), Matches("this STRING contains 'abc' as a substring")
+ </Original>
+ <Expanded>
+ "this string contains 'abc' as a substring" matches "this STRING contains 'abc' as a substring" case sensitively
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ testStringForMatching(), Matches("contains 'abc' as a substring")
+ </Original>
+ <Expanded>
+ "this string contains 'abc' as a substring" matches "contains 'abc' as a substring" case sensitively
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ testStringForMatching(), Matches("this string contains 'abc' as a")
+ </Original>
+ <Expanded>
+ "this string contains 'abc' as a substring" matches "this string contains 'abc' as a" case sensitively
+ </Expanded>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="SUCCEED counts as a test pass" tags="[messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="SUCCEED does not require an argument" tags="[.][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Scenario: BDD tests requiring Fixtures to provide commonly-accessed data or methods" tags="[bdd][fixtures]" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Section name="Given: No operations precede me" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Original>
+ before == 0
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <Section name="When: We get the count" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Section name="Then: Subsequently values are higher" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Original>
+ after > before
+ </Original>
+ <Expanded>
+ 1 > 0
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Scenario: Do that thing with the thing" tags="[Tags]" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Section name="Given: This stuff exists" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Section name="When: I do this" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Section name="Then: it should do this" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Original>
+ itDoesThis()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Section name="And: do that" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Original>
+ itDoesThat()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Scenario: This is a really long scenario name to see how the list command deals with wrapping" tags="[anotherReallyLongTagNameButThisOneHasNoObviousWrapPointsSoShouldSplitWithinAWordUsingADashCharacter][long][lots][one very long tag name that should cause line wrapping writing out using the list command][tags][verbose][very long tags]" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Section name="Given: A section name that is so long that it cannot fit in a single console width" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Section name="When: The test headers are printed as part of the normal running of the scenario" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Section name="Then: The, deliberately very long and overly verbose (you see what I did there?) section names must wrap, along with an indent" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Scenario: Vector resizing affects size and capacity" tags="[bdd][capacity][size][vector]" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Section name="Given: an empty vector" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Original>
+ v.size() == 0
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <Section name="When: it is made larger" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Section name="Then: the size and capacity go up" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Original>
+ v.size() == 10
+ </Original>
+ <Expanded>
+ 10 == 10
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Original>
+ v.capacity() >= 10
+ </Original>
+ <Expanded>
+ 10 >= 10
+ </Expanded>
+ </Expression>
+ <Section name="And when: it is made smaller again" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Section name="Then: the size goes down but the capacity stays the same" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Original>
+ v.size() == 5
+ </Original>
+ <Expanded>
+ 5 == 5
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Original>
+ v.capacity() >= 10
+ </Original>
+ <Expanded>
+ 10 >= 10
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="4" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="4" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="5" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Given: an empty vector" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Original>
+ v.size() == 0
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <Section name="When: we reserve more space" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Section name="Then: The capacity is increased but the size remains the same" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Original>
+ v.capacity() >= 10
+ </Original>
+ <Expanded>
+ 10 >= 10
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
+ <Original>
+ v.size() == 0
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="3" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Sends stuff to stdout and stderr" tags="[.]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <OverallResult success="false">
+ <StdOut>
+A string sent directly to stdout
+ </StdOut>
+ <StdErr>
+A string sent directly to stderr
+A string sent to stderr via clog
+ </StdErr>
+ </OverallResult>
+ </TestCase>
+ <TestCase name="Some simple comparisons between doubles" tags="[Approx]" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ d == Approx( 1.23 )
+ </Original>
+ <Expanded>
+ 1.23 == Approx( 1.23 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ d != Approx( 1.22 )
+ </Original>
+ <Expanded>
+ 1.23 != Approx( 1.22 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ d != Approx( 1.24 )
+ </Original>
+ <Expanded>
+ 1.23 != Approx( 1.24 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ Approx( d ) == 1.23
+ </Original>
+ <Expanded>
+ Approx( 1.23 ) == 1.23
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ Approx( d ) != 1.22
+ </Original>
+ <Expanded>
+ Approx( 1.23 ) != 1.22
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ Approx( d ) != 1.24
+ </Original>
+ <Expanded>
+ Approx( 1.23 ) != 1.24
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ INFINITY == Approx(INFINITY)
+ </Original>
+ <Expanded>
+ inff == Approx( inf )
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Standard output from all sections is reported" tags="[.][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Section name="one" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <OverallResults successes="0" failures="1" expectedFailures="0"/>
+ </Section>
+ <Section name="two" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <OverallResults successes="0" failures="1" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="false">
+ <StdOut>
+Message from section one
+Message from section two
+ </StdOut>
+ </OverallResult>
+ </TestCase>
+ <TestCase name="StartsWith string matcher" tags="[.][failing][matchers]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ testStringForMatching(), StartsWith("This String")
+ </Original>
+ <Expanded>
+ "this string contains 'abc' as a substring" starts with: "This String"
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ testStringForMatching(), StartsWith("string", Catch::CaseSensitive::No)
+ </Original>
+ <Expanded>
+ "this string contains 'abc' as a substring" starts with: "string" (case insensitive)
+ </Expanded>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="Static arrays are convertible to string" tags="[toString]" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Section name="Single item" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Original>
+ Catch::Detail::stringify(singular) == "{ 1 }"
+ </Original>
+ <Expanded>
+ "{ 1 }" == "{ 1 }"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Multiple" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Original>
+ Catch::Detail::stringify(arr) == "{ 3, 2, 1 }"
+ </Original>
+ <Expanded>
+ "{ 3, 2, 1 }" == "{ 3, 2, 1 }"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Non-trivial inner items" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Original>
+ Catch::Detail::stringify(arr) == R"({ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } })"
+ </Original>
+ <Expanded>
+ "{ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } }"
+==
+"{ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } }"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="String matchers" tags="[matchers]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ testStringForMatching(), Contains("string")
+ </Original>
+ <Expanded>
+ "this string contains 'abc' as a substring" contains: "string"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ testStringForMatching(), Contains("string", Catch::CaseSensitive::No)
+ </Original>
+ <Expanded>
+ "this string contains 'abc' as a substring" contains: "string" (case insensitive)
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ testStringForMatching(), Contains("abc")
+ </Original>
+ <Expanded>
+ "this string contains 'abc' as a substring" contains: "abc"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ testStringForMatching(), Contains("aBC", Catch::CaseSensitive::No)
+ </Original>
+ <Expanded>
+ "this string contains 'abc' as a substring" contains: "abc" (case insensitive)
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ testStringForMatching(), StartsWith("this")
+ </Original>
+ <Expanded>
+ "this string contains 'abc' as a substring" starts with: "this"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ testStringForMatching(), StartsWith("THIS", Catch::CaseSensitive::No)
+ </Original>
+ <Expanded>
+ "this string contains 'abc' as a substring" starts with: "this" (case insensitive)
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ testStringForMatching(), EndsWith("substring")
+ </Original>
+ <Expanded>
+ "this string contains 'abc' as a substring" ends with: "substring"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ testStringForMatching(), EndsWith(" SuBsTrInG", Catch::CaseSensitive::No)
+ </Original>
+ <Expanded>
+ "this string contains 'abc' as a substring" ends with: " substring" (case insensitive)
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="StringRef" tags="[Strings]" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Section name="Empty string" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ empty.empty()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ empty.size() == 0
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ std::strcmp( empty.c_str(), "" ) == 0
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <OverallResults successes="3" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="From string literal" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ s.empty() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ s.size() == 5
+ </Original>
+ <Expanded>
+ 5 == 5
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ isSubstring( s ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ std::strcmp( rawChars, "hello" ) == 0
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <Section name="c_str() does not cause copy" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ isOwned( s ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ s.c_str() == rawChars
+ </Original>
+ <Expanded>
+ "hello" == "hello"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ isOwned( s ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <OverallResults successes="3" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="7" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="From sub-string" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ original == "original"
+ </Original>
+ <Expanded>
+ original == "original"
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ isSubstring( original )
+ </Original>
+ <Expanded>
+ false
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="1" expectedFailures="0"/>
+ </Section>
+ <Section name="Substrings" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Section name="zero-based substring" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ ss.empty() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ ss.size() == 5
+ </Original>
+ <Expanded>
+ 5 == 5
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ std::strcmp( ss.c_str(), "hello" ) == 0
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ ss == "hello"
+ </Original>
+ <Expanded>
+ hello == "hello"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="4" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="4" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Substrings" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Section name="c_str() causes copy" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ isSubstring( ss )
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ isOwned( ss ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ rawChars == data( s )
+ </Original>
+ <Expanded>
+ "hello world!" == "hello world!"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ ss.c_str() != rawChars
+ </Original>
+ <Expanded>
+ "hello" != "hello world!"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ isSubstring( ss ) == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ isOwned( ss )
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ data( ss ) != data( s )
+ </Original>
+ <Expanded>
+ "hello" != "hello world!"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="7" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="7" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Substrings" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Section name="non-zero-based substring" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ ss.size() == 6
+ </Original>
+ <Expanded>
+ 6 == 6
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ std::strcmp( ss.c_str(), "world!" ) == 0
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Substrings" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Section name="Pointer values of full refs should match" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ s.c_str() == s2.c_str()
+ </Original>
+ <Expanded>
+ "hello world!" == "hello world!"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Substrings" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Section name="Pointer values of substring refs should not match" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ s.c_str() != ss.c_str()
+ </Original>
+ <Expanded>
+ "hello world!" != "hello"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Comparisons" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ StringRef("hello") == StringRef("hello")
+ </Original>
+ <Expanded>
+ hello == hello
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ StringRef("hello") != StringRef("cello")
+ </Original>
+ <Expanded>
+ hello != cello
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="from std::string" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Section name="implicitly constructed" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ sr == "a standard string"
+ </Original>
+ <Expanded>
+ a standard string == "a standard string"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ sr.size() == stdStr.size()
+ </Original>
+ <Expanded>
+ 17 == 17
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="from std::string" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Section name="explicitly constructed" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ sr == "a standard string"
+ </Original>
+ <Expanded>
+ a standard string == "a standard string"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ sr.size() == stdStr.size()
+ </Original>
+ <Expanded>
+ 17 == 17
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="from std::string" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Section name="assigned" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ sr == "a standard string"
+ </Original>
+ <Expanded>
+ a standard string == "a standard string"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ sr.size() == stdStr.size()
+ </Original>
+ <Expanded>
+ 17 == 17
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="to std::string" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Section name="implicitly constructed" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ stdStr == "a stringref"
+ </Original>
+ <Expanded>
+ "a stringref" == "a stringref"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ stdStr.size() == sr.size()
+ </Original>
+ <Expanded>
+ 11 == 11
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="to std::string" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Section name="explicitly constructed" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ stdStr == "a stringref"
+ </Original>
+ <Expanded>
+ "a stringref" == "a stringref"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ stdStr.size() == sr.size()
+ </Original>
+ <Expanded>
+ 11 == 11
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="to std::string" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Section name="assigned" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ stdStr == "a stringref"
+ </Original>
+ <Expanded>
+ "a stringref" == "a stringref"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ stdStr.size() == sr.size()
+ </Original>
+ <Expanded>
+ 11 == 11
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="Stringifying std::chrono::duration helpers" tags="[chrono][toString]" filename="projects/<exe-name>/UsageTests/ToStringChrono.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringChrono.tests.cpp" >
+ <Original>
+ minute == seconds
+ </Original>
+ <Expanded>
+ 1 m == 60 s
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringChrono.tests.cpp" >
+ <Original>
+ hour != seconds
+ </Original>
+ <Expanded>
+ 1 h != 60 s
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringChrono.tests.cpp" >
+ <Original>
+ micro != milli
+ </Original>
+ <Expanded>
+ 1 us != 1 ms
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringChrono.tests.cpp" >
+ <Original>
+ nano != micro
+ </Original>
+ <Expanded>
+ 1 ns != 1 us
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Stringifying std::chrono::duration with weird ratios" tags="[chrono][toString]" filename="projects/<exe-name>/UsageTests/ToStringChrono.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringChrono.tests.cpp" >
+ <Original>
+ half_minute != femto_second
+ </Original>
+ <Expanded>
+ 1 [30/1]s != 1 fs
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringChrono.tests.cpp" >
+ <Original>
+ pico_second != atto_second
+ </Original>
+ <Expanded>
+ 1 ps != 1 as
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Stringifying std::chrono::time_point<system_clock>" tags="[chrono][toString]" filename="projects/<exe-name>/UsageTests/ToStringChrono.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringChrono.tests.cpp" >
+ <Original>
+ now != later
+ </Original>
+ <Expanded>
+ {iso8601-timestamp}
+!=
+{iso8601-timestamp}
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Tabs and newlines show in output" tags="[.][failing][whitespace]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ s1 == s2
+ </Original>
+ <Expanded>
+ "if ($b == 10) {
+ $a = 20;
+}"
+==
+"if ($b == 10) {
+ $a = 20;
+}
+"
+ </Expanded>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="Tag alias can be registered against tag patterns" filename="projects/<exe-name>/IntrospectiveTests/TagAlias.tests.cpp" >
+ <Section name="The same tag alias can only be registered once" filename="projects/<exe-name>/IntrospectiveTests/TagAlias.tests.cpp" >
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/IntrospectiveTests/TagAlias.tests.cpp" >
+ <Original>
+ what, Contains( "[@zzz]" )
+ </Original>
+ <Expanded>
+ "error: tag alias, '[@zzz]' already registered.
+ First seen at: file:2
+ Redefined at: file:10" contains: "[@zzz]"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/IntrospectiveTests/TagAlias.tests.cpp" >
+ <Original>
+ what, Contains( "file" )
+ </Original>
+ <Expanded>
+ "error: tag alias, '[@zzz]' already registered.
+ First seen at: file:2
+ Redefined at: file:10" contains: "file"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/IntrospectiveTests/TagAlias.tests.cpp" >
+ <Original>
+ what, Contains( "2" )
+ </Original>
+ <Expanded>
+ "error: tag alias, '[@zzz]' already registered.
+ First seen at: file:2
+ Redefined at: file:10" contains: "2"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/IntrospectiveTests/TagAlias.tests.cpp" >
+ <Original>
+ what, Contains( "10" )
+ </Original>
+ <Expanded>
+ "error: tag alias, '[@zzz]' already registered.
+ First seen at: file:2
+ Redefined at: file:10" contains: "10"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="4" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Tag aliases must be of the form [@name]" filename="projects/<exe-name>/IntrospectiveTests/TagAlias.tests.cpp" >
+ <Expression success="true" type="CHECK_THROWS" filename="projects/<exe-name>/IntrospectiveTests/TagAlias.tests.cpp" >
+ <Original>
+ registry.add( "[no ampersat]", "", Catch::SourceLineInfo( "file", 3 ) )
+ </Original>
+ <Expanded>
+ registry.add( "[no ampersat]", "", Catch::SourceLineInfo( "file", 3 ) )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_THROWS" filename="projects/<exe-name>/IntrospectiveTests/TagAlias.tests.cpp" >
+ <Original>
+ registry.add( "[the @ is not at the start]", "", Catch::SourceLineInfo( "file", 3 ) )
+ </Original>
+ <Expanded>
+ registry.add( "[the @ is not at the start]", "", Catch::SourceLineInfo( "file", 3 ) )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_THROWS" filename="projects/<exe-name>/IntrospectiveTests/TagAlias.tests.cpp" >
+ <Original>
+ registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) )
+ </Original>
+ <Expanded>
+ registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_THROWS" filename="projects/<exe-name>/IntrospectiveTests/TagAlias.tests.cpp" >
+ <Original>
+ registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) )
+ </Original>
+ <Expanded>
+ registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) )
+ </Expanded>
+ </Expression>
+ <OverallResults successes="4" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Test case with one argument" filename="projects/<exe-name>/UsageTests/VariadicMacros.tests.cpp" >
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Test enum bit values" tags="[Tricky]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ 0x<hex digits> == bit30and31
+ </Original>
+ <Expanded>
+ 3221225472 (0x<hex digits>) == 3221225472
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="The NO_FAIL macro reports a failure but does not fail the test" tags="[messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Expression success="false" type="CHECK_NOFAIL" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Original>
+ 1 == 2
+ </Original>
+ <Expanded>
+ 1 == 2
+ </Expanded>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="This test 'should' fail but doesn't" tags="[!shouldfail][.][failing]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="Tracker" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Section name="successfully close one section" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1.isSuccessfullyCompleted()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase.isComplete() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ ctx.completedCycle()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase.isSuccessfullyCompleted()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="4" failures="0" expectedFailures="0"/>
+ </Section>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Section name="fail one section" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1.isComplete()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1.isSuccessfullyCompleted() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase.isComplete() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ ctx.completedCycle()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase.isSuccessfullyCompleted() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Section name="re-enter after failed section" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase2.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1b.isOpen() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ ctx.completedCycle()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase.isComplete()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase.isSuccessfullyCompleted()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="5" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="10" failures="0" expectedFailures="0"/>
+ </Section>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Section name="fail one section" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1.isComplete()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1.isSuccessfullyCompleted() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase.isComplete() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ ctx.completedCycle()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase.isSuccessfullyCompleted() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Section name="re-enter after failed section and find next section" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase2.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1b.isOpen() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s2.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ ctx.completedCycle()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase.isComplete()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase.isSuccessfullyCompleted()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="6" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="11" failures="0" expectedFailures="0"/>
+ </Section>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Section name="successfully close one section, then find another" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s2.isOpen() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase.isComplete() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Section name="Re-enter - skips S1 and enters S2" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase2.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1b.isOpen() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s2b.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ ctx.completedCycle() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Section name="Successfully close S2" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ ctx.completedCycle()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s2b.isSuccessfullyCompleted()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase2.isComplete() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase2.isSuccessfullyCompleted()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="4" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="8" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="10" failures="0" expectedFailures="0"/>
+ </Section>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Section name="successfully close one section, then find another" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s2.isOpen() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase.isComplete() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Section name="Re-enter - skips S1 and enters S2" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase2.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1b.isOpen() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s2b.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ ctx.completedCycle() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Section name="fail S2" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ ctx.completedCycle()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s2b.isComplete()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s2b.isSuccessfullyCompleted() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase2.isSuccessfullyCompleted() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase3.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1c.isOpen() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s2c.isOpen() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase3.isSuccessfullyCompleted()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="8" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="12" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="14" failures="0" expectedFailures="0"/>
+ </Section>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Section name="open a nested section" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s2.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s2.isComplete()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1.isComplete() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1.isComplete()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase.isComplete() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase.isComplete()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="6" failures="0" expectedFailures="0"/>
+ </Section>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Section name="start a generator" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ g1.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ g1.index() == 0
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ g1.isComplete() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1.isComplete() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Section name="close outer section" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1.isComplete() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase.isSuccessfullyCompleted() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Section name="Re-enter for second generation" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase2.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1b.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ g1b.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ g1b.index() == 1
+ </Original>
+ <Expanded>
+ 1 == 1
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1.isComplete() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1b.isComplete()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ g1b.isComplete()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase2.isComplete()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="8" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="10" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="14" failures="0" expectedFailures="0"/>
+ </Section>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Section name="start a generator" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ g1.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ g1.index() == 0
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ g1.isComplete() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1.isComplete() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Section name="Start a new inner section" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s2.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s2.isComplete()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1.isComplete() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase.isComplete() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Section name="Re-enter for second generation" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase2.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1b.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ g1b.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ g1b.index() == 1
+ </Original>
+ <Expanded>
+ 1 == 1
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s2b.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s2b.isComplete()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ g1b.isComplete()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1b.isComplete()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase2.isComplete()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="9" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="13" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="17" failures="0" expectedFailures="0"/>
+ </Section>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Section name="start a generator" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ g1.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ g1.index() == 0
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ g1.isComplete() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1.isComplete() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Section name="Fail an inner section" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s2.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s2.isComplete()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s2.isSuccessfullyCompleted() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1.isComplete() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase.isComplete() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Section name="Re-enter for second generation" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase2.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1b.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ g1b.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ g1b.index() == 0
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s2b.isOpen() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ g1b.isComplete() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1b.isComplete() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase2.isComplete() == false
+ </Original>
+ <Expanded>
+ false == false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase3.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1c.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ g1c.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ g1c.index() == 1
+ </Original>
+ <Expanded>
+ 1 == 1
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s2c.isOpen()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s2c.isComplete()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ g1c.isComplete()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ s1c.isComplete()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" >
+ <Original>
+ testCase3.isComplete()
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="17" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="22" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="26" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Unexpected exceptions can be translated" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Exception filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ 3.14
+ </Exception>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="Use a custom approx" tags="[Approx][custom]" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ d == approx( 1.23 )
+ </Original>
+ <Expanded>
+ 1.23 == Approx( 1.23 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ d == approx( 1.22 )
+ </Original>
+ <Expanded>
+ 1.23 == Approx( 1.22 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ d == approx( 1.24 )
+ </Original>
+ <Expanded>
+ 1.23 == Approx( 1.24 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ d != approx( 1.25 )
+ </Original>
+ <Expanded>
+ 1.23 != Approx( 1.25 )
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ approx( d ) == 1.23
+ </Original>
+ <Expanded>
+ Approx( 1.23 ) == 1.23
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ approx( d ) == 1.22
+ </Original>
+ <Expanded>
+ Approx( 1.23 ) == 1.22
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ approx( d ) == 1.24
+ </Original>
+ <Expanded>
+ Approx( 1.23 ) == 1.24
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" >
+ <Original>
+ approx( d ) != 1.25
+ </Original>
+ <Expanded>
+ Approx( 1.23 ) != 1.25
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Variadic macros" tags="[sections][variadic]" filename="projects/<exe-name>/UsageTests/VariadicMacros.tests.cpp" >
+ <Section name="Section with one argument" filename="projects/<exe-name>/UsageTests/VariadicMacros.tests.cpp" >
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Vector matchers" tags="[matchers][vector]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Section name="Contains (element)" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ v, VectorContains(1)
+ </Original>
+ <Expanded>
+ { 1, 2, 3 } Contains: 1
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ v, VectorContains(2)
+ </Original>
+ <Expanded>
+ { 1, 2, 3 } Contains: 2
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Contains (vector)" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ v, Contains(v2)
+ </Original>
+ <Expanded>
+ { 1, 2, 3 } Contains: { 1, 2 }
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ v, Contains(v2)
+ </Original>
+ <Expanded>
+ { 1, 2, 3 } Contains: { 1, 2, 3 }
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ v, Contains(empty)
+ </Original>
+ <Expanded>
+ { 1, 2, 3 } Contains: { }
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ empty, Contains(empty)
+ </Original>
+ <Expanded>
+ { } Contains: { }
+ </Expanded>
+ </Expression>
+ <OverallResults successes="4" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Contains (element), composed" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ v, VectorContains(1) && VectorContains(2)
+ </Original>
+ <Expanded>
+ { 1, 2, 3 } ( Contains: 1 and Contains: 2 )
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Equals" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ v, Equals(v)
+ </Original>
+ <Expanded>
+ { 1, 2, 3 } Equals: { 1, 2, 3 }
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ empty, Equals(empty)
+ </Original>
+ <Expanded>
+ { } Equals: { }
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ v, Equals(v2)
+ </Original>
+ <Expanded>
+ { 1, 2, 3 } Equals: { 1, 2, 3 }
+ </Expanded>
+ </Expression>
+ <OverallResults successes="3" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="UnorderedEquals" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ v, UnorderedEquals(v)
+ </Original>
+ <Expanded>
+ { 1, 2, 3 } UnorderedEquals: { 1, 2, 3 }
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ empty, UnorderedEquals(empty)
+ </Original>
+ <Expanded>
+ { } UnorderedEquals: { }
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ permuted, UnorderedEquals(v)
+ </Original>
+ <Expanded>
+ { 1, 3, 2 } UnorderedEquals: { 1, 2, 3 }
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ permuted, UnorderedEquals(v)
+ </Original>
+ <Expanded>
+ { 2, 3, 1 } UnorderedEquals: { 1, 2, 3 }
+ </Expanded>
+ </Expression>
+ <OverallResults successes="4" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="Vector matchers that fail" tags="[.][failing][matchers][vector]" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Section name="Contains (element)" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ v, VectorContains(-1)
+ </Original>
+ <Expanded>
+ { 1, 2, 3 } Contains: -1
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ empty, VectorContains(1)
+ </Original>
+ <Expanded>
+ { } Contains: 1
+ </Expanded>
+ </Expression>
+ <OverallResults successes="0" failures="2" expectedFailures="0"/>
+ </Section>
+ <Section name="Contains (vector)" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ empty, Contains(v)
+ </Original>
+ <Expanded>
+ { } Contains: { 1, 2, 3 }
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ v, Contains(v2)
+ </Original>
+ <Expanded>
+ { 1, 2, 3 } Contains: { 1, 2, 4 }
+ </Expanded>
+ </Expression>
+ <OverallResults successes="0" failures="2" expectedFailures="0"/>
+ </Section>
+ <Section name="Equals" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ v, Equals(v2)
+ </Original>
+ <Expanded>
+ { 1, 2, 3 } Equals: { 1, 2 }
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ v2, Equals(v)
+ </Original>
+ <Expanded>
+ { 1, 2 } Equals: { 1, 2, 3 }
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ empty, Equals(v)
+ </Original>
+ <Expanded>
+ { } Equals: { 1, 2, 3 }
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ v, Equals(empty)
+ </Original>
+ <Expanded>
+ { 1, 2, 3 } Equals: { }
+ </Expanded>
+ </Expression>
+ <OverallResults successes="0" failures="4" expectedFailures="0"/>
+ </Section>
+ <Section name="UnorderedEquals" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ v, UnorderedEquals(empty)
+ </Original>
+ <Expanded>
+ { 1, 2, 3 } UnorderedEquals: { }
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ empty, UnorderedEquals(v)
+ </Original>
+ <Expanded>
+ { } UnorderedEquals: { 1, 2, 3 }
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ permuted, UnorderedEquals(v)
+ </Original>
+ <Expanded>
+ { 1, 3 } UnorderedEquals: { 1, 2, 3 }
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="CHECK_THAT" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
+ <Original>
+ permuted, UnorderedEquals(v)
+ </Original>
+ <Expanded>
+ { 3, 1 } UnorderedEquals: { 1, 2, 3 }
+ </Expanded>
+ </Expression>
+ <OverallResults successes="0" failures="4" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="When checked exceptions are thrown they can be expected or unexpected" tags="[!throws]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Expression success="true" type="REQUIRE_THROWS_AS" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Original>
+ thisThrows(), std::domain_error
+ </Original>
+ <Expanded>
+ thisThrows(), std::domain_error
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_NOTHROW" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Original>
+ thisDoesntThrow()
+ </Original>
+ <Expanded>
+ thisDoesntThrow()
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE_THROWS" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Original>
+ thisThrows()
+ </Original>
+ <Expanded>
+ thisThrows()
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="When unchecked exceptions are thrown directly they are always failures" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Exception filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ unexpected exception
+ </Exception>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="When unchecked exceptions are thrown during a CHECK the test should continue" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Original>
+ thisThrows() == 0
+ </Original>
+ <Expanded>
+ thisThrows() == 0
+ </Expanded>
+ <Exception filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ expected exception
+ </Exception>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="When unchecked exceptions are thrown during a REQUIRE the test should abort fail" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Original>
+ thisThrows() == 0
+ </Original>
+ <Expanded>
+ thisThrows() == 0
+ </Expanded>
+ <Exception filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ expected exception
+ </Exception>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="When unchecked exceptions are thrown from functions they are always failures" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Original>
+ thisThrows() == 0
+ </Original>
+ <Expanded>
+ thisThrows() == 0
+ </Expanded>
+ <Exception filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ expected exception
+ </Exception>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="When unchecked exceptions are thrown from sections they are always failures" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Section name="section name" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <Exception filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ unexpected exception
+ </Exception>
+ <OverallResults successes="0" failures="1" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="When unchecked exceptions are thrown, but caught, they do not affect the test" tags="[!throws]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" >
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="Where the LHS is not a simple value" tags="[.][Tricky][failing]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Warning>
+ Uncomment the code in this test to check that it gives a sensible compiler error
+ </Warning>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="Where there is more to the expression after the RHS" tags="[.][Tricky][failing]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Warning>
+ Uncomment the code in this test to check that it gives a sensible compiler error
+ </Warning>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="X/level/0/a" tags="[Tricky]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="X/level/0/b" tags="[Tricky][fizz]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="X/level/1/a" tags="[Tricky]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="X/level/1/b" tags="[Tricky]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="XmlEncode" filename="projects/<exe-name>/IntrospectiveTests/Xml.tests.cpp" >
+ <Section name="normal string" filename="projects/<exe-name>/IntrospectiveTests/Xml.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/Xml.tests.cpp" >
+ <Original>
+ encode( "normal string" ) == "normal string"
+ </Original>
+ <Expanded>
+ "normal string" == "normal string"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="empty string" filename="projects/<exe-name>/IntrospectiveTests/Xml.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/Xml.tests.cpp" >
+ <Original>
+ encode( "" ) == ""
+ </Original>
+ <Expanded>
+ "" == ""
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="string with ampersand" filename="projects/<exe-name>/IntrospectiveTests/Xml.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/Xml.tests.cpp" >
+ <Original>
+ encode( "smith & jones" ) == "smith &amp; jones"
+ </Original>
+ <Expanded>
+ "smith &amp; jones" == "smith &amp; jones"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="string with less-than" filename="projects/<exe-name>/IntrospectiveTests/Xml.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/Xml.tests.cpp" >
+ <Original>
+ encode( "smith < jones" ) == "smith &lt; jones"
+ </Original>
+ <Expanded>
+ "smith &lt; jones" == "smith &lt; jones"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="string with greater-than" filename="projects/<exe-name>/IntrospectiveTests/Xml.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/Xml.tests.cpp" >
+ <Original>
+ encode( "smith > jones" ) == "smith > jones"
+ </Original>
+ <Expanded>
+ "smith > jones" == "smith > jones"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/Xml.tests.cpp" >
+ <Original>
+ encode( "smith ]]> jones" ) == "smith ]]&gt; jones"
+ </Original>
+ <Expanded>
+ "smith ]]&gt; jones"
+==
+"smith ]]&gt; jones"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="string with quotes" filename="projects/<exe-name>/IntrospectiveTests/Xml.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/Xml.tests.cpp" >
+ <Original>
+ encode( stringWithQuotes ) == stringWithQuotes
+ </Original>
+ <Expanded>
+ "don't "quote" me on that"
+==
+"don't "quote" me on that"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/Xml.tests.cpp" >
+ <Original>
+ encode( stringWithQuotes, Catch::XmlEncode::ForAttributes ) == "don't &quot;quote&quot; me on that"
+ </Original>
+ <Expanded>
+ "don't &quot;quote&quot; me on that"
+==
+"don't &quot;quote&quot; me on that"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="string with control char (1)" filename="projects/<exe-name>/IntrospectiveTests/Xml.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/Xml.tests.cpp" >
+ <Original>
+ encode( "[\x01]" ) == "[\\x01]"
+ </Original>
+ <Expanded>
+ "[\x01]" == "[\x01]"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="string with control char (x7F)" filename="projects/<exe-name>/IntrospectiveTests/Xml.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/Xml.tests.cpp" >
+ <Original>
+ encode( "[\x7F]" ) == "[\\x7F]"
+ </Original>
+ <Expanded>
+ "[\x7F]" == "[\x7F]"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="array<int, N> -> toString" tags="[array][containers][toString]" filename="projects/<exe-name>/UsageTests/ToStringVector.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringVector.tests.cpp" >
+ <Original>
+ Catch::Detail::stringify( empty ) == "{ }"
+ </Original>
+ <Expanded>
+ "{ }" == "{ }"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringVector.tests.cpp" >
+ <Original>
+ Catch::Detail::stringify( oneValue ) == "{ 42 }"
+ </Original>
+ <Expanded>
+ "{ 42 }" == "{ 42 }"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringVector.tests.cpp" >
+ <Original>
+ Catch::Detail::stringify( twoValues ) == "{ 42, 250 }"
+ </Original>
+ <Expanded>
+ "{ 42, 250 }" == "{ 42, 250 }"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="atomic if" tags="[0][failing]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ x == 0
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="boolean member" tags="[Tricky]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ obj.prop != 0
+ </Original>
+ <Expanded>
+ 0x<hex digits> != 0
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="checkedElse" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Expression success="true" type="CHECKED_ELSE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ flag
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ testCheckedElse( true )
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="checkedElse, failing" tags="[.][failing]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Expression success="false" type="CHECKED_ELSE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ flag
+ </Original>
+ <Expanded>
+ false
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ testCheckedElse( false )
+ </Original>
+ <Expanded>
+ false
+ </Expanded>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="checkedIf" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Expression success="true" type="CHECKED_IF" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ flag
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ testCheckedIf( true )
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="checkedIf, failing" tags="[.][failing]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Expression success="false" type="CHECKED_IF" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ flag
+ </Original>
+ <Expanded>
+ false
+ </Expanded>
+ </Expression>
+ <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ testCheckedIf( false )
+ </Original>
+ <Expanded>
+ false
+ </Expanded>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="comparisons between const int variables" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ unsigned_char_var == 1
+ </Original>
+ <Expanded>
+ 1 == 1
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ unsigned_short_var == 1
+ </Original>
+ <Expanded>
+ 1 == 1
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ unsigned_int_var == 1
+ </Original>
+ <Expanded>
+ 1 == 1
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ unsigned_long_var == 1
+ </Original>
+ <Expanded>
+ 1 == 1
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="comparisons between int variables" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ long_var == unsigned_char_var
+ </Original>
+ <Expanded>
+ 1 == 1
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ long_var == unsigned_short_var
+ </Original>
+ <Expanded>
+ 1 == 1
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ long_var == unsigned_int_var
+ </Original>
+ <Expanded>
+ 1 == 1
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
+ <Original>
+ long_var == unsigned_long_var
+ </Original>
+ <Expanded>
+ 1 == 1
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="even more nested SECTION tests" tags="[sections]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Section name="c" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Section name="d (leaf)" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="c" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Section name="e (leaf)" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="f (leaf)" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="first tag" tags="[tag1]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="has printf" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+loose text artifact
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="just failure" tags="[.][fail][isolated info][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Failure filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ Previous info should not be seen
+ </Failure>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="just info" tags="[info][isolated info][messages]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="long long" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ l == std::numeric_limits<long long>::max()
+ </Original>
+ <Expanded>
+ 9223372036854775807 (0x<hex digits>)
+==
+9223372036854775807 (0x<hex digits>)
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <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" >
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ b > a
+ </Original>
+ <Expanded>
+ 0 > 1
+ </Expanded>
+ </Expression>
+ <OverallResults successes="0" failures="1" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="looped tests" tags="[.][failing]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Info>
+ Testing if fib[0] (1) is even
+ </Info>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ ( fib[i] % 2 ) == 0
+ </Original>
+ <Expanded>
+ 1 == 0
+ </Expanded>
+ </Expression>
+ <Info>
+ Testing if fib[1] (1) is even
+ </Info>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ ( fib[i] % 2 ) == 0
+ </Original>
+ <Expanded>
+ 1 == 0
+ </Expanded>
+ </Expression>
+ <Info>
+ Testing if fib[2] (2) is even
+ </Info>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ ( fib[i] % 2 ) == 0
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <Info>
+ Testing if fib[3] (3) is even
+ </Info>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ ( fib[i] % 2 ) == 0
+ </Original>
+ <Expanded>
+ 1 == 0
+ </Expanded>
+ </Expression>
+ <Info>
+ Testing if fib[4] (5) is even
+ </Info>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ ( fib[i] % 2 ) == 0
+ </Original>
+ <Expanded>
+ 1 == 0
+ </Expanded>
+ </Expression>
+ <Info>
+ Testing if fib[5] (8) is even
+ </Info>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ ( fib[i] % 2 ) == 0
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <Info>
+ Testing if fib[6] (13) is even
+ </Info>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ ( fib[i] % 2 ) == 0
+ </Original>
+ <Expanded>
+ 1 == 0
+ </Expanded>
+ </Expression>
+ <Info>
+ Testing if fib[7] (21) is even
+ </Info>
+ <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ ( fib[i] % 2 ) == 0
+ </Original>
+ <Expanded>
+ 1 == 0
+ </Expanded>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <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="s2" description="equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ a == b
+ </Original>
+ <Expanded>
+ 1 == 2
+ </Expanded>
+ </Expression>
+ <OverallResults successes="0" failures="1" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="0" failures="1" expectedFailures="0"/>
+ </Section>
+ <Section name="s1" description="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" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ a != b
+ </Original>
+ <Expanded>
+ 1 != 2
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="s1" description="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" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ a < b
+ </Original>
+ <Expanded>
+ 1 < 2
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="false"/>
+ </TestCase>
+ <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" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ a != b
+ </Original>
+ <Expanded>
+ 1 != 2
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ b != a
+ </Original>
+ <Expanded>
+ 2 != 1
+ </Expanded>
+ </Expression>
+ <Section name="s2" description="not equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ a != b
+ </Original>
+ <Expanded>
+ 1 != 2
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="3" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="non streamable - with conv. op" tags="[Tricky]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ s == "7"
+ </Original>
+ <Expanded>
+ "7" == "7"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="non-copyable objects" tags="[.][failing]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ ti == typeid(int)
+ </Original>
+ <Expanded>
+ {?} == {?}
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="not allowed" tags="[!throws]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="null strings" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ makeString( false ) != static_cast<char*>(0)
+ </Original>
+ <Expanded>
+ "valid string" != {null string}
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ makeString( true ) == static_cast<char*>(0)
+ </Original>
+ <Expanded>
+ {null string} == {null string}
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="null_ptr" tags="[Tricky]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ ptr.get() == 0
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="pair<pair<int,const char *,pair<std::string,int> > -> toString" tags="[pair][toString]" filename="projects/<exe-name>/UsageTests/ToStringPair.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringPair.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify( pair ) == "{ { 42, \"Arthur\" }, { \"Ford\", 24 } }"
+ </Original>
+ <Expanded>
+ "{ { 42, "Arthur" }, { "Ford", 24 } }"
+==
+"{ { 42, "Arthur" }, { "Ford", 24 } }"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="pointer to class" tags="[Tricky]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ p == 0
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <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" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ a != b
+ </Original>
+ <Expanded>
+ 1 != 2
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ b != a
+ </Original>
+ <Expanded>
+ 2 != 1
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="s2" description="not equal" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ a != b
+ </Original>
+ <Expanded>
+ 1 != 2
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="replaceInPlace" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Section name="replace single char" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ Catch::replaceInPlace( letters, "b", "z" )
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ letters == "azcdefcg"
+ </Original>
+ <Expanded>
+ "azcdefcg" == "azcdefcg"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="replace two chars" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ Catch::replaceInPlace( letters, "c", "z" )
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ letters == "abzdefzg"
+ </Original>
+ <Expanded>
+ "abzdefzg" == "abzdefzg"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="replace first char" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ Catch::replaceInPlace( letters, "a", "z" )
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ letters == "zbcdefcg"
+ </Original>
+ <Expanded>
+ "zbcdefcg" == "zbcdefcg"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="replace last char" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ Catch::replaceInPlace( letters, "g", "z" )
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ letters == "abcdefcz"
+ </Original>
+ <Expanded>
+ "abcdefcz" == "abcdefcz"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="replace all chars" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ Catch::replaceInPlace( letters, letters, "replaced" )
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ letters == "replaced"
+ </Original>
+ <Expanded>
+ "replaced" == "replaced"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="replace no chars" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Expression success="true" type="CHECK_FALSE" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ !(Catch::replaceInPlace( letters, "x", "z" ))
+ </Original>
+ <Expanded>
+ !false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ letters == letters
+ </Original>
+ <Expanded>
+ "abcdefcg" == "abcdefcg"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="escape '" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ Catch::replaceInPlace( s, "'", "|'" )
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/String.tests.cpp" >
+ <Original>
+ s == "didn|'t"
+ </Original>
+ <Expanded>
+ "didn|'t" == "didn|'t"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="second tag" tags="[tag2]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="send a single char to INFO" tags="[.][failing]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Info>
+ 3
+ </Info>
+ <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ false
+ </Original>
+ <Expanded>
+ false
+ </Expanded>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="sends information to INFO" tags="[.][failing]" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Info>
+ hi
+ </Info>
+ <Info>
+ i := 7
+ </Info>
+ <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Message.tests.cpp" >
+ <Original>
+ false
+ </Original>
+ <Expanded>
+ false
+ </Expanded>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="std::map is convertible string" tags="[toString]" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Section name="empty" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Original>
+ Catch::Detail::stringify( emptyMap ) == "{ }"
+ </Original>
+ <Expanded>
+ "{ }" == "{ }"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="single item" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Original>
+ Catch::Detail::stringify( map ) == "{ { \"one\", 1 } }"
+ </Original>
+ <Expanded>
+ "{ { "one", 1 } }" == "{ { "one", 1 } }"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="several items" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Original>
+ Catch::Detail::stringify( map ) == "{ { \"abc\", 1 }, { \"def\", 2 }, { \"ghi\", 3 } }"
+ </Original>
+ <Expanded>
+ "{ { "abc", 1 }, { "def", 2 }, { "ghi", 3 } }"
+==
+"{ { "abc", 1 }, { "def", 2 }, { "ghi", 3 } }"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="std::pair<int,const std::string> -> toString" tags="[pair][toString]" filename="projects/<exe-name>/UsageTests/ToStringPair.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringPair.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify(value) == "{ 34, \"xyzzy\" }"
+ </Original>
+ <Expanded>
+ "{ 34, "xyzzy" }" == "{ 34, "xyzzy" }"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="std::pair<int,std::string> -> toString" tags="[pair][toString]" filename="projects/<exe-name>/UsageTests/ToStringPair.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringPair.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify( value ) == "{ 34, \"xyzzy\" }"
+ </Original>
+ <Expanded>
+ "{ 34, "xyzzy" }" == "{ 34, "xyzzy" }"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="std::set is convertible string" tags="[toString]" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Section name="empty" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Original>
+ Catch::Detail::stringify( emptySet ) == "{ }"
+ </Original>
+ <Expanded>
+ "{ }" == "{ }"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="single item" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Original>
+ Catch::Detail::stringify( set ) == "{ \"one\" }"
+ </Original>
+ <Expanded>
+ "{ "one" }" == "{ "one" }"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="several items" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" >
+ <Original>
+ Catch::Detail::stringify( set ) == "{ \"abc\", \"def\", \"ghi\" }"
+ </Original>
+ <Expanded>
+ "{ "abc", "def", "ghi" }"
+==
+"{ "abc", "def", "ghi" }"
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="std::vector<std::pair<std::string,int> > -> toString" tags="[pair][toString]" filename="projects/<exe-name>/UsageTests/ToStringPair.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringPair.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify( pr ) == "{ { \"green\", 55 } }"
+ </Original>
+ <Expanded>
+ "{ { "green", 55 } }"
+==
+"{ { "green", 55 } }"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="string literals of different sizes can be compared" tags="[.][Tricky][failing]" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Tricky.tests.cpp" >
+ <Original>
+ std::string( "first" ) == "second"
+ </Original>
+ <Expanded>
+ "first" == "second"
+ </Expanded>
+ </Expression>
+ <OverallResult success="false"/>
+ </TestCase>
+ <TestCase name="stringify( has_maker )" tags="[toString]" filename="projects/<exe-name>/UsageTests/ToStringWhich.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringWhich.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify( item ) == "StringMaker<has_maker>"
+ </Original>
+ <Expanded>
+ "StringMaker<has_maker>"
+==
+"StringMaker<has_maker>"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="stringify( has_maker_and_toString )" tags="[.][toString]" filename="projects/<exe-name>/UsageTests/ToStringWhich.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringWhich.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify( item ) == "StringMaker<has_maker_and_operator>"
+ </Original>
+ <Expanded>
+ "StringMaker<has_maker_and_operator>"
+==
+"StringMaker<has_maker_and_operator>"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="stringify( has_operator )" tags="[toString]" filename="projects/<exe-name>/UsageTests/ToStringWhich.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringWhich.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify( item ) == "operator<<( has_operator )"
+ </Original>
+ <Expanded>
+ "operator<<( has_operator )"
+==
+"operator<<( has_operator )"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="toString on const wchar_t const pointer returns the string contents" tags="[toString]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ result == "\"wide load\""
+ </Original>
+ <Expanded>
+ ""wide load"" == ""wide load""
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="toString on const wchar_t pointer returns the string contents" tags="[toString]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ result == "\"wide load\""
+ </Original>
+ <Expanded>
+ ""wide load"" == ""wide load""
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="toString on wchar_t const pointer returns the string contents" tags="[toString]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ result == "\"wide load\""
+ </Original>
+ <Expanded>
+ ""wide load"" == ""wide load""
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="toString on wchar_t returns the string contents" tags="[toString]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ result == "\"wide load\""
+ </Original>
+ <Expanded>
+ ""wide load"" == ""wide load""
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="toString streamable range" tags="[toString]" filename="projects/<exe-name>/UsageTests/ToStringWhich.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringWhich.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify(streamable_range{}) == "op<<(streamable_range)"
+ </Original>
+ <Expanded>
+ "op<<(streamable_range)"
+==
+"op<<(streamable_range)"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringWhich.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify(stringmaker_range{}) == "stringmaker(streamable_range)"
+ </Original>
+ <Expanded>
+ "stringmaker(streamable_range)"
+==
+"stringmaker(streamable_range)"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringWhich.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify(just_range{}) == "{ 1, 2, 3, 4 }"
+ </Original>
+ <Expanded>
+ "{ 1, 2, 3, 4 }" == "{ 1, 2, 3, 4 }"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringWhich.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify(disabled_range{}) == "{?}"
+ </Original>
+ <Expanded>
+ "{?}" == "{?}"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="toString( vectors<has_maker> )" tags="[toString]" filename="projects/<exe-name>/UsageTests/ToStringWhich.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringWhich.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify( v ) == "{ StringMaker<has_maker> }"
+ </Original>
+ <Expanded>
+ "{ StringMaker<has_maker> }"
+==
+"{ StringMaker<has_maker> }"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="toString( vectors<has_maker_and_operator> )" tags="[toString]" filename="projects/<exe-name>/UsageTests/ToStringWhich.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringWhich.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify( v ) == "{ StringMaker<has_maker_and_operator> }"
+ </Original>
+ <Expanded>
+ "{ StringMaker<has_maker_and_operator> }"
+==
+"{ StringMaker<has_maker_and_operator> }"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="toString( vectors<has_operator> )" tags="[toString]" filename="projects/<exe-name>/UsageTests/ToStringWhich.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringWhich.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify( v ) == "{ operator<<( has_operator ) }"
+ </Original>
+ <Expanded>
+ "{ operator<<( has_operator ) }"
+==
+"{ operator<<( has_operator ) }"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="toString(enum class w/operator<<)" tags="[enum][enumClass][toString]" filename="projects/<exe-name>/UsageTests/EnumToString.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/EnumToString.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify(e0) == "E2/V0"
+ </Original>
+ <Expanded>
+ "E2/V0" == "E2/V0"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/EnumToString.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify(e1) == "E2/V1"
+ </Original>
+ <Expanded>
+ "E2/V1" == "E2/V1"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/EnumToString.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify(e3) == "Unknown enum value 10"
+ </Original>
+ <Expanded>
+ "Unknown enum value 10"
+==
+"Unknown enum value 10"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="toString(enum class)" tags="[enum][enumClass][toString]" filename="projects/<exe-name>/UsageTests/EnumToString.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/EnumToString.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify(e0) == "0"
+ </Original>
+ <Expanded>
+ "0" == "0"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/EnumToString.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify(e1) == "1"
+ </Original>
+ <Expanded>
+ "1" == "1"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="toString(enum w/operator<<)" tags="[enum][toString]" filename="projects/<exe-name>/UsageTests/EnumToString.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/EnumToString.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify(e0) == "E2{0}"
+ </Original>
+ <Expanded>
+ "E2{0}" == "E2{0}"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/EnumToString.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify(e1) == "E2{1}"
+ </Original>
+ <Expanded>
+ "E2{1}" == "E2{1}"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="toString(enum)" tags="[enum][toString]" filename="projects/<exe-name>/UsageTests/EnumToString.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/EnumToString.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify(e0) == "0"
+ </Original>
+ <Expanded>
+ "0" == "0"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/EnumToString.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify(e1) == "1"
+ </Original>
+ <Expanded>
+ "1" == "1"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="tuple<>" tags="[toString][tuple]" filename="projects/<exe-name>/UsageTests/ToStringTuple.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/ToStringTuple.tests.cpp" >
+ <Original>
+ "{ }" == ::Catch::Detail::stringify(type{})
+ </Original>
+ <Expanded>
+ "{ }" == "{ }"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/ToStringTuple.tests.cpp" >
+ <Original>
+ "{ }" == ::Catch::Detail::stringify(value)
+ </Original>
+ <Expanded>
+ "{ }" == "{ }"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="tuple<float,int>" tags="[toString][tuple]" filename="projects/<exe-name>/UsageTests/ToStringTuple.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/ToStringTuple.tests.cpp" >
+ <Original>
+ "1.2f" == ::Catch::Detail::stringify(float(1.2))
+ </Original>
+ <Expanded>
+ "1.2f" == "1.2f"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/ToStringTuple.tests.cpp" >
+ <Original>
+ "{ 1.2f, 0 }" == ::Catch::Detail::stringify(type{1.2f,0})
+ </Original>
+ <Expanded>
+ "{ 1.2f, 0 }" == "{ 1.2f, 0 }"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="tuple<int>" tags="[toString][tuple]" filename="projects/<exe-name>/UsageTests/ToStringTuple.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/ToStringTuple.tests.cpp" >
+ <Original>
+ "{ 0 }" == ::Catch::Detail::stringify(type{0})
+ </Original>
+ <Expanded>
+ "{ 0 }" == "{ 0 }"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="tuple<0,int,const char *>" tags="[toString][tuple]" filename="projects/<exe-name>/UsageTests/ToStringTuple.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/ToStringTuple.tests.cpp" >
+ <Original>
+ "{ 0, 42, \"Catch me\" }" == ::Catch::Detail::stringify(value)
+ </Original>
+ <Expanded>
+ "{ 0, 42, "Catch me" }"
+==
+"{ 0, 42, "Catch me" }"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="tuple<string,string>" tags="[toString][tuple]" filename="projects/<exe-name>/UsageTests/ToStringTuple.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/ToStringTuple.tests.cpp" >
+ <Original>
+ "{ \"hello\", \"world\" }" == ::Catch::Detail::stringify(type{"hello","world"})
+ </Original>
+ <Expanded>
+ "{ "hello", "world" }"
+==
+"{ "hello", "world" }"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="tuple<tuple<int>,tuple<>,float>" tags="[toString][tuple]" filename="projects/<exe-name>/UsageTests/ToStringTuple.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/ToStringTuple.tests.cpp" >
+ <Original>
+ "{ { 42 }, { }, 1.2f }" == ::Catch::Detail::stringify(value)
+ </Original>
+ <Expanded>
+ "{ { 42 }, { }, 1.2f }"
+==
+"{ { 42 }, { }, 1.2f }"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="vec<vec<string,alloc>> -> toString" tags="[toString][vector,allocator]" filename="projects/<exe-name>/UsageTests/ToStringVector.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringVector.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify(v) == "{ }"
+ </Original>
+ <Expanded>
+ "{ }" == "{ }"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringVector.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify(v) == "{ { \"hello\" }, { \"world\" } }"
+ </Original>
+ <Expanded>
+ "{ { "hello" }, { "world" } }"
+==
+"{ { "hello" }, { "world" } }"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="vector<bool> -> toString" tags="[containers][toString][vector]" filename="projects/<exe-name>/UsageTests/ToStringVector.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringVector.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify(bools) == "{ }"
+ </Original>
+ <Expanded>
+ "{ }" == "{ }"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringVector.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify(bools) == "{ true }"
+ </Original>
+ <Expanded>
+ "{ true }" == "{ true }"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringVector.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify(bools) == "{ true, false }"
+ </Original>
+ <Expanded>
+ "{ true, false }" == "{ true, false }"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="vector<int,allocator> -> toString" tags="[toString][vector,allocator]" filename="projects/<exe-name>/UsageTests/ToStringVector.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringVector.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify(vv) == "{ }"
+ </Original>
+ <Expanded>
+ "{ }" == "{ }"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringVector.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify(vv) == "{ 42 }"
+ </Original>
+ <Expanded>
+ "{ 42 }" == "{ 42 }"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringVector.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify(vv) == "{ 42, 250 }"
+ </Original>
+ <Expanded>
+ "{ 42, 250 }" == "{ 42, 250 }"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="vector<int> -> toString" tags="[toString][vector]" filename="projects/<exe-name>/UsageTests/ToStringVector.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringVector.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify(vv) == "{ }"
+ </Original>
+ <Expanded>
+ "{ }" == "{ }"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringVector.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify(vv) == "{ 42 }"
+ </Original>
+ <Expanded>
+ "{ 42 }" == "{ 42 }"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringVector.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify(vv) == "{ 42, 250 }"
+ </Original>
+ <Expanded>
+ "{ 42, 250 }" == "{ 42, 250 }"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="vector<string> -> toString" tags="[toString][vector]" filename="projects/<exe-name>/UsageTests/ToStringVector.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringVector.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify(vv) == "{ }"
+ </Original>
+ <Expanded>
+ "{ }" == "{ }"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringVector.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify(vv) == "{ \"hello\" }"
+ </Original>
+ <Expanded>
+ "{ "hello" }" == "{ "hello" }"
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/ToStringVector.tests.cpp" >
+ <Original>
+ ::Catch::Detail::stringify(vv) == "{ \"hello\", \"world\" }"
+ </Original>
+ <Expanded>
+ "{ "hello", "world" }"
+==
+"{ "hello", "world" }"
+ </Expanded>
+ </Expression>
+ <OverallResult success="true"/>
+ </TestCase>
+ <TestCase name="vectors can be sized and resized" tags="[vector]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ v.size() == 5
+ </Original>
+ <Expanded>
+ 5 == 5
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ v.capacity() >= 5
+ </Original>
+ <Expanded>
+ 5 >= 5
+ </Expanded>
+ </Expression>
+ <Section name="resizing bigger changes size and capacity" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ v.size() == 10
+ </Original>
+ <Expanded>
+ 10 == 10
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ v.capacity() >= 10
+ </Original>
+ <Expanded>
+ 10 >= 10
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ v.size() == 5
+ </Original>
+ <Expanded>
+ 5 == 5
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ v.capacity() >= 5
+ </Original>
+ <Expanded>
+ 5 >= 5
+ </Expanded>
+ </Expression>
+ <Section name="resizing smaller changes size but not capacity" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ v.size() == 0
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ v.capacity() >= 5
+ </Original>
+ <Expanded>
+ 5 >= 5
+ </Expanded>
+ </Expression>
+ <Section name="We can use the 'swap trick' to reset the capacity" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ v.capacity() == 0
+ </Original>
+ <Expanded>
+ 0 == 0
+ </Expanded>
+ </Expression>
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResults successes="3" failures="0" expectedFailures="0"/>
+ </Section>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ v.size() == 5
+ </Original>
+ <Expanded>
+ 5 == 5
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ v.capacity() >= 5
+ </Original>
+ <Expanded>
+ 5 >= 5
+ </Expanded>
+ </Expression>
+ <Section name="reserving bigger changes capacity but not size" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ v.size() == 5
+ </Original>
+ <Expanded>
+ 5 == 5
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ v.capacity() >= 10
+ </Original>
+ <Expanded>
+ 10 >= 10
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ v.size() == 5
+ </Original>
+ <Expanded>
+ 5 == 5
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ v.capacity() >= 5
+ </Original>
+ <Expanded>
+ 5 >= 5
+ </Expanded>
+ </Expression>
+ <Section name="reserving smaller does not change size or capacity" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ v.size() == 5
+ </Original>
+ <Expanded>
+ 5 == 5
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <Original>
+ v.capacity() >= 5
+ </Original>
+ <Expanded>
+ 5 >= 5
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
+ <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" >
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="encoded chars" description="these should all be encoded: &&&"""<<<&"<<&"" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" >
+ <OverallResults successes="1" failures="0" expectedFailures="0"/>
+ </Section>
+ <OverallResult success="true"/>
+ </TestCase>
+ <OverallResults successes="866" failures="121" expectedFailures="21"/>
+ </Group>
+ <OverallResults successes="866" failures="120" expectedFailures="21"/>
+</Catch>
diff --git a/projects/SelfTest/CompileTimePerfTests/10.tests.cpp b/projects/SelfTest/CompileTimePerfTests/10.tests.cpp
new file mode 100644
index 0000000..01cd072
--- /dev/null
+++ b/projects/SelfTest/CompileTimePerfTests/10.tests.cpp
@@ -0,0 +1,13 @@
+// Include set of usage tests multiple times - for compile-time performance testing
+// (do not run)
+
+#include "All.tests.cpp"
+#include "All.tests.cpp"
+#include "All.tests.cpp"
+#include "All.tests.cpp"
+#include "All.tests.cpp"
+#include "All.tests.cpp"
+#include "All.tests.cpp"
+#include "All.tests.cpp"
+#include "All.tests.cpp"
+#include "All.tests.cpp"
diff --git a/projects/SelfTest/CompileTimePerfTests/100.tests.cpp b/projects/SelfTest/CompileTimePerfTests/100.tests.cpp
new file mode 100644
index 0000000..e03ca83
--- /dev/null
+++ b/projects/SelfTest/CompileTimePerfTests/100.tests.cpp
@@ -0,0 +1,13 @@
+// Include set of usage tests multiple times - for compile-time performance testing
+// (do not run)
+
+#include "10.tests.cpp"
+#include "10.tests.cpp"
+#include "10.tests.cpp"
+#include "10.tests.cpp"
+#include "10.tests.cpp"
+#include "10.tests.cpp"
+#include "10.tests.cpp"
+#include "10.tests.cpp"
+#include "10.tests.cpp"
+#include "10.tests.cpp"
diff --git a/projects/SelfTest/CompileTimePerfTests/All.tests.cpp b/projects/SelfTest/CompileTimePerfTests/All.tests.cpp
new file mode 100644
index 0000000..2b6a102
--- /dev/null
+++ b/projects/SelfTest/CompileTimePerfTests/All.tests.cpp
@@ -0,0 +1,15 @@
+// include set of usage tests into one file for compiler performance test purposes
+// This whole file can now be included multiple times in 10.tests.cpp, and *that*
+// file included multiple times (in 100.tests.cpp)
+
+// Note that the intention is only for these files to be compiled. They will
+// fail at runtime due to the re-user of test case names
+
+#include "../UsageTests/Approx.tests.cpp"
+#include "../UsageTests/BDD.tests.cpp"
+#include "../UsageTests/Class.tests.cpp"
+#include "../UsageTests/Compilation.tests.cpp"
+#include "../UsageTests/Condition.tests.cpp"
+#include "../UsageTests/Exception.tests.cpp"
+#include "../UsageTests/Matchers.tests.cpp"
+#include "../UsageTests/Misc.tests.cpp"
diff --git a/projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp b/projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
new file mode 100644
index 0000000..a073585
--- /dev/null
+++ b/projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
@@ -0,0 +1,457 @@
+/*
+ * Created by Phil on 13/5/2013.
+ * Copyright 2014 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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.hpp"
+#include "internal/catch_test_spec_parser.h"
+#include "internal/catch_config.hpp"
+#include "internal/catch_commandline.h"
+
+#ifdef __clang__
+# pragma clang diagnostic ignored "-Wc++98-compat"
+#endif
+
+inline Catch::TestCase fakeTestCase( const char* name, const char* desc = "" ){ return Catch::makeTestCase( nullptr, "", name, desc, CATCH_INTERNAL_LINEINFO ); }
+
+TEST_CASE( "Parse test names and tags" ) {
+
+ using Catch::parseTestSpec;
+ using Catch::TestSpec;
+
+ Catch::TestCase tcA = fakeTestCase( "a" );
+ Catch::TestCase tcB = fakeTestCase( "b", "[one][x]" );
+ Catch::TestCase tcC = fakeTestCase( "longer name with spaces", "[two][three][.][x]" );
+ Catch::TestCase tcD = fakeTestCase( "zlonger name with spacesz" );
+
+ SECTION( "Empty test spec should have no filters" ) {
+ TestSpec spec;
+ CHECK( spec.hasFilters() == false );
+ CHECK( spec.matches( tcA ) == false );
+ CHECK( spec.matches( tcB ) == false );
+ }
+
+ SECTION( "Test spec from empty string should have no filters" ) {
+ TestSpec spec = parseTestSpec( "" );
+ CHECK( spec.hasFilters() == false );
+ CHECK( spec.matches(tcA ) == false );
+ CHECK( spec.matches( tcB ) == false );
+ }
+
+ SECTION( "Test spec from just a comma should have no filters" ) {
+ TestSpec spec = parseTestSpec( "," );
+ CHECK( spec.hasFilters() == false );
+ CHECK( spec.matches( tcA ) == false );
+ CHECK( spec.matches( tcB ) == false );
+ }
+
+ SECTION( "Test spec from name should have one filter" ) {
+ TestSpec spec = parseTestSpec( "b" );
+ CHECK( spec.hasFilters() == true );
+ CHECK( spec.matches( tcA ) == false );
+ CHECK( spec.matches( tcB ) == true );
+ }
+
+ SECTION( "Test spec from quoted name should have one filter" ) {
+ TestSpec spec = parseTestSpec( "\"b\"" );
+ CHECK( spec.hasFilters() == true );
+ CHECK( spec.matches( tcA ) == false );
+ CHECK( spec.matches( tcB ) == true );
+ }
+
+ SECTION( "Test spec from name should have one filter" ) {
+ TestSpec spec = parseTestSpec( "b" );
+ CHECK( spec.hasFilters() == true );
+ CHECK( spec.matches( tcA ) == false );
+ CHECK( spec.matches( tcB ) == true );
+ CHECK( spec.matches( tcC ) == false );
+ }
+
+ SECTION( "Wildcard at the start" ) {
+ TestSpec spec = parseTestSpec( "*spaces" );
+ CHECK( spec.hasFilters() == true );
+ CHECK( spec.matches( tcA ) == false );
+ CHECK( spec.matches( tcB ) == false );
+ CHECK( spec.matches( tcC ) == true );
+ CHECK( spec.matches( tcD ) == false );
+ CHECK( parseTestSpec( "*a" ).matches( tcA ) == true );
+ }
+ SECTION( "Wildcard at the end" ) {
+ TestSpec spec = parseTestSpec( "long*" );
+ CHECK( spec.hasFilters() == true );
+ CHECK( spec.matches( tcA ) == false );
+ CHECK( spec.matches( tcB ) == false );
+ CHECK( spec.matches( tcC ) == true );
+ CHECK( spec.matches( tcD ) == false );
+ CHECK( parseTestSpec( "a*" ).matches( tcA ) == true );
+ }
+ SECTION( "Wildcard at both ends" ) {
+ TestSpec spec = parseTestSpec( "*name*" );
+ CHECK( spec.hasFilters() == true );
+ CHECK( spec.matches( tcA ) == false );
+ CHECK( spec.matches( tcB ) == false );
+ CHECK( spec.matches( tcC ) == true );
+ CHECK( spec.matches( tcD ) == true );
+ CHECK( parseTestSpec( "*a*" ).matches( tcA ) == true );
+ }
+ SECTION( "Redundant wildcard at the start" ) {
+ TestSpec spec = parseTestSpec( "*a" );
+ CHECK( spec.hasFilters() == true );
+ CHECK( spec.matches( tcA ) == true );
+ CHECK( spec.matches( tcB ) == false );
+ }
+ SECTION( "Redundant wildcard at the end" ) {
+ TestSpec spec = parseTestSpec( "a*" );
+ CHECK( spec.hasFilters() == true );
+ CHECK( spec.matches( tcA ) == true );
+ CHECK( spec.matches( tcB ) == false );
+ }
+ SECTION( "Redundant wildcard at both ends" ) {
+ TestSpec spec = parseTestSpec( "*a*" );
+ CHECK( spec.hasFilters() == true );
+ CHECK( spec.matches( tcA ) == true );
+ CHECK( spec.matches( tcB ) == false );
+ }
+ SECTION( "Wildcard at both ends, redundant at start" ) {
+ TestSpec spec = parseTestSpec( "*longer*" );
+ CHECK( spec.hasFilters() == true );
+ CHECK( spec.matches( tcA ) == false );
+ CHECK( spec.matches( tcB ) == false );
+ CHECK( spec.matches( tcC ) == true );
+ CHECK( spec.matches( tcD ) == true );
+ }
+ SECTION( "Just wildcard" ) {
+ TestSpec spec = parseTestSpec( "*" );
+ CHECK( spec.hasFilters() == true );
+ CHECK( spec.matches( tcA ) == true );
+ CHECK( spec.matches( tcB ) == true );
+ CHECK( spec.matches( tcC ) == true );
+ CHECK( spec.matches( tcD ) == true );
+ }
+
+ SECTION( "Single tag" ) {
+ TestSpec spec = parseTestSpec( "[one]" );
+ CHECK( spec.hasFilters() == true );
+ CHECK( spec.matches( tcA ) == false );
+ CHECK( spec.matches( tcB ) == true );
+ CHECK( spec.matches( tcC ) == false );
+ }
+ SECTION( "Single tag, two matches" ) {
+ TestSpec spec = parseTestSpec( "[x]" );
+ CHECK( spec.hasFilters() == true );
+ CHECK( spec.matches( tcA ) == false );
+ CHECK( spec.matches( tcB ) == true );
+ CHECK( spec.matches( tcC ) == true );
+ }
+ SECTION( "Two tags" ) {
+ TestSpec spec = parseTestSpec( "[two][x]" );
+ CHECK( spec.hasFilters() == true );
+ CHECK( spec.matches( tcA ) == false );
+ CHECK( spec.matches( tcB ) == false );
+ CHECK( spec.matches( tcC ) == true );
+ }
+ SECTION( "Two tags, spare separated" ) {
+ TestSpec spec = parseTestSpec( "[two] [x]" );
+ CHECK( spec.hasFilters() == true );
+ CHECK( spec.matches( tcA ) == false );
+ CHECK( spec.matches( tcB ) == false );
+ CHECK( spec.matches( tcC ) == true );
+ }
+ SECTION( "Wildcarded name and tag" ) {
+ TestSpec spec = parseTestSpec( "*name*[x]" );
+ CHECK( spec.hasFilters() == true );
+ CHECK( spec.matches( tcA ) == false );
+ CHECK( spec.matches( tcB ) == false );
+ CHECK( spec.matches( tcC ) == true );
+ CHECK( spec.matches( tcD ) == false );
+ }
+ SECTION( "Single tag exclusion" ) {
+ TestSpec spec = parseTestSpec( "~[one]" );
+ CHECK( spec.hasFilters() == true );
+ CHECK( spec.matches( tcA ) == true );
+ CHECK( spec.matches( tcB ) == false );
+ CHECK( spec.matches( tcC ) == true );
+ }
+ SECTION( "One tag exclusion and one tag inclusion" ) {
+ TestSpec spec = parseTestSpec( "~[two][x]" );
+ CHECK( spec.hasFilters() == true );
+ CHECK( spec.matches( tcA ) == false );
+ CHECK( spec.matches( tcB ) == true );
+ CHECK( spec.matches( tcC ) == false );
+ }
+ SECTION( "One tag exclusion and one wldcarded name inclusion" ) {
+ TestSpec spec = parseTestSpec( "~[two]*name*" );
+ CHECK( spec.hasFilters() == true );
+ CHECK( spec.matches( tcA ) == false );
+ CHECK( spec.matches( tcB ) == false );
+ CHECK( spec.matches( tcC ) == false );
+ CHECK( spec.matches( tcD ) == true );
+ }
+ SECTION( "One tag exclusion, using exclude:, and one wldcarded name inclusion" ) {
+ TestSpec spec = parseTestSpec( "exclude:[two]*name*" );
+ CHECK( spec.hasFilters() == true );
+ CHECK( spec.matches( tcA ) == false );
+ CHECK( spec.matches( tcB ) == false );
+ CHECK( spec.matches( tcC ) == false );
+ CHECK( spec.matches( tcD ) == true );
+ }
+ SECTION( "name exclusion" ) {
+ TestSpec spec = parseTestSpec( "~b" );
+ CHECK( spec.hasFilters() == true );
+ CHECK( spec.matches( tcA ) == true );
+ CHECK( spec.matches( tcB ) == false );
+ CHECK( spec.matches( tcC ) == true );
+ CHECK( spec.matches( tcD ) == true );
+ }
+ SECTION( "wildcarded name exclusion" ) {
+ TestSpec spec = parseTestSpec( "~*name*" );
+ CHECK( spec.hasFilters() == true );
+ CHECK( spec.matches( tcA ) == true );
+ CHECK( spec.matches( tcB ) == true );
+ CHECK( spec.matches( tcC ) == false );
+ CHECK( spec.matches( tcD ) == false );
+ }
+ SECTION( "wildcarded name exclusion with tag inclusion" ) {
+ TestSpec spec = parseTestSpec( "~*name*,[three]" );
+ CHECK( spec.hasFilters() == true );
+ CHECK( spec.matches( tcA ) == true );
+ CHECK( spec.matches( tcB ) == true );
+ CHECK( spec.matches( tcC ) == true );
+ CHECK( spec.matches( tcD ) == false );
+ }
+ SECTION( "wildcarded name exclusion, using exclude:, with tag inclusion" ) {
+ TestSpec spec = parseTestSpec( "exclude:*name*,[three]" );
+ CHECK( spec.hasFilters() == true );
+ CHECK( spec.matches( tcA ) == true );
+ CHECK( spec.matches( tcB ) == true );
+ CHECK( spec.matches( tcC ) == true );
+ CHECK( spec.matches( tcD ) == false );
+ }
+ SECTION( "two wildcarded names" ) {
+ TestSpec spec = parseTestSpec( "\"longer*\"\"*spaces\"" );
+ CHECK( spec.hasFilters() == true );
+ CHECK( spec.matches( tcA ) == false );
+ CHECK( spec.matches( tcB ) == false );
+ CHECK( spec.matches( tcC ) == true );
+ CHECK( spec.matches( tcD ) == false );
+ }
+ SECTION( "empty tag" ) {
+ TestSpec spec = parseTestSpec( "[]" );
+ CHECK( spec.hasFilters() == false );
+ CHECK( spec.matches( tcA ) == false );
+ CHECK( spec.matches( tcB ) == false );
+ CHECK( spec.matches( tcC ) == false );
+ CHECK( spec.matches( tcD ) == false );
+ }
+ SECTION( "empty quoted name" ) {
+ TestSpec spec = parseTestSpec( "\"\"" );
+ CHECK( spec.hasFilters() == false );
+ CHECK( spec.matches( tcA ) == false );
+ CHECK( spec.matches( tcB ) == false );
+ CHECK( spec.matches( tcC ) == false );
+ CHECK( spec.matches( tcD ) == false );
+ }
+ SECTION( "quoted string followed by tag exclusion" ) {
+ TestSpec spec = parseTestSpec( "\"*name*\"~[.]" );
+ CHECK( spec.hasFilters() == true );
+ CHECK( spec.matches( tcA ) == false );
+ CHECK( spec.matches( tcB ) == false );
+ CHECK( spec.matches( tcC ) == false );
+ CHECK( spec.matches( tcD ) == true );
+ }
+
+}
+
+TEST_CASE( "Process can be configured on command line", "[config][command-line]" ) {
+
+#ifndef CATCH_CONFIG_DISABLE_MATCHERS
+ using namespace Catch::Matchers;
+#endif
+
+ Catch::ConfigData config;
+ auto cli = Catch::makeCommandLineParser(config);
+
+ SECTION("empty args don't cause a crash") {
+ auto result = cli.parse({""});
+ CHECK(result);
+ CHECK(config.processName == "");
+ }
+
+
+ SECTION("default - no arguments") {
+ auto result = cli.parse({"test"});
+ CHECK(result);
+ CHECK(config.processName == "test");
+ CHECK(config.shouldDebugBreak == false);
+ CHECK(config.abortAfter == -1);
+ CHECK(config.noThrow == false);
+ CHECK(config.reporterNames.empty());
+ }
+
+ SECTION("test lists") {
+ SECTION("1 test", "Specify one test case using") {
+ auto result = cli.parse({"test", "test1"});
+ CHECK(result);
+
+ Catch::Config cfg(config);
+ REQUIRE(cfg.testSpec().matches(fakeTestCase("notIncluded")) == false);
+ REQUIRE(cfg.testSpec().matches(fakeTestCase("test1")));
+ }
+ SECTION("Specify one test case exclusion using exclude:") {
+ auto result = cli.parse({"test", "exclude:test1"});
+ CHECK(result);
+
+ Catch::Config cfg(config);
+ REQUIRE(cfg.testSpec().matches(fakeTestCase("test1")) == false);
+ REQUIRE(cfg.testSpec().matches(fakeTestCase("alwaysIncluded")));
+ }
+
+ SECTION("Specify one test case exclusion using ~") {
+ auto result = cli.parse({"test", "~test1"});
+ CHECK(result);
+
+ Catch::Config cfg(config);
+ REQUIRE(cfg.testSpec().matches(fakeTestCase("test1")) == false);
+ REQUIRE(cfg.testSpec().matches(fakeTestCase("alwaysIncluded")));
+ }
+
+ }
+
+ SECTION("reporter") {
+ SECTION("-r/console") {
+ CHECK(cli.parse({"test", "-r", "console"}));
+
+ REQUIRE(config.reporterNames[0] == "console");
+ }
+ SECTION("-r/xml") {
+ CHECK(cli.parse({"test", "-r", "xml"}));
+
+ REQUIRE(config.reporterNames[0] == "xml");
+ }
+ SECTION("-r xml and junit") {
+ CHECK(cli.parse({"test", "-r", "xml", "-r", "junit"}));
+
+ REQUIRE(config.reporterNames.size() == 2);
+ REQUIRE(config.reporterNames[0] == "xml");
+ REQUIRE(config.reporterNames[1] == "junit");
+ }
+ SECTION("--reporter/junit") {
+ CHECK(cli.parse({"test", "--reporter", "junit"}));
+
+ REQUIRE(config.reporterNames[0] == "junit");
+ }
+ }
+
+
+ SECTION("debugger") {
+ SECTION("-b") {
+ CHECK(cli.parse({"test", "-b"}));
+
+ REQUIRE(config.shouldDebugBreak == true);
+ }
+ SECTION("--break") {
+ CHECK(cli.parse({"test", "--break"}));
+
+ REQUIRE(config.shouldDebugBreak);
+ }
+ }
+
+
+ SECTION("abort") {
+ SECTION("-a aborts after first failure") {
+ CHECK(cli.parse({"test", "-a"}));
+
+ REQUIRE(config.abortAfter == 1);
+ }
+ SECTION("-x 2 aborts after two failures") {
+ CHECK(cli.parse({"test", "-x", "2"}));
+
+ REQUIRE(config.abortAfter == 2);
+ }
+ SECTION("-x must be numeric") {
+ auto result = cli.parse({"test", "-x", "oops"});
+ CHECK(!result);
+
+#ifndef CATCH_CONFIG_DISABLE_MATCHERS
+ REQUIRE_THAT(result.errorMessage(), Contains("convert") && Contains("oops"));
+#endif
+ }
+ }
+
+ SECTION("nothrow") {
+ SECTION("-e") {
+ CHECK(cli.parse({"test", "-e"}));
+
+ REQUIRE(config.noThrow);
+ }
+ SECTION("--nothrow") {
+ CHECK(cli.parse({"test", "--nothrow"}));
+
+ REQUIRE(config.noThrow);
+ }
+ }
+
+ SECTION("output filename") {
+ SECTION("-o filename") {
+ CHECK(cli.parse({"test", "-o", "filename.ext"}));
+
+ REQUIRE(config.outputFilename == "filename.ext");
+ }
+ SECTION("--out") {
+ CHECK(cli.parse({"test", "--out", "filename.ext"}));
+
+ REQUIRE(config.outputFilename == "filename.ext");
+ }
+ }
+
+ SECTION("combinations") {
+ SECTION("Single character flags can be combined") {
+ CHECK(cli.parse({"test", "-abe"}));
+
+ CHECK(config.abortAfter == 1);
+ CHECK(config.shouldDebugBreak);
+ CHECK(config.noThrow == true);
+ }
+ }
+
+
+ SECTION( "use-colour") {
+
+ using Catch::UseColour;
+
+ SECTION( "without option" ) {
+ CHECK(cli.parse({"test"}));
+
+ REQUIRE( config.useColour == UseColour::Auto );
+ }
+
+ SECTION( "auto" ) {
+ CHECK(cli.parse({"test", "--use-colour", "auto"}));
+
+ REQUIRE( config.useColour == UseColour::Auto );
+ }
+
+ SECTION( "yes" ) {
+ CHECK(cli.parse({"test", "--use-colour", "yes"}));
+
+ REQUIRE( config.useColour == UseColour::Yes );
+ }
+
+ SECTION( "no" ) {
+ CHECK(cli.parse({"test", "--use-colour", "no"}));
+
+ REQUIRE( config.useColour == UseColour::No );
+ }
+
+ SECTION( "error" ) {
+ auto result = cli.parse({"test", "--use-colour", "wrong"});
+ CHECK( !result );
+#ifndef CATCH_CONFIG_DISABLE_MATCHERS
+ CHECK_THAT( result.errorMessage(), Contains( "colour mode must be one of" ) );
+#endif
+ }
+ }
+}
diff --git a/projects/SelfTest/IntrospectiveTests/PartTracker.tests.cpp b/projects/SelfTest/IntrospectiveTests/PartTracker.tests.cpp
new file mode 100644
index 0000000..042c03a
--- /dev/null
+++ b/projects/SelfTest/IntrospectiveTests/PartTracker.tests.cpp
@@ -0,0 +1,333 @@
+/*
+ * Created by Phil on 1/10/2015.
+ * Copyright 2015 Two Blue Cubes Ltd
+ *
+ * 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 "internal/catch_suppress_warnings.h"
+#include "internal/catch_test_case_tracker.h"
+
+
+namespace Catch
+{
+ class LocalContext {
+
+ public:
+ TrackerContext& operator()() const {
+ return TrackerContext::instance();
+ }
+ };
+
+} // namespace Catch
+
+inline Catch::TrackerContext& C_A_T_C_H_Context() {
+ return Catch::TrackerContext::instance();
+}
+
+// -------------------
+
+#include "catch.hpp"
+
+using namespace Catch;
+
+//inline void testCase( Catch::LocalContext const& C_A_T_C_H_Context ) {
+//
+// REQUIRE( C_A_T_C_H_Context().i() == 42 );
+//}
+
+Catch::TestCaseTracking::NameAndLocation makeNAL( std::string const& name ) {
+ return Catch::TestCaseTracking::NameAndLocation( name, Catch::SourceLineInfo("",0) );
+}
+
+TEST_CASE( "Tracker" ) {
+
+ TrackerContext ctx;
+ ctx.startRun();
+ ctx.startCycle();
+
+
+ ITracker& testCase = SectionTracker::acquire( ctx, makeNAL( "Testcase" ) );
+ REQUIRE( testCase.isOpen() );
+
+ ITracker& s1 = SectionTracker::acquire( ctx, makeNAL( "S1" ) );
+ REQUIRE( s1.isOpen() );
+
+ SECTION( "successfully close one section" ) {
+ s1.close();
+ REQUIRE( s1.isSuccessfullyCompleted() );
+ REQUIRE( testCase.isComplete() == false );
+
+ testCase.close();
+ REQUIRE( ctx.completedCycle() );
+ REQUIRE( testCase.isSuccessfullyCompleted() );
+ }
+
+ SECTION( "fail one section" ) {
+ s1.fail();
+ REQUIRE( s1.isComplete() );
+ REQUIRE( s1.isSuccessfullyCompleted() == false );
+ REQUIRE( testCase.isComplete() == false );
+
+ testCase.close();
+ REQUIRE( ctx.completedCycle() );
+ REQUIRE( testCase.isSuccessfullyCompleted() == false );
+
+ SECTION( "re-enter after failed section" ) {
+ ctx.startCycle();
+ ITracker& testCase2 = SectionTracker::acquire( ctx, makeNAL( "Testcase" ) );
+ REQUIRE( testCase2.isOpen() );
+
+ ITracker& s1b = SectionTracker::acquire( ctx, makeNAL( "S1" ) );
+ REQUIRE( s1b.isOpen() == false );
+
+ testCase2.close();
+ REQUIRE( ctx.completedCycle() );
+ REQUIRE( testCase.isComplete() );
+ REQUIRE( testCase.isSuccessfullyCompleted() );
+ }
+ SECTION( "re-enter after failed section and find next section" ) {
+ ctx.startCycle();
+ ITracker& testCase2 = SectionTracker::acquire( ctx, makeNAL( "Testcase" ) );
+ REQUIRE( testCase2.isOpen() );
+
+ ITracker& s1b = SectionTracker::acquire( ctx, makeNAL( "S1" ) );
+ REQUIRE( s1b.isOpen() == false );
+
+ ITracker& s2 = SectionTracker::acquire( ctx, makeNAL( "S2" ) );
+ REQUIRE( s2.isOpen() );
+
+ s2.close();
+ REQUIRE( ctx.completedCycle() );
+
+ testCase2.close();
+ REQUIRE( testCase.isComplete() );
+ REQUIRE( testCase.isSuccessfullyCompleted() );
+ }
+ }
+
+ SECTION( "successfully close one section, then find another" ) {
+ s1.close();
+
+ ITracker& s2 = SectionTracker::acquire( ctx, makeNAL( "S2" ) );
+ REQUIRE( s2.isOpen() == false );
+
+ testCase.close();
+ REQUIRE( testCase.isComplete() == false );
+
+ SECTION( "Re-enter - skips S1 and enters S2" ) {
+ ctx.startCycle();
+ ITracker& testCase2 = SectionTracker::acquire( ctx, makeNAL( "Testcase" ) );
+ REQUIRE( testCase2.isOpen() );
+
+ ITracker& s1b = SectionTracker::acquire( ctx, makeNAL( "S1" ) );
+ REQUIRE( s1b.isOpen() == false );
+
+ ITracker& s2b = SectionTracker::acquire( ctx, makeNAL( "S2" ) );
+ REQUIRE( s2b.isOpen() );
+
+ REQUIRE( ctx.completedCycle() == false );
+
+ SECTION ("Successfully close S2") {
+ s2b.close();
+ REQUIRE( ctx.completedCycle() );
+
+ REQUIRE( s2b.isSuccessfullyCompleted() );
+ REQUIRE( testCase2.isComplete() == false );
+
+ testCase2.close();
+ REQUIRE( testCase2.isSuccessfullyCompleted() );
+ }
+ SECTION ("fail S2") {
+ s2b.fail();
+ REQUIRE( ctx.completedCycle() );
+
+ REQUIRE( s2b.isComplete() );
+ REQUIRE( s2b.isSuccessfullyCompleted() == false );
+
+ testCase2.close();
+ REQUIRE( testCase2.isSuccessfullyCompleted() == false );
+
+ // Need a final cycle
+ ctx.startCycle();
+ ITracker& testCase3 = SectionTracker::acquire( ctx, makeNAL( "Testcase" ) );
+ REQUIRE( testCase3.isOpen() );
+
+ ITracker& s1c = SectionTracker::acquire( ctx, makeNAL( "S1" ) );
+ REQUIRE( s1c.isOpen() == false );
+
+ ITracker& s2c = SectionTracker::acquire( ctx, makeNAL( "S2" ) );
+ REQUIRE( s2c.isOpen() == false );
+
+ testCase3.close();
+ REQUIRE( testCase3.isSuccessfullyCompleted() );
+ }
+ }
+ }
+
+ SECTION( "open a nested section" ) {
+ ITracker& s2 = SectionTracker::acquire( ctx, makeNAL( "S2" ) );
+ REQUIRE( s2.isOpen() );
+
+ s2.close();
+ REQUIRE( s2.isComplete() );
+ REQUIRE( s1.isComplete() == false );
+
+ s1.close();
+ REQUIRE( s1.isComplete() );
+ REQUIRE( testCase.isComplete() == false );
+
+ testCase.close();
+ REQUIRE( testCase.isComplete() );
+ }
+
+ SECTION( "start a generator" ) {
+ IndexTracker& g1 = IndexTracker::acquire( ctx, makeNAL( "G1" ), 2 );
+ REQUIRE( g1.isOpen() );
+ REQUIRE( g1.index() == 0 );
+
+ REQUIRE( g1.isComplete() == false );
+ REQUIRE( s1.isComplete() == false );
+
+ SECTION( "close outer section" )
+ {
+ s1.close();
+ REQUIRE( s1.isComplete() == false );
+ testCase.close();
+ REQUIRE( testCase.isSuccessfullyCompleted() == false );
+
+ SECTION( "Re-enter for second generation" ) {
+ ctx.startCycle();
+ ITracker& testCase2 = SectionTracker::acquire( ctx, makeNAL( "Testcase" ) );
+ REQUIRE( testCase2.isOpen() );
+
+ ITracker& s1b = SectionTracker::acquire( ctx, makeNAL( "S1" ) );
+ REQUIRE( s1b.isOpen() );
+
+
+ IndexTracker& g1b = IndexTracker::acquire( ctx, makeNAL( "G1" ), 2 );
+ REQUIRE( g1b.isOpen() );
+ REQUIRE( g1b.index() == 1 );
+
+ REQUIRE( s1.isComplete() == false );
+
+ s1b.close();
+ REQUIRE( s1b.isComplete() );
+ REQUIRE( g1b.isComplete() );
+ testCase2.close();
+ REQUIRE( testCase2.isComplete() );
+ }
+ }
+ SECTION( "Start a new inner section" ) {
+ ITracker& s2 = SectionTracker::acquire( ctx, makeNAL( "S2" ) );
+ REQUIRE( s2.isOpen() );
+
+ s2.close();
+ REQUIRE( s2.isComplete() );
+
+ s1.close();
+ REQUIRE( s1.isComplete() == false );
+
+ testCase.close();
+ REQUIRE( testCase.isComplete() == false );
+
+ SECTION( "Re-enter for second generation" ) {
+ ctx.startCycle();
+ ITracker& testCase2 = SectionTracker::acquire( ctx, makeNAL( "Testcase" ) );
+ REQUIRE( testCase2.isOpen() );
+
+ ITracker& s1b = SectionTracker::acquire( ctx, makeNAL( "S1" ) );
+ REQUIRE( s1b.isOpen() );
+
+ // generator - next value
+ IndexTracker& g1b = IndexTracker::acquire( ctx, makeNAL( "G1" ), 2 );
+ REQUIRE( g1b.isOpen() );
+ REQUIRE( g1b.index() == 1 );
+
+ // inner section again
+ ITracker& s2b = SectionTracker::acquire( ctx, makeNAL( "S2" ) );
+ REQUIRE( s2b.isOpen() );
+
+ s2b.close();
+ REQUIRE( s2b.isComplete() );
+
+ s1b.close();
+ REQUIRE( g1b.isComplete() );
+ REQUIRE( s1b.isComplete() );
+
+ testCase2.close();
+ REQUIRE( testCase2.isComplete() );
+ }
+ }
+
+ SECTION( "Fail an inner section" ) {
+ ITracker& s2 = SectionTracker::acquire( ctx, makeNAL( "S2" ) );
+ REQUIRE( s2.isOpen() );
+
+ s2.fail();
+ REQUIRE( s2.isComplete() );
+ REQUIRE( s2.isSuccessfullyCompleted() == false );
+
+ s1.close();
+ REQUIRE( s1.isComplete() == false );
+
+ testCase.close();
+ REQUIRE( testCase.isComplete() == false );
+
+ SECTION( "Re-enter for second generation" ) {
+ ctx.startCycle();
+ ITracker& testCase2 = SectionTracker::acquire( ctx, makeNAL( "Testcase" ) );
+ REQUIRE( testCase2.isOpen() );
+
+ ITracker& s1b = SectionTracker::acquire( ctx, makeNAL( "S1" ) );
+ REQUIRE( s1b.isOpen() );
+
+ // generator - still same value
+ IndexTracker& g1b = IndexTracker::acquire( ctx, makeNAL( "G1" ), 2 );
+ REQUIRE( g1b.isOpen() );
+ REQUIRE( g1b.index() == 0 );
+
+ // inner section again - this time won't open
+ ITracker& s2b = SectionTracker::acquire( ctx, makeNAL( "S2" ) );
+ REQUIRE( s2b.isOpen() == false );
+
+ s1b.close();
+ REQUIRE( g1b.isComplete() == false );
+ REQUIRE( s1b.isComplete() == false );
+
+ testCase2.close();
+ REQUIRE( testCase2.isComplete() == false );
+
+ // Another cycle - now should complete
+ ctx.startCycle();
+ ITracker& testCase3 = SectionTracker::acquire( ctx, makeNAL( "Testcase" ) );
+ REQUIRE( testCase3.isOpen() );
+
+ ITracker& s1c = SectionTracker::acquire( ctx, makeNAL( "S1" ) );
+ REQUIRE( s1c.isOpen() );
+
+ // generator - now next value
+ IndexTracker& g1c = IndexTracker::acquire( ctx, makeNAL( "G1" ), 2 );
+ REQUIRE( g1c.isOpen() );
+ REQUIRE( g1c.index() == 1 );
+
+ // inner section - now should open again
+ ITracker& s2c = SectionTracker::acquire( ctx, makeNAL( "S2" ) );
+ REQUIRE( s2c.isOpen() );
+
+ s2c.close();
+ REQUIRE( s2c.isComplete() );
+
+ s1c.close();
+ REQUIRE( g1c.isComplete() );
+ REQUIRE( s1c.isComplete() );
+
+ testCase3.close();
+ REQUIRE( testCase3.isComplete() );
+ }
+ }
+ // !TBD"
+ // nested generator
+ // two sections within a generator
+ }
+}
diff --git a/projects/SelfTest/IntrospectiveTests/String.tests.cpp b/projects/SelfTest/IntrospectiveTests/String.tests.cpp
new file mode 100644
index 0000000..9c9c559
--- /dev/null
+++ b/projects/SelfTest/IntrospectiveTests/String.tests.cpp
@@ -0,0 +1,200 @@
+#include "internal/catch_stringref.h"
+
+#include "catch.hpp"
+
+#include <cstring>
+
+namespace Catch {
+
+ // Implementation of test accessors
+ struct StringRefTestAccess {
+ static auto isOwned( StringRef const& stringRef ) -> bool {
+ return stringRef.isOwned();
+ }
+ static auto isSubstring( StringRef const& stringRef ) -> bool {
+ return stringRef.isSubstring();
+ }
+ static auto data( StringRef const& stringRef ) -> char const* {
+ return stringRef.data();
+ }
+ };
+
+ auto isOwned( StringRef const& stringRef ) -> bool {
+ return StringRefTestAccess::isOwned( stringRef );
+ }
+ auto isSubstring( StringRef const& stringRef ) -> bool {
+ return StringRefTestAccess::isSubstring( stringRef );
+ }
+ auto data( StringRef const& stringRef ) -> char const* {
+ return StringRefTestAccess::data( stringRef );
+ }
+} // namespace Catch2
+
+namespace Catch {
+ inline auto toString( Catch::StringRef const& stringRef ) -> std::string {
+ return std::string( data( stringRef ), stringRef.size() );
+ }
+} // namespace Catch
+
+TEST_CASE( "StringRef", "[Strings]" ) {
+
+ using Catch::StringRef;
+
+ SECTION( "Empty string" ) {
+ StringRef empty;
+ REQUIRE( empty.empty() );
+ REQUIRE( empty.size() == 0 );
+ REQUIRE( std::strcmp( empty.c_str(), "" ) == 0 );
+ }
+
+ SECTION( "From string literal" ) {
+ StringRef s = "hello";
+ REQUIRE( s.empty() == false );
+ REQUIRE( s.size() == 5 );
+ REQUIRE( isSubstring( s ) == false );
+
+ auto rawChars = data( s );
+ REQUIRE( std::strcmp( rawChars, "hello" ) == 0 );
+
+ SECTION( "c_str() does not cause copy" ) {
+ REQUIRE( isOwned( s ) == false );
+
+ REQUIRE( s.c_str() == rawChars );
+
+ REQUIRE( isOwned( s ) == false );
+ }
+ }
+ SECTION( "From sub-string" ) {
+ StringRef original = StringRef( "original string" ).substr(0, 8);
+ REQUIRE( original == "original" );
+ REQUIRE( isSubstring( original ) );
+ REQUIRE( isOwned( original ) == false );
+
+ original.c_str(); // Forces it to take ownership
+
+ REQUIRE( isSubstring( original ) == false );
+ REQUIRE( isOwned( original ) );
+
+ }
+
+
+ SECTION( "Substrings" ) {
+ StringRef s = "hello world!";
+ StringRef ss = s.substr(0, 5);
+
+ SECTION( "zero-based substring" ) {
+ REQUIRE( ss.empty() == false );
+ REQUIRE( ss.size() == 5 );
+ REQUIRE( std::strcmp( ss.c_str(), "hello" ) == 0 );
+ REQUIRE( ss == "hello" );
+ }
+ SECTION( "c_str() causes copy" ) {
+ REQUIRE( isSubstring( ss ) );
+ REQUIRE( isOwned( ss ) == false );
+
+ auto rawChars = data( ss );
+ REQUIRE( rawChars == data( s ) ); // same pointer value
+ REQUIRE( ss.c_str() != rawChars );
+
+ REQUIRE( isSubstring( ss ) == false );
+ REQUIRE( isOwned( ss ) );
+
+ REQUIRE( data( ss ) != data( s ) ); // different pointer value
+ }
+
+ SECTION( "non-zero-based substring") {
+ ss = s.substr( 6, 6 );
+ REQUIRE( ss.size() == 6 );
+ REQUIRE( std::strcmp( ss.c_str(), "world!" ) == 0 );
+ }
+
+ SECTION( "Pointer values of full refs should match" ) {
+ StringRef s2 = s;
+ REQUIRE( s.c_str() == s2.c_str() );
+ }
+
+ SECTION( "Pointer values of substring refs should not match" ) {
+ REQUIRE( s.c_str() != ss.c_str() );
+ }
+ }
+
+ SECTION( "Comparisons" ) {
+ REQUIRE( StringRef("hello") == StringRef("hello") );
+ REQUIRE( StringRef("hello") != StringRef("cello") );
+ }
+
+ SECTION( "from std::string" ) {
+ std::string stdStr = "a standard string";
+
+ SECTION( "implicitly constructed" ) {
+ StringRef sr = stdStr;
+ REQUIRE( sr == "a standard string" );
+ REQUIRE( sr.size() == stdStr.size() );
+ }
+ SECTION( "explicitly constructed" ) {
+ StringRef sr( stdStr );
+ REQUIRE( sr == "a standard string" );
+ REQUIRE( sr.size() == stdStr.size() );
+ }
+ SECTION( "assigned" ) {
+ StringRef sr;
+ sr = stdStr;
+ REQUIRE( sr == "a standard string" );
+ REQUIRE( sr.size() == stdStr.size() );
+ }
+ }
+
+ SECTION( "to std::string" ) {
+ StringRef sr = "a stringref";
+
+ SECTION( "implicitly constructed" ) {
+ std::string stdStr = sr;
+ REQUIRE( stdStr == "a stringref" );
+ REQUIRE( stdStr.size() == sr.size() );
+ }
+ SECTION( "explicitly constructed" ) {
+ std::string stdStr( sr );
+ REQUIRE( stdStr == "a stringref" );
+ REQUIRE( stdStr.size() == sr.size() );
+ }
+ SECTION( "assigned" ) {
+ std::string stdStr;
+ stdStr = sr;
+ REQUIRE( stdStr == "a stringref" );
+ REQUIRE( stdStr.size() == sr.size() );
+ }
+ }
+}
+
+TEST_CASE( "replaceInPlace" ) {
+ std::string letters = "abcdefcg";
+ SECTION( "replace single char" ) {
+ CHECK( Catch::replaceInPlace( letters, "b", "z" ) );
+ CHECK( letters == "azcdefcg" );
+ }
+ SECTION( "replace two chars" ) {
+ CHECK( Catch::replaceInPlace( letters, "c", "z" ) );
+ CHECK( letters == "abzdefzg" );
+ }
+ SECTION( "replace first char" ) {
+ CHECK( Catch::replaceInPlace( letters, "a", "z" ) );
+ CHECK( letters == "zbcdefcg" );
+ }
+ SECTION( "replace last char" ) {
+ CHECK( Catch::replaceInPlace( letters, "g", "z" ) );
+ CHECK( letters == "abcdefcz" );
+ }
+ SECTION( "replace all chars" ) {
+ CHECK( Catch::replaceInPlace( letters, letters, "replaced" ) );
+ CHECK( letters == "replaced" );
+ }
+ SECTION( "replace no chars" ) {
+ CHECK_FALSE( Catch::replaceInPlace( letters, "x", "z" ) );
+ CHECK( letters == letters );
+ }
+ SECTION( "escape '" ) {
+ std::string s = "didn't";
+ CHECK( Catch::replaceInPlace( s, "'", "|'" ) );
+ CHECK( s == "didn|'t" );
+ }
+}
diff --git a/projects/SelfTest/IntrospectiveTests/TagAlias.tests.cpp b/projects/SelfTest/IntrospectiveTests/TagAlias.tests.cpp
new file mode 100644
index 0000000..b533c45
--- /dev/null
+++ b/projects/SelfTest/IntrospectiveTests/TagAlias.tests.cpp
@@ -0,0 +1,42 @@
+/*
+ * Created by Phil on 27/06/2014.
+ * Copyright 2014 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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.hpp"
+#include "internal/catch_tag_alias_registry.h"
+
+TEST_CASE( "Tag alias can be registered against tag patterns" ) {
+
+ Catch::TagAliasRegistry registry;
+
+ registry.add( "[@zzz]", "[one][two]", Catch::SourceLineInfo( "file", 2 ) );
+
+ SECTION( "The same tag alias can only be registered once" ) {
+
+ try {
+ registry.add( "[@zzz]", "[one][two]", Catch::SourceLineInfo( "file", 10 ) );
+ FAIL( "expected exception" );
+ }
+ catch( std::exception& ex ) {
+#ifndef CATCH_CONFIG_DISABLE_MATCHERS
+ std::string what = ex.what();
+ using namespace Catch::Matchers;
+ CHECK_THAT( what, Contains( "[@zzz]" ) );
+ CHECK_THAT( what, Contains( "file" ) );
+ CHECK_THAT( what, Contains( "2" ) );
+ CHECK_THAT( what, Contains( "10" ) );
+#endif
+ }
+ }
+
+ SECTION( "Tag aliases must be of the form [@name]" ) {
+ CHECK_THROWS( registry.add( "[no ampersat]", "", Catch::SourceLineInfo( "file", 3 ) ) );
+ CHECK_THROWS( registry.add( "[the @ is not at the start]", "", Catch::SourceLineInfo( "file", 3 ) ) );
+ CHECK_THROWS( registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) ) );
+ CHECK_THROWS( registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) ) );
+ }
+}
diff --git a/projects/SelfTest/IntrospectiveTests/Xml.tests.cpp b/projects/SelfTest/IntrospectiveTests/Xml.tests.cpp
new file mode 100644
index 0000000..9bbed25
--- /dev/null
+++ b/projects/SelfTest/IntrospectiveTests/Xml.tests.cpp
@@ -0,0 +1,41 @@
+#include "catch.hpp"
+
+#include "internal/catch_xmlwriter.h"
+
+#include <sstream>
+
+inline std::string encode( std::string const& str, Catch::XmlEncode::ForWhat forWhat = Catch::XmlEncode::ForTextNodes ) {
+ std::ostringstream oss;
+ oss << Catch::XmlEncode( str, forWhat );
+ return oss.str();
+}
+
+TEST_CASE( "XmlEncode" ) {
+ SECTION( "normal string" ) {
+ REQUIRE( encode( "normal string" ) == "normal string" );
+ }
+ SECTION( "empty string" ) {
+ REQUIRE( encode( "" ) == "" );
+ }
+ SECTION( "string with ampersand" ) {
+ REQUIRE( encode( "smith & jones" ) == "smith & jones" );
+ }
+ SECTION( "string with less-than" ) {
+ REQUIRE( encode( "smith < jones" ) == "smith < jones" );
+ }
+ SECTION( "string with greater-than" ) {
+ REQUIRE( encode( "smith > jones" ) == "smith > jones" );
+ REQUIRE( encode( "smith ]]> jones" ) == "smith ]]> jones" );
+ }
+ SECTION( "string with quotes" ) {
+ std::string stringWithQuotes = "don't \"quote\" me on that";
+ REQUIRE( encode( stringWithQuotes ) == stringWithQuotes );
+ REQUIRE( encode( stringWithQuotes, Catch::XmlEncode::ForAttributes ) == "don't "quote" me on that" );
+ }
+ SECTION( "string with control char (1)" ) {
+ REQUIRE( encode( "[\x01]" ) == "[\\x01]" );
+ }
+ SECTION( "string with control char (x7F)" ) {
+ REQUIRE( encode( "[\x7F]" ) == "[\\x7F]" );
+ }
+}
\ No newline at end of file
diff --git a/projects/SelfTest/SurrogateCpps/catch_console_colour.cpp b/projects/SelfTest/SurrogateCpps/catch_console_colour.cpp
new file mode 100644
index 0000000..a237750
--- /dev/null
+++ b/projects/SelfTest/SurrogateCpps/catch_console_colour.cpp
@@ -0,0 +1,3 @@
+// 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"
diff --git a/projects/SelfTest/SurrogateCpps/catch_debugger.cpp b/projects/SelfTest/SurrogateCpps/catch_debugger.cpp
new file mode 100644
index 0000000..04f4e07
--- /dev/null
+++ b/projects/SelfTest/SurrogateCpps/catch_debugger.cpp
@@ -0,0 +1,2 @@
+// This file is only here to verify (to the extent possible) the self sufficiency of the header
+#include "internal/catch_debugger.h"
diff --git a/projects/SelfTest/SurrogateCpps/catch_interfaces_reporter.cpp b/projects/SelfTest/SurrogateCpps/catch_interfaces_reporter.cpp
new file mode 100644
index 0000000..f3c7158
--- /dev/null
+++ b/projects/SelfTest/SurrogateCpps/catch_interfaces_reporter.cpp
@@ -0,0 +1,2 @@
+#include "internal/catch_suppress_warnings.h"
+#include "internal/catch_interfaces_reporter.h"
diff --git a/projects/SelfTest/SurrogateCpps/catch_option.cpp b/projects/SelfTest/SurrogateCpps/catch_option.cpp
new file mode 100644
index 0000000..a4ca37c
--- /dev/null
+++ b/projects/SelfTest/SurrogateCpps/catch_option.cpp
@@ -0,0 +1,3 @@
+// 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_option.hpp"
diff --git a/projects/SelfTest/SurrogateCpps/catch_stream.cpp b/projects/SelfTest/SurrogateCpps/catch_stream.cpp
new file mode 100644
index 0000000..a76d841
--- /dev/null
+++ b/projects/SelfTest/SurrogateCpps/catch_stream.cpp
@@ -0,0 +1,3 @@
+// 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_stream.h"
diff --git a/projects/SelfTest/SurrogateCpps/catch_test_case_tracker.cpp b/projects/SelfTest/SurrogateCpps/catch_test_case_tracker.cpp
new file mode 100644
index 0000000..0d697b0
--- /dev/null
+++ b/projects/SelfTest/SurrogateCpps/catch_test_case_tracker.cpp
@@ -0,0 +1,2 @@
+// This file is only here to verify (to the extent possible) the self sufficiency of the header
+#include "internal/catch_test_case_tracker.h"
diff --git a/projects/SelfTest/SurrogateCpps/catch_test_spec.cpp b/projects/SelfTest/SurrogateCpps/catch_test_spec.cpp
new file mode 100644
index 0000000..8be135e
--- /dev/null
+++ b/projects/SelfTest/SurrogateCpps/catch_test_spec.cpp
@@ -0,0 +1,3 @@
+// 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"
diff --git a/projects/SelfTest/SurrogateCpps/catch_xmlwriter.cpp b/projects/SelfTest/SurrogateCpps/catch_xmlwriter.cpp
new file mode 100644
index 0000000..930e382
--- /dev/null
+++ b/projects/SelfTest/SurrogateCpps/catch_xmlwriter.cpp
@@ -0,0 +1,4 @@
+// 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"
diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp
new file mode 100644
index 0000000..1c023ce
--- /dev/null
+++ b/projects/SelfTest/TestMain.cpp
@@ -0,0 +1,33 @@
+/*
+ * Created by Phil on 22/10/2010.
+ * Copyright 2010 Two Blue Cubes Ltd
+ *
+ * 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)
+ */
+
+#define CATCH_CONFIG_MAIN
+#include "catch.hpp"
+
+// These reporters are not included in the single include, so must be included separately in the main file
+#include "reporters/catch_reporter_teamcity.hpp"
+#include "reporters/catch_reporter_tap.hpp"
+#include "reporters/catch_reporter_automake.hpp"
+
+
+// Some example tag aliases
+CATCH_REGISTER_TAG_ALIAS( "[@nhf]", "[failing]~[.]" )
+CATCH_REGISTER_TAG_ALIAS( "[@tricky]", "[tricky]~[.]" )
+
+
+#ifdef __clang__
+# pragma clang diagnostic ignored "-Wpadded"
+# pragma clang diagnostic ignored "-Wweak-vtables"
+# pragma clang diagnostic ignored "-Wc++98-compat"
+#endif
+
+struct TestListener : Catch::TestEventListenerBase {
+ using TestEventListenerBase::TestEventListenerBase; // inherit constructor
+};
+CATCH_REGISTER_LISTENER( TestListener )
+
diff --git a/projects/SelfTest/UsageTests/Approx.tests.cpp b/projects/SelfTest/UsageTests/Approx.tests.cpp
new file mode 100644
index 0000000..5930075
--- /dev/null
+++ b/projects/SelfTest/UsageTests/Approx.tests.cpp
@@ -0,0 +1,198 @@
+/*
+ * Created by Phil on 28/04/2011.
+ * Copyright 2011 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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.hpp"
+
+#include <cmath>
+
+namespace { namespace ApproxTests {
+
+#ifndef APPROX_TEST_HELPERS_INCLUDED // Don't compile this more than once per TU
+#define APPROX_TEST_HELPERS_INCLUDED
+
+ inline double divide( double a, double b ) {
+ return a/b;
+ }
+
+ class StrongDoubleTypedef {
+ double d_ = 0.0;
+
+ public:
+ explicit StrongDoubleTypedef(double d) : d_(d) {}
+ explicit operator double() const { return d_; }
+ };
+
+ inline std::ostream& operator<<( std::ostream& os, StrongDoubleTypedef td ) {
+ return os << "StrongDoubleTypedef(" << static_cast<double>(td) << ")";
+ }
+
+#endif
+
+
+///////////////////////////////////////////////////////////////////////////////
+TEST_CASE( "Some simple comparisons between doubles", "[Approx]" ) {
+ double d = 1.23;
+
+ REQUIRE( d == Approx( 1.23 ) );
+ REQUIRE( d != Approx( 1.22 ) );
+ REQUIRE( d != Approx( 1.24 ) );
+
+ REQUIRE( Approx( d ) == 1.23 );
+ REQUIRE( Approx( d ) != 1.22 );
+ REQUIRE( Approx( d ) != 1.24 );
+
+ REQUIRE(INFINITY == Approx(INFINITY));
+}
+
+///////////////////////////////////////////////////////////////////////////////
+TEST_CASE( "Approximate comparisons with different epsilons", "[Approx]" ) {
+ double d = 1.23;
+
+ REQUIRE( d != Approx( 1.231 ) );
+ REQUIRE( d == Approx( 1.231 ).epsilon( 0.1 ) );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+TEST_CASE( "Less-than inequalities with different epsilons", "[Approx]" ) {
+ double d = 1.23;
+
+ REQUIRE( d <= Approx( 1.24 ) );
+ REQUIRE( d <= Approx( 1.23 ) );
+ REQUIRE_FALSE( d <= Approx( 1.22 ) );
+ REQUIRE( d <= Approx( 1.22 ).epsilon(0.1) );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+TEST_CASE( "Greater-than inequalities with different epsilons", "[Approx]" ) {
+ double d = 1.23;
+
+ REQUIRE( d >= Approx( 1.22 ) );
+ REQUIRE( d >= Approx( 1.23 ) );
+ REQUIRE_FALSE( d >= Approx( 1.24 ) );
+ REQUIRE( d >= Approx( 1.24 ).epsilon(0.1) );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+TEST_CASE( "Approximate comparisons with floats", "[Approx]" ) {
+ REQUIRE( 1.23f == Approx( 1.23f ) );
+ REQUIRE( 0.0f == Approx( 0.0f ) );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+TEST_CASE( "Approximate comparisons with ints", "[Approx]" ) {
+ REQUIRE( 1 == Approx( 1 ) );
+ REQUIRE( 0 == Approx( 0 ) );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+TEST_CASE( "Approximate comparisons with mixed numeric types", "[Approx]" ) {
+ const double dZero = 0;
+ const double dSmall = 0.00001;
+ const double dMedium = 1.234;
+
+ REQUIRE( 1.0f == Approx( 1 ) );
+ REQUIRE( 0 == Approx( dZero) );
+ REQUIRE( 0 == Approx( dSmall ).margin( 0.001 ) );
+ REQUIRE( 1.234f == Approx( dMedium ) );
+ REQUIRE( dMedium == Approx( 1.234f ) );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+TEST_CASE( "Use a custom approx", "[Approx][custom]" ) {
+ double d = 1.23;
+
+ Approx approx = Approx::custom().epsilon( 0.01 );
+
+ REQUIRE( d == approx( 1.23 ) );
+ REQUIRE( d == approx( 1.22 ) );
+ REQUIRE( d == approx( 1.24 ) );
+ REQUIRE( d != approx( 1.25 ) );
+
+ REQUIRE( approx( d ) == 1.23 );
+ REQUIRE( approx( d ) == 1.22 );
+ REQUIRE( approx( d ) == 1.24 );
+ REQUIRE( approx( d ) != 1.25 );
+}
+
+TEST_CASE( "Approximate PI", "[Approx][PI]" ) {
+ REQUIRE( divide( 22, 7 ) == Approx( 3.141 ).epsilon( 0.001 ) );
+ REQUIRE( divide( 22, 7 ) != Approx( 3.141 ).epsilon( 0.0001 ) );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+TEST_CASE( "Absolute margin", "[Approx]" ) {
+ REQUIRE( 104.0 != Approx(100.0) );
+ REQUIRE( 104.0 == Approx(100.0).margin(5) );
+ REQUIRE( 104.0 == Approx(100.0).margin(4) );
+ REQUIRE( 104.0 != Approx(100.0).margin(3) );
+ REQUIRE( 100.3 != Approx(100.0) );
+ REQUIRE( 100.3 == Approx(100.0).margin(0.5) );
+}
+
+TEST_CASE("Approx with exactly-representable margin", "[Approx]") {
+ CHECK( 0.25f == Approx(0.0f).margin(0.25f) );
+
+ CHECK( 0.0f == Approx(0.25f).margin(0.25f) );
+ CHECK( 0.5f == Approx(0.25f).margin(0.25f) );
+
+ CHECK( 245.0f == Approx(245.25f).margin(0.25f) );
+ CHECK( 245.5f == Approx(245.25f).margin(0.25f) );
+}
+
+TEST_CASE("Approx setters validate their arguments", "[Approx]") {
+ REQUIRE_NOTHROW(Approx(0).margin(0));
+ REQUIRE_NOTHROW(Approx(0).margin(1234656));
+
+ REQUIRE_THROWS_AS(Approx(0).margin(-2), std::domain_error);
+
+ REQUIRE_NOTHROW(Approx(0).epsilon(0));
+ REQUIRE_NOTHROW(Approx(0).epsilon(1));
+
+ REQUIRE_THROWS_AS(Approx(0).epsilon(-0.001), std::domain_error);
+ REQUIRE_THROWS_AS(Approx(0).epsilon(1.0001), std::domain_error);
+}
+
+TEST_CASE("Default scale is invisible to comparison", "[Approx]") {
+ REQUIRE(101.000001 != Approx(100).epsilon(0.01));
+ REQUIRE(std::pow(10, -5) != Approx(std::pow(10, -7)));
+}
+
+TEST_CASE("Epsilon only applies to Approx's value", "[Approx]") {
+ REQUIRE(101.01 != Approx(100).epsilon(0.01));
+}
+
+TEST_CASE("Assorted miscellaneous tests", "[Approx]") {
+ REQUIRE(INFINITY == Approx(INFINITY));
+ REQUIRE(NAN != Approx(NAN));
+ REQUIRE_FALSE(NAN == Approx(NAN));
+}
+
+TEST_CASE( "Comparison with explicitly convertible types", "[Approx]" )
+{
+ StrongDoubleTypedef td(10.0);
+
+ REQUIRE(td == Approx(10.0));
+ REQUIRE(Approx(10.0) == td);
+
+ REQUIRE(td != Approx(11.0));
+ REQUIRE(Approx(11.0) != td);
+
+ REQUIRE(td <= Approx(10.0));
+ REQUIRE(td <= Approx(11.0));
+ REQUIRE(Approx(10.0) <= td);
+ REQUIRE(Approx(9.0) <= td);
+
+ REQUIRE(td >= Approx(9.0));
+ REQUIRE(td >= Approx(td));
+ REQUIRE(Approx(td) >= td);
+ REQUIRE(Approx(11.0) >= td);
+
+}
+
+}} // namespace ApproxTests
diff --git a/projects/SelfTest/UsageTests/BDD.tests.cpp b/projects/SelfTest/UsageTests/BDD.tests.cpp
new file mode 100644
index 0000000..f43fd96
--- /dev/null
+++ b/projects/SelfTest/UsageTests/BDD.tests.cpp
@@ -0,0 +1,107 @@
+/*
+ * Created by Phil on 29/11/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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.hpp"
+
+namespace { namespace BDDTests {
+
+#ifndef BDD_TEST_HELPERS_INCLUDED // Don't compile this more than once per TU
+#define BDD_TEST_HELPERS_INCLUDED
+
+ inline bool itDoesThis() { return true; }
+
+ inline bool itDoesThat() { return true; }
+
+ namespace {
+
+// a trivial fixture example to support SCENARIO_METHOD tests
+ struct Fixture {
+ Fixture()
+ : d_counter(0) {
+ }
+
+ int counter() {
+ return d_counter++;
+ }
+
+ int d_counter;
+ };
+
+ }
+#endif
+
+ SCENARIO("Do that thing with the thing", "[Tags]") {
+ GIVEN("This stuff exists") {
+ // make stuff exist
+ WHEN("I do this") {
+ // do this
+ THEN("it should do this") {
+ REQUIRE(itDoesThis());
+ AND_THEN("do that")REQUIRE(itDoesThat());
+ }
+ }
+ }
+ }
+
+ SCENARIO("Vector resizing affects size and capacity", "[vector][bdd][size][capacity]") {
+ GIVEN("an empty vector") {
+ std::vector<int> v;
+ REQUIRE(v.size() == 0);
+
+ WHEN("it is made larger") {
+ v.resize(10);
+ THEN("the size and capacity go up") {
+ REQUIRE(v.size() == 10);
+ REQUIRE(v.capacity() >= 10);
+
+ AND_WHEN("it is made smaller again") {
+ v.resize(5);
+ THEN("the size goes down but the capacity stays the same") {
+ REQUIRE(v.size() == 5);
+ REQUIRE(v.capacity() >= 10);
+ }
+ }
+ }
+ }
+
+ WHEN("we reserve more space") {
+ v.reserve(10);
+ THEN("The capacity is increased but the size remains the same") {
+ REQUIRE(v.capacity() >= 10);
+ REQUIRE(v.size() == 0);
+ }
+ }
+ }
+ }
+
+ SCENARIO("This is a really long scenario name to see how the list command deals with wrapping",
+ "[very long tags][lots][long][tags][verbose]"
+ "[one very long tag name that should cause line wrapping writing out using the list command]"
+ "[anotherReallyLongTagNameButThisOneHasNoObviousWrapPointsSoShouldSplitWithinAWordUsingADashCharacter]") {
+ GIVEN("A section name that is so long that it cannot fit in a single console width")WHEN(
+ "The test headers are printed as part of the normal running of the scenario")THEN(
+ "The, deliberately very long and overly verbose (you see what I did there?) section names must wrap, along with an indent")SUCCEED(
+ "boo!");
+ }
+
+ SCENARIO_METHOD(Fixture,
+ "BDD tests requiring Fixtures to provide commonly-accessed data or methods",
+ "[bdd][fixtures]") {
+ const int before(counter());
+ GIVEN("No operations precede me") {
+ REQUIRE(before == 0);
+ WHEN("We get the count") {
+ const int after(counter());
+ THEN("Subsequently values are higher") {
+ REQUIRE(after > before);
+ }
+ }
+ }
+ }
+
+}} // namespace BDDtests
diff --git a/projects/SelfTest/UsageTests/Benchmark.tests.cpp b/projects/SelfTest/UsageTests/Benchmark.tests.cpp
new file mode 100644
index 0000000..ddf6950
--- /dev/null
+++ b/projects/SelfTest/UsageTests/Benchmark.tests.cpp
@@ -0,0 +1,43 @@
+#include "catch.hpp"
+
+#include <map>
+
+TEST_CASE( "benchmarked", "[!benchmark]" ) {
+
+ static const int size = 100;
+
+ std::vector<int> v;
+ std::map<int, int> m;
+
+ BENCHMARK( "Load up a vector" ) {
+ v = std::vector<int>();
+ for(int i =0; i < size; ++i )
+ v.push_back( i );
+ }
+ REQUIRE( v.size() == size );
+
+ BENCHMARK( "Load up a map" ) {
+ m = std::map<int, int>();
+ for(int i =0; i < size; ++i )
+ m.insert( { i, i+1 } );
+ }
+ REQUIRE( m.size() == size );
+
+ BENCHMARK( "Reserved vector" ) {
+ v = std::vector<int>();
+ v.reserve(size);
+ for(int i =0; i < size; ++i )
+ v.push_back( i );
+ }
+ REQUIRE( v.size() == size );
+
+ int array[size];
+ BENCHMARK( "A fixed size array that should require no allocations" ) {
+ for(int i =0; i < size; ++i )
+ array[i] = i;
+ }
+ int sum = 0;
+ for(int i =0; i < size; ++i )
+ sum += array[i];
+ REQUIRE( sum > size );
+}
diff --git a/projects/SelfTest/UsageTests/Class.tests.cpp b/projects/SelfTest/UsageTests/Class.tests.cpp
new file mode 100644
index 0000000..c19a517
--- /dev/null
+++ b/projects/SelfTest/UsageTests/Class.tests.cpp
@@ -0,0 +1,63 @@
+/*
+ * Created by Phil on 09/11/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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.hpp"
+
+namespace{ namespace ClassTests {
+
+#ifndef CLASS_TEST_HELPERS_INCLUDED // Don't compile this more than once per TU
+#define CLASS_TEST_HELPERS_INCLUDED
+
+class TestClass
+{
+ std::string s;
+
+public:
+ TestClass()
+ : s( "hello" )
+ {}
+
+ void succeedingCase()
+ {
+ REQUIRE( s == "hello" );
+ }
+ void failingCase()
+ {
+ REQUIRE( s == "world" );
+ }
+};
+
+struct Fixture
+{
+ Fixture() : m_a( 1 ) {}
+
+ int m_a;
+};
+
+#endif
+
+
+
+METHOD_AS_TEST_CASE( TestClass::succeedingCase, "A METHOD_AS_TEST_CASE based test run that succeeds", "[class]" )
+METHOD_AS_TEST_CASE( TestClass::failingCase, "A METHOD_AS_TEST_CASE based test run that fails", "[.][class][failing]" )
+
+TEST_CASE_METHOD( Fixture, "A TEST_CASE_METHOD based test run that succeeds", "[class]" )
+{
+ REQUIRE( m_a == 1 );
+}
+
+// We should be able to write our tests within a different namespace
+namespace Inner
+{
+ TEST_CASE_METHOD( Fixture, "A TEST_CASE_METHOD based test run that fails", "[.][class][failing]" )
+ {
+ REQUIRE( m_a == 2 );
+ }
+}
+
+}} // namespace ClassTests
diff --git a/projects/SelfTest/UsageTests/Compilation.tests.cpp b/projects/SelfTest/UsageTests/Compilation.tests.cpp
new file mode 100644
index 0000000..9075743
--- /dev/null
+++ b/projects/SelfTest/UsageTests/Compilation.tests.cpp
@@ -0,0 +1,137 @@
+/*
+ * Created by Martin on 17/02/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.hpp"
+
+namespace { namespace CompilationTests {
+
+#ifndef COMPILATION_TEST_HELPERS_INCLUDED // Don't compile this more than once per TU
+#define COMPILATION_TEST_HELPERS_INCLUDED
+
+ // Comparison operators can return non-booleans.
+ // This is unusual, but should be supported.
+ struct logic_t {
+ logic_t operator< (logic_t) const { return {}; }
+ logic_t operator<=(logic_t) const { return {}; }
+ logic_t operator> (logic_t) const { return {}; }
+ logic_t operator>=(logic_t) const { return {}; }
+ logic_t operator==(logic_t) const { return {}; }
+ logic_t operator!=(logic_t) const { return {}; }
+ explicit operator bool() const { return true; }
+ };
+
+
+// This is a minimal example for an issue we have found in 1.7.0
+ struct foo {
+ int i;
+ };
+
+ template<typename T>
+ bool operator==(const T &val, foo f) {
+ return val == f.i;
+ }
+
+ struct Y {
+ uint32_t v : 1;
+ };
+
+ void throws_int(bool b) {
+ if (b) {
+ throw 1;
+ }
+ }
+
+ template<typename T>
+ bool templated_tests(T t) {
+ int a = 3;
+ REQUIRE(a == t);
+ CHECK(a == t);
+ REQUIRE_THROWS(throws_int(true));
+ CHECK_THROWS_AS(throws_int(true), int);
+ REQUIRE_NOTHROW(throws_int(false));
+#ifndef CATCH_CONFIG_DISABLE_MATCHERS
+ REQUIRE_THAT("aaa", Catch::EndsWith("aaa"));
+#endif
+ return true;
+ }
+
+ struct A {
+ };
+
+ std::ostream &operator<<(std::ostream &o, const A &) { return o << 0; }
+
+ struct B : private A {
+ bool operator==(int) const { return true; }
+ };
+
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunused-function"
+#endif
+#ifdef __GNUC__
+// Note that because -~GCC~-, this warning cannot be silenced temporarily, by pushing diagnostic stack...
+// Luckily it is firing in test files and thus can be silenced for the whole file, without losing much.
+#pragma GCC diagnostic ignored "-Wunused-function"
+#endif
+
+ B f();
+
+ std::ostream g();
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
+#endif
+
+ TEST_CASE("#809") {
+ foo f;
+ f.i = 42;
+ REQUIRE(42 == f);
+ }
+
+
+// ------------------------------------------------------------------
+// Changes to REQUIRE_THROWS_AS made it stop working in a template in
+// an unfixable way (as long as C++03 compatibility is being kept).
+// To prevent these from happening in the future, this needs to compile
+
+ TEST_CASE("#833") {
+ REQUIRE(templated_tests<int>(3));
+ }
+
+
+// Test containing example where original stream insertable check breaks compilation
+
+
+ TEST_CASE("#872") {
+ A dummy;
+ CAPTURE(dummy);
+ B x;
+ REQUIRE (x == 4);
+ }
+
+
+ TEST_CASE("#1027") {
+ Y y{0};
+ REQUIRE(y.v == 0);
+ REQUIRE(0 == y.v);
+ }
+
+ // Comparison operators can return non-booleans.
+ // This is unusual, but should be supported.
+ TEST_CASE("#1147") {
+ logic_t t1, t2;
+ REQUIRE(t1 == t2);
+ REQUIRE(t1 != t2);
+ REQUIRE(t1 < t2);
+ REQUIRE(t1 > t2);
+ REQUIRE(t1 <= t2);
+ REQUIRE(t1 >= t2);
+ }
+
+}} // namespace CompilationTests
diff --git a/projects/SelfTest/UsageTests/Condition.tests.cpp b/projects/SelfTest/UsageTests/Condition.tests.cpp
new file mode 100644
index 0000000..9aed5e2
--- /dev/null
+++ b/projects/SelfTest/UsageTests/Condition.tests.cpp
@@ -0,0 +1,334 @@
+/*
+ * Created by Phil on 08/11/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifdef __clang__
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wpadded"
+// Wdouble-promotion is not supported until 3.8
+# if (__clang_major__ > 3) || (__clang_major__ == 3 && __clang_minor__ > 7)
+# pragma clang diagnostic ignored "-Wdouble-promotion"
+# endif
+#endif
+
+#include "catch.hpp"
+
+#include <string>
+#include <limits>
+#include <cstdint>
+
+namespace { namespace ConditionTests {
+
+#ifndef CONDITION_TEST_HELPERS_INCLUDED // Don't compile this more than once per TU
+#define CONDITION_TEST_HELPERS_INCLUDED
+
+struct TestData {
+ int int_seven = 7;
+ std::string str_hello = "hello";
+ float float_nine_point_one = 9.1f;
+ double double_pi = 3.1415926535;
+};
+
+struct TestDef {
+ TestDef& operator + ( const std::string& ) {
+ return *this;
+ }
+ TestDef& operator[]( const std::string& ) {
+ return *this;
+ }
+};
+
+inline const char* returnsConstNull(){ return nullptr; }
+inline char* returnsNull(){ return nullptr; }
+
+#endif
+
+// The "failing" tests all use the CHECK macro, which continues if the specific test fails.
+// This allows us to see all results, even if an earlier check fails
+
+// Equality tests
+TEST_CASE( "Equality checks that should succeed" )
+{
+ TestDef td;
+ td + "hello" + "hello";
+
+ TestData data;
+
+ REQUIRE( data.int_seven == 7 );
+ REQUIRE( data.float_nine_point_one == Approx( 9.1f ) );
+ REQUIRE( data.double_pi == Approx( 3.1415926535 ) );
+ REQUIRE( data.str_hello == "hello" );
+ REQUIRE( "hello" == data.str_hello );
+ REQUIRE( data.str_hello.size() == 5 );
+
+ double x = 1.1 + 0.1 + 0.1;
+ REQUIRE( x == Approx( 1.3 ) );
+}
+
+TEST_CASE( "Equality checks that should fail", "[.][failing][!mayfail]" )
+{
+ TestData data;
+
+ CHECK( data.int_seven == 6 );
+ CHECK( data.int_seven == 8 );
+ CHECK( data.int_seven == 0 );
+ CHECK( data.float_nine_point_one == Approx( 9.11f ) );
+ CHECK( data.float_nine_point_one == Approx( 9.0f ) );
+ CHECK( data.float_nine_point_one == Approx( 1 ) );
+ CHECK( data.float_nine_point_one == Approx( 0 ) );
+ CHECK( data.double_pi == Approx( 3.1415 ) );
+ CHECK( data.str_hello == "goodbye" );
+ CHECK( data.str_hello == "hell" );
+ CHECK( data.str_hello == "hello1" );
+ CHECK( data.str_hello.size() == 6 );
+
+ double x = 1.1 + 0.1 + 0.1;
+ CHECK( x == Approx( 1.301 ) );
+}
+
+TEST_CASE( "Inequality checks that should succeed" )
+{
+ TestData data;
+
+ REQUIRE( data.int_seven != 6 );
+ REQUIRE( data.int_seven != 8 );
+ REQUIRE( data.float_nine_point_one != Approx( 9.11f ) );
+ REQUIRE( data.float_nine_point_one != Approx( 9.0f ) );
+ REQUIRE( data.float_nine_point_one != Approx( 1 ) );
+ REQUIRE( data.float_nine_point_one != Approx( 0 ) );
+ REQUIRE( data.double_pi != Approx( 3.1415 ) );
+ REQUIRE( data.str_hello != "goodbye" );
+ REQUIRE( data.str_hello != "hell" );
+ REQUIRE( data.str_hello != "hello1" );
+ REQUIRE( data.str_hello.size() != 6 );
+}
+
+TEST_CASE( "Inequality checks that should fail", "[.][failing][!shouldfail]" )
+{
+ TestData data;
+
+ CHECK( data.int_seven != 7 );
+ CHECK( data.float_nine_point_one != Approx( 9.1f ) );
+ CHECK( data.double_pi != Approx( 3.1415926535 ) );
+ CHECK( data.str_hello != "hello" );
+ CHECK( data.str_hello.size() != 5 );
+}
+
+// Ordering comparison tests
+TEST_CASE( "Ordering comparison checks that should succeed" )
+{
+ TestData data;
+
+ REQUIRE( data.int_seven < 8 );
+ REQUIRE( data.int_seven > 6 );
+ REQUIRE( data.int_seven > 0 );
+ REQUIRE( data.int_seven > -1 );
+
+ REQUIRE( data.int_seven >= 7 );
+ REQUIRE( data.int_seven >= 6 );
+ REQUIRE( data.int_seven <= 7 );
+ REQUIRE( data.int_seven <= 8 );
+
+ REQUIRE( data.float_nine_point_one > 9 );
+ REQUIRE( data.float_nine_point_one < 10 );
+ REQUIRE( data.float_nine_point_one < 9.2 );
+
+ REQUIRE( data.str_hello <= "hello" );
+ REQUIRE( data.str_hello >= "hello" );
+
+ REQUIRE( data.str_hello < "hellp" );
+ REQUIRE( data.str_hello < "zebra" );
+ REQUIRE( data.str_hello > "hellm" );
+ REQUIRE( data.str_hello > "a" );
+}
+
+TEST_CASE( "Ordering comparison checks that should fail", "[.][failing]" )
+{
+ TestData data;
+
+ CHECK( data.int_seven > 7 );
+ CHECK( data.int_seven < 7 );
+ CHECK( data.int_seven > 8 );
+ CHECK( data.int_seven < 6 );
+ CHECK( data.int_seven < 0 );
+ CHECK( data.int_seven < -1 );
+
+ CHECK( data.int_seven >= 8 );
+ CHECK( data.int_seven <= 6 );
+
+ CHECK( data.float_nine_point_one < 9 );
+ CHECK( data.float_nine_point_one > 10 );
+ CHECK( data.float_nine_point_one > 9.2 );
+
+ CHECK( data.str_hello > "hello" );
+ CHECK( data.str_hello < "hello" );
+ CHECK( data.str_hello > "hellp" );
+ CHECK( data.str_hello > "z" );
+ CHECK( data.str_hello < "hellm" );
+ CHECK( data.str_hello < "a" );
+
+ CHECK( data.str_hello >= "z" );
+ CHECK( data.str_hello <= "a" );
+}
+
+#ifdef __clang__
+# pragma clang diagnostic pop
+#endif
+
+
+// Comparisons with int literals
+TEST_CASE( "Comparisons with int literals don't warn when mixing signed/ unsigned" )
+{
+ int i = 1;
+ unsigned int ui = 2;
+ long l = 3;
+ unsigned long ul = 4;
+ char c = 5;
+ unsigned char uc = 6;
+
+ REQUIRE( i == 1 );
+ REQUIRE( ui == 2 );
+ REQUIRE( l == 3 );
+ REQUIRE( ul == 4 );
+ REQUIRE( c == 5 );
+ REQUIRE( uc == 6 );
+
+ REQUIRE( 1 == i );
+ REQUIRE( 2 == ui );
+ REQUIRE( 3 == l );
+ REQUIRE( 4 == ul );
+ REQUIRE( 5 == c );
+ REQUIRE( 6 == uc );
+
+ REQUIRE( (std::numeric_limits<uint32_t>::max)() > ul );
+}
+
+// Disable warnings about sign conversions for the next two tests
+// (as we are deliberately invoking them)
+// - Currently only disabled for GCC/ LLVM. Should add VC++ too
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wsign-compare"
+#pragma GCC diagnostic ignored "-Wsign-conversion"
+#endif
+#ifdef _MSC_VER
+#pragma warning(disable:4389) // '==' : signed/unsigned mismatch
+#endif
+
+TEST_CASE( "comparisons between int variables" )
+{
+ long long_var = 1L;
+ unsigned char unsigned_char_var = 1;
+ unsigned short unsigned_short_var = 1;
+ unsigned int unsigned_int_var = 1;
+ unsigned long unsigned_long_var = 1L;
+
+ REQUIRE( long_var == unsigned_char_var );
+ REQUIRE( long_var == unsigned_short_var );
+ REQUIRE( long_var == unsigned_int_var );
+ REQUIRE( long_var == unsigned_long_var );
+}
+
+TEST_CASE( "comparisons between const int variables" )
+{
+ const unsigned char unsigned_char_var = 1;
+ const unsigned short unsigned_short_var = 1;
+ const unsigned int unsigned_int_var = 1;
+ const unsigned long unsigned_long_var = 1L;
+
+ REQUIRE( unsigned_char_var == 1 );
+ REQUIRE( unsigned_short_var == 1 );
+ REQUIRE( unsigned_int_var == 1 );
+ REQUIRE( unsigned_long_var == 1 );
+}
+
+TEST_CASE( "Comparisons between unsigned ints and negative signed ints match c++ standard behaviour" )
+{
+ CHECK( ( -1 > 2u ) );
+ CHECK( -1 > 2u );
+
+ CHECK( ( 2u < -1 ) );
+ CHECK( 2u < -1 );
+
+ const int minInt = (std::numeric_limits<int>::min)();
+ CHECK( ( minInt > 2u ) );
+ CHECK( minInt > 2u );
+}
+
+TEST_CASE( "Comparisons between ints where one side is computed" )
+{
+ CHECK( 54 == 6*9 );
+}
+
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
+
+TEST_CASE( "Pointers can be compared to null" )
+{
+ TestData* p = nullptr;
+ TestData* pNULL = nullptr;
+
+ REQUIRE( p == nullptr );
+ REQUIRE( p == pNULL );
+
+ TestData data;
+ p = &data;
+
+ REQUIRE( p != nullptr );
+
+ const TestData* cp = p;
+ REQUIRE( cp != nullptr );
+
+ const TestData* const cpc = p;
+ REQUIRE( cpc != nullptr );
+
+ REQUIRE( returnsNull() == nullptr );
+ REQUIRE( returnsConstNull() == nullptr );
+
+ REQUIRE( nullptr != p );
+}
+
+// Not (!) tests
+// The problem with the ! operator is that it has right-to-left associativity.
+// This means we can't isolate it when we decompose. The simple REQUIRE( !false ) form, therefore,
+// cannot have the operand value extracted. The test will work correctly, and the situation
+// is detected and a warning issued.
+// An alternative form of the macros (CHECK_FALSE and REQUIRE_FALSE) can be used instead to capture
+// the operand value.
+TEST_CASE( "'Not' checks that should succeed" )
+{
+ bool falseValue = false;
+
+ REQUIRE( false == false );
+ REQUIRE( true == true );
+ REQUIRE( !false );
+ REQUIRE_FALSE( false );
+
+ REQUIRE( !falseValue );
+ REQUIRE_FALSE( falseValue );
+
+ REQUIRE( !(1 == 2) );
+ REQUIRE_FALSE( 1 == 2 );
+}
+
+TEST_CASE( "'Not' checks that should fail", "[.][failing]" )
+{
+ bool trueValue = true;
+
+ CHECK( false != false );
+ CHECK( true != true );
+ CHECK( !true );
+ CHECK_FALSE( true );
+
+ CHECK( !trueValue );
+ CHECK_FALSE( trueValue );
+
+ CHECK( !(1 == 1) );
+ CHECK_FALSE( 1 == 1 );
+}
+
+}} // namespace ConditionTests
diff --git a/projects/SelfTest/UsageTests/Decomposition.tests.cpp b/projects/SelfTest/UsageTests/Decomposition.tests.cpp
new file mode 100644
index 0000000..1b44b60
--- /dev/null
+++ b/projects/SelfTest/UsageTests/Decomposition.tests.cpp
@@ -0,0 +1,35 @@
+/*
+ * Created by Martin on 27/5/2017.
+ * Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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 <iostream>
+#include <cstdio>
+
+struct truthy {
+ truthy(bool b):m_value(b){}
+ operator bool() const {
+ return false;
+ }
+ bool m_value;
+};
+
+std::ostream& operator<<(std::ostream& o, truthy) {
+ o << "Hey, its truthy!";
+ return o;
+}
+
+#include "catch.hpp"
+
+TEST_CASE( "Reconstruction should be based on stringification: #914" , "[Decomposition][failing][.]") {
+ CHECK(truthy(false));
+}
+
+TEST_CASE("#1005: Comparing pointer to int and long (NULL can be either on various systems)", "[Decomposition]") {
+ FILE* fptr = nullptr;
+ REQUIRE(fptr == 0);
+ REQUIRE(fptr == 0l);
+}
diff --git a/projects/SelfTest/UsageTests/EnumToString.tests.cpp b/projects/SelfTest/UsageTests/EnumToString.tests.cpp
new file mode 100644
index 0000000..7d18a29
--- /dev/null
+++ b/projects/SelfTest/UsageTests/EnumToString.tests.cpp
@@ -0,0 +1,61 @@
+#include "catch.hpp"
+
+
+// Enum without user-provided stream operator
+enum Enum1 { Enum1Value0, Enum1Value1 };
+
+TEST_CASE( "toString(enum)", "[toString][enum]" ) {
+ Enum1 e0 = Enum1Value0;
+ CHECK( ::Catch::Detail::stringify(e0) == "0" );
+ Enum1 e1 = Enum1Value1;
+ CHECK( ::Catch::Detail::stringify(e1) == "1" );
+}
+
+// Enum with user-provided stream operator
+enum Enum2 { Enum2Value0, Enum2Value1 };
+
+std::ostream& operator<<( std::ostream& os, Enum2 v ) {
+ return os << "E2{" << static_cast<int>(v) << "}";
+}
+
+TEST_CASE( "toString(enum w/operator<<)", "[toString][enum]" ) {
+ Enum2 e0 = Enum2Value0;
+ CHECK( ::Catch::Detail::stringify(e0) == "E2{0}" );
+ Enum2 e1 = Enum2Value1;
+ CHECK( ::Catch::Detail::stringify(e1) == "E2{1}" );
+}
+
+// Enum class without user-provided stream operator
+enum class EnumClass1 { EnumClass1Value0, EnumClass1Value1 };
+
+TEST_CASE( "toString(enum class)", "[toString][enum][enumClass]" ) {
+ EnumClass1 e0 = EnumClass1::EnumClass1Value0;
+ CHECK( ::Catch::Detail::stringify(e0) == "0" );
+ EnumClass1 e1 = EnumClass1::EnumClass1Value1;
+ CHECK( ::Catch::Detail::stringify(e1) == "1" );
+}
+
+// Enum class with user-provided stream operator
+enum class EnumClass2 : short { EnumClass2Value0, EnumClass2Value1 };
+
+std::ostream& operator<<( std::ostream& os, EnumClass2 e2 ) {
+ switch( static_cast<int>( e2 ) ) {
+ case static_cast<int>( EnumClass2::EnumClass2Value0 ):
+ return os << "E2/V0";
+ case static_cast<int>( EnumClass2::EnumClass2Value1 ):
+ return os << "E2/V1";
+ default:
+ return os << "Unknown enum value " << static_cast<int>( e2 );
+ }
+}
+
+TEST_CASE( "toString(enum class w/operator<<)", "[toString][enum][enumClass]" ) {
+ EnumClass2 e0 = EnumClass2::EnumClass2Value0;
+ CHECK( ::Catch::Detail::stringify(e0) == "E2/V0" );
+ EnumClass2 e1 = EnumClass2::EnumClass2Value1;
+ CHECK( ::Catch::Detail::stringify(e1) == "E2/V1" );
+
+ EnumClass2 e3 = static_cast<EnumClass2>(10);
+ CHECK( ::Catch::Detail::stringify(e3) == "Unknown enum value 10" );
+}
+
diff --git a/projects/SelfTest/UsageTests/Exception.tests.cpp b/projects/SelfTest/UsageTests/Exception.tests.cpp
new file mode 100644
index 0000000..d67ef34
--- /dev/null
+++ b/projects/SelfTest/UsageTests/Exception.tests.cpp
@@ -0,0 +1,200 @@
+/*
+ * Created by Phil on 09/11/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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.hpp"
+
+#include <string>
+#include <stdexcept>
+
+#ifdef _MSC_VER
+#pragma warning(disable:4702) // Unreachable code -- uncoditional throws and so on
+#endif
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wweak-vtables"
+#pragma clang diagnostic ignored "-Wmissing-noreturn"
+#endif
+
+namespace { namespace ExceptionTests {
+
+#ifndef EXCEPTION_TEST_HELPERS_INCLUDED // Don't compile this more than once per TU
+#define EXCEPTION_TEST_HELPERS_INCLUDED
+
+int thisThrows() {
+ throw std::domain_error( "expected exception" );
+ return 1;
+}
+
+int thisDoesntThrow() {
+ return 0;
+}
+
+class CustomException {
+public:
+ explicit CustomException( const std::string& msg )
+ : m_msg( msg )
+ {}
+
+ std::string getMessage() const {
+ return m_msg;
+ }
+
+private:
+ std::string m_msg;
+};
+
+class CustomStdException : public std::exception {
+public:
+ explicit CustomStdException( const std::string& msg )
+ : m_msg( msg )
+ {}
+ ~CustomStdException() noexcept override {}
+
+ std::string getMessage() const {
+ return m_msg;
+ }
+
+private:
+ std::string m_msg;
+};
+
+[[noreturn]] void throwCustom() {
+ throw CustomException( "custom exception - not std" );
+}
+
+#endif
+
+TEST_CASE( "When checked exceptions are thrown they can be expected or unexpected", "[!throws]" ) {
+ REQUIRE_THROWS_AS( thisThrows(), std::domain_error );
+ REQUIRE_NOTHROW( thisDoesntThrow() );
+ REQUIRE_THROWS( thisThrows() );
+}
+
+TEST_CASE( "Expected exceptions that don't throw or unexpected exceptions fail the test", "[.][failing][!throws]" ) {
+ CHECK_THROWS_AS( thisThrows(), std::string );
+ CHECK_THROWS_AS( thisDoesntThrow(), std::domain_error );
+ CHECK_NOTHROW( thisThrows() );
+}
+
+TEST_CASE( "When unchecked exceptions are thrown directly they are always failures", "[.][failing][!throws]" ) {
+ throw std::domain_error( "unexpected exception" );
+}
+
+TEST_CASE( "An unchecked exception reports the line of the last assertion", "[.][failing][!throws]" ) {
+ CHECK( 1 == 1 );
+ throw std::domain_error( "unexpected exception" );
+}
+
+TEST_CASE( "When unchecked exceptions are thrown from sections they are always failures", "[.][failing][!throws]" ) {
+ SECTION( "section name" ) {
+ throw std::domain_error("unexpected exception");
+ }
+}
+
+TEST_CASE( "When unchecked exceptions are thrown from functions they are always failures", "[.][failing][!throws]" ) {
+ CHECK( thisThrows() == 0 );
+}
+
+TEST_CASE( "When unchecked exceptions are thrown during a REQUIRE the test should abort fail", "[.][failing][!throws]" ) {
+ REQUIRE( thisThrows() == 0 );
+ FAIL( "This should never happen" );
+}
+
+TEST_CASE( "When unchecked exceptions are thrown during a CHECK the test should continue", "[.][failing][!throws]" ) {
+ try {
+ CHECK(thisThrows() == 0);
+ }
+ catch(...) {
+ FAIL( "This should never happen" );
+ }
+}
+
+TEST_CASE( "When unchecked exceptions are thrown, but caught, they do not affect the test", "[!throws]" ) {
+ try {
+ throw std::domain_error( "unexpected exception" );
+ }
+ catch(...) {}
+}
+
+
+CATCH_TRANSLATE_EXCEPTION( CustomException& ex ) {
+ return ex.getMessage();
+}
+
+CATCH_TRANSLATE_EXCEPTION( CustomStdException& ex ) {
+ return ex.getMessage();
+}
+
+CATCH_TRANSLATE_EXCEPTION( double& ex ) {
+ return Catch::Detail::stringify( ex );
+}
+
+TEST_CASE("Non-std exceptions can be translated", "[.][failing][!throws]" ) {
+ throw CustomException( "custom exception" );
+}
+
+TEST_CASE("Custom std-exceptions can be custom translated", "[.][failing][!throws]" ) {
+ throw CustomException( "custom std exception" );
+}
+
+TEST_CASE( "Custom exceptions can be translated when testing for nothrow", "[.][failing][!throws]" ) {
+ REQUIRE_NOTHROW( throwCustom() );
+}
+
+TEST_CASE( "Custom exceptions can be translated when testing for throwing as something else", "[.][failing][!throws]" ) {
+ REQUIRE_THROWS_AS( throwCustom(), std::exception );
+}
+
+TEST_CASE( "Unexpected exceptions can be translated", "[.][failing][!throws]" ) {
+ throw double( 3.14 );
+}
+
+#ifndef CATCH_CONFIG_DISABLE_MATCHERS
+
+TEST_CASE( "Exception messages can be tested for", "[!throws]" ) {
+ using namespace Catch::Matchers;
+ SECTION( "exact match" )
+ REQUIRE_THROWS_WITH( thisThrows(), "expected exception" );
+ SECTION( "different case" )
+ REQUIRE_THROWS_WITH( thisThrows(), Equals( "expecteD Exception", Catch::CaseSensitive::No ) );
+ SECTION( "wildcarded" ) {
+ REQUIRE_THROWS_WITH( thisThrows(), StartsWith( "expected" ) );
+ REQUIRE_THROWS_WITH( thisThrows(), EndsWith( "exception" ) );
+ REQUIRE_THROWS_WITH( thisThrows(), Contains( "except" ) );
+ REQUIRE_THROWS_WITH( thisThrows(), Contains( "exCept", Catch::CaseSensitive::No ) );
+ }
+}
+
+#endif
+
+TEST_CASE( "Mismatching exception messages failing the test", "[.][failing][!throws]" ) {
+ REQUIRE_THROWS_WITH( thisThrows(), "expected exception" );
+ REQUIRE_THROWS_WITH( thisThrows(), "should fail" );
+ REQUIRE_THROWS_WITH( thisThrows(), "expected exception" );
+}
+
+TEST_CASE( "#748 - captures with unexpected exceptions", "[.][failing][!throws][!shouldfail]" ) {
+ int answer = 42;
+ CAPTURE( answer );
+ // the message should be printed on the first two sections but not on the third
+ SECTION( "outside assertions" ) {
+ thisThrows();
+ }
+ SECTION( "inside REQUIRE_NOTHROW" ) {
+ REQUIRE_NOTHROW( thisThrows() );
+ }
+ SECTION( "inside REQUIRE_THROWS" ) {
+ REQUIRE_THROWS( thisThrows() );
+ }
+}
+
+}} // namespace ExceptionTests
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
diff --git a/projects/SelfTest/UsageTests/Matchers.tests.cpp b/projects/SelfTest/UsageTests/Matchers.tests.cpp
new file mode 100644
index 0000000..3c20caa
--- /dev/null
+++ b/projects/SelfTest/UsageTests/Matchers.tests.cpp
@@ -0,0 +1,377 @@
+/*
+ * Created by Phil on 21/02/2017.
+ * Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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.hpp"
+
+#include <sstream>
+#include <algorithm>
+
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wweak-vtables"
+#pragma clang diagnostic ignored "-Wpadded"
+#endif
+
+namespace { namespace MatchersTests {
+
+#ifndef CATCH_CONFIG_DISABLE_MATCHERS
+
+#ifndef MATCHERS_TEST_HELPERS_INCLUDED // Don't compile this more than once per TU
+#define MATCHERS_TEST_HELPERS_INCLUDED
+
+ inline const char *testStringForMatching() {
+ return "this string contains 'abc' as a substring";
+ }
+
+ inline const char *testStringForMatching2() {
+ return "some completely different text that contains one common word";
+ }
+
+
+#ifdef _MSC_VER
+#pragma warning(disable:4702) // Unreachable code -- MSVC 19 (VS 2015) sees right through the indirection
+#endif
+
+#include <exception>
+
+ struct SpecialException : std::exception {
+ SpecialException(int i_) : i(i_) {}
+
+ int i;
+ };
+
+ void doesNotThrow() {}
+
+ [[noreturn]]
+ void throws(int i) {
+ throw SpecialException{i};
+ }
+
+ [[noreturn]]
+ void throwsAsInt(int i) {
+ throw i;
+ }
+
+ class ExceptionMatcher : public Catch::MatcherBase<SpecialException> {
+ int m_expected;
+ public:
+ ExceptionMatcher(int i) : m_expected(i) {}
+
+ bool match(SpecialException const &se) const override {
+ return se.i == m_expected;
+ }
+
+ std::string describe() const override {
+ std::ostringstream ss;
+ ss << "special exception has value of " << m_expected;
+ return ss.str();
+ }
+ };
+
+#endif
+
+ using namespace Catch::Matchers;
+
+ TEST_CASE("String matchers", "[matchers]") {
+ REQUIRE_THAT(testStringForMatching(), Contains("string"));
+ REQUIRE_THAT(testStringForMatching(), Contains("string", Catch::CaseSensitive::No));
+ CHECK_THAT(testStringForMatching(), Contains("abc"));
+ CHECK_THAT(testStringForMatching(), Contains("aBC", Catch::CaseSensitive::No));
+
+ CHECK_THAT(testStringForMatching(), StartsWith("this"));
+ CHECK_THAT(testStringForMatching(), StartsWith("THIS", Catch::CaseSensitive::No));
+ CHECK_THAT(testStringForMatching(), EndsWith("substring"));
+ CHECK_THAT(testStringForMatching(), EndsWith(" SuBsTrInG", Catch::CaseSensitive::No));
+ }
+
+ TEST_CASE("Contains string matcher", "[.][failing][matchers]") {
+ CHECK_THAT(testStringForMatching(), Contains("not there", Catch::CaseSensitive::No));
+ CHECK_THAT(testStringForMatching(), Contains("STRING"));
+ }
+
+ TEST_CASE("StartsWith string matcher", "[.][failing][matchers]") {
+ CHECK_THAT(testStringForMatching(), StartsWith("This String"));
+ CHECK_THAT(testStringForMatching(), StartsWith("string", Catch::CaseSensitive::No));
+ }
+
+ TEST_CASE("EndsWith string matcher", "[.][failing][matchers]") {
+ CHECK_THAT(testStringForMatching(), EndsWith("Substring"));
+ CHECK_THAT(testStringForMatching(), EndsWith("this", Catch::CaseSensitive::No));
+ }
+
+ TEST_CASE("Equals string matcher", "[.][failing][matchers]") {
+ CHECK_THAT(testStringForMatching(), Equals("this string contains 'ABC' as a substring"));
+ CHECK_THAT(testStringForMatching(), Equals("something else", Catch::CaseSensitive::No));
+ }
+
+ TEST_CASE("Equals", "[matchers]") {
+ CHECK_THAT(testStringForMatching(), Equals("this string contains 'abc' as a substring"));
+ CHECK_THAT(testStringForMatching(),
+ Equals("this string contains 'ABC' as a substring", Catch::CaseSensitive::No));
+ }
+
+// <regex> does not work in libstdc++ 4.8, so we have to enable these tests only when they
+// are expected to pass and cannot have them in baselines
+ TEST_CASE("Regex string matcher -- libstdc++-4.8 workaround", "[matchers][approvals]") {
+
+// This is fiiiine
+// Taken from an answer at
+// https://stackoverflow.com/questions/12530406/is-gcc-4-8-or-earlier-buggy-about-regular-expressions
+#if (!defined(__GNUC__)) || \
+ (__cplusplus >= 201103L && \
+ (!defined(__GLIBCXX__) || (__cplusplus >= 201402L) || \
+ (defined(_GLIBCXX_REGEX_DFS_QUANTIFIERS_LIMIT) || \
+ defined(_GLIBCXX_REGEX_STATE_LIMIT) || \
+ (defined(_GLIBCXX_RELEASE) && \
+ _GLIBCXX_RELEASE > 4))))
+
+ REQUIRE_THAT(testStringForMatching(), Matches("this string contains 'abc' as a substring"));
+ REQUIRE_THAT(testStringForMatching(),
+ Matches("this string CONTAINS 'abc' as a substring", Catch::CaseSensitive::No));
+ REQUIRE_THAT(testStringForMatching(), Matches("^this string contains 'abc' as a substring$"));
+ REQUIRE_THAT(testStringForMatching(), Matches("^.* 'abc' .*$"));
+ REQUIRE_THAT(testStringForMatching(), Matches("^.* 'ABC' .*$", Catch::CaseSensitive::No));
+#endif
+
+ REQUIRE_THAT(testStringForMatching2(), !Matches("this string contains 'abc' as a substring"));
+ }
+
+ TEST_CASE("Regex string matcher", "[matchers][.failing]") {
+ CHECK_THAT(testStringForMatching(), Matches("this STRING contains 'abc' as a substring"));
+ CHECK_THAT(testStringForMatching(), Matches("contains 'abc' as a substring"));
+ CHECK_THAT(testStringForMatching(), Matches("this string contains 'abc' as a"));
+ }
+
+ TEST_CASE("Matchers can be (AllOf) composed with the && operator", "[matchers][operators][operator&&]") {
+ CHECK_THAT(testStringForMatching(),
+ Contains("string") &&
+ Contains("abc") &&
+ Contains("substring") &&
+ Contains("contains"));
+ }
+
+ TEST_CASE("Matchers can be (AnyOf) composed with the || operator", "[matchers][operators][operator||]") {
+ CHECK_THAT(testStringForMatching(), Contains("string") || Contains("different") || Contains("random"));
+ CHECK_THAT(testStringForMatching2(), Contains("string") || Contains("different") || Contains("random"));
+ }
+
+ TEST_CASE("Matchers can be composed with both && and ||", "[matchers][operators][operator||][operator&&]") {
+ CHECK_THAT(testStringForMatching(), (Contains("string") || Contains("different")) && Contains("substring"));
+ }
+
+ TEST_CASE("Matchers can be composed with both && and || - failing",
+ "[matchers][operators][operator||][operator&&][.failing]") {
+ CHECK_THAT(testStringForMatching(), (Contains("string") || Contains("different")) && Contains("random"));
+ }
+
+ TEST_CASE("Matchers can be negated (Not) with the ! operator", "[matchers][operators][not]") {
+ CHECK_THAT(testStringForMatching(), !Contains("different"));
+ }
+
+ TEST_CASE("Matchers can be negated (Not) with the ! operator - failing",
+ "[matchers][operators][not][.failing]") {
+ CHECK_THAT(testStringForMatching(), !Contains("substring"));
+ }
+
+ TEST_CASE("Vector matchers", "[matchers][vector]") {
+ std::vector<int> v;
+ v.push_back(1);
+ v.push_back(2);
+ v.push_back(3);
+
+ std::vector<int> v2;
+ v2.push_back(1);
+ v2.push_back(2);
+
+ std::vector<int> empty;
+
+ SECTION("Contains (element)") {
+ CHECK_THAT(v, VectorContains(1));
+ CHECK_THAT(v, VectorContains(2));
+ }
+ SECTION("Contains (vector)") {
+ CHECK_THAT(v, Contains(v2));
+ v2.push_back(3); // now exactly matches
+ CHECK_THAT(v, Contains(v2));
+
+ CHECK_THAT(v, Contains(empty));
+ CHECK_THAT(empty, Contains(empty));
+ }
+ SECTION("Contains (element), composed") {
+ CHECK_THAT(v, VectorContains(1) && VectorContains(2));
+ }
+
+ SECTION("Equals") {
+
+ // Same vector
+ CHECK_THAT(v, Equals(v));
+
+ CHECK_THAT(empty, Equals(empty));
+
+ // Different vector with same elements
+ v2.push_back(3);
+ CHECK_THAT(v, Equals(v2));
+ }
+ SECTION("UnorderedEquals") {
+ CHECK_THAT(v, UnorderedEquals(v));
+ CHECK_THAT(empty, UnorderedEquals(empty));
+
+ auto permuted = v;
+ std::next_permutation(begin(permuted), end(permuted));
+ REQUIRE_THAT(permuted, UnorderedEquals(v));
+
+ std::reverse(begin(permuted), end(permuted));
+ REQUIRE_THAT(permuted, UnorderedEquals(v));
+ }
+ }
+
+ TEST_CASE("Vector matchers that fail", "[matchers][vector][.][failing]") {
+ std::vector<int> v;
+ v.push_back(1);
+ v.push_back(2);
+ v.push_back(3);
+
+ std::vector<int> v2;
+ v2.push_back(1);
+ v2.push_back(2);
+
+ std::vector<int> empty;
+
+ SECTION("Contains (element)") {
+ CHECK_THAT(v, VectorContains(-1));
+ CHECK_THAT(empty, VectorContains(1));
+ }
+ SECTION("Contains (vector)") {
+ CHECK_THAT(empty, Contains(v));
+ v2.push_back(4);
+ CHECK_THAT(v, Contains(v2));
+ }
+
+ SECTION("Equals") {
+
+ CHECK_THAT(v, Equals(v2));
+ CHECK_THAT(v2, Equals(v));
+ CHECK_THAT(empty, Equals(v));
+ CHECK_THAT(v, Equals(empty));
+ }
+ SECTION("UnorderedEquals") {
+ CHECK_THAT(v, UnorderedEquals(empty));
+ CHECK_THAT(empty, UnorderedEquals(v));
+
+ auto permuted = v;
+ std::next_permutation(begin(permuted), end(permuted));
+ permuted.pop_back();
+ CHECK_THAT(permuted, UnorderedEquals(v));
+
+ std::reverse(begin(permuted), end(permuted));
+ CHECK_THAT(permuted, UnorderedEquals(v));
+ }
+ }
+
+ TEST_CASE("Exception matchers that succeed", "[matchers][exceptions][!throws]") {
+ CHECK_THROWS_MATCHES(throws(1), SpecialException, ExceptionMatcher{1});
+ REQUIRE_THROWS_MATCHES(throws(2), SpecialException, ExceptionMatcher{2});
+ }
+
+ TEST_CASE("Exception matchers that fail", "[matchers][exceptions][!throws][.failing]") {
+ SECTION("No exception") {
+ CHECK_THROWS_MATCHES(doesNotThrow(), SpecialException, ExceptionMatcher{1});
+ REQUIRE_THROWS_MATCHES(doesNotThrow(), SpecialException, ExceptionMatcher{1});
+ }
+ SECTION("Type mismatch") {
+ CHECK_THROWS_MATCHES(throwsAsInt(1), SpecialException, ExceptionMatcher{1});
+ REQUIRE_THROWS_MATCHES(throwsAsInt(1), SpecialException, ExceptionMatcher{1});
+ }
+ SECTION("Contents are wrong") {
+ CHECK_THROWS_MATCHES(throws(3), SpecialException, ExceptionMatcher{1});
+ REQUIRE_THROWS_MATCHES(throws(4), SpecialException, ExceptionMatcher{1});
+ }
+ }
+
+ TEST_CASE("Floating point matchers: float", "[matchers][floating-point]") {
+ SECTION("Margin") {
+ REQUIRE_THAT(1.f, WithinAbs(1.f, 0));
+ REQUIRE_THAT(0.f, WithinAbs(1.f, 1));
+
+ REQUIRE_THAT(0.f, !WithinAbs(1.f, 0.99f));
+ REQUIRE_THAT(0.f, !WithinAbs(1.f, 0.99f));
+
+ REQUIRE_THAT(0.f, WithinAbs(-0.f, 0));
+ REQUIRE_THAT(NAN, !WithinAbs(NAN, 0));
+ }
+ SECTION("ULPs") {
+ REQUIRE_THAT(1.f, WithinULP(1.f, 0));
+
+ REQUIRE_THAT(std::nextafter(1.f, 2.f), WithinULP(1.f, 1));
+ REQUIRE_THAT(std::nextafter(1.f, 0.f), WithinULP(1.f, 1));
+ REQUIRE_THAT(std::nextafter(1.f, 2.f), !WithinULP(1.f, 0));
+
+ REQUIRE_THAT(1.f, WithinULP(1.f, 0));
+ REQUIRE_THAT(-0.f, WithinULP(0.f, 0));
+
+ REQUIRE_THAT(NAN, !WithinULP(NAN, 123));
+ }
+ SECTION("Composed") {
+ REQUIRE_THAT(1.f, WithinAbs(1.f, 0.5) || WithinULP(1.f, 1));
+ REQUIRE_THAT(1.f, WithinAbs(2.f, 0.5) || WithinULP(1.f, 0));
+
+ REQUIRE_THAT(NAN, !(WithinAbs(NAN, 100) || WithinULP(NAN, 123)));
+ }
+ SECTION("Constructor validation") {
+ REQUIRE_NOTHROW(WithinAbs(1.f, 0.f));
+ REQUIRE_THROWS_AS(WithinAbs(1.f, -1.f), std::domain_error);
+
+ REQUIRE_NOTHROW(WithinULP(1.f, 0));
+ REQUIRE_THROWS_AS(WithinULP(1.f, -1), std::domain_error);
+ }
+ }
+
+ TEST_CASE("Floating point matchers: double", "[matchers][floating-point]") {
+ SECTION("Margin") {
+ REQUIRE_THAT(1., WithinAbs(1., 0));
+ REQUIRE_THAT(0., WithinAbs(1., 1));
+
+ REQUIRE_THAT(0., !WithinAbs(1., 0.99));
+ REQUIRE_THAT(0., !WithinAbs(1., 0.99));
+
+ REQUIRE_THAT(NAN, !WithinAbs(NAN, 0));
+ }
+ SECTION("ULPs") {
+ REQUIRE_THAT(1., WithinULP(1., 0));
+
+ REQUIRE_THAT(std::nextafter(1., 2.), WithinULP(1., 1));
+ REQUIRE_THAT(std::nextafter(1., 0.), WithinULP(1., 1));
+ REQUIRE_THAT(std::nextafter(1., 2.), !WithinULP(1., 0));
+
+ REQUIRE_THAT(1., WithinULP(1., 0));
+ REQUIRE_THAT(-0., WithinULP(0., 0));
+
+ REQUIRE_THAT(NAN, !WithinULP(NAN, 123));
+ }
+ SECTION("Composed") {
+ REQUIRE_THAT(1., WithinAbs(1., 0.5) || WithinULP(2., 1));
+ REQUIRE_THAT(1., WithinAbs(2., 0.5) || WithinULP(1., 0));
+
+ REQUIRE_THAT(NAN, !(WithinAbs(NAN, 100) || WithinULP(NAN, 123)));
+ }
+ SECTION("Constructor validation") {
+ REQUIRE_NOTHROW(WithinAbs(1., 0.));
+ REQUIRE_THROWS_AS(WithinAbs(1., -1.), std::domain_error);
+
+ REQUIRE_NOTHROW(WithinULP(1., 0));
+ REQUIRE_THROWS_AS(WithinULP(1., -1), std::domain_error);
+ }
+ }
+
+} } // namespace MatchersTests
+
+#endif // CATCH_CONFIG_DISABLE_MATCHERS
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
diff --git a/projects/SelfTest/UsageTests/Message.tests.cpp b/projects/SelfTest/UsageTests/Message.tests.cpp
new file mode 100644
index 0000000..f3ac02a
--- /dev/null
+++ b/projects/SelfTest/UsageTests/Message.tests.cpp
@@ -0,0 +1,137 @@
+/*
+ * Created by Phil on 09/11/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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.hpp"
+#include <iostream>
+
+#ifdef __clang__
+#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
+#endif
+
+TEST_CASE( "INFO and WARN do not abort tests", "[messages][.]" ) {
+ INFO( "this is a " << "message" ); // This should output the message if a failure occurs
+ WARN( "this is a " << "warning" ); // This should always output the message but then continue
+}
+
+TEST_CASE( "SUCCEED counts as a test pass", "[messages]" ) {
+ SUCCEED( "this is a " << "success" );
+}
+
+TEST_CASE( "INFO gets logged on failure", "[failing][messages][.]" ) {
+ INFO( "this message should be logged" );
+ INFO( "so should this" );
+ int a = 2;
+ REQUIRE( a == 1 );
+}
+
+TEST_CASE( "INFO gets logged on failure, even if captured before successful assertions", "[failing][messages][.]" ) {
+ INFO( "this message may be logged later" );
+ int a = 2;
+ CHECK( a == 2 );
+
+ INFO( "this message should be logged" );
+
+ CHECK( a == 1 );
+
+ INFO( "and this, but later" );
+
+ CHECK( a == 0 );
+
+ INFO( "but not this" );
+
+ CHECK( a == 2 );
+}
+
+TEST_CASE( "FAIL aborts the test", "[failing][messages][.]" ) {
+ FAIL( "This is a " << "failure" ); // This should output the message and abort
+ WARN( "We should never see this");
+}
+
+TEST_CASE( "FAIL_CHECK does not abort the test", "[failing][messages][.]" ) {
+ FAIL_CHECK( "This is a " << "failure" ); // This should output the message then continue
+ WARN( "This message appears in the output");
+}
+
+TEST_CASE( "FAIL does not require an argument", "[failing][messages][.]" ) {
+ FAIL();
+}
+
+TEST_CASE( "SUCCEED does not require an argument", "[messages][.]" ) {
+ SUCCEED();
+}
+
+TEST_CASE( "Output from all sections is reported", "[failing][messages][.]" ) {
+ SECTION( "one" ) {
+ FAIL( "Message from section one" );
+ }
+
+ SECTION( "two" ) {
+ FAIL( "Message from section two" );
+ }
+}
+
+TEST_CASE( "Standard output from all sections is reported", "[messages][.]" ) {
+ SECTION( "one" ) {
+ std::cout << "Message from section one" << std::endl;
+ }
+
+ SECTION( "two" ) {
+ std::cout << "Message from section two" << std::endl;
+ }
+}
+
+TEST_CASE( "Standard error is reported and redirected", "[messages][.][approvals]" ) {
+ SECTION( "std::cerr" ) {
+ std::cerr << "Write to std::cerr" << std::endl;
+ }
+ SECTION( "std::clog" ) {
+ std::clog << "Write to std::clog" << std::endl;
+ }
+ SECTION( "Interleaved writes to cerr and clog" ) {
+ std::cerr << "Inter";
+ std::clog << "leaved";
+ std::cerr << ' ';
+ std::clog << "writes";
+ std::cerr << " to error";
+ std::clog << " streams" << std::endl;
+ }
+}
+
+TEST_CASE( "INFO is reset for each loop", "[messages][failing][.]" ) {
+ for( int i=0; i<100; i++ )
+ {
+ INFO( "current counter " << i );
+ CAPTURE( i );
+ REQUIRE( i < 10 );
+ }
+}
+
+TEST_CASE( "The NO_FAIL macro reports a failure but does not fail the test", "[messages]" ) {
+ CHECK_NOFAIL( 1 == 2 );
+}
+
+TEST_CASE( "just info", "[info][isolated info][messages]" ) {
+ INFO( "this should never be seen" );
+}
+TEST_CASE( "just failure", "[fail][isolated info][.][messages]" ) {
+ FAIL( "Previous info should not be seen" );
+}
+
+
+TEST_CASE( "sends information to INFO", "[.][failing]" ) {
+ INFO( "hi" );
+ int i = 7;
+ CAPTURE( i );
+ REQUIRE( false );
+}
+
+TEST_CASE( "Pointers can be converted to strings", "[messages][.][approvals]" ) {
+ int p;
+ WARN( "actual address of p: " << &p );
+ WARN( "toString(p): " << ::Catch::Detail::stringify( &p ) );
+}
diff --git a/projects/SelfTest/UsageTests/Misc.tests.cpp b/projects/SelfTest/UsageTests/Misc.tests.cpp
new file mode 100644
index 0000000..757a99b
--- /dev/null
+++ b/projects/SelfTest/UsageTests/Misc.tests.cpp
@@ -0,0 +1,351 @@
+/*
+ * Created by Phil on 29/11/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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.hpp"
+
+#ifdef __clang__
+# pragma clang diagnostic ignored "-Wc++98-compat"
+# pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
+#endif
+
+
+#include <iostream>
+#include <cerrno>
+#include <limits>
+#include <sstream>
+
+namespace { namespace MiscTests {
+
+#ifndef MISC_TEST_HELPERS_INCLUDED // Don't compile this more than once per TU
+#define MISC_TEST_HELPERS_INCLUDED
+
+inline const char* makeString( bool makeNull ) {
+ return makeNull ? nullptr : "valid string";
+}
+inline bool testCheckedIf( bool flag ) {
+ CHECKED_IF( flag )
+ return true;
+ else
+ return false;
+}
+inline bool testCheckedElse( bool flag ) {
+ CHECKED_ELSE( flag )
+ return false;
+
+ return true;
+}
+
+inline unsigned int Factorial( unsigned int number ) {
+ return number > 1 ? Factorial(number-1)*number : 1;
+}
+
+static int f() {
+ return 1;
+}
+
+inline void manuallyRegisteredTestFunction() {
+ SUCCEED( "was called" );
+}
+
+struct AutoTestReg {
+ AutoTestReg() {
+ REGISTER_TEST_CASE( manuallyRegisteredTestFunction, "ManuallyRegistered" );
+ }
+};
+CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
+static AutoTestReg autoTestReg;
+CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS
+
+#endif
+
+TEST_CASE( "random SECTION tests", "[.][sections][failing]" ) {
+ int a = 1;
+ int b = 2;
+
+ SECTION( "s1", "doesn't equal" ) {
+ REQUIRE( a != b );
+ REQUIRE( b != a );
+ }
+
+ SECTION( "s2", "not equal" ) {
+ REQUIRE( a != b);
+ }
+}
+
+TEST_CASE( "nested SECTION tests", "[.][sections][failing]" ) {
+ int a = 1;
+ int b = 2;
+
+ SECTION( "s1", "doesn't equal" ) {
+ REQUIRE( a != b );
+ REQUIRE( b != a );
+
+ SECTION( "s2", "not equal" ) {
+ REQUIRE( a != b);
+ }
+ }
+}
+
+TEST_CASE( "more nested SECTION tests", "[sections][failing][.]" ) {
+ int a = 1;
+ int b = 2;
+
+ SECTION( "s1", "doesn't equal" ) {
+ SECTION( "s2", "equal" ) {
+ REQUIRE( a == b );
+ }
+
+ SECTION( "s3", "not equal" ) {
+ REQUIRE( a != b );
+ }
+ SECTION( "s4", "less than" ) {
+ REQUIRE( a < b );
+ }
+ }
+}
+
+TEST_CASE( "even more nested SECTION tests", "[sections]" ) {
+ SECTION( "c" ) {
+ SECTION( "d (leaf)" ) {
+ SUCCEED(""); // avoid failing due to no tests
+ }
+
+ SECTION( "e (leaf)" ) {
+ SUCCEED(""); // avoid failing due to no tests
+ }
+ }
+
+ SECTION( "f (leaf)" ) {
+ SUCCEED(""); // avoid failing due to no tests
+ }
+}
+
+TEST_CASE( "looped SECTION tests", "[.][failing][sections]" ) {
+ int a = 1;
+
+ for( int b = 0; b < 10; ++b ) {
+ std::ostringstream oss;
+ oss << "b is currently: " << b;
+ SECTION( "s1", oss.str() ) {
+ CHECK( b > a );
+ }
+ }
+}
+
+TEST_CASE( "looped tests", "[.][failing]" ) {
+ static const int fib[] = { 1, 1, 2, 3, 5, 8, 13, 21 };
+
+ for( std::size_t i=0; i < sizeof(fib)/sizeof(int); ++i ) {
+ INFO( "Testing if fib[" << i << "] (" << fib[i] << ") is even" );
+ CHECK( ( fib[i] % 2 ) == 0 );
+ }
+}
+
+TEST_CASE( "Sends stuff to stdout and stderr", "[.]" ) {
+ std::cout << "A string sent directly to stdout" << std::endl;
+ std::cerr << "A string sent directly to stderr" << std::endl;
+ std::clog << "A string sent to stderr via clog" << std::endl;
+}
+
+TEST_CASE( "null strings" ) {
+ REQUIRE( makeString( false ) != static_cast<char*>(nullptr));
+ REQUIRE( makeString( true ) == static_cast<char*>(nullptr));
+}
+
+TEST_CASE( "checkedIf" ) {
+ REQUIRE( testCheckedIf( true ) );
+}
+
+TEST_CASE( "checkedIf, failing", "[failing][.]" ) {
+ REQUIRE( testCheckedIf( false ) );
+}
+
+TEST_CASE( "checkedElse" ) {
+ REQUIRE( testCheckedElse( true ) );
+}
+
+TEST_CASE( "checkedElse, failing", "[failing][.]" ) {
+ REQUIRE( testCheckedElse( false ) );
+}
+
+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>" ) {
+ SUCCEED(""); // We need this here to stop it failing due to no tests
+ }
+ SECTION( "encoded chars", "these should all be encoded: &&&\"\"\"<<<&\"<<&\"" ) {
+ SUCCEED(""); // We need this here to stop it failing due to no tests
+ }
+}
+
+TEST_CASE( "send a single char to INFO", "[failing][.]" ) {
+ INFO(3);
+ REQUIRE(false);
+}
+
+TEST_CASE( "atomic if", "[failing][0]") {
+ std::size_t x = 0;
+
+ if( x )
+ REQUIRE(x > 0);
+ else
+ REQUIRE(x == 0);
+}
+
+
+TEST_CASE( "Factorials are computed", "[factorial]" ) {
+ REQUIRE( Factorial(0) == 1 );
+ REQUIRE( Factorial(1) == 1 );
+ REQUIRE( Factorial(2) == 2 );
+ REQUIRE( Factorial(3) == 6 );
+ REQUIRE( Factorial(10) == 3628800 );
+}
+
+TEST_CASE( "An empty test with no assertions", "[empty]" ) {}
+
+TEST_CASE( "Nice descriptive name", "[tag1][tag2][tag3][.]" ) {
+ WARN( "This one ran" );
+}
+TEST_CASE( "first tag", "[tag1]" ) {}
+TEST_CASE( "second tag", "[tag2]" ) {}
+
+//
+//TEST_CASE( "spawn a new process", "[.]" )
+//{
+// // !TBD Work in progress
+// char line[200];
+// FILE* output = popen("./CatchSelfTest ./failing/matchers/StartsWith", "r");
+// while ( fgets(line, 199, output) )
+// std::cout << line;
+//}
+
+TEST_CASE( "vectors can be sized and resized", "[vector]" ) {
+
+ std::vector<int> v( 5 );
+
+ REQUIRE( v.size() == 5 );
+ REQUIRE( v.capacity() >= 5 );
+
+ SECTION( "resizing bigger changes size and capacity" ) {
+ v.resize( 10 );
+
+ REQUIRE( v.size() == 10 );
+ REQUIRE( v.capacity() >= 10 );
+ }
+ SECTION( "resizing smaller changes size but not capacity" ) {
+ v.resize( 0 );
+
+ REQUIRE( v.size() == 0 );
+ REQUIRE( v.capacity() >= 5 );
+
+ SECTION( "We can use the 'swap trick' to reset the capacity" ) {
+ std::vector<int> empty;
+ empty.swap( v );
+
+ REQUIRE( v.capacity() == 0 );
+ }
+ }
+ SECTION( "reserving bigger changes capacity but not size" ) {
+ v.reserve( 10 );
+
+ REQUIRE( v.size() == 5 );
+ REQUIRE( v.capacity() >= 10 );
+ }
+ SECTION( "reserving smaller does not change size or capacity" ) {
+ v.reserve( 0 );
+
+ REQUIRE( v.size() == 5 );
+ REQUIRE( v.capacity() >= 5 );
+ }
+}
+
+// https://github.com/philsquared/Catch/issues/166
+TEST_CASE("A couple of nested sections followed by a failure", "[failing][.]") {
+ SECTION("Outer", "")
+ SECTION("Inner", "")
+ SUCCEED("that's not flying - that's failing in style");
+
+ FAIL("to infinity and beyond");
+}
+
+TEST_CASE("not allowed", "[!throws]") {
+ // This test case should not be included if you run with -e on the command line
+ SUCCEED( "" );
+}
+
+//TEST_CASE( "Is big endian" ) {
+// CHECK( Catch::Detail::Endianness::which() == Catch::Detail::Endianness::Little );
+//}
+
+TEST_CASE( "Tabs and newlines show in output", "[.][whitespace][failing]" ) {
+
+ // Based on issue #242
+ std::string s1 = "if ($b == 10) {\n\t\t$a\t= 20;\n}";
+ std::string s2 = "if ($b == 10) {\n\t$a = 20;\n}\n";
+ CHECK( s1 == s2 );
+}
+
+
+TEST_CASE( "toString on const wchar_t const pointer returns the string contents", "[toString]" ) {
+ const wchar_t * const s = L"wide load";
+ std::string result = ::Catch::Detail::stringify( s );
+ CHECK( result == "\"wide load\"" );
+}
+
+TEST_CASE( "toString on const wchar_t pointer returns the string contents", "[toString]" ) {
+ const wchar_t * s = L"wide load";
+ std::string result = ::Catch::Detail::stringify( s );
+ CHECK( result == "\"wide load\"" );
+}
+
+TEST_CASE( "toString on wchar_t const pointer returns the string contents", "[toString]" ) {
+ auto const s = const_cast<wchar_t* const>( L"wide load" );
+ std::string result = ::Catch::Detail::stringify( s );
+ CHECK( result == "\"wide load\"" );
+}
+
+TEST_CASE( "toString on wchar_t returns the string contents", "[toString]" ) {
+ auto s = const_cast<wchar_t*>( L"wide load" );
+ std::string result = ::Catch::Detail::stringify( s );
+ CHECK( result == "\"wide load\"" );
+}
+
+TEST_CASE( "long long" ) {
+ long long l = std::numeric_limits<long long>::max();
+
+ REQUIRE( l == std::numeric_limits<long long>::max() );
+}
+
+//TEST_CASE( "Divide by Zero signal handler", "[.][sig]" ) {
+// int i = 0;
+// int x = 10/i; // This should cause the signal to fire
+// CHECK( x == 0 );
+//}
+
+TEST_CASE( "This test 'should' fail but doesn't", "[.][failing][!shouldfail]" ) {
+ SUCCEED( "oops!" );
+}
+
+TEST_CASE( "# A test name that starts with a #" ) {
+ SUCCEED( "yay" );
+}
+
+TEST_CASE( "#835 -- errno should not be touched by Catch", "[.][failing][!shouldfail]" ) {
+ errno = 1;
+ CHECK(f() == 0);
+ REQUIRE(errno == 1); // Check that f() doesn't touch errno.
+}
+
+TEST_CASE( "#961 -- Dynamically created sections should all be reported", "[.]" ) {
+ for (char i = '0'; i < '5'; ++i) {
+ SECTION(std::string("Looped section ") + i) {
+ SUCCEED( "Everything is OK" );
+ }
+ }
+}
+
+}} // namespace MiscTests
diff --git a/projects/SelfTest/UsageTests/ToStringChrono.tests.cpp b/projects/SelfTest/UsageTests/ToStringChrono.tests.cpp
new file mode 100644
index 0000000..c2c0829
--- /dev/null
+++ b/projects/SelfTest/UsageTests/ToStringChrono.tests.cpp
@@ -0,0 +1,44 @@
+#define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
+#include "catch.hpp"
+
+#include <chrono>
+#include <cstdint>
+
+TEST_CASE("Stringifying std::chrono::duration helpers", "[toString][chrono]") {
+ // No literals because we still support c++11
+ auto hour = std::chrono::hours(1);
+ auto minute = std::chrono::minutes(1);
+ auto seconds = std::chrono::seconds(60);
+ auto micro = std::chrono::microseconds(1);
+ auto milli = std::chrono::milliseconds(1);
+ auto nano = std::chrono::nanoseconds(1);
+ REQUIRE(minute == seconds);
+ REQUIRE(hour != seconds);
+ REQUIRE(micro != milli);
+ REQUIRE(nano != micro);
+}
+
+TEST_CASE("Stringifying std::chrono::duration with weird ratios", "[toString][chrono]") {
+ std::chrono::duration<int64_t, std::ratio<30>> half_minute(1);
+ std::chrono::duration<int64_t, std::ratio<1, 1000000000000>> pico_second(1);
+ std::chrono::duration<int64_t, std::ratio<1, 1000000000000000>> femto_second(1);
+ std::chrono::duration<int64_t, std::ratio<1, 1000000000000000000>> atto_second(1);
+ REQUIRE(half_minute != femto_second);
+ REQUIRE(pico_second != atto_second);
+}
+
+TEST_CASE("Stringifying std::chrono::time_point<system_clock>", "[toString][chrono]") {
+ auto now = std::chrono::system_clock::now();
+ auto later = now + std::chrono::minutes(2);
+ REQUIRE(now != later);
+}
+
+TEST_CASE("Stringifying std::chrono::time_point<Clock>", "[toString][chrono][!nonportable]") {
+ auto now = std::chrono::high_resolution_clock::now();
+ auto later = now + std::chrono::minutes(2);
+ REQUIRE(now != later);
+
+ auto now2 = std::chrono::steady_clock::now();
+ auto later2 = now2 + std::chrono::minutes(2);
+ REQUIRE(now2 != later2);
+}
diff --git a/projects/SelfTest/UsageTests/ToStringGeneral.tests.cpp b/projects/SelfTest/UsageTests/ToStringGeneral.tests.cpp
new file mode 100644
index 0000000..8ab3324
--- /dev/null
+++ b/projects/SelfTest/UsageTests/ToStringGeneral.tests.cpp
@@ -0,0 +1,117 @@
+/*
+ * Created by Martin on 17/02/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)
+ */
+
+#define CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER
+#include "catch.hpp"
+
+#include <map>
+#include <set>
+
+TEST_CASE( "Character pretty printing" ){
+ SECTION("Specifically escaped"){
+ char tab = '\t';
+ char newline = '\n';
+ char carr_return = '\r';
+ char form_feed = '\f';
+ CHECK(tab == '\t');
+ CHECK(newline == '\n');
+ CHECK(carr_return == '\r');
+ CHECK(form_feed == '\f');
+ }
+ SECTION("General chars"){
+ char space = ' ';
+ CHECK(space == ' ');
+ char chars[] = {'a', 'z', 'A', 'Z'};
+ for (int i = 0; i < 4; ++i){
+ char c = chars[i];
+ REQUIRE(c == chars[i]);
+ }
+ }
+ SECTION("Low ASCII"){
+ char null_terminator = '\0';
+ CHECK(null_terminator == '\0');
+ for (int i = 2; i < 6; ++i){
+ char c = static_cast<char>(i);
+ REQUIRE(c == i);
+ }
+ }
+}
+
+
+TEST_CASE( "Capture and info messages" ) {
+ SECTION("Capture should stringify like assertions") {
+ int i = 2;
+ CAPTURE(i);
+ REQUIRE(true);
+ }
+ SECTION("Info should NOT stringify the way assertions do") {
+ int i = 3;
+ INFO(i);
+ REQUIRE(true);
+ }
+}
+
+TEST_CASE( "std::map is convertible string", "[toString]" ) {
+
+ SECTION( "empty" ) {
+ std::map<std::string, int> emptyMap;
+
+ REQUIRE( Catch::Detail::stringify( emptyMap ) == "{ }" );
+ }
+
+ SECTION( "single item" ) {
+ std::map<std::string, int> map = { { "one", 1 } };
+
+ REQUIRE( Catch::Detail::stringify( map ) == "{ { \"one\", 1 } }" );
+ }
+
+ SECTION( "several items" ) {
+ std::map<std::string, int> map = {
+ { "abc", 1 },
+ { "def", 2 },
+ { "ghi", 3 }
+ };
+
+ REQUIRE( Catch::Detail::stringify( map ) == "{ { \"abc\", 1 }, { \"def\", 2 }, { \"ghi\", 3 } }" );
+ }
+}
+
+TEST_CASE( "std::set is convertible string", "[toString]" ) {
+
+ SECTION( "empty" ) {
+ std::set<std::string> emptySet;
+
+ REQUIRE( Catch::Detail::stringify( emptySet ) == "{ }" );
+ }
+
+ SECTION( "single item" ) {
+ std::set<std::string> set = { "one" };
+
+ REQUIRE( Catch::Detail::stringify( set ) == "{ \"one\" }" );
+ }
+
+ SECTION( "several items" ) {
+ std::set<std::string> set = { "abc", "def", "ghi" };
+
+ REQUIRE( Catch::Detail::stringify( set ) == "{ \"abc\", \"def\", \"ghi\" }" );
+ }
+}
+
+TEST_CASE("Static arrays are convertible to string", "[toString]") {
+ SECTION("Single item") {
+ int singular[1] = { 1 };
+ REQUIRE(Catch::Detail::stringify(singular) == "{ 1 }");
+ }
+ SECTION("Multiple") {
+ int arr[3] = { 3, 2, 1 };
+ REQUIRE(Catch::Detail::stringify(arr) == "{ 3, 2, 1 }");
+ }
+ SECTION("Non-trivial inner items") {
+ std::vector<std::string> arr[2] = { {"1:1", "1:2", "1:3"}, {"2:1", "2:2"} };
+ REQUIRE(Catch::Detail::stringify(arr) == R"({ { "1:1", "1:2", "1:3" }, { "2:1", "2:2" } })");
+ }
+}
diff --git a/projects/SelfTest/UsageTests/ToStringPair.tests.cpp b/projects/SelfTest/UsageTests/ToStringPair.tests.cpp
new file mode 100644
index 0000000..1445c54
--- /dev/null
+++ b/projects/SelfTest/UsageTests/ToStringPair.tests.cpp
@@ -0,0 +1,30 @@
+#define CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER
+#include "catch.hpp"
+
+TEST_CASE( "std::pair<int,std::string> -> toString", "[toString][pair]" ) {
+ std::pair<int,std::string> value( 34, "xyzzy" );
+ REQUIRE( ::Catch::Detail::stringify( value ) == "{ 34, \"xyzzy\" }" );
+}
+
+TEST_CASE( "std::pair<int,const std::string> -> toString", "[toString][pair]" ) {
+ std::pair<int,const std::string> value( 34, "xyzzy" );
+ REQUIRE( ::Catch::Detail::stringify(value) == "{ 34, \"xyzzy\" }" );
+}
+
+TEST_CASE( "std::vector<std::pair<std::string,int> > -> toString", "[toString][pair]" ) {
+ std::vector<std::pair<std::string,int> > pr;
+ pr.push_back( std::make_pair("green", 55 ) );
+ REQUIRE( ::Catch::Detail::stringify( pr ) == "{ { \"green\", 55 } }" );
+}
+
+// This is pretty contrived - I figure if this works, anything will...
+TEST_CASE( "pair<pair<int,const char *,pair<std::string,int> > -> toString", "[toString][pair]" ) {
+ typedef std::pair<int,const char *> left_t;
+ typedef std::pair<std::string,int> right_t;
+
+ left_t left( 42, "Arthur" );
+ right_t right( "Ford", 24 );
+
+ std::pair<left_t,right_t> pair( left, right );
+ REQUIRE( ::Catch::Detail::stringify( pair ) == "{ { 42, \"Arthur\" }, { \"Ford\", 24 } }" );
+}
diff --git a/projects/SelfTest/UsageTests/ToStringTuple.tests.cpp b/projects/SelfTest/UsageTests/ToStringTuple.tests.cpp
new file mode 100644
index 0000000..fe19ce0
--- /dev/null
+++ b/projects/SelfTest/UsageTests/ToStringTuple.tests.cpp
@@ -0,0 +1,47 @@
+#define CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER
+#include "catch.hpp"
+
+#include <tuple>
+
+TEST_CASE( "tuple<>", "[toString][tuple]" )
+{
+ typedef std::tuple<> type;
+ CHECK( "{ }" == ::Catch::Detail::stringify(type{}) );
+ type value {};
+ CHECK( "{ }" == ::Catch::Detail::stringify(value) );
+}
+
+TEST_CASE( "tuple<int>", "[toString][tuple]" )
+{
+ typedef std::tuple<int> type;
+ CHECK( "{ 0 }" == ::Catch::Detail::stringify(type{0}) );
+}
+
+
+TEST_CASE( "tuple<float,int>", "[toString][tuple]" )
+{
+ typedef std::tuple<float,int> type;
+ CHECK( "1.2f" == ::Catch::Detail::stringify(float(1.2)) );
+ CHECK( "{ 1.2f, 0 }" == ::Catch::Detail::stringify(type{1.2f,0}) );
+}
+
+TEST_CASE( "tuple<string,string>", "[toString][tuple]" )
+{
+ typedef std::tuple<std::string,std::string> type;
+ CHECK( "{ \"hello\", \"world\" }" == ::Catch::Detail::stringify(type{"hello","world"}) );
+}
+
+TEST_CASE( "tuple<tuple<int>,tuple<>,float>", "[toString][tuple]" )
+{
+ typedef std::tuple<std::tuple<int>,std::tuple<>,float> type;
+ type value { std::tuple<int>{42}, {}, 1.2f };
+ CHECK( "{ { 42 }, { }, 1.2f }" == ::Catch::Detail::stringify(value) );
+}
+
+TEST_CASE( "tuple<nullptr,int,const char *>", "[toString][tuple]" )
+{
+ typedef std::tuple<std::nullptr_t,int,const char *> type;
+ type value { nullptr, 42, "Catch me" };
+ CHECK( "{ nullptr, 42, \"Catch me\" }" == ::Catch::Detail::stringify(value) );
+}
+
diff --git a/projects/SelfTest/UsageTests/ToStringVector.tests.cpp b/projects/SelfTest/UsageTests/ToStringVector.tests.cpp
new file mode 100644
index 0000000..18e56c0
--- /dev/null
+++ b/projects/SelfTest/UsageTests/ToStringVector.tests.cpp
@@ -0,0 +1,86 @@
+#include "catch.hpp"
+#include <vector>
+#include <array>
+
+// vedctor
+TEST_CASE( "vector<int> -> toString", "[toString][vector]" )
+{
+ std::vector<int> vv;
+ REQUIRE( ::Catch::Detail::stringify(vv) == "{ }" );
+ vv.push_back( 42 );
+ REQUIRE( ::Catch::Detail::stringify(vv) == "{ 42 }" );
+ vv.push_back( 250 );
+ REQUIRE( ::Catch::Detail::stringify(vv) == "{ 42, 250 }" );
+}
+
+TEST_CASE( "vector<string> -> toString", "[toString][vector]" )
+{
+ std::vector<std::string> vv;
+ REQUIRE( ::Catch::Detail::stringify(vv) == "{ }" );
+ vv.push_back( "hello" );
+ REQUIRE( ::Catch::Detail::stringify(vv) == "{ \"hello\" }" );
+ vv.push_back( "world" );
+ REQUIRE( ::Catch::Detail::stringify(vv) == "{ \"hello\", \"world\" }" );
+}
+
+namespace {
+ /* Minimal Allocator */
+ template<typename T>
+ struct minimal_allocator {
+ using value_type = T;
+ using size_type = std::size_t;
+
+ minimal_allocator() = default;
+ template <typename U>
+ minimal_allocator(const minimal_allocator<U>&) {}
+
+
+ T *allocate( size_type n ) {
+ return static_cast<T *>( ::operator new( n * sizeof(T) ) );
+ }
+ void deallocate( T *p, size_type /*n*/ ) {
+ ::operator delete( static_cast<void *>(p) );
+ }
+ template<typename U>
+ bool operator==( const minimal_allocator<U>& ) const { return true; }
+ template<typename U>
+ bool operator!=( const minimal_allocator<U>& ) const { return false; }
+ };
+}
+
+TEST_CASE( "vector<int,allocator> -> toString", "[toString][vector,allocator]" ) {
+ std::vector<int,minimal_allocator<int> > vv;
+ REQUIRE( ::Catch::Detail::stringify(vv) == "{ }" );
+ vv.push_back( 42 );
+ REQUIRE( ::Catch::Detail::stringify(vv) == "{ 42 }" );
+ vv.push_back( 250 );
+ REQUIRE( ::Catch::Detail::stringify(vv) == "{ 42, 250 }" );
+}
+
+TEST_CASE( "vec<vec<string,alloc>> -> toString", "[toString][vector,allocator]" ) {
+ using inner = std::vector<std::string, minimal_allocator<std::string>>;
+ using vector = std::vector<inner>;
+ vector v;
+ REQUIRE( ::Catch::Detail::stringify(v) == "{ }" );
+ v.push_back( inner { "hello" } );
+ v.push_back( inner { "world" } );
+ REQUIRE( ::Catch::Detail::stringify(v) == "{ { \"hello\" }, { \"world\" } }" );
+}
+
+// Based on PR by mat-so: https://github.com/catchorg/Catch2/pull/606/files#diff-43562f40f8c6dcfe2c54557316e0f852
+TEST_CASE( "vector<bool> -> toString", "[toString][containers][vector]" ) {
+ std::vector<bool> bools;
+ REQUIRE( ::Catch::Detail::stringify(bools) == "{ }");
+ bools.push_back(true);
+ REQUIRE( ::Catch::Detail::stringify(bools) == "{ true }");
+ bools.push_back(false);
+ REQUIRE( ::Catch::Detail::stringify(bools) == "{ true, false }");
+}
+TEST_CASE( "array<int, N> -> toString", "[toString][containers][array]" ) {
+ std::array<int, 0> empty;
+ REQUIRE( Catch::Detail::stringify( empty ) == "{ }" );
+ std::array<int, 1> oneValue = {{ 42 }};
+ REQUIRE( Catch::Detail::stringify( oneValue ) == "{ 42 }" );
+ std::array<int, 2> twoValues = {{ 42, 250 }};
+ REQUIRE( Catch::Detail::stringify( twoValues ) == "{ 42, 250 }" );
+}
\ No newline at end of file
diff --git a/projects/SelfTest/UsageTests/ToStringWhich.tests.cpp b/projects/SelfTest/UsageTests/ToStringWhich.tests.cpp
new file mode 100644
index 0000000..fe96186
--- /dev/null
+++ b/projects/SelfTest/UsageTests/ToStringWhich.tests.cpp
@@ -0,0 +1,146 @@
+#include "catch.hpp"
+/*
+ Demonstrate which version of toString/StringMaker is being used
+ for various types
+*/
+
+
+struct has_operator { };
+struct has_maker {};
+struct has_maker_and_operator {};
+
+std::ostream& operator<<(std::ostream& os, const has_operator&) {
+ os << "operator<<( has_operator )";
+ return os;
+}
+
+std::ostream& operator<<(std::ostream& os, const has_maker_and_operator&) {
+ os << "operator<<( has_maker_and_operator )";
+ return os;
+}
+
+namespace Catch {
+ template<>
+ struct StringMaker<has_maker> {
+ static std::string convert( const has_maker& ) {
+ return "StringMaker<has_maker>";
+ }
+ };
+ template<>
+ struct StringMaker<has_maker_and_operator> {
+ static std::string convert( const has_maker_and_operator& ) {
+ return "StringMaker<has_maker_and_operator>";
+ }
+ };
+}
+
+// Call the operator
+TEST_CASE( "stringify( has_operator )", "[toString]" ) {
+ has_operator item;
+ REQUIRE( ::Catch::Detail::stringify( item ) == "operator<<( has_operator )" );
+}
+
+// Call the stringmaker
+TEST_CASE( "stringify( has_maker )", "[toString]" ) {
+ has_maker item;
+ REQUIRE( ::Catch::Detail::stringify( item ) == "StringMaker<has_maker>" );
+}
+
+// Call the stringmaker
+TEST_CASE( "stringify( has_maker_and_toString )", "[.][toString]" ) {
+ has_maker_and_operator item;
+ REQUIRE( ::Catch::Detail::stringify( item ) == "StringMaker<has_maker_and_operator>" );
+}
+
+// Vectors...
+
+// Don't run this in approval tests as it is sensitive to two phase lookup differences
+TEST_CASE( "toString( vectors<has_operator> )", "[toString]" ) {
+ std::vector<has_operator> v(1);
+ REQUIRE( ::Catch::Detail::stringify( v ) == "{ operator<<( has_operator ) }" );
+}
+
+TEST_CASE( "toString( vectors<has_maker> )", "[toString]" ) {
+ std::vector<has_maker> v(1);
+ REQUIRE( ::Catch::Detail::stringify( v ) == "{ StringMaker<has_maker> }" );
+}
+
+
+// Don't run this in approval tests as it is sensitive to two phase lookup differences
+TEST_CASE( "toString( vectors<has_maker_and_operator> )", "[toString]" ) {
+ std::vector<has_maker_and_operator> v(1);
+ REQUIRE( ::Catch::Detail::stringify( v ) == "{ StringMaker<has_maker_and_operator> }" );
+}
+
+// Conversion should go
+// StringMaker specialization, operator<<, range/enum detection, unprintable
+struct int_iterator {
+ using iterator_category = std::input_iterator_tag;
+ using difference_type = std::ptrdiff_t;
+ using value_type = int;
+ using reference = int&;
+ using pointer = int*;
+
+ int_iterator() = default;
+ int_iterator(int i) :val(i) {}
+
+ value_type operator*() const { return val; }
+ bool operator==(int_iterator rhs) const { return val == rhs.val; }
+ bool operator!=(int_iterator rhs) const { return val != rhs.val; }
+ int_iterator operator++() { ++val; return *this; }
+ int_iterator operator++(int) {
+ auto temp(*this);
+ ++val;
+ return temp;
+ }
+private:
+ int val = 5;
+};
+
+struct streamable_range {
+ int_iterator begin() const { return int_iterator{ 1 }; }
+ int_iterator end() const { return {}; }
+};
+
+std::ostream& operator<<(std::ostream& os, const streamable_range&) {
+ os << "op<<(streamable_range)";
+ return os;
+}
+
+struct stringmaker_range {
+ int_iterator begin() const { return int_iterator{ 1 }; }
+ int_iterator end() const { return {}; }
+};
+
+namespace Catch {
+template <>
+struct StringMaker<stringmaker_range> {
+ static std::string convert(stringmaker_range const&) {
+ return "stringmaker(streamable_range)";
+ }
+};
+}
+
+struct just_range {
+ int_iterator begin() const { return int_iterator{ 1 }; }
+ int_iterator end() const { return {}; }
+};
+
+struct disabled_range {
+ int_iterator begin() const { return int_iterator{ 1 }; }
+ int_iterator end() const { return {}; }
+};
+
+namespace Catch {
+template <>
+struct is_range<disabled_range> {
+ static const bool value = false;
+};
+}
+
+TEST_CASE("toString streamable range", "[toString]") {
+ REQUIRE(::Catch::Detail::stringify(streamable_range{}) == "op<<(streamable_range)");
+ REQUIRE(::Catch::Detail::stringify(stringmaker_range{}) == "stringmaker(streamable_range)");
+ REQUIRE(::Catch::Detail::stringify(just_range{}) == "{ 1, 2, 3, 4 }");
+ REQUIRE(::Catch::Detail::stringify(disabled_range{}) == "{?}");
+}
diff --git a/projects/SelfTest/UsageTests/Tricky.tests.cpp b/projects/SelfTest/UsageTests/Tricky.tests.cpp
new file mode 100644
index 0000000..1c352ce
--- /dev/null
+++ b/projects/SelfTest/UsageTests/Tricky.tests.cpp
@@ -0,0 +1,448 @@
+/*
+ * Created by Phil on 09/11/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+
+#ifdef __clang__
+#pragma clang diagnostic ignored "-Wpadded"
+#endif
+
+#ifdef _MSC_VER
+#pragma warning (disable : 4702) // Disable unreachable code warning for the last test
+ // that is triggered when compiling as Win32|Release
+#endif
+
+#include "catch.hpp"
+
+#include <stdio.h>
+#include <sstream>
+
+namespace Catch {
+ std::string toString( const std::pair<int, int>& value ) {
+ std::ostringstream oss;
+ oss << "std::pair( " << value.first << ", " << value.second << " )";
+ return oss.str();
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+TEST_CASE
+(
+ "Parsing a std::pair",
+ "[Tricky][std::pair]"
+)
+{
+ std::pair<int, int> aNicePair( 1, 2 );
+
+ REQUIRE( (std::pair<int, int>( 1, 2 )) == aNicePair );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+TEST_CASE
+(
+ "Where there is more to the expression after the RHS",
+ "[Tricky][failing][.]"
+)
+{
+// int a = 1, b = 2;
+// REQUIRE( a == 2 || b == 2 );
+ WARN( "Uncomment the code in this test to check that it gives a sensible compiler error" );
+}
+///////////////////////////////////////////////////////////////////////////////
+TEST_CASE
+(
+ "Where the LHS is not a simple value",
+ "[Tricky][failing][.]"
+)
+{
+ /*
+ int a = 1;
+ int b = 2;
+
+ // This only captures part of the expression, but issues a warning about the rest
+ REQUIRE( a+1 == b-1 );
+ */
+ WARN( "Uncomment the code in this test to check that it gives a sensible compiler error" );
+}
+
+struct Opaque
+{
+ int val;
+ bool operator ==( const Opaque& o ) const
+ {
+ return val == o.val;
+ }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+TEST_CASE
+(
+ "A failing expression with a non streamable type is still captured",
+ "[Tricky][failing][.]"
+)
+{
+
+ Opaque o1, o2;
+ o1.val = 7;
+ o2.val = 8;
+
+ CHECK( &o1 == &o2 );
+ CHECK( o1 == o2 );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+TEST_CASE
+(
+ "string literals of different sizes can be compared",
+ "[Tricky][failing][.]"
+)
+{
+ REQUIRE( std::string( "first" ) == "second" );
+
+}
+
+///////////////////////////////////////////////////////////////////////////////
+TEST_CASE
+(
+ "An expression with side-effects should only be evaluated once",
+ "[Tricky]"
+)
+{
+ int i = 7;
+
+ REQUIRE( i++ == 7 );
+ REQUIRE( i++ == 8 );
+
+}
+
+namespace A {
+ struct X
+ {
+ X() : a(4), b(2), c(7) {}
+ X(int v) : a(v), b(2), c(7) {}
+ int a;
+ int b;
+ int c;
+ };
+}
+
+namespace B {
+ struct Y
+ {
+ Y() : a(4), b(2), c(7) {}
+ Y(int v) : a(v), b(2), c(7) {}
+ int a;
+ int b;
+ int c;
+ };
+}
+
+inline bool operator==(const A::X& lhs, const B::Y& rhs)
+{
+ return (lhs.a == rhs.a);
+}
+
+inline bool operator==(const B::Y& lhs, const A::X& rhs)
+{
+ return (lhs.a == rhs.a);
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+/* This, currently, does not compile with LLVM
+TEST_CASE
+(
+ "Operators at different namespace levels not hijacked by Koenig lookup"
+ "[Tricky]"
+)
+{
+ A::X x;
+ B::Y y;
+ REQUIRE( x == y );
+}
+*/
+
+namespace ObjectWithConversions
+{
+ struct Object
+ {
+ operator unsigned int() const {return 0xc0000000;}
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
+ TEST_CASE
+ (
+ "Operators at different namespace levels not hijacked by Koenig lookup",
+ "[Tricky][approvals]"
+ )
+ {
+ Object o;
+ REQUIRE(0xc0000000 == o );
+ }
+}
+
+namespace EnumBitFieldTests
+{
+ enum Bits : uint32_t {
+ bit0 = 0x0001,
+ bit1 = 0x0002,
+ bit2 = 0x0004,
+ bit3 = 0x0008,
+ bit1and2 = bit1 | bit2,
+ bit30 = 0x40000000,
+ bit31 = 0x80000000,
+ bit30and31 = bit30 | bit31
+ };
+
+ TEST_CASE( "Test enum bit values", "[Tricky]" )
+ {
+ REQUIRE( 0xc0000000 == bit30and31 );
+ }
+}
+
+struct Obj
+{
+ Obj():prop(&p){}
+
+ int p;
+ int* prop;
+};
+
+TEST_CASE("boolean member", "[Tricky]")
+{
+ Obj obj;
+ REQUIRE( obj.prop != nullptr );
+}
+
+// Tests for a problem submitted by Ralph McArdell
+//
+// The static bool value should not need to be defined outside the
+// struct it is declared in - but when evaluating it in a deduced
+// context it appears to require the extra definition.
+// The issue was fixed by adding bool overloads to bypass the
+// templates that were there to deduce it.
+template <bool B>
+struct is_true
+{
+ static const bool value = B;
+};
+
+TEST_CASE( "(unimplemented) static bools can be evaluated", "[Tricky]" )
+{
+ SECTION("compare to true","")
+ {
+ REQUIRE( is_true<true>::value == true );
+ REQUIRE( true == is_true<true>::value );
+ }
+ SECTION("compare to false","")
+ {
+ REQUIRE( is_true<false>::value == false );
+ REQUIRE( false == is_true<false>::value );
+ }
+
+ SECTION("negation", "")
+ {
+ REQUIRE( !is_true<false>::value );
+ }
+
+ SECTION("double negation","")
+ {
+ REQUIRE( !!is_true<true>::value );
+ }
+
+ SECTION("direct","")
+ {
+ REQUIRE( is_true<true>::value );
+ REQUIRE_FALSE( is_true<false>::value );
+ }
+}
+
+// Uncomment these tests to produce an error at test registration time
+/*
+TEST_CASE( "Tests with the same name are not allowed", "[Tricky]" )
+{
+
+}
+TEST_CASE( "Tests with the same name are not allowed", "[Tricky]" )
+{
+
+}
+*/
+
+struct Boolable
+{
+ explicit Boolable( bool value ) : m_value( value ) {}
+
+ explicit operator bool() const {
+ return m_value;
+ }
+
+ bool m_value;
+};
+
+TEST_CASE( "Objects that evaluated in boolean contexts can be checked", "[Tricky][SafeBool]" )
+{
+ Boolable True( true );
+ Boolable False( false );
+
+ CHECK( True );
+ CHECK( !False );
+ CHECK_FALSE( False );
+}
+
+TEST_CASE( "Assertions then sections", "[Tricky]" )
+{
+ // This was causing a failure due to the way the console reporter was handling
+ // the current section
+
+ REQUIRE( true );
+
+ SECTION( "A section" )
+ {
+ REQUIRE( true );
+
+ SECTION( "Another section" )
+ {
+ REQUIRE( true );
+ }
+ SECTION( "Another other section" )
+ {
+ REQUIRE( true );
+ }
+ }
+}
+
+struct Awkward
+{
+ operator int() const { return 7; }
+};
+
+TEST_CASE( "non streamable - with conv. op", "[Tricky]" )
+{
+ Awkward awkward;
+ std::string s = ::Catch::Detail::stringify( awkward );
+ REQUIRE( s == "7" );
+}
+
+inline void foo() {}
+
+typedef void (*fooptr_t)();
+
+TEST_CASE( "Comparing function pointers", "[Tricky][function pointer]" )
+{
+ // This was giving a warning in VS2010
+ // #179
+ fooptr_t a = foo;
+
+ REQUIRE( a );
+ REQUIRE( a == &foo );
+}
+
+struct S
+{
+ void f() {}
+};
+
+
+TEST_CASE( "Comparing member function pointers", "[Tricky][member function pointer][approvals]" )
+{
+ typedef void (S::*MF)();
+ MF m = &S::f;
+
+ CHECK( m == &S::f );
+}
+
+class ClassName {};
+
+TEST_CASE( "pointer to class", "[Tricky]" )
+{
+ ClassName *p = 0;
+ REQUIRE( p == 0 );
+}
+
+#include <memory>
+
+TEST_CASE( "null_ptr", "[Tricky]" )
+{
+ std::unique_ptr<int> ptr;
+ REQUIRE(ptr.get() == nullptr);
+}
+
+TEST_CASE( "X/level/0/a", "[Tricky]" ) { SUCCEED(""); }
+TEST_CASE( "X/level/0/b", "[Tricky][fizz]" ){ SUCCEED(""); }
+TEST_CASE( "X/level/1/a", "[Tricky]" ) { SUCCEED(""); }
+TEST_CASE( "X/level/1/b", "[Tricky]" ) { SUCCEED(""); }
+
+TEST_CASE( "has printf" ) {
+
+ // This can cause problems as, currently, stdout itself is not redirected - only the cout (and cerr) buffer
+ printf( "loose text artifact\n" );
+}
+
+namespace {
+ struct constructor_throws {
+ [[noreturn]] constructor_throws() {
+ throw 1;
+ }
+ };
+}
+
+TEST_CASE("Commas in various macros are allowed") {
+ REQUIRE_THROWS( std::vector<constructor_throws>{constructor_throws{}, constructor_throws{}} );
+ CHECK_THROWS( std::vector<constructor_throws>{constructor_throws{}, constructor_throws{}} );
+ REQUIRE_NOTHROW( std::vector<int>{1, 2, 3} == std::vector<int>{1, 2, 3} );
+ CHECK_NOTHROW( std::vector<int>{1, 2, 3} == std::vector<int>{1, 2, 3} );
+
+ REQUIRE(std::vector<int>{1, 2} == std::vector<int>{1, 2});
+ CHECK( std::vector<int>{1, 2} == std::vector<int>{1, 2} );
+ REQUIRE_FALSE(std::vector<int>{1, 2} == std::vector<int>{1, 2, 3});
+ CHECK_FALSE( std::vector<int>{1, 2} == std::vector<int>{1, 2, 3} );
+
+ CHECK_NOFAIL( std::vector<int>{1, 2} == std::vector<int>{1, 2} );
+ CHECKED_IF( std::vector<int>{1, 2} == std::vector<int>{1, 2} ) {
+ REQUIRE(true);
+ } CHECKED_ELSE( std::vector<int>{1, 2} == std::vector<int>{1, 2} ) {
+ CHECK(true);
+ }
+}
+
+TEST_CASE( "null deref", "[.][failing][!nonportable]" ) {
+ CHECK( false );
+ int *x = NULL;
+ *x = 1;
+}
+
+TEST_CASE( "non-copyable objects", "[.][failing]" ) {
+ // Thanks to Agustin Bergé (@k-ballo on the cpplang Slack) for raising this
+ std::type_info const& ti = typeid(int);
+ CHECK( ti == typeid(int) );
+}
+
+// #925
+using signal_t = void (*) (void*);
+
+struct TestClass {
+ signal_t testMethod_uponComplete_arg = nullptr;
+};
+
+namespace utility {
+ inline static void synchronizing_callback( void * ) { }
+}
+
+TEST_CASE("#925: comparing function pointer to function address failed to compile", "[!nonportable]" ) {
+
+ TestClass test;
+ REQUIRE(utility::synchronizing_callback != test.testMethod_uponComplete_arg);
+}
+
+TEST_CASE( "Bitfields can be captured (#1027)" ) {
+ struct Y {
+ uint32_t v : 1;
+ };
+ Y y{ 0 };
+ REQUIRE( y.v == 0 );
+ REQUIRE( 0 == y.v );
+}
diff --git a/projects/SelfTest/UsageTests/VariadicMacros.tests.cpp b/projects/SelfTest/UsageTests/VariadicMacros.tests.cpp
new file mode 100644
index 0000000..fd651c5
--- /dev/null
+++ b/projects/SelfTest/UsageTests/VariadicMacros.tests.cpp
@@ -0,0 +1,29 @@
+/*
+ * Created by Phil on 15/03/2013.
+ * Copyright 2013 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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.hpp"
+
+
+TEST_CASE()
+{
+ SUCCEED( "anonymous test case" );
+}
+
+TEST_CASE( "Test case with one argument" )
+{
+ SUCCEED( "no assertions" );
+}
+
+TEST_CASE( "Variadic macros", "[variadic][sections]" )
+{
+ SECTION( "Section with one argument" )
+ {
+ SUCCEED( "no assertions" );
+ }
+}
+
diff --git a/projects/Where did the projects go.txt b/projects/Where did the projects go.txt
new file mode 100644
index 0000000..c7b011d
--- /dev/null
+++ b/projects/Where did the projects go.txt
@@ -0,0 +1,13 @@
+The canonical project format is now CMake.
+To generate an XCode or Visual Studio project you'll need CMake, which you can download from https://cmake.org if necessary.
+
+To generate the project files open a terminal/ console within the projects directory (where this file is located), create a directory called "Generated" (using mkdir or md), cd into it, then type:
+
+CMake -G <project format> ../..
+
+Where <project format> is XCode for XCode projects, or "Visual Studio 14" for Visual Studio 2015 (replace 14 with the major version number for any other supported Visual Studio version - or execute CMake -help for the full list)
+
+Remember to re-run CMake any time you pull from GitHub.
+Note that the projects/Generated folder is excluded in .gitignore. So it is recommended to use this.
+
+CMake can also generate make files or projects for other build systems. Run CMake -help for the full set of options.
diff --git a/projects/XCode/OCTest/OCTest.xcodeproj/project.pbxproj b/projects/XCode/OCTest/OCTest.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..91e2cd9
--- /dev/null
+++ b/projects/XCode/OCTest/OCTest.xcodeproj/project.pbxproj
@@ -0,0 +1,267 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 4A5C29AA1F715603007CB94C /* catch_objc_impl.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4A5C29A91F715603007CB94C /* catch_objc_impl.mm */; };
+ 4A63D2AC14E3C1A900F615CB /* OCTest.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4A63D2AB14E3C1A900F615CB /* OCTest.1 */; };
+ 4A63D2B314E3C1E600F615CB /* Main.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4A63D2B214E3C1E600F615CB /* Main.mm */; };
+ 4A63D2C014E4544700F615CB /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4A63D2BF14E4544700F615CB /* Foundation.framework */; };
+ 4A63D2C614E454CC00F615CB /* CatchOCTestCase.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4A63D2C214E454CC00F615CB /* CatchOCTestCase.mm */; };
+ 4A63D2C714E454CC00F615CB /* OCTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4A63D2C314E454CC00F615CB /* OCTest.mm */; };
+ 4A63D2C814E454CC00F615CB /* TestObj.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A63D2C514E454CC00F615CB /* TestObj.m */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ 4A63D2A314E3C1A900F615CB /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = /usr/share/man/man1/;
+ dstSubfolderSpec = 0;
+ files = (
+ 4A63D2AC14E3C1A900F615CB /* OCTest.1 in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+ 4A5C29A91F715603007CB94C /* catch_objc_impl.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = catch_objc_impl.mm; sourceTree = "<group>"; };
+ 4A63D2A514E3C1A900F615CB /* OCTest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = OCTest; sourceTree = BUILT_PRODUCTS_DIR; };
+ 4A63D2AB14E3C1A900F615CB /* OCTest.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = OCTest.1; sourceTree = "<group>"; };
+ 4A63D2B214E3C1E600F615CB /* Main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Main.mm; sourceTree = "<group>"; };
+ 4A63D2BF14E4544700F615CB /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ 4A63D2C114E454CC00F615CB /* CatchOCTestCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CatchOCTestCase.h; sourceTree = "<group>"; };
+ 4A63D2C214E454CC00F615CB /* CatchOCTestCase.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CatchOCTestCase.mm; sourceTree = "<group>"; };
+ 4A63D2C314E454CC00F615CB /* OCTest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OCTest.mm; sourceTree = "<group>"; };
+ 4A63D2C414E454CC00F615CB /* TestObj.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestObj.h; sourceTree = "<group>"; };
+ 4A63D2C514E454CC00F615CB /* TestObj.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestObj.m; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 4A63D2A214E3C1A900F615CB /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 4A63D2C014E4544700F615CB /* Foundation.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 4A63D29A14E3C1A900F615CB = {
+ isa = PBXGroup;
+ children = (
+ 4AA0D94F154C0A63004B4193 /* Catch */,
+ 4A63D2BF14E4544700F615CB /* Foundation.framework */,
+ 4A63D2A814E3C1A900F615CB /* OCTest */,
+ 4A63D2A614E3C1A900F615CB /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ 4A63D2A614E3C1A900F615CB /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 4A63D2A514E3C1A900F615CB /* OCTest */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 4A63D2A814E3C1A900F615CB /* OCTest */ = {
+ isa = PBXGroup;
+ children = (
+ 4A63D2C114E454CC00F615CB /* CatchOCTestCase.h */,
+ 4A63D2C214E454CC00F615CB /* CatchOCTestCase.mm */,
+ 4A63D2C314E454CC00F615CB /* OCTest.mm */,
+ 4A63D2C414E454CC00F615CB /* TestObj.h */,
+ 4A63D2C514E454CC00F615CB /* TestObj.m */,
+ 4A63D2B214E3C1E600F615CB /* Main.mm */,
+ 4A63D2AB14E3C1A900F615CB /* OCTest.1 */,
+ );
+ path = OCTest;
+ sourceTree = "<group>";
+ };
+ 4AA0D94F154C0A63004B4193 /* Catch */ = {
+ isa = PBXGroup;
+ children = (
+ 4A5C29A91F715603007CB94C /* catch_objc_impl.mm */,
+ );
+ name = Catch;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 4A63D2A414E3C1A900F615CB /* OCTest */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 4A63D2AF14E3C1A900F615CB /* Build configuration list for PBXNativeTarget "OCTest" */;
+ buildPhases = (
+ 4A63D2A114E3C1A900F615CB /* Sources */,
+ 4A63D2A214E3C1A900F615CB /* Frameworks */,
+ 4A63D2A314E3C1A900F615CB /* CopyFiles */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = OCTest;
+ productName = OCTest;
+ productReference = 4A63D2A514E3C1A900F615CB /* OCTest */;
+ productType = "com.apple.product-type.tool";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 4A63D29C14E3C1A900F615CB /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0500;
+ };
+ buildConfigurationList = 4A63D29F14E3C1A900F615CB /* Build configuration list for PBXProject "OCTest" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ );
+ mainGroup = 4A63D29A14E3C1A900F615CB;
+ productRefGroup = 4A63D2A614E3C1A900F615CB /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 4A63D2A414E3C1A900F615CB /* OCTest */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 4A63D2A114E3C1A900F615CB /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 4A63D2B314E3C1E600F615CB /* Main.mm in Sources */,
+ 4A5C29AA1F715603007CB94C /* catch_objc_impl.mm in Sources */,
+ 4A63D2C614E454CC00F615CB /* CatchOCTestCase.mm in Sources */,
+ 4A63D2C714E454CC00F615CB /* OCTest.mm in Sources */,
+ 4A63D2C814E454CC00F615CB /* TestObj.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ 4A63D2AD14E3C1A900F615CB /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ COPY_PHASE_STRIP = NO;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = ../../../include;
+ MACOSX_DEPLOYMENT_TARGET = 10.7;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = macosx;
+ };
+ name = Debug;
+ };
+ 4A63D2AE14E3C1A900F615CB /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ COPY_PHASE_STRIP = YES;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = ../../../include;
+ MACOSX_DEPLOYMENT_TARGET = 10.7;
+ SDKROOT = macosx;
+ };
+ name = Release;
+ };
+ 4A63D2B014E3C1A900F615CB /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_OBJC_ARC = YES;
+ HEADER_SEARCH_PATHS = ../../../include;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ 4A63D2B114E3C1A900F615CB /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_OBJC_ARC = YES;
+ HEADER_SEARCH_PATHS = ../../../include;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 4A63D29F14E3C1A900F615CB /* Build configuration list for PBXProject "OCTest" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 4A63D2AD14E3C1A900F615CB /* Debug */,
+ 4A63D2AE14E3C1A900F615CB /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 4A63D2AF14E3C1A900F615CB /* Build configuration list for PBXNativeTarget "OCTest" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 4A63D2B014E3C1A900F615CB /* Debug */,
+ 4A63D2B114E3C1A900F615CB /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 4A63D29C14E3C1A900F615CB /* Project object */;
+}
diff --git a/projects/XCode/OCTest/OCTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/projects/XCode/OCTest/OCTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 0000000..119e61c
--- /dev/null
+++ b/projects/XCode/OCTest/OCTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "self:OCTest.xcodeproj">
+ </FileRef>
+</Workspace>
diff --git a/projects/XCode/OCTest/OCTest/CatchOCTestCase.h b/projects/XCode/OCTest/OCTest/CatchOCTestCase.h
new file mode 100644
index 0000000..bd26239
--- /dev/null
+++ b/projects/XCode/OCTest/OCTest/CatchOCTestCase.h
@@ -0,0 +1,25 @@
+//
+// CatchOCTestCase.h
+// OCTest
+//
+// Created by Phil on 13/11/2010.
+// Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+//
+// 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)
+#ifndef TWOBLUECUBES_CATCHOCTESTCASE_H_INCLUDED
+#define TWOBLUECUBES_CATCHOCTESTCASE_H_INCLUDED
+
+#include "catch.hpp"
+
+#import <Cocoa/Cocoa.h>
+#import "TestObj.h"
+
+@interface TestFixture : NSObject <OcFixture>
+{
+ TestObj* obj;
+}
+
+@end
+
+#endif // TWOBLUECUBES_CATCHOCTESTCASE_H_INCLUDED
diff --git a/projects/XCode/OCTest/OCTest/CatchOCTestCase.mm b/projects/XCode/OCTest/OCTest/CatchOCTestCase.mm
new file mode 100644
index 0000000..9bd1fa0
--- /dev/null
+++ b/projects/XCode/OCTest/OCTest/CatchOCTestCase.mm
@@ -0,0 +1,87 @@
+//
+// CatchOCTestCase.mm
+// OCTest
+//
+// Created by Phil Nash on 13/11/2010.
+// Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+//
+// 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)
+
+#import "CatchOCTestCase.h"
+
+
+@implementation TestFixture
+
+
+-(void) setUp
+{
+ obj = [[TestObj alloc] init];
+}
+
+-(void) tearDown
+{
+ arcSafeRelease( obj );
+}
+
+OC_TEST_CASE( "This is a test case", "" )
+{
+ REQUIRE( obj.int_val == 0 );
+
+ obj.int_val = 1;
+
+ REQUIRE( obj.int_val == 1 );
+}
+
+OC_TEST_CASE( "This is another test case", "" )
+{
+ REQUIRE( obj.int_val == 0 );
+
+ obj.int_val = 2;
+
+ REQUIRE( obj.int_val == 2 );
+}
+
+OC_TEST_CASE( "tests a boolean value", "[!shouldfail]" )
+{
+ CHECK( [obj isTrue] == NO );
+ CHECK( [obj isFalse] == YES );
+}
+
+OC_TEST_CASE( "throws an Objective-C exception", "[!throws][!shouldfail]" )
+{
+ @throw [[NSException alloc] initWithName: NSGenericException
+ reason: @"Objective-C exception"
+ userInfo: nil];
+}
+OC_TEST_CASE( "throws a std c++ exception", "[!throws][!shouldfail]" )
+{
+ throw std::domain_error( "std C++ exception" );
+}
+
+///////////////////////////////////////////////////////////////////////////
+template<typename T>
+void useObject( const T& object ){}
+
+template<typename T>
+void useObject( const T* object ){}
+
+OC_TEST_CASE( "Matches work with OC types (NSString so far)", "[!shouldfail]" )
+{
+ using namespace Catch::Matchers;
+
+ REQUIRE_THAT( @"This is a string", Equals( @"This isnt a string" ) );
+ REQUIRE_THAT( @"This is a string", Contains( @"is a" ) );
+ REQUIRE_THAT( @"This is a string", StartsWith( @"This" ) );
+ REQUIRE_THAT( @"This is a string", EndsWith( @"string" ) );
+}
+
+OC_TEST_CASE( "nil NSString should not crash the test", "[!shouldfail]" )
+{
+ using namespace Catch::Matchers;
+
+ CHECK_THAT( (NSString*)nil, Equals( @"This should fail, but not crash" ) );
+ CHECK_THAT( (NSString*)nil, StartsWith( @"anything" ) );
+}
+
+@end
diff --git a/projects/XCode/OCTest/OCTest/Main.mm b/projects/XCode/OCTest/OCTest/Main.mm
new file mode 100644
index 0000000..569dc4d
--- /dev/null
+++ b/projects/XCode/OCTest/OCTest/Main.mm
@@ -0,0 +1,2 @@
+#define CATCH_CONFIG_MAIN
+#import "catch.hpp"
diff --git a/projects/XCode/OCTest/OCTest/OCTest.1 b/projects/XCode/OCTest/OCTest/OCTest.1
new file mode 100644
index 0000000..38afeb5
--- /dev/null
+++ b/projects/XCode/OCTest/OCTest/OCTest.1
@@ -0,0 +1,79 @@
+.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples.
+.\"See Also:
+.\"man mdoc.samples for a complete listing of options
+.\"man mdoc for the short list of editing options
+.\"/usr/share/misc/mdoc.template
+.Dd 09/02/2012 \" DATE
+.Dt OCTest 1 \" Program name and manual section number
+.Os Darwin
+.Sh NAME \" Section Header - required - don't modify
+.Nm OCTest,
+.\" The following lines are read in generating the apropos(man -k) database. Use only key
+.\" words here as the database is built based on the words here and in the .ND line.
+.Nm Other_name_for_same_program(),
+.Nm Yet another name for the same program.
+.\" Use .Nm macro to designate other names for the documented program.
+.Nd This line parsed for whatis database.
+.Sh SYNOPSIS \" Section Header - required - don't modify
+.Nm
+.Op Fl abcd \" [-abcd]
+.Op Fl a Ar path \" [-a path]
+.Op Ar file \" [file]
+.Op Ar \" [file ...]
+.Ar arg0 \" Underlined argument - use .Ar anywhere to underline
+arg2 ... \" Arguments
+.Sh DESCRIPTION \" Section Header - required - don't modify
+Use the .Nm macro to refer to your program throughout the man page like such:
+.Nm
+Underlining is accomplished with the .Ar macro like this:
+.Ar underlined text .
+.Pp \" Inserts a space
+A list of items with descriptions:
+.Bl -tag -width -indent \" Begins a tagged list
+.It item a \" Each item preceded by .It macro
+Description of item a
+.It item b
+Description of item b
+.El \" Ends the list
+.Pp
+A list of flags and their descriptions:
+.Bl -tag -width -indent \" Differs from above in tag removed
+.It Fl a \"-a flag as a list item
+Description of -a flag
+.It Fl b
+Description of -b flag
+.El \" Ends the list
+.Pp
+.\" .Sh ENVIRONMENT \" May not be needed
+.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1
+.\" .It Ev ENV_VAR_1
+.\" Description of ENV_VAR_1
+.\" .It Ev ENV_VAR_2
+.\" Description of ENV_VAR_2
+.\" .El
+.Sh FILES \" File used or created by the topic of the man page
+.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact
+.It Pa /usr/share/file_name
+FILE_1 description
+.It Pa /Users/joeuser/Library/really_long_file_name
+FILE_2 description
+.El \" Ends the list
+.\" .Sh DIAGNOSTICS \" May not be needed
+.\" .Bl -diag
+.\" .It Diagnostic Tag
+.\" Diagnostic informtion here.
+.\" .It Diagnostic Tag
+.\" Diagnostic informtion here.
+.\" .El
+.Sh SEE ALSO
+.\" List links in ascending order by section, alphabetically within a section.
+.\" Please do not reference files that do not exist without filing a bug report
+.Xr a 1 ,
+.Xr b 1 ,
+.Xr c 1 ,
+.Xr a 2 ,
+.Xr b 2 ,
+.Xr a 3 ,
+.Xr b 3
+.\" .Sh BUGS \" Document known, unremedied bugs
+.\" .Sh HISTORY \" Document history if command behaves in a unique manner
\ No newline at end of file
diff --git a/projects/XCode/OCTest/OCTest/OCTest.mm b/projects/XCode/OCTest/OCTest/OCTest.mm
new file mode 100644
index 0000000..fa3ffea
--- /dev/null
+++ b/projects/XCode/OCTest/OCTest/OCTest.mm
@@ -0,0 +1,28 @@
+/*
+ * OCTest.mm
+ * OCTest
+ *
+ * Created by Phil on 13/11/2010.
+ * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ *
+ */
+
+#import "catch.hpp"
+
+#import "TestObj.h"
+
+TEST_CASE( "OCTest/TestObj", "tests TestObj" )
+{
+ TestObj* obj = [[TestObj alloc] init];
+
+ REQUIRE( obj.int_val == 0 );
+
+ obj.int_val = 1;
+
+ REQUIRE( obj.int_val == 1 );
+
+ arcSafeRelease( obj );
+}
diff --git a/projects/XCode/OCTest/OCTest/TestObj.h b/projects/XCode/OCTest/OCTest/TestObj.h
new file mode 100644
index 0000000..8443921
--- /dev/null
+++ b/projects/XCode/OCTest/OCTest/TestObj.h
@@ -0,0 +1,28 @@
+//
+// TestObj.h
+// OCTest
+//
+// Created by Phil on 13/11/2010.
+// Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+//
+// 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)
+#ifndef TWOBLUECUBES_TESTOBJ_H_INCLUDED
+#define TWOBLUECUBES_TESTOBJ_H_INCLUDED
+
+#import <Foundation/Foundation.h>
+
+
+@interface TestObj : NSObject {
+
+ int int_val;
+}
+
+-(BOOL) isTrue;
+-(BOOL) isFalse;
+
+@property (nonatomic, assign ) int int_val;
+
+@end
+
+#endif // TWOBLUECUBES_TESTOBJ_H_INCLUDED
diff --git a/projects/XCode/OCTest/OCTest/TestObj.m b/projects/XCode/OCTest/OCTest/TestObj.m
new file mode 100644
index 0000000..2c7dc99
--- /dev/null
+++ b/projects/XCode/OCTest/OCTest/TestObj.m
@@ -0,0 +1,25 @@
+//
+// TestObj.m
+// OCTest
+//
+// Created by Phil on 13/11/2010.
+// Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
+//
+// 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)
+
+#import "TestObj.h"
+
+
+@implementation TestObj
+
+@synthesize int_val;
+
+-(BOOL) isTrue {
+ return YES;
+}
+-(BOOL) isFalse {
+ return NO;
+}
+
+@end
diff --git a/projects/XCode/OCTest/catch_objc_impl.mm b/projects/XCode/OCTest/catch_objc_impl.mm
new file mode 100644
index 0000000..01443cc
--- /dev/null
+++ b/projects/XCode/OCTest/catch_objc_impl.mm
@@ -0,0 +1,67 @@
+// This file #includes all the .cpp files into a single .mm
+// - so they get compiled as ObjectiveC++
+
+#include "../../../include/internal/catch_approx.cpp"
+#include "../../../include/internal/catch_assertionhandler.cpp"
+#include "../../../include/internal/catch_assertionresult.cpp"
+#include "../../../include/internal/catch_benchmark.cpp"
+#include "../../../include/internal/catch_capture_matchers.cpp"
+#include "../../../include/internal/catch_commandline.cpp"
+#include "../../../include/internal/catch_common.cpp"
+#include "../../../include/internal/catch_config.cpp"
+#include "../../../include/internal/catch_console_colour.cpp"
+#include "../../../include/internal/catch_context.cpp"
+#include "../../../include/internal/catch_debug_console.cpp"
+#include "../../../include/internal/catch_debugger.cpp"
+#include "../../../include/internal/catch_decomposer.cpp"
+#include "../../../include/internal/catch_errno_guard.cpp"
+#include "../../../include/internal/catch_exception_translator_registry.cpp"
+#include "../../../include/internal/catch_fatal_condition.cpp"
+#include "../../../include/internal/catch_interfaces_capture.cpp"
+#include "../../../include/internal/catch_interfaces_config.cpp"
+#include "../../../include/internal/catch_interfaces_exception.cpp"
+#include "../../../include/internal/catch_interfaces_registry_hub.cpp"
+#include "../../../include/internal/catch_interfaces_reporter.cpp"
+#include "../../../include/internal/catch_interfaces_runner.cpp"
+#include "../../../include/internal/catch_interfaces_testcase.cpp"
+#include "../../../include/internal/catch_leak_detector.cpp"
+#include "../../../include/internal/catch_list.cpp"
+#include "../../../include/internal/catch_matchers.cpp"
+#include "../../../include/internal/catch_matchers_string.cpp"
+#include "../../../include/internal/catch_message.cpp"
+#include "../../../include/internal/catch_random_number_generator.cpp"
+#include "../../../include/internal/catch_registry_hub.cpp"
+#include "../../../include/internal/catch_reporter_registry.cpp"
+#include "../../../include/internal/catch_result_type.cpp"
+#include "../../../include/internal/catch_run_context.cpp"
+#include "../../../include/internal/catch_section.cpp"
+#include "../../../include/internal/catch_section_info.cpp"
+#include "../../../include/internal/catch_session.cpp"
+#include "../../../include/internal/catch_startup_exception_registry.cpp"
+#include "../../../include/internal/catch_stream.cpp"
+#include "../../../include/internal/catch_string_manip.cpp"
+#include "../../../include/internal/catch_stringref.cpp"
+#include "../../../include/internal/catch_tag_alias.cpp"
+#include "../../../include/internal/catch_tag_alias_autoregistrar.cpp"
+#include "../../../include/internal/catch_tag_alias_registry.cpp"
+#include "../../../include/internal/catch_test_case_info.cpp"
+#include "../../../include/internal/catch_test_case_registry_impl.cpp"
+#include "../../../include/internal/catch_test_case_tracker.cpp"
+#include "../../../include/internal/catch_test_registry.cpp"
+#include "../../../include/internal/catch_test_spec.cpp"
+#include "../../../include/internal/catch_test_spec_parser.cpp"
+#include "../../../include/internal/catch_timer.cpp"
+#include "../../../include/internal/catch_tostring.cpp"
+#include "../../../include/internal/catch_totals.cpp"
+#include "../../../include/internal/catch_version.cpp"
+#include "../../../include/internal/catch_wildcard_pattern.cpp"
+#include "../../../include/internal/catch_xmlwriter.cpp"
+
+
+// Reporters
+#include "../../../include/reporters/catch_reporter_bases.cpp"
+#include "../../../include/reporters/catch_reporter_compact.cpp"
+#include "../../../include/reporters/catch_reporter_console.cpp"
+#include "../../../include/reporters/catch_reporter_junit.cpp"
+#include "../../../include/reporters/catch_reporter_multi.cpp"
+#include "../../../include/reporters/catch_reporter_xml.cpp"
diff --git a/scripts/approvalTests.py b/scripts/approvalTests.py
new file mode 100755
index 0000000..a2ab5d5
--- /dev/null
+++ b/scripts/approvalTests.py
@@ -0,0 +1,189 @@
+#!/usr/bin/env python
+
+from __future__ import print_function
+
+import os
+import sys
+import subprocess
+import re
+import difflib
+
+import scriptCommon
+from scriptCommon import catchPath
+
+rootPath = os.path.join(catchPath, 'projects/SelfTest/Baselines')
+
+
+filelocParser = re.compile(r'''
+ .*/
+ (.+\.[ch]pp) # filename
+ (?::|\() # : is starting separator between filename and line number on Linux, ( on Windows
+ ([0-9]*) # line number
+ \)? # Windows also has an ending separator, )
+''', re.VERBOSE)
+lineNumberParser = re.compile(r' line="[0-9]*"')
+hexParser = re.compile(r'\b(0[xX][0-9a-fA-F]+)\b')
+durationsParser = re.compile(r' time="[0-9]*\.[0-9]*"')
+timestampsParser = re.compile(r'\d{4}-\d{2}-\d{2}T\d{2}\:\d{2}\:\d{2}Z')
+versionParser = re.compile(r'Catch v[0-9]+\.[0-9]+\.[0-9]+(-develop\.[0-9]+)?')
+nullParser = re.compile(r'\b(__null|nullptr)\b')
+exeNameParser = re.compile(r'''
+ \b
+ (CatchSelfTest|SelfTest) # Expected executable name
+ (?:.exe)? # Executable name contains .exe on Windows.
+ \b
+''', re.VERBOSE)
+# This is a hack until something more reasonable is figured out
+specialCaseParser = re.compile(r'file\((\d+)\)')
+
+# errno macro expands into various names depending on platform, so we need to fix them up as well
+errnoParser = re.compile(r'''
+ \(\*__errno_location\ \(\)\)
+ |
+ \(\*__error\(\)\)
+ |
+ \(\*_errno\(\)\)
+''', re.VERBOSE)
+sinceEpochParser = re.compile(r'\d+ .+ since epoch')
+infParser = re.compile(r'''
+ \(\(float\)\(1e\+300\ \*\ 1e\+300\)\) # MSVC INFINITY macro
+ |
+ \(__builtin_inff\(\)\) # Linux (ubuntu) INFINITY macro
+ |
+ \(__builtin_inff\ \(\)\) # Fedora INFINITY macro
+ |
+ __builtin_huge_valf\(\) # OSX macro
+''', re.VERBOSE)
+nanParser = re.compile(r'''
+ \(\(float\)\(\(\(float\)\(1e\+300\ \*\ 1e\+300\)\)\ \*\ 0\.0F\)\) # MSVC NAN macro
+ |
+ \(\(float\)\(INFINITY\ \*\ 0\.0F\)\) # Yet another MSVC NAN macro
+ |
+ \(__builtin_nanf\ \(""\)\) # Linux (ubuntu) NAN macro
+ |
+ __builtin_nanf\("0x<hex\ digits>"\) # The weird content of the brackets is there because a different parser has already ran before this one
+''', re.VERBOSE)
+
+
+if len(sys.argv) == 2:
+ cmdPath = sys.argv[1]
+else:
+ cmdPath = os.path.join(catchPath, scriptCommon.getBuildExecutable())
+
+overallResult = 0
+
+def diffFiles(fileA, fileB):
+ with open(fileA, 'r') as file:
+ aLines = [line.rstrip() for line in file.readlines()]
+ with open(fileB, 'r') as file:
+ bLines = [line.rstrip() for line in file.readlines()]
+
+ shortenedFilenameA = fileA.rsplit(os.sep, 1)[-1]
+ shortenedFilenameB = fileB.rsplit(os.sep, 1)[-1]
+
+ diff = difflib.unified_diff(aLines, bLines, fromfile=shortenedFilenameA, tofile=shortenedFilenameB, n=0)
+ return [line for line in diff if line[0] in ('+', '-')]
+
+
+def filterLine(line):
+ if catchPath in line:
+ # make paths relative to Catch root
+ line = line.replace(catchPath + os.sep, '')
+ # go from \ in windows paths to /
+ line = line.replace('\\', '/')
+
+
+ # strip source line numbers
+ m = filelocParser.match(line)
+ if m:
+ # note that this also strips directories, leaving only the filename
+ filename, lnum = m.groups()
+ lnum = ":<line number>" if lnum else ""
+ line = filename + lnum + line[m.end():]
+ else:
+ line = lineNumberParser.sub(" ", line)
+
+ # strip Catch version number
+ line = versionParser.sub("<version>", line)
+
+ # replace *null* with 0
+ line = nullParser.sub("0", line)
+
+ # strip executable name
+ line = exeNameParser.sub("<exe-name>", line)
+
+ # strip hexadecimal numbers (presumably pointer values)
+ line = hexParser.sub("0x<hex digits>", line)
+
+ # strip durations and timestamps
+ line = durationsParser.sub(' time="{duration}"', line)
+ line = timestampsParser.sub('{iso8601-timestamp}', line)
+ line = specialCaseParser.sub('file:\g<1>', line)
+ line = errnoParser.sub('errno', line)
+ line = sinceEpochParser.sub('{since-epoch-report}', line)
+ line = infParser.sub('INFINITY', line)
+ line = nanParser.sub('NAN', line)
+ return line
+
+
+def approve(baseName, args):
+ global overallResult
+ args[0:0] = [cmdPath]
+ if not os.path.exists(cmdPath):
+ raise Exception("Executable doesn't exist at " + cmdPath)
+ baselinesPath = os.path.join(rootPath, '{0}.approved.txt'.format(baseName))
+ rawResultsPath = os.path.join(rootPath, '_{0}.tmp'.format(baseName))
+ filteredResultsPath = os.path.join(rootPath, '{0}.unapproved.txt'.format(baseName))
+
+ f = open(rawResultsPath, 'w')
+ subprocess.call(args, stdout=f, stderr=f)
+ f.close()
+
+ rawFile = open(rawResultsPath, 'r')
+ filteredFile = open(filteredResultsPath, 'w')
+ for line in rawFile:
+ filteredFile.write(filterLine(line).rstrip() + "\n")
+ filteredFile.close()
+ rawFile.close()
+
+ os.remove(rawResultsPath)
+ print()
+ print(baseName + ":")
+ if os.path.exists(baselinesPath):
+ diffResult = diffFiles(baselinesPath, filteredResultsPath)
+ if diffResult:
+ print('\n'.join(diffResult))
+ print(" \n****************************\n \033[91mResults differed")
+ if len(diffResult) > overallResult:
+ overallResult = len(diffResult)
+ else:
+ os.remove(filteredResultsPath)
+ print(" \033[92mResults matched")
+ print("\033[0m")
+ else:
+ print(" first approval")
+ if overallResult == 0:
+ overallResult = 1
+
+
+print("Running approvals against executable:")
+print(" " + cmdPath)
+
+
+### Keep default reporters here
+# Standard console reporter
+approve("console.std", ["~[!nonportable]~[!benchmark]~[approvals]", "--order", "lex"])
+# console reporter, include passes, warn about No Assertions
+approve("console.sw", ["~[!nonportable]~[!benchmark]~[approvals]", "-s", "-w", "NoAssertions", "--order", "lex"])
+# console reporter, include passes, warn about No Assertions, limit failures to first 4
+approve("console.swa4", ["~[!nonportable]~[!benchmark]~[approvals]", "-s", "-w", "NoAssertions", "-x", "4", "--order", "lex"])
+# junit reporter, include passes, warn about No Assertions
+approve("junit.sw", ["~[!nonportable]~[!benchmark]~[approvals]", "-s", "-w", "NoAssertions", "-r", "junit", "--order", "lex"])
+# xml reporter, include passes, warn about No Assertions
+approve("xml.sw", ["~[!nonportable]~[!benchmark]~[approvals]", "-s", "-w", "NoAssertions", "-r", "xml", "--order", "lex"])
+# compact reporter, include passes, warn about No Assertions
+approve('compact.sw', ['~[!nonportable]~[!benchmark]~[approvals]', '-s', '-w', 'NoAssertions', '-r', 'compact', '--order', 'lex'])
+
+if overallResult != 0:
+ print("If these differences are expected, run approve.py to approve new baselines.")
+exit(overallResult)
diff --git a/scripts/approve.py b/scripts/approve.py
new file mode 100755
index 0000000..78a2a9e
--- /dev/null
+++ b/scripts/approve.py
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+
+from __future__ import print_function
+
+import os
+import sys
+import shutil
+import glob
+from scriptCommon import catchPath
+
+rootPath = os.path.join( catchPath, 'projects/SelfTest/Baselines' )
+
+if len(sys.argv) > 1:
+ files = [os.path.join( rootPath, f ) for f in sys.argv[1:]]
+else:
+ files = glob.glob( os.path.join( rootPath, "*.unapproved.txt" ) )
+
+
+def approveFile( approvedFile, unapprovedFile ):
+ justFilename = unapprovedFile[len(rootPath)+1:]
+ if os.path.exists( unapprovedFile ):
+ if os.path.exists( approvedFile ):
+ os.remove( approvedFile )
+ os.rename( unapprovedFile, approvedFile )
+ print( "approved " + justFilename )
+ else:
+ print( "approval file " + justFilename + " does not exist" )
+
+if len(files) > 0:
+ for unapprovedFile in files:
+ approveFile( unapprovedFile.replace( "unapproved.txt", "approved.txt" ), unapprovedFile )
+else:
+ print( "no files to approve" )
diff --git a/scripts/benchmarkCompile.py b/scripts/benchmarkCompile.py
new file mode 100755
index 0000000..586c26a
--- /dev/null
+++ b/scripts/benchmarkCompile.py
@@ -0,0 +1,148 @@
+#!/usr/bin/env python
+
+from __future__ import print_function
+
+import time, subprocess, sys, os, shutil, glob, random
+import argparse
+
+def median(lst):
+ lst = sorted(lst)
+ mid, odd = divmod(len(lst), 2)
+ if odd:
+ return lst[mid]
+ else:
+ return (lst[mid - 1] + lst[mid]) / 2.0
+
+def mean(lst):
+ return float(sum(lst)) / max(len(lst), 1)
+
+compiler_path = ''
+flags = []
+
+main_file = r'''
+#define CATCH_CONFIG_MAIN
+#include "catch.hpp"
+'''
+main_name = 'catch-main.cpp'
+
+dir_name = 'benchmark-dir'
+
+files = 20
+test_cases_in_file = 20
+sections_in_file = 4
+assertions_per_section = 5
+
+checks = [
+ 'a != b', 'a != c', 'a != d', 'a != e', 'b != c', 'b != d', 'b != e', 'c != d', 'c != e', 'd != e', 'a + a == a',
+ 'a + b == b', 'a + c == c', 'a + d == d', 'a + e == e', 'b + a == b', 'b + b == c', 'b + c == d',
+ 'b + d == e', 'c + a == c', 'c + b == d', 'c + c == e', 'd + a == d', 'd + b == e', 'e + a == e',
+ 'a + a + a == a', 'b + c == a + d', 'c + a + a == a + b + b + a',
+ 'a < b', 'b < c', 'c < d', 'd < e', 'a >= a', 'd >= b',
+]
+
+def create_temp_dir():
+ if os.path.exists(dir_name):
+ shutil.rmtree(dir_name)
+ os.mkdir(dir_name)
+
+def copy_catch(path_to_catch):
+ shutil.copy(path_to_catch, dir_name)
+
+def create_catch_main():
+ with open(main_name, 'w') as f:
+ f.write(main_file)
+
+def compile_main():
+ start_t = time.time()
+ subprocess.check_call([compiler_path, main_name, '-c'] + flags)
+ end_t = time.time()
+ return end_t - start_t
+
+def compile_files():
+ cpp_files = glob.glob('tests*.cpp')
+ start_t = time.time()
+ subprocess.check_call([compiler_path, '-c'] + flags + cpp_files)
+ end_t = time.time()
+ return end_t - start_t
+
+def link_files():
+ obj_files = glob.glob('*.o')
+ start_t = time.time()
+ subprocess.check_call([compiler_path] + flags + obj_files)
+ end_t = time.time()
+ return end_t - start_t
+
+def benchmark(func):
+ results = [func() for i in range(10)]
+ return mean(results), median(results)
+
+def char_range(start, end):
+ for c in range(ord(start), ord(end)):
+ yield chr(c)
+
+def generate_sections(fd):
+ for i in range(sections_in_file):
+ fd.write(' SECTION("Section {}") {{\n'.format(i))
+ fd.write('\n'.join(' CHECK({});'.format(check) for check in random.sample(checks, assertions_per_section)))
+ fd.write(' }\n')
+
+
+def generate_file(file_no):
+ with open('tests{}.cpp'.format(file_no), 'w') as f:
+ f.write('#include "catch.hpp"\n\n')
+ for i in range(test_cases_in_file):
+ f.write('TEST_CASE("File {} test {}", "[.compile]"){{\n'.format(file_no, i))
+ for i, c in enumerate(char_range('a', 'f')):
+ f.write(' int {} = {};\n'.format(c, i))
+ generate_sections(f)
+ f.write('}\n\n')
+
+
+def generate_files():
+ create_catch_main()
+ for i in range(files):
+ generate_file(i)
+
+
+options = ['all', 'main', 'files', 'link']
+
+parser = argparse.ArgumentParser(description='Benchmarks Catch\'s compile times against some synthetic tests')
+# Add first arg -- benchmark type
+parser.add_argument('benchmark_kind', nargs='?', default='all', choices=options, help='What kind of benchmark to run, default: all')
+
+# Args to allow changing header/compiler
+parser.add_argument('-I', '--catch-header', default='catch.hpp', help = 'Path to catch.hpp, default: catch.hpp')
+parser.add_argument('-c', '--compiler', default='g++', help = 'Compiler to use, default: g++')
+
+parser.add_argument('-f', '--flags', help = 'Flags to be passed to the compiler. Pass as "," separated list')
+
+# Allow creating files only, without running the whole thing
+parser.add_argument('-g', '--generate-files', action='store_true', help='Generate test files and quit')
+
+args = parser.parse_args()
+
+compiler_path = args.compiler
+catch_path = args.catch_header
+
+if args.generate_files:
+ create_temp_dir()
+ copy_catch(catch_path)
+ os.chdir(dir_name)
+ # now create the fake test files
+ generate_files()
+ # Early exit
+ print('Finished generating files')
+ exit(1)
+
+os.chdir(dir_name)
+
+if args.flags:
+ flags = args.flags.split(',')
+
+print('Time needed for ...')
+if args.benchmark_kind in ('all', 'main'):
+ print(' ... compiling main, mean: {:.2f}, median: {:.2f} s'.format(*benchmark(compile_main)))
+if args.benchmark_kind in ('all', 'files'):
+ print(' ... compiling test files, mean: {:.2f}, median: {:.2f} s'.format(*benchmark(compile_files)))
+if args.benchmark_kind in ('all', 'link'):
+ print(' ... linking everything, mean: {:.2f}, median: {:.2f} s'.format(*benchmark(link_files)))
diff --git a/scripts/benchmarkRunner.py b/scripts/benchmarkRunner.py
new file mode 100755
index 0000000..dc753cf
--- /dev/null
+++ b/scripts/benchmarkRunner.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python3
+
+import subprocess, os, sys
+import xml.etree.ElementTree as ET
+from collections import defaultdict
+from statistics import median, stdev
+from datetime import datetime
+
+def get_commit_hash():
+ res = subprocess.run('git rev-parse HEAD'.split(), check=True, stdout=subprocess.PIPE, universal_newlines=True)
+ return res.stdout.strip()
+
+if len(sys.argv) < 2:
+ print('Usage: {} benchmark-binary'.format(sys.argv[0]))
+ exit(1)
+
+
+num_runs = 10
+data = defaultdict(list)
+
+
+def parse_file(file):
+
+ def recursive_search(node):
+ if node.tag == 'TestCase':
+ results = node.find('OverallResult')
+ time = results.get('durationInSeconds')
+ data[node.get('name')].append(float(time))
+ elif node.tag in ('Group', 'Catch'):
+ for child in node:
+ recursive_search(child)
+
+ tree = ET.parse(file)
+ recursive_search(tree.getroot())
+
+def run_benchmarks(binary):
+ call = [binary] + '-d yes -r xml -o'.split()
+ for i in range(num_runs):
+ file = 'temp{}.xml'.format(i)
+ print('Run number {}'.format(i))
+ subprocess.run(call + [file])
+ parse_file(file)
+ # Remove file right after parsing, because benchmark output can be big
+ os.remove(file)
+
+
+# Run benchmarks
+run_benchmarks(sys.argv[1])
+
+result_file = '{:%Y-%m-%dT%H-%M-%S}-{}.result'.format(datetime.now(), get_commit_hash())
+
+
+print('Writing results to {}'.format(result_file))
+with open(result_file, 'w') as file:
+ for k in sorted(data):
+ file.write('{}: median: {} (s), stddev: {} (s)\n'.format(k, median(data[k]), stdev(data[k])))
diff --git a/scripts/developBuild.py b/scripts/developBuild.py
new file mode 100755
index 0000000..a8115fe
--- /dev/null
+++ b/scripts/developBuild.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python
+
+from __future__ import print_function
+import releaseCommon
+
+v = releaseCommon.Version()
+v.incrementBuildNumber()
+releaseCommon.performUpdates(v)
+
+print( "Updated Version.hpp, README and Conan to v{0}".format( v.getVersionString() ) )
diff --git a/scripts/embed.py b/scripts/embed.py
new file mode 100644
index 0000000..23b157c
--- /dev/null
+++ b/scripts/embed.py
@@ -0,0 +1,63 @@
+import re
+
+preprocessorRe = re.compile( r'\s*#.*' )
+
+fdefineRe = re.compile( r'\s*#\s*define\s*(\S*)\s*\(' ) # #defines that take arguments
+defineRe = re.compile( r'\s*#\s*define\s*(\S*)(\s+)(.*)' ) # all #defines
+undefRe = re.compile( r'\s*#\s*undef\s*(\S*)' ) # all #undefs
+
+ifdefCommonRe = re.compile( r'\s*#\s*if' ) # all #ifdefs
+ifdefRe = re.compile( r'\s*#\s*ifdef\s*(\S*)' )
+ifndefRe = re.compile( r'\s*#\s*ifndef\s*(\S*)' )
+endifRe = re.compile( r'\s*#\s*endif\s*//\s*(.*)' )
+elseRe = re.compile( r'\s*#\s*else' )
+ifRe = re.compile( r'\s*#\s*if\s+(.*)' )
+
+nsRe = re.compile( r'(.*?\s*\s*namespace\s+)(\w+)(\s*{?)(.*)' )
+nsCloseRe = re.compile( r'(.*\s*})(\s*\/\/\s*namespace\s+)(\w+)(\s*)(.*)' )
+
+
+class LineMapper:
+ def __init__( self, idMap, outerNamespace ):
+ self.idMap = idMap
+ self.outerNamespace = outerNamespace
+
+ # TBD:
+ # #if, #ifdef, comments after #else
+ def mapLine( self, lineNo, line ):
+ for idFrom, idTo in self.idMap.iteritems():
+ r = re.compile("(.*)" + idFrom + "(.*)")
+
+ m = r.match( line )
+ if m:
+ line = m.group(1) + idTo + m.group(2) + "\n"
+
+ m = nsCloseRe.match( line )
+ if m:
+ originalNs = m.group(3)
+ # print("[{0}] originalNs: '{1}' - closing".format(lineNo, originalNs))
+ # print( " " + line )
+ # print( " 1:[{0}]\n 2:[{1}]\n 3:[{2}]\n 4:[{3}]\n 5:[{4}]".format( m.group(1), m.group(2), m.group(3), m.group(4), m.group(5) ) )
+ if self.outerNamespace.has_key(originalNs):
+ outerNs, innerNs = self.outerNamespace[originalNs]
+ return "{0}}}{1}{2}::{3}{4}{5}\n".format( m.group(1), m.group(2), outerNs, innerNs, m.group(4), m.group(5))
+ m = nsRe.match( line )
+ if m:
+ originalNs = m.group(2)
+ # print("[{0}] originalNs: '{1}'".format(lineNo, originalNs))
+ # print( " " + line )
+ # print( " 1:[{0}]\n 2:[{1}]\n 3:[{2}]\n 4:[{3}]".format( m.group(1), m.group(2), m.group(3), m.group(4) ) )
+ if self.outerNamespace.has_key(originalNs):
+ outerNs, innerNs = self.outerNamespace[originalNs]
+ return "{0}{1} {{ namespace {2}{3}{4}\n".format( m.group(1), outerNs, innerNs, m.group(3), m.group(4) )
+
+ return line
+
+ def mapFile(self, filenameIn, filenameOut ):
+ print( "Embedding:\n {0}\nas:\n {1}".format( filenameIn, filenameOut ) )
+ with open( filenameIn, 'r' ) as f, open( filenameOut, 'w' ) as outf:
+ lineNo = 1
+ for line in f:
+ outf.write( self.mapLine( lineNo, line ) )
+ lineNo = lineNo + 1
+ print( "Written {0} lines".format( lineNo ) )
\ No newline at end of file
diff --git a/scripts/embedClara.py b/scripts/embedClara.py
new file mode 100644
index 0000000..e7bb933
--- /dev/null
+++ b/scripts/embedClara.py
@@ -0,0 +1,25 @@
+# Execute this script any time you import a new copy of Clara into the third_party area
+import os
+import sys
+import embed
+
+rootPath = os.path.dirname(os.path.realpath( os.path.dirname(sys.argv[0])))
+
+filename = os.path.join( rootPath, "third_party", "clara.hpp" )
+outfilename = os.path.join( rootPath, "include", "external", "clara.hpp" )
+
+
+# Mapping of pre-processor identifiers
+idMap = {
+ "CLARA_HPP_INCLUDED": "CATCH_CLARA_HPP_INCLUDED",
+ "CLARA_CONFIG_CONSOLE_WIDTH": "CATCH_CLARA_CONFIG_CONSOLE_WIDTH",
+ "CLARA_TEXTFLOW_HPP_INCLUDED": "CATCH_CLARA_TEXTFLOW_HPP_INCLUDED",
+ "CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH": "CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH",
+ "CLARA_PLATFORM_WINDOWS": "CATCH_PLATFORM_WINDOWS"
+ }
+
+# outer namespace to add
+outerNamespace = { "clara": ("Catch", "clara") }
+
+mapper = embed.LineMapper( idMap, outerNamespace )
+mapper.mapFile( filename, outfilename )
\ No newline at end of file
diff --git a/scripts/fixWhitespace.py b/scripts/fixWhitespace.py
new file mode 100755
index 0000000..6f37c53
--- /dev/null
+++ b/scripts/fixWhitespace.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+
+from __future__ import print_function
+import os
+from scriptCommon import catchPath
+
+changedFiles = 0
+
+def isSourceFile( path ):
+ return path.endswith( ".cpp" ) or path.endswith( ".h" ) or path.endswith( ".hpp" )
+
+def fixAllFilesInDir( dir ):
+ for f in os.listdir( dir ):
+ path = os.path.join( dir,f )
+ if os.path.isfile( path ):
+ if isSourceFile( path ):
+ fixFile( path )
+ else:
+ fixAllFilesInDir( path )
+
+def fixFile( path ):
+ f = open( path, 'r' )
+ lines = []
+ changed = 0
+ for line in f:
+ trimmed = line.rstrip() + "\n"
+ trimmed = trimmed.replace('\t', ' ')
+ if trimmed != line:
+ changed = changed +1
+ lines.append( trimmed )
+ f.close()
+ if changed > 0:
+ global changedFiles
+ changedFiles = changedFiles + 1
+ print( path + ":" )
+ print( " - fixed " + str(changed) + " line(s)" )
+ altPath = path + ".backup"
+ os.rename( path, altPath )
+ f2 = open( path, 'w' )
+ for line in lines:
+ f2.write( line )
+ f2.close()
+ os.remove( altPath )
+
+fixAllFilesInDir(catchPath)
+if changedFiles > 0:
+ print( "Fixed " + str(changedFiles) + " file(s)" )
+else:
+ print( "No trailing whitespace found" )
diff --git a/scripts/generateSingleHeader.py b/scripts/generateSingleHeader.py
new file mode 100755
index 0000000..633e8c1
--- /dev/null
+++ b/scripts/generateSingleHeader.py
@@ -0,0 +1,130 @@
+#!/usr/bin/env python
+
+from __future__ import print_function
+
+import os
+import io
+import sys
+import re
+import datetime
+import string
+from glob import glob
+
+from scriptCommon import catchPath
+
+def generate(v):
+ includesParser = re.compile( r'\s*#\s*include\s*"(.*)"' )
+ guardParser = re.compile( r'\s*#.*(TWOBLUECUBES_)?CATCH_.*_INCLUDED')
+ defineParser = re.compile( r'\s*#define\s+(TWOBLUECUBES_)?CATCH_.*_INCLUDED')
+ ifParser = re.compile( r'\s*#ifndef (TWOBLUECUBES_)?CATCH_.*_INCLUDED')
+ endIfParser = re.compile( r'\s*#endif // (TWOBLUECUBES_)?CATCH_.*_INCLUDED')
+ ifImplParser = re.compile( r'\s*#ifdef CATCH_CONFIG_RUNNER' )
+ commentParser1 = re.compile( r'^\s*/\*')
+ commentParser2 = re.compile( r'^ \*')
+ blankParser = re.compile( r'^\s*$')
+
+ seenHeaders = set([])
+ rootPath = os.path.join( catchPath, 'include/' )
+ outputPath = os.path.join( catchPath, 'single_include/catch.hpp' )
+
+ globals = {
+ 'includeImpl' : True,
+ 'ifdefs' : 0,
+ 'implIfDefs' : -1
+ }
+
+ for arg in sys.argv[1:]:
+ arg = string.lower(arg)
+ if arg == "noimpl":
+ globals['includeImpl'] = False
+ print( "Not including impl code" )
+ else:
+ print( "\n** Unrecognised argument: " + arg + " **\n" )
+ exit(1)
+
+
+ # ensure that the output directory exists (hopefully no races)
+ outDir = os.path.dirname(outputPath)
+ if not os.path.exists(outDir):
+ os.makedirs(outDir)
+ out = io.open( outputPath, 'w', newline='\n')
+
+ def write( line ):
+ if globals['includeImpl'] or globals['implIfDefs'] == -1:
+ out.write( line.decode('utf-8') )
+
+ def insertCpps():
+ dirs = [os.path.join( rootPath, s) for s in ['', 'internal', 'reporters']]
+ cppFiles = []
+ for dir in dirs:
+ cppFiles += glob(os.path.join(dir, '*.cpp'))
+ # To minimize random diffs, sort the files before processing them
+ for fname in sorted(cppFiles):
+ dir, name = fname.rsplit(os.path.sep, 1)
+ dir += os.path.sep
+ parseFile(dir, name)
+
+ def parseFile( path, filename ):
+ f = open( os.path.join(path, filename), 'r' )
+ blanks = 0
+ write( "// start {0}\n".format( filename ) )
+ for line in f:
+ if '// ~*~* CATCH_CPP_STITCH_PLACE *~*~' in line:
+ insertCpps()
+ continue
+ elif ifParser.match( line ):
+ globals['ifdefs'] += 1
+ elif endIfParser.match( line ):
+ globals['ifdefs'] -= 1
+ if globals['ifdefs'] == globals['implIfDefs']:
+ globals['implIfDefs'] = -1
+ m = includesParser.match( line )
+ if m:
+ header = m.group(1)
+ headerPath, sep, headerFile = header.rpartition( "/" )
+ if not headerFile in seenHeaders:
+ if headerFile != "tbc_text_format.h" and headerFile != "clara.h":
+ seenHeaders.add( headerFile )
+ if headerPath == "internal" and path.endswith("internal/"):
+ headerPath = ""
+ sep = ""
+ if os.path.exists( path + headerPath + sep + headerFile ):
+ parseFile( path + headerPath + sep, headerFile )
+ else:
+ parseFile( rootPath + headerPath + sep, headerFile )
+ else:
+ if ifImplParser.match(line):
+ globals['implIfDefs'] = globals['ifdefs']
+ if (not guardParser.match( line ) or defineParser.match( line ) ) and not commentParser1.match( line )and not commentParser2.match( line ):
+ if blankParser.match( line ):
+ blanks = blanks + 1
+ else:
+ blanks = 0
+ if blanks < 2 and not defineParser.match(line):
+ write( line.rstrip() + "\n" )
+ write( '// end {}\n'.format(filename) )
+
+
+ write( "/*\n" )
+ write( " * Catch v{0}\n".format( v.getVersionString() ) )
+ write( " * Generated: {0}\n".format( datetime.datetime.now() ) )
+ write( " * ----------------------------------------------------------\n" )
+ write( " * This file has been merged from multiple headers. Please don't edit it directly\n" )
+ write( " * Copyright (c) {} Two Blue Cubes Ltd. All rights reserved.\n".format( datetime.date.today().year ) )
+ write( " *\n" )
+ write( " * Distributed under the Boost Software License, Version 1.0. (See accompanying\n" )
+ write( " * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n" )
+ write( " */\n" )
+ write( "#ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" )
+ write( "#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n" )
+
+ parseFile( rootPath, 'catch.hpp' )
+
+ write( "#endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n\n" )
+ out.close()
+ print ("Generated single include for Catch v{0}\n".format( v.getVersionString() ) )
+
+
+if __name__ == '__main__':
+ from releaseCommon import Version
+ generate(Version())
diff --git a/scripts/majorRelease.py b/scripts/majorRelease.py
new file mode 100755
index 0000000..8da3406
--- /dev/null
+++ b/scripts/majorRelease.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python
+
+from __future__ import print_function
+import releaseCommon
+
+v = releaseCommon.Version()
+v.incrementMajorVersion()
+releaseCommon.performUpdates(v)
+
+print( "Updated Version.hpp, README and Conan to v{0}".format( v.getVersionString() ) )
diff --git a/scripts/minorRelease.py b/scripts/minorRelease.py
new file mode 100755
index 0000000..6e71cd8
--- /dev/null
+++ b/scripts/minorRelease.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python
+
+from __future__ import print_function
+import releaseCommon
+
+v = releaseCommon.Version()
+v.incrementMinorVersion()
+releaseCommon.performUpdates(v)
+
+print( "Updated Version.hpp, README and Conan to v{0}".format( v.getVersionString() ) )
diff --git a/scripts/patchRelease.py b/scripts/patchRelease.py
new file mode 100755
index 0000000..1417642
--- /dev/null
+++ b/scripts/patchRelease.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python
+
+from __future__ import print_function
+import releaseCommon
+
+v = releaseCommon.Version()
+v.incrementPatchNumber()
+releaseCommon.performUpdates(v)
+
+print( "Updated Version.hpp, README and Conan to v{0}".format( v.getVersionString() ) )
diff --git a/scripts/releaseCommon.py b/scripts/releaseCommon.py
new file mode 100644
index 0000000..6e44da2
--- /dev/null
+++ b/scripts/releaseCommon.py
@@ -0,0 +1,178 @@
+from __future__ import print_function
+
+import os
+import sys
+import re
+import string
+
+from scriptCommon import catchPath
+
+versionParser = re.compile( r'(\s*static\sVersion\sversion)\s*\(\s*(.*)\s*,\s*(.*)\s*,\s*(.*)\s*,\s*\"(.*)\"\s*,\s*(.*)\s*\).*' )
+rootPath = os.path.join( catchPath, 'include/' )
+versionPath = os.path.join( rootPath, "internal/catch_version.cpp" )
+definePath = os.path.join(rootPath, 'catch.hpp')
+readmePath = os.path.join( catchPath, "README.md" )
+conanPath = os.path.join(catchPath, 'conanfile.py')
+conanTestPath = os.path.join(catchPath, 'test_package', 'conanfile.py')
+cmakePath = os.path.join(catchPath, 'CMakeLists.txt')
+
+class Version:
+ def __init__(self):
+ f = open( versionPath, 'r' )
+ for line in f:
+ m = versionParser.match( line )
+ if m:
+ self.variableDecl = m.group(1)
+ self.majorVersion = int(m.group(2))
+ self.minorVersion = int(m.group(3))
+ self.patchNumber = int(m.group(4))
+ self.branchName = m.group(5)
+ self.buildNumber = int(m.group(6))
+ f.close()
+
+ def nonDevelopRelease(self):
+ if self.branchName != "":
+ self.branchName = ""
+ self.buildNumber = 0
+ def developBuild(self):
+ if self.branchName == "":
+ self.branchName = "develop"
+ self.buildNumber = 0
+
+ def incrementBuildNumber(self):
+ self.developBuild()
+ self.buildNumber = self.buildNumber+1
+
+ def incrementPatchNumber(self):
+ self.nonDevelopRelease()
+ self.patchNumber = self.patchNumber+1
+
+ def incrementMinorVersion(self):
+ self.nonDevelopRelease()
+ self.patchNumber = 0
+ self.minorVersion = self.minorVersion+1
+
+ def incrementMajorVersion(self):
+ self.nonDevelopRelease()
+ self.patchNumber = 0
+ self.minorVersion = 0
+ self.majorVersion = self.majorVersion+1
+
+ def getVersionString(self):
+ versionString = '{0}.{1}.{2}'.format( self.majorVersion, self.minorVersion, self.patchNumber )
+ if self.branchName != "":
+ versionString = versionString + '-{0}.{1}'.format( self.branchName, self.buildNumber )
+ return versionString
+
+ def updateVersionFile(self):
+ f = open( versionPath, 'r' )
+ lines = []
+ for line in f:
+ m = versionParser.match( line )
+ if m:
+ lines.append( '{0}( {1}, {2}, {3}, "{4}", {5} );'.format( self.variableDecl, self.majorVersion, self.minorVersion, self.patchNumber, self.branchName, self.buildNumber ) )
+ else:
+ lines.append( line.rstrip() )
+ f.close()
+ f = open( versionPath, 'w' )
+ for line in lines:
+ f.write( line + "\n" )
+
+def updateReadmeFile(version):
+ import updateWandbox
+
+ downloadParser = re.compile( r'<a href=\"https://github.com/catchorg/Catch2/releases/download/v\d+\.\d+\.\d+/catch.hpp\">' )
+ success, wandboxLink = updateWandbox.uploadFiles()
+ if not success:
+ print('Error when uploading to wandbox: {}'.format(wandboxLink))
+ exit(1)
+ f = open( readmePath, 'r' )
+ lines = []
+ for line in f:
+ lines.append( line.rstrip() )
+ f.close()
+ f = open( readmePath, 'w' )
+ for line in lines:
+ line = downloadParser.sub( r'<a href="https://github.com/catchorg/Catch2/releases/download/v{0}/catch.hpp">'.format(version.getVersionString()) , line)
+ if '[]' in line:
+ line = '[]({0})'.format(wandboxLink)
+ f.write( line + "\n" )
+
+def updateConanFile(version):
+ conanParser = re.compile( r' version = "\d+\.\d+\.\d+.*"')
+ f = open( conanPath, 'r' )
+ lines = []
+ for line in f:
+ m = conanParser.match( line )
+ if m:
+ lines.append( ' version = "{0}"'.format(format(version.getVersionString())) )
+ else:
+ lines.append( line.rstrip() )
+ f.close()
+ f = open( conanPath, 'w' )
+ for line in lines:
+ f.write( line + "\n" )
+
+def updateConanTestFile(version):
+ conanParser = re.compile( r' requires = \"Catch\/\d+\.\d+\.\d+.*@%s\/%s\" % \(username, channel\)')
+ f = open( conanTestPath, 'r' )
+ lines = []
+ for line in f:
+ m = conanParser.match( line )
+ if m:
+ lines.append( ' requires = "Catch/{0}@%s/%s" % (username, channel)'.format(format(version.getVersionString())) )
+ else:
+ lines.append( line.rstrip() )
+ f.close()
+ f = open( conanTestPath, 'w' )
+ for line in lines:
+ f.write( line + "\n" )
+
+def updateCmakeFile(version):
+ with open(cmakePath, 'r') as file:
+ lines = file.readlines()
+ with open(cmakePath, 'w') as file:
+ for line in lines:
+ if 'project(Catch2 LANGUAGES CXX VERSION ' in line:
+ file.write('project(Catch2 LANGUAGES CXX VERSION {0})\n'.format(version.getVersionString()))
+ else:
+ file.write(line)
+
+
+def updateVersionDefine(version):
+ with open(definePath, 'r') as file:
+ lines = file.readlines()
+ with open(definePath, 'w') as file:
+ for line in lines:
+ if '#define CATCH_VERSION_MAJOR' in line:
+ file.write('#define CATCH_VERSION_MAJOR {}\n'.format(version.majorVersion))
+ elif '#define CATCH_VERSION_MINOR' in line:
+ file.write('#define CATCH_VERSION_MINOR {}\n'.format(version.minorVersion))
+ elif '#define CATCH_VERSION_PATCH' in line:
+ file.write('#define CATCH_VERSION_PATCH {}\n'.format(version.patchNumber))
+ else:
+ file.write(line)
+
+
+def performUpdates(version):
+ # First update version file, so we can regenerate single header and
+ # have it ready for upload to wandbox, when updating readme
+ version.updateVersionFile()
+ updateVersionDefine(version)
+
+ import generateSingleHeader
+ generateSingleHeader.generate(version)
+
+ # Then copy the reporters to single include folder to keep them in sync
+ # We probably should have some kind of convention to select which reporters need to be copied automagically,
+ # but this works for now
+ import shutil
+ for rep in ('automake', 'tap', 'teamcity'):
+ sourceFile = os.path.join(catchPath, 'include/reporters/catch_reporter_{}.hpp'.format(rep))
+ destFile = os.path.join(catchPath, 'single_include/catch_reporter_{}.hpp'.format(rep))
+ shutil.copyfile(sourceFile, destFile)
+
+ updateReadmeFile(version)
+ updateConanFile(version)
+ updateConanTestFile(version)
+ updateCmakeFile(version)
diff --git a/scripts/releaseNotes.py b/scripts/releaseNotes.py
new file mode 100755
index 0000000..80fffbf
--- /dev/null
+++ b/scripts/releaseNotes.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+
+import os
+import re
+import urllib2
+import json
+
+from scriptCommon import catchPath
+from scriptCommon import runAndCapture
+
+issueNumberRe = re.compile( r'(.*?)#([0-9]*)([^0-9]?.*)' )
+
+rootPath = os.path.join( catchPath, 'include/' )
+versionPath = os.path.join( rootPath, "internal/catch_version.hpp" )
+
+
+hashes = runAndCapture( ['git', 'log', '-2', '--format="%H"', versionPath] )
+lines = runAndCapture( ['git', 'log', hashes[1] + ".." + hashes[0], catchPath] )
+
+prevLine = ""
+messages = []
+dates = []
+issues = {}
+
+def getIssueTitle( issueNumber ):
+ try:
+ s = urllib2.urlopen("https://api.github.com/repos/philsquared/catch/issues/" + issueNumber ).read()
+ except:
+ return "#HTTP Error#"
+
+ try:
+ j = json.loads( s )
+ return j["title"]
+ except:
+ return "#JSON Error#"
+
+for line in lines:
+ if line.startswith( "commit"):
+ pass
+ elif line.startswith( "Author:"):
+ pass
+ elif line.startswith( "Date:"):
+ dates.append( line[5:].lstrip() )
+ pass
+ elif line == "" and prevLine == "":
+ pass
+ else:
+ prevLine = line
+ match = issueNumberRe.match( line )
+ line2 = ""
+ while match:
+ issueNumber = match.group(2)
+ issue = '#{0} ("{1}")'.format( issueNumber, getIssueTitle( issueNumber ) )
+ line2 = line2 + match.group(1) + issue
+ match = issueNumberRe.match( match.group(3) )
+ if line2 == "":
+ messages.append( line )
+ else:
+ messages.append( line2 )
+
+print "All changes between {0} and {1}:\n".format( dates[-1], dates[0] )
+
+for line in messages:
+ print line
diff --git a/scripts/scriptCommon.py b/scripts/scriptCommon.py
new file mode 100644
index 0000000..9adadb6
--- /dev/null
+++ b/scripts/scriptCommon.py
@@ -0,0 +1,26 @@
+import os
+import sys
+import subprocess
+
+
+catchPath = os.path.dirname(os.path.realpath( os.path.dirname(sys.argv[0])))
+
+def getBuildExecutable():
+ dir = os.environ.get('CATCH_DEV_OUT_DIR', "cmake-build-debug/SelfTest")
+ return dir
+
+def runAndCapture( args ):
+ child = subprocess.Popen(" ".join( args ), shell=True, stdout=subprocess.PIPE)
+ lines = []
+ line = ""
+ while True:
+ out = child.stdout.read(1)
+ if out == '' and child.poll() != None:
+ break
+ if out != '':
+ if out == '\n':
+ lines.append( line )
+ line = ""
+ else:
+ line = line + out
+ return lines
diff --git a/scripts/updateDocumentToC.py b/scripts/updateDocumentToC.py
new file mode 100644
index 0000000..948e5e1
--- /dev/null
+++ b/scripts/updateDocumentToC.py
@@ -0,0 +1,446 @@
+#!/usr/bin/env python
+
+#
+# updateDocumentToC.py
+#
+# Insert table of contents at top of Catch markdown documents.
+#
+# This script is distributed under the GNU General Public License v3.0
+#
+# It is based on markdown-toclify version 1.7.1 by Sebastian Raschka,
+# https://github.com/rasbt/markdown-toclify
+#
+
+from __future__ import print_function
+from scriptCommon import catchPath
+
+import argparse
+import glob
+import os
+import re
+import sys
+
+# Configuration:
+
+minTocEntries = 4
+
+headingExcludeDefault = [1,3,4,5] # use level 2 headers for at default
+headingExcludeRelease = [2,3,4,5] # use level 1 headers for release-notes.md
+
+documentsDefault = os.path.join(os.path.relpath(catchPath), 'docs/*.md')
+releaseNotesName = 'release-notes.md'
+
+contentTitle = '**Contents**'
+contentLineNo = 4
+contentLineNdx = contentLineNo - 1
+
+# End configuration
+
+VALIDS = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-&'
+
+def readLines(in_file):
+ """Returns a list of lines from a input markdown file."""
+
+ with open(in_file, 'r') as inf:
+ in_contents = inf.read().split('\n')
+ return in_contents
+
+def removeLines(lines, remove=('[[back to top]', '<a class="mk-toclify"')):
+ """Removes existing [back to top] links and <a id> tags."""
+
+ if not remove:
+ return lines[:]
+
+ out = []
+ for l in lines:
+ if l.startswith(remove):
+ continue
+ out.append(l)
+ return out
+
+def removeToC(lines):
+ """Removes existing table of contents starting at index contentLineNdx."""
+ if not lines[contentLineNdx ].startswith(contentTitle):
+ return lines[:]
+
+ result_top = lines[:contentLineNdx]
+
+ pos = contentLineNdx + 1
+ while lines[pos].startswith('['):
+ pos = pos + 1
+
+ result_bottom = lines[pos + 1:]
+
+ return result_top + result_bottom
+
+def dashifyHeadline(line):
+ """
+ Takes a header line from a Markdown document and
+ returns a tuple of the
+ '#'-stripped version of the head line,
+ a string version for <a id=''></a> anchor tags,
+ and the level of the headline as integer.
+ E.g.,
+ >>> dashifyHeadline('### some header lvl3')
+ ('Some header lvl3', 'some-header-lvl3', 3)
+
+ """
+ stripped_right = line.rstrip('#')
+ stripped_both = stripped_right.lstrip('#')
+ level = len(stripped_right) - len(stripped_both)
+ stripped_wspace = stripped_both.strip()
+
+ # character replacements
+ replaced_colon = stripped_wspace.replace('.', '')
+ replaced_slash = replaced_colon.replace('/', '')
+ rem_nonvalids = ''.join([c if c in VALIDS
+ else '-' for c in replaced_slash])
+
+ lowered = rem_nonvalids.lower()
+ dashified = re.sub(r'(-)\1+', r'\1', lowered) # remove duplicate dashes
+ dashified = dashified.strip('-') # strip dashes from start and end
+
+ # exception '&' (double-dash in github)
+ dashified = dashified.replace('-&-', '--')
+
+ return [stripped_wspace, dashified, level]
+
+def tagAndCollect(lines, id_tag=True, back_links=False, exclude_h=None):
+ """
+ Gets headlines from the markdown document and creates anchor tags.
+
+ Keyword arguments:
+ lines: a list of sublists where every sublist
+ represents a line from a Markdown document.
+ id_tag: if true, creates inserts a the <a id> tags (not req. by GitHub)
+ back_links: if true, adds "back to top" links below each headline
+ exclude_h: header levels to exclude. E.g., [2, 3]
+ excludes level 2 and 3 headings.
+
+ Returns a tuple of 2 lists:
+ 1st list:
+ A modified version of the input list where
+ <a id="some-header"></a> anchor tags where inserted
+ above the header lines (if github is False).
+
+ 2nd list:
+ A list of 3-value sublists, where the first value
+ represents the heading, the second value the string
+ that was inserted assigned to the IDs in the anchor tags,
+ and the third value is an integer that reprents the headline level.
+ E.g.,
+ [['some header lvl3', 'some-header-lvl3', 3], ...]
+
+ """
+ out_contents = []
+ headlines = []
+ for l in lines:
+ saw_headline = False
+
+ orig_len = len(l)
+ l_stripped = l.lstrip()
+
+ if l_stripped.startswith(('# ', '## ', '### ', '#### ', '##### ', '###### ')):
+
+ # comply with new markdown standards
+
+ # not a headline if '#' not followed by whitespace '##no-header':
+ if not l.lstrip('#').startswith(' '):
+ continue
+ # not a headline if more than 6 '#':
+ if len(l) - len(l.lstrip('#')) > 6:
+ continue
+ # headers can be indented by at most 3 spaces:
+ if orig_len - len(l_stripped) > 3:
+ continue
+
+ # ignore empty headers
+ if not set(l) - {'#', ' '}:
+ continue
+
+ saw_headline = True
+ dashified = dashifyHeadline(l)
+
+ if not exclude_h or not dashified[-1] in exclude_h:
+ if id_tag:
+ id_tag = '<a class="mk-toclify" id="%s"></a>'\
+ % (dashified[1])
+ out_contents.append(id_tag)
+ headlines.append(dashified)
+
+ out_contents.append(l)
+ if back_links and saw_headline:
+ out_contents.append('[[back to top](#table-of-contents)]')
+ return out_contents, headlines
+
+def positioningHeadlines(headlines):
+ """
+ Strips unnecessary whitespaces/tabs if first header is not left-aligned
+ """
+ left_just = False
+ for row in headlines:
+ if row[-1] == 1:
+ left_just = True
+ break
+ if not left_just:
+ for row in headlines:
+ row[-1] -= 1
+ return headlines
+
+def createToc(headlines, hyperlink=True, top_link=False, no_toc_header=False):
+ """
+ Creates the table of contents from the headline list
+ that was returned by the tagAndCollect function.
+
+ Keyword Arguments:
+ headlines: list of lists
+ e.g., ['Some header lvl3', 'some-header-lvl3', 3]
+ hyperlink: Creates hyperlinks in Markdown format if True,
+ e.g., '- [Some header lvl1](#some-header-lvl1)'
+ top_link: if True, add a id tag for linking the table
+ of contents itself (for the back-to-top-links)
+ no_toc_header: suppresses TOC header if True.
+
+ Returns a list of headlines for a table of contents
+ in Markdown format,
+ e.g., [' - [Some header lvl3](#some-header-lvl3)', ...]
+
+ """
+ processed = []
+ if not no_toc_header:
+ if top_link:
+ processed.append('<a class="mk-toclify" id="table-of-contents"></a>\n')
+ processed.append(contentTitle + '<br>')
+
+ for line in headlines:
+ if hyperlink:
+ item = '[%s](#%s)' % (line[0], line[1])
+ else:
+ item = '%s- %s' % ((line[2]-1)*' ', line[0])
+ processed.append(item + '<br>')
+ processed.append('\n')
+ return processed
+
+def buildMarkdown(toc_headlines, body, spacer=0, placeholder=None):
+ """
+ Returns a string with the Markdown output contents incl.
+ the table of contents.
+
+ Keyword arguments:
+ toc_headlines: lines for the table of contents
+ as created by the createToc function.
+ body: contents of the Markdown file including
+ ID-anchor tags as returned by the
+ tagAndCollect function.
+ spacer: Adds vertical space after the table
+ of contents. Height in pixels.
+ placeholder: If a placeholder string is provided, the placeholder
+ will be replaced by the TOC instead of inserting the TOC at
+ the top of the document
+
+ """
+ if spacer:
+ spacer_line = ['\n<div style="height:%spx;"></div>\n' % (spacer)]
+ toc_markdown = "\n".join(toc_headlines + spacer_line)
+ else:
+ toc_markdown = "\n".join(toc_headlines)
+
+ if placeholder:
+ body_markdown = "\n".join(body)
+ markdown = body_markdown.replace(placeholder, toc_markdown)
+ else:
+ body_markdown_p1 = "\n".join(body[:contentLineNdx ]) + '\n'
+ body_markdown_p2 = "\n".join(body[ contentLineNdx:])
+ markdown = body_markdown_p1 + toc_markdown + body_markdown_p2
+
+ return markdown
+
+def outputMarkdown(markdown_cont, output_file):
+ """
+ Writes to an output file if `outfile` is a valid path.
+
+ """
+ if output_file:
+ with open(output_file, 'w') as out:
+ out.write(markdown_cont)
+
+def markdownToclify(
+ input_file,
+ output_file=None,
+ min_toc_len=2,
+ github=False,
+ back_to_top=False,
+ nolink=False,
+ no_toc_header=False,
+ spacer=0,
+ placeholder=None,
+ exclude_h=None):
+ """ Function to add table of contents to markdown files.
+
+ Parameters
+ -----------
+ input_file: str
+ Path to the markdown input file.
+
+ output_file: str (defaul: None)
+ Path to the markdown output file.
+
+ min_toc_len: int (default: 2)
+ Miniumum number of entries to create a table of contents for.
+
+ github: bool (default: False)
+ Uses GitHub TOC syntax if True.
+
+ back_to_top: bool (default: False)
+ Inserts back-to-top links below headings if True.
+
+ nolink: bool (default: False)
+ Creates the table of contents without internal links if True.
+
+ no_toc_header: bool (default: False)
+ Suppresses the Table of Contents header if True
+
+ spacer: int (default: 0)
+ Inserts horizontal space (in pixels) after the table of contents.
+
+ placeholder: str (default: None)
+ Inserts the TOC at the placeholder string instead
+ of inserting the TOC at the top of the document.
+
+ exclude_h: list (default None)
+ Excludes header levels, e.g., if [2, 3], ignores header
+ levels 2 and 3 in the TOC.
+
+ Returns
+ -----------
+ changed: Boolean
+ True if the file has been updated, False otherwise.
+
+ """
+ cleaned_contents = removeLines(
+ removeToC(readLines(input_file)),
+ remove=('[[back to top]', '<a class="mk-toclify"'))
+
+ processed_contents, raw_headlines = tagAndCollect(
+ cleaned_contents,
+ id_tag=not github,
+ back_links=back_to_top,
+ exclude_h=exclude_h)
+
+ # add table of contents?
+ if len(raw_headlines) < min_toc_len:
+ processed_headlines = []
+ else:
+ leftjustified_headlines = positioningHeadlines(raw_headlines)
+
+ processed_headlines = createToc(
+ leftjustified_headlines,
+ hyperlink=not nolink,
+ top_link=not nolink and not github,
+ no_toc_header=no_toc_header)
+
+ if nolink:
+ processed_contents = cleaned_contents
+
+ cont = buildMarkdown(
+ toc_headlines=processed_headlines,
+ body=processed_contents,
+ spacer=spacer,
+ placeholder=placeholder)
+
+ if output_file:
+ outputMarkdown(cont, output_file)
+
+def isReleaseNotes(f):
+ return os.path.basename(f) == releaseNotesName
+
+def excludeHeadingsFor(f):
+ return headingExcludeRelease if isReleaseNotes(f) else headingExcludeDefault
+
+def updateSingleDocumentToC(input_file, min_toc_len, verbose=False):
+ """Add or update table of contents in specified file. Return 1 if file changed, 0 otherwise."""
+ if verbose :
+ print( 'file: {}'.format(input_file))
+
+ output_file = input_file + '.tmp'
+
+ markdownToclify(
+ input_file=input_file,
+ output_file=output_file,
+ min_toc_len=min_toc_len,
+ github=True,
+ back_to_top=False,
+ nolink=False,
+ no_toc_header=False,
+ spacer=False,
+ placeholder=False,
+ exclude_h=excludeHeadingsFor(input_file))
+
+ # prevent race-condition (Python 3.3):
+ if sys.version_info >= (3, 3):
+ os.replace(output_file, input_file)
+ else:
+ os.remove(input_file)
+ os.rename(output_file, input_file)
+
+ return 1
+
+def updateDocumentToC(paths, min_toc_len, verbose):
+ """Add or update table of contents to specified paths. Return number of changed files"""
+ n = 0
+ for g in paths:
+ for f in glob.glob(g):
+ if os.path.isfile(f):
+ n = n + updateSingleDocumentToC(input_file=f, min_toc_len=min_toc_len, verbose=verbose)
+ return n
+
+def updateDocumentToCMain():
+ """Add or update table of contents to specified paths."""
+
+ parser = argparse.ArgumentParser(
+ description='Add or update table of contents in markdown documents.',
+ epilog="""""",
+ formatter_class=argparse.RawTextHelpFormatter)
+
+ parser.add_argument(
+ 'Input',
+ metavar='file',
+ type=str,
+ nargs=argparse.REMAINDER,
+ help='files to process, at default: docs/*.md')
+
+ parser.add_argument(
+ '-v', '--verbose',
+ action='store_true',
+ help='report the name of the file being processed')
+
+ parser.add_argument(
+ '--min-toc-entries',
+ dest='minTocEntries',
+ default=minTocEntries,
+ type=int,
+ metavar='N',
+ help='the minimum number of entries to create a table of contents for [{deflt}]'.format(deflt=minTocEntries))
+
+ parser.add_argument(
+ '--remove-toc',
+ action='store_const',
+ dest='minTocEntries',
+ const=99,
+ help='remove all tables of contents')
+
+ args = parser.parse_args()
+
+ paths = args.Input if len(args.Input) > 0 else [documentsDefault]
+
+ changedFiles = updateDocumentToC(paths=paths, min_toc_len=args.minTocEntries, verbose=args.verbose)
+
+ if changedFiles > 0:
+ print( "Processed table of contents in " + str(changedFiles) + " file(s)" )
+ else:
+ print( "No table of contents added or updated" )
+
+if __name__ == '__main__':
+ updateDocumentToCMain()
+
+# end of file
diff --git a/scripts/updateVcpkgPackage.py b/scripts/updateVcpkgPackage.py
new file mode 100644
index 0000000..43321e1
--- /dev/null
+++ b/scripts/updateVcpkgPackage.py
@@ -0,0 +1,110 @@
+#!/usr/bin/env python
+
+import io, os, re, sys, subprocess
+import hashlib
+
+from scriptCommon import catchPath
+from releaseCommon import Version
+
+print(catchPath)
+
+default_path = '../vcpkg/ports/catch2/'
+
+def adjusted_path(path):
+ return os.path.join(catchPath, path)
+
+def get_hash(path):
+ BUFF_SIZE = 65536
+ sha512 = hashlib.sha512()
+ # The newlines should be normalized into \n, which is what we want
+ # If reused use 'rb' with a file written with io.open(newline='\n')
+ with open(path, 'r') as f:
+ while True:
+ data = f.read(BUFF_SIZE)
+ if not data:
+ break
+ if sys.version_info[0] < 3:
+ sha512.update(data)
+ else:
+ sha512.update(data.encode('utf-8'))
+ return sha512.hexdigest()
+
+def update_control(path):
+ v = Version()
+ ver_string = v.getVersionString()
+
+ # Update control
+ lines = []
+ control_path = os.path.join(path, 'CONTROL')
+ with open(control_path, 'r') as f:
+ for line in f:
+ lines.append(line)
+ with open(control_path, 'w') as f:
+ for line in lines:
+ if 'Version: ' in line:
+ line = 'Version: {}\n'.format(v.getVersionString())
+ f.write(line)
+
+def update_portfile(path, header_hash, licence_hash):
+ print('Updating portfile')
+ v = Version()
+ ver_string = v.getVersionString()
+
+ # Update portfile
+ lines = []
+ portfile_path = os.path.join(path, 'portfile.cmake')
+ with open(portfile_path, 'r') as f:
+ for line in f:
+ lines.append(line)
+ with open(portfile_path, 'w') as f:
+ # There are three things we need to change/update
+ # 1) CATCH_VERSION cmake variable
+ # 2) Hash of header
+ # 3) Hash of licence
+ # We could assume licence never changes, but where is the fun in that?
+ for line in lines:
+ # Update the version
+ if 'set(CATCH_VERSION' in line:
+ line = 'set(CATCH_VERSION v{})\n'.format(v.getVersionString())
+
+ # Determine which file we are updating
+ if 'vcpkg_download_distfile' in line:
+ kind = line.split('(')[-1].strip()
+
+ # Update the hashes
+ if 'SHA512' in line and kind == 'HEADER':
+ line = ' SHA512 {}\n'.format(header_hash)
+ if 'SHA512' in line and kind == 'LICENSE':
+ line = ' SHA512 {}\n'.format(licence_hash)
+ f.write(line)
+
+
+def git_push(path_to_repo):
+ v = Version()
+ ver_string = v.getVersionString()
+
+ os.chdir(path_to_repo)
+
+ # Work with git
+ # Make sure we branch off master
+ subprocess.call('git checkout master', shell=True)
+
+ # Update repo to current master, so we don't work off old version of the portsfile
+ subprocess.call('git pull Microsoft master', shell=True)
+ subprocess.call('git push', shell=True)
+
+ # Create a new branch for the update
+ subprocess.call('git checkout -b catch-{}'.format(ver_string), shell=True)
+ # Add changed files (should be only our files)
+ subprocess.call('git add -u .', shell=True)
+ # Create a commit with these changes
+ subprocess.call('git commit -m "Update Catch to {}"'.format(ver_string), shell=True)
+ # Don't push, so author can review
+ print('Changes were commited to the vcpkg fork. Please check, push and open PR.')
+
+header_hash = get_hash(adjusted_path('single_include/catch.hpp'))
+licence_hash = get_hash(adjusted_path('LICENSE.txt'))
+update_control(adjusted_path(default_path))
+update_portfile(adjusted_path(default_path), header_hash, licence_hash)
+
+git_push(adjusted_path('../vcpkg'))
diff --git a/scripts/updateWandbox.py b/scripts/updateWandbox.py
new file mode 100644
index 0000000..25a7463
--- /dev/null
+++ b/scripts/updateWandbox.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+
+import json
+import os
+import urllib2
+
+from scriptCommon import catchPath
+
+def upload(options):
+ request = urllib2.Request('http://melpon.org/wandbox/api/compile.json')
+ request.add_header('Content-Type', 'application/json')
+ response = urllib2.urlopen(request, json.dumps(options))
+ return json.loads(response.read())
+
+main_file = '''
+#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file
+#include "catch.hpp"
+
+unsigned int Factorial( unsigned int number ) {
+ return number <= 1 ? number : Factorial(number-1)*number;
+}
+
+TEST_CASE( "Factorials are computed", "[factorial]" ) {
+ REQUIRE( Factorial(1) == 1 );
+ REQUIRE( Factorial(2) == 2 );
+ REQUIRE( Factorial(3) == 6 );
+ REQUIRE( Factorial(10) == 3628800 );
+}
+'''
+
+def uploadFiles():
+ response = upload({
+ 'compiler': 'gcc-head',
+ 'code': main_file,
+ 'codes': [{
+ 'file': 'catch.hpp',
+ 'code': open(os.path.join(catchPath, 'single_include', 'catch.hpp')).read()
+ }],
+ 'options': 'c++11,cpp-no-pedantic,boost-nothing',
+ 'compiler-option-raw': '-DCATCH_CONFIG_FAST_COMPILE',
+ 'save': True
+ })
+
+ if 'status' in response and not 'compiler_error' in response:
+ return True, response['url']
+ else:
+ return False, response
diff --git a/single_include/catch.hpp b/single_include/catch.hpp
new file mode 100644
index 0000000..160bad0
--- /dev/null
+++ b/single_include/catch.hpp
@@ -0,0 +1,12749 @@
+/*
+ * Catch v2.1.1
+ * Generated: 2018-01-26 16:04:07.190063
+ * ----------------------------------------------------------
+ * This file has been merged from multiple headers. Please don't edit it directly
+ * Copyright (c) 2018 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED
+#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED
+// start catch.hpp
+
+
+#ifdef __clang__
+# pragma clang system_header
+#elif defined __GNUC__
+# pragma GCC system_header
+#endif
+
+// start catch_suppress_warnings.h
+
+#ifdef __clang__
+# ifdef __ICC // icpc defines the __clang__ macro
+# pragma warning(push)
+# pragma warning(disable: 161 1682)
+# else // __ICC
+# pragma clang diagnostic ignored "-Wunused-variable"
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wpadded"
+# pragma clang diagnostic ignored "-Wswitch-enum"
+# pragma clang diagnostic ignored "-Wcovered-switch-default"
+# endif
+#elif defined __GNUC__
+# pragma GCC diagnostic ignored "-Wunused-variable"
+# pragma GCC diagnostic ignored "-Wparentheses"
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wpadded"
+#endif
+// end 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
+# define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
+#endif
+
+#if !defined(CATCH_CONFIG_IMPL_ONLY)
+// start catch_platform.h
+
+#ifdef __APPLE__
+# include <TargetConditionals.h>
+# if TARGET_OS_OSX == 1
+# define CATCH_PLATFORM_MAC
+# elif TARGET_OS_IPHONE == 1
+# define CATCH_PLATFORM_IPHONE
+# endif
+
+#elif defined(linux) || defined(__linux) || defined(__linux__)
+# define CATCH_PLATFORM_LINUX
+
+#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER)
+# define CATCH_PLATFORM_WINDOWS
+#endif
+
+// end catch_platform.h
+
+#ifdef CATCH_IMPL
+# ifndef CLARA_CONFIG_MAIN
+# define CLARA_CONFIG_MAIN_NOT_DEFINED
+# define CLARA_CONFIG_MAIN
+# endif
+#endif
+
+// start catch_user_interfaces.h
+
+namespace Catch {
+ unsigned int rngSeed();
+}
+
+// end catch_user_interfaces.h
+// start catch_tag_alias_autoregistrar.h
+
+// start catch_common.h
+
+// start catch_compiler_capabilities.h
+
+// Detect a number of compiler features - by compiler
+// The following features are defined:
+//
+// CATCH_CONFIG_COUNTER : is the __COUNTER__ macro supported?
+// CATCH_CONFIG_WINDOWS_SEH : is Windows SEH supported?
+// CATCH_CONFIG_POSIX_SIGNALS : are POSIX signals supported?
+// ****************
+// Note to maintainers: if new toggles are added please document them
+// in configuration.md, too
+// ****************
+
+// In general each macro has a _NO_<feature name> form
+// (e.g. CATCH_CONFIG_NO_POSIX_SIGNALS) which disables the feature.
+// Many features, at point of detection, define an _INTERNAL_ macro, so they
+// can be combined, en-mass, with the _NO_ forms later.
+
+#ifdef __cplusplus
+
+# if __cplusplus >= 201402L
+# define CATCH_CPP14_OR_GREATER
+# endif
+
+#endif
+
+#ifdef __clang__
+
+# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
+ _Pragma( "clang diagnostic push" ) \
+ _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) \
+ _Pragma( "clang diagnostic ignored \"-Wglobal-constructors\"")
+# define CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
+ _Pragma( "clang diagnostic pop" )
+
+# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \
+ _Pragma( "clang diagnostic push" ) \
+ _Pragma( "clang diagnostic ignored \"-Wparentheses\"" )
+# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \
+ _Pragma( "clang diagnostic pop" )
+
+#endif // __clang__
+
+////////////////////////////////////////////////////////////////////////////////
+// We know some environments not to support full POSIX signals
+#if defined(__CYGWIN__) || defined(__QNX__)
+
+# if !defined(CATCH_CONFIG_POSIX_SIGNALS)
+# define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS
+# endif
+
+#endif
+
+#ifdef __OS400__
+# define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS
+# define CATCH_CONFIG_COLOUR_NONE
+#endif
+
+////////////////////////////////////////////////////////////////////////////////
+// Cygwin
+#ifdef __CYGWIN__
+
+// Required for some versions of Cygwin to declare gettimeofday
+// see: http://stackoverflow.com/questions/36901803/gettimeofday-not-declared-in-this-scope-cygwin
+# define _BSD_SOURCE
+
+#endif // __CYGWIN__
+
+////////////////////////////////////////////////////////////////////////////////
+// Visual C++
+#ifdef _MSC_VER
+
+// Universal Windows platform does not support SEH
+// Or console colours (or console at all...)
+# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
+# define CATCH_CONFIG_COLOUR_NONE
+# else
+# define CATCH_INTERNAL_CONFIG_WINDOWS_SEH
+# endif
+
+#endif // _MSC_VER
+
+////////////////////////////////////////////////////////////////////////////////
+
+// Use of __COUNTER__ is suppressed during code analysis in
+// CLion/AppCode 2017.2.x and former, because __COUNTER__ is not properly
+// handled by it.
+// Otherwise all supported compilers support COUNTER macro,
+// but user still might want to turn it off
+#if ( !defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L )
+ #define CATCH_INTERNAL_CONFIG_COUNTER
+#endif
+
+#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER)
+# define CATCH_CONFIG_COUNTER
+#endif
+#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH)
+# define CATCH_CONFIG_WINDOWS_SEH
+#endif
+// This is set by default, because we assume that unix compilers are posix-signal-compatible by default.
+#if !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS)
+# define CATCH_CONFIG_POSIX_SIGNALS
+#endif
+
+#if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS)
+# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS
+# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS
+#endif
+#if !defined(CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS)
+# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
+# define CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS
+#endif
+
+// end 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 )
+#ifdef CATCH_CONFIG_COUNTER
+# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ )
+#else
+# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ )
+#endif
+
+#include <iosfwd>
+#include <string>
+#include <cstdint>
+
+namespace Catch {
+
+ struct CaseSensitive { enum Choice {
+ Yes,
+ No
+ }; };
+
+ class NonCopyable {
+ NonCopyable( NonCopyable const& ) = delete;
+ NonCopyable( NonCopyable && ) = delete;
+ NonCopyable& operator = ( NonCopyable const& ) = delete;
+ NonCopyable& operator = ( NonCopyable && ) = delete;
+
+ protected:
+ NonCopyable();
+ virtual ~NonCopyable();
+ };
+
+ struct SourceLineInfo {
+
+ SourceLineInfo() = delete;
+ SourceLineInfo( char const* _file, std::size_t _line ) noexcept
+ : file( _file ),
+ line( _line )
+ {}
+
+ SourceLineInfo( SourceLineInfo const& other ) = default;
+ SourceLineInfo( SourceLineInfo && ) = default;
+ SourceLineInfo& operator = ( SourceLineInfo const& ) = default;
+ SourceLineInfo& operator = ( SourceLineInfo && ) = default;
+
+ bool empty() const noexcept;
+ bool operator == ( SourceLineInfo const& other ) const noexcept;
+ bool operator < ( SourceLineInfo const& other ) const noexcept;
+
+ char const* file;
+ std::size_t line;
+ };
+
+ std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info );
+
+ // Use this in variadic streaming macros to allow
+ // >> +StreamEndStop
+ // as well as
+ // >> stuff +StreamEndStop
+ struct StreamEndStop {
+ std::string operator+() const;
+ };
+ template<typename T>
+ T const& operator + ( T const& value, StreamEndStop ) {
+ return value;
+ }
+}
+
+#define CATCH_INTERNAL_LINEINFO \
+ ::Catch::SourceLineInfo( __FILE__, static_cast<std::size_t>( __LINE__ ) )
+
+// end catch_common.h
+namespace Catch {
+
+ struct RegistrarForTagAliases {
+ RegistrarForTagAliases( char const* alias, char const* tag, SourceLineInfo const& lineInfo );
+ };
+
+} // end namespace Catch
+
+#define CATCH_REGISTER_TAG_ALIAS( alias, spec ) \
+ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
+ namespace{ Catch::RegistrarForTagAliases INTERNAL_CATCH_UNIQUE_NAME( AutoRegisterTagAlias )( alias, spec, CATCH_INTERNAL_LINEINFO ); } \
+ CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS
+
+// end catch_tag_alias_autoregistrar.h
+// start catch_test_registry.h
+
+// start catch_interfaces_testcase.h
+
+#include <vector>
+#include <memory>
+
+namespace Catch {
+
+ class TestSpec;
+
+ struct ITestInvoker {
+ virtual void invoke () const = 0;
+ virtual ~ITestInvoker();
+ };
+
+ using ITestCasePtr = std::shared_ptr<ITestInvoker>;
+
+ class TestCase;
+ struct IConfig;
+
+ struct ITestCaseRegistry {
+ virtual ~ITestCaseRegistry();
+ virtual std::vector<TestCase> const& getAllTests() const = 0;
+ virtual std::vector<TestCase> const& getAllTestsSorted( IConfig const& config ) const = 0;
+ };
+
+ bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config );
+ std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config );
+ std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config );
+
+}
+
+// end catch_interfaces_testcase.h
+// start catch_stringref.h
+
+#include <cstddef>
+#include <string>
+#include <iosfwd>
+
+namespace Catch {
+
+ class StringData;
+
+ /// A non-owning string class (similar to the forthcoming std::string_view)
+ /// Note that, because a StringRef may be a substring of another string,
+ /// it may not be null terminated. c_str() must return a null terminated
+ /// string, however, and so the StringRef will internally take ownership
+ /// (taking a copy), if necessary. In theory this ownership is not externally
+ /// visible - but it does mean (substring) StringRefs should not be shared between
+ /// threads.
+ class StringRef {
+ public:
+ using size_type = std::size_t;
+
+ private:
+ friend struct StringRefTestAccess;
+
+ char const* m_start;
+ size_type m_size;
+
+ char* m_data = nullptr;
+
+ void takeOwnership();
+
+ static constexpr char const* const s_empty = "";
+
+ public: // construction/ assignment
+ StringRef() noexcept
+ : StringRef( s_empty, 0 )
+ {}
+
+ StringRef( StringRef const& other ) noexcept
+ : m_start( other.m_start ),
+ m_size( other.m_size )
+ {}
+
+ StringRef( StringRef&& other ) noexcept
+ : m_start( other.m_start ),
+ m_size( other.m_size ),
+ m_data( other.m_data )
+ {
+ other.m_data = nullptr;
+ }
+
+ StringRef( char const* rawChars ) noexcept;
+
+ StringRef( char const* rawChars, size_type size ) noexcept
+ : m_start( rawChars ),
+ m_size( size )
+ {}
+
+ StringRef( std::string const& stdString ) noexcept
+ : m_start( stdString.c_str() ),
+ m_size( stdString.size() )
+ {}
+
+ ~StringRef() noexcept {
+ delete[] m_data;
+ }
+
+ auto operator = ( StringRef const &other ) noexcept -> StringRef& {
+ delete[] m_data;
+ m_data = nullptr;
+ m_start = other.m_start;
+ m_size = other.m_size;
+ return *this;
+ }
+
+ operator std::string() const;
+
+ void swap( StringRef& other ) noexcept;
+
+ public: // operators
+ auto operator == ( StringRef const& other ) const noexcept -> bool;
+ auto operator != ( StringRef const& other ) const noexcept -> bool;
+
+ auto operator[] ( size_type index ) const noexcept -> char;
+
+ public: // named queries
+ auto empty() const noexcept -> bool {
+ return m_size == 0;
+ }
+ auto size() const noexcept -> size_type {
+ return m_size;
+ }
+
+ auto numberOfCharacters() const noexcept -> size_type;
+ auto c_str() const -> char const*;
+
+ public: // substrings and searches
+ auto substr( size_type start, size_type size ) const noexcept -> StringRef;
+
+ private: // ownership queries - may not be consistent between calls
+ auto isOwned() const noexcept -> bool;
+ auto isSubstring() const noexcept -> bool;
+ auto data() const noexcept -> char const*;
+ };
+
+ auto operator + ( StringRef const& lhs, StringRef const& rhs ) -> std::string;
+ auto operator + ( StringRef const& lhs, char const* rhs ) -> std::string;
+ auto operator + ( char const* lhs, StringRef const& rhs ) -> std::string;
+
+ auto operator << ( std::ostream& os, StringRef const& sr ) -> std::ostream&;
+
+ inline auto operator "" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef {
+ return StringRef( rawChars, size );
+ }
+
+} // namespace Catch
+
+// end catch_stringref.h
+namespace Catch {
+
+template<typename C>
+class TestInvokerAsMethod : public ITestInvoker {
+ void (C::*m_testAsMethod)();
+public:
+ TestInvokerAsMethod( void (C::*testAsMethod)() ) noexcept : m_testAsMethod( testAsMethod ) {}
+
+ void invoke() const override {
+ C obj;
+ (obj.*m_testAsMethod)();
+ }
+};
+
+auto makeTestInvoker( void(*testAsFunction)() ) noexcept -> ITestInvoker*;
+
+template<typename C>
+auto makeTestInvoker( void (C::*testAsMethod)() ) noexcept -> ITestInvoker* {
+ return new(std::nothrow) TestInvokerAsMethod<C>( testAsMethod );
+}
+
+struct NameAndTags {
+ NameAndTags( StringRef name_ = StringRef(), StringRef tags_ = StringRef() ) noexcept;
+ StringRef name;
+ StringRef tags;
+};
+
+struct AutoReg : NonCopyable {
+ AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef classOrMethod, NameAndTags const& nameAndTags ) noexcept;
+ ~AutoReg();
+};
+
+} // end namespace Catch
+
+#if defined(CATCH_CONFIG_DISABLE)
+ #define INTERNAL_CATCH_TESTCASE_NO_REGISTRATION( TestName, ... ) \
+ static void TestName()
+ #define INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION( TestName, ClassName, ... ) \
+ namespace{ \
+ struct TestName : ClassName { \
+ void test(); \
+ }; \
+ } \
+ void TestName::test()
+
+#endif
+
+ ///////////////////////////////////////////////////////////////////////////////
+ #define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \
+ static void TestName(); \
+ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
+ namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &TestName ), CATCH_INTERNAL_LINEINFO, "", Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \
+ CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
+ static void TestName()
+ #define INTERNAL_CATCH_TESTCASE( ... ) \
+ INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), __VA_ARGS__ )
+
+ ///////////////////////////////////////////////////////////////////////////////
+ #define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \
+ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
+ namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &QualifiedMethod ), CATCH_INTERNAL_LINEINFO, "&" #QualifiedMethod, Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \
+ CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS
+
+ ///////////////////////////////////////////////////////////////////////////////
+ #define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\
+ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
+ namespace{ \
+ struct TestName : ClassName{ \
+ void test(); \
+ }; \
+ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( Catch::makeTestInvoker( &TestName::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \
+ } \
+ CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
+ void TestName::test()
+ #define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... ) \
+ INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, __VA_ARGS__ )
+
+ ///////////////////////////////////////////////////////////////////////////////
+ #define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \
+ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
+ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( Function ), CATCH_INTERNAL_LINEINFO, "", Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \
+ CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS
+
+// end catch_test_registry.h
+// start catch_capture.hpp
+
+// start catch_assertionhandler.h
+
+// start catch_assertioninfo.h
+
+// start catch_result_type.h
+
+namespace Catch {
+
+ // ResultWas::OfType enum
+ struct ResultWas { enum OfType {
+ Unknown = -1,
+ Ok = 0,
+ Info = 1,
+ Warning = 2,
+
+ FailureBit = 0x10,
+
+ ExpressionFailed = FailureBit | 1,
+ ExplicitFailure = FailureBit | 2,
+
+ Exception = 0x100 | FailureBit,
+
+ ThrewException = Exception | 1,
+ DidntThrowException = Exception | 2,
+
+ FatalErrorCondition = 0x200 | FailureBit
+
+ }; };
+
+ bool isOk( ResultWas::OfType resultType );
+ bool isJustInfo( int flags );
+
+ // ResultDisposition::Flags enum
+ struct ResultDisposition { enum Flags {
+ Normal = 0x01,
+
+ ContinueOnFailure = 0x02, // Failures fail test, but execution continues
+ FalseTest = 0x04, // Prefix expression with !
+ SuppressFail = 0x08 // Failures are reported but do not fail the test
+ }; };
+
+ ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs );
+
+ bool shouldContinueOnFailure( int flags );
+ inline bool isFalseTest( int flags ) { return ( flags & ResultDisposition::FalseTest ) != 0; }
+ bool shouldSuppressFailure( int flags );
+
+} // end namespace Catch
+
+// end catch_result_type.h
+namespace Catch {
+
+ struct AssertionInfo
+ {
+ StringRef macroName;
+ SourceLineInfo lineInfo;
+ StringRef capturedExpression;
+ ResultDisposition::Flags resultDisposition;
+
+ // We want to delete this constructor but a compiler bug in 4.8 means
+ // the struct is then treated as non-aggregate
+ //AssertionInfo() = delete;
+ };
+
+} // end namespace Catch
+
+// end catch_assertioninfo.h
+// start catch_decomposer.h
+
+// start catch_tostring.h
+
+#include <vector>
+#include <cstddef>
+#include <type_traits>
+#include <string>
+// start catch_stream.h
+
+#include <iosfwd>
+#include <cstddef>
+#include <ostream>
+
+namespace Catch {
+
+ std::ostream& cout();
+ std::ostream& cerr();
+ std::ostream& clog();
+
+ class StringRef;
+
+ struct IStream {
+ virtual ~IStream();
+ virtual std::ostream& stream() const = 0;
+ };
+
+ auto makeStream( StringRef const &filename ) -> IStream const*;
+
+ class ReusableStringStream {
+ std::size_t m_index;
+ std::ostream* m_oss;
+ public:
+ ReusableStringStream();
+ ~ReusableStringStream();
+
+ auto str() const -> std::string;
+
+ template<typename T>
+ auto operator << ( T const& value ) -> ReusableStringStream& {
+ *m_oss << value;
+ return *this;
+ }
+ auto get() -> std::ostream& { return *m_oss; }
+
+ static void cleanup();
+ };
+}
+
+// end catch_stream.h
+
+#ifdef __OBJC__
+// start catch_objc_arc.hpp
+
+#import <Foundation/Foundation.h>
+
+#ifdef __has_feature
+#define CATCH_ARC_ENABLED __has_feature(objc_arc)
+#else
+#define CATCH_ARC_ENABLED 0
+#endif
+
+void arcSafeRelease( NSObject* obj );
+id performOptionalSelector( id obj, SEL sel );
+
+#if !CATCH_ARC_ENABLED
+inline void arcSafeRelease( NSObject* obj ) {
+ [obj release];
+}
+inline id performOptionalSelector( id obj, SEL sel ) {
+ if( [obj respondsToSelector: sel] )
+ return [obj performSelector: sel];
+ return nil;
+}
+#define CATCH_UNSAFE_UNRETAINED
+#define CATCH_ARC_STRONG
+#else
+inline void arcSafeRelease( NSObject* ){}
+inline id performOptionalSelector( id obj, SEL sel ) {
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
+#endif
+ if( [obj respondsToSelector: sel] )
+ return [obj performSelector: sel];
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+ return nil;
+}
+#define CATCH_UNSAFE_UNRETAINED __unsafe_unretained
+#define CATCH_ARC_STRONG __strong
+#endif
+
+// end catch_objc_arc.hpp
+#endif
+
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4180) // We attempt to stream a function (address) by const&, which MSVC complains about but is harmless
+#endif
+
+// We need a dummy global operator<< so we can bring it into Catch namespace later
+struct Catch_global_namespace_dummy {};
+std::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy);
+
+namespace Catch {
+ // Bring in operator<< from global namespace into Catch namespace
+ using ::operator<<;
+
+ namespace Detail {
+
+ extern const std::string unprintableString;
+
+ std::string rawMemoryToString( const void *object, std::size_t size );
+
+ template<typename T>
+ std::string rawMemoryToString( const T& object ) {
+ return rawMemoryToString( &object, sizeof(object) );
+ }
+
+ template<typename T>
+ class IsStreamInsertable {
+ template<typename SS, typename TT>
+ static auto test(int)
+ -> decltype(std::declval<SS&>() << std::declval<TT>(), std::true_type());
+
+ template<typename, typename>
+ static auto test(...)->std::false_type;
+
+ public:
+ static const bool value = decltype(test<std::ostream, const T&>(0))::value;
+ };
+
+ template<typename E>
+ std::string convertUnknownEnumToString( E e );
+
+ template<typename T>
+ typename std::enable_if<!std::is_enum<T>::value, std::string>::type convertUnstreamable( T const& ) {
+ return Detail::unprintableString;
+ };
+ template<typename T>
+ typename std::enable_if<std::is_enum<T>::value, std::string>::type convertUnstreamable( T const& value ) {
+ return convertUnknownEnumToString( value );
+ };
+
+ } // namespace Detail
+
+ // If we decide for C++14, change these to enable_if_ts
+ template <typename T, typename = void>
+ struct StringMaker {
+ template <typename Fake = T>
+ static
+ typename std::enable_if<::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type
+ convert(const Fake& value) {
+ ReusableStringStream rss;
+ rss << value;
+ return rss.str();
+ }
+
+ template <typename Fake = T>
+ static
+ typename std::enable_if<!::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type
+ convert( const Fake& value ) {
+ return Detail::convertUnstreamable( value );
+ }
+ };
+
+ namespace Detail {
+
+ // This function dispatches all stringification requests inside of Catch.
+ // Should be preferably called fully qualified, like ::Catch::Detail::stringify
+ template <typename T>
+ std::string stringify(const T& e) {
+ return ::Catch::StringMaker<typename std::remove_cv<typename std::remove_reference<T>::type>::type>::convert(e);
+ }
+
+ template<typename E>
+ std::string convertUnknownEnumToString( E e ) {
+ return ::Catch::Detail::stringify(static_cast<typename std::underlying_type<E>::type>(e));
+ }
+
+ } // namespace Detail
+
+ // Some predefined specializations
+
+ template<>
+ struct StringMaker<std::string> {
+ static std::string convert(const std::string& str);
+ };
+ template<>
+ struct StringMaker<std::wstring> {
+ static std::string convert(const std::wstring& wstr);
+ };
+
+ template<>
+ struct StringMaker<char const *> {
+ static std::string convert(char const * str);
+ };
+ template<>
+ struct StringMaker<char *> {
+ static std::string convert(char * str);
+ };
+ template<>
+ struct StringMaker<wchar_t const *> {
+ static std::string convert(wchar_t const * str);
+ };
+ template<>
+ struct StringMaker<wchar_t *> {
+ static std::string convert(wchar_t * str);
+ };
+
+ template<int SZ>
+ struct StringMaker<char[SZ]> {
+ static std::string convert(const char* str) {
+ return ::Catch::Detail::stringify(std::string{ str });
+ }
+ };
+ template<int SZ>
+ struct StringMaker<signed char[SZ]> {
+ static std::string convert(const char* str) {
+ return ::Catch::Detail::stringify(std::string{ str });
+ }
+ };
+ template<int SZ>
+ struct StringMaker<unsigned char[SZ]> {
+ static std::string convert(const char* str) {
+ return ::Catch::Detail::stringify(std::string{ str });
+ }
+ };
+
+ template<>
+ struct StringMaker<int> {
+ static std::string convert(int value);
+ };
+ template<>
+ struct StringMaker<long> {
+ static std::string convert(long value);
+ };
+ template<>
+ struct StringMaker<long long> {
+ static std::string convert(long long value);
+ };
+ template<>
+ struct StringMaker<unsigned int> {
+ static std::string convert(unsigned int value);
+ };
+ template<>
+ struct StringMaker<unsigned long> {
+ static std::string convert(unsigned long value);
+ };
+ template<>
+ struct StringMaker<unsigned long long> {
+ static std::string convert(unsigned long long value);
+ };
+
+ template<>
+ struct StringMaker<bool> {
+ static std::string convert(bool b);
+ };
+
+ template<>
+ struct StringMaker<char> {
+ static std::string convert(char c);
+ };
+ template<>
+ struct StringMaker<signed char> {
+ static std::string convert(signed char c);
+ };
+ template<>
+ struct StringMaker<unsigned char> {
+ static std::string convert(unsigned char c);
+ };
+
+ template<>
+ struct StringMaker<std::nullptr_t> {
+ static std::string convert(std::nullptr_t);
+ };
+
+ template<>
+ struct StringMaker<float> {
+ static std::string convert(float value);
+ };
+ template<>
+ struct StringMaker<double> {
+ static std::string convert(double value);
+ };
+
+ template <typename T>
+ struct StringMaker<T*> {
+ template <typename U>
+ static std::string convert(U* p) {
+ if (p) {
+ return ::Catch::Detail::rawMemoryToString(p);
+ } else {
+ return "nullptr";
+ }
+ }
+ };
+
+ template <typename R, typename C>
+ struct StringMaker<R C::*> {
+ static std::string convert(R C::* p) {
+ if (p) {
+ return ::Catch::Detail::rawMemoryToString(p);
+ } else {
+ return "nullptr";
+ }
+ }
+ };
+
+ namespace Detail {
+ template<typename InputIterator>
+ std::string rangeToString(InputIterator first, InputIterator last) {
+ ReusableStringStream rss;
+ rss << "{ ";
+ if (first != last) {
+ rss << ::Catch::Detail::stringify(*first);
+ for (++first; first != last; ++first)
+ rss << ", " << ::Catch::Detail::stringify(*first);
+ }
+ rss << " }";
+ return rss.str();
+ }
+ }
+
+#ifdef __OBJC__
+ template<>
+ struct StringMaker<NSString*> {
+ static std::string convert(NSString * nsstring) {
+ if (!nsstring)
+ return "nil";
+ return std::string("@") + [nsstring UTF8String];
+ }
+ };
+ template<>
+ struct StringMaker<NSObject*> {
+ static std::string convert(NSObject* nsObject) {
+ return ::Catch::Detail::stringify([nsObject description]);
+ }
+
+ };
+ namespace Detail {
+ inline std::string stringify( NSString* nsstring ) {
+ return StringMaker<NSString*>::convert( nsstring );
+ }
+
+ } // namespace Detail
+#endif // __OBJC__
+
+} // namespace Catch
+
+//////////////////////////////////////////////////////
+// Separate std-lib types stringification, so it can be selectively enabled
+// This means that we do not bring in
+
+#if defined(CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS)
+# define CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER
+# define CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER
+# define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
+#endif
+
+// Separate std::pair specialization
+#if defined(CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER)
+#include <utility>
+namespace Catch {
+ template<typename T1, typename T2>
+ struct StringMaker<std::pair<T1, T2> > {
+ static std::string convert(const std::pair<T1, T2>& pair) {
+ ReusableStringStream rss;
+ rss << "{ "
+ << ::Catch::Detail::stringify(pair.first)
+ << ", "
+ << ::Catch::Detail::stringify(pair.second)
+ << " }";
+ return rss.str();
+ }
+ };
+}
+#endif // CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER
+
+// Separate std::tuple specialization
+#if defined(CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER)
+#include <tuple>
+namespace Catch {
+ namespace Detail {
+ template<
+ typename Tuple,
+ std::size_t N = 0,
+ bool = (N < std::tuple_size<Tuple>::value)
+ >
+ struct TupleElementPrinter {
+ static void print(const Tuple& tuple, std::ostream& os) {
+ os << (N ? ", " : " ")
+ << ::Catch::Detail::stringify(std::get<N>(tuple));
+ TupleElementPrinter<Tuple, N + 1>::print(tuple, os);
+ }
+ };
+
+ template<
+ typename Tuple,
+ std::size_t N
+ >
+ struct TupleElementPrinter<Tuple, N, false> {
+ static void print(const Tuple&, std::ostream&) {}
+ };
+
+ }
+
+ template<typename ...Types>
+ struct StringMaker<std::tuple<Types...>> {
+ static std::string convert(const std::tuple<Types...>& tuple) {
+ ReusableStringStream rss;
+ rss << '{';
+ Detail::TupleElementPrinter<std::tuple<Types...>>::print(tuple, rss.get());
+ rss << " }";
+ return rss.str();
+ }
+ };
+}
+#endif // CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER
+
+namespace Catch {
+ struct not_this_one {}; // Tag type for detecting which begin/ end are being selected
+
+ // Import begin/ end from std here so they are considered alongside the fallback (...) overloads in this namespace
+ using std::begin;
+ using std::end;
+
+ not_this_one begin( ... );
+ not_this_one end( ... );
+
+ template <typename T>
+ struct is_range {
+ static const bool value =
+ !std::is_same<decltype(begin(std::declval<T>())), not_this_one>::value &&
+ !std::is_same<decltype(end(std::declval<T>())), not_this_one>::value;
+ };
+
+ template<typename Range>
+ std::string rangeToString( Range const& range ) {
+ return ::Catch::Detail::rangeToString( begin( range ), end( range ) );
+ }
+
+ // Handle vector<bool> specially
+ template<typename Allocator>
+ std::string rangeToString( std::vector<bool, Allocator> const& v ) {
+ ReusableStringStream rss;
+ rss << "{ ";
+ bool first = true;
+ for( bool b : v ) {
+ if( first )
+ first = false;
+ else
+ rss << ", ";
+ rss << ::Catch::Detail::stringify( b );
+ }
+ rss << " }";
+ return rss.str();
+ }
+
+ template<typename R>
+ struct StringMaker<R, typename std::enable_if<is_range<R>::value && !std::is_array<R>::value>::type> {
+ static std::string convert( R const& range ) {
+ return rangeToString( range );
+ }
+ };
+
+ template <typename T, int SZ>
+ struct StringMaker<T[SZ]> {
+ static std::string convert(T const(&arr)[SZ]) {
+ return rangeToString(arr);
+ }
+ };
+
+} // namespace Catch
+
+// Separate std::chrono::duration specialization
+#if defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER)
+#include <ctime>
+#include <ratio>
+#include <chrono>
+
+namespace Catch {
+
+template <class Ratio>
+struct ratio_string {
+ static std::string symbol();
+};
+
+template <class Ratio>
+std::string ratio_string<Ratio>::symbol() {
+ Catch::ReusableStringStream rss;
+ rss << '[' << Ratio::num << '/'
+ << Ratio::den << ']';
+ return rss.str();
+}
+template <>
+struct ratio_string<std::atto> {
+ static std::string symbol();
+};
+template <>
+struct ratio_string<std::femto> {
+ static std::string symbol();
+};
+template <>
+struct ratio_string<std::pico> {
+ static std::string symbol();
+};
+template <>
+struct ratio_string<std::nano> {
+ static std::string symbol();
+};
+template <>
+struct ratio_string<std::micro> {
+ static std::string symbol();
+};
+template <>
+struct ratio_string<std::milli> {
+ static std::string symbol();
+};
+
+ ////////////
+ // std::chrono::duration specializations
+ template<typename Value, typename Ratio>
+ struct StringMaker<std::chrono::duration<Value, Ratio>> {
+ static std::string convert(std::chrono::duration<Value, Ratio> const& duration) {
+ ReusableStringStream rss;
+ rss << duration.count() << ' ' << ratio_string<Ratio>::symbol() << 's';
+ return rss.str();
+ }
+ };
+ template<typename Value>
+ struct StringMaker<std::chrono::duration<Value, std::ratio<1>>> {
+ static std::string convert(std::chrono::duration<Value, std::ratio<1>> const& duration) {
+ ReusableStringStream rss;
+ rss << duration.count() << " s";
+ return rss.str();
+ }
+ };
+ template<typename Value>
+ struct StringMaker<std::chrono::duration<Value, std::ratio<60>>> {
+ static std::string convert(std::chrono::duration<Value, std::ratio<60>> const& duration) {
+ ReusableStringStream rss;
+ rss << duration.count() << " m";
+ return rss.str();
+ }
+ };
+ template<typename Value>
+ struct StringMaker<std::chrono::duration<Value, std::ratio<3600>>> {
+ static std::string convert(std::chrono::duration<Value, std::ratio<3600>> const& duration) {
+ ReusableStringStream rss;
+ rss << duration.count() << " h";
+ return rss.str();
+ }
+ };
+
+ ////////////
+ // std::chrono::time_point specialization
+ // Generic time_point cannot be specialized, only std::chrono::time_point<system_clock>
+ template<typename Clock, typename Duration>
+ struct StringMaker<std::chrono::time_point<Clock, Duration>> {
+ static std::string convert(std::chrono::time_point<Clock, Duration> const& time_point) {
+ return ::Catch::Detail::stringify(time_point.time_since_epoch()) + " since epoch";
+ }
+ };
+ // std::chrono::time_point<system_clock> specialization
+ template<typename Duration>
+ struct StringMaker<std::chrono::time_point<std::chrono::system_clock, Duration>> {
+ static std::string convert(std::chrono::time_point<std::chrono::system_clock, Duration> const& time_point) {
+ auto converted = std::chrono::system_clock::to_time_t(time_point);
+
+#ifdef _MSC_VER
+ std::tm timeInfo = {};
+ gmtime_s(&timeInfo, &converted);
+#else
+ std::tm* timeInfo = std::gmtime(&converted);
+#endif
+
+ auto const timeStampSize = sizeof("2017-01-16T17:06:45Z");
+ char timeStamp[timeStampSize];
+ const char * const fmt = "%Y-%m-%dT%H:%M:%SZ";
+
+#ifdef _MSC_VER
+ std::strftime(timeStamp, timeStampSize, fmt, &timeInfo);
+#else
+ std::strftime(timeStamp, timeStampSize, fmt, timeInfo);
+#endif
+ return std::string(timeStamp);
+ }
+ };
+}
+#endif // CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+// end catch_tostring.h
+#include <iosfwd>
+
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4389) // '==' : signed/unsigned mismatch
+#pragma warning(disable:4018) // more "signed/unsigned mismatch"
+#pragma warning(disable:4312) // Converting int to T* using reinterpret_cast (issue on x64 platform)
+#pragma warning(disable:4180) // qualifier applied to function type has no meaning
+#endif
+
+namespace Catch {
+
+ struct ITransientExpression {
+ auto isBinaryExpression() const -> bool { return m_isBinaryExpression; }
+ auto getResult() const -> bool { return m_result; }
+ virtual void streamReconstructedExpression( std::ostream &os ) const = 0;
+
+ ITransientExpression( bool isBinaryExpression, bool result )
+ : m_isBinaryExpression( isBinaryExpression ),
+ m_result( result )
+ {}
+
+ // We don't actually need a virtual destructor, but many static analysers
+ // complain if it's not here :-(
+ virtual ~ITransientExpression();
+
+ bool m_isBinaryExpression;
+ bool m_result;
+
+ };
+
+ void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs );
+
+ template<typename LhsT, typename RhsT>
+ class BinaryExpr : public ITransientExpression {
+ LhsT m_lhs;
+ StringRef m_op;
+ RhsT m_rhs;
+
+ void streamReconstructedExpression( std::ostream &os ) const override {
+ formatReconstructedExpression
+ ( os, Catch::Detail::stringify( m_lhs ), m_op, Catch::Detail::stringify( m_rhs ) );
+ }
+
+ public:
+ BinaryExpr( bool comparisonResult, LhsT lhs, StringRef op, RhsT rhs )
+ : ITransientExpression{ true, comparisonResult },
+ m_lhs( lhs ),
+ m_op( op ),
+ m_rhs( rhs )
+ {}
+ };
+
+ template<typename LhsT>
+ class UnaryExpr : public ITransientExpression {
+ LhsT m_lhs;
+
+ void streamReconstructedExpression( std::ostream &os ) const override {
+ os << Catch::Detail::stringify( m_lhs );
+ }
+
+ public:
+ explicit UnaryExpr( LhsT lhs )
+ : ITransientExpression{ false, lhs ? true : false },
+ m_lhs( lhs )
+ {}
+ };
+
+ // Specialised comparison functions to handle equality comparisons between ints and pointers (NULL deduces as an int)
+ template<typename LhsT, typename RhsT>
+ auto compareEqual( LhsT const& lhs, RhsT const& rhs ) -> bool { return static_cast<bool>(lhs == rhs); };
+ template<typename T>
+ auto compareEqual( T* const& lhs, int rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); }
+ template<typename T>
+ auto compareEqual( T* const& lhs, long rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); }
+ template<typename T>
+ auto compareEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; }
+ template<typename T>
+ auto compareEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; }
+
+ template<typename LhsT, typename RhsT>
+ auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return static_cast<bool>(lhs != rhs); };
+ template<typename T>
+ auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); }
+ template<typename T>
+ auto compareNotEqual( T* const& lhs, long rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); }
+ template<typename T>
+ auto compareNotEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) != rhs; }
+ template<typename T>
+ auto compareNotEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) != rhs; }
+
+ template<typename LhsT>
+ class ExprLhs {
+ LhsT m_lhs;
+ public:
+ explicit ExprLhs( LhsT lhs ) : m_lhs( lhs ) {}
+
+ template<typename RhsT>
+ auto operator == ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
+ return { compareEqual( m_lhs, rhs ), m_lhs, "==", rhs };
+ }
+ auto operator == ( bool rhs ) -> BinaryExpr<LhsT, bool> const {
+ return { m_lhs == rhs, m_lhs, "==", rhs };
+ }
+
+ template<typename RhsT>
+ auto operator != ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
+ return { compareNotEqual( m_lhs, rhs ), m_lhs, "!=", rhs };
+ }
+ auto operator != ( bool rhs ) -> BinaryExpr<LhsT, bool> const {
+ return { m_lhs != rhs, m_lhs, "!=", rhs };
+ }
+
+ template<typename RhsT>
+ auto operator > ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
+ return { static_cast<bool>(m_lhs > rhs), m_lhs, ">", rhs };
+ }
+ template<typename RhsT>
+ auto operator < ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
+ return { static_cast<bool>(m_lhs < rhs), m_lhs, "<", rhs };
+ }
+ template<typename RhsT>
+ auto operator >= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
+ return { static_cast<bool>(m_lhs >= rhs), m_lhs, ">=", rhs };
+ }
+ template<typename RhsT>
+ auto operator <= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {
+ return { static_cast<bool>(m_lhs <= rhs), m_lhs, "<=", rhs };
+ }
+
+ auto makeUnaryExpr() const -> UnaryExpr<LhsT> {
+ return UnaryExpr<LhsT>{ m_lhs };
+ }
+ };
+
+ void handleExpression( ITransientExpression const& expr );
+
+ template<typename T>
+ void handleExpression( ExprLhs<T> const& expr ) {
+ handleExpression( expr.makeUnaryExpr() );
+ }
+
+ struct Decomposer {
+ template<typename T>
+ auto operator <= ( T const& lhs ) -> ExprLhs<T const&> {
+ return ExprLhs<T const&>{ lhs };
+ }
+
+ auto operator <=( bool value ) -> ExprLhs<bool> {
+ return ExprLhs<bool>{ value };
+ }
+ };
+
+} // end namespace Catch
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+// end catch_decomposer.h
+// start catch_interfaces_capture.h
+
+#include <string>
+
+namespace Catch {
+
+ class AssertionResult;
+ struct AssertionInfo;
+ struct SectionInfo;
+ struct SectionEndInfo;
+ struct MessageInfo;
+ struct Counts;
+ struct BenchmarkInfo;
+ struct BenchmarkStats;
+ struct AssertionReaction;
+
+ struct ITransientExpression;
+
+ struct IResultCapture {
+
+ virtual ~IResultCapture();
+
+ virtual bool sectionStarted( SectionInfo const& sectionInfo,
+ Counts& assertions ) = 0;
+ virtual void sectionEnded( SectionEndInfo const& endInfo ) = 0;
+ virtual void sectionEndedEarly( SectionEndInfo const& endInfo ) = 0;
+
+ virtual void benchmarkStarting( BenchmarkInfo const& info ) = 0;
+ virtual void benchmarkEnded( BenchmarkStats const& stats ) = 0;
+
+ virtual void pushScopedMessage( MessageInfo const& message ) = 0;
+ virtual void popScopedMessage( MessageInfo const& message ) = 0;
+
+ virtual void handleFatalErrorCondition( StringRef message ) = 0;
+
+ virtual void handleExpr
+ ( AssertionInfo const& info,
+ ITransientExpression const& expr,
+ AssertionReaction& reaction ) = 0;
+ virtual void handleMessage
+ ( AssertionInfo const& info,
+ ResultWas::OfType resultType,
+ StringRef const& message,
+ AssertionReaction& reaction ) = 0;
+ virtual void handleUnexpectedExceptionNotThrown
+ ( AssertionInfo const& info,
+ AssertionReaction& reaction ) = 0;
+ virtual void handleUnexpectedInflightException
+ ( AssertionInfo const& info,
+ std::string const& message,
+ AssertionReaction& reaction ) = 0;
+ virtual void handleIncomplete
+ ( AssertionInfo const& info ) = 0;
+ virtual void handleNonExpr
+ ( AssertionInfo const &info,
+ ResultWas::OfType resultType,
+ AssertionReaction &reaction ) = 0;
+
+ virtual bool lastAssertionPassed() = 0;
+ virtual void assertionPassed() = 0;
+
+ // Deprecated, do not use:
+ virtual std::string getCurrentTestName() const = 0;
+ virtual const AssertionResult* getLastResult() const = 0;
+ virtual void exceptionEarlyReported() = 0;
+ };
+
+ IResultCapture& getResultCapture();
+}
+
+// end catch_interfaces_capture.h
+namespace Catch {
+
+ struct TestFailureException{};
+ struct AssertionResultData;
+ struct IResultCapture;
+ class RunContext;
+
+ class LazyExpression {
+ friend class AssertionHandler;
+ friend struct AssertionStats;
+ friend class RunContext;
+
+ ITransientExpression const* m_transientExpression = nullptr;
+ bool m_isNegated;
+ public:
+ LazyExpression( bool isNegated );
+ LazyExpression( LazyExpression const& other );
+ LazyExpression& operator = ( LazyExpression const& ) = delete;
+
+ explicit operator bool() const;
+
+ friend auto operator << ( std::ostream& os, LazyExpression const& lazyExpr ) -> std::ostream&;
+ };
+
+ struct AssertionReaction {
+ bool shouldDebugBreak = false;
+ bool shouldThrow = false;
+ };
+
+ class AssertionHandler {
+ AssertionInfo m_assertionInfo;
+ AssertionReaction m_reaction;
+ bool m_completed = false;
+ IResultCapture& m_resultCapture;
+
+ public:
+ AssertionHandler
+ ( StringRef macroName,
+ SourceLineInfo const& lineInfo,
+ StringRef capturedExpression,
+ ResultDisposition::Flags resultDisposition );
+ ~AssertionHandler() {
+ if ( !m_completed ) {
+ m_resultCapture.handleIncomplete( m_assertionInfo );
+ }
+ }
+
+ template<typename T>
+ void handleExpr( ExprLhs<T> const& expr ) {
+ handleExpr( expr.makeUnaryExpr() );
+ }
+ void handleExpr( ITransientExpression const& expr );
+
+ void handleMessage(ResultWas::OfType resultType, StringRef const& message);
+
+ void handleExceptionThrownAsExpected();
+ void handleUnexpectedExceptionNotThrown();
+ void handleExceptionNotThrownAsExpected();
+ void handleThrowingCallSkipped();
+ void handleUnexpectedInflightException();
+
+ void complete();
+ void setCompleted();
+
+ // query
+ auto allowThrows() const -> bool;
+ };
+
+ void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef matcherString );
+
+} // namespace Catch
+
+// end catch_assertionhandler.h
+// start catch_message.h
+
+#include <string>
+
+namespace Catch {
+
+ struct MessageInfo {
+ MessageInfo( std::string const& _macroName,
+ SourceLineInfo const& _lineInfo,
+ ResultWas::OfType _type );
+
+ std::string macroName;
+ std::string message;
+ SourceLineInfo lineInfo;
+ ResultWas::OfType type;
+ unsigned int sequence;
+
+ bool operator == ( MessageInfo const& other ) const;
+ bool operator < ( MessageInfo const& other ) const;
+ private:
+ static unsigned int globalCount;
+ };
+
+ struct MessageStream {
+
+ template<typename T>
+ MessageStream& operator << ( T const& value ) {
+ m_stream << value;
+ return *this;
+ }
+
+ ReusableStringStream m_stream;
+ };
+
+ struct MessageBuilder : MessageStream {
+ MessageBuilder( std::string const& macroName,
+ SourceLineInfo const& lineInfo,
+ ResultWas::OfType type );
+
+ template<typename T>
+ MessageBuilder& operator << ( T const& value ) {
+ m_stream << value;
+ return *this;
+ }
+
+ MessageInfo m_info;
+ };
+
+ class ScopedMessage {
+ public:
+ explicit ScopedMessage( MessageBuilder const& builder );
+ ~ScopedMessage();
+
+ MessageInfo m_info;
+ };
+
+} // end namespace Catch
+
+// end catch_message.h
+#if !defined(CATCH_CONFIG_DISABLE)
+
+#if !defined(CATCH_CONFIG_DISABLE_STRINGIFICATION)
+ #define CATCH_INTERNAL_STRINGIFY(...) #__VA_ARGS__
+#else
+ #define CATCH_INTERNAL_STRINGIFY(...) "Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION"
+#endif
+
+#if defined(CATCH_CONFIG_FAST_COMPILE)
+
+///////////////////////////////////////////////////////////////////////////////
+// Another way to speed-up compilation is to omit local try-catch for REQUIRE*
+// macros.
+#define INTERNAL_CATCH_TRY
+#define INTERNAL_CATCH_CATCH( capturer )
+
+#else // CATCH_CONFIG_FAST_COMPILE
+
+#define INTERNAL_CATCH_TRY try
+#define INTERNAL_CATCH_CATCH( handler ) catch(...) { handler.handleUnexpectedInflightException(); }
+
+#endif
+
+#define INTERNAL_CATCH_REACT( handler ) handler.complete();
+
+///////////////////////////////////////////////////////////////////////////////
+#define INTERNAL_CATCH_TEST( macroName, resultDisposition, ... ) \
+ do { \
+ Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \
+ INTERNAL_CATCH_TRY { \
+ CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \
+ catchAssertionHandler.handleExpr( Catch::Decomposer() <= __VA_ARGS__ ); \
+ CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \
+ } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \
+ INTERNAL_CATCH_REACT( catchAssertionHandler ) \
+ } while( (void)0, false && static_cast<bool>( !!(__VA_ARGS__) ) ) // the expression here is never evaluated at runtime but it forces the compiler to give it a look
+ // The double negation silences MSVC's C4800 warning, the static_cast forces short-circuit evaluation if the type has overloaded &&.
+
+///////////////////////////////////////////////////////////////////////////////
+#define INTERNAL_CATCH_IF( macroName, resultDisposition, ... ) \
+ INTERNAL_CATCH_TEST( macroName, resultDisposition, __VA_ARGS__ ); \
+ if( Catch::getResultCapture().lastAssertionPassed() )
+
+///////////////////////////////////////////////////////////////////////////////
+#define INTERNAL_CATCH_ELSE( macroName, resultDisposition, ... ) \
+ INTERNAL_CATCH_TEST( macroName, resultDisposition, __VA_ARGS__ ); \
+ if( !Catch::getResultCapture().lastAssertionPassed() )
+
+///////////////////////////////////////////////////////////////////////////////
+#define INTERNAL_CATCH_NO_THROW( macroName, resultDisposition, ... ) \
+ do { \
+ Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \
+ try { \
+ static_cast<void>(__VA_ARGS__); \
+ catchAssertionHandler.handleExceptionNotThrownAsExpected(); \
+ } \
+ catch( ... ) { \
+ catchAssertionHandler.handleUnexpectedInflightException(); \
+ } \
+ INTERNAL_CATCH_REACT( catchAssertionHandler ) \
+ } while( false )
+
+///////////////////////////////////////////////////////////////////////////////
+#define INTERNAL_CATCH_THROWS( macroName, resultDisposition, ... ) \
+ do { \
+ Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition); \
+ if( catchAssertionHandler.allowThrows() ) \
+ try { \
+ static_cast<void>(__VA_ARGS__); \
+ catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \
+ } \
+ catch( ... ) { \
+ catchAssertionHandler.handleExceptionThrownAsExpected(); \
+ } \
+ else \
+ catchAssertionHandler.handleThrowingCallSkipped(); \
+ INTERNAL_CATCH_REACT( catchAssertionHandler ) \
+ } while( false )
+
+///////////////////////////////////////////////////////////////////////////////
+#define INTERNAL_CATCH_THROWS_AS( macroName, exceptionType, resultDisposition, expr ) \
+ do { \
+ Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(expr) ", " CATCH_INTERNAL_STRINGIFY(exceptionType), resultDisposition ); \
+ if( catchAssertionHandler.allowThrows() ) \
+ try { \
+ static_cast<void>(expr); \
+ catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \
+ } \
+ catch( exceptionType const& ) { \
+ catchAssertionHandler.handleExceptionThrownAsExpected(); \
+ } \
+ catch( ... ) { \
+ catchAssertionHandler.handleUnexpectedInflightException(); \
+ } \
+ else \
+ catchAssertionHandler.handleThrowingCallSkipped(); \
+ INTERNAL_CATCH_REACT( catchAssertionHandler ) \
+ } while( false )
+
+///////////////////////////////////////////////////////////////////////////////
+#define INTERNAL_CATCH_MSG( macroName, messageType, resultDisposition, ... ) \
+ do { \
+ Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, "", resultDisposition ); \
+ catchAssertionHandler.handleMessage( messageType, ( Catch::MessageStream() << __VA_ARGS__ + ::Catch::StreamEndStop() ).m_stream.str() ); \
+ INTERNAL_CATCH_REACT( catchAssertionHandler ) \
+ } while( false )
+
+///////////////////////////////////////////////////////////////////////////////
+#define INTERNAL_CATCH_INFO( macroName, log ) \
+ Catch::ScopedMessage INTERNAL_CATCH_UNIQUE_NAME( scopedMessage )( Catch::MessageBuilder( macroName, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log );
+
+///////////////////////////////////////////////////////////////////////////////
+// Although this is matcher-based, it can be used with just a string
+#define INTERNAL_CATCH_THROWS_STR_MATCHES( macroName, resultDisposition, matcher, ... ) \
+ do { \
+ Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \
+ if( catchAssertionHandler.allowThrows() ) \
+ try { \
+ static_cast<void>(__VA_ARGS__); \
+ catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \
+ } \
+ catch( ... ) { \
+ Catch::handleExceptionMatchExpr( catchAssertionHandler, matcher, #matcher ); \
+ } \
+ else \
+ catchAssertionHandler.handleThrowingCallSkipped(); \
+ INTERNAL_CATCH_REACT( catchAssertionHandler ) \
+ } while( false )
+
+#endif // CATCH_CONFIG_DISABLE
+
+// end catch_capture.hpp
+// start catch_section.h
+
+// start catch_section_info.h
+
+// start catch_totals.h
+
+#include <cstddef>
+
+namespace Catch {
+
+ struct Counts {
+ Counts operator - ( Counts const& other ) const;
+ Counts& operator += ( Counts const& other );
+
+ std::size_t total() const;
+ bool allPassed() const;
+ bool allOk() const;
+
+ std::size_t passed = 0;
+ std::size_t failed = 0;
+ std::size_t failedButOk = 0;
+ };
+
+ struct Totals {
+
+ Totals operator - ( Totals const& other ) const;
+ Totals& operator += ( Totals const& other );
+
+ Totals delta( Totals const& prevTotals ) const;
+
+ Counts assertions;
+ Counts testCases;
+ };
+}
+
+// end catch_totals.h
+#include <string>
+
+namespace Catch {
+
+ struct SectionInfo {
+ SectionInfo
+ ( SourceLineInfo const& _lineInfo,
+ std::string const& _name,
+ std::string const& _description = std::string() );
+
+ std::string name;
+ std::string description;
+ SourceLineInfo lineInfo;
+ };
+
+ struct SectionEndInfo {
+ SectionEndInfo( SectionInfo const& _sectionInfo, Counts const& _prevAssertions, double _durationInSeconds );
+
+ SectionInfo sectionInfo;
+ Counts prevAssertions;
+ double durationInSeconds;
+ };
+
+} // end namespace Catch
+
+// end catch_section_info.h
+// start catch_timer.h
+
+#include <cstdint>
+
+namespace Catch {
+
+ auto getCurrentNanosecondsSinceEpoch() -> uint64_t;
+ auto getEstimatedClockResolution() -> uint64_t;
+
+ class Timer {
+ uint64_t m_nanoseconds = 0;
+ public:
+ void start();
+ auto getElapsedNanoseconds() const -> uint64_t;
+ auto getElapsedMicroseconds() const -> uint64_t;
+ auto getElapsedMilliseconds() const -> unsigned int;
+ auto getElapsedSeconds() const -> double;
+ };
+
+} // namespace Catch
+
+// end catch_timer.h
+#include <string>
+
+namespace Catch {
+
+ class Section : NonCopyable {
+ public:
+ Section( SectionInfo const& info );
+ ~Section();
+
+ // This indicates whether the section should be executed or not
+ explicit operator bool() const;
+
+ private:
+ SectionInfo m_info;
+
+ std::string m_name;
+ Counts m_assertions;
+ bool m_sectionIncluded;
+ Timer m_timer;
+ };
+
+} // end namespace Catch
+
+ #define INTERNAL_CATCH_SECTION( ... ) \
+ if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) )
+
+// end catch_section.h
+// start catch_benchmark.h
+
+#include <cstdint>
+#include <string>
+
+namespace Catch {
+
+ class BenchmarkLooper {
+
+ std::string m_name;
+ std::size_t m_count = 0;
+ std::size_t m_iterationsToRun = 1;
+ uint64_t m_resolution;
+ Timer m_timer;
+
+ static auto getResolution() -> uint64_t;
+ public:
+ // Keep most of this inline as it's on the code path that is being timed
+ BenchmarkLooper( StringRef name )
+ : m_name( name ),
+ m_resolution( getResolution() )
+ {
+ reportStart();
+ m_timer.start();
+ }
+
+ explicit operator bool() {
+ if( m_count < m_iterationsToRun )
+ return true;
+ return needsMoreIterations();
+ }
+
+ void increment() {
+ ++m_count;
+ }
+
+ void reportStart();
+ auto needsMoreIterations() -> bool;
+ };
+
+} // end namespace Catch
+
+#define BENCHMARK( name ) \
+ for( Catch::BenchmarkLooper looper( name ); looper; looper.increment() )
+
+// end catch_benchmark.h
+// start catch_interfaces_exception.h
+
+// start catch_interfaces_registry_hub.h
+
+#include <string>
+#include <memory>
+
+namespace Catch {
+
+ class TestCase;
+ struct ITestCaseRegistry;
+ struct IExceptionTranslatorRegistry;
+ struct IExceptionTranslator;
+ struct IReporterRegistry;
+ struct IReporterFactory;
+ struct ITagAliasRegistry;
+ class StartupExceptionRegistry;
+
+ using IReporterFactoryPtr = std::shared_ptr<IReporterFactory>;
+
+ struct IRegistryHub {
+ virtual ~IRegistryHub();
+
+ virtual IReporterRegistry const& getReporterRegistry() const = 0;
+ virtual ITestCaseRegistry const& getTestCaseRegistry() const = 0;
+ virtual ITagAliasRegistry const& getTagAliasRegistry() const = 0;
+
+ virtual IExceptionTranslatorRegistry& getExceptionTranslatorRegistry() = 0;
+
+ virtual StartupExceptionRegistry const& getStartupExceptionRegistry() const = 0;
+ };
+
+ struct IMutableRegistryHub {
+ virtual ~IMutableRegistryHub();
+ virtual void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) = 0;
+ virtual void registerListener( IReporterFactoryPtr const& factory ) = 0;
+ virtual void registerTest( TestCase const& testInfo ) = 0;
+ virtual void registerTranslator( const IExceptionTranslator* translator ) = 0;
+ virtual void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) = 0;
+ virtual void registerStartupException() noexcept = 0;
+ };
+
+ IRegistryHub& getRegistryHub();
+ IMutableRegistryHub& getMutableRegistryHub();
+ void cleanUp();
+ std::string translateActiveException();
+
+}
+
+// end catch_interfaces_registry_hub.h
+#if defined(CATCH_CONFIG_DISABLE)
+ #define INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( translatorName, signature) \
+ static std::string translatorName( signature )
+#endif
+
+#include <exception>
+#include <string>
+#include <vector>
+
+namespace Catch {
+ using exceptionTranslateFunction = std::string(*)();
+
+ struct IExceptionTranslator;
+ using ExceptionTranslators = std::vector<std::unique_ptr<IExceptionTranslator const>>;
+
+ struct IExceptionTranslator {
+ virtual ~IExceptionTranslator();
+ virtual std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const = 0;
+ };
+
+ struct IExceptionTranslatorRegistry {
+ virtual ~IExceptionTranslatorRegistry();
+
+ virtual std::string translateActiveException() const = 0;
+ };
+
+ class ExceptionTranslatorRegistrar {
+ template<typename T>
+ class ExceptionTranslator : public IExceptionTranslator {
+ public:
+
+ ExceptionTranslator( std::string(*translateFunction)( T& ) )
+ : m_translateFunction( translateFunction )
+ {}
+
+ std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const override {
+ try {
+ if( it == itEnd )
+ std::rethrow_exception(std::current_exception());
+ else
+ return (*it)->translate( it+1, itEnd );
+ }
+ catch( T& ex ) {
+ return m_translateFunction( ex );
+ }
+ }
+
+ protected:
+ std::string(*m_translateFunction)( T& );
+ };
+
+ public:
+ template<typename T>
+ ExceptionTranslatorRegistrar( std::string(*translateFunction)( T& ) ) {
+ getMutableRegistryHub().registerTranslator
+ ( new ExceptionTranslator<T>( translateFunction ) );
+ }
+ };
+}
+
+///////////////////////////////////////////////////////////////////////////////
+#define INTERNAL_CATCH_TRANSLATE_EXCEPTION2( translatorName, signature ) \
+ static std::string translatorName( signature ); \
+ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
+ namespace{ Catch::ExceptionTranslatorRegistrar INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionRegistrar )( &translatorName ); } \
+ CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
+ static std::string translatorName( signature )
+
+#define INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION2( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature )
+
+// end catch_interfaces_exception.h
+// start catch_approx.h
+
+#include <type_traits>
+#include <stdexcept>
+
+namespace Catch {
+namespace Detail {
+
+ class Approx {
+ private:
+ bool equalityComparisonImpl(double other) const;
+
+ public:
+ explicit Approx ( double value );
+
+ static Approx custom();
+
+ template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+ Approx operator()( T const& value ) {
+ Approx approx( static_cast<double>(value) );
+ approx.epsilon( m_epsilon );
+ approx.margin( m_margin );
+ approx.scale( m_scale );
+ return approx;
+ }
+
+ template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+ explicit Approx( T const& value ): Approx(static_cast<double>(value))
+ {}
+
+ template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+ friend bool operator == ( const T& lhs, Approx const& rhs ) {
+ auto lhs_v = static_cast<double>(lhs);
+ return rhs.equalityComparisonImpl(lhs_v);
+ }
+
+ template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+ friend bool operator == ( Approx const& lhs, const T& rhs ) {
+ return operator==( rhs, lhs );
+ }
+
+ template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+ friend bool operator != ( T const& lhs, Approx const& rhs ) {
+ return !operator==( lhs, rhs );
+ }
+
+ template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+ friend bool operator != ( Approx const& lhs, T const& rhs ) {
+ return !operator==( rhs, lhs );
+ }
+
+ template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+ friend bool operator <= ( T const& lhs, Approx const& rhs ) {
+ return static_cast<double>(lhs) < rhs.m_value || lhs == rhs;
+ }
+
+ template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+ friend bool operator <= ( Approx const& lhs, T const& rhs ) {
+ return lhs.m_value < static_cast<double>(rhs) || lhs == rhs;
+ }
+
+ template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+ friend bool operator >= ( T const& lhs, Approx const& rhs ) {
+ return static_cast<double>(lhs) > rhs.m_value || lhs == rhs;
+ }
+
+ template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+ friend bool operator >= ( Approx const& lhs, T const& rhs ) {
+ return lhs.m_value > static_cast<double>(rhs) || lhs == rhs;
+ }
+
+ template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+ Approx& epsilon( T const& newEpsilon ) {
+ double epsilonAsDouble = static_cast<double>(newEpsilon);
+ if( epsilonAsDouble < 0 || epsilonAsDouble > 1.0 ) {
+ throw std::domain_error
+ ( "Invalid Approx::epsilon: " +
+ Catch::Detail::stringify( epsilonAsDouble ) +
+ ", Approx::epsilon has to be between 0 and 1" );
+ }
+ m_epsilon = epsilonAsDouble;
+ return *this;
+ }
+
+ template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+ Approx& margin( T const& newMargin ) {
+ double marginAsDouble = static_cast<double>(newMargin);
+ if( marginAsDouble < 0 ) {
+ throw std::domain_error
+ ( "Invalid Approx::margin: " +
+ Catch::Detail::stringify( marginAsDouble ) +
+ ", Approx::Margin has to be non-negative." );
+
+ }
+ m_margin = marginAsDouble;
+ return *this;
+ }
+
+ template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
+ Approx& scale( T const& newScale ) {
+ m_scale = static_cast<double>(newScale);
+ return *this;
+ }
+
+ std::string toString() const;
+
+ private:
+ double m_epsilon;
+ double m_margin;
+ double m_scale;
+ double m_value;
+ };
+}
+
+template<>
+struct StringMaker<Catch::Detail::Approx> {
+ static std::string convert(Catch::Detail::Approx const& value);
+};
+
+} // end namespace Catch
+
+// end catch_approx.h
+// start catch_string_manip.h
+
+#include <string>
+#include <iosfwd>
+
+namespace Catch {
+
+ bool startsWith( std::string const& s, std::string const& prefix );
+ bool startsWith( std::string const& s, char prefix );
+ bool endsWith( std::string const& s, std::string const& suffix );
+ bool endsWith( std::string const& s, char suffix );
+ bool contains( std::string const& s, std::string const& infix );
+ void toLowerInPlace( std::string& s );
+ std::string toLower( std::string const& s );
+ std::string trim( std::string const& str );
+ bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis );
+
+ struct pluralise {
+ pluralise( std::size_t count, std::string const& label );
+
+ friend std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser );
+
+ std::size_t m_count;
+ std::string m_label;
+ };
+}
+
+// end catch_string_manip.h
+#ifndef CATCH_CONFIG_DISABLE_MATCHERS
+// start catch_capture_matchers.h
+
+// start catch_matchers.h
+
+#include <string>
+#include <vector>
+
+namespace Catch {
+namespace Matchers {
+ namespace Impl {
+
+ template<typename ArgT> struct MatchAllOf;
+ template<typename ArgT> struct MatchAnyOf;
+ template<typename ArgT> struct MatchNotOf;
+
+ class MatcherUntypedBase {
+ public:
+ MatcherUntypedBase() = default;
+ MatcherUntypedBase ( MatcherUntypedBase const& ) = default;
+ MatcherUntypedBase& operator = ( MatcherUntypedBase const& ) = delete;
+ std::string toString() const;
+
+ protected:
+ virtual ~MatcherUntypedBase();
+ virtual std::string describe() const = 0;
+ mutable std::string m_cachedToString;
+ };
+
+ template<typename ObjectT>
+ struct MatcherMethod {
+ virtual bool match( ObjectT const& arg ) const = 0;
+ };
+ template<typename PtrT>
+ struct MatcherMethod<PtrT*> {
+ virtual bool match( PtrT* arg ) const = 0;
+ };
+
+ template<typename T>
+ struct MatcherBase : MatcherUntypedBase, MatcherMethod<T> {
+
+ MatchAllOf<T> operator && ( MatcherBase const& other ) const;
+ MatchAnyOf<T> operator || ( MatcherBase const& other ) const;
+ MatchNotOf<T> operator ! () const;
+ };
+
+ template<typename ArgT>
+ struct MatchAllOf : MatcherBase<ArgT> {
+ bool match( ArgT const& arg ) const override {
+ for( auto matcher : m_matchers ) {
+ if (!matcher->match(arg))
+ return false;
+ }
+ return true;
+ }
+ std::string describe() const override {
+ std::string description;
+ description.reserve( 4 + m_matchers.size()*32 );
+ description += "( ";
+ bool first = true;
+ for( auto matcher : m_matchers ) {
+ if( first )
+ first = false;
+ else
+ description += " and ";
+ description += matcher->toString();
+ }
+ description += " )";
+ return description;
+ }
+
+ MatchAllOf<ArgT>& operator && ( MatcherBase<ArgT> const& other ) {
+ m_matchers.push_back( &other );
+ return *this;
+ }
+
+ std::vector<MatcherBase<ArgT> const*> m_matchers;
+ };
+ template<typename ArgT>
+ struct MatchAnyOf : MatcherBase<ArgT> {
+
+ bool match( ArgT const& arg ) const override {
+ for( auto matcher : m_matchers ) {
+ if (matcher->match(arg))
+ return true;
+ }
+ return false;
+ }
+ std::string describe() const override {
+ std::string description;
+ description.reserve( 4 + m_matchers.size()*32 );
+ description += "( ";
+ bool first = true;
+ for( auto matcher : m_matchers ) {
+ if( first )
+ first = false;
+ else
+ description += " or ";
+ description += matcher->toString();
+ }
+ description += " )";
+ return description;
+ }
+
+ MatchAnyOf<ArgT>& operator || ( MatcherBase<ArgT> const& other ) {
+ m_matchers.push_back( &other );
+ return *this;
+ }
+
+ std::vector<MatcherBase<ArgT> const*> m_matchers;
+ };
+
+ template<typename ArgT>
+ struct MatchNotOf : MatcherBase<ArgT> {
+
+ MatchNotOf( MatcherBase<ArgT> const& underlyingMatcher ) : m_underlyingMatcher( underlyingMatcher ) {}
+
+ bool match( ArgT const& arg ) const override {
+ return !m_underlyingMatcher.match( arg );
+ }
+
+ std::string describe() const override {
+ return "not " + m_underlyingMatcher.toString();
+ }
+ MatcherBase<ArgT> const& m_underlyingMatcher;
+ };
+
+ template<typename T>
+ MatchAllOf<T> MatcherBase<T>::operator && ( MatcherBase const& other ) const {
+ return MatchAllOf<T>() && *this && other;
+ }
+ template<typename T>
+ MatchAnyOf<T> MatcherBase<T>::operator || ( MatcherBase const& other ) const {
+ return MatchAnyOf<T>() || *this || other;
+ }
+ template<typename T>
+ MatchNotOf<T> MatcherBase<T>::operator ! () const {
+ return MatchNotOf<T>( *this );
+ }
+
+ } // namespace Impl
+
+} // namespace Matchers
+
+using namespace Matchers;
+using Matchers::Impl::MatcherBase;
+
+} // namespace Catch
+
+// end catch_matchers.h
+// start catch_matchers_floating.h
+
+#include <type_traits>
+#include <cmath>
+
+namespace Catch {
+namespace Matchers {
+
+ namespace Floating {
+
+ enum class FloatingPointKind : uint8_t;
+
+ struct WithinAbsMatcher : MatcherBase<double> {
+ WithinAbsMatcher(double target, double margin);
+ bool match(double const& matchee) const override;
+ std::string describe() const override;
+ private:
+ double m_target;
+ double m_margin;
+ };
+
+ struct WithinUlpsMatcher : MatcherBase<double> {
+ WithinUlpsMatcher(double target, int ulps, FloatingPointKind baseType);
+ bool match(double const& matchee) const override;
+ std::string describe() const override;
+ private:
+ double m_target;
+ int m_ulps;
+ FloatingPointKind m_type;
+ };
+
+ } // namespace Floating
+
+ // The following functions create the actual matcher objects.
+ // This allows the types to be inferred
+ Floating::WithinUlpsMatcher WithinULP(double target, int maxUlpDiff);
+ Floating::WithinUlpsMatcher WithinULP(float target, int maxUlpDiff);
+ Floating::WithinAbsMatcher WithinAbs(double target, double margin);
+
+} // namespace Matchers
+} // namespace Catch
+
+// end catch_matchers_floating.h
+// start catch_matchers_string.h
+
+#include <string>
+
+namespace Catch {
+namespace Matchers {
+
+ namespace StdString {
+
+ struct CasedString
+ {
+ CasedString( std::string const& str, CaseSensitive::Choice caseSensitivity );
+ std::string adjustString( std::string const& str ) const;
+ std::string caseSensitivitySuffix() const;
+
+ CaseSensitive::Choice m_caseSensitivity;
+ std::string m_str;
+ };
+
+ struct StringMatcherBase : MatcherBase<std::string> {
+ StringMatcherBase( std::string const& operation, CasedString const& comparator );
+ std::string describe() const override;
+
+ CasedString m_comparator;
+ std::string m_operation;
+ };
+
+ struct EqualsMatcher : StringMatcherBase {
+ EqualsMatcher( CasedString const& comparator );
+ bool match( std::string const& source ) const override;
+ };
+ struct ContainsMatcher : StringMatcherBase {
+ ContainsMatcher( CasedString const& comparator );
+ bool match( std::string const& source ) const override;
+ };
+ struct StartsWithMatcher : StringMatcherBase {
+ StartsWithMatcher( CasedString const& comparator );
+ bool match( std::string const& source ) const override;
+ };
+ struct EndsWithMatcher : StringMatcherBase {
+ EndsWithMatcher( CasedString const& comparator );
+ bool match( std::string const& source ) const override;
+ };
+
+ struct RegexMatcher : MatcherBase<std::string> {
+ RegexMatcher( std::string regex, CaseSensitive::Choice caseSensitivity );
+ bool match( std::string const& matchee ) const override;
+ std::string describe() const override;
+
+ private:
+ std::string m_regex;
+ CaseSensitive::Choice m_caseSensitivity;
+ };
+
+ } // namespace StdString
+
+ // The following functions create the actual matcher objects.
+ // This allows the types to be inferred
+
+ StdString::EqualsMatcher Equals( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes );
+ StdString::ContainsMatcher Contains( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes );
+ StdString::EndsWithMatcher EndsWith( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes );
+ StdString::StartsWithMatcher StartsWith( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes );
+ StdString::RegexMatcher Matches( std::string const& regex, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes );
+
+} // namespace Matchers
+} // namespace Catch
+
+// end catch_matchers_string.h
+// start catch_matchers_vector.h
+
+#include <algorithm>
+
+namespace Catch {
+namespace Matchers {
+
+ namespace Vector {
+ namespace Detail {
+ template <typename InputIterator, typename T>
+ size_t count(InputIterator first, InputIterator last, T const& item) {
+ size_t cnt = 0;
+ for (; first != last; ++first) {
+ if (*first == item) {
+ ++cnt;
+ }
+ }
+ return cnt;
+ }
+ template <typename InputIterator, typename T>
+ bool contains(InputIterator first, InputIterator last, T const& item) {
+ for (; first != last; ++first) {
+ if (*first == item) {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+
+ template<typename T>
+ struct ContainsElementMatcher : MatcherBase<std::vector<T>> {
+
+ ContainsElementMatcher(T const &comparator) : m_comparator( comparator) {}
+
+ bool match(std::vector<T> const &v) const override {
+ for (auto const& el : v) {
+ if (el == m_comparator) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ std::string describe() const override {
+ return "Contains: " + ::Catch::Detail::stringify( m_comparator );
+ }
+
+ T const& m_comparator;
+ };
+
+ template<typename T>
+ struct ContainsMatcher : MatcherBase<std::vector<T>> {
+
+ ContainsMatcher(std::vector<T> const &comparator) : m_comparator( comparator ) {}
+
+ bool match(std::vector<T> const &v) const override {
+ // !TBD: see note in EqualsMatcher
+ if (m_comparator.size() > v.size())
+ return false;
+ for (auto const& comparator : m_comparator) {
+ auto present = false;
+ for (const auto& el : v) {
+ if (el == comparator) {
+ present = true;
+ break;
+ }
+ }
+ if (!present) {
+ return false;
+ }
+ }
+ return true;
+ }
+ std::string describe() const override {
+ return "Contains: " + ::Catch::Detail::stringify( m_comparator );
+ }
+
+ std::vector<T> const& m_comparator;
+ };
+
+ template<typename T>
+ struct EqualsMatcher : MatcherBase<std::vector<T>> {
+
+ EqualsMatcher(std::vector<T> const &comparator) : m_comparator( comparator ) {}
+
+ bool match(std::vector<T> const &v) const override {
+ // !TBD: This currently works if all elements can be compared using !=
+ // - a more general approach would be via a compare template that defaults
+ // to using !=. but could be specialised for, e.g. std::vector<T> etc
+ // - then just call that directly
+ if (m_comparator.size() != v.size())
+ return false;
+ for (std::size_t i = 0; i < v.size(); ++i)
+ if (m_comparator[i] != v[i])
+ return false;
+ return true;
+ }
+ std::string describe() const override {
+ return "Equals: " + ::Catch::Detail::stringify( m_comparator );
+ }
+ std::vector<T> const& m_comparator;
+ };
+
+ template<typename T>
+ struct UnorderedEqualsMatcher : MatcherBase<std::vector<T>> {
+ UnorderedEqualsMatcher(std::vector<T> const& target) : m_target(target) {}
+ bool match(std::vector<T> const& vec) const override {
+ // Note: This is a reimplementation of std::is_permutation,
+ // because I don't want to include <algorithm> inside the common path
+ if (m_target.size() != vec.size()) {
+ return false;
+ }
+ auto lfirst = m_target.begin(), llast = m_target.end();
+ auto rfirst = vec.begin(), rlast = vec.end();
+ // Cut common prefix to optimize checking of permuted parts
+ while (lfirst != llast && *lfirst != *rfirst) {
+ ++lfirst; ++rfirst;
+ }
+ if (lfirst == llast) {
+ return true;
+ }
+
+ for (auto mid = lfirst; mid != llast; ++mid) {
+ // Skip already counted items
+ if (Detail::contains(lfirst, mid, *mid)) {
+ continue;
+ }
+ size_t num_vec = Detail::count(rfirst, rlast, *mid);
+ if (num_vec == 0 || Detail::count(lfirst, llast, *mid) != num_vec) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ std::string describe() const override {
+ return "UnorderedEquals: " + ::Catch::Detail::stringify(m_target);
+ }
+ private:
+ std::vector<T> const& m_target;
+ };
+
+ } // namespace Vector
+
+ // The following functions create the actual matcher objects.
+ // This allows the types to be inferred
+
+ template<typename T>
+ Vector::ContainsMatcher<T> Contains( std::vector<T> const& comparator ) {
+ return Vector::ContainsMatcher<T>( comparator );
+ }
+
+ template<typename T>
+ Vector::ContainsElementMatcher<T> VectorContains( T const& comparator ) {
+ return Vector::ContainsElementMatcher<T>( comparator );
+ }
+
+ template<typename T>
+ Vector::EqualsMatcher<T> Equals( std::vector<T> const& comparator ) {
+ return Vector::EqualsMatcher<T>( comparator );
+ }
+
+ template<typename T>
+ Vector::UnorderedEqualsMatcher<T> UnorderedEquals(std::vector<T> const& target) {
+ return Vector::UnorderedEqualsMatcher<T>(target);
+ }
+
+} // namespace Matchers
+} // namespace Catch
+
+// end catch_matchers_vector.h
+namespace Catch {
+
+ template<typename ArgT, typename MatcherT>
+ class MatchExpr : public ITransientExpression {
+ ArgT const& m_arg;
+ MatcherT m_matcher;
+ StringRef m_matcherString;
+ public:
+ MatchExpr( ArgT const& arg, MatcherT const& matcher, StringRef matcherString )
+ : ITransientExpression{ true, matcher.match( arg ) },
+ m_arg( arg ),
+ m_matcher( matcher ),
+ m_matcherString( matcherString )
+ {}
+
+ void streamReconstructedExpression( std::ostream &os ) const override {
+ auto matcherAsString = m_matcher.toString();
+ os << Catch::Detail::stringify( m_arg ) << ' ';
+ if( matcherAsString == Detail::unprintableString )
+ os << m_matcherString;
+ else
+ os << matcherAsString;
+ }
+ };
+
+ using StringMatcher = Matchers::Impl::MatcherBase<std::string>;
+
+ void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef matcherString );
+
+ template<typename ArgT, typename MatcherT>
+ auto makeMatchExpr( ArgT const& arg, MatcherT const& matcher, StringRef matcherString ) -> MatchExpr<ArgT, MatcherT> {
+ return MatchExpr<ArgT, MatcherT>( arg, matcher, matcherString );
+ }
+
+} // namespace Catch
+
+///////////////////////////////////////////////////////////////////////////////
+#define INTERNAL_CHECK_THAT( macroName, matcher, resultDisposition, arg ) \
+ do { \
+ Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(arg) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \
+ INTERNAL_CATCH_TRY { \
+ catchAssertionHandler.handleExpr( Catch::makeMatchExpr( arg, matcher, #matcher ) ); \
+ } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \
+ INTERNAL_CATCH_REACT( catchAssertionHandler ) \
+ } while( false )
+
+///////////////////////////////////////////////////////////////////////////////
+#define INTERNAL_CATCH_THROWS_MATCHES( macroName, exceptionType, resultDisposition, matcher, ... ) \
+ do { \
+ Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) ", " CATCH_INTERNAL_STRINGIFY(exceptionType) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \
+ if( catchAssertionHandler.allowThrows() ) \
+ try { \
+ static_cast<void>(__VA_ARGS__ ); \
+ catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \
+ } \
+ catch( exceptionType const& ex ) { \
+ catchAssertionHandler.handleExpr( Catch::makeMatchExpr( ex, matcher, #matcher ) ); \
+ } \
+ catch( ... ) { \
+ catchAssertionHandler.handleUnexpectedInflightException(); \
+ } \
+ else \
+ catchAssertionHandler.handleThrowingCallSkipped(); \
+ INTERNAL_CATCH_REACT( catchAssertionHandler ) \
+ } while( false )
+
+// end catch_capture_matchers.h
+#endif
+
+// These files are included here so the single_include script doesn't put them
+// in the conditionally compiled sections
+// start catch_test_case_info.h
+
+#include <string>
+#include <vector>
+#include <memory>
+
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpadded"
+#endif
+
+namespace Catch {
+
+ struct ITestInvoker;
+
+ struct TestCaseInfo {
+ enum SpecialProperties{
+ None = 0,
+ IsHidden = 1 << 1,
+ ShouldFail = 1 << 2,
+ MayFail = 1 << 3,
+ Throws = 1 << 4,
+ NonPortable = 1 << 5,
+ Benchmark = 1 << 6
+ };
+
+ TestCaseInfo( std::string const& _name,
+ std::string const& _className,
+ std::string const& _description,
+ std::vector<std::string> const& _tags,
+ SourceLineInfo const& _lineInfo );
+
+ friend void setTags( TestCaseInfo& testCaseInfo, std::vector<std::string> tags );
+
+ bool isHidden() const;
+ bool throws() const;
+ bool okToFail() const;
+ bool expectedToFail() const;
+
+ std::string tagsAsString() const;
+
+ std::string name;
+ std::string className;
+ std::string description;
+ std::vector<std::string> tags;
+ std::vector<std::string> lcaseTags;
+ SourceLineInfo lineInfo;
+ SpecialProperties properties;
+ };
+
+ class TestCase : public TestCaseInfo {
+ public:
+
+ TestCase( ITestInvoker* testCase, TestCaseInfo const& info );
+
+ TestCase withName( std::string const& _newName ) const;
+
+ void invoke() const;
+
+ TestCaseInfo const& getTestCaseInfo() const;
+
+ bool operator == ( TestCase const& other ) const;
+ bool operator < ( TestCase const& other ) const;
+
+ private:
+ std::shared_ptr<ITestInvoker> test;
+ };
+
+ TestCase makeTestCase( ITestInvoker* testCase,
+ std::string const& className,
+ std::string const& name,
+ std::string const& description,
+ SourceLineInfo const& lineInfo );
+}
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
+// end catch_test_case_info.h
+// start catch_interfaces_runner.h
+
+namespace Catch {
+
+ struct IRunner {
+ virtual ~IRunner();
+ virtual bool aborting() const = 0;
+ };
+}
+
+// end catch_interfaces_runner.h
+
+#ifdef __OBJC__
+// start catch_objc.hpp
+
+#import <objc/runtime.h>
+
+#include <string>
+
+// NB. Any general catch headers included here must be included
+// in catch.hpp first to make sure they are included by the single
+// header for non obj-usage
+
+///////////////////////////////////////////////////////////////////////////////
+// This protocol is really only here for (self) documenting purposes, since
+// all its methods are optional.
+@protocol OcFixture
+
+@optional
+
+-(void) setUp;
+-(void) tearDown;
+
+@end
+
+namespace Catch {
+
+ class OcMethod : public ITestInvoker {
+
+ public:
+ OcMethod( Class cls, SEL sel ) : m_cls( cls ), m_sel( sel ) {}
+
+ virtual void invoke() const {
+ id obj = [[m_cls alloc] init];
+
+ performOptionalSelector( obj, @selector(setUp) );
+ performOptionalSelector( obj, m_sel );
+ performOptionalSelector( obj, @selector(tearDown) );
+
+ arcSafeRelease( obj );
+ }
+ private:
+ virtual ~OcMethod() {}
+
+ Class m_cls;
+ SEL m_sel;
+ };
+
+ namespace Detail{
+
+ inline std::string getAnnotation( Class cls,
+ std::string const& annotationName,
+ std::string const& testCaseName ) {
+ NSString* selStr = [[NSString alloc] initWithFormat:@"Catch_%s_%s", annotationName.c_str(), testCaseName.c_str()];
+ SEL sel = NSSelectorFromString( selStr );
+ arcSafeRelease( selStr );
+ id value = performOptionalSelector( cls, sel );
+ if( value )
+ return [(NSString*)value UTF8String];
+ return "";
+ }
+ }
+
+ inline std::size_t registerTestMethods() {
+ std::size_t noTestMethods = 0;
+ int noClasses = objc_getClassList( nullptr, 0 );
+
+ Class* classes = (CATCH_UNSAFE_UNRETAINED Class *)malloc( sizeof(Class) * noClasses);
+ objc_getClassList( classes, noClasses );
+
+ for( int c = 0; c < noClasses; c++ ) {
+ Class cls = classes[c];
+ {
+ u_int count;
+ Method* methods = class_copyMethodList( cls, &count );
+ for( u_int m = 0; m < count ; m++ ) {
+ SEL selector = method_getName(methods[m]);
+ std::string methodName = sel_getName(selector);
+ if( startsWith( methodName, "Catch_TestCase_" ) ) {
+ std::string testCaseName = methodName.substr( 15 );
+ std::string name = Detail::getAnnotation( cls, "Name", testCaseName );
+ std::string desc = Detail::getAnnotation( cls, "Description", testCaseName );
+ const char* className = class_getName( cls );
+
+ getMutableRegistryHub().registerTest( makeTestCase( new OcMethod( cls, selector ), className, name.c_str(), desc.c_str(), SourceLineInfo("",0) ) );
+ noTestMethods++;
+ }
+ }
+ free(methods);
+ }
+ }
+ return noTestMethods;
+ }
+
+#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
+
+ namespace Matchers {
+ namespace Impl {
+ namespace NSStringMatchers {
+
+ struct StringHolder : MatcherBase<NSString*>{
+ StringHolder( NSString* substr ) : m_substr( [substr copy] ){}
+ StringHolder( StringHolder const& other ) : m_substr( [other.m_substr copy] ){}
+ StringHolder() {
+ arcSafeRelease( m_substr );
+ }
+
+ bool match( NSString* arg ) const override {
+ return false;
+ }
+
+ NSString* CATCH_ARC_STRONG m_substr;
+ };
+
+ struct Equals : StringHolder {
+ Equals( NSString* substr ) : StringHolder( substr ){}
+
+ bool match( NSString* str ) const override {
+ return (str != nil || m_substr == nil ) &&
+ [str isEqualToString:m_substr];
+ }
+
+ std::string describe() const override {
+ return "equals string: " + Catch::Detail::stringify( m_substr );
+ }
+ };
+
+ struct Contains : StringHolder {
+ Contains( NSString* substr ) : StringHolder( substr ){}
+
+ bool match( NSString* str ) const {
+ return (str != nil || m_substr == nil ) &&
+ [str rangeOfString:m_substr].location != NSNotFound;
+ }
+
+ std::string describe() const override {
+ return "contains string: " + Catch::Detail::stringify( m_substr );
+ }
+ };
+
+ struct StartsWith : StringHolder {
+ StartsWith( NSString* substr ) : StringHolder( substr ){}
+
+ bool match( NSString* str ) const override {
+ return (str != nil || m_substr == nil ) &&
+ [str rangeOfString:m_substr].location == 0;
+ }
+
+ std::string describe() const override {
+ return "starts with: " + Catch::Detail::stringify( m_substr );
+ }
+ };
+ struct EndsWith : StringHolder {
+ EndsWith( NSString* substr ) : StringHolder( substr ){}
+
+ bool match( NSString* str ) const override {
+ return (str != nil || m_substr == nil ) &&
+ [str rangeOfString:m_substr].location == [str length] - [m_substr length];
+ }
+
+ std::string describe() const override {
+ return "ends with: " + Catch::Detail::stringify( m_substr );
+ }
+ };
+
+ } // namespace NSStringMatchers
+ } // namespace Impl
+
+ inline Impl::NSStringMatchers::Equals
+ Equals( NSString* substr ){ return Impl::NSStringMatchers::Equals( substr ); }
+
+ inline Impl::NSStringMatchers::Contains
+ Contains( NSString* substr ){ return Impl::NSStringMatchers::Contains( substr ); }
+
+ inline Impl::NSStringMatchers::StartsWith
+ StartsWith( NSString* substr ){ return Impl::NSStringMatchers::StartsWith( substr ); }
+
+ inline Impl::NSStringMatchers::EndsWith
+ EndsWith( NSString* substr ){ return Impl::NSStringMatchers::EndsWith( substr ); }
+
+ } // namespace Matchers
+
+ using namespace Matchers;
+
+#endif // CATCH_CONFIG_DISABLE_MATCHERS
+
+} // namespace Catch
+
+///////////////////////////////////////////////////////////////////////////////
+#define OC_MAKE_UNIQUE_NAME( root, uniqueSuffix ) root##uniqueSuffix
+#define OC_TEST_CASE2( name, desc, uniqueSuffix ) \
++(NSString*) OC_MAKE_UNIQUE_NAME( Catch_Name_test_, uniqueSuffix ) \
+{ \
+return @ name; \
+} \
++(NSString*) OC_MAKE_UNIQUE_NAME( Catch_Description_test_, uniqueSuffix ) \
+{ \
+return @ desc; \
+} \
+-(void) OC_MAKE_UNIQUE_NAME( Catch_TestCase_test_, uniqueSuffix )
+
+#define OC_TEST_CASE( name, desc ) OC_TEST_CASE2( name, desc, __LINE__ )
+
+// end catch_objc.hpp
+#endif
+
+#ifdef CATCH_CONFIG_EXTERNAL_INTERFACES
+// start catch_external_interfaces.h
+
+// start catch_reporter_bases.hpp
+
+// start catch_interfaces_reporter.h
+
+// start catch_config.hpp
+
+// start catch_test_spec_parser.h
+
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpadded"
+#endif
+
+// start catch_test_spec.h
+
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpadded"
+#endif
+
+// start catch_wildcard_pattern.h
+
+namespace Catch
+{
+ class WildcardPattern {
+ enum WildcardPosition {
+ NoWildcard = 0,
+ WildcardAtStart = 1,
+ WildcardAtEnd = 2,
+ WildcardAtBothEnds = WildcardAtStart | WildcardAtEnd
+ };
+
+ public:
+
+ WildcardPattern( std::string const& pattern, CaseSensitive::Choice caseSensitivity );
+ virtual ~WildcardPattern() = default;
+ virtual bool matches( std::string const& str ) const;
+
+ private:
+ std::string adjustCase( std::string const& str ) const;
+ CaseSensitive::Choice m_caseSensitivity;
+ WildcardPosition m_wildcard = NoWildcard;
+ std::string m_pattern;
+ };
+}
+
+// end catch_wildcard_pattern.h
+#include <string>
+#include <vector>
+#include <memory>
+
+namespace Catch {
+
+ class TestSpec {
+ struct Pattern {
+ virtual ~Pattern();
+ virtual bool matches( TestCaseInfo const& testCase ) const = 0;
+ };
+ using PatternPtr = std::shared_ptr<Pattern>;
+
+ class NamePattern : public Pattern {
+ public:
+ NamePattern( std::string const& name );
+ virtual ~NamePattern();
+ virtual bool matches( TestCaseInfo const& testCase ) const override;
+ private:
+ WildcardPattern m_wildcardPattern;
+ };
+
+ class TagPattern : public Pattern {
+ public:
+ TagPattern( std::string const& tag );
+ virtual ~TagPattern();
+ virtual bool matches( TestCaseInfo const& testCase ) const override;
+ private:
+ std::string m_tag;
+ };
+
+ class ExcludedPattern : public Pattern {
+ public:
+ ExcludedPattern( PatternPtr const& underlyingPattern );
+ virtual ~ExcludedPattern();
+ virtual bool matches( TestCaseInfo const& testCase ) const override;
+ private:
+ PatternPtr m_underlyingPattern;
+ };
+
+ struct Filter {
+ std::vector<PatternPtr> m_patterns;
+
+ bool matches( TestCaseInfo const& testCase ) const;
+ };
+
+ public:
+ bool hasFilters() const;
+ bool matches( TestCaseInfo const& testCase ) const;
+
+ private:
+ std::vector<Filter> m_filters;
+
+ friend class TestSpecParser;
+ };
+}
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
+// end catch_test_spec.h
+// start catch_interfaces_tag_alias_registry.h
+
+#include <string>
+
+namespace Catch {
+
+ struct TagAlias;
+
+ struct ITagAliasRegistry {
+ virtual ~ITagAliasRegistry();
+ // Nullptr if not present
+ virtual TagAlias const* find( std::string const& alias ) const = 0;
+ virtual std::string expandAliases( std::string const& unexpandedTestSpec ) const = 0;
+
+ static ITagAliasRegistry const& get();
+ };
+
+} // end namespace Catch
+
+// end catch_interfaces_tag_alias_registry.h
+namespace Catch {
+
+ class TestSpecParser {
+ enum Mode{ None, Name, QuotedName, Tag, EscapedName };
+ Mode m_mode = None;
+ bool m_exclusion = false;
+ std::size_t m_start = std::string::npos, m_pos = 0;
+ std::string m_arg;
+ std::vector<std::size_t> m_escapeChars;
+ TestSpec::Filter m_currentFilter;
+ TestSpec m_testSpec;
+ ITagAliasRegistry const* m_tagAliases = nullptr;
+
+ public:
+ TestSpecParser( ITagAliasRegistry const& tagAliases );
+
+ TestSpecParser& parse( std::string const& arg );
+ TestSpec testSpec();
+
+ private:
+ void visitChar( char c );
+ void startNewMode( Mode mode, std::size_t start );
+ void escape();
+ std::string subString() const;
+
+ template<typename T>
+ void addPattern() {
+ std::string token = subString();
+ for( std::size_t i = 0; i < m_escapeChars.size(); ++i )
+ token = token.substr( 0, m_escapeChars[i]-m_start-i ) + token.substr( m_escapeChars[i]-m_start-i+1 );
+ m_escapeChars.clear();
+ if( startsWith( token, "exclude:" ) ) {
+ m_exclusion = true;
+ token = token.substr( 8 );
+ }
+ if( !token.empty() ) {
+ TestSpec::PatternPtr pattern = std::make_shared<T>( token );
+ if( m_exclusion )
+ pattern = std::make_shared<TestSpec::ExcludedPattern>( pattern );
+ m_currentFilter.m_patterns.push_back( pattern );
+ }
+ m_exclusion = false;
+ m_mode = None;
+ }
+
+ void addFilter();
+ };
+ TestSpec parseTestSpec( std::string const& arg );
+
+} // namespace Catch
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
+// end catch_test_spec_parser.h
+// start catch_interfaces_config.h
+
+#include <iosfwd>
+#include <string>
+#include <vector>
+#include <memory>
+
+namespace Catch {
+
+ enum class Verbosity {
+ Quiet = 0,
+ Normal,
+ High
+ };
+
+ struct WarnAbout { enum What {
+ Nothing = 0x00,
+ NoAssertions = 0x01
+ }; };
+
+ struct ShowDurations { enum OrNot {
+ DefaultForReporter,
+ Always,
+ Never
+ }; };
+ struct RunTests { enum InWhatOrder {
+ InDeclarationOrder,
+ InLexicographicalOrder,
+ InRandomOrder
+ }; };
+ struct UseColour { enum YesOrNo {
+ Auto,
+ Yes,
+ No
+ }; };
+ struct WaitForKeypress { enum When {
+ Never,
+ BeforeStart = 1,
+ BeforeExit = 2,
+ BeforeStartAndExit = BeforeStart | BeforeExit
+ }; };
+
+ class TestSpec;
+
+ struct IConfig : NonCopyable {
+
+ virtual ~IConfig();
+
+ virtual bool allowThrows() const = 0;
+ virtual std::ostream& stream() const = 0;
+ virtual std::string name() const = 0;
+ virtual bool includeSuccessfulResults() const = 0;
+ virtual bool shouldDebugBreak() const = 0;
+ virtual bool warnAboutMissingAssertions() const = 0;
+ virtual int abortAfter() const = 0;
+ virtual bool showInvisibles() const = 0;
+ virtual ShowDurations::OrNot showDurations() const = 0;
+ virtual TestSpec const& testSpec() const = 0;
+ virtual RunTests::InWhatOrder runOrder() const = 0;
+ virtual unsigned int rngSeed() const = 0;
+ virtual int benchmarkResolutionMultiple() const = 0;
+ virtual UseColour::YesOrNo useColour() const = 0;
+ virtual std::vector<std::string> const& getSectionsToRun() const = 0;
+ virtual Verbosity verbosity() const = 0;
+ };
+
+ using IConfigPtr = std::shared_ptr<IConfig const>;
+}
+
+// end catch_interfaces_config.h
+// Libstdc++ doesn't like incomplete classes for unique_ptr
+
+#include <memory>
+#include <vector>
+#include <string>
+
+#ifndef CATCH_CONFIG_CONSOLE_WIDTH
+#define CATCH_CONFIG_CONSOLE_WIDTH 80
+#endif
+
+namespace Catch {
+
+ struct IStream;
+
+ struct ConfigData {
+ bool listTests = false;
+ bool listTags = false;
+ bool listReporters = false;
+ bool listTestNamesOnly = false;
+
+ bool showSuccessfulTests = false;
+ bool shouldDebugBreak = false;
+ bool noThrow = false;
+ bool showHelp = false;
+ bool showInvisibles = false;
+ bool filenamesAsTags = false;
+ bool libIdentify = false;
+
+ int abortAfter = -1;
+ unsigned int rngSeed = 0;
+ int benchmarkResolutionMultiple = 100;
+
+ Verbosity verbosity = Verbosity::Normal;
+ WarnAbout::What warnings = WarnAbout::Nothing;
+ ShowDurations::OrNot showDurations = ShowDurations::DefaultForReporter;
+ RunTests::InWhatOrder runOrder = RunTests::InDeclarationOrder;
+ UseColour::YesOrNo useColour = UseColour::Auto;
+ WaitForKeypress::When waitForKeypress = WaitForKeypress::Never;
+
+ std::string outputFilename;
+ std::string name;
+ std::string processName;
+
+ std::vector<std::string> reporterNames;
+ std::vector<std::string> testsOrTags;
+ std::vector<std::string> sectionsToRun;
+ };
+
+ class Config : public IConfig {
+ public:
+
+ Config() = default;
+ Config( ConfigData const& data );
+ virtual ~Config() = default;
+
+ std::string const& getFilename() const;
+
+ bool listTests() const;
+ bool listTestNamesOnly() const;
+ bool listTags() const;
+ bool listReporters() const;
+
+ std::string getProcessName() const;
+
+ std::vector<std::string> const& getReporterNames() const;
+ std::vector<std::string> const& getSectionsToRun() const override;
+
+ virtual TestSpec const& testSpec() const override;
+
+ bool showHelp() const;
+
+ // IConfig interface
+ bool allowThrows() const override;
+ std::ostream& stream() const override;
+ std::string name() const override;
+ bool includeSuccessfulResults() const override;
+ bool warnAboutMissingAssertions() const override;
+ ShowDurations::OrNot showDurations() const override;
+ RunTests::InWhatOrder runOrder() const override;
+ unsigned int rngSeed() const override;
+ int benchmarkResolutionMultiple() const override;
+ UseColour::YesOrNo useColour() const override;
+ bool shouldDebugBreak() const override;
+ int abortAfter() const override;
+ bool showInvisibles() const override;
+ Verbosity verbosity() const override;
+
+ private:
+
+ IStream const* openStream();
+ ConfigData m_data;
+
+ std::unique_ptr<IStream const> m_stream;
+ TestSpec m_testSpec;
+ };
+
+} // end namespace Catch
+
+// end catch_config.hpp
+// start catch_assertionresult.h
+
+#include <string>
+
+namespace Catch {
+
+ struct AssertionResultData
+ {
+ AssertionResultData() = delete;
+
+ AssertionResultData( ResultWas::OfType _resultType, LazyExpression const& _lazyExpression );
+
+ std::string message;
+ mutable std::string reconstructedExpression;
+ LazyExpression lazyExpression;
+ ResultWas::OfType resultType;
+
+ std::string reconstructExpression() const;
+ };
+
+ class AssertionResult {
+ public:
+ AssertionResult() = delete;
+ AssertionResult( AssertionInfo const& info, AssertionResultData const& data );
+
+ bool isOk() const;
+ bool succeeded() const;
+ ResultWas::OfType getResultType() const;
+ bool hasExpression() const;
+ bool hasMessage() const;
+ std::string getExpression() const;
+ std::string getExpressionInMacro() const;
+ bool hasExpandedExpression() const;
+ std::string getExpandedExpression() const;
+ std::string getMessage() const;
+ SourceLineInfo getSourceInfo() const;
+ StringRef getTestMacroName() const;
+
+ //protected:
+ AssertionInfo m_info;
+ AssertionResultData m_resultData;
+ };
+
+} // end namespace Catch
+
+// end catch_assertionresult.h
+// start catch_option.hpp
+
+namespace Catch {
+
+ // An optional type
+ template<typename T>
+ class Option {
+ public:
+ Option() : nullableValue( nullptr ) {}
+ Option( T const& _value )
+ : nullableValue( new( storage ) T( _value ) )
+ {}
+ Option( Option const& _other )
+ : nullableValue( _other ? new( storage ) T( *_other ) : nullptr )
+ {}
+
+ ~Option() {
+ reset();
+ }
+
+ Option& operator= ( Option const& _other ) {
+ if( &_other != this ) {
+ reset();
+ if( _other )
+ nullableValue = new( storage ) T( *_other );
+ }
+ return *this;
+ }
+ Option& operator = ( T const& _value ) {
+ reset();
+ nullableValue = new( storage ) T( _value );
+ return *this;
+ }
+
+ void reset() {
+ if( nullableValue )
+ nullableValue->~T();
+ nullableValue = nullptr;
+ }
+
+ T& operator*() { return *nullableValue; }
+ T const& operator*() const { return *nullableValue; }
+ T* operator->() { return nullableValue; }
+ const T* operator->() const { return nullableValue; }
+
+ T valueOr( T const& defaultValue ) const {
+ return nullableValue ? *nullableValue : defaultValue;
+ }
+
+ bool some() const { return nullableValue != nullptr; }
+ bool none() const { return nullableValue == nullptr; }
+
+ bool operator !() const { return nullableValue == nullptr; }
+ explicit operator bool() const {
+ return some();
+ }
+
+ private:
+ T *nullableValue;
+ alignas(alignof(T)) char storage[sizeof(T)];
+ };
+
+} // end namespace Catch
+
+// end catch_option.hpp
+#include <string>
+#include <iosfwd>
+#include <map>
+#include <set>
+#include <memory>
+
+namespace Catch {
+
+ struct ReporterConfig {
+ explicit ReporterConfig( IConfigPtr const& _fullConfig );
+
+ ReporterConfig( IConfigPtr const& _fullConfig, std::ostream& _stream );
+
+ std::ostream& stream() const;
+ IConfigPtr fullConfig() const;
+
+ private:
+ std::ostream* m_stream;
+ IConfigPtr m_fullConfig;
+ };
+
+ struct ReporterPreferences {
+ bool shouldRedirectStdOut = false;
+ };
+
+ template<typename T>
+ struct LazyStat : Option<T> {
+ LazyStat& operator=( T const& _value ) {
+ Option<T>::operator=( _value );
+ used = false;
+ return *this;
+ }
+ void reset() {
+ Option<T>::reset();
+ used = false;
+ }
+ bool used = false;
+ };
+
+ struct TestRunInfo {
+ TestRunInfo( std::string const& _name );
+ std::string name;
+ };
+ struct GroupInfo {
+ GroupInfo( std::string const& _name,
+ std::size_t _groupIndex,
+ std::size_t _groupsCount );
+
+ std::string name;
+ std::size_t groupIndex;
+ std::size_t groupsCounts;
+ };
+
+ struct AssertionStats {
+ AssertionStats( AssertionResult const& _assertionResult,
+ std::vector<MessageInfo> const& _infoMessages,
+ Totals const& _totals );
+
+ AssertionStats( AssertionStats const& ) = default;
+ AssertionStats( AssertionStats && ) = default;
+ AssertionStats& operator = ( AssertionStats const& ) = default;
+ AssertionStats& operator = ( AssertionStats && ) = default;
+ virtual ~AssertionStats();
+
+ AssertionResult assertionResult;
+ std::vector<MessageInfo> infoMessages;
+ Totals totals;
+ };
+
+ struct SectionStats {
+ SectionStats( SectionInfo const& _sectionInfo,
+ Counts const& _assertions,
+ double _durationInSeconds,
+ bool _missingAssertions );
+ SectionStats( SectionStats const& ) = default;
+ SectionStats( SectionStats && ) = default;
+ SectionStats& operator = ( SectionStats const& ) = default;
+ SectionStats& operator = ( SectionStats && ) = default;
+ virtual ~SectionStats();
+
+ SectionInfo sectionInfo;
+ Counts assertions;
+ double durationInSeconds;
+ bool missingAssertions;
+ };
+
+ struct TestCaseStats {
+ TestCaseStats( TestCaseInfo const& _testInfo,
+ Totals const& _totals,
+ std::string const& _stdOut,
+ std::string const& _stdErr,
+ bool _aborting );
+
+ TestCaseStats( TestCaseStats const& ) = default;
+ TestCaseStats( TestCaseStats && ) = default;
+ TestCaseStats& operator = ( TestCaseStats const& ) = default;
+ TestCaseStats& operator = ( TestCaseStats && ) = default;
+ virtual ~TestCaseStats();
+
+ TestCaseInfo testInfo;
+ Totals totals;
+ std::string stdOut;
+ std::string stdErr;
+ bool aborting;
+ };
+
+ struct TestGroupStats {
+ TestGroupStats( GroupInfo const& _groupInfo,
+ Totals const& _totals,
+ bool _aborting );
+ TestGroupStats( GroupInfo const& _groupInfo );
+
+ TestGroupStats( TestGroupStats const& ) = default;
+ TestGroupStats( TestGroupStats && ) = default;
+ TestGroupStats& operator = ( TestGroupStats const& ) = default;
+ TestGroupStats& operator = ( TestGroupStats && ) = default;
+ virtual ~TestGroupStats();
+
+ GroupInfo groupInfo;
+ Totals totals;
+ bool aborting;
+ };
+
+ struct TestRunStats {
+ TestRunStats( TestRunInfo const& _runInfo,
+ Totals const& _totals,
+ bool _aborting );
+
+ TestRunStats( TestRunStats const& ) = default;
+ TestRunStats( TestRunStats && ) = default;
+ TestRunStats& operator = ( TestRunStats const& ) = default;
+ TestRunStats& operator = ( TestRunStats && ) = default;
+ virtual ~TestRunStats();
+
+ TestRunInfo runInfo;
+ Totals totals;
+ bool aborting;
+ };
+
+ struct BenchmarkInfo {
+ std::string name;
+ };
+ struct BenchmarkStats {
+ BenchmarkInfo info;
+ std::size_t iterations;
+ uint64_t elapsedTimeInNanoseconds;
+ };
+
+ struct IStreamingReporter {
+ virtual ~IStreamingReporter() = default;
+
+ // Implementing class must also provide the following static methods:
+ // static std::string getDescription();
+ // static std::set<Verbosity> getSupportedVerbosities()
+
+ virtual ReporterPreferences getPreferences() const = 0;
+
+ virtual void noMatchingTestCases( std::string const& spec ) = 0;
+
+ virtual void testRunStarting( TestRunInfo const& testRunInfo ) = 0;
+ virtual void testGroupStarting( GroupInfo const& groupInfo ) = 0;
+
+ virtual void testCaseStarting( TestCaseInfo const& testInfo ) = 0;
+ virtual void sectionStarting( SectionInfo const& sectionInfo ) = 0;
+
+ // *** experimental ***
+ virtual void benchmarkStarting( BenchmarkInfo const& ) {}
+
+ virtual void assertionStarting( AssertionInfo const& assertionInfo ) = 0;
+
+ // The return value indicates if the messages buffer should be cleared:
+ virtual bool assertionEnded( AssertionStats const& assertionStats ) = 0;
+
+ // *** experimental ***
+ virtual void benchmarkEnded( BenchmarkStats const& ) {}
+
+ virtual void sectionEnded( SectionStats const& sectionStats ) = 0;
+ virtual void testCaseEnded( TestCaseStats const& testCaseStats ) = 0;
+ virtual void testGroupEnded( TestGroupStats const& testGroupStats ) = 0;
+ virtual void testRunEnded( TestRunStats const& testRunStats ) = 0;
+
+ virtual void skipTest( TestCaseInfo const& testInfo ) = 0;
+
+ // Default empty implementation provided
+ virtual void fatalErrorEncountered( StringRef name );
+
+ virtual bool isMulti() const;
+ };
+ using IStreamingReporterPtr = std::unique_ptr<IStreamingReporter>;
+
+ struct IReporterFactory {
+ virtual ~IReporterFactory();
+ virtual IStreamingReporterPtr create( ReporterConfig const& config ) const = 0;
+ virtual std::string getDescription() const = 0;
+ };
+ using IReporterFactoryPtr = std::shared_ptr<IReporterFactory>;
+
+ struct IReporterRegistry {
+ using FactoryMap = std::map<std::string, IReporterFactoryPtr>;
+ using Listeners = std::vector<IReporterFactoryPtr>;
+
+ virtual ~IReporterRegistry();
+ virtual IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const = 0;
+ virtual FactoryMap const& getFactories() const = 0;
+ virtual Listeners const& getListeners() const = 0;
+ };
+
+ void addReporter( IStreamingReporterPtr& existingReporter, IStreamingReporterPtr&& additionalReporter );
+
+} // end namespace Catch
+
+// end catch_interfaces_reporter.h
+#include <algorithm>
+#include <cstring>
+#include <cfloat>
+#include <cstdio>
+#include <assert.h>
+#include <memory>
+#include <ostream>
+
+namespace Catch {
+ void prepareExpandedExpression(AssertionResult& result);
+
+ // Returns double formatted as %.3f (format expected on output)
+ std::string getFormattedDuration( double duration );
+
+ template<typename DerivedT>
+ struct StreamingReporterBase : IStreamingReporter {
+
+ StreamingReporterBase( ReporterConfig const& _config )
+ : m_config( _config.fullConfig() ),
+ stream( _config.stream() )
+ {
+ m_reporterPrefs.shouldRedirectStdOut = false;
+ if( !DerivedT::getSupportedVerbosities().count( m_config->verbosity() ) )
+ throw std::domain_error( "Verbosity level not supported by this reporter" );
+ }
+
+ ReporterPreferences getPreferences() const override {
+ return m_reporterPrefs;
+ }
+
+ static std::set<Verbosity> getSupportedVerbosities() {
+ return { Verbosity::Normal };
+ }
+
+ ~StreamingReporterBase() override = default;
+
+ void noMatchingTestCases(std::string const&) override {}
+
+ void testRunStarting(TestRunInfo const& _testRunInfo) override {
+ currentTestRunInfo = _testRunInfo;
+ }
+ void testGroupStarting(GroupInfo const& _groupInfo) override {
+ currentGroupInfo = _groupInfo;
+ }
+
+ void testCaseStarting(TestCaseInfo const& _testInfo) override {
+ currentTestCaseInfo = _testInfo;
+ }
+ void sectionStarting(SectionInfo const& _sectionInfo) override {
+ m_sectionStack.push_back(_sectionInfo);
+ }
+
+ void sectionEnded(SectionStats const& /* _sectionStats */) override {
+ m_sectionStack.pop_back();
+ }
+ void testCaseEnded(TestCaseStats const& /* _testCaseStats */) override {
+ currentTestCaseInfo.reset();
+ }
+ void testGroupEnded(TestGroupStats const& /* _testGroupStats */) override {
+ currentGroupInfo.reset();
+ }
+ void testRunEnded(TestRunStats const& /* _testRunStats */) override {
+ currentTestCaseInfo.reset();
+ currentGroupInfo.reset();
+ currentTestRunInfo.reset();
+ }
+
+ void skipTest(TestCaseInfo const&) override {
+ // Don't do anything with this by default.
+ // It can optionally be overridden in the derived class.
+ }
+
+ IConfigPtr m_config;
+ std::ostream& stream;
+
+ LazyStat<TestRunInfo> currentTestRunInfo;
+ LazyStat<GroupInfo> currentGroupInfo;
+ LazyStat<TestCaseInfo> currentTestCaseInfo;
+
+ std::vector<SectionInfo> m_sectionStack;
+ ReporterPreferences m_reporterPrefs;
+ };
+
+ template<typename DerivedT>
+ struct CumulativeReporterBase : IStreamingReporter {
+ template<typename T, typename ChildNodeT>
+ struct Node {
+ explicit Node( T const& _value ) : value( _value ) {}
+ virtual ~Node() {}
+
+ using ChildNodes = std::vector<std::shared_ptr<ChildNodeT>>;
+ T value;
+ ChildNodes children;
+ };
+ struct SectionNode {
+ explicit SectionNode(SectionStats const& _stats) : stats(_stats) {}
+ virtual ~SectionNode() = default;
+
+ bool operator == (SectionNode const& other) const {
+ return stats.sectionInfo.lineInfo == other.stats.sectionInfo.lineInfo;
+ }
+ bool operator == (std::shared_ptr<SectionNode> const& other) const {
+ return operator==(*other);
+ }
+
+ SectionStats stats;
+ using ChildSections = std::vector<std::shared_ptr<SectionNode>>;
+ using Assertions = std::vector<AssertionStats>;
+ ChildSections childSections;
+ Assertions assertions;
+ std::string stdOut;
+ std::string stdErr;
+ };
+
+ struct BySectionInfo {
+ BySectionInfo( SectionInfo const& other ) : m_other( other ) {}
+ BySectionInfo( BySectionInfo const& other ) : m_other( other.m_other ) {}
+ bool operator() (std::shared_ptr<SectionNode> const& node) const {
+ return ((node->stats.sectionInfo.name == m_other.name) &&
+ (node->stats.sectionInfo.lineInfo == m_other.lineInfo));
+ }
+ void operator=(BySectionInfo const&) = delete;
+
+ private:
+ SectionInfo const& m_other;
+ };
+
+ using TestCaseNode = Node<TestCaseStats, SectionNode>;
+ using TestGroupNode = Node<TestGroupStats, TestCaseNode>;
+ using TestRunNode = Node<TestRunStats, TestGroupNode>;
+
+ CumulativeReporterBase( ReporterConfig const& _config )
+ : m_config( _config.fullConfig() ),
+ stream( _config.stream() )
+ {
+ m_reporterPrefs.shouldRedirectStdOut = false;
+ if( !DerivedT::getSupportedVerbosities().count( m_config->verbosity() ) )
+ throw std::domain_error( "Verbosity level not supported by this reporter" );
+ }
+ ~CumulativeReporterBase() override = default;
+
+ ReporterPreferences getPreferences() const override {
+ return m_reporterPrefs;
+ }
+
+ static std::set<Verbosity> getSupportedVerbosities() {
+ return { Verbosity::Normal };
+ }
+
+ void testRunStarting( TestRunInfo const& ) override {}
+ void testGroupStarting( GroupInfo const& ) override {}
+
+ void testCaseStarting( TestCaseInfo const& ) override {}
+
+ void sectionStarting( SectionInfo const& sectionInfo ) override {
+ SectionStats incompleteStats( sectionInfo, Counts(), 0, false );
+ std::shared_ptr<SectionNode> node;
+ if( m_sectionStack.empty() ) {
+ if( !m_rootSection )
+ m_rootSection = std::make_shared<SectionNode>( incompleteStats );
+ node = m_rootSection;
+ }
+ else {
+ SectionNode& parentNode = *m_sectionStack.back();
+ auto it =
+ std::find_if( parentNode.childSections.begin(),
+ parentNode.childSections.end(),
+ BySectionInfo( sectionInfo ) );
+ if( it == parentNode.childSections.end() ) {
+ node = std::make_shared<SectionNode>( incompleteStats );
+ parentNode.childSections.push_back( node );
+ }
+ else
+ node = *it;
+ }
+ m_sectionStack.push_back( node );
+ m_deepestSection = std::move(node);
+ }
+
+ void assertionStarting(AssertionInfo const&) override {}
+
+ bool assertionEnded(AssertionStats const& assertionStats) override {
+ assert(!m_sectionStack.empty());
+ // AssertionResult holds a pointer to a temporary DecomposedExpression,
+ // which getExpandedExpression() calls to build the expression string.
+ // Our section stack copy of the assertionResult will likely outlive the
+ // temporary, so it must be expanded or discarded now to avoid calling
+ // a destroyed object later.
+ prepareExpandedExpression(const_cast<AssertionResult&>( assertionStats.assertionResult ) );
+ SectionNode& sectionNode = *m_sectionStack.back();
+ sectionNode.assertions.push_back(assertionStats);
+ return true;
+ }
+ void sectionEnded(SectionStats const& sectionStats) override {
+ assert(!m_sectionStack.empty());
+ SectionNode& node = *m_sectionStack.back();
+ node.stats = sectionStats;
+ m_sectionStack.pop_back();
+ }
+ void testCaseEnded(TestCaseStats const& testCaseStats) override {
+ auto node = std::make_shared<TestCaseNode>(testCaseStats);
+ assert(m_sectionStack.size() == 0);
+ node->children.push_back(m_rootSection);
+ m_testCases.push_back(node);
+ m_rootSection.reset();
+
+ assert(m_deepestSection);
+ m_deepestSection->stdOut = testCaseStats.stdOut;
+ m_deepestSection->stdErr = testCaseStats.stdErr;
+ }
+ void testGroupEnded(TestGroupStats const& testGroupStats) override {
+ auto node = std::make_shared<TestGroupNode>(testGroupStats);
+ node->children.swap(m_testCases);
+ m_testGroups.push_back(node);
+ }
+ void testRunEnded(TestRunStats const& testRunStats) override {
+ auto node = std::make_shared<TestRunNode>(testRunStats);
+ node->children.swap(m_testGroups);
+ m_testRuns.push_back(node);
+ testRunEndedCumulative();
+ }
+ virtual void testRunEndedCumulative() = 0;
+
+ void skipTest(TestCaseInfo const&) override {}
+
+ IConfigPtr m_config;
+ std::ostream& stream;
+ std::vector<AssertionStats> m_assertions;
+ std::vector<std::vector<std::shared_ptr<SectionNode>>> m_sections;
+ std::vector<std::shared_ptr<TestCaseNode>> m_testCases;
+ std::vector<std::shared_ptr<TestGroupNode>> m_testGroups;
+
+ std::vector<std::shared_ptr<TestRunNode>> m_testRuns;
+
+ std::shared_ptr<SectionNode> m_rootSection;
+ std::shared_ptr<SectionNode> m_deepestSection;
+ std::vector<std::shared_ptr<SectionNode>> m_sectionStack;
+ ReporterPreferences m_reporterPrefs;
+ };
+
+ template<char C>
+ char const* getLineOfChars() {
+ static char line[CATCH_CONFIG_CONSOLE_WIDTH] = {0};
+ if( !*line ) {
+ std::memset( line, C, CATCH_CONFIG_CONSOLE_WIDTH-1 );
+ line[CATCH_CONFIG_CONSOLE_WIDTH-1] = 0;
+ }
+ return line;
+ }
+
+ struct TestEventListenerBase : StreamingReporterBase<TestEventListenerBase> {
+ TestEventListenerBase( ReporterConfig const& _config );
+
+ void assertionStarting(AssertionInfo const&) override;
+ bool assertionEnded(AssertionStats const&) override;
+ };
+
+} // end namespace Catch
+
+// end catch_reporter_bases.hpp
+// start catch_console_colour.h
+
+namespace Catch {
+
+ struct Colour {
+ enum Code {
+ None = 0,
+
+ White,
+ Red,
+ Green,
+ Blue,
+ Cyan,
+ Yellow,
+ Grey,
+
+ Bright = 0x10,
+
+ BrightRed = Bright | Red,
+ BrightGreen = Bright | Green,
+ LightGrey = Bright | Grey,
+ BrightWhite = Bright | White,
+
+ // By intention
+ FileName = LightGrey,
+ Warning = Yellow,
+ ResultError = BrightRed,
+ ResultSuccess = BrightGreen,
+ ResultExpectedFailure = Warning,
+
+ Error = BrightRed,
+ Success = Green,
+
+ OriginalExpression = Cyan,
+ ReconstructedExpression = Yellow,
+
+ SecondaryText = LightGrey,
+ Headers = White
+ };
+
+ // Use constructed object for RAII guard
+ Colour( Code _colourCode );
+ Colour( Colour&& other ) noexcept;
+ Colour& operator=( Colour&& other ) noexcept;
+ ~Colour();
+
+ // Use static method for one-shot changes
+ static void use( Code _colourCode );
+
+ private:
+ bool m_moved = false;
+ };
+
+ std::ostream& operator << ( std::ostream& os, Colour const& );
+
+} // end namespace Catch
+
+// end catch_console_colour.h
+// start catch_reporter_registrars.hpp
+
+
+namespace Catch {
+
+ template<typename T>
+ class ReporterRegistrar {
+
+ class ReporterFactory : public IReporterFactory {
+
+ virtual IStreamingReporterPtr create( ReporterConfig const& config ) const override {
+ return std::unique_ptr<T>( new T( config ) );
+ }
+
+ virtual std::string getDescription() const override {
+ return T::getDescription();
+ }
+ };
+
+ public:
+
+ explicit ReporterRegistrar( std::string const& name ) {
+ getMutableRegistryHub().registerReporter( name, std::make_shared<ReporterFactory>() );
+ }
+ };
+
+ template<typename T>
+ class ListenerRegistrar {
+
+ class ListenerFactory : public IReporterFactory {
+
+ virtual IStreamingReporterPtr create( ReporterConfig const& config ) const override {
+ return std::unique_ptr<T>( new T( config ) );
+ }
+ virtual std::string getDescription() const override {
+ return std::string();
+ }
+ };
+
+ public:
+
+ ListenerRegistrar() {
+ getMutableRegistryHub().registerListener( std::make_shared<ListenerFactory>() );
+ }
+ };
+}
+
+#if !defined(CATCH_CONFIG_DISABLE)
+
+#define CATCH_REGISTER_REPORTER( name, reporterType ) \
+ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
+ namespace{ Catch::ReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name ); } \
+ CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS
+
+#define CATCH_REGISTER_LISTENER( listenerType ) \
+ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
+ namespace{ Catch::ListenerRegistrar<listenerType> catch_internal_RegistrarFor##listenerType; } \
+ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
+#else // CATCH_CONFIG_DISABLE
+
+#define CATCH_REGISTER_REPORTER(name, reporterType)
+#define CATCH_REGISTER_LISTENER(listenerType)
+
+#endif // CATCH_CONFIG_DISABLE
+
+// end catch_reporter_registrars.hpp
+// Allow users to base their work off existing reporters
+// start catch_reporter_compact.h
+
+namespace Catch {
+
+ struct CompactReporter : StreamingReporterBase<CompactReporter> {
+
+ using StreamingReporterBase::StreamingReporterBase;
+
+ ~CompactReporter() override;
+
+ static std::string getDescription();
+
+ ReporterPreferences getPreferences() const override;
+
+ void noMatchingTestCases(std::string const& spec) override;
+
+ void assertionStarting(AssertionInfo const&) override;
+
+ bool assertionEnded(AssertionStats const& _assertionStats) override;
+
+ void sectionEnded(SectionStats const& _sectionStats) override;
+
+ void testRunEnded(TestRunStats const& _testRunStats) override;
+
+ };
+
+} // end namespace Catch
+
+// end catch_reporter_compact.h
+// start catch_reporter_console.h
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch
+ // Note that 4062 (not all labels are handled
+ // and default is missing) is enabled
+#endif
+
+namespace Catch {
+ // Fwd decls
+ struct SummaryColumn;
+ class TablePrinter;
+
+ struct ConsoleReporter : StreamingReporterBase<ConsoleReporter> {
+ std::unique_ptr<TablePrinter> m_tablePrinter;
+
+ ConsoleReporter(ReporterConfig const& config);
+ ~ConsoleReporter() override;
+ static std::string getDescription();
+
+ void noMatchingTestCases(std::string const& spec) override;
+
+ void assertionStarting(AssertionInfo const&) override;
+
+ bool assertionEnded(AssertionStats const& _assertionStats) override;
+
+ void sectionStarting(SectionInfo const& _sectionInfo) override;
+ void sectionEnded(SectionStats const& _sectionStats) override;
+
+ void benchmarkStarting(BenchmarkInfo const& info) override;
+ void benchmarkEnded(BenchmarkStats const& stats) override;
+
+ void testCaseEnded(TestCaseStats const& _testCaseStats) override;
+ void testGroupEnded(TestGroupStats const& _testGroupStats) override;
+ void testRunEnded(TestRunStats const& _testRunStats) override;
+
+ private:
+
+ void lazyPrint();
+
+ void lazyPrintWithoutClosingBenchmarkTable();
+ void lazyPrintRunInfo();
+ void lazyPrintGroupInfo();
+ void printTestCaseAndSectionHeader();
+
+ void printClosedHeader(std::string const& _name);
+ void printOpenHeader(std::string const& _name);
+
+ // if string has a : in first line will set indent to follow it on
+ // subsequent lines
+ void printHeaderString(std::string const& _string, std::size_t indent = 0);
+
+ void printTotals(Totals const& totals);
+ void printSummaryRow(std::string const& label, std::vector<SummaryColumn> const& cols, std::size_t row);
+
+ void printTotalsDivider(Totals const& totals);
+ void printSummaryDivider();
+
+ private:
+ bool m_headerPrinted = false;
+ };
+
+} // end namespace Catch
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif
+
+// end catch_reporter_console.h
+// start catch_reporter_junit.h
+
+// start catch_xmlwriter.h
+
+#include <vector>
+
+namespace Catch {
+
+ class XmlEncode {
+ public:
+ enum ForWhat { ForTextNodes, ForAttributes };
+
+ XmlEncode( std::string const& str, ForWhat forWhat = ForTextNodes );
+
+ void encodeTo( std::ostream& os ) const;
+
+ friend std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode );
+
+ private:
+ std::string m_str;
+ ForWhat m_forWhat;
+ };
+
+ class XmlWriter {
+ public:
+
+ class ScopedElement {
+ public:
+ ScopedElement( XmlWriter* writer );
+
+ ScopedElement( ScopedElement&& other ) noexcept;
+ ScopedElement& operator=( ScopedElement&& other ) noexcept;
+
+ ~ScopedElement();
+
+ ScopedElement& writeText( std::string const& text, bool indent = true );
+
+ template<typename T>
+ ScopedElement& writeAttribute( std::string const& name, T const& attribute ) {
+ m_writer->writeAttribute( name, attribute );
+ return *this;
+ }
+
+ private:
+ mutable XmlWriter* m_writer = nullptr;
+ };
+
+ XmlWriter( std::ostream& os = Catch::cout() );
+ ~XmlWriter();
+
+ XmlWriter( XmlWriter const& ) = delete;
+ XmlWriter& operator=( XmlWriter const& ) = delete;
+
+ XmlWriter& startElement( std::string const& name );
+
+ ScopedElement scopedElement( std::string const& name );
+
+ XmlWriter& endElement();
+
+ XmlWriter& writeAttribute( std::string const& name, std::string const& attribute );
+
+ XmlWriter& writeAttribute( std::string const& name, bool attribute );
+
+ template<typename T>
+ XmlWriter& writeAttribute( std::string const& name, T const& attribute ) {
+ ReusableStringStream rss;
+ rss << attribute;
+ return writeAttribute( name, rss.str() );
+ }
+
+ XmlWriter& writeText( std::string const& text, bool indent = true );
+
+ XmlWriter& writeComment( std::string const& text );
+
+ void writeStylesheetRef( std::string const& url );
+
+ XmlWriter& writeBlankLine();
+
+ void ensureTagClosed();
+
+ private:
+
+ void writeDeclaration();
+
+ void newlineIfNecessary();
+
+ bool m_tagIsOpen = false;
+ bool m_needsNewline = false;
+ std::vector<std::string> m_tags;
+ std::string m_indent;
+ std::ostream& m_os;
+ };
+
+}
+
+// end catch_xmlwriter.h
+namespace Catch {
+
+ class JunitReporter : public CumulativeReporterBase<JunitReporter> {
+ public:
+ JunitReporter(ReporterConfig const& _config);
+
+ ~JunitReporter() override;
+
+ static std::string getDescription();
+
+ void noMatchingTestCases(std::string const& /*spec*/) override;
+
+ void testRunStarting(TestRunInfo const& runInfo) override;
+
+ void testGroupStarting(GroupInfo const& groupInfo) override;
+
+ void testCaseStarting(TestCaseInfo const& testCaseInfo) override;
+ bool assertionEnded(AssertionStats const& assertionStats) override;
+
+ void testCaseEnded(TestCaseStats const& testCaseStats) override;
+
+ void testGroupEnded(TestGroupStats const& testGroupStats) override;
+
+ void testRunEndedCumulative() override;
+
+ void writeGroup(TestGroupNode const& groupNode, double suiteTime);
+
+ void writeTestCase(TestCaseNode const& testCaseNode);
+
+ void writeSection(std::string const& className,
+ std::string const& rootName,
+ SectionNode const& sectionNode);
+
+ void writeAssertions(SectionNode const& sectionNode);
+ void writeAssertion(AssertionStats const& stats);
+
+ XmlWriter xml;
+ Timer suiteTimer;
+ std::string stdOutForSuite;
+ std::string stdErrForSuite;
+ unsigned int unexpectedExceptions = 0;
+ bool m_okToFail = false;
+ };
+
+} // end namespace Catch
+
+// end catch_reporter_junit.h
+// start catch_reporter_xml.h
+
+namespace Catch {
+ class XmlReporter : public StreamingReporterBase<XmlReporter> {
+ public:
+ XmlReporter(ReporterConfig const& _config);
+
+ ~XmlReporter() override;
+
+ static std::string getDescription();
+
+ virtual std::string getStylesheetRef() const;
+
+ void writeSourceInfo(SourceLineInfo const& sourceInfo);
+
+ public: // StreamingReporterBase
+
+ void noMatchingTestCases(std::string const& s) override;
+
+ void testRunStarting(TestRunInfo const& testInfo) override;
+
+ void testGroupStarting(GroupInfo const& groupInfo) override;
+
+ void testCaseStarting(TestCaseInfo const& testInfo) override;
+
+ void sectionStarting(SectionInfo const& sectionInfo) override;
+
+ void assertionStarting(AssertionInfo const&) override;
+
+ bool assertionEnded(AssertionStats const& assertionStats) override;
+
+ void sectionEnded(SectionStats const& sectionStats) override;
+
+ void testCaseEnded(TestCaseStats const& testCaseStats) override;
+
+ void testGroupEnded(TestGroupStats const& testGroupStats) override;
+
+ void testRunEnded(TestRunStats const& testRunStats) override;
+
+ private:
+ Timer m_testCaseTimer;
+ XmlWriter m_xml;
+ int m_sectionDepth = 0;
+ };
+
+} // end namespace Catch
+
+// end catch_reporter_xml.h
+
+// end catch_external_interfaces.h
+#endif
+
+#endif // ! CATCH_CONFIG_IMPL_ONLY
+
+#ifdef CATCH_IMPL
+// start catch_impl.hpp
+
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wweak-vtables"
+#endif
+
+// Keep these here for external reporters
+// start catch_test_case_tracker.h
+
+#include <string>
+#include <vector>
+#include <memory>
+
+namespace Catch {
+namespace TestCaseTracking {
+
+ struct NameAndLocation {
+ std::string name;
+ SourceLineInfo location;
+
+ NameAndLocation( std::string const& _name, SourceLineInfo const& _location );
+ };
+
+ struct ITracker;
+
+ using ITrackerPtr = std::shared_ptr<ITracker>;
+
+ struct ITracker {
+ virtual ~ITracker();
+
+ // static queries
+ virtual NameAndLocation const& nameAndLocation() const = 0;
+
+ // dynamic queries
+ virtual bool isComplete() const = 0; // Successfully completed or failed
+ virtual bool isSuccessfullyCompleted() const = 0;
+ virtual bool isOpen() const = 0; // Started but not complete
+ virtual bool hasChildren() const = 0;
+
+ virtual ITracker& parent() = 0;
+
+ // actions
+ virtual void close() = 0; // Successfully complete
+ virtual void fail() = 0;
+ virtual void markAsNeedingAnotherRun() = 0;
+
+ virtual void addChild( ITrackerPtr const& child ) = 0;
+ virtual ITrackerPtr findChild( NameAndLocation const& nameAndLocation ) = 0;
+ virtual void openChild() = 0;
+
+ // Debug/ checking
+ virtual bool isSectionTracker() const = 0;
+ virtual bool isIndexTracker() const = 0;
+ };
+
+ class TrackerContext {
+
+ enum RunState {
+ NotStarted,
+ Executing,
+ CompletedCycle
+ };
+
+ ITrackerPtr m_rootTracker;
+ ITracker* m_currentTracker = nullptr;
+ RunState m_runState = NotStarted;
+
+ public:
+
+ static TrackerContext& instance();
+
+ ITracker& startRun();
+ void endRun();
+
+ void startCycle();
+ void completeCycle();
+
+ bool completedCycle() const;
+ ITracker& currentTracker();
+ void setCurrentTracker( ITracker* tracker );
+ };
+
+ class TrackerBase : public ITracker {
+ protected:
+ enum CycleState {
+ NotStarted,
+ Executing,
+ ExecutingChildren,
+ NeedsAnotherRun,
+ CompletedSuccessfully,
+ Failed
+ };
+
+ class TrackerHasName {
+ NameAndLocation m_nameAndLocation;
+ public:
+ TrackerHasName( NameAndLocation const& nameAndLocation );
+ bool operator ()( ITrackerPtr const& tracker ) const;
+ };
+
+ using Children = std::vector<ITrackerPtr>;
+ NameAndLocation m_nameAndLocation;
+ TrackerContext& m_ctx;
+ ITracker* m_parent;
+ Children m_children;
+ CycleState m_runState = NotStarted;
+
+ public:
+ TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent );
+
+ NameAndLocation const& nameAndLocation() const override;
+ bool isComplete() const override;
+ bool isSuccessfullyCompleted() const override;
+ bool isOpen() const override;
+ bool hasChildren() const override;
+
+ void addChild( ITrackerPtr const& child ) override;
+
+ ITrackerPtr findChild( NameAndLocation const& nameAndLocation ) override;
+ ITracker& parent() override;
+
+ void openChild() override;
+
+ bool isSectionTracker() const override;
+ bool isIndexTracker() const override;
+
+ void open();
+
+ void close() override;
+ void fail() override;
+ void markAsNeedingAnotherRun() override;
+
+ private:
+ void moveToParent();
+ void moveToThis();
+ };
+
+ class SectionTracker : public TrackerBase {
+ std::vector<std::string> m_filters;
+ public:
+ SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent );
+
+ bool isSectionTracker() const override;
+
+ static SectionTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation );
+
+ void tryOpen();
+
+ void addInitialFilters( std::vector<std::string> const& filters );
+ void addNextFilters( std::vector<std::string> const& filters );
+ };
+
+ class IndexTracker : public TrackerBase {
+ int m_size;
+ int m_index = -1;
+ public:
+ IndexTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent, int size );
+
+ bool isIndexTracker() const override;
+ void close() override;
+
+ static IndexTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation, int size );
+
+ int index() const;
+
+ void moveNext();
+ };
+
+} // namespace TestCaseTracking
+
+using TestCaseTracking::ITracker;
+using TestCaseTracking::TrackerContext;
+using TestCaseTracking::SectionTracker;
+using TestCaseTracking::IndexTracker;
+
+} // namespace Catch
+
+// end catch_test_case_tracker.h
+
+// start catch_leak_detector.h
+
+namespace Catch {
+
+ struct LeakDetector {
+ LeakDetector();
+ };
+
+}
+// end catch_leak_detector.h
+// Cpp files will be included in the single-header file here
+// start catch_approx.cpp
+
+#include <cmath>
+#include <limits>
+
+namespace {
+
+// Performs equivalent check of std::fabs(lhs - rhs) <= margin
+// But without the subtraction to allow for INFINITY in comparison
+bool marginComparison(double lhs, double rhs, double margin) {
+ return (lhs + margin >= rhs) && (rhs + margin >= lhs);
+}
+
+}
+
+namespace Catch {
+namespace Detail {
+
+ Approx::Approx ( double value )
+ : m_epsilon( std::numeric_limits<float>::epsilon()*100 ),
+ m_margin( 0.0 ),
+ m_scale( 0.0 ),
+ m_value( value )
+ {}
+
+ Approx Approx::custom() {
+ return Approx( 0 );
+ }
+
+ std::string Approx::toString() const {
+ ReusableStringStream rss;
+ rss << "Approx( " << ::Catch::Detail::stringify( m_value ) << " )";
+ return rss.str();
+ }
+
+ bool Approx::equalityComparisonImpl(const double other) const {
+ // First try with fixed margin, then compute margin based on epsilon, scale and Approx's value
+ // Thanks to Richard Harris for his help refining the scaled margin value
+ return marginComparison(m_value, other, m_margin) || marginComparison(m_value, other, m_epsilon * (m_scale + std::fabs(m_value)));
+ }
+
+} // end namespace Detail
+
+std::string StringMaker<Catch::Detail::Approx>::convert(Catch::Detail::Approx const& value) {
+ return value.toString();
+}
+
+} // end namespace Catch
+// end catch_approx.cpp
+// start catch_assertionhandler.cpp
+
+// start catch_context.h
+
+#include <memory>
+
+namespace Catch {
+
+ struct IResultCapture;
+ struct IRunner;
+ struct IConfig;
+ struct IMutableContext;
+
+ using IConfigPtr = std::shared_ptr<IConfig const>;
+
+ struct IContext
+ {
+ virtual ~IContext();
+
+ virtual IResultCapture* getResultCapture() = 0;
+ virtual IRunner* getRunner() = 0;
+ virtual IConfigPtr const& getConfig() const = 0;
+ };
+
+ struct IMutableContext : IContext
+ {
+ virtual ~IMutableContext();
+ virtual void setResultCapture( IResultCapture* resultCapture ) = 0;
+ virtual void setRunner( IRunner* runner ) = 0;
+ virtual void setConfig( IConfigPtr const& config ) = 0;
+
+ private:
+ static IMutableContext *currentContext;
+ friend IMutableContext& getCurrentMutableContext();
+ friend void cleanUpContext();
+ static void createContext();
+ };
+
+ inline IMutableContext& getCurrentMutableContext()
+ {
+ if( !IMutableContext::currentContext )
+ IMutableContext::createContext();
+ return *IMutableContext::currentContext;
+ }
+
+ inline IContext& getCurrentContext()
+ {
+ return getCurrentMutableContext();
+ }
+
+ void cleanUpContext();
+}
+
+// end catch_context.h
+// start catch_debugger.h
+
+namespace Catch {
+ bool isDebuggerActive();
+}
+
+#ifdef CATCH_PLATFORM_MAC
+
+ #define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */
+
+#elif defined(CATCH_PLATFORM_LINUX)
+ // If we can use inline assembler, do it because this allows us to break
+ // directly at the location of the failing check instead of breaking inside
+ // raise() called from it, i.e. one stack frame below.
+ #if defined(__GNUC__) && (defined(__i386) || defined(__x86_64))
+ #define CATCH_TRAP() asm volatile ("int $3") /* NOLINT */
+ #else // Fall back to the generic way.
+ #include <signal.h>
+
+ #define CATCH_TRAP() raise(SIGTRAP)
+ #endif
+#elif defined(_MSC_VER)
+ #define CATCH_TRAP() __debugbreak()
+#elif defined(__MINGW32__)
+ extern "C" __declspec(dllimport) void __stdcall DebugBreak();
+ #define CATCH_TRAP() DebugBreak()
+#endif
+
+#ifdef CATCH_TRAP
+ #define CATCH_BREAK_INTO_DEBUGGER() if( Catch::isDebuggerActive() ) { CATCH_TRAP(); }
+#else
+ #define CATCH_BREAK_INTO_DEBUGGER() (void)0, 0
+#endif
+
+// end catch_debugger.h
+// start catch_run_context.h
+
+// start catch_fatal_condition.h
+
+#include <string>
+
+#if defined ( CATCH_PLATFORM_WINDOWS ) /////////////////////////////////////////
+// start catch_windows_h_proxy.h
+
+
+#if defined(CATCH_PLATFORM_WINDOWS)
+
+#if !defined(NOMINMAX) && !defined(CATCH_CONFIG_NO_NOMINMAX)
+# define CATCH_DEFINED_NOMINMAX
+# define NOMINMAX
+#endif
+#if !defined(WIN32_LEAN_AND_MEAN) && !defined(CATCH_CONFIG_NO_WIN32_LEAN_AND_MEAN)
+# define CATCH_DEFINED_WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+#endif
+
+#ifdef __AFXDLL
+#include <AfxWin.h>
+#else
+#include <windows.h>
+#endif
+
+#ifdef CATCH_DEFINED_NOMINMAX
+# undef NOMINMAX
+#endif
+#ifdef CATCH_DEFINED_WIN32_LEAN_AND_MEAN
+# undef WIN32_LEAN_AND_MEAN
+#endif
+
+#endif // defined(CATCH_PLATFORM_WINDOWS)
+
+// end catch_windows_h_proxy.h
+
+# if !defined ( CATCH_CONFIG_WINDOWS_SEH )
+
+namespace Catch {
+ struct FatalConditionHandler {
+ void reset();
+ };
+}
+
+# else // CATCH_CONFIG_WINDOWS_SEH is defined
+
+namespace Catch {
+
+ struct FatalConditionHandler {
+
+ static LONG CALLBACK handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo);
+ FatalConditionHandler();
+ static void reset();
+ ~FatalConditionHandler();
+
+ private:
+ static bool isSet;
+ static ULONG guaranteeSize;
+ static PVOID exceptionHandlerHandle;
+ };
+
+} // namespace Catch
+
+# endif // CATCH_CONFIG_WINDOWS_SEH
+
+#else // Not Windows - assumed to be POSIX compatible //////////////////////////
+
+# if !defined(CATCH_CONFIG_POSIX_SIGNALS)
+
+namespace Catch {
+ struct FatalConditionHandler {
+ void reset();
+ };
+}
+
+# else // CATCH_CONFIG_POSIX_SIGNALS is defined
+
+#include <signal.h>
+
+namespace Catch {
+
+ struct FatalConditionHandler {
+
+ static bool isSet;
+ static struct sigaction oldSigActions[];// [sizeof(signalDefs) / sizeof(SignalDefs)];
+ static stack_t oldSigStack;
+ static char altStackMem[];
+
+ static void handleSignal( int sig );
+
+ FatalConditionHandler();
+ ~FatalConditionHandler();
+ static void reset();
+ };
+
+} // namespace Catch
+
+# endif // CATCH_CONFIG_POSIX_SIGNALS
+
+#endif // not Windows
+
+// end catch_fatal_condition.h
+#include <string>
+
+namespace Catch {
+
+ struct IMutableContext;
+
+ ///////////////////////////////////////////////////////////////////////////
+
+ class RunContext : public IResultCapture, public IRunner {
+
+ public:
+ RunContext( RunContext const& ) = delete;
+ RunContext& operator =( RunContext const& ) = delete;
+
+ explicit RunContext( IConfigPtr const& _config, IStreamingReporterPtr&& reporter );
+
+ ~RunContext() override;
+
+ void testGroupStarting( std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount );
+ void testGroupEnded( std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount );
+
+ Totals runTest(TestCase const& testCase);
+
+ IConfigPtr config() const;
+ IStreamingReporter& reporter() const;
+
+ public: // IResultCapture
+
+ // Assertion handlers
+ void handleExpr
+ ( AssertionInfo const& info,
+ ITransientExpression const& expr,
+ AssertionReaction& reaction ) override;
+ void handleMessage
+ ( AssertionInfo const& info,
+ ResultWas::OfType resultType,
+ StringRef const& message,
+ AssertionReaction& reaction ) override;
+ void handleUnexpectedExceptionNotThrown
+ ( AssertionInfo const& info,
+ AssertionReaction& reaction ) override;
+ void handleUnexpectedInflightException
+ ( AssertionInfo const& info,
+ std::string const& message,
+ AssertionReaction& reaction ) override;
+ void handleIncomplete
+ ( AssertionInfo const& info ) override;
+ void handleNonExpr
+ ( AssertionInfo const &info,
+ ResultWas::OfType resultType,
+ AssertionReaction &reaction ) override;
+
+ bool sectionStarted( SectionInfo const& sectionInfo, Counts& assertions ) override;
+
+ void sectionEnded( SectionEndInfo const& endInfo ) override;
+ void sectionEndedEarly( SectionEndInfo const& endInfo ) override;
+
+ void benchmarkStarting( BenchmarkInfo const& info ) override;
+ void benchmarkEnded( BenchmarkStats const& stats ) override;
+
+ void pushScopedMessage( MessageInfo const& message ) override;
+ void popScopedMessage( MessageInfo const& message ) override;
+
+ std::string getCurrentTestName() const override;
+
+ const AssertionResult* getLastResult() const override;
+
+ void exceptionEarlyReported() override;
+
+ void handleFatalErrorCondition( StringRef message ) override;
+
+ bool lastAssertionPassed() override;
+
+ void assertionPassed() override;
+
+ public:
+ // !TBD We need to do this another way!
+ bool aborting() const override;
+
+ private:
+
+ void runCurrentTest( std::string& redirectedCout, std::string& redirectedCerr );
+ void invokeActiveTestCase();
+
+ void resetAssertionInfo();
+ bool testForMissingAssertions( Counts& assertions );
+
+ void assertionEnded( AssertionResult const& result );
+ void reportExpr
+ ( AssertionInfo const &info,
+ ResultWas::OfType resultType,
+ ITransientExpression const *expr,
+ bool negated );
+
+ void populateReaction( AssertionReaction& reaction );
+
+ private:
+
+ void handleUnfinishedSections();
+
+ TestRunInfo m_runInfo;
+ IMutableContext& m_context;
+ TestCase const* m_activeTestCase = nullptr;
+ ITracker* m_testCaseTracker;
+ Option<AssertionResult> m_lastResult;
+
+ IConfigPtr m_config;
+ Totals m_totals;
+ IStreamingReporterPtr m_reporter;
+ std::vector<MessageInfo> m_messages;
+ AssertionInfo m_lastAssertionInfo;
+ std::vector<SectionEndInfo> m_unfinishedSections;
+ std::vector<ITracker*> m_activeSections;
+ TrackerContext m_trackerContext;
+ bool m_lastAssertionPassed = false;
+ bool m_shouldReportUnexpected = true;
+ bool m_includeSuccessfulResults;
+ };
+
+} // end namespace Catch
+
+// end catch_run_context.h
+namespace Catch {
+
+ auto operator <<( std::ostream& os, ITransientExpression const& expr ) -> std::ostream& {
+ expr.streamReconstructedExpression( os );
+ return os;
+ }
+
+ LazyExpression::LazyExpression( bool isNegated )
+ : m_isNegated( isNegated )
+ {}
+
+ LazyExpression::LazyExpression( LazyExpression const& other ) : m_isNegated( other.m_isNegated ) {}
+
+ LazyExpression::operator bool() const {
+ return m_transientExpression != nullptr;
+ }
+
+ auto operator << ( std::ostream& os, LazyExpression const& lazyExpr ) -> std::ostream& {
+ if( lazyExpr.m_isNegated )
+ os << "!";
+
+ if( lazyExpr ) {
+ if( lazyExpr.m_isNegated && lazyExpr.m_transientExpression->isBinaryExpression() )
+ os << "(" << *lazyExpr.m_transientExpression << ")";
+ else
+ os << *lazyExpr.m_transientExpression;
+ }
+ else {
+ os << "{** error - unchecked empty expression requested **}";
+ }
+ return os;
+ }
+
+ AssertionHandler::AssertionHandler
+ ( StringRef macroName,
+ SourceLineInfo const& lineInfo,
+ StringRef capturedExpression,
+ ResultDisposition::Flags resultDisposition )
+ : m_assertionInfo{ macroName, lineInfo, capturedExpression, resultDisposition },
+ m_resultCapture( getResultCapture() )
+ {}
+
+ void AssertionHandler::handleExpr( ITransientExpression const& expr ) {
+ m_resultCapture.handleExpr( m_assertionInfo, expr, m_reaction );
+ }
+ void AssertionHandler::handleMessage(ResultWas::OfType resultType, StringRef const& message) {
+ m_resultCapture.handleMessage( m_assertionInfo, resultType, message, m_reaction );
+ }
+
+ auto AssertionHandler::allowThrows() const -> bool {
+ return getCurrentContext().getConfig()->allowThrows();
+ }
+
+ void AssertionHandler::complete() {
+ setCompleted();
+ if( m_reaction.shouldDebugBreak ) {
+
+ // If you find your debugger stopping you here then go one level up on the
+ // call-stack for the code that caused it (typically a failed assertion)
+
+ // (To go back to the test and change execution, jump over the throw, next)
+ CATCH_BREAK_INTO_DEBUGGER();
+ }
+ if( m_reaction.shouldThrow )
+ throw Catch::TestFailureException();
+ }
+ void AssertionHandler::setCompleted() {
+ m_completed = true;
+ }
+
+ void AssertionHandler::handleUnexpectedInflightException() {
+ m_resultCapture.handleUnexpectedInflightException( m_assertionInfo, Catch::translateActiveException(), m_reaction );
+ }
+
+ void AssertionHandler::handleExceptionThrownAsExpected() {
+ m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction);
+ }
+ void AssertionHandler::handleExceptionNotThrownAsExpected() {
+ m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction);
+ }
+
+ void AssertionHandler::handleUnexpectedExceptionNotThrown() {
+ m_resultCapture.handleUnexpectedExceptionNotThrown( m_assertionInfo, m_reaction );
+ }
+
+ void AssertionHandler::handleThrowingCallSkipped() {
+ m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction);
+ }
+
+ // This is the overload that takes a string and infers the Equals matcher from it
+ // The more general overload, that takes any string matcher, is in catch_capture_matchers.cpp
+ void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef matcherString ) {
+ handleExceptionMatchExpr( handler, Matchers::Equals( str ), matcherString );
+ }
+
+} // namespace Catch
+// end catch_assertionhandler.cpp
+// start catch_assertionresult.cpp
+
+namespace Catch {
+ AssertionResultData::AssertionResultData(ResultWas::OfType _resultType, LazyExpression const & _lazyExpression):
+ lazyExpression(_lazyExpression),
+ resultType(_resultType) {}
+
+ std::string AssertionResultData::reconstructExpression() const {
+
+ if( reconstructedExpression.empty() ) {
+ if( lazyExpression ) {
+ ReusableStringStream rss;
+ rss << lazyExpression;
+ reconstructedExpression = rss.str();
+ }
+ }
+ return reconstructedExpression;
+ }
+
+ AssertionResult::AssertionResult( AssertionInfo const& info, AssertionResultData const& data )
+ : m_info( info ),
+ m_resultData( data )
+ {}
+
+ // Result was a success
+ bool AssertionResult::succeeded() const {
+ return Catch::isOk( m_resultData.resultType );
+ }
+
+ // Result was a success, or failure is suppressed
+ bool AssertionResult::isOk() const {
+ return Catch::isOk( m_resultData.resultType ) || shouldSuppressFailure( m_info.resultDisposition );
+ }
+
+ ResultWas::OfType AssertionResult::getResultType() const {
+ return m_resultData.resultType;
+ }
+
+ bool AssertionResult::hasExpression() const {
+ return m_info.capturedExpression[0] != 0;
+ }
+
+ bool AssertionResult::hasMessage() const {
+ return !m_resultData.message.empty();
+ }
+
+ std::string AssertionResult::getExpression() const {
+ if( isFalseTest( m_info.resultDisposition ) )
+ return "!(" + m_info.capturedExpression + ")";
+ else
+ return m_info.capturedExpression;
+ }
+
+ std::string AssertionResult::getExpressionInMacro() const {
+ std::string expr;
+ if( m_info.macroName[0] == 0 )
+ expr = m_info.capturedExpression;
+ else {
+ expr.reserve( m_info.macroName.size() + m_info.capturedExpression.size() + 4 );
+ expr += m_info.macroName.c_str();
+ expr += "( ";
+ expr += m_info.capturedExpression.c_str();
+ expr += " )";
+ }
+ return expr;
+ }
+
+ bool AssertionResult::hasExpandedExpression() const {
+ return hasExpression() && getExpandedExpression() != getExpression();
+ }
+
+ std::string AssertionResult::getExpandedExpression() const {
+ std::string expr = m_resultData.reconstructExpression();
+ return expr.empty()
+ ? getExpression()
+ : expr;
+ }
+
+ std::string AssertionResult::getMessage() const {
+ return m_resultData.message;
+ }
+ SourceLineInfo AssertionResult::getSourceInfo() const {
+ return m_info.lineInfo;
+ }
+
+ StringRef AssertionResult::getTestMacroName() const {
+ return m_info.macroName;
+ }
+
+} // end namespace Catch
+// end catch_assertionresult.cpp
+// start catch_benchmark.cpp
+
+namespace Catch {
+
+ auto BenchmarkLooper::getResolution() -> uint64_t {
+ return getEstimatedClockResolution() * getCurrentContext().getConfig()->benchmarkResolutionMultiple();
+ }
+
+ void BenchmarkLooper::reportStart() {
+ getResultCapture().benchmarkStarting( { m_name } );
+ }
+ auto BenchmarkLooper::needsMoreIterations() -> bool {
+ auto elapsed = m_timer.getElapsedNanoseconds();
+
+ // Exponentially increasing iterations until we're confident in our timer resolution
+ if( elapsed < m_resolution ) {
+ m_iterationsToRun *= 10;
+ return true;
+ }
+
+ getResultCapture().benchmarkEnded( { { m_name }, m_count, elapsed } );
+ return false;
+ }
+
+} // end namespace Catch
+// end catch_benchmark.cpp
+// start catch_capture_matchers.cpp
+
+namespace Catch {
+
+ using StringMatcher = Matchers::Impl::MatcherBase<std::string>;
+
+ // This is the general overload that takes a any string matcher
+ // There is another overload, in catch_assertinhandler.h/.cpp, that only takes a string and infers
+ // the Equals matcher (so the header does not mention matchers)
+ void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef matcherString ) {
+ std::string exceptionMessage = Catch::translateActiveException();
+ MatchExpr<std::string, StringMatcher const&> expr( exceptionMessage, matcher, matcherString );
+ handler.handleExpr( expr );
+ }
+
+} // namespace Catch
+// end catch_capture_matchers.cpp
+// start catch_commandline.cpp
+
+// start catch_commandline.h
+
+// start catch_clara.h
+
+// Use Catch's value for console width (store Clara's off to the side, if present)
+#ifdef CLARA_CONFIG_CONSOLE_WIDTH
+#define CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH
+#undef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH
+#endif
+#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_CONFIG_CONSOLE_WIDTH-1
+
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wweak-vtables"
+#pragma clang diagnostic ignored "-Wexit-time-destructors"
+#pragma clang diagnostic ignored "-Wshadow"
+#endif
+
+// start clara.hpp
+// Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
+//
+// 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)
+//
+// See https://github.com/philsquared/Clara for more details
+
+// Clara v1.1.1
+
+
+#ifndef CATCH_CLARA_CONFIG_CONSOLE_WIDTH
+#define CATCH_CLARA_CONFIG_CONSOLE_WIDTH 80
+#endif
+
+#ifndef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH
+#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_CLARA_CONFIG_CONSOLE_WIDTH
+#endif
+
+// ----------- #included from clara_textflow.hpp -----------
+
+// TextFlowCpp
+//
+// A single-header library for wrapping and laying out basic text, by Phil Nash
+//
+// This work is licensed under the BSD 2-Clause license.
+// See the accompanying LICENSE file, or the one at https://opensource.org/licenses/BSD-2-Clause
+//
+// This project is hosted at https://github.com/philsquared/textflowcpp
+
+
+#include <cassert>
+#include <ostream>
+#include <sstream>
+#include <vector>
+
+#ifndef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH
+#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH 80
+#endif
+
+namespace Catch { namespace clara { namespace TextFlow {
+
+ inline auto isWhitespace( char c ) -> bool {
+ static std::string chars = " \t\n\r";
+ return chars.find( c ) != std::string::npos;
+ }
+ inline auto isBreakableBefore( char c ) -> bool {
+ static std::string chars = "[({<|";
+ return chars.find( c ) != std::string::npos;
+ }
+ inline auto isBreakableAfter( char c ) -> bool {
+ static std::string chars = "])}>.,:;*+-=&/\\";
+ return chars.find( c ) != std::string::npos;
+ }
+
+ class Columns;
+
+ class Column {
+ std::vector<std::string> m_strings;
+ size_t m_width = CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH;
+ size_t m_indent = 0;
+ size_t m_initialIndent = std::string::npos;
+
+ public:
+ class iterator {
+ friend Column;
+
+ Column const& m_column;
+ size_t m_stringIndex = 0;
+ size_t m_pos = 0;
+
+ size_t m_len = 0;
+ size_t m_end = 0;
+ bool m_suffix = false;
+
+ iterator( Column const& column, size_t stringIndex )
+ : m_column( column ),
+ m_stringIndex( stringIndex )
+ {}
+
+ auto line() const -> std::string const& { return m_column.m_strings[m_stringIndex]; }
+
+ auto isBoundary( size_t at ) const -> bool {
+ assert( at > 0 );
+ assert( at <= line().size() );
+
+ return at == line().size() ||
+ ( isWhitespace( line()[at] ) && !isWhitespace( line()[at-1] ) ) ||
+ isBreakableBefore( line()[at] ) ||
+ isBreakableAfter( line()[at-1] );
+ }
+
+ void calcLength() {
+ assert( m_stringIndex < m_column.m_strings.size() );
+
+ m_suffix = false;
+ auto width = m_column.m_width-indent();
+ m_end = m_pos;
+ while( m_end < line().size() && line()[m_end] != '\n' )
+ ++m_end;
+
+ if( m_end < m_pos + width ) {
+ m_len = m_end - m_pos;
+ }
+ else {
+ size_t len = width;
+ while (len > 0 && !isBoundary(m_pos + len))
+ --len;
+ while (len > 0 && isWhitespace( line()[m_pos + len - 1] ))
+ --len;
+
+ if (len > 0) {
+ m_len = len;
+ } else {
+ m_suffix = true;
+ m_len = width - 1;
+ }
+ }
+ }
+
+ auto indent() const -> size_t {
+ auto initial = m_pos == 0 && m_stringIndex == 0 ? m_column.m_initialIndent : std::string::npos;
+ return initial == std::string::npos ? m_column.m_indent : initial;
+ }
+
+ auto addIndentAndSuffix(std::string const &plain) const -> std::string {
+ return std::string( indent(), ' ' ) + (m_suffix ? plain + "-" : plain);
+ }
+
+ public:
+ explicit iterator( Column const& column ) : m_column( column ) {
+ assert( m_column.m_width > m_column.m_indent );
+ assert( m_column.m_initialIndent == std::string::npos || m_column.m_width > m_column.m_initialIndent );
+ calcLength();
+ if( m_len == 0 )
+ m_stringIndex++; // Empty string
+ }
+
+ auto operator *() const -> std::string {
+ assert( m_stringIndex < m_column.m_strings.size() );
+ assert( m_pos <= m_end );
+ if( m_pos + m_column.m_width < m_end )
+ return addIndentAndSuffix(line().substr(m_pos, m_len));
+ else
+ return addIndentAndSuffix(line().substr(m_pos, m_end - m_pos));
+ }
+
+ auto operator ++() -> iterator& {
+ m_pos += m_len;
+ if( m_pos < line().size() && line()[m_pos] == '\n' )
+ m_pos += 1;
+ else
+ while( m_pos < line().size() && isWhitespace( line()[m_pos] ) )
+ ++m_pos;
+
+ if( m_pos == line().size() ) {
+ m_pos = 0;
+ ++m_stringIndex;
+ }
+ if( m_stringIndex < m_column.m_strings.size() )
+ calcLength();
+ return *this;
+ }
+ auto operator ++(int) -> iterator {
+ iterator prev( *this );
+ operator++();
+ return prev;
+ }
+
+ auto operator ==( iterator const& other ) const -> bool {
+ return
+ m_pos == other.m_pos &&
+ m_stringIndex == other.m_stringIndex &&
+ &m_column == &other.m_column;
+ }
+ auto operator !=( iterator const& other ) const -> bool {
+ return !operator==( other );
+ }
+ };
+ using const_iterator = iterator;
+
+ explicit Column( std::string const& text ) { m_strings.push_back( text ); }
+
+ auto width( size_t newWidth ) -> Column& {
+ assert( newWidth > 0 );
+ m_width = newWidth;
+ return *this;
+ }
+ auto indent( size_t newIndent ) -> Column& {
+ m_indent = newIndent;
+ return *this;
+ }
+ auto initialIndent( size_t newIndent ) -> Column& {
+ m_initialIndent = newIndent;
+ return *this;
+ }
+
+ auto width() const -> size_t { return m_width; }
+ auto begin() const -> iterator { return iterator( *this ); }
+ auto end() const -> iterator { return { *this, m_strings.size() }; }
+
+ inline friend std::ostream& operator << ( std::ostream& os, Column const& col ) {
+ bool first = true;
+ for( auto line : col ) {
+ if( first )
+ first = false;
+ else
+ os << "\n";
+ os << line;
+ }
+ return os;
+ }
+
+ auto operator + ( Column const& other ) -> Columns;
+
+ auto toString() const -> std::string {
+ std::ostringstream oss;
+ oss << *this;
+ return oss.str();
+ }
+ };
+
+ class Spacer : public Column {
+
+ public:
+ explicit Spacer( size_t spaceWidth ) : Column( "" ) {
+ width( spaceWidth );
+ }
+ };
+
+ class Columns {
+ std::vector<Column> m_columns;
+
+ public:
+
+ class iterator {
+ friend Columns;
+ struct EndTag {};
+
+ std::vector<Column> const& m_columns;
+ std::vector<Column::iterator> m_iterators;
+ size_t m_activeIterators;
+
+ iterator( Columns const& columns, EndTag )
+ : m_columns( columns.m_columns ),
+ m_activeIterators( 0 )
+ {
+ m_iterators.reserve( m_columns.size() );
+
+ for( auto const& col : m_columns )
+ m_iterators.push_back( col.end() );
+ }
+
+ public:
+ explicit iterator( Columns const& columns )
+ : m_columns( columns.m_columns ),
+ m_activeIterators( m_columns.size() )
+ {
+ m_iterators.reserve( m_columns.size() );
+
+ for( auto const& col : m_columns )
+ m_iterators.push_back( col.begin() );
+ }
+
+ auto operator ==( iterator const& other ) const -> bool {
+ return m_iterators == other.m_iterators;
+ }
+ auto operator !=( iterator const& other ) const -> bool {
+ return m_iterators != other.m_iterators;
+ }
+ auto operator *() const -> std::string {
+ std::string row, padding;
+
+ for( size_t i = 0; i < m_columns.size(); ++i ) {
+ auto width = m_columns[i].width();
+ if( m_iterators[i] != m_columns[i].end() ) {
+ std::string col = *m_iterators[i];
+ row += padding + col;
+ if( col.size() < width )
+ padding = std::string( width - col.size(), ' ' );
+ else
+ padding = "";
+ }
+ else {
+ padding += std::string( width, ' ' );
+ }
+ }
+ return row;
+ }
+ auto operator ++() -> iterator& {
+ for( size_t i = 0; i < m_columns.size(); ++i ) {
+ if (m_iterators[i] != m_columns[i].end())
+ ++m_iterators[i];
+ }
+ return *this;
+ }
+ auto operator ++(int) -> iterator {
+ iterator prev( *this );
+ operator++();
+ return prev;
+ }
+ };
+ using const_iterator = iterator;
+
+ auto begin() const -> iterator { return iterator( *this ); }
+ auto end() const -> iterator { return { *this, iterator::EndTag() }; }
+
+ auto operator += ( Column const& col ) -> Columns& {
+ m_columns.push_back( col );
+ return *this;
+ }
+ auto operator + ( Column const& col ) -> Columns {
+ Columns combined = *this;
+ combined += col;
+ return combined;
+ }
+
+ inline friend std::ostream& operator << ( std::ostream& os, Columns const& cols ) {
+
+ bool first = true;
+ for( auto line : cols ) {
+ if( first )
+ first = false;
+ else
+ os << "\n";
+ os << line;
+ }
+ return os;
+ }
+
+ auto toString() const -> std::string {
+ std::ostringstream oss;
+ oss << *this;
+ return oss.str();
+ }
+ };
+
+ inline auto Column::operator + ( Column const& other ) -> Columns {
+ Columns cols;
+ cols += *this;
+ cols += other;
+ return cols;
+ }
+}}} // namespace Catch::clara::TextFlow
+
+// ----------- end of #include from clara_textflow.hpp -----------
+// ........... back in clara.hpp
+
+#include <memory>
+#include <set>
+#include <algorithm>
+
+#if !defined(CATCH_PLATFORM_WINDOWS) && ( defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) )
+#define CATCH_PLATFORM_WINDOWS
+#endif
+
+namespace Catch { namespace clara {
+namespace detail {
+
+ // Traits for extracting arg and return type of lambdas (for single argument lambdas)
+ template<typename L>
+ struct UnaryLambdaTraits : UnaryLambdaTraits<decltype( &L::operator() )> {};
+
+ template<typename ClassT, typename ReturnT, typename... Args>
+ struct UnaryLambdaTraits<ReturnT( ClassT::* )( Args... ) const> {
+ static const bool isValid = false;
+ };
+
+ template<typename ClassT, typename ReturnT, typename ArgT>
+ struct UnaryLambdaTraits<ReturnT( ClassT::* )( ArgT ) const> {
+ static const bool isValid = true;
+ using ArgType = typename std::remove_const<typename std::remove_reference<ArgT>::type>::type;
+ using ReturnType = ReturnT;
+ };
+
+ class TokenStream;
+
+ // Transport for raw args (copied from main args, or supplied via init list for testing)
+ class Args {
+ friend TokenStream;
+ std::string m_exeName;
+ std::vector<std::string> m_args;
+
+ public:
+ Args( int argc, char *argv[] ) {
+ m_exeName = argv[0];
+ for( int i = 1; i < argc; ++i )
+ m_args.push_back( argv[i] );
+ }
+
+ Args( std::initializer_list<std::string> args )
+ : m_exeName( *args.begin() ),
+ m_args( args.begin()+1, args.end() )
+ {}
+
+ auto exeName() const -> std::string {
+ return m_exeName;
+ }
+ };
+
+ // Wraps a token coming from a token stream. These may not directly correspond to strings as a single string
+ // may encode an option + its argument if the : or = form is used
+ enum class TokenType {
+ Option, Argument
+ };
+ struct Token {
+ TokenType type;
+ std::string token;
+ };
+
+ inline auto isOptPrefix( char c ) -> bool {
+ return c == '-'
+#ifdef CATCH_PLATFORM_WINDOWS
+ || c == '/'
+#endif
+ ;
+ }
+
+ // Abstracts iterators into args as a stream of tokens, with option arguments uniformly handled
+ class TokenStream {
+ using Iterator = std::vector<std::string>::const_iterator;
+ Iterator it;
+ Iterator itEnd;
+ std::vector<Token> m_tokenBuffer;
+
+ void loadBuffer() {
+ m_tokenBuffer.resize( 0 );
+
+ // Skip any empty strings
+ while( it != itEnd && it->empty() )
+ ++it;
+
+ if( it != itEnd ) {
+ auto const &next = *it;
+ if( isOptPrefix( next[0] ) ) {
+ auto delimiterPos = next.find_first_of( " :=" );
+ if( delimiterPos != std::string::npos ) {
+ m_tokenBuffer.push_back( { TokenType::Option, next.substr( 0, delimiterPos ) } );
+ m_tokenBuffer.push_back( { TokenType::Argument, next.substr( delimiterPos + 1 ) } );
+ } else {
+ if( next[1] != '-' && next.size() > 2 ) {
+ std::string opt = "- ";
+ for( size_t i = 1; i < next.size(); ++i ) {
+ opt[1] = next[i];
+ m_tokenBuffer.push_back( { TokenType::Option, opt } );
+ }
+ } else {
+ m_tokenBuffer.push_back( { TokenType::Option, next } );
+ }
+ }
+ } else {
+ m_tokenBuffer.push_back( { TokenType::Argument, next } );
+ }
+ }
+ }
+
+ public:
+ explicit TokenStream( Args const &args ) : TokenStream( args.m_args.begin(), args.m_args.end() ) {}
+
+ TokenStream( Iterator it, Iterator itEnd ) : it( it ), itEnd( itEnd ) {
+ loadBuffer();
+ }
+
+ explicit operator bool() const {
+ return !m_tokenBuffer.empty() || it != itEnd;
+ }
+
+ auto count() const -> size_t { return m_tokenBuffer.size() + (itEnd - it); }
+
+ auto operator*() const -> Token {
+ assert( !m_tokenBuffer.empty() );
+ return m_tokenBuffer.front();
+ }
+
+ auto operator->() const -> Token const * {
+ assert( !m_tokenBuffer.empty() );
+ return &m_tokenBuffer.front();
+ }
+
+ auto operator++() -> TokenStream & {
+ if( m_tokenBuffer.size() >= 2 ) {
+ m_tokenBuffer.erase( m_tokenBuffer.begin() );
+ } else {
+ if( it != itEnd )
+ ++it;
+ loadBuffer();
+ }
+ return *this;
+ }
+ };
+
+ class ResultBase {
+ public:
+ enum Type {
+ Ok, LogicError, RuntimeError
+ };
+
+ protected:
+ ResultBase( Type type ) : m_type( type ) {}
+ virtual ~ResultBase() = default;
+
+ virtual void enforceOk() const = 0;
+
+ Type m_type;
+ };
+
+ template<typename T>
+ class ResultValueBase : public ResultBase {
+ public:
+ auto value() const -> T const & {
+ enforceOk();
+ return m_value;
+ }
+
+ protected:
+ ResultValueBase( Type type ) : ResultBase( type ) {}
+
+ ResultValueBase( ResultValueBase const &other ) : ResultBase( other ) {
+ if( m_type == ResultBase::Ok )
+ new( &m_value ) T( other.m_value );
+ }
+
+ ResultValueBase( Type, T const &value ) : ResultBase( Ok ) {
+ new( &m_value ) T( value );
+ }
+
+ auto operator=( ResultValueBase const &other ) -> ResultValueBase & {
+ if( m_type == ResultBase::Ok )
+ m_value.~T();
+ ResultBase::operator=(other);
+ if( m_type == ResultBase::Ok )
+ new( &m_value ) T( other.m_value );
+ return *this;
+ }
+
+ ~ResultValueBase() override {
+ if( m_type == Ok )
+ m_value.~T();
+ }
+
+ union {
+ T m_value;
+ };
+ };
+
+ template<>
+ class ResultValueBase<void> : public ResultBase {
+ protected:
+ using ResultBase::ResultBase;
+ };
+
+ template<typename T = void>
+ class BasicResult : public ResultValueBase<T> {
+ public:
+ template<typename U>
+ explicit BasicResult( BasicResult<U> const &other )
+ : ResultValueBase<T>( other.type() ),
+ m_errorMessage( other.errorMessage() )
+ {
+ assert( type() != ResultBase::Ok );
+ }
+
+ template<typename U>
+ static auto ok( U const &value ) -> BasicResult { return { ResultBase::Ok, value }; }
+ static auto ok() -> BasicResult { return { ResultBase::Ok }; }
+ static auto logicError( std::string const &message ) -> BasicResult { return { ResultBase::LogicError, message }; }
+ static auto runtimeError( std::string const &message ) -> BasicResult { return { ResultBase::RuntimeError, message }; }
+
+ explicit operator bool() const { return m_type == ResultBase::Ok; }
+ auto type() const -> ResultBase::Type { return m_type; }
+ auto errorMessage() const -> std::string { return m_errorMessage; }
+
+ protected:
+ void enforceOk() const override {
+ // !TBD: If no exceptions, std::terminate here or something
+ switch( m_type ) {
+ case ResultBase::LogicError:
+ throw std::logic_error( m_errorMessage );
+ case ResultBase::RuntimeError:
+ throw std::runtime_error( m_errorMessage );
+ case ResultBase::Ok:
+ break;
+ }
+ }
+
+ std::string m_errorMessage; // Only populated if resultType is an error
+
+ BasicResult( ResultBase::Type type, std::string const &message )
+ : ResultValueBase<T>(type),
+ m_errorMessage(message)
+ {
+ assert( m_type != ResultBase::Ok );
+ }
+
+ using ResultValueBase<T>::ResultValueBase;
+ using ResultBase::m_type;
+ };
+
+ enum class ParseResultType {
+ Matched, NoMatch, ShortCircuitAll, ShortCircuitSame
+ };
+
+ class ParseState {
+ public:
+
+ ParseState( ParseResultType type, TokenStream const &remainingTokens )
+ : m_type(type),
+ m_remainingTokens( remainingTokens )
+ {}
+
+ auto type() const -> ParseResultType { return m_type; }
+ auto remainingTokens() const -> TokenStream { return m_remainingTokens; }
+
+ private:
+ ParseResultType m_type;
+ TokenStream m_remainingTokens;
+ };
+
+ using Result = BasicResult<void>;
+ using ParserResult = BasicResult<ParseResultType>;
+ using InternalParseResult = BasicResult<ParseState>;
+
+ struct HelpColumns {
+ std::string left;
+ std::string right;
+ };
+
+ template<typename T>
+ inline auto convertInto( std::string const &source, T& target ) -> ParserResult {
+ std::stringstream ss;
+ ss << source;
+ ss >> target;
+ if( ss.fail() )
+ return ParserResult::runtimeError( "Unable to convert '" + source + "' to destination type" );
+ else
+ return ParserResult::ok( ParseResultType::Matched );
+ }
+ inline auto convertInto( std::string const &source, std::string& target ) -> ParserResult {
+ target = source;
+ return ParserResult::ok( ParseResultType::Matched );
+ }
+ inline auto convertInto( std::string const &source, bool &target ) -> ParserResult {
+ std::string srcLC = source;
+ std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( char c ) { return static_cast<char>( ::tolower(c) ); } );
+ if (srcLC == "y" || srcLC == "1" || srcLC == "true" || srcLC == "yes" || srcLC == "on")
+ target = true;
+ else if (srcLC == "n" || srcLC == "0" || srcLC == "false" || srcLC == "no" || srcLC == "off")
+ target = false;
+ else
+ return ParserResult::runtimeError( "Expected a boolean value but did not recognise: '" + source + "'" );
+ return ParserResult::ok( ParseResultType::Matched );
+ }
+
+ struct NonCopyable {
+ NonCopyable() = default;
+ NonCopyable( NonCopyable const & ) = delete;
+ NonCopyable( NonCopyable && ) = delete;
+ NonCopyable &operator=( NonCopyable const & ) = delete;
+ NonCopyable &operator=( NonCopyable && ) = delete;
+ };
+
+ struct BoundRef : NonCopyable {
+ virtual ~BoundRef() = default;
+ virtual auto isContainer() const -> bool { return false; }
+ };
+ struct BoundValueRefBase : BoundRef {
+ virtual auto setValue( std::string const &arg ) -> ParserResult = 0;
+ };
+ struct BoundFlagRefBase : BoundRef {
+ virtual auto setFlag( bool flag ) -> ParserResult = 0;
+ };
+
+ template<typename T>
+ struct BoundValueRef : BoundValueRefBase {
+ T &m_ref;
+
+ explicit BoundValueRef( T &ref ) : m_ref( ref ) {}
+
+ auto setValue( std::string const &arg ) -> ParserResult override {
+ return convertInto( arg, m_ref );
+ }
+ };
+
+ template<typename T>
+ struct BoundValueRef<std::vector<T>> : BoundValueRefBase {
+ std::vector<T> &m_ref;
+
+ explicit BoundValueRef( std::vector<T> &ref ) : m_ref( ref ) {}
+
+ auto isContainer() const -> bool override { return true; }
+
+ auto setValue( std::string const &arg ) -> ParserResult override {
+ T temp;
+ auto result = convertInto( arg, temp );
+ if( result )
+ m_ref.push_back( temp );
+ return result;
+ }
+ };
+
+ struct BoundFlagRef : BoundFlagRefBase {
+ bool &m_ref;
+
+ explicit BoundFlagRef( bool &ref ) : m_ref( ref ) {}
+
+ auto setFlag( bool flag ) -> ParserResult override {
+ m_ref = flag;
+ return ParserResult::ok( ParseResultType::Matched );
+ }
+ };
+
+ template<typename ReturnType>
+ struct LambdaInvoker {
+ static_assert( std::is_same<ReturnType, ParserResult>::value, "Lambda must return void or clara::ParserResult" );
+
+ template<typename L, typename ArgType>
+ static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult {
+ return lambda( arg );
+ }
+ };
+
+ template<>
+ struct LambdaInvoker<void> {
+ template<typename L, typename ArgType>
+ static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult {
+ lambda( arg );
+ return ParserResult::ok( ParseResultType::Matched );
+ }
+ };
+
+ template<typename ArgType, typename L>
+ inline auto invokeLambda( L const &lambda, std::string const &arg ) -> ParserResult {
+ ArgType temp{};
+ auto result = convertInto( arg, temp );
+ return !result
+ ? result
+ : LambdaInvoker<typename UnaryLambdaTraits<L>::ReturnType>::invoke( lambda, temp );
+ }
+
+ template<typename L>
+ struct BoundLambda : BoundValueRefBase {
+ L m_lambda;
+
+ static_assert( UnaryLambdaTraits<L>::isValid, "Supplied lambda must take exactly one argument" );
+ explicit BoundLambda( L const &lambda ) : m_lambda( lambda ) {}
+
+ auto setValue( std::string const &arg ) -> ParserResult override {
+ return invokeLambda<typename UnaryLambdaTraits<L>::ArgType>( m_lambda, arg );
+ }
+ };
+
+ template<typename L>
+ struct BoundFlagLambda : BoundFlagRefBase {
+ L m_lambda;
+
+ static_assert( UnaryLambdaTraits<L>::isValid, "Supplied lambda must take exactly one argument" );
+ static_assert( std::is_same<typename UnaryLambdaTraits<L>::ArgType, bool>::value, "flags must be boolean" );
+
+ explicit BoundFlagLambda( L const &lambda ) : m_lambda( lambda ) {}
+
+ auto setFlag( bool flag ) -> ParserResult override {
+ return LambdaInvoker<typename UnaryLambdaTraits<L>::ReturnType>::invoke( m_lambda, flag );
+ }
+ };
+
+ enum class Optionality { Optional, Required };
+
+ struct Parser;
+
+ class ParserBase {
+ public:
+ virtual ~ParserBase() = default;
+ virtual auto validate() const -> Result { return Result::ok(); }
+ virtual auto parse( std::string const& exeName, TokenStream const &tokens) const -> InternalParseResult = 0;
+ virtual auto cardinality() const -> size_t { return 1; }
+
+ auto parse( Args const &args ) const -> InternalParseResult {
+ return parse( args.exeName(), TokenStream( args ) );
+ }
+ };
+
+ template<typename DerivedT>
+ class ComposableParserImpl : public ParserBase {
+ public:
+ template<typename T>
+ auto operator|( T const &other ) const -> Parser;
+
+ template<typename T>
+ auto operator+( T const &other ) const -> Parser;
+ };
+
+ // Common code and state for Args and Opts
+ template<typename DerivedT>
+ class ParserRefImpl : public ComposableParserImpl<DerivedT> {
+ protected:
+ Optionality m_optionality = Optionality::Optional;
+ std::shared_ptr<BoundRef> m_ref;
+ std::string m_hint;
+ std::string m_description;
+
+ explicit ParserRefImpl( std::shared_ptr<BoundRef> const &ref ) : m_ref( ref ) {}
+
+ public:
+ template<typename T>
+ ParserRefImpl( T &ref, std::string const &hint )
+ : m_ref( std::make_shared<BoundValueRef<T>>( ref ) ),
+ m_hint( hint )
+ {}
+
+ template<typename LambdaT>
+ ParserRefImpl( LambdaT const &ref, std::string const &hint )
+ : m_ref( std::make_shared<BoundLambda<LambdaT>>( ref ) ),
+ m_hint(hint)
+ {}
+
+ auto operator()( std::string const &description ) -> DerivedT & {
+ m_description = description;
+ return static_cast<DerivedT &>( *this );
+ }
+
+ auto optional() -> DerivedT & {
+ m_optionality = Optionality::Optional;
+ return static_cast<DerivedT &>( *this );
+ };
+
+ auto required() -> DerivedT & {
+ m_optionality = Optionality::Required;
+ return static_cast<DerivedT &>( *this );
+ };
+
+ auto isOptional() const -> bool {
+ return m_optionality == Optionality::Optional;
+ }
+
+ auto cardinality() const -> size_t override {
+ if( m_ref->isContainer() )
+ return 0;
+ else
+ return 1;
+ }
+
+ auto hint() const -> std::string { return m_hint; }
+ };
+
+ class ExeName : public ComposableParserImpl<ExeName> {
+ std::shared_ptr<std::string> m_name;
+ std::shared_ptr<BoundValueRefBase> m_ref;
+
+ template<typename LambdaT>
+ static auto makeRef(LambdaT const &lambda) -> std::shared_ptr<BoundValueRefBase> {
+ return std::make_shared<BoundLambda<LambdaT>>( lambda) ;
+ }
+
+ public:
+ ExeName() : m_name( std::make_shared<std::string>( "<executable>" ) ) {}
+
+ explicit ExeName( std::string &ref ) : ExeName() {
+ m_ref = std::make_shared<BoundValueRef<std::string>>( ref );
+ }
+
+ template<typename LambdaT>
+ explicit ExeName( LambdaT const& lambda ) : ExeName() {
+ m_ref = std::make_shared<BoundLambda<LambdaT>>( lambda );
+ }
+
+ // The exe name is not parsed out of the normal tokens, but is handled specially
+ auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override {
+ return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) );
+ }
+
+ auto name() const -> std::string { return *m_name; }
+ auto set( std::string const& newName ) -> ParserResult {
+
+ auto lastSlash = newName.find_last_of( "\\/" );
+ auto filename = ( lastSlash == std::string::npos )
+ ? newName
+ : newName.substr( lastSlash+1 );
+
+ *m_name = filename;
+ if( m_ref )
+ return m_ref->setValue( filename );
+ else
+ return ParserResult::ok( ParseResultType::Matched );
+ }
+ };
+
+ class Arg : public ParserRefImpl<Arg> {
+ public:
+ using ParserRefImpl::ParserRefImpl;
+
+ auto parse( std::string const &, TokenStream const &tokens ) const -> InternalParseResult override {
+ auto validationResult = validate();
+ if( !validationResult )
+ return InternalParseResult( validationResult );
+
+ auto remainingTokens = tokens;
+ auto const &token = *remainingTokens;
+ if( token.type != TokenType::Argument )
+ return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) );
+
+ assert( dynamic_cast<detail::BoundValueRefBase*>( m_ref.get() ) );
+ auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() );
+
+ auto result = valueRef->setValue( remainingTokens->token );
+ if( !result )
+ return InternalParseResult( result );
+ else
+ return InternalParseResult::ok( ParseState( ParseResultType::Matched, ++remainingTokens ) );
+ }
+ };
+
+ inline auto normaliseOpt( std::string const &optName ) -> std::string {
+#ifdef CATCH_PLATFORM_WINDOWS
+ if( optName[0] == '/' )
+ return "-" + optName.substr( 1 );
+ else
+#endif
+ return optName;
+ }
+
+ class Opt : public ParserRefImpl<Opt> {
+ protected:
+ std::vector<std::string> m_optNames;
+
+ public:
+ template<typename LambdaT>
+ explicit Opt( LambdaT const &ref ) : ParserRefImpl( std::make_shared<BoundFlagLambda<LambdaT>>( ref ) ) {}
+
+ explicit Opt( bool &ref ) : ParserRefImpl( std::make_shared<BoundFlagRef>( ref ) ) {}
+
+ template<typename LambdaT>
+ Opt( LambdaT const &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {}
+
+ template<typename T>
+ Opt( T &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {}
+
+ auto operator[]( std::string const &optName ) -> Opt & {
+ m_optNames.push_back( optName );
+ return *this;
+ }
+
+ auto getHelpColumns() const -> std::vector<HelpColumns> {
+ std::ostringstream oss;
+ bool first = true;
+ for( auto const &opt : m_optNames ) {
+ if (first)
+ first = false;
+ else
+ oss << ", ";
+ oss << opt;
+ }
+ if( !m_hint.empty() )
+ oss << " <" << m_hint << ">";
+ return { { oss.str(), m_description } };
+ }
+
+ auto isMatch( std::string const &optToken ) const -> bool {
+ auto normalisedToken = normaliseOpt( optToken );
+ for( auto const &name : m_optNames ) {
+ if( normaliseOpt( name ) == normalisedToken )
+ return true;
+ }
+ return false;
+ }
+
+ using ParserBase::parse;
+
+ auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override {
+ auto validationResult = validate();
+ if( !validationResult )
+ return InternalParseResult( validationResult );
+
+ auto remainingTokens = tokens;
+ if( remainingTokens && remainingTokens->type == TokenType::Option ) {
+ auto const &token = *remainingTokens;
+ if( isMatch(token.token ) ) {
+ if( auto flagRef = dynamic_cast<detail::BoundFlagRefBase*>( m_ref.get() ) ) {
+ auto result = flagRef->setFlag( true );
+ if( !result )
+ return InternalParseResult( result );
+ if( result.value() == ParseResultType::ShortCircuitAll )
+ return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) );
+ } else {
+ assert( dynamic_cast<detail::BoundValueRefBase*>( m_ref.get() ) );
+ auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() );
+ ++remainingTokens;
+ if( !remainingTokens )
+ return InternalParseResult::runtimeError( "Expected argument following " + token.token );
+ auto const &argToken = *remainingTokens;
+ if( argToken.type != TokenType::Argument )
+ return InternalParseResult::runtimeError( "Expected argument following " + token.token );
+ auto result = valueRef->setValue( argToken.token );
+ if( !result )
+ return InternalParseResult( result );
+ if( result.value() == ParseResultType::ShortCircuitAll )
+ return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) );
+ }
+ return InternalParseResult::ok( ParseState( ParseResultType::Matched, ++remainingTokens ) );
+ }
+ }
+ return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) );
+ }
+
+ auto validate() const -> Result override {
+ if( m_optNames.empty() )
+ return Result::logicError( "No options supplied to Opt" );
+ for( auto const &name : m_optNames ) {
+ if( name.empty() )
+ return Result::logicError( "Option name cannot be empty" );
+#ifdef CATCH_PLATFORM_WINDOWS
+ if( name[0] != '-' && name[0] != '/' )
+ return Result::logicError( "Option name must begin with '-' or '/'" );
+#else
+ if( name[0] != '-' )
+ return Result::logicError( "Option name must begin with '-'" );
+#endif
+ }
+ return ParserRefImpl::validate();
+ }
+ };
+
+ struct Help : Opt {
+ Help( bool &showHelpFlag )
+ : Opt([&]( bool flag ) {
+ showHelpFlag = flag;
+ return ParserResult::ok( ParseResultType::ShortCircuitAll );
+ })
+ {
+ static_cast<Opt &>( *this )
+ ("display usage information")
+ ["-?"]["-h"]["--help"]
+ .optional();
+ }
+ };
+
+ struct Parser : ParserBase {
+
+ mutable ExeName m_exeName;
+ std::vector<Opt> m_options;
+ std::vector<Arg> m_args;
+
+ auto operator|=( ExeName const &exeName ) -> Parser & {
+ m_exeName = exeName;
+ return *this;
+ }
+
+ auto operator|=( Arg const &arg ) -> Parser & {
+ m_args.push_back(arg);
+ return *this;
+ }
+
+ auto operator|=( Opt const &opt ) -> Parser & {
+ m_options.push_back(opt);
+ return *this;
+ }
+
+ auto operator|=( Parser const &other ) -> Parser & {
+ m_options.insert(m_options.end(), other.m_options.begin(), other.m_options.end());
+ m_args.insert(m_args.end(), other.m_args.begin(), other.m_args.end());
+ return *this;
+ }
+
+ template<typename T>
+ auto operator|( T const &other ) const -> Parser {
+ return Parser( *this ) |= other;
+ }
+
+ // Forward deprecated interface with '+' instead of '|'
+ template<typename T>
+ auto operator+=( T const &other ) -> Parser & { return operator|=( other ); }
+ template<typename T>
+ auto operator+( T const &other ) const -> Parser { return operator|( other ); }
+
+ auto getHelpColumns() const -> std::vector<HelpColumns> {
+ std::vector<HelpColumns> cols;
+ for (auto const &o : m_options) {
+ auto childCols = o.getHelpColumns();
+ cols.insert( cols.end(), childCols.begin(), childCols.end() );
+ }
+ return cols;
+ }
+
+ void writeToStream( std::ostream &os ) const {
+ if (!m_exeName.name().empty()) {
+ os << "usage:\n" << " " << m_exeName.name() << " ";
+ bool required = true, first = true;
+ for( auto const &arg : m_args ) {
+ if (first)
+ first = false;
+ else
+ os << " ";
+ if( arg.isOptional() && required ) {
+ os << "[";
+ required = false;
+ }
+ os << "<" << arg.hint() << ">";
+ if( arg.cardinality() == 0 )
+ os << " ... ";
+ }
+ if( !required )
+ os << "]";
+ if( !m_options.empty() )
+ os << " options";
+ os << "\n\nwhere options are:" << std::endl;
+ }
+
+ auto rows = getHelpColumns();
+ size_t consoleWidth = CATCH_CLARA_CONFIG_CONSOLE_WIDTH;
+ size_t optWidth = 0;
+ for( auto const &cols : rows )
+ optWidth = (std::max)(optWidth, cols.left.size() + 2);
+
+ optWidth = (std::min)(optWidth, consoleWidth/2);
+
+ for( auto const &cols : rows ) {
+ auto row =
+ TextFlow::Column( cols.left ).width( optWidth ).indent( 2 ) +
+ TextFlow::Spacer(4) +
+ TextFlow::Column( cols.right ).width( consoleWidth - 7 - optWidth );
+ os << row << std::endl;
+ }
+ }
+
+ friend auto operator<<( std::ostream &os, Parser const &parser ) -> std::ostream& {
+ parser.writeToStream( os );
+ return os;
+ }
+
+ auto validate() const -> Result override {
+ for( auto const &opt : m_options ) {
+ auto result = opt.validate();
+ if( !result )
+ return result;
+ }
+ for( auto const &arg : m_args ) {
+ auto result = arg.validate();
+ if( !result )
+ return result;
+ }
+ return Result::ok();
+ }
+
+ using ParserBase::parse;
+
+ auto parse( std::string const& exeName, TokenStream const &tokens ) const -> InternalParseResult override {
+
+ struct ParserInfo {
+ ParserBase const* parser = nullptr;
+ size_t count = 0;
+ };
+ const size_t totalParsers = m_options.size() + m_args.size();
+ assert( totalParsers < 512 );
+ // ParserInfo parseInfos[totalParsers]; // <-- this is what we really want to do
+ ParserInfo parseInfos[512];
+
+ {
+ size_t i = 0;
+ for (auto const &opt : m_options) parseInfos[i++].parser = &opt;
+ for (auto const &arg : m_args) parseInfos[i++].parser = &arg;
+ }
+
+ m_exeName.set( exeName );
+
+ auto result = InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) );
+ while( result.value().remainingTokens() ) {
+ bool tokenParsed = false;
+
+ for( size_t i = 0; i < totalParsers; ++i ) {
+ auto& parseInfo = parseInfos[i];
+ if( parseInfo.parser->cardinality() == 0 || parseInfo.count < parseInfo.parser->cardinality() ) {
+ result = parseInfo.parser->parse(exeName, result.value().remainingTokens());
+ if (!result)
+ return result;
+ if (result.value().type() != ParseResultType::NoMatch) {
+ tokenParsed = true;
+ ++parseInfo.count;
+ break;
+ }
+ }
+ }
+
+ if( result.value().type() == ParseResultType::ShortCircuitAll )
+ return result;
+ if( !tokenParsed )
+ return InternalParseResult::runtimeError( "Unrecognised token: " + result.value().remainingTokens()->token );
+ }
+ // !TBD Check missing required options
+ return result;
+ }
+ };
+
+ template<typename DerivedT>
+ template<typename T>
+ auto ComposableParserImpl<DerivedT>::operator|( T const &other ) const -> Parser {
+ return Parser() | static_cast<DerivedT const &>( *this ) | other;
+ }
+} // namespace detail
+
+// A Combined parser
+using detail::Parser;
+
+// A parser for options
+using detail::Opt;
+
+// A parser for arguments
+using detail::Arg;
+
+// Wrapper for argc, argv from main()
+using detail::Args;
+
+// Specifies the name of the executable
+using detail::ExeName;
+
+// Convenience wrapper for option parser that specifies the help option
+using detail::Help;
+
+// enum of result types from a parse
+using detail::ParseResultType;
+
+// Result type for parser operation
+using detail::ParserResult;
+
+}} // namespace Catch::clara
+
+// end clara.hpp
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
+// Restore Clara's value for console width, if present
+#ifdef CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH
+#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH
+#undef CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH
+#endif
+
+// end catch_clara.h
+namespace Catch {
+
+ clara::Parser makeCommandLineParser( ConfigData& config );
+
+} // end namespace Catch
+
+// end catch_commandline.h
+#include <fstream>
+#include <ctime>
+
+namespace Catch {
+
+ clara::Parser makeCommandLineParser( ConfigData& config ) {
+
+ using namespace clara;
+
+ auto const setWarning = [&]( std::string const& warning ) {
+ if( warning != "NoAssertions" )
+ return ParserResult::runtimeError( "Unrecognised warning: '" + warning + "'" );
+ config.warnings = static_cast<WarnAbout::What>( config.warnings | WarnAbout::NoAssertions );
+ return ParserResult::ok( ParseResultType::Matched );
+ };
+ auto const loadTestNamesFromFile = [&]( std::string const& filename ) {
+ std::ifstream f( filename.c_str() );
+ if( !f.is_open() )
+ return ParserResult::runtimeError( "Unable to load input file: '" + filename + "'" );
+
+ std::string line;
+ while( std::getline( f, line ) ) {
+ line = trim(line);
+ if( !line.empty() && !startsWith( line, '#' ) ) {
+ if( !startsWith( line, '"' ) )
+ line = '"' + line + '"';
+ config.testsOrTags.push_back( line + ',' );
+ }
+ }
+ return ParserResult::ok( ParseResultType::Matched );
+ };
+ auto const setTestOrder = [&]( std::string const& order ) {
+ if( startsWith( "declared", order ) )
+ config.runOrder = RunTests::InDeclarationOrder;
+ else if( startsWith( "lexical", order ) )
+ config.runOrder = RunTests::InLexicographicalOrder;
+ else if( startsWith( "random", order ) )
+ config.runOrder = RunTests::InRandomOrder;
+ else
+ return clara::ParserResult::runtimeError( "Unrecognised ordering: '" + order + "'" );
+ return ParserResult::ok( ParseResultType::Matched );
+ };
+ auto const setRngSeed = [&]( std::string const& seed ) {
+ if( seed != "time" )
+ return clara::detail::convertInto( seed, config.rngSeed );
+ config.rngSeed = static_cast<unsigned int>( std::time(nullptr) );
+ return ParserResult::ok( ParseResultType::Matched );
+ };
+ auto const setColourUsage = [&]( std::string const& useColour ) {
+ auto mode = toLower( useColour );
+
+ if( mode == "yes" )
+ config.useColour = UseColour::Yes;
+ else if( mode == "no" )
+ config.useColour = UseColour::No;
+ else if( mode == "auto" )
+ config.useColour = UseColour::Auto;
+ else
+ return ParserResult::runtimeError( "colour mode must be one of: auto, yes or no. '" + useColour + "' not recognised" );
+ return ParserResult::ok( ParseResultType::Matched );
+ };
+ auto const setWaitForKeypress = [&]( std::string const& keypress ) {
+ auto keypressLc = toLower( keypress );
+ if( keypressLc == "start" )
+ config.waitForKeypress = WaitForKeypress::BeforeStart;
+ else if( keypressLc == "exit" )
+ config.waitForKeypress = WaitForKeypress::BeforeExit;
+ else if( keypressLc == "both" )
+ config.waitForKeypress = WaitForKeypress::BeforeStartAndExit;
+ else
+ return ParserResult::runtimeError( "keypress argument must be one of: start, exit or both. '" + keypress + "' not recognised" );
+ return ParserResult::ok( ParseResultType::Matched );
+ };
+ auto const setVerbosity = [&]( std::string const& verbosity ) {
+ auto lcVerbosity = toLower( verbosity );
+ if( lcVerbosity == "quiet" )
+ config.verbosity = Verbosity::Quiet;
+ else if( lcVerbosity == "normal" )
+ config.verbosity = Verbosity::Normal;
+ else if( lcVerbosity == "high" )
+ config.verbosity = Verbosity::High;
+ else
+ return ParserResult::runtimeError( "Unrecognised verbosity, '" + verbosity + "'" );
+ return ParserResult::ok( ParseResultType::Matched );
+ };
+
+ auto cli
+ = ExeName( config.processName )
+ | Help( config.showHelp )
+ | Opt( config.listTests )
+ ["-l"]["--list-tests"]
+ ( "list all/matching test cases" )
+ | Opt( config.listTags )
+ ["-t"]["--list-tags"]
+ ( "list all/matching tags" )
+ | Opt( config.showSuccessfulTests )
+ ["-s"]["--success"]
+ ( "include successful tests in output" )
+ | Opt( config.shouldDebugBreak )
+ ["-b"]["--break"]
+ ( "break into debugger on failure" )
+ | Opt( config.noThrow )
+ ["-e"]["--nothrow"]
+ ( "skip exception tests" )
+ | Opt( config.showInvisibles )
+ ["-i"]["--invisibles"]
+ ( "show invisibles (tabs, newlines)" )
+ | Opt( config.outputFilename, "filename" )
+ ["-o"]["--out"]
+ ( "output filename" )
+ | Opt( config.reporterNames, "name" )
+ ["-r"]["--reporter"]
+ ( "reporter to use (defaults to console)" )
+ | Opt( config.name, "name" )
+ ["-n"]["--name"]
+ ( "suite name" )
+ | Opt( [&]( bool ){ config.abortAfter = 1; } )
+ ["-a"]["--abort"]
+ ( "abort at first failure" )
+ | Opt( [&]( int x ){ config.abortAfter = x; }, "no. failures" )
+ ["-x"]["--abortx"]
+ ( "abort after x failures" )
+ | Opt( setWarning, "warning name" )
+ ["-w"]["--warn"]
+ ( "enable warnings" )
+ | Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, "yes|no" )
+ ["-d"]["--durations"]
+ ( "show test durations" )
+ | Opt( loadTestNamesFromFile, "filename" )
+ ["-f"]["--input-file"]
+ ( "load test names to run from a file" )
+ | Opt( config.filenamesAsTags )
+ ["-#"]["--filenames-as-tags"]
+ ( "adds a tag for the filename" )
+ | Opt( config.sectionsToRun, "section name" )
+ ["-c"]["--section"]
+ ( "specify section to run" )
+ | Opt( setVerbosity, "quiet|normal|high" )
+ ["-v"]["--verbosity"]
+ ( "set output verbosity" )
+ | Opt( config.listTestNamesOnly )
+ ["--list-test-names-only"]
+ ( "list all/matching test cases names only" )
+ | Opt( config.listReporters )
+ ["--list-reporters"]
+ ( "list all reporters" )
+ | Opt( setTestOrder, "decl|lex|rand" )
+ ["--order"]
+ ( "test case order (defaults to decl)" )
+ | Opt( setRngSeed, "'time'|number" )
+ ["--rng-seed"]
+ ( "set a specific seed for random numbers" )
+ | Opt( setColourUsage, "yes|no" )
+ ["--use-colour"]
+ ( "should output be colourised" )
+ | Opt( config.libIdentify )
+ ["--libidentify"]
+ ( "report name and version according to libidentify standard" )
+ | Opt( setWaitForKeypress, "start|exit|both" )
+ ["--wait-for-keypress"]
+ ( "waits for a keypress before exiting" )
+ | Opt( config.benchmarkResolutionMultiple, "multiplier" )
+ ["--benchmark-resolution-multiple"]
+ ( "multiple of clock resolution to run benchmarks" )
+
+ | Arg( config.testsOrTags, "test name|pattern|tags" )
+ ( "which test or tests to use" );
+
+ return cli;
+ }
+
+} // end namespace Catch
+// end catch_commandline.cpp
+// start catch_common.cpp
+
+#include <cstring>
+#include <ostream>
+
+namespace Catch {
+
+ bool SourceLineInfo::empty() const noexcept {
+ return file[0] == '\0';
+ }
+ bool SourceLineInfo::operator == ( SourceLineInfo const& other ) const noexcept {
+ return line == other.line && (file == other.file || std::strcmp(file, other.file) == 0);
+ }
+ bool SourceLineInfo::operator < ( SourceLineInfo const& other ) const noexcept {
+ return line < other.line || ( line == other.line && (std::strcmp(file, other.file) < 0));
+ }
+
+ std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) {
+#ifndef __GNUG__
+ os << info.file << '(' << info.line << ')';
+#else
+ os << info.file << ':' << info.line;
+#endif
+ return os;
+ }
+
+ std::string StreamEndStop::operator+() const {
+ return std::string();
+ }
+
+ NonCopyable::NonCopyable() = default;
+ NonCopyable::~NonCopyable() = default;
+
+}
+// end catch_common.cpp
+// start catch_config.cpp
+
+// start catch_enforce.h
+
+#include <stdexcept>
+#include <iosfwd>
+
+#define CATCH_PREPARE_EXCEPTION( type, msg ) \
+ type( static_cast<std::ostringstream&&>( Catch::ReusableStringStream().get() << msg ).str() )
+#define CATCH_INTERNAL_ERROR( msg ) \
+ throw CATCH_PREPARE_EXCEPTION( std::logic_error, CATCH_INTERNAL_LINEINFO << ": Internal Catch error: " << msg);
+#define CATCH_ERROR( msg ) \
+ throw CATCH_PREPARE_EXCEPTION( std::domain_error, msg )
+#define CATCH_ENFORCE( condition, msg ) \
+ do{ if( !(condition) ) CATCH_ERROR( msg ); } while(false)
+
+// end catch_enforce.h
+namespace Catch {
+
+ Config::Config( ConfigData const& data )
+ : m_data( data ),
+ m_stream( openStream() )
+ {
+ if( !data.testsOrTags.empty() ) {
+ TestSpecParser parser( ITagAliasRegistry::get() );
+ for( auto const& testOrTags : data.testsOrTags )
+ parser.parse( testOrTags );
+ m_testSpec = parser.testSpec();
+ }
+ }
+
+ std::string const& Config::getFilename() const {
+ return m_data.outputFilename ;
+ }
+
+ bool Config::listTests() const { return m_data.listTests; }
+ bool Config::listTestNamesOnly() const { return m_data.listTestNamesOnly; }
+ bool Config::listTags() const { return m_data.listTags; }
+ bool Config::listReporters() const { return m_data.listReporters; }
+
+ std::string Config::getProcessName() const { return m_data.processName; }
+
+ std::vector<std::string> const& Config::getReporterNames() const { return m_data.reporterNames; }
+ std::vector<std::string> const& Config::getSectionsToRun() const { return m_data.sectionsToRun; }
+
+ TestSpec const& Config::testSpec() const { return m_testSpec; }
+
+ bool Config::showHelp() const { return m_data.showHelp; }
+
+ // IConfig interface
+ bool Config::allowThrows() const { return !m_data.noThrow; }
+ std::ostream& Config::stream() const { return m_stream->stream(); }
+ std::string Config::name() const { return m_data.name.empty() ? m_data.processName : m_data.name; }
+ bool Config::includeSuccessfulResults() const { return m_data.showSuccessfulTests; }
+ bool Config::warnAboutMissingAssertions() const { return m_data.warnings & WarnAbout::NoAssertions; }
+ ShowDurations::OrNot Config::showDurations() const { return m_data.showDurations; }
+ RunTests::InWhatOrder Config::runOrder() const { return m_data.runOrder; }
+ unsigned int Config::rngSeed() const { return m_data.rngSeed; }
+ int Config::benchmarkResolutionMultiple() const { return m_data.benchmarkResolutionMultiple; }
+ UseColour::YesOrNo Config::useColour() const { return m_data.useColour; }
+ bool Config::shouldDebugBreak() const { return m_data.shouldDebugBreak; }
+ int Config::abortAfter() const { return m_data.abortAfter; }
+ bool Config::showInvisibles() const { return m_data.showInvisibles; }
+ Verbosity Config::verbosity() const { return m_data.verbosity; }
+
+ IStream const* Config::openStream() {
+ return Catch::makeStream(m_data.outputFilename);
+ }
+
+} // end namespace Catch
+// end catch_config.cpp
+// start catch_console_colour.cpp
+
+#if defined(__clang__)
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wexit-time-destructors"
+#endif
+
+// start catch_errno_guard.h
+
+namespace Catch {
+
+ class ErrnoGuard {
+ public:
+ ErrnoGuard();
+ ~ErrnoGuard();
+ private:
+ int m_oldErrno;
+ };
+
+}
+
+// end catch_errno_guard.h
+#include <sstream>
+
+namespace Catch {
+ namespace {
+
+ struct IColourImpl {
+ virtual ~IColourImpl() = default;
+ virtual void use( Colour::Code _colourCode ) = 0;
+ };
+
+ struct NoColourImpl : IColourImpl {
+ void use( Colour::Code ) {}
+
+ static IColourImpl* instance() {
+ static NoColourImpl s_instance;
+ return &s_instance;
+ }
+ };
+
+ } // anon namespace
+} // namespace Catch
+
+#if !defined( CATCH_CONFIG_COLOUR_NONE ) && !defined( CATCH_CONFIG_COLOUR_WINDOWS ) && !defined( CATCH_CONFIG_COLOUR_ANSI )
+# ifdef CATCH_PLATFORM_WINDOWS
+# define CATCH_CONFIG_COLOUR_WINDOWS
+# else
+# define CATCH_CONFIG_COLOUR_ANSI
+# endif
+#endif
+
+#if defined ( CATCH_CONFIG_COLOUR_WINDOWS ) /////////////////////////////////////////
+
+namespace Catch {
+namespace {
+
+ class Win32ColourImpl : public IColourImpl {
+ public:
+ Win32ColourImpl() : stdoutHandle( GetStdHandle(STD_OUTPUT_HANDLE) )
+ {
+ CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
+ GetConsoleScreenBufferInfo( stdoutHandle, &csbiInfo );
+ originalForegroundAttributes = csbiInfo.wAttributes & ~( BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_BLUE | BACKGROUND_INTENSITY );
+ originalBackgroundAttributes = csbiInfo.wAttributes & ~( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY );
+ }
+
+ virtual void use( Colour::Code _colourCode ) override {
+ switch( _colourCode ) {
+ case Colour::None: return setTextAttribute( originalForegroundAttributes );
+ case Colour::White: return setTextAttribute( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE );
+ case Colour::Red: return setTextAttribute( FOREGROUND_RED );
+ case Colour::Green: return setTextAttribute( FOREGROUND_GREEN );
+ case Colour::Blue: return setTextAttribute( FOREGROUND_BLUE );
+ case Colour::Cyan: return setTextAttribute( FOREGROUND_BLUE | FOREGROUND_GREEN );
+ case Colour::Yellow: return setTextAttribute( FOREGROUND_RED | FOREGROUND_GREEN );
+ case Colour::Grey: return setTextAttribute( 0 );
+
+ case Colour::LightGrey: return setTextAttribute( FOREGROUND_INTENSITY );
+ case Colour::BrightRed: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_RED );
+ case Colour::BrightGreen: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN );
+ case Colour::BrightWhite: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE );
+
+ case Colour::Bright: CATCH_INTERNAL_ERROR( "not a colour" );
+ }
+ }
+
+ private:
+ void setTextAttribute( WORD _textAttribute ) {
+ SetConsoleTextAttribute( stdoutHandle, _textAttribute | originalBackgroundAttributes );
+ }
+ HANDLE stdoutHandle;
+ WORD originalForegroundAttributes;
+ WORD originalBackgroundAttributes;
+ };
+
+ IColourImpl* platformColourInstance() {
+ static Win32ColourImpl s_instance;
+
+ IConfigPtr config = getCurrentContext().getConfig();
+ UseColour::YesOrNo colourMode = config
+ ? config->useColour()
+ : UseColour::Auto;
+ if( colourMode == UseColour::Auto )
+ colourMode = UseColour::Yes;
+ return colourMode == UseColour::Yes
+ ? &s_instance
+ : NoColourImpl::instance();
+ }
+
+} // end anon namespace
+} // end namespace Catch
+
+#elif defined( CATCH_CONFIG_COLOUR_ANSI ) //////////////////////////////////////
+
+#include <unistd.h>
+
+namespace Catch {
+namespace {
+
+ // use POSIX/ ANSI console terminal codes
+ // Thanks to Adam Strzelecki for original contribution
+ // (http://github.com/nanoant)
+ // https://github.com/philsquared/Catch/pull/131
+ class PosixColourImpl : public IColourImpl {
+ public:
+ virtual void use( Colour::Code _colourCode ) override {
+ switch( _colourCode ) {
+ case Colour::None:
+ case Colour::White: return setColour( "[0m" );
+ case Colour::Red: return setColour( "[0;31m" );
+ case Colour::Green: return setColour( "[0;32m" );
+ case Colour::Blue: return setColour( "[0;34m" );
+ case Colour::Cyan: return setColour( "[0;36m" );
+ case Colour::Yellow: return setColour( "[0;33m" );
+ case Colour::Grey: return setColour( "[1;30m" );
+
+ case Colour::LightGrey: return setColour( "[0;37m" );
+ case Colour::BrightRed: return setColour( "[1;31m" );
+ case Colour::BrightGreen: return setColour( "[1;32m" );
+ case Colour::BrightWhite: return setColour( "[1;37m" );
+
+ case Colour::Bright: CATCH_INTERNAL_ERROR( "not a colour" );
+ }
+ }
+ static IColourImpl* instance() {
+ static PosixColourImpl s_instance;
+ return &s_instance;
+ }
+
+ private:
+ void setColour( const char* _escapeCode ) {
+ Catch::cout() << '\033' << _escapeCode;
+ }
+ };
+
+ bool useColourOnPlatform() {
+ return
+#ifdef CATCH_PLATFORM_MAC
+ !isDebuggerActive() &&
+#endif
+ isatty(STDOUT_FILENO);
+ }
+ IColourImpl* platformColourInstance() {
+ ErrnoGuard guard;
+ IConfigPtr config = getCurrentContext().getConfig();
+ UseColour::YesOrNo colourMode = config
+ ? config->useColour()
+ : UseColour::Auto;
+ if( colourMode == UseColour::Auto )
+ colourMode = useColourOnPlatform()
+ ? UseColour::Yes
+ : UseColour::No;
+ return colourMode == UseColour::Yes
+ ? PosixColourImpl::instance()
+ : NoColourImpl::instance();
+ }
+
+} // end anon namespace
+} // end namespace Catch
+
+#else // not Windows or ANSI ///////////////////////////////////////////////
+
+namespace Catch {
+
+ static IColourImpl* platformColourInstance() { return NoColourImpl::instance(); }
+
+} // end namespace Catch
+
+#endif // Windows/ ANSI/ None
+
+namespace Catch {
+
+ Colour::Colour( Code _colourCode ) { use( _colourCode ); }
+ Colour::Colour( Colour&& rhs ) noexcept {
+ m_moved = rhs.m_moved;
+ rhs.m_moved = true;
+ }
+ Colour& Colour::operator=( Colour&& rhs ) noexcept {
+ m_moved = rhs.m_moved;
+ rhs.m_moved = true;
+ return *this;
+ }
+
+ Colour::~Colour(){ if( !m_moved ) use( None ); }
+
+ void Colour::use( Code _colourCode ) {
+ static IColourImpl* impl = platformColourInstance();
+ impl->use( _colourCode );
+ }
+
+ std::ostream& operator << ( std::ostream& os, Colour const& ) {
+ return os;
+ }
+
+} // end namespace Catch
+
+#if defined(__clang__)
+# pragma clang diagnostic pop
+#endif
+
+// end catch_console_colour.cpp
+// start catch_context.cpp
+
+namespace Catch {
+
+ class Context : public IMutableContext, NonCopyable {
+
+ public: // IContext
+ virtual IResultCapture* getResultCapture() override {
+ return m_resultCapture;
+ }
+ virtual IRunner* getRunner() override {
+ return m_runner;
+ }
+
+ virtual IConfigPtr const& getConfig() const override {
+ return m_config;
+ }
+
+ virtual ~Context() override;
+
+ public: // IMutableContext
+ virtual void setResultCapture( IResultCapture* resultCapture ) override {
+ m_resultCapture = resultCapture;
+ }
+ virtual void setRunner( IRunner* runner ) override {
+ m_runner = runner;
+ }
+ virtual void setConfig( IConfigPtr const& config ) override {
+ m_config = config;
+ }
+
+ friend IMutableContext& getCurrentMutableContext();
+
+ private:
+ IConfigPtr m_config;
+ IRunner* m_runner = nullptr;
+ IResultCapture* m_resultCapture = nullptr;
+ };
+
+ IMutableContext *IMutableContext::currentContext = nullptr;
+
+ void IMutableContext::createContext()
+ {
+ currentContext = new Context();
+ }
+
+ void cleanUpContext() {
+ delete IMutableContext::currentContext;
+ IMutableContext::currentContext = nullptr;
+ }
+ IContext::~IContext() = default;
+ IMutableContext::~IMutableContext() = default;
+ Context::~Context() = default;
+}
+// end catch_context.cpp
+// start catch_debug_console.cpp
+
+// start catch_debug_console.h
+
+#include <string>
+
+namespace Catch {
+ void writeToDebugConsole( std::string const& text );
+}
+
+// end catch_debug_console.h
+#ifdef CATCH_PLATFORM_WINDOWS
+
+ namespace Catch {
+ void writeToDebugConsole( std::string const& text ) {
+ ::OutputDebugStringA( text.c_str() );
+ }
+ }
+#else
+ namespace Catch {
+ void writeToDebugConsole( std::string const& text ) {
+ // !TBD: Need a version for Mac/ XCode and other IDEs
+ Catch::cout() << text;
+ }
+ }
+#endif // Platform
+// end catch_debug_console.cpp
+// start catch_debugger.cpp
+
+#ifdef CATCH_PLATFORM_MAC
+
+# include <assert.h>
+# include <stdbool.h>
+# include <sys/types.h>
+# include <unistd.h>
+# include <sys/sysctl.h>
+# include <cstddef>
+# include <ostream>
+
+namespace Catch {
+
+ // The following function is taken directly from the following technical note:
+ // http://developer.apple.com/library/mac/#qa/qa2004/qa1361.html
+
+ // Returns true if the current process is being debugged (either
+ // running under the debugger or has a debugger attached post facto).
+ bool isDebuggerActive(){
+
+ int mib[4];
+ struct kinfo_proc info;
+ std::size_t size;
+
+ // Initialize the flags so that, if sysctl fails for some bizarre
+ // reason, we get a predictable result.
+
+ info.kp_proc.p_flag = 0;
+
+ // Initialize mib, which tells sysctl the info we want, in this case
+ // we're looking for information about a specific process ID.
+
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_PROC;
+ mib[2] = KERN_PROC_PID;
+ mib[3] = getpid();
+
+ // Call sysctl.
+
+ size = sizeof(info);
+ if( sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, nullptr, 0) != 0 ) {
+ Catch::cerr() << "\n** Call to sysctl failed - unable to determine if debugger is active **\n" << std::endl;
+ return false;
+ }
+
+ // We're being debugged if the P_TRACED flag is set.
+
+ return ( (info.kp_proc.p_flag & P_TRACED) != 0 );
+ }
+ } // namespace Catch
+
+#elif defined(CATCH_PLATFORM_LINUX)
+ #include <fstream>
+ #include <string>
+
+ namespace Catch{
+ // The standard POSIX way of detecting a debugger is to attempt to
+ // ptrace() the process, but this needs to be done from a child and not
+ // this process itself to still allow attaching to this process later
+ // if wanted, so is rather heavy. Under Linux we have the PID of the
+ // "debugger" (which doesn't need to be gdb, of course, it could also
+ // be strace, for example) in /proc/$PID/status, so just get it from
+ // there instead.
+ bool isDebuggerActive(){
+ // Libstdc++ has a bug, where std::ifstream sets errno to 0
+ // This way our users can properly assert over errno values
+ ErrnoGuard guard;
+ std::ifstream in("/proc/self/status");
+ for( std::string line; std::getline(in, line); ) {
+ static const int PREFIX_LEN = 11;
+ if( line.compare(0, PREFIX_LEN, "TracerPid:\t") == 0 ) {
+ // We're traced if the PID is not 0 and no other PID starts
+ // with 0 digit, so it's enough to check for just a single
+ // character.
+ return line.length() > PREFIX_LEN && line[PREFIX_LEN] != '0';
+ }
+ }
+
+ return false;
+ }
+ } // namespace Catch
+#elif defined(_MSC_VER)
+ extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent();
+ namespace Catch {
+ bool isDebuggerActive() {
+ return IsDebuggerPresent() != 0;
+ }
+ }
+#elif defined(__MINGW32__)
+ extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent();
+ namespace Catch {
+ bool isDebuggerActive() {
+ return IsDebuggerPresent() != 0;
+ }
+ }
+#else
+ namespace Catch {
+ bool isDebuggerActive() { return false; }
+ }
+#endif // Platform
+// end catch_debugger.cpp
+// start catch_decomposer.cpp
+
+namespace Catch {
+
+ ITransientExpression::~ITransientExpression() = default;
+
+ void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ) {
+ if( lhs.size() + rhs.size() < 40 &&
+ lhs.find('\n') == std::string::npos &&
+ rhs.find('\n') == std::string::npos )
+ os << lhs << " " << op << " " << rhs;
+ else
+ os << lhs << "\n" << op << "\n" << rhs;
+ }
+}
+// end catch_decomposer.cpp
+// start catch_errno_guard.cpp
+
+#include <cerrno>
+
+namespace Catch {
+ ErrnoGuard::ErrnoGuard():m_oldErrno(errno){}
+ ErrnoGuard::~ErrnoGuard() { errno = m_oldErrno; }
+}
+// end catch_errno_guard.cpp
+// start catch_exception_translator_registry.cpp
+
+// start catch_exception_translator_registry.h
+
+#include <vector>
+#include <string>
+#include <memory>
+
+namespace Catch {
+
+ class ExceptionTranslatorRegistry : public IExceptionTranslatorRegistry {
+ public:
+ ~ExceptionTranslatorRegistry();
+ virtual void registerTranslator( const IExceptionTranslator* translator );
+ virtual std::string translateActiveException() const override;
+ std::string tryTranslators() const;
+
+ private:
+ std::vector<std::unique_ptr<IExceptionTranslator const>> m_translators;
+ };
+}
+
+// end catch_exception_translator_registry.h
+#ifdef __OBJC__
+#import "Foundation/Foundation.h"
+#endif
+
+namespace Catch {
+
+ ExceptionTranslatorRegistry::~ExceptionTranslatorRegistry() {
+ }
+
+ void ExceptionTranslatorRegistry::registerTranslator( const IExceptionTranslator* translator ) {
+ m_translators.push_back( std::unique_ptr<const IExceptionTranslator>( translator ) );
+ }
+
+ std::string ExceptionTranslatorRegistry::translateActiveException() const {
+ try {
+#ifdef __OBJC__
+ // In Objective-C try objective-c exceptions first
+ @try {
+ return tryTranslators();
+ }
+ @catch (NSException *exception) {
+ return Catch::Detail::stringify( [exception description] );
+ }
+#else
+ // Compiling a mixed mode project with MSVC means that CLR
+ // exceptions will be caught in (...) as well. However, these
+ // do not fill-in std::current_exception and thus lead to crash
+ // when attempting rethrow.
+ // /EHa switch also causes structured exceptions to be caught
+ // here, but they fill-in current_exception properly, so
+ // at worst the output should be a little weird, instead of
+ // causing a crash.
+ if (std::current_exception() == nullptr) {
+ return "Non C++ exception. Possibly a CLR exception.";
+ }
+ return tryTranslators();
+#endif
+ }
+ catch( TestFailureException& ) {
+ std::rethrow_exception(std::current_exception());
+ }
+ catch( std::exception& ex ) {
+ return ex.what();
+ }
+ catch( std::string& msg ) {
+ return msg;
+ }
+ catch( const char* msg ) {
+ return msg;
+ }
+ catch(...) {
+ return "Unknown exception";
+ }
+ }
+
+ std::string ExceptionTranslatorRegistry::tryTranslators() const {
+ if( m_translators.empty() )
+ std::rethrow_exception(std::current_exception());
+ else
+ return m_translators[0]->translate( m_translators.begin()+1, m_translators.end() );
+ }
+}
+// end catch_exception_translator_registry.cpp
+// start catch_fatal_condition.cpp
+
+#if defined(__GNUC__)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wmissing-field-initializers"
+#endif
+
+namespace {
+ // Report the error condition
+ void reportFatal( char const * const message ) {
+ Catch::getCurrentContext().getResultCapture()->handleFatalErrorCondition( message );
+ }
+}
+
+#if defined ( CATCH_PLATFORM_WINDOWS ) /////////////////////////////////////////
+
+# if !defined ( CATCH_CONFIG_WINDOWS_SEH )
+
+namespace Catch {
+ void FatalConditionHandler::reset() {}
+}
+
+# else // CATCH_CONFIG_WINDOWS_SEH is defined
+
+namespace Catch {
+ struct SignalDefs { DWORD id; const char* name; };
+
+ // There is no 1-1 mapping between signals and windows exceptions.
+ // Windows can easily distinguish between SO and SigSegV,
+ // but SigInt, SigTerm, etc are handled differently.
+ static SignalDefs signalDefs[] = {
+ { EXCEPTION_ILLEGAL_INSTRUCTION, "SIGILL - Illegal instruction signal" },
+ { EXCEPTION_STACK_OVERFLOW, "SIGSEGV - Stack overflow" },
+ { EXCEPTION_ACCESS_VIOLATION, "SIGSEGV - Segmentation violation signal" },
+ { EXCEPTION_INT_DIVIDE_BY_ZERO, "Divide by zero error" },
+ };
+
+ LONG CALLBACK FatalConditionHandler::handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo) {
+ for (auto const& def : signalDefs) {
+ if (ExceptionInfo->ExceptionRecord->ExceptionCode == def.id) {
+ reportFatal(def.name);
+ }
+ }
+ // If its not an exception we care about, pass it along.
+ // This stops us from eating debugger breaks etc.
+ return EXCEPTION_CONTINUE_SEARCH;
+ }
+
+ FatalConditionHandler::FatalConditionHandler() {
+ isSet = true;
+ // 32k seems enough for Catch to handle stack overflow,
+ // but the value was found experimentally, so there is no strong guarantee
+ guaranteeSize = 32 * 1024;
+ exceptionHandlerHandle = nullptr;
+ // Register as first handler in current chain
+ exceptionHandlerHandle = AddVectoredExceptionHandler(1, handleVectoredException);
+ // Pass in guarantee size to be filled
+ SetThreadStackGuarantee(&guaranteeSize);
+ }
+
+ void FatalConditionHandler::reset() {
+ if (isSet) {
+ // Unregister handler and restore the old guarantee
+ RemoveVectoredExceptionHandler(exceptionHandlerHandle);
+ SetThreadStackGuarantee(&guaranteeSize);
+ exceptionHandlerHandle = nullptr;
+ isSet = false;
+ }
+ }
+
+ FatalConditionHandler::~FatalConditionHandler() {
+ reset();
+ }
+
+bool FatalConditionHandler::isSet = false;
+ULONG FatalConditionHandler::guaranteeSize = 0;
+PVOID FatalConditionHandler::exceptionHandlerHandle = nullptr;
+
+} // namespace Catch
+
+# endif // CATCH_CONFIG_WINDOWS_SEH
+
+#else // Not Windows - assumed to be POSIX compatible //////////////////////////
+
+# if !defined(CATCH_CONFIG_POSIX_SIGNALS)
+
+namespace Catch {
+ void FatalConditionHandler::reset() {}
+}
+
+# else // CATCH_CONFIG_POSIX_SIGNALS is defined
+
+#include <signal.h>
+
+namespace Catch {
+
+ struct SignalDefs {
+ int id;
+ const char* name;
+ };
+ static SignalDefs signalDefs[] = {
+ { SIGINT, "SIGINT - Terminal interrupt signal" },
+ { SIGILL, "SIGILL - Illegal instruction signal" },
+ { SIGFPE, "SIGFPE - Floating point error signal" },
+ { SIGSEGV, "SIGSEGV - Segmentation violation signal" },
+ { SIGTERM, "SIGTERM - Termination request signal" },
+ { SIGABRT, "SIGABRT - Abort (abnormal termination) signal" }
+ };
+
+ void FatalConditionHandler::handleSignal( int sig ) {
+ char const * name = "<unknown signal>";
+ for (auto const& def : signalDefs) {
+ if (sig == def.id) {
+ name = def.name;
+ break;
+ }
+ }
+ reset();
+ reportFatal(name);
+ raise( sig );
+ }
+
+ FatalConditionHandler::FatalConditionHandler() {
+ isSet = true;
+ stack_t sigStack;
+ sigStack.ss_sp = altStackMem;
+ sigStack.ss_size = SIGSTKSZ;
+ sigStack.ss_flags = 0;
+ sigaltstack(&sigStack, &oldSigStack);
+ struct sigaction sa = { };
+
+ sa.sa_handler = handleSignal;
+ sa.sa_flags = SA_ONSTACK;
+ for (std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i) {
+ sigaction(signalDefs[i].id, &sa, &oldSigActions[i]);
+ }
+ }
+
+ FatalConditionHandler::~FatalConditionHandler() {
+ reset();
+ }
+
+ void FatalConditionHandler::reset() {
+ if( isSet ) {
+ // Set signals back to previous values -- hopefully nobody overwrote them in the meantime
+ for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) {
+ sigaction(signalDefs[i].id, &oldSigActions[i], nullptr);
+ }
+ // Return the old stack
+ sigaltstack(&oldSigStack, nullptr);
+ isSet = false;
+ }
+ }
+
+ bool FatalConditionHandler::isSet = false;
+ struct sigaction FatalConditionHandler::oldSigActions[sizeof(signalDefs)/sizeof(SignalDefs)] = {};
+ stack_t FatalConditionHandler::oldSigStack = {};
+ char FatalConditionHandler::altStackMem[SIGSTKSZ] = {};
+
+} // namespace Catch
+
+# endif // CATCH_CONFIG_POSIX_SIGNALS
+
+#endif // not Windows
+
+#if defined(__GNUC__)
+# pragma GCC diagnostic pop
+#endif
+// end catch_fatal_condition.cpp
+// start catch_interfaces_capture.cpp
+
+namespace Catch {
+ IResultCapture::~IResultCapture() = default;
+}
+// end catch_interfaces_capture.cpp
+// start catch_interfaces_config.cpp
+
+namespace Catch {
+ IConfig::~IConfig() = default;
+}
+// end catch_interfaces_config.cpp
+// start catch_interfaces_exception.cpp
+
+namespace Catch {
+ IExceptionTranslator::~IExceptionTranslator() = default;
+ IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() = default;
+}
+// end catch_interfaces_exception.cpp
+// start catch_interfaces_registry_hub.cpp
+
+namespace Catch {
+ IRegistryHub::~IRegistryHub() = default;
+ IMutableRegistryHub::~IMutableRegistryHub() = default;
+}
+// end catch_interfaces_registry_hub.cpp
+// start catch_interfaces_reporter.cpp
+
+// start catch_reporter_multi.h
+
+namespace Catch {
+
+ class MultipleReporters : public IStreamingReporter {
+ using Reporters = std::vector<IStreamingReporterPtr>;
+ Reporters m_reporters;
+
+ public:
+ void add( IStreamingReporterPtr&& reporter );
+
+ public: // IStreamingReporter
+
+ ReporterPreferences getPreferences() const override;
+
+ void noMatchingTestCases( std::string const& spec ) override;
+
+ static std::set<Verbosity> getSupportedVerbosities();
+
+ void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override;
+ void benchmarkEnded( BenchmarkStats const& benchmarkStats ) override;
+
+ void testRunStarting( TestRunInfo const& testRunInfo ) override;
+ void testGroupStarting( GroupInfo const& groupInfo ) override;
+ void testCaseStarting( TestCaseInfo const& testInfo ) override;
+ void sectionStarting( SectionInfo const& sectionInfo ) override;
+ void assertionStarting( AssertionInfo const& assertionInfo ) override;
+
+ // The return value indicates if the messages buffer should be cleared:
+ bool assertionEnded( AssertionStats const& assertionStats ) override;
+ void sectionEnded( SectionStats const& sectionStats ) override;
+ void testCaseEnded( TestCaseStats const& testCaseStats ) override;
+ void testGroupEnded( TestGroupStats const& testGroupStats ) override;
+ void testRunEnded( TestRunStats const& testRunStats ) override;
+
+ void skipTest( TestCaseInfo const& testInfo ) override;
+ bool isMulti() const override;
+
+ };
+
+} // end namespace Catch
+
+// end catch_reporter_multi.h
+namespace Catch {
+
+ ReporterConfig::ReporterConfig( IConfigPtr const& _fullConfig )
+ : m_stream( &_fullConfig->stream() ), m_fullConfig( _fullConfig ) {}
+
+ ReporterConfig::ReporterConfig( IConfigPtr const& _fullConfig, std::ostream& _stream )
+ : m_stream( &_stream ), m_fullConfig( _fullConfig ) {}
+
+ std::ostream& ReporterConfig::stream() const { return *m_stream; }
+ IConfigPtr ReporterConfig::fullConfig() const { return m_fullConfig; }
+
+ TestRunInfo::TestRunInfo( std::string const& _name ) : name( _name ) {}
+
+ GroupInfo::GroupInfo( std::string const& _name,
+ std::size_t _groupIndex,
+ std::size_t _groupsCount )
+ : name( _name ),
+ groupIndex( _groupIndex ),
+ groupsCounts( _groupsCount )
+ {}
+
+ AssertionStats::AssertionStats( AssertionResult const& _assertionResult,
+ std::vector<MessageInfo> const& _infoMessages,
+ Totals const& _totals )
+ : assertionResult( _assertionResult ),
+ infoMessages( _infoMessages ),
+ totals( _totals )
+ {
+ assertionResult.m_resultData.lazyExpression.m_transientExpression = _assertionResult.m_resultData.lazyExpression.m_transientExpression;
+
+ if( assertionResult.hasMessage() ) {
+ // Copy message into messages list.
+ // !TBD This should have been done earlier, somewhere
+ MessageBuilder builder( assertionResult.getTestMacroName(), assertionResult.getSourceInfo(), assertionResult.getResultType() );
+ builder << assertionResult.getMessage();
+ builder.m_info.message = builder.m_stream.str();
+
+ infoMessages.push_back( builder.m_info );
+ }
+ }
+
+ AssertionStats::~AssertionStats() = default;
+
+ SectionStats::SectionStats( SectionInfo const& _sectionInfo,
+ Counts const& _assertions,
+ double _durationInSeconds,
+ bool _missingAssertions )
+ : sectionInfo( _sectionInfo ),
+ assertions( _assertions ),
+ durationInSeconds( _durationInSeconds ),
+ missingAssertions( _missingAssertions )
+ {}
+
+ SectionStats::~SectionStats() = default;
+
+ TestCaseStats::TestCaseStats( TestCaseInfo const& _testInfo,
+ Totals const& _totals,
+ std::string const& _stdOut,
+ std::string const& _stdErr,
+ bool _aborting )
+ : testInfo( _testInfo ),
+ totals( _totals ),
+ stdOut( _stdOut ),
+ stdErr( _stdErr ),
+ aborting( _aborting )
+ {}
+
+ TestCaseStats::~TestCaseStats() = default;
+
+ TestGroupStats::TestGroupStats( GroupInfo const& _groupInfo,
+ Totals const& _totals,
+ bool _aborting )
+ : groupInfo( _groupInfo ),
+ totals( _totals ),
+ aborting( _aborting )
+ {}
+
+ TestGroupStats::TestGroupStats( GroupInfo const& _groupInfo )
+ : groupInfo( _groupInfo ),
+ aborting( false )
+ {}
+
+ TestGroupStats::~TestGroupStats() = default;
+
+ TestRunStats::TestRunStats( TestRunInfo const& _runInfo,
+ Totals const& _totals,
+ bool _aborting )
+ : runInfo( _runInfo ),
+ totals( _totals ),
+ aborting( _aborting )
+ {}
+
+ TestRunStats::~TestRunStats() = default;
+
+ void IStreamingReporter::fatalErrorEncountered( StringRef ) {}
+ bool IStreamingReporter::isMulti() const { return false; }
+
+ IReporterFactory::~IReporterFactory() = default;
+ IReporterRegistry::~IReporterRegistry() = default;
+
+ void addReporter( IStreamingReporterPtr& existingReporter, IStreamingReporterPtr&& additionalReporter ) {
+
+ if( !existingReporter ) {
+ existingReporter = std::move( additionalReporter );
+ return;
+ }
+
+ MultipleReporters* multi = nullptr;
+
+ if( existingReporter->isMulti() ) {
+ multi = static_cast<MultipleReporters*>( existingReporter.get() );
+ }
+ else {
+ auto newMulti = std::unique_ptr<MultipleReporters>( new MultipleReporters );
+ newMulti->add( std::move( existingReporter ) );
+ multi = newMulti.get();
+ existingReporter = std::move( newMulti );
+ }
+ multi->add( std::move( additionalReporter ) );
+ }
+
+} // end namespace Catch
+// end catch_interfaces_reporter.cpp
+// start catch_interfaces_runner.cpp
+
+namespace Catch {
+ IRunner::~IRunner() = default;
+}
+// end catch_interfaces_runner.cpp
+// start catch_interfaces_testcase.cpp
+
+namespace Catch {
+ ITestInvoker::~ITestInvoker() = default;
+ ITestCaseRegistry::~ITestCaseRegistry() = default;
+}
+// end catch_interfaces_testcase.cpp
+// start catch_leak_detector.cpp
+
+#ifdef CATCH_CONFIG_WINDOWS_CRTDBG
+#include <crtdbg.h>
+
+namespace Catch {
+
+ LeakDetector::LeakDetector() {
+ int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
+ flag |= _CRTDBG_LEAK_CHECK_DF;
+ flag |= _CRTDBG_ALLOC_MEM_DF;
+ _CrtSetDbgFlag(flag);
+ _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+ _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
+ // Change this to leaking allocation's number to break there
+ _CrtSetBreakAlloc(-1);
+ }
+}
+
+#else
+
+ Catch::LeakDetector::LeakDetector() {}
+
+#endif
+// end catch_leak_detector.cpp
+// start catch_list.cpp
+
+// start catch_list.h
+
+#include <set>
+
+namespace Catch {
+
+ std::size_t listTests( Config const& config );
+
+ std::size_t listTestsNamesOnly( Config const& config );
+
+ struct TagInfo {
+ void add( std::string const& spelling );
+ std::string all() const;
+
+ std::set<std::string> spellings;
+ std::size_t count = 0;
+ };
+
+ std::size_t listTags( Config const& config );
+
+ std::size_t listReporters( Config const& /*config*/ );
+
+ Option<std::size_t> list( Config const& config );
+
+} // end namespace Catch
+
+// end catch_list.h
+// start catch_text.h
+
+namespace Catch {
+ using namespace clara::TextFlow;
+}
+
+// end catch_text.h
+#include <limits>
+#include <algorithm>
+#include <iomanip>
+
+namespace Catch {
+
+ std::size_t listTests( Config const& config ) {
+ TestSpec testSpec = config.testSpec();
+ if( config.testSpec().hasFilters() )
+ Catch::cout() << "Matching test cases:\n";
+ else {
+ Catch::cout() << "All available test cases:\n";
+ testSpec = TestSpecParser( ITagAliasRegistry::get() ).parse( "*" ).testSpec();
+ }
+
+ auto matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config );
+ for( auto const& testCaseInfo : matchedTestCases ) {
+ Colour::Code colour = testCaseInfo.isHidden()
+ ? Colour::SecondaryText
+ : Colour::None;
+ Colour colourGuard( colour );
+
+ Catch::cout() << Column( testCaseInfo.name ).initialIndent( 2 ).indent( 4 ) << "\n";
+ if( config.verbosity() >= Verbosity::High ) {
+ Catch::cout() << Column( Catch::Detail::stringify( testCaseInfo.lineInfo ) ).indent(4) << std::endl;
+ std::string description = testCaseInfo.description;
+ if( description.empty() )
+ description = "(NO DESCRIPTION)";
+ Catch::cout() << Column( description ).indent(4) << std::endl;
+ }
+ if( !testCaseInfo.tags.empty() )
+ Catch::cout() << Column( testCaseInfo.tagsAsString() ).indent( 6 ) << "\n";
+ }
+
+ if( !config.testSpec().hasFilters() )
+ Catch::cout() << pluralise( matchedTestCases.size(), "test case" ) << '\n' << std::endl;
+ else
+ Catch::cout() << pluralise( matchedTestCases.size(), "matching test case" ) << '\n' << std::endl;
+ return matchedTestCases.size();
+ }
+
+ std::size_t listTestsNamesOnly( Config const& config ) {
+ TestSpec testSpec = config.testSpec();
+ if( !config.testSpec().hasFilters() )
+ testSpec = TestSpecParser( ITagAliasRegistry::get() ).parse( "*" ).testSpec();
+ std::size_t matchedTests = 0;
+ std::vector<TestCase> matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config );
+ for( auto const& testCaseInfo : matchedTestCases ) {
+ matchedTests++;
+ if( startsWith( testCaseInfo.name, '#' ) )
+ Catch::cout() << '"' << testCaseInfo.name << '"';
+ else
+ Catch::cout() << testCaseInfo.name;
+ if ( config.verbosity() >= Verbosity::High )
+ Catch::cout() << "\t@" << testCaseInfo.lineInfo;
+ Catch::cout() << std::endl;
+ }
+ return matchedTests;
+ }
+
+ void TagInfo::add( std::string const& spelling ) {
+ ++count;
+ spellings.insert( spelling );
+ }
+
+ std::string TagInfo::all() const {
+ std::string out;
+ for( auto const& spelling : spellings )
+ out += "[" + spelling + "]";
+ return out;
+ }
+
+ std::size_t listTags( Config const& config ) {
+ TestSpec testSpec = config.testSpec();
+ if( config.testSpec().hasFilters() )
+ Catch::cout() << "Tags for matching test cases:\n";
+ else {
+ Catch::cout() << "All available tags:\n";
+ testSpec = TestSpecParser( ITagAliasRegistry::get() ).parse( "*" ).testSpec();
+ }
+
+ std::map<std::string, TagInfo> tagCounts;
+
+ std::vector<TestCase> matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config );
+ for( auto const& testCase : matchedTestCases ) {
+ for( auto const& tagName : testCase.getTestCaseInfo().tags ) {
+ std::string lcaseTagName = toLower( tagName );
+ auto countIt = tagCounts.find( lcaseTagName );
+ if( countIt == tagCounts.end() )
+ countIt = tagCounts.insert( std::make_pair( lcaseTagName, TagInfo() ) ).first;
+ countIt->second.add( tagName );
+ }
+ }
+
+ for( auto const& tagCount : tagCounts ) {
+ ReusableStringStream rss;
+ rss << " " << std::setw(2) << tagCount.second.count << " ";
+ auto str = rss.str();
+ auto wrapper = Column( tagCount.second.all() )
+ .initialIndent( 0 )
+ .indent( str.size() )
+ .width( CATCH_CONFIG_CONSOLE_WIDTH-10 );
+ Catch::cout() << str << wrapper << '\n';
+ }
+ Catch::cout() << pluralise( tagCounts.size(), "tag" ) << '\n' << std::endl;
+ return tagCounts.size();
+ }
+
+ std::size_t listReporters( Config const& /*config*/ ) {
+ Catch::cout() << "Available reporters:\n";
+ IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories();
+ std::size_t maxNameLen = 0;
+ for( auto const& factoryKvp : factories )
+ maxNameLen = (std::max)( maxNameLen, factoryKvp.first.size() );
+
+ for( auto const& factoryKvp : factories ) {
+ Catch::cout()
+ << Column( factoryKvp.first + ":" )
+ .indent(2)
+ .width( 5+maxNameLen )
+ + Column( factoryKvp.second->getDescription() )
+ .initialIndent(0)
+ .indent(2)
+ .width( CATCH_CONFIG_CONSOLE_WIDTH - maxNameLen-8 )
+ << "\n";
+ }
+ Catch::cout() << std::endl;
+ return factories.size();
+ }
+
+ Option<std::size_t> list( Config const& config ) {
+ Option<std::size_t> listedCount;
+ if( config.listTests() )
+ listedCount = listedCount.valueOr(0) + listTests( config );
+ if( config.listTestNamesOnly() )
+ listedCount = listedCount.valueOr(0) + listTestsNamesOnly( config );
+ if( config.listTags() )
+ listedCount = listedCount.valueOr(0) + listTags( config );
+ if( config.listReporters() )
+ listedCount = listedCount.valueOr(0) + listReporters( config );
+ return listedCount;
+ }
+
+} // end namespace Catch
+// end catch_list.cpp
+// start catch_matchers.cpp
+
+namespace Catch {
+namespace Matchers {
+ namespace Impl {
+
+ std::string MatcherUntypedBase::toString() const {
+ if( m_cachedToString.empty() )
+ m_cachedToString = describe();
+ return m_cachedToString;
+ }
+
+ MatcherUntypedBase::~MatcherUntypedBase() = default;
+
+ } // namespace Impl
+} // namespace Matchers
+
+using namespace Matchers;
+using Matchers::Impl::MatcherBase;
+
+} // namespace Catch
+// end catch_matchers.cpp
+// start catch_matchers_floating.cpp
+
+#include <cstdlib>
+#include <cstdint>
+#include <cstring>
+#include <stdexcept>
+
+namespace Catch {
+namespace Matchers {
+namespace Floating {
+enum class FloatingPointKind : uint8_t {
+ Float,
+ Double
+};
+}
+}
+}
+
+namespace {
+
+template <typename T>
+struct Converter;
+
+template <>
+struct Converter<float> {
+ static_assert(sizeof(float) == sizeof(int32_t), "Important ULP matcher assumption violated");
+ Converter(float f) {
+ std::memcpy(&i, &f, sizeof(f));
+ }
+ int32_t i;
+};
+
+template <>
+struct Converter<double> {
+ static_assert(sizeof(double) == sizeof(int64_t), "Important ULP matcher assumption violated");
+ Converter(double d) {
+ std::memcpy(&i, &d, sizeof(d));
+ }
+ int64_t i;
+};
+
+template <typename T>
+auto convert(T t) -> Converter<T> {
+ return Converter<T>(t);
+}
+
+template <typename FP>
+bool almostEqualUlps(FP lhs, FP rhs, int maxUlpDiff) {
+ // Comparison with NaN should always be false.
+ // This way we can rule it out before getting into the ugly details
+ if (std::isnan(lhs) || std::isnan(rhs)) {
+ return false;
+ }
+
+ auto lc = convert(lhs);
+ auto rc = convert(rhs);
+
+ if ((lc.i < 0) != (rc.i < 0)) {
+ // Potentially we can have +0 and -0
+ return lhs == rhs;
+ }
+
+ auto ulpDiff = std::abs(lc.i - rc.i);
+ return ulpDiff <= maxUlpDiff;
+}
+
+}
+
+namespace Catch {
+namespace Matchers {
+namespace Floating {
+ WithinAbsMatcher::WithinAbsMatcher(double target, double margin)
+ :m_target{ target }, m_margin{ margin } {
+ if (m_margin < 0) {
+ throw std::domain_error("Allowed margin difference has to be >= 0");
+ }
+ }
+
+ // Performs equivalent check of std::fabs(lhs - rhs) <= margin
+ // But without the subtraction to allow for INFINITY in comparison
+ bool WithinAbsMatcher::match(double const& matchee) const {
+ return (matchee + m_margin >= m_target) && (m_target + m_margin >= m_margin);
+ }
+
+ std::string WithinAbsMatcher::describe() const {
+ return "is within " + ::Catch::Detail::stringify(m_margin) + " of " + ::Catch::Detail::stringify(m_target);
+ }
+
+ WithinUlpsMatcher::WithinUlpsMatcher(double target, int ulps, FloatingPointKind baseType)
+ :m_target{ target }, m_ulps{ ulps }, m_type{ baseType } {
+ if (m_ulps < 0) {
+ throw std::domain_error("Allowed ulp difference has to be >= 0");
+ }
+ }
+
+ bool WithinUlpsMatcher::match(double const& matchee) const {
+ switch (m_type) {
+ case FloatingPointKind::Float:
+ return almostEqualUlps<float>(static_cast<float>(matchee), static_cast<float>(m_target), m_ulps);
+ case FloatingPointKind::Double:
+ return almostEqualUlps<double>(matchee, m_target, m_ulps);
+ default:
+ throw std::domain_error("Unknown FloatingPointKind value");
+ }
+ }
+
+ std::string WithinUlpsMatcher::describe() const {
+ return "is within " + std::to_string(m_ulps) + " ULPs of " + ::Catch::Detail::stringify(m_target) + ((m_type == FloatingPointKind::Float)? "f" : "");
+ }
+
+}// namespace Floating
+
+Floating::WithinUlpsMatcher WithinULP(double target, int maxUlpDiff) {
+ return Floating::WithinUlpsMatcher(target, maxUlpDiff, Floating::FloatingPointKind::Double);
+}
+
+Floating::WithinUlpsMatcher WithinULP(float target, int maxUlpDiff) {
+ return Floating::WithinUlpsMatcher(target, maxUlpDiff, Floating::FloatingPointKind::Float);
+}
+
+Floating::WithinAbsMatcher WithinAbs(double target, double margin) {
+ return Floating::WithinAbsMatcher(target, margin);
+}
+
+} // namespace Matchers
+} // namespace Catch
+
+// end catch_matchers_floating.cpp
+// start catch_matchers_string.cpp
+
+#include <regex>
+
+namespace Catch {
+namespace Matchers {
+
+ namespace StdString {
+
+ CasedString::CasedString( std::string const& str, CaseSensitive::Choice caseSensitivity )
+ : m_caseSensitivity( caseSensitivity ),
+ m_str( adjustString( str ) )
+ {}
+ std::string CasedString::adjustString( std::string const& str ) const {
+ return m_caseSensitivity == CaseSensitive::No
+ ? toLower( str )
+ : str;
+ }
+ std::string CasedString::caseSensitivitySuffix() const {
+ return m_caseSensitivity == CaseSensitive::No
+ ? " (case insensitive)"
+ : std::string();
+ }
+
+ StringMatcherBase::StringMatcherBase( std::string const& operation, CasedString const& comparator )
+ : m_comparator( comparator ),
+ m_operation( operation ) {
+ }
+
+ std::string StringMatcherBase::describe() const {
+ std::string description;
+ description.reserve(5 + m_operation.size() + m_comparator.m_str.size() +
+ m_comparator.caseSensitivitySuffix().size());
+ description += m_operation;
+ description += ": \"";
+ description += m_comparator.m_str;
+ description += "\"";
+ description += m_comparator.caseSensitivitySuffix();
+ return description;
+ }
+
+ EqualsMatcher::EqualsMatcher( CasedString const& comparator ) : StringMatcherBase( "equals", comparator ) {}
+
+ bool EqualsMatcher::match( std::string const& source ) const {
+ return m_comparator.adjustString( source ) == m_comparator.m_str;
+ }
+
+ ContainsMatcher::ContainsMatcher( CasedString const& comparator ) : StringMatcherBase( "contains", comparator ) {}
+
+ bool ContainsMatcher::match( std::string const& source ) const {
+ return contains( m_comparator.adjustString( source ), m_comparator.m_str );
+ }
+
+ StartsWithMatcher::StartsWithMatcher( CasedString const& comparator ) : StringMatcherBase( "starts with", comparator ) {}
+
+ bool StartsWithMatcher::match( std::string const& source ) const {
+ return startsWith( m_comparator.adjustString( source ), m_comparator.m_str );
+ }
+
+ EndsWithMatcher::EndsWithMatcher( CasedString const& comparator ) : StringMatcherBase( "ends with", comparator ) {}
+
+ bool EndsWithMatcher::match( std::string const& source ) const {
+ return endsWith( m_comparator.adjustString( source ), m_comparator.m_str );
+ }
+
+ RegexMatcher::RegexMatcher(std::string regex, CaseSensitive::Choice caseSensitivity): m_regex(std::move(regex)), m_caseSensitivity(caseSensitivity) {}
+
+ bool RegexMatcher::match(std::string const& matchee) const {
+ auto flags = std::regex::ECMAScript; // ECMAScript is the default syntax option anyway
+ if (m_caseSensitivity == CaseSensitive::Choice::No) {
+ flags |= std::regex::icase;
+ }
+ auto reg = std::regex(m_regex, flags);
+ return std::regex_match(matchee, reg);
+ }
+
+ std::string RegexMatcher::describe() const {
+ return "matches " + ::Catch::Detail::stringify(m_regex) + ((m_caseSensitivity == CaseSensitive::Choice::Yes)? " case sensitively" : " case insensitively");
+ }
+
+ } // namespace StdString
+
+ StdString::EqualsMatcher Equals( std::string const& str, CaseSensitive::Choice caseSensitivity ) {
+ return StdString::EqualsMatcher( StdString::CasedString( str, caseSensitivity) );
+ }
+ StdString::ContainsMatcher Contains( std::string const& str, CaseSensitive::Choice caseSensitivity ) {
+ return StdString::ContainsMatcher( StdString::CasedString( str, caseSensitivity) );
+ }
+ StdString::EndsWithMatcher EndsWith( std::string const& str, CaseSensitive::Choice caseSensitivity ) {
+ return StdString::EndsWithMatcher( StdString::CasedString( str, caseSensitivity) );
+ }
+ StdString::StartsWithMatcher StartsWith( std::string const& str, CaseSensitive::Choice caseSensitivity ) {
+ return StdString::StartsWithMatcher( StdString::CasedString( str, caseSensitivity) );
+ }
+
+ StdString::RegexMatcher Matches(std::string const& regex, CaseSensitive::Choice caseSensitivity) {
+ return StdString::RegexMatcher(regex, caseSensitivity);
+ }
+
+} // namespace Matchers
+} // namespace Catch
+// end catch_matchers_string.cpp
+// start catch_message.cpp
+
+namespace Catch {
+
+ MessageInfo::MessageInfo( std::string const& _macroName,
+ SourceLineInfo const& _lineInfo,
+ ResultWas::OfType _type )
+ : macroName( _macroName ),
+ lineInfo( _lineInfo ),
+ type( _type ),
+ sequence( ++globalCount )
+ {}
+
+ bool MessageInfo::operator==( MessageInfo const& other ) const {
+ return sequence == other.sequence;
+ }
+
+ bool MessageInfo::operator<( MessageInfo const& other ) const {
+ return sequence < other.sequence;
+ }
+
+ // This may need protecting if threading support is added
+ unsigned int MessageInfo::globalCount = 0;
+
+ ////////////////////////////////////////////////////////////////////////////
+
+ Catch::MessageBuilder::MessageBuilder( std::string const& macroName,
+ SourceLineInfo const& lineInfo,
+ ResultWas::OfType type )
+ :m_info(macroName, lineInfo, type) {}
+
+ ////////////////////////////////////////////////////////////////////////////
+
+ ScopedMessage::ScopedMessage( MessageBuilder const& builder )
+ : m_info( builder.m_info )
+ {
+ m_info.message = builder.m_stream.str();
+ getResultCapture().pushScopedMessage( m_info );
+ }
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4996) // std::uncaught_exception is deprecated in C++17
+#endif
+ ScopedMessage::~ScopedMessage() {
+ if ( !std::uncaught_exception() ){
+ getResultCapture().popScopedMessage(m_info);
+ }
+ }
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif
+
+} // end namespace Catch
+// end catch_message.cpp
+// start catch_random_number_generator.cpp
+
+// start catch_random_number_generator.h
+
+#include <algorithm>
+
+namespace Catch {
+
+ struct IConfig;
+
+ void seedRng( IConfig const& config );
+
+ 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 );
+ }
+ };
+
+}
+
+// end catch_random_number_generator.h
+#include <cstdlib>
+
+namespace Catch {
+
+ void seedRng( IConfig const& config ) {
+ if( config.rngSeed() != 0 )
+ std::srand( config.rngSeed() );
+ }
+ unsigned int 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)();
+ }
+
+}
+// end catch_random_number_generator.cpp
+// start catch_registry_hub.cpp
+
+// start catch_test_case_registry_impl.h
+
+#include <vector>
+#include <set>
+#include <algorithm>
+#include <ios>
+
+namespace Catch {
+
+ class TestCase;
+ struct IConfig;
+
+ std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases );
+ bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config );
+
+ void enforceNoDuplicateTestCases( std::vector<TestCase> const& functions );
+
+ std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config );
+ std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config );
+
+ class TestRegistry : public ITestCaseRegistry {
+ public:
+ virtual ~TestRegistry() = default;
+
+ virtual void registerTest( TestCase const& testCase );
+
+ std::vector<TestCase> const& getAllTests() const override;
+ std::vector<TestCase> const& getAllTestsSorted( IConfig const& config ) const override;
+
+ private:
+ std::vector<TestCase> m_functions;
+ mutable RunTests::InWhatOrder m_currentSortOrder = RunTests::InDeclarationOrder;
+ mutable std::vector<TestCase> m_sortedFunctions;
+ std::size_t m_unnamedCount = 0;
+ std::ios_base::Init m_ostreamInit; // Forces cout/ cerr to be initialised
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+
+ class TestInvokerAsFunction : public ITestInvoker {
+ void(*m_testAsFunction)();
+ public:
+ TestInvokerAsFunction( void(*testAsFunction)() ) noexcept;
+
+ void invoke() const override;
+ };
+
+ std::string extractClassName( std::string const& classOrQualifiedMethodName );
+
+ ///////////////////////////////////////////////////////////////////////////
+
+} // end namespace Catch
+
+// end catch_test_case_registry_impl.h
+// start catch_reporter_registry.h
+
+#include <map>
+
+namespace Catch {
+
+ class ReporterRegistry : public IReporterRegistry {
+
+ public:
+
+ ~ReporterRegistry() override;
+
+ IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const override;
+
+ void registerReporter( std::string const& name, IReporterFactoryPtr const& factory );
+ void registerListener( IReporterFactoryPtr const& factory );
+
+ FactoryMap const& getFactories() const override;
+ Listeners const& getListeners() const override;
+
+ private:
+ FactoryMap m_factories;
+ Listeners m_listeners;
+ };
+}
+
+// end catch_reporter_registry.h
+// start catch_tag_alias_registry.h
+
+// start catch_tag_alias.h
+
+#include <string>
+
+namespace Catch {
+
+ struct TagAlias {
+ TagAlias(std::string const& _tag, SourceLineInfo _lineInfo);
+
+ std::string tag;
+ SourceLineInfo lineInfo;
+ };
+
+} // end namespace Catch
+
+// end catch_tag_alias.h
+#include <map>
+
+namespace Catch {
+
+ class TagAliasRegistry : public ITagAliasRegistry {
+ public:
+ ~TagAliasRegistry() override;
+ TagAlias const* find( std::string const& alias ) const override;
+ std::string expandAliases( std::string const& unexpandedTestSpec ) const override;
+ void add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo );
+
+ private:
+ std::map<std::string, TagAlias> m_registry;
+ };
+
+} // end namespace Catch
+
+// end catch_tag_alias_registry.h
+// start catch_startup_exception_registry.h
+
+#include <vector>
+#include <exception>
+
+namespace Catch {
+
+ class StartupExceptionRegistry {
+ public:
+ void add(std::exception_ptr const& exception) noexcept;
+ std::vector<std::exception_ptr> const& getExceptions() const noexcept;
+ private:
+ std::vector<std::exception_ptr> m_exceptions;
+ };
+
+} // end namespace Catch
+
+// end catch_startup_exception_registry.h
+namespace Catch {
+
+ namespace {
+
+ class RegistryHub : public IRegistryHub, public IMutableRegistryHub,
+ private NonCopyable {
+
+ public: // IRegistryHub
+ RegistryHub() = default;
+ IReporterRegistry const& getReporterRegistry() const override {
+ return m_reporterRegistry;
+ }
+ ITestCaseRegistry const& getTestCaseRegistry() const override {
+ return m_testCaseRegistry;
+ }
+ IExceptionTranslatorRegistry& getExceptionTranslatorRegistry() override {
+ return m_exceptionTranslatorRegistry;
+ }
+ ITagAliasRegistry const& getTagAliasRegistry() const override {
+ return m_tagAliasRegistry;
+ }
+ StartupExceptionRegistry const& getStartupExceptionRegistry() const override {
+ return m_exceptionRegistry;
+ }
+
+ public: // IMutableRegistryHub
+ void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) override {
+ m_reporterRegistry.registerReporter( name, factory );
+ }
+ void registerListener( IReporterFactoryPtr const& factory ) override {
+ m_reporterRegistry.registerListener( factory );
+ }
+ void registerTest( TestCase const& testInfo ) override {
+ m_testCaseRegistry.registerTest( testInfo );
+ }
+ void registerTranslator( const IExceptionTranslator* translator ) override {
+ m_exceptionTranslatorRegistry.registerTranslator( translator );
+ }
+ void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) override {
+ m_tagAliasRegistry.add( alias, tag, lineInfo );
+ }
+ void registerStartupException() noexcept override {
+ m_exceptionRegistry.add(std::current_exception());
+ }
+
+ private:
+ TestRegistry m_testCaseRegistry;
+ ReporterRegistry m_reporterRegistry;
+ ExceptionTranslatorRegistry m_exceptionTranslatorRegistry;
+ TagAliasRegistry m_tagAliasRegistry;
+ StartupExceptionRegistry m_exceptionRegistry;
+ };
+
+ // Single, global, instance
+ RegistryHub*& getTheRegistryHub() {
+ static RegistryHub* theRegistryHub = nullptr;
+ if( !theRegistryHub )
+ theRegistryHub = new RegistryHub();
+ return theRegistryHub;
+ }
+ }
+
+ IRegistryHub& getRegistryHub() {
+ return *getTheRegistryHub();
+ }
+ IMutableRegistryHub& getMutableRegistryHub() {
+ return *getTheRegistryHub();
+ }
+ void cleanUp() {
+ delete getTheRegistryHub();
+ getTheRegistryHub() = nullptr;
+ cleanUpContext();
+ ReusableStringStream::cleanup();
+ }
+ std::string translateActiveException() {
+ return getRegistryHub().getExceptionTranslatorRegistry().translateActiveException();
+ }
+
+} // end namespace Catch
+// end catch_registry_hub.cpp
+// start catch_reporter_registry.cpp
+
+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;
+ }
+
+}
+// end catch_reporter_registry.cpp
+// start catch_result_type.cpp
+
+namespace Catch {
+
+ bool isOk( ResultWas::OfType resultType ) {
+ return ( resultType & ResultWas::FailureBit ) == 0;
+ }
+ bool isJustInfo( int flags ) {
+ return flags == ResultWas::Info;
+ }
+
+ ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs ) {
+ return static_cast<ResultDisposition::Flags>( static_cast<int>( lhs ) | static_cast<int>( rhs ) );
+ }
+
+ bool shouldContinueOnFailure( int flags ) { return ( flags & ResultDisposition::ContinueOnFailure ) != 0; }
+ bool shouldSuppressFailure( int flags ) { return ( flags & ResultDisposition::SuppressFail ) != 0; }
+
+} // end namespace Catch
+// end catch_result_type.cpp
+// start catch_run_context.cpp
+
+#include <cassert>
+#include <algorithm>
+#include <sstream>
+
+namespace Catch {
+
+ class RedirectedStream {
+ std::ostream& m_originalStream;
+ std::ostream& m_redirectionStream;
+ std::streambuf* m_prevBuf;
+
+ public:
+ RedirectedStream( std::ostream& originalStream, std::ostream& redirectionStream )
+ : m_originalStream( originalStream ),
+ m_redirectionStream( redirectionStream ),
+ m_prevBuf( m_originalStream.rdbuf() )
+ {
+ m_originalStream.rdbuf( m_redirectionStream.rdbuf() );
+ }
+ ~RedirectedStream() {
+ m_originalStream.rdbuf( m_prevBuf );
+ }
+ };
+
+ class RedirectedStdOut {
+ ReusableStringStream m_rss;
+ RedirectedStream m_cout;
+ public:
+ RedirectedStdOut() : m_cout( Catch::cout(), m_rss.get() ) {}
+ auto str() const -> std::string { return m_rss.str(); }
+ };
+
+ // StdErr has two constituent streams in C++, std::cerr and std::clog
+ // This means that we need to redirect 2 streams into 1 to keep proper
+ // order of writes
+ class RedirectedStdErr {
+ ReusableStringStream m_rss;
+ RedirectedStream m_cerr;
+ RedirectedStream m_clog;
+ public:
+ RedirectedStdErr()
+ : m_cerr( Catch::cerr(), m_rss.get() ),
+ m_clog( Catch::clog(), m_rss.get() )
+ {}
+ auto str() const -> std::string { return m_rss.str(); }
+ };
+
+ RunContext::RunContext(IConfigPtr const& _config, IStreamingReporterPtr&& reporter)
+ : m_runInfo(_config->name()),
+ m_context(getCurrentMutableContext()),
+ m_config(_config),
+ m_reporter(std::move(reporter)),
+ m_lastAssertionInfo{ "", SourceLineInfo("",0), "", ResultDisposition::Normal },
+ m_includeSuccessfulResults( m_config->includeSuccessfulResults() )
+ {
+ m_context.setRunner(this);
+ m_context.setConfig(m_config);
+ m_context.setResultCapture(this);
+ m_reporter->testRunStarting(m_runInfo);
+ }
+
+ RunContext::~RunContext() {
+ m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, aborting()));
+ }
+
+ void RunContext::testGroupStarting(std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount) {
+ m_reporter->testGroupStarting(GroupInfo(testSpec, groupIndex, groupsCount));
+ }
+
+ void RunContext::testGroupEnded(std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount) {
+ m_reporter->testGroupEnded(TestGroupStats(GroupInfo(testSpec, groupIndex, groupsCount), totals, aborting()));
+ }
+
+ Totals RunContext::runTest(TestCase const& testCase) {
+ Totals prevTotals = m_totals;
+
+ std::string redirectedCout;
+ std::string redirectedCerr;
+
+ TestCaseInfo testInfo = testCase.getTestCaseInfo();
+
+ m_reporter->testCaseStarting(testInfo);
+
+ m_activeTestCase = &testCase;
+
+ ITracker& rootTracker = m_trackerContext.startRun();
+ assert(rootTracker.isSectionTracker());
+ static_cast<SectionTracker&>(rootTracker).addInitialFilters(m_config->getSectionsToRun());
+ do {
+ m_trackerContext.startCycle();
+ m_testCaseTracker = &SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocation(testInfo.name, testInfo.lineInfo));
+ runCurrentTest(redirectedCout, redirectedCerr);
+ } while (!m_testCaseTracker->isSuccessfullyCompleted() && !aborting());
+
+ Totals deltaTotals = m_totals.delta(prevTotals);
+ if (testInfo.expectedToFail() && deltaTotals.testCases.passed > 0) {
+ deltaTotals.assertions.failed++;
+ deltaTotals.testCases.passed--;
+ deltaTotals.testCases.failed++;
+ }
+ m_totals.testCases += deltaTotals.testCases;
+ m_reporter->testCaseEnded(TestCaseStats(testInfo,
+ deltaTotals,
+ redirectedCout,
+ redirectedCerr,
+ aborting()));
+
+ m_activeTestCase = nullptr;
+ m_testCaseTracker = nullptr;
+
+ return deltaTotals;
+ }
+
+ IConfigPtr RunContext::config() const {
+ return m_config;
+ }
+
+ IStreamingReporter& RunContext::reporter() const {
+ return *m_reporter;
+ }
+
+ void RunContext::assertionEnded(AssertionResult const & result) {
+ if (result.getResultType() == ResultWas::Ok) {
+ m_totals.assertions.passed++;
+ m_lastAssertionPassed = true;
+ } else if (!result.isOk()) {
+ m_lastAssertionPassed = false;
+ if( m_activeTestCase->getTestCaseInfo().okToFail() )
+ m_totals.assertions.failedButOk++;
+ else
+ m_totals.assertions.failed++;
+ }
+ else {
+ m_lastAssertionPassed = true;
+ }
+
+ // We have no use for the return value (whether messages should be cleared), because messages were made scoped
+ // and should be let to clear themselves out.
+ static_cast<void>(m_reporter->assertionEnded(AssertionStats(result, m_messages, m_totals)));
+
+ // Reset working state
+ resetAssertionInfo();
+ m_lastResult = result;
+ }
+ void RunContext::resetAssertionInfo() {
+ m_lastAssertionInfo.macroName = StringRef();
+ m_lastAssertionInfo.capturedExpression = "{Unknown expression after the reported line}"_sr;
+ }
+
+ bool RunContext::sectionStarted(SectionInfo const & sectionInfo, Counts & assertions) {
+ ITracker& sectionTracker = SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocation(sectionInfo.name, sectionInfo.lineInfo));
+ if (!sectionTracker.isOpen())
+ return false;
+ m_activeSections.push_back(§ionTracker);
+
+ m_lastAssertionInfo.lineInfo = sectionInfo.lineInfo;
+
+ m_reporter->sectionStarting(sectionInfo);
+
+ assertions = m_totals.assertions;
+
+ return true;
+ }
+
+ bool RunContext::testForMissingAssertions(Counts& assertions) {
+ if (assertions.total() != 0)
+ return false;
+ if (!m_config->warnAboutMissingAssertions())
+ return false;
+ if (m_trackerContext.currentTracker().hasChildren())
+ return false;
+ m_totals.assertions.failed++;
+ assertions.failed++;
+ return true;
+ }
+
+ void RunContext::sectionEnded(SectionEndInfo const & endInfo) {
+ Counts assertions = m_totals.assertions - endInfo.prevAssertions;
+ bool missingAssertions = testForMissingAssertions(assertions);
+
+ if (!m_activeSections.empty()) {
+ m_activeSections.back()->close();
+ m_activeSections.pop_back();
+ }
+
+ m_reporter->sectionEnded(SectionStats(endInfo.sectionInfo, assertions, endInfo.durationInSeconds, missingAssertions));
+ m_messages.clear();
+ }
+
+ void RunContext::sectionEndedEarly(SectionEndInfo const & endInfo) {
+ if (m_unfinishedSections.empty())
+ m_activeSections.back()->fail();
+ else
+ m_activeSections.back()->close();
+ m_activeSections.pop_back();
+
+ m_unfinishedSections.push_back(endInfo);
+ }
+ void RunContext::benchmarkStarting( BenchmarkInfo const& info ) {
+ m_reporter->benchmarkStarting( info );
+ }
+ void RunContext::benchmarkEnded( BenchmarkStats const& stats ) {
+ m_reporter->benchmarkEnded( stats );
+ }
+
+ void RunContext::pushScopedMessage(MessageInfo const & message) {
+ m_messages.push_back(message);
+ }
+
+ void RunContext::popScopedMessage(MessageInfo const & message) {
+ m_messages.erase(std::remove(m_messages.begin(), m_messages.end(), message), m_messages.end());
+ }
+
+ std::string RunContext::getCurrentTestName() const {
+ return m_activeTestCase
+ ? m_activeTestCase->getTestCaseInfo().name
+ : std::string();
+ }
+
+ const AssertionResult * RunContext::getLastResult() const {
+ return &(*m_lastResult);
+ }
+
+ void RunContext::exceptionEarlyReported() {
+ m_shouldReportUnexpected = false;
+ }
+
+ void RunContext::handleFatalErrorCondition( StringRef message ) {
+ // First notify reporter that bad things happened
+ m_reporter->fatalErrorEncountered(message);
+
+ // Don't rebuild the result -- the stringification itself can cause more fatal errors
+ // Instead, fake a result data.
+ AssertionResultData tempResult( ResultWas::FatalErrorCondition, { false } );
+ tempResult.message = message;
+ AssertionResult result(m_lastAssertionInfo, tempResult);
+
+ assertionEnded(result);
+
+ handleUnfinishedSections();
+
+ // Recreate section for test case (as we will lose the one that was in scope)
+ auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo();
+ SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name, testCaseInfo.description);
+
+ Counts assertions;
+ assertions.failed = 1;
+ SectionStats testCaseSectionStats(testCaseSection, assertions, 0, false);
+ m_reporter->sectionEnded(testCaseSectionStats);
+
+ auto const& testInfo = m_activeTestCase->getTestCaseInfo();
+
+ Totals deltaTotals;
+ deltaTotals.testCases.failed = 1;
+ deltaTotals.assertions.failed = 1;
+ m_reporter->testCaseEnded(TestCaseStats(testInfo,
+ deltaTotals,
+ std::string(),
+ std::string(),
+ false));
+ m_totals.testCases.failed++;
+ testGroupEnded(std::string(), m_totals, 1, 1);
+ m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, false));
+ }
+
+ bool RunContext::lastAssertionPassed() {
+ return m_lastAssertionPassed;
+ }
+
+ void RunContext::assertionPassed() {
+ m_lastAssertionPassed = true;
+ ++m_totals.assertions.passed;
+ resetAssertionInfo();
+ }
+
+ bool RunContext::aborting() const {
+ return m_totals.assertions.failed == static_cast<std::size_t>(m_config->abortAfter());
+ }
+
+ void RunContext::runCurrentTest(std::string & redirectedCout, std::string & redirectedCerr) {
+ auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo();
+ SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name, testCaseInfo.description);
+ m_reporter->sectionStarting(testCaseSection);
+ Counts prevAssertions = m_totals.assertions;
+ double duration = 0;
+ m_shouldReportUnexpected = true;
+ m_lastAssertionInfo = { "TEST_CASE", testCaseInfo.lineInfo, "", ResultDisposition::Normal };
+
+ seedRng(*m_config);
+
+ Timer timer;
+ try {
+ if (m_reporter->getPreferences().shouldRedirectStdOut) {
+ RedirectedStdOut redirectedStdOut;
+ RedirectedStdErr redirectedStdErr;
+ timer.start();
+ invokeActiveTestCase();
+ redirectedCout += redirectedStdOut.str();
+ redirectedCerr += redirectedStdErr.str();
+
+ } else {
+ timer.start();
+ invokeActiveTestCase();
+ }
+ duration = timer.getElapsedSeconds();
+ } catch (TestFailureException&) {
+ // This just means the test was aborted due to failure
+ } catch (...) {
+ // Under CATCH_CONFIG_FAST_COMPILE, unexpected exceptions under REQUIRE assertions
+ // are reported without translation at the point of origin.
+ if( m_shouldReportUnexpected ) {
+ AssertionReaction dummyReaction;
+ handleUnexpectedInflightException( m_lastAssertionInfo, translateActiveException(), dummyReaction );
+ }
+ }
+ m_testCaseTracker->close();
+ handleUnfinishedSections();
+ m_messages.clear();
+
+ Counts assertions = m_totals.assertions - prevAssertions;
+ bool missingAssertions = testForMissingAssertions(assertions);
+ SectionStats testCaseSectionStats(testCaseSection, assertions, duration, missingAssertions);
+ m_reporter->sectionEnded(testCaseSectionStats);
+ }
+
+ void RunContext::invokeActiveTestCase() {
+ FatalConditionHandler fatalConditionHandler; // Handle signals
+ m_activeTestCase->invoke();
+ fatalConditionHandler.reset();
+ }
+
+ void RunContext::handleUnfinishedSections() {
+ // If sections ended prematurely due to an exception we stored their
+ // infos here so we can tear them down outside the unwind process.
+ for (auto it = m_unfinishedSections.rbegin(),
+ itEnd = m_unfinishedSections.rend();
+ it != itEnd;
+ ++it)
+ sectionEnded(*it);
+ m_unfinishedSections.clear();
+ }
+
+ void RunContext::handleExpr(
+ AssertionInfo const& info,
+ ITransientExpression const& expr,
+ AssertionReaction& reaction
+ ) {
+ m_reporter->assertionStarting( info );
+
+ bool negated = isFalseTest( info.resultDisposition );
+ bool result = expr.getResult() != negated;
+
+ if( result ) {
+ if (!m_includeSuccessfulResults) {
+ assertionPassed();
+ }
+ else {
+ reportExpr(info, ResultWas::Ok, &expr, negated);
+ }
+ }
+ else {
+ reportExpr(info, ResultWas::ExpressionFailed, &expr, negated );
+ populateReaction( reaction );
+ }
+ }
+ void RunContext::reportExpr(
+ AssertionInfo const &info,
+ ResultWas::OfType resultType,
+ ITransientExpression const *expr,
+ bool negated ) {
+
+ m_lastAssertionInfo = info;
+ AssertionResultData data( resultType, LazyExpression( negated ) );
+
+ AssertionResult assertionResult{ info, data };
+ assertionResult.m_resultData.lazyExpression.m_transientExpression = expr;
+
+ assertionEnded( assertionResult );
+ }
+
+ void RunContext::handleMessage(
+ AssertionInfo const& info,
+ ResultWas::OfType resultType,
+ StringRef const& message,
+ AssertionReaction& reaction
+ ) {
+ m_reporter->assertionStarting( info );
+
+ m_lastAssertionInfo = info;
+
+ AssertionResultData data( resultType, LazyExpression( false ) );
+ data.message = message;
+ AssertionResult assertionResult{ m_lastAssertionInfo, data };
+ assertionEnded( assertionResult );
+ if( !assertionResult.isOk() )
+ populateReaction( reaction );
+ }
+ void RunContext::handleUnexpectedExceptionNotThrown(
+ AssertionInfo const& info,
+ AssertionReaction& reaction
+ ) {
+ handleNonExpr(info, Catch::ResultWas::DidntThrowException, reaction);
+ }
+
+ void RunContext::handleUnexpectedInflightException(
+ AssertionInfo const& info,
+ std::string const& message,
+ AssertionReaction& reaction
+ ) {
+ m_lastAssertionInfo = info;
+
+ AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) );
+ data.message = message;
+ AssertionResult assertionResult{ info, data };
+ assertionEnded( assertionResult );
+ populateReaction( reaction );
+ }
+
+ void RunContext::populateReaction( AssertionReaction& reaction ) {
+ reaction.shouldDebugBreak = m_config->shouldDebugBreak();
+ reaction.shouldThrow = aborting() || (m_lastAssertionInfo.resultDisposition & ResultDisposition::Normal);
+ }
+
+ void RunContext::handleIncomplete(
+ AssertionInfo const& info
+ ) {
+ m_lastAssertionInfo = info;
+
+ AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) );
+ data.message = "Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE";
+ AssertionResult assertionResult{ info, data };
+ assertionEnded( assertionResult );
+ }
+ void RunContext::handleNonExpr(
+ AssertionInfo const &info,
+ ResultWas::OfType resultType,
+ AssertionReaction &reaction
+ ) {
+ m_lastAssertionInfo = info;
+
+ AssertionResultData data( resultType, LazyExpression( false ) );
+ AssertionResult assertionResult{ info, data };
+ assertionEnded( assertionResult );
+
+ if( !assertionResult.isOk() )
+ populateReaction( reaction );
+ }
+
+ IResultCapture& getResultCapture() {
+ if (auto* capture = getCurrentContext().getResultCapture())
+ return *capture;
+ else
+ CATCH_INTERNAL_ERROR("No result capture instance");
+ }
+}
+// end catch_run_context.cpp
+// start catch_section.cpp
+
+namespace Catch {
+
+ Section::Section( SectionInfo const& info )
+ : m_info( info ),
+ m_sectionIncluded( getResultCapture().sectionStarted( m_info, m_assertions ) )
+ {
+ m_timer.start();
+ }
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4996) // std::uncaught_exception is deprecated in C++17
+#endif
+ Section::~Section() {
+ if( m_sectionIncluded ) {
+ SectionEndInfo endInfo( m_info, m_assertions, m_timer.getElapsedSeconds() );
+ if( std::uncaught_exception() )
+ getResultCapture().sectionEndedEarly( endInfo );
+ else
+ getResultCapture().sectionEnded( endInfo );
+ }
+ }
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif
+
+ // This indicates whether the section should be executed or not
+ Section::operator bool() const {
+ return m_sectionIncluded;
+ }
+
+} // end namespace Catch
+// end catch_section.cpp
+// start catch_section_info.cpp
+
+namespace Catch {
+
+ SectionInfo::SectionInfo
+ ( SourceLineInfo const& _lineInfo,
+ std::string const& _name,
+ std::string const& _description )
+ : name( _name ),
+ description( _description ),
+ lineInfo( _lineInfo )
+ {}
+
+ SectionEndInfo::SectionEndInfo( SectionInfo const& _sectionInfo, Counts const& _prevAssertions, double _durationInSeconds )
+ : sectionInfo( _sectionInfo ), prevAssertions( _prevAssertions ), durationInSeconds( _durationInSeconds )
+ {}
+
+} // end namespace Catch
+// end catch_section_info.cpp
+// start catch_session.cpp
+
+// start catch_session.h
+
+#include <memory>
+
+namespace Catch {
+
+ class Session : NonCopyable {
+ public:
+
+ Session();
+ ~Session() override;
+
+ void showHelp() const;
+ void libIdentify();
+
+ int applyCommandLine( int argc, char* argv[] );
+
+ void useConfigData( ConfigData const& configData );
+
+ int run( int argc, char* argv[] );
+ #if defined(WIN32) && defined(UNICODE)
+ int run( int argc, wchar_t* const argv[] );
+ #endif
+ int run();
+
+ clara::Parser const& cli() const;
+ void cli( clara::Parser const& newParser );
+ ConfigData& configData();
+ Config& config();
+ private:
+ int runInternal();
+
+ clara::Parser m_cli;
+ ConfigData m_configData;
+ std::shared_ptr<Config> m_config;
+ bool m_startupExceptions = false;
+ };
+
+} // end namespace Catch
+
+// end catch_session.h
+// start catch_version.h
+
+#include <iosfwd>
+
+namespace Catch {
+
+ // Versioning information
+ struct Version {
+ Version( Version const& ) = delete;
+ Version& operator=( Version const& ) = delete;
+ Version( unsigned int _majorVersion,
+ unsigned int _minorVersion,
+ unsigned int _patchNumber,
+ char const * const _branchName,
+ unsigned int _buildNumber );
+
+ unsigned int const majorVersion;
+ unsigned int const minorVersion;
+ unsigned int const patchNumber;
+
+ // buildNumber is only used if branchName is not null
+ char const * const branchName;
+ unsigned int const buildNumber;
+
+ friend std::ostream& operator << ( std::ostream& os, Version const& version );
+ };
+
+ Version const& libraryVersion();
+}
+
+// end catch_version.h
+#include <cstdlib>
+#include <iomanip>
+
+namespace Catch {
+
+ namespace {
+ const int MaxExitCode = 255;
+
+ IStreamingReporterPtr createReporter(std::string const& reporterName, IConfigPtr const& config) {
+ auto reporter = Catch::getRegistryHub().getReporterRegistry().create(reporterName, config);
+ CATCH_ENFORCE(reporter, "No reporter registered with name: '" << reporterName << "'");
+
+ return reporter;
+ }
+
+#ifndef CATCH_CONFIG_DEFAULT_REPORTER
+#define CATCH_CONFIG_DEFAULT_REPORTER "console"
+#endif
+
+ IStreamingReporterPtr makeReporter(std::shared_ptr<Config> const& config) {
+ auto const& reporterNames = config->getReporterNames();
+ if (reporterNames.empty())
+ return createReporter(CATCH_CONFIG_DEFAULT_REPORTER, config);
+
+ IStreamingReporterPtr reporter;
+ for (auto const& name : reporterNames)
+ addReporter(reporter, createReporter(name, config));
+ return reporter;
+ }
+
+#undef CATCH_CONFIG_DEFAULT_REPORTER
+
+ void addListeners(IStreamingReporterPtr& reporters, IConfigPtr const& config) {
+ auto const& listeners = Catch::getRegistryHub().getReporterRegistry().getListeners();
+ for (auto const& listener : listeners)
+ addReporter(reporters, listener->create(Catch::ReporterConfig(config)));
+ }
+
+ Catch::Totals runTests(std::shared_ptr<Config> const& config) {
+ IStreamingReporterPtr reporter = makeReporter(config);
+ addListeners(reporter, config);
+
+ RunContext context(config, std::move(reporter));
+
+ Totals totals;
+
+ context.testGroupStarting(config->name(), 1, 1);
+
+ TestSpec testSpec = config->testSpec();
+ if (!testSpec.hasFilters())
+ testSpec = TestSpecParser(ITagAliasRegistry::get()).parse("~[.]").testSpec(); // All not hidden tests
+
+ auto const& allTestCases = getAllTestCasesSorted(*config);
+ for (auto const& testCase : allTestCases) {
+ if (!context.aborting() && matchTest(testCase, testSpec, *config))
+ totals += context.runTest(testCase);
+ else
+ context.reporter().skipTest(testCase);
+ }
+
+ context.testGroupEnded(config->name(), totals, 1, 1);
+ return totals;
+ }
+
+ void applyFilenamesAsTags(Catch::IConfig const& config) {
+ auto& tests = const_cast<std::vector<TestCase>&>(getAllTestCasesSorted(config));
+ for (auto& testCase : tests) {
+ auto tags = testCase.tags;
+
+ std::string filename = testCase.lineInfo.file;
+ auto lastSlash = filename.find_last_of("\\/");
+ if (lastSlash != std::string::npos) {
+ filename.erase(0, lastSlash);
+ filename[0] = '#';
+ }
+
+ auto lastDot = filename.find_last_of('.');
+ if (lastDot != std::string::npos) {
+ filename.erase(lastDot);
+ }
+
+ tags.push_back(std::move(filename));
+ setTags(testCase, tags);
+ }
+ }
+
+ } // anon namespace
+
+ Session::Session() {
+ static bool alreadyInstantiated = false;
+ if( alreadyInstantiated ) {
+ try { CATCH_INTERNAL_ERROR( "Only one instance of Catch::Session can ever be used" ); }
+ catch(...) { getMutableRegistryHub().registerStartupException(); }
+ }
+
+ const auto& exceptions = getRegistryHub().getStartupExceptionRegistry().getExceptions();
+ if ( !exceptions.empty() ) {
+ m_startupExceptions = true;
+ Colour colourGuard( Colour::Red );
+ Catch::cerr() << "Errors occured during startup!" << '\n';
+ // iterate over all exceptions and notify user
+ for ( const auto& ex_ptr : exceptions ) {
+ try {
+ std::rethrow_exception(ex_ptr);
+ } catch ( std::exception const& ex ) {
+ Catch::cerr() << Column( ex.what() ).indent(2) << '\n';
+ }
+ }
+ }
+
+ alreadyInstantiated = true;
+ m_cli = makeCommandLineParser( m_configData );
+ }
+ Session::~Session() {
+ Catch::cleanUp();
+ }
+
+ void Session::showHelp() const {
+ Catch::cout()
+ << "\nCatch v" << libraryVersion() << "\n"
+ << m_cli << std::endl
+ << "For more detailed usage please see the project docs\n" << std::endl;
+ }
+ void Session::libIdentify() {
+ Catch::cout()
+ << std::left << std::setw(16) << "description: " << "A Catch test executable\n"
+ << std::left << std::setw(16) << "category: " << "testframework\n"
+ << std::left << std::setw(16) << "framework: " << "Catch Test\n"
+ << std::left << std::setw(16) << "version: " << libraryVersion() << std::endl;
+ }
+
+ int Session::applyCommandLine( int argc, char* argv[] ) {
+ if( m_startupExceptions )
+ return 1;
+
+ auto result = m_cli.parse( clara::Args( argc, argv ) );
+ if( !result ) {
+ Catch::cerr()
+ << Colour( Colour::Red )
+ << "\nError(s) in input:\n"
+ << Column( result.errorMessage() ).indent( 2 )
+ << "\n\n";
+ Catch::cerr() << "Run with -? for usage\n" << std::endl;
+ return MaxExitCode;
+ }
+
+ if( m_configData.showHelp )
+ showHelp();
+ if( m_configData.libIdentify )
+ libIdentify();
+ m_config.reset();
+ return 0;
+ }
+
+ void Session::useConfigData( ConfigData const& configData ) {
+ m_configData = configData;
+ m_config.reset();
+ }
+
+ int Session::run( int argc, char* argv[] ) {
+ if( m_startupExceptions )
+ return 1;
+ int returnCode = applyCommandLine( argc, argv );
+ if( returnCode == 0 )
+ returnCode = run();
+ return returnCode;
+ }
+
+#if defined(WIN32) && defined(UNICODE)
+ int Session::run( int argc, wchar_t* const argv[] ) {
+
+ char **utf8Argv = new char *[ argc ];
+
+ for ( int i = 0; i < argc; ++i ) {
+ int bufSize = WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, NULL, 0, NULL, NULL );
+
+ utf8Argv[ i ] = new char[ bufSize ];
+
+ WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, utf8Argv[i], bufSize, NULL, NULL );
+ }
+
+ int returnCode = run( argc, utf8Argv );
+
+ for ( int i = 0; i < argc; ++i )
+ delete [] utf8Argv[ i ];
+
+ delete [] utf8Argv;
+
+ return returnCode;
+ }
+#endif
+ int Session::run() {
+ if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeStart ) != 0 ) {
+ Catch::cout() << "...waiting for enter/ return before starting" << std::endl;
+ static_cast<void>(std::getchar());
+ }
+ int exitCode = runInternal();
+ if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeExit ) != 0 ) {
+ Catch::cout() << "...waiting for enter/ return before exiting, with code: " << exitCode << std::endl;
+ static_cast<void>(std::getchar());
+ }
+ return exitCode;
+ }
+
+ clara::Parser const& Session::cli() const {
+ return m_cli;
+ }
+ void Session::cli( clara::Parser const& newParser ) {
+ m_cli = newParser;
+ }
+ ConfigData& Session::configData() {
+ return m_configData;
+ }
+ Config& Session::config() {
+ if( !m_config )
+ m_config = std::make_shared<Config>( m_configData );
+ return *m_config;
+ }
+
+ int Session::runInternal() {
+ if( m_startupExceptions )
+ return 1;
+
+ if( m_configData.showHelp || m_configData.libIdentify )
+ return 0;
+
+ try
+ {
+ config(); // Force config to be constructed
+
+ seedRng( *m_config );
+
+ if( m_configData.filenamesAsTags )
+ applyFilenamesAsTags( *m_config );
+
+ // Handle list request
+ if( Option<std::size_t> listed = list( config() ) )
+ return static_cast<int>( *listed );
+
+ // Note that on unices only the lower 8 bits are usually used, clamping
+ // the return value to 255 prevents false negative when some multiple
+ // of 256 tests has failed
+ return (std::min)( MaxExitCode, static_cast<int>( runTests( m_config ).assertions.failed ) );
+ }
+ catch( std::exception& ex ) {
+ Catch::cerr() << ex.what() << std::endl;
+ return MaxExitCode;
+ }
+ }
+
+} // end namespace Catch
+// end catch_session.cpp
+// start catch_startup_exception_registry.cpp
+
+namespace Catch {
+ void StartupExceptionRegistry::add( std::exception_ptr const& exception ) noexcept {
+ try {
+ m_exceptions.push_back(exception);
+ }
+ catch(...) {
+ // If we run out of memory during start-up there's really not a lot more we can do about it
+ std::terminate();
+ }
+ }
+
+ std::vector<std::exception_ptr> const& StartupExceptionRegistry::getExceptions() const noexcept {
+ return m_exceptions;
+ }
+
+} // end namespace Catch
+// end catch_startup_exception_registry.cpp
+// start catch_stream.cpp
+
+#include <cstdio>
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <vector>
+#include <memory>
+
+#if defined(__clang__)
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wexit-time-destructors"
+#endif
+
+namespace Catch {
+
+ Catch::IStream::~IStream() = default;
+
+ namespace detail { namespace {
+ template<typename WriterF, std::size_t bufferSize=256>
+ class StreamBufImpl : public std::streambuf {
+ char data[bufferSize];
+ WriterF m_writer;
+
+ public:
+ StreamBufImpl() {
+ setp( data, data + sizeof(data) );
+ }
+
+ ~StreamBufImpl() noexcept {
+ StreamBufImpl::sync();
+ }
+
+ private:
+ int overflow( int c ) override {
+ sync();
+
+ if( c != EOF ) {
+ if( pbase() == epptr() )
+ m_writer( std::string( 1, static_cast<char>( c ) ) );
+ else
+ sputc( static_cast<char>( c ) );
+ }
+ return 0;
+ }
+
+ int sync() override {
+ if( pbase() != pptr() ) {
+ m_writer( std::string( pbase(), static_cast<std::string::size_type>( pptr() - pbase() ) ) );
+ setp( pbase(), epptr() );
+ }
+ return 0;
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+
+ struct OutputDebugWriter {
+
+ void operator()( std::string const&str ) {
+ writeToDebugConsole( str );
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+
+ class FileStream : public IStream {
+ mutable std::ofstream m_ofs;
+ public:
+ FileStream( StringRef filename ) {
+ m_ofs.open( filename.c_str() );
+ CATCH_ENFORCE( !m_ofs.fail(), "Unable to open file: '" << filename << "'" );
+ }
+ ~FileStream() override = default;
+ public: // IStream
+ std::ostream& stream() const override {
+ return m_ofs;
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+
+ class CoutStream : public IStream {
+ mutable std::ostream m_os;
+ public:
+ // Store the streambuf from cout up-front because
+ // cout may get redirected when running tests
+ CoutStream() : m_os( Catch::cout().rdbuf() ) {}
+ ~CoutStream() override = default;
+
+ public: // IStream
+ std::ostream& stream() const override { return m_os; }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+
+ class DebugOutStream : public IStream {
+ std::unique_ptr<StreamBufImpl<OutputDebugWriter>> m_streamBuf;
+ mutable std::ostream m_os;
+ public:
+ DebugOutStream()
+ : m_streamBuf( new StreamBufImpl<OutputDebugWriter>() ),
+ m_os( m_streamBuf.get() )
+ {}
+
+ ~DebugOutStream() override = default;
+
+ public: // IStream
+ std::ostream& stream() const override { return m_os; }
+ };
+
+ }} // namespace anon::detail
+
+ ///////////////////////////////////////////////////////////////////////////
+
+ auto makeStream( StringRef const &filename ) -> IStream const* {
+ if( filename.empty() )
+ return new detail::CoutStream();
+ else if( filename[0] == '%' ) {
+ if( filename == "%debug" )
+ return new detail::DebugOutStream();
+ else
+ CATCH_ERROR( "Unrecognised stream: '" << filename << "'" );
+ }
+ else
+ return new detail::FileStream( filename );
+ }
+
+ // This class encapsulates the idea of a pool of ostringstreams that can be reused.
+ struct StringStreams {
+ std::vector<std::unique_ptr<std::ostringstream>> m_streams;
+ std::vector<std::size_t> m_unused;
+ std::ostringstream m_referenceStream; // Used for copy state/ flags from
+ static StringStreams* s_instance;
+
+ auto add() -> std::size_t {
+ if( m_unused.empty() ) {
+ m_streams.push_back( std::unique_ptr<std::ostringstream>( new std::ostringstream ) );
+ return m_streams.size()-1;
+ }
+ else {
+ auto index = m_unused.back();
+ m_unused.pop_back();
+ return index;
+ }
+ }
+
+ void release( std::size_t index ) {
+ m_streams[index]->copyfmt( m_referenceStream ); // Restore initial flags and other state
+ m_unused.push_back(index);
+ }
+
+ // !TBD: put in TLS
+ static auto instance() -> StringStreams& {
+ if( !s_instance )
+ s_instance = new StringStreams();
+ return *s_instance;
+ }
+ static void cleanup() {
+ delete s_instance;
+ s_instance = nullptr;
+ }
+ };
+
+ StringStreams* StringStreams::s_instance = nullptr;
+
+ void ReusableStringStream::cleanup() {
+ StringStreams::cleanup();
+ }
+
+ ReusableStringStream::ReusableStringStream()
+ : m_index( StringStreams::instance().add() ),
+ m_oss( StringStreams::instance().m_streams[m_index].get() )
+ {}
+
+ ReusableStringStream::~ReusableStringStream() {
+ static_cast<std::ostringstream*>( m_oss )->str("");
+ m_oss->clear();
+ StringStreams::instance().release( m_index );
+ }
+
+ auto ReusableStringStream::str() const -> std::string {
+ return static_cast<std::ostringstream*>( m_oss )->str();
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+
+#ifndef CATCH_CONFIG_NOSTDOUT // If you #define this you must implement these functions
+ std::ostream& cout() { return std::cout; }
+ std::ostream& cerr() { return std::cerr; }
+ std::ostream& clog() { return std::clog; }
+#endif
+}
+
+#if defined(__clang__)
+# pragma clang diagnostic pop
+#endif
+// end catch_stream.cpp
+// start catch_string_manip.cpp
+
+#include <algorithm>
+#include <ostream>
+#include <cstring>
+#include <cctype>
+
+namespace Catch {
+
+ bool startsWith( std::string const& s, std::string const& prefix ) {
+ return s.size() >= prefix.size() && std::equal(prefix.begin(), prefix.end(), s.begin());
+ }
+ bool startsWith( std::string const& s, char prefix ) {
+ return !s.empty() && s[0] == prefix;
+ }
+ bool endsWith( std::string const& s, std::string const& suffix ) {
+ return s.size() >= suffix.size() && std::equal(suffix.rbegin(), suffix.rend(), s.rbegin());
+ }
+ bool endsWith( std::string const& s, char suffix ) {
+ return !s.empty() && s[s.size()-1] == suffix;
+ }
+ bool contains( std::string const& s, std::string const& infix ) {
+ return s.find( infix ) != std::string::npos;
+ }
+ char toLowerCh(char c) {
+ return static_cast<char>( std::tolower( c ) );
+ }
+ void toLowerInPlace( std::string& s ) {
+ std::transform( s.begin(), s.end(), s.begin(), toLowerCh );
+ }
+ std::string toLower( std::string const& s ) {
+ std::string lc = s;
+ toLowerInPlace( lc );
+ return lc;
+ }
+ std::string trim( std::string const& str ) {
+ static char const* whitespaceChars = "\n\r\t ";
+ std::string::size_type start = str.find_first_not_of( whitespaceChars );
+ std::string::size_type end = str.find_last_not_of( whitespaceChars );
+
+ return start != std::string::npos ? str.substr( start, 1+end-start ) : std::string();
+ }
+
+ bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ) {
+ bool replaced = false;
+ std::size_t i = str.find( replaceThis );
+ while( i != std::string::npos ) {
+ replaced = true;
+ str = str.substr( 0, i ) + withThis + str.substr( i+replaceThis.size() );
+ if( i < str.size()-withThis.size() )
+ i = str.find( replaceThis, i+withThis.size() );
+ else
+ i = std::string::npos;
+ }
+ return replaced;
+ }
+
+ pluralise::pluralise( std::size_t count, std::string const& label )
+ : m_count( count ),
+ m_label( label )
+ {}
+
+ std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ) {
+ os << pluraliser.m_count << ' ' << pluraliser.m_label;
+ if( pluraliser.m_count != 1 )
+ os << 's';
+ return os;
+ }
+
+}
+// end catch_string_manip.cpp
+// start catch_stringref.cpp
+
+#if defined(__clang__)
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wexit-time-destructors"
+#endif
+
+#include <ostream>
+#include <cstring>
+
+namespace Catch {
+ StringRef::StringRef( char const* rawChars ) noexcept
+ : StringRef( rawChars, static_cast<StringRef::size_type>(std::strlen(rawChars) ) )
+ {}
+
+ StringRef::operator std::string() const {
+ return std::string( m_start, m_size );
+ }
+
+ void StringRef::swap( StringRef& other ) noexcept {
+ std::swap( m_start, other.m_start );
+ std::swap( m_size, other.m_size );
+ std::swap( m_data, other.m_data );
+ }
+
+ auto StringRef::c_str() const -> char const* {
+ if( isSubstring() )
+ const_cast<StringRef*>( this )->takeOwnership();
+ return m_start;
+ }
+ auto StringRef::data() const noexcept -> char const* {
+ return m_start;
+ }
+
+ auto StringRef::isOwned() const noexcept -> bool {
+ return m_data != nullptr;
+ }
+ auto StringRef::isSubstring() const noexcept -> bool {
+ return m_start[m_size] != '\0';
+ }
+
+ void StringRef::takeOwnership() {
+ if( !isOwned() ) {
+ m_data = new char[m_size+1];
+ memcpy( m_data, m_start, m_size );
+ m_data[m_size] = '\0';
+ m_start = m_data;
+ }
+ }
+ auto StringRef::substr( size_type start, size_type size ) const noexcept -> StringRef {
+ if( start < m_size )
+ return StringRef( m_start+start, size );
+ else
+ return StringRef();
+ }
+ auto StringRef::operator == ( StringRef const& other ) const noexcept -> bool {
+ return
+ size() == other.size() &&
+ (std::strncmp( m_start, other.m_start, size() ) == 0);
+ }
+ auto StringRef::operator != ( StringRef const& other ) const noexcept -> bool {
+ return !operator==( other );
+ }
+
+ auto StringRef::operator[](size_type index) const noexcept -> char {
+ return m_start[index];
+ }
+
+ auto StringRef::numberOfCharacters() const noexcept -> size_type {
+ size_type noChars = m_size;
+ // Make adjustments for uft encodings
+ for( size_type i=0; i < m_size; ++i ) {
+ char c = m_start[i];
+ if( ( c & 0b11000000 ) == 0b11000000 ) {
+ if( ( c & 0b11100000 ) == 0b11000000 )
+ noChars--;
+ else if( ( c & 0b11110000 ) == 0b11100000 )
+ noChars-=2;
+ else if( ( c & 0b11111000 ) == 0b11110000 )
+ noChars-=3;
+ }
+ }
+ return noChars;
+ }
+
+ auto operator + ( StringRef const& lhs, StringRef const& rhs ) -> std::string {
+ std::string str;
+ str.reserve( lhs.size() + rhs.size() );
+ str += lhs;
+ str += rhs;
+ return str;
+ }
+ auto operator + ( StringRef const& lhs, const char* rhs ) -> std::string {
+ return std::string( lhs ) + std::string( rhs );
+ }
+ auto operator + ( char const* lhs, StringRef const& rhs ) -> std::string {
+ return std::string( lhs ) + std::string( rhs );
+ }
+
+ auto operator << ( std::ostream& os, StringRef const& str ) -> std::ostream& {
+ return os << str.c_str();
+ }
+
+} // namespace Catch
+
+#if defined(__clang__)
+# pragma clang diagnostic pop
+#endif
+// end catch_stringref.cpp
+// start catch_tag_alias.cpp
+
+namespace Catch {
+ TagAlias::TagAlias(std::string const & _tag, SourceLineInfo _lineInfo): tag(_tag), lineInfo(_lineInfo) {}
+}
+// end catch_tag_alias.cpp
+// start catch_tag_alias_autoregistrar.cpp
+
+namespace Catch {
+
+ RegistrarForTagAliases::RegistrarForTagAliases(char const* alias, char const* tag, SourceLineInfo const& lineInfo) {
+ try {
+ getMutableRegistryHub().registerTagAlias(alias, tag, lineInfo);
+ } catch (...) {
+ // Do not throw when constructing global objects, instead register the exception to be processed later
+ getMutableRegistryHub().registerStartupException();
+ }
+ }
+
+}
+// end catch_tag_alias_autoregistrar.cpp
+// start catch_tag_alias_registry.cpp
+
+#include <sstream>
+
+namespace Catch {
+
+ TagAliasRegistry::~TagAliasRegistry() {}
+
+ TagAlias const* TagAliasRegistry::find( std::string const& alias ) const {
+ auto it = m_registry.find( alias );
+ if( it != m_registry.end() )
+ return &(it->second);
+ else
+ return nullptr;
+ }
+
+ std::string TagAliasRegistry::expandAliases( std::string const& unexpandedTestSpec ) const {
+ std::string expandedTestSpec = unexpandedTestSpec;
+ for( auto const& registryKvp : m_registry ) {
+ std::size_t pos = expandedTestSpec.find( registryKvp.first );
+ if( pos != std::string::npos ) {
+ expandedTestSpec = expandedTestSpec.substr( 0, pos ) +
+ registryKvp.second.tag +
+ expandedTestSpec.substr( pos + registryKvp.first.size() );
+ }
+ }
+ return expandedTestSpec;
+ }
+
+ void TagAliasRegistry::add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) {
+ CATCH_ENFORCE( startsWith(alias, "[@") && endsWith(alias, ']'),
+ "error: tag alias, '" << alias << "' is not of the form [@alias name].\n" << lineInfo );
+
+ CATCH_ENFORCE( m_registry.insert(std::make_pair(alias, TagAlias(tag, lineInfo))).second,
+ "error: tag alias, '" << alias << "' already registered.\n"
+ << "\tFirst seen at: " << find(alias)->lineInfo << "\n"
+ << "\tRedefined at: " << lineInfo );
+ }
+
+ ITagAliasRegistry::~ITagAliasRegistry() {}
+
+ ITagAliasRegistry const& ITagAliasRegistry::get() {
+ return getRegistryHub().getTagAliasRegistry();
+ }
+
+} // end namespace Catch
+// end catch_tag_alias_registry.cpp
+// start catch_test_case_info.cpp
+
+#include <cctype>
+#include <exception>
+#include <algorithm>
+#include <sstream>
+
+namespace Catch {
+
+ TestCaseInfo::SpecialProperties parseSpecialTag( std::string const& tag ) {
+ if( startsWith( tag, '.' ) ||
+ tag == "!hide" )
+ return TestCaseInfo::IsHidden;
+ else if( tag == "!throws" )
+ return TestCaseInfo::Throws;
+ else if( tag == "!shouldfail" )
+ return TestCaseInfo::ShouldFail;
+ else if( tag == "!mayfail" )
+ return TestCaseInfo::MayFail;
+ else if( tag == "!nonportable" )
+ return TestCaseInfo::NonPortable;
+ else if( tag == "!benchmark" )
+ return static_cast<TestCaseInfo::SpecialProperties>( TestCaseInfo::Benchmark | TestCaseInfo::IsHidden );
+ else
+ return TestCaseInfo::None;
+ }
+ bool isReservedTag( std::string const& tag ) {
+ return parseSpecialTag( tag ) == TestCaseInfo::None && tag.size() > 0 && !std::isalnum( tag[0] );
+ }
+ void enforceNotReservedTag( std::string const& tag, SourceLineInfo const& _lineInfo ) {
+ CATCH_ENFORCE( !isReservedTag(tag),
+ "Tag name: [" << tag << "] is not allowed.\n"
+ << "Tag names starting with non alpha-numeric characters are reserved\n"
+ << _lineInfo );
+ }
+
+ TestCase makeTestCase( ITestInvoker* _testCase,
+ std::string const& _className,
+ std::string const& _name,
+ std::string const& _descOrTags,
+ SourceLineInfo const& _lineInfo )
+ {
+ bool isHidden = false;
+
+ // Parse out tags
+ std::vector<std::string> tags;
+ std::string desc, tag;
+ bool inTag = false;
+ for (char c : _descOrTags) {
+ if( !inTag ) {
+ if( c == '[' )
+ inTag = true;
+ else
+ desc += c;
+ }
+ else {
+ if( c == ']' ) {
+ TestCaseInfo::SpecialProperties prop = parseSpecialTag( tag );
+ if( ( prop & TestCaseInfo::IsHidden ) != 0 )
+ isHidden = true;
+ else if( prop == TestCaseInfo::None )
+ enforceNotReservedTag( tag, _lineInfo );
+
+ tags.push_back( tag );
+ tag.clear();
+ inTag = false;
+ }
+ else
+ tag += c;
+ }
+ }
+ if( isHidden ) {
+ tags.push_back( "." );
+ }
+
+ TestCaseInfo info( _name, _className, desc, tags, _lineInfo );
+ return TestCase( _testCase, info );
+ }
+
+ void setTags( TestCaseInfo& testCaseInfo, std::vector<std::string> tags ) {
+ std::sort(begin(tags), end(tags));
+ tags.erase(std::unique(begin(tags), end(tags)), end(tags));
+ testCaseInfo.lcaseTags.clear();
+
+ for( auto const& tag : tags ) {
+ std::string lcaseTag = toLower( tag );
+ testCaseInfo.properties = static_cast<TestCaseInfo::SpecialProperties>( testCaseInfo.properties | parseSpecialTag( lcaseTag ) );
+ testCaseInfo.lcaseTags.push_back( lcaseTag );
+ }
+ testCaseInfo.tags = std::move(tags);
+ }
+
+ TestCaseInfo::TestCaseInfo( std::string const& _name,
+ std::string const& _className,
+ std::string const& _description,
+ std::vector<std::string> const& _tags,
+ SourceLineInfo const& _lineInfo )
+ : name( _name ),
+ className( _className ),
+ description( _description ),
+ lineInfo( _lineInfo ),
+ properties( None )
+ {
+ setTags( *this, _tags );
+ }
+
+ bool TestCaseInfo::isHidden() const {
+ return ( properties & IsHidden ) != 0;
+ }
+ bool TestCaseInfo::throws() const {
+ return ( properties & Throws ) != 0;
+ }
+ bool TestCaseInfo::okToFail() const {
+ return ( properties & (ShouldFail | MayFail ) ) != 0;
+ }
+ bool TestCaseInfo::expectedToFail() const {
+ return ( properties & (ShouldFail ) ) != 0;
+ }
+
+ std::string TestCaseInfo::tagsAsString() const {
+ std::string ret;
+ // '[' and ']' per tag
+ std::size_t full_size = 2 * tags.size();
+ for (const auto& tag : tags) {
+ full_size += tag.size();
+ }
+ ret.reserve(full_size);
+ for (const auto& tag : tags) {
+ ret.push_back('[');
+ ret.append(tag);
+ ret.push_back(']');
+ }
+
+ return ret;
+ }
+
+ TestCase::TestCase( ITestInvoker* testCase, TestCaseInfo const& info ) : TestCaseInfo( info ), test( testCase ) {}
+
+ TestCase TestCase::withName( std::string const& _newName ) const {
+ TestCase other( *this );
+ other.name = _newName;
+ return other;
+ }
+
+ void TestCase::invoke() const {
+ test->invoke();
+ }
+
+ bool TestCase::operator == ( TestCase const& other ) const {
+ return test.get() == other.test.get() &&
+ name == other.name &&
+ className == other.className;
+ }
+
+ bool TestCase::operator < ( TestCase const& other ) const {
+ return name < other.name;
+ }
+
+ TestCaseInfo const& TestCase::getTestCaseInfo() const
+ {
+ return *this;
+ }
+
+} // end namespace Catch
+// end catch_test_case_info.cpp
+// start catch_test_case_registry_impl.cpp
+
+#include <sstream>
+
+namespace Catch {
+
+ std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases ) {
+
+ std::vector<TestCase> sorted = unsortedTestCases;
+
+ switch( config.runOrder() ) {
+ case RunTests::InLexicographicalOrder:
+ std::sort( sorted.begin(), sorted.end() );
+ break;
+ case RunTests::InRandomOrder:
+ seedRng( config );
+ RandomNumberGenerator::shuffle( sorted );
+ break;
+ case RunTests::InDeclarationOrder:
+ // already in declaration order
+ break;
+ }
+ return sorted;
+ }
+ bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ) {
+ return testSpec.matches( testCase ) && ( config.allowThrows() || !testCase.throws() );
+ }
+
+ void enforceNoDuplicateTestCases( std::vector<TestCase> const& functions ) {
+ std::set<TestCase> seenFunctions;
+ for( auto const& function : functions ) {
+ auto prev = seenFunctions.insert( function );
+ CATCH_ENFORCE( prev.second,
+ "error: TEST_CASE( \"" << function.name << "\" ) already defined.\n"
+ << "\tFirst seen at " << prev.first->getTestCaseInfo().lineInfo << "\n"
+ << "\tRedefined at " << function.getTestCaseInfo().lineInfo );
+ }
+ }
+
+ std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config ) {
+ std::vector<TestCase> filtered;
+ filtered.reserve( testCases.size() );
+ for( auto const& testCase : testCases )
+ if( matchTest( testCase, testSpec, config ) )
+ filtered.push_back( testCase );
+ return filtered;
+ }
+ std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config ) {
+ return getRegistryHub().getTestCaseRegistry().getAllTestsSorted( config );
+ }
+
+ void TestRegistry::registerTest( TestCase const& testCase ) {
+ std::string name = testCase.getTestCaseInfo().name;
+ if( name.empty() ) {
+ ReusableStringStream rss;
+ rss << "Anonymous test case " << ++m_unnamedCount;
+ return registerTest( testCase.withName( rss.str() ) );
+ }
+ m_functions.push_back( testCase );
+ }
+
+ std::vector<TestCase> const& TestRegistry::getAllTests() const {
+ return m_functions;
+ }
+ std::vector<TestCase> const& TestRegistry::getAllTestsSorted( IConfig const& config ) const {
+ if( m_sortedFunctions.empty() )
+ enforceNoDuplicateTestCases( m_functions );
+
+ if( m_currentSortOrder != config.runOrder() || m_sortedFunctions.empty() ) {
+ m_sortedFunctions = sortTests( config, m_functions );
+ m_currentSortOrder = config.runOrder();
+ }
+ return m_sortedFunctions;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ TestInvokerAsFunction::TestInvokerAsFunction( void(*testAsFunction)() ) noexcept : m_testAsFunction( testAsFunction ) {}
+
+ void TestInvokerAsFunction::invoke() const {
+ m_testAsFunction();
+ }
+
+ std::string extractClassName( std::string const& classOrQualifiedMethodName ) {
+ std::string className = classOrQualifiedMethodName;
+ if( startsWith( className, '&' ) )
+ {
+ std::size_t lastColons = className.rfind( "::" );
+ std::size_t penultimateColons = className.rfind( "::", lastColons-1 );
+ if( penultimateColons == std::string::npos )
+ penultimateColons = 1;
+ className = className.substr( penultimateColons, lastColons-penultimateColons );
+ }
+ return className;
+ }
+
+} // end namespace Catch
+// end catch_test_case_registry_impl.cpp
+// start catch_test_case_tracker.cpp
+
+#include <algorithm>
+#include <assert.h>
+#include <stdexcept>
+#include <memory>
+#include <sstream>
+
+#if defined(__clang__)
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wexit-time-destructors"
+#endif
+
+namespace Catch {
+namespace TestCaseTracking {
+
+ NameAndLocation::NameAndLocation( std::string const& _name, SourceLineInfo const& _location )
+ : name( _name ),
+ location( _location )
+ {}
+
+ ITracker::~ITracker() = default;
+
+ TrackerContext& TrackerContext::instance() {
+ static TrackerContext s_instance;
+ return s_instance;
+ }
+
+ ITracker& TrackerContext::startRun() {
+ m_rootTracker = std::make_shared<SectionTracker>( NameAndLocation( "{root}", CATCH_INTERNAL_LINEINFO ), *this, nullptr );
+ m_currentTracker = nullptr;
+ m_runState = Executing;
+ return *m_rootTracker;
+ }
+
+ void TrackerContext::endRun() {
+ m_rootTracker.reset();
+ m_currentTracker = nullptr;
+ m_runState = NotStarted;
+ }
+
+ void TrackerContext::startCycle() {
+ m_currentTracker = m_rootTracker.get();
+ m_runState = Executing;
+ }
+ void TrackerContext::completeCycle() {
+ m_runState = CompletedCycle;
+ }
+
+ bool TrackerContext::completedCycle() const {
+ return m_runState == CompletedCycle;
+ }
+ ITracker& TrackerContext::currentTracker() {
+ return *m_currentTracker;
+ }
+ void TrackerContext::setCurrentTracker( ITracker* tracker ) {
+ m_currentTracker = tracker;
+ }
+
+ TrackerBase::TrackerHasName::TrackerHasName( NameAndLocation const& nameAndLocation ) : m_nameAndLocation( nameAndLocation ) {}
+ bool TrackerBase::TrackerHasName::operator ()( ITrackerPtr const& tracker ) const {
+ return
+ tracker->nameAndLocation().name == m_nameAndLocation.name &&
+ tracker->nameAndLocation().location == m_nameAndLocation.location;
+ }
+
+ TrackerBase::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent )
+ : m_nameAndLocation( nameAndLocation ),
+ m_ctx( ctx ),
+ m_parent( parent )
+ {}
+
+ NameAndLocation const& TrackerBase::nameAndLocation() const {
+ return m_nameAndLocation;
+ }
+ bool TrackerBase::isComplete() const {
+ return m_runState == CompletedSuccessfully || m_runState == Failed;
+ }
+ bool TrackerBase::isSuccessfullyCompleted() const {
+ return m_runState == CompletedSuccessfully;
+ }
+ bool TrackerBase::isOpen() const {
+ return m_runState != NotStarted && !isComplete();
+ }
+ bool TrackerBase::hasChildren() const {
+ return !m_children.empty();
+ }
+
+ void TrackerBase::addChild( ITrackerPtr const& child ) {
+ m_children.push_back( child );
+ }
+
+ ITrackerPtr TrackerBase::findChild( NameAndLocation const& nameAndLocation ) {
+ auto it = std::find_if( m_children.begin(), m_children.end(), TrackerHasName( nameAndLocation ) );
+ return( it != m_children.end() )
+ ? *it
+ : nullptr;
+ }
+ ITracker& TrackerBase::parent() {
+ assert( m_parent ); // Should always be non-null except for root
+ return *m_parent;
+ }
+
+ void TrackerBase::openChild() {
+ if( m_runState != ExecutingChildren ) {
+ m_runState = ExecutingChildren;
+ if( m_parent )
+ m_parent->openChild();
+ }
+ }
+
+ bool TrackerBase::isSectionTracker() const { return false; }
+ bool TrackerBase::isIndexTracker() const { return false; }
+
+ void TrackerBase::open() {
+ m_runState = Executing;
+ moveToThis();
+ if( m_parent )
+ m_parent->openChild();
+ }
+
+ void TrackerBase::close() {
+
+ // Close any still open children (e.g. generators)
+ while( &m_ctx.currentTracker() != this )
+ m_ctx.currentTracker().close();
+
+ switch( m_runState ) {
+ case NeedsAnotherRun:
+ break;
+
+ case Executing:
+ m_runState = CompletedSuccessfully;
+ break;
+ case ExecutingChildren:
+ if( m_children.empty() || m_children.back()->isComplete() )
+ m_runState = CompletedSuccessfully;
+ break;
+
+ case NotStarted:
+ case CompletedSuccessfully:
+ case Failed:
+ CATCH_INTERNAL_ERROR( "Illogical state: " << m_runState );
+
+ default:
+ CATCH_INTERNAL_ERROR( "Unknown state: " << m_runState );
+ }
+ moveToParent();
+ m_ctx.completeCycle();
+ }
+ void TrackerBase::fail() {
+ m_runState = Failed;
+ if( m_parent )
+ m_parent->markAsNeedingAnotherRun();
+ moveToParent();
+ m_ctx.completeCycle();
+ }
+ void TrackerBase::markAsNeedingAnotherRun() {
+ m_runState = NeedsAnotherRun;
+ }
+
+ void TrackerBase::moveToParent() {
+ assert( m_parent );
+ m_ctx.setCurrentTracker( m_parent );
+ }
+ void TrackerBase::moveToThis() {
+ m_ctx.setCurrentTracker( this );
+ }
+
+ SectionTracker::SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent )
+ : TrackerBase( nameAndLocation, ctx, parent )
+ {
+ if( parent ) {
+ while( !parent->isSectionTracker() )
+ parent = &parent->parent();
+
+ SectionTracker& parentSection = static_cast<SectionTracker&>( *parent );
+ addNextFilters( parentSection.m_filters );
+ }
+ }
+
+ bool SectionTracker::isSectionTracker() const { return true; }
+
+ SectionTracker& SectionTracker::acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation ) {
+ std::shared_ptr<SectionTracker> section;
+
+ ITracker& currentTracker = ctx.currentTracker();
+ if( ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) {
+ assert( childTracker );
+ assert( childTracker->isSectionTracker() );
+ section = std::static_pointer_cast<SectionTracker>( childTracker );
+ }
+ else {
+ section = std::make_shared<SectionTracker>( nameAndLocation, ctx, ¤tTracker );
+ currentTracker.addChild( section );
+ }
+ if( !ctx.completedCycle() )
+ section->tryOpen();
+ return *section;
+ }
+
+ void SectionTracker::tryOpen() {
+ if( !isComplete() && (m_filters.empty() || m_filters[0].empty() || m_filters[0] == m_nameAndLocation.name ) )
+ open();
+ }
+
+ void SectionTracker::addInitialFilters( std::vector<std::string> const& filters ) {
+ if( !filters.empty() ) {
+ m_filters.push_back(""); // Root - should never be consulted
+ m_filters.push_back(""); // Test Case - not a section filter
+ m_filters.insert( m_filters.end(), filters.begin(), filters.end() );
+ }
+ }
+ void SectionTracker::addNextFilters( std::vector<std::string> const& filters ) {
+ if( filters.size() > 1 )
+ m_filters.insert( m_filters.end(), ++filters.begin(), filters.end() );
+ }
+
+ IndexTracker::IndexTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent, int size )
+ : TrackerBase( nameAndLocation, ctx, parent ),
+ m_size( size )
+ {}
+
+ bool IndexTracker::isIndexTracker() const { return true; }
+
+ IndexTracker& IndexTracker::acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation, int size ) {
+ std::shared_ptr<IndexTracker> tracker;
+
+ ITracker& currentTracker = ctx.currentTracker();
+ if( ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) {
+ assert( childTracker );
+ assert( childTracker->isIndexTracker() );
+ tracker = std::static_pointer_cast<IndexTracker>( childTracker );
+ }
+ else {
+ tracker = std::make_shared<IndexTracker>( nameAndLocation, ctx, ¤tTracker, size );
+ currentTracker.addChild( tracker );
+ }
+
+ if( !ctx.completedCycle() && !tracker->isComplete() ) {
+ if( tracker->m_runState != ExecutingChildren && tracker->m_runState != NeedsAnotherRun )
+ tracker->moveNext();
+ tracker->open();
+ }
+
+ return *tracker;
+ }
+
+ int IndexTracker::index() const { return m_index; }
+
+ void IndexTracker::moveNext() {
+ m_index++;
+ m_children.clear();
+ }
+
+ void IndexTracker::close() {
+ TrackerBase::close();
+ if( m_runState == CompletedSuccessfully && m_index < m_size-1 )
+ m_runState = Executing;
+ }
+
+} // namespace TestCaseTracking
+
+using TestCaseTracking::ITracker;
+using TestCaseTracking::TrackerContext;
+using TestCaseTracking::SectionTracker;
+using TestCaseTracking::IndexTracker;
+
+} // namespace Catch
+
+#if defined(__clang__)
+# pragma clang diagnostic pop
+#endif
+// end catch_test_case_tracker.cpp
+// start catch_test_registry.cpp
+
+namespace Catch {
+
+ auto makeTestInvoker( void(*testAsFunction)() ) noexcept -> ITestInvoker* {
+ return new(std::nothrow) TestInvokerAsFunction( testAsFunction );
+ }
+
+ NameAndTags::NameAndTags( StringRef name_ , StringRef tags_ ) noexcept : name( name_ ), tags( tags_ ) {}
+
+ AutoReg::AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef classOrMethod, NameAndTags const& nameAndTags ) noexcept {
+ try {
+ getMutableRegistryHub()
+ .registerTest(
+ makeTestCase(
+ invoker,
+ extractClassName( classOrMethod ),
+ nameAndTags.name,
+ nameAndTags.tags,
+ lineInfo));
+ } catch (...) {
+ // Do not throw when constructing global objects, instead register the exception to be processed later
+ getMutableRegistryHub().registerStartupException();
+ }
+ }
+
+ AutoReg::~AutoReg() = default;
+}
+// end catch_test_registry.cpp
+// start catch_test_spec.cpp
+
+#include <algorithm>
+#include <string>
+#include <vector>
+#include <memory>
+
+namespace Catch {
+
+ TestSpec::Pattern::~Pattern() = default;
+ TestSpec::NamePattern::~NamePattern() = default;
+ TestSpec::TagPattern::~TagPattern() = default;
+ TestSpec::ExcludedPattern::~ExcludedPattern() = default;
+
+ TestSpec::NamePattern::NamePattern( std::string const& name )
+ : m_wildcardPattern( toLower( name ), CaseSensitive::No )
+ {}
+ bool TestSpec::NamePattern::matches( TestCaseInfo const& testCase ) const {
+ return m_wildcardPattern.matches( toLower( testCase.name ) );
+ }
+
+ TestSpec::TagPattern::TagPattern( std::string const& tag ) : m_tag( toLower( tag ) ) {}
+ bool TestSpec::TagPattern::matches( TestCaseInfo const& testCase ) const {
+ return std::find(begin(testCase.lcaseTags),
+ end(testCase.lcaseTags),
+ m_tag) != end(testCase.lcaseTags);
+ }
+
+ TestSpec::ExcludedPattern::ExcludedPattern( PatternPtr const& underlyingPattern ) : m_underlyingPattern( underlyingPattern ) {}
+ bool TestSpec::ExcludedPattern::matches( TestCaseInfo const& testCase ) const { return !m_underlyingPattern->matches( testCase ); }
+
+ bool TestSpec::Filter::matches( TestCaseInfo const& testCase ) const {
+ // All patterns in a filter must match for the filter to be a match
+ for( auto const& pattern : m_patterns ) {
+ if( !pattern->matches( testCase ) )
+ return false;
+ }
+ return true;
+ }
+
+ bool TestSpec::hasFilters() const {
+ return !m_filters.empty();
+ }
+ bool TestSpec::matches( TestCaseInfo const& testCase ) const {
+ // A TestSpec matches if any filter matches
+ for( auto const& filter : m_filters )
+ if( filter.matches( testCase ) )
+ return true;
+ return false;
+ }
+}
+// end catch_test_spec.cpp
+// start catch_test_spec_parser.cpp
+
+namespace Catch {
+
+ TestSpecParser::TestSpecParser( ITagAliasRegistry const& tagAliases ) : m_tagAliases( &tagAliases ) {}
+
+ TestSpecParser& TestSpecParser::parse( std::string const& arg ) {
+ m_mode = None;
+ m_exclusion = false;
+ m_start = std::string::npos;
+ m_arg = m_tagAliases->expandAliases( arg );
+ m_escapeChars.clear();
+ for( m_pos = 0; m_pos < m_arg.size(); ++m_pos )
+ visitChar( m_arg[m_pos] );
+ if( m_mode == Name )
+ addPattern<TestSpec::NamePattern>();
+ return *this;
+ }
+ TestSpec TestSpecParser::testSpec() {
+ addFilter();
+ return m_testSpec;
+ }
+
+ void TestSpecParser::visitChar( char c ) {
+ if( m_mode == None ) {
+ switch( c ) {
+ case ' ': return;
+ case '~': m_exclusion = true; return;
+ case '[': return startNewMode( Tag, ++m_pos );
+ case '"': return startNewMode( QuotedName, ++m_pos );
+ case '\\': return escape();
+ default: startNewMode( Name, m_pos ); break;
+ }
+ }
+ if( m_mode == Name ) {
+ if( c == ',' ) {
+ addPattern<TestSpec::NamePattern>();
+ addFilter();
+ }
+ else if( c == '[' ) {
+ if( subString() == "exclude:" )
+ m_exclusion = true;
+ else
+ addPattern<TestSpec::NamePattern>();
+ startNewMode( Tag, ++m_pos );
+ }
+ else if( c == '\\' )
+ escape();
+ }
+ else if( m_mode == EscapedName )
+ m_mode = Name;
+ else if( m_mode == QuotedName && c == '"' )
+ addPattern<TestSpec::NamePattern>();
+ else if( m_mode == Tag && c == ']' )
+ addPattern<TestSpec::TagPattern>();
+ }
+ void TestSpecParser::startNewMode( Mode mode, std::size_t start ) {
+ m_mode = mode;
+ m_start = start;
+ }
+ void TestSpecParser::escape() {
+ if( m_mode == None )
+ m_start = m_pos;
+ m_mode = EscapedName;
+ m_escapeChars.push_back( m_pos );
+ }
+ std::string TestSpecParser::subString() const { return m_arg.substr( m_start, m_pos - m_start ); }
+
+ void TestSpecParser::addFilter() {
+ if( !m_currentFilter.m_patterns.empty() ) {
+ m_testSpec.m_filters.push_back( m_currentFilter );
+ m_currentFilter = TestSpec::Filter();
+ }
+ }
+
+ TestSpec parseTestSpec( std::string const& arg ) {
+ return TestSpecParser( ITagAliasRegistry::get() ).parse( arg ).testSpec();
+ }
+
+} // namespace Catch
+// end catch_test_spec_parser.cpp
+// start catch_timer.cpp
+
+#include <chrono>
+
+namespace Catch {
+
+ auto getCurrentNanosecondsSinceEpoch() -> uint64_t {
+ return std::chrono::duration_cast<std::chrono::nanoseconds>( std::chrono::high_resolution_clock::now().time_since_epoch() ).count();
+ }
+
+ auto estimateClockResolution() -> uint64_t {
+ uint64_t sum = 0;
+ static const uint64_t iterations = 1000000;
+
+ for( std::size_t i = 0; i < iterations; ++i ) {
+
+ uint64_t ticks;
+ uint64_t baseTicks = getCurrentNanosecondsSinceEpoch();
+ do {
+ ticks = getCurrentNanosecondsSinceEpoch();
+ }
+ while( ticks == baseTicks );
+
+ auto delta = ticks - baseTicks;
+ sum += delta;
+ }
+
+ // We're just taking the mean, here. To do better we could take the std. dev and exclude outliers
+ // - and potentially do more iterations if there's a high variance.
+ return sum/iterations;
+ }
+ auto getEstimatedClockResolution() -> uint64_t {
+ static auto s_resolution = estimateClockResolution();
+ return s_resolution;
+ }
+
+ void Timer::start() {
+ m_nanoseconds = getCurrentNanosecondsSinceEpoch();
+ }
+ auto Timer::getElapsedNanoseconds() const -> uint64_t {
+ return getCurrentNanosecondsSinceEpoch() - m_nanoseconds;
+ }
+ auto Timer::getElapsedMicroseconds() const -> uint64_t {
+ return getElapsedNanoseconds()/1000;
+ }
+ auto Timer::getElapsedMilliseconds() const -> unsigned int {
+ return static_cast<unsigned int>(getElapsedMicroseconds()/1000);
+ }
+ auto Timer::getElapsedSeconds() const -> double {
+ return getElapsedMicroseconds()/1000000.0;
+ }
+
+} // namespace Catch
+// end catch_timer.cpp
+// start catch_tostring.cpp
+
+#if defined(__clang__)
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wexit-time-destructors"
+# pragma clang diagnostic ignored "-Wglobal-constructors"
+#endif
+
+// Enable specific decls locally
+#if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER)
+#define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER
+#endif
+
+#include <cmath>
+#include <iomanip>
+
+namespace Catch {
+
+namespace Detail {
+
+ const std::string unprintableString = "{?}";
+
+ namespace {
+ const int hexThreshold = 255;
+
+ struct Endianness {
+ enum Arch { Big, Little };
+
+ static Arch which() {
+ union _{
+ int asInt;
+ char asChar[sizeof (int)];
+ } u;
+
+ u.asInt = 1;
+ return ( u.asChar[sizeof(int)-1] == 1 ) ? Big : Little;
+ }
+ };
+ }
+
+ std::string rawMemoryToString( const void *object, std::size_t size ) {
+ // Reverse order for little endian architectures
+ int i = 0, end = static_cast<int>( size ), inc = 1;
+ if( Endianness::which() == Endianness::Little ) {
+ i = end-1;
+ end = inc = -1;
+ }
+
+ unsigned char const *bytes = static_cast<unsigned char const *>(object);
+ ReusableStringStream rss;
+ rss << "0x" << std::setfill('0') << std::hex;
+ for( ; i != end; i += inc )
+ rss << std::setw(2) << static_cast<unsigned>(bytes[i]);
+ return rss.str();
+ }
+}
+
+template<typename T>
+std::string fpToString( T value, int precision ) {
+ if (std::isnan(value)) {
+ return "nan";
+ }
+
+ ReusableStringStream rss;
+ rss << std::setprecision( precision )
+ << std::fixed
+ << value;
+ std::string d = rss.str();
+ std::size_t i = d.find_last_not_of( '0' );
+ if( i != std::string::npos && i != d.size()-1 ) {
+ if( d[i] == '.' )
+ i++;
+ d = d.substr( 0, i+1 );
+ }
+ return d;
+}
+
+//// ======================================================= ////
+//
+// Out-of-line defs for full specialization of StringMaker
+//
+//// ======================================================= ////
+
+std::string StringMaker<std::string>::convert(const std::string& str) {
+ if (!getCurrentContext().getConfig()->showInvisibles()) {
+ return '"' + str + '"';
+ }
+
+ std::string s("\"");
+ for (char c : str) {
+ switch (c) {
+ case '\n':
+ s.append("\\n");
+ break;
+ case '\t':
+ s.append("\\t");
+ break;
+ default:
+ s.push_back(c);
+ break;
+ }
+ }
+ s.append("\"");
+ return s;
+}
+
+std::string StringMaker<std::wstring>::convert(const std::wstring& wstr) {
+ std::string s;
+ s.reserve(wstr.size());
+ for (auto c : wstr) {
+ s += (c <= 0xff) ? static_cast<char>(c) : '?';
+ }
+ return ::Catch::Detail::stringify(s);
+}
+
+std::string StringMaker<char const*>::convert(char const* str) {
+ if (str) {
+ return ::Catch::Detail::stringify(std::string{ str });
+ } else {
+ return{ "{null string}" };
+ }
+}
+std::string StringMaker<char*>::convert(char* str) {
+ if (str) {
+ return ::Catch::Detail::stringify(std::string{ str });
+ } else {
+ return{ "{null string}" };
+ }
+}
+std::string StringMaker<wchar_t const*>::convert(wchar_t const * str) {
+ if (str) {
+ return ::Catch::Detail::stringify(std::wstring{ str });
+ } else {
+ return{ "{null string}" };
+ }
+}
+std::string StringMaker<wchar_t *>::convert(wchar_t * str) {
+ if (str) {
+ return ::Catch::Detail::stringify(std::wstring{ str });
+ } else {
+ return{ "{null string}" };
+ }
+}
+
+std::string StringMaker<int>::convert(int value) {
+ return ::Catch::Detail::stringify(static_cast<long long>(value));
+}
+std::string StringMaker<long>::convert(long value) {
+ return ::Catch::Detail::stringify(static_cast<long long>(value));
+}
+std::string StringMaker<long long>::convert(long long value) {
+ ReusableStringStream rss;
+ rss << value;
+ if (value > Detail::hexThreshold) {
+ rss << " (0x" << std::hex << value << ')';
+ }
+ return rss.str();
+}
+
+std::string StringMaker<unsigned int>::convert(unsigned int value) {
+ return ::Catch::Detail::stringify(static_cast<unsigned long long>(value));
+}
+std::string StringMaker<unsigned long>::convert(unsigned long value) {
+ return ::Catch::Detail::stringify(static_cast<unsigned long long>(value));
+}
+std::string StringMaker<unsigned long long>::convert(unsigned long long value) {
+ ReusableStringStream rss;
+ rss << value;
+ if (value > Detail::hexThreshold) {
+ rss << " (0x" << std::hex << value << ')';
+ }
+ return rss.str();
+}
+
+std::string StringMaker<bool>::convert(bool b) {
+ return b ? "true" : "false";
+}
+
+std::string StringMaker<char>::convert(char value) {
+ if (value == '\r') {
+ return "'\\r'";
+ } else if (value == '\f') {
+ return "'\\f'";
+ } else if (value == '\n') {
+ return "'\\n'";
+ } else if (value == '\t') {
+ return "'\\t'";
+ } else if ('\0' <= value && value < ' ') {
+ return ::Catch::Detail::stringify(static_cast<unsigned int>(value));
+ } else {
+ char chstr[] = "' '";
+ chstr[1] = value;
+ return chstr;
+ }
+}
+std::string StringMaker<signed char>::convert(signed char c) {
+ return ::Catch::Detail::stringify(static_cast<char>(c));
+}
+std::string StringMaker<unsigned char>::convert(unsigned char c) {
+ return ::Catch::Detail::stringify(static_cast<char>(c));
+}
+
+std::string StringMaker<std::nullptr_t>::convert(std::nullptr_t) {
+ return "nullptr";
+}
+
+std::string StringMaker<float>::convert(float value) {
+ return fpToString(value, 5) + 'f';
+}
+std::string StringMaker<double>::convert(double value) {
+ return fpToString(value, 10);
+}
+
+std::string ratio_string<std::atto>::symbol() { return "a"; }
+std::string ratio_string<std::femto>::symbol() { return "f"; }
+std::string ratio_string<std::pico>::symbol() { return "p"; }
+std::string ratio_string<std::nano>::symbol() { return "n"; }
+std::string ratio_string<std::micro>::symbol() { return "u"; }
+std::string ratio_string<std::milli>::symbol() { return "m"; }
+
+} // end namespace Catch
+
+#if defined(__clang__)
+# pragma clang diagnostic pop
+#endif
+
+// end catch_tostring.cpp
+// start catch_totals.cpp
+
+namespace Catch {
+
+ Counts Counts::operator - ( Counts const& other ) const {
+ Counts diff;
+ diff.passed = passed - other.passed;
+ diff.failed = failed - other.failed;
+ diff.failedButOk = failedButOk - other.failedButOk;
+ return diff;
+ }
+
+ Counts& Counts::operator += ( Counts const& other ) {
+ passed += other.passed;
+ failed += other.failed;
+ failedButOk += other.failedButOk;
+ return *this;
+ }
+
+ std::size_t Counts::total() const {
+ return passed + failed + failedButOk;
+ }
+ bool Counts::allPassed() const {
+ return failed == 0 && failedButOk == 0;
+ }
+ bool Counts::allOk() const {
+ return failed == 0;
+ }
+
+ Totals Totals::operator - ( Totals const& other ) const {
+ Totals diff;
+ diff.assertions = assertions - other.assertions;
+ diff.testCases = testCases - other.testCases;
+ return diff;
+ }
+
+ Totals& Totals::operator += ( Totals const& other ) {
+ assertions += other.assertions;
+ testCases += other.testCases;
+ return *this;
+ }
+
+ Totals Totals::delta( Totals const& prevTotals ) const {
+ Totals diff = *this - prevTotals;
+ if( diff.assertions.failed > 0 )
+ ++diff.testCases.failed;
+ else if( diff.assertions.failedButOk > 0 )
+ ++diff.testCases.failedButOk;
+ else
+ ++diff.testCases.passed;
+ return diff;
+ }
+
+}
+// end catch_totals.cpp
+// start catch_version.cpp
+
+#include <ostream>
+
+namespace Catch {
+
+ Version::Version
+ ( unsigned int _majorVersion,
+ unsigned int _minorVersion,
+ unsigned int _patchNumber,
+ char const * const _branchName,
+ unsigned int _buildNumber )
+ : majorVersion( _majorVersion ),
+ minorVersion( _minorVersion ),
+ patchNumber( _patchNumber ),
+ branchName( _branchName ),
+ buildNumber( _buildNumber )
+ {}
+
+ std::ostream& operator << ( std::ostream& os, Version const& version ) {
+ os << version.majorVersion << '.'
+ << version.minorVersion << '.'
+ << version.patchNumber;
+ // branchName is never null -> 0th char is \0 if it is empty
+ if (version.branchName[0]) {
+ os << '-' << version.branchName
+ << '.' << version.buildNumber;
+ }
+ return os;
+ }
+
+ Version const& libraryVersion() {
+ static Version version( 2, 1, 1, "", 0 );
+ return version;
+ }
+
+}
+// end catch_version.cpp
+// start catch_wildcard_pattern.cpp
+
+#include <sstream>
+
+namespace Catch {
+
+ WildcardPattern::WildcardPattern( std::string const& pattern,
+ CaseSensitive::Choice caseSensitivity )
+ : m_caseSensitivity( caseSensitivity ),
+ m_pattern( adjustCase( pattern ) )
+ {
+ if( startsWith( m_pattern, '*' ) ) {
+ m_pattern = m_pattern.substr( 1 );
+ m_wildcard = WildcardAtStart;
+ }
+ if( endsWith( m_pattern, '*' ) ) {
+ m_pattern = m_pattern.substr( 0, m_pattern.size()-1 );
+ m_wildcard = static_cast<WildcardPosition>( m_wildcard | WildcardAtEnd );
+ }
+ }
+
+ bool WildcardPattern::matches( std::string const& str ) const {
+ switch( m_wildcard ) {
+ case NoWildcard:
+ return m_pattern == adjustCase( str );
+ case WildcardAtStart:
+ return endsWith( adjustCase( str ), m_pattern );
+ case WildcardAtEnd:
+ return startsWith( adjustCase( str ), m_pattern );
+ case WildcardAtBothEnds:
+ return contains( adjustCase( str ), m_pattern );
+ default:
+ CATCH_INTERNAL_ERROR( "Unknown enum" );
+ }
+ }
+
+ std::string WildcardPattern::adjustCase( std::string const& str ) const {
+ return m_caseSensitivity == CaseSensitive::No ? toLower( str ) : str;
+ }
+}
+// end catch_wildcard_pattern.cpp
+// start catch_xmlwriter.cpp
+
+#include <iomanip>
+
+namespace Catch {
+
+ XmlEncode::XmlEncode( std::string const& str, ForWhat forWhat )
+ : m_str( str ),
+ m_forWhat( forWhat )
+ {}
+
+ void XmlEncode::encodeTo( std::ostream& os ) const {
+
+ // Apostrophe escaping not necessary if we always use " to write attributes
+ // (see: http://www.w3.org/TR/xml/#syntax)
+
+ for( std::size_t i = 0; i < m_str.size(); ++ i ) {
+ char c = m_str[i];
+ switch( c ) {
+ case '<': os << "<"; break;
+ case '&': os << "&"; break;
+
+ case '>':
+ // See: http://www.w3.org/TR/xml/#syntax
+ if( i > 2 && m_str[i-1] == ']' && m_str[i-2] == ']' )
+ os << ">";
+ else
+ os << c;
+ break;
+
+ case '\"':
+ if( m_forWhat == ForAttributes )
+ os << """;
+ else
+ os << c;
+ break;
+
+ default:
+ // Escape control chars - based on contribution by @espenalb in PR #465 and
+ // by @mrpi PR #588
+ if ( ( c >= 0 && c < '\x09' ) || ( c > '\x0D' && c < '\x20') || c=='\x7F' ) {
+ // see http://stackoverflow.com/questions/404107/why-are-control-characters-illegal-in-xml-1-0
+ os << "\\x" << std::uppercase << std::hex << std::setfill('0') << std::setw(2)
+ << static_cast<int>( c );
+ }
+ else
+ os << c;
+ }
+ }
+ }
+
+ std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode ) {
+ xmlEncode.encodeTo( os );
+ return os;
+ }
+
+ XmlWriter::ScopedElement::ScopedElement( XmlWriter* writer )
+ : m_writer( writer )
+ {}
+
+ XmlWriter::ScopedElement::ScopedElement( ScopedElement&& other ) noexcept
+ : m_writer( other.m_writer ){
+ other.m_writer = nullptr;
+ }
+ XmlWriter::ScopedElement& XmlWriter::ScopedElement::operator=( ScopedElement&& other ) noexcept {
+ if ( m_writer ) {
+ m_writer->endElement();
+ }
+ m_writer = other.m_writer;
+ other.m_writer = nullptr;
+ return *this;
+ }
+
+ XmlWriter::ScopedElement::~ScopedElement() {
+ if( m_writer )
+ m_writer->endElement();
+ }
+
+ XmlWriter::ScopedElement& XmlWriter::ScopedElement::writeText( std::string const& text, bool indent ) {
+ m_writer->writeText( text, indent );
+ return *this;
+ }
+
+ XmlWriter::XmlWriter( std::ostream& os ) : m_os( os )
+ {
+ writeDeclaration();
+ }
+
+ XmlWriter::~XmlWriter() {
+ while( !m_tags.empty() )
+ endElement();
+ }
+
+ XmlWriter& XmlWriter::startElement( std::string const& name ) {
+ ensureTagClosed();
+ newlineIfNecessary();
+ m_os << m_indent << '<' << name;
+ m_tags.push_back( name );
+ m_indent += " ";
+ m_tagIsOpen = true;
+ return *this;
+ }
+
+ XmlWriter::ScopedElement XmlWriter::scopedElement( std::string const& name ) {
+ ScopedElement scoped( this );
+ startElement( name );
+ return scoped;
+ }
+
+ XmlWriter& XmlWriter::endElement() {
+ newlineIfNecessary();
+ m_indent = m_indent.substr( 0, m_indent.size()-2 );
+ if( m_tagIsOpen ) {
+ m_os << "/>";
+ m_tagIsOpen = false;
+ }
+ else {
+ m_os << m_indent << "</" << m_tags.back() << ">";
+ }
+ m_os << std::endl;
+ m_tags.pop_back();
+ return *this;
+ }
+
+ XmlWriter& XmlWriter::writeAttribute( std::string const& name, std::string const& attribute ) {
+ if( !name.empty() && !attribute.empty() )
+ m_os << ' ' << name << "=\"" << XmlEncode( attribute, XmlEncode::ForAttributes ) << '"';
+ return *this;
+ }
+
+ XmlWriter& XmlWriter::writeAttribute( std::string const& name, bool attribute ) {
+ m_os << ' ' << name << "=\"" << ( attribute ? "true" : "false" ) << '"';
+ return *this;
+ }
+
+ XmlWriter& XmlWriter::writeText( std::string const& text, bool indent ) {
+ if( !text.empty() ){
+ bool tagWasOpen = m_tagIsOpen;
+ ensureTagClosed();
+ if( tagWasOpen && indent )
+ m_os << m_indent;
+ m_os << XmlEncode( text );
+ m_needsNewline = true;
+ }
+ return *this;
+ }
+
+ XmlWriter& XmlWriter::writeComment( std::string const& text ) {
+ ensureTagClosed();
+ m_os << m_indent << "<!--" << text << "-->";
+ m_needsNewline = true;
+ return *this;
+ }
+
+ void XmlWriter::writeStylesheetRef( std::string const& url ) {
+ m_os << "<?xml-stylesheet type=\"text/xsl\" href=\"" << url << "\"?>\n";
+ }
+
+ XmlWriter& XmlWriter::writeBlankLine() {
+ ensureTagClosed();
+ m_os << '\n';
+ return *this;
+ }
+
+ void XmlWriter::ensureTagClosed() {
+ if( m_tagIsOpen ) {
+ m_os << ">" << std::endl;
+ m_tagIsOpen = false;
+ }
+ }
+
+ void XmlWriter::writeDeclaration() {
+ m_os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
+ }
+
+ void XmlWriter::newlineIfNecessary() {
+ if( m_needsNewline ) {
+ m_os << std::endl;
+ m_needsNewline = false;
+ }
+ }
+}
+// end catch_xmlwriter.cpp
+// start catch_reporter_bases.cpp
+
+#include <cstring>
+#include <cfloat>
+#include <cstdio>
+#include <assert.h>
+#include <memory>
+
+namespace Catch {
+ void prepareExpandedExpression(AssertionResult& result) {
+ result.getExpandedExpression();
+ }
+
+ // Because formatting using c++ streams is stateful, drop down to C is required
+ // Alternatively we could use stringstream, but its performance is... not good.
+ std::string getFormattedDuration( double duration ) {
+ // Max exponent + 1 is required to represent the whole part
+ // + 1 for decimal point
+ // + 3 for the 3 decimal places
+ // + 1 for null terminator
+ const std::size_t maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1;
+ char buffer[maxDoubleSize];
+
+ // Save previous errno, to prevent sprintf from overwriting it
+ ErrnoGuard guard;
+#ifdef _MSC_VER
+ sprintf_s(buffer, "%.3f", duration);
+#else
+ sprintf(buffer, "%.3f", duration);
+#endif
+ return std::string(buffer);
+ }
+
+ TestEventListenerBase::TestEventListenerBase(ReporterConfig const & _config)
+ :StreamingReporterBase(_config) {}
+
+ void TestEventListenerBase::assertionStarting(AssertionInfo const &) {}
+
+ bool TestEventListenerBase::assertionEnded(AssertionStats const &) {
+ return false;
+ }
+
+} // end namespace Catch
+// end catch_reporter_bases.cpp
+// start catch_reporter_compact.cpp
+
+namespace {
+
+#ifdef CATCH_PLATFORM_MAC
+ const char* failedString() { return "FAILED"; }
+ const char* passedString() { return "PASSED"; }
+#else
+ const char* failedString() { return "failed"; }
+ const char* passedString() { return "passed"; }
+#endif
+
+ // Colour::LightGrey
+ Catch::Colour::Code dimColour() { return Catch::Colour::FileName; }
+
+ std::string bothOrAll( std::size_t count ) {
+ return count == 1 ? std::string() :
+ count == 2 ? "both " : "all " ;
+ }
+
+} // anon namespace
+
+namespace Catch {
+namespace {
+// Colour, message variants:
+// - white: No tests ran.
+// - red: Failed [both/all] N test cases, failed [both/all] M assertions.
+// - white: Passed [both/all] N test cases (no assertions).
+// - red: Failed N tests cases, failed M assertions.
+// - green: Passed [both/all] N tests cases with M assertions.
+void printTotals(std::ostream& out, const Totals& totals) {
+ if (totals.testCases.total() == 0) {
+ out << "No tests ran.";
+ } else if (totals.testCases.failed == totals.testCases.total()) {
+ Colour colour(Colour::ResultError);
+ const std::string qualify_assertions_failed =
+ totals.assertions.failed == totals.assertions.total() ?
+ bothOrAll(totals.assertions.failed) : std::string();
+ out <<
+ "Failed " << bothOrAll(totals.testCases.failed)
+ << pluralise(totals.testCases.failed, "test case") << ", "
+ "failed " << qualify_assertions_failed <<
+ pluralise(totals.assertions.failed, "assertion") << '.';
+ } else if (totals.assertions.total() == 0) {
+ out <<
+ "Passed " << bothOrAll(totals.testCases.total())
+ << pluralise(totals.testCases.total(), "test case")
+ << " (no assertions).";
+ } else if (totals.assertions.failed) {
+ Colour colour(Colour::ResultError);
+ out <<
+ "Failed " << pluralise(totals.testCases.failed, "test case") << ", "
+ "failed " << pluralise(totals.assertions.failed, "assertion") << '.';
+ } else {
+ Colour colour(Colour::ResultSuccess);
+ out <<
+ "Passed " << bothOrAll(totals.testCases.passed)
+ << pluralise(totals.testCases.passed, "test case") <<
+ " with " << pluralise(totals.assertions.passed, "assertion") << '.';
+ }
+}
+
+// Implementation of CompactReporter formatting
+class AssertionPrinter {
+public:
+ AssertionPrinter& operator= (AssertionPrinter const&) = delete;
+ AssertionPrinter(AssertionPrinter const&) = delete;
+ AssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages)
+ : stream(_stream)
+ , result(_stats.assertionResult)
+ , messages(_stats.infoMessages)
+ , itMessage(_stats.infoMessages.begin())
+ , printInfoMessages(_printInfoMessages) {}
+
+ void print() {
+ printSourceInfo();
+
+ itMessage = messages.begin();
+
+ switch (result.getResultType()) {
+ case ResultWas::Ok:
+ printResultType(Colour::ResultSuccess, passedString());
+ printOriginalExpression();
+ printReconstructedExpression();
+ if (!result.hasExpression())
+ printRemainingMessages(Colour::None);
+ else
+ printRemainingMessages();
+ break;
+ case ResultWas::ExpressionFailed:
+ if (result.isOk())
+ printResultType(Colour::ResultSuccess, failedString() + std::string(" - but was ok"));
+ else
+ printResultType(Colour::Error, failedString());
+ printOriginalExpression();
+ printReconstructedExpression();
+ printRemainingMessages();
+ break;
+ case ResultWas::ThrewException:
+ printResultType(Colour::Error, failedString());
+ printIssue("unexpected exception with message:");
+ printMessage();
+ printExpressionWas();
+ printRemainingMessages();
+ break;
+ case ResultWas::FatalErrorCondition:
+ printResultType(Colour::Error, failedString());
+ printIssue("fatal error condition with message:");
+ printMessage();
+ printExpressionWas();
+ printRemainingMessages();
+ break;
+ case ResultWas::DidntThrowException:
+ printResultType(Colour::Error, failedString());
+ printIssue("expected exception, got none");
+ printExpressionWas();
+ printRemainingMessages();
+ break;
+ case ResultWas::Info:
+ printResultType(Colour::None, "info");
+ printMessage();
+ printRemainingMessages();
+ break;
+ case ResultWas::Warning:
+ printResultType(Colour::None, "warning");
+ printMessage();
+ printRemainingMessages();
+ break;
+ case ResultWas::ExplicitFailure:
+ printResultType(Colour::Error, failedString());
+ printIssue("explicitly");
+ printRemainingMessages(Colour::None);
+ break;
+ // These cases are here to prevent compiler warnings
+ case ResultWas::Unknown:
+ case ResultWas::FailureBit:
+ case ResultWas::Exception:
+ printResultType(Colour::Error, "** internal error **");
+ break;
+ }
+ }
+
+private:
+ void printSourceInfo() const {
+ Colour colourGuard(Colour::FileName);
+ stream << result.getSourceInfo() << ':';
+ }
+
+ void printResultType(Colour::Code colour, std::string const& passOrFail) const {
+ if (!passOrFail.empty()) {
+ {
+ Colour colourGuard(colour);
+ stream << ' ' << passOrFail;
+ }
+ stream << ':';
+ }
+ }
+
+ void printIssue(std::string const& issue) const {
+ stream << ' ' << issue;
+ }
+
+ void printExpressionWas() {
+ if (result.hasExpression()) {
+ stream << ';';
+ {
+ Colour colour(dimColour());
+ stream << " expression was:";
+ }
+ printOriginalExpression();
+ }
+ }
+
+ void printOriginalExpression() const {
+ if (result.hasExpression()) {
+ stream << ' ' << result.getExpression();
+ }
+ }
+
+ void printReconstructedExpression() const {
+ if (result.hasExpandedExpression()) {
+ {
+ Colour colour(dimColour());
+ stream << " for: ";
+ }
+ stream << result.getExpandedExpression();
+ }
+ }
+
+ void printMessage() {
+ if (itMessage != messages.end()) {
+ stream << " '" << itMessage->message << '\'';
+ ++itMessage;
+ }
+ }
+
+ void printRemainingMessages(Colour::Code colour = dimColour()) {
+ if (itMessage == messages.end())
+ return;
+
+ // using messages.end() directly yields (or auto) compilation error:
+ std::vector<MessageInfo>::const_iterator itEnd = messages.end();
+ const std::size_t N = static_cast<std::size_t>(std::distance(itMessage, itEnd));
+
+ {
+ Colour colourGuard(colour);
+ stream << " with " << pluralise(N, "message") << ':';
+ }
+
+ for (; itMessage != itEnd; ) {
+ // If this assertion is a warning ignore any INFO messages
+ if (printInfoMessages || itMessage->type != ResultWas::Info) {
+ stream << " '" << itMessage->message << '\'';
+ if (++itMessage != itEnd) {
+ Colour colourGuard(dimColour());
+ stream << " and";
+ }
+ }
+ }
+ }
+
+private:
+ std::ostream& stream;
+ AssertionResult const& result;
+ std::vector<MessageInfo> messages;
+ std::vector<MessageInfo>::const_iterator itMessage;
+ bool printInfoMessages;
+};
+
+} // anon namespace
+
+ std::string CompactReporter::getDescription() {
+ return "Reports test results on a single line, suitable for IDEs";
+ }
+
+ ReporterPreferences CompactReporter::getPreferences() const {
+ ReporterPreferences prefs;
+ prefs.shouldRedirectStdOut = false;
+ return prefs;
+ }
+
+ void CompactReporter::noMatchingTestCases( std::string const& spec ) {
+ stream << "No test cases matched '" << spec << '\'' << std::endl;
+ }
+
+ void CompactReporter::assertionStarting( AssertionInfo const& ) {}
+
+ bool CompactReporter::assertionEnded( AssertionStats const& _assertionStats ) {
+ AssertionResult const& result = _assertionStats.assertionResult;
+
+ bool printInfoMessages = true;
+
+ // Drop out if result was successful and we're not printing those
+ if( !m_config->includeSuccessfulResults() && result.isOk() ) {
+ if( result.getResultType() != ResultWas::Warning )
+ return false;
+ printInfoMessages = false;
+ }
+
+ AssertionPrinter printer( stream, _assertionStats, printInfoMessages );
+ printer.print();
+
+ stream << std::endl;
+ return true;
+ }
+
+ void CompactReporter::sectionEnded(SectionStats const& _sectionStats) {
+ if (m_config->showDurations() == ShowDurations::Always) {
+ stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl;
+ }
+ }
+
+ void CompactReporter::testRunEnded( TestRunStats const& _testRunStats ) {
+ printTotals( stream, _testRunStats.totals );
+ stream << '\n' << std::endl;
+ StreamingReporterBase::testRunEnded( _testRunStats );
+ }
+
+ CompactReporter::~CompactReporter() {}
+
+ CATCH_REGISTER_REPORTER( "compact", CompactReporter )
+
+} // end namespace Catch
+// end catch_reporter_compact.cpp
+// start catch_reporter_console.cpp
+
+#include <cfloat>
+#include <cstdio>
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch
+ // Note that 4062 (not all labels are handled
+ // and default is missing) is enabled
+#endif
+
+namespace Catch {
+
+namespace {
+
+// Formatter impl for ConsoleReporter
+class ConsoleAssertionPrinter {
+public:
+ ConsoleAssertionPrinter& operator= (ConsoleAssertionPrinter const&) = delete;
+ ConsoleAssertionPrinter(ConsoleAssertionPrinter const&) = delete;
+ ConsoleAssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages)
+ : stream(_stream),
+ stats(_stats),
+ result(_stats.assertionResult),
+ colour(Colour::None),
+ message(result.getMessage()),
+ messages(_stats.infoMessages),
+ printInfoMessages(_printInfoMessages) {
+ switch (result.getResultType()) {
+ case ResultWas::Ok:
+ colour = Colour::Success;
+ passOrFail = "PASSED";
+ //if( result.hasMessage() )
+ if (_stats.infoMessages.size() == 1)
+ messageLabel = "with message";
+ if (_stats.infoMessages.size() > 1)
+ messageLabel = "with messages";
+ break;
+ case ResultWas::ExpressionFailed:
+ if (result.isOk()) {
+ colour = Colour::Success;
+ passOrFail = "FAILED - but was ok";
+ } else {
+ colour = Colour::Error;
+ passOrFail = "FAILED";
+ }
+ if (_stats.infoMessages.size() == 1)
+ messageLabel = "with message";
+ if (_stats.infoMessages.size() > 1)
+ messageLabel = "with messages";
+ break;
+ case ResultWas::ThrewException:
+ colour = Colour::Error;
+ passOrFail = "FAILED";
+ messageLabel = "due to unexpected exception with ";
+ if (_stats.infoMessages.size() == 1)
+ messageLabel += "message";
+ if (_stats.infoMessages.size() > 1)
+ messageLabel += "messages";
+ break;
+ case ResultWas::FatalErrorCondition:
+ colour = Colour::Error;
+ passOrFail = "FAILED";
+ messageLabel = "due to a fatal error condition";
+ break;
+ case ResultWas::DidntThrowException:
+ colour = Colour::Error;
+ passOrFail = "FAILED";
+ messageLabel = "because no exception was thrown where one was expected";
+ break;
+ case ResultWas::Info:
+ messageLabel = "info";
+ break;
+ case ResultWas::Warning:
+ messageLabel = "warning";
+ break;
+ case ResultWas::ExplicitFailure:
+ passOrFail = "FAILED";
+ colour = Colour::Error;
+ if (_stats.infoMessages.size() == 1)
+ messageLabel = "explicitly with message";
+ if (_stats.infoMessages.size() > 1)
+ messageLabel = "explicitly with messages";
+ break;
+ // These cases are here to prevent compiler warnings
+ case ResultWas::Unknown:
+ case ResultWas::FailureBit:
+ case ResultWas::Exception:
+ passOrFail = "** internal error **";
+ colour = Colour::Error;
+ break;
+ }
+ }
+
+ void print() const {
+ printSourceInfo();
+ if (stats.totals.assertions.total() > 0) {
+ if (result.isOk())
+ stream << '\n';
+ printResultType();
+ printOriginalExpression();
+ printReconstructedExpression();
+ } else {
+ stream << '\n';
+ }
+ printMessage();
+ }
+
+private:
+ void printResultType() const {
+ if (!passOrFail.empty()) {
+ Colour colourGuard(colour);
+ stream << passOrFail << ":\n";
+ }
+ }
+ void printOriginalExpression() const {
+ if (result.hasExpression()) {
+ Colour colourGuard(Colour::OriginalExpression);
+ stream << " ";
+ stream << result.getExpressionInMacro();
+ stream << '\n';
+ }
+ }
+ void printReconstructedExpression() const {
+ if (result.hasExpandedExpression()) {
+ stream << "with expansion:\n";
+ Colour colourGuard(Colour::ReconstructedExpression);
+ stream << Column(result.getExpandedExpression()).indent(2) << '\n';
+ }
+ }
+ void printMessage() const {
+ if (!messageLabel.empty())
+ stream << messageLabel << ':' << '\n';
+ for (auto const& msg : messages) {
+ // If this assertion is a warning ignore any INFO messages
+ if (printInfoMessages || msg.type != ResultWas::Info)
+ stream << Column(msg.message).indent(2) << '\n';
+ }
+ }
+ void printSourceInfo() const {
+ Colour colourGuard(Colour::FileName);
+ stream << result.getSourceInfo() << ": ";
+ }
+
+ std::ostream& stream;
+ AssertionStats const& stats;
+ AssertionResult const& result;
+ Colour::Code colour;
+ std::string passOrFail;
+ std::string messageLabel;
+ std::string message;
+ std::vector<MessageInfo> messages;
+ bool printInfoMessages;
+};
+
+std::size_t makeRatio(std::size_t number, std::size_t total) {
+ std::size_t ratio = total > 0 ? CATCH_CONFIG_CONSOLE_WIDTH * number / total : 0;
+ return (ratio == 0 && number > 0) ? 1 : ratio;
+}
+
+std::size_t& findMax(std::size_t& i, std::size_t& j, std::size_t& k) {
+ if (i > j && i > k)
+ return i;
+ else if (j > k)
+ return j;
+ else
+ return k;
+}
+
+struct ColumnInfo {
+ enum Justification { Left, Right };
+ std::string name;
+ int width;
+ Justification justification;
+};
+struct ColumnBreak {};
+struct RowBreak {};
+
+class Duration {
+ enum class Unit {
+ Auto,
+ Nanoseconds,
+ Microseconds,
+ Milliseconds,
+ Seconds,
+ Minutes
+ };
+ static const uint64_t s_nanosecondsInAMicrosecond = 1000;
+ static const uint64_t s_nanosecondsInAMillisecond = 1000 * s_nanosecondsInAMicrosecond;
+ static const uint64_t s_nanosecondsInASecond = 1000 * s_nanosecondsInAMillisecond;
+ static const uint64_t s_nanosecondsInAMinute = 60 * s_nanosecondsInASecond;
+
+ uint64_t m_inNanoseconds;
+ Unit m_units;
+
+public:
+ explicit Duration(uint64_t inNanoseconds, Unit units = Unit::Auto)
+ : m_inNanoseconds(inNanoseconds),
+ m_units(units) {
+ if (m_units == Unit::Auto) {
+ if (m_inNanoseconds < s_nanosecondsInAMicrosecond)
+ m_units = Unit::Nanoseconds;
+ else if (m_inNanoseconds < s_nanosecondsInAMillisecond)
+ m_units = Unit::Microseconds;
+ else if (m_inNanoseconds < s_nanosecondsInASecond)
+ m_units = Unit::Milliseconds;
+ else if (m_inNanoseconds < s_nanosecondsInAMinute)
+ m_units = Unit::Seconds;
+ else
+ m_units = Unit::Minutes;
+ }
+
+ }
+
+ auto value() const -> double {
+ switch (m_units) {
+ case Unit::Microseconds:
+ return m_inNanoseconds / static_cast<double>(s_nanosecondsInAMicrosecond);
+ case Unit::Milliseconds:
+ return m_inNanoseconds / static_cast<double>(s_nanosecondsInAMillisecond);
+ case Unit::Seconds:
+ return m_inNanoseconds / static_cast<double>(s_nanosecondsInASecond);
+ case Unit::Minutes:
+ return m_inNanoseconds / static_cast<double>(s_nanosecondsInAMinute);
+ default:
+ return static_cast<double>(m_inNanoseconds);
+ }
+ }
+ auto unitsAsString() const -> std::string {
+ switch (m_units) {
+ case Unit::Nanoseconds:
+ return "ns";
+ case Unit::Microseconds:
+ return "µs";
+ case Unit::Milliseconds:
+ return "ms";
+ case Unit::Seconds:
+ return "s";
+ case Unit::Minutes:
+ return "m";
+ default:
+ return "** internal error **";
+ }
+
+ }
+ friend auto operator << (std::ostream& os, Duration const& duration) -> std::ostream& {
+ return os << duration.value() << " " << duration.unitsAsString();
+ }
+};
+} // end anon namespace
+
+class TablePrinter {
+ std::ostream& m_os;
+ std::vector<ColumnInfo> m_columnInfos;
+ std::ostringstream m_oss;
+ int m_currentColumn = -1;
+ bool m_isOpen = false;
+
+public:
+ TablePrinter( std::ostream& os, std::vector<ColumnInfo> columnInfos )
+ : m_os( os ),
+ m_columnInfos( std::move( columnInfos ) ) {}
+
+ auto columnInfos() const -> std::vector<ColumnInfo> const& {
+ return m_columnInfos;
+ }
+
+ void open() {
+ if (!m_isOpen) {
+ m_isOpen = true;
+ *this << RowBreak();
+ for (auto const& info : m_columnInfos)
+ *this << info.name << ColumnBreak();
+ *this << RowBreak();
+ m_os << Catch::getLineOfChars<'-'>() << "\n";
+ }
+ }
+ void close() {
+ if (m_isOpen) {
+ *this << RowBreak();
+ m_os << std::endl;
+ m_isOpen = false;
+ }
+ }
+
+ template<typename T>
+ friend TablePrinter& operator << (TablePrinter& tp, T const& value) {
+ tp.m_oss << value;
+ return tp;
+ }
+
+ friend TablePrinter& operator << (TablePrinter& tp, ColumnBreak) {
+ auto colStr = tp.m_oss.str();
+ // This takes account of utf8 encodings
+ auto strSize = Catch::StringRef(colStr).numberOfCharacters();
+ tp.m_oss.str("");
+ tp.open();
+ if (tp.m_currentColumn == static_cast<int>(tp.m_columnInfos.size() - 1)) {
+ tp.m_currentColumn = -1;
+ tp.m_os << "\n";
+ }
+ tp.m_currentColumn++;
+
+ auto colInfo = tp.m_columnInfos[tp.m_currentColumn];
+ auto padding = (strSize + 2 < static_cast<std::size_t>(colInfo.width))
+ ? std::string(colInfo.width - (strSize + 2), ' ')
+ : std::string();
+ if (colInfo.justification == ColumnInfo::Left)
+ tp.m_os << colStr << padding << " ";
+ else
+ tp.m_os << padding << colStr << " ";
+ return tp;
+ }
+
+ friend TablePrinter& operator << (TablePrinter& tp, RowBreak) {
+ if (tp.m_currentColumn > 0) {
+ tp.m_os << "\n";
+ tp.m_currentColumn = -1;
+ }
+ return tp;
+ }
+};
+
+ConsoleReporter::ConsoleReporter(ReporterConfig const& config)
+ : StreamingReporterBase(config),
+ m_tablePrinter(new TablePrinter(config.stream(),
+ {
+ { "benchmark name", CATCH_CONFIG_CONSOLE_WIDTH - 32, ColumnInfo::Left },
+ { "iters", 8, ColumnInfo::Right },
+ { "elapsed ns", 14, ColumnInfo::Right },
+ { "average", 14, ColumnInfo::Right }
+ })) {}
+ConsoleReporter::~ConsoleReporter() = default;
+
+std::string ConsoleReporter::getDescription() {
+ return "Reports test results as plain lines of text";
+}
+
+void ConsoleReporter::noMatchingTestCases(std::string const& spec) {
+ stream << "No test cases matched '" << spec << '\'' << std::endl;
+}
+
+void ConsoleReporter::assertionStarting(AssertionInfo const&) {}
+
+bool ConsoleReporter::assertionEnded(AssertionStats const& _assertionStats) {
+ AssertionResult const& result = _assertionStats.assertionResult;
+
+ bool includeResults = m_config->includeSuccessfulResults() || !result.isOk();
+
+ // Drop out if result was successful but we're not printing them.
+ if (!includeResults && result.getResultType() != ResultWas::Warning)
+ return false;
+
+ lazyPrint();
+
+ ConsoleAssertionPrinter printer(stream, _assertionStats, includeResults);
+ printer.print();
+ stream << std::endl;
+ return true;
+}
+
+void ConsoleReporter::sectionStarting(SectionInfo const& _sectionInfo) {
+ m_headerPrinted = false;
+ StreamingReporterBase::sectionStarting(_sectionInfo);
+}
+void ConsoleReporter::sectionEnded(SectionStats const& _sectionStats) {
+ m_tablePrinter->close();
+ if (_sectionStats.missingAssertions) {
+ lazyPrint();
+ Colour colour(Colour::ResultError);
+ if (m_sectionStack.size() > 1)
+ stream << "\nNo assertions in section";
+ else
+ stream << "\nNo assertions in test case";
+ stream << " '" << _sectionStats.sectionInfo.name << "'\n" << std::endl;
+ }
+ if (m_config->showDurations() == ShowDurations::Always) {
+ stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl;
+ }
+ if (m_headerPrinted) {
+ m_headerPrinted = false;
+ }
+ StreamingReporterBase::sectionEnded(_sectionStats);
+}
+
+void ConsoleReporter::benchmarkStarting(BenchmarkInfo const& info) {
+ lazyPrintWithoutClosingBenchmarkTable();
+
+ auto nameCol = Column( info.name ).width( static_cast<std::size_t>( m_tablePrinter->columnInfos()[0].width - 2 ) );
+
+ bool firstLine = true;
+ for (auto line : nameCol) {
+ if (!firstLine)
+ (*m_tablePrinter) << ColumnBreak() << ColumnBreak() << ColumnBreak();
+ else
+ firstLine = false;
+
+ (*m_tablePrinter) << line << ColumnBreak();
+ }
+}
+void ConsoleReporter::benchmarkEnded(BenchmarkStats const& stats) {
+ Duration average(stats.elapsedTimeInNanoseconds / stats.iterations);
+ (*m_tablePrinter)
+ << stats.iterations << ColumnBreak()
+ << stats.elapsedTimeInNanoseconds << ColumnBreak()
+ << average << ColumnBreak();
+}
+
+void ConsoleReporter::testCaseEnded(TestCaseStats const& _testCaseStats) {
+ m_tablePrinter->close();
+ StreamingReporterBase::testCaseEnded(_testCaseStats);
+ m_headerPrinted = false;
+}
+void ConsoleReporter::testGroupEnded(TestGroupStats const& _testGroupStats) {
+ if (currentGroupInfo.used) {
+ printSummaryDivider();
+ stream << "Summary for group '" << _testGroupStats.groupInfo.name << "':\n";
+ printTotals(_testGroupStats.totals);
+ stream << '\n' << std::endl;
+ }
+ StreamingReporterBase::testGroupEnded(_testGroupStats);
+}
+void ConsoleReporter::testRunEnded(TestRunStats const& _testRunStats) {
+ printTotalsDivider(_testRunStats.totals);
+ printTotals(_testRunStats.totals);
+ stream << std::endl;
+ StreamingReporterBase::testRunEnded(_testRunStats);
+}
+
+void ConsoleReporter::lazyPrint() {
+
+ m_tablePrinter->close();
+ lazyPrintWithoutClosingBenchmarkTable();
+}
+
+void ConsoleReporter::lazyPrintWithoutClosingBenchmarkTable() {
+
+ if (!currentTestRunInfo.used)
+ lazyPrintRunInfo();
+ if (!currentGroupInfo.used)
+ lazyPrintGroupInfo();
+
+ if (!m_headerPrinted) {
+ printTestCaseAndSectionHeader();
+ m_headerPrinted = true;
+ }
+}
+void ConsoleReporter::lazyPrintRunInfo() {
+ stream << '\n' << getLineOfChars<'~'>() << '\n';
+ Colour colour(Colour::SecondaryText);
+ stream << currentTestRunInfo->name
+ << " is a Catch v" << libraryVersion() << " host application.\n"
+ << "Run with -? for options\n\n";
+
+ if (m_config->rngSeed() != 0)
+ stream << "Randomness seeded to: " << m_config->rngSeed() << "\n\n";
+
+ currentTestRunInfo.used = true;
+}
+void ConsoleReporter::lazyPrintGroupInfo() {
+ if (!currentGroupInfo->name.empty() && currentGroupInfo->groupsCounts > 1) {
+ printClosedHeader("Group: " + currentGroupInfo->name);
+ currentGroupInfo.used = true;
+ }
+}
+void ConsoleReporter::printTestCaseAndSectionHeader() {
+ assert(!m_sectionStack.empty());
+ printOpenHeader(currentTestCaseInfo->name);
+
+ if (m_sectionStack.size() > 1) {
+ Colour colourGuard(Colour::Headers);
+
+ auto
+ it = m_sectionStack.begin() + 1, // Skip first section (test case)
+ itEnd = m_sectionStack.end();
+ for (; it != itEnd; ++it)
+ printHeaderString(it->name, 2);
+ }
+
+ SourceLineInfo lineInfo = m_sectionStack.back().lineInfo;
+
+ if (!lineInfo.empty()) {
+ stream << getLineOfChars<'-'>() << '\n';
+ Colour colourGuard(Colour::FileName);
+ stream << lineInfo << '\n';
+ }
+ stream << getLineOfChars<'.'>() << '\n' << std::endl;
+}
+
+void ConsoleReporter::printClosedHeader(std::string const& _name) {
+ printOpenHeader(_name);
+ stream << getLineOfChars<'.'>() << '\n';
+}
+void ConsoleReporter::printOpenHeader(std::string const& _name) {
+ stream << getLineOfChars<'-'>() << '\n';
+ {
+ Colour colourGuard(Colour::Headers);
+ printHeaderString(_name);
+ }
+}
+
+// if string has a : in first line will set indent to follow it on
+// subsequent lines
+void ConsoleReporter::printHeaderString(std::string const& _string, std::size_t indent) {
+ std::size_t i = _string.find(": ");
+ if (i != std::string::npos)
+ i += 2;
+ else
+ i = 0;
+ stream << Column(_string).indent(indent + i).initialIndent(indent) << '\n';
+}
+
+struct SummaryColumn {
+
+ SummaryColumn( std::string _label, Colour::Code _colour )
+ : label( std::move( _label ) ),
+ colour( _colour ) {}
+ SummaryColumn addRow( std::size_t count ) {
+ ReusableStringStream rss;
+ rss << count;
+ std::string row = rss.str();
+ for (auto& oldRow : rows) {
+ while (oldRow.size() < row.size())
+ oldRow = ' ' + oldRow;
+ while (oldRow.size() > row.size())
+ row = ' ' + row;
+ }
+ rows.push_back(row);
+ return *this;
+ }
+
+ std::string label;
+ Colour::Code colour;
+ std::vector<std::string> rows;
+
+};
+
+void ConsoleReporter::printTotals( Totals const& totals ) {
+ if (totals.testCases.total() == 0) {
+ stream << Colour(Colour::Warning) << "No tests ran\n";
+ } else if (totals.assertions.total() > 0 && totals.testCases.allPassed()) {
+ stream << Colour(Colour::ResultSuccess) << "All tests passed";
+ stream << " ("
+ << pluralise(totals.assertions.passed, "assertion") << " in "
+ << pluralise(totals.testCases.passed, "test case") << ')'
+ << '\n';
+ } else {
+
+ std::vector<SummaryColumn> columns;
+ columns.push_back(SummaryColumn("", Colour::None)
+ .addRow(totals.testCases.total())
+ .addRow(totals.assertions.total()));
+ columns.push_back(SummaryColumn("passed", Colour::Success)
+ .addRow(totals.testCases.passed)
+ .addRow(totals.assertions.passed));
+ columns.push_back(SummaryColumn("failed", Colour::ResultError)
+ .addRow(totals.testCases.failed)
+ .addRow(totals.assertions.failed));
+ columns.push_back(SummaryColumn("failed as expected", Colour::ResultExpectedFailure)
+ .addRow(totals.testCases.failedButOk)
+ .addRow(totals.assertions.failedButOk));
+
+ printSummaryRow("test cases", columns, 0);
+ printSummaryRow("assertions", columns, 1);
+ }
+}
+void ConsoleReporter::printSummaryRow(std::string const& label, std::vector<SummaryColumn> const& cols, std::size_t row) {
+ for (auto col : cols) {
+ std::string value = col.rows[row];
+ if (col.label.empty()) {
+ stream << label << ": ";
+ if (value != "0")
+ stream << value;
+ else
+ stream << Colour(Colour::Warning) << "- none -";
+ } else if (value != "0") {
+ stream << Colour(Colour::LightGrey) << " | ";
+ stream << Colour(col.colour)
+ << value << ' ' << col.label;
+ }
+ }
+ stream << '\n';
+}
+
+void ConsoleReporter::printTotalsDivider(Totals const& totals) {
+ if (totals.testCases.total() > 0) {
+ std::size_t failedRatio = makeRatio(totals.testCases.failed, totals.testCases.total());
+ std::size_t failedButOkRatio = makeRatio(totals.testCases.failedButOk, totals.testCases.total());
+ std::size_t passedRatio = makeRatio(totals.testCases.passed, totals.testCases.total());
+ while (failedRatio + failedButOkRatio + passedRatio < CATCH_CONFIG_CONSOLE_WIDTH - 1)
+ findMax(failedRatio, failedButOkRatio, passedRatio)++;
+ while (failedRatio + failedButOkRatio + passedRatio > CATCH_CONFIG_CONSOLE_WIDTH - 1)
+ findMax(failedRatio, failedButOkRatio, passedRatio)--;
+
+ stream << Colour(Colour::Error) << std::string(failedRatio, '=');
+ stream << Colour(Colour::ResultExpectedFailure) << std::string(failedButOkRatio, '=');
+ if (totals.testCases.allPassed())
+ stream << Colour(Colour::ResultSuccess) << std::string(passedRatio, '=');
+ else
+ stream << Colour(Colour::Success) << std::string(passedRatio, '=');
+ } else {
+ stream << Colour(Colour::Warning) << std::string(CATCH_CONFIG_CONSOLE_WIDTH - 1, '=');
+ }
+ stream << '\n';
+}
+void ConsoleReporter::printSummaryDivider() {
+ stream << getLineOfChars<'-'>() << '\n';
+}
+
+CATCH_REGISTER_REPORTER("console", ConsoleReporter)
+
+} // end namespace Catch
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif
+// end catch_reporter_console.cpp
+// start catch_reporter_junit.cpp
+
+#include <assert.h>
+#include <sstream>
+#include <ctime>
+#include <algorithm>
+
+namespace Catch {
+
+ namespace {
+ std::string getCurrentTimestamp() {
+ // Beware, this is not reentrant because of backward compatibility issues
+ // Also, UTC only, again because of backward compatibility (%z is C++11)
+ time_t rawtime;
+ std::time(&rawtime);
+ auto const timeStampSize = sizeof("2017-01-16T17:06:45Z");
+
+#ifdef _MSC_VER
+ std::tm timeInfo = {};
+ gmtime_s(&timeInfo, &rawtime);
+#else
+ std::tm* timeInfo;
+ timeInfo = std::gmtime(&rawtime);
+#endif
+
+ char timeStamp[timeStampSize];
+ const char * const fmt = "%Y-%m-%dT%H:%M:%SZ";
+
+#ifdef _MSC_VER
+ std::strftime(timeStamp, timeStampSize, fmt, &timeInfo);
+#else
+ std::strftime(timeStamp, timeStampSize, fmt, timeInfo);
+#endif
+ return std::string(timeStamp);
+ }
+
+ std::string fileNameTag(const std::vector<std::string> &tags) {
+ auto it = std::find_if(begin(tags),
+ end(tags),
+ [] (std::string const& tag) {return tag.front() == '#'; });
+ if (it != tags.end())
+ return it->substr(1);
+ return std::string();
+ }
+ } // anonymous namespace
+
+ JunitReporter::JunitReporter( ReporterConfig const& _config )
+ : CumulativeReporterBase( _config ),
+ xml( _config.stream() )
+ {
+ m_reporterPrefs.shouldRedirectStdOut = true;
+ }
+
+ JunitReporter::~JunitReporter() {};
+
+ std::string JunitReporter::getDescription() {
+ return "Reports test results in an XML format that looks like Ant's junitreport target";
+ }
+
+ void JunitReporter::noMatchingTestCases( std::string const& /*spec*/ ) {}
+
+ void JunitReporter::testRunStarting( TestRunInfo const& runInfo ) {
+ CumulativeReporterBase::testRunStarting( runInfo );
+ xml.startElement( "testsuites" );
+ }
+
+ void JunitReporter::testGroupStarting( GroupInfo const& groupInfo ) {
+ suiteTimer.start();
+ stdOutForSuite.clear();
+ stdErrForSuite.clear();
+ unexpectedExceptions = 0;
+ CumulativeReporterBase::testGroupStarting( groupInfo );
+ }
+
+ void JunitReporter::testCaseStarting( TestCaseInfo const& testCaseInfo ) {
+ m_okToFail = testCaseInfo.okToFail();
+ }
+
+ bool JunitReporter::assertionEnded( AssertionStats const& assertionStats ) {
+ if( assertionStats.assertionResult.getResultType() == ResultWas::ThrewException && !m_okToFail )
+ unexpectedExceptions++;
+ return CumulativeReporterBase::assertionEnded( assertionStats );
+ }
+
+ void JunitReporter::testCaseEnded( TestCaseStats const& testCaseStats ) {
+ stdOutForSuite += testCaseStats.stdOut;
+ stdErrForSuite += testCaseStats.stdErr;
+ CumulativeReporterBase::testCaseEnded( testCaseStats );
+ }
+
+ void JunitReporter::testGroupEnded( TestGroupStats const& testGroupStats ) {
+ double suiteTime = suiteTimer.getElapsedSeconds();
+ CumulativeReporterBase::testGroupEnded( testGroupStats );
+ writeGroup( *m_testGroups.back(), suiteTime );
+ }
+
+ void JunitReporter::testRunEndedCumulative() {
+ xml.endElement();
+ }
+
+ void JunitReporter::writeGroup( TestGroupNode const& groupNode, double suiteTime ) {
+ XmlWriter::ScopedElement e = xml.scopedElement( "testsuite" );
+ TestGroupStats const& stats = groupNode.value;
+ xml.writeAttribute( "name", stats.groupInfo.name );
+ xml.writeAttribute( "errors", unexpectedExceptions );
+ xml.writeAttribute( "failures", stats.totals.assertions.failed-unexpectedExceptions );
+ xml.writeAttribute( "tests", stats.totals.assertions.total() );
+ xml.writeAttribute( "hostname", "tbd" ); // !TBD
+ if( m_config->showDurations() == ShowDurations::Never )
+ xml.writeAttribute( "time", "" );
+ else
+ xml.writeAttribute( "time", suiteTime );
+ xml.writeAttribute( "timestamp", getCurrentTimestamp() );
+
+ // Write test cases
+ for( auto const& child : groupNode.children )
+ writeTestCase( *child );
+
+ xml.scopedElement( "system-out" ).writeText( trim( stdOutForSuite ), false );
+ xml.scopedElement( "system-err" ).writeText( trim( stdErrForSuite ), false );
+ }
+
+ void JunitReporter::writeTestCase( TestCaseNode const& testCaseNode ) {
+ TestCaseStats const& stats = testCaseNode.value;
+
+ // All test cases have exactly one section - which represents the
+ // test case itself. That section may have 0-n nested sections
+ assert( testCaseNode.children.size() == 1 );
+ SectionNode const& rootSection = *testCaseNode.children.front();
+
+ std::string className = stats.testInfo.className;
+
+ if( className.empty() ) {
+ className = fileNameTag(stats.testInfo.tags);
+ if ( className.empty() )
+ className = "global";
+ }
+
+ if ( !m_config->name().empty() )
+ className = m_config->name() + "." + className;
+
+ writeSection( className, "", rootSection );
+ }
+
+ void JunitReporter::writeSection( std::string const& className,
+ std::string const& rootName,
+ SectionNode const& sectionNode ) {
+ std::string name = trim( sectionNode.stats.sectionInfo.name );
+ if( !rootName.empty() )
+ name = rootName + '/' + name;
+
+ if( !sectionNode.assertions.empty() ||
+ !sectionNode.stdOut.empty() ||
+ !sectionNode.stdErr.empty() ) {
+ XmlWriter::ScopedElement e = xml.scopedElement( "testcase" );
+ if( className.empty() ) {
+ xml.writeAttribute( "classname", name );
+ xml.writeAttribute( "name", "root" );
+ }
+ else {
+ xml.writeAttribute( "classname", className );
+ xml.writeAttribute( "name", name );
+ }
+ xml.writeAttribute( "time", ::Catch::Detail::stringify( sectionNode.stats.durationInSeconds ) );
+
+ writeAssertions( sectionNode );
+
+ if( !sectionNode.stdOut.empty() )
+ xml.scopedElement( "system-out" ).writeText( trim( sectionNode.stdOut ), false );
+ if( !sectionNode.stdErr.empty() )
+ xml.scopedElement( "system-err" ).writeText( trim( sectionNode.stdErr ), false );
+ }
+ for( auto const& childNode : sectionNode.childSections )
+ if( className.empty() )
+ writeSection( name, "", *childNode );
+ else
+ writeSection( className, name, *childNode );
+ }
+
+ void JunitReporter::writeAssertions( SectionNode const& sectionNode ) {
+ for( auto const& assertion : sectionNode.assertions )
+ writeAssertion( assertion );
+ }
+
+ void JunitReporter::writeAssertion( AssertionStats const& stats ) {
+ AssertionResult const& result = stats.assertionResult;
+ if( !result.isOk() ) {
+ std::string elementName;
+ switch( result.getResultType() ) {
+ case ResultWas::ThrewException:
+ case ResultWas::FatalErrorCondition:
+ elementName = "error";
+ break;
+ case ResultWas::ExplicitFailure:
+ elementName = "failure";
+ break;
+ case ResultWas::ExpressionFailed:
+ elementName = "failure";
+ break;
+ case ResultWas::DidntThrowException:
+ elementName = "failure";
+ break;
+
+ // We should never see these here:
+ case ResultWas::Info:
+ case ResultWas::Warning:
+ case ResultWas::Ok:
+ case ResultWas::Unknown:
+ case ResultWas::FailureBit:
+ case ResultWas::Exception:
+ elementName = "internalError";
+ break;
+ }
+
+ XmlWriter::ScopedElement e = xml.scopedElement( elementName );
+
+ xml.writeAttribute( "message", result.getExpandedExpression() );
+ xml.writeAttribute( "type", result.getTestMacroName() );
+
+ ReusableStringStream rss;
+ if( !result.getMessage().empty() )
+ rss << result.getMessage() << '\n';
+ for( auto const& msg : stats.infoMessages )
+ if( msg.type == ResultWas::Info )
+ rss << msg.message << '\n';
+
+ rss << "at " << result.getSourceInfo();
+ xml.writeText( rss.str(), false );
+ }
+ }
+
+ CATCH_REGISTER_REPORTER( "junit", JunitReporter )
+
+} // end namespace Catch
+// end catch_reporter_junit.cpp
+// start catch_reporter_multi.cpp
+
+namespace Catch {
+
+ void MultipleReporters::add( IStreamingReporterPtr&& reporter ) {
+ m_reporters.push_back( std::move( reporter ) );
+ }
+
+ ReporterPreferences MultipleReporters::getPreferences() const {
+ return m_reporters[0]->getPreferences();
+ }
+
+ std::set<Verbosity> MultipleReporters::getSupportedVerbosities() {
+ return std::set<Verbosity>{ };
+ }
+
+ void MultipleReporters::noMatchingTestCases( std::string const& spec ) {
+ for( auto const& reporter : m_reporters )
+ reporter->noMatchingTestCases( spec );
+ }
+
+ void MultipleReporters::benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) {
+ for( auto const& reporter : m_reporters )
+ reporter->benchmarkStarting( benchmarkInfo );
+ }
+ void MultipleReporters::benchmarkEnded( BenchmarkStats const& benchmarkStats ) {
+ for( auto const& reporter : m_reporters )
+ reporter->benchmarkEnded( benchmarkStats );
+ }
+
+ void MultipleReporters::testRunStarting( TestRunInfo const& testRunInfo ) {
+ for( auto const& reporter : m_reporters )
+ reporter->testRunStarting( testRunInfo );
+ }
+
+ void MultipleReporters::testGroupStarting( GroupInfo const& groupInfo ) {
+ for( auto const& reporter : m_reporters )
+ reporter->testGroupStarting( groupInfo );
+ }
+
+ void MultipleReporters::testCaseStarting( TestCaseInfo const& testInfo ) {
+ for( auto const& reporter : m_reporters )
+ reporter->testCaseStarting( testInfo );
+ }
+
+ void MultipleReporters::sectionStarting( SectionInfo const& sectionInfo ) {
+ for( auto const& reporter : m_reporters )
+ reporter->sectionStarting( sectionInfo );
+ }
+
+ void MultipleReporters::assertionStarting( AssertionInfo const& assertionInfo ) {
+ for( auto const& reporter : m_reporters )
+ reporter->assertionStarting( assertionInfo );
+ }
+
+ // The return value indicates if the messages buffer should be cleared:
+ bool MultipleReporters::assertionEnded( AssertionStats const& assertionStats ) {
+ bool clearBuffer = false;
+ for( auto const& reporter : m_reporters )
+ clearBuffer |= reporter->assertionEnded( assertionStats );
+ return clearBuffer;
+ }
+
+ void MultipleReporters::sectionEnded( SectionStats const& sectionStats ) {
+ for( auto const& reporter : m_reporters )
+ reporter->sectionEnded( sectionStats );
+ }
+
+ void MultipleReporters::testCaseEnded( TestCaseStats const& testCaseStats ) {
+ for( auto const& reporter : m_reporters )
+ reporter->testCaseEnded( testCaseStats );
+ }
+
+ void MultipleReporters::testGroupEnded( TestGroupStats const& testGroupStats ) {
+ for( auto const& reporter : m_reporters )
+ reporter->testGroupEnded( testGroupStats );
+ }
+
+ void MultipleReporters::testRunEnded( TestRunStats const& testRunStats ) {
+ for( auto const& reporter : m_reporters )
+ reporter->testRunEnded( testRunStats );
+ }
+
+ void MultipleReporters::skipTest( TestCaseInfo const& testInfo ) {
+ for( auto const& reporter : m_reporters )
+ reporter->skipTest( testInfo );
+ }
+
+ bool MultipleReporters::isMulti() const {
+ return true;
+ }
+
+} // end namespace Catch
+// end catch_reporter_multi.cpp
+// start catch_reporter_xml.cpp
+
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch
+ // Note that 4062 (not all labels are handled
+ // and default is missing) is enabled
+#endif
+
+namespace Catch {
+ XmlReporter::XmlReporter( ReporterConfig const& _config )
+ : StreamingReporterBase( _config ),
+ m_xml(_config.stream())
+ {
+ m_reporterPrefs.shouldRedirectStdOut = true;
+ }
+
+ XmlReporter::~XmlReporter() = default;
+
+ std::string XmlReporter::getDescription() {
+ return "Reports test results as an XML document";
+ }
+
+ std::string XmlReporter::getStylesheetRef() const {
+ return std::string();
+ }
+
+ void XmlReporter::writeSourceInfo( SourceLineInfo const& sourceInfo ) {
+ m_xml
+ .writeAttribute( "filename", sourceInfo.file )
+ .writeAttribute( "line", sourceInfo.line );
+ }
+
+ void XmlReporter::noMatchingTestCases( std::string const& s ) {
+ StreamingReporterBase::noMatchingTestCases( s );
+ }
+
+ void XmlReporter::testRunStarting( TestRunInfo const& testInfo ) {
+ StreamingReporterBase::testRunStarting( testInfo );
+ std::string stylesheetRef = getStylesheetRef();
+ if( !stylesheetRef.empty() )
+ m_xml.writeStylesheetRef( stylesheetRef );
+ m_xml.startElement( "Catch" );
+ if( !m_config->name().empty() )
+ m_xml.writeAttribute( "name", m_config->name() );
+ }
+
+ void XmlReporter::testGroupStarting( GroupInfo const& groupInfo ) {
+ StreamingReporterBase::testGroupStarting( groupInfo );
+ m_xml.startElement( "Group" )
+ .writeAttribute( "name", groupInfo.name );
+ }
+
+ void XmlReporter::testCaseStarting( TestCaseInfo const& testInfo ) {
+ StreamingReporterBase::testCaseStarting(testInfo);
+ m_xml.startElement( "TestCase" )
+ .writeAttribute( "name", trim( testInfo.name ) )
+ .writeAttribute( "description", testInfo.description )
+ .writeAttribute( "tags", testInfo.tagsAsString() );
+
+ writeSourceInfo( testInfo.lineInfo );
+
+ if ( m_config->showDurations() == ShowDurations::Always )
+ m_testCaseTimer.start();
+ m_xml.ensureTagClosed();
+ }
+
+ void XmlReporter::sectionStarting( SectionInfo const& sectionInfo ) {
+ StreamingReporterBase::sectionStarting( sectionInfo );
+ if( m_sectionDepth++ > 0 ) {
+ m_xml.startElement( "Section" )
+ .writeAttribute( "name", trim( sectionInfo.name ) )
+ .writeAttribute( "description", sectionInfo.description );
+ writeSourceInfo( sectionInfo.lineInfo );
+ m_xml.ensureTagClosed();
+ }
+ }
+
+ void XmlReporter::assertionStarting( AssertionInfo const& ) { }
+
+ bool XmlReporter::assertionEnded( AssertionStats const& assertionStats ) {
+
+ AssertionResult const& result = assertionStats.assertionResult;
+
+ bool includeResults = m_config->includeSuccessfulResults() || !result.isOk();
+
+ if( includeResults || result.getResultType() == ResultWas::Warning ) {
+ // Print any info messages in <Info> tags.
+ for( auto const& msg : assertionStats.infoMessages ) {
+ if( msg.type == ResultWas::Info && includeResults ) {
+ m_xml.scopedElement( "Info" )
+ .writeText( msg.message );
+ } else if ( msg.type == ResultWas::Warning ) {
+ m_xml.scopedElement( "Warning" )
+ .writeText( msg.message );
+ }
+ }
+ }
+
+ // Drop out if result was successful but we're not printing them.
+ if( !includeResults && result.getResultType() != ResultWas::Warning )
+ return true;
+
+ // Print the expression if there is one.
+ if( result.hasExpression() ) {
+ m_xml.startElement( "Expression" )
+ .writeAttribute( "success", result.succeeded() )
+ .writeAttribute( "type", result.getTestMacroName() );
+
+ writeSourceInfo( result.getSourceInfo() );
+
+ m_xml.scopedElement( "Original" )
+ .writeText( result.getExpression() );
+ m_xml.scopedElement( "Expanded" )
+ .writeText( result.getExpandedExpression() );
+ }
+
+ // And... Print a result applicable to each result type.
+ switch( result.getResultType() ) {
+ case ResultWas::ThrewException:
+ m_xml.startElement( "Exception" );
+ writeSourceInfo( result.getSourceInfo() );
+ m_xml.writeText( result.getMessage() );
+ m_xml.endElement();
+ break;
+ case ResultWas::FatalErrorCondition:
+ m_xml.startElement( "FatalErrorCondition" );
+ writeSourceInfo( result.getSourceInfo() );
+ m_xml.writeText( result.getMessage() );
+ m_xml.endElement();
+ break;
+ case ResultWas::Info:
+ m_xml.scopedElement( "Info" )
+ .writeText( result.getMessage() );
+ break;
+ case ResultWas::Warning:
+ // Warning will already have been written
+ break;
+ case ResultWas::ExplicitFailure:
+ m_xml.startElement( "Failure" );
+ writeSourceInfo( result.getSourceInfo() );
+ m_xml.writeText( result.getMessage() );
+ m_xml.endElement();
+ break;
+ default:
+ break;
+ }
+
+ if( result.hasExpression() )
+ m_xml.endElement();
+
+ return true;
+ }
+
+ void XmlReporter::sectionEnded( SectionStats const& sectionStats ) {
+ StreamingReporterBase::sectionEnded( sectionStats );
+ if( --m_sectionDepth > 0 ) {
+ XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResults" );
+ e.writeAttribute( "successes", sectionStats.assertions.passed );
+ e.writeAttribute( "failures", sectionStats.assertions.failed );
+ e.writeAttribute( "expectedFailures", sectionStats.assertions.failedButOk );
+
+ if ( m_config->showDurations() == ShowDurations::Always )
+ e.writeAttribute( "durationInSeconds", sectionStats.durationInSeconds );
+
+ m_xml.endElement();
+ }
+ }
+
+ void XmlReporter::testCaseEnded( TestCaseStats const& testCaseStats ) {
+ StreamingReporterBase::testCaseEnded( testCaseStats );
+ XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResult" );
+ e.writeAttribute( "success", testCaseStats.totals.assertions.allOk() );
+
+ if ( m_config->showDurations() == ShowDurations::Always )
+ e.writeAttribute( "durationInSeconds", m_testCaseTimer.getElapsedSeconds() );
+
+ if( !testCaseStats.stdOut.empty() )
+ m_xml.scopedElement( "StdOut" ).writeText( trim( testCaseStats.stdOut ), false );
+ if( !testCaseStats.stdErr.empty() )
+ m_xml.scopedElement( "StdErr" ).writeText( trim( testCaseStats.stdErr ), false );
+
+ m_xml.endElement();
+ }
+
+ void XmlReporter::testGroupEnded( TestGroupStats const& testGroupStats ) {
+ StreamingReporterBase::testGroupEnded( testGroupStats );
+ // TODO: Check testGroupStats.aborting and act accordingly.
+ m_xml.scopedElement( "OverallResults" )
+ .writeAttribute( "successes", testGroupStats.totals.assertions.passed )
+ .writeAttribute( "failures", testGroupStats.totals.assertions.failed )
+ .writeAttribute( "expectedFailures", testGroupStats.totals.assertions.failedButOk );
+ m_xml.endElement();
+ }
+
+ void XmlReporter::testRunEnded( TestRunStats const& testRunStats ) {
+ StreamingReporterBase::testRunEnded( testRunStats );
+ m_xml.scopedElement( "OverallResults" )
+ .writeAttribute( "successes", testRunStats.totals.assertions.passed )
+ .writeAttribute( "failures", testRunStats.totals.assertions.failed )
+ .writeAttribute( "expectedFailures", testRunStats.totals.assertions.failedButOk );
+ m_xml.endElement();
+ }
+
+ CATCH_REGISTER_REPORTER( "xml", XmlReporter )
+
+} // end namespace Catch
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif
+// end catch_reporter_xml.cpp
+
+namespace Catch {
+ LeakDetector leakDetector;
+}
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
+// end catch_impl.hpp
+#endif
+
+#ifdef CATCH_CONFIG_MAIN
+// start catch_default_main.hpp
+
+#ifndef __OBJC__
+
+#if defined(WIN32) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN)
+// Standard C/C++ Win32 Unicode wmain entry point
+extern "C" int wmain (int argc, wchar_t * argv[], wchar_t * []) {
+#else
+// Standard C/C++ main entry point
+int main (int argc, char * argv[]) {
+#endif
+
+ return Catch::Session().run( argc, argv );
+}
+
+#else // __OBJC__
+
+// Objective-C entry point
+int main (int argc, char * const argv[]) {
+#if !CATCH_ARC_ENABLED
+ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
+#endif
+
+ Catch::registerTestMethods();
+ int result = Catch::Session().run( argc, (char**)argv );
+
+#if !CATCH_ARC_ENABLED
+ [pool drain];
+#endif
+
+ return result;
+}
+
+#endif // __OBJC__
+
+// end catch_default_main.hpp
+#endif
+
+#if !defined(CATCH_CONFIG_IMPL_ONLY)
+
+#ifdef CLARA_CONFIG_MAIN_NOT_DEFINED
+# undef CLARA_CONFIG_MAIN
+#endif
+
+#if !defined(CATCH_CONFIG_DISABLE)
+//////
+// If this config identifier is defined then all CATCH macros are prefixed with CATCH_
+#ifdef CATCH_CONFIG_PREFIX_ALL
+
+#define CATCH_REQUIRE( ... ) INTERNAL_CATCH_TEST( "CATCH_REQUIRE", Catch::ResultDisposition::Normal, __VA_ARGS__ )
+#define CATCH_REQUIRE_FALSE( ... ) INTERNAL_CATCH_TEST( "CATCH_REQUIRE_FALSE", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )
+
+#define CATCH_REQUIRE_THROWS( ... ) INTERNAL_CATCH_THROWS( "CATCH_REQUIRE_THROWS", Catch::ResultDisposition::Normal, "", __VA_ARGS__ )
+#define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CATCH_REQUIRE_THROWS_AS", exceptionType, Catch::ResultDisposition::Normal, expr )
+#define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CATCH_REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr )
+#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
+#define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CATCH_REQUIRE_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::Normal, matcher, expr )
+#endif// CATCH_CONFIG_DISABLE_MATCHERS
+#define CATCH_REQUIRE_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CATCH_REQUIRE_NOTHROW", Catch::ResultDisposition::Normal, __VA_ARGS__ )
+
+#define CATCH_CHECK( ... ) INTERNAL_CATCH_TEST( "CATCH_CHECK", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
+#define CATCH_CHECK_FALSE( ... ) INTERNAL_CATCH_TEST( "CATCH_CHECK_FALSE", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )
+#define CATCH_CHECKED_IF( ... ) INTERNAL_CATCH_IF( "CATCH_CHECKED_IF", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
+#define CATCH_CHECKED_ELSE( ... ) INTERNAL_CATCH_ELSE( "CATCH_CHECKED_ELSE", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
+#define CATCH_CHECK_NOFAIL( ... ) INTERNAL_CATCH_TEST( "CATCH_CHECK_NOFAIL", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ )
+
+#define CATCH_CHECK_THROWS( ... ) INTERNAL_CATCH_THROWS( "CATCH_CHECK_THROWS", Catch::ResultDisposition::ContinueOnFailure, "", __VA_ARGS__ )
+#define CATCH_CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CATCH_CHECK_THROWS_AS", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr )
+#define CATCH_CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CATCH_CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
+#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
+#define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CATCH_CHECK_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
+#endif // CATCH_CONFIG_DISABLE_MATCHERS
+#define CATCH_CHECK_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CATCH_CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
+
+#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
+#define CATCH_CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CATCH_CHECK_THAT", matcher, Catch::ResultDisposition::ContinueOnFailure, arg )
+
+#define CATCH_REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CATCH_REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg )
+#endif // CATCH_CONFIG_DISABLE_MATCHERS
+
+#define CATCH_INFO( msg ) INTERNAL_CATCH_INFO( "CATCH_INFO", msg )
+#define CATCH_WARN( msg ) INTERNAL_CATCH_MSG( "CATCH_WARN", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg )
+#define CATCH_CAPTURE( msg ) INTERNAL_CATCH_INFO( "CATCH_CAPTURE", #msg " := " << ::Catch::Detail::stringify(msg) )
+
+#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )
+#define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __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_SECTION( ... ) INTERNAL_CATCH_SECTION( __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_SUCCEED( ... ) INTERNAL_CATCH_MSG( "CATCH_SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
+
+#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE()
+
+// "BDD-style" convenience wrappers
+#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_GIVEN( desc ) CATCH_SECTION( std::string( "Given: ") + desc )
+#define CATCH_WHEN( desc ) CATCH_SECTION( std::string( " When: ") + desc )
+#define CATCH_AND_WHEN( desc ) CATCH_SECTION( std::string( " And: ") + desc )
+#define CATCH_THEN( desc ) CATCH_SECTION( std::string( " Then: ") + desc )
+#define CATCH_AND_THEN( desc ) CATCH_SECTION( std::string( " And: ") + desc )
+
+// If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required
+#else
+
+#define REQUIRE( ... ) INTERNAL_CATCH_TEST( "REQUIRE", Catch::ResultDisposition::Normal, __VA_ARGS__ )
+#define REQUIRE_FALSE( ... ) INTERNAL_CATCH_TEST( "REQUIRE_FALSE", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )
+
+#define REQUIRE_THROWS( ... ) INTERNAL_CATCH_THROWS( "REQUIRE_THROWS", Catch::ResultDisposition::Normal, __VA_ARGS__ )
+#define REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "REQUIRE_THROWS_AS", exceptionType, Catch::ResultDisposition::Normal, expr )
+#define REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr )
+#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
+#define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "REQUIRE_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::Normal, matcher, expr )
+#endif // CATCH_CONFIG_DISABLE_MATCHERS
+#define REQUIRE_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "REQUIRE_NOTHROW", Catch::ResultDisposition::Normal, __VA_ARGS__ )
+
+#define CHECK( ... ) INTERNAL_CATCH_TEST( "CHECK", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
+#define CHECK_FALSE( ... ) INTERNAL_CATCH_TEST( "CHECK_FALSE", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )
+#define CHECKED_IF( ... ) INTERNAL_CATCH_IF( "CHECKED_IF", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
+#define CHECKED_ELSE( ... ) INTERNAL_CATCH_ELSE( "CHECKED_ELSE", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
+#define CHECK_NOFAIL( ... ) INTERNAL_CATCH_TEST( "CHECK_NOFAIL", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ )
+
+#define CHECK_THROWS( ... ) INTERNAL_CATCH_THROWS( "CHECK_THROWS", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
+#define CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CHECK_THROWS_AS", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr )
+#define CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
+#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
+#define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CHECK_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
+#endif // CATCH_CONFIG_DISABLE_MATCHERS
+#define CHECK_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
+
+#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
+#define CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CHECK_THAT", matcher, Catch::ResultDisposition::ContinueOnFailure, arg )
+
+#define REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg )
+#endif // CATCH_CONFIG_DISABLE_MATCHERS
+
+#define INFO( msg ) INTERNAL_CATCH_INFO( "INFO", msg )
+#define WARN( msg ) INTERNAL_CATCH_MSG( "WARN", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg )
+#define CAPTURE( msg ) INTERNAL_CATCH_INFO( "CAPTURE", #msg " := " << ::Catch::Detail::stringify(msg) )
+
+#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )
+#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __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 SECTION( ... ) INTERNAL_CATCH_SECTION( __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 SUCCEED( ... ) INTERNAL_CATCH_MSG( "SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
+#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE()
+
+#endif
+
+#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature )
+
+// "BDD-style" convenience wrappers
+#define SCENARIO( ... ) TEST_CASE( "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 WHEN( desc ) SECTION( std::string(" When: ") + desc )
+#define AND_WHEN( desc ) SECTION( std::string("And when: ") + desc )
+#define THEN( desc ) SECTION( std::string(" Then: ") + desc )
+#define AND_THEN( desc ) SECTION( std::string(" And: ") + desc )
+
+using Catch::Detail::Approx;
+
+#else
+//////
+// If this config identifier is defined then all CATCH macros are prefixed with CATCH_
+#ifdef CATCH_CONFIG_PREFIX_ALL
+
+#define CATCH_REQUIRE( ... ) (void)(0)
+#define CATCH_REQUIRE_FALSE( ... ) (void)(0)
+
+#define CATCH_REQUIRE_THROWS( ... ) (void)(0)
+#define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0)
+#define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) (void)(0)
+#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
+#define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
+#endif// CATCH_CONFIG_DISABLE_MATCHERS
+#define CATCH_REQUIRE_NOTHROW( ... ) (void)(0)
+
+#define CATCH_CHECK( ... ) (void)(0)
+#define CATCH_CHECK_FALSE( ... ) (void)(0)
+#define CATCH_CHECKED_IF( ... ) if (__VA_ARGS__)
+#define CATCH_CHECKED_ELSE( ... ) if (!(__VA_ARGS__))
+#define CATCH_CHECK_NOFAIL( ... ) (void)(0)
+
+#define CATCH_CHECK_THROWS( ... ) (void)(0)
+#define CATCH_CHECK_THROWS_AS( expr, exceptionType ) (void)(0)
+#define CATCH_CHECK_THROWS_WITH( expr, matcher ) (void)(0)
+#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
+#define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
+#endif // CATCH_CONFIG_DISABLE_MATCHERS
+#define CATCH_CHECK_NOTHROW( ... ) (void)(0)
+
+#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
+#define CATCH_CHECK_THAT( arg, matcher ) (void)(0)
+
+#define CATCH_REQUIRE_THAT( arg, matcher ) (void)(0)
+#endif // CATCH_CONFIG_DISABLE_MATCHERS
+
+#define CATCH_INFO( msg ) (void)(0)
+#define CATCH_WARN( msg ) (void)(0)
+#define CATCH_CAPTURE( msg ) (void)(0)
+
+#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
+#define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
+#define CATCH_METHOD_AS_TEST_CASE( method, ... )
+#define CATCH_REGISTER_TEST_CASE( Function, ... ) (void)(0)
+#define CATCH_SECTION( ... )
+#define CATCH_FAIL( ... ) (void)(0)
+#define CATCH_FAIL_CHECK( ... ) (void)(0)
+#define CATCH_SUCCEED( ... ) (void)(0)
+
+#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
+
+// "BDD-style" convenience wrappers
+#define CATCH_SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
+#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), className )
+#define CATCH_GIVEN( desc )
+#define CATCH_WHEN( desc )
+#define CATCH_AND_WHEN( desc )
+#define CATCH_THEN( desc )
+#define CATCH_AND_THEN( desc )
+
+// If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required
+#else
+
+#define REQUIRE( ... ) (void)(0)
+#define REQUIRE_FALSE( ... ) (void)(0)
+
+#define REQUIRE_THROWS( ... ) (void)(0)
+#define REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0)
+#define REQUIRE_THROWS_WITH( expr, matcher ) (void)(0)
+#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
+#define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
+#endif // CATCH_CONFIG_DISABLE_MATCHERS
+#define REQUIRE_NOTHROW( ... ) (void)(0)
+
+#define CHECK( ... ) (void)(0)
+#define CHECK_FALSE( ... ) (void)(0)
+#define CHECKED_IF( ... ) if (__VA_ARGS__)
+#define CHECKED_ELSE( ... ) if (!(__VA_ARGS__))
+#define CHECK_NOFAIL( ... ) (void)(0)
+
+#define CHECK_THROWS( ... ) (void)(0)
+#define CHECK_THROWS_AS( expr, exceptionType ) (void)(0)
+#define CHECK_THROWS_WITH( expr, matcher ) (void)(0)
+#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
+#define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
+#endif // CATCH_CONFIG_DISABLE_MATCHERS
+#define CHECK_NOTHROW( ... ) (void)(0)
+
+#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
+#define CHECK_THAT( arg, matcher ) (void)(0)
+
+#define REQUIRE_THAT( arg, matcher ) (void)(0)
+#endif // CATCH_CONFIG_DISABLE_MATCHERS
+
+#define INFO( msg ) (void)(0)
+#define WARN( msg ) (void)(0)
+#define CAPTURE( msg ) (void)(0)
+
+#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
+#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
+#define METHOD_AS_TEST_CASE( method, ... )
+#define REGISTER_TEST_CASE( Function, ... ) (void)(0)
+#define SECTION( ... )
+#define FAIL( ... ) (void)(0)
+#define FAIL_CHECK( ... ) (void)(0)
+#define SUCCEED( ... ) (void)(0)
+#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
+
+#endif
+
+#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature )
+
+// "BDD-style" convenience wrappers
+#define SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ) )
+#define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), className )
+
+#define GIVEN( desc )
+#define WHEN( desc )
+#define AND_WHEN( desc )
+#define THEN( desc )
+#define AND_THEN( desc )
+
+using Catch::Detail::Approx;
+
+#endif
+
+#endif // ! CATCH_CONFIG_IMPL_ONLY
+
+// start catch_reenable_warnings.h
+
+
+#ifdef __clang__
+# ifdef __ICC // icpc defines the __clang__ macro
+# pragma warning(pop)
+# else
+# pragma clang diagnostic pop
+# endif
+#elif defined __GNUC__
+# pragma GCC diagnostic pop
+#endif
+
+// end catch_reenable_warnings.h
+// end catch.hpp
+#endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED
+
diff --git a/single_include/catch_reporter_automake.hpp b/single_include/catch_reporter_automake.hpp
new file mode 100644
index 0000000..dbebe97
--- /dev/null
+++ b/single_include/catch_reporter_automake.hpp
@@ -0,0 +1,62 @@
+/*
+ * Created by Justin R. Wilson on 2/19/2017.
+ * Copyright 2017 Justin R. Wilson. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED
+
+// Don't #include any Catch headers here - we can assume they are already
+// included before this header.
+// This is not good practice in general but is necessary in this case so this
+// file can be distributed as a single header that works with the main
+// Catch single header.
+
+namespace Catch {
+
+ struct AutomakeReporter : StreamingReporterBase<AutomakeReporter> {
+ AutomakeReporter( ReporterConfig const& _config )
+ : StreamingReporterBase( _config )
+ {}
+
+ ~AutomakeReporter() override;
+
+ static std::string getDescription() {
+ return "Reports test results in the format of Automake .trs files";
+ }
+
+ void assertionStarting( AssertionInfo const& ) override {}
+
+ bool assertionEnded( AssertionStats const& /*_assertionStats*/ ) override { return true; }
+
+ void testCaseEnded( TestCaseStats const& _testCaseStats ) override {
+ // Possible values to emit are PASS, XFAIL, SKIP, FAIL, XPASS and ERROR.
+ stream << ":test-result: ";
+ if (_testCaseStats.totals.assertions.allPassed()) {
+ stream << "PASS";
+ } else if (_testCaseStats.totals.assertions.allOk()) {
+ stream << "XFAIL";
+ } else {
+ stream << "FAIL";
+ }
+ stream << ' ' << _testCaseStats.testInfo.name << '\n';
+ StreamingReporterBase::testCaseEnded( _testCaseStats );
+ }
+
+ void skipTest( TestCaseInfo const& testInfo ) override {
+ stream << ":test-result: SKIP " << testInfo.name << '\n';
+ }
+
+ };
+
+#ifdef CATCH_IMPL
+ AutomakeReporter::~AutomakeReporter() {}
+#endif
+
+ CATCH_REGISTER_REPORTER( "automake", AutomakeReporter)
+
+} // end namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED
diff --git a/single_include/catch_reporter_tap.hpp b/single_include/catch_reporter_tap.hpp
new file mode 100644
index 0000000..edb75b5
--- /dev/null
+++ b/single_include/catch_reporter_tap.hpp
@@ -0,0 +1,255 @@
+/*
+ * Created by Colton Wolkins on 2015-08-15.
+ * Copyright 2015 Martin Moene. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_REPORTER_TAP_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_REPORTER_TAP_HPP_INCLUDED
+
+
+// Don't #include any Catch headers here - we can assume they are already
+// included before this header.
+// This is not good practice in general but is necessary in this case so this
+// file can be distributed as a single header that works with the main
+// Catch single header.
+
+#include <algorithm>
+
+namespace Catch {
+
+ struct TAPReporter : StreamingReporterBase<TAPReporter> {
+
+ using StreamingReporterBase::StreamingReporterBase;
+
+ ~TAPReporter() override;
+
+ static std::string getDescription() {
+ return "Reports test results in TAP format, suitable for test harneses";
+ }
+
+ ReporterPreferences getPreferences() const override {
+ ReporterPreferences prefs;
+ prefs.shouldRedirectStdOut = false;
+ return prefs;
+ }
+
+ void noMatchingTestCases( std::string const& spec ) override {
+ stream << "# No test cases matched '" << spec << "'" << std::endl;
+ }
+
+ void assertionStarting( AssertionInfo const& ) override {}
+
+ bool assertionEnded( AssertionStats const& _assertionStats ) override {
+ ++counter;
+
+ AssertionPrinter printer( stream, _assertionStats, counter );
+ printer.print();
+ stream << " # " << currentTestCaseInfo->name ;
+
+ stream << std::endl;
+ return true;
+ }
+
+ void testRunEnded( TestRunStats const& _testRunStats ) override {
+ printTotals( _testRunStats.totals );
+ stream << "\n" << std::endl;
+ StreamingReporterBase::testRunEnded( _testRunStats );
+ }
+
+ private:
+ std::size_t counter = 0;
+ class AssertionPrinter {
+ public:
+ AssertionPrinter& operator= ( AssertionPrinter const& ) = delete;
+ AssertionPrinter( AssertionPrinter const& ) = delete;
+ AssertionPrinter( std::ostream& _stream, AssertionStats const& _stats, std::size_t _counter )
+ : stream( _stream )
+ , result( _stats.assertionResult )
+ , messages( _stats.infoMessages )
+ , itMessage( _stats.infoMessages.begin() )
+ , printInfoMessages( true )
+ , counter(_counter)
+ {}
+
+ void print() {
+ itMessage = messages.begin();
+
+ switch( result.getResultType() ) {
+ case ResultWas::Ok:
+ printResultType( passedString() );
+ printOriginalExpression();
+ printReconstructedExpression();
+ if ( ! result.hasExpression() )
+ printRemainingMessages( Colour::None );
+ else
+ printRemainingMessages();
+ break;
+ case ResultWas::ExpressionFailed:
+ if (result.isOk()) {
+ printResultType(passedString());
+ } else {
+ printResultType(failedString());
+ }
+ printOriginalExpression();
+ printReconstructedExpression();
+ if (result.isOk()) {
+ printIssue(" # TODO");
+ }
+ printRemainingMessages();
+ break;
+ case ResultWas::ThrewException:
+ printResultType( failedString() );
+ printIssue( "unexpected exception with message:" );
+ printMessage();
+ printExpressionWas();
+ printRemainingMessages();
+ break;
+ case ResultWas::FatalErrorCondition:
+ printResultType( failedString() );
+ printIssue( "fatal error condition with message:" );
+ printMessage();
+ printExpressionWas();
+ printRemainingMessages();
+ break;
+ case ResultWas::DidntThrowException:
+ printResultType( failedString() );
+ printIssue( "expected exception, got none" );
+ printExpressionWas();
+ printRemainingMessages();
+ break;
+ case ResultWas::Info:
+ printResultType( "info" );
+ printMessage();
+ printRemainingMessages();
+ break;
+ case ResultWas::Warning:
+ printResultType( "warning" );
+ printMessage();
+ printRemainingMessages();
+ break;
+ case ResultWas::ExplicitFailure:
+ printResultType( failedString() );
+ printIssue( "explicitly" );
+ printRemainingMessages( Colour::None );
+ break;
+ // These cases are here to prevent compiler warnings
+ case ResultWas::Unknown:
+ case ResultWas::FailureBit:
+ case ResultWas::Exception:
+ printResultType( "** internal error **" );
+ break;
+ }
+ }
+
+ private:
+ static Colour::Code dimColour() { return Colour::FileName; }
+
+ static const char* failedString() { return "not ok"; }
+ static const char* passedString() { return "ok"; }
+
+ void printSourceInfo() const {
+ Colour colourGuard( dimColour() );
+ stream << result.getSourceInfo() << ":";
+ }
+
+ void printResultType( std::string const& passOrFail ) const {
+ if( !passOrFail.empty() ) {
+ stream << passOrFail << ' ' << counter << " -";
+ }
+ }
+
+ void printIssue( std::string const& issue ) const {
+ stream << " " << issue;
+ }
+
+ void printExpressionWas() {
+ if( result.hasExpression() ) {
+ stream << ";";
+ {
+ Colour colour( dimColour() );
+ stream << " expression was:";
+ }
+ printOriginalExpression();
+ }
+ }
+
+ void printOriginalExpression() const {
+ if( result.hasExpression() ) {
+ stream << " " << result.getExpression();
+ }
+ }
+
+ void printReconstructedExpression() const {
+ if( result.hasExpandedExpression() ) {
+ {
+ Colour colour( dimColour() );
+ stream << " for: ";
+ }
+ std::string expr = result.getExpandedExpression();
+ std::replace( expr.begin(), expr.end(), '\n', ' ');
+ stream << expr;
+ }
+ }
+
+ void printMessage() {
+ if ( itMessage != messages.end() ) {
+ stream << " '" << itMessage->message << "'";
+ ++itMessage;
+ }
+ }
+
+ void printRemainingMessages( Colour::Code colour = dimColour() ) {
+ if (itMessage == messages.end()) {
+ return;
+ }
+
+ // using messages.end() directly (or auto) yields compilation error:
+ std::vector<MessageInfo>::const_iterator itEnd = messages.end();
+ const std::size_t N = static_cast<std::size_t>( std::distance( itMessage, itEnd ) );
+
+ {
+ Colour colourGuard( colour );
+ stream << " with " << pluralise( N, "message" ) << ":";
+ }
+
+ for(; itMessage != itEnd; ) {
+ // If this assertion is a warning ignore any INFO messages
+ if( printInfoMessages || itMessage->type != ResultWas::Info ) {
+ stream << " '" << itMessage->message << "'";
+ if ( ++itMessage != itEnd ) {
+ Colour colourGuard( dimColour() );
+ stream << " and";
+ }
+ }
+ }
+ }
+
+ private:
+ std::ostream& stream;
+ AssertionResult const& result;
+ std::vector<MessageInfo> messages;
+ std::vector<MessageInfo>::const_iterator itMessage;
+ bool printInfoMessages;
+ std::size_t counter;
+ };
+
+ void printTotals( const Totals& totals ) const {
+ if( totals.testCases.total() == 0 ) {
+ stream << "1..0 # Skipped: No tests ran.";
+ } else {
+ stream << "1.." << counter;
+ }
+ }
+ };
+
+#ifdef CATCH_IMPL
+ TAPReporter::~TAPReporter() {}
+#endif
+
+ CATCH_REGISTER_REPORTER( "tap", TAPReporter )
+
+} // end namespace Catch
+
+#endif // TWOBLUECUBES_CATCH_REPORTER_TAP_HPP_INCLUDED
diff --git a/single_include/catch_reporter_teamcity.hpp b/single_include/catch_reporter_teamcity.hpp
new file mode 100644
index 0000000..dbd0db5
--- /dev/null
+++ b/single_include/catch_reporter_teamcity.hpp
@@ -0,0 +1,220 @@
+/*
+ * Created by Phil Nash on 19th December 2014
+ * Copyright 2014 Two Blue Cubes Ltd. All rights reserved.
+ *
+ * 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)
+ */
+#ifndef TWOBLUECUBES_CATCH_REPORTER_TEAMCITY_HPP_INCLUDED
+#define TWOBLUECUBES_CATCH_REPORTER_TEAMCITY_HPP_INCLUDED
+
+// Don't #include any Catch headers here - we can assume they are already
+// included before this header.
+// This is not good practice in general but is necessary in this case so this
+// file can be distributed as a single header that works with the main
+// Catch single header.
+
+#include <cstring>
+
+#ifdef __clang__
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wpadded"
+#endif
+
+namespace Catch {
+
+ struct TeamCityReporter : StreamingReporterBase<TeamCityReporter> {
+ TeamCityReporter( ReporterConfig const& _config )
+ : StreamingReporterBase( _config )
+ {
+ m_reporterPrefs.shouldRedirectStdOut = true;
+ }
+
+ static std::string escape( std::string const& str ) {
+ std::string escaped = str;
+ replaceInPlace( escaped, "|", "||" );
+ replaceInPlace( escaped, "'", "|'" );
+ replaceInPlace( escaped, "\n", "|n" );
+ replaceInPlace( escaped, "\r", "|r" );
+ replaceInPlace( escaped, "[", "|[" );
+ replaceInPlace( escaped, "]", "|]" );
+ return escaped;
+ }
+ ~TeamCityReporter() override;
+
+ static std::string getDescription() {
+ return "Reports test results as TeamCity service messages";
+ }
+
+ void skipTest( TestCaseInfo const& /* testInfo */ ) override {
+ }
+
+ void noMatchingTestCases( std::string const& /* spec */ ) override {}
+
+ void testGroupStarting( GroupInfo const& groupInfo ) override {
+ StreamingReporterBase::testGroupStarting( groupInfo );
+ stream << "##teamcity[testSuiteStarted name='"
+ << escape( groupInfo.name ) << "']\n";
+ }
+ void testGroupEnded( TestGroupStats const& testGroupStats ) override {
+ StreamingReporterBase::testGroupEnded( testGroupStats );
+ stream << "##teamcity[testSuiteFinished name='"
+ << escape( testGroupStats.groupInfo.name ) << "']\n";
+ }
+
+
+ void assertionStarting( AssertionInfo const& ) override {}
+
+ bool assertionEnded( AssertionStats const& assertionStats ) override {
+ AssertionResult const& result = assertionStats.assertionResult;
+ if( !result.isOk() ) {
+
+ ReusableStringStream msg;
+ if( !m_headerPrintedForThisSection )
+ printSectionHeader( msg.get() );
+ m_headerPrintedForThisSection = true;
+
+ msg << result.getSourceInfo() << "\n";
+
+ switch( result.getResultType() ) {
+ case ResultWas::ExpressionFailed:
+ msg << "expression failed";
+ break;
+ case ResultWas::ThrewException:
+ msg << "unexpected exception";
+ break;
+ case ResultWas::FatalErrorCondition:
+ msg << "fatal error condition";
+ break;
+ case ResultWas::DidntThrowException:
+ msg << "no exception was thrown where one was expected";
+ break;
+ case ResultWas::ExplicitFailure:
+ msg << "explicit failure";
+ break;
+
+ // We shouldn't get here because of the isOk() test
+ case ResultWas::Ok:
+ case ResultWas::Info:
+ case ResultWas::Warning:
+ throw std::domain_error( "Internal error in TeamCity reporter" );
+ // These cases are here to prevent compiler warnings
+ case ResultWas::Unknown:
+ case ResultWas::FailureBit:
+ case ResultWas::Exception:
+ throw std::domain_error( "Not implemented" );
+ }
+ if( assertionStats.infoMessages.size() == 1 )
+ msg << " with message:";
+ if( assertionStats.infoMessages.size() > 1 )
+ msg << " with messages:";
+ for( auto const& messageInfo : assertionStats.infoMessages )
+ msg << "\n \"" << messageInfo.message << "\"";
+
+
+ if( result.hasExpression() ) {
+ msg <<
+ "\n " << result.getExpressionInMacro() << "\n"
+ "with expansion:\n" <<
+ " " << result.getExpandedExpression() << "\n";
+ }
+
+ if( currentTestCaseInfo->okToFail() ) {
+ msg << "- failure ignore as test marked as 'ok to fail'\n";
+ stream << "##teamcity[testIgnored"
+ << " name='" << escape( currentTestCaseInfo->name )<< "'"
+ << " message='" << escape( msg.str() ) << "'"
+ << "]\n";
+ }
+ else {
+ stream << "##teamcity[testFailed"
+ << " name='" << escape( currentTestCaseInfo->name )<< "'"
+ << " message='" << escape( msg.str() ) << "'"
+ << "]\n";
+ }
+ }
+ stream.flush();
+ return true;
+ }
+
+ void sectionStarting( SectionInfo const& sectionInfo ) override {
+ m_headerPrintedForThisSection = false;
+ StreamingReporterBase::sectionStarting( sectionInfo );
+ }
+
+ void testCaseStarting( TestCaseInfo const& testInfo ) override {
+ m_testTimer.start();
+ StreamingReporterBase::testCaseStarting( testInfo );
+ stream << "##teamcity[testStarted name='"
+ << escape( testInfo.name ) << "']\n";
+ stream.flush();
+ }
+
+ void testCaseEnded( TestCaseStats const& testCaseStats ) override {
+ StreamingReporterBase::testCaseEnded( testCaseStats );
+ if( !testCaseStats.stdOut.empty() )
+ stream << "##teamcity[testStdOut name='"
+ << escape( testCaseStats.testInfo.name )
+ << "' out='" << escape( testCaseStats.stdOut ) << "']\n";
+ if( !testCaseStats.stdErr.empty() )
+ stream << "##teamcity[testStdErr name='"
+ << escape( testCaseStats.testInfo.name )
+ << "' out='" << escape( testCaseStats.stdErr ) << "']\n";
+ stream << "##teamcity[testFinished name='"
+ << escape( testCaseStats.testInfo.name ) << "' duration='"
+ << m_testTimer.getElapsedMilliseconds() << "']\n";
+ stream.flush();
+ }
+
+ private:
+ void printSectionHeader( std::ostream& os ) {
+ assert( !m_sectionStack.empty() );
+
+ if( m_sectionStack.size() > 1 ) {
+ os << getLineOfChars<'-'>() << "\n";
+
+ std::vector<SectionInfo>::const_iterator
+ it = m_sectionStack.begin()+1, // Skip first section (test case)
+ itEnd = m_sectionStack.end();
+ for( ; it != itEnd; ++it )
+ printHeaderString( os, it->name );
+ os << getLineOfChars<'-'>() << "\n";
+ }
+
+ SourceLineInfo lineInfo = m_sectionStack.front().lineInfo;
+
+ if( !lineInfo.empty() )
+ os << lineInfo << "\n";
+ os << getLineOfChars<'.'>() << "\n\n";
+ }
+
+ // if string has a : in first line will set indent to follow it on
+ // subsequent lines
+ static void printHeaderString( std::ostream& os, std::string const& _string, std::size_t indent = 0 ) {
+ std::size_t i = _string.find( ": " );
+ if( i != std::string::npos )
+ i+=2;
+ else
+ i = 0;
+ os << Column( _string )
+ .indent( indent+i)
+ .initialIndent( indent ) << "\n";
+ }
+ private:
+ bool m_headerPrintedForThisSection = false;
+ Timer m_testTimer;
+ };
+
+#ifdef CATCH_IMPL
+ TeamCityReporter::~TeamCityReporter() {}
+#endif
+
+ CATCH_REGISTER_REPORTER( "teamcity", TeamCityReporter )
+
+} // end namespace Catch
+
+#ifdef __clang__
+# pragma clang diagnostic pop
+#endif
+
+#endif // TWOBLUECUBES_CATCH_REPORTER_TEAMCITY_HPP_INCLUDED
diff --git a/test_package/CMakeLists.txt b/test_package/CMakeLists.txt
new file mode 100644
index 0000000..339facb
--- /dev/null
+++ b/test_package/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 3.0)
+project(CatchTest CXX)
+
+include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
+conan_basic_setup()
+
+add_executable(${CMAKE_PROJECT_NAME} MainTest.cpp)
diff --git a/test_package/MainTest.cpp b/test_package/MainTest.cpp
new file mode 100644
index 0000000..b8ed744
--- /dev/null
+++ b/test_package/MainTest.cpp
@@ -0,0 +1,21 @@
+/*
+ * Created by Phil on 22/10/2010.
+ * Copyright 2010 Two Blue Cubes Ltd
+ *
+ * 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)
+ */
+#define CATCH_CONFIG_MAIN
+#include "catch.hpp"
+
+unsigned int Factorial( unsigned int number ) {
+ return number > 1 ? Factorial(number-1)*number : 1;
+}
+
+TEST_CASE( "Factorials are computed", "[factorial]" ) {
+ REQUIRE( Factorial(0) == 1 );
+ REQUIRE( Factorial(1) == 1 );
+ REQUIRE( Factorial(2) == 2 );
+ REQUIRE( Factorial(3) == 6 );
+ REQUIRE( Factorial(10) == 3628800 );
+}
diff --git a/test_package/conanfile.py b/test_package/conanfile.py
new file mode 100644
index 0000000..174beba
--- /dev/null
+++ b/test_package/conanfile.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+from os import getenv
+from os import path
+from conans import ConanFile
+from conans import CMake
+
+
+class CatchConanTest(ConanFile):
+ generators = "cmake"
+ settings = "os", "compiler", "arch", "build_type"
+ username = getenv("CONAN_USERNAME", "philsquared")
+ channel = getenv("CONAN_CHANNEL", "testing")
+ requires = "Catch/2.1.1@%s/%s" % (username, channel)
+
+ def build(self):
+ cmake = CMake(self)
+ cmake.configure(build_dir="./")
+ cmake.build()
+
+ def test(self):
+ self.run(path.join("bin", "CatchTest"))
diff --git a/third_party/clara.hpp b/third_party/clara.hpp
new file mode 100644
index 0000000..2134a46
--- /dev/null
+++ b/third_party/clara.hpp
@@ -0,0 +1,1237 @@
+// Copyright 2017 Two Blue Cubes Ltd. All rights reserved.
+//
+// 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)
+//
+// See https://github.com/philsquared/Clara for more details
+
+// Clara v1.1.1
+
+#ifndef CLARA_HPP_INCLUDED
+#define CLARA_HPP_INCLUDED
+
+#ifndef CLARA_CONFIG_CONSOLE_WIDTH
+#define CLARA_CONFIG_CONSOLE_WIDTH 80
+#endif
+
+#ifndef CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH
+#define CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CLARA_CONFIG_CONSOLE_WIDTH
+#endif
+
+// ----------- #included from clara_textflow.hpp -----------
+
+// TextFlowCpp
+//
+// A single-header library for wrapping and laying out basic text, by Phil Nash
+//
+// This work is licensed under the BSD 2-Clause license.
+// See the accompanying LICENSE file, or the one at https://opensource.org/licenses/BSD-2-Clause
+//
+// This project is hosted at https://github.com/philsquared/textflowcpp
+
+#ifndef CLARA_TEXTFLOW_HPP_INCLUDED
+#define CLARA_TEXTFLOW_HPP_INCLUDED
+
+#include <cassert>
+#include <ostream>
+#include <sstream>
+#include <vector>
+
+#ifndef CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH
+#define CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH 80
+#endif
+
+
+namespace clara { namespace TextFlow {
+
+ inline auto isWhitespace( char c ) -> bool {
+ static std::string chars = " \t\n\r";
+ return chars.find( c ) != std::string::npos;
+ }
+ inline auto isBreakableBefore( char c ) -> bool {
+ static std::string chars = "[({<|";
+ return chars.find( c ) != std::string::npos;
+ }
+ inline auto isBreakableAfter( char c ) -> bool {
+ static std::string chars = "])}>.,:;*+-=&/\\";
+ return chars.find( c ) != std::string::npos;
+ }
+
+ class Columns;
+
+ class Column {
+ std::vector<std::string> m_strings;
+ size_t m_width = CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH;
+ size_t m_indent = 0;
+ size_t m_initialIndent = std::string::npos;
+
+ public:
+ class iterator {
+ friend Column;
+
+ Column const& m_column;
+ size_t m_stringIndex = 0;
+ size_t m_pos = 0;
+
+ size_t m_len = 0;
+ size_t m_end = 0;
+ bool m_suffix = false;
+
+ iterator( Column const& column, size_t stringIndex )
+ : m_column( column ),
+ m_stringIndex( stringIndex )
+ {}
+
+ auto line() const -> std::string const& { return m_column.m_strings[m_stringIndex]; }
+
+ auto isBoundary( size_t at ) const -> bool {
+ assert( at > 0 );
+ assert( at <= line().size() );
+
+ return at == line().size() ||
+ ( isWhitespace( line()[at] ) && !isWhitespace( line()[at-1] ) ) ||
+ isBreakableBefore( line()[at] ) ||
+ isBreakableAfter( line()[at-1] );
+ }
+
+ void calcLength() {
+ assert( m_stringIndex < m_column.m_strings.size() );
+
+ m_suffix = false;
+ auto width = m_column.m_width-indent();
+ m_end = m_pos;
+ while( m_end < line().size() && line()[m_end] != '\n' )
+ ++m_end;
+
+ if( m_end < m_pos + width ) {
+ m_len = m_end - m_pos;
+ }
+ else {
+ size_t len = width;
+ while (len > 0 && !isBoundary(m_pos + len))
+ --len;
+ while (len > 0 && isWhitespace( line()[m_pos + len - 1] ))
+ --len;
+
+ if (len > 0) {
+ m_len = len;
+ } else {
+ m_suffix = true;
+ m_len = width - 1;
+ }
+ }
+ }
+
+ auto indent() const -> size_t {
+ auto initial = m_pos == 0 && m_stringIndex == 0 ? m_column.m_initialIndent : std::string::npos;
+ return initial == std::string::npos ? m_column.m_indent : initial;
+ }
+
+ auto addIndentAndSuffix(std::string const &plain) const -> std::string {
+ return std::string( indent(), ' ' ) + (m_suffix ? plain + "-" : plain);
+ }
+
+ public:
+ explicit iterator( Column const& column ) : m_column( column ) {
+ assert( m_column.m_width > m_column.m_indent );
+ assert( m_column.m_initialIndent == std::string::npos || m_column.m_width > m_column.m_initialIndent );
+ calcLength();
+ if( m_len == 0 )
+ m_stringIndex++; // Empty string
+ }
+
+ auto operator *() const -> std::string {
+ assert( m_stringIndex < m_column.m_strings.size() );
+ assert( m_pos <= m_end );
+ if( m_pos + m_column.m_width < m_end )
+ return addIndentAndSuffix(line().substr(m_pos, m_len));
+ else
+ return addIndentAndSuffix(line().substr(m_pos, m_end - m_pos));
+ }
+
+ auto operator ++() -> iterator& {
+ m_pos += m_len;
+ if( m_pos < line().size() && line()[m_pos] == '\n' )
+ m_pos += 1;
+ else
+ while( m_pos < line().size() && isWhitespace( line()[m_pos] ) )
+ ++m_pos;
+
+ if( m_pos == line().size() ) {
+ m_pos = 0;
+ ++m_stringIndex;
+ }
+ if( m_stringIndex < m_column.m_strings.size() )
+ calcLength();
+ return *this;
+ }
+ auto operator ++(int) -> iterator {
+ iterator prev( *this );
+ operator++();
+ return prev;
+ }
+
+ auto operator ==( iterator const& other ) const -> bool {
+ return
+ m_pos == other.m_pos &&
+ m_stringIndex == other.m_stringIndex &&
+ &m_column == &other.m_column;
+ }
+ auto operator !=( iterator const& other ) const -> bool {
+ return !operator==( other );
+ }
+ };
+ using const_iterator = iterator;
+
+ explicit Column( std::string const& text ) { m_strings.push_back( text ); }
+
+ auto width( size_t newWidth ) -> Column& {
+ assert( newWidth > 0 );
+ m_width = newWidth;
+ return *this;
+ }
+ auto indent( size_t newIndent ) -> Column& {
+ m_indent = newIndent;
+ return *this;
+ }
+ auto initialIndent( size_t newIndent ) -> Column& {
+ m_initialIndent = newIndent;
+ return *this;
+ }
+
+ auto width() const -> size_t { return m_width; }
+ auto begin() const -> iterator { return iterator( *this ); }
+ auto end() const -> iterator { return { *this, m_strings.size() }; }
+
+ inline friend std::ostream& operator << ( std::ostream& os, Column const& col ) {
+ bool first = true;
+ for( auto line : col ) {
+ if( first )
+ first = false;
+ else
+ os << "\n";
+ os << line;
+ }
+ return os;
+ }
+
+ auto operator + ( Column const& other ) -> Columns;
+
+ auto toString() const -> std::string {
+ std::ostringstream oss;
+ oss << *this;
+ return oss.str();
+ }
+ };
+
+ class Spacer : public Column {
+
+ public:
+ explicit Spacer( size_t spaceWidth ) : Column( "" ) {
+ width( spaceWidth );
+ }
+ };
+
+ class Columns {
+ std::vector<Column> m_columns;
+
+ public:
+
+ class iterator {
+ friend Columns;
+ struct EndTag {};
+
+ std::vector<Column> const& m_columns;
+ std::vector<Column::iterator> m_iterators;
+ size_t m_activeIterators;
+
+ iterator( Columns const& columns, EndTag )
+ : m_columns( columns.m_columns ),
+ m_activeIterators( 0 )
+ {
+ m_iterators.reserve( m_columns.size() );
+
+ for( auto const& col : m_columns )
+ m_iterators.push_back( col.end() );
+ }
+
+ public:
+ explicit iterator( Columns const& columns )
+ : m_columns( columns.m_columns ),
+ m_activeIterators( m_columns.size() )
+ {
+ m_iterators.reserve( m_columns.size() );
+
+ for( auto const& col : m_columns )
+ m_iterators.push_back( col.begin() );
+ }
+
+ auto operator ==( iterator const& other ) const -> bool {
+ return m_iterators == other.m_iterators;
+ }
+ auto operator !=( iterator const& other ) const -> bool {
+ return m_iterators != other.m_iterators;
+ }
+ auto operator *() const -> std::string {
+ std::string row, padding;
+
+ for( size_t i = 0; i < m_columns.size(); ++i ) {
+ auto width = m_columns[i].width();
+ if( m_iterators[i] != m_columns[i].end() ) {
+ std::string col = *m_iterators[i];
+ row += padding + col;
+ if( col.size() < width )
+ padding = std::string( width - col.size(), ' ' );
+ else
+ padding = "";
+ }
+ else {
+ padding += std::string( width, ' ' );
+ }
+ }
+ return row;
+ }
+ auto operator ++() -> iterator& {
+ for( size_t i = 0; i < m_columns.size(); ++i ) {
+ if (m_iterators[i] != m_columns[i].end())
+ ++m_iterators[i];
+ }
+ return *this;
+ }
+ auto operator ++(int) -> iterator {
+ iterator prev( *this );
+ operator++();
+ return prev;
+ }
+ };
+ using const_iterator = iterator;
+
+ auto begin() const -> iterator { return iterator( *this ); }
+ auto end() const -> iterator { return { *this, iterator::EndTag() }; }
+
+ auto operator += ( Column const& col ) -> Columns& {
+ m_columns.push_back( col );
+ return *this;
+ }
+ auto operator + ( Column const& col ) -> Columns {
+ Columns combined = *this;
+ combined += col;
+ return combined;
+ }
+
+ inline friend std::ostream& operator << ( std::ostream& os, Columns const& cols ) {
+
+ bool first = true;
+ for( auto line : cols ) {
+ if( first )
+ first = false;
+ else
+ os << "\n";
+ os << line;
+ }
+ return os;
+ }
+
+ auto toString() const -> std::string {
+ std::ostringstream oss;
+ oss << *this;
+ return oss.str();
+ }
+ };
+
+ inline auto Column::operator + ( Column const& other ) -> Columns {
+ Columns cols;
+ cols += *this;
+ cols += other;
+ return cols;
+ }
+}} // namespace clara::TextFlow
+
+#endif // CLARA_TEXTFLOW_HPP_INCLUDED
+
+// ----------- end of #include from clara_textflow.hpp -----------
+// ........... back in clara.hpp
+
+
+#include <memory>
+#include <set>
+#include <algorithm>
+
+#if !defined(CLARA_PLATFORM_WINDOWS) && ( defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) )
+#define CLARA_PLATFORM_WINDOWS
+#endif
+
+namespace clara {
+namespace detail {
+
+ // Traits for extracting arg and return type of lambdas (for single argument lambdas)
+ template<typename L>
+ struct UnaryLambdaTraits : UnaryLambdaTraits<decltype( &L::operator() )> {};
+
+ template<typename ClassT, typename ReturnT, typename... Args>
+ struct UnaryLambdaTraits<ReturnT( ClassT::* )( Args... ) const> {
+ static const bool isValid = false;
+ };
+
+ template<typename ClassT, typename ReturnT, typename ArgT>
+ struct UnaryLambdaTraits<ReturnT( ClassT::* )( ArgT ) const> {
+ static const bool isValid = true;
+ using ArgType = typename std::remove_const<typename std::remove_reference<ArgT>::type>::type;
+ using ReturnType = ReturnT;
+ };
+
+ class TokenStream;
+
+ // Transport for raw args (copied from main args, or supplied via init list for testing)
+ class Args {
+ friend TokenStream;
+ std::string m_exeName;
+ std::vector<std::string> m_args;
+
+ public:
+ Args( int argc, char *argv[] ) {
+ m_exeName = argv[0];
+ for( int i = 1; i < argc; ++i )
+ m_args.push_back( argv[i] );
+ }
+
+ Args( std::initializer_list<std::string> args )
+ : m_exeName( *args.begin() ),
+ m_args( args.begin()+1, args.end() )
+ {}
+
+ auto exeName() const -> std::string {
+ return m_exeName;
+ }
+ };
+
+ // Wraps a token coming from a token stream. These may not directly correspond to strings as a single string
+ // may encode an option + its argument if the : or = form is used
+ enum class TokenType {
+ Option, Argument
+ };
+ struct Token {
+ TokenType type;
+ std::string token;
+ };
+
+ inline auto isOptPrefix( char c ) -> bool {
+ return c == '-'
+#ifdef CLARA_PLATFORM_WINDOWS
+ || c == '/'
+#endif
+ ;
+ }
+
+ // Abstracts iterators into args as a stream of tokens, with option arguments uniformly handled
+ class TokenStream {
+ using Iterator = std::vector<std::string>::const_iterator;
+ Iterator it;
+ Iterator itEnd;
+ std::vector<Token> m_tokenBuffer;
+
+ void loadBuffer() {
+ m_tokenBuffer.resize( 0 );
+
+ // Skip any empty strings
+ while( it != itEnd && it->empty() )
+ ++it;
+
+ if( it != itEnd ) {
+ auto const &next = *it;
+ if( isOptPrefix( next[0] ) ) {
+ auto delimiterPos = next.find_first_of( " :=" );
+ if( delimiterPos != std::string::npos ) {
+ m_tokenBuffer.push_back( { TokenType::Option, next.substr( 0, delimiterPos ) } );
+ m_tokenBuffer.push_back( { TokenType::Argument, next.substr( delimiterPos + 1 ) } );
+ } else {
+ if( next[1] != '-' && next.size() > 2 ) {
+ std::string opt = "- ";
+ for( size_t i = 1; i < next.size(); ++i ) {
+ opt[1] = next[i];
+ m_tokenBuffer.push_back( { TokenType::Option, opt } );
+ }
+ } else {
+ m_tokenBuffer.push_back( { TokenType::Option, next } );
+ }
+ }
+ } else {
+ m_tokenBuffer.push_back( { TokenType::Argument, next } );
+ }
+ }
+ }
+
+ public:
+ explicit TokenStream( Args const &args ) : TokenStream( args.m_args.begin(), args.m_args.end() ) {}
+
+ TokenStream( Iterator it, Iterator itEnd ) : it( it ), itEnd( itEnd ) {
+ loadBuffer();
+ }
+
+ explicit operator bool() const {
+ return !m_tokenBuffer.empty() || it != itEnd;
+ }
+
+ auto count() const -> size_t { return m_tokenBuffer.size() + (itEnd - it); }
+
+ auto operator*() const -> Token {
+ assert( !m_tokenBuffer.empty() );
+ return m_tokenBuffer.front();
+ }
+
+ auto operator->() const -> Token const * {
+ assert( !m_tokenBuffer.empty() );
+ return &m_tokenBuffer.front();
+ }
+
+ auto operator++() -> TokenStream & {
+ if( m_tokenBuffer.size() >= 2 ) {
+ m_tokenBuffer.erase( m_tokenBuffer.begin() );
+ } else {
+ if( it != itEnd )
+ ++it;
+ loadBuffer();
+ }
+ return *this;
+ }
+ };
+
+
+ class ResultBase {
+ public:
+ enum Type {
+ Ok, LogicError, RuntimeError
+ };
+
+ protected:
+ ResultBase( Type type ) : m_type( type ) {}
+ virtual ~ResultBase() = default;
+
+ virtual void enforceOk() const = 0;
+
+ Type m_type;
+ };
+
+ template<typename T>
+ class ResultValueBase : public ResultBase {
+ public:
+ auto value() const -> T const & {
+ enforceOk();
+ return m_value;
+ }
+
+ protected:
+ ResultValueBase( Type type ) : ResultBase( type ) {}
+
+ ResultValueBase( ResultValueBase const &other ) : ResultBase( other ) {
+ if( m_type == ResultBase::Ok )
+ new( &m_value ) T( other.m_value );
+ }
+
+ ResultValueBase( Type, T const &value ) : ResultBase( Ok ) {
+ new( &m_value ) T( value );
+ }
+
+ auto operator=( ResultValueBase const &other ) -> ResultValueBase & {
+ if( m_type == ResultBase::Ok )
+ m_value.~T();
+ ResultBase::operator=(other);
+ if( m_type == ResultBase::Ok )
+ new( &m_value ) T( other.m_value );
+ return *this;
+ }
+
+ ~ResultValueBase() override {
+ if( m_type == Ok )
+ m_value.~T();
+ }
+
+ union {
+ T m_value;
+ };
+ };
+
+ template<>
+ class ResultValueBase<void> : public ResultBase {
+ protected:
+ using ResultBase::ResultBase;
+ };
+
+ template<typename T = void>
+ class BasicResult : public ResultValueBase<T> {
+ public:
+ template<typename U>
+ explicit BasicResult( BasicResult<U> const &other )
+ : ResultValueBase<T>( other.type() ),
+ m_errorMessage( other.errorMessage() )
+ {
+ assert( type() != ResultBase::Ok );
+ }
+
+ template<typename U>
+ static auto ok( U const &value ) -> BasicResult { return { ResultBase::Ok, value }; }
+ static auto ok() -> BasicResult { return { ResultBase::Ok }; }
+ static auto logicError( std::string const &message ) -> BasicResult { return { ResultBase::LogicError, message }; }
+ static auto runtimeError( std::string const &message ) -> BasicResult { return { ResultBase::RuntimeError, message }; }
+
+ explicit operator bool() const { return m_type == ResultBase::Ok; }
+ auto type() const -> ResultBase::Type { return m_type; }
+ auto errorMessage() const -> std::string { return m_errorMessage; }
+
+ protected:
+ void enforceOk() const override {
+ // !TBD: If no exceptions, std::terminate here or something
+ switch( m_type ) {
+ case ResultBase::LogicError:
+ throw std::logic_error( m_errorMessage );
+ case ResultBase::RuntimeError:
+ throw std::runtime_error( m_errorMessage );
+ case ResultBase::Ok:
+ break;
+ }
+ }
+
+ std::string m_errorMessage; // Only populated if resultType is an error
+
+ BasicResult( ResultBase::Type type, std::string const &message )
+ : ResultValueBase<T>(type),
+ m_errorMessage(message)
+ {
+ assert( m_type != ResultBase::Ok );
+ }
+
+ using ResultValueBase<T>::ResultValueBase;
+ using ResultBase::m_type;
+ };
+
+ enum class ParseResultType {
+ Matched, NoMatch, ShortCircuitAll, ShortCircuitSame
+ };
+
+ class ParseState {
+ public:
+
+ ParseState( ParseResultType type, TokenStream const &remainingTokens )
+ : m_type(type),
+ m_remainingTokens( remainingTokens )
+ {}
+
+ auto type() const -> ParseResultType { return m_type; }
+ auto remainingTokens() const -> TokenStream { return m_remainingTokens; }
+
+ private:
+ ParseResultType m_type;
+ TokenStream m_remainingTokens;
+ };
+
+ using Result = BasicResult<void>;
+ using ParserResult = BasicResult<ParseResultType>;
+ using InternalParseResult = BasicResult<ParseState>;
+
+ struct HelpColumns {
+ std::string left;
+ std::string right;
+ };
+
+ template<typename T>
+ inline auto convertInto( std::string const &source, T& target ) -> ParserResult {
+ std::stringstream ss;
+ ss << source;
+ ss >> target;
+ if( ss.fail() )
+ return ParserResult::runtimeError( "Unable to convert '" + source + "' to destination type" );
+ else
+ return ParserResult::ok( ParseResultType::Matched );
+ }
+ inline auto convertInto( std::string const &source, std::string& target ) -> ParserResult {
+ target = source;
+ return ParserResult::ok( ParseResultType::Matched );
+ }
+ inline auto convertInto( std::string const &source, bool &target ) -> ParserResult {
+ std::string srcLC = source;
+ std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( char c ) { return static_cast<char>( ::tolower(c) ); } );
+ if (srcLC == "y" || srcLC == "1" || srcLC == "true" || srcLC == "yes" || srcLC == "on")
+ target = true;
+ else if (srcLC == "n" || srcLC == "0" || srcLC == "false" || srcLC == "no" || srcLC == "off")
+ target = false;
+ else
+ return ParserResult::runtimeError( "Expected a boolean value but did not recognise: '" + source + "'" );
+ return ParserResult::ok( ParseResultType::Matched );
+ }
+
+ struct NonCopyable {
+ NonCopyable() = default;
+ NonCopyable( NonCopyable const & ) = delete;
+ NonCopyable( NonCopyable && ) = delete;
+ NonCopyable &operator=( NonCopyable const & ) = delete;
+ NonCopyable &operator=( NonCopyable && ) = delete;
+ };
+
+ struct BoundRef : NonCopyable {
+ virtual ~BoundRef() = default;
+ virtual auto isContainer() const -> bool { return false; }
+ };
+ struct BoundValueRefBase : BoundRef {
+ virtual auto setValue( std::string const &arg ) -> ParserResult = 0;
+ };
+ struct BoundFlagRefBase : BoundRef {
+ virtual auto setFlag( bool flag ) -> ParserResult = 0;
+ };
+
+ template<typename T>
+ struct BoundValueRef : BoundValueRefBase {
+ T &m_ref;
+
+ explicit BoundValueRef( T &ref ) : m_ref( ref ) {}
+
+ auto setValue( std::string const &arg ) -> ParserResult override {
+ return convertInto( arg, m_ref );
+ }
+ };
+
+ template<typename T>
+ struct BoundValueRef<std::vector<T>> : BoundValueRefBase {
+ std::vector<T> &m_ref;
+
+ explicit BoundValueRef( std::vector<T> &ref ) : m_ref( ref ) {}
+
+ auto isContainer() const -> bool override { return true; }
+
+ auto setValue( std::string const &arg ) -> ParserResult override {
+ T temp;
+ auto result = convertInto( arg, temp );
+ if( result )
+ m_ref.push_back( temp );
+ return result;
+ }
+ };
+
+ struct BoundFlagRef : BoundFlagRefBase {
+ bool &m_ref;
+
+ explicit BoundFlagRef( bool &ref ) : m_ref( ref ) {}
+
+ auto setFlag( bool flag ) -> ParserResult override {
+ m_ref = flag;
+ return ParserResult::ok( ParseResultType::Matched );
+ }
+ };
+
+ template<typename ReturnType>
+ struct LambdaInvoker {
+ static_assert( std::is_same<ReturnType, ParserResult>::value, "Lambda must return void or clara::ParserResult" );
+
+ template<typename L, typename ArgType>
+ static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult {
+ return lambda( arg );
+ }
+ };
+
+ template<>
+ struct LambdaInvoker<void> {
+ template<typename L, typename ArgType>
+ static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult {
+ lambda( arg );
+ return ParserResult::ok( ParseResultType::Matched );
+ }
+ };
+
+ template<typename ArgType, typename L>
+ inline auto invokeLambda( L const &lambda, std::string const &arg ) -> ParserResult {
+ ArgType temp{};
+ auto result = convertInto( arg, temp );
+ return !result
+ ? result
+ : LambdaInvoker<typename UnaryLambdaTraits<L>::ReturnType>::invoke( lambda, temp );
+ }
+
+
+ template<typename L>
+ struct BoundLambda : BoundValueRefBase {
+ L m_lambda;
+
+ static_assert( UnaryLambdaTraits<L>::isValid, "Supplied lambda must take exactly one argument" );
+ explicit BoundLambda( L const &lambda ) : m_lambda( lambda ) {}
+
+ auto setValue( std::string const &arg ) -> ParserResult override {
+ return invokeLambda<typename UnaryLambdaTraits<L>::ArgType>( m_lambda, arg );
+ }
+ };
+
+ template<typename L>
+ struct BoundFlagLambda : BoundFlagRefBase {
+ L m_lambda;
+
+ static_assert( UnaryLambdaTraits<L>::isValid, "Supplied lambda must take exactly one argument" );
+ static_assert( std::is_same<typename UnaryLambdaTraits<L>::ArgType, bool>::value, "flags must be boolean" );
+
+ explicit BoundFlagLambda( L const &lambda ) : m_lambda( lambda ) {}
+
+ auto setFlag( bool flag ) -> ParserResult override {
+ return LambdaInvoker<typename UnaryLambdaTraits<L>::ReturnType>::invoke( m_lambda, flag );
+ }
+ };
+
+ enum class Optionality { Optional, Required };
+
+ struct Parser;
+
+ class ParserBase {
+ public:
+ virtual ~ParserBase() = default;
+ virtual auto validate() const -> Result { return Result::ok(); }
+ virtual auto parse( std::string const& exeName, TokenStream const &tokens) const -> InternalParseResult = 0;
+ virtual auto cardinality() const -> size_t { return 1; }
+
+ auto parse( Args const &args ) const -> InternalParseResult {
+ return parse( args.exeName(), TokenStream( args ) );
+ }
+ };
+
+ template<typename DerivedT>
+ class ComposableParserImpl : public ParserBase {
+ public:
+ template<typename T>
+ auto operator|( T const &other ) const -> Parser;
+
+ template<typename T>
+ auto operator+( T const &other ) const -> Parser;
+ };
+
+ // Common code and state for Args and Opts
+ template<typename DerivedT>
+ class ParserRefImpl : public ComposableParserImpl<DerivedT> {
+ protected:
+ Optionality m_optionality = Optionality::Optional;
+ std::shared_ptr<BoundRef> m_ref;
+ std::string m_hint;
+ std::string m_description;
+
+ explicit ParserRefImpl( std::shared_ptr<BoundRef> const &ref ) : m_ref( ref ) {}
+
+ public:
+ template<typename T>
+ ParserRefImpl( T &ref, std::string const &hint )
+ : m_ref( std::make_shared<BoundValueRef<T>>( ref ) ),
+ m_hint( hint )
+ {}
+
+ template<typename LambdaT>
+ ParserRefImpl( LambdaT const &ref, std::string const &hint )
+ : m_ref( std::make_shared<BoundLambda<LambdaT>>( ref ) ),
+ m_hint(hint)
+ {}
+
+ auto operator()( std::string const &description ) -> DerivedT & {
+ m_description = description;
+ return static_cast<DerivedT &>( *this );
+ }
+
+ auto optional() -> DerivedT & {
+ m_optionality = Optionality::Optional;
+ return static_cast<DerivedT &>( *this );
+ };
+
+ auto required() -> DerivedT & {
+ m_optionality = Optionality::Required;
+ return static_cast<DerivedT &>( *this );
+ };
+
+ auto isOptional() const -> bool {
+ return m_optionality == Optionality::Optional;
+ }
+
+ auto cardinality() const -> size_t override {
+ if( m_ref->isContainer() )
+ return 0;
+ else
+ return 1;
+ }
+
+ auto hint() const -> std::string { return m_hint; }
+ };
+
+ class ExeName : public ComposableParserImpl<ExeName> {
+ std::shared_ptr<std::string> m_name;
+ std::shared_ptr<BoundValueRefBase> m_ref;
+
+ template<typename LambdaT>
+ static auto makeRef(LambdaT const &lambda) -> std::shared_ptr<BoundValueRefBase> {
+ return std::make_shared<BoundLambda<LambdaT>>( lambda) ;
+ }
+
+ public:
+ ExeName() : m_name( std::make_shared<std::string>( "<executable>" ) ) {}
+
+ explicit ExeName( std::string &ref ) : ExeName() {
+ m_ref = std::make_shared<BoundValueRef<std::string>>( ref );
+ }
+
+ template<typename LambdaT>
+ explicit ExeName( LambdaT const& lambda ) : ExeName() {
+ m_ref = std::make_shared<BoundLambda<LambdaT>>( lambda );
+ }
+
+ // The exe name is not parsed out of the normal tokens, but is handled specially
+ auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override {
+ return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) );
+ }
+
+ auto name() const -> std::string { return *m_name; }
+ auto set( std::string const& newName ) -> ParserResult {
+
+ auto lastSlash = newName.find_last_of( "\\/" );
+ auto filename = ( lastSlash == std::string::npos )
+ ? newName
+ : newName.substr( lastSlash+1 );
+
+ *m_name = filename;
+ if( m_ref )
+ return m_ref->setValue( filename );
+ else
+ return ParserResult::ok( ParseResultType::Matched );
+ }
+ };
+
+ class Arg : public ParserRefImpl<Arg> {
+ public:
+ using ParserRefImpl::ParserRefImpl;
+
+ auto parse( std::string const &, TokenStream const &tokens ) const -> InternalParseResult override {
+ auto validationResult = validate();
+ if( !validationResult )
+ return InternalParseResult( validationResult );
+
+ auto remainingTokens = tokens;
+ auto const &token = *remainingTokens;
+ if( token.type != TokenType::Argument )
+ return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) );
+
+ assert( dynamic_cast<detail::BoundValueRefBase*>( m_ref.get() ) );
+ auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() );
+
+ auto result = valueRef->setValue( remainingTokens->token );
+ if( !result )
+ return InternalParseResult( result );
+ else
+ return InternalParseResult::ok( ParseState( ParseResultType::Matched, ++remainingTokens ) );
+ }
+ };
+
+ inline auto normaliseOpt( std::string const &optName ) -> std::string {
+#ifdef CLARA_PLATFORM_WINDOWS
+ if( optName[0] == '/' )
+ return "-" + optName.substr( 1 );
+ else
+#endif
+ return optName;
+ }
+
+ class Opt : public ParserRefImpl<Opt> {
+ protected:
+ std::vector<std::string> m_optNames;
+
+ public:
+ template<typename LambdaT>
+ explicit Opt( LambdaT const &ref ) : ParserRefImpl( std::make_shared<BoundFlagLambda<LambdaT>>( ref ) ) {}
+
+ explicit Opt( bool &ref ) : ParserRefImpl( std::make_shared<BoundFlagRef>( ref ) ) {}
+
+ template<typename LambdaT>
+ Opt( LambdaT const &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {}
+
+ template<typename T>
+ Opt( T &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {}
+
+ auto operator[]( std::string const &optName ) -> Opt & {
+ m_optNames.push_back( optName );
+ return *this;
+ }
+
+ auto getHelpColumns() const -> std::vector<HelpColumns> {
+ std::ostringstream oss;
+ bool first = true;
+ for( auto const &opt : m_optNames ) {
+ if (first)
+ first = false;
+ else
+ oss << ", ";
+ oss << opt;
+ }
+ if( !m_hint.empty() )
+ oss << " <" << m_hint << ">";
+ return { { oss.str(), m_description } };
+ }
+
+ auto isMatch( std::string const &optToken ) const -> bool {
+ auto normalisedToken = normaliseOpt( optToken );
+ for( auto const &name : m_optNames ) {
+ if( normaliseOpt( name ) == normalisedToken )
+ return true;
+ }
+ return false;
+ }
+
+ using ParserBase::parse;
+
+ auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override {
+ auto validationResult = validate();
+ if( !validationResult )
+ return InternalParseResult( validationResult );
+
+ auto remainingTokens = tokens;
+ if( remainingTokens && remainingTokens->type == TokenType::Option ) {
+ auto const &token = *remainingTokens;
+ if( isMatch(token.token ) ) {
+ if( auto flagRef = dynamic_cast<detail::BoundFlagRefBase*>( m_ref.get() ) ) {
+ auto result = flagRef->setFlag( true );
+ if( !result )
+ return InternalParseResult( result );
+ if( result.value() == ParseResultType::ShortCircuitAll )
+ return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) );
+ } else {
+ assert( dynamic_cast<detail::BoundValueRefBase*>( m_ref.get() ) );
+ auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() );
+ ++remainingTokens;
+ if( !remainingTokens )
+ return InternalParseResult::runtimeError( "Expected argument following " + token.token );
+ auto const &argToken = *remainingTokens;
+ if( argToken.type != TokenType::Argument )
+ return InternalParseResult::runtimeError( "Expected argument following " + token.token );
+ auto result = valueRef->setValue( argToken.token );
+ if( !result )
+ return InternalParseResult( result );
+ if( result.value() == ParseResultType::ShortCircuitAll )
+ return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) );
+ }
+ return InternalParseResult::ok( ParseState( ParseResultType::Matched, ++remainingTokens ) );
+ }
+ }
+ return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) );
+ }
+
+ auto validate() const -> Result override {
+ if( m_optNames.empty() )
+ return Result::logicError( "No options supplied to Opt" );
+ for( auto const &name : m_optNames ) {
+ if( name.empty() )
+ return Result::logicError( "Option name cannot be empty" );
+#ifdef CLARA_PLATFORM_WINDOWS
+ if( name[0] != '-' && name[0] != '/' )
+ return Result::logicError( "Option name must begin with '-' or '/'" );
+#else
+ if( name[0] != '-' )
+ return Result::logicError( "Option name must begin with '-'" );
+#endif
+ }
+ return ParserRefImpl::validate();
+ }
+ };
+
+ struct Help : Opt {
+ Help( bool &showHelpFlag )
+ : Opt([&]( bool flag ) {
+ showHelpFlag = flag;
+ return ParserResult::ok( ParseResultType::ShortCircuitAll );
+ })
+ {
+ static_cast<Opt &>( *this )
+ ("display usage information")
+ ["-?"]["-h"]["--help"]
+ .optional();
+ }
+ };
+
+
+ struct Parser : ParserBase {
+
+ mutable ExeName m_exeName;
+ std::vector<Opt> m_options;
+ std::vector<Arg> m_args;
+
+ auto operator|=( ExeName const &exeName ) -> Parser & {
+ m_exeName = exeName;
+ return *this;
+ }
+
+ auto operator|=( Arg const &arg ) -> Parser & {
+ m_args.push_back(arg);
+ return *this;
+ }
+
+ auto operator|=( Opt const &opt ) -> Parser & {
+ m_options.push_back(opt);
+ return *this;
+ }
+
+ auto operator|=( Parser const &other ) -> Parser & {
+ m_options.insert(m_options.end(), other.m_options.begin(), other.m_options.end());
+ m_args.insert(m_args.end(), other.m_args.begin(), other.m_args.end());
+ return *this;
+ }
+
+ template<typename T>
+ auto operator|( T const &other ) const -> Parser {
+ return Parser( *this ) |= other;
+ }
+
+ // Forward deprecated interface with '+' instead of '|'
+ template<typename T>
+ auto operator+=( T const &other ) -> Parser & { return operator|=( other ); }
+ template<typename T>
+ auto operator+( T const &other ) const -> Parser { return operator|( other ); }
+
+ auto getHelpColumns() const -> std::vector<HelpColumns> {
+ std::vector<HelpColumns> cols;
+ for (auto const &o : m_options) {
+ auto childCols = o.getHelpColumns();
+ cols.insert( cols.end(), childCols.begin(), childCols.end() );
+ }
+ return cols;
+ }
+
+ void writeToStream( std::ostream &os ) const {
+ if (!m_exeName.name().empty()) {
+ os << "usage:\n" << " " << m_exeName.name() << " ";
+ bool required = true, first = true;
+ for( auto const &arg : m_args ) {
+ if (first)
+ first = false;
+ else
+ os << " ";
+ if( arg.isOptional() && required ) {
+ os << "[";
+ required = false;
+ }
+ os << "<" << arg.hint() << ">";
+ if( arg.cardinality() == 0 )
+ os << " ... ";
+ }
+ if( !required )
+ os << "]";
+ if( !m_options.empty() )
+ os << " options";
+ os << "\n\nwhere options are:" << std::endl;
+ }
+
+ auto rows = getHelpColumns();
+ size_t consoleWidth = CLARA_CONFIG_CONSOLE_WIDTH;
+ size_t optWidth = 0;
+ for( auto const &cols : rows )
+ optWidth = (std::max)(optWidth, cols.left.size() + 2);
+
+ optWidth = (std::min)(optWidth, consoleWidth/2);
+
+ for( auto const &cols : rows ) {
+ auto row =
+ TextFlow::Column( cols.left ).width( optWidth ).indent( 2 ) +
+ TextFlow::Spacer(4) +
+ TextFlow::Column( cols.right ).width( consoleWidth - 7 - optWidth );
+ os << row << std::endl;
+ }
+ }
+
+ friend auto operator<<( std::ostream &os, Parser const &parser ) -> std::ostream& {
+ parser.writeToStream( os );
+ return os;
+ }
+
+ auto validate() const -> Result override {
+ for( auto const &opt : m_options ) {
+ auto result = opt.validate();
+ if( !result )
+ return result;
+ }
+ for( auto const &arg : m_args ) {
+ auto result = arg.validate();
+ if( !result )
+ return result;
+ }
+ return Result::ok();
+ }
+
+ using ParserBase::parse;
+
+ auto parse( std::string const& exeName, TokenStream const &tokens ) const -> InternalParseResult override {
+
+ struct ParserInfo {
+ ParserBase const* parser = nullptr;
+ size_t count = 0;
+ };
+ const size_t totalParsers = m_options.size() + m_args.size();
+ assert( totalParsers < 512 );
+ // ParserInfo parseInfos[totalParsers]; // <-- this is what we really want to do
+ ParserInfo parseInfos[512];
+
+ {
+ size_t i = 0;
+ for (auto const &opt : m_options) parseInfos[i++].parser = &opt;
+ for (auto const &arg : m_args) parseInfos[i++].parser = &arg;
+ }
+
+ m_exeName.set( exeName );
+
+ auto result = InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) );
+ while( result.value().remainingTokens() ) {
+ bool tokenParsed = false;
+
+ for( size_t i = 0; i < totalParsers; ++i ) {
+ auto& parseInfo = parseInfos[i];
+ if( parseInfo.parser->cardinality() == 0 || parseInfo.count < parseInfo.parser->cardinality() ) {
+ result = parseInfo.parser->parse(exeName, result.value().remainingTokens());
+ if (!result)
+ return result;
+ if (result.value().type() != ParseResultType::NoMatch) {
+ tokenParsed = true;
+ ++parseInfo.count;
+ break;
+ }
+ }
+ }
+
+ if( result.value().type() == ParseResultType::ShortCircuitAll )
+ return result;
+ if( !tokenParsed )
+ return InternalParseResult::runtimeError( "Unrecognised token: " + result.value().remainingTokens()->token );
+ }
+ // !TBD Check missing required options
+ return result;
+ }
+ };
+
+ template<typename DerivedT>
+ template<typename T>
+ auto ComposableParserImpl<DerivedT>::operator|( T const &other ) const -> Parser {
+ return Parser() | static_cast<DerivedT const &>( *this ) | other;
+ }
+} // namespace detail
+
+
+// A Combined parser
+using detail::Parser;
+
+// A parser for options
+using detail::Opt;
+
+// A parser for arguments
+using detail::Arg;
+
+// Wrapper for argc, argv from main()
+using detail::Args;
+
+// Specifies the name of the executable
+using detail::ExeName;
+
+// Convenience wrapper for option parser that specifies the help option
+using detail::Help;
+
+// enum of result types from a parse
+using detail::ParseResultType;
+
+// Result type for parser operation
+using detail::ParserResult;
+
+
+} // namespace clara
+
+#endif // CLARA_HPP_INCLUDED