diff --git a/CMakeLists.txt b/CMakeLists.txt index 696c96578a15c9303d9135ec8a56089062c2cc30..45c69b7a0d8744a1fde62b53170e7f3f8ef303c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -315,7 +315,6 @@ include_directories(${PUGS_BINARY_DIR}/src) # Pugs tests set(CATCH_MODULE_PATH "${PUGS_SOURCE_DIR}/packages/Catch2") -include("${CATCH_MODULE_PATH}/contrib/ParseAndAddCatchTests.cmake") add_subdirectory("${CATCH_MODULE_PATH}") add_subdirectory(tests) diff --git a/packages/Catch2/.clang-format b/packages/Catch2/.clang-format new file mode 100644 index 0000000000000000000000000000000000000000..2a82aacfdcf07382b720d7706bf9ad60f4fc8402 --- /dev/null +++ b/packages/Catch2/.clang-format @@ -0,0 +1,25 @@ +--- +AccessModifierOffset: '-4' +AlignEscapedNewlines: Left +AllowAllConstructorInitializersOnNextLine: 'true' +BinPackArguments: 'false' +BinPackParameters: 'false' +BreakConstructorInitializers: AfterColon +ConstructorInitializerAllOnOneLineOrOnePerLine: 'true' +DerivePointerAlignment: 'false' +FixNamespaceComments: 'true' +IncludeBlocks: Regroup +IndentCaseLabels: 'false' +IndentPPDirectives: AfterHash +IndentWidth: '4' +Language: Cpp +NamespaceIndentation: All +PointerAlignment: Left +SpaceBeforeCtorInitializerColon: 'false' +SpaceInEmptyParentheses: 'false' +SpacesInParentheses: 'true' +Standard: Cpp11 +TabWidth: '4' +UseTab: Never + +... diff --git a/packages/Catch2/.conan/build.py b/packages/Catch2/.conan/build.py new file mode 100644 index 0000000000000000000000000000000000000000..e163d5f46d04b62ee5b64aa0ad1ba368fd65f3be --- /dev/null +++ b/packages/Catch2/.conan/build.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import os +import re +from cpt.packager import ConanMultiPackager +from cpt.ci_manager import CIManager +from cpt.printer import Printer + + +class BuilderSettings(object): + @property + def username(self): + """ Set catchorg as package's owner + """ + return os.getenv("CONAN_USERNAME", "catchorg") + + @property + def login_username(self): + """ Set Bintray login username + """ + return os.getenv("CONAN_LOGIN_USERNAME", "horenmar") + + @property + def upload(self): + """ Set Catch2 repository to be used on upload. + The upload server address could be customized by env var + CONAN_UPLOAD. If not defined, the method will check the branch name. + Only devel or CONAN_STABLE_BRANCH_PATTERN will be accepted. + The devel branch will be pushed to testing channel, because it does + not match the stable pattern. Otherwise it will upload to stable + channel. + """ + return os.getenv("CONAN_UPLOAD", "https://api.bintray.com/conan/catchorg/catch2") + + @property + def upload_only_when_stable(self): + """ Force to upload when running over tag branch + """ + return os.getenv("CONAN_UPLOAD_ONLY_WHEN_STABLE", "True").lower() in ["true", "1", "yes"] + + @property + def stable_branch_pattern(self): + """ Only upload the package the branch name is like a tag + """ + return os.getenv("CONAN_STABLE_BRANCH_PATTERN", r"v\d+\.\d+\.\d+") + + @property + def reference(self): + """ Read project version from branch create Conan reference + """ + return os.getenv("CONAN_REFERENCE", "catch2/{}".format(self._version)) + + @property + def channel(self): + """ Default Conan package channel when not stable + """ + return os.getenv("CONAN_CHANNEL", "testing") + + @property + def _version(self): + """ Get version name from cmake file + """ + pattern = re.compile(r"project\(Catch2 LANGUAGES CXX VERSION (\d+\.\d+\.\d+)\)") + version = "latest" + with open("CMakeLists.txt") as file: + for line in file: + result = pattern.search(line) + if result: + version = result.group(1) + return version + + @property + def _branch(self): + """ Get branch name from CI manager + """ + printer = Printer(None) + ci_manager = CIManager(printer) + return ci_manager.get_branch() + + +if __name__ == "__main__": + settings = BuilderSettings() + builder = ConanMultiPackager( + reference=settings.reference, + channel=settings.channel, + upload=settings.upload, + upload_only_when_stable=False, + stable_branch_pattern=settings.stable_branch_pattern, + login_username=settings.login_username, + username=settings.username, + test_folder=os.path.join(".conan", "test_package")) + builder.add() + builder.run() diff --git a/packages/Catch2/.conan/test_package/CMakeLists.txt b/packages/Catch2/.conan/test_package/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ee069c01eba215033b4e5d09d1604a4bea9536d --- /dev/null +++ b/packages/Catch2/.conan/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.2.0) +project(test_package CXX) + +include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +conan_basic_setup() + +find_package(Catch2 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) + +target_link_libraries(${PROJECT_NAME} Catch2::Catch2WithMain) +set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14) diff --git a/packages/Catch2/.conan/test_package/conanfile.py b/packages/Catch2/.conan/test_package/conanfile.py new file mode 100644 index 0000000000000000000000000000000000000000..069ace61ef9118df7a6b3de4894d57b0d104248c --- /dev/null +++ b/packages/Catch2/.conan/test_package/conanfile.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +from conans import ConanFile, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake_find_package_multi", "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + assert os.path.isfile(os.path.join( + self.deps_cpp_info["catch2"].rootpath, "licenses", "LICENSE.txt")) + bin_path = os.path.join("bin", "test_package") + self.run("%s -s" % bin_path, run_environment=True) diff --git a/packages/Catch2/.conan/test_package/test_package.cpp b/packages/Catch2/.conan/test_package/test_package.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3c08090bf59015c9edc9747b9fd4b238a9f3a018 --- /dev/null +++ b/packages/Catch2/.conan/test_package/test_package.cpp @@ -0,0 +1,13 @@ +#include <catch2/catch_test_macros.hpp> + +int Factorial( int number ) { + return number <= 1 ? 1 : Factorial( number - 1 ) * number; +} + +TEST_CASE( "Factorial Tests", "[single-file]" ) { + REQUIRE( Factorial(0) == 1 ); + REQUIRE( Factorial(1) == 1 ); + REQUIRE( Factorial(2) == 2 ); + REQUIRE( Factorial(3) == 6 ); + REQUIRE( Factorial(10) == 3628800 ); +} \ No newline at end of file diff --git a/packages/Catch2/.gitattributes b/packages/Catch2/.gitattributes new file mode 100644 index 0000000000000000000000000000000000000000..23f98fffa38cb97875db0ba787e9574fa51fc884 --- /dev/null +++ b/packages/Catch2/.gitattributes @@ -0,0 +1,22 @@ +# 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 executable scripts with LFs so they can be run after being +# checked out on Windows +*.py text eol=lf + + +# 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/packages/Catch2/.github/FUNDING.yml b/packages/Catch2/.github/FUNDING.yml new file mode 100644 index 0000000000000000000000000000000000000000..4d8a0e95ae59d78c522dd3422ed050c5946c8f3e --- /dev/null +++ b/packages/Catch2/.github/FUNDING.yml @@ -0,0 +1 @@ +custom: "https://www.paypal.me/horenmar" diff --git a/packages/Catch2/.github/ISSUE_TEMPLATE/bug_report.md b/packages/Catch2/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000000000000000000000000000000000000..dbeff1152f15e446cb83ad89523748c9f43228ca --- /dev/null +++ b/packages/Catch2/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,29 @@ +--- +name: Bug report +about: Create an issue that documents a bug +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Reproduction steps** +Steps to reproduce the bug. +<!-- Usually this means a small and self-contained piece of code that uses Catch and specifying compiler flags if relevant. --> + + +**Platform information:** +<!-- Fill in any extra information that might be important for your issue. --> + - OS: **Windows NT** + - Compiler+version: **GCC v2.9.5** + - Catch version: **v1.2.3** + + +**Additional context** +Add any other context about the problem here. diff --git a/packages/Catch2/.github/ISSUE_TEMPLATE/feature_request.md b/packages/Catch2/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000000000000000000000000000000000000..be9b9eeaeca200d84218f9080843d24154fdd888 --- /dev/null +++ b/packages/Catch2/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,14 @@ +--- +name: Feature request +about: Create an issue that requests a feature or other improvement +title: '' +labels: '' +assignees: '' + +--- + +**Description** +Describe the feature/change you request and why do you want it. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/packages/Catch2/.github/pull_request_template.md b/packages/Catch2/.github/pull_request_template.md new file mode 100644 index 0000000000000000000000000000000000000000..ea2b7bb5fa635ab3c93c11d38bcae27885f86d84 --- /dev/null +++ b/packages/Catch2/.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, that's 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/packages/Catch2/.github/workflows/linux-builds.yml b/packages/Catch2/.github/workflows/linux-builds.yml new file mode 100644 index 0000000000000000000000000000000000000000..93ae21e6f7ca436246f227b17094d6148d058e99 --- /dev/null +++ b/packages/Catch2/.github/workflows/linux-builds.yml @@ -0,0 +1,61 @@ +name: Linux builds + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-20.04 + strategy: + matrix: + cxx: +# - g++-6 + - g++-7 + - g++-8 + - g++-9 + - g++-10 + - clang++-6.0 + - clang++-7 + - clang++-8 + - clang++-9 + - clang++-10 + build_type: [Debug, Release] + std: [14] + include: + # cannot be installed on ubuntu-20.04 be default? +# - cxx: g++-6 +# other_pkgs: g++-6 + - cxx: clang++-6.0 + other_pkgs: clang-6.0 + - cxx: clang++-7 + other_pkgs: clang-7 + - cxx: clang++-10 + other_pkgs: clang-10 + + steps: + - uses: actions/checkout@v2 + + - name: Prepare environment + run: sudo apt-get install -y ninja-build ${{matrix.other_pkgs}} + + - name: Configure build + working-directory: ${{runner.workspace}} + env: + CXX: ${{matrix.cxx}} + CXXFLAGS: ${{matrix.cxxflags}} + # Note: $GITHUB_WORKSPACE is distinct from ${{runner.workspace}}. + # This is important + run: | + cmake -Bbuild -H$GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ + -DCMAKE_CXX_STANDARD=${{matrix.std}} -DCATCH_DEVELOPMENT_BUILD=ON \ + -G Ninja + + - name: Build tests + lib + working-directory: ${{runner.workspace}}/build + run: ninja + + - name: Run tests + env: + CTEST_OUTPUT_ON_FAILURE: 1 + working-directory: ${{runner.workspace}}/build + # Hardcode 2 cores we know are there + run: ctest -C ${{matrix.build_type}} -j 2 diff --git a/packages/Catch2/.github/workflows/mac-builds.yml b/packages/Catch2/.github/workflows/mac-builds.yml new file mode 100644 index 0000000000000000000000000000000000000000..5bcc35414b959b79435ecaa06b49a877cf1352b3 --- /dev/null +++ b/packages/Catch2/.github/workflows/mac-builds.yml @@ -0,0 +1,45 @@ +name: Mac builds + +on: [push, pull_request] + +jobs: + build: + runs-on: macos-10.15 + strategy: + matrix: + cxx: + - g++-9 + - clang++ + build_type: [Debug, Release] + std: [14, 17] + include: + - build_type: Debug + examples: ON + extra_tests: ON + + steps: + - uses: actions/checkout@v2 + + - name: Configure build + working-directory: ${{runner.workspace}} + env: + CXX: ${{matrix.cxx}} + CXXFLAGS: ${{matrix.cxxflags}} + # Note: $GITHUB_WORKSPACE is distinct from ${{runner.workspace}}. + # This is important + run: | + cmake -Bbuild -H$GITHUB_WORKSPACE \ + -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_CXX_STANDARD=${{matrix.std}} \ + -DCATCH_DEVELOPMENT_BUILD=ON -DCATCH_BUILD_EXAMPLES=${{matrix.examples}} \ + -DCATCH_BUILD_EXTRA_TESTS=${{matrix.examples}} + + - name: Build tests + lib + working-directory: ${{runner.workspace}}/build + run: make -j 2 + + - name: Run tests + env: + CTEST_OUTPUT_ON_FAILURE: 1 + working-directory: ${{runner.workspace}}/build + # Hardcode 2 cores we know are there + run: ctest -C ${{matrix.build_type}} -j 2 diff --git a/packages/Catch2/.github/workflows/validate-header-guards.yml b/packages/Catch2/.github/workflows/validate-header-guards.yml new file mode 100644 index 0000000000000000000000000000000000000000..c02b5d49e2dcf57ebcb589085c4b0b1d3a513f35 --- /dev/null +++ b/packages/Catch2/.github/workflows/validate-header-guards.yml @@ -0,0 +1,36 @@ +name: Check header guards + +on: [push, pull_request] + +jobs: + build: + # Set the type of machine to run on + runs-on: ubuntu-20.04 + steps: + + - name: Checkout source code + uses: actions/checkout@v2 + + - name: Setup Dependencies + uses: actions/setup-python@v2 + with: + python-version: '3.7' + - name: Install checkguard + run: pip install guardonce + + - name: Check that include guards are properly named + run: | + wrong_files=$(checkguard -r src/catch2/ -p "name | append _INCLUDED | upper") + if [[ $wrong_files ]]; then + echo "Files with wrong header guard:" + echo $wrong_files + exit 1 + fi + + - name: Check that there are no duplicated filenames + run: | + ./tools/scripts/checkDuplicateFilenames.py + + - name: Check that all source files have the correct license header + run: | + ./tools/scripts/checkLicense.py diff --git a/packages/Catch2/.gitignore b/packages/Catch2/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..1b3934bf5e7f4854ea526248190d97cd4f4f8308 --- /dev/null +++ b/packages/Catch2/.gitignore @@ -0,0 +1,33 @@ +*.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 +.conan/test_package/build +bazel-* +build-fuzzers +debug-build diff --git a/packages/Catch2/.gitrepo b/packages/Catch2/.gitrepo new file mode 100644 index 0000000000000000000000000000000000000000..ebe025859982135cd6d8d666ef0df64a3d4977fc --- /dev/null +++ b/packages/Catch2/.gitrepo @@ -0,0 +1,12 @@ +; DO NOT EDIT (unless you know what you are doing) +; +; This subdirectory is a git "subrepo", and this file is maintained by the +; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme +; +[subrepo] + remote = git@github.com:catchorg/Catch2.git + branch = devel + commit = 2dbe63a6ba949c3f0a2078770f7d12cfe5adc10c + parent = 2179906885aa483f8d2b2cfa127d187dff80aea2 + method = merge + cmdver = 0.4.3 diff --git a/packages/Catch2/.travis.yml b/packages/Catch2/.travis.yml new file mode 100644 index 0000000000000000000000000000000000000000..811b12bf7fedbf4bc297907872e808b001ab8398 --- /dev/null +++ b/packages/Catch2/.travis.yml @@ -0,0 +1,161 @@ +language: cpp +dist: xenial + + +branches: + except: + - /dev-appveyor.*/ + +common_sources: &all_sources + - ubuntu-toolchain-r-test + - llvm-toolchain-xenial + - llvm-toolchain-xenial-3.8 + - llvm-toolchain-xenial-3.9 + - llvm-toolchain-xenial-4.0 + - llvm-toolchain-xenial-5.0 + - llvm-toolchain-xenial-6.0 + - llvm-toolchain-xenial-7 + - llvm-toolchain-xenial-8 + + +matrix: + include: + # Clang builds + - os: linux + compiler: clang + addons: + apt: + sources: *all_sources + packages: ['clang-3.8'] + env: COMPILER='clang++-3.8' CPP14=1 + + - os: linux + compiler: clang + addons: + apt: + sources: *all_sources + packages: ['clang-3.8', 'lcov'] + env: COMPILER='clang++-3.8' CPP14=1 EXAMPLES=1 COVERAGE=1 EXTRAS=1 + + - os: linux + compiler: clang + addons: + apt: + sources: *all_sources + packages: ['clang-3.9'] + env: COMPILER='clang++-3.9' CPP14=1 + + - os: linux + compiler: clang + addons: + apt: + sources: *all_sources + packages: ['clang-4.0'] + env: COMPILER='clang++-4.0' CPP14=1 + + - os: linux + compiler: clang + addons: + apt: + sources: *all_sources + packages: ['clang-5.0'] + env: COMPILER='clang++-5.0' CPP14=1 + + + - os: linux + compiler: clang + addons: + apt: + sources: *all_sources + packages: ['clang-6.0', 'libstdc++-8-dev'] + env: COMPILER='clang++-6.0' CPP17=1 + + + - os: linux + compiler: clang + addons: + apt: + sources: *all_sources + packages: ['clang-8', 'libstdc++-8-dev'] + env: COMPILER='clang++-8' CPP17=1 EXAMPLES=1 COVERAGE=1 EXTRAS=1 + + + # GCC builds + - os: linux + compiler: gcc + addons: + apt: + sources: *all_sources + packages: ['g++-5'] + env: COMPILER='g++-5' CPP14=1 + + - os: linux + compiler: gcc + addons: + apt: + sources: *all_sources + packages: ['g++-6'] + env: COMPILER='g++-6' CPP14=1 + + - os: linux + compiler: gcc + addons: + apt: + sources: *all_sources + packages: ['g++-7', 'lcov'] + env: COMPILER='g++-7' CPP14=1 EXAMPLES=1 COVERAGE=1 EXTRAS=1 + + + # Special builds, e.g. conan + - language: python + python: + - "3.7" + install: + - pip install conan-package-tools + env: + - CONAN_GCC_VERSIONS=8 + - CONAN_DOCKER_IMAGE=conanio/gcc8 + - CPP14=1 + script: + - python .conan/build.py + +before_script: + - export CXX=${COMPILER} + - cd ${TRAVIS_BUILD_DIR} + # We want to regenerate the amalgamated header if the extra tests + # are enabled. + - | + if [[ ${EXTRAS} -eq 1 ]]; then + python3 ./tools/scripts/generateAmalgamatedFiles.py + fi + + - | + if [[ ${CPP17} -eq 1 ]]; then + export CPP_STANDARD=17 + elif [[ ${CPP14} -eq 1 ]]; then + export CPP_STANDARD=14 + else + travis_terminate 4; + fi + + # Use Debug builds for running Valgrind and building examples + - cmake -H. -BBuild-Debug -DCMAKE_BUILD_TYPE=Debug -Wdev -DCATCH_USE_VALGRIND=${VALGRIND} -DCATCH_BUILD_EXAMPLES=${EXAMPLES} -DCATCH_ENABLE_COVERAGE=${COVERAGE} -DCATCH_BUILD_EXTRA_TESTS=${EXTRAS} -DCMAKE_CXX_STANDARD=${CPP_STANDARD} -DCMAKE_CXX_STANDARD_REQUIRED=On -DCMAKE_CXX_EXTENSIONS=OFF -DCATCH_DEVELOPMENT_BUILD=ON + # Don't bother with release build for coverage build + - cmake -H. -BBuild-Release -DCMAKE_BUILD_TYPE=Release -Wdev -DCMAKE_CXX_STANDARD=${CPP_STANDARD} -DCMAKE_CXX_STANDARD_REQUIRED=On -DCMAKE_CXX_EXTENSIONS=OFF -DCATCH_DEVELOPMENT_BUILD=ON + + +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" ]] && [[ "${COVERAGE}" == "1" ]]; 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/packages/Catch2/BUILD.bazel b/packages/Catch2/BUILD.bazel new file mode 100644 index 0000000000000000000000000000000000000000..6dc626d806f123c31beefdb8c8d258b1c39e2248 --- /dev/null +++ b/packages/Catch2/BUILD.bazel @@ -0,0 +1,25 @@ +# Load the cc_library rule. +load("@rules_cc//cc:defs.bzl", "cc_library") + +# Static library, without main. +cc_library( + name = "catch2", + hdrs = glob(["src/catch2/**/*.hpp"]), + srcs = glob(["src/catch2/**/*.cpp"], + exclude=[ "src/catch2/internal/catch_main.cpp"]), + visibility = ["//visibility:public"], + copts = ["-std=c++14"], + linkstatic = True, + includes = ["src/"], +) + +# Static library, with main. +cc_library( + name = "catch2_main", + srcs = ["src/catch2/internal/catch_main.cpp"], + deps = [":catch2"], + visibility = ["//visibility:public"], + linkstatic = True, + copts = ["-std=c++14"], + includes = ["src/"], +) diff --git a/packages/Catch2/CMake/Catch2Config.cmake.in b/packages/Catch2/CMake/Catch2Config.cmake.in new file mode 100644 index 0000000000000000000000000000000000000000..c485219cdb77406be4b972d0f596e335ad9fdf37 --- /dev/null +++ b/packages/Catch2/CMake/Catch2Config.cmake.in @@ -0,0 +1,10 @@ +@PACKAGE_INIT@ + + +# Avoid repeatedly including the targets +if(NOT TARGET Catch2::Catch2) + # Provide path for scripts + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") + + include(${CMAKE_CURRENT_LIST_DIR}/Catch2Targets.cmake) +endif() diff --git a/packages/Catch2/CMake/FindGcov.cmake b/packages/Catch2/CMake/FindGcov.cmake new file mode 100644 index 0000000000000000000000000000000000000000..414171134c208bcb8ec9a37c2659cec0f7292b0b --- /dev/null +++ b/packages/Catch2/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 dependent 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/packages/Catch2/CMake/FindLcov.cmake b/packages/Catch2/CMake/FindLcov.cmake new file mode 100644 index 0000000000000000000000000000000000000000..beb925ae06efb0de816b8a95c16782dbeffeef4a --- /dev/null +++ b/packages/Catch2/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/packages/Catch2/CMake/Findcodecov.cmake b/packages/Catch2/CMake/Findcodecov.cmake new file mode 100644 index 0000000000000000000000000000000000000000..2c0f2fee5fdcc92c0a3333f8a8dc586cebf47b68 --- /dev/null +++ b/packages/Catch2/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 dependent 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/packages/Catch2/CMake/MiscFunctions.cmake b/packages/Catch2/CMake/MiscFunctions.cmake new file mode 100644 index 0000000000000000000000000000000000000000..1f0ed865040cea32082f2b54ef02096a76eb760a --- /dev/null +++ b/packages/Catch2/CMake/MiscFunctions.cmake @@ -0,0 +1,79 @@ +include(CheckCXXCompilerFlag) +function(add_cxx_flag_if_supported_to_targets flagname targets) + check_cxx_compiler_flag("${flagname}" HAVE_FLAG_${flagname}) + + if (HAVE_FLAG_${flagname}) + foreach(target ${targets}) + target_compile_options(${target} PUBLIC ${flagname}) + endforeach() + endif() +endfunction() + +# Assumes that it is only called for development builds, where warnings +# and Werror is desired, so it also enables Werror. +function(add_warnings_to_targets targets) + LIST(LENGTH targets TARGETS_LEN) + # For now we just assume 2 possibilities: msvc and msvc-like compilers, + # and other. + if (MSVC) + foreach(target ${targets}) + # Force MSVC to consider everything as encoded in utf-8 + target_compile_options( ${target} PRIVATE /utf-8 ) + # Enable Werror equivalent + if (CATCH_ENABLE_WERROR) + target_compile_options( ${target} PRIVATE /WX ) + endif() + + # MSVC is currently handled specially + 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( ${target} PRIVATE /w44265 /w44061 /w44062 /w45038 ) + endif() + endforeach() + + endif() + + if (NOT MSVC) + set(CHECKED_WARNING_FLAGS + "-Wall" + "-Wextra" + "-Wpedantic" + "-Wweak-vtables" + "-Wunreachable-code" + "-Wmissing-declarations" + "-Wexit-time-destructors" + "-Wglobal-constructors" + "-Wmissing-noreturn" + "-Wparentheses" + "-Wextra-semi-stmt" + "-Wunreachable-code" + "-Wstrict-aliasing" + "-Wreturn-std-move" + "-Wmissing-braces" + "-Wdeprecated" + "-Wvla" + "-Wundef" + "-Wmisleading-indentation" + "-Wcatch-value" + "-Wabsolute-value" + "-Wreturn-std-move" + "-Wunused-parameter" + "-Wunused-function" + "-Wcall-to-pure-virtual-from-ctor-dtor" + "-Wdeprecated-register" + "-Wsuggest-override" + "-Wshadow" + "-Wold-style-cast" + ) + foreach(warning ${CHECKED_WARNING_FLAGS}) + add_cxx_flag_if_supported_to_targets(${warning} "${targets}") + endforeach() + + if (CATCH_ENABLE_WERROR) + foreach(target ${targets}) + # Enable Werror equivalent + target_compile_options( ${target} PRIVATE -Werror ) + endforeach() + endif() + endif() +endfunction() diff --git a/packages/Catch2/CMake/catch2-with-main.pc.in b/packages/Catch2/CMake/catch2-with-main.pc.in new file mode 100644 index 0000000000000000000000000000000000000000..122f1f96a726279471f1ceaa13315f970a8bbaa7 --- /dev/null +++ b/packages/Catch2/CMake/catch2-with-main.pc.in @@ -0,0 +1,10 @@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +pkg_version=@Catch2_VERSION@ + +Name: Catch2-With-Main +Description: A modern, C++-native test framework for C++14 and above (links in default main) +Version: ${pkg_version} +Requires: catch2 = ${pkg_version} +Cflags: -I${includedir} +Libs: -L${libdir} -lCatch2WithMain diff --git a/packages/Catch2/CMake/catch2.pc.in b/packages/Catch2/CMake/catch2.pc.in new file mode 100644 index 0000000000000000000000000000000000000000..c37eb8ad345af246b83e40dea53e44a3c946bec2 --- /dev/null +++ b/packages/Catch2/CMake/catch2.pc.in @@ -0,0 +1,9 @@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ + +Name: Catch2 +Description: A modern, C++-native, test framework for C++14 and above +URL: https://github.com/catchorg/Catch2 +Version: @Catch2_VERSION@ +Cflags: -I${includedir} +Libs: -L${libdir} -lCatch2 diff --git a/packages/Catch2/CMake/llvm-cov-wrapper b/packages/Catch2/CMake/llvm-cov-wrapper new file mode 100755 index 0000000000000000000000000000000000000000..2ac3310248839c1b7ded0c2b67f0a6e50de9af83 --- /dev/null +++ b/packages/Catch2/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/packages/Catch2/CMakeLists.txt b/packages/Catch2/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..90d5806baeabe49d074d742d75aeb8ee1e15ddae --- /dev/null +++ b/packages/Catch2/CMakeLists.txt @@ -0,0 +1,206 @@ +cmake_minimum_required(VERSION 3.5) + +# detect if Catch is being bundled, +# disable testsuite in that case +if(NOT DEFINED PROJECT_NAME) + set(NOT_SUBPROJECT ON) +endif() + +option(CATCH_INSTALL_DOCS "Install documentation alongside library" ON) +option(CATCH_INSTALL_EXTRAS "Install extras alongside library" ON) +option(CATCH_DEVELOPMENT_BUILD "Build tests, enable warnings, enable Werror, etc" OFF) + +include(CMakeDependentOption) +cmake_dependent_option(CATCH_BUILD_TESTING "Build the SelfTest project" ON "CATCH_DEVELOPMENT_BUILD" OFF) +cmake_dependent_option(CATCH_BUILD_EXAMPLES "Build code examples" OFF "CATCH_DEVELOPMENT_BUILD" OFF) +cmake_dependent_option(CATCH_BUILD_EXTRA_TESTS "Build extra tests" OFF "CATCH_DEVELOPMENT_BUILD" OFF) +cmake_dependent_option(CATCH_BUILD_FUZZERS "Build fuzzers" OFF "CATCH_DEVELOPMENT_BUILD" OFF) +cmake_dependent_option(CATCH_ENABLE_COVERAGE "Generate coverage for codecov.io" OFF "CATCH_DEVELOPMENT_BUILD" OFF) +cmake_dependent_option(CATCH_ENABLE_WERROR "Enables Werror during build" ON "CATCH_DEVELOPMENT_BUILD" OFF) + +# Catch2's build breaks if done in-tree. You probably should not build +# things in tree anyway, but we can allow projects that include Catch2 +# as a subproject to build in-tree as long as it is not in our tree. +if (CMAKE_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + message(FATAL_ERROR "Building in-source is not supported! Create a build dir and remove ${CMAKE_SOURCE_DIR}/CMakeCache.txt") +endif() + +if(CMAKE_VERSION VERSION_GREATER 3.8) + # Enable IPO for CMake versions that support it + cmake_policy(SET CMP0069 NEW) +endif() + + +project(Catch2 LANGUAGES CXX VERSION 3.0.0) + +# Provide path for scripts +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake") +include(GNUInstallDirs) +include(CMakePackageConfigHelpers) +include(CTest) + +# This variable is used in some subdirectories, so we need it here, rather +# than later in the install block +set(CATCH_CMAKE_CONFIG_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Catch2") + +# We have some Windows builds that test `wmain` entry point, +# and we need this change to be present in all binaries that +# are built during these tests, so this is required here, before +# the subdirectories are added. +if(CATCH_TEST_USE_WMAIN) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:wmainCRTStartup") +endif() + + +# Basic paths +set(CATCH_DIR ${CMAKE_CURRENT_SOURCE_DIR}) +set(SOURCES_DIR ${CATCH_DIR}/src/catch2) +set(SELF_TEST_DIR ${CATCH_DIR}/tests/SelfTest) +set(BENCHMARK_DIR ${CATCH_DIR}/tests/Benchmark) +set(EXAMPLES_DIR ${CATCH_DIR}/examples) + +# We need to bring-in the variables defined there to this scope +add_subdirectory(src) + +# Build tests only if requested +if (BUILD_TESTING AND CATCH_BUILD_TESTING AND NOT_SUBPROJECT) + find_package(PythonInterp 3 REQUIRED) + if (NOT PYTHONINTERP_FOUND) + message(FATAL_ERROR "Python not found, but required for tests") + endif() + add_subdirectory(tests) +endif() + +if(CATCH_BUILD_EXAMPLES) + add_subdirectory(examples) +endif() + +if(CATCH_BUILD_EXTRA_TESTS) + add_subdirectory(tests/ExtraTests) +endif() + +if(CATCH_BUILD_FUZZERS) + add_subdirectory(fuzzing) +endif() + +if (CATCH_DEVELOPMENT_BUILD) + add_warnings_to_targets("${CATCH_WARNING_TARGETS}") +endif() + + +#option(CATCH_USE_VALGRIND "Perform SelfTests with Valgrind" OFF) +#option(CATCH_ENABLE_WERROR "Enable all warnings as errors" ON) +# +#set_property(GLOBAL PROPERTY USE_FOLDERS ON) +# +# +# +# +# +# Only perform the installation steps when Catch is not being used as +# a subproject via `add_subdirectory`, or the destinations will break, +# see https://github.com/catchorg/Catch2/issues/1373 +if (NOT_SUBPROJECT) + configure_package_config_file( + ${CMAKE_CURRENT_LIST_DIR}/CMake/Catch2Config.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/Catch2Config.cmake + INSTALL_DESTINATION + ${CATCH_CMAKE_CONFIG_DESTINATION} + ) + + ## TODO: Catch2 main target? + ## Install some cpp file as well? + + # By default, FooConfigVersion is tied to architecture that it was + # generated on. Because Catch2 is header-only, it is arch-independent + # and thus Catch2ConfigVersion should not be tied to the architecture + # it was generated on. + # + # CMake does not provide a direct customization point for this in + # `write_basic_package_version_file`, but it can be accomplished + # indirectly by temporarily redefining `CMAKE_SIZEOF_VOID_P` to an + # empty string. Note that just undefining the variable could be + # insufficient in cases where the variable was already in CMake cache + set(CATCH2_CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P}) + set(CMAKE_SIZEOF_VOID_P "") + write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/Catch2ConfigVersion.cmake" + COMPATIBILITY + SameMajorVersion + ) + set(CMAKE_SIZEOF_VOID_P ${CATCH2_CMAKE_SIZEOF_VOID_P}) + + install( + FILES + "${CMAKE_CURRENT_BINARY_DIR}/Catch2Config.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/Catch2ConfigVersion.cmake" + DESTINATION + ${CATCH_CMAKE_CONFIG_DESTINATION} + ) + + # Install documentation + if(CATCH_INSTALL_DOCS) + install( + DIRECTORY + docs/ + DESTINATION + "${CMAKE_INSTALL_DOCDIR}" + ) + endif() + + if(CATCH_INSTALL_EXTRAS) + # Install CMake scripts + install( + FILES + "extras/ParseAndAddCatchTests.cmake" + "extras/Catch.cmake" + "extras/CatchAddTests.cmake" + DESTINATION + ${CATCH_CMAKE_CONFIG_DESTINATION} + ) + + # Install debugger helpers + install( + FILES + "extras/gdbinit" + "extras/lldbinit" + DESTINATION + ${CMAKE_INSTALL_DATAROOTDIR}/Catch2 + ) + endif() + + ## Provide some pkg-config integration + set(PKGCONFIG_INSTALL_DIR + "${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig" + CACHE PATH "Path where catch2.pc is installed" + ) + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/CMake/catch2.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/catch2.pc + @ONLY + ) + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/CMake/catch2-with-main.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/catch2-with-main.pc + @ONLY + ) + install( + FILES + "${CMAKE_CURRENT_BINARY_DIR}/catch2.pc" + "${CMAKE_CURRENT_BINARY_DIR}/catch2-with-main.pc" + DESTINATION + ${PKGCONFIG_INSTALL_DIR} + ) + + # CPack/CMake started taking the package version from project version 3.12 + # So we need to set the version manually for older CMake versions + if(${CMAKE_VERSION} VERSION_LESS "3.12.0") + set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) + endif() + + set(CPACK_PACKAGE_CONTACT "https://github.com/catchorg/Catch2/") + + + include( CPack ) + +endif(NOT_SUBPROJECT) diff --git a/packages/Catch2/CODE_OF_CONDUCT.md b/packages/Catch2/CODE_OF_CONDUCT.md new file mode 100644 index 0000000000000000000000000000000000000000..be1a688e01076e92cac4d05c7fb6b1e7e70c48c6 --- /dev/null +++ b/packages/Catch2/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/packages/Catch2/Doxyfile b/packages/Catch2/Doxyfile new file mode 100644 index 0000000000000000000000000000000000000000..6831841678725d6a4486a498d9a4c4acba9bad22 --- /dev/null +++ b/packages/Catch2/Doxyfile @@ -0,0 +1,2484 @@ +# Doxyfile 1.8.16 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the configuration +# file that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# https://www.gnu.org/software/libiconv/ for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = "Catch2" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = "Popular C++ unit testing framework" + +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. + + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = docs/doxygen + +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all generated output in the proper direction. +# Possible values are: None, LTR, RTL and Context. +# The default value is: None. + +OUTPUT_TEXT_DIRECTION = None + +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = YES + +# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line +# such as +# /*************** +# as being the beginning of a Javadoc-style comment "banner". If set to NO, the +# Javadoc-style will behave just like regular comments and it will not be +# interpreted by doxygen. +# The default value is: NO. + +JAVADOC_BANNER = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = YES + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:\n" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". You can put \n's in the value part of an alias to insert +# newlines (in the resulting output). You can put ^^ in the value part of an +# alias to insert a newline as if a physical newline was in the original file. +# When you need a literal { or } or , in the value part of an alias you have to +# escape them by means of a backslash (\), this can lead to conflicts with the +# commands \{ and \} for these it is advised to use the version @{ and @} or use +# a double escape (\\{ and \\}) + +ALIASES = "complexity=@par Complexity:" \ + "noexcept=**Noexcept**" + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding "class=itcl::class" +# will allow you to use the command class in the itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice +# sources only. Doxygen will then generate output that is more tailored for that +# language. For instance, namespaces will be presented as modules, types will be +# separated into more groups, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_SLICE = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, Javascript, +# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, +# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: +# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser +# tries to guess whether the code is fixed or free formatted code, this is the +# default for Fortran type files), VHDL, tcl. For instance to make doxygen treat +# .inc files as Fortran files (default is PHP), and .f files as C (default is +# Fortran), use: inc=Fortran f=C. +# +# Note: For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See https://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 5. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 5 + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = YES + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = YES + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = YES + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual +# methods of a class will be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIV_VIRTUAL = NO + +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = YES + +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = NO + +# This flag is only useful for Objective-C code. If set to YES, local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO, only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO, these classes will be included in the various overviews. This option +# has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# (class|struct|union) declarations. If set to NO, these declarations will be +# included in the documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO, these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file +# names in lower-case letters. If set to YES, upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# (including Cygwin) ands Mac users are advised to set this option to NO. +# The default value is: system dependent. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES, the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = YES + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = YES + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. +# The default value is: YES. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if <section_label> ... \endif and \cond <section_label> +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES, the +# list will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. See also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some parameters +# in a documented function, or documenting parameters that don't exist or using +# markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO, doxygen will only warn about wrong or incomplete +# parameter documentation, but not about the absence of documentation. If +# EXTRACT_ALL is set to YES then this flag will automatically be disabled. +# The default value is: NO. + +WARN_NO_PARAMDOC = YES + +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. +# The default value is: NO. + +WARN_AS_ERROR = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). + +WARN_LOGFILE = doxygen.errors + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING +# Note: If this tag is empty the current directory is searched. + +INPUT = "src/catch2" + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: https://www.gnu.org/software/libiconv/) for the list of +# possible encodings. +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, +# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, +# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, +# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, +# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, *.qsf and *.ice. + +# FILE_PATTERNS = + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = */lib/* + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# <filter> <input-file> +# +# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = NO + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# entity all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = NO + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see https://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = YES + +# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in +# which the alphabetical index list will be split. +# Minimum value: 1, maximum value: 20, default value: 5. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all classes will +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag +# can be used to specify a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). For an example see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the style sheet and background images according to +# this color. Hue is specified as an angle on a colorwheel, see +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use grayscales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting this +# to YES can help to show when doxygen was last run and thus if the +# documentation is up to date. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = NO + +# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML +# documentation will contain a main index with vertical navigation menus that +# are dynamically created via Javascript. If disabled, the navigation index will +# consists of multiple levels of tabs that are statically embedded in every HTML +# page. Disable this option to support browsers that do not have Javascript, +# like the Qt help browser. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_MENUS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: https://developer.apple.com/xcode/), introduced with OSX +# 10.5 (Leopard). To create a documentation set, doxygen will generate a +# Makefile in the HTML output directory. Running make will produce the docset in +# that directory and running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy +# genXcode/_index.html for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# (see: https://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# Windows. +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler (hhc.exe). If non-empty, +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the master .chm file (NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual- +# folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location of Qt's +# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the +# generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can +# further fine-tune the look of the index. As an example, the default style +# sheet generated by doxygen has an example that shows how to put an image at +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has +# the same information as the tab index, you could consider setting +# DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANSPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# https://www.mathjax.org) which uses client side Javascript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = YES + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. See the MathJax site (see: +# http://docs.mathjax.org/en/latest/output.html) for more details. +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility), NativeMML (i.e. MathML) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from https://www.mathjax.org before deployment. +# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = TeX/AMSmath \ + TeX/AMSsymbols + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use <access key> + S +# (what the <access key> is depends on the OS and browser, but it is typically +# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down +# key> to jump into the search results window, the results can be navigated +# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel +# the search. The filter options can be selected when the cursor is inside the +# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys> +# to select a filter and <Enter> or <escape> to activate or cancel the filter +# option. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +SEARCHENGINE = YES + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a web server instead of a web client using Javascript. There +# are two flavors of web server based searching depending on the EXTERNAL_SEARCH +# setting. When disabled, doxygen will generate a PHP script for searching and +# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing +# and searching needs to be provided by external tools. See the section +# "External Indexing and Searching" for details. +# The default value is: NO. +# This tag requires that the tag SEARCHENGINE is set to YES. + +SERVER_BASED_SEARCH = NO + +# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP +# script for searching. Instead the search results are written to an XML file +# which needs to be processed by an external indexer. Doxygen will invoke an +# external search engine pointed to by the SEARCHENGINE_URL option to obtain the +# search results. +# +# Doxygen ships with an example indexer (doxyindexer) and search engine +# (doxysearch.cgi) which are based on the open source search engine library +# Xapian (see: https://xapian.org/). +# +# See the section "External Indexing and Searching" for details. +# The default value is: NO. +# This tag requires that the tag SEARCHENGINE is set to YES. + +EXTERNAL_SEARCH = NO + +# The SEARCHENGINE_URL should point to a search engine hosted by a web server +# which will return the search results when EXTERNAL_SEARCH is enabled. +# +# Doxygen ships with an example indexer (doxyindexer) and search engine +# (doxysearch.cgi) which are based on the open source search engine library +# Xapian (see: https://xapian.org/). See the section "External Indexing and +# Searching" for details. +# This tag requires that the tag SEARCHENGINE is set to YES. + +SEARCHENGINE_URL = + +# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed +# search data is written to a file for indexing by an external tool. With the +# SEARCHDATA_FILE tag the name of this file can be specified. +# The default file is: searchdata.xml. +# This tag requires that the tag SEARCHENGINE is set to YES. + +SEARCHDATA_FILE = searchdata.xml + +# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the +# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is +# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple +# projects and redirect the results back to the right project. +# This tag requires that the tag SEARCHENGINE is set to YES. + +EXTERNAL_SEARCH_ID = + +# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen +# projects other than the one defined by this configuration file, but that are +# all added to the same external search index. Each project needs to have a +# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of +# to a relative location where the documentation can be found. The format is: +# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ... +# This tag requires that the tag SEARCHENGINE is set to YES. + +EXTRA_SEARCH_MAPPINGS = + +#--------------------------------------------------------------------------- +# Configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output. +# The default value is: YES. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: latex. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. +# +# Note that when not enabling USE_PDFLATEX the default is latex when enabling +# USE_PDFLATEX the default is pdflatex and when in the later case latex is +# chosen this is overwritten by pdflatex. For specific output languages the +# default can have been set differently, this depends on the implementation of +# the output language. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate +# index for LaTeX. +# Note: This tag is used in the Makefile / make.bat. +# See also: LATEX_MAKEINDEX_CMD for the part in the generated output file +# (.tex). +# The default file is: makeindex. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +MAKEINDEX_CMD_NAME = makeindex + +# The LATEX_MAKEINDEX_CMD tag can be used to specify the command name to +# generate index for LaTeX. In case there is no backslash (\) as first character +# it will be automatically added in the LaTeX code. +# Note: This tag is used in the generated output file (.tex). +# See also: MAKEINDEX_CMD_NAME for the part in the Makefile / make.bat. +# The default value is: makeindex. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_MAKEINDEX_CMD = makeindex + +# If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX +# documents. This may be useful for small projects and may help to save some +# trees in general. +# The default value is: NO. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used by the +# printer. +# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x +# 14 inches) and executive (7.25 x 10.5 inches). +# The default value is: a4. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +PAPER_TYPE = a4 + +# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names +# that should be included in the LaTeX output. The package can be specified just +# by its name or with the correct syntax as to be used with the LaTeX +# \usepackage command. To get the times font for instance you can specify : +# EXTRA_PACKAGES=times or EXTRA_PACKAGES={times} +# To use the option intlimits with the amsmath package you can specify: +# EXTRA_PACKAGES=[intlimits]{amsmath} +# If left blank no extra packages will be included. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the +# generated LaTeX document. The header should contain everything until the first +# chapter. If it is left blank doxygen will generate a standard header. See +# section "Doxygen usage" for information on how to let doxygen write the +# default header to a separate file. +# +# Note: Only use a user-defined header if you know what you are doing! The +# following commands have a special meaning inside the header: $title, +# $datetime, $date, $doxygenversion, $projectname, $projectnumber, +# $projectbrief, $projectlogo. Doxygen will replace $title with the empty +# string, for the replacement values of the other commands the user is referred +# to HTML_HEADER. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_HEADER = + +# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the +# generated LaTeX document. The footer should contain everything after the last +# chapter. If it is left blank doxygen will generate a standard footer. See +# LATEX_HEADER for more information on how to generate a default footer and what +# special commands can be used inside the footer. +# +# Note: Only use a user-defined footer if you know what you are doing! +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_FOOTER = + +# The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# LaTeX style sheets that are included after the standard style sheets created +# by doxygen. Using this option one can overrule certain style aspects. Doxygen +# will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_EXTRA_STYLESHEET = + +# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the LATEX_OUTPUT output +# directory. Note that the files will be copied as-is; there are no commands or +# markers available. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_EXTRA_FILES = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is +# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will +# contain links (just like the HTML output) instead of page references. This +# makes the output suitable for online browsing using a PDF viewer. +# The default value is: YES. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate +# the PDF file directly from the LaTeX files. Set this option to YES, to get a +# higher quality PDF documentation. +# The default value is: YES. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode +# command to the generated LaTeX files. This will instruct LaTeX to keep running +# if errors occur, instead of asking the user for help. This option is also used +# when generating formulas in HTML. +# The default value is: NO. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_BATCHMODE = YES + +# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the +# index chapters (such as File Index, Compound Index, etc.) in the output. +# The default value is: NO. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_HIDE_INDICES = NO + +# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source +# code with syntax highlighting in the LaTeX output. +# +# Note that which sources are shown also depends on other settings such as +# SOURCE_BROWSER. +# The default value is: NO. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_SOURCE_CODE = NO + +# The LATEX_BIB_STYLE tag can be used to specify the style to use for the +# bibliography, e.g. plainnat, or ieeetr. See +# https://en.wikipedia.org/wiki/BibTeX and \cite for more info. +# The default value is: plain. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_BIB_STYLE = plain + +# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated +# page will contain the date and time when the page was generated. Setting this +# to NO can help when comparing the output of multiple runs. +# The default value is: NO. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_TIMESTAMP = NO + +# The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute) +# path from which the emoji images will be read. If a relative path is entered, +# it will be relative to the LATEX_OUTPUT directory. If left blank the +# LATEX_OUTPUT directory will be used. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_EMOJI_DIRECTORY = + +#--------------------------------------------------------------------------- +# Configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES, doxygen will generate RTF output. The +# RTF output is optimized for Word 97 and may not look too pretty with other RTF +# readers/editors. +# The default value is: NO. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: rtf. +# This tag requires that the tag GENERATE_RTF is set to YES. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES, doxygen generates more compact RTF +# documents. This may be useful for small projects and may help to save some +# trees in general. +# The default value is: NO. +# This tag requires that the tag GENERATE_RTF is set to YES. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will +# contain hyperlink fields. The RTF file will contain links (just like the HTML +# output) instead of page references. This makes the output suitable for online +# browsing using Word or some other Word compatible readers that support those +# fields. +# +# Note: WordPad (write) and others do not support links. +# The default value is: NO. +# This tag requires that the tag GENERATE_RTF is set to YES. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# configuration file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. +# +# See also section "Doxygen usage" for information on how to generate the +# default style sheet that doxygen normally uses. +# This tag requires that the tag GENERATE_RTF is set to YES. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an RTF document. Syntax is +# similar to doxygen's configuration file. A template extensions file can be +# generated using doxygen -e rtf extensionFile. +# This tag requires that the tag GENERATE_RTF is set to YES. + +RTF_EXTENSIONS_FILE = + +# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code +# with syntax highlighting in the RTF output. +# +# Note that which sources are shown also depends on other settings such as +# SOURCE_BROWSER. +# The default value is: NO. +# This tag requires that the tag GENERATE_RTF is set to YES. + +RTF_SOURCE_CODE = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES, doxygen will generate man pages for +# classes and files. +# The default value is: NO. + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. A directory man3 will be created inside the directory specified by +# MAN_OUTPUT. +# The default directory is: man. +# This tag requires that the tag GENERATE_MAN is set to YES. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to the generated +# man pages. In case the manual section does not start with a number, the number +# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is +# optional. +# The default value is: .3. +# This tag requires that the tag GENERATE_MAN is set to YES. + +MAN_EXTENSION = .3 + +# The MAN_SUBDIR tag determines the name of the directory created within +# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by +# MAN_EXTENSION with the initial . removed. +# This tag requires that the tag GENERATE_MAN is set to YES. + +MAN_SUBDIR = + +# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it +# will generate one additional man file for each entity documented in the real +# man page(s). These additional files only source the real man page, but without +# them the man command would be unable to find the correct page. +# The default value is: NO. +# This tag requires that the tag GENERATE_MAN is set to YES. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES, doxygen will generate an XML file that +# captures the structure of the code including all documentation. +# The default value is: NO. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: xml. +# This tag requires that the tag GENERATE_XML is set to YES. + +XML_OUTPUT = xml + +# If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program +# listings (including syntax highlighting and cross-referencing information) to +# the XML output. Note that enabling this will significantly increase the size +# of the XML output. +# The default value is: YES. +# This tag requires that the tag GENERATE_XML is set to YES. + +XML_PROGRAMLISTING = YES + +# If the XML_NS_MEMB_FILE_SCOPE tag is set to YES, doxygen will include +# namespace members in file scope as well, matching the HTML output. +# The default value is: NO. +# This tag requires that the tag GENERATE_XML is set to YES. + +XML_NS_MEMB_FILE_SCOPE = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the DOCBOOK output +#--------------------------------------------------------------------------- + +# If the GENERATE_DOCBOOK tag is set to YES, doxygen will generate Docbook files +# that can be used to generate PDF. +# The default value is: NO. + +GENERATE_DOCBOOK = NO + +# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in +# front of it. +# The default directory is: docbook. +# This tag requires that the tag GENERATE_DOCBOOK is set to YES. + +DOCBOOK_OUTPUT = docbook + +# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the +# program listings (including syntax highlighting and cross-referencing +# information) to the DOCBOOK output. Note that enabling this will significantly +# increase the size of the DOCBOOK output. +# The default value is: NO. +# This tag requires that the tag GENERATE_DOCBOOK is set to YES. + +DOCBOOK_PROGRAMLISTING = NO + +#--------------------------------------------------------------------------- +# Configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an +# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures +# the structure of the code including all documentation. Note that this feature +# is still experimental and incomplete at the moment. +# The default value is: NO. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES, doxygen will generate a Perl module +# file that captures the structure of the code including all documentation. +# +# Note that this feature is still experimental and incomplete at the moment. +# The default value is: NO. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES, doxygen will generate the necessary +# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI +# output from the Perl module output. +# The default value is: NO. +# This tag requires that the tag GENERATE_PERLMOD is set to YES. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES, the Perl module output will be nicely +# formatted so it can be parsed by a human reader. This is useful if you want to +# understand what is going on. On the other hand, if this tag is set to NO, the +# size of the Perl module output will be much smaller and Perl will parse it +# just the same. +# The default value is: YES. +# This tag requires that the tag GENERATE_PERLMOD is set to YES. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file are +# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful +# so different doxyrules.make files included by the same Makefile don't +# overwrite each other's variables. +# This tag requires that the tag GENERATE_PERLMOD is set to YES. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all +# C-preprocessor directives found in the sources and include files. +# The default value is: YES. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names +# in the source code. If set to NO, only conditional compilation will be +# performed. Macro expansion can be done in a controlled way by setting +# EXPAND_ONLY_PREDEF to YES. +# The default value is: NO. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then +# the macro expansion is limited to the macros specified with the PREDEFINED and +# EXPAND_AS_DEFINED tags. +# The default value is: NO. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES, the include files in the +# INCLUDE_PATH will be searched if a #include is found. +# The default value is: YES. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by the +# preprocessor. +# This tag requires that the tag SEARCH_INCLUDES is set to YES. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will be +# used. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that are +# defined before the preprocessor is started (similar to the -D option of e.g. +# gcc). The argument of the tag is a list of macros of the form: name or +# name=definition (no spaces). If the definition and the "=" are omitted, "=1" +# is assumed. To prevent a macro definition from being undefined via #undef or +# recursively expanded use the := operator instead of the = operator. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this +# tag can be used to specify a list of macro names that should be expanded. The +# macro definition that is found in the sources will be used. Use the PREDEFINED +# tag if you want to use a different macro definition that overrules the +# definition found in the source code. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will +# remove all references to function-like macros that are alone on a line, have +# an all uppercase name, and do not end with a semicolon. Such function macros +# are typically used for boiler-plate code, and will confuse the parser if not +# removed. +# The default value is: YES. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration options related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES tag can be used to specify one or more tag files. For each tag +# file the location of the external documentation should be added. The format of +# a tag file without this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where loc1 and loc2 can be relative or absolute paths or URLs. See the +# section "Linking to external documentation" for more information about the use +# of tag files. +# Note: Each tag file must have a unique name (where the name does NOT include +# the path). If a tag file is not located in the directory in which doxygen is +# run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create a +# tag file that is based on the input files it reads. See section "Linking to +# external documentation" for more information about the usage of tag files. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES, all external class will be listed in +# the class index. If set to NO, only the inherited external classes will be +# listed. +# The default value is: NO. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will be +# listed. +# The default value is: YES. + +EXTERNAL_GROUPS = YES + +# If the EXTERNAL_PAGES tag is set to YES, all external pages will be listed in +# the related pages index. If set to NO, only the current project's pages will +# be listed. +# The default value is: YES. + +EXTERNAL_PAGES = YES + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram +# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to +# NO turns the diagrams off. Note that this option also works with HAVE_DOT +# disabled, but it is recommended to install and use dot, since it yields more +# powerful graphs. +# The default value is: YES. + +CLASS_DIAGRAMS = NO + +# You can include diagrams made with dia in doxygen documentation. Doxygen will +# then run dia to produce the diagram and insert it in the documentation. The +# DIA_PATH tag allows you to specify the directory where the dia binary resides. +# If left empty dia is assumed to be found in the default search path. + +DIA_PATH = + +# If set to YES the inheritance and collaboration graphs will hide inheritance +# and usage relations if the target is undocumented or is not a class. +# The default value is: YES. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz (see: +# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent +# Bell Labs. The other options in this section have no effect if this option is +# set to NO +# The default value is: NO. + +HAVE_DOT = YES + +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed +# to run in parallel. When set to 0 doxygen will base this on the number of +# processors available in the system. You can set it explicitly to a value +# larger than 0 to get control over the balance between CPU load and processing +# speed. +# Minimum value: 0, maximum value: 32, default value: 0. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_NUM_THREADS = 0 + +# When you want a differently looking font in the dot files that doxygen +# generates you can specify the font name using DOT_FONTNAME. You need to make +# sure dot is able to find the font, which can be done by putting it in a +# standard location or by setting the DOTFONTPATH environment variable or by +# setting DOT_FONTPATH to the directory containing the font. +# The default value is: Helvetica. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_FONTNAME = Helvetica + +# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of +# dot graphs. +# Minimum value: 4, maximum value: 24, default value: 10. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the default font as specified with +# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set +# the path where dot can find it using this tag. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_FONTPATH = + +# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for +# each documented class showing the direct and indirect inheritance relations. +# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +CLASS_GRAPH = NO + +# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a +# graph for each documented class showing the direct and indirect implementation +# dependencies (inheritance, containment, and class references variables) of the +# class with other documented classes. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +COLLABORATION_GRAPH = NO + +# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for +# groups, showing the direct groups dependencies. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +GROUP_GRAPHS = NO + +# If the UML_LOOK tag is set to YES, doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. +# The default value is: NO. +# This tag requires that the tag HAVE_DOT is set to YES. + +UML_LOOK = NO + +# If the UML_LOOK tag is enabled, the fields and methods are shown inside the +# class node. If there are many fields or methods and many nodes the graph may +# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the +# number of items for each type to make the size more manageable. Set this to 0 +# for no limit. Note that the threshold may be exceeded by 50% before the limit +# is enforced. So when you set the threshold to 10, up to 15 fields may appear, +# but if the number exceeds 15, the total amount of fields shown is limited to +# 10. +# Minimum value: 0, maximum value: 100, default value: 10. +# This tag requires that the tag HAVE_DOT is set to YES. + +UML_LIMIT_NUM_FIELDS = 10 + +# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and +# collaboration graphs will show the relations between templates and their +# instances. +# The default value is: NO. +# This tag requires that the tag HAVE_DOT is set to YES. + +TEMPLATE_RELATIONS = NO + +# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to +# YES then doxygen will generate a graph for each documented file showing the +# direct and indirect include dependencies of the file with other documented +# files. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +INCLUDE_GRAPH = YES + +# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are +# set to YES then doxygen will generate a graph for each documented file showing +# the direct and indirect include dependencies of the file with other documented +# files. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH tag is set to YES then doxygen will generate a call +# dependency graph for every global function or class method. +# +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected +# functions only using the \callgraph command. Disabling a call graph can be +# accomplished by means of the command \hidecallgraph. +# The default value is: NO. +# This tag requires that the tag HAVE_DOT is set to YES. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller +# dependency graph for every global function or class method. +# +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable caller graphs for selected +# functions only using the \callergraph command. Disabling a caller graph can be +# accomplished by means of the command \hidecallergraph. +# The default value is: NO. +# This tag requires that the tag HAVE_DOT is set to YES. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical +# hierarchy of all classes instead of a textual one. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +GRAPHICAL_HIERARCHY = NO + +# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the +# dependencies a directory has on other directories in a graphical way. The +# dependency relations are determined by the #include relations between the +# files in the directories. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +DIRECTORY_GRAPH = NO + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. For an explanation of the image formats see the section +# output formats in the documentation of the dot tool (Graphviz (see: +# http://www.graphviz.org/)). +# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order +# to make the SVG files visible in IE 9+ (other browsers do not have this +# requirement). +# Possible values are: png, jpg, gif, svg, png:gd, png:gd:gd, png:cairo, +# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and +# png:gdiplus:gdiplus. +# The default value is: png. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_IMAGE_FORMAT = png + +# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to +# enable generation of interactive SVG images that allow zooming and panning. +# +# Note that this requires a modern browser other than Internet Explorer. Tested +# and working are Firefox, Chrome, Safari, and Opera. +# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make +# the SVG files visible. Older versions of IE do not have SVG support. +# The default value is: NO. +# This tag requires that the tag HAVE_DOT is set to YES. + +INTERACTIVE_SVG = YES + +# The DOT_PATH tag can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the \dotfile +# command). +# This tag requires that the tag HAVE_DOT is set to YES. + +DOTFILE_DIRS = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the \mscfile +# command). + +MSCFILE_DIRS = + +# The DIAFILE_DIRS tag can be used to specify one or more directories that +# contain dia files that are included in the documentation (see the \diafile +# command). + +DIAFILE_DIRS = + +# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the +# path where java can find the plantuml.jar file. If left blank, it is assumed +# PlantUML is not used or called during a preprocessing step. Doxygen will +# generate a warning when it encounters a \startuml command in this case and +# will not generate output for the diagram. + +PLANTUML_JAR_PATH = + +# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a +# configuration file for plantuml. + +PLANTUML_CFG_FILE = + +# When using plantuml, the specified paths are searched for files specified by +# the !include statement in a plantuml block. + +PLANTUML_INCLUDE_PATH = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes +# that will be shown in the graph. If the number of nodes in a graph becomes +# larger than this value, doxygen will truncate the graph, which is visualized +# by representing a node as a red box. Note that doxygen if the number of direct +# children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that +# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. +# Minimum value: 0, maximum value: 10000, default value: 50. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_GRAPH_MAX_NODES = 100 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs +# generated by dot. A depth value of 3 means that only nodes reachable from the +# root by following a path via at most 3 edges will be shown. Nodes that lay +# further from the root node will be omitted. Note that setting this option to 1 +# or 2 may greatly reduce the computation time needed for large code bases. Also +# note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. +# Minimum value: 0, maximum value: 1000, default value: 0. +# This tag requires that the tag HAVE_DOT is set to YES. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not seem +# to support this out of the box. +# +# Warning: Depending on the platform used, enabling this option may lead to +# badly anti-aliased labels on the edges of a graph (i.e. they become hard to +# read). +# The default value is: NO. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) support +# this, this feature is disabled by default. +# The default value is: NO. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_MULTI_TARGETS = YES + +# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page +# explaining the meaning of the various boxes and arrows in the dot generated +# graphs. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot +# files that are used to generate the various graphs. +# The default value is: YES. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_CLEANUP = YES diff --git a/packages/Catch2/LICENSE.txt b/packages/Catch2/LICENSE.txt new file mode 100644 index 0000000000000000000000000000000000000000..36b7cd93cdfbac762f5be4c6ce276df2ea6305c2 --- /dev/null +++ b/packages/Catch2/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/packages/Catch2/README.md b/packages/Catch2/README.md new file mode 100644 index 0000000000000000000000000000000000000000..d8e08bb717cc4f80dbc37eabca3be574e5ee533b --- /dev/null +++ b/packages/Catch2/README.md @@ -0,0 +1,49 @@ +<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://godbolt.org/z/9x9qoM) +[](https://discord.gg/4CWS9zD) + + +## Catch2 v3 is being developed! + +You are on the `devel` branch, where the next major version, v3, of +Catch2 is being developed. As it is a significant rework, you will +find that parts of this documentation are likely still stuck on v2. + +For stable (and documentation-matching) version of Catch2, [go to the +`v2.x` branch](https://github.com/catchorg/Catch2/tree/v2.x). + +For migrating from the v2 releases to v3, you should look at [our +documentation](docs/migrate-v2-to-v3.md#top). It provides a simple +guidelines on getting started, and collects most common migration +problems. + + +## What's the Catch2? + +Catch2 is mainly a unit testing framework for C++, but it also +provides basic micro-benchmarking features, and simple BDD macros. + +Catch2's main advantage is that using it is both simple and natural. +Tests autoregister themselves and do not have to be named with valid +identifiers, assertions look like normal C++ code, and sections provide +a nice way to share set-up and tear-down code in tests. + + +## 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) or our [Discord](https://discord.gg/4CWS9zD) +* See [who else is using Catch2](docs/opensource-users.md#top) diff --git a/packages/Catch2/WORKSPACE b/packages/Catch2/WORKSPACE new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/packages/Catch2/appveyor.yml b/packages/Catch2/appveyor.yml new file mode 100644 index 0000000000000000000000000000000000000000..86a1df1885e213cd678348b0c65e0d95ee616910 --- /dev/null +++ b/packages/Catch2/appveyor.yml @@ -0,0 +1,127 @@ +version: "{build}-{branch}" + +# If we ever get a backlog larger than clone_depth, builds will fail +# spuriously. I do not think we will ever get 20 deep commits deep though. +clone_depth: 20 + +# We want to build everything, except for branches that are explicitly +# for messing around with travis. +branches: + except: + - /dev-travis.+/ + + +# We need a more up to date pip because Python 2.7 is EOL soon +init: + - set PATH=C:\Python35;C:\Python35\Scripts;%PATH% + + +install: + - ps: if (($env:CONFIGURATION) -eq "Debug" -And ($env:coverage) -eq "1" ) { pip --disable-pip-version-check install codecov } + # This removes our changes to PATH. Keep this step last! + - ps: if (($env:CONFIGURATION) -eq "Debug" -And ($env:coverage) -eq "1" ) { .\tools\misc\installOpenCppCoverage.ps1 } + + +before_build: + # We need to modify PATH again, because it was reset since the "init" step + - set PATH=C:\Python35;C:\Python35\Scripts;%PATH% + - set CXXFLAGS=%additional_flags% + # If we are building examples/extra-tests, we need to regenerate the amalgamated files + - cmd: if "%examples%"=="1" ( python .\tools\scripts\generateAmalgamatedFiles.py ) + # 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: .\tools\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: .\tools\misc\appveyorTestRunScript.bat + + +# Sadly we cannot use the standard "dimensions" based approach towards +# specifying the different builds, as there is no way to add one-offs +# builds afterwards. This means that we will painfully specify each +# build explicitly. +environment: + matrix: + - FLAVOR: VS 2019 x64 Debug + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + platform: x64 + configuration: Debug + + - FLAVOR: VS 2019 x64 Release + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + platform: x64 + configuration: Release + + - FLAVOR: VS 2019 x64 Debug Coverage Examples + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + examples: 1 + coverage: 1 + platform: x64 + configuration: Debug + + - FLAVOR: VS 2019 x64 Debug WMain + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + wmain: 1 + additional_flags: "/D_UNICODE /DUNICODE" + platform: x64 + configuration: Debug + + - FLAVOR: VS 2019 Win32 Debug + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + platform: Win32 + configuration: Debug + + - FLAVOR: VS 2019 x64 Debug Latest Strict + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + additional_flags: "/permissive- /std:c++latest" + platform: x64 + configuration: Debug + + - FLAVOR: VS 2017 x64 Debug + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + platform: x64 + configuration: Debug + + - FLAVOR: VS 2017 x64 Release + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + platform: x64 + configuration: Release + + - FLAVOR: VS 2017 x64 Release Coverage + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + coverage: 1 + platform: x64 + configuration: Debug + + - FLAVOR: VS 2017 Win32 Debug + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + platform: Win32 + configuration: Debug + + - FLAVOR: VS 2017 Win32 Debug Examples + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + examples: 1 + platform: Win32 + configuration: Debug + + - FLAVOR: VS 2017 Win32 Debug WMain + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + wmain: 1 + additional_flags: "/D_UNICODE /DUNICODE" + platform: Win32 + configuration: Debug + + - FLAVOR: VS 2017 x64 Debug Latest Strict + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + additional_flags: "/permissive- /std:c++latest" + platform: x64 + configuration: Debug diff --git a/packages/Catch2/codecov.yml b/packages/Catch2/codecov.yml new file mode 100644 index 0000000000000000000000000000000000000000..357cb5ebd3010dcc699a0b1337bbc1d06741181d --- /dev/null +++ b/packages/Catch2/codecov.yml @@ -0,0 +1,22 @@ +coverage: + precision: 2 + round: nearest + range: "60...90" + status: + project: + default: + threshold: 2% + patch: + default: + target: 80% + ignore: + - "**/external/clara.hpp" + - "tests" + + +codecov: + branch: devel + max_report_age: off + +comment: + layout: "diff" diff --git a/packages/Catch2/conanfile.py b/packages/Catch2/conanfile.py new file mode 100644 index 0000000000000000000000000000000000000000..7c597d49a37bbd78648426df387f6ae1366051a6 --- /dev/null +++ b/packages/Catch2/conanfile.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python +from conans import ConanFile, CMake, tools + +class CatchConan(ConanFile): + name = "catch2" + description = "A modern, C++-native, framework for unit-tests, TDD and BDD" + topics = ("conan", "catch2", "unit-test", "tdd", "bdd") + url = "https://github.com/catchorg/Catch2" + homepage = url + license = "BSL-1.0" + + exports = "LICENSE.txt" + exports_sources = ("src/*", "CMakeLists.txt", "CMake/*", "extras/*") + + settings = "os", "compiler", "build_type", "arch" + + generators = "cmake" + + def _configure_cmake(self): + cmake = CMake(self) + cmake.definitions["BUILD_TESTING"] = "OFF" + cmake.definitions["CATCH_INSTALL_DOCS"] = "OFF" + cmake.definitions["CATCH_INSTALL_HELPERS"] = "ON" + cmake.configure(build_folder="build") + return cmake + + def build(self): + # We need this workaround until the toolchains feature + # to inject stuff like MD/MT + line_to_replace = 'list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake")' + tools.replace_in_file("CMakeLists.txt", line_to_replace, + '''{} +include("{}/conanbuildinfo.cmake") +conan_basic_setup()'''.format(line_to_replace, self.install_folder.replace("\\", "/"))) + + cmake = self._configure_cmake() + cmake.build() + + def package(self): + self.copy(pattern="LICENSE.txt", dst="licenses") + cmake = self._configure_cmake() + cmake.install() + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "Catch2" + self.cpp_info.names["cmake_find_package_multi"] = "Catch2" + # Catch2 + self.cpp_info.components["catch2base"].names["cmake_find_package"] = "Catch2" + self.cpp_info.components["catch2base"].names["cmake_find_package_multi"] = "Catch2" + self.cpp_info.components["catch2base"].names["pkg_config"] = "Catch2" + self.cpp_info.components["catch2base"].libs = ["Catch2"] + # Catch2WithMain + self.cpp_info.components["catch2main"].names["cmake_find_package"] = "Catch2WithMain" + self.cpp_info.components["catch2main"].names["cmake_find_package_multi"] = "Catch2WithMain" + self.cpp_info.components["catch2main"].names["pkg_config"] = "Catch2WithMain" + self.cpp_info.components["catch2main"].libs = ["Catch2Main"] + self.cpp_info.components["catch2main"].requires = ["catch2base"] diff --git a/packages/Catch2/data/artwork/catch2-c-logo.png b/packages/Catch2/data/artwork/catch2-c-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..b1066b8ee7edda10ec0b70d9e207e7c19062ace8 Binary files /dev/null and b/packages/Catch2/data/artwork/catch2-c-logo.png differ diff --git a/packages/Catch2/data/artwork/catch2-hand-logo.png b/packages/Catch2/data/artwork/catch2-hand-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..ab857eaab75d6159d251fa7e50f989edeab193f9 Binary files /dev/null and b/packages/Catch2/data/artwork/catch2-hand-logo.png differ diff --git a/packages/Catch2/data/artwork/catch2-logo-small.png b/packages/Catch2/data/artwork/catch2-logo-small.png new file mode 100644 index 0000000000000000000000000000000000000000..742e81e15ce43f13b1c0fd0f4b3225e76b624382 Binary files /dev/null and b/packages/Catch2/data/artwork/catch2-logo-small.png differ diff --git a/packages/Catch2/docs/Readme.md b/packages/Catch2/docs/Readme.md new file mode 100644 index 0000000000000000000000000000000000000000..821e6fca0d7625a4637c60f47a8b586ef2fc7497 --- /dev/null +++ b/packages/Catch2/docs/Readme.md @@ -0,0 +1,42 @@ +<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) +* [Data Generators](generators.md#top) +* [Other macros](other-macros.md#top) +* [Micro benchmarking](benchmarks.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) + +Odds and ends: +* [CMake integration](cmake-integration.md#top) +* [CI and other miscellaneous pieces](ci-and-misc.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) +* [Migrating from v2 to v3](migrate-v2-to-v3.md#top) +* [Open Source Projects using Catch](opensource-users.md#top) +* [Commercial Projects using Catch](commercial-users.md#top) +* [Contributing](contributing.md#top) +* [Release Notes](release-notes.md#top) +* [Deprecations and incoming changes](deprecations.md#top) diff --git a/packages/Catch2/docs/assertions.md b/packages/Catch2/docs/assertions.md new file mode 100644 index 0000000000000000000000000000000000000000..682eb6e7ce34615ee615e449e53acc2ccf42e9ac --- /dev/null +++ b/packages/Catch2/docs/assertions.md @@ -0,0 +1,201 @@ +<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> +[Expressions with commas](#expressions-with-commas)<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 is a rich set of auxiliary 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: + +```cpp +REQUIRE( performComputation() == Approx( 2.1 ) ); +``` + +Catch also provides a user-defined literal for `Approx`; `_a`. It resides in +the `Catch::literals` namespace and can be used like so: +```cpp +using namespace Catch::literals; +REQUIRE( performComputation() == 2.1_a ); +``` + +`Approx` is constructed with defaults that should cover most simple cases. +For the more complex cases, `Approx` provides 3 customization points: + +* __epsilon__ - epsilon serves to set the coefficient by which a result +can differ from `Approx`'s value 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 differ from `Approx`'s value before it is rejected. +_By default set to `0.0`._ +* __scale__ - scale is used to change the magnitude of `Approx` for relative check. +_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% difference +``` + +#### margin example +```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 difference of at most 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 the [documentation for Matchers](matchers.md#top)). + + +_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). + +## Expressions with commas + +Because the preprocessor parses code using different rules than the +compiler, multiple-argument assertions (e.g. `REQUIRE_THROWS_AS`) have +problems with commas inside the provided expressions. As an example +`REQUIRE_THROWS_AS(std::pair<int, int>(1, 2), std::invalid_argument);` +will fail to compile, because the preprocessor sees 3 arguments provided, +but the macro accepts only 2. There are two possible workarounds. + +1) Use typedef: +```cpp +using int_pair = std::pair<int, int>; +REQUIRE_THROWS_AS(int_pair(1, 2), std::invalid_argument); +``` + +This solution is always applicable, but makes the meaning of the code +less clear. + +2) Parenthesize the expression: +```cpp +TEST_CASE_METHOD((Fixture<int, int>), "foo", "[bar]") { + SUCCEED(); +} +``` + +This solution is not always applicable, because it might require extra +changes on the Catch's side to work. + +--- + +[Home](Readme.md#top) diff --git a/packages/Catch2/docs/benchmarks.md b/packages/Catch2/docs/benchmarks.md new file mode 100644 index 0000000000000000000000000000000000000000..ccc4175b6c346e2136fa379eae649c876c3da2d9 --- /dev/null +++ b/packages/Catch2/docs/benchmarks.md @@ -0,0 +1,250 @@ +<a id="top"></a> +# Authoring benchmarks + +> [Introduced](https://github.com/catchorg/Catch2/issues/1616) in Catch 2.9.0. + +Writing benchmarks is not easy. Catch simplifies certain aspects but you'll +always need to take care about various aspects. Understanding a few things about +the way Catch runs your code will be very helpful when writing your benchmarks. + +First off, let's go over some terminology that will be used throughout this +guide. + +- *User code*: user code is the code that the user provides to be measured. +- *Run*: one run is one execution of the user code. +- *Sample*: one sample is one data point obtained by measuring the time it takes + to perform a certain number of runs. One sample can consist of more than one + run if the clock available does not have enough resolution to accurately + measure a single run. All samples for a given benchmark execution are obtained + with the same number of runs. + +## Execution procedure + +Now I can explain how a benchmark is executed in Catch. There are three main +steps, though the first does not need to be repeated for every benchmark. + +1. *Environmental probe*: before any benchmarks can be executed, the clock's +resolution is estimated. A few other environmental artifacts are also estimated +at this point, like the cost of calling the clock function, but they almost +never have any impact in the results. + +2. *Estimation*: the user code is executed a few times to obtain an estimate of +the amount of runs that should be in each sample. This also has the potential +effect of bringing relevant code and data into the caches before the actual +measurement starts. + +3. *Measurement*: all the samples are collected sequentially by performing the +number of runs estimated in the previous step for each sample. + +This already gives us one important rule for writing benchmarks for Catch: the +benchmarks must be repeatable. The user code will be executed several times, and +the number of times it will be executed during the estimation step cannot be +known beforehand since it depends on the time it takes to execute the code. +User code that cannot be executed repeatedly will lead to bogus results or +crashes. + +## Benchmark specification + +Benchmarks can be specified anywhere inside a Catch test case. +There is a simple and a slightly more advanced version of the `BENCHMARK` macro. + +Let's have a look how a naive Fibonacci implementation could be benchmarked: +```c++ +std::uint64_t Fibonacci(std::uint64_t number) { + return number < 2 ? 1 : Fibonacci(number - 1) + Fibonacci(number - 2); +} +``` +Now the most straight forward way to benchmark this function, is just adding a `BENCHMARK` macro to our test case: +```c++ +TEST_CASE("Fibonacci") { + CHECK(Fibonacci(0) == 1); + // some more asserts.. + CHECK(Fibonacci(5) == 8); + // some more asserts.. + + // now let's benchmark: + BENCHMARK("Fibonacci 20") { + return Fibonacci(20); + }; + + BENCHMARK("Fibonacci 25") { + return Fibonacci(25); + }; + + BENCHMARK("Fibonacci 30") { + return Fibonacci(30); + }; + + BENCHMARK("Fibonacci 35") { + return Fibonacci(35); + }; +} +``` +There's a few things to note: +- As `BENCHMARK` expands to a lambda expression it is necessary to add a semicolon after + the closing brace (as opposed to the first experimental version). +- The `return` is a handy way to avoid the compiler optimizing away the benchmark code. + +Running this already runs the benchmarks and outputs something similar to: +``` +------------------------------------------------------------------------------- +Fibonacci +------------------------------------------------------------------------------- +C:\path\to\Catch2\Benchmark.tests.cpp(10) +............................................................................... +benchmark name samples iterations estimated + mean low mean high mean + std dev low std dev high std dev +------------------------------------------------------------------------------- +Fibonacci 20 100 416439 83.2878 ms + 2 ns 2 ns 2 ns + 0 ns 0 ns 0 ns + +Fibonacci 25 100 400776 80.1552 ms + 3 ns 3 ns 3 ns + 0 ns 0 ns 0 ns + +Fibonacci 30 100 396873 79.3746 ms + 17 ns 17 ns 17 ns + 0 ns 0 ns 0 ns + +Fibonacci 35 100 145169 87.1014 ms + 468 ns 464 ns 473 ns + 21 ns 15 ns 34 ns +``` + +### Advanced benchmarking +The simplest use case shown above, takes no arguments and just runs the user code that needs to be measured. +However, if using the `BENCHMARK_ADVANCED` macro and adding a `Catch::Benchmark::Chronometer` argument after +the macro, some advanced features are available. The contents of the simple benchmarks are invoked once per run, +while the blocks of the advanced benchmarks are invoked exactly twice: +once during the estimation phase, and another time during the execution phase. + +```c++ +BENCHMARK("simple"){ return long_computation(); }; + +BENCHMARK_ADVANCED("advanced")(Catch::Benchmark::Chronometer meter) { + set_up(); + meter.measure([] { return long_computation(); }); +}; +``` + +These advanced benchmarks no longer consist entirely of user code to be measured. +In these cases, the code to be measured is provided via the +`Catch::Benchmark::Chronometer::measure` member function. This allows you to set up any +kind of state that might be required for the benchmark but is not to be included +in the measurements, like making a vector of random integers to feed to a +sorting algorithm. + +A single call to `Catch::Benchmark::Chronometer::measure` performs the actual measurements +by invoking the callable object passed in as many times as necessary. Anything +that needs to be done outside the measurement can be done outside the call to +`measure`. + +The callable object passed in to `measure` can optionally accept an `int` +parameter. + +```c++ +meter.measure([](int i) { return long_computation(i); }); +``` + +If it accepts an `int` parameter, the sequence number of each run will be passed +in, starting with 0. This is useful if you want to measure some mutating code, +for example. The number of runs can be known beforehand by calling +`Catch::Benchmark::Chronometer::runs`; with this one can set up a different instance to be +mutated by each run. + +```c++ +std::vector<std::string> v(meter.runs()); +std::fill(v.begin(), v.end(), test_string()); +meter.measure([&v](int i) { in_place_escape(v[i]); }); +``` + +Note that it is not possible to simply use the same instance for different runs +and resetting it between each run since that would pollute the measurements with +the resetting code. + +It is also possible to just provide an argument name to the simple `BENCHMARK` macro to get +the same semantics as providing a callable to `meter.measure` with `int` argument: + +```c++ +BENCHMARK("indexed", i){ return long_computation(i); }; +``` + +### Constructors and destructors + +All of these tools give you a lot mileage, but there are two things that still +need special handling: constructors and destructors. The problem is that if you +use automatic objects they get destroyed by the end of the scope, so you end up +measuring the time for construction and destruction together. And if you use +dynamic allocation instead, you end up including the time to allocate memory in +the measurements. + +To solve this conundrum, Catch provides class templates that let you manually +construct and destroy objects without dynamic allocation and in a way that lets +you measure construction and destruction separately. + +```c++ +BENCHMARK_ADVANCED("construct")(Catch::Benchmark::Chronometer meter) { + std::vector<Catch::Benchmark::storage_for<std::string>> storage(meter.runs()); + meter.measure([&](int i) { storage[i].construct("thing"); }); +}; + +BENCHMARK_ADVANCED("destroy")(Catch::Benchmark::Chronometer meter) { + std::vector<Catch::Benchmark::destructable_object<std::string>> storage(meter.runs()); + for(auto&& o : storage) + o.construct("thing"); + meter.measure([&](int i) { storage[i].destruct(); }); +}; +``` + +`Catch::Benchmark::storage_for<T>` objects are just pieces of raw storage suitable for `T` +objects. You can use the `Catch::Benchmark::storage_for::construct` member function to call a constructor and +create an object in that storage. So if you want to measure the time it takes +for a certain constructor to run, you can just measure the time it takes to run +this function. + +When the lifetime of a `Catch::Benchmark::storage_for<T>` object ends, if an actual object was +constructed there it will be automatically destroyed, so nothing leaks. + +If you want to measure a destructor, though, we need to use +`Catch::Benchmark::destructable_object<T>`. These objects are similar to +`Catch::Benchmark::storage_for<T>` in that construction of the `T` object is manual, but +it does not destroy anything automatically. Instead, you are required to call +the `Catch::Benchmark::destructable_object::destruct` member function, which is what you +can use to measure the destruction time. + +### The optimizer + +Sometimes the optimizer will optimize away the very code that you want to +measure. There are several ways to use results that will prevent the optimiser +from removing them. You can use the `volatile` keyword, or you can output the +value to standard output or to a file, both of which force the program to +actually generate the value somehow. + +Catch adds a third option. The values returned by any function provided as user +code are guaranteed to be evaluated and not optimised out. This means that if +your user code consists of computing a certain value, you don't need to bother +with using `volatile` or forcing output. Just `return` it from the function. +That helps with keeping the code in a natural fashion. + +Here's an example: + +```c++ +// may measure nothing at all by skipping the long calculation since its +// result is not used +BENCHMARK("no return"){ long_calculation(); }; + +// the result of long_calculation() is guaranteed to be computed somehow +BENCHMARK("with return"){ return long_calculation(); }; +``` + +However, there's no other form of control over the optimizer whatsoever. It is +up to you to write a benchmark that actually measures what you want and doesn't +just measure the time to do a whole bunch of nothing. + +To sum up, there are two simple rules: whatever you would do in handwritten code +to control optimization still works in Catch; and Catch makes return values +from user code into observable effects that can't be optimized away. + +<i>Adapted from nonius' documentation.</i> diff --git a/packages/Catch2/docs/ci-and-misc.md b/packages/Catch2/docs/ci-and-misc.md new file mode 100644 index 0000000000000000000000000000000000000000..40b7cec9270010cd631bc19b130a852544222a9d --- /dev/null +++ b/packages/Catch2/docs/ci-and-misc.md @@ -0,0 +1,112 @@ +<a id="top"></a> +# CI and other odd pieces + +**Contents**<br> +[Continuous Integration systems](#continuous-integration-systems)<br> +[Other reporters](#other-reporters)<br> +[Low-level tools](#low-level-tools)<br> +[CMake](#cmake)<br> + +This page talks about how Catch integrates with Continuous Integration +Build Systems may refer to low-level tools, like CMake, or larger systems that run on servers, like Jenkins or TeamCity. This page will talk about both. + +## 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, Automake and SonarQube 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. + +### SonarQube Reporter +```-r sonarqube``` +[SonarQube Generic Test Data](https://docs.sonarqube.org/latest/analysis/generic-test/) XML format for tests metrics. + +## 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 + + +### 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 + + +### pkg-config + +Catch2 provides a rudimentary pkg-config integration, by registering itself +under the name `catch2`. This means that after Catch2 is installed, you +can use `pkg-config` to get its include path: `pkg-config --cflags catch2`. + +### gdb and lldb scripts + +Catch2's `contrib` folder also contains two simple debugger scripts, +`gdbinit` for `gdb` and `lldbinit` for `lldb`. If loaded into their +respective debugger, these will tell it to step over Catch2's internals +when stepping through code. + + +## CMake + +[As it has been getting kinda long, the documentation of Catch2's +integration with CMake has been moved to its own page.](cmake-integration.md#top) + + +--- + +[Home](Readme.md#top) diff --git a/packages/Catch2/docs/cmake-integration.md b/packages/Catch2/docs/cmake-integration.md new file mode 100644 index 0000000000000000000000000000000000000000..59e06842c93a10887e6a629c18b79386952a138d --- /dev/null +++ b/packages/Catch2/docs/cmake-integration.md @@ -0,0 +1,287 @@ +<a id="top"></a> +# CMake integration + +**Contents**<br> +[CMake target](#cmake-target)<br> +[Automatic test registration](#automatic-test-registration)<br> +[CMake project options](#cmake-project-options)<br> +[Installing Catch2 from git repository](#installing-catch2-from-git-repository)<br> +[Installing Catch2 from vcpkg](#installing-catch2-from-vcpkg)<br> + +Because we use CMake to build Catch2, we also provide a couple of +integration points for our users. + +1) Catch2 exports a (namespaced) CMake target +2) Catch2's repository contains CMake scripts for automatic registration +of `TEST_CASE`s in CTest + +## CMake target + +Catch2's CMake build exports an interface target `Catch2::Catch2`. Linking +against it will add the proper include path and all necessary capabilities +to the resulting binary. + +This means that if Catch2 has been installed on the system, it should be +enough to do: +```cmake +find_package(Catch2 REQUIRED) +add_executable(tests test.cpp) +target_link_libraries(tests PRIVATE Catch2::Catch2) +``` + + +This target is also provided when Catch2 is used as a subdirectory. +Assuming that Catch2 has been cloned to `lib/Catch2`: +```cmake +add_subdirectory(lib/Catch2) +add_executable(tests test.cpp) +target_link_libraries(tests PRIVATE Catch2::Catch2) +``` + +Another possibility is to use [FetchContent](https://cmake.org/cmake/help/latest/module/FetchContent.html): +```cmake +Include(FetchContent) + +FetchContent_Declare( + Catch2 + GIT_REPOSITORY https://github.com/catchorg/Catch2.git + GIT_TAG v2.13.1) + +FetchContent_MakeAvailable(Catch2) + +add_executable(tests test.cpp) +target_link_libraries(tests PRIVATE Catch2::Catch2) +``` + +## Automatic test registration + +Catch2's repository also contains two CMake scripts that help users +with automatically registering their `TEST_CASE`s with CTest. They +can be found in the `extras` folder, and are + +1) `Catch.cmake` (and its dependency `CatchAddTests.cmake`) +2) `ParseAndAddCatchTests.cmake` + +If Catch2 has been installed in system, both of these can be used after +doing `find_package(Catch2 REQUIRED)`. Otherwise you need to add them +to your CMake module path. + +### `Catch.cmake` and `CatchAddTests.cmake` + +`Catch.cmake` provides function `catch_discover_tests` to get tests from +a target. This function works by running the resulting executable with +`--list-test-names-only` flag, and then parsing the output to find all +existing tests. + +#### Usage +```cmake +cmake_minimum_required(VERSION 3.5) + +project(baz LANGUAGES CXX VERSION 0.0.1) + +find_package(Catch2 REQUIRED) +add_executable(foo test.cpp) +target_link_libraries(foo PRIVATE Catch2::Catch2) + +include(CTest) +include(Catch) +catch_discover_tests(foo) +``` + + +#### Customization +`catch_discover_tests` can be given several extra argumets: +```cmake +catch_discover_tests(target + [TEST_SPEC arg1...] + [EXTRA_ARGS arg1...] + [WORKING_DIRECTORY dir] + [TEST_PREFIX prefix] + [TEST_SUFFIX suffix] + [PROPERTIES name1 value1...] + [TEST_LIST var] + [REPORTER reporter] + [OUTPUT_DIR dir] + [OUTPUT_PREFIX prefix] + [OUTPUT_SUFFIX suffix] +) +``` + +* `TEST_SPEC arg1...` + +Specifies test cases, wildcarded test cases, tags and tag expressions to +pass to the Catch executable alongside the `--list-test-names-only` flag. + + +* `EXTRA_ARGS arg1...` + +Any extra arguments to pass on the command line to each test case. + + +* `WORKING_DIRECTORY dir` + +Specifies the directory in which to run the discovered test cases. If this +option is not provided, the current binary directory is used. + + +* `TEST_PREFIX prefix` + +Specifies a _prefix_ to be added to the name of each discovered test case. +This can be useful when the same test executable is being used in multiple +calls to `catch_discover_tests()`, with different `TEST_SPEC` or `EXTRA_ARGS`. + + +* `TEST_SUFFIX suffix` + +Same as `TEST_PREFIX`, except it specific the _suffix_ for the test names. +Both `TEST_PREFIX` and `TEST_SUFFIX` can be specified at the same time. + + +* `PROPERTIES name1 value1...` + +Specifies additional properties to be set on all tests discovered by this +invocation of `catch_discover_tests`. + + +* `TEST_LIST var` + +Make the list of tests available in the variable `var`, rather than the +default `<target>_TESTS`. This can be useful when the same test +executable is being used in multiple calls to `catch_discover_tests()`. +Note that this variable is only available in CTest. + +* `REPORTER reporter` + +Use the specified reporter when running the test case. The reporter will +be passed to the test runner as `--reporter reporter`. + +* `OUTPUT_DIR dir` + +If specified, the parameter is passed along as +`--out dir/<test_name>` to test executable. The actual file name is the +same as the test name. This should be used instead of +`EXTRA_ARGS --out foo` to avoid race conditions writing the result output +when using parallel test execution. + +* `OUTPUT_PREFIX prefix` + +May be used in conjunction with `OUTPUT_DIR`. +If specified, `prefix` is added to each output file name, like so +`--out dir/prefix<test_name>`. + +* `OUTPUT_SUFFIX suffix` + +May be used in conjunction with `OUTPUT_DIR`. +If specified, `suffix` is added to each output file name, like so +`--out dir/<test_name>suffix`. This can be used to add a file extension to +the output file name e.g. ".xml". + + +### `ParseAndAddCatchTests.cmake` + +`ParseAndAddCatchTests` works by parsing all implementation files +associated with the provided target, and registering them via CTest's +`add_test`. This approach has some limitations, such as the fact that +commented-out tests will be registered anyway. + + +#### Usage + +```cmake +cmake_minimum_required(VERSION 3.5) + +project(baz LANGUAGES CXX VERSION 0.0.1) + +find_package(Catch2 REQUIRED) +add_executable(foo test.cpp) +target_link_libraries(foo PRIVATE Catch2::Catch2) + +include(CTest) +include(ParseAndAddCatchTests) +ParseAndAddCatchTests(foo) +``` + + +#### Customization + +`ParseAndAddCatchTests` provides some customization points: +* `PARSE_CATCH_TESTS_VERBOSE` -- When `ON`, the script prints debug +messages. Defaults to `OFF`. +* `PARSE_CATCH_TESTS_NO_HIDDEN_TESTS` -- When `ON`, hidden tests (tests +tagged with either of `[.]` or `[.foo]`) will not be registered. +Defaults to `OFF`. +* `PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME` -- When `ON`, adds fixture +class name to the test name in CTest. Defaults to `ON`. +* `PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME` -- When `ON`, adds target +name to the test name in CTest. Defaults to `ON`. +* `PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS` -- When `ON`, adds test +file to `CMAKE_CONFIGURE_DEPENDS`. This means that the CMake configuration +step will be re-ran when the test files change, letting new tests be +automatically discovered. Defaults to `OFF`. + + +Optionally, one can specify a launching command to run tests by setting the +variable `OptionalCatchTestLauncher` before calling `ParseAndAddCatchTests`. For +instance to run some tests using `MPI` and other sequentially, one can write +```cmake +set(OptionalCatchTestLauncher ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${NUMPROC}) +ParseAndAddCatchTests(mpi_foo) +unset(OptionalCatchTestLauncher) +ParseAndAddCatchTests(bar) +``` + +## CMake project options + +Catch2's CMake project also provides some options for other projects +that consume it. These are + +* `CATCH_BUILD_TESTING` -- When `ON`, Catch2's SelfTest project will be +built. Defaults to `ON`. Note that Catch2 also obeys `BUILD_TESTING` CMake +variable, so _both_ of them need to be `ON` for the SelfTest to be built, +and either of them can be set to `OFF` to disable building SelfTest. +* `CATCH_BUILD_EXAMPLES` -- When `ON`, Catch2's usage examples will be +built. Defaults to `OFF`. +* `CATCH_INSTALL_DOCS` -- When `ON`, Catch2's documentation will be +included in the installation. Defaults to `ON`. +* `CATCH_INSTALL_HELPERS` -- When `ON`, Catch2's contrib folder will be +included in the installation. Defaults to `ON`. +* `BUILD_TESTING` -- When `ON` and the project is not used as a subproject, +Catch2's test binary will be built. Defaults to `ON`. + + +## Installing Catch2 from git repository + +If you cannot install Catch2 from a package manager (e.g. Ubuntu 16.04 +provides catch only in version 1.2.0) you might want to install it from +the repository instead. Assuming you have enough rights, you can just +install it to the default location, like so: +``` +$ git clone https://github.com/catchorg/Catch2.git +$ cd Catch2 +$ cmake -Bbuild -H. -DBUILD_TESTING=OFF +$ sudo cmake --build build/ --target install +``` + +If you do not have superuser rights, you will also need to specify +[CMAKE_INSTALL_PREFIX](https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html) +when configuring the build, and then modify your calls to +[find_package](https://cmake.org/cmake/help/latest/command/find_package.html) +accordingly. + +## Installing Catch2 from vcpkg + +Alternatively, you can build and install Catch2 using [vcpkg](https://github.com/microsoft/vcpkg/) dependency manager: +``` +git clone https://github.com/Microsoft/vcpkg.git +cd vcpkg +./bootstrap-vcpkg.sh +./vcpkg integrate install +./vcpkg install catch2 +``` + +The catch2 port in vcpkg is kept up to date by microsoft team members and community contributors. +If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository. + +--- + +[Home](Readme.md#top) diff --git a/packages/Catch2/docs/command-line.md b/packages/Catch2/docs/command-line.md new file mode 100644 index 0000000000000000000000000000000000000000..a14acf7f2f35866be154790b904b9678dc34dd1c --- /dev/null +++ b/packages/Catch2/docs/command-line.md @@ -0,0 +1,421 @@ +<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 the number of benchmark samples to collect](#specify-the-number-of-benchmark-samples-to-collect)<br> +[Specify the number of resamples for bootstrapping](#specify-the-number-of-resamples-for-bootstrapping)<br> +[Specify the confidence-interval for bootstrapping](#specify-the-confidence-interval-for-bootstrapping)<br> +[Disable statistical analysis of collected benchmark samples](#disable-statistical-analysis-of-collected-benchmark-samples)<br> +[Specify the amount of time in milliseconds spent on warming up each test](#specify-the-amount-of-time-in-milliseconds-spent-on-warming-up-each-test)<br> +[Usage](#usage)<br> +[Specify the section to run](#specify-the-section-to-run)<br> +[Filenames as tags](#filenames-as-tags)<br> +[Override output colouring](#override-output-colouring)<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 following 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-samples"> ` --benchmark-samples`</a><br /> +<a href="#benchmark-resamples"> ` --benchmark-resamples`</a><br /> +<a href="#benchmark-confidence-interval"> ` --benchmark-confidence-interval`</a><br /> +<a href="#benchmark-no-analysis"> ` --benchmark-no-analysis`</a><br /> +<a href="#benchmark-warmup-time"> ` --benchmark-warmup-time`</a><br /> +<a href="#use-colour"> ` --use-colour`</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 precedence, 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 +-# [#somefile] Matches all tests from the file 'somefile.cpp' +</pre> + +Names within square brackets are interpreted as tags. +A series of tags form an AND expression whereas 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 Jenkins. 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> + +Under most debuggers Catch2 is capable of automatically breaking on a test +failure. This allows the user to see the current state of the test during +failure. + +<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 suspicious test states. There are currently two +available warnings + +``` + NoAssertions // Fail test case / leaf section if no assertions + // (e.g. `REQUIRE`) is encountered. + NoTests // Return non-zero exit code when no test cases were run + // Also calls reporter's noMatchingTestCases method +``` + + +<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. + +<pre>-D, --min-duration <value></pre> + +> `--min-duration` was [introduced](https://github.com/catchorg/Catch2/pull/1910) in Catch 2.13.0 + +When set, Catch will report the duration of each test case that took more +than <value> seconds, in milliseconds. This option is overriden by both +`-d yes` and `-d no`, so that either all durations are reported, or none +are. + + +<a id="input-file"></a> +## Load test names to run from a file +<pre>-f, --input-file <filename></pre> + +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 (this is the default order if no --order argument is provided). +Tests in the same TU are sorted using their declaration orders, different +TUs are in an implementation (linking) dependent order. + + +### lex +Lexicographic order. Tests are sorted by their name, their tags are ignored. + + +### rand + +Randomly sorted. The order is dependent on Catch2's random seed (see +[`--rng-seed`](#rng-seed)), and is subset invariant. What this means +is that as long as the random seed is fixed, running only some tests +(e.g. via tag) does not change their relative order. + +> The subset stability was introduced in Catch2 v2.12.0 + + +<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 some cases, you might need to pass the keyword ```time``` in double quotes instead of single quotes. + +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 <never|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-samples"></a> +## Specify the number of benchmark samples to collect +<pre>--benchmark-samples <# of samples></pre> + +> [Introduced](https://github.com/catchorg/Catch2/issues/1616) in Catch 2.9.0. + +When running benchmarks a number of "samples" is collected. This is the base data for later statistical analysis. +Per sample a clock resolution dependent number of iterations of the user code is run, which is independent of the number of samples. Defaults to 100. + +<a id="benchmark-resamples"></a> +## Specify the number of resamples for bootstrapping +<pre>--benchmark-resamples <# of resamples></pre> + +> [Introduced](https://github.com/catchorg/Catch2/issues/1616) in Catch 2.9.0. + +After the measurements are performed, statistical [bootstrapping] is performed +on the samples. The number of resamples for that bootstrapping is configurable +but defaults to 100000. Due to the bootstrapping it is possible to give +estimates for the mean and standard deviation. The estimates come with a lower +bound and an upper bound, and the confidence interval (which is configurable but +defaults to 95%). + + [bootstrapping]: http://en.wikipedia.org/wiki/Bootstrapping_%28statistics%29 + +<a id="benchmark-confidence-interval"></a> +## Specify the confidence-interval for bootstrapping +<pre>--benchmark-confidence-interval <confidence-interval></pre> + +> [Introduced](https://github.com/catchorg/Catch2/issues/1616) in Catch 2.9.0. + +The confidence-interval is used for statistical bootstrapping on the samples to +calculate the upper and lower bounds of mean and standard deviation. +Must be between 0 and 1 and defaults to 0.95. + +<a id="benchmark-no-analysis"></a> +## Disable statistical analysis of collected benchmark samples +<pre>--benchmark-no-analysis</pre> + +> [Introduced](https://github.com/catchorg/Catch2/issues/1616) in Catch 2.9.0. + +When this flag is specified no bootstrapping or any other statistical analysis is performed. +Instead the user code is only measured and the plain mean from the samples is reported. + +<a id="benchmark-warmup-time"></a> +## Specify the amount of time in milliseconds spent on warming up each test +<pre>--benchmark-warmup-time</pre> + +> [Introduced](https://github.com/catchorg/Catch2/pull/1844) in Catch 2.11.2. + +Configure the amount of time spent warming up each test. + +<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]`. + +<a id="use-colour"></a> +## Override output colouring +<pre>--use-colour <yes|no|auto></pre> + +Catch colours output for terminals, but omits colouring when it detects that +output is being sent to a pipe. This is done to avoid interfering with automated +processing of output. + +`--use-colour yes` forces coloured output, `--use-colour no` disables coloured +output. The default behaviour is `--use-colour auto`. + +--- + +[Home](Readme.md#top) diff --git a/packages/Catch2/docs/commercial-users.md b/packages/Catch2/docs/commercial-users.md new file mode 100644 index 0000000000000000000000000000000000000000..7d2e87d387b52ed7c96aab1d5d30f60d07437dfd --- /dev/null +++ b/packages/Catch2/docs/commercial-users.md @@ -0,0 +1,22 @@ +<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 + - [Bloomlife](https://bloomlife.com) + - NASA + - [Inscopix Inc.](https://www.inscopix.com/) + - [Makimo](https://makimo.pl/) + - [UX3D](https://ux3d.io) + - [King](https://king.com) + diff --git a/packages/Catch2/docs/configuration.md b/packages/Catch2/docs/configuration.md new file mode 100644 index 0000000000000000000000000000000000000000..e80f695e78f22b847a436b6bf033828c1df9be9c --- /dev/null +++ b/packages/Catch2/docs/configuration.md @@ -0,0 +1,254 @@ +<a id="top"></a> +# Compile-time configuration + +**Contents**<br> +[Prefixing Catch macros](#prefixing-catch-macros)<br> +[Terminal colour](#terminal-colour)<br> +[Console width](#console-width)<br> +[stdout](#stdout)<br> +[Fallback stringifier](#fallback-stringifier)<br> +[Default reporter](#default-reporter)<br> +[C++11 toggles](#c11-toggles)<br> +[C++17 toggles](#c17-toggles)<br> +[Other toggles](#other-toggles)<br> +[Windows header clutter](#windows-header-clutter)<br> +[Enabling stringification](#enabling-stringification)<br> +[Disabling exceptions](#disabling-exceptions)<br> +[Overriding Catch's debug break (`-b`)](#overriding-catchs-debug-break--b)<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. + + +## 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 + +To support platforms that do not provide `std::cout`, `std::cerr` and +`std::clog`, Catch does not use them directly, but rather calls +`Catch::cout`, `Catch::cerr` and `Catch::clog`. You can replace their +implementation by defining `CATCH_CONFIG_NOSTDOUT` and implementing +them yourself, their signatures are: + + std::ostream& cout(); + std::ostream& cerr(); + std::ostream& clog(); + +[You can see an example of replacing these functions here.]( +../examples/231-Cfg-OutputStreams.cpp) + + +## Fallback stringifier + +By default, when Catch's stringification machinery has to stringify +a type that does not specialize `StringMaker`, does not overload `operator<<`, +is not an enumeration and is not a range, it uses `"{?}"`. This can be +overridden by defining `CATCH_CONFIG_FALLBACK_STRINGIFIER` to name of a +function that should perform the stringification instead. + +All types that do not provide `StringMaker` specialization or `operator<<` +overload will be sent to this function (this includes enums and ranges). +The provided function must return `std::string` and must accept any type, +e.g. via overloading. + +_Note that if the provided function does not handle a type and this type +requires to be stringified, the compilation will fail._ + + +## Default reporter + +Catch's default reporter can be changed by defining macro +`CATCH_CONFIG_DEFAULT_REPORTER` to string literal naming the desired +default reporter. + +This means that defining `CATCH_CONFIG_DEFAULT_REPORTER` to `"console"` +is equivalent with the out-of-the-box experience. + + +## C++11 toggles + + CATCH_CONFIG_CPP11_TO_STRING // Use `std::to_string` + +Because we support platforms whose standard library does not contain +`std::to_string`, it is possible to force Catch to use a workaround +based on `std::stringstream`. On platforms other than Android, +the default is to use `std::to_string`. On Android, the default is to +use the `stringstream` workaround. As always, it is possible to override +Catch's selection, by defining either `CATCH_CONFIG_CPP11_TO_STRING` or +`CATCH_CONFIG_NO_CPP11_TO_STRING`. + + +## C++17 toggles + + CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS // Override std::uncaught_exceptions (instead of std::uncaught_exception) support detection + CATCH_CONFIG_CPP17_STRING_VIEW // Override std::string_view support detection (Catch provides a StringMaker specialization by default) + CATCH_CONFIG_CPP17_VARIANT // Override std::variant support detection (checked by CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER) + CATCH_CONFIG_CPP17_OPTIONAL // Override std::optional support detection (checked by CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER) + CATCH_CONFIG_CPP17_BYTE // Override std::byte support detection (Catch provides a StringMaker specialization by default) + +> `CATCH_CONFIG_CPP17_STRING_VIEW` was [introduced](https://github.com/catchorg/Catch2/issues/1376) in Catch 2.4.1. + +Catch contains basic compiler/standard detection and attempts to use +some C++17 features whenever appropriate. This automatic detection +can be manually overridden in both directions, that is, a feature +can be enabled by defining the macro in the table above, and disabled +by using `_NO_` in the macro, e.g. `CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS`. + + +## 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_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 + CATCH_CONFIG_WCHAR // Enables use of wchart_t + CATCH_CONFIG_EXPERIMENTAL_REDIRECT // Enables the new (experimental) way of capturing stdout/stderr + CATCH_CONFIG_USE_ASYNC // Force parallel statistical processing of samples during benchmarking + CATCH_CONFIG_ANDROID_LOGWRITE // Use android's logging system for debug output + CATCH_CONFIG_GLOBAL_NEXTAFTER // Use nextafter{,f,l} instead of std::nextafter + +> [`CATCH_CONFIG_ANDROID_LOGWRITE`](https://github.com/catchorg/Catch2/issues/1743) and [`CATCH_CONFIG_GLOBAL_NEXTAFTER`](https://github.com/catchorg/Catch2/pull/1739) were introduced in Catch 2.10.0 + +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. This option only works when linking against the default +main, and must be defined for the whole library build. + +`CATCH_CONFIG_WCHAR` is on by default, but can be disabled. Currently +it is only used in support for DJGPP cross-compiler. + +With the exception of `CATCH_CONFIG_EXPERIMENTAL_REDIRECT`, +these toggles can be disabled by using `_NO_` form of the toggle, +e.g. `CATCH_CONFIG_NO_WINDOWS_SEH`. + +### `CATCH_CONFIG_FAST_COMPILE` +This compile-time flag speeds up compilation of assertion macros by ~20%, +by disabling the generation of assertion-local try-catch blocks for +non-exception family of assertion macros ({`REQUIRE`,`CHECK`}{``,`_FALSE`, `_THAT`}). +This disables translation of exceptions thrown under these assertions, 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. + +### `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_VARIANT_STRINGMAKER // Provide StringMaker specialization for std::variant, std::monostate (on C++17) + CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER // Provide StringMaker specialization for std::optional (on C++17) + CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS // Defines all of the above + +> `CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER` was [introduced](https://github.com/catchorg/Catch2/issues/1380) in Catch 2.4.1. + +> `CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER` was [introduced](https://github.com/catchorg/Catch2/issues/1510) in Catch 2.6.0. + +## Disabling exceptions + +> Introduced in Catch 2.4.0. + +By default, Catch2 uses exceptions to signal errors and to abort tests +when an assertion from the `REQUIRE` family of assertions fails. We also +provide an experimental support for disabling exceptions. Catch2 should +automatically detect when it is compiled with exceptions disabled, but +it can be forced to compile without exceptions by defining + + CATCH_CONFIG_DISABLE_EXCEPTIONS + +Note that when using Catch2 without exceptions, there are 2 major +limitations: + +1) If there is an error that would normally be signalled by an exception, +the exception's message will instead be written to `Catch::cerr` and +`std::terminate` will be called. +2) If an assertion from the `REQUIRE` family of macros fails, +`std::terminate` will be called after the active reporter returns. + + +There is also a customization point for the exact behaviour of what +happens instead of exception being thrown. To use it, define + + CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER + +and provide a definition for this function: + +```cpp +namespace Catch { + [[noreturn]] + void throw_exception(std::exception const&); +} +``` + +## Overriding Catch's debug break (`-b`) + +> [Introduced](https://github.com/catchorg/Catch2/pull/1846) in Catch 2.11.2. + +You can override Catch2's break-into-debugger code by defining the +`CATCH_BREAK_INTO_DEBUGGER()` macro. This can be used if e.g. Catch2 does +not know your platform, or your platform is misdetected. + +The macro will be used as is, that is, `CATCH_BREAK_INTO_DEBUGGER();` +must compile and must break into debugger. + + +--- + +[Home](Readme.md#top) diff --git a/packages/Catch2/docs/contributing.md b/packages/Catch2/docs/contributing.md new file mode 100644 index 0000000000000000000000000000000000000000..ddf8dea26d4368a3d2833a7535c55f5ff081ab0f --- /dev/null +++ b/packages/Catch2/docs/contributing.md @@ -0,0 +1,262 @@ +<a id="top"></a> +# Contributing to Catch2 + +**Contents**<br> +[Using Git(Hub)](#using-github)<br> +[Testing your changes](#testing-your-changes)<br> +[Writing documentation](#writing-documentation)<br> +[Writing code](#writing-code)<br> +[CoC](#coc)<br> + +So you want to contribute something to Catch2? That's great! Whether it's +a bug fix, a new feature, support for additional compilers - or just +a fix to the documentation - all contributions are very welcome and very +much appreciated. Of course so are bug reports, other comments, and +questions, but generally it is a better idea to ask questions in our +[Discord](https://discord.gg/4CWS9zD), than in the issue tracker. + + +This page covers some guidelines and helpful tips for contributing +to the codebase itself. + +## Using Git(Hub) + +Ongoing development happens in the `devel` branch for Catch2 v3, and in +`v2.x` for maintenance updates to the v2 versions. + +Commits should be small and atomic. A commit is atomic when, after it is +applied, the codebase, tests and all, still works as expected. Small +commits are also prefered, as they make later operations with git history, +whether it is bisecting, reverting, or something else, easier. + +_When submitting a pull request please do not include changes to the +amalgamated distribution files. This means do not include them in your +git commits!_ + +When addressing review comments in a MR, please do not rebase/squash the +commits immediately. Doing so makes it harder to review the new changes, +slowing down the process of merging a MR. Instead, when addressing review +comments, you should append new commits to the branch and only squash +them into other commits when the MR is ready to be merged. We recommend +creating new commits with `git commit --fixup` (or `--squash`) and then +later squashing them with `git rebase --autosquash` to make things easier. + + + +## Testing your changes + +_Note: Running Catch2's tests requires Python3_ + + +Catch2 has multiple layers of tests that are then run as part of our CI. +The most obvious one are the unit tests compiled into the `SelfTest` +binary. These are then used in "Approval tests", which run (almost) all +tests from `SelfTest` through a specific reporter and then compare the +generated output with a known good output ("Baseline"). By default, new +tests should be placed here. + +However, not all tests can be written as plain unit tests. For example, +checking that Catch2 orders tests randomly when asked to, and that this +random ordering is subset-invariant, is better done as an integration +test using an external check script. Catch2 integration tests are written +using CTest, either as a direct command invocation + pass/fail regex, +or by delegating the check to a Python script. + +There are also two more kinds of tests, examples and "ExtraTests". +Examples present a small and self-contained snippets of code that +use Catch2's facilities for specific purpose. Currently they are assumed +passing if they compile. ExtraTests then are expensive tests, that we +do not want to run all the time. This can be either because they take +a long time to run, or because they take a long time to compile, e.g. +because they test compile time configuration and require separate +compilation. + +Examples and ExtraTests are not compiled by default. To compile them, +add `-DCATCH_BUILD_EXAMPLES=ON` and `-DCATCH_BUILD_EXTRA_TESTS=ON` to +the invocation of CMake configuration step. + +Bringing this all together, the steps below should configure, build, +and run all tests in the `Debug` compilation. + +<!-- snippet: catch2-build-and-test --> +<a id='snippet-catch2-build-and-test'></a> +```sh +# 1. Regenerate the amalgamated distribution +./tools/scripts/generateAmalgamatedFiles.py + +# 2. Configure the full test build +cmake -Bdebug-build -H. -DCMAKE_BUILD_TYPE=Debug -DCATCH_BUILD_EXAMPLES=ON -DCATCH_BUILD_EXTRA_TESTS=ON -DCATCH_DEVELOPMENT_BUILD=ON + +# 3. Run the actual build +cmake --build debug-build + +# 4. Run the tests using CTest +cd debug-build +ctest -j 4 --output-on-failure -C Debug +``` +<sup><a href='/tools/scripts/buildAndTest.sh#L6-L19' title='File snippet `catch2-build-and-test` was extracted from'>snippet source</a> | <a href='#snippet-catch2-build-and-test' title='Navigate to start of snippet `catch2-build-and-test`'>anchor</a></sup> +<!-- endSnippet --> + +For convenience, the above commands are in the script `tools/scripts/buildAndTest.sh`, and can be run like this: + +```bash +cd Catch2 +./tools/scripts/buildAndTest.sh +``` + +If you added new tests, you will likely see `ApprovalTests` failure. +After you check that the output difference is expected, you should +run `tools/scripts/approve.py` to confirm them, and include these changes +in your commit. + + +## Writing documentation + +If you have added new feature to Catch2, it needs documentation, so that +other people can use it as well. This section collects some technical +information that you will need for updating Catch2's documentation, and +possibly some generic advise as well. + + +### Technicalities + +First, the technicalities: + +* If you have introduced a new document, there is a simple template you +should use. It provides you with the top anchor mentioned to link to +(more below), and also with a backlink to the top of the documentation: +```markdown +<a id="top"></a> +# Cool feature + +Text that explains how to use the cool feature. + + +--- + +[Home](Readme.md#top) +``` + +* Crosslinks to different pages should target the `top` anchor, like this +`[link to contributing](contributing.md#top)`. + +* We introduced version tags to the documentation, which show users in +which version a specific feature was introduced. This means that newly +written documentation should be tagged with a placeholder, that will +be replaced with the actual version upon release. There are 2 styles +of placeholders used through the documentation, you should pick one that +fits your text better (if in doubt, take a look at the existing version +tags for other features). + * `> [Introduced](link-to-issue-or-PR) in Catch X.Y.Z` - this + placeholder is usually used after a section heading + * `> X (Y and Z) was [introduced](link-to-issue-or-PR) in Catch X.Y.Z` + - this placeholder is used when you need to tag a subpart of something, + e.g. a list + +* For pages with more than 4 subheadings, we provide a table of contents +(ToC) at the top of the page. Because GitHub markdown does not support +automatic generation of ToC, it has to be handled semi-manually. Thus, +if you've added a new subheading to some page, you should add it to the +ToC. This can be done either manually, or by running the +`updateDocumentToC.py` script in the `scripts/` folder. + +### Contents + +Now, for some content tips: + +* Usage examples are good. However, having large code snippets inline +can make the documentation less readable, and so the inline snippets +should be kept reasonably short. To provide more complex compilable +examples, consider adding new .cpp file to `examples/`. + +* Don't be afraid to introduce new pages. The current documentation +tends towards long pages, but a lot of that is caused by legacy, and +we know that some of the pages are overly big and unfocused. + +* When adding information to an existing page, please try to keep your +formatting, style and changes consistent with the rest of the page. + +* Any documentation has multiple different audiences, that desire +different information from the text. The 3 basic user-types to try and +cover are: + * A beginner to Catch2, who requires closer guidance for the usage of Catch2. + * Advanced user of Catch2, who want to customize their usage. + * Experts, looking for full reference of Catch2's capabilities. + + +## Writing code + +If want to contribute code, this section contains some simple rules +and tips on things like code formatting, code constructions to avoid, +and so on. + + +### Formatting + +To make code formatting simpler for the contributors, Catch2 provides +its own config for `clang-format`. However, because it is currently +impossible to replicate existing Catch2's formatting in clang-format, +using it to reformat a whole file would cause massive diffs. To keep +the size of your diffs reasonable, you should only use clang-format +on the newly changed code. + + +### Code constructs to watch out for + +This section is a (sadly incomplete) listing of various constructs that +are problematic and are not always caught by our CI infrastructure. + + +#### Naked exceptions and exceptions-related function + +If you are throwing an exception, it should be done via `CATCH_ERROR` +or `CATCH_RUNTIME_ERROR` in `catch_enforce.h`. These macros will handle +the differences between compilation with or without exceptions for you. +However, some platforms (IAR) also have problems with exceptions-related +functions, such as `std::current_exceptions`. We do not have IAR in our +CI, but luckily there should not be too many reasons to use these. +However, if you do, they should be kept behind a +`CATCH_CONFIG_DISABLE_EXCEPTIONS` macro. + + +#### Unqualified usage of functions from C's stdlib + +If you are using a function from C's stdlib, please include the header +as `<cfoo>` and call the function qualified. The common knowledge that +there is no difference is wrong, QNX and VxWorks won't compile if you +include the header as `<cfoo>` and call the function unqualified. + + +### New source file template + +If you are adding new source file, there is a template you should use. +Specifically, every source file should start with the licence header: +```cpp + + // Copyright Catch2 Authors + // Distributed under the Boost Software License, Version 1.0. + // (See accompanying file LICENSE_1_0.txt or copy at + // https://www.boost.org/LICENSE_1_0.txt) + + // SPDX-License-Identifier: BSL-1.0 +``` + +The include guards for header files should follow the pattern `{FILENAME}_INCLUDED`. +This means that for file `catch_matchers_foo`, the include guard should +be `CATCH_MATCHERS_FOO_INCLUDED`, for `catch_generators_bar`, the include +guard should be `CATCH_GENERATORS_BAR_INCLUDED`, and so on. + + +## CoC + +This project has a [CoC](../CODE_OF_CONDUCT.md). Please adhere to it +while contributing to Catch2. + +----------- + +_This documentation will always be in-progress as new information comes +up, but we are trying to keep it as up to date as possible._ + +--- + +[Home](Readme.md#top) diff --git a/packages/Catch2/docs/deprecations.md b/packages/Catch2/docs/deprecations.md new file mode 100644 index 0000000000000000000000000000000000000000..c0e51b46dca59c7d7359e6b482ba2d852617f6a3 --- /dev/null +++ b/packages/Catch2/docs/deprecations.md @@ -0,0 +1,31 @@ +<a id="top"></a> +# Deprecations and incoming changes + +This page documents current deprecations and upcoming planned changes +inside Catch2. The difference between these is that a deprecated feature +will be removed, while a planned change to a feature means that the +feature will behave differently, but will still be present. Obviously, +either of these is a breaking change, and thus will not happen until +at least the next major release. + + + +## Planned changes + +### `CHECKED_IF` and `CHECKED_ELSE` + +To make the `CHECKED_IF` and `CHECKED_ELSE` macros more useful, they will +be marked as "OK to fail" (`Catch::ResultDisposition::SuppressFail` flag +will be added), which means that their failure will not fail the test, +making the `else` actually useful. + + +### Console Colour API + +The API for Catch2's console colour will be changed to take an extra +argument, the stream to which the colour code should be applied. + + +--- + +[Home](Readme.md#top) diff --git a/packages/Catch2/docs/event-listeners.md b/packages/Catch2/docs/event-listeners.md new file mode 100644 index 0000000000000000000000000000000000000000..6231100667cbda9a7629d6c9b638f65e9431d2b2 --- /dev/null +++ b/packages/Catch2/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 + + void testCaseStarting( Catch::TestCaseInfo const& testInfo ) override { + // Perform some setup before a test case is run + } + + 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 overridden 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/packages/Catch2/docs/generators.md b/packages/Catch2/docs/generators.md new file mode 100644 index 0000000000000000000000000000000000000000..d48cf06b4fd6785e589f3ed53513ee47542c74a1 --- /dev/null +++ b/packages/Catch2/docs/generators.md @@ -0,0 +1,219 @@ +<a id="top"></a> +# Data Generators + +> Introduced in Catch 2.6.0. + +Data generators (also known as _data driven/parametrized test cases_) +let you reuse the same set of assertions across different input values. +In Catch2, this means that they respect the ordering and nesting +of the `TEST_CASE` and `SECTION` macros, and their nested sections +are run once per each value in a generator. + +This is best explained with an example: +```cpp +TEST_CASE("Generators") { + auto i = GENERATE(1, 3, 5); + REQUIRE(is_odd(i)); +} +``` + +The "Generators" `TEST_CASE` will be entered 3 times, and the value of +`i` will be 1, 3, and 5 in turn. `GENERATE`s can also be used multiple +times at the same scope, in which case the result will be a cartesian +product of all elements in the generators. This means that in the snippet +below, the test case will be run 6 (2\*3) times. + +```cpp +TEST_CASE("Generators") { + auto i = GENERATE(1, 2); + auto j = GENERATE(3, 4, 5); +} +``` + +There are 2 parts to generators in Catch2, the `GENERATE` macro together +with the already provided generators, and the `IGenerator<T>` interface +that allows users to implement their own generators. + + +## Combining `GENERATE` and `SECTION`. + +`GENERATE` can be seen as an implicit `SECTION`, that goes from the place +`GENERATE` is used, to the end of the scope. This can be used for various +effects. The simplest usage is shown below, where the `SECTION` "one" +runs 4 (2\*2) times, and `SECTION` "two" is run 6 times (2\*3). + +```cpp +TEST_CASE("Generators") { + auto i = GENERATE(1, 2); + SECTION("one") { + auto j = GENERATE(-3, -2); + REQUIRE(j < i); + } + SECTION("two") { + auto k = GENERATE(4, 5, 6); + REQUIRE(i != k); + } +} +``` + +The specific order of the `SECTION`s will be "one", "one", "two", "two", +"two", "one"... + + +The fact that `GENERATE` introduces a virtual `SECTION` can also be used +to make a generator replay only some `SECTION`s, without having to +explicitly add a `SECTION`. As an example, the code below reports 3 +assertions, because the "first" section is run once, but the "second" +section is run twice. + +```cpp +TEST_CASE("GENERATE between SECTIONs") { + SECTION("first") { REQUIRE(true); } + auto _ = GENERATE(1, 2); + SECTION("second") { REQUIRE(true); } +} +``` + +This can lead to surprisingly complex test flows. As an example, the test +below will report 14 assertions: + +```cpp +TEST_CASE("Complex mix of sections and generates") { + auto i = GENERATE(1, 2); + SECTION("A") { + SUCCEED("A"); + } + auto j = GENERATE(3, 4); + SECTION("B") { + SUCCEED("B"); + } + auto k = GENERATE(5, 6); + SUCCEED(); +} +``` + +> The ability to place `GENERATE` between two `SECTION`s was [introduced](https://github.com/catchorg/Catch2/issues/1938) in Catch 2.13.0. + +## Provided generators + +Catch2's provided generator functionality consists of three parts, + +* `GENERATE` macro, that serves to integrate generator expression with +a test case, +* 2 fundamental generators + * `SingleValueGenerator<T>` -- contains only single element + * `FixedValuesGenerator<T>` -- contains multiple elements +* 5 generic generators that modify other generators + * `FilterGenerator<T, Predicate>` -- filters out elements from a generator + for which the predicate returns "false" + * `TakeGenerator<T>` -- takes first `n` elements from a generator + * `RepeatGenerator<T>` -- repeats output from a generator `n` times + * `MapGenerator<T, U, Func>` -- returns the result of applying `Func` + on elements from a different generator + * `ChunkGenerator<T>` -- returns chunks (inside `std::vector`) of n elements from a generator +* 4 specific purpose generators + * `RandomIntegerGenerator<Integral>` -- generates random Integrals from range + * `RandomFloatGenerator<Float>` -- generates random Floats from range + * `RangeGenerator<T>` -- generates all values inside an arithmetic range + * `IteratorGenerator<T>` -- copies and returns values from an iterator range + +> `ChunkGenerator<T>`, `RandomIntegerGenerator<Integral>`, `RandomFloatGenerator<Float>` and `RangeGenerator<T>` were introduced in Catch 2.7.0. + +> `IteratorGenerator<T>` was introduced in Catch 2.10.0. + +The generators also have associated helper functions that infer their +type, making their usage much nicer. These are + +* `value(T&&)` for `SingleValueGenerator<T>` +* `values(std::initializer_list<T>)` for `FixedValuesGenerator<T>` +* `table<Ts...>(std::initializer_list<std::tuple<Ts...>>)` for `FixedValuesGenerator<std::tuple<Ts...>>` +* `filter(predicate, GeneratorWrapper<T>&&)` for `FilterGenerator<T, Predicate>` +* `take(count, GeneratorWrapper<T>&&)` for `TakeGenerator<T>` +* `repeat(repeats, GeneratorWrapper<T>&&)` for `RepeatGenerator<T>` +* `map(func, GeneratorWrapper<T>&&)` for `MapGenerator<T, U, Func>` (map `U` to `T`, deduced from `Func`) +* `map<T>(func, GeneratorWrapper<U>&&)` for `MapGenerator<T, U, Func>` (map `U` to `T`) +* `chunk(chunk-size, GeneratorWrapper<T>&&)` for `ChunkGenerator<T>` +* `random(IntegerOrFloat a, IntegerOrFloat b)` for `RandomIntegerGenerator` or `RandomFloatGenerator` +* `range(Arithemtic start, Arithmetic end)` for `RangeGenerator<Arithmetic>` with a step size of `1` +* `range(Arithmetic start, Arithmetic end, Arithmetic step)` for `RangeGenerator<Arithmetic>` with a custom step size +* `from_range(InputIterator from, InputIterator to)` for `IteratorGenerator<T>` +* `from_range(Container const&)` for `IteratorGenerator<T>` + +> `chunk()`, `random()` and both `range()` functions were introduced in Catch 2.7.0. + +> `from_range` has been introduced in Catch 2.10.0 + +> `range()` for floating point numbers has been introduced in Catch 2.11.0 + +And can be used as shown in the example below to create a generator +that returns 100 odd random number: + +```cpp +TEST_CASE("Generating random ints", "[example][generator]") { + SECTION("Deducing functions") { + auto i = GENERATE(take(100, filter([](int i) { return i % 2 == 1; }, random(-100, 100)))); + REQUIRE(i > -100); + REQUIRE(i < 100); + REQUIRE(i % 2 == 1); + } +} +``` + + +Apart from registering generators with Catch2, the `GENERATE` macro has +one more purpose, and that is to provide simple way of generating trivial +generators, as seen in the first example on this page, where we used it +as `auto i = GENERATE(1, 2, 3);`. This usage converted each of the three +literals into a single `SingleValueGenerator<int>` and then placed them all in +a special generator that concatenates other generators. It can also be +used with other generators as arguments, such as `auto i = GENERATE(0, 2, +take(100, random(300, 3000)));`. This is useful e.g. if you know that +specific inputs are problematic and want to test them separately/first. + +**For safety reasons, you cannot use variables inside the `GENERATE` macro. +This is done because the generator expression _will_ outlive the outside +scope and thus capturing references is dangerous. If you need to use +variables inside the generator expression, make sure you thought through +the lifetime implications and use `GENERATE_COPY` or `GENERATE_REF`.** + +> `GENERATE_COPY` and `GENERATE_REF` were introduced in Catch 2.7.1. + +You can also override the inferred type by using `as<type>` as the first +argument to the macro. This can be useful when dealing with string literals, +if you want them to come out as `std::string`: + +```cpp +TEST_CASE("type conversion", "[generators]") { + auto str = GENERATE(as<std::string>{}, "a", "bb", "ccc"); + REQUIRE(str.size() > 0); +} +``` + +## Generator interface + +You can also implement your own generators, by deriving from the +`IGenerator<T>` interface: + +```cpp +template<typename T> +struct IGenerator : GeneratorUntypedBase { + // via GeneratorUntypedBase: + // Attempts to move the generator to the next element. + // Returns true if successful (and thus has another element that can be read) + virtual bool next() = 0; + + // Precondition: + // The generator is either freshly constructed or the last call to next() returned true + virtual T const& get() const = 0; +}; +``` + +However, to be able to use your custom generator inside `GENERATE`, it +will need to be wrapped inside a `GeneratorWrapper<T>`. +`GeneratorWrapper<T>` is a value wrapper around a +`std::unique_ptr<IGenerator<T>>`. + +For full example of implementing your own generator, look into Catch2's +examples, specifically +[Generators: Create your own generator](../examples/300-Gen-OwnGenerator.cpp). + diff --git a/packages/Catch2/docs/limitations.md b/packages/Catch2/docs/limitations.md new file mode 100644 index 0000000000000000000000000000000000000000..65483b87bbd0873f7e07e79f39de08e5a55e190f --- /dev/null +++ b/packages/Catch2/docs/limitations.md @@ -0,0 +1,187 @@ +<a id="top"></a> +# Known limitations + +Over time, some limitations of Catch2 emerged. Some of these are due +to implementation details that cannot be easily changed, some of these +are due to lack of development resources on our part, and some of these +are due to plain old 3rd party 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" ); + } + } +} +``` + +or with a `DYNAMIC_SECTION` macro (that was made for exactly this purpose): + +```cpp +TEST_CASE( "Looped section" ) { + for (char i = '0'; i < '5'; ++i) { + DYNAMIC_SECTION( "Looped section " << i) { + SUCCEED( "Everything is OK" ); + } + } +} +``` + +### Tests might be run again if last section fails + +If the last section in a test fails, it might be run again. This is because +Catch2 discovers `SECTION`s dynamically, as they are about to run, and +if the last section in test case is aborted during execution (e.g. via +the `REQUIRE` family of macros), Catch2 does not know that there are no +more sections in that test case and must run the test case again. + + +### MinGW/CygWin compilation (linking) is extremely slow + +Compiling Catch2 with MinGW can be exceedingly slow, especially during +the linking step. As far as we can tell, this is caused by deficiencies +in its default linker. If you can tell MinGW to instead use lld, via +`-fuse-ld=lld`, the link time should drop down to reasonable length +again. + + +## Features +This section outlines some missing features, what is their status and their possible workarounds. + +### Thread safe assertions +Catch2's assertion macros 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); +``` + +Because C++11 provides the necessary tools to do this, we are planning +to remove this limitation in the future. + +### 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 -- Alignment compilation error (C2718) + +VS 2015 has a known bug, where `declval<T>` can cause compilation error +if `T` has alignment requirements that it cannot meet. + + +A workaround is to explicitly specialize `Catch::is_range` for given +type (this avoids code path that uses `declval<T>` in a SFINAE context). + + +### 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++`. + + +### libstdc++, `_GLIBCXX_DEBUG` macro and random ordering of tests + +Running a Catch2 binary compiled against libstdc++ with `_GLIBCXX_DEBUG` +macro defined with `--order rand` will cause a debug check to trigger and +abort the run due to self-assignment. +[This is a known bug inside libstdc++](https://stackoverflow.com/questions/22915325/avoiding-self-assignment-in-stdshuffle/23691322) + +Workaround: Don't use `--order rand` when compiling against debug-enabled +libstdc++. diff --git a/packages/Catch2/docs/list-of-examples.md b/packages/Catch2/docs/list-of-examples.md new file mode 100644 index 0000000000000000000000000000000000000000..642d4d23783155159cb411cc7dc78c50f4c5801d --- /dev/null +++ b/packages/Catch2/docs/list-of-examples.md @@ -0,0 +1,47 @@ +<a id="top"></a> +# List of examples + +## Already available + +- Catch main: [Catch-provided main](../examples/000-CatchMain.cpp) +- Test Case: [Single-file](../examples/010-TestCase.cpp) +- Test Case: [Multiple-file 1](../examples/020-TestCase-1.cpp), [2](../examples/020-TestCase-2.cpp) +- Assertion: [REQUIRE, CHECK](../examples/030-Asn-Require-Check.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) +- Listener: [Listeners](../examples/210-Evt-EventListeners.cpp) +- Configuration: [Provide your own output streams](../examples/231-Cfg-OutputStreams.cpp) +- Generators: [Create your own generator](../examples/300-Gen-OwnGenerator.cpp) +- Generators: [Use map to convert types in GENERATE expression](../examples/301-Gen-MapTypeConversion.cpp) +- Generators: [Run test with a table of input values](../examples/302-Gen-Table.cpp) +- Generators: [Use variables in generator expressions](../examples/310-Gen-VariablesInGenerators.cpp) +- Generators: [Use custom variable capture in generator expressions](../examples/311-Gen-CustomCapture.cpp) + + +## Planned + +- 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) +- 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: [User-defined reporter](../examples/202-Rpt-UserDefinedReporter.cpp) +- Report: [Automake reporter](../examples/205-Rpt-AutomakeReporter.cpp) +- Report: [TAP reporter](../examples/206-Rpt-TapReporter.cpp) +- Report: [Multiple reporter](../examples/208-Rpt-MultipleReporters.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/packages/Catch2/docs/logging.md b/packages/Catch2/docs/logging.md new file mode 100644 index 0000000000000000000000000000000000000000..476b1e08484c7ddbb438413867cc5cde8d29f4c0 --- /dev/null +++ b/packages/Catch2/docs/logging.md @@ -0,0 +1,159 @@ +<a id="top"></a> +# Logging macros + +Additional messages can be logged during a test case. Note that the messages logged with `INFO` 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`. + +## Logging without local scope + +> [Introduced](https://github.com/catchorg/Catch2/issues/1522) in Catch 2.7.0. + +`UNSCOPED_INFO` is similar to `INFO` with two key differences: + +- Lifetime of an unscoped message is not tied to its own scope. +- An unscoped message can be reported by the first following assertion only, regardless of the result of that assertion. + +In other words, lifetime of `UNSCOPED_INFO` is limited by the following assertion (or by the end of test case/section, whichever comes first) whereas lifetime of `INFO` is limited by its own scope. + +These differences make this macro useful for reporting information from helper functions or inner scopes. An example: + +```cpp +void print_some_info() { + UNSCOPED_INFO("Info from helper"); +} + +TEST_CASE("Baz") { + print_some_info(); + for (int i = 0; i < 2; ++i) { + UNSCOPED_INFO("The number is " << i); + } + CHECK(false); +} + +TEST_CASE("Qux") { + INFO("First info"); + UNSCOPED_INFO("First unscoped info"); + CHECK(false); + + INFO("Second info"); + UNSCOPED_INFO("Second unscoped info"); + CHECK(false); +} +``` + +"Baz" test case prints: +``` +Info from helper +The number is 0 +The number is 1 +``` + +With "Qux" test case, two messages will be printed when the first `CHECK` fails: +``` +First info +First unscoped info +``` + +"First unscoped info" message will be cleared after the first `CHECK`, while "First info" message will persist until the end of the test case. Therefore, when the second `CHECK` fails, three messages will be printed: +``` +First info +Second info +Second unscoped info +``` + +## Streaming macros + +All these macros allow heterogeneous 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 next assertions that are 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. + +_Note that in Catch2 2.x.x `INFO` can be used without a trailing semicolon as there is a trailing semicolon inside macro. +This semicolon will be removed with next major version. It is highly advised to use a trailing semicolon after `INFO` macro._ + +**UNSCOPED_INFO(** _message expression_ **)** + +> [Introduced](https://github.com/catchorg/Catch2/issues/1522) in Catch 2.7.0. + +Similar to `INFO`, but messages are not limited to their own scope: They are removed from the buffer after each assertion, section or test case, whichever comes first. + +**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 value of variables or expressions + +**CAPTURE(** _expression1_, _expression2_, ... **)** + +Sometimes you just want to log a value of variable, or expression. For +convenience, we provide the `CAPTURE` macro, that can take a variable, +or an expression, and prints out that variable/expression and its value +at the time of capture. + +e.g. `CAPTURE( theAnswer );` will log message "theAnswer := 42", while +```cpp +int a = 1, b = 2, c = 3; +CAPTURE( a, b, c, a + b, c > b, a == 1); +``` +will log a total of 6 messages: +``` +a := 1 +b := 2 +c := 3 +a + b := 3 +c > b := true +a == 1 := true +``` + +You can also capture expressions that use commas inside parentheses +(e.g. function calls), brackets, or braces (e.g. initializers). To +properly capture expression that contains template parameters list +(in other words, it contains commas between angle brackets), you need +to enclose the expression inside parentheses: +`CAPTURE( (std::pair<int, int>{1, 2}) );` + + +--- + +[Home](Readme.md#top) diff --git a/packages/Catch2/docs/matchers.md b/packages/Catch2/docs/matchers.md new file mode 100644 index 0000000000000000000000000000000000000000..a5bf13f2cce72f5301625916576e768775276fd1 --- /dev/null +++ b/packages/Catch2/docs/matchers.md @@ -0,0 +1,416 @@ +<a id="top"></a> +# Matchers + +**Contents**<br> +[Using Matchers](#using-matchers)<br> +[Built-in matchers](#built-in-matchers)<br> +[Writing custom matchers (old style)](#writing-custom-matchers-old-style)<br> +[Writing custom matchers (new style)](#writing-custom-matchers-new-style)<br> + +Matchers, as popularized by the [Hamcrest](https://en.wikipedia.org/wiki/Hamcrest) +framework are an alternative way to write assertions, useful for tests +where you work with complex types or need to assert more complex +properties. Matchers are easily composable and users can write their +own and combine them with the Catch2-provided matchers seamlessly. + + +## Using Matchers + +Matchers are most commonly used in tandem with the `REQUIRE_THAT` or +`CHECK_THAT` macros. The `REQUIRE_THAT` macro takes two arguments, +the first one is the input (object/value) to test, the second argument +is the matcher itself. + +For example, to assert that a string ends with the "as a service" +substring, you can write the following assertion + +```cpp +using Catch::Matchers::EndsWith; + +REQUIRE_THAT( getSomeString(), EndsWith("as a service") ); +``` + +Individual matchers can also be combined using the C++ logical +operators, that is `&&`, `||`, and `!`, like so: + +```cpp +using Catch::Matchers::EndsWith; +using Catch::Matchers::Contains; + +REQUIRE_THAT( getSomeString(), + EndsWith("as a service") && Contains("web scale")); +``` + +The example above asserts that the string returned from `getSomeString` +_both_ ends with the suffix "as a service" _and_ contains the string +"web scale" somewhere. + + +Both of the string matchers used in the examples above live in the +`catch_matchers_string.hpp` header, so to compile the code above also +requires `#include <catch2/matchers/catch_matchers_string.hpp>`. + +**IMPORTANT**: The combining operators do not take ownership of the +matcher objects being combined. This means that if you store combined +matcher object, you have to ensure that the matchers being combined +outlive its last use. What this means is that the following code leads +to a use-after-free (UAF): + +```cpp +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_string.h> + +TEST_CASE("Bugs, bugs, bugs", "[Bug]"){ + std::string str = "Bugs as a service"; + + auto match_expression = Catch::Matchers::EndsWith( "as a service" ) || + (Catch::Matchers::StartsWith( "Big data" ) && !Catch::Matchers::Contains( "web scale" ) ); + REQUIRE_THAT(str, match_expression); +} +``` + + +## Built-in matchers + +Every matcher provided by Catch2 is split into 2 parts, a factory +function that lives in the `Catch::Matchers` namespace, and the actual +matcher type that is in some deeper namespace and should not be used by +the user. In the examples above, we used `Catch::Matchers::Contains`. +This is the factory function for the +`Catch::Matchers::StdString::ContainsMatcher` type that does the actual +matching. + +Out of the box, Catch2 provides the following matchers: + + +### `std::string` matchers + +Catch2 provides 5 different matchers that work with `std::string`, +* `StartsWith(std::string str, CaseSensitive)`, +* `EndsWith(std::string str, CaseSensitive)`, +* `Contains(std::string str, CaseSensitive)`, +* `Equals(std::string str, CaseSensitive)`, and +* `Matches(std::string str, CaseSensitive)`. + +The first three should be fairly self-explanatory, they succeed if +the argument starts with `str`, ends with `str`, or contains `str` +somewhere inside it. + +The `Equals` matcher matches a string if (and only if) the argument +string is equal to `str`. + +Finally, the `Matches` matcher performs an ECMASCript regex match using +`str` against the argument string. It is important to know that +the match is performed agains the string as a whole, meaning that +the regex `"abc"` will not match input string `"abcd"`. To match +`"abcd"`, you need to use e.g. `"abc.*"` as your regex. + +The second argument sets whether the matching should be case-sensitive +or not. By default, it is case-sensitive. + +> `std::string` matchers live in `catch2/matchers/catch_matchers_string.hpp` + + +### Vector matchers + +_Vector matchers have been deprecated in favour of the generic +range matchers with the same functionality._ + +Catch2 provides 5 built-in matchers that work on `std::vector`. + +These are + + * `Contains` which checks whether a specified vector is present in the result + * `VectorContains` which checks whether a specified element is present in the result + * `Equals` which checks whether the result is exactly equal (order matters) to a specific vector + * `UnorderedEquals` which checks whether the result is equal to a specific vector under a permutation + * `Approx` which checks whether the result is "approx-equal" (order matters, but comparison is done via `Approx`) to a specific vector +> Approx matcher was [introduced](https://github.com/catchorg/Catch2/issues/1499) in Catch 2.7.2. + +An example usage: +```cpp + std::vector<int> some_vec{ 1, 2, 3 }; + REQUIRE_THAT(some_vec, Catch::Matchers::UnorderedEquals(std::vector<int>{ 3, 2, 1 })); +``` + +This assertions will pass, because the elements given to the matchers +are a permutation of the ones in `some_vec`. + +> vector matchers live in `catch2/matchers/catch_matchers_vector.hpp` + + +### Floating point matchers + +Catch2 provides 3 matchers that target floating point numbers. These +are: + +* `WithinAbs(double target, double margin)`, +* `WithinUlps(FloatingPoint target, uint64_t maxUlpDiff)`, and +* `WithinRel(FloatingPoint target, FloatingPoint eps)`. + +> `WithinRel` matcher was introduced in Catch 2.10.0 + + +`WithinAbs` creates a matcher that accepts floating point numbers whose +difference with `target` is less than the `margin`. + +`WithinULP` creates a matcher that accepts floating point numbers that +are no more than `maxUlpDiff` +[ULPs](https://en.wikipedia.org/wiki/Unit_in_the_last_place) +away from the `target` value. The short version of what this means +is that there is no more than `maxUlpDiff - 1` representeable floating +point numbers between the argument for matching and the `target` value. + +`WithinRel` creates a matcher that accepts floating point numbers that +are _approximately equal_ with the `target` with tolerance of `eps.` +Specifically, it matches if +`|arg - target| <= eps * max(|arg|, |target|)` holds. If you do not +specify `eps`, `std::numeric_limits<FloatingPoint>::epsilon * 100` +is used as the default. + + +In practice, you will often want to combine multiple of these matchers, +together for an assertion, because all 3 options have edge cases where +they behave differently than you would expect. As an example, under +the `WithinRel` matcher, a `0.` only ever matches a `0.` (or `-0.`), +regardless of the relative tolerance specified. Thus, if you want to +handle numbers that are "close enough to 0 to be 0", you have to combine +it with the `WithinAbs` matcher. + +For example, to check that our computation matches known good value +within 0.1%, or is close enough (no different to 5 decimal places) +to zero, we would write this assertion: +```cpp + REQUIRE_THAT( computation(input), + Catch::Matchers::WithinRel(expected, 0.001) + || Catch::Matchers::WithinAbs(0, 0.000001) ); +``` + + +> floating point matchers live in `catch2/matchers/catch_matchers_floating.hpp` + + +### Miscellaneous matchers + +Catch2 also provides some matchers and matcher utilities that do not +quite fit into other categories. + +The first one of them is the `Predicate(Callable pred, std::string description)` +matcher. It creates a matcher object that calls `pred` for the provided +argument. The `description` argument allows users to set what the +resulting matcher should self-describe as if required. + +Do note that you will need to explicitly specify the type of the +argument, like in this example: + +```cpp +REQUIRE_THAT("Hello olleH", + Predicate<std::string>( + [] (std::string const& str) -> bool { return str.front() == str.back(); }, + "First and last character should be equal") +); +``` + +> the predicate matcher lives in `catch2/matchers/catch_matchers_predicate.hpp` + + +The other miscellaneous matcher utility is exception matching. + + +#### Matching exceptions + +Catch2 provides an utility macro for asserting that an expression +throws exception of specific type, and that the exception has desired +properties. The macro is `REQUIRE_THROWS_MATCHES(expr, ExceptionType, Matcher)`. + +> `REQUIRE_THROWS_MATCHES` macro lives in `catch2/matchers/catch_matchers.hpp` + + +Catch2 currently provides only one matcher for exceptions, +`Message(std::string message)`. `Message` checks that the exception's +message, as returned from `what` is exactly equal to `message`. + +Example use: +```cpp +REQUIRE_THROWS_MATCHES(throwsDerivedException(), DerivedException, Message("DerivedException::what")); +``` + +Note that `DerivedException` in the example above has to derive from +`std::exception` for the example to work. + +> the exception message matcher lives in `catch2/matchers/catch_matchers_exception.hpp` + + +### Generic range Matchers + +> Generic range matchers were introduced in Catch X.Y.Z + +Catch2 also provides some matchers that use the new style matchers +definitions to handle generic range-like types. These are: + +* `IsEmpty()` +* `SizeIs(size_t target_size)` +* `SizeIs(Matcher size_matcher)` +* `Contains(T&& target_element, Comparator = std::equal_to<>{})` +* `Contains(Matcher element_matcher)` + +`IsEmpty` should be self-explanatory. It successfully matches objects +that are empty according to either `std::empty`, or ADL-found `empty` +free function. + +`SizeIs` checks range's size. If constructed with `size_t` arg, the +matchers accepts ranges whose size is exactly equal to the arg. If +constructed from another matcher, then the resulting matcher accepts +ranges whose size is accepted by the provided matcher. + +`Contains` accepts ranges that contain specific element. There are +again two variants, one that accepts the desired element directly, +in which case a range is accepted if any of its elements is equal to +the target element. The other variant is constructed from a matcher, +in which case a range is accepted if any of its elements is accepted +by the provided matcher. + + +## Writing custom matchers (old style) + +The old style of writing matchers has been introduced back in Catch +Classic. To create an old-style matcher, you have to create your own +type that derives from `Catch::Matchers::MatcherBase<ArgT>`, where +`ArgT` is the type your matcher works for. Your type has to override +two methods, `bool match(ArgT const&) const`, +and `std::string describe() const`. + +As the name suggests, `match` decides whether the provided argument +is matched (accepted) by the matcher. `describe` then provides a +human-oriented description of what the matcher does. + +We also recommend that you create factory function, just like Catch2 +does, but that is mostly useful for template argument deduction for +templated matchers (assuming you do not have CTAD available). + +To combine these into an example, let's say that you want to write +a matcher that decides whether the provided argument is a number +within certain range. We will call it `IsBetweenMatcher<T>`: + +```c++ +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers.h> +// ... + + +template <typename T> +class IsBetweenMatcher : public Catch::Matchers::MatcherBase<T> { + T m_begin, m_end; +public: + IsBetweenMatcher(T begin, T end) : m_begin(begin), m_end(end) {} + + bool match(T const& in) const override { + return in >= m_begin && in <= m_end; + } + + std::string describe() const override { + std::ostringstream ss; + ss << "is between " << m_begin << " and " << m_end; + return ss.str(); + } +}; + +template <typename T> +IsBetweenMatcher<T> IsBetween(T begin, T end) { + return { begin, end }; +} + +// ... + +TEST_CASE("Numbers are within range") { + // infers `double` for the argument type of the matcher + CHECK_THAT(3., IsBetween(1., 10.)); + // infers `int` for the argument type of the matcher + CHECK_THAT(100, IsBetween(1, 10)); +} +``` + +Obviously, the code above can be improved somewhat, for example you +might want to `static_assert` over the fact that `T` is an arithmetic +type... or generalize the matcher to cover any type for which the user +can provide a comparison function object. + +Note that while any matcher written using the old style can also be +written using the new style, combining old style matchers should +generally compile faster. Also note that you can combine old and new +style matchers arbitrarily. + +> `MatcherBase` lives in `catch2/matchers/catch_matchers.hpp` + + +## Writing custom matchers (new style) + +> New style matchers were introduced in Catch X.Y.Z + +To create a new-style matcher, you have to create your own type that +derives from `Catch::Matchers::MatcherGenericBase`. Your type has to +also provide two methods, `bool match( ... ) const` and overriden +`std::string describe() const`. + +Unlike with old-style matchers, there are no requirements on how +the `match` member function takes its argument. This means that the +argument can be taken by value or by mutating reference, but also that +the matcher's `match` member function can be templated. + +This allows you to write more complex matcher, such as a matcher that +can compare one range-like (something that responds to `begin` and +`end`) object to another, like in the following example: + +```cpp +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_templated.hpp> +// ... + +template<typename Range> +struct EqualsRangeMatcher : Catch::Matchers::MatcherGenericBase { + EqualsRangeMatcher(Range const& range): + range{ range } + {} + + template<typename OtherRange> + bool match(OtherRange const& other) const { + using std::begin; using std::end; + + return std::equal(begin(range), end(range), begin(other), end(other)); + } + + std::string describe() const override { + return "Equals: " + Catch::rangeToString(range); + } + +private: + Range const& range; +}; + +template<typename Range> +auto EqualsRange(const Range& range) -> EqualsRangeMatcher<Range> { + return EqualsRangeMatcher<Range>{range}; +} + +TEST_CASE("Combining templated matchers", "[matchers][templated]") { + std::array<int, 3> container{{ 1,2,3 }}; + + std::array<int, 3> a{{ 1,2,3 }}; + std::vector<int> b{ 0,1,2 }; + std::list<int> c{ 4,5,6 }; + + REQUIRE_THAT(container, EqualsRange(a) || EqualsRange(b) || EqualsRange(c)); +} +``` + +Do note that while you can rewrite any matcher from the old style to +a new style matcher, combining new style matchers is more expensive +in terms of compilation time. Also note that you can combine old style +and new style matchers arbitrarily. + +> `MatcherGenericBase` lives in `catch2/matchers/catch_matchers_templated.hpp` + + +--- + +[Home](Readme.md#top) diff --git a/packages/Catch2/docs/migrate-v2-to-v3.md b/packages/Catch2/docs/migrate-v2-to-v3.md new file mode 100644 index 0000000000000000000000000000000000000000..b9590b1f1700c9ea803843bc6090190ee971745f --- /dev/null +++ b/packages/Catch2/docs/migrate-v2-to-v3.md @@ -0,0 +1,57 @@ +<a id="top"></a> +# Migrating from v2 to v3 + +If you want to migrate to v3, there are two basic approaches to do so. + +1. Use `catch_amalgamated.hpp` and `catch_amalgamated.cpp`. +2. Build Catch2 as a proper (static) library, and move to piecewise headers + +Doing 1 means downloading the [amalgamated header](/extras/catch_amalgamated.hpp) +and the [amalgamated sources](/extras/catch_amalgamated.cpp) from `extras`, +dropping them into your test project, and rewriting your includes from +`<catch2/catch.hpp>` to `"catch_amalgamated.hpp"` (or something similar, +based on how you set up your paths). + +The disadvantage of using this approach are increased compilation times, +at least compared to the second approach, but it does let you avoid +dealing with consuming libraries in your build system of choice. + + +However, we recommend doing 2, and taking extra time to migrate to v3 +properly. This lets you reap the benefits of significantly improved +compilation times in the v3 version. The basic steps to do so are: + +1. Change your CMakeLists.txt to link against `Catch2WithMain` target if +you use Catch2's default main. (If you do not, keep linking against +the `Catch2` target.) +2. Delete TU with `CATCH_CONFIG_RUNNER` or `CATCH_CONFIG_MAIN` defined, +as it is no longer needed. +3. Change `#include <catch2/catch.hpp>` to `#include <catch2/catch_all.hpp>` +4. Check that everything compiles. You might have to modify namespaces, +or perform some other changes (see the +[Things that can break during porting](#things-that-can-break-during-porting) +section for the most common things). +5. Start migrating your test TUs from including `<catch2/catch_all.hpp>` +to piecemeal includes. You will likely want to start by including +`<catch2/catch_test_macros.hpp>`, and then go from there. (see +[other notes](#other-notes) for further ideas) + +## Other notes +* The main test include is now `<catch2/catch_test_macros.hpp>` +* Big "subparts" like Matchers, or Generators, have their own folder, and +also their own "big header", so if you just want to include all matchers, +you can include `<catch2/matchers/catch_matchers_all.hpp>`, +or `<catch2/generators/catch_generators_all.hpp>` + + +## Things that can break during porting +* The namespace on Matchers were cleaned up, they are no longer first declared +deep within an internal namespace and then brought up. All Matchers now live +in `Catch::Matchers`. +* The reporter interfaces changed in a breaking manner. If you wrote custom +reporter or listener, you might need to modify them a bit. + + +--- + +[Home](Readme.md#top) \ No newline at end of file diff --git a/packages/Catch2/docs/opensource-users.md b/packages/Catch2/docs/opensource-users.md new file mode 100644 index 0000000000000000000000000000000000000000..17483f8b07a4033abf31d7d6c3aefeec30f1fe48 --- /dev/null +++ b/packages/Catch2/docs/opensource-users.md @@ -0,0 +1,129 @@ +<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 + +### [ApprovalTests.cpp](https://github.com/approvals/ApprovalTests.cpp) +C++11 implementation of Approval Tests, for quick, convenient testing of legacy code. + +### [args](https://github.com/Taywee/args) +A simple header-only C++ argument parser library. + +### [Azmq](https://github.com/zeromq/azmq) +Boost Asio style bindings for ZeroMQ. + +### [Cataclysm: Dark Days Ahead](https://github.com/CleverRaven/Cataclysm-DDA) +Post-apocalyptic survival RPG. + +### [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. + +### [ChakraCore](https://github.com/Microsoft/ChakraCore) +The core part of the Chakra JavaScript engine that powers Microsoft Edge. + +### [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. + +### [cppcodec](https://github.com/tplgy/cppcodec) +Header-only C++11 library to encode/decode base64, base64url, base32, base32hex and hex (a.k.a. base16) as specified in RFC 4648, plus Crockford's base32. + +### [DtCraft](https://github.com/twhuang-uiuc/DtCraft) +A High-performance Cluster Computing Engine. + +### [forest](https://github.com/xorz57/forest) +Template Library of Tree Data Structures. + +### [Fuxedo](https://github.com/fuxedo/fuxedo) +Open source Oracle Tuxedo-like XATMI middleware for C and C++. + +### [HIP CPU Runtime](https://github.com/ROCm-Developer-Tools/HIP-CPU) +A header-only library that allows CPUs to execute unmodified HIP code. It is generic and does not assume a particular CPU vendor or architecture. + +### [Inja](https://github.com/pantor/inja) +A header-only template engine for modern C++. + +### [libcluon](https://github.com/chrberger/libcluon) +A single-header-only library written in C++14 to glue distributed software components (UDP, TCP, shared memory) supporting natively Protobuf, LCM/ZCM, MsgPack, and JSON for dynamic message transformations in-between. + +### [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. + +### [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. + +### [SOCI](https://github.com/SOCI/soci) +The C++ Database Access Library. + +### [TextFlowCpp](https://github.com/philsquared/textflowcpp) +A small, single-header-only, library for wrapping and composing columns of text. + +### [thor](https://github.com/xorz57/thor) +Wrapper Library for CUDA. + +### [toml++](https://github.com/marzer/tomlplusplus) +A header-only TOML parser and serializer for modern C++. + +### [Trompeloeil](https://github.com/rollbear/trompeloeil) +A thread-safe header-only mocking framework for C++14. + +## Applications & Tools + +### [App Mesh](https://github.com/laoshanxi/app-mesh) +A high available cloud native micro-service application management platform implemented by modern C++. + +### [ArangoDB](https://github.com/arangodb/arangodb) +ArangoDB is a native multi-model database with flexible data models for documents, graphs, and key-values. + +### [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. + +### [PopHead](https://github.com/SPC-Some-Polish-Coders/PopHead) +A 2D, Zombie, RPG game which is being made on our own engine. + +### [raspigcd](https://github.com/pantadeusz/raspigcd) +Low level CLI app and library for execution of GCODE on Raspberry Pi without any additional microcontrolers (just RPi + Stepsticks). + +### [SpECTRE](https://github.com/sxs-collaboration/spectre) +SpECTRE is a code for multi-scale, multi-physics problems in astrophysics and gravitational physics. + +### [Standardese](https://github.com/foonathan/standardese) +Standardese aims to be a nextgen Doxygen. + +--- + +[Home](Readme.md#top) diff --git a/packages/Catch2/docs/other-macros.md b/packages/Catch2/docs/other-macros.md new file mode 100644 index 0000000000000000000000000000000000000000..994115f16d120b2f1af08fc54444e21b8fce8460 --- /dev/null +++ b/packages/Catch2/docs/other-macros.md @@ -0,0 +1,154 @@ +<a id="top"></a> +# Other macros + +This page serves as a reference for macros that are not documented +elsewhere. For now, these macros are separated into 2 rough categories, +"assertion related macros" and "test case related macros". + +## Assertion related macros + +* `CHECKED_IF` and `CHECKED_ELSE` + +`CHECKED_IF( expr )` is an `if` replacement, that also applies Catch2's +stringification machinery to the _expr_ and records the result. As with +`if`, the block after a `CHECKED_IF` is entered only if the expression +evaluates to `true`. `CHECKED_ELSE( expr )` work similarly, but the block +is entered only if the _expr_ evaluated to `false`. + +Example: +```cpp +int a = ...; +int b = ...; +CHECKED_IF( a == b ) { + // This block is entered when a == b +} CHECKED_ELSE ( a == b ) { + // This block is entered when a != b +} +``` + +* `CHECK_NOFAIL` + +`CHECK_NOFAIL( expr )` is a variant of `CHECK` that does not fail the test +case if _expr_ evaluates to `false`. This can be useful for checking some +assumption, that might be violated without the test necessarily failing. + +Example output: +``` +main.cpp:6: +FAILED - but was ok: + CHECK_NOFAIL( 1 == 2 ) + +main.cpp:7: +PASSED: + CHECK( 2 == 2 ) +``` + +* `SUCCEED` + +`SUCCEED( msg )` is mostly equivalent with `INFO( msg ); REQUIRE( true );`. +In other words, `SUCCEED` is for cases where just reaching a certain line +means that the test has been a success. + +Example usage: +```cpp +TEST_CASE( "SUCCEED showcase" ) { + int I = 1; + SUCCEED( "I is " << I ); +} +``` + +* `STATIC_REQUIRE` + +> [Introduced](https://github.com/catchorg/Catch2/issues/1362) in Catch 2.4.2. + +`STATIC_REQUIRE( expr )` is a macro that can be used the same way as a +`static_assert`, but also registers the success with Catch2, so it is +reported as a success at runtime. The whole check can also be deferred +to the runtime, by defining `CATCH_CONFIG_RUNTIME_STATIC_REQUIRE` before +including the Catch2 header. + +Example: +```cpp +TEST_CASE("STATIC_REQUIRE showcase", "[traits]") { + STATIC_REQUIRE( std::is_void<void>::value ); + STATIC_REQUIRE_FALSE( std::is_void<int>::value ); +} +``` + +## Test case related macros + +* `METHOD_AS_TEST_CASE` + +`METHOD_AS_TEST_CASE( member-function-pointer, description )` lets you +register a member function of a class as a Catch2 test case. The class +will be separately instantiated for each method registered in this way. + +```cpp +class TestClass { + std::string s; + +public: + TestClass() + :s( "hello" ) + {} + + void testCase() { + REQUIRE( s == "hello" ); + } +}; + + +METHOD_AS_TEST_CASE( TestClass::testCase, "Use class's method as a test case", "[class]" ) +``` + +* `REGISTER_TEST_CASE` + +`REGISTER_TEST_CASE( function, description )` let's you register +a `function` as a test case. The function has to have `void()` signature, +the description can contain both name and tags. + +Example: +```cpp +REGISTER_TEST_CASE( someFunction, "ManuallyRegistered", "[tags]" ); +``` + +_Note that the registration still has to happen before Catch2's session +is initiated. This means that it either needs to be done in a global +constructor, or before Catch2's session is created in user's own main._ + + +* `ANON_TEST_CASE` + +`ANON_TEST_CASE` is a `TEST_CASE` replacement that will autogenerate +unique name. The advantage of this is that you do not have to think +of a name for the test case,`the disadvantage is that the name doesn't +necessarily remain stable across different links, and thus it might be +hard to run directly. + +Example: +```cpp +ANON_TEST_CASE() { + SUCCEED("Hello from anonymous test case"); +} +``` + +* `DYNAMIC_SECTION` + +> Introduced in Catch 2.3.0. + +`DYNAMIC_SECTION` is a `SECTION` where the user can use `operator<<` to +create the final name for that section. This can be useful with e.g. +generators, or when creating a `SECTION` dynamically, within a loop. + +Example: +```cpp +TEST_CASE( "looped SECTION tests" ) { + int a = 1; + + for( int b = 0; b < 10; ++b ) { + DYNAMIC_SECTION( "b is currently: " << b ) { + CHECK( b > a ); + } + } +} +``` diff --git a/packages/Catch2/docs/own-main.md b/packages/Catch2/docs/own-main.md new file mode 100644 index 0000000000000000000000000000000000000000..6a9b1aadc7ab31ff3923adbf3ef3daf14d05bdb7 --- /dev/null +++ b/packages/Catch2/docs/own-main.md @@ -0,0 +1,131 @@ +<a id="top"></a> +# Supplying main() yourself + +**Contents**<br> +[Let Catch take full control of args and config](#let-catch-take-full-control-of-args-and-config)<br> +[Amending the config](#amending-the-config)<br> +[Adding your own command line options](#adding-your-own-command-line-options)<br> +[Version detection](#version-detection)<br> + +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 programmatically 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/packages/Catch2/docs/release-notes.md b/packages/Catch2/docs/release-notes.md new file mode 100644 index 0000000000000000000000000000000000000000..b8538c288cef415729f02d841b35e0fac6130252 --- /dev/null +++ b/packages/Catch2/docs/release-notes.md @@ -0,0 +1,1352 @@ +<a id="top"></a> + +# Release notes +**Contents**<br> +[3.0.1](#301)<br> +[2.13.3](#2133)<br> +[2.13.2](#2132)<br> +[2.13.1](#2131)<br> +[2.13.0](#2130)<br> +[2.12.4](#2124)<br> +[2.12.3](#2123)<br> +[2.12.2](#2122)<br> +[2.12.1](#2121)<br> +[2.12.0](#2120)<br> +[2.11.3](#2113)<br> +[2.11.2](#2112)<br> +[2.11.1](#2111)<br> +[2.11.0](#2110)<br> +[2.10.2](#2102)<br> +[2.10.1](#2101)<br> +[2.10.0](#2100)<br> +[2.9.2](#292)<br> +[2.9.1](#291)<br> +[2.9.0](#290)<br> +[2.8.0](#280)<br> +[2.7.2](#272)<br> +[2.7.1](#271)<br> +[2.7.0](#270)<br> +[2.6.1](#261)<br> +[2.6.0](#260)<br> +[2.5.0](#250)<br> +[2.4.2](#242)<br> +[2.4.1](#241)<br> +[2.4.0](#240)<br> +[2.3.0](#230)<br> +[2.2.3](#223)<br> +[2.2.2](#222)<br> +[2.2.1](#221)<br> +[2.2.0](#220)<br> +[2.1.2](#212)<br> +[2.1.1](#211)<br> +[2.1.0](#210)<br> +[2.0.1](#201)<br> +[Older versions](#older-versions)<br> +[Even Older versions](#even-older-versions)<br> + + +## 3.0.1 (in progress) + + +**Catch2 now uses statically compiled library as its distribution model. +This also means that to get all of Catch2's functionality in a test file, +you have to include multiple headers.** + +For quick'n'dirty migration, you can replace the old `#include <catch2/catch.hpp>` +with `#include <catch2/catch_all.hpp>`. This is a (one of) convenience +header(s) that brings in _all_ of headers in Catch2. By doing this, +you should be able to migrate instantly, but at the cost of (significantly) +increased compilation times. You should prefer piecemeal including +headers that are actually required by your test code. + +The basic set of functionality (`TEST_CASE`, `SECTION`, `REQUIRE`) is in +`catch2/catch_test_macros.hpp`. Matchers are in `matchers` subfolder, +generators in `generators` subfolder, and so on. + +Note that documentation has not yet been updated to account for the +new design. + + +### FAQ + +* Why is Catch2 moving to separate headers? + * The short answer is future extensibility and scalability. The long answer is complex and can be found on my blog, but at the most basic level, it is that providing single-header distribution is at odds with providing variety of useful features. When Catch2 was distributed in a single header, adding a new Matcher would cause overhead for everyone, but was useful only to a subset of users. This meant that the barrier to entry for new Matchers/Generators/etc is high in single header model, but much smaller in the new model. +* Will Catch2 again distribute single-header version in the future? + * No. But we do provide sqlite-style amalgamated distribution option. This means that you can download just 1 .cpp file and 1 header and place them next to your own sources. However, doing this has downsides similar to using the `catch_all.hpp` header. +* Why the big breaking change caused by replacing `catch.hpp` with `catch_all.hpp`? + * The convenience header `catch_all.hpp` exists for two reasons. One of them is to provide a way for quick migration from Catch2, the second one is to provide a simple way to test things with Catch2. Using it for migration has one drawback in that it is **big**. This means that including it _will_ cause significant compile time drag, and so using it to migrate should be a concious decision by the user, not something they can just stumble into unknowingly. + + +### (Potentially) Breaking changes +* **Catch2 now uses statically compiled library as its distribution model** + * **Including `catch.hpp` no longer works** +* `ANON_TEST_CASE` has been removed, use `TEST_CASE` with no arguments instead (#1220) +* `--list*` commands no longer have non-zero return code (#1410) +* `--list-test-names-only` has been removed (#1190) + * You should use verbosity-modifiers for `--list-tests` instead +* `--list*` commands are now piped through the reporters + * The top-level reporter interface provides default implementation that works just as the old one + * XmlReporter outputs a machine-parseable XML +* `TEST_CASE` description support has been removed + * If the second argument has text outside tags, the text will be ignored. +* Hidden test cases are no longer included just because they don't match an exclusion tag + * Previously, a `TEST_CASE("A", "[.foo]")` would be included by asking for `~[bar]`. +* `PredicateMatcher` is no longer type erased. + * This means that the type of the provided predicate is part of the `PredicateMatcher`'s type +* `SectionInfo` no longer contains section description as a member (#1319) + * You can still write `SECTION("ShortName", "Long and wordy description")`, but the description is thrown away + * The description type now must be a `const char*` or be implicitly convertible to it +* The `[!hide]` tag has been removed. + * Use `[.]` or `[.foo]` instead. +* Lvalues of composed matchers cannot be composed further +* Uses of `REGISTER_TEST_CASE` macro need to be followed by a semicolon + * This does not change `TEST_CASE` and friends in any way +* `IStreamingReporter::IsMulti` member function was removed + * This is _very_ unlikely to actually affect anyone, as it was default-implemented in the interface, and only used internally +* Various classes not designed for user-extension have been made final + * `ListeningReporter` is now `final` + * Concrete Matchers (e.g. `UnorderedEquals` vector matcher) are now `final` + * All Generators are now `final` +* Matcher namespacing has been redone + * Matcher types are no longer in deeply nested namespaces + * Matcher factory functions are no longer brought into `Catch` namespace + * This means that all public-facing matcher-related functionality is now in `Catch::Matchers` namespace +* Defining `CATCH_CONFIG_MAIN` will no longer create main in that TU. + * Link with `libCatch2Main.a`, or the proper CMake/pkg-config target + * If you want to write custom main, include `catch2/catch_session.hpp` +* `CATCH_CONFIG_EXTERNAL_INTERFACES` has been removed. + * You should instead include the appropriate headers as needed. +* `CATCH_CONFIG_IMPL` has been removed. + * The implementation is now compiled into a static library. +* Event Listener interface has changed + * `TestEventListenerBase` was renamed to `EventListenerBase` + * `EventListenerBase` now directly derives from `IStreamingReporter`, instead of deriving from `StreamingReporterBase` +* `GENERATE` decays its arguments (#2012, #2040) + * This means that `str` in `auto str = GENERATE("aa", "bb", "cc");` is inferred to `char const*` rather than `const char[2]`. + + +### Improvements +* Matchers have been extended with the ability to use different signatures of `match` (#1307, #1553, #1554, #1843) + * This includes having templated `match` member function + * See the [rewritten Matchers documentation](matchers.md#top) for details + * Catch2 currently provides _some_ generic matchers, but there should be more before final release of v3 + * So far, `IsEmpty`, `SizeIs`, and `Contains` are provided. + * At least `ElementsAre` and `UnorderedElementsAre` are planned. +* Some runtime performance improvements +* Significant compilation time improvements + * including `catch_test_macros.hpp` is 80% cheaper than including `catch.hpp` + + +### Fixes +* The `INFO` macro no longer contains superfluous semicolon (#1456) +* The `--list*` family of command line flags now return 0 on success (#1410, #1146) + + +### Other changes +* `CATCH_CONFIG_DISABLE_MATCHERS` no longer exists. + * If you do not want to use Matchers in a TU, do not include their header. +* `CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER` no longer exists. + * `StringMaker` specializations for `<chrono>` are always provided +* Catch2's CMake now provides 2 targets, `Catch2` and `Catch2WithMain`. + * `Catch2` is the statically compiled implementation by itself + * `Catch2WithMain` also links in the default main +* Catch2's pkg-config integration also provides 2 packages + * `catch2` is the statically compiled implementation by itself + * `catch2-with-main` also links in the default main + + + +## 2.13.3 + +### Fixes +* Fixed possible infinite loop when combining generators with section filter (`-c` option) (#2025) + +### Miscellaneous +* Fixed `ParseAndAddCatchTests` not finding `TEST_CASE`s without tags (#2055, #2056) +* `ParseAndAddCatchTests` supports `CMP0110` policy for changing behaviour of `add_test` (#2057) + * This was the shortlived change in CMake 3.18.0 that temporarily broke `ParseAndAddCatchTests` + + +## 2.13.2 + +### Improvements +* Implemented workaround for AppleClang shadowing bug (#2030) +* Implemented workaround for NVCC ICE (#2005, #2027) + +### Fixes +* Fixed detection of `std::uncaught_exceptions` support under non-msvc platforms (#2021) +* Fixed the experimental stdout/stderr capture under Windows (#2013) + +### Miscellaneous +* `catch_discover_tests` has been improved significantly (#2023, #2039) + * You can now specify which reporter should be used + * You can now modify where the output will be written + * `WORKING_DIRECTORY` setting is respected +* `ParseAndAddCatchTests` now supports `TEMPLATE_TEST_CASE` macros (#2031) +* Various documentation fixes and improvements (#2022, #2028, #2034) + + +## 2.13.1 + +### Improvements +* `ParseAndAddCatchTests` handles CMake v3.18.0 correctly (#1984) +* Improved autodetection of `std::byte` (#1992) +* Simplified implementation of templated test cases (#2007) + * This should have a tiny positive effect on its compilation throughput + +### Fixes +* Automatic stringification of ranges handles sentinel ranges properly (#2004) + + +## 2.13.0 + +### Improvements +* `GENERATE` can now follow a `SECTION` at the same level of nesting (#1938) + * The `SECTION`(s) before the `GENERATE` will not be run multiple times, the following ones will. +* Added `-D`/`--min-duration` command line flag (#1910) + * If a test takes longer to finish than the provided value, its name and duration will be printed. + * This flag is overriden by setting `-d`/`--duration`. + +### Fixes +* `TAPReporter` no longer skips successful assertions (#1983) + + +## 2.12.4 + +### Improvements +* Added support for MacOS on ARM (#1971) + + +## 2.12.3 + +### Fixes +* `GENERATE` nested in a for loop no longer creates multiple generators (#1913) +* Fixed copy paste error breaking `TEMPLATE_TEST_CASE_SIG` for 6 or more arguments (#1954) +* Fixed potential UB when handling non-ASCII characters in CLI args (#1943) + +### Improvements +* There can be multiple calls to `GENERATE` on a single line +* Improved `fno-except` support for platforms that do not provide shims for exception-related std functions (#1950) + * E.g. the Green Hills C++ compiler +* XmlReporter now also reports test-case-level statistics (#1958) + * This is done via a new element, `OverallResultsCases` + +### Miscellaneous +* Added `.clang-format` file to the repo (#1182, #1920) +* Rewrote contributing docs + * They should explain the different levels of testing and so on much better + + +## 2.12.2 + +### Fixes +* Fixed compilation failure if `is_range` ADL found deleted function (#1929) +* Fixed potential UB in `CAPTURE` if the expression contained non-ASCII characters (#1925) + +### Improvements +* `std::result_of` is not used if `std::invoke_result` is available (#1934) +* JUnit reporter writes out `status` attribute for tests (#1899) +* Suppresed clang-tidy's `hicpp-vararg` warning (#1921) + * Catch2 was already suppressing the `cppcoreguidelines-pro-type-vararg` alias of the warning + + +## 2.12.1 + +### Fixes +* Vector matchers now support initializer list literals better + +### Improvements +* Added support for `^` (bitwise xor) to `CHECK` and `REQUIRE` + + + +## 2.12.0 + +### Improvements +* Running tests in random order (`--order rand`) has been reworked significantly (#1908) + * Given same seed, all platforms now produce the same order + * Given same seed, the relative order of tests does not change if you select only a subset of them +* Vector matchers support custom allocators (#1909) +* `|` and `&` (bitwise or and bitwise and) are now supported in `CHECK` and `REQUIRE` + * The resulting type must be convertible to `bool` + +### Fixes +* Fixed computation of benchmarking column widths in ConsoleReporter (#1885, #1886) +* Suppressed clang-tidy's `cppcoreguidelines-pro-type-vararg` in assertions (#1901) + * It was a false positive trigered by the new warning support workaround +* Fixed bug in test specification parser handling of OR'd patterns using escaping (#1905) + +### Miscellaneous +* Worked around IBM XL's codegen bug (#1907) + * It would emit code for _destructors_ of temporaries in an unevaluated context +* Improved detection of stdlib's support for `std::uncaught_exceptions` (#1911) + + + +## 2.11.3 + +### Fixes +* Fixed compilation error caused by lambdas in assertions under MSVC + + +## 2.11.2 + +### Improvements +* GCC and Clang now issue warnings for suspicious code in assertions (#1880) + * E.g. `REQUIRE( int != unsigned int )` will now issue mixed signedness comparison warning + * This has always worked on MSVC, but it now also works for GCC and current Clang versions +* Colorization of "Test filters" output should be more robust now +* `--wait-for-keypress` now also accepts `never` as an option (#1866) +* Reporters no longer round-off nanoseconds when reporting benchmarking results (#1876) +* Catch2's debug break now supports iOS while using Thumb instruction set (#1862) +* It is now possible to customize benchmark's warm-up time when running the test binary (#1844) + * `--benchmark-warmup-time {ms}` +* User can now specify how Catch2 should break into debugger (#1846) + +### Fixes +* Fixes missing `<random>` include in benchmarking (#1831) +* Fixed missing `<iterator>` include in benchmarking (#1874) +* Hidden test cases are now also tagged with `[!hide]` as per documentation (#1847) +* Detection of whether libc provides `std::nextafter` has been improved (#1854) +* Detection of `wmain` no longer incorrectly looks for `WIN32` macro (#1849) + * Now it just detects Windows platform +* Composing already-composed matchers no longer modifies the partially-composed matcher expression + * This bug has been present for the last ~2 years and nobody reported it + + + +## 2.11.1 + +### Improvements +* Breaking into debugger is supported on iOS (#1817) +* `google-build-using-namespace` clang-tidy warning is suppressed (#1799) + +### Fixes +* Clang on Windows is no longer assumed to implement MSVC's traditional preprocessor (#1806) +* `ObjectStorage` now behaves properly in `const` contexts (#1820) +* `GENERATE_COPY(a, b)` now compiles properly (#1809, #1815) +* Some more cleanups in the benchmarking support + + + +## 2.11.0 + +### Improvements +* JUnit reporter output now contains more details in case of failure (#1347, #1719) +* Added SonarQube Test Data reporter (#1738) + * It is in a separate header, just like the TAP, Automake, and TeamCity reporters +* `range` generator now allows floating point numbers (#1776) +* Reworked part of internals to increase throughput + + +### Fixes +* The single header version should contain full benchmarking support (#1800) +* `[.foo]` is now properly parsed as `[.][foo]` when used on the command line (#1798) +* Fixed compilation of benchmarking on platforms where `steady_clock::period` is not `std::nano` (#1794) + + + +## 2.10.2 + +### Improvements +* Catch2 will now compile on platform where `INFINITY` is double (#1782) + + +### Fixes +* Warning suppressed during listener registration will no longer leak + + + +## 2.10.1 + +### Improvements +* Catch2 now guards itself against `min` and `max` macros from `windows.h` (#1772) +* Templated tests will now compile with ICC (#1748) +* `WithinULP` matcher now uses scientific notation for stringification (#1760) + + +### Fixes +* Templated tests no longer trigger `-Wunused-templates` (#1762) +* Suppressed clang-analyzer false positive in context getter (#1230, #1735) + + +### Miscellaneous +* CMake no longer prohibits in-tree build when Catch2 is used as a subproject (#1773, #1774) + + + +## 2.10.0 + +### Fixes +* `TEMPLATE_LIST_TEST_CASE` now properly handles non-copyable and non-movable types (#1729) +* Fixed compilation error on Solaris caused by a system header defining macro `TT` (#1722, #1723) +* `REGISTER_ENUM` will now fail at compilation time if the registered enum is too large +* Removed use of `std::is_same_v` in C++17 mode (#1757) +* Fixed parsing of escaped special characters when reading test specs from a file (#1767, #1769) + + +### Improvements +* Trailing and leading whitespace in test/section specs are now ignored. +* Writing to Android debug log now uses `__android_log_write` instead of `__android_log_print` +* Android logging support can now be turned on/off at compile time (#1743) + * The toggle is `CATCH_CONFIG_ANDROID_LOGWRITE` +* Added a generator that returns elements of a range + * Use via `from_range(from, to)` or `from_range(container)` +* Added support for CRTs that do not provide `std::nextafter` (#1739) + * They must still provide global `nextafter{f,l,}` + * Enabled via `CATCH_CONFIG_GLOBAL_NEXTAFTER` +* Special cased `Approx(inf)` not to match non-infinite values + * Very strictly speaking this might be a breaking change, but it should match user expectations better +* The output of benchmarking through the Console reporter when `--benchmark-no-analysis` is set is now much simpler (#1768) +* Added a matcher that can be used for checking an exceptions message (#1649, #1728) + * The matcher helper function is called `Message` + * The exception must publicly derive from `std::exception` + * The matching is done exactly, including case and whitespace +* Added a matcher that can be used for checking relative equality of floating point numbers (#1746) + * Unlike `Approx`, it considers both sides when determining the allowed margin + * Special cases `NaN` and `INFINITY` to match user expectations + * The matcher helper function is called `WithinRel` +* The ULP matcher now allows for any possible distance between the two numbers +* The random number generators now use Catch-global instance of RNG (#1734, #1736) + * This means that nested random number generators actually generate different numbers + + +### Miscellaneous +* In-repo PNGs have been optimized to lower overhead of using Catch2 via git clone +* Catch2 now uses its own implementation of the URBG concept + * In the future we also plan to use our own implementation of the distributions from `<random>` to provide cross-platform repeatability of random results + + + +## 2.9.2 + +### Fixes +* `ChunkGenerator` can now be used with chunks of size 0 (#1671) +* Nested subsections are now run properly when specific section is run via the `-c` argument (#1670, #1673) +* Catch2 now consistently uses `_WIN32` to detect Windows platform (#1676) +* `TEMPLATE_LIST_TEST_CASE` now support non-default constructible type lists (#1697) +* Fixed a crash in the XMLReporter when a benchmark throws exception during warmup (#1706) +* Fixed a possible infinite loop in CompactReporter (#1715) +* Fixed `-w NoTests` returning 0 even when no tests were matched (#1449, #1683, #1684) +* Fixed matcher compilation under Obj-C++ (#1661) + +### Improvements +* `RepeatGenerator` and `FixedValuesGenerator` now fail to compile when used with `bool` (#1692) + * Previously they would fail at runtime. +* Catch2 now supports Android's debug logging for its debug output (#1710) +* Catch2 now detects and configures itself for the RTX platform (#1693) + * You still need to pass `--benchmark-no-analysis` if you are using benchmarking under RTX +* Removed a "storage class is not first" warning when compiling Catch2 with PGI compiler (#1717) + +### Miscellaneous +* Documentation now contains indication when a specific feature was introduced (#1695) + * These start with Catch2 v2.3.0, (a bit over a year ago). + * `docs/contributing.md` has been updated to provide contributors guidance on how to add these to newly written documentation +* Various other documentation improvements + * ToC fixes + * Documented `--order` and `--rng-seed` command line options + * Benchmarking documentation now clearly states that it requires opt-in + * Documented `CATCH_CONFIG_CPP17_OPTIONAL` and `CATCH_CONFIG_CPP17_BYTE` macros + * Properly documented built-in vector matchers + * Improved `*_THROWS_MATCHES` documentation a bit +* CMake config file is now arch-independent even if `CMAKE_SIZEOF_VOID_P` is in CMake cache (#1660) +* `CatchAddTests` now properly escapes `[` and `]` in test names (#1634, #1698) +* Reverted `CatchAddTests` adding tags as CTest labels (#1658) + * The script broke when test names were too long + * Overwriting `LABELS` caused trouble for users who set them manually + * CMake does not let users append to `LABELS` if the test name has spaces + + +## 2.9.1 + +### Fixes +* Fix benchmarking compilation failure in files without `CATCH_CONFIG_EXTERNAL_INTERFACES` (or implementation) + + +## 2.9.0 + +### Improvements +* The experimental benchmarking support has been replaced by integrating Nonius code (#1616) + * This provides a much more featurefull micro-benchmarking support. + * Due to the compilation cost, it is disabled by default. See the documentation for details. + * As far as backwards compatibility is concerned, this feature is still considered experimental in that we might change the interface based on user feedback. +* `WithinULP` matcher now shows the acceptable range (#1581) +* Template test cases now support type lists (#1627) + + +## 2.8.0 + +### Improvements +* Templated test cases no longer check whether the provided types are unique (#1628) + * This allows you to e.g. test over `uint32_t`, `uint64_t`, and `size_t` without compilation failing +* The precision of floating point stringification can be modified by user (#1612, #1614) +* We now provide `REGISTER_ENUM` convenience macro for generating `StringMaker` specializations for enums + * See the "String conversion" documentation for details +* Added new set of macros for template test cases that enables the use of NTTPs (#1531, #1609) + * See "Test cases and sections" documentation for details + +### Fixes +* `UNSCOPED_INFO` macro now has a prefixed/disabled/prefixed+disabled versions (#1611) +* Reporting errors at startup should no longer cause a segfault under certain circumstances (#1626) + + +### Miscellaneous +* CMake will now prevent you from attempting in-tree build (#1636, #1638) + * Previously it would break with an obscure error message during the build step + + +## 2.7.2 + +### Improvements +* Added an approximate vector matcher (#1499) + +### Fixes +* Filters will no longer be shown if there were none +* Fixed compilation error when using Homebrew GCC on OS X (#1588, #1589) +* Fixed the console reporter not showing messages that start with a newline (#1455, #1470) +* Modified JUnit reporter's output so that rng seed and filters are reported according to the JUnit schema (#1598) +* Fixed some obscure warnings and static analysis passes + +### Miscellaneous +* Various improvements to `ParseAndAddCatchTests` (#1559, #1601) + * When a target is parsed, it receives `ParseAndAddCatchTests_TESTS` property which summarizes found tests + * Fixed problem with tests not being found if the `OptionalCatchTestLauncher` variables is used + * Including the script will no longer forcefully modify `CMAKE_MINIMUM_REQUIRED_VERSION` + * CMake object libraries are ignored when parsing to avoid needless warnings +* `CatchAddTests` now adds test's tags to their CTest labels (#1600) +* Added basic CPack support to our build + +## 2.7.1 + +### Improvements +* Reporters now print out the filters applied to test cases (#1550, #1585) +* Added `GENERATE_COPY` and `GENERATE_REF` macros that can use variables inside the generator expression + * Because of the significant danger of lifetime issues, the default `GENERATE` macro still does not allow variables +* The `map` generator helper now deduces the mapped return type (#1576) + +### Fixes +* Fixed ObjC++ compilation (#1571) +* Fixed test tag parsing so that `[.foo]` is now parsed as `[.][foo]`. +* Suppressed warning caused by the Windows headers defining SE codes in different manners (#1575) + +## 2.7.0 + +### Improvements +* `TEMPLATE_PRODUCT_TEST_CASE` now uses the resulting type in the name, instead of the serial number (#1544) +* Catch2's single header is now strictly ASCII (#1542) +* Added generator for random integral/floating point types + * The types are inferred within the `random` helper +* Added back RangeGenerator (#1526) + * RangeGenerator returns elements within a certain range +* Added ChunkGenerator generic transform (#1538) + * A ChunkGenerator returns the elements from different generator in chunks of n elements +* Added `UNSCOPED_INFO` (#415, #983, #1522) + * This is a variant of `INFO` that lives until next assertion/end of the test case. + + +### Fixes +* All calls to C stdlib functions are now `std::` qualified (#1541) + * Code brought in from Clara was also updated. +* Running tests will no longer open the specified output file twice (#1545) + * This would cause trouble when the file was not a file, but rather a named pipe + * Fixes the CLion/Resharper integration with Catch +* Fixed `-Wunreachable-code` occurring with (old) ccache+cmake+clang combination (#1540) +* Fixed `-Wdefaulted-function-deleted` warning with Clang 8 (#1537) +* Catch2's type traits and helpers are now properly namespaced inside `Catch::` (#1548) +* Fixed std{out,err} redirection for failing test (#1514, #1525) + * Somehow, this bug has been present for well over a year before it was reported + + +### Contrib +* `ParseAndAddCatchTests` now properly escapes commas in the test name + + + +## 2.6.1 + +### Improvements +* The JUnit reporter now also reports random seed (#1520, #1521) + +### Fixes +* The TAP reporter now formats comments with test name properly (#1529) +* `CATCH_REQUIRE_THROWS`'s internals were unified with `REQUIRE_THROWS` (#1536) + * This fixes a potential `-Wunused-value` warning when used +* Fixed a potential segfault when using any of the `--list-*` options (#1533, #1534) + + +## 2.6.0 + +**With this release the data generator feature is now fully supported.** + + +### Improvements +* Added `TEMPLATE_PRODUCT_TEST_CASE` (#1454, #1468) + * This allows you to easily test various type combinations, see documentation for details +* The error message for `&&` and `||` inside assertions has been improved (#1273, #1480) +* The error message for chained comparisons inside assertions has been improved (#1481) +* Added `StringMaker` specialization for `std::optional` (#1510) +* The generator interface has been redone once again (#1516) + * It is no longer considered experimental and is fully supported + * The new interface supports "Input" generators + * The generator documentation has been fully updated + * We also added 2 generator examples + + +### Fixes +* Fixed `-Wredundant-move` on newer Clang (#1474) +* Removed unreachable mentions `std::current_exception`, `std::rethrow_exception` in no-exceptions mode (#1462) + * This should fix compilation with IAR +* Fixed missing `<type_traits>` include (#1494) +* Fixed various static analysis warnings + * Unrestored stream state in `XmlWriter` (#1489) + * Potential division by zero in `estimateClockResolution` (#1490) + * Uninitialized member in `RunContext` (#1491) + * `SourceLineInfo` move ops are now marked `noexcept` + * `CATCH_BREAK_INTO_DEBUGGER` is now always a function +* Fix double run of a test case if user asks for a specific section (#1394, #1492) +* ANSI colour code output now respects `-o` flag and writes to the file as well (#1502) +* Fixed detection of `std::variant` support for compilers other than Clang (#1511) + + +### Contrib +* `ParseAndAddCatchTests` has learned how to use `DISABLED` CTest property (#1452) +* `ParseAndAddCatchTests` now works when there is a whitspace before the test name (#1493) + + +### Miscellaneous +* We added new issue templates for reporting issues on GitHub +* `contributing.md` has been updated to reflect the current test status (#1484) + + + +## 2.5.0 + +### Improvements +* Added support for templated tests via `TEMPLATE_TEST_CASE` (#1437) + + +### Fixes +* Fixed compilation of `PredicateMatcher<const char*>` by removing partial specialization of `MatcherMethod<T*>` +* Listeners now implicitly support any verbosity (#1426) +* Fixed compilation with Embarcadero builder by introducing `Catch::isnan` polyfill (#1438) +* Fixed `CAPTURE` asserting for non-trivial captures (#1436, #1448) + + +### Miscellaneous +* We should now be providing first party Conan support via https://bintray.com/catchorg/Catch2 (#1443) +* Added new section "deprecations and planned changes" to the documentation + * It contains summary of what is deprecated and might change with next major version +* From this release forward, the released headers should be pgp signed (#430) + * KeyID `E29C 46F3 B8A7 5028 6079 3B7D ECC9 C20E 314B 2360` + * or https://codingnest.com/files/horenmar-publickey.asc + + +## 2.4.2 + +### Improvements +* XmlReporter now also outputs the RNG seed that was used in a run (#1404) +* `Catch::Session::applyCommandLine` now also accepts `wchar_t` arguments. + * However, Catch2 still does not support unicode. +* Added `STATIC_REQUIRE` macro (#1356, #1362) +* Catch2's singleton's are now cleaned up even if tests are run (#1411) + * This is mostly useful as a FP prevention for users who define their own main. +* Specifying an invalid reporter via `-r` is now reported sooner (#1351, #1422) + + +### Fixes +* Stringification no longer assumes that `char` is signed (#1399, #1407) + * This caused a `Wtautological-compare` warning. +* SFINAE for `operator<<` no longer sees different overload set than the actual insertion (#1403) + + +### Contrib +* `catch_discover_tests` correctly adds tests with comma in name (#1327, #1409) +* Added a new customization point in how the tests are launched to `catch_discover_tests` + + +## 2.4.1 + +### Improvements +* Added a StringMaker for `std::(w)string_view` (#1375, #1376) +* Added a StringMaker for `std::variant` (#1380) + * This one is disabled by default to avoid increased compile-time drag +* Added detection for cygwin environment without `std::to_string` (#1396, #1397) + +### Fixes +* `UnorderedEqualsMatcher` will no longer accept erroneously accept +vectors that share suffix, but are not permutation of the desired vector +* Abort after (`-x N`) can no longer be overshot by nested `REQUIRES` and +subsequently ignored (#1391, #1392) + + +## 2.4.0 + +**This release brings two new experimental features, generator support +and a `-fno-exceptions` support. Being experimental means that they +will not be subject to the usual stability guarantees provided by semver.** + +### Improvements +* Various small runtime performance improvements +* `CAPTURE` macro is now variadic +* Added `AND_GIVEN` macro (#1360) +* Added experimental support for data generators + * See [their documentation](generators.md) for details +* Added support for compiling and running Catch without exceptions + * Doing so limits the functionality somewhat + * Look [into the documentation](configuration.md#disablingexceptions) for details + +### Fixes +* Suppressed `-Wnon-virtual-dtor` warnings in Matchers (#1357) +* Suppressed `-Wunreachable-code` warnings in floating point matchers (#1350) + +### CMake +* It is now possible to override which Python is used to run Catch's tests (#1365) +* Catch now provides infrastructure for adding tests that check compile-time configuration +* Catch no longer tries to install itself when used as a subproject (#1373) +* Catch2ConfigVersion.cmake is now generated as arch-independent (#1368) + * This means that installing Catch from 32-bit machine and copying it to 64-bit one works + * This fixes conan installation of Catch + + +## 2.3.0 + +**This release changes the include paths provided by our CMake and +pkg-config integration. The proper include path for the single-header +when using one of the above is now `<catch2/catch.hpp>`. This change +also necessitated changes to paths inside the repository, so that the +single-header version is now at `single_include/catch2/catch.hpp`, rather +than `single_include/catch.hpp`.** + + + +### Fixes +* Fixed Objective-C++ build +* `-Wunused-variable` suppression no longer leaks from Catch's header under Clang +* Implementation of the experimental new output capture can now be disabled (#1335) + * This allows building Catch2 on platforms that do not provide things like `dup` or `tmpfile`. +* The JUnit and XML reporters will no longer skip over successful tests when running without `-s` (#1264, #1267, #1310) + * See improvements for more details + +### Improvements +* pkg-config and CMake integration has been rewritten + * If you use them, the new include path is `#include <catch2/catch.hpp>` + * CMake installation now also installs scripts from `contrib/` + * For details see the [new documentation](cmake-integration.md#top) +* Reporters now have a new customization point, `ReporterPreferences::shouldReportAllAssertions` + * When this is set to `false` and the tests are run without `-s`, passing assertions are not sent to the reporter. + * Defaults to `false`. +* Added `DYNAMIC_SECTION`, a section variant that constructs its name using stream + * This means that you can do `DYNAMIC_SECTION("For X := " << x)`. + + +## 2.2.3 + +**To fix some of the bugs, some behavior had to change in potentially breaking manner.** +**This means that even though this is a patch release, it might not be a drop-in replacement.** + +### Fixes +* Listeners are now called before reporter + * This was always documented to be the case, now it actually works that way +* Catch's commandline will no longer accept multiple reporters + * This was done because multiple reporters never worked properly and broke things in non-obvious ways + * **This has potential to be a breaking change** +* MinGW is now detected as Windows platform w/o SEH support (#1257) + * This means that Catch2 no longer tries to use POSIX signal handling when compiled with MinGW +* Fixed potential UB in parsing tags using non-ASCII characters (#1266) + * Note that Catch2 still supports only ASCII test names/tags/etc +* `TEST_CASE_METHOD` can now be used on classnames containing commas (#1245) + * You have to enclose the classname in extra set of parentheses +* Fixed insufficient alt stack size for POSIX signal handling (#1225) +* Fixed compilation error on Android due to missing `std::to_string` in C++11 mode (#1280) +* Fixed the order of user-provided `FALLBACK_STRINGIFIER` in stringification machinery (#1024) + * It was intended to be replacement for built-in fallbacks, but it was used _after_ them. + * **This has potential to be a breaking change** +* Fixed compilation error when a type has an `operator<<` with templated lhs (#1285, #1306) + +### Improvements +* Added a new, experimental, output capture (#1243) + * This capture can also redirect output written via C apis, e.g. `printf` + * To opt-in, define `CATCH_CONFIG_EXPERIMENTAL_REDIRECT` in the implementation file +* Added a new fallback stringifier for classes derived from `std::exception` + * Both `StringMaker` specialization and `operator<<` overload are given priority + +### Miscellaneous +* `contrib/` now contains dbg scripts that skip over Catch's internals (#904, #1283) + * `gdbinit` for gdb `lldbinit` for lldb +* `CatchAddTests.cmake` no longer strips whitespace from tests (#1265, #1281) +* Online documentation now describes `--use-colour` option (#1263) + + +## 2.2.2 + +### Fixes +* Fixed bug in `WithinAbs::match()` failing spuriously (#1228) +* Fixed clang-tidy diagnostic about virtual call in destructor (#1226) +* Reduced the number of GCC warnings suppression leaking out of the header (#1090, #1091) + * Only `-Wparentheses` should be leaking now +* Added upper bound on the time benchmark timer calibration is allowed to take (#1237) + * On platforms where `std::chrono::high_resolution_clock`'s resolution is low, the calibration would appear stuck +* Fixed compilation error when stringifying static arrays of `unsigned char`s (#1238) + +### Improvements +* XML encoder now hex-encodes invalid UTF-8 sequences (#1207) + * This affects xml and junit reporters + * Some invalid UTF-8 parts are left as is, e.g. surrogate pairs. This is because certain extensions of UTF-8 allow them, such as WTF-8. +* CLR objects (`T^`) can now be stringified (#1216) + * This affects code compiled as C++/CLI +* Added `PredicateMatcher`, a matcher that takes an arbitrary predicate function (#1236) + * See [documentation for details](https://github.com/catchorg/Catch2/blob/devel/docs/matchers.md) + +### Others +* Modified CMake-installed pkg-config to allow `#include <catch.hpp>`(#1239) + * The plans to standardize on `#include <catch2/catch.hpp>` are still in effect + + +## 2.2.1 + +### Fixes +* Fixed compilation error when compiling Catch2 with `std=c++17` against libc++ (#1214) + * Clara (Catch2's CLI parsing library) used `std::optional` without including it explicitly +* Fixed Catch2 return code always being 0 (#1215) + * In the words of STL, "We feel superbad about letting this in" + + +## 2.2.0 + +### Fixes +* Hidden tests are not listed by default when listing tests (#1175) + * This makes `catch_discover_tests` CMake script work better +* Fixed regression that meant `<windows.h>` could potentially not be included properly (#1197) +* Fixed installing `Catch2ConfigVersion.cmake` when Catch2 is a subproject. + +### Improvements +* Added an option to warn (+ exit with error) when no tests were ran (#1158) + * Use as `-w NoTests` +* Added provisional support for Emscripten (#1114) +* [Added a way to override the fallback stringifier](https://github.com/catchorg/Catch2/blob/devel/docs/configuration.md#fallback-stringifier) (#1024) + * This allows project's own stringification machinery to be easily reused for Catch +* `Catch::Session::run()` now accepts `char const * const *`, allowing it to accept array of string literals (#1031, #1178) + * The embedded version of Clara was bumped to v1.1.3 +* Various minor performance improvements +* Added support for DJGPP DOS crosscompiler (#1206) + + +## 2.1.2 + +### Fixes +* Fixed compilation error with `-fno-rtti` (#1165) +* Fixed NoAssertion warnings +* `operator<<` is used before range-based stringification (#1172) +* Fixed `-Wpedantic` warnings (extra semicolons and binary literals) (#1173) + + +### Improvements +* Added `CATCH_VERSION_{MAJOR,MINOR,PATCH}` macros (#1131) +* Added `BrightYellow` colour for use in reporters (#979) + * It is also used by ConsoleReporter for reconstructed expressions + +### Other changes +* Catch is now exported as a CMake package and linkable target (#1170) + +## 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.12.x + +#### 1.12.2 +##### Fixes +* Fixed missing <cassert> include + +#### 1.12.1 + +##### Fixes +* Fixed deprecation warning in `ScopedMessage::~ScopedMessage` +* All uses of `min` or `max` identifiers are now wrapped in parentheses + * This avoids problems when Windows headers define `min` and `max` macros + +#### 1.12.0 + +##### Fixes +* Fixed compilation for strict C++98 mode (ie not gnu++98) and older compilers (#1103) +* `INFO` messages are included in the `xml` reporter output even without `-s` specified. + + +### 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` suppression for gcc (#674) + * When compiled with gcc 4.8 or newer, the suppression is localized to assertions only + * Otherwise it is suppressed 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 attributes 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 suppressed 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/packages/Catch2/docs/release-process.md b/packages/Catch2/docs/release-process.md new file mode 100644 index 0000000000000000000000000000000000000000..1b39b1f263c3ccd12da8788ba75f7a40e15bcfbc --- /dev/null +++ b/packages/Catch2/docs/release-process.md @@ -0,0 +1,72 @@ +<a id="top"></a> +# How to release + +When enough changes have accumulated, it is time to release new version of Catch. This document describes the process in doing so, that no steps are forgotten. Note that all referenced scripts can be found in the `tools/scripts/` directory. + +## Necessary steps + +These steps are necessary 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. + + +### Testing + +All of the tests are currently run in our CI setup based on TravisCI and +AppVeyor. As long as the last commit tested green, the release can +proceed. + + +### 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 added to `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 committed 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, SonarQube) should also be attached as binaries, as they might be +dependent on a specific version of the single-include header. + +Since 2.5.0, the release tag and the "binaries" (headers) should be PGP +signed. + +#### Signing a tag + +To create a signed tag, use `git tag -s <VERSION>`, where `<VERSION>` +is the version being released, e.g. `git tag -s v2.6.0`. + +Use the version name as the short message and the release notes as +the body (long) message. + +#### Signing the headers + +This will create ASCII-armored signatures for the headers that are +uploaded to the GitHub release: + +``` +$ gpg2 --armor --output catch.hpp.asc --detach-sig catch.hpp +$ gpg2 --armor --output catch_reporter_automake.hpp.asc --detach-sig catch_reporter_automake.hpp +$ gpg2 --armor --output catch_reporter_teamcity.hpp.asc --detach-sig catch_reporter_teamcity.hpp +$ gpg2 --armor --output catch_reporter_tap.hpp.asc --detach-sig catch_reporter_tap.hpp +``` + +_GPG does not support signing multiple files in single invocation._ diff --git a/packages/Catch2/docs/reporters.md b/packages/Catch2/docs/reporters.md new file mode 100644 index 0000000000000000000000000000000000000000..a33e55bf11bf296986105f94e9127eff8c11f684 --- /dev/null +++ b/packages/Catch2/docs/reporters.md @@ -0,0 +1,47 @@ +<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 ([code example](../examples/207-Rpt-TeamCityReporter.cpp)). +* `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 +* `sonarqube` writes the [SonarQube Generic Test Data](https://docs.sonarqube.org/latest/analysis/generic-test/) XML format. + +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/packages/Catch2/docs/slow-compiles.md b/packages/Catch2/docs/slow-compiles.md new file mode 100644 index 0000000000000000000000000000000000000000..230f533059035150416e0387b2da9efd26fff160 --- /dev/null +++ b/packages/Catch2/docs/slow-compiles.md @@ -0,0 +1,72 @@ +<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++ factorial.cpp -c +$ g++ tests-main.o factorial.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 factorial.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/packages/Catch2/docs/test-cases-and-sections.md b/packages/Catch2/docs/test-cases-and-sections.md new file mode 100644 index 0000000000000000000000000000000000000000..e9308c5ef0c78cb331959044b65d15157bf3d44c --- /dev/null +++ b/packages/Catch2/docs/test-cases-and-sections.md @@ -0,0 +1,283 @@ +<a id="top"></a> +# Test cases and sections + +**Contents**<br> +[Tags](#tags)<br> +[Tag aliases](#tag-aliases)<br> +[BDD-style test cases](#bdd-style-test-cases)<br> +[Type parametrised test cases](#type-parametrised-test-cases)<br> +[Signature based parametrised test cases](#signature-based-parametrised-test-cases)<br> + +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_, \[, _section description_ \] **)** + + +_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, and are discussed below. +_section description_ can be used to provide long form description +of a section while keeping the _section name_ short for use with the +[`-c` command line parameter](command-line.md#specify-the-section-to-run). + +**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. + +* `[.]` - 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]`. + +* `[!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_GIVEN(** _something_ **)** +* **AND_WHEN(** _something_ **)** +* **AND_THEN(** _something_ **)** + +Similar to ```GIVEN```, ```WHEN``` and ```THEN``` except that the prefixes start with "and ". These are used to chain ```GIVEN```s, ```WHEN```s and ```THEN```s together. + +> `AND_GIVEN` was [introduced](https://github.com/catchorg/Catch2/issues/1360) in Catch 2.4.0. + +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! + +## Type parametrised test cases + +In addition to `TEST_CASE`s, Catch2 also supports test cases parametrised +by types, in the form of `TEMPLATE_TEST_CASE`, +`TEMPLATE_PRODUCT_TEST_CASE` and `TEMPLATE_LIST_TEST_CASE`. + +* **TEMPLATE_TEST_CASE(** _test name_ , _tags_, _type1_, _type2_, ..., _typen_ **)** + +> [Introduced](https://github.com/catchorg/Catch2/issues/1437) in Catch 2.5.0. + +_test name_ and _tag_ are exactly the same as they are in `TEST_CASE`, +with the difference that the tag string must be provided (however, it +can be empty). _type1_ through _typen_ is the list of types for which +this test case should run, and, inside the test code, the current type +is available as the `TestType` type. + +Because of limitations of the C++ preprocessor, if you want to specify +a type with multiple template parameters, you need to enclose it in +parentheses, e.g. `std::map<int, std::string>` needs to be passed as +`(std::map<int, std::string>)`. + +Example: +```cpp +TEMPLATE_TEST_CASE( "vectors can be sized and resized", "[vector][template]", int, std::string, (std::tuple<int,float>) ) { + + std::vector<TestType> 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<TestType> empty; + empty.swap( v ); + + REQUIRE( v.capacity() == 0 ); + } + } + SECTION( "reserving smaller does not change size or capacity" ) { + v.reserve( 0 ); + + REQUIRE( v.size() == 5 ); + REQUIRE( v.capacity() >= 5 ); + } +} +``` + +* **TEMPLATE_PRODUCT_TEST_CASE(** _test name_ , _tags_, (_template-type1_, _template-type2_, ..., _template-typen_), (_template-arg1_, _template-arg2_, ..., _template-argm_) **)** + +> [Introduced](https://github.com/catchorg/Catch2/issues/1468) in Catch 2.6.0. + +_template-type1_ through _template-typen_ is list of template template +types which should be combined with each of _template-arg1_ through + _template-argm_, resulting in _n * m_ test cases. Inside the test case, +the resulting type is available under the name of `TestType`. + +To specify more than 1 type as a single _template-type_ or _template-arg_, +you must enclose the types in an additional set of parentheses, e.g. +`((int, float), (char, double))` specifies 2 template-args, each +consisting of 2 concrete types (`int`, `float` and `char`, `double` +respectively). You can also omit the outer set of parentheses if you +specify only one type as the full set of either the _template-types_, +or the _template-args_. + + +Example: +```cpp +template< typename T> +struct Foo { + size_t size() { + return 0; + } +}; + +TEMPLATE_PRODUCT_TEST_CASE("A Template product test case", "[template][product]", (std::vector, Foo), (int, float)) { + TestType x; + REQUIRE(x.size() == 0); +} +``` + +You can also have different arities in the _template-arg_ packs: +```cpp +TEMPLATE_PRODUCT_TEST_CASE("Product with differing arities", "[template][product]", std::tuple, (int, (int, double), (int, double, float))) { + TestType x; + REQUIRE(std::tuple_size<TestType>::value >= 1); +} +``` + +_While there is an upper limit on the number of types you can specify +in single `TEMPLATE_TEST_CASE` or `TEMPLATE_PRODUCT_TEST_CASE`, the limit +is very high and should not be encountered in practice._ + +* **TEMPLATE_LIST_TEST_CASE(** _test name_, _tags_, _type list_ **)** + +> [Introduced](https://github.com/catchorg/Catch2/issues/1627) in Catch 2.9.0. + +_type list_ is a generic list of types on which test case should be instantiated. +List can be `std::tuple`, `boost::mpl::list`, `boost::mp11::mp_list` or anything with +`template <typename...>` signature. + +This allows you to reuse the _type list_ in multiple test cases. + +Example: +```cpp +using MyTypes = std::tuple<int, char, float>; +TEMPLATE_LIST_TEST_CASE("Template test case with test types specified inside std::tuple", "[template][list]", MyTypes) +{ + REQUIRE(sizeof(TestType) > 0); +} +``` + + +## Signature based parametrised test cases + +> [Introduced](https://github.com/catchorg/Catch2/issues/1609) in Catch 2.8.0. + +In addition to [type parametrised test cases](#type-parametrised-test-cases) Catch2 also supports +signature base parametrised test cases, in form of `TEMPLATE_TEST_CASE_SIG` and `TEMPLATE_PRODUCT_TEST_CASE_SIG`. +These test cases have similar syntax like [type parametrised test cases](#type-parametrised-test-cases), with one +additional positional argument which specifies the signature. + +### Signature +Signature has some strict rules for these tests cases to work properly: +* signature with multiple template parameters e.g. `typename T, size_t S` must have this format in test case declaration + `((typename T, size_t S), T, S)` +* signature with variadic template arguments e.g. `typename T, size_t S, typename...Ts` must have this format in test case declaration + `((typename T, size_t S, typename...Ts), T, S, Ts...)` +* signature with single non type template parameter e.g. `int V` must have this format in test case declaration `((int V), V)` +* signature with single type template parameter e.g. `typename T` should not be used as it is in fact `TEMPLATE_TEST_CASE` + +Currently Catch2 support up to 11 template parameters in signature + +### Examples + +* **TEMPLATE_TEST_CASE_SIG(** _test name_ , _tags_, _signature_, _type1_, _type2_, ..., _typen_ **)** + +Inside `TEMPLATE_TEST_CASE_SIG` test case you can use the names of template parameters as defined in _signature_. + +```cpp +TEMPLATE_TEST_CASE_SIG("TemplateTestSig: arrays can be created from NTTP arguments", "[vector][template][nttp]", + ((typename T, int V), T, V), (int,5), (float,4), (std::string,15), ((std::tuple<int, float>), 6)) { + + std::array<T, V> v; + REQUIRE(v.size() > 1); +} +``` + +* **TEMPLATE_PRODUCT_TEST_CASE_SIG(** _test name_ , _tags_, _signature_, (_template-type1_, _template-type2_, ..., _template-typen_), (_template-arg1_, _template-arg2_, ..., _template-argm_) **)** + +```cpp + +template<typename T, size_t S> +struct Bar { + size_t size() { return S; } +}; + +TEMPLATE_PRODUCT_TEST_CASE_SIG("A Template product test case with array signature", "[template][product][nttp]", ((typename T, size_t S), T, S), (std::array, Bar), ((int, 9), (float, 42))) { + TestType x; + REQUIRE(x.size() > 0); +} +``` + + +--- + +[Home](Readme.md#top) diff --git a/packages/Catch2/docs/test-fixtures.md b/packages/Catch2/docs/test-fixtures.md new file mode 100644 index 0000000000000000000000000000000000000000..832bba128023811273e72b1569256d2d352f6fee --- /dev/null +++ b/packages/Catch2/docs/test-fixtures.md @@ -0,0 +1,143 @@ +<a id="top"></a> +# Test fixtures + +## Defining 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. + + +Catch2 also provides `TEMPLATE_TEST_CASE_METHOD` and +`TEMPLATE_PRODUCT_TEST_CASE_METHOD` that can be used together +with templated fixtures and templated template fixtures to perform +tests for multiple different types. Unlike `TEST_CASE_METHOD`, +`TEMPLATE_TEST_CASE_METHOD` and `TEMPLATE_PRODUCT_TEST_CASE_METHOD` do +require the tag specification to be non-empty, as it is followed by +further macro arguments. + +Also note that, because of limitations of the C++ preprocessor, if you +want to specify a type with multiple template parameters, you need to +enclose it in parentheses, e.g. `std::map<int, std::string>` needs to be +passed as `(std::map<int, std::string>)`. +In the case of `TEMPLATE_PRODUCT_TEST_CASE_METHOD`, if a member of the +type list should consist of more than single type, it needs to be enclosed +in another pair of parentheses, e.g. `(std::map, std::pair)` and +`((int, float), (char, double))`. + +Example: +```cpp +template< typename T > +struct Template_Fixture { + Template_Fixture(): m_a(1) {} + + T m_a; +}; + +TEMPLATE_TEST_CASE_METHOD(Template_Fixture,"A TEMPLATE_TEST_CASE_METHOD based test run that succeeds", "[class][template]", int, float, double) { + REQUIRE( Template_Fixture<TestType>::m_a == 1 ); +} + +template<typename T> +struct Template_Template_Fixture { + Template_Template_Fixture() {} + + T m_a; +}; + +template<typename T> +struct Foo_class { + size_t size() { + return 0; + } +}; + +TEMPLATE_PRODUCT_TEST_CASE_METHOD(Template_Template_Fixture, "A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test succeeds", "[class][template]", (Foo_class, std::vector), int) { + REQUIRE( Template_Template_Fixture<TestType>::m_a.size() == 0 ); +} +``` + +_While there is an upper limit on the number of types you can specify +in single `TEMPLATE_TEST_CASE_METHOD` or `TEMPLATE_PRODUCT_TEST_CASE_METHOD`, +the limit is very high and should not be encountered in practice._ + +## Signature-based parametrised test fixtures + +> [Introduced](https://github.com/catchorg/Catch2/issues/1609) in Catch 2.8.0. + +Catch2 also provides `TEMPLATE_TEST_CASE_METHOD_SIG` and `TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG` to support +fixtures using non-type template parameters. These test cases work similar to `TEMPLATE_TEST_CASE_METHOD` and `TEMPLATE_PRODUCT_TEST_CASE_METHOD`, +with additional positional argument for [signature](test-cases-and-sections.md#signature-based-parametrised-test-cases). + +Example: +```cpp +template <int V> +struct Nttp_Fixture{ + int value = V; +}; + +TEMPLATE_TEST_CASE_METHOD_SIG(Nttp_Fixture, "A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds", "[class][template][nttp]",((int V), V), 1, 3, 6) { + REQUIRE(Nttp_Fixture<V>::value > 0); +} + +template<typename T> +struct Template_Fixture_2 { + Template_Fixture_2() {} + + T m_a; +}; + +template< typename T, size_t V> +struct Template_Foo_2 { + size_t size() { return V; } +}; + +TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG(Template_Fixture_2, "A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds", "[class][template][product][nttp]", ((typename T, size_t S), T, S),(std::array, Template_Foo_2), ((int,2), (float,6))) +{ + REQUIRE(Template_Fixture_2<TestType>{}.m_a.size() >= 2); +} +``` + +## Template fixtures with types specified in template type lists + +Catch2 also provides `TEMPLATE_LIST_TEST_CASE_METHOD` to support template fixtures with types specified in +template type lists like `std::tuple`, `boost::mpl::list` or `boost::mp11::mp_list`. This test case works the same as `TEMPLATE_TEST_CASE_METHOD`, +only difference is the source of types. This allows you to reuse the template type list in multiple test cases. + +Example: +```cpp +using MyTypes = std::tuple<int, char, double>; +TEMPLATE_LIST_TEST_CASE_METHOD(Template_Fixture, "Template test case method with test types specified inside std::tuple", "[class][template][list]", MyTypes) +{ + REQUIRE( Template_Fixture<TestType>::m_a == 1 ); +} +``` + +--- + +[Home](Readme.md#top) diff --git a/packages/Catch2/docs/tostring.md b/packages/Catch2/docs/tostring.md new file mode 100644 index 0000000000000000000000000000000000000000..87a0caf0dfecbe8948bfe123c661067c3634a682 --- /dev/null +++ b/packages/Catch2/docs/tostring.md @@ -0,0 +1,132 @@ +<a id="top"></a> +# String conversions + +**Contents**<br> +[operator << overload for std::ostream](#operator--overload-for-stdostream)<br> +[Catch::StringMaker specialisation](#catchstringmaker-specialisation)<br> +[Catch::is_range specialisation](#catchis_range-specialisation)<br> +[Exceptions](#exceptions)<br> +[Enums](#enums)<br> +[Floating point precision](#floating-point-precision)<br> + + +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: + +```cpp +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, or the global namespace, and have it declared before including Catch's header. + +## Catch::StringMaker 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>`: + +```cpp +namespace Catch { + template<> + struct StringMaker<T> { + static std::string convert( T const& value ) { + return convertMyTypeToString( value ); + } + }; +} +``` + +## Catch::is_range 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: + +```cpp +CATCH_TRANSLATE_EXCEPTION( MyType const& ex ) { + return ex.message(); +} +``` + +## Enums + +> Introduced in Catch 2.8.0. + +Enums that already have a `<<` overload for `std::ostream` will convert to strings as expected. +If you only need to convert enums to strings for test reporting purposes you can provide a `StringMaker` specialisations as any other type. +However, as a convenience, Catch provides the `REGISTER_ENUM` helper macro that will generate the `StringMaker` specialiation for you with minimal code. +Simply provide it the (qualified) enum name, followed by all the enum values, and you're done! + +E.g. + +```cpp +enum class Fruits { Banana, Apple, Mango }; + +CATCH_REGISTER_ENUM( Fruits, Fruits::Banana, Fruits::Apple, Fruits::Mango ) + +TEST_CASE() { + REQUIRE( Fruits::Mango == Fruits::Apple ); +} +``` + +... or if the enum is in a namespace: +```cpp +namespace Bikeshed { + enum class Colours { Red, Green, Blue }; +} + +// Important!: This macro must appear at top level scope - not inside a namespace +// You can fully qualify the names, or use a using if you prefer +CATCH_REGISTER_ENUM( Bikeshed::Colours, + Bikeshed::Colours::Red, + Bikeshed::Colours::Green, + Bikeshed::Colours::Blue ) + +TEST_CASE() { + REQUIRE( Bikeshed::Colours::Red == Bikeshed::Colours::Blue ); +} +``` + +## Floating point precision + +> [Introduced](https://github.com/catchorg/Catch2/issues/1614) in Catch 2.8.0. + +Catch provides a built-in `StringMaker` specialization for both `float` +and `double`. By default, it uses what we think is a reasonable precision, +but you can customize it by modifying the `precision` static variable +inside the `StringMaker` specialization, like so: + +```cpp + Catch::StringMaker<float>::precision = 15; + const float testFloat1 = 1.12345678901234567899f; + const float testFloat2 = 1.12345678991234567899f; + REQUIRE(testFloat1 == testFloat2); +``` + +This assertion will fail and print out the `testFloat1` and `testFloat2` +to 15 decimal places. + +--- + +[Home](Readme.md#top) diff --git a/packages/Catch2/docs/tutorial.md b/packages/Catch2/docs/tutorial.md new file mode 100644 index 0000000000000000000000000000000000000000..45cb9919b5b745096bc7f39a6fa3474d946d9104 --- /dev/null +++ b/packages/Catch2/docs/tutorial.md @@ -0,0 +1,288 @@ +<a id="top"></a> +# Tutorial + +**Contents**<br> +[Getting Catch2](#getting-catch2)<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> +[Type parametrised test cases](#type-parametrised-test-cases)<br> +[Next steps](#next-steps)<br> + +## Getting Catch2 + +The simplest way to get Catch2 is to download the latest +[amalgamated header](https://raw.githubusercontent.com/catchorg/Catch2/devel/extras/catch_amalgamated.hpp) +and [amalgamated source file](https://raw.githubusercontent.com/catchorg/Catch2/devel/extras/catch_amalgamated.cpp). + +These two files are the result of merging all headers, respectively +all source files, into one file. To use them, just drop them next to your +own project. Using Catch2 like this has a significant disadvantage in terms +of final compilation times, but it works well enough to get you started. + +Later, you should move towards using Catch2 as a proper library, preferably +via CMake. See our documentation on the [CMake integration](cmake-integration.md#top). + + +_If you have installed Catch2 from system package manager, or CMake +package, you need to include the header as `#include <catch2/catch.hpp>`_ + + +-------- + +The rest of this page is currently waiting for rewrite for the v3 +release. It might not be accurate in places, and likely doesn't mention +the proper header to include, or might refer to outdated functionality, +like the `CATCH_CONFIG_MAIN` macro. + +-------- + + +## 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 a 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! + + +## Type parametrised test cases + +Test cases in Catch2 can be also parametrised by type, via the +`TEMPLATE_TEST_CASE` and `TEMPLATE_PRODUCT_TEST_CASE` macros, +which behave in the same way the `TEST_CASE` macro, but are run for +every type or type combination. + +For more details, see our documentation on [test cases and +sections](test-cases-and-sections.md#type-parametrised-test-cases). + + +## 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/packages/Catch2/docs/why-catch.md b/packages/Catch2/docs/why-catch.md new file mode 100644 index 0000000000000000000000000000000000000000..86cc55bc56b52d8982a9e31ef788cae2102f8848 --- /dev/null +++ b/packages/Catch2/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://www.cute-test.com), +[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/packages/Catch2/examples/000-CatchMain.cpp b/packages/Catch2/examples/000-CatchMain.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5d06bd98950dc0946c4327fac6b461652058080e --- /dev/null +++ b/packages/Catch2/examples/000-CatchMain.cpp @@ -0,0 +1,13 @@ +// 000-CatchMain.cpp + +// It is generally recommended to have a single file provide the main +// of a testing binary, and other test files to link against it. + +// Let Catch provide main(): +#include <catch2/internal/catch_default_main.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/packages/Catch2/examples/010-TestCase.cpp b/packages/Catch2/examples/010-TestCase.cpp new file mode 100644 index 0000000000000000000000000000000000000000..70a0b4c10a6247b6fb4933c9fd8c108ae89329a4 --- /dev/null +++ b/packages/Catch2/examples/010-TestCase.cpp @@ -0,0 +1,33 @@ +// 010-TestCase.cpp +// And write tests in the same file: +#include <catch2/catch_test_macros.hpp> + +static 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/packages/Catch2/examples/020-TestCase-1.cpp b/packages/Catch2/examples/020-TestCase-1.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5d7d8de6e9e3640f2ba3a7744b83d9ecba0670a6 --- /dev/null +++ b/packages/Catch2/examples/020-TestCase-1.cpp @@ -0,0 +1,29 @@ +// 020-TestCase-1.cpp + +#include <catch2/catch_test_macros.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/packages/Catch2/examples/020-TestCase-2.cpp b/packages/Catch2/examples/020-TestCase-2.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3f5767b3409411a485bc654bfd6fa98073b9e980 --- /dev/null +++ b/packages/Catch2/examples/020-TestCase-2.cpp @@ -0,0 +1,33 @@ +// 020-TestCase-2.cpp + +// main() provided by Catch in file 020-TestCase-1.cpp. + +#include <catch2/catch_test_macros.hpp> + +static 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/packages/Catch2/examples/030-Asn-Require-Check.cpp b/packages/Catch2/examples/030-Asn-Require-Check.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f638afae52ed9f4a251a53656760fbd0d874988f --- /dev/null +++ b/packages/Catch2/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 <catch2/catch_test_macros.hpp> + +static 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/packages/Catch2/examples/100-Fix-Section.cpp b/packages/Catch2/examples/100-Fix-Section.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6ec5ee803390616ad7d4346e3904babd6879343f --- /dev/null +++ b/packages/Catch2/examples/100-Fix-Section.cpp @@ -0,0 +1,70 @@ +// 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 <catch2/catch_test_macros.hpp> +#include <vector> + +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/packages/Catch2/examples/110-Fix-ClassFixture.cpp b/packages/Catch2/examples/110-Fix-ClassFixture.cpp new file mode 100644 index 0000000000000000000000000000000000000000..38617a3b91e46b812566c994e61dcc92f2a94107 --- /dev/null +++ b/packages/Catch2/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 <catch2/catch_test_macros.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/packages/Catch2/examples/120-Bdd-ScenarioGivenWhenThen.cpp b/packages/Catch2/examples/120-Bdd-ScenarioGivenWhenThen.cpp new file mode 100644 index 0000000000000000000000000000000000000000..97336a7057734c5de6e8cdb705e74616c5768787 --- /dev/null +++ b/packages/Catch2/examples/120-Bdd-ScenarioGivenWhenThen.cpp @@ -0,0 +1,73 @@ +// 120-Bdd-ScenarioGivenWhenThen.cpp + +// main() provided in 000-CatchMain.cpp + +#include <catch2/catch_test_macros.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/packages/Catch2/examples/210-Evt-EventListeners.cpp b/packages/Catch2/examples/210-Evt-EventListeners.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7a025375abbcfe6fe9c1ed0ab33a92bc025f5a8e --- /dev/null +++ b/packages/Catch2/examples/210-Evt-EventListeners.cpp @@ -0,0 +1,430 @@ +// 210-Evt-EventListeners.cpp + +// Contents: +// 1. Printing of listener data +// 2. My listener and registration +// 3. Test cases + +#include <catch2/catch_test_macros.hpp> +#include <catch2/reporters/catch_reporter_event_listener.hpp> +#include <catch2/catch_reporter_registrars.hpp> +#include <catch2/catch_test_case_info.hpp> +#include <iostream> + +// ----------------------------------------------------------------------- +// 1. Printing of listener data: +// + + +namespace { +std::string ws(int const level) { + return std::string( 2 * level, ' ' ); +} + +std::ostream& operator<<(std::ostream& out, Catch::Tag t) { + return out << "original: " << t.original << "lower cased: " << t.lowerCased; +} + +template< typename T > +std::ostream& operator<<( std::ostream& os, std::vector<T> const& v ) { + os << "{ "; + for ( const 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 ( const 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 Tag { +// StringRef original, lowerCased; +// }; +// +// +// enum class TestCaseProperties : uint8_t { +// None = 0, +// IsHidden = 1 << 1, +// ShouldFail = 1 << 2, +// MayFail = 1 << 3, +// Throws = 1 << 4, +// NonPortable = 1 << 5, +// Benchmark = 1 << 6 +// }; +// +// +// struct TestCaseInfo : NonCopyable { +// +// bool isHidden() const; +// bool throws() const; +// bool okToFail() const; +// bool expectedToFail() const; +// +// +// std::string name; +// std::string className; +// std::vector<Tag> tags; +// SourceLineInfo lineInfo; +// TestCaseProperties properties = TestCaseProperties::None; +// }; + +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) << "- tags: " << info.tags << "\n"; + print( os, level+1 , "- lineInfo", info.lineInfo ); + os << ws(level+1) << "- properties (flags): 0x" << std::hex << static_cast<uint32_t>(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"; + 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::EventListenerBase { + + using EventListenerBase::EventListenerBase; // inherit constructor + + // Get rid of Wweak-tables + ~MyListener(); + + // The whole test run starting + 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 + 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") + void skipTest( Catch::TestCaseInfo const& testInfo ) override { + std::cout + << dashed_line + << "\nEvent: skipTest:\n"; + print( std::cout, 1, "- testInfo", testInfo ); + } + + // Test cases starting + void testCaseStarting( Catch::TestCaseInfo const& testInfo ) override { + std::cout + << dashed_line + << "\nEvent: testCaseStarting:\n"; + print( std::cout, 1, "- testInfo", testInfo ); + } + + // Test cases ending + void testCaseEnded( Catch::TestCaseStats const& testCaseStats ) override { + std::cout << "\nEvent: testCaseEnded:\n"; + print( std::cout, 1, "testCaseStats", testCaseStats ); + } + + // Sections starting + void sectionStarting( Catch::SectionInfo const& sectionInfo ) override { + std::cout << "\nEvent: sectionStarting:\n"; + print( std::cout, 1, "- sectionInfo", sectionInfo ); + } + + // Sections ending + void sectionEnded( Catch::SectionStats const& sectionStats ) override { + std::cout << "\nEvent: sectionEnded:\n"; + print( std::cout, 1, "- sectionStats", sectionStats ); + } + + // Assertions before/ after + void assertionStarting( Catch::AssertionInfo const& assertionInfo ) override { + std::cout << "\nEvent: assertionStarting:\n"; + print( std::cout, 1, "- assertionInfo", assertionInfo ); + } + + bool assertionEnded( Catch::AssertionStats const& assertionStats ) override { + std::cout << "\nEvent: assertionEnded:\n"; + print( std::cout, 1, "- assertionStats", assertionStats ); + return true; + } +}; + +} // end anonymous namespace + +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/packages/Catch2/examples/231-Cfg-OutputStreams.cpp b/packages/Catch2/examples/231-Cfg-OutputStreams.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b77c127354b97dd34823697d08d41923a5e98d19 --- /dev/null +++ b/packages/Catch2/examples/231-Cfg-OutputStreams.cpp @@ -0,0 +1,55 @@ +// 231-Cfg-OutputStreams.cpp +// Show how to replace the streams with a simple custom made streambuf. + +// Note that this reimplementation _does not_ follow `std::cerr` +// semantic, because it buffers the output. For most uses however, +// there is no important difference between having `std::cerr` buffered +// or unbuffered. +#include <catch2/catch_test_macros.hpp> + +#include <sstream> +#include <cstdio> + +class out_buff : public std::stringbuf { + std::FILE* m_stream; +public: + out_buff(std::FILE* stream):m_stream(stream) {} + ~out_buff(); + int sync() override { + int ret = 0; + for (unsigned char c : str()) { + if (putc(c, m_stream) == EOF) { + ret = -1; + break; + } + } + // Reset the buffer to avoid printing it multiple times + str(""); + return ret; + } +}; + +out_buff::~out_buff() { pubsync(); } + +#if defined(__clang__) +#pragma clang diagnostic ignored "-Wexit-time-destructors" // static variables in cout/cerr/clog +#endif + +namespace Catch { + std::ostream& cout() { + static std::ostream ret(new out_buff(stdout)); + return ret; + } + std::ostream& clog() { + static std::ostream ret(new out_buff(stderr)); + return ret; + } + std::ostream& cerr() { + return clog(); + } +} + + +TEST_CASE("This binary uses putc to write out output", "[compilation-only]") { + SUCCEED("Nothing to test."); +} diff --git a/packages/Catch2/examples/300-Gen-OwnGenerator.cpp b/packages/Catch2/examples/300-Gen-OwnGenerator.cpp new file mode 100644 index 0000000000000000000000000000000000000000..09643d6f78c47986117805943dd7c4df59c9adf3 --- /dev/null +++ b/packages/Catch2/examples/300-Gen-OwnGenerator.cpp @@ -0,0 +1,69 @@ +// 300-Gen-OwnGenerator.cpp +// Shows how to define a custom generator. + +// Specifically we will implement a random number generator for integers +// It will have infinite capacity and settable lower/upper bound + +#include <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generators.hpp> +#include <catch2/generators/catch_generators_adapters.hpp> + +#include <random> + +namespace { + +// This class shows how to implement a simple generator for Catch tests +class RandomIntGenerator : public Catch::Generators::IGenerator<int> { + std::minstd_rand m_rand; + std::uniform_int_distribution<> m_dist; + int current_number; +public: + + RandomIntGenerator(int low, int high): + m_rand(std::random_device{}()), + m_dist(low, high) + { + static_cast<void>(next()); + } + + int const& get() const override; + bool next() override { + current_number = m_dist(m_rand); + return true; + } +}; + +// Avoids -Wweak-vtables +int const& RandomIntGenerator::get() const { + return current_number; +} + +// This helper function provides a nicer UX when instantiating the generator +// Notice that it returns an instance of GeneratorWrapper<int>, which +// is a value-wrapper around std::unique_ptr<IGenerator<int>>. +Catch::Generators::GeneratorWrapper<int> random(int low, int high) { + return Catch::Generators::GeneratorWrapper<int>( + new RandomIntGenerator(low, high) + // Another possibility: + // Catch::Detail::make_unique<RandomIntGenerator>(low, high) + ); +} + +} // end anonymous namespaces + +// The two sections in this test case are equivalent, but the first one +// is much more readable/nicer to use +TEST_CASE("Generating random ints", "[example][generator]") { + SECTION("Nice UX") { + auto i = GENERATE(take(100, random(-100, 100))); + REQUIRE(i >= -100); + REQUIRE(i <= 100); + } + SECTION("Creating the random generator directly") { + auto i = GENERATE(take(100, GeneratorWrapper<int>(Catch::Detail::make_unique<RandomIntGenerator>(-100, 100)))); + REQUIRE(i >= -100); + REQUIRE(i <= 100); + } +} + +// Compiling and running this file will result in 400 successful assertions diff --git a/packages/Catch2/examples/301-Gen-MapTypeConversion.cpp b/packages/Catch2/examples/301-Gen-MapTypeConversion.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ba55f65f156cf5dfaf344198a1d583c57113b5c0 --- /dev/null +++ b/packages/Catch2/examples/301-Gen-MapTypeConversion.cpp @@ -0,0 +1,60 @@ +// 301-Gen-MapTypeConversion.cpp +// Shows how to use map to modify generator's return type. + +// Specifically we wrap a std::string returning generator with a generator +// that converts the strings using stoi, so the returned type is actually +// an int. + +#include <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generators_adapters.hpp> + +#include <string> +#include <sstream> + +namespace { + +// Returns a line from a stream. You could have it e.g. read lines from +// a file, but to avoid problems with paths in examples, we will use +// a fixed stringstream. +class LineGenerator : public Catch::Generators::IGenerator<std::string> { + std::string m_line; + std::stringstream m_stream; +public: + LineGenerator() { + m_stream.str("1\n2\n3\n4\n"); + if (!next()) { + Catch::Generators::Detail::throw_generator_exception("Couldn't read a single line"); + } + } + + std::string const& get() const override; + + bool next() override { + return !!std::getline(m_stream, m_line); + } +}; + +std::string const& LineGenerator::get() const { + return m_line; +} + +// This helper function provides a nicer UX when instantiating the generator +// Notice that it returns an instance of GeneratorWrapper<std::string>, which +// is a value-wrapper around std::unique_ptr<IGenerator<std::string>>. +Catch::Generators::GeneratorWrapper<std::string> lines(std::string /* ignored for example */) { + return Catch::Generators::GeneratorWrapper<std::string>( + new LineGenerator() + ); +} + +} // end anonymous namespace + + +TEST_CASE("filter can convert types inside the generator expression", "[example][generator]") { + auto num = GENERATE(map<int>([](std::string const& line) { return std::stoi(line); }, + lines("fake-file"))); + + REQUIRE(num > 0); +} + +// Compiling and running this file will result in 4 successful assertions diff --git a/packages/Catch2/examples/302-Gen-Table.cpp b/packages/Catch2/examples/302-Gen-Table.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8b4fc97481d788cfd2f1d89998127b3d900c7c5f --- /dev/null +++ b/packages/Catch2/examples/302-Gen-Table.cpp @@ -0,0 +1,55 @@ +// 302-Gen-Table.cpp +// Shows how to use table to run a test many times with different inputs. Lifted from examples on +// issue #850. + +#include <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generators.hpp> +#include <string> + +struct TestSubject { + // this is the method we are going to test. It returns the length of the + // input string. + size_t GetLength( const std::string& input ) const { return input.size(); } +}; + + +TEST_CASE("Table allows pre-computed test inputs and outputs", "[example][generator]") { + using std::make_tuple; + // do setup here as normal + TestSubject subj; + + SECTION("This section is run for each row in the table") { + std::string test_input; + size_t expected_output; + std::tie( test_input, expected_output ) = + GENERATE( table<std::string, size_t>( + { /* In this case one of the parameters to our test case is the + * expected output, but this is not required. There could be + * multiple expected values in the table, which can have any + * (fixed) number of columns. + */ + make_tuple( "one", 3 ), + make_tuple( "two", 3 ), + make_tuple( "three", 5 ), + make_tuple( "four", 4 ) } ) ); + + // run the test + auto result = subj.GetLength(test_input); + // capture the input data to go with the outputs. + CAPTURE(test_input); + // check it matches the pre-calculated data + REQUIRE(result == expected_output); + } // end section +} + +/* Possible simplifications where less legacy toolchain support is needed: + * + * - With libstdc++6 or newer, the make_tuple() calls can be ommitted + * (technically C++17 but does not require -std in GCC/Clang). See + * https://stackoverflow.com/questions/12436586/tuple-vector-and-initializer-list + * + * - In C++17 mode std::tie() and the preceeding variable delcarations can be + * replaced by structured bindings: auto [test_input, expected] = GENERATE( + * table<std::string, size_t>({ ... + */ +// Compiling and running this file will result in 4 successful assertions diff --git a/packages/Catch2/examples/310-Gen-VariablesInGenerators.cpp b/packages/Catch2/examples/310-Gen-VariablesInGenerators.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0339c5f18a55ccefa821ebbdf2db4baf78fae4bb --- /dev/null +++ b/packages/Catch2/examples/310-Gen-VariablesInGenerators.cpp @@ -0,0 +1,35 @@ +// 310-Gen-VariablesInGenerator.cpp +// Shows how to use variables when creating generators. + +// Note that using variables inside generators is dangerous and should +// be done only if you know what you are doing, because the generators +// _WILL_ outlive the variables -- thus they should be either captured +// by value directly, or copied by the generators during construction. + +#include <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generators_adapters.hpp> +#include <catch2/generators/catch_generators_random.hpp> + +TEST_CASE("Generate random doubles across different ranges", + "[generator][example][advanced]") { + // Workaround for old libstdc++ + using record = std::tuple<double, double>; + // Set up 3 ranges to generate numbers from + auto r = GENERATE(table<double, double>({ + record{3, 4}, + record{-4, -3}, + record{10, 1000} + })); + + // This will not compile (intentionally), because it accesses a variable + // auto number = GENERATE(take(50, random(std::get<0>(r), std::get<1>(r)))); + + // GENERATE_COPY copies all variables mentioned inside the expression + // thus this will work. + auto number = GENERATE_COPY(take(50, random(std::get<0>(r), std::get<1>(r)))); + + REQUIRE(std::abs(number) > 0); +} + +// Compiling and running this file will result in 150 successful assertions + diff --git a/packages/Catch2/examples/311-Gen-CustomCapture.cpp b/packages/Catch2/examples/311-Gen-CustomCapture.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d12ee70901261137ba0e98d222f504379beeeded --- /dev/null +++ b/packages/Catch2/examples/311-Gen-CustomCapture.cpp @@ -0,0 +1,43 @@ +// 311-Gen-CustomCapture.cpp +// Shows how to provide custom capture list to the generator expression + +// Note that using variables inside generators is dangerous and should +// be done only if you know what you are doing, because the generators +// _WILL_ outlive the variables. Also, even if you know what you are +// doing, you should probably use GENERATE_COPY or GENERATE_REF macros +// instead. However, if your use case requires having a +// per-variable custom capture list, this example shows how to achieve +// that. + +#include <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generators_adapters.hpp> +#include <catch2/generators/catch_generators_random.hpp> + +TEST_CASE("Generate random doubles across different ranges", + "[generator][example][advanced]") { + // Workaround for old libstdc++ + using record = std::tuple<double, double>; + // Set up 3 ranges to generate numbers from + auto r1 = GENERATE(table<double, double>({ + record{3, 4}, + record{-4, -3}, + record{10, 1000} + })); + + auto r2(r1); + + // This will take r1 by reference and r2 by value. + // Note that there are no advantages for doing so in this example, + // it is done only for expository purposes. + auto number = Catch::Generators::generate( "custom capture generator", CATCH_INTERNAL_LINEINFO, + [&r1, r2]{ + using namespace Catch::Generators; + return makeGenerators(take(50, random(std::get<0>(r1), std::get<1>(r2)))); + } + ); + + REQUIRE(std::abs(number) > 0); +} + +// Compiling and running this file will result in 150 successful assertions + diff --git a/packages/Catch2/examples/CMakeLists.txt b/packages/Catch2/examples/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..b934aa7cd7718f469fea9e4ba426347e199effc3 --- /dev/null +++ b/packages/Catch2/examples/CMakeLists.txt @@ -0,0 +1,63 @@ +cmake_minimum_required( VERSION 3.5 ) + +project( Catch2Examples LANGUAGES CXX ) + +message( STATUS "Examples included" ) + + +# Some one-offs first: +# 1) Tests and main in one file +add_executable( 010-TestCase + 010-TestCase.cpp +) + +# 2) Tests and main across two files +add_executable( 020-MultiFile + 020-TestCase-1.cpp + 020-TestCase-2.cpp +) + +add_executable(231-Cfg_OutputStreams + 231-Cfg-OutputStreams.cpp +) +target_link_libraries(231-Cfg_OutputStreams Catch2_buildall_interface) +target_compile_definitions(231-Cfg_OutputStreams PUBLIC CATCH_CONFIG_NOSTDOUT) + +# These examples use the standard separate compilation +set( SOURCES_IDIOMATIC_EXAMPLES + 030-Asn-Require-Check.cpp + 100-Fix-Section.cpp + 110-Fix-ClassFixture.cpp + 120-Bdd-ScenarioGivenWhenThen.cpp + 210-Evt-EventListeners.cpp + 300-Gen-OwnGenerator.cpp + 301-Gen-MapTypeConversion.cpp + 302-Gen-Table.cpp + 310-Gen-VariablesInGenerators.cpp + 311-Gen-CustomCapture.cpp +) + +string( REPLACE ".cpp" "" BASENAMES_IDIOMATIC_EXAMPLES "${SOURCES_IDIOMATIC_EXAMPLES}" ) +set( TARGETS_IDIOMATIC_EXAMPLES ${BASENAMES_IDIOMATIC_EXAMPLES} ) + + +foreach( name ${TARGETS_IDIOMATIC_EXAMPLES} ) + add_executable( ${name} + ${EXAMPLES_DIR}/${name}.cpp ) +endforeach() + +set(ALL_EXAMPLE_TARGETS + ${TARGETS_IDIOMATIC_EXAMPLES} + 010-TestCase + 020-MultiFile +) + +foreach( name ${ALL_EXAMPLE_TARGETS} ) + target_link_libraries( ${name} Catch2 Catch2WithMain ) + set_property(TARGET ${name} PROPERTY CXX_STANDARD 14) + set_property(TARGET ${name} PROPERTY CXX_EXTENSIONS OFF) +endforeach() + + +list(APPEND CATCH_WARNING_TARGETS ${ALL_EXAMPLE_TARGETS}) +set(CATCH_WARNING_TARGETS ${CATCH_WARNING_TARGETS} PARENT_SCOPE) diff --git a/packages/Catch2/extras/Catch.cmake b/packages/Catch2/extras/Catch.cmake new file mode 100644 index 0000000000000000000000000000000000000000..b3f90a79e8bf16cf7210af5f651a966334142a66 --- /dev/null +++ b/packages/Catch2/extras/Catch.cmake @@ -0,0 +1,205 @@ +# 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] + [REPORTER reporter] + [OUTPUT_DIR dir] + [OUTPUT_PREFIX prefix} + [OUTPUT_SUFFIX suffix] + ) + + ``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. + + ``REPORTER reporter`` + Use the specified reporter when running the test case. The reporter will + be passed to the Catch executable as ``--reporter reporter``. + + ``OUTPUT_DIR dir`` + If specified, the parameter is passed along as + ``--out dir/<test_name>`` to Catch executable. The actual file name is the + same as the test name. This should be used instead of + ``EXTRA_ARGS --out foo`` to avoid race conditions writing the result output + when using parallel test execution. + + ``OUTPUT_PREFIX prefix`` + May be used in conjunction with ``OUTPUT_DIR``. + If specified, ``prefix`` is added to each output file name, like so + ``--out dir/prefix<test_name>``. + + ``OUTPUT_SUFFIX suffix`` + May be used in conjunction with ``OUTPUT_DIR``. + If specified, ``suffix`` is added to each output file name, like so + ``--out dir/<test_name>suffix``. This can be used to add a file extension to + the output e.g. ".xml". + +#]=======================================================================] + +#------------------------------------------------------------------------------ +function(catch_discover_tests TARGET) + cmake_parse_arguments( + "" + "" + "TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST;REPORTER;OUTPUT_DIR;OUTPUT_PREFIX;OUTPUT_SUFFIX" + "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} ${_REPORTER} ${_OUTPUT_DIR} ${_OUTPUT_PREFIX} ${_OUTPUT_SUFFIX}") + string(SUBSTRING ${args_hash} 0 7 args_hash) + + # Define rule to generate test list for aforementioned test executable + 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 "TEST_REPORTER=${_REPORTER}" + -D "TEST_OUTPUT_DIR=${_OUTPUT_DIR}" + -D "TEST_OUTPUT_PREFIX=${_OUTPUT_PREFIX}" + -D "TEST_OUTPUT_SUFFIX=${_OUTPUT_SUFFIX}" + -D "CTEST_FILE=${ctest_tests_file}" + -P "${_CATCH_DISCOVER_TESTS_SCRIPT}" + VERBATIM + ) + + 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/packages/Catch2/extras/CatchAddTests.cmake b/packages/Catch2/extras/CatchAddTests.cmake new file mode 100644 index 0000000000000000000000000000000000000000..3688b72fd13255bef358be79209b1794b20aef3d --- /dev/null +++ b/packages/Catch2/extras/CatchAddTests.cmake @@ -0,0 +1,123 @@ +# 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(reporter ${TEST_REPORTER}) +set(output_dir ${TEST_OUTPUT_DIR}) +set(output_prefix ${TEST_OUTPUT_PREFIX}) +set(output_suffix ${TEST_OUTPUT_SUFFIX}) +set(script) +set(suite) +set(tests) + +function(add_command NAME) + set(_args "") + foreach(_arg ${ARGN}) + 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-tests --verbosity quiet + OUTPUT_VARIABLE output + RESULT_VARIABLE result + WORKING_DIRECTORY "${TEST_WORKING_DIR}" +) +if(NOT ${result} EQUAL 0) + message(FATAL_ERROR + "Error running test executable '${TEST_EXECUTABLE}':\n" + " Result: ${result}\n" + " Output: ${output}\n" + ) +endif() + +string(REPLACE "\n" ";" output "${output}") + +# Run test executable to get list of available reporters +execute_process( + COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} --list-reporters + OUTPUT_VARIABLE reporters_output + RESULT_VARIABLE reporters_result + WORKING_DIRECTORY "${TEST_WORKING_DIR}" +) +if(NOT ${reporters_result} EQUAL 0) + message(FATAL_ERROR + "Error running test executable '${TEST_EXECUTABLE}':\n" + " Result: ${reporters_result}\n" + " Output: ${reporters_output}\n" + ) +endif() +string(FIND "${reporters_output}" "${reporter}" reporter_is_valid) +if(reporter AND ${reporter_is_valid} EQUAL -1) + message(FATAL_ERROR + "\"${reporter}\" is not a valid reporter!\n" + ) +endif() + +# Prepare reporter +if(reporter) + set(reporter_arg "--reporter ${reporter}") +endif() + +# Prepare output dir +if(output_dir AND NOT IS_ABSOLUTE ${output_dir}) + set(output_dir "${TEST_WORKING_DIR}/${output_dir}") + if(NOT EXISTS ${output_dir}) + file(MAKE_DIRECTORY ${output_dir}) + endif() +endif() + +# Parse output +foreach(line ${output}) + set(test ${line}) + # Escape characters in test case names that would be parsed by Catch2 + set(test_name ${test}) + foreach(char , [ ]) + string(REPLACE ${char} "\\${char}" test_name ${test_name}) + endforeach(char) + # ...add output dir + if(output_dir) + string(REGEX REPLACE "[^A-Za-z0-9_]" "_" test_name_clean ${test_name}) + set(output_dir_arg "--out ${output_dir}/${output_prefix}${test_name_clean}${output_suffix}") + endif() + + # ...and add to script + add_command(add_test + "${prefix}${test}${suffix}" + ${TEST_EXECUTOR} + "${TEST_EXECUTABLE}" + "${test_name}" + ${extra_args} + "${reporter_arg}" + "${output_dir_arg}" + ) + 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/packages/Catch2/extras/ParseAndAddCatchTests.cmake b/packages/Catch2/extras/ParseAndAddCatchTests.cmake new file mode 100644 index 0000000000000000000000000000000000000000..3f3da83198f3aac7bc555dbb69f7c50b887b9971 --- /dev/null +++ b/packages/Catch2/extras/ParseAndAddCatchTests.cmake @@ -0,0 +1,251 @@ +#==================================================================================================# +# supported macros # +# - TEST_CASE, # +# - TEMPLATE_TEST_CASE # +# - SCENARIO, # +# - TEST_CASE_METHOD, # +# - CATCH_TEST_CASE, # +# - CATCH_TEMPLATE_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 # +# # +# One can also set (locally) the optional variable OptionalCatchTestLauncher to precise the way # +# a test should be run. For instance to use test MPI, one can write # +# set(OptionalCatchTestLauncher ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${NUMPROC}) # +# just before calling this ParseAndAddCatchTests function # +# # +# The AdditionalCatchParameters optional variable can be used to pass extra argument to the test # +# command. For example, to include successful tests in the output, one can write # +# set(AdditionalCatchParameters --success) # +# # +# After the script, the ParseAndAddCatchTests_TESTS property for the target, and for each source # +# file in the target is set, and contains the list of the tests extracted from that target, or # +# from that file. This is useful, for example to add further labels or properties to the tests. # +# # +#==================================================================================================# + +if (CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.8) + message(FATAL_ERROR "ParseAndAddCatchTests requires CMake 2.8.8 or newer") +endif() + +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(ParseAndAddCatchTests_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(ParseAndAddCatchTests_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(ParseAndAddCatchTests_ParseFile SourceFile TestTarget) + # If SourceFile is an object library, do not scan it (as it is not a file). Exit without giving a warning about a missing file. + if(SourceFile MATCHES "\\\$<TARGET_OBJECTS:.+>") + ParseAndAddCatchTests_PrintDebugMessage("Detected OBJECT library: ${SourceFile} this will not be scanned for tests.") + return() + endif() + # 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() + ParseAndAddCatchTests_PrintDebugMessage("parsing ${SourceFile}") + file(STRINGS ${SourceFile} Contents NEWLINE_CONSUME) + + # Remove block and fullline comments + ParseAndAddCatchTests_RemoveComments(Contents) + + # Find definition of test names + # https://regex101.com/r/JygOND/1 + string(REGEX MATCHALL "[ \t]*(CATCH_)?(TEMPLATE_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)[ \t]*\\([ \t\n]*\"[^\"]*\"[ \t\n]*(,[ \t\n]*\"[^\"]*\")?(,[ \t\n]*[^\,\)]*)*\\)[ \t\n]*\{+[ \t]*(//[^\n]*[Tt][Ii][Mm][Ee][Oo][Uu][Tt][ \t]*[0-9]+)*" Tests "${Contents}") + + if(PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS AND Tests) + ParseAndAddCatchTests_PrintDebugMessage("Adding ${SourceFile} to CMAKE_CONFIGURE_DEPENDS property") + set_property( + DIRECTORY + APPEND + PROPERTY CMAKE_CONFIGURE_DEPENDS ${SourceFile} + ) + endif() + + # check CMP0110 policy for new add_test() behavior + if(POLICY CMP0110) + cmake_policy(GET CMP0110 _cmp0110_value) # new add_test() behavior + else() + # just to be thorough explicitly set the variable + set(_cmp0110_value) + endif() + + foreach(TestName ${Tests}) + # Strip newlines + string(REGEX REPLACE "\\\\\n|\n" "" TestName "${TestName}") + + # Get test type and fixture if applicable + string(REGEX MATCH "(CATCH_)?(TEMPLATE_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)[ \t]*\\([^,^\"]*" TestTypeAndFixture "${TestName}") + string(REGEX MATCH "(CATCH_)?(TEMPLATE_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)" TestType "${TestTypeAndFixture}") + string(REGEX REPLACE "${TestType}\\([ \t]*" "" TestFixture "${TestTypeAndFixture}") + + # Get string parts of test definition + 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 "${TestType}" MATCHES "(CATCH_)?TEST_CASE_METHOD" 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}") + else() + # unset tags variable from previous loop + unset(Tags) + endif() + + list(APPEND Labels ${Tags}) + + 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} AND ${CMAKE_VERSION} VERSION_LESS "3.9") + ParseAndAddCatchTests_PrintDebugMessage("Skipping test \"${CTestName}\" as it has [!hide], [.] or [.foo] label") + else() + ParseAndAddCatchTests_PrintDebugMessage("Adding test \"${CTestName}\"") + if(Labels) + ParseAndAddCatchTests_PrintDebugMessage("Setting labels to ${Labels}") + endif() + + # Escape commas in the test spec + string(REPLACE "," "\\," Name ${Name}) + + # Work around CMake 3.18.0 change in `add_test()`, before the escaped quotes were neccessary, + # only with CMake 3.18.0 the escaped double quotes confuse the call. This change is reverted in 3.18.1 + # And properly introduced in 3.19 with the CMP0110 policy + if(_cmp0110_value STREQUAL "NEW" OR ${CMAKE_VERSION} VERSION_EQUAL "3.18") + ParseAndAddCatchTests_PrintDebugMessage("CMP0110 set to NEW, no need for add_test(\"\") workaround") + else() + ParseAndAddCatchTests_PrintDebugMessage("CMP0110 set to OLD adding \"\" for add_test() workaround") + set(CTestName "\"${CTestName}\"") + endif() + + # Handle template test cases + if("${TestTypeAndFixture}" MATCHES ".*TEMPLATE_.*") + set(Name "${Name} - *") + endif() + + # Add the test and set its properties + add_test(NAME "${CTestName}" COMMAND ${OptionalCatchTestLauncher} $<TARGET_FILE:${TestTarget}> ${Name} ${AdditionalCatchParameters}) + # Old CMake versions do not document VERSION_GREATER_EQUAL, so we use VERSION_GREATER with 3.8 instead + if(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS AND ${HiddenTagFound} AND ${CMAKE_VERSION} VERSION_GREATER "3.8") + ParseAndAddCatchTests_PrintDebugMessage("Setting DISABLED test property") + set_tests_properties("${CTestName}" PROPERTIES DISABLED ON) + else() + set_tests_properties("${CTestName}" PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran" + LABELS "${Labels}") + endif() + set_property( + TARGET ${TestTarget} + APPEND + PROPERTY ParseAndAddCatchTests_TESTS "${CTestName}") + set_property( + SOURCE ${SourceFile} + APPEND + PROPERTY ParseAndAddCatchTests_TESTS "${CTestName}") + endif() + + + endforeach() +endfunction() + +# entry point +function(ParseAndAddCatchTests TestTarget) + ParseAndAddCatchTests_PrintDebugMessage("Started parsing ${TestTarget}") + get_target_property(SourceFiles ${TestTarget} SOURCES) + ParseAndAddCatchTests_PrintDebugMessage("Found the following sources: ${SourceFiles}") + foreach(SourceFile ${SourceFiles}) + ParseAndAddCatchTests_ParseFile(${SourceFile} ${TestTarget}) + endforeach() + ParseAndAddCatchTests_PrintDebugMessage("Finished parsing ${TestTarget}") +endfunction() diff --git a/packages/Catch2/extras/catch_amalgamated.cpp b/packages/Catch2/extras/catch_amalgamated.cpp new file mode 100644 index 0000000000000000000000000000000000000000..43f3eed9123a05150041430f070d1fce7b5d24b3 --- /dev/null +++ b/packages/Catch2/extras/catch_amalgamated.cpp @@ -0,0 +1,9430 @@ +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +// Catch v3.0.0-preview.3 +// Generated: 2020-10-08 13:59:26.616931 +// ---------------------------------------------------------- +// This file is an amalgamation of multiple different files. +// You probably shouldn't edit it directly. +// ---------------------------------------------------------- + +#include "catch_amalgamated.hpp" + + +// Adapted from donated nonius code. + + + +#include <cassert> +#include <iterator> +#include <random> + + +#if defined(CATCH_CONFIG_USE_ASYNC) +#include <future> +#endif + +namespace { + +using Catch::Benchmark::Detail::sample; + + template <typename URng, typename Estimator> + sample resample(URng& rng, int resamples, std::vector<double>::iterator first, std::vector<double>::iterator last, Estimator& estimator) { + auto n = last - first; + std::uniform_int_distribution<decltype(n)> dist(0, n - 1); + + sample out; + out.reserve(resamples); + std::generate_n(std::back_inserter(out), resamples, [n, first, &estimator, &dist, &rng] { + std::vector<double> resampled; + resampled.reserve(n); + std::generate_n(std::back_inserter(resampled), n, [first, &dist, &rng] { return first[dist(rng)]; }); + return estimator(resampled.begin(), resampled.end()); + }); + std::sort(out.begin(), out.end()); + return out; + } + + + double erf_inv(double x) { + // Code accompanying the article "Approximating the erfinv function" in GPU Computing Gems, Volume 2 + double w, p; + + w = -log((1.0 - x) * (1.0 + x)); + + if (w < 6.250000) { + w = w - 3.125000; + p = -3.6444120640178196996e-21; + p = -1.685059138182016589e-19 + p * w; + p = 1.2858480715256400167e-18 + p * w; + p = 1.115787767802518096e-17 + p * w; + p = -1.333171662854620906e-16 + p * w; + p = 2.0972767875968561637e-17 + p * w; + p = 6.6376381343583238325e-15 + p * w; + p = -4.0545662729752068639e-14 + p * w; + p = -8.1519341976054721522e-14 + p * w; + p = 2.6335093153082322977e-12 + p * w; + p = -1.2975133253453532498e-11 + p * w; + p = -5.4154120542946279317e-11 + p * w; + p = 1.051212273321532285e-09 + p * w; + p = -4.1126339803469836976e-09 + p * w; + p = -2.9070369957882005086e-08 + p * w; + p = 4.2347877827932403518e-07 + p * w; + p = -1.3654692000834678645e-06 + p * w; + p = -1.3882523362786468719e-05 + p * w; + p = 0.0001867342080340571352 + p * w; + p = -0.00074070253416626697512 + p * w; + p = -0.0060336708714301490533 + p * w; + p = 0.24015818242558961693 + p * w; + p = 1.6536545626831027356 + p * w; + } else if (w < 16.000000) { + w = sqrt(w) - 3.250000; + p = 2.2137376921775787049e-09; + p = 9.0756561938885390979e-08 + p * w; + p = -2.7517406297064545428e-07 + p * w; + p = 1.8239629214389227755e-08 + p * w; + p = 1.5027403968909827627e-06 + p * w; + p = -4.013867526981545969e-06 + p * w; + p = 2.9234449089955446044e-06 + p * w; + p = 1.2475304481671778723e-05 + p * w; + p = -4.7318229009055733981e-05 + p * w; + p = 6.8284851459573175448e-05 + p * w; + p = 2.4031110387097893999e-05 + p * w; + p = -0.0003550375203628474796 + p * w; + p = 0.00095328937973738049703 + p * w; + p = -0.0016882755560235047313 + p * w; + p = 0.0024914420961078508066 + p * w; + p = -0.0037512085075692412107 + p * w; + p = 0.005370914553590063617 + p * w; + p = 1.0052589676941592334 + p * w; + p = 3.0838856104922207635 + p * w; + } else { + w = sqrt(w) - 5.000000; + p = -2.7109920616438573243e-11; + p = -2.5556418169965252055e-10 + p * w; + p = 1.5076572693500548083e-09 + p * w; + p = -3.7894654401267369937e-09 + p * w; + p = 7.6157012080783393804e-09 + p * w; + p = -1.4960026627149240478e-08 + p * w; + p = 2.9147953450901080826e-08 + p * w; + p = -6.7711997758452339498e-08 + p * w; + p = 2.2900482228026654717e-07 + p * w; + p = -9.9298272942317002539e-07 + p * w; + p = 4.5260625972231537039e-06 + p * w; + p = -1.9681778105531670567e-05 + p * w; + p = 7.5995277030017761139e-05 + p * w; + p = -0.00021503011930044477347 + p * w; + p = -0.00013871931833623122026 + p * w; + p = 1.0103004648645343977 + p * w; + p = 4.8499064014085844221 + p * w; + } + return p * x; + } + + double standard_deviation(std::vector<double>::iterator first, std::vector<double>::iterator last) { + auto m = Catch::Benchmark::Detail::mean(first, last); + double variance = std::accumulate(first, last, 0., [m](double a, double b) { + double diff = b - m; + return a + diff * diff; + }) / (last - first); + return std::sqrt(variance); + } + +} + +namespace Catch { + namespace Benchmark { + namespace Detail { + + double weighted_average_quantile(int k, int q, std::vector<double>::iterator first, std::vector<double>::iterator last) { + auto count = last - first; + double idx = (count - 1) * k / static_cast<double>(q); + int j = static_cast<int>(idx); + double g = idx - j; + std::nth_element(first, first + j, last); + auto xj = first[j]; + if (g == 0) return xj; + + auto xj1 = *std::min_element(first + (j + 1), last); + return xj + g * (xj1 - xj); + } + + + double erfc_inv(double x) { + return erf_inv(1.0 - x); + } + + double normal_quantile(double p) { + static const double ROOT_TWO = std::sqrt(2.0); + + double result = 0.0; + assert(p >= 0 && p <= 1); + if (p < 0 || p > 1) { + return result; + } + + result = -erfc_inv(2.0 * p); + // result *= normal distribution standard deviation (1.0) * sqrt(2) + result *= /*sd * */ ROOT_TWO; + // result += normal disttribution mean (0) + return result; + } + + + double outlier_variance(Estimate<double> mean, Estimate<double> stddev, int n) { + double sb = stddev.point; + double mn = mean.point / n; + double mg_min = mn / 2.; + double sg = std::min(mg_min / 4., sb / std::sqrt(n)); + double sg2 = sg * sg; + double sb2 = sb * sb; + + auto c_max = [n, mn, sb2, sg2](double x) -> double { + double k = mn - x; + double d = k * k; + double nd = n * d; + double k0 = -n * nd; + double k1 = sb2 - n * sg2 + nd; + double det = k1 * k1 - 4 * sg2 * k0; + return (int)(-2. * k0 / (k1 + std::sqrt(det))); + }; + + auto var_out = [n, sb2, sg2](double c) { + double nc = n - c; + return (nc / n) * (sb2 - nc * sg2); + }; + + return std::min(var_out(1), var_out(std::min(c_max(0.), c_max(mg_min)))) / sb2; + } + + + bootstrap_analysis analyse_samples(double confidence_level, int n_resamples, std::vector<double>::iterator first, std::vector<double>::iterator last) { + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS + static std::random_device entropy; + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION + + auto n = static_cast<int>(last - first); // seriously, one can't use integral types without hell in C++ + + auto mean = &Detail::mean<std::vector<double>::iterator>; + auto stddev = &standard_deviation; + +#if defined(CATCH_CONFIG_USE_ASYNC) + auto Estimate = [=](double(*f)(std::vector<double>::iterator, std::vector<double>::iterator)) { + auto seed = entropy(); + return std::async(std::launch::async, [=] { + std::mt19937 rng(seed); + auto resampled = resample(rng, n_resamples, first, last, f); + return bootstrap(confidence_level, first, last, resampled, f); + }); + }; + + auto mean_future = Estimate(mean); + auto stddev_future = Estimate(stddev); + + auto mean_estimate = mean_future.get(); + auto stddev_estimate = stddev_future.get(); +#else + auto Estimate = [=](double(*f)(std::vector<double>::iterator, std::vector<double>::iterator)) { + auto seed = entropy(); + std::mt19937 rng(seed); + auto resampled = resample(rng, n_resamples, first, last, f); + return bootstrap(confidence_level, first, last, resampled, f); + }; + + auto mean_estimate = Estimate(mean); + auto stddev_estimate = Estimate(stddev); +#endif // CATCH_USE_ASYNC + + double outlier_variance = Detail::outlier_variance(mean_estimate, stddev_estimate, n); + + return { mean_estimate, stddev_estimate, outlier_variance }; + } + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + + +/** \file + * This is a special TU that combines what would otherwise be a very + * small benchmarking-related TUs into one bigger TU. + * + * The reason for this is compilation performance improvements by + * avoiding reparsing headers for many small TUs, instead having this + * one TU include bit more, but having it all parsed only once. + * + * To avoid heavy-tail problem with compilation times, each "subpart" + * of Catch2 has its own combined TU like this. + */ + +//////////////////////////////////////////// +// vvv formerly catch_chronometer.cpp vvv // +//////////////////////////////////////////// + + +namespace Catch { + namespace Benchmark { + namespace Detail { + ChronometerConcept::~ChronometerConcept() = default; + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + + +/////////////////////////////////////////////////// +// vvv formerly catch_benchmark_function.cpp vvv // +/////////////////////////////////////////////////// + + +namespace Catch { + namespace Benchmark { + namespace Detail { + BenchmarkFunction::callable::~callable() = default; + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + + +//////////////////////////////////////////////// +// vvv formerly catch_complete_invoke.cpp vvv // +//////////////////////////////////////////////// + + +namespace Catch { + namespace Benchmark { + namespace Detail { + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS + const std::string benchmarkErrorMsg = "a benchmark failed to run successfully"; + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + + + + +///////////////////////////////////////////////// +// vvv formerly catch_run_for_at_least.cpp vvv // +///////////////////////////////////////////////// + +#include <exception> + +namespace Catch { + namespace Benchmark { + namespace Detail { + struct optimized_away_error : std::exception { + const char* what() const noexcept override; + }; + + const char* optimized_away_error::what() const noexcept { + return "could not measure benchmark, maybe it was optimized away"; + } + + void throw_optimized_away_error() { + Catch::throw_exception(optimized_away_error{}); + } + + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + + + +#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 { + + 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 ); + } + + Approx Approx::operator-() const { + auto temp(*this); + temp.m_value = -temp.m_value; + return temp; + } + + + 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(std::isinf(m_value)? 0 : m_value))); + } + + void Approx::setMargin(double newMargin) { + CATCH_ENFORCE(newMargin >= 0, + "Invalid Approx::margin: " << newMargin << '.' + << " Approx::Margin has to be non-negative."); + m_margin = newMargin; + } + + void Approx::setEpsilon(double newEpsilon) { + CATCH_ENFORCE(newEpsilon >= 0 && newEpsilon <= 1.0, + "Invalid Approx::epsilon: " << newEpsilon << '.' + << " Approx::epsilon has to be in [0, 1]"); + m_epsilon = newEpsilon; + } + +namespace literals { + Approx operator "" _a(long double val) { + return Approx(val); + } + Approx operator "" _a(unsigned long long val) { + return Approx(val); + } +} // end namespace literals + +std::string StringMaker<Catch::Approx>::convert(Catch::Approx const& value) { + return value.toString(); +} + +} // end namespace Catch + + + +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.empty(); + } + + bool AssertionResult::hasMessage() const { + return !m_resultData.message.empty(); + } + + std::string AssertionResult::getExpression() const { + // Possibly overallocating by 3 characters should be basically free + std::string expr; expr.reserve(m_info.capturedExpression.size() + 3); + if (isFalseTest(m_info.resultDisposition)) { + expr += "!("; + } + expr += m_info.capturedExpression; + if (isFalseTest(m_info.resultDisposition)) { + expr += ')'; + } + return expr; + } + + std::string AssertionResult::getExpressionInMacro() const { + std::string expr; + if( m_info.macroName.empty() ) + expr = static_cast<std::string>(m_info.capturedExpression); + else { + expr.reserve( m_info.macroName.size() + m_info.capturedExpression.size() + 4 ); + expr += m_info.macroName; + expr += "( "; + expr += m_info.capturedExpression; + 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 + + + + +namespace Catch { + + Config::Config( ConfigData const& data ) + : m_data( data ), + m_stream( openStream() ) + { + // We need to trim filter specs to avoid trouble with superfluous + // whitespace (esp. important for bdd macros, as those are manually + // aligned with whitespace). + + for (auto& elem : m_data.testsOrTags) { + elem = trim(elem); + } + for (auto& elem : m_data.sectionsToRun) { + elem = trim(elem); + } + + TestSpecParser parser(ITagAliasRegistry::get()); + if (!m_data.testsOrTags.empty()) { + m_hasTestFilters = true; + for (auto const& testOrTags : m_data.testsOrTags) { + parser.parse(testOrTags); + } + } + m_testSpec = parser.testSpec(); + } + + Config::~Config() = default; + + + std::string const& Config::getFilename() const { + return m_data.outputFilename ; + } + + bool Config::listTests() const { return m_data.listTests; } + 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::string const& Config::getReporterName() const { return m_data.reporterName; } + + std::vector<std::string> const& Config::getTestsOrTags() const { return m_data.testsOrTags; } + std::vector<std::string> const& Config::getSectionsToRun() const { return m_data.sectionsToRun; } + + TestSpec const& Config::testSpec() const { return m_testSpec; } + bool Config::hasTestFilters() const { return m_hasTestFilters; } + + 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); } + bool Config::warnAboutNoTests() const { return !!(m_data.warnings & WarnAbout::NoTests); } + ShowDurations Config::showDurations() const { return m_data.showDurations; } + double Config::minDuration() const { return m_data.minDuration; } + TestRunOrder Config::runOrder() const { return m_data.runOrder; } + unsigned int Config::rngSeed() const { return m_data.rngSeed; } + UseColour 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; } + + bool Config::benchmarkNoAnalysis() const { return m_data.benchmarkNoAnalysis; } + int Config::benchmarkSamples() const { return m_data.benchmarkSamples; } + double Config::benchmarkConfidenceInterval() const { return m_data.benchmarkConfidenceInterval; } + unsigned int Config::benchmarkResamples() const { return m_data.benchmarkResamples; } + std::chrono::milliseconds Config::benchmarkWarmupTime() const { return std::chrono::milliseconds(m_data.benchmarkWarmupTime); } + + IStream const* Config::openStream() { + return Catch::makeStream(m_data.outputFilename); + } + +} // end namespace Catch + + + +#include <cassert> +#include <stack> + +namespace Catch { + + //////////////////////////////////////////////////////////////////////////// + + Catch::MessageBuilder::MessageBuilder( StringRef 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( ScopedMessage&& old ) noexcept: + m_info( std::move( old.m_info ) ) { + old.m_moved = true; + } + + ScopedMessage::~ScopedMessage() { + if ( !uncaught_exceptions() && !m_moved ){ + getResultCapture().popScopedMessage(m_info); + } + } + + + Capturer::Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names ) { + auto trimmed = [&] (size_t start, size_t end) { + while (names[start] == ',' || isspace(static_cast<unsigned char>(names[start]))) { + ++start; + } + while (names[end] == ',' || isspace(static_cast<unsigned char>(names[end]))) { + --end; + } + return names.substr(start, end - start + 1); + }; + auto skipq = [&] (size_t start, char quote) { + for (auto i = start + 1; i < names.size() ; ++i) { + if (names[i] == quote) + return i; + if (names[i] == '\\') + ++i; + } + CATCH_INTERNAL_ERROR("CAPTURE parsing encountered unmatched quote"); + }; + + size_t start = 0; + std::stack<char> openings; + for (size_t pos = 0; pos < names.size(); ++pos) { + char c = names[pos]; + switch (c) { + case '[': + case '{': + case '(': + // It is basically impossible to disambiguate between + // comparison and start of template args in this context +// case '<': + openings.push(c); + break; + case ']': + case '}': + case ')': +// case '>': + openings.pop(); + break; + case '"': + case '\'': + pos = skipq(pos, c); + break; + case ',': + if (start != pos && openings.empty()) { + m_messages.emplace_back(macroName, lineInfo, resultType); + m_messages.back().message = static_cast<std::string>(trimmed(start, pos)); + m_messages.back().message += " := "; + start = pos; + } + } + } + assert(openings.empty() && "Mismatched openings"); + m_messages.emplace_back(macroName, lineInfo, resultType); + m_messages.back().message = static_cast<std::string>(trimmed(start, names.size() - 1)); + m_messages.back().message += " := "; + } + Capturer::~Capturer() { + if ( !uncaught_exceptions() ){ + assert( m_captured == m_messages.size() ); + for( size_t i = 0; i < m_captured; ++i ) + m_resultCapture.popScopedMessage( m_messages[i] ); + } + } + + void Capturer::captureValue( size_t index, std::string const& value ) { + assert( index < m_messages.size() ); + m_messages[index].message += value; + m_resultCapture.pushScopedMessage( m_messages[index] ); + m_captured++; + } + +} // end namespace Catch + + + + +namespace Catch { + + namespace { + + class RegistryHub : public IRegistryHub, + public IMutableRegistryHub, + private Detail::NonCopyable { + + public: // IRegistryHub + RegistryHub() = default; + IReporterRegistry const& getReporterRegistry() const override { + return m_reporterRegistry; + } + ITestCaseRegistry const& getTestCaseRegistry() const override { + return m_testCaseRegistry; + } + IExceptionTranslatorRegistry const& getExceptionTranslatorRegistry() const 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 factory ) override { + m_reporterRegistry.registerReporter( name, std::move(factory) ); + } + void registerListener( IReporterFactoryPtr factory ) override { + m_reporterRegistry.registerListener( std::move(factory) ); + } + void registerTest( Detail::unique_ptr<TestCaseInfo>&& testInfo, Detail::unique_ptr<ITestInvoker>&& invoker ) override { + m_testCaseRegistry.registerTest( std::move(testInfo), std::move(invoker) ); + } + 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 { +#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + m_exceptionRegistry.add(std::current_exception()); +#else + CATCH_INTERNAL_ERROR("Attempted to register active exception under CATCH_CONFIG_DISABLE_EXCEPTIONS!"); +#endif + } + IMutableEnumValuesRegistry& getMutableEnumValuesRegistry() override { + return m_enumValuesRegistry; + } + + private: + TestRegistry m_testCaseRegistry; + ReporterRegistry m_reporterRegistry; + ExceptionTranslatorRegistry m_exceptionTranslatorRegistry; + TagAliasRegistry m_tagAliasRegistry; + StartupExceptionRegistry m_exceptionRegistry; + Detail::EnumValuesRegistry m_enumValuesRegistry; + }; + } + + using RegistryHubSingleton = Singleton<RegistryHub, IRegistryHub, IMutableRegistryHub>; + + IRegistryHub const& getRegistryHub() { + return RegistryHubSingleton::get(); + } + IMutableRegistryHub& getMutableRegistryHub() { + return RegistryHubSingleton::getMutable(); + } + void cleanUp() { + cleanupSingletons(); + cleanUpContext(); + } + std::string translateActiveException() { + return getRegistryHub().getExceptionTranslatorRegistry().translateActiveException(); + } + + +} // end namespace Catch + + + +#include <algorithm> +#include <iomanip> +#include <set> + +namespace Catch { + + namespace { + const int MaxExitCode = 255; + + IStreamingReporterPtr createReporter(std::string const& reporterName, IConfig const* config) { + auto reporter = Catch::getRegistryHub().getReporterRegistry().create(reporterName, config); + CATCH_ENFORCE(reporter, "No reporter registered with name: '" << reporterName << "'"); + + return reporter; + } + + IStreamingReporterPtr makeReporter(Config const* config) { + if (Catch::getRegistryHub().getReporterRegistry().getListeners().empty()) { + return createReporter(config->getReporterName(), config); + } + + // On older platforms, returning unique_ptr<ListeningReporter> + // when the return type is unique_ptr<IStreamingReporter> + // doesn't compile without a std::move call. However, this causes + // a warning on newer platforms. Thus, we have to work around + // it a bit and downcast the pointer manually. + auto ret = Detail::unique_ptr<IStreamingReporter>(new ListeningReporter); + auto& multi = static_cast<ListeningReporter&>(*ret); + auto const& listeners = Catch::getRegistryHub().getReporterRegistry().getListeners(); + for (auto const& listener : listeners) { + multi.addListener(listener->create(Catch::ReporterConfig(config))); + } + multi.addReporter(createReporter(config->getReporterName(), config)); + return ret; + } + + class TestGroup { + public: + explicit TestGroup(IStreamingReporterPtr&& reporter, Config const* config): + m_reporter(reporter.get()), + m_config{config}, + m_context{config, std::move(reporter)} { + + auto const& allTestCases = getAllTestCasesSorted(*m_config); + m_matches = m_config->testSpec().matchesByFilter(allTestCases, *m_config); + auto const& invalidArgs = m_config->testSpec().getInvalidArgs(); + + if (m_matches.empty() && invalidArgs.empty()) { + for (auto const& test : allTestCases) + if (!test.getTestCaseInfo().isHidden()) + m_tests.emplace(&test); + } else { + for (auto const& match : m_matches) + m_tests.insert(match.tests.begin(), match.tests.end()); + } + } + + Totals execute() { + auto const& invalidArgs = m_config->testSpec().getInvalidArgs(); + Totals totals; + m_context.testGroupStarting(m_config->name(), 1, 1); + for (auto const& testCase : m_tests) { + if (!m_context.aborting()) + totals += m_context.runTest(*testCase); + else + m_reporter->skipTest(testCase->getTestCaseInfo()); + } + + for (auto const& match : m_matches) { + if (match.tests.empty()) { + m_reporter->noMatchingTestCases(match.name); + totals.error = -1; + } + } + + if (!invalidArgs.empty()) { + for (auto const& invalidArg: invalidArgs) + m_reporter->reportInvalidArguments(invalidArg); + } + + m_context.testGroupEnded(m_config->name(), totals, 1, 1); + return totals; + } + + private: + using Tests = std::set<TestCaseHandle const*>; + + IStreamingReporter* m_reporter; + Config const* m_config; + RunContext m_context; + Tests m_tests; + TestSpec::Matches m_matches; + }; + + void applyFilenamesAsTags() { + for (auto const& testInfo : getRegistryHub().getTestCaseRegistry().getAllInfos()) { + testInfo->addFilenameTag(); + } + } + + } // anon namespace + + Session::Session() { + static bool alreadyInstantiated = false; + if( alreadyInstantiated ) { + CATCH_TRY { CATCH_INTERNAL_ERROR( "Only one instance of Catch::Session can ever be used" ); } + CATCH_CATCH_ALL { getMutableRegistryHub().registerStartupException(); } + } + + // There cannot be exceptions at startup in no-exception mode. +#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + const auto& exceptions = getRegistryHub().getStartupExceptionRegistry().getExceptions(); + if ( !exceptions.empty() ) { + config(); + getCurrentMutableContext().setConfig(m_config.get()); + + m_startupExceptions = true; + Colour colourGuard( Colour::Red ); + Catch::cerr() << "Errors occurred 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() << TextFlow::Column( ex.what() ).indent(2) << '\n'; + } + } + } +#endif + + 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 Catch2 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 const * const * argv ) { + if( m_startupExceptions ) + return 1; + + auto result = m_cli.parse( Clara::Args( argc, argv ) ); + if( !result ) { + config(); + getCurrentMutableContext().setConfig(m_config.get()); + Catch::cerr() + << Colour( Colour::Red ) + << "\nError(s) in input:\n" + << TextFlow::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; + } + +#if defined(CATCH_CONFIG_WCHAR) && defined(_WIN32) && defined(UNICODE) + int Session::applyCommandLine( int argc, wchar_t const * const * argv ) { + + char **utf8Argv = new char *[ argc ]; + + for ( int i = 0; i < argc; ++i ) { + int bufSize = WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, nullptr, 0, nullptr, nullptr ); + + utf8Argv[ i ] = new char[ bufSize ]; + + WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, utf8Argv[i], bufSize, nullptr, nullptr ); + } + + int returnCode = applyCommandLine( argc, utf8Argv ); + + for ( int i = 0; i < argc; ++i ) + delete [] utf8Argv[ i ]; + + delete [] utf8Argv; + + return returnCode; + } +#endif + + void Session::useConfigData( ConfigData const& configData ) { + m_configData = configData; + m_config.reset(); + } + + 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 = Detail::make_unique<Config>( m_configData ); + return *m_config; + } + + int Session::runInternal() { + if( m_startupExceptions ) + return 1; + + if (m_configData.showHelp || m_configData.libIdentify) { + return 0; + } + + CATCH_TRY { + config(); // Force config to be constructed + + seedRng( *m_config ); + + if (m_configData.filenamesAsTags) { + applyFilenamesAsTags(); + } + + // Set up global config instance before we start calling into other functions + getCurrentMutableContext().setConfig(m_config.get()); + + // Create reporter(s) so we can route listings through them + auto reporter = makeReporter(m_config.get()); + + // Handle list request + if (list(*reporter, *m_config)) { + return 0; + } + + TestGroup tests { std::move(reporter), m_config.get() }; + auto const totals = tests.execute(); + + if( m_config->warnAboutNoTests() && totals.error == -1 ) + return 2; + + // 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, (std::max) (totals.error, static_cast<int>(totals.assertions.failed))); + } +#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + catch( std::exception& ex ) { + Catch::cerr() << ex.what() << std::endl; + return MaxExitCode; + } +#endif + } + +} // end namespace Catch + + + +#include <cassert> +#include <cctype> +#include <algorithm> + +namespace Catch { + + namespace { + using TCP_underlying_type = uint8_t; + static_assert(sizeof(TestCaseProperties) == sizeof(TCP_underlying_type), + "The size of the TestCaseProperties is different from the assumed size"); + + TestCaseProperties operator|(TestCaseProperties lhs, TestCaseProperties rhs) { + return static_cast<TestCaseProperties>( + static_cast<TCP_underlying_type>(lhs) | static_cast<TCP_underlying_type>(rhs) + ); + } + + TestCaseProperties& operator|=(TestCaseProperties& lhs, TestCaseProperties rhs) { + lhs = static_cast<TestCaseProperties>( + static_cast<TCP_underlying_type>(lhs) | static_cast<TCP_underlying_type>(rhs) + ); + return lhs; + } + + TestCaseProperties operator&(TestCaseProperties lhs, TestCaseProperties rhs) { + return static_cast<TestCaseProperties>( + static_cast<TCP_underlying_type>(lhs) & static_cast<TCP_underlying_type>(rhs) + ); + } + + bool applies(TestCaseProperties tcp) { + static_assert(static_cast<TCP_underlying_type>(TestCaseProperties::None) == 0, + "TestCaseProperties::None must be equal to 0"); + return tcp != TestCaseProperties::None; + } + + TestCaseProperties parseSpecialTag( StringRef tag ) { + if( !tag.empty() && tag[0] == '.' ) + return TestCaseProperties::IsHidden; + else if( tag == "!throws"_sr ) + return TestCaseProperties::Throws; + else if( tag == "!shouldfail"_sr ) + return TestCaseProperties::ShouldFail; + else if( tag == "!mayfail"_sr ) + return TestCaseProperties::MayFail; + else if( tag == "!nonportable"_sr ) + return TestCaseProperties::NonPortable; + else if( tag == "!benchmark"_sr ) + return static_cast<TestCaseProperties>(TestCaseProperties::Benchmark | TestCaseProperties::IsHidden ); + else + return TestCaseProperties::None; + } + bool isReservedTag( StringRef tag ) { + return parseSpecialTag( tag ) == TestCaseProperties::None + && tag.size() > 0 + && !std::isalnum( static_cast<unsigned char>(tag[0]) ); + } + void enforceNotReservedTag( StringRef tag, SourceLineInfo const& _lineInfo ) { + CATCH_ENFORCE( !isReservedTag(tag), + "Tag name: [" << tag << "] is not allowed.\n" + << "Tag names starting with non alphanumeric characters are reserved\n" + << _lineInfo ); + } + + std::string makeDefaultName() { + static size_t counter = 0; + return "Anonymous test case " + std::to_string(++counter); + } + + StringRef extractFilenamePart(StringRef filename) { + size_t lastDot = filename.size(); + while (lastDot > 0 && filename[lastDot - 1] != '.') { + --lastDot; + } + --lastDot; + + size_t nameStart = lastDot; + while (nameStart > 0 && filename[nameStart - 1] != '/' && filename[nameStart - 1] != '\\') { + --nameStart; + } + + return filename.substr(nameStart, lastDot - nameStart); + } + + // Returns the upper bound on size of extra tags ([#file]+[.]) + size_t sizeOfExtraTags(StringRef filepath) { + // [.] is 3, [#] is another 3 + const size_t extras = 3 + 3; + return extractFilenamePart(filepath).size() + extras; + } + } + + Detail::unique_ptr<TestCaseInfo> + makeTestCaseInfo(std::string const& _className, + NameAndTags const& nameAndTags, + SourceLineInfo const& _lineInfo ) { + return Detail::unique_ptr<TestCaseInfo>(new TestCaseInfo(_className, nameAndTags, _lineInfo)); + } + + TestCaseInfo::TestCaseInfo(std::string const& _className, + NameAndTags const& _nameAndTags, + SourceLineInfo const& _lineInfo): + name( _nameAndTags.name.empty() ? makeDefaultName() : _nameAndTags.name ), + className( _className ), + lineInfo( _lineInfo ) + { + StringRef originalTags = _nameAndTags.tags; + // We need to reserve enough space to store all of the tags + // (including optional hidden tag and filename tag) + auto requiredSize = originalTags.size() + sizeOfExtraTags(_lineInfo.file); + backingTags.reserve(requiredSize); + backingLCaseTags.reserve(requiredSize); + + // We cannot copy the tags directly, as we need to normalize + // some tags, so that [.foo] is copied as [.][foo]. + size_t tagStart = 0; + size_t tagEnd = 0; + bool inTag = false; + for (size_t idx = 0; idx < originalTags.size(); ++idx) { + auto c = originalTags[idx]; + if (c == '[') { + assert(!inTag); + inTag = true; + tagStart = idx; + } + if (c == ']') { + assert(inTag); + inTag = false; + tagEnd = idx; + assert(tagStart < tagEnd); + + // We need to check the tag for special meanings, copy + // it over to backing storage and actually reference the + // backing storage in the saved tags + StringRef tagStr = originalTags.substr(tagStart+1, tagEnd - tagStart - 1); + enforceNotReservedTag(tagStr, lineInfo); + properties |= parseSpecialTag(tagStr); + // When copying a tag to the backing storage, we need to + // check if it is a merged hide tag, such as [.foo], and + // if it is, we need to handle it as if it was [foo]. + if (tagStr.size() > 1 && tagStr[0] == '.') { + tagStr = tagStr.substr(1, tagStr.size() - 1); + } + // We skip over dealing with the [.] tag, as we will add + // it later unconditionally and then sort and unique all + // the tags. + internalAppendTag(tagStr); + } + (void)inTag; // Silence "set-but-unused" warning in release mode. + } + // Add [.] if relevant + if (isHidden()) { + internalAppendTag("."_sr); + } + + // Sort and prepare tags + toLowerInPlace(backingLCaseTags); + std::sort(begin(tags), end(tags), [](Tag lhs, Tag rhs) { return lhs.lowerCased < rhs.lowerCased; }); + tags.erase(std::unique(begin(tags), end(tags), [](Tag lhs, Tag rhs) {return lhs.lowerCased == rhs.lowerCased; }), + end(tags)); + } + + bool TestCaseInfo::isHidden() const { + return applies( properties & TestCaseProperties::IsHidden ); + } + bool TestCaseInfo::throws() const { + return applies( properties & TestCaseProperties::Throws ); + } + bool TestCaseInfo::okToFail() const { + return applies( properties & (TestCaseProperties::ShouldFail | TestCaseProperties::MayFail ) ); + } + bool TestCaseInfo::expectedToFail() const { + return applies( properties & (TestCaseProperties::ShouldFail) ); + } + + void TestCaseInfo::addFilenameTag() { + std::string combined("#"); + combined += extractFilenamePart(lineInfo.file); + internalAppendTag(combined); + } + + 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.original.size(); + } + ret.reserve(full_size); + for (const auto& tag : tags) { + ret.push_back('['); + ret += tag.original; + ret.push_back(']'); + } + + return ret; + } + + void TestCaseInfo::internalAppendTag(StringRef tagStr) { + backingTags += '['; + const auto backingStart = backingTags.size(); + backingTags += tagStr; + const auto backingEnd = backingTags.size(); + backingTags += ']'; + backingLCaseTags += '['; + // We append the tag to the lower-case backing storage as-is, + // because we will perform the lower casing later, in bulk + backingLCaseTags += tagStr; + backingLCaseTags += ']'; + tags.emplace_back(StringRef(backingTags.c_str() + backingStart, backingEnd - backingStart), + StringRef(backingLCaseTags.c_str() + backingStart, backingEnd - backingStart)); + } + + + bool TestCaseHandle::operator == ( TestCaseHandle const& rhs ) const { + return m_invoker == rhs.m_invoker + && m_info->name == rhs.m_info->name + && m_info->className == rhs.m_info->className; + } + + bool TestCaseHandle::operator < ( TestCaseHandle const& rhs ) const { + return m_info->name < rhs.m_info->name; + } + + TestCaseInfo const& TestCaseHandle::getTestCaseInfo() const { + return *m_info; + } + +} // end namespace Catch + + + +#include <algorithm> +#include <string> +#include <vector> + +namespace Catch { + + TestSpec::Pattern::Pattern( std::string const& name ) + : m_name( name ) + {} + + TestSpec::Pattern::~Pattern() = default; + + std::string const& TestSpec::Pattern::name() const { + return m_name; + } + + + TestSpec::NamePattern::NamePattern( std::string const& name, std::string const& filterString ) + : Pattern( filterString ) + , m_wildcardPattern( toLower( name ), CaseSensitive::No ) + {} + + bool TestSpec::NamePattern::matches( TestCaseInfo const& testCase ) const { + return m_wildcardPattern.matches( testCase.name ); + } + + + TestSpec::TagPattern::TagPattern( std::string const& tag, std::string const& filterString ) + : Pattern( filterString ) + , m_tag( toLower( tag ) ) + {} + + bool TestSpec::TagPattern::matches( TestCaseInfo const& testCase ) const { + return std::find_if(begin(testCase.tags), + end(testCase.tags), + [&](Tag const& tag) { + return tag.lowerCased == m_tag; + }) != end(testCase.tags); + } + + bool TestSpec::Filter::matches( TestCaseInfo const& testCase ) const { + bool should_use = !testCase.isHidden(); + for (auto const& pattern : m_required) { + should_use = true; + if (!pattern->matches(testCase)) { + return false; + } + } + for (auto const& pattern : m_forbidden) { + if (pattern->matches(testCase)) { + return false; + } + } + return should_use; + } + + std::string TestSpec::Filter::name() const { + std::string name; + for (auto const& p : m_required) { + name += p->name(); + } + for (auto const& p : m_forbidden) { + name += p->name(); + } + return name; + } + + + bool TestSpec::hasFilters() const { + return !m_filters.empty(); + } + + bool TestSpec::matches( TestCaseInfo const& testCase ) const { + return std::any_of( m_filters.begin(), m_filters.end(), [&]( Filter const& f ){ return f.matches( testCase ); } ); + } + + TestSpec::Matches TestSpec::matchesByFilter( std::vector<TestCaseHandle> const& testCases, IConfig const& config ) const + { + Matches matches( m_filters.size() ); + std::transform( m_filters.begin(), m_filters.end(), matches.begin(), [&]( Filter const& filter ){ + std::vector<TestCaseHandle const*> currentMatches; + for( auto const& test : testCases ) + if( isThrowSafe( test, config ) && filter.matches( test.getTestCaseInfo() ) ) + currentMatches.emplace_back( &test ); + return FilterMatch{ filter.name(), currentMatches }; + } ); + return matches; + } + + const TestSpec::vectorStrings& TestSpec::getInvalidArgs() const{ + return (m_invalidArgs); + } + +} + + + +#include <chrono> + +static const uint64_t nanosecondsInSecond = 1000000000; + +namespace Catch { + + auto getCurrentNanosecondsSinceEpoch() -> uint64_t { + return std::chrono::duration_cast<std::chrono::nanoseconds>( std::chrono::high_resolution_clock::now().time_since_epoch() ).count(); + } + + namespace { + auto estimateClockResolution() -> uint64_t { + uint64_t sum = 0; + static const uint64_t iterations = 1000000; + + auto startTime = getCurrentNanosecondsSinceEpoch(); + + 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; + + // If we have been calibrating for over 3 seconds -- the clock + // is terrible and we should move on. + // TBD: How to signal that the measured resolution is probably wrong? + if (ticks > startTime + 3 * nanosecondsInSecond) { + return sum / ( i + 1u ); + } + } + + // 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 + + +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wexit-time-destructors" +# pragma clang diagnostic ignored "-Wglobal-constructors" +#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() { + int one = 1; + // If the lowest byte we read is non-zero, we can assume + // that little endian format is used. + auto value = *reinterpret_cast<char*>(&one); + return value ? Little : Big; + } + }; + + template<typename T> + std::string fpToString(T value, int precision) { + if (Catch::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; + } + } // end unnamed namespace + + 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(); + } +} // end Detail namespace + + + +//// ======================================================= //// +// +// 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; +} + +#ifdef CATCH_CONFIG_CPP17_STRING_VIEW +std::string StringMaker<std::string_view>::convert(std::string_view str) { + return ::Catch::Detail::stringify(std::string{ str }); +} +#endif + +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}" }; + } +} + +#ifdef CATCH_CONFIG_WCHAR +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); +} + +# ifdef CATCH_CONFIG_CPP17_STRING_VIEW +std::string StringMaker<std::wstring_view>::convert(std::wstring_view str) { + return StringMaker<std::wstring>::convert(std::wstring(str)); +} +# endif + +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}" }; + } +} +#endif + +#if defined(CATCH_CONFIG_CPP17_BYTE) +#include <cstddef> +std::string StringMaker<std::byte>::convert(std::byte value) { + return ::Catch::Detail::stringify(std::to_integer<unsigned long long>(value)); +} +#endif // defined(CATCH_CONFIG_CPP17_BYTE) + +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<signed char>::convert(signed 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<char>::convert(char c) { + return ::Catch::Detail::stringify(static_cast<signed char>(c)); +} +std::string StringMaker<unsigned char>::convert(unsigned char c) { + return ::Catch::Detail::stringify(static_cast<char>(c)); +} + +int StringMaker<float>::precision = 5; + +std::string StringMaker<float>::convert(float value) { + return Detail::fpToString(value, precision) + 'f'; +} + +int StringMaker<double>::precision = 10; + +std::string StringMaker<double>::convert(double value) { + return Detail::fpToString(value, precision); +} + +} // end namespace Catch + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif + + + + +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; + } + +} + + +#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( 3, 0, 0, "preview", 3 ); + return version; + } + +} + + +/** \file + * This is a special TU that combines what would otherwise be a very + * small generator-related TUs into one bigger TU. + * + * The reason for this is compilation performance improvements by + * avoiding reparsing headers for many small TUs, instead having this + * one TU include bit more, but having it all parsed only once. + * + * To avoid heavy-tail problem with compilation times, each "subpart" + * of Catch2 has its own combined TU like this. + */ + +//////////////////////////////////////////////////// +// vvv formerly catch_generator_exception.cpp vvv // +//////////////////////////////////////////////////// + + +namespace Catch { + + const char* GeneratorException::what() const noexcept { + return m_msg; + } + +} // end namespace Catch + + +/////////////////////////////////////////// +// vvv formerly catch_generators.cpp vvv // +/////////////////////////////////////////// + + +namespace Catch { + + IGeneratorTracker::~IGeneratorTracker() = default; + +namespace Generators { + +namespace Detail { + + [[noreturn]] + void throw_generator_exception(char const* msg) { + Catch::throw_exception(GeneratorException{ msg }); + } +} // end namespace Detail + + GeneratorUntypedBase::~GeneratorUntypedBase() = default; + + auto acquireGeneratorTracker(StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& { + return getResultCapture().acquireGeneratorTracker( generatorName, lineInfo ); + } + +} // namespace Generators +} // namespace Catch + + +/** \file + * This is a special TU that combines what would otherwise be a very + * small interfaces-related TUs into one bigger TU. + * + * The reason for this is compilation performance improvements by + * avoiding reparsing headers for many small TUs, instead having this + * one TU include bit more, but having it all parsed only once. + * + * To avoid heavy-tail problem with compilation times, each "subpart" + * of Catch2 has its own combined TU like this. + */ + +/////////////////////////////////////////////////// +// vvv formerly catch_interfaces_capture.cpp vvv // +/////////////////////////////////////////////////// + + +namespace Catch { + IResultCapture::~IResultCapture() = default; +} + + +////////////////////////////////////////////////// +// vvv formerly catch_interfaces_config.cpp vvv // +////////////////////////////////////////////////// + + +namespace Catch { + IConfig::~IConfig() = default; +} + + +///////////////////////////////////////////////////// +// vvv formerly catch_interfaces_exception.cpp vvv // +///////////////////////////////////////////////////// + + +namespace Catch { + IExceptionTranslator::~IExceptionTranslator() = default; + IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() = default; +} + + +//////////////////////////////////////////////////////// +// vvv formerly catch_interfaces_registry_hub.cpp vvv // +//////////////////////////////////////////////////////// + + +namespace Catch { + IRegistryHub::~IRegistryHub() = default; + IMutableRegistryHub::~IMutableRegistryHub() = default; +} + + +////////////////////////////////////////////////// +// vvv formerly catch_interfaces_runner.cpp vvv // +////////////////////////////////////////////////// + + +namespace Catch { + IRunner::~IRunner() = default; +} + + +//////////////////////////////////////////////////// +// vvv formerly catch_interfaces_testcase.cpp vvv // +//////////////////////////////////////////////////// + + +namespace Catch { + ITestInvoker::~ITestInvoker() = default; + ITestCaseRegistry::~ITestCaseRegistry() = default; +} + + +namespace Catch { + IReporterRegistry::~IReporterRegistry() = default; +} + + + +namespace Catch { + IReporterFactory::~IReporterFactory() = default; +} + + + +#include <algorithm> +#include <iomanip> + +namespace Catch { + + ReporterConfig::ReporterConfig( IConfig const* _fullConfig ) + : m_stream( &_fullConfig->stream() ), m_fullConfig( _fullConfig ) {} + + ReporterConfig::ReporterConfig( IConfig const* _fullConfig, std::ostream& _stream ) + : m_stream( &_stream ), m_fullConfig( _fullConfig ) {} + + std::ostream& ReporterConfig::stream() const { return *m_stream; } + IConfig const * 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 ); + } + } + + SectionStats::SectionStats( SectionInfo const& _sectionInfo, + Counts const& _assertions, + double _durationInSeconds, + bool _missingAssertions ) + : sectionInfo( _sectionInfo ), + assertions( _assertions ), + durationInSeconds( _durationInSeconds ), + missingAssertions( _missingAssertions ) + {} + + + 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 ) + {} + + + 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 ) + {} + + + TestRunStats::TestRunStats( TestRunInfo const& _runInfo, + Totals const& _totals, + bool _aborting ) + : runInfo( _runInfo ), + totals( _totals ), + aborting( _aborting ) + {} + + void IStreamingReporter::fatalErrorEncountered( StringRef ) {} + + void IStreamingReporter::listReporters(std::vector<ReporterDescription> const& descriptions, IConfig const& config) { + Catch::cout() << "Available reporters:\n"; + const auto maxNameLen = std::max_element(descriptions.begin(), descriptions.end(), + [](ReporterDescription const& lhs, ReporterDescription const& rhs) { return lhs.name.size() < rhs.name.size(); }) + ->name.size(); + + for (auto const& desc : descriptions) { + if (config.verbosity() == Verbosity::Quiet) { + Catch::cout() + << TextFlow::Column(desc.name) + .indent(2) + .width(5 + maxNameLen) << '\n'; + } else { + Catch::cout() + << TextFlow::Column(desc.name + ":") + .indent(2) + .width(5 + maxNameLen) + + TextFlow::Column(desc.description) + .initialIndent(0) + .indent(2) + .width(CATCH_CONFIG_CONSOLE_WIDTH - maxNameLen - 8) + << '\n'; + } + } + Catch::cout() << std::endl; + } + + void IStreamingReporter::listTests(std::vector<TestCaseHandle> const& tests, IConfig const& config) { + if (config.hasTestFilters()) { + Catch::cout() << "Matching test cases:\n"; + } else { + Catch::cout() << "All available test cases:\n"; + } + + for (auto const& test : tests) { + auto const& testCaseInfo = test.getTestCaseInfo(); + Colour::Code colour = testCaseInfo.isHidden() + ? Colour::SecondaryText + : Colour::None; + Colour colourGuard(colour); + + Catch::cout() << TextFlow::Column(testCaseInfo.name).initialIndent(2).indent(4) << '\n'; + if (config.verbosity() >= Verbosity::High) { + Catch::cout() << TextFlow::Column(Catch::Detail::stringify(testCaseInfo.lineInfo)).indent(4) << std::endl; + } + if (!testCaseInfo.tags.empty() && config.verbosity() > Verbosity::Quiet) { + Catch::cout() << TextFlow::Column(testCaseInfo.tagsAsString()).indent(6) << '\n'; + } + } + + if (!config.hasTestFilters()) { + Catch::cout() << pluralise(tests.size(), "test case") << '\n' << std::endl; + } else { + Catch::cout() << pluralise(tests.size(), "matching test case") << '\n' << std::endl; + } + } + + void IStreamingReporter::listTags(std::vector<TagInfo> const& tags, IConfig const& config) { + if (config.hasTestFilters()) { + Catch::cout() << "Tags for matching test cases:\n"; + } else { + Catch::cout() << "All available tags:\n"; + } + + for (auto const& tagCount : tags) { + ReusableStringStream rss; + rss << " " << std::setw(2) << tagCount.count << " "; + auto str = rss.str(); + auto wrapper = TextFlow::Column(tagCount.all()) + .initialIndent(0) + .indent(str.size()) + .width(CATCH_CONFIG_CONSOLE_WIDTH - 10); + Catch::cout() << str << wrapper << '\n'; + } + Catch::cout() << pluralise(tags.size(), "tag") << '\n' << std::endl; + } + +} // end namespace Catch + + + +namespace Catch { + + AssertionHandler::AssertionHandler + ( StringRef const& 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) { +#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + throw Catch::TestFailureException(); +#else + CATCH_ERROR( "Test failure requires aborting test!" ); +#endif + } + } + 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 const& matcherString ) { + handleExceptionMatchExpr( handler, Matchers::Equals( str ), matcherString ); + } + +} // namespace Catch + + +#include <algorithm> + +namespace { + bool isOptPrefix( char c ) { + return c == '-' +#ifdef CATCH_PLATFORM_WINDOWS + || c == '/' +#endif + ; + } + + std::string normaliseOpt( std::string const& optName ) { +#ifdef CATCH_PLATFORM_WINDOWS + if ( optName[0] == '/' ) + return "-" + optName.substr( 1 ); + else +#endif + return optName; + } + +} // namespace + +namespace Catch { + namespace Clara { + namespace Detail { + + void TokenStream::loadBuffer() { + m_tokenBuffer.clear(); + + // 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 } ); + } + } + } + + TokenStream::TokenStream( Args const& args ): + TokenStream( args.m_args.begin(), args.m_args.end() ) {} + + TokenStream::TokenStream( Iterator it_, Iterator itEnd_ ): + it( it_ ), itEnd( itEnd_ ) { + loadBuffer(); + } + + TokenStream& TokenStream::operator++() { + if ( m_tokenBuffer.size() >= 2 ) { + m_tokenBuffer.erase( m_tokenBuffer.begin() ); + } else { + if ( it != itEnd ) + ++it; + loadBuffer(); + } + return *this; + } + + ParserResult convertInto( std::string const& source, + std::string& target ) { + target = source; + return ParserResult::ok( ParseResultType::Matched ); + } + + ParserResult convertInto( std::string const& source, + bool& target ) { + std::string srcLC = toLower( source ); + + 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 ); + } + + size_t ParserBase::cardinality() const { return 1; } + + InternalParseResult ParserBase::parse( Args const& args ) const { + return parse( args.exeName(), TokenStream( args ) ); + } + + ParseState::ParseState( ParseResultType type, + TokenStream const& remainingTokens ): + m_type( type ), m_remainingTokens( remainingTokens ) {} + + ParserResult BoundFlagRef::setFlag( bool flag ) { + m_ref = flag; + return ParserResult::ok( ParseResultType::Matched ); + } + + ResultBase::~ResultBase() = default; + + bool BoundRef::isContainer() const { return false; } + + bool BoundRef::isFlag() const { return false; } + + bool BoundFlagRefBase::isFlag() const { return true; } + +} // namespace Detail + + Detail::InternalParseResult Arg::parse(std::string const&, + Detail::TokenStream const& tokens) const { + auto validationResult = validate(); + if (!validationResult) + return Detail::InternalParseResult(validationResult); + + auto remainingTokens = tokens; + auto const& token = *remainingTokens; + if (token.type != Detail::TokenType::Argument) + return Detail::InternalParseResult::ok(Detail::ParseState( + ParseResultType::NoMatch, remainingTokens)); + + assert(!m_ref->isFlag()); + auto valueRef = + static_cast<Detail::BoundValueRefBase*>(m_ref.get()); + + auto result = valueRef->setValue(remainingTokens->token); + if (!result) + return Detail::InternalParseResult(result); + else + return Detail::InternalParseResult::ok(Detail::ParseState( + ParseResultType::Matched, ++remainingTokens)); + } + + Opt::Opt(bool& ref) : + ParserRefImpl(std::make_shared<Detail::BoundFlagRef>(ref)) {} + + std::vector<Detail::HelpColumns> Opt::getHelpColumns() const { + 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 } }; + } + + bool Opt::isMatch(std::string const& optToken) const { + auto normalisedToken = normaliseOpt(optToken); + for (auto const& name : m_optNames) { + if (normaliseOpt(name) == normalisedToken) + return true; + } + return false; + } + + Detail::InternalParseResult Opt::parse(std::string const&, + Detail::TokenStream const& tokens) const { + auto validationResult = validate(); + if (!validationResult) + return Detail::InternalParseResult(validationResult); + + auto remainingTokens = tokens; + if (remainingTokens && + remainingTokens->type == Detail::TokenType::Option) { + auto const& token = *remainingTokens; + if (isMatch(token.token)) { + if (m_ref->isFlag()) { + auto flagRef = + static_cast<Detail::BoundFlagRefBase*>( + m_ref.get()); + auto result = flagRef->setFlag(true); + if (!result) + return Detail::InternalParseResult(result); + if (result.value() == + ParseResultType::ShortCircuitAll) + return Detail::InternalParseResult::ok(Detail::ParseState( + result.value(), remainingTokens)); + } else { + auto valueRef = + static_cast<Detail::BoundValueRefBase*>( + m_ref.get()); + ++remainingTokens; + if (!remainingTokens) + return Detail::InternalParseResult::runtimeError( + "Expected argument following " + + token.token); + auto const& argToken = *remainingTokens; + if (argToken.type != Detail::TokenType::Argument) + return Detail::InternalParseResult::runtimeError( + "Expected argument following " + + token.token); + auto result = valueRef->setValue(argToken.token); + if (!result) + return Detail::InternalParseResult(result); + if (result.value() == + ParseResultType::ShortCircuitAll) + return Detail::InternalParseResult::ok(Detail::ParseState( + result.value(), remainingTokens)); + } + return Detail::InternalParseResult::ok(Detail::ParseState( + ParseResultType::Matched, ++remainingTokens)); + } + } + return Detail::InternalParseResult::ok( + Detail::ParseState(ParseResultType::NoMatch, remainingTokens)); + } + + Detail::Result Opt::validate() const { + if (m_optNames.empty()) + return Detail::Result::logicError("No options supplied to Opt"); + for (auto const& name : m_optNames) { + if (name.empty()) + return Detail::Result::logicError( + "Option name cannot be empty"); +#ifdef CATCH_PLATFORM_WINDOWS + if (name[0] != '-' && name[0] != '/') + return Detail::Result::logicError( + "Option name must begin with '-' or '/'"); +#else + if (name[0] != '-') + return Detail::Result::logicError( + "Option name must begin with '-'"); +#endif + } + return ParserRefImpl::validate(); + } + + ExeName::ExeName() : + m_name(std::make_shared<std::string>("<executable>")) {} + + ExeName::ExeName(std::string& ref) : ExeName() { + m_ref = std::make_shared<Detail::BoundValueRef<std::string>>(ref); + } + + Detail::InternalParseResult + ExeName::parse(std::string const&, + Detail::TokenStream const& tokens) const { + return Detail::InternalParseResult::ok( + Detail::ParseState(ParseResultType::NoMatch, tokens)); + } + + ParserResult ExeName::set(std::string const& newName) { + 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); + } + + + + + Parser& Parser::operator|=( Parser const& other ) { + 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; + } + + std::vector<Detail::HelpColumns> Parser::getHelpColumns() const { + std::vector<Detail::HelpColumns> cols; + for ( auto const& o : m_options ) { + auto childCols = o.getHelpColumns(); + cols.insert( cols.end(), childCols.begin(), childCols.end() ); + } + return cols; + } + + void Parser::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:\n"; + } + + auto rows = getHelpColumns(); + size_t consoleWidth = CATCH_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 << '\n'; + } + } + + Detail::Result Parser::validate() const { + 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 Detail::Result::ok(); + } + + Detail::InternalParseResult + Parser::parse( std::string const& exeName, + Detail::TokenStream const& tokens ) const { + + struct ParserInfo { + ParserBase const* parser = nullptr; + size_t count = 0; + }; + std::vector<ParserInfo> parseInfos; + parseInfos.reserve( m_options.size() + m_args.size() ); + for ( auto const& opt : m_options ) { + parseInfos.push_back( { &opt, 0 } ); + } + for ( auto const& arg : m_args ) { + parseInfos.push_back( { &arg, 0 } ); + } + + m_exeName.set( exeName ); + + auto result = Detail::InternalParseResult::ok( + Detail::ParseState( ParseResultType::NoMatch, tokens ) ); + while ( result.value().remainingTokens() ) { + bool tokenParsed = false; + + for ( auto& parseInfo : parseInfos ) { + 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 Detail::InternalParseResult::runtimeError( + "Unrecognised token: " + + result.value().remainingTokens()->token ); + } + // !TBD Check missing required options + return result; + } + + Args::Args(int argc, char const* const* argv) : + m_exeName(argv[0]), m_args(argv + 1, argv + argc) {} + + Args::Args(std::initializer_list<std::string> args) : + m_exeName(*args.begin()), + m_args(args.begin() + 1, args.end()) {} + + + Help::Help( bool& showHelpFlag ): + Opt( [&]( bool flag ) { + showHelpFlag = flag; + return ParserResult::ok( ParseResultType::ShortCircuitAll ); + } ) { + static_cast<Opt&> ( *this )( + "display usage information" )["-?"]["-h"]["--help"] + .optional(); + } + + } // namespace Clara +} // namespace Catch + + +/** \file + * This is a special TU that combines what would otherwise be a very + * small top-level TUs into one bigger TU. + * + * The reason for this is compilation performance improvements by + * avoiding reparsing headers for many small TUs, instead having this + * one TU include bit more, but having it all parsed only once. + * + * To avoid heavy-tail problem with compilation times, each "subpart" + * of Catch2 has its own combined TU like this. + */ + + +//////////////////////////////////////////////////////// +// vvv formerly catch_tag_alias_autoregistrar.cpp vvv // +//////////////////////////////////////////////////////// + + +namespace Catch { + + RegistrarForTagAliases::RegistrarForTagAliases(char const* alias, char const* tag, SourceLineInfo const& lineInfo) { + CATCH_TRY { + getMutableRegistryHub().registerTagAlias(alias, tag, lineInfo); + } CATCH_CATCH_ALL { + // Do not throw when constructing global objects, instead register the exception to be processed later + getMutableRegistryHub().registerStartupException(); + } + } + +} + + +////////////////////////////////////////// +// vvv formerly catch_polyfills.cpp vvv // +////////////////////////////////////////// + +#include <cmath> + +namespace Catch { + +#if !defined(CATCH_CONFIG_POLYFILL_ISNAN) + bool isnan(float f) { + return std::isnan(f); + } + bool isnan(double d) { + return std::isnan(d); + } +#else + // For now we only use this for embarcadero + bool isnan(float f) { + return std::_isnan(f); + } + bool isnan(double d) { + return std::_isnan(d); + } +#endif + +} // end namespace Catch + + +//////////////////////////////////////////////////// +// vvv formerly catch_uncaught_exceptions.cpp vvv // +//////////////////////////////////////////////////// + + +#include <exception> + +namespace Catch { + bool uncaught_exceptions() { +#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + return false; +#elif defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) + return std::uncaught_exceptions() > 0; +#else + return std::uncaught_exception(); +#endif + } +} // end namespace Catch + + +//////////////////////////////////////////// +// vvv formerly catch_errno_guard.cpp vvv // +//////////////////////////////////////////// + +#include <cerrno> + +namespace Catch { + ErrnoGuard::ErrnoGuard():m_oldErrno(errno){} + ErrnoGuard::~ErrnoGuard() { errno = m_oldErrno; } +} + + +/////////////////////////////////////////// +// vvv formerly catch_decomposer.cpp vvv // +/////////////////////////////////////////// + +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; + } +} + + +/////////////////////////////////////////////////////////// +// vvv formerly catch_startup_exception_registry.cpp vvv // +/////////////////////////////////////////////////////////// + +namespace Catch { +#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + void StartupExceptionRegistry::add( std::exception_ptr const& exception ) noexcept { + CATCH_TRY { + m_exceptions.push_back(exception); + } CATCH_CATCH_ALL { + // 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; + } +#endif + +} // end namespace Catch + + +////////////////////////////////////////////// +// vvv formerly catch_leak_detector.cpp vvv // +////////////////////////////////////////////// + + +#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 // ^^ Windows crt debug heap enabled // Windows crt debug heap disabled vv + + Catch::LeakDetector::LeakDetector() {} + +#endif // CATCH_CONFIG_WINDOWS_CRTDBG + +Catch::LeakDetector::~LeakDetector() { + Catch::cleanUp(); +} + + +///////////////////////////////////////////// +// vvv formerly catch_message_info.cpp vvv // +///////////////////////////////////////////// + + +namespace Catch { + + MessageInfo::MessageInfo( StringRef const& _macroName, + SourceLineInfo const& _lineInfo, + ResultWas::OfType _type ) + : macroName( _macroName ), + lineInfo( _lineInfo ), + type( _type ), + sequence( ++globalCount ) + {} + + // This may need protecting if threading support is added + unsigned int MessageInfo::globalCount = 0; + +} // end namespace Catch + + + + +////////////////////////////////////////// +// vvv formerly catch_lazy_expr.cpp vvv // +////////////////////////////////////////// + +namespace Catch { + + 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; + } + +} // namespace Catch + + + + +#include <fstream> +#include <ctime> + +namespace Catch { + + Clara::Parser makeCommandLineParser( ConfigData& config ) { + + using namespace Clara; + + auto const setWarning = [&]( std::string const& warning ) { + auto warningSet = [&]() { + if( warning == "NoAssertions" ) + return WarnAbout::NoAssertions; + + if ( warning == "NoTests" ) + return WarnAbout::NoTests; + + return WarnAbout::Nothing; + }(); + + if (warningSet == WarnAbout::Nothing) + return ParserResult::runtimeError( "Unrecognised warning: '" + warning + "'" ); + config.warnings = static_cast<WarnAbout::What>( config.warnings | warningSet ); + 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 ); + config.testsOrTags.emplace_back( "," ); + } + } + //Remove comma in the end + if(!config.testsOrTags.empty()) + config.testsOrTags.erase( config.testsOrTags.end()-1 ); + + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const setTestOrder = [&]( std::string const& order ) { + if( startsWith( "declared", order ) ) + config.runOrder = TestRunOrder::Declared; + else if( startsWith( "lexical", order ) ) + config.runOrder = TestRunOrder::LexicographicallySorted; + else if( startsWith( "random", order ) ) + config.runOrder = TestRunOrder::Randomized; + else + return 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 == "never") + config.waitForKeypress = WaitForKeypress::Never; + else 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: never, 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 const setReporter = [&]( std::string const& reporter ) { + IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories(); + + auto lcReporter = toLower( reporter ); + auto result = factories.find( lcReporter ); + + if( factories.end() != result ) + config.reporterName = lcReporter; + else + return ParserResult::runtimeError( "Unrecognized reporter, '" + reporter + "'. Check available with --list-reporters" ); + 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( setReporter, "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( config.minDuration, "seconds" ) + ["-D"]["--min-duration"] + ( "show test durations for tests taking at least the given number of seconds" ) + | Opt( loadTestNamesFromFile, "filename" ) + ["-f"]["--input-file"] + ( "load test names to run from a file" ) + | 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.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, "never|start|exit|both" ) + ["--wait-for-keypress"] + ( "waits for a keypress before exiting" ) + | Opt( config.benchmarkSamples, "samples" ) + ["--benchmark-samples"] + ( "number of samples to collect (default: 100)" ) + | Opt( config.benchmarkResamples, "resamples" ) + ["--benchmark-resamples"] + ( "number of resamples for the bootstrap (default: 100000)" ) + | Opt( config.benchmarkConfidenceInterval, "confidence interval" ) + ["--benchmark-confidence-interval"] + ( "confidence interval for the bootstrap (between 0 and 1, default: 0.95)" ) + | Opt( config.benchmarkNoAnalysis ) + ["--benchmark-no-analysis"] + ( "perform only measurements; do not perform any analysis" ) + | Opt( config.benchmarkWarmupTime, "benchmarkWarmupTime" ) + ["--benchmark-warmup-time"] + ( "amount of time in milliseconds spent on warming up each test (default: 100)" ) + | Arg( config.testsOrTags, "test name|pattern|tags" ) + ( "which test or tests to use" ); + + return cli; + } + +} // end namespace Catch + + + +#include <cstring> +#include <ostream> + +namespace Catch { + + 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 { + // We can assume that the same file will usually have the same pointer. + // Thus, if the pointers are the same, there is no point in calling the strcmp + return line < other.line || ( line == other.line && file != other.file && (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; + } + +} // end namespace Catch + + +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wexit-time-destructors" +#endif + + + +#include <ostream> + +namespace Catch { + namespace { + + struct IColourImpl { + virtual ~IColourImpl() = default; + virtual void use( Colour::Code _colourCode ) = 0; + }; + + struct NoColourImpl : IColourImpl { + void use( Colour::Code ) override {} + + 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 ); + } + + 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; + + auto const* config = getCurrentContext().getConfig(); + UseColour 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: + 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 ) { + // The escape sequence must be flushed to console, otherwise if + // stdin and stderr are intermixed, we'd get accidentally coloured output. + getCurrentContext().getConfig()->stream() + << '\033' << _escapeCode << std::flush; + } + }; + + bool useColourOnPlatform() { + return +#if defined(CATCH_PLATFORM_MAC) || defined(CATCH_PLATFORM_IPHONE) + !isDebuggerActive() && +#endif +#if !(defined(__DJGPP__) && defined(__STRICT_ANSI__)) + isatty(STDOUT_FILENO) +#else + false +#endif + ; + } + IColourImpl* platformColourInstance() { + ErrnoGuard guard; + auto const* config = getCurrentContext().getConfig(); + UseColour 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&& other ) noexcept { + m_moved = other.m_moved; + other.m_moved = true; + } + Colour& Colour::operator=( Colour&& other ) noexcept { + m_moved = other.m_moved; + other.m_moved = true; + return *this; + } + + Colour::~Colour(){ if( !m_moved ) use( None ); } + + void Colour::use( Code _colourCode ) { + static IColourImpl* impl = platformColourInstance(); + // Strictly speaking, this cannot possibly happen. + // However, under some conditions it does happen (see #1626), + // and this change is small enough that we can let practicality + // triumph over purity in this case. + if (impl != nullptr) { + impl->use( _colourCode ); + } + } + + std::ostream& operator << ( std::ostream& os, Colour const& ) { + return os; + } + +} // end namespace Catch + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif + + + + +namespace Catch { + + class Context : public IMutableContext, private Detail::NonCopyable { + + public: // IContext + IResultCapture* getResultCapture() override { + return m_resultCapture; + } + IRunner* getRunner() override { + return m_runner; + } + + IConfig const* getConfig() const override { + return m_config; + } + + ~Context() override; + + public: // IMutableContext + void setResultCapture( IResultCapture* resultCapture ) override { + m_resultCapture = resultCapture; + } + void setRunner( IRunner* runner ) override { + m_runner = runner; + } + void setConfig( IConfig const* config ) override { + m_config = config; + } + + friend IMutableContext& getCurrentMutableContext(); + + private: + IConfig const* m_config = nullptr; + 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; + + + SimplePcg32& rng() { + static SimplePcg32 s_rng; + return s_rng; + } + +} + + + +#if defined(CATCH_CONFIG_ANDROID_LOGWRITE) +#include <android/log.h> + + namespace Catch { + void writeToDebugConsole( std::string const& text ) { + __android_log_write( ANDROID_LOG_DEBUG, "Catch", text.c_str() ); + } + } + +#elif defined(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 + + + +#if defined(CATCH_PLATFORM_MAC) || defined(CATCH_PLATFORM_IPHONE) + +# include <cassert> +# include <sys/types.h> +# include <unistd.h> +# include <cstddef> +# include <ostream> + +#ifdef __apple_build_version__ + // These headers will only compile with AppleClang (XCode) + // For other compilers (Clang, GCC, ... ) we need to exclude them +# include <sys/sysctl.h> +#endif + + namespace Catch { + #ifdef __apple_build_version__ + // The following function is taken directly from the following technical note: + // https://developer.apple.com/library/archive/qa/qa1361/_index.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 ); + } + #else + bool isDebuggerActive() { + // We need to find another way to determine this for non-appleclang compilers on macOS + return false; + } + #endif + } // 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 + + + +#include <stdexcept> + + +namespace Catch { +#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER) + [[noreturn]] + void throw_exception(std::exception const& e) { + Catch::cerr() << "Catch will terminate because it needed to throw an exception.\n" + << "The message was: " << e.what() << '\n'; + std::terminate(); + } +#endif + + [[noreturn]] + void throw_logic_error(std::string const& msg) { + throw_exception(std::logic_error(msg)); + } + + [[noreturn]] + void throw_domain_error(std::string const& msg) { + throw_exception(std::domain_error(msg)); + } + + [[noreturn]] + void throw_runtime_error(std::string const& msg) { + throw_exception(std::runtime_error(msg)); + } + + + +} // namespace Catch; + + + +#include <cassert> + +namespace Catch { + + IMutableEnumValuesRegistry::~IMutableEnumValuesRegistry() {} + + namespace Detail { + + namespace { + // Extracts the actual name part of an enum instance + // In other words, it returns the Blue part of Bikeshed::Colour::Blue + StringRef extractInstanceName(StringRef enumInstance) { + // Find last occurence of ":" + size_t name_start = enumInstance.size(); + while (name_start > 0 && enumInstance[name_start - 1] != ':') { + --name_start; + } + return enumInstance.substr(name_start, enumInstance.size() - name_start); + } + } + + std::vector<StringRef> parseEnums( StringRef enums ) { + auto enumValues = splitStringRef( enums, ',' ); + std::vector<StringRef> parsed; + parsed.reserve( enumValues.size() ); + for( auto const& enumValue : enumValues ) { + parsed.push_back(trim(extractInstanceName(enumValue))); + } + return parsed; + } + + EnumInfo::~EnumInfo() {} + + StringRef EnumInfo::lookup( int value ) const { + for( auto const& valueToName : m_values ) { + if( valueToName.first == value ) + return valueToName.second; + } + return "{** unexpected enum value **}"_sr; + } + + Catch::Detail::unique_ptr<EnumInfo> makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector<int> const& values ) { + auto enumInfo = Catch::Detail::make_unique<EnumInfo>(); + enumInfo->m_name = enumName; + enumInfo->m_values.reserve( values.size() ); + + const auto valueNames = Catch::Detail::parseEnums( allValueNames ); + assert( valueNames.size() == values.size() ); + std::size_t i = 0; + for( auto value : values ) + enumInfo->m_values.emplace_back(value, valueNames[i++]); + + return enumInfo; + } + + EnumInfo const& EnumValuesRegistry::registerEnum( StringRef enumName, StringRef allValueNames, std::vector<int> const& values ) { + m_enumInfos.push_back(makeEnumInfo(enumName, allValueNames, values)); + return *m_enumInfos.back(); + } + + } // Detail +} // Catch + + + + +namespace Catch { + + ExceptionTranslatorRegistry::~ExceptionTranslatorRegistry() { + } + + void ExceptionTranslatorRegistry::registerTranslator( const IExceptionTranslator* translator ) { + m_translators.push_back( Detail::unique_ptr<const IExceptionTranslator>( translator ) ); + } + +#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + std::string ExceptionTranslatorRegistry::translateActiveException() const { + try { + // 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(); + } + 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()); + } + } + +#else // ^^ Exceptions are enabled // Exceptions are disabled vv + std::string ExceptionTranslatorRegistry::translateActiveException() const { + CATCH_INTERNAL_ERROR("Attempted to translate active exception under CATCH_CONFIG_DISABLE_EXCEPTIONS!"); + } + + std::string ExceptionTranslatorRegistry::tryTranslators() const { + CATCH_INTERNAL_ERROR("Attempted to use exception translators under CATCH_CONFIG_DISABLE_EXCEPTIONS!"); + } +#endif + + +} + + + + +#if defined(__GNUC__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#endif + +#if 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 // signals/SEH handling + +#if defined( CATCH_CONFIG_WINDOWS_SEH ) + +namespace Catch { + struct SignalDefs { DWORD id; const char* name; }; + + // There is no 1-1 mapping between signals and windows exceptions. + // Windows can easily distinguish between SO and SigSegV, + // but SigInt, SigTerm, etc are handled differently. + static SignalDefs signalDefs[] = { + { static_cast<DWORD>(EXCEPTION_ILLEGAL_INSTRUCTION), "SIGILL - Illegal instruction signal" }, + { static_cast<DWORD>(EXCEPTION_STACK_OVERFLOW), "SIGSEGV - Stack overflow" }, + { static_cast<DWORD>(EXCEPTION_ACCESS_VIOLATION), "SIGSEGV - Segmentation violation signal" }, + { static_cast<DWORD>(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) { + RemoveVectoredExceptionHandler(exceptionHandlerHandle); + SetThreadStackGuarantee(&guaranteeSize); + exceptionHandlerHandle = nullptr; + isSet = false; + } + } + +bool FatalConditionHandler::isSet = false; +ULONG FatalConditionHandler::guaranteeSize = 0; +PVOID FatalConditionHandler::exceptionHandlerHandle = nullptr; + + +} // namespace Catch + +#elif defined( CATCH_CONFIG_POSIX_SIGNALS ) + +namespace Catch { + + struct SignalDefs { + int id; + const char* name; + }; + + // 32kb for the alternate stack seems to be sufficient. However, this value + // is experimentally determined, so that's not guaranteed. + static constexpr std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ; + + static SignalDefs signalDefs[] = { + { SIGINT, "SIGINT - Terminal interrupt signal" }, + { 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 = sigStackSize; + 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]); + } + } + + void FatalConditionHandler::reset() { + if( isSet ) { + // Set signals back to previous values -- hopefully nobody overwrote them in the meantime + for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) { + sigaction(signalDefs[i].id, &oldSigActions[i], nullptr); + } + // Return the old stack + sigaltstack(&oldSigStack, nullptr); + isSet = false; + } + } + + bool FatalConditionHandler::isSet = false; + struct sigaction FatalConditionHandler::oldSigActions[sizeof(signalDefs)/sizeof(SignalDefs)] = {}; + stack_t FatalConditionHandler::oldSigStack = {}; + char FatalConditionHandler::altStackMem[sigStackSize] = {}; + + +} // namespace Catch + +#endif // signals/SEH handling + +#if defined(__GNUC__) +# pragma GCC diagnostic pop +#endif + + + + + +namespace Catch { + namespace { + + void listTests(IStreamingReporter& reporter, IConfig const& config) { + auto const& testSpec = config.testSpec(); + auto matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config); + reporter.listTests(matchedTestCases, config); + } + + void listTags(IStreamingReporter& reporter, IConfig const& config) { + auto const& testSpec = config.testSpec(); + std::vector<TestCaseHandle> matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config); + + std::map<StringRef, TagInfo> tagCounts; + for (auto const& testCase : matchedTestCases) { + for (auto const& tagName : testCase.getTestCaseInfo().tags) { + auto it = tagCounts.find(tagName.lowerCased); + if (it == tagCounts.end()) + it = tagCounts.insert(std::make_pair(tagName.lowerCased, TagInfo())).first; + it->second.add(tagName.original); + } + } + + std::vector<TagInfo> infos; infos.reserve(tagCounts.size()); + for (auto& tagc : tagCounts) { + infos.push_back(std::move(tagc.second)); + } + + reporter.listTags(infos, config); + } + + void listReporters(IStreamingReporter& reporter, IConfig const& config) { + std::vector<ReporterDescription> descriptions; + + IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories(); + descriptions.reserve(factories.size()); + for (auto const& fac : factories) { + descriptions.push_back({ fac.first, fac.second->getDescription() }); + } + + reporter.listReporters(descriptions, config); + } + + } // end anonymous namespace + + void TagInfo::add( StringRef spelling ) { + ++count; + spellings.insert( spelling ); + } + + std::string TagInfo::all() const { + // 2 per tag for brackets '[' and ']' + size_t size = spellings.size() * 2; + for (auto const& spelling : spellings) { + size += spelling.size(); + } + + std::string out; out.reserve(size); + for (auto const& spelling : spellings) { + out += '['; + out += spelling; + out += ']'; + } + return out; + } + + bool list( IStreamingReporter& reporter, Config const& config ) { + bool listed = false; + if (config.listTests()) { + listed = true; + listTests(reporter, config); + } + if (config.listTags()) { + listed = true; + listTags(reporter, config); + } + if (config.listReporters()) { + listed = true; + listReporters(reporter, config); + } + return listed; + } + +} // end namespace Catch + + + +namespace Catch { + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS + LeakDetector leakDetector; + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION +} + +#if defined(CATCH_CONFIG_WCHAR) && defined(CATCH_PLATFORM_WINDOWS) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN) +// Standard C/C++ Win32 Unicode wmain entry point +extern "C" int wmain (int argc, wchar_t * argv[], wchar_t * []) { +#else +// Standard C/C++ main entry point +int main (int argc, char * argv[]) { +#endif + + // We want to force the linker not to discard the global variable + // and its constructor, as it (optionally) registers leak detector + (void)&Catch::leakDetector; + + return Catch::Session().run( argc, argv ); +} + + + +#include <cstdio> +#include <cstring> +#include <sstream> + +#if defined(CATCH_CONFIG_NEW_CAPTURE) + #if defined(_MSC_VER) + #include <io.h> //_dup and _dup2 + #define dup _dup + #define dup2 _dup2 + #define fileno _fileno + #else + #include <unistd.h> // dup and dup2 + #endif +#endif + + +namespace Catch { + + RedirectedStream::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::~RedirectedStream() { + m_originalStream.rdbuf( m_prevBuf ); + } + + RedirectedStdOut::RedirectedStdOut() : m_cout( Catch::cout(), m_rss.get() ) {} + auto RedirectedStdOut::str() const -> std::string { return m_rss.str(); } + + RedirectedStdErr::RedirectedStdErr() + : m_cerr( Catch::cerr(), m_rss.get() ), + m_clog( Catch::clog(), m_rss.get() ) + {} + auto RedirectedStdErr::str() const -> std::string { return m_rss.str(); } + + RedirectedStreams::RedirectedStreams(std::string& redirectedCout, std::string& redirectedCerr) + : m_redirectedCout(redirectedCout), + m_redirectedCerr(redirectedCerr) + {} + + RedirectedStreams::~RedirectedStreams() { + m_redirectedCout += m_redirectedStdOut.str(); + m_redirectedCerr += m_redirectedStdErr.str(); + } + +#if defined(CATCH_CONFIG_NEW_CAPTURE) + +#if defined(_MSC_VER) + TempFile::TempFile() { + if (tmpnam_s(m_buffer)) { + CATCH_RUNTIME_ERROR("Could not get a temp filename"); + } + if (fopen_s(&m_file, m_buffer, "w+")) { + char buffer[100]; + if (strerror_s(buffer, errno)) { + CATCH_RUNTIME_ERROR("Could not translate errno to a string"); + } + CATCH_RUNTIME_ERROR("Could not open the temp file: '" << m_buffer << "' because: " << buffer); + } + } +#else + TempFile::TempFile() { + m_file = std::tmpfile(); + if (!m_file) { + CATCH_RUNTIME_ERROR("Could not create a temp file."); + } + } + +#endif + + TempFile::~TempFile() { + // TBD: What to do about errors here? + std::fclose(m_file); + // We manually create the file on Windows only, on Linux + // it will be autodeleted +#if defined(_MSC_VER) + std::remove(m_buffer); +#endif + } + + + FILE* TempFile::getFile() { + return m_file; + } + + std::string TempFile::getContents() { + std::stringstream sstr; + char buffer[100] = {}; + std::rewind(m_file); + while (std::fgets(buffer, sizeof(buffer), m_file)) { + sstr << buffer; + } + return sstr.str(); + } + + OutputRedirect::OutputRedirect(std::string& stdout_dest, std::string& stderr_dest) : + m_originalStdout(dup(1)), + m_originalStderr(dup(2)), + m_stdoutDest(stdout_dest), + m_stderrDest(stderr_dest) { + dup2(fileno(m_stdoutFile.getFile()), 1); + dup2(fileno(m_stderrFile.getFile()), 2); + } + + OutputRedirect::~OutputRedirect() { + Catch::cout() << std::flush; + fflush(stdout); + // Since we support overriding these streams, we flush cerr + // even though std::cerr is unbuffered + Catch::cerr() << std::flush; + Catch::clog() << std::flush; + fflush(stderr); + + dup2(m_originalStdout, 1); + dup2(m_originalStderr, 2); + + m_stdoutDest += m_stdoutFile.getContents(); + m_stderrDest += m_stderrFile.getContents(); + } + +#endif // CATCH_CONFIG_NEW_CAPTURE + +} // namespace Catch + +#if defined(CATCH_CONFIG_NEW_CAPTURE) + #if defined(_MSC_VER) + #undef dup + #undef dup2 + #undef fileno + #endif +#endif + + + +namespace Catch { + +namespace { + +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4146) // we negate uint32 during the rotate +#endif + // Safe rotr implementation thanks to John Regehr + uint32_t rotate_right(uint32_t val, uint32_t count) { + const uint32_t mask = 31; + count &= mask; + return (val >> count) | (val << (-count & mask)); + } + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif + +} + + + SimplePcg32::SimplePcg32(result_type seed_) { + seed(seed_); + } + + + void SimplePcg32::seed(result_type seed_) { + m_state = 0; + (*this)(); + m_state += seed_; + (*this)(); + } + + void SimplePcg32::discard(uint64_t skip) { + // We could implement this to run in O(log n) steps, but this + // should suffice for our use case. + for (uint64_t s = 0; s < skip; ++s) { + static_cast<void>((*this)()); + } + } + + SimplePcg32::result_type SimplePcg32::operator()() { + // prepare the output value + const uint32_t xorshifted = static_cast<uint32_t>(((m_state >> 18u) ^ m_state) >> 27u); + const auto output = rotate_right(xorshifted, m_state >> 59u); + + // advance state + m_state = m_state * 6364136223846793005ULL + s_inc; + + return output; + } + + bool operator==(SimplePcg32 const& lhs, SimplePcg32 const& rhs) { + return lhs.m_state == rhs.m_state; + } + + bool operator!=(SimplePcg32 const& lhs, SimplePcg32 const& rhs) { + return lhs.m_state != rhs.m_state; + } +} + + + + +namespace Catch { + + ReporterRegistry::ReporterRegistry() { + // Because it is impossible to move out of initializer list, + // we have to add the elements manually + m_factories["automake"] = Detail::make_unique<ReporterFactory<AutomakeReporter>>(); + m_factories["compact"] = Detail::make_unique<ReporterFactory<CompactReporter>>(); + m_factories["console"] = Detail::make_unique<ReporterFactory<ConsoleReporter>>(); + m_factories["junit"] = Detail::make_unique<ReporterFactory<JunitReporter>>(); + m_factories["sonarqube"] = Detail::make_unique<ReporterFactory<SonarQubeReporter>>(); + m_factories["tap"] = Detail::make_unique<ReporterFactory<TAPReporter>>(); + m_factories["teamcity"] = Detail::make_unique<ReporterFactory<TeamCityReporter>>(); + m_factories["xml"] = Detail::make_unique<ReporterFactory<XmlReporter>>(); + } + + ReporterRegistry::~ReporterRegistry() = default; + + + IStreamingReporterPtr ReporterRegistry::create( std::string const& name, IConfig 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 factory ) { + m_factories.emplace(name, std::move(factory)); + } + void ReporterRegistry::registerListener( IReporterFactoryPtr factory ) { + m_listeners.push_back( std::move(factory) ); + } + + IReporterRegistry::FactoryMap const& ReporterRegistry::getFactories() const { + return m_factories; + } + IReporterRegistry::Listeners const& ReporterRegistry::getListeners() const { + return m_listeners; + } + +} + + + +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 + + + + +#include <cassert> +#include <algorithm> + +namespace Catch { + + namespace Generators { + struct GeneratorTracker : TestCaseTracking::TrackerBase, IGeneratorTracker { + GeneratorBasePtr m_generator; + + GeneratorTracker( TestCaseTracking::NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ) + : TrackerBase( nameAndLocation, ctx, parent ) + {} + ~GeneratorTracker(); + + static GeneratorTracker& acquire( TrackerContext& ctx, TestCaseTracking::NameAndLocation const& nameAndLocation ) { + std::shared_ptr<GeneratorTracker> tracker; + + ITracker& currentTracker = ctx.currentTracker(); + // Under specific circumstances, the generator we want + // to acquire is also the current tracker. If this is + // the case, we have to avoid looking through current + // tracker's children, and instead return the current + // tracker. + // A case where this check is important is e.g. + // for (int i = 0; i < 5; ++i) { + // int n = GENERATE(1, 2); + // } + // + // without it, the code above creates 5 nested generators. + if (currentTracker.nameAndLocation() == nameAndLocation) { + auto thisTracker = currentTracker.parent().findChild(nameAndLocation); + assert(thisTracker); + assert(thisTracker->isGeneratorTracker()); + tracker = std::static_pointer_cast<GeneratorTracker>(thisTracker); + } else if ( TestCaseTracking::ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) { + assert( childTracker ); + assert( childTracker->isGeneratorTracker() ); + tracker = std::static_pointer_cast<GeneratorTracker>( childTracker ); + } else { + tracker = std::make_shared<GeneratorTracker>( nameAndLocation, ctx, ¤tTracker ); + currentTracker.addChild( tracker ); + } + + if( !tracker->isComplete() ) { + tracker->open(); + } + + return *tracker; + } + + // TrackerBase interface + bool isGeneratorTracker() const override { return true; } + auto hasGenerator() const -> bool override { + return !!m_generator; + } + void close() override { + TrackerBase::close(); + // If a generator has a child (it is followed by a section) + // and none of its children have started, then we must wait + // until later to start consuming its values. + // This catches cases where `GENERATE` is placed between two + // `SECTION`s. + // **The check for m_children.empty cannot be removed**. + // doing so would break `GENERATE` _not_ followed by `SECTION`s. + const bool should_wait_for_child = + !m_children.empty() && + std::find_if( m_children.begin(), + m_children.end(), + []( TestCaseTracking::ITrackerPtr tracker ) { + return tracker->hasStarted(); + } ) == m_children.end(); + + // This check is a bit tricky, because m_generator->next() + // has a side-effect, where it consumes generator's current + // value, but we do not want to invoke the side-effect if + // this generator is still waiting for any child to start. + if ( should_wait_for_child || + ( m_runState == CompletedSuccessfully && + m_generator->next() ) ) { + m_children.clear(); + m_runState = Executing; + } + } + + // IGeneratorTracker interface + auto getGenerator() const -> GeneratorBasePtr const& override { + return m_generator; + } + void setGenerator( GeneratorBasePtr&& generator ) override { + m_generator = std::move( generator ); + } + }; + GeneratorTracker::~GeneratorTracker() {} + } + + RunContext::RunContext(IConfig const* _config, IStreamingReporterPtr&& reporter) + : m_runInfo(_config->name()), + m_context(getCurrentMutableContext()), + m_config(_config), + m_reporter(std::move(reporter)), + m_lastAssertionInfo{ StringRef(), SourceLineInfo("",0), StringRef(), ResultDisposition::Normal }, + m_includeSuccessfulResults( m_config->includeSuccessfulResults() || m_reporter->getPreferences().shouldReportAllAssertions ) + { + m_context.setRunner(this); + 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(TestCaseHandle const& testCase) { + Totals prevTotals = m_totals; + + std::string redirectedCout; + std::string redirectedCerr; + + auto const& 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; + } + + + 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))); + + if (result.getResultType() != ResultWas::Warning) + m_messageScopes.clear(); + + // 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; + } + auto RunContext::acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& { + using namespace Generators; + GeneratorTracker& tracker = GeneratorTracker::acquire(m_trackerContext, + TestCaseTracking::NameAndLocation( static_cast<std::string>(generatorName), lineInfo ) ); + m_lastAssertionInfo.lineInfo = lineInfo; + return tracker; + } + + 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(); + m_messageScopes.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::benchmarkPreparing(std::string const& name) { + m_reporter->benchmarkPreparing(name); + } + void RunContext::benchmarkStarting( BenchmarkInfo const& info ) { + m_reporter->benchmarkStarting( info ); + } + void RunContext::benchmarkEnded( BenchmarkStats<> const& stats ) { + m_reporter->benchmarkEnded( stats ); + } + void RunContext::benchmarkFailed(std::string const & error) { + m_reporter->benchmarkFailed(error); + } + + void RunContext::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()); + } + + void RunContext::emplaceUnscopedMessage( MessageBuilder const& builder ) { + m_messageScopes.emplace_back( builder ); + } + + 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 = static_cast<std::string>(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); + + 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(); + m_messageScopes.clear(); + } + + 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); + m_reporter->sectionStarting(testCaseSection); + Counts prevAssertions = m_totals.assertions; + double duration = 0; + m_shouldReportUnexpected = true; + m_lastAssertionInfo = { "TEST_CASE"_sr, testCaseInfo.lineInfo, StringRef(), ResultDisposition::Normal }; + + seedRng(*m_config); + + Timer timer; + CATCH_TRY { + if (m_reporter->getPreferences().shouldRedirectStdOut) { +#if !defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT) + RedirectedStreams redirectedStreams(redirectedCout, redirectedCerr); + + timer.start(); + invokeActiveTestCase(); +#else + OutputRedirect r(redirectedCout, redirectedCerr); + timer.start(); + invokeActiveTestCase(); +#endif + } else { + timer.start(); + invokeActiveTestCase(); + } + duration = timer.getElapsedSeconds(); + } CATCH_CATCH_ANON (TestFailureException&) { + // This just means the test was aborted due to failure + } CATCH_CATCH_ALL { + // 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(); + m_messageScopes.clear(); + + SectionStats testCaseSectionStats(testCaseSection, assertions, duration, missingAssertions); + m_reporter->sectionEnded(testCaseSectionStats); + } + + void RunContext::invokeActiveTestCase() { + // We need to register a handler for signals/structured exceptions + // before running the tests themselves, or the binary can crash + // without failed test being reported. + FatalConditionHandler _; + m_activeTestCase->invoke(); + } + + 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 = static_cast<std::string>(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"); + } + + void seedRng(IConfig const& config) { + if (config.rngSeed() != 0) { + std::srand(config.rngSeed()); + rng().seed(config.rngSeed()); + } + } + + unsigned int rngSeed() { + return getCurrentContext().getConfig()->rngSeed(); + } + +} + + + +#include <utility> + +namespace Catch { + + Section::Section( SectionInfo&& info ): + m_info( std::move( info ) ), + m_sectionIncluded( + getResultCapture().sectionStarted( m_info, m_assertions ) ) { + // Non-"included" sections will not use the timing information + // anyway, so don't bother with the potential syscall. + if (m_sectionIncluded) { + 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 + + + +#include <vector> + +namespace Catch { + + namespace { + static auto getSingletons() -> std::vector<ISingleton*>*& { + static std::vector<ISingleton*>* g_singletons = nullptr; + if( !g_singletons ) + g_singletons = new std::vector<ISingleton*>(); + return g_singletons; + } + } + + ISingleton::~ISingleton() {} + + void addSingleton(ISingleton* singleton ) { + getSingletons()->push_back( singleton ); + } + void cleanupSingletons() { + auto& singletons = getSingletons(); + for( auto singleton : *singletons ) + delete singleton; + delete singletons; + singletons = nullptr; + } + +} // namespace Catch + + + +#include <cstdio> +#include <iostream> +#include <fstream> +#include <sstream> +#include <vector> + +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 { + Detail::unique_ptr<StreamBufImpl<OutputDebugWriter>> m_streamBuf; + mutable std::ostream m_os; + public: + DebugOutStream() + : m_streamBuf( Detail::make_unique<StreamBufImpl<OutputDebugWriter>>() ), + m_os( m_streamBuf.get() ) + {} + + ~DebugOutStream() override = default; + + public: // IStream + std::ostream& stream() const override { return m_os; } + }; + + } // unnamed namespace +} // namespace 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<Detail::unique_ptr<std::ostringstream>> m_streams; + std::vector<std::size_t> m_unused; + std::ostringstream m_referenceStream; // Used for copy state/ flags from + + auto add() -> std::size_t { + if( m_unused.empty() ) { + m_streams.push_back( Detail::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); + } + }; + + ReusableStringStream::ReusableStringStream() + : m_index( Singleton<StringStreams>::getMutable().add() ), + m_oss( Singleton<StringStreams>::getMutable().m_streams[m_index].get() ) + {} + + ReusableStringStream::~ReusableStringStream() { + static_cast<std::ostringstream*>( m_oss )->str(""); + m_oss->clear(); + Singleton<StringStreams>::getMutable().release( m_index ); + } + + std::string ReusableStringStream::str() const { + return static_cast<std::ostringstream*>( m_oss )->str(); + } + + void ReusableStringStream::str( std::string const& str ) { + static_cast<std::ostringstream*>( m_oss )->str( 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 +} + + + +#include <algorithm> +#include <ostream> +#include <cstring> +#include <cctype> +#include <vector> + +namespace Catch { + + namespace { + char toLowerCh(char c) { + return static_cast<char>( std::tolower( static_cast<unsigned char>(c) ) ); + } + } + + 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; + } + 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(); + } + + StringRef trim(StringRef ref) { + const auto is_ws = [](char c) { + return c == ' ' || c == '\t' || c == '\n' || c == '\r'; + }; + size_t real_begin = 0; + while (real_begin < ref.size() && is_ws(ref[real_begin])) { ++real_begin; } + size_t real_end = ref.size(); + while (real_end > real_begin && is_ws(ref[real_end - 1])) { --real_end; } + + return ref.substr(real_begin, real_end - real_begin); + } + + 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; + } + + std::vector<StringRef> splitStringRef( StringRef str, char delimiter ) { + std::vector<StringRef> subStrings; + std::size_t start = 0; + for(std::size_t pos = 0; pos < str.size(); ++pos ) { + if( str[pos] == delimiter ) { + if( pos - start > 1 ) + subStrings.push_back( str.substr( start, pos-start ) ); + start = pos+1; + } + } + if( start < str.size() ) + subStrings.push_back( str.substr( start, str.size()-start ) ); + return subStrings; + } + + 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; + } + +} + + + +#include <algorithm> +#include <ostream> +#include <cstring> +#include <cstdint> + +namespace Catch { + StringRef::StringRef( char const* rawChars ) noexcept + : StringRef( rawChars, static_cast<StringRef::size_type>(std::strlen(rawChars) ) ) + {} + + auto StringRef::c_str() const -> char const* { + CATCH_ENFORCE(isNullTerminated(), "Called StringRef::c_str() on a non-null-terminated instance"); + return m_start; + } + + auto StringRef::operator == ( StringRef const& other ) const noexcept -> bool { + return m_size == other.m_size + && (std::memcmp( m_start, other.m_start, m_size ) == 0); + } + + bool StringRef::operator<(StringRef const& rhs) const noexcept { + if (m_size < rhs.m_size) { + return strncmp(m_start, rhs.m_start, m_size) <= 0; + } + return strncmp(m_start, rhs.m_start, rhs.m_size) < 0; + } + + auto operator << ( std::ostream& os, StringRef const& str ) -> std::ostream& { + return os.write(str.data(), str.size()); + } + + std::string operator+(StringRef lhs, StringRef rhs) { + std::string ret; + ret.reserve(lhs.size() + rhs.size()); + ret += lhs; + ret += rhs; + return ret; + } + + auto operator+=( std::string& lhs, StringRef const& rhs ) -> std::string& { + lhs.append(rhs.data(), rhs.size()); + return lhs; + } + +} // namespace Catch + + + +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 + + + + +#include <algorithm> +#include <set> + +namespace Catch { + +namespace { + struct HashTest { + explicit HashTest(SimplePcg32& rng_inst) { + basis = rng_inst(); + basis <<= 32; + basis |= rng_inst(); + } + + uint64_t basis; + + uint64_t operator()(TestCaseInfo const& t) const { + // Modified FNV-1a hash + static constexpr uint64_t prime = 1099511628211; + uint64_t hash = basis; + for (const char c : t.name) { + hash ^= c; + hash *= prime; + } + return hash; + } + }; +} // end anonymous namespace + + std::vector<TestCaseHandle> sortTests( IConfig const& config, std::vector<TestCaseHandle> const& unsortedTestCases ) { + switch (config.runOrder()) { + case TestRunOrder::Declared: + return unsortedTestCases; + + case TestRunOrder::LexicographicallySorted: { + std::vector<TestCaseHandle> sorted = unsortedTestCases; + std::sort(sorted.begin(), sorted.end()); + return sorted; + } + case TestRunOrder::Randomized: { + seedRng(config); + HashTest h(rng()); + std::vector<std::pair<uint64_t, TestCaseHandle>> indexed_tests; + indexed_tests.reserve(unsortedTestCases.size()); + + for (auto const& handle : unsortedTestCases) { + indexed_tests.emplace_back(h(handle.getTestCaseInfo()), handle); + } + + std::sort(indexed_tests.begin(), indexed_tests.end()); + + std::vector<TestCaseHandle> randomized; + randomized.reserve(indexed_tests.size()); + + for (auto const& indexed : indexed_tests) { + randomized.push_back(indexed.second); + } + + return randomized; + } + } + + CATCH_INTERNAL_ERROR("Unknown test order value!"); + } + + bool isThrowSafe( TestCaseHandle const& testCase, IConfig const& config ) { + return !testCase.getTestCaseInfo().throws() || config.allowThrows(); + } + + bool matchTest( TestCaseHandle const& testCase, TestSpec const& testSpec, IConfig const& config ) { + return testSpec.matches( testCase.getTestCaseInfo() ) && isThrowSafe( testCase, config ); + } + + void enforceNoDuplicateTestCases( std::vector<TestCaseHandle> const& functions ) { + std::set<TestCaseHandle> seenFunctions; + for( auto const& function : functions ) { + auto prev = seenFunctions.insert( function ); + CATCH_ENFORCE( prev.second, + "error: TEST_CASE( \"" << function.getTestCaseInfo().name << "\" ) already defined.\n" + << "\tFirst seen at " << prev.first->getTestCaseInfo().lineInfo << "\n" + << "\tRedefined at " << function.getTestCaseInfo().lineInfo ); + } + } + + std::vector<TestCaseHandle> filterTests( std::vector<TestCaseHandle> const& testCases, TestSpec const& testSpec, IConfig const& config ) { + std::vector<TestCaseHandle> filtered; + filtered.reserve( testCases.size() ); + for (auto const& testCase : testCases) { + if ((!testSpec.hasFilters() && !testCase.getTestCaseInfo().isHidden()) || + (testSpec.hasFilters() && matchTest(testCase, testSpec, config))) { + filtered.push_back(testCase); + } + } + return filtered; + } + std::vector<TestCaseHandle> const& getAllTestCasesSorted( IConfig const& config ) { + return getRegistryHub().getTestCaseRegistry().getAllTestsSorted( config ); + } + + void TestRegistry::registerTest(Detail::unique_ptr<TestCaseInfo> testInfo, Detail::unique_ptr<ITestInvoker> testInvoker) { + m_handles.emplace_back(testInfo.get(), testInvoker.get()); + m_viewed_test_infos.push_back(testInfo.get()); + m_owned_test_infos.push_back(std::move(testInfo)); + m_invokers.push_back(std::move(testInvoker)); + } + + std::vector<TestCaseInfo*> const& TestRegistry::getAllInfos() const { + return m_viewed_test_infos; + } + + std::vector<TestCaseHandle> const& TestRegistry::getAllTests() const { + return m_handles; + } + std::vector<TestCaseHandle> const& TestRegistry::getAllTestsSorted( IConfig const& config ) const { + if( m_sortedFunctions.empty() ) + enforceNoDuplicateTestCases( m_handles ); + + if( m_currentSortOrder != config.runOrder() || m_sortedFunctions.empty() ) { + m_sortedFunctions = sortTests( config, m_handles ); + m_currentSortOrder = config.runOrder(); + } + return m_sortedFunctions; + } + + + + /////////////////////////////////////////////////////////////////////////// + void TestInvokerAsFunction::invoke() const { + m_testAsFunction(); + } + + std::string extractClassName( StringRef 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 + + + + +#include <algorithm> +#include <cassert> +#include <memory> + +#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; + + void ITracker::addChild( ITrackerPtr const& child ) { + m_children.push_back( child ); + } + + ITrackerPtr ITracker::findChild( NameAndLocation const& nameAndLocation ) { + auto it = std::find_if( + m_children.begin(), + m_children.end(), + [&nameAndLocation]( ITrackerPtr const& tracker ) { + return tracker->nameAndLocation().location == + nameAndLocation.location && + tracker->nameAndLocation().name == nameAndLocation.name; + } ); + return ( it != m_children.end() ) ? *it : nullptr; + } + + + + ITracker& TrackerContext::startRun() { + using namespace std::string_literals; + m_rootTracker = std::make_shared<SectionTracker>( NameAndLocation( "{root}"s, 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::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ): + ITracker(nameAndLocation), + m_ctx( ctx ), + m_parent( parent ) + {} + + 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(); + } + + 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::isGeneratorTracker() 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( std::all_of(m_children.begin(), m_children.end(), [](ITrackerPtr const& t){ return t->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 ), + m_trimmed_name(trim(nameAndLocation.name)) + { + if( parent ) { + while( !parent->isSectionTracker() ) + parent = &parent->parent(); + + SectionTracker& parentSection = static_cast<SectionTracker&>( *parent ); + addNextFilters( parentSection.m_filters ); + } + } + + bool SectionTracker::isComplete() const { + bool complete = true; + + if (m_filters.empty() + || m_filters[0] == "" + || std::find(m_filters.begin(), m_filters.end(), m_trimmed_name) != m_filters.end()) { + complete = TrackerBase::isComplete(); + } + return complete; + } + + 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() ) + open(); + } + + void SectionTracker::addInitialFilters( std::vector<std::string> const& filters ) { + if( !filters.empty() ) { + m_filters.reserve( m_filters.size() + filters.size() + 2 ); + m_filters.emplace_back(""); // Root - should never be consulted + m_filters.emplace_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()+1, filters.end() ); + } + +} // namespace TestCaseTracking + +using TestCaseTracking::ITracker; +using TestCaseTracking::TrackerContext; +using TestCaseTracking::SectionTracker; + +} // namespace Catch + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif + + + +namespace Catch { + + Detail::unique_ptr<ITestInvoker> makeTestInvoker( void(*testAsFunction)() ) { + return Detail::unique_ptr<ITestInvoker>( new TestInvokerAsFunction( testAsFunction )); + } + + AutoReg::AutoReg( Detail::unique_ptr<ITestInvoker> invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept { + CATCH_TRY { + getMutableRegistryHub() + .registerTest( + makeTestCaseInfo( + extractClassName( classOrMethod ), + nameAndTags, + lineInfo), + std::move(invoker) + ); + } CATCH_CATCH_ALL { + // Do not throw when constructing global objects, instead register the exception to be processed later + getMutableRegistryHub().registerStartupException(); + } + } +} + + + + + +namespace Catch { + + TestSpecParser::TestSpecParser( ITagAliasRegistry const& tagAliases ) : m_tagAliases( &tagAliases ) {} + + TestSpecParser& TestSpecParser::parse( std::string const& arg ) { + m_mode = None; + m_exclusion = false; + m_arg = m_tagAliases->expandAliases( arg ); + m_escapeChars.clear(); + m_substring.reserve(m_arg.size()); + m_patternName.reserve(m_arg.size()); + m_realPatternPos = 0; + + for( m_pos = 0; m_pos < m_arg.size(); ++m_pos ) + //if visitChar fails + if( !visitChar( m_arg[m_pos] ) ){ + m_testSpec.m_invalidArgs.push_back(arg); + break; + } + endMode(); + return *this; + } + TestSpec TestSpecParser::testSpec() { + addFilter(); + return std::move(m_testSpec); + } + bool TestSpecParser::visitChar( char c ) { + if( (m_mode != EscapedName) && (c == '\\') ) { + escape(); + addCharToPattern(c); + return true; + }else if((m_mode != EscapedName) && (c == ',') ) { + return separate(); + } + + switch( m_mode ) { + case None: + if( processNoneChar( c ) ) + return true; + break; + case Name: + processNameChar( c ); + break; + case EscapedName: + endMode(); + addCharToPattern(c); + return true; + default: + case Tag: + case QuotedName: + if( processOtherChar( c ) ) + return true; + break; + } + + m_substring += c; + if( !isControlChar( c ) ) { + m_patternName += c; + m_realPatternPos++; + } + return true; + } + // Two of the processing methods return true to signal the caller to return + // without adding the given character to the current pattern strings + bool TestSpecParser::processNoneChar( char c ) { + switch( c ) { + case ' ': + return true; + case '~': + m_exclusion = true; + return false; + case '[': + startNewMode( Tag ); + return false; + case '"': + startNewMode( QuotedName ); + return false; + default: + startNewMode( Name ); + return false; + } + } + void TestSpecParser::processNameChar( char c ) { + if( c == '[' ) { + if( m_substring == "exclude:" ) + m_exclusion = true; + else + endMode(); + startNewMode( Tag ); + } + } + bool TestSpecParser::processOtherChar( char c ) { + if( !isControlChar( c ) ) + return false; + m_substring += c; + endMode(); + return true; + } + void TestSpecParser::startNewMode( Mode mode ) { + m_mode = mode; + } + void TestSpecParser::endMode() { + switch( m_mode ) { + case Name: + case QuotedName: + return addNamePattern(); + case Tag: + return addTagPattern(); + case EscapedName: + revertBackToLastMode(); + return; + case None: + default: + return startNewMode( None ); + } + } + void TestSpecParser::escape() { + saveLastMode(); + m_mode = EscapedName; + m_escapeChars.push_back(m_realPatternPos); + } + bool TestSpecParser::isControlChar( char c ) const { + switch( m_mode ) { + default: + return false; + case None: + return c == '~'; + case Name: + return c == '['; + case EscapedName: + return true; + case QuotedName: + return c == '"'; + case Tag: + return c == '[' || c == ']'; + } + } + + void TestSpecParser::addFilter() { + if( !m_currentFilter.m_required.empty() || !m_currentFilter.m_forbidden.empty() ) { + m_testSpec.m_filters.push_back( std::move(m_currentFilter) ); + m_currentFilter = TestSpec::Filter(); + } + } + + void TestSpecParser::saveLastMode() { + lastMode = m_mode; + } + + void TestSpecParser::revertBackToLastMode() { + m_mode = lastMode; + } + + bool TestSpecParser::separate() { + if( (m_mode==QuotedName) || (m_mode==Tag) ){ + //invalid argument, signal failure to previous scope. + m_mode = None; + m_pos = m_arg.size(); + m_substring.clear(); + m_patternName.clear(); + m_realPatternPos = 0; + return false; + } + endMode(); + addFilter(); + return true; //success + } + + std::string TestSpecParser::preprocessPattern() { + std::string token = m_patternName; + for (std::size_t i = 0; i < m_escapeChars.size(); ++i) + token = token.substr(0, m_escapeChars[i] - i) + token.substr(m_escapeChars[i] - i + 1); + m_escapeChars.clear(); + if (startsWith(token, "exclude:")) { + m_exclusion = true; + token = token.substr(8); + } + + m_patternName.clear(); + m_realPatternPos = 0; + + return token; + } + + void TestSpecParser::addNamePattern() { + auto token = preprocessPattern(); + + if (!token.empty()) { + if (m_exclusion) { + m_currentFilter.m_forbidden.emplace_back(Detail::make_unique<TestSpec::NamePattern>(token, m_substring)); + } else { + m_currentFilter.m_required.emplace_back(Detail::make_unique<TestSpec::NamePattern>(token, m_substring)); + } + } + m_substring.clear(); + m_exclusion = false; + m_mode = None; + } + + void TestSpecParser::addTagPattern() { + auto token = preprocessPattern(); + + if (!token.empty()) { + // If the tag pattern is the "hide and tag" shorthand (e.g. [.foo]) + // we have to create a separate hide tag and shorten the real one + if (token.size() > 1 && token[0] == '.') { + token.erase(token.begin()); + if (m_exclusion) { + m_currentFilter.m_forbidden.emplace_back(Detail::make_unique<TestSpec::TagPattern>(".", m_substring)); + m_currentFilter.m_forbidden.emplace_back(Detail::make_unique<TestSpec::TagPattern>(token, m_substring)); + } else { + m_currentFilter.m_required.emplace_back(Detail::make_unique<TestSpec::TagPattern>(".", m_substring)); + m_currentFilter.m_required.emplace_back(Detail::make_unique<TestSpec::TagPattern>(token, m_substring)); + } + } + if (m_exclusion) { + m_currentFilter.m_forbidden.emplace_back(Detail::make_unique<TestSpec::TagPattern>(token, m_substring)); + } else { + m_currentFilter.m_required.emplace_back(Detail::make_unique<TestSpec::TagPattern>(token, m_substring)); + } + } + m_substring.clear(); + m_exclusion = false; + m_mode = None; + } + + TestSpec parseTestSpec( std::string const& arg ) { + return TestSpecParser( ITagAliasRegistry::get() ).parse( arg ).testSpec(); + } + +} // namespace Catch + + +#include <cstring> +#include <ostream> + +namespace { + bool isWhitespace( char c ) { + return c == ' ' || c == '\t' || c == '\n' || c == '\r'; + } + + bool isBreakableBefore( char c ) { + static const char chars[] = "[({<|"; + return std::memchr( chars, c, sizeof( chars ) - 1 ) != nullptr; + } + + bool isBreakableAfter( char c ) { + static const char chars[] = "])}>.,:;*+-=&/\\"; + return std::memchr( chars, c, sizeof( chars ) - 1 ) != nullptr; + } + + bool isBoundary( std::string const& line, size_t at ) { + 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] ); + } + +} // namespace + +namespace Catch { + namespace TextFlow { + + void Column::iterator::calcLength() { + m_suffix = false; + auto width = m_column.m_width - indent(); + m_end = m_pos; + std::string const& current_line = m_column.m_string; + if ( current_line[m_pos] == '\n' ) { + ++m_end; + } + while ( m_end < current_line.size() && + current_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( current_line, m_pos + len ) ) { + --len; + } + while ( len > 0 && + isWhitespace( current_line[m_pos + len - 1] ) ) { + --len; + } + + if ( len > 0 ) { + m_len = len; + } else { + m_suffix = true; + m_len = width - 1; + } + } + } + + size_t Column::iterator::indent() const { + auto initial = + m_pos == 0 ? m_column.m_initialIndent : std::string::npos; + return initial == std::string::npos ? m_column.m_indent : initial; + } + + std::string + Column::iterator::addIndentAndSuffix( size_t position, + size_t length ) const { + std::string ret; + const auto desired_indent = indent(); + ret.reserve( desired_indent + length + m_suffix ); + ret.append( desired_indent, ' ' ); + ret.append( m_column.m_string, position, length ); + if ( m_suffix ) { + ret.push_back( '-' ); + } + + return ret; + } + + Column::iterator::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_pos = m_column.m_string.size(); + } + } + + std::string Column::iterator::operator*() const { + assert( m_pos <= m_end ); + return addIndentAndSuffix( m_pos, m_len ); + } + + Column::iterator& Column::iterator::operator++() { + m_pos += m_len; + std::string const& current_line = m_column.m_string; + if ( m_pos < current_line.size() && current_line[m_pos] == '\n' ) { + m_pos += 1; + } else { + while ( m_pos < current_line.size() && + isWhitespace( current_line[m_pos] ) ) { + ++m_pos; + } + } + + if ( m_pos != current_line.size() ) { + calcLength(); + } + return *this; + } + + Column::iterator Column::iterator::operator++( int ) { + iterator prev( *this ); + operator++(); + return prev; + } + + 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; + } + + Column Spacer( size_t spaceWidth ) { + Column ret{ "" }; + ret.width( spaceWidth ); + return ret; + } + + Columns::iterator::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() ); + } + } + + Columns::iterator::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() ); + } + } + + std::string Columns::iterator::operator*() const { + std::string row, padding; + + for ( size_t i = 0; i < m_columns.size(); ++i ) { + const auto width = m_columns[i].width(); + if ( m_iterators[i] != m_columns[i].end() ) { + std::string col = *m_iterators[i]; + row += padding; + row += col; + + padding.clear(); + if ( col.size() < width ) { + padding.append( width - col.size(), ' ' ); + } + } else { + padding.append( width, ' ' ); + } + } + return row; + } + + Columns::iterator& Columns::iterator::operator++() { + for ( size_t i = 0; i < m_columns.size(); ++i ) { + if ( m_iterators[i] != m_columns[i].end() ) { + ++m_iterators[i]; + } + } + return *this; + } + + Columns::iterator Columns::iterator::operator++( int ) { + iterator prev( *this ); + operator++(); + return prev; + } + + 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; + } + + Columns Column::operator+( Column const& other ) { + Columns cols; + cols += *this; + cols += other; + return cols; + } + + Columns& Columns::operator+=( Column const& col ) { + m_columns.push_back( col ); + return *this; + } + + Columns Columns::operator+( Column const& col ) { + Columns combined = *this; + combined += col; + return combined; + } + + } // namespace TextFlow +} // namespace Catch + + + +namespace Catch { + + WildcardPattern::WildcardPattern( std::string const& pattern, + CaseSensitive caseSensitivity ) + : m_caseSensitivity( caseSensitivity ), + m_pattern( normaliseString( 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 == normaliseString( str ); + case WildcardAtStart: + return endsWith( normaliseString( str ), m_pattern ); + case WildcardAtEnd: + return startsWith( normaliseString( str ), m_pattern ); + case WildcardAtBothEnds: + return contains( normaliseString( str ), m_pattern ); + default: + CATCH_INTERNAL_ERROR( "Unknown enum" ); + } + } + + std::string WildcardPattern::normaliseString( std::string const& str ) const { + return trim( m_caseSensitivity == CaseSensitive::No ? toLower( str ) : str ); + } +} + + + + +#include <iomanip> +#include <type_traits> + +namespace Catch { + +namespace { + + size_t trailingBytes(unsigned char c) { + if ((c & 0xE0) == 0xC0) { + return 2; + } + if ((c & 0xF0) == 0xE0) { + return 3; + } + if ((c & 0xF8) == 0xF0) { + return 4; + } + CATCH_INTERNAL_ERROR("Invalid multibyte utf-8 start byte encountered"); + } + + uint32_t headerValue(unsigned char c) { + if ((c & 0xE0) == 0xC0) { + return c & 0x1F; + } + if ((c & 0xF0) == 0xE0) { + return c & 0x0F; + } + if ((c & 0xF8) == 0xF0) { + return c & 0x07; + } + CATCH_INTERNAL_ERROR("Invalid multibyte utf-8 start byte encountered"); + } + + void hexEscapeChar(std::ostream& os, unsigned char c) { + std::ios_base::fmtflags f(os.flags()); + os << "\\x" + << std::uppercase << std::hex << std::setfill('0') << std::setw(2) + << static_cast<int>(c); + os.flags(f); + } + + bool shouldNewline(XmlFormatting fmt) { + return !!(static_cast<std::underlying_type_t<XmlFormatting>>(fmt & XmlFormatting::Newline)); + } + + bool shouldIndent(XmlFormatting fmt) { + return !!(static_cast<std::underlying_type_t<XmlFormatting>>(fmt & XmlFormatting::Indent)); + } + +} // anonymous namespace + + XmlFormatting operator | (XmlFormatting lhs, XmlFormatting rhs) { + return static_cast<XmlFormatting>( + static_cast<std::underlying_type_t<XmlFormatting>>(lhs) | + static_cast<std::underlying_type_t<XmlFormatting>>(rhs) + ); + } + + XmlFormatting operator & (XmlFormatting lhs, XmlFormatting rhs) { + return static_cast<XmlFormatting>( + static_cast<std::underlying_type_t<XmlFormatting>>(lhs) & + static_cast<std::underlying_type_t<XmlFormatting>>(rhs) + ); + } + + + 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 idx = 0; idx < m_str.size(); ++ idx ) { + unsigned char c = m_str[idx]; + switch (c) { + case '<': os << "<"; break; + case '&': os << "&"; break; + + case '>': + // See: http://www.w3.org/TR/xml/#syntax + if (idx > 2 && m_str[idx - 1] == ']' && m_str[idx - 2] == ']') + os << ">"; + else + os << c; + break; + + case '\"': + if (m_forWhat == ForAttributes) + os << """; + else + os << c; + break; + + default: + // Check for control characters and invalid utf-8 + + // Escape control characters in standard ascii + // see http://stackoverflow.com/questions/404107/why-are-control-characters-illegal-in-xml-1-0 + if (c < 0x09 || (c > 0x0D && c < 0x20) || c == 0x7F) { + hexEscapeChar(os, c); + break; + } + + // Plain ASCII: Write it to stream + if (c < 0x7F) { + os << c; + break; + } + + // UTF-8 territory + // Check if the encoding is valid and if it is not, hex escape bytes. + // Important: We do not check the exact decoded values for validity, only the encoding format + // First check that this bytes is a valid lead byte: + // This means that it is not encoded as 1111 1XXX + // Or as 10XX XXXX + if (c < 0xC0 || + c >= 0xF8) { + hexEscapeChar(os, c); + break; + } + + auto encBytes = trailingBytes(c); + // Are there enough bytes left to avoid accessing out-of-bounds memory? + if (idx + encBytes - 1 >= m_str.size()) { + hexEscapeChar(os, c); + break; + } + // The header is valid, check data + // The next encBytes bytes must together be a valid utf-8 + // This means: bitpattern 10XX XXXX and the extracted value is sane (ish) + bool valid = true; + uint32_t value = headerValue(c); + for (std::size_t n = 1; n < encBytes; ++n) { + unsigned char nc = m_str[idx + n]; + valid &= ((nc & 0xC0) == 0x80); + value = (value << 6) | (nc & 0x3F); + } + + if ( + // Wrong bit pattern of following bytes + (!valid) || + // Overlong encodings + (value < 0x80) || + (0x80 <= value && value < 0x800 && encBytes > 2) || + (0x800 < value && value < 0x10000 && encBytes > 3) || + // Encoded value out of range + (value >= 0x110000) + ) { + hexEscapeChar(os, c); + break; + } + + // If we got here, this is in fact a valid(ish) utf-8 sequence + for (std::size_t n = 0; n < encBytes; ++n) { + os << m_str[idx + n]; + } + idx += encBytes - 1; + break; + } + } + } + + std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode ) { + xmlEncode.encodeTo( os ); + return os; + } + + XmlWriter::ScopedElement::ScopedElement( XmlWriter* writer, XmlFormatting fmt ) + : m_writer( writer ), + m_fmt(fmt) + {} + + XmlWriter::ScopedElement::ScopedElement( ScopedElement&& other ) noexcept + : m_writer( other.m_writer ), + m_fmt(other.m_fmt) + { + other.m_writer = nullptr; + other.m_fmt = XmlFormatting::None; + } + XmlWriter::ScopedElement& XmlWriter::ScopedElement::operator=( ScopedElement&& other ) noexcept { + if ( m_writer ) { + m_writer->endElement(); + } + m_writer = other.m_writer; + other.m_writer = nullptr; + m_fmt = other.m_fmt; + other.m_fmt = XmlFormatting::None; + return *this; + } + + + XmlWriter::ScopedElement::~ScopedElement() { + if (m_writer) { + m_writer->endElement(m_fmt); + } + } + + XmlWriter::ScopedElement& XmlWriter::ScopedElement::writeText( std::string const& text, XmlFormatting fmt ) { + m_writer->writeText( text, fmt ); + return *this; + } + + XmlWriter::XmlWriter( std::ostream& os ) : m_os( os ) + { + writeDeclaration(); + } + + XmlWriter::~XmlWriter() { + while (!m_tags.empty()) { + endElement(); + } + newlineIfNecessary(); + } + + XmlWriter& XmlWriter::startElement( std::string const& name, XmlFormatting fmt ) { + ensureTagClosed(); + newlineIfNecessary(); + if (shouldIndent(fmt)) { + m_os << m_indent; + m_indent += " "; + } + m_os << '<' << name; + m_tags.push_back( name ); + m_tagIsOpen = true; + applyFormatting(fmt); + return *this; + } + + XmlWriter::ScopedElement XmlWriter::scopedElement( std::string const& name, XmlFormatting fmt ) { + ScopedElement scoped( this, fmt ); + startElement( name, fmt ); + return scoped; + } + + XmlWriter& XmlWriter::endElement(XmlFormatting fmt) { + m_indent = m_indent.substr(0, m_indent.size() - 2); + + if( m_tagIsOpen ) { + m_os << "/>"; + m_tagIsOpen = false; + } else { + newlineIfNecessary(); + if (shouldIndent(fmt)) { + m_os << m_indent; + } + m_os << "</" << m_tags.back() << ">"; + } + m_os << std::flush; + applyFormatting(fmt); + 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, XmlFormatting fmt) { + if( !text.empty() ){ + bool tagWasOpen = m_tagIsOpen; + ensureTagClosed(); + if (tagWasOpen && shouldIndent(fmt)) { + m_os << m_indent; + } + m_os << XmlEncode( text ); + applyFormatting(fmt); + } + return *this; + } + + XmlWriter& XmlWriter::writeComment( std::string const& text, XmlFormatting fmt) { + ensureTagClosed(); + if (shouldIndent(fmt)) { + m_os << m_indent; + } + m_os << "<!--" << text << "-->"; + applyFormatting(fmt); + 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::flush; + newlineIfNecessary(); + m_tagIsOpen = false; + } + } + + void XmlWriter::applyFormatting(XmlFormatting fmt) { + m_needsNewline = shouldNewline(fmt); + } + + 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; + } + } +} + + + +#include <algorithm> +#include <cmath> +#include <cstdlib> +#include <cstdint> +#include <cstring> +#include <sstream> +#include <iomanip> +#include <limits> + + +namespace Catch { +namespace { + + int32_t convert(float f) { + static_assert(sizeof(float) == sizeof(int32_t), "Important ULP matcher assumption violated"); + int32_t i; + std::memcpy(&i, &f, sizeof(f)); + return i; + } + + int64_t convert(double d) { + static_assert(sizeof(double) == sizeof(int64_t), "Important ULP matcher assumption violated"); + int64_t i; + std::memcpy(&i, &d, sizeof(d)); + return i; + } + + template <typename FP> + bool almostEqualUlps(FP lhs, FP rhs, uint64_t maxUlpDiff) { + // Comparison with NaN should always be false. + // This way we can rule it out before getting into the ugly details + if (Catch::isnan(lhs) || Catch::isnan(rhs)) { + return false; + } + + auto lc = convert(lhs); + auto rc = convert(rhs); + + if ((lc < 0) != (rc < 0)) { + // Potentially we can have +0 and -0 + return lhs == rhs; + } + + auto ulpDiff = std::abs(lc - rc); + return static_cast<uint64_t>(ulpDiff) <= maxUlpDiff; + } + +#if defined(CATCH_CONFIG_GLOBAL_NEXTAFTER) + + float nextafter(float x, float y) { + return ::nextafterf(x, y); + } + + double nextafter(double x, double y) { + return ::nextafter(x, y); + } + +#endif // ^^^ CATCH_CONFIG_GLOBAL_NEXTAFTER ^^^ + +template <typename FP> +FP step(FP start, FP direction, uint64_t steps) { + for (uint64_t i = 0; i < steps; ++i) { +#if defined(CATCH_CONFIG_GLOBAL_NEXTAFTER) + start = Catch::nextafter(start, direction); +#else + start = std::nextafter(start, direction); +#endif + } + return start; +} + +// 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); +} + +template <typename FloatingPoint> +void write(std::ostream& out, FloatingPoint num) { + out << std::scientific + << std::setprecision(std::numeric_limits<FloatingPoint>::max_digits10 - 1) + << num; +} + +} // end anonymous namespace + +namespace Matchers { +namespace Detail { + + enum class FloatingPointKind : uint8_t { + Float, + Double + }; + +} // end namespace Detail + + + WithinAbsMatcher::WithinAbsMatcher(double target, double margin) + :m_target{ target }, m_margin{ margin } { + CATCH_ENFORCE(margin >= 0, "Invalid margin: " << margin << '.' + << " Margin has to be non-negative."); + } + + // 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 >= matchee); + } + + std::string WithinAbsMatcher::describe() const { + return "is within " + ::Catch::Detail::stringify(m_margin) + " of " + ::Catch::Detail::stringify(m_target); + } + + + WithinUlpsMatcher::WithinUlpsMatcher(double target, uint64_t ulps, Detail::FloatingPointKind baseType) + :m_target{ target }, m_ulps{ ulps }, m_type{ baseType } { + CATCH_ENFORCE(m_type == Detail::FloatingPointKind::Double + || m_ulps < (std::numeric_limits<uint32_t>::max)(), + "Provided ULP is impossibly large for a float comparison."); + } + +#if defined(__clang__) +#pragma clang diagnostic push +// Clang <3.5 reports on the default branch in the switch below +#pragma clang diagnostic ignored "-Wunreachable-code" +#endif + + bool WithinUlpsMatcher::match(double const& matchee) const { + switch (m_type) { + case Detail::FloatingPointKind::Float: + return almostEqualUlps<float>(static_cast<float>(matchee), static_cast<float>(m_target), m_ulps); + case Detail::FloatingPointKind::Double: + return almostEqualUlps<double>(matchee, m_target, m_ulps); + default: + CATCH_INTERNAL_ERROR( "Unknown Detail::FloatingPointKind value" ); + } + } + +#if defined(__clang__) +#pragma clang diagnostic pop +#endif + + std::string WithinUlpsMatcher::describe() const { + std::stringstream ret; + + ret << "is within " << m_ulps << " ULPs of "; + + if (m_type == Detail::FloatingPointKind::Float) { + write(ret, static_cast<float>(m_target)); + ret << 'f'; + } else { + write(ret, m_target); + } + + ret << " (["; + if (m_type == Detail::FloatingPointKind::Double) { + write(ret, step(m_target, static_cast<double>(-INFINITY), m_ulps)); + ret << ", "; + write(ret, step(m_target, static_cast<double>( INFINITY), m_ulps)); + } else { + // We have to cast INFINITY to float because of MinGW, see #1782 + write(ret, step(static_cast<float>(m_target), static_cast<float>(-INFINITY), m_ulps)); + ret << ", "; + write(ret, step(static_cast<float>(m_target), static_cast<float>( INFINITY), m_ulps)); + } + ret << "])"; + + return ret.str(); + } + + WithinRelMatcher::WithinRelMatcher(double target, double epsilon): + m_target(target), + m_epsilon(epsilon){ + CATCH_ENFORCE(m_epsilon >= 0., "Relative comparison with epsilon < 0 does not make sense."); + CATCH_ENFORCE(m_epsilon < 1., "Relative comparison with epsilon >= 1 does not make sense."); + } + + bool WithinRelMatcher::match(double const& matchee) const { + const auto relMargin = m_epsilon * (std::max)(std::fabs(matchee), std::fabs(m_target)); + return marginComparison(matchee, m_target, + std::isinf(relMargin)? 0 : relMargin); + } + + std::string WithinRelMatcher::describe() const { + Catch::ReusableStringStream sstr; + sstr << "and " << m_target << " are within " << m_epsilon * 100. << "% of each other"; + return sstr.str(); + } + + +WithinUlpsMatcher WithinULP(double target, uint64_t maxUlpDiff) { + return WithinUlpsMatcher(target, maxUlpDiff, Detail::FloatingPointKind::Double); +} + +WithinUlpsMatcher WithinULP(float target, uint64_t maxUlpDiff) { + return WithinUlpsMatcher(target, maxUlpDiff, Detail::FloatingPointKind::Float); +} + +WithinAbsMatcher WithinAbs(double target, double margin) { + return WithinAbsMatcher(target, margin); +} + +WithinRelMatcher WithinRel(double target, double eps) { + return WithinRelMatcher(target, eps); +} + +WithinRelMatcher WithinRel(double target) { + return WithinRelMatcher(target, std::numeric_limits<double>::epsilon() * 100); +} + +WithinRelMatcher WithinRel(float target, float eps) { + return WithinRelMatcher(target, eps); +} + +WithinRelMatcher WithinRel(float target) { + return WithinRelMatcher(target, std::numeric_limits<float>::epsilon() * 100); +} + + +} // namespace Matchers +} // namespace Catch + + + +#include <regex> + +namespace Catch { +namespace Matchers { + + CasedString::CasedString( std::string const& str, CaseSensitive 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; + } + StringRef CasedString::caseSensitivitySuffix() const { + return m_caseSensitivity == CaseSensitive::Yes + ? StringRef() + : " (case insensitive)"_sr; + } + + + 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; + } + + StringEqualsMatcher::StringEqualsMatcher( CasedString const& comparator ) : StringMatcherBase( "equals", comparator ) {} + + bool StringEqualsMatcher::match( std::string const& source ) const { + return m_comparator.adjustString( source ) == m_comparator.m_str; + } + + + StringContainsMatcher::StringContainsMatcher( CasedString const& comparator ) : StringMatcherBase( "contains", comparator ) {} + + bool StringContainsMatcher::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 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::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::Yes)? " case sensitively" : " case insensitively"); + } + + + StringEqualsMatcher Equals( std::string const& str, CaseSensitive caseSensitivity ) { + return StringEqualsMatcher( CasedString( str, caseSensitivity) ); + } + StringContainsMatcher Contains( std::string const& str, CaseSensitive caseSensitivity ) { + return StringContainsMatcher( CasedString( str, caseSensitivity) ); + } + EndsWithMatcher EndsWith( std::string const& str, CaseSensitive caseSensitivity ) { + return EndsWithMatcher( CasedString( str, caseSensitivity) ); + } + StartsWithMatcher StartsWith( std::string const& str, CaseSensitive caseSensitivity ) { + return StartsWithMatcher( CasedString( str, caseSensitivity) ); + } + + RegexMatcher Matches(std::string const& regex, CaseSensitive caseSensitivity) { + return RegexMatcher(regex, caseSensitivity); + } + +} // namespace Matchers +} // namespace Catch + + + +namespace Catch { +namespace Matchers { + MatcherGenericBase::~MatcherGenericBase() = default; + + namespace Detail { + + std::string describe_multi_matcher(StringRef combine, std::string const* descriptions_begin, std::string const* descriptions_end) { + std::string description; + std::size_t combined_size = 4; + for ( auto desc = descriptions_begin; desc != descriptions_end; ++desc ) { + combined_size += desc->size(); + } + combined_size += (descriptions_end - descriptions_begin - 1) * combine.size(); + + description.reserve(combined_size); + + description += "( "; + bool first = true; + for( auto desc = descriptions_begin; desc != descriptions_end; ++desc ) { + if( first ) + first = false; + else + description += combine; + description += *desc; + } + description += " )"; + return description; + } + + } // namespace Detail +} // namespace Matchers +} // namespace Catch + + +/** \file + * This is a special TU that combines what would otherwise be a very + * small matcher-related TUs into one bigger TU. + * + * The reason for this is compilation performance improvements by + * avoiding reparsing headers for many small TUs, instead having this + * one TU include bit more, but having it all parsed only once. + * + * To avoid heavy-tail problem with compilation times, each "subpart" + * of Catch2 has its own combined TU like this. + */ + +////////////////////////////////////////////// +// vvv formerly catch_matchers_impl.cpp vvv // +////////////////////////////////////////////// + +namespace Catch { + + // This is the general overload that takes a any string matcher + // There is another overload, in catch_assertionhandler.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 const& matcherString ) { + std::string exceptionMessage = Catch::translateActiveException(); + MatchExpr<std::string, StringMatcher const&> expr( std::move(exceptionMessage), matcher, matcherString ); + handler.handleExpr( expr ); + } + +} // namespace Catch + + +////////////////////////////////////////////////////////////// +// vvv formerly catch_matchers_container_properties.cpp vvv // +////////////////////////////////////////////////////////////// + +namespace Catch { +namespace Matchers { + + std::string IsEmptyMatcher::describe() const { + return "is empty"; + } + + std::string HasSizeMatcher::describe() const { + ReusableStringStream sstr; + sstr << "has size == " << m_target_size; + return sstr.str(); + } + + IsEmptyMatcher IsEmpty() { + return {}; + } + + HasSizeMatcher SizeIs(std::size_t sz) { + return HasSizeMatcher{ sz }; + } + +} // end namespace Matchers +} // end namespace Catch + + + +///////////////////////////////////////// +// vvv formerly catch_matchers.cpp vvv // +///////////////////////////////////////// + + +namespace Catch { +namespace Matchers { + + std::string MatcherUntypedBase::toString() const { + if (m_cachedToString.empty()) { + m_cachedToString = describe(); + } + return m_cachedToString; + } + + MatcherUntypedBase::~MatcherUntypedBase() = default; + +} // namespace Matchers +} // namespace Catch + + + +/////////////////////////////////////////////////// +// vvv formerly catch_matchers_predicate.cpp vvv // +/////////////////////////////////////////////////// + +std::string Catch::Matchers::Detail::finalizeDescription(const std::string& desc) { + if (desc.empty()) { + return "matches undescribed predicate"; + } else { + return "matches predicate: \"" + desc + '"'; + } +} + + + + + +/////////////////////////////////////////////////// +// vvv formerly catch_matchers_exception.cpp vvv // +/////////////////////////////////////////////////// + +namespace Catch { +namespace Matchers { + +bool ExceptionMessageMatcher::match(std::exception const& ex) const { + return ex.what() == m_message; +} + +std::string ExceptionMessageMatcher::describe() const { + return "exception message matches \"" + m_message + "\""; +} + +ExceptionMessageMatcher Message(std::string const& message) { + return ExceptionMessageMatcher(message); +} + +} // namespace Matchers +} // namespace Catch + + + +#include <ostream> + +namespace Catch { + + AutomakeReporter::~AutomakeReporter() {} + + void AutomakeReporter::testCaseEnded(TestCaseStats const& _testCaseStats) { + // 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 AutomakeReporter::skipTest(TestCaseInfo const& testInfo) { + stream << ":test-result: SKIP " << testInfo.name << '\n'; + } + +} // end namespace Catch + + +/** \file + * This is a special TU that combines what would otherwise be a very + * small reporter-related TUs into one bigger TU. + * + * The reason for this is compilation performance improvements by + * avoiding reparsing headers for many small TUs, instead having this + * one TU include bit more, but having it all parsed only once. + * + * To avoid heavy-tail problem with compilation times, each "subpart" + * of Catch2 has its own combined TU like this. + */ + + +#include <cfloat> +#include <cstdio> +#include <ostream> + +namespace Catch { + + // 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 + std::sprintf( buffer, "%.3f", duration ); +#endif + return std::string( buffer ); + } + + bool shouldShowDuration( IConfig const& config, double duration ) { + if ( config.showDurations() == ShowDurations::Always ) { + return true; + } + if ( config.showDurations() == ShowDurations::Never ) { + return false; + } + const double min = config.minDuration(); + return min >= 0 && duration >= min; + } + + std::string serializeFilters( std::vector<std::string> const& filters ) { + // We add a ' ' separator between each filter + size_t serialized_size = filters.size() - 1; + for (auto const& filter : filters) { + serialized_size += filter.size(); + } + + std::string serialized; + serialized.reserve(serialized_size); + bool first = true; + + for (auto const& filter : filters) { + if (!first) { + serialized.push_back(' '); + } + first = false; + serialized.append(filter); + } + + return serialized; + } + + std::ostream& operator<<( std::ostream& out, lineOfChars value ) { + for ( size_t idx = 0; idx < CATCH_CONFIG_CONSOLE_WIDTH - 1; ++idx ) { + out.put( value.c ); + } + return out; + } + +} // namespace Catch + + + +namespace Catch { + void EventListenerBase::assertionStarting( AssertionInfo const& ) {} + + bool EventListenerBase::assertionEnded( AssertionStats const& ) { + return false; + } + void + EventListenerBase::listReporters( std::vector<ReporterDescription> const&, + IConfig const& ) {} + void EventListenerBase::listTests( std::vector<TestCaseHandle> const&, + IConfig const& ) {} + void EventListenerBase::listTags( std::vector<TagInfo> const&, + IConfig const& ) {} + void EventListenerBase::noMatchingTestCases( std::string const& ) {} + void EventListenerBase::testRunStarting( TestRunInfo const& ) {} + void EventListenerBase::testGroupStarting( GroupInfo const& ) {} + void EventListenerBase::testCaseStarting( TestCaseInfo const& ) {} + void EventListenerBase::sectionStarting( SectionInfo const& ) {} + void EventListenerBase::sectionEnded( SectionStats const& ) {} + void EventListenerBase::testCaseEnded( TestCaseStats const& ) {} + void EventListenerBase::testGroupEnded( TestGroupStats const& ) {} + void EventListenerBase::testRunEnded( TestRunStats const& ) {} + void EventListenerBase::skipTest( TestCaseInfo const& ) {} +} // namespace Catch + + + + +#include <ostream> + +namespace { + + // Colour::LightGrey + Catch::Colour::Code dimColour() { return Catch::Colour::FileName; } + + Catch::StringRef bothOrAll( std::size_t count ) { + switch (count) { + case 1: + return Catch::StringRef{}; + case 2: + return "both "_catch_sr; + default: + return "all "_catch_sr; + } + } + +} // anon namespace + + +namespace Catch { +namespace { + +#ifdef CATCH_PLATFORM_MAC + static constexpr Catch::StringRef compactFailedString = "FAILED"_sr; + static constexpr Catch::StringRef compactPassedString = "PASSED"_sr; +#else + static constexpr Catch::StringRef compactFailedString = "failed"_sr; + static constexpr Catch::StringRef compactPassedString = "passed"_sr; +#endif + +// 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 StringRef qualify_assertions_failed = + totals.assertions.failed == totals.assertions.total() ? + bothOrAll(totals.assertions.failed) : StringRef{}; + 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, compactPassedString); + printOriginalExpression(); + printReconstructedExpression(); + if (!result.hasExpression()) + printRemainingMessages(Colour::None); + else + printRemainingMessages(); + break; + case ResultWas::ExpressionFailed: + if (result.isOk()) + printResultType(Colour::ResultSuccess, compactFailedString + " - but was ok"_sr); + else + printResultType(Colour::Error, compactFailedString); + printOriginalExpression(); + printReconstructedExpression(); + printRemainingMessages(); + break; + case ResultWas::ThrewException: + printResultType(Colour::Error, compactFailedString); + printIssue("unexpected exception with message:"); + printMessage(); + printExpressionWas(); + printRemainingMessages(); + break; + case ResultWas::FatalErrorCondition: + printResultType(Colour::Error, compactFailedString); + printIssue("fatal error condition with message:"); + printMessage(); + printExpressionWas(); + printRemainingMessages(); + break; + case ResultWas::DidntThrowException: + printResultType(Colour::Error, compactFailedString); + printIssue("expected exception, got none"); + printExpressionWas(); + printRemainingMessages(); + break; + case ResultWas::Info: + printResultType(Colour::None, "info"_sr); + printMessage(); + printRemainingMessages(); + break; + case ResultWas::Warning: + printResultType(Colour::None, "warning"_sr); + printMessage(); + printRemainingMessages(); + break; + case ResultWas::ExplicitFailure: + printResultType(Colour::Error, compactFailedString); + 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, StringRef passOrFail) const { + if (!passOrFail.empty()) { + { + Colour colourGuard(colour); + stream << ' ' << passOrFail; + } + stream << ':'; + } + } + + void printIssue(char 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; + + const auto itEnd = messages.cend(); + const auto N = static_cast<std::size_t>(std::distance(itMessage, itEnd)); + + { + Colour colourGuard(colour); + stream << " with " << pluralise(N, "message") << ':'; + } + + while (itMessage != itEnd) { + // If this assertion is a warning ignore any INFO messages + if (printInfoMessages || itMessage->type != ResultWas::Info) { + printMessage(); + if (itMessage != itEnd) { + Colour colourGuard(dimColour()); + stream << " and"; + } + continue; + } + ++itMessage; + } + } + +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"; + } + + 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) { + double dur = _sectionStats.durationInSeconds; + if ( shouldShowDuration( *m_config, dur ) ) { + stream << getFormattedDuration( dur ) << " 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() {} + +} // end namespace Catch + + + + +#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 + +#if defined(__clang__) +# pragma clang diagnostic push +// For simplicity, benchmarking-only helpers are always enabled +# pragma clang diagnostic ignored "-Wunused-function" +#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) { + 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 << TextFlow::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 << TextFlow::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; +} + +enum class Justification { Left, Right }; + +struct ColumnInfo { + 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; + + double m_inNanoseconds; + Unit m_units; + +public: + explicit Duration(double 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 m_inNanoseconds; + } + } + StringRef unitsAsString() const { + switch (m_units) { + case Unit::Nanoseconds: + return "ns"_sr; + case Unit::Microseconds: + return "us"_sr; + case Unit::Milliseconds: + return "ms"_sr; + case Unit::Seconds: + return "s"_sr; + case Unit::Minutes: + return "m"_sr; + default: + return "** internal error **"_sr; + } + + } + 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; + ReusableStringStream 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(); + + TextFlow::Columns headerCols; + auto spacer = TextFlow::Spacer(2); + for (auto const& info : m_columnInfos) { + headerCols += TextFlow::Column(info.name).width(static_cast<std::size_t>(info.width - 2)); + headerCols += spacer; + } + m_os << headerCols << '\n'; + + m_os << lineOfChars('-') << '\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(); + const auto strSize = colStr.size(); + 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 + 1 < static_cast<std::size_t>(colInfo.width)) + ? std::string(colInfo.width - (strSize + 1), ' ') + : std::string(); + if (colInfo.justification == Justification::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(), + [&config]() -> std::vector<ColumnInfo> { + if (config.fullConfig()->benchmarkNoAnalysis()) + { + return{ + { "benchmark name", CATCH_CONFIG_CONSOLE_WIDTH - 43, Justification::Left }, + { " samples", 14, Justification::Right }, + { " iterations", 14, Justification::Right }, + { " mean", 14, Justification::Right } + }; + } + else + { + return{ + { "benchmark name", CATCH_CONFIG_CONSOLE_WIDTH - 43, Justification::Left }, + { "samples mean std dev", 14, Justification::Right }, + { "iterations low mean low std dev", 14, Justification::Right }, + { "estimated high mean high std dev", 14, Justification::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::reportInvalidArguments(std::string const&arg){ + stream << "Invalid Filter: " << arg << 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_tablePrinter->close(); + 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; + } + double dur = _sectionStats.durationInSeconds; + if (shouldShowDuration(*m_config, dur)) { + stream << getFormattedDuration(dur) << " s: " << _sectionStats.sectionInfo.name << std::endl; + } + if (m_headerPrinted) { + m_headerPrinted = false; + } + StreamingReporterBase::sectionEnded(_sectionStats); +} + +void ConsoleReporter::benchmarkPreparing(std::string const& name) { + lazyPrintWithoutClosingBenchmarkTable(); + + auto nameCol = TextFlow::Column(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::benchmarkStarting(BenchmarkInfo const& info) { + (*m_tablePrinter) << info.samples << ColumnBreak() + << info.iterations << ColumnBreak(); + if (!m_config->benchmarkNoAnalysis()) + (*m_tablePrinter) << Duration(info.estimatedDuration) << ColumnBreak(); +} +void ConsoleReporter::benchmarkEnded(BenchmarkStats<> const& stats) { + if (m_config->benchmarkNoAnalysis()) + { + (*m_tablePrinter) << Duration(stats.mean.point.count()) << ColumnBreak(); + } + else + { + (*m_tablePrinter) << ColumnBreak() + << Duration(stats.mean.point.count()) << ColumnBreak() + << Duration(stats.mean.lower_bound.count()) << ColumnBreak() + << Duration(stats.mean.upper_bound.count()) << ColumnBreak() << ColumnBreak() + << Duration(stats.standardDeviation.point.count()) << ColumnBreak() + << Duration(stats.standardDeviation.lower_bound.count()) << ColumnBreak() + << Duration(stats.standardDeviation.upper_bound.count()) << ColumnBreak() << ColumnBreak() << ColumnBreak() << ColumnBreak() << ColumnBreak(); + } +} + +void ConsoleReporter::benchmarkFailed(std::string const& error) { + Colour colour(Colour::Red); + (*m_tablePrinter) + << "Benchmark failed (" << error << ')' + << ColumnBreak() << RowBreak(); +} + +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::testRunStarting(TestRunInfo const& _testInfo) { + StreamingReporterBase::testRunStarting(_testInfo); + printTestFilters(); +} + +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' << lineOfChars('~') << '\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; + + + stream << lineOfChars('-') << '\n'; + Colour colourGuard(Colour::FileName); + stream << lineInfo << '\n'; + stream << lineOfChars('.') << '\n' << std::endl; +} + +void ConsoleReporter::printClosedHeader(std::string const& _name) { + printOpenHeader(_name); + stream << lineOfChars('.') << '\n'; +} +void ConsoleReporter::printOpenHeader(std::string const& _name) { + stream << lineOfChars('-') << '\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 << TextFlow::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 << lineOfChars('-') << '\n'; +} + +void ConsoleReporter::printTestFilters() { + if (m_config->testSpec().hasFilters()) { + Colour guard(Colour::BrightYellow); + stream << "Filters: " << serializeFilters(m_config->getTestsOrTags()) << '\n'; + } +} + +} // end namespace Catch + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif + + + +#include <algorithm> +#include <cassert> + +namespace Catch { + namespace { + struct BySectionInfo { + BySectionInfo( SectionInfo const& other ): m_other( other ) {} + BySectionInfo( BySectionInfo const& other ): + m_other( other.m_other ) {} + bool operator()( + std::shared_ptr<CumulativeReporterBase::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; + }; + + void prepareExpandedExpression( AssertionResult& result ) { + result.getExpandedExpression(); + } + } // namespace + + + CumulativeReporterBase::~CumulativeReporterBase() = default; + + void + CumulativeReporterBase::sectionStarting( SectionInfo const& sectionInfo ) { + 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 ); + } + + bool CumulativeReporterBase::assertionEnded( + AssertionStats const& assertionStats ) { + 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 CumulativeReporterBase::sectionEnded( SectionStats const& sectionStats ) { + assert( !m_sectionStack.empty() ); + SectionNode& node = *m_sectionStack.back(); + node.stats = sectionStats; + m_sectionStack.pop_back(); + } + + void CumulativeReporterBase::testCaseEnded( + TestCaseStats const& testCaseStats ) { + 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 CumulativeReporterBase::testGroupEnded( + TestGroupStats const& testGroupStats ) { + auto node = std::make_shared<TestGroupNode>( testGroupStats ); + node->children.swap( m_testCases ); + m_testGroups.push_back( node ); + } + + void CumulativeReporterBase::testRunEnded( TestRunStats const& testRunStats ) { + auto node = std::make_shared<TestRunNode>( testRunStats ); + node->children.swap( m_testGroups ); + m_testRuns.push_back( node ); + testRunEndedCumulative(); + } + +} // end namespace Catch + + + + +#include <cassert> +#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(std::vector<Tag> const& tags) { + auto it = std::find_if(begin(tags), + end(tags), + [] (Tag const& tag) { + return tag.original.size() > 0 + && tag.original[0] == '#'; }); + if (it != tags.end()) { + return static_cast<std::string>( + it->original.substr(1, it->original.size() - 1) + ); + } + return std::string(); + } + } // anonymous namespace + + JunitReporter::JunitReporter( ReporterConfig const& _config ) + : CumulativeReporterBase( _config ), + xml( _config.stream() ) + { + m_preferences.shouldRedirectStdOut = true; + m_preferences.shouldReportAllAssertions = 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 properties if there are any + if (m_config->hasTestFilters() || m_config->rngSeed() != 0) { + auto properties = xml.scopedElement("properties"); + if (m_config->hasTestFilters()) { + xml.scopedElement("property") + .writeAttribute("name", "filters") + .writeAttribute("value", serializeFilters(m_config->getTestsOrTags())); + } + if (m_config->rngSeed() != 0) { + xml.scopedElement("property") + .writeAttribute("name", "random-seed") + .writeAttribute("value", m_config->rngSeed()); + } + } + + // Write test cases + for( auto const& child : groupNode.children ) + writeTestCase( *child ); + + xml.scopedElement( "system-out" ).writeText( trim( stdOutForSuite ), XmlFormatting::Newline ); + xml.scopedElement( "system-err" ).writeText( trim( stdErrForSuite ), XmlFormatting::Newline ); + } + + 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 ) ); + // This is not ideal, but it should be enough to mimic gtest's + // junit output. + // Ideally the JUnit reporter would also handle `skipTest` + // events and write those out appropriately. + xml.writeAttribute( "status", "run" ); + + writeAssertions( sectionNode ); + + if( !sectionNode.stdOut.empty() ) + xml.scopedElement( "system-out" ).writeText( trim( sectionNode.stdOut ), XmlFormatting::Newline ); + if( !sectionNode.stdErr.empty() ) + xml.scopedElement( "system-err" ).writeText( trim( sectionNode.stdErr ), XmlFormatting::Newline ); + } + 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: + case ResultWas::ExpressionFailed: + 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.getExpression() ); + xml.writeAttribute( "type", result.getTestMacroName() ); + + ReusableStringStream rss; + if (stats.totals.assertions.total() > 0) { + rss << "FAILED" << ":\n"; + if (result.hasExpression()) { + rss << " "; + rss << result.getExpressionInMacro(); + rss << '\n'; + } + if (result.hasExpandedExpression()) { + rss << "with expansion:\n"; + rss << TextFlow::Column(result.getExpandedExpression()).indent(2) << '\n'; + } + } else { + rss << '\n'; + } + + 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(), XmlFormatting::Newline ); + } + } + +} // end namespace Catch + + + +#include <cassert> + +namespace Catch { + + ListeningReporter::ListeningReporter() { + // We will assume that listeners will always want all assertions + m_preferences.shouldReportAllAssertions = true; + } + + void ListeningReporter::addListener( IStreamingReporterPtr&& listener ) { + m_listeners.push_back( std::move( listener ) ); + } + + void ListeningReporter::addReporter(IStreamingReporterPtr&& reporter) { + assert(!m_reporter && "Listening reporter can wrap only 1 real reporter"); + m_reporter = std::move( reporter ); + m_preferences.shouldRedirectStdOut = m_reporter->getPreferences().shouldRedirectStdOut; + } + + void ListeningReporter::noMatchingTestCases( std::string const& spec ) { + for ( auto const& listener : m_listeners ) { + listener->noMatchingTestCases( spec ); + } + m_reporter->noMatchingTestCases( spec ); + } + + void ListeningReporter::reportInvalidArguments(std::string const&arg){ + for ( auto const& listener : m_listeners ) { + listener->reportInvalidArguments( arg ); + } + m_reporter->reportInvalidArguments( arg ); + } + + void ListeningReporter::benchmarkPreparing( std::string const& name ) { + for (auto const& listener : m_listeners) { + listener->benchmarkPreparing(name); + } + m_reporter->benchmarkPreparing(name); + } + void ListeningReporter::benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) { + for ( auto const& listener : m_listeners ) { + listener->benchmarkStarting( benchmarkInfo ); + } + m_reporter->benchmarkStarting( benchmarkInfo ); + } + void ListeningReporter::benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) { + for ( auto const& listener : m_listeners ) { + listener->benchmarkEnded( benchmarkStats ); + } + m_reporter->benchmarkEnded( benchmarkStats ); + } + + void ListeningReporter::benchmarkFailed( std::string const& error ) { + for (auto const& listener : m_listeners) { + listener->benchmarkFailed(error); + } + m_reporter->benchmarkFailed(error); + } + + void ListeningReporter::testRunStarting( TestRunInfo const& testRunInfo ) { + for ( auto const& listener : m_listeners ) { + listener->testRunStarting( testRunInfo ); + } + m_reporter->testRunStarting( testRunInfo ); + } + + void ListeningReporter::testGroupStarting( GroupInfo const& groupInfo ) { + for ( auto const& listener : m_listeners ) { + listener->testGroupStarting( groupInfo ); + } + m_reporter->testGroupStarting( groupInfo ); + } + + + void ListeningReporter::testCaseStarting( TestCaseInfo const& testInfo ) { + for ( auto const& listener : m_listeners ) { + listener->testCaseStarting( testInfo ); + } + m_reporter->testCaseStarting( testInfo ); + } + + void ListeningReporter::sectionStarting( SectionInfo const& sectionInfo ) { + for ( auto const& listener : m_listeners ) { + listener->sectionStarting( sectionInfo ); + } + m_reporter->sectionStarting( sectionInfo ); + } + + void ListeningReporter::assertionStarting( AssertionInfo const& assertionInfo ) { + for ( auto const& listener : m_listeners ) { + listener->assertionStarting( assertionInfo ); + } + m_reporter->assertionStarting( assertionInfo ); + } + + // The return value indicates if the messages buffer should be cleared: + bool ListeningReporter::assertionEnded( AssertionStats const& assertionStats ) { + for( auto const& listener : m_listeners ) { + static_cast<void>( listener->assertionEnded( assertionStats ) ); + } + return m_reporter->assertionEnded( assertionStats ); + } + + void ListeningReporter::sectionEnded( SectionStats const& sectionStats ) { + for ( auto const& listener : m_listeners ) { + listener->sectionEnded( sectionStats ); + } + m_reporter->sectionEnded( sectionStats ); + } + + void ListeningReporter::testCaseEnded( TestCaseStats const& testCaseStats ) { + for ( auto const& listener : m_listeners ) { + listener->testCaseEnded( testCaseStats ); + } + m_reporter->testCaseEnded( testCaseStats ); + } + + void ListeningReporter::testGroupEnded( TestGroupStats const& testGroupStats ) { + for ( auto const& listener : m_listeners ) { + listener->testGroupEnded( testGroupStats ); + } + m_reporter->testGroupEnded( testGroupStats ); + } + + void ListeningReporter::testRunEnded( TestRunStats const& testRunStats ) { + for ( auto const& listener : m_listeners ) { + listener->testRunEnded( testRunStats ); + } + m_reporter->testRunEnded( testRunStats ); + } + + + void ListeningReporter::skipTest( TestCaseInfo const& testInfo ) { + for ( auto const& listener : m_listeners ) { + listener->skipTest( testInfo ); + } + m_reporter->skipTest( testInfo ); + } + + void ListeningReporter::listReporters(std::vector<ReporterDescription> const& descriptions, IConfig const& config) { + for (auto const& listener : m_listeners) { + listener->listReporters(descriptions, config); + } + m_reporter->listReporters(descriptions, config); + } + + void ListeningReporter::listTests(std::vector<TestCaseHandle> const& tests, IConfig const& config) { + for (auto const& listener : m_listeners) { + listener->listTests(tests, config); + } + m_reporter->listTests(tests, config); + } + + void ListeningReporter::listTags(std::vector<TagInfo> const& tags, IConfig const& config) { + for (auto const& listener : m_listeners) { + listener->listTags(tags, config); + } + m_reporter->listTags(tags, config); + } + +} // end namespace Catch + + + + +#include <map> + +namespace Catch { + + SonarQubeReporter::~SonarQubeReporter() {} + + void SonarQubeReporter::testRunStarting(TestRunInfo const& testRunInfo) { + CumulativeReporterBase::testRunStarting(testRunInfo); + xml.startElement("testExecutions"); + xml.writeAttribute("version", '1'); + } + + void SonarQubeReporter::testGroupEnded(TestGroupStats const& testGroupStats) { + CumulativeReporterBase::testGroupEnded(testGroupStats); + writeGroup(*m_testGroups.back()); + } + + void SonarQubeReporter::writeGroup(TestGroupNode const& groupNode) { + std::map<std::string, TestGroupNode::ChildNodes> testsPerFile; + for (auto const& child : groupNode.children) + testsPerFile[child->value.testInfo->lineInfo.file].push_back(child); + + for (auto const& kv : testsPerFile) + writeTestFile(kv.first, kv.second); + } + + void SonarQubeReporter::writeTestFile(std::string const& filename, TestGroupNode::ChildNodes const& testCaseNodes) { + XmlWriter::ScopedElement e = xml.scopedElement("file"); + xml.writeAttribute("path", filename); + + for (auto const& child : testCaseNodes) + writeTestCase(*child); + } + + void SonarQubeReporter::writeTestCase(TestCaseNode const& testCaseNode) { + // 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(); + writeSection("", rootSection, testCaseNode.value.testInfo->okToFail()); + } + + void SonarQubeReporter::writeSection(std::string const& rootName, SectionNode const& sectionNode, bool okToFail) { + 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"); + xml.writeAttribute("name", name); + xml.writeAttribute("duration", static_cast<long>(sectionNode.stats.durationInSeconds * 1000)); + + writeAssertions(sectionNode, okToFail); + } + + for (auto const& childNode : sectionNode.childSections) + writeSection(name, *childNode, okToFail); + } + + void SonarQubeReporter::writeAssertions(SectionNode const& sectionNode, bool okToFail) { + for (auto const& assertion : sectionNode.assertions) + writeAssertion(assertion, okToFail); + } + + void SonarQubeReporter::writeAssertion(AssertionStats const& stats, bool okToFail) { + AssertionResult const& result = stats.assertionResult; + if (!result.isOk()) { + std::string elementName; + if (okToFail) { + elementName = "skipped"; + } else { + 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); + + ReusableStringStream messageRss; + messageRss << result.getTestMacroName() << "(" << result.getExpression() << ")"; + xml.writeAttribute("message", messageRss.str()); + + ReusableStringStream textRss; + if (stats.totals.assertions.total() > 0) { + textRss << "FAILED:\n"; + if (result.hasExpression()) { + textRss << "\t" << result.getExpressionInMacro() << "\n"; + } + if (result.hasExpandedExpression()) { + textRss << "with expansion:\n\t" << result.getExpandedExpression() << "\n"; + } + } + + if (!result.getMessage().empty()) + textRss << result.getMessage() << "\n"; + + for (auto const& msg : stats.infoMessages) + if (msg.type == ResultWas::Info) + textRss << msg.message << "\n"; + + textRss << "at " << result.getSourceInfo(); + xml.writeText(textRss.str(), XmlFormatting::Newline); + } + } + +} // end namespace Catch + + + +namespace Catch { + + StreamingReporterBase::~StreamingReporterBase() = default; + + void + StreamingReporterBase::testRunStarting( TestRunInfo const& _testRunInfo ) { + currentTestRunInfo = _testRunInfo; + } + + void + StreamingReporterBase::testGroupStarting( GroupInfo const& _groupInfo ) { + currentGroupInfo = _groupInfo; + } + + void StreamingReporterBase::testGroupEnded( TestGroupStats const& ) { + currentGroupInfo.reset(); + } + + void StreamingReporterBase::testRunEnded( TestRunStats const& ) { + currentTestCaseInfo = nullptr; + currentGroupInfo.reset(); + currentTestRunInfo.reset(); + } + +} // end namespace Catch + + + +#include <algorithm> +#include <ostream> + +namespace Catch { + + namespace { + // Yes, this has to be outside the class and namespaced by naming. + // Making older compiler happy is hard. + static constexpr StringRef tapFailedString = "not ok"_sr; + static constexpr StringRef tapPassedString = "ok"_sr; + + class TapAssertionPrinter { + public: + TapAssertionPrinter& operator= (TapAssertionPrinter const&) = delete; + TapAssertionPrinter(TapAssertionPrinter const&) = delete; + TapAssertionPrinter(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(tapPassedString); + printOriginalExpression(); + printReconstructedExpression(); + if (!result.hasExpression()) + printRemainingMessages(Colour::None); + else + printRemainingMessages(); + break; + case ResultWas::ExpressionFailed: + if (result.isOk()) { + printResultType(tapPassedString); + } else { + printResultType(tapFailedString); + } + printOriginalExpression(); + printReconstructedExpression(); + if (result.isOk()) { + printIssue(" # TODO"); + } + printRemainingMessages(); + break; + case ResultWas::ThrewException: + printResultType(tapFailedString); + printIssue("unexpected exception with message:"_sr); + printMessage(); + printExpressionWas(); + printRemainingMessages(); + break; + case ResultWas::FatalErrorCondition: + printResultType(tapFailedString); + printIssue("fatal error condition with message:"_sr); + printMessage(); + printExpressionWas(); + printRemainingMessages(); + break; + case ResultWas::DidntThrowException: + printResultType(tapFailedString); + printIssue("expected exception, got none"_sr); + printExpressionWas(); + printRemainingMessages(); + break; + case ResultWas::Info: + printResultType("info"_sr); + printMessage(); + printRemainingMessages(); + break; + case ResultWas::Warning: + printResultType("warning"_sr); + printMessage(); + printRemainingMessages(); + break; + case ResultWas::ExplicitFailure: + printResultType(tapFailedString); + printIssue("explicitly"_sr); + printRemainingMessages(Colour::None); + break; + // These cases are here to prevent compiler warnings + case ResultWas::Unknown: + case ResultWas::FailureBit: + case ResultWas::Exception: + printResultType("** internal error **"_sr); + break; + } + } + + private: + static Colour::Code dimColour() { return Colour::FileName; } + + void printSourceInfo() const { + Colour colourGuard(dimColour()); + stream << result.getSourceInfo() << ':'; + } + + void printResultType(StringRef passOrFail) const { + if (!passOrFail.empty()) { + stream << passOrFail << ' ' << counter << " -"; + } + } + + void printIssue(StringRef 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; + }; + + } // End anonymous namespace + + TAPReporter::~TAPReporter() {} + + void TAPReporter::noMatchingTestCases(std::string const& spec) { + stream << "# No test cases matched '" << spec << "'\n"; + } + + bool TAPReporter::assertionEnded(AssertionStats const& _assertionStats) { + ++counter; + + stream << "# " << currentTestCaseInfo->name << '\n'; + TapAssertionPrinter printer(stream, _assertionStats, counter); + printer.print(); + + stream << '\n' << std::flush; + return true; + } + + void TAPReporter::testRunEnded(TestRunStats const& _testRunStats) { + stream << "1.." << _testRunStats.totals.assertions.total(); + if (_testRunStats.totals.testCases.total() == 0) { + stream << " # Skipped: No tests ran."; + } + stream << "\n\n" << std::flush; + StreamingReporterBase::testRunEnded(_testRunStats); + } + + + + +} // end namespace Catch + + + + +#include <cassert> + +namespace Catch { + + namespace { + // if string has a : in first line will set indent to follow it on + // subsequent lines + 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 << TextFlow::Column(_string) + .indent(indent + i) + .initialIndent(indent) << '\n'; + } + + 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; + } + } // end anonymous namespace + + + TeamCityReporter::~TeamCityReporter() {} + + void TeamCityReporter::testGroupStarting(GroupInfo const& groupInfo) { + StreamingReporterBase::testGroupStarting(groupInfo); + stream << "##teamcity[testSuiteStarted name='" + << escape(groupInfo.name) << "']\n"; + } + + void TeamCityReporter::testGroupEnded(TestGroupStats const& testGroupStats) { + StreamingReporterBase::testGroupEnded(testGroupStats); + stream << "##teamcity[testSuiteFinished name='" + << escape(testGroupStats.groupInfo.name) << "']\n"; + } + + bool TeamCityReporter::assertionEnded(AssertionStats const& assertionStats) { + 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: + CATCH_ERROR("Internal error in TeamCity reporter"); + // These cases are here to prevent compiler warnings + case ResultWas::Unknown: + case ResultWas::FailureBit: + case ResultWas::Exception: + CATCH_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 TeamCityReporter::testCaseStarting(TestCaseInfo const& testInfo) { + m_testTimer.start(); + StreamingReporterBase::testCaseStarting(testInfo); + stream << "##teamcity[testStarted name='" + << escape(testInfo.name) << "']\n"; + stream.flush(); + } + + void TeamCityReporter::testCaseEnded(TestCaseStats const& testCaseStats) { + StreamingReporterBase::testCaseEnded(testCaseStats); + auto const& testCaseInfo = *testCaseStats.testInfo; + if (!testCaseStats.stdOut.empty()) + stream << "##teamcity[testStdOut name='" + << escape(testCaseInfo.name) + << "' out='" << escape(testCaseStats.stdOut) << "']\n"; + if (!testCaseStats.stdErr.empty()) + stream << "##teamcity[testStdErr name='" + << escape(testCaseInfo.name) + << "' out='" << escape(testCaseStats.stdErr) << "']\n"; + stream << "##teamcity[testFinished name='" + << escape(testCaseInfo.name) << "' duration='" + << m_testTimer.getElapsedMilliseconds() << "']\n"; + stream.flush(); + } + + void TeamCityReporter::printSectionHeader(std::ostream& os) { + assert(!m_sectionStack.empty()); + + if (m_sectionStack.size() > 1) { + os << lineOfChars('-') << '\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 << lineOfChars('-') << '\n'; + } + + SourceLineInfo lineInfo = m_sectionStack.front().lineInfo; + + os << lineInfo << '\n'; + os << lineOfChars('.') << "\n\n"; + } + +} // end namespace Catch + + + + +#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_preferences.shouldRedirectStdOut = true; + m_preferences.shouldReportAllAssertions = 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() ); + if (m_config->testSpec().hasFilters()) + m_xml.writeAttribute( "filters", serializeFilters( m_config->getTestsOrTags() ) ); + if( m_config->rngSeed() != 0 ) + m_xml.scopedElement( "Randomness" ) + .writeAttribute( "seed", m_config->rngSeed() ); + } + + 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( "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 ) ); + 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 ), XmlFormatting::Newline ); + if( !testCaseStats.stdErr.empty() ) + m_xml.scopedElement( "StdErr" ).writeText( trim( testCaseStats.stdErr ), XmlFormatting::Newline ); + + 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.scopedElement( "OverallResultsCases") + .writeAttribute( "successes", testGroupStats.totals.testCases.passed ) + .writeAttribute( "failures", testGroupStats.totals.testCases.failed ) + .writeAttribute( "expectedFailures", testGroupStats.totals.testCases.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.scopedElement( "OverallResultsCases") + .writeAttribute( "successes", testRunStats.totals.testCases.passed ) + .writeAttribute( "failures", testRunStats.totals.testCases.failed ) + .writeAttribute( "expectedFailures", testRunStats.totals.testCases.failedButOk ); + m_xml.endElement(); + } + + void XmlReporter::benchmarkPreparing(std::string const& name) { + m_xml.startElement("BenchmarkResults") + .writeAttribute("name", name); + } + + void XmlReporter::benchmarkStarting(BenchmarkInfo const &info) { + m_xml.writeAttribute("samples", info.samples) + .writeAttribute("resamples", info.resamples) + .writeAttribute("iterations", info.iterations) + .writeAttribute("clockResolution", info.clockResolution) + .writeAttribute("estimatedDuration", info.estimatedDuration) + .writeComment("All values in nano seconds"); + } + + void XmlReporter::benchmarkEnded(BenchmarkStats<> const& benchmarkStats) { + m_xml.startElement("mean") + .writeAttribute("value", benchmarkStats.mean.point.count()) + .writeAttribute("lowerBound", benchmarkStats.mean.lower_bound.count()) + .writeAttribute("upperBound", benchmarkStats.mean.upper_bound.count()) + .writeAttribute("ci", benchmarkStats.mean.confidence_interval); + m_xml.endElement(); + m_xml.startElement("standardDeviation") + .writeAttribute("value", benchmarkStats.standardDeviation.point.count()) + .writeAttribute("lowerBound", benchmarkStats.standardDeviation.lower_bound.count()) + .writeAttribute("upperBound", benchmarkStats.standardDeviation.upper_bound.count()) + .writeAttribute("ci", benchmarkStats.standardDeviation.confidence_interval); + m_xml.endElement(); + m_xml.startElement("outliers") + .writeAttribute("variance", benchmarkStats.outlierVariance) + .writeAttribute("lowMild", benchmarkStats.outliers.low_mild) + .writeAttribute("lowSevere", benchmarkStats.outliers.low_severe) + .writeAttribute("highMild", benchmarkStats.outliers.high_mild) + .writeAttribute("highSevere", benchmarkStats.outliers.high_severe); + m_xml.endElement(); + m_xml.endElement(); + } + + void XmlReporter::benchmarkFailed(std::string const &error) { + m_xml.scopedElement("failed"). + writeAttribute("message", error); + m_xml.endElement(); + } + + void XmlReporter::listReporters(std::vector<ReporterDescription> const& descriptions, IConfig const&) { + auto outerTag = m_xml.scopedElement("AvailableReporters"); + for (auto const& reporter : descriptions) { + auto inner = m_xml.scopedElement("Reporter"); + m_xml.startElement("Name", XmlFormatting::Indent) + .writeText(reporter.name, XmlFormatting::None) + .endElement(XmlFormatting::Newline); + m_xml.startElement("Description", XmlFormatting::Indent) + .writeText(reporter.description, XmlFormatting::None) + .endElement(XmlFormatting::Newline); + } + } + + void XmlReporter::listTests(std::vector<TestCaseHandle> const& tests, IConfig const&) { + auto outerTag = m_xml.scopedElement("MatchingTests"); + for (auto const& test : tests) { + auto innerTag = m_xml.scopedElement("TestCase"); + auto const& testInfo = test.getTestCaseInfo(); + m_xml.startElement("Name", XmlFormatting::Indent) + .writeText(testInfo.name, XmlFormatting::None) + .endElement(XmlFormatting::Newline); + m_xml.startElement("ClassName", XmlFormatting::Indent) + .writeText(testInfo.className, XmlFormatting::None) + .endElement(XmlFormatting::Newline); + m_xml.startElement("Tags", XmlFormatting::Indent) + .writeText(testInfo.tagsAsString(), XmlFormatting::None) + .endElement(XmlFormatting::Newline); + + auto sourceTag = m_xml.scopedElement("SourceInfo"); + m_xml.startElement("File", XmlFormatting::Indent) + .writeText(testInfo.lineInfo.file, XmlFormatting::None) + .endElement(XmlFormatting::Newline); + m_xml.startElement("Line", XmlFormatting::Indent) + .writeText(std::to_string(testInfo.lineInfo.line), XmlFormatting::None) + .endElement(XmlFormatting::Newline); + } + } + + void XmlReporter::listTags(std::vector<TagInfo> const& tags, IConfig const&) { + auto outerTag = m_xml.scopedElement("TagsFromMatchingTests"); + for (auto const& tag : tags) { + auto innerTag = m_xml.scopedElement("Tag"); + m_xml.startElement("Count", XmlFormatting::Indent) + .writeText(std::to_string(tag.count), XmlFormatting::None) + .endElement(XmlFormatting::Newline); + auto aliasTag = m_xml.scopedElement("Aliases"); + for (auto const& alias : tag.spellings) { + m_xml.startElement("Alias", XmlFormatting::Indent) + .writeText(static_cast<std::string>(alias), XmlFormatting::None) + .endElement(XmlFormatting::Newline); + } + } + } + +} // end namespace Catch + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif diff --git a/packages/Catch2/extras/catch_amalgamated.hpp b/packages/Catch2/extras/catch_amalgamated.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7f832413c6be01d4ac834cdbc3a4361a40a375c7 --- /dev/null +++ b/packages/Catch2/extras/catch_amalgamated.hpp @@ -0,0 +1,10987 @@ +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +// Catch v3.0.0-preview.3 +// Generated: 2020-10-08 13:59:26.309308 +// ---------------------------------------------------------- +// This file is an amalgamation of multiple different files. +// You probably shouldn't edit it directly. +// ---------------------------------------------------------- +#ifndef CATCH_AMALGAMATED_HPP_INCLUDED +#define CATCH_AMALGAMATED_HPP_INCLUDED + + +/** \file + * This is a convenience header for Catch2. It includes **all** of Catch2 headers. + * + * Generally the Catch2 users should use specific includes they need, + * but this header can be used instead for ease-of-experimentation, or + * just plain convenience, at the cost of (significantly) increased + * compilation times. + * + * When a new header is added to either the top level folder, or to the + * corresponding internal subfolder, it should be added here. Headers + * added to the various subparts (e.g. matchers, generators, etc...), + * should go their respective catch-all headers. + */ + +#ifndef CATCH_ALL_HPP_INCLUDED +#define CATCH_ALL_HPP_INCLUDED + + + +/** \file + * This is a convenience header for Catch2's benchmarking. It includes + * **all** of Catch2 headers related to benchmarking. + * + * Generally the Catch2 users should use specific includes they need, + * but this header can be used instead for ease-of-experimentation, or + * just plain convenience, at the cost of (significantly) increased + * compilation times. + * + * When a new header is added to either the `benchmark` folder, or to + * the corresponding internal (detail) subfolder, it should be added here. + */ + +#ifndef CATCH_BENCHMARK_ALL_HPP_INCLUDED +#define CATCH_BENCHMARK_ALL_HPP_INCLUDED + + + +// Adapted from donated nonius code. + +#ifndef CATCH_BENCHMARK_HPP_INCLUDED +#define CATCH_BENCHMARK_HPP_INCLUDED + + + +#ifndef CATCH_INTERFACES_CONFIG_HPP_INCLUDED +#define CATCH_INTERFACES_CONFIG_HPP_INCLUDED + + + +#ifndef CATCH_NONCOPYABLE_HPP_INCLUDED +#define CATCH_NONCOPYABLE_HPP_INCLUDED + +namespace Catch { + namespace Detail { + + //! Deriving classes become noncopyable and nonmovable + class NonCopyable { + NonCopyable( NonCopyable const& ) = delete; + NonCopyable( NonCopyable&& ) = delete; + NonCopyable& operator=( NonCopyable const& ) = delete; + NonCopyable& operator=( NonCopyable&& ) = delete; + + protected: + NonCopyable() noexcept = default; + }; + + } // namespace Detail +} // namespace Catch + +#endif // CATCH_NONCOPYABLE_HPP_INCLUDED + +#include <chrono> +#include <iosfwd> +#include <string> +#include <vector> + +namespace Catch { + + enum class Verbosity { + Quiet = 0, + Normal, + High + }; + + struct WarnAbout { enum What { + Nothing = 0x00, + NoAssertions = 0x01, + NoTests = 0x02 + }; }; + + enum class ShowDurations { + DefaultForReporter, + Always, + Never + }; + enum class TestRunOrder { + Declared, + LexicographicallySorted, + Randomized + }; + enum class UseColour { + Auto, + Yes, + No + }; + struct WaitForKeypress { enum When { + Never, + BeforeStart = 1, + BeforeExit = 2, + BeforeStartAndExit = BeforeStart | BeforeExit + }; }; + + class TestSpec; + + struct IConfig : Detail::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 bool warnAboutNoTests() const = 0; + virtual int abortAfter() const = 0; + virtual bool showInvisibles() const = 0; + virtual ShowDurations showDurations() const = 0; + virtual double minDuration() const = 0; + virtual TestSpec const& testSpec() const = 0; + virtual bool hasTestFilters() const = 0; + virtual std::vector<std::string> const& getTestsOrTags() const = 0; + virtual TestRunOrder runOrder() const = 0; + virtual unsigned int rngSeed() const = 0; + virtual UseColour useColour() const = 0; + virtual std::vector<std::string> const& getSectionsToRun() const = 0; + virtual Verbosity verbosity() const = 0; + + virtual bool benchmarkNoAnalysis() const = 0; + virtual int benchmarkSamples() const = 0; + virtual double benchmarkConfidenceInterval() const = 0; + virtual unsigned int benchmarkResamples() const = 0; + virtual std::chrono::milliseconds benchmarkWarmupTime() const = 0; + }; +} + +#endif // CATCH_INTERFACES_CONFIG_HPP_INCLUDED + + +#ifndef CATCH_CONTEXT_HPP_INCLUDED +#define CATCH_CONTEXT_HPP_INCLUDED + +namespace Catch { + + struct IResultCapture; + struct IRunner; + struct IConfig; + + struct IContext + { + virtual ~IContext(); + + virtual IResultCapture* getResultCapture() = 0; + virtual IRunner* getRunner() = 0; + virtual IConfig const* getConfig() const = 0; + }; + + struct IMutableContext : IContext + { + virtual ~IMutableContext(); + virtual void setResultCapture( IResultCapture* resultCapture ) = 0; + virtual void setRunner( IRunner* runner ) = 0; + virtual void setConfig( IConfig const* config ) = 0; + + private: + static IMutableContext *currentContext; + friend IMutableContext& getCurrentMutableContext(); + friend void cleanUpContext(); + static void createContext(); + }; + + inline IMutableContext& getCurrentMutableContext() + { + if( !IMutableContext::currentContext ) + IMutableContext::createContext(); + // NOLINTNEXTLINE(clang-analyzer-core.uninitialized.UndefReturn) + return *IMutableContext::currentContext; + } + + inline IContext& getCurrentContext() + { + return getCurrentMutableContext(); + } + + void cleanUpContext(); + + class SimplePcg32; + SimplePcg32& rng(); +} + +#endif // CATCH_CONTEXT_HPP_INCLUDED + + +#ifndef CATCH_INTERFACES_REPORTER_HPP_INCLUDED +#define CATCH_INTERFACES_REPORTER_HPP_INCLUDED + + + +#ifndef CATCH_SECTION_INFO_HPP_INCLUDED +#define CATCH_SECTION_INFO_HPP_INCLUDED + + + +#ifndef CATCH_COMMON_HPP_INCLUDED +#define CATCH_COMMON_HPP_INCLUDED + + + +#ifndef CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED +#define 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? +// CATCH_CONFIG_DISABLE_EXCEPTIONS : Are exceptions enabled? +// **************** +// 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. + + + +#ifndef CATCH_PLATFORM_HPP_INCLUDED +#define CATCH_PLATFORM_HPP_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) || defined(__MINGW32__) +# define CATCH_PLATFORM_WINDOWS +#endif + +#endif // CATCH_PLATFORM_HPP_INCLUDED + +#ifdef __cplusplus + +# if (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) +# define CATCH_CPP14_OR_GREATER +# endif + +# if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) +# define CATCH_CPP17_OR_GREATER +# endif + +#endif + +// We have to avoid both ICC and Clang, because they try to mask themselves +// as gcc, and we want only GCC in this block +#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && !defined(__CUDACC__) +# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic push" ) +# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic pop" ) + +// This only works on GCC 9+. so we have to also add a global suppression of Wparentheses +// for older versions of GCC. +# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ + _Pragma( "GCC diagnostic ignored \"-Wparentheses\"" ) + +# define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + _Pragma( "GCC diagnostic ignored \"-Wunused-variable\"" ) + +# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) + +#endif + +#if defined(__clang__) + +# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic push" ) +# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic pop" ) + +// As of this writing, IBM XL's implementation of __builtin_constant_p has a bug +// which results in calls to destructors being emitted for each temporary, +// without a matching initialization. In practice, this can result in something +// like `std::string::~string` being called on an uninitialized value. +// +// For example, this code will likely segfault under IBM XL: +// ``` +// REQUIRE(std::string("12") + "34" == "1234") +// ``` +// +// Therefore, `CATCH_INTERNAL_IGNORE_BUT_WARN` is not implemented. +# if !defined(__ibmxl__) && !defined(__CUDACC__) +# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) /* NOLINT(cppcoreguidelines-pro-type-vararg, hicpp-vararg) */ +# endif + + +# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) \ + _Pragma( "clang diagnostic ignored \"-Wglobal-constructors\"") + +# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wparentheses\"" ) + +# define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wunused-variable\"" ) + +# define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wgnu-zero-variadic-macro-arguments\"" ) + +# define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wunused-template\"" ) + +#endif // __clang__ + + +//////////////////////////////////////////////////////////////////////////////// +// Assume that non-Windows platforms support posix signals by default +#if !defined(CATCH_PLATFORM_WINDOWS) + #define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS +#endif + +//////////////////////////////////////////////////////////////////////////////// +// We know some environments not to support full POSIX signals +#if defined(__CYGWIN__) || defined(__QNX__) || defined(__EMSCRIPTEN__) || defined(__DJGPP__) + #define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS +#endif + +#ifdef __OS400__ +# define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS +# define CATCH_CONFIG_COLOUR_NONE +#endif + +//////////////////////////////////////////////////////////////////////////////// +// Android somehow still does not support std::to_string +#if defined(__ANDROID__) +# define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING +# define CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE +#endif + +//////////////////////////////////////////////////////////////////////////////// +// Not all Windows environments support SEH properly +#if defined(__MINGW32__) +# define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH +#endif + +//////////////////////////////////////////////////////////////////////////////// +// PS4 +#if defined(__ORBIS__) +# define CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE +#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 +// some versions of cygwin (most) do not support std::to_string. Use the libstd check. +// https://gcc.gnu.org/onlinedocs/gcc-4.8.2/libstdc++/api/a01053_source.html line 2812-2813 +# if !((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \ + && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF)) + +# define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING + +# endif +#endif // __CYGWIN__ + +//////////////////////////////////////////////////////////////////////////////// +// Visual C++ +#if defined(_MSC_VER) + +# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma( warning(push) ) +# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION __pragma( warning(pop) ) + +// 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 + +// MSVC traditional preprocessor needs some workaround for __VA_ARGS__ +// _MSVC_TRADITIONAL == 0 means new conformant preprocessor +// _MSVC_TRADITIONAL == 1 means old traditional non-conformant preprocessor +# if !defined(__clang__) // Handle Clang masquerading for msvc +# if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL) +# define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +# endif // MSVC_TRADITIONAL +# endif // __clang__ + +#endif // _MSC_VER + +#if defined(_REENTRANT) || defined(_MSC_VER) +// Enable async processing, as -pthread is specified or no additional linking is required +# define CATCH_INTERNAL_CONFIG_USE_ASYNC +#endif // _MSC_VER + +//////////////////////////////////////////////////////////////////////////////// +// Check if we are compiled with -fno-exceptions or equivalent +#if defined(__EXCEPTIONS) || defined(__cpp_exceptions) || defined(_CPPUNWIND) +# define CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED +#endif + +//////////////////////////////////////////////////////////////////////////////// +// DJGPP +#ifdef __DJGPP__ +# define CATCH_INTERNAL_CONFIG_NO_WCHAR +#endif // __DJGPP__ + +//////////////////////////////////////////////////////////////////////////////// +// Embarcadero C++Build +#if defined(__BORLANDC__) + #define CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN +#endif + +//////////////////////////////////////////////////////////////////////////////// + +// 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 + + +//////////////////////////////////////////////////////////////////////////////// + +// RTX is a special version of Windows that is real time. +// This means that it is detected as Windows, but does not provide +// the same set of capabilities as real Windows does. +#if defined(UNDER_RTSS) || defined(RTX64_BUILD) + #define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH + #define CATCH_INTERNAL_CONFIG_NO_ASYNC + #define CATCH_CONFIG_COLOUR_NONE +#endif + +#if !defined(_GLIBCXX_USE_C99_MATH_TR1) +#define CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER +#endif + +// Various stdlib support checks that require __has_include +#if defined(__has_include) + // Check if string_view is available and usable + #if __has_include(<string_view>) && defined(CATCH_CPP17_OR_GREATER) + # define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW + #endif + + // Check if optional is available and usable + # if __has_include(<optional>) && defined(CATCH_CPP17_OR_GREATER) + # define CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL + # endif // __has_include(<optional>) && defined(CATCH_CPP17_OR_GREATER) + + // Check if byte is available and usable + # if __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER) + # include <cstddef> + # if __cpp_lib_byte > 0 + # define CATCH_INTERNAL_CONFIG_CPP17_BYTE + # endif + # endif // __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER) + + // Check if variant is available and usable + # if __has_include(<variant>) && defined(CATCH_CPP17_OR_GREATER) + # if defined(__clang__) && (__clang_major__ < 8) + // work around clang bug with libstdc++ https://bugs.llvm.org/show_bug.cgi?id=31852 + // fix should be in clang 8, workaround in libstdc++ 8.2 + # include <ciso646> + # if defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) + # define CATCH_CONFIG_NO_CPP17_VARIANT + # else + # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT + # endif // defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) + # else + # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT + # endif // defined(__clang__) && (__clang_major__ < 8) + # endif // __has_include(<variant>) && defined(CATCH_CPP17_OR_GREATER) +#endif // defined(__has_include) + + +#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) && !defined(CATCH_INTERNAL_CONFIG_NO_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_POSIX_SIGNALS) && !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS) +# define CATCH_CONFIG_POSIX_SIGNALS +#endif +// This is set by default, because we assume that compilers with no wchar_t support are just rare exceptions. +#if !defined(CATCH_INTERNAL_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_WCHAR) +# define CATCH_CONFIG_WCHAR +#endif + +#if !defined(CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_CPP11_TO_STRING) +# define CATCH_CONFIG_CPP11_TO_STRING +#endif + +#if defined(CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_NO_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_CPP17_OPTIONAL) +# define CATCH_CONFIG_CPP17_OPTIONAL +#endif + +#if defined(CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_NO_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_CPP17_STRING_VIEW) +# define CATCH_CONFIG_CPP17_STRING_VIEW +#endif + +#if defined(CATCH_INTERNAL_CONFIG_CPP17_VARIANT) && !defined(CATCH_CONFIG_NO_CPP17_VARIANT) && !defined(CATCH_CONFIG_CPP17_VARIANT) +# define CATCH_CONFIG_CPP17_VARIANT +#endif + +#if defined(CATCH_INTERNAL_CONFIG_CPP17_BYTE) && !defined(CATCH_CONFIG_NO_CPP17_BYTE) && !defined(CATCH_CONFIG_CPP17_BYTE) +# define CATCH_CONFIG_CPP17_BYTE +#endif + + +#if defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT) +# define CATCH_INTERNAL_CONFIG_NEW_CAPTURE +#endif + +#if defined(CATCH_INTERNAL_CONFIG_NEW_CAPTURE) && !defined(CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NEW_CAPTURE) +# define CATCH_CONFIG_NEW_CAPTURE +#endif + +#if !defined(CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) +# define CATCH_CONFIG_DISABLE_EXCEPTIONS +#endif + +#if defined(CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_NO_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_POLYFILL_ISNAN) +# define CATCH_CONFIG_POLYFILL_ISNAN +#endif + +#if defined(CATCH_INTERNAL_CONFIG_USE_ASYNC) && !defined(CATCH_INTERNAL_CONFIG_NO_ASYNC) && !defined(CATCH_CONFIG_NO_USE_ASYNC) && !defined(CATCH_CONFIG_USE_ASYNC) +# define CATCH_CONFIG_USE_ASYNC +#endif + +#if defined(CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE) && !defined(CATCH_CONFIG_NO_ANDROID_LOGWRITE) && !defined(CATCH_CONFIG_ANDROID_LOGWRITE) +# define CATCH_CONFIG_ANDROID_LOGWRITE +#endif + +#if defined(CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_NO_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_GLOBAL_NEXTAFTER) +# define CATCH_CONFIG_GLOBAL_NEXTAFTER +#endif + + +// Even if we do not think the compiler has that warning, we still have +// to provide a macro that can be used by the code. +#if !defined(CATCH_INTERNAL_START_WARNINGS_SUPPRESSION) +# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION +#endif +#if !defined(CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION) +# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION +#endif +#if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS) +# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS +#endif +#if !defined(CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS) +# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS +#endif +#if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS) +# define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS +#endif +#if !defined(CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS) +# define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS +#endif + +// The goal of this macro is to avoid evaluation of the arguments, but +// still have the compiler warn on problems inside... +#if !defined(CATCH_INTERNAL_IGNORE_BUT_WARN) +# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) +#endif + +#if defined(__APPLE__) && defined(__apple_build_version__) && (__clang_major__ < 10) +# undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS +#elif defined(__clang__) && (__clang_major__ < 5) +# undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS +#endif + +#if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS) +# define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS +#endif + +#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) +#define CATCH_TRY if ((true)) +#define CATCH_CATCH_ALL if ((false)) +#define CATCH_CATCH_ANON(type) if ((false)) +#else +#define CATCH_TRY try +#define CATCH_CATCH_ALL catch (...) +#define CATCH_CATCH_ANON(type) catch (type) +#endif + +#if defined(CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_NO_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) +#define CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#endif + +#endif // CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED + + +#ifndef CATCH_STRINGREF_HPP_INCLUDED +#define CATCH_STRINGREF_HPP_INCLUDED + +#include <cstddef> +#include <string> +#include <iosfwd> +#include <cassert> + +namespace Catch { + + /// 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. + class StringRef { + public: + using size_type = std::size_t; + using const_iterator = const char*; + + private: + static constexpr char const* const s_empty = ""; + + char const* m_start = s_empty; + size_type m_size = 0; + + public: // construction + constexpr StringRef() noexcept = default; + + StringRef( char const* rawChars ) noexcept; + + constexpr 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() ) + {} + + explicit operator std::string() const { + return std::string(m_start, m_size); + } + + public: // operators + auto operator == ( StringRef const& other ) const noexcept -> bool; + auto operator != (StringRef const& other) const noexcept -> bool { + return !(*this == other); + } + + constexpr auto operator[] ( size_type index ) const noexcept -> char { + assert(index < m_size); + return m_start[index]; + } + + bool operator<(StringRef const& rhs) const noexcept; + + public: // named queries + constexpr auto empty() const noexcept -> bool { + return m_size == 0; + } + constexpr auto size() const noexcept -> size_type { + return m_size; + } + + // Returns the current start pointer. If the StringRef is not + // null-terminated, throws std::domain_exception + auto c_str() const -> char const*; + + public: // substrings and searches + // Returns a substring of [start, start + length). + // If start + length > size(), then the substring is [start, start + size()). + // If start > size(), then the substring is empty. + constexpr StringRef substr(size_type start, size_type length) const noexcept { + if (start < m_size) { + const auto shortened_size = m_size - start; + return StringRef(m_start + start, (shortened_size < length) ? shortened_size : length); + } else { + return StringRef(); + } + } + + // Returns the current start pointer. May not be null-terminated. + constexpr char const* data() const noexcept { + return m_start; + } + + constexpr auto isNullTerminated() const noexcept -> bool { + return m_start[m_size] == '\0'; + } + + public: // iterators + constexpr const_iterator begin() const { return m_start; } + constexpr const_iterator end() const { return m_start + m_size; } + + + friend std::string& operator += (std::string& lhs, StringRef const& sr); + friend std::ostream& operator << (std::ostream& os, StringRef const& sr); + friend std::string operator+(StringRef lhs, StringRef rhs); + }; + + + constexpr auto operator "" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef { + return StringRef( rawChars, size ); + } +} // namespace Catch + +constexpr auto operator "" _catch_sr( char const* rawChars, std::size_t size ) noexcept -> Catch::StringRef { + return Catch::StringRef( rawChars, size ); +} + +#endif // CATCH_STRINGREF_HPP_INCLUDED + +#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> + +// 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 { + + struct SourceLineInfo { + + SourceLineInfo() = delete; + constexpr SourceLineInfo( char const* _file, std::size_t _line ) noexcept: + file( _file ), + line( _line ) + {} + + bool operator == ( SourceLineInfo const& other ) const noexcept; + bool operator < ( SourceLineInfo const& other ) const noexcept; + + char const* file; + std::size_t line; + + friend std::ostream& operator << (std::ostream& os, SourceLineInfo const& info); + }; + + + // Bring in operator<< from global namespace into Catch namespace + // This is necessary because the overload of operator<< above makes + // lookup stop at namespace Catch + using ::operator<<; + + // Use this in variadic streaming macros to allow + // >> +StreamEndStop + // as well as + // >> stuff +StreamEndStop + struct StreamEndStop { + StringRef operator+() const { + return StringRef(); + } + + template<typename T> + friend T const& operator + ( T const& value, StreamEndStop ) { + return value; + } + }; +} + +#define CATCH_INTERNAL_LINEINFO \ + ::Catch::SourceLineInfo( __FILE__, static_cast<std::size_t>( __LINE__ ) ) + +#endif // CATCH_COMMON_HPP_INCLUDED + + +#ifndef CATCH_TOTALS_HPP_INCLUDED +#define 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; + + int error = 0; + Counts assertions; + Counts testCases; + }; +} + +#endif // CATCH_TOTALS_HPP_INCLUDED + +#include <string> + +namespace Catch { + + struct SectionInfo { + // The last argument is ignored, so that people can write + // SECTION("ShortName", "Proper description that is long") and + // still use the `-c` flag comfortably. + SectionInfo( SourceLineInfo const& _lineInfo, std::string _name, + const char* const = nullptr ): + name(std::move(_name)), + lineInfo(_lineInfo) + {} + + std::string name; + SourceLineInfo lineInfo; + }; + + struct SectionEndInfo { + SectionInfo sectionInfo; + Counts prevAssertions; + double durationInSeconds; + }; + +} // end namespace Catch + +#endif // CATCH_SECTION_INFO_HPP_INCLUDED + + +#ifndef CATCH_ASSERTION_RESULT_HPP_INCLUDED +#define CATCH_ASSERTION_RESULT_HPP_INCLUDED + +#include <string> + + +#ifndef CATCH_ASSERTION_INFO_HPP_INCLUDED +#define CATCH_ASSERTION_INFO_HPP_INCLUDED + + + +#ifndef CATCH_RESULT_TYPE_HPP_INCLUDED +#define CATCH_RESULT_TYPE_HPP_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 // CATCH_RESULT_TYPE_HPP_INCLUDED + +namespace Catch { + + struct AssertionInfo { + // AssertionInfo() = delete; + + StringRef macroName; + SourceLineInfo lineInfo; + StringRef capturedExpression; + ResultDisposition::Flags resultDisposition; + }; + +} // end namespace Catch + +#endif // CATCH_ASSERTION_INFO_HPP_INCLUDED + + +#ifndef CATCH_LAZY_EXPR_HPP_INCLUDED +#define CATCH_LAZY_EXPR_HPP_INCLUDED + +#include <iosfwd> + +namespace Catch { + + struct ITransientExpression; + + class LazyExpression { + friend class AssertionHandler; + friend struct AssertionStats; + friend class RunContext; + + ITransientExpression const* m_transientExpression = nullptr; + bool m_isNegated; + public: + LazyExpression( bool isNegated ): + m_isNegated(isNegated) + {} + LazyExpression(LazyExpression const& other) = default; + LazyExpression& operator = ( LazyExpression const& ) = delete; + + explicit operator bool() const { + return m_transientExpression != nullptr; + } + + friend auto operator << ( std::ostream& os, LazyExpression const& lazyExpr ) -> std::ostream&; + }; + +} // namespace Catch + +#endif // CATCH_LAZY_EXPR_HPP_INCLUDED + +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 // CATCH_ASSERTION_RESULT_HPP_INCLUDED + + +#ifndef CATCH_MESSAGE_INFO_HPP_INCLUDED +#define CATCH_MESSAGE_INFO_HPP_INCLUDED + + + +#ifndef CATCH_INTERFACES_CAPTURE_HPP_INCLUDED +#define CATCH_INTERFACES_CAPTURE_HPP_INCLUDED + +#include <string> +#include <chrono> + + +namespace Catch { + + class AssertionResult; + struct AssertionInfo; + struct SectionInfo; + struct SectionEndInfo; + struct MessageInfo; + struct MessageBuilder; + struct Counts; + struct AssertionReaction; + struct SourceLineInfo; + + struct ITransientExpression; + struct IGeneratorTracker; + + struct BenchmarkInfo; + template <typename Duration = std::chrono::duration<double, std::nano>> + struct BenchmarkStats; + + 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 auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& = 0; + + virtual void benchmarkPreparing( std::string const& name ) = 0; + virtual void benchmarkStarting( BenchmarkInfo const& info ) = 0; + virtual void benchmarkEnded( BenchmarkStats<> const& stats ) = 0; + virtual void benchmarkFailed( std::string const& error ) = 0; + + virtual void pushScopedMessage( MessageInfo const& message ) = 0; + virtual void popScopedMessage( MessageInfo const& message ) = 0; + + virtual void emplaceUnscopedMessage( MessageBuilder const& builder ) = 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 // CATCH_INTERFACES_CAPTURE_HPP_INCLUDED + +#include <string> + +namespace Catch { + + struct MessageInfo { + MessageInfo( StringRef const& _macroName, + SourceLineInfo const& _lineInfo, + ResultWas::OfType _type ); + + StringRef macroName; + std::string message; + SourceLineInfo lineInfo; + ResultWas::OfType type; + unsigned int sequence; + + bool operator == (MessageInfo const& other) const { + return sequence == other.sequence; + } + bool operator < (MessageInfo const& other) const { + return sequence < other.sequence; + } + private: + static unsigned int globalCount; + }; + +} // end namespace Catch + +#endif // CATCH_MESSAGE_INFO_HPP_INCLUDED + + +#ifndef CATCH_UNIQUE_PTR_HPP_INCLUDED +#define CATCH_UNIQUE_PTR_HPP_INCLUDED + +#include <cassert> +#include <type_traits> + +namespace Catch { +namespace Detail { + // reimplementation of unique_ptr for improved compilation times + // Does not support custom deleters (and thus does not require EBO) + // Does not support arrays + template <typename T> + class unique_ptr { + T* m_ptr; + public: + constexpr unique_ptr(std::nullptr_t = nullptr): + m_ptr{} + {} + explicit constexpr unique_ptr(T* ptr): + m_ptr(ptr) + {} + + template <typename U, typename = std::enable_if_t<std::is_base_of<T, U>::value>> + unique_ptr(unique_ptr<U>&& from): + m_ptr(from.release()) + {} + + template <typename U, typename = std::enable_if_t<std::is_base_of<T, U>::value>> + unique_ptr& operator=(unique_ptr<U>&& from) { + reset(from.release()); + + return *this; + } + + unique_ptr(unique_ptr const&) = delete; + unique_ptr& operator=(unique_ptr const&) = delete; + + unique_ptr(unique_ptr&& rhs) noexcept: + m_ptr(rhs.m_ptr) { + rhs.m_ptr = nullptr; + } + unique_ptr& operator=(unique_ptr&& rhs) noexcept { + reset(rhs.release()); + + return *this; + } + + ~unique_ptr() { + delete m_ptr; + } + + T& operator*() { + assert(m_ptr); + return *m_ptr; + } + T const& operator*() const { + assert(m_ptr); + return *m_ptr; + } + T* operator->() const noexcept { + assert(m_ptr); + return m_ptr; + } + + T* get() { return m_ptr; } + T const* get() const { return m_ptr; } + + void reset(T* ptr = nullptr) { + delete m_ptr; + m_ptr = ptr; + } + + T* release() { + auto temp = m_ptr; + m_ptr = nullptr; + return temp; + } + + explicit operator bool() const { + return m_ptr; + } + + friend void swap(unique_ptr& lhs, unique_ptr& rhs) { + auto temp = lhs.m_ptr; + lhs.m_ptr = rhs.m_ptr; + rhs.m_ptr = temp; + } + }; + + // Purposefully doesn't exist + // We could also rely on compiler warning + werror for calling plain delete + // on a T[], but this seems better. + // Maybe add definition and a static assert? + template <typename T> + class unique_ptr<T[]>; + + template <typename T, typename... Args> + unique_ptr<T> make_unique(Args&&... args) { + // static_cast<Args&&> does the same thing as std::forward in + // this case, but does not require including big header (<utility>) + // and compiles faster thanks to not requiring template instantiation + // and overload resolution + return unique_ptr<T>(new T(static_cast<Args&&>(args)...)); + } + + +} // end namespace Detail +} // end namespace Catch + +#endif // CATCH_UNIQUE_PTR_HPP_INCLUDED + + + +// Adapted from donated nonius code. + +#ifndef CATCH_ESTIMATE_HPP_INCLUDED +#define CATCH_ESTIMATE_HPP_INCLUDED + +namespace Catch { + namespace Benchmark { + template <typename Duration> + struct Estimate { + Duration point; + Duration lower_bound; + Duration upper_bound; + double confidence_interval; + + template <typename Duration2> + operator Estimate<Duration2>() const { + return { point, lower_bound, upper_bound, confidence_interval }; + } + }; + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_ESTIMATE_HPP_INCLUDED + + +// Adapted from donated nonius code. + +#ifndef CATCH_OUTLIER_CLASSIFICATION_HPP_INCLUDED +#define CATCH_OUTLIER_CLASSIFICATION_HPP_INCLUDED + +namespace Catch { + namespace Benchmark { + struct OutlierClassification { + int samples_seen = 0; + int low_severe = 0; // more than 3 times IQR below Q1 + int low_mild = 0; // 1.5 to 3 times IQR below Q1 + int high_mild = 0; // 1.5 to 3 times IQR above Q3 + int high_severe = 0; // more than 3 times IQR above Q3 + + int total() const { + return low_severe + low_mild + high_mild + high_severe; + } + }; + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_OUTLIERS_CLASSIFICATION_HPP_INCLUDED + + +#include <string> +#include <vector> +#include <iosfwd> + +namespace Catch { + + struct ReporterDescription; + struct TagInfo; + struct TestCaseInfo; + class TestCaseHandle; + struct IConfig; + + struct ReporterConfig { + explicit ReporterConfig( IConfig const* _fullConfig ); + + ReporterConfig( IConfig const* _fullConfig, std::ostream& _stream ); + + std::ostream& stream() const; + IConfig const* fullConfig() const; + + private: + std::ostream* m_stream; + IConfig const* m_fullConfig; + }; + + 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& ) = delete; + AssertionStats& operator = ( AssertionStats && ) = delete; + + AssertionResult assertionResult; + std::vector<MessageInfo> infoMessages; + Totals totals; + }; + + struct SectionStats { + SectionStats( SectionInfo const& _sectionInfo, + Counts const& _assertions, + double _durationInSeconds, + bool _missingAssertions ); + + 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 ); + + TestCaseInfo const * 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 ); + + GroupInfo groupInfo; + Totals totals; + bool aborting; + }; + + struct TestRunStats { + TestRunStats( TestRunInfo const& _runInfo, + Totals const& _totals, + bool _aborting ); + + TestRunInfo runInfo; + Totals totals; + bool aborting; + }; + + + struct BenchmarkInfo { + std::string name; + double estimatedDuration; + int iterations; + int samples; + unsigned int resamples; + double clockResolution; + double clockCost; + }; + + template <class Duration> + struct BenchmarkStats { + BenchmarkInfo info; + + std::vector<Duration> samples; + Benchmark::Estimate<Duration> mean; + Benchmark::Estimate<Duration> standardDeviation; + Benchmark::OutlierClassification outliers; + double outlierVariance; + + template <typename Duration2> + operator BenchmarkStats<Duration2>() const { + std::vector<Duration2> samples2; + samples2.reserve(samples.size()); + for (auto const& sample : samples) { + samples2.push_back(Duration2(sample)); + } + return { + info, + std::move(samples2), + mean, + standardDeviation, + outliers, + outlierVariance, + }; + } + }; + + //! By setting up its preferences, a reporter can modify Catch2's behaviour + //! in some regards, e.g. it can request Catch2 to capture writes to + //! stdout/stderr during test execution, and pass them to the reporter. + struct ReporterPreferences { + //! Catch2 should redirect writes to stdout and pass them to the + //! reporter + bool shouldRedirectStdOut = false; + //! Catch2 should call `Reporter::assertionEnded` even for passing + //! assertions + bool shouldReportAllAssertions = false; + }; + + + struct IStreamingReporter { + protected: + //! Derived classes can set up their preferences here + ReporterPreferences m_preferences; + public: + virtual ~IStreamingReporter() = default; + + // Implementing class must also provide the following static methods: + // static std::string getDescription(); + + ReporterPreferences const& getPreferences() const { + return m_preferences; + } + + virtual void noMatchingTestCases( std::string const& spec ) = 0; + + virtual void reportInvalidArguments(std::string const&) {} + + 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; + + virtual void benchmarkPreparing( std::string const& ) {} + virtual void benchmarkStarting( BenchmarkInfo const& ) {} + virtual void benchmarkEnded( BenchmarkStats<> const& ) {} + virtual void benchmarkFailed( std::string 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; + + 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 ); + + //! Writes out information about provided reporters using reporter-specific format + virtual void listReporters(std::vector<ReporterDescription> const& descriptions, IConfig const& config); + //! Writes out information about provided tests using reporter-specific format + virtual void listTests(std::vector<TestCaseHandle> const& tests, IConfig const& config); + //! Writes out information about the provided tags using reporter-specific format + virtual void listTags(std::vector<TagInfo> const& tags, IConfig const& config); + + }; + using IStreamingReporterPtr = Detail::unique_ptr<IStreamingReporter>; + +} // end namespace Catch + +#endif // CATCH_INTERFACES_REPORTER_HPP_INCLUDED + + + +// Adapted from donated nonius code. + +#ifndef CATCH_CHRONOMETER_HPP_INCLUDED +#define CATCH_CHRONOMETER_HPP_INCLUDED + + + +// Adapted from donated nonius code. + +#ifndef CATCH_CLOCK_HPP_INCLUDED +#define CATCH_CLOCK_HPP_INCLUDED + +#include <chrono> +#include <ratio> + +namespace Catch { + namespace Benchmark { + template <typename Clock> + using ClockDuration = typename Clock::duration; + template <typename Clock> + using FloatDuration = std::chrono::duration<double, typename Clock::period>; + + template <typename Clock> + using TimePoint = typename Clock::time_point; + + using default_clock = std::chrono::steady_clock; + + template <typename Clock> + struct now { + TimePoint<Clock> operator()() const { + return Clock::now(); + } + }; + + using fp_seconds = std::chrono::duration<double, std::ratio<1>>; + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_CLOCK_HPP_INCLUDED + + +// Adapted from donated nonius code. + +#ifndef CATCH_OPTIMIZER_HPP_INCLUDED +#define CATCH_OPTIMIZER_HPP_INCLUDED + +#if defined(_MSC_VER) +# include <atomic> // atomic_thread_fence +#endif + +#include <type_traits> +#include <utility> + +namespace Catch { + namespace Benchmark { +#if defined(__GNUC__) || defined(__clang__) + template <typename T> + inline void keep_memory(T* p) { + asm volatile("" : : "g"(p) : "memory"); + } + inline void keep_memory() { + asm volatile("" : : : "memory"); + } + + namespace Detail { + inline void optimizer_barrier() { keep_memory(); } + } // namespace Detail +#elif defined(_MSC_VER) + +#pragma optimize("", off) + template <typename T> + inline void keep_memory(T* p) { + // thanks @milleniumbug + *reinterpret_cast<char volatile*>(p) = *reinterpret_cast<char const volatile*>(p); + } + // TODO equivalent keep_memory() +#pragma optimize("", on) + + namespace Detail { + inline void optimizer_barrier() { + std::atomic_thread_fence(std::memory_order_seq_cst); + } + } // namespace Detail + +#endif + + template <typename T> + inline void deoptimize_value(T&& x) { + keep_memory(&x); + } + + template <typename Fn, typename... Args> + inline auto invoke_deoptimized(Fn&& fn, Args&&... args) -> typename std::enable_if<!std::is_same<void, decltype(fn(args...))>::value>::type { + deoptimize_value(std::forward<Fn>(fn) (std::forward<Args...>(args...))); + } + + template <typename Fn, typename... Args> + inline auto invoke_deoptimized(Fn&& fn, Args&&... args) -> typename std::enable_if<std::is_same<void, decltype(fn(args...))>::value>::type { + std::forward<Fn>(fn) (std::forward<Args...>(args...)); + } + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_OPTIMIZER_HPP_INCLUDED + + +// Adapted from donated nonius code. + +#ifndef CATCH_COMPLETE_INVOKE_HPP_INCLUDED +#define CATCH_COMPLETE_INVOKE_HPP_INCLUDED + + + +#ifndef CATCH_ENFORCE_HPP_INCLUDED +#define CATCH_ENFORCE_HPP_INCLUDED + + + +#ifndef CATCH_STREAM_HPP_INCLUDED +#define CATCH_STREAM_HPP_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 : Detail::NonCopyable { + std::size_t m_index; + std::ostream* m_oss; + public: + ReusableStringStream(); + ~ReusableStringStream(); + + //! Returns the serialized state + std::string str() const; + //! Sets internal state to `str` + void str(std::string const& str); + +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic push +// Old versions of GCC do not understand -Wnonnull-compare +#pragma GCC diagnostic ignored "-Wpragmas" +// Streaming a function pointer triggers Waddress and Wnonnull-compare +// on GCC, because it implicitly converts it to bool and then decides +// that the check it uses (a? true : false) is tautological and cannot +// be null... +#pragma GCC diagnostic ignored "-Waddress" +#pragma GCC diagnostic ignored "-Wnonnull-compare" +#endif + + template<typename T> + auto operator << ( T const& value ) -> ReusableStringStream& { + *m_oss << value; + return *this; + } + +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic pop +#endif + auto get() -> std::ostream& { return *m_oss; } + }; +} + +#endif // CATCH_STREAM_HPP_INCLUDED + +#include <exception> + +namespace Catch { +#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + template <typename Ex> + [[noreturn]] + void throw_exception(Ex const& e) { + throw e; + } +#else // ^^ Exceptions are enabled // Exceptions are disabled vv + [[noreturn]] + void throw_exception(std::exception const& e); +#endif + + [[noreturn]] + void throw_logic_error(std::string const& msg); + [[noreturn]] + void throw_domain_error(std::string const& msg); + [[noreturn]] + void throw_runtime_error(std::string const& msg); + +} // namespace Catch; + +#define CATCH_MAKE_MSG(...) \ + (Catch::ReusableStringStream() << __VA_ARGS__).str() + +#define CATCH_INTERNAL_ERROR(...) \ + Catch::throw_logic_error(CATCH_MAKE_MSG( CATCH_INTERNAL_LINEINFO << ": Internal Catch2 error: " << __VA_ARGS__)) + +#define CATCH_ERROR(...) \ + Catch::throw_domain_error(CATCH_MAKE_MSG( __VA_ARGS__ )) + +#define CATCH_RUNTIME_ERROR(...) \ + Catch::throw_runtime_error(CATCH_MAKE_MSG( __VA_ARGS__ )) + +#define CATCH_ENFORCE( condition, ... ) \ + do{ if( !(condition) ) CATCH_ERROR( __VA_ARGS__ ); } while(false) + + +#endif // CATCH_ENFORCE_HPP_INCLUDED + + +#ifndef CATCH_META_HPP_INCLUDED +#define CATCH_META_HPP_INCLUDED + +#include <type_traits> + +namespace Catch { + template<typename T> + struct always_false : std::false_type {}; + + template <typename> struct true_given : std::true_type {}; + struct is_callable_tester { + template <typename Fun, typename... Args> + true_given<decltype(std::declval<Fun>()(std::declval<Args>()...))> static test(int); + template <typename...> + std::false_type static test(...); + }; + + template <typename T> + struct is_callable; + + template <typename Fun, typename... Args> + struct is_callable<Fun(Args...)> : decltype(is_callable_tester::test<Fun, Args...>(0)) {}; + + +#if defined(__cpp_lib_is_invocable) && __cpp_lib_is_invocable >= 201703 + // std::result_of is deprecated in C++17 and removed in C++20. Hence, it is + // replaced with std::invoke_result here. + template <typename Func, typename... U> + using FunctionReturnType = std::remove_reference_t<std::remove_cv_t<std::invoke_result_t<Func, U...>>>; +#else + template <typename Func, typename... U> + using FunctionReturnType = std::remove_reference_t<std::remove_cv_t<std::result_of_t<Func(U...)>>>; +#endif + +} // namespace Catch + +namespace mpl_{ + struct na; +} + +#endif // CATCH_META_HPP_INCLUDED + + +#ifndef CATCH_INTERFACES_REGISTRY_HUB_HPP_INCLUDED +#define CATCH_INTERFACES_REGISTRY_HUB_HPP_INCLUDED + + +#include <string> + +namespace Catch { + + class TestCaseHandle; + struct TestCaseInfo; + struct ITestCaseRegistry; + struct IExceptionTranslatorRegistry; + struct IExceptionTranslator; + struct IReporterRegistry; + struct IReporterFactory; + struct ITagAliasRegistry; + struct ITestInvoker; + struct IMutableEnumValuesRegistry; + struct SourceLineInfo; + + class StartupExceptionRegistry; + + using IReporterFactoryPtr = Detail::unique_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 const& getExceptionTranslatorRegistry() const = 0; + + + virtual StartupExceptionRegistry const& getStartupExceptionRegistry() const = 0; + }; + + struct IMutableRegistryHub { + virtual ~IMutableRegistryHub(); + virtual void registerReporter( std::string const& name, IReporterFactoryPtr factory ) = 0; + virtual void registerListener( IReporterFactoryPtr factory ) = 0; + virtual void registerTest(Detail::unique_ptr<TestCaseInfo>&& testInfo, Detail::unique_ptr<ITestInvoker>&& invoker) = 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; + virtual IMutableEnumValuesRegistry& getMutableEnumValuesRegistry() = 0; + }; + + IRegistryHub const& getRegistryHub(); + IMutableRegistryHub& getMutableRegistryHub(); + void cleanUp(); + std::string translateActiveException(); + +} + +#endif // CATCH_INTERFACES_REGISTRY_HUB_HPP_INCLUDED + +#include <type_traits> +#include <utility> + +namespace Catch { + namespace Benchmark { + namespace Detail { + template <typename T> + struct CompleteType { using type = T; }; + template <> + struct CompleteType<void> { struct type {}; }; + + template <typename T> + using CompleteType_t = typename CompleteType<T>::type; + + template <typename Result> + struct CompleteInvoker { + template <typename Fun, typename... Args> + static Result invoke(Fun&& fun, Args&&... args) { + return std::forward<Fun>(fun)(std::forward<Args>(args)...); + } + }; + template <> + struct CompleteInvoker<void> { + template <typename Fun, typename... Args> + static CompleteType_t<void> invoke(Fun&& fun, Args&&... args) { + std::forward<Fun>(fun)(std::forward<Args>(args)...); + return {}; + } + }; + + // invoke and not return void :( + template <typename Fun, typename... Args> + CompleteType_t<FunctionReturnType<Fun, Args...>> complete_invoke(Fun&& fun, Args&&... args) { + return CompleteInvoker<FunctionReturnType<Fun, Args...>>::invoke(std::forward<Fun>(fun), std::forward<Args>(args)...); + } + + extern const std::string benchmarkErrorMsg; + } // namespace Detail + + template <typename Fun> + Detail::CompleteType_t<FunctionReturnType<Fun>> user_code(Fun&& fun) { + CATCH_TRY{ + return Detail::complete_invoke(std::forward<Fun>(fun)); + } CATCH_CATCH_ALL{ + getResultCapture().benchmarkFailed(translateActiveException()); + CATCH_RUNTIME_ERROR(Detail::benchmarkErrorMsg); + } + } + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_COMPLETE_INVOKE_HPP_INCLUDED + +namespace Catch { + namespace Benchmark { + namespace Detail { + struct ChronometerConcept { + virtual void start() = 0; + virtual void finish() = 0; + virtual ~ChronometerConcept(); // = default; + + ChronometerConcept() = default; + ChronometerConcept(ChronometerConcept const&) = default; + ChronometerConcept& operator=(ChronometerConcept const&) = default; + }; + template <typename Clock> + struct ChronometerModel final : public ChronometerConcept { + void start() override { started = Clock::now(); } + void finish() override { finished = Clock::now(); } + + ClockDuration<Clock> elapsed() const { return finished - started; } + + TimePoint<Clock> started; + TimePoint<Clock> finished; + }; + } // namespace Detail + + struct Chronometer { + public: + template <typename Fun> + void measure(Fun&& fun) { measure(std::forward<Fun>(fun), is_callable<Fun(int)>()); } + + int runs() const { return repeats; } + + Chronometer(Detail::ChronometerConcept& meter, int repeats_) + : impl(&meter) + , repeats(repeats_) {} + + private: + template <typename Fun> + void measure(Fun&& fun, std::false_type) { + measure([&fun](int) { return fun(); }, std::true_type()); + } + + template <typename Fun> + void measure(Fun&& fun, std::true_type) { + Detail::optimizer_barrier(); + impl->start(); + for (int i = 0; i < repeats; ++i) invoke_deoptimized(fun, i); + impl->finish(); + Detail::optimizer_barrier(); + } + + Detail::ChronometerConcept* impl; + int repeats; + }; + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_CHRONOMETER_HPP_INCLUDED + + +// Adapted from donated nonius code. + +#ifndef CATCH_ENVIRONMENT_HPP_INCLUDED +#define CATCH_ENVIRONMENT_HPP_INCLUDED + + +namespace Catch { + namespace Benchmark { + template <typename Duration> + struct EnvironmentEstimate { + Duration mean; + OutlierClassification outliers; + + template <typename Duration2> + operator EnvironmentEstimate<Duration2>() const { + return { mean, outliers }; + } + }; + template <typename Clock> + struct Environment { + using clock_type = Clock; + EnvironmentEstimate<FloatDuration<Clock>> clock_resolution; + EnvironmentEstimate<FloatDuration<Clock>> clock_cost; + }; + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_ENVIRONMENT_HPP_INCLUDED + + +// Adapted from donated nonius code. + +#ifndef CATCH_EXECUTION_PLAN_HPP_INCLUDED +#define CATCH_EXECUTION_PLAN_HPP_INCLUDED + + + +// Adapted from donated nonius code. + +#ifndef CATCH_BENCHMARK_FUNCTION_HPP_INCLUDED +#define CATCH_BENCHMARK_FUNCTION_HPP_INCLUDED + + +#include <cassert> +#include <type_traits> +#include <utility> + +namespace Catch { + namespace Benchmark { + namespace Detail { + template <typename T> + using Decay = typename std::decay<T>::type; + template <typename T, typename U> + struct is_related + : std::is_same<Decay<T>, Decay<U>> {}; + + /// We need to reinvent std::function because every piece of code that might add overhead + /// in a measurement context needs to have consistent performance characteristics so that we + /// can account for it in the measurement. + /// Implementations of std::function with optimizations that aren't always applicable, like + /// small buffer optimizations, are not uncommon. + /// This is effectively an implementation of std::function without any such optimizations; + /// it may be slow, but it is consistently slow. + struct BenchmarkFunction { + private: + struct callable { + virtual void call(Chronometer meter) const = 0; + virtual callable* clone() const = 0; + virtual ~callable(); // = default; + + callable() = default; + callable(callable const&) = default; + callable& operator=(callable const&) = default; + }; + template <typename Fun> + struct model : public callable { + model(Fun&& fun_) : fun(std::move(fun_)) {} + model(Fun const& fun_) : fun(fun_) {} + + model<Fun>* clone() const override { return new model<Fun>(*this); } + + void call(Chronometer meter) const override { + call(meter, is_callable<Fun(Chronometer)>()); + } + void call(Chronometer meter, std::true_type) const { + fun(meter); + } + void call(Chronometer meter, std::false_type) const { + meter.measure(fun); + } + + Fun fun; + }; + + struct do_nothing { void operator()() const {} }; + + template <typename T> + BenchmarkFunction(model<T>* c) : f(c) {} + + public: + BenchmarkFunction() + : f(new model<do_nothing>{ {} }) {} + + template <typename Fun, + typename std::enable_if<!is_related<Fun, BenchmarkFunction>::value, int>::type = 0> + BenchmarkFunction(Fun&& fun) + : f(new model<typename std::decay<Fun>::type>(std::forward<Fun>(fun))) {} + + BenchmarkFunction( BenchmarkFunction&& that ) noexcept: + f( std::move( that.f ) ) {} + + BenchmarkFunction(BenchmarkFunction const& that) + : f(that.f->clone()) {} + + BenchmarkFunction& + operator=( BenchmarkFunction&& that ) noexcept { + f = std::move( that.f ); + return *this; + } + + BenchmarkFunction& operator=(BenchmarkFunction const& that) { + f.reset(that.f->clone()); + return *this; + } + + void operator()(Chronometer meter) const { f->call(meter); } + + private: + Catch::Detail::unique_ptr<callable> f; + }; + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_BENCHMARK_FUNCTION_HPP_INCLUDED + + +// Adapted from donated nonius code. + +#ifndef CATCH_REPEAT_HPP_INCLUDED +#define CATCH_REPEAT_HPP_INCLUDED + +#include <type_traits> +#include <utility> + +namespace Catch { + namespace Benchmark { + namespace Detail { + template <typename Fun> + struct repeater { + void operator()(int k) const { + for (int i = 0; i < k; ++i) { + fun(); + } + } + Fun fun; + }; + template <typename Fun> + repeater<typename std::decay<Fun>::type> repeat(Fun&& fun) { + return { std::forward<Fun>(fun) }; + } + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_REPEAT_HPP_INCLUDED + + +// Adapted from donated nonius code. + +#ifndef CATCH_RUN_FOR_AT_LEAST_HPP_INCLUDED +#define CATCH_RUN_FOR_AT_LEAST_HPP_INCLUDED + + + +// Adapted from donated nonius code. + +#ifndef CATCH_MEASURE_HPP_INCLUDED +#define CATCH_MEASURE_HPP_INCLUDED + + + +// Adapted from donated nonius code. + +#ifndef CATCH_TIMING_HPP_INCLUDED +#define CATCH_TIMING_HPP_INCLUDED + + +#include <type_traits> + +namespace Catch { + namespace Benchmark { + template <typename Duration, typename Result> + struct Timing { + Duration elapsed; + Result result; + int iterations; + }; + template <typename Clock, typename Func, typename... Args> + using TimingOf = Timing<ClockDuration<Clock>, Detail::CompleteType_t<FunctionReturnType<Func, Args...>>>; + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_TIMING_HPP_INCLUDED + +#include <utility> + +namespace Catch { + namespace Benchmark { + namespace Detail { + template <typename Clock, typename Fun, typename... Args> + TimingOf<Clock, Fun, Args...> measure(Fun&& fun, Args&&... args) { + auto start = Clock::now(); + auto&& r = Detail::complete_invoke(fun, std::forward<Args>(args)...); + auto end = Clock::now(); + auto delta = end - start; + return { delta, std::forward<decltype(r)>(r), 1 }; + } + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_MEASURE_HPP_INCLUDED + +#include <utility> +#include <type_traits> + +namespace Catch { + namespace Benchmark { + namespace Detail { + template <typename Clock, typename Fun> + TimingOf<Clock, Fun, int> measure_one(Fun&& fun, int iters, std::false_type) { + return Detail::measure<Clock>(fun, iters); + } + template <typename Clock, typename Fun> + TimingOf<Clock, Fun, Chronometer> measure_one(Fun&& fun, int iters, std::true_type) { + Detail::ChronometerModel<Clock> meter; + auto&& result = Detail::complete_invoke(fun, Chronometer(meter, iters)); + + return { meter.elapsed(), std::move(result), iters }; + } + + template <typename Clock, typename Fun> + using run_for_at_least_argument_t = typename std::conditional<is_callable<Fun(Chronometer)>::value, Chronometer, int>::type; + + + [[noreturn]] + void throw_optimized_away_error(); + + template <typename Clock, typename Fun> + TimingOf<Clock, Fun, run_for_at_least_argument_t<Clock, Fun>> run_for_at_least(ClockDuration<Clock> how_long, int seed, Fun&& fun) { + auto iters = seed; + while (iters < (1 << 30)) { + auto&& Timing = measure_one<Clock>(fun, iters, is_callable<Fun(Chronometer)>()); + + if (Timing.elapsed >= how_long) { + return { Timing.elapsed, std::move(Timing.result), iters }; + } + iters *= 2; + } + throw_optimized_away_error(); + } + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_RUN_FOR_AT_LEAST_HPP_INCLUDED + +#include <algorithm> + +namespace Catch { + namespace Benchmark { + template <typename Duration> + struct ExecutionPlan { + int iterations_per_sample; + Duration estimated_duration; + Detail::BenchmarkFunction benchmark; + Duration warmup_time; + int warmup_iterations; + + template <typename Duration2> + operator ExecutionPlan<Duration2>() const { + return { iterations_per_sample, estimated_duration, benchmark, warmup_time, warmup_iterations }; + } + + template <typename Clock> + std::vector<FloatDuration<Clock>> run(const IConfig &cfg, Environment<FloatDuration<Clock>> env) const { + // warmup a bit + Detail::run_for_at_least<Clock>(std::chrono::duration_cast<ClockDuration<Clock>>(warmup_time), warmup_iterations, Detail::repeat(now<Clock>{})); + + std::vector<FloatDuration<Clock>> times; + times.reserve(cfg.benchmarkSamples()); + std::generate_n(std::back_inserter(times), cfg.benchmarkSamples(), [this, env] { + Detail::ChronometerModel<Clock> model; + this->benchmark(Chronometer(model, iterations_per_sample)); + auto sample_time = model.elapsed() - env.clock_cost.mean; + if (sample_time < FloatDuration<Clock>::zero()) sample_time = FloatDuration<Clock>::zero(); + return sample_time / iterations_per_sample; + }); + return times; + } + }; + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_EXECUTION_PLAN_HPP_INCLUDED + + +// Adapted from donated nonius code. + +#ifndef CATCH_ESTIMATE_CLOCK_HPP_INCLUDED +#define CATCH_ESTIMATE_CLOCK_HPP_INCLUDED + + + +// Adapted from donated nonius code. + +#ifndef CATCH_STATS_HPP_INCLUDED +#define CATCH_STATS_HPP_INCLUDED + + +#include <algorithm> +#include <vector> +#include <numeric> +#include <tuple> +#include <cmath> +#include <utility> + +namespace Catch { + namespace Benchmark { + namespace Detail { + using sample = std::vector<double>; + + double weighted_average_quantile(int k, int q, std::vector<double>::iterator first, std::vector<double>::iterator last); + + template <typename Iterator> + OutlierClassification classify_outliers(Iterator first, Iterator last) { + std::vector<double> copy(first, last); + + auto q1 = weighted_average_quantile(1, 4, copy.begin(), copy.end()); + auto q3 = weighted_average_quantile(3, 4, copy.begin(), copy.end()); + auto iqr = q3 - q1; + auto los = q1 - (iqr * 3.); + auto lom = q1 - (iqr * 1.5); + auto him = q3 + (iqr * 1.5); + auto his = q3 + (iqr * 3.); + + OutlierClassification o; + for (; first != last; ++first) { + auto&& t = *first; + if (t < los) ++o.low_severe; + else if (t < lom) ++o.low_mild; + else if (t > his) ++o.high_severe; + else if (t > him) ++o.high_mild; + ++o.samples_seen; + } + return o; + } + + template <typename Iterator> + double mean(Iterator first, Iterator last) { + auto count = last - first; + double sum = std::accumulate(first, last, 0.); + return sum / count; + } + + template <typename Estimator, typename Iterator> + sample jackknife(Estimator&& estimator, Iterator first, Iterator last) { + auto n = last - first; + auto second = first; + ++second; + sample results; + results.reserve(n); + + for (auto it = first; it != last; ++it) { + std::iter_swap(it, first); + results.push_back(estimator(second, last)); + } + + return results; + } + + inline double normal_cdf(double x) { + return std::erfc(-x / std::sqrt(2.0)) / 2.0; + } + + double erfc_inv(double x); + + double normal_quantile(double p); + + template <typename Iterator, typename Estimator> + Estimate<double> bootstrap(double confidence_level, Iterator first, Iterator last, sample const& resample, Estimator&& estimator) { + auto n_samples = last - first; + + double point = estimator(first, last); + // Degenerate case with a single sample + if (n_samples == 1) return { point, point, point, confidence_level }; + + sample jack = jackknife(estimator, first, last); + double jack_mean = mean(jack.begin(), jack.end()); + double sum_squares, sum_cubes; + std::tie(sum_squares, sum_cubes) = std::accumulate(jack.begin(), jack.end(), std::make_pair(0., 0.), [jack_mean](std::pair<double, double> sqcb, double x) -> std::pair<double, double> { + auto d = jack_mean - x; + auto d2 = d * d; + auto d3 = d2 * d; + return { sqcb.first + d2, sqcb.second + d3 }; + }); + + double accel = sum_cubes / (6 * std::pow(sum_squares, 1.5)); + int n = static_cast<int>(resample.size()); + double prob_n = std::count_if(resample.begin(), resample.end(), [point](double x) { return x < point; }) / (double)n; + // degenerate case with uniform samples + if (prob_n == 0) return { point, point, point, confidence_level }; + + double bias = normal_quantile(prob_n); + double z1 = normal_quantile((1. - confidence_level) / 2.); + + auto cumn = [n](double x) -> int { + return std::lround(normal_cdf(x) * n); }; + auto a = [bias, accel](double b) { return bias + b / (1. - accel * b); }; + double b1 = bias + z1; + double b2 = bias - z1; + double a1 = a(b1); + double a2 = a(b2); + auto lo = std::max(cumn(a1), 0); + auto hi = std::min(cumn(a2), n - 1); + + return { point, resample[lo], resample[hi], confidence_level }; + } + + double outlier_variance(Estimate<double> mean, Estimate<double> stddev, int n); + + struct bootstrap_analysis { + Estimate<double> mean; + Estimate<double> standard_deviation; + double outlier_variance; + }; + + bootstrap_analysis analyse_samples(double confidence_level, int n_resamples, std::vector<double>::iterator first, std::vector<double>::iterator last); + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_STATS_HPP_INCLUDED + +#include <algorithm> +#include <iterator> +#include <vector> +#include <cmath> + +namespace Catch { + namespace Benchmark { + namespace Detail { + template <typename Clock> + std::vector<double> resolution(int k) { + std::vector<TimePoint<Clock>> times; + times.reserve(k + 1); + std::generate_n(std::back_inserter(times), k + 1, now<Clock>{}); + + std::vector<double> deltas; + deltas.reserve(k); + std::transform(std::next(times.begin()), times.end(), times.begin(), + std::back_inserter(deltas), + [](TimePoint<Clock> a, TimePoint<Clock> b) { return static_cast<double>((a - b).count()); }); + + return deltas; + } + + const auto warmup_iterations = 10000; + const auto warmup_time = std::chrono::milliseconds(100); + const auto minimum_ticks = 1000; + const auto warmup_seed = 10000; + const auto clock_resolution_estimation_time = std::chrono::milliseconds(500); + const auto clock_cost_estimation_time_limit = std::chrono::seconds(1); + const auto clock_cost_estimation_tick_limit = 100000; + const auto clock_cost_estimation_time = std::chrono::milliseconds(10); + const auto clock_cost_estimation_iterations = 10000; + + template <typename Clock> + int warmup() { + return run_for_at_least<Clock>(std::chrono::duration_cast<ClockDuration<Clock>>(warmup_time), warmup_seed, &resolution<Clock>) + .iterations; + } + template <typename Clock> + EnvironmentEstimate<FloatDuration<Clock>> estimate_clock_resolution(int iterations) { + auto r = run_for_at_least<Clock>(std::chrono::duration_cast<ClockDuration<Clock>>(clock_resolution_estimation_time), iterations, &resolution<Clock>) + .result; + return { + FloatDuration<Clock>(mean(r.begin(), r.end())), + classify_outliers(r.begin(), r.end()), + }; + } + template <typename Clock> + EnvironmentEstimate<FloatDuration<Clock>> estimate_clock_cost(FloatDuration<Clock> resolution) { + auto time_limit = std::min(resolution * clock_cost_estimation_tick_limit, FloatDuration<Clock>(clock_cost_estimation_time_limit)); + auto time_clock = [](int k) { + return Detail::measure<Clock>([k] { + for (int i = 0; i < k; ++i) { + volatile auto ignored = Clock::now(); + (void)ignored; + } + }).elapsed; + }; + time_clock(1); + int iters = clock_cost_estimation_iterations; + auto&& r = run_for_at_least<Clock>(std::chrono::duration_cast<ClockDuration<Clock>>(clock_cost_estimation_time), iters, time_clock); + std::vector<double> times; + int nsamples = static_cast<int>(std::ceil(time_limit / r.elapsed)); + times.reserve(nsamples); + std::generate_n(std::back_inserter(times), nsamples, [time_clock, &r] { + return static_cast<double>((time_clock(r.iterations) / r.iterations).count()); + }); + return { + FloatDuration<Clock>(mean(times.begin(), times.end())), + classify_outliers(times.begin(), times.end()), + }; + } + + template <typename Clock> + Environment<FloatDuration<Clock>> measure_environment() { + static Environment<FloatDuration<Clock>>* env = nullptr; + if (env) { + return *env; + } + + auto iters = Detail::warmup<Clock>(); + auto resolution = Detail::estimate_clock_resolution<Clock>(iters); + auto cost = Detail::estimate_clock_cost<Clock>(resolution.mean); + + env = new Environment<FloatDuration<Clock>>{ resolution, cost }; + return *env; + } + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_ESTIMATE_CLOCK_HPP_INCLUDED + + +// Adapted from donated nonius code. + +#ifndef CATCH_ANALYSE_HPP_INCLUDED +#define CATCH_ANALYSE_HPP_INCLUDED + + + +// Adapted from donated nonius code. + +#ifndef CATCH_SAMPLE_ANALYSIS_HPP_INCLUDED +#define CATCH_SAMPLE_ANALYSIS_HPP_INCLUDED + + +#include <algorithm> +#include <vector> +#include <string> +#include <iterator> + +namespace Catch { + namespace Benchmark { + template <typename Duration> + struct SampleAnalysis { + std::vector<Duration> samples; + Estimate<Duration> mean; + Estimate<Duration> standard_deviation; + OutlierClassification outliers; + double outlier_variance; + + template <typename Duration2> + operator SampleAnalysis<Duration2>() const { + std::vector<Duration2> samples2; + samples2.reserve(samples.size()); + std::transform(samples.begin(), samples.end(), std::back_inserter(samples2), [](Duration d) { return Duration2(d); }); + return { + std::move(samples2), + mean, + standard_deviation, + outliers, + outlier_variance, + }; + } + }; + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_SAMPLE_ANALYSIS_HPP_INCLUDED + +#include <algorithm> +#include <iterator> +#include <vector> + +namespace Catch { + namespace Benchmark { + namespace Detail { + template <typename Duration, typename Iterator> + SampleAnalysis<Duration> analyse(const IConfig &cfg, Environment<Duration>, Iterator first, Iterator last) { + if (!cfg.benchmarkNoAnalysis()) { + std::vector<double> samples; + samples.reserve(last - first); + std::transform(first, last, std::back_inserter(samples), [](Duration d) { return d.count(); }); + + auto analysis = Catch::Benchmark::Detail::analyse_samples(cfg.benchmarkConfidenceInterval(), cfg.benchmarkResamples(), samples.begin(), samples.end()); + auto outliers = Catch::Benchmark::Detail::classify_outliers(samples.begin(), samples.end()); + + auto wrap_estimate = [](Estimate<double> e) { + return Estimate<Duration> { + Duration(e.point), + Duration(e.lower_bound), + Duration(e.upper_bound), + e.confidence_interval, + }; + }; + std::vector<Duration> samples2; + samples2.reserve(samples.size()); + std::transform(samples.begin(), samples.end(), std::back_inserter(samples2), [](double d) { return Duration(d); }); + return { + std::move(samples2), + wrap_estimate(analysis.mean), + wrap_estimate(analysis.standard_deviation), + outliers, + analysis.outlier_variance, + }; + } else { + std::vector<Duration> samples; + samples.reserve(last - first); + + Duration mean = Duration(0); + int i = 0; + for (auto it = first; it < last; ++it, ++i) { + samples.push_back(Duration(*it)); + mean += Duration(*it); + } + mean /= i; + + return { + std::move(samples), + Estimate<Duration>{mean, mean, mean, 0.0}, + Estimate<Duration>{Duration(0), Duration(0), Duration(0), 0.0}, + OutlierClassification{}, + 0.0 + }; + } + } + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_ANALYSE_HPP_INCLUDED + +#include <algorithm> +#include <functional> +#include <string> +#include <vector> +#include <cmath> + +namespace Catch { + namespace Benchmark { + struct Benchmark { + Benchmark(std::string&& benchmarkName) + : name(std::move(benchmarkName)) {} + + template <class FUN> + Benchmark(std::string&& benchmarkName , FUN &&func) + : fun(std::move(func)), name(std::move(benchmarkName)) {} + + template <typename Clock> + ExecutionPlan<FloatDuration<Clock>> prepare(const IConfig &cfg, Environment<FloatDuration<Clock>> env) const { + auto min_time = env.clock_resolution.mean * Detail::minimum_ticks; + auto run_time = std::max(min_time, std::chrono::duration_cast<decltype(min_time)>(cfg.benchmarkWarmupTime())); + auto&& test = Detail::run_for_at_least<Clock>(std::chrono::duration_cast<ClockDuration<Clock>>(run_time), 1, fun); + int new_iters = static_cast<int>(std::ceil(min_time * test.iterations / test.elapsed)); + return { new_iters, test.elapsed / test.iterations * new_iters * cfg.benchmarkSamples(), fun, std::chrono::duration_cast<FloatDuration<Clock>>(cfg.benchmarkWarmupTime()), Detail::warmup_iterations }; + } + + template <typename Clock = default_clock> + void run() { + auto const* cfg = getCurrentContext().getConfig(); + + auto env = Detail::measure_environment<Clock>(); + + getResultCapture().benchmarkPreparing(name); + CATCH_TRY{ + auto plan = user_code([&] { + return prepare<Clock>(*cfg, env); + }); + + BenchmarkInfo info { + name, + plan.estimated_duration.count(), + plan.iterations_per_sample, + cfg->benchmarkSamples(), + cfg->benchmarkResamples(), + env.clock_resolution.mean.count(), + env.clock_cost.mean.count() + }; + + getResultCapture().benchmarkStarting(info); + + auto samples = user_code([&] { + return plan.template run<Clock>(*cfg, env); + }); + + auto analysis = Detail::analyse(*cfg, env, samples.begin(), samples.end()); + BenchmarkStats<FloatDuration<Clock>> stats{ info, analysis.samples, analysis.mean, analysis.standard_deviation, analysis.outliers, analysis.outlier_variance }; + getResultCapture().benchmarkEnded(stats); + + } CATCH_CATCH_ALL{ + if (translateActiveException() != Detail::benchmarkErrorMsg) // benchmark errors have been reported, otherwise rethrow. + std::rethrow_exception(std::current_exception()); + } + } + + // sets lambda to be used in fun *and* executes benchmark! + template <typename Fun, + typename std::enable_if<!Detail::is_related<Fun, Benchmark>::value, int>::type = 0> + Benchmark & operator=(Fun func) { + fun = Detail::BenchmarkFunction(func); + run(); + return *this; + } + + explicit operator bool() { + return true; + } + + private: + Detail::BenchmarkFunction fun; + std::string name; + }; + } +} // namespace Catch + +#define INTERNAL_CATCH_GET_1_ARG(arg1, arg2, ...) arg1 +#define INTERNAL_CATCH_GET_2_ARG(arg1, arg2, ...) arg2 + +#define INTERNAL_CATCH_BENCHMARK(BenchmarkName, name, benchmarkIndex)\ + if( Catch::Benchmark::Benchmark BenchmarkName{name} ) \ + BenchmarkName = [&](int benchmarkIndex) + +#define INTERNAL_CATCH_BENCHMARK_ADVANCED(BenchmarkName, name)\ + if( Catch::Benchmark::Benchmark BenchmarkName{name} ) \ + BenchmarkName = [&] + +#if defined(CATCH_CONFIG_PREFIX_ALL) + +#define CATCH_BENCHMARK(...) \ + INTERNAL_CATCH_BENCHMARK(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____B_E_N_C_H____), INTERNAL_CATCH_GET_1_ARG(__VA_ARGS__,,), INTERNAL_CATCH_GET_2_ARG(__VA_ARGS__,,)) +#define CATCH_BENCHMARK_ADVANCED(name) \ + INTERNAL_CATCH_BENCHMARK_ADVANCED(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____B_E_N_C_H____), name) + +#else + +#define BENCHMARK(...) \ + INTERNAL_CATCH_BENCHMARK(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____B_E_N_C_H____), INTERNAL_CATCH_GET_1_ARG(__VA_ARGS__,,), INTERNAL_CATCH_GET_2_ARG(__VA_ARGS__,,)) +#define BENCHMARK_ADVANCED(name) \ + INTERNAL_CATCH_BENCHMARK_ADVANCED(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____B_E_N_C_H____), name) + +#endif + +#endif // CATCH_BENCHMARK_HPP_INCLUDED + + +// Adapted from donated nonius code. + +#ifndef CATCH_CONSTRUCTOR_HPP_INCLUDED +#define CATCH_CONSTRUCTOR_HPP_INCLUDED + +#include <type_traits> + +namespace Catch { + namespace Benchmark { + namespace Detail { + template <typename T, bool Destruct> + struct ObjectStorage + { + using TStorage = typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type; + + ObjectStorage() : data() {} + + ObjectStorage(const ObjectStorage& other) + { + new(&data) T(other.stored_object()); + } + + ObjectStorage(ObjectStorage&& other) + { + new(&data) T(std::move(other.stored_object())); + } + + ~ObjectStorage() { destruct_on_exit<T>(); } + + template <typename... Args> + void construct(Args&&... args) + { + new (&data) T(std::forward<Args>(args)...); + } + + template <bool AllowManualDestruction = !Destruct> + typename std::enable_if<AllowManualDestruction>::type destruct() + { + stored_object().~T(); + } + + private: + // If this is a constructor benchmark, destruct the underlying object + template <typename U> + void destruct_on_exit(typename std::enable_if<Destruct, U>::type* = 0) { destruct<true>(); } + // Otherwise, don't + template <typename U> + void destruct_on_exit(typename std::enable_if<!Destruct, U>::type* = 0) { } + + T& stored_object() { + return *static_cast<T*>(static_cast<void*>(&data)); + } + + T const& stored_object() const { + return *static_cast<T*>(static_cast<void*>(&data)); + } + + + TStorage data; + }; + } // namespace Detail + + template <typename T> + using storage_for = Detail::ObjectStorage<T, true>; + + template <typename T> + using destructable_object = Detail::ObjectStorage<T, false>; + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_CONSTRUCTOR_HPP_INCLUDED + +#endif // CATCH_BENCHMARK_ALL_HPP_INCLUDED + + +#ifndef CATCH_APPROX_HPP_INCLUDED +#define CATCH_APPROX_HPP_INCLUDED + + + +#ifndef CATCH_TOSTRING_HPP_INCLUDED +#define CATCH_TOSTRING_HPP_INCLUDED + + +#include <vector> +#include <cstddef> +#include <type_traits> +#include <string> + + +#ifndef CATCH_INTERFACES_ENUM_VALUES_REGISTRY_HPP_INCLUDED +#define CATCH_INTERFACES_ENUM_VALUES_REGISTRY_HPP_INCLUDED + + +#include <vector> + +namespace Catch { + + namespace Detail { + struct EnumInfo { + StringRef m_name; + std::vector<std::pair<int, StringRef>> m_values; + + ~EnumInfo(); + + StringRef lookup( int value ) const; + }; + } // namespace Detail + + struct IMutableEnumValuesRegistry { + virtual ~IMutableEnumValuesRegistry(); + + virtual Detail::EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::vector<int> const& values ) = 0; + + template<typename E> + Detail::EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::initializer_list<E> values ) { + static_assert(sizeof(int) >= sizeof(E), "Cannot serialize enum to int"); + std::vector<int> intValues; + intValues.reserve( values.size() ); + for( auto enumValue : values ) + intValues.push_back( static_cast<int>( enumValue ) ); + return registerEnum( enumName, allEnums, intValues ); + } + }; + +} // Catch + +#endif // CATCH_INTERFACES_ENUM_VALUES_REGISTRY_HPP_INCLUDED + +#ifdef CATCH_CONFIG_CPP17_STRING_VIEW +#include <string_view> +#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 + +namespace Catch { + 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 Stream, typename U> + static auto test(int) + -> decltype(std::declval<Stream&>() << std::declval<U>(), 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> + std::enable_if_t< + !std::is_enum<T>::value && !std::is_base_of<std::exception, T>::value, + std::string> convertUnstreamable( T const& ) { + return Detail::unprintableString; + } + template<typename T> + std::enable_if_t< + !std::is_enum<T>::value && std::is_base_of<std::exception, T>::value, + std::string> convertUnstreamable(T const& ex) { + return ex.what(); + } + + + template<typename T> + std::enable_if_t< + std::is_enum<T>::value, + std::string> convertUnstreamable( T const& value ) { + return convertUnknownEnumToString( value ); + } + +#if defined(_MANAGED) + //! Convert a CLR string to a utf8 std::string + template<typename T> + std::string clrReferenceToString( T^ ref ) { + if (ref == nullptr) + return std::string("null"); + auto bytes = System::Text::Encoding::UTF8->GetBytes(ref->ToString()); + cli::pin_ptr<System::Byte> p = &bytes[0]; + return std::string(reinterpret_cast<char const *>(p), bytes->Length); + } +#endif + + } // 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 + std::enable_if_t<::Catch::Detail::IsStreamInsertable<Fake>::value, std::string> + convert(const Fake& value) { + ReusableStringStream rss; + // NB: call using the function-like syntax to avoid ambiguity with + // user-defined templated operator<< under clang. + rss.operator<<(value); + return rss.str(); + } + + template <typename Fake = T> + static + std::enable_if_t<!::Catch::Detail::IsStreamInsertable<Fake>::value, std::string> + convert( const Fake& value ) { +#if !defined(CATCH_CONFIG_FALLBACK_STRINGIFIER) + return Detail::convertUnstreamable(value); +#else + return CATCH_CONFIG_FALLBACK_STRINGIFIER(value); +#endif + } + }; + + 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<std::remove_cv_t<std::remove_reference_t<T>>>::convert(e); + } + + template<typename E> + std::string convertUnknownEnumToString( E e ) { + return ::Catch::Detail::stringify(static_cast<std::underlying_type_t<E>>(e)); + } + +#if defined(_MANAGED) + template <typename T> + std::string stringify( T^ e ) { + return ::Catch::StringMaker<T^>::convert(e); + } +#endif + + } // namespace Detail + + // Some predefined specializations + + template<> + struct StringMaker<std::string> { + static std::string convert(const std::string& str); + }; + +#ifdef CATCH_CONFIG_CPP17_STRING_VIEW + template<> + struct StringMaker<std::string_view> { + static std::string convert(std::string_view str); + }; +#endif + + template<> + struct StringMaker<char const *> { + static std::string convert(char const * str); + }; + template<> + struct StringMaker<char *> { + static std::string convert(char * str); + }; + +#ifdef CATCH_CONFIG_WCHAR + template<> + struct StringMaker<std::wstring> { + static std::string convert(const std::wstring& wstr); + }; + +# ifdef CATCH_CONFIG_CPP17_STRING_VIEW + template<> + struct StringMaker<std::wstring_view> { + static std::string convert(std::wstring_view str); + }; +# endif + + 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); + }; +#endif + + // TBD: Should we use `strnlen` to ensure that we don't go out of the buffer, + // while keeping string semantics? + template<int SZ> + struct StringMaker<char[SZ]> { + static std::string convert(char const* str) { + return ::Catch::Detail::stringify(std::string{ str }); + } + }; + template<int SZ> + struct StringMaker<signed char[SZ]> { + static std::string convert(signed char const* str) { + return ::Catch::Detail::stringify(std::string{ reinterpret_cast<char const *>(str) }); + } + }; + template<int SZ> + struct StringMaker<unsigned char[SZ]> { + static std::string convert(unsigned char const* str) { + return ::Catch::Detail::stringify(std::string{ reinterpret_cast<char const *>(str) }); + } + }; + +#if defined(CATCH_CONFIG_CPP17_BYTE) + template<> + struct StringMaker<std::byte> { + static std::string convert(std::byte value); + }; +#endif // defined(CATCH_CONFIG_CPP17_BYTE) + 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) { + using namespace std::string_literals; + return b ? "true"s : "false"s; + } + }; + + 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) { + using namespace std::string_literals; + return "nullptr"s; + } + }; + + template<> + struct StringMaker<float> { + static std::string convert(float value); + static int precision; + }; + + template<> + struct StringMaker<double> { + static std::string convert(double value); + static int precision; + }; + + 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"; + } + } + }; + +#if defined(_MANAGED) + template <typename T> + struct StringMaker<T^> { + static std::string convert( T^ ref ) { + return ::Catch::Detail::clrReferenceToString(ref); + } + }; +#endif + + namespace Detail { + template<typename InputIterator, typename Sentinel = InputIterator> + std::string rangeToString(InputIterator first, Sentinel 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(); + } + } + +} // namespace Catch + +////////////////////////////////////////////////////// +// Separate std-lib types stringification, so it can be selectively enabled +// This means that we do not bring in their headers + +#if defined(CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS) +# define CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER +# define CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER +# define CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER +# define CATCH_CONFIG_ENABLE_OPTIONAL_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 + +#if defined(CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER) && defined(CATCH_CONFIG_CPP17_OPTIONAL) +#include <optional> +namespace Catch { + template<typename T> + struct StringMaker<std::optional<T> > { + static std::string convert(const std::optional<T>& optional) { + ReusableStringStream rss; + if (optional.has_value()) { + rss << ::Catch::Detail::stringify(*optional); + } else { + rss << "{ }"; + } + return rss.str(); + } + }; +} +#endif // CATCH_CONFIG_ENABLE_OPTIONAL_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 + +#if defined(CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER) && defined(CATCH_CONFIG_CPP17_VARIANT) +#include <variant> +namespace Catch { + template<> + struct StringMaker<std::monostate> { + static std::string convert(const std::monostate&) { + return "{ }"; + } + }; + + template<typename... Elements> + struct StringMaker<std::variant<Elements...>> { + static std::string convert(const std::variant<Elements...>& variant) { + if (variant.valueless_by_exception()) { + return "{valueless variant}"; + } else { + return std::visit( + [](const auto& value) { + return ::Catch::Detail::stringify(value); + }, + variant + ); + } + } + }; +} +#endif // CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER + +namespace Catch { + // Import begin/ end from std here + using std::begin; + using std::end; + + namespace detail { + template <typename...> + struct void_type { + using type = void; + }; + + template <typename T, typename = void> + struct is_range_impl : std::false_type { + }; + + template <typename T> + struct is_range_impl<T, typename void_type<decltype(begin(std::declval<T>()))>::type> : std::true_type { + }; + } // namespace detail + + template <typename T> + struct is_range : detail::is_range_impl<T> { + }; + +#if defined(_MANAGED) // Managed types are never ranges + template <typename T> + struct is_range<T^> { + static const bool value = false; + }; +#endif + + 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, std::enable_if_t<is_range<R>::value && !::Catch::Detail::IsStreamInsertable<R>::value>> { + 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 +#include <ctime> +#include <ratio> +#include <chrono> + + +namespace Catch { + +template <class Ratio> +struct ratio_string { + static std::string symbol() { + Catch::ReusableStringStream rss; + rss << '[' << Ratio::num << '/' + << Ratio::den << ']'; + return rss.str(); + } +}; + +template <> +struct ratio_string<std::atto> { + static std::string symbol() { return "a"; } +}; +template <> +struct ratio_string<std::femto> { + static std::string symbol() { return "f"; } +}; +template <> +struct ratio_string<std::pico> { + static std::string symbol() { return "p"; } +}; +template <> +struct ratio_string<std::nano> { + static std::string symbol() { return "n"; } +}; +template <> +struct ratio_string<std::micro> { + static std::string symbol() { return "u"; } +}; +template <> +struct ratio_string<std::milli> { + static std::string symbol() { return "m"; } +}; + + //////////// + // 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); + } + }; +} + + +#define INTERNAL_CATCH_REGISTER_ENUM( enumName, ... ) \ +namespace Catch { \ + template<> struct StringMaker<enumName> { \ + static std::string convert( enumName value ) { \ + static const auto& enumInfo = ::Catch::getMutableRegistryHub().getMutableEnumValuesRegistry().registerEnum( #enumName, #__VA_ARGS__, { __VA_ARGS__ } ); \ + return static_cast<std::string>(enumInfo.lookup( static_cast<int>( value ) )); \ + } \ + }; \ +} + +#define CATCH_REGISTER_ENUM( enumName, ... ) INTERNAL_CATCH_REGISTER_ENUM( enumName, __VA_ARGS__ ) + +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#endif // CATCH_TOSTRING_HPP_INCLUDED + +#include <type_traits> + +namespace Catch { + + class Approx { + private: + bool equalityComparisonImpl(double other) const; + // Sets and validates the new margin (margin >= 0) + void setMargin(double margin); + // Sets and validates the new epsilon (0 < epsilon < 1) + void setEpsilon(double epsilon); + + public: + explicit Approx ( double value ); + + static Approx custom(); + + Approx operator-() const; + + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> + Approx operator()( T const& value ) { + Approx approx( static_cast<double>(value) ); + approx.m_epsilon = m_epsilon; + approx.m_margin = m_margin; + approx.m_scale = m_scale; + return approx; + } + + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> + explicit Approx( T const& value ): Approx(static_cast<double>(value)) + {} + + + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> + 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 = std::enable_if_t<std::is_constructible<double, T>::value>> + friend bool operator == ( Approx const& lhs, const T& rhs ) { + return operator==( rhs, lhs ); + } + + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> + friend bool operator != ( T const& lhs, Approx const& rhs ) { + return !operator==( lhs, rhs ); + } + + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> + friend bool operator != ( Approx const& lhs, T const& rhs ) { + return !operator==( rhs, lhs ); + } + + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> + friend bool operator <= ( T const& lhs, Approx const& rhs ) { + return static_cast<double>(lhs) < rhs.m_value || lhs == rhs; + } + + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> + friend bool operator <= ( Approx const& lhs, T const& rhs ) { + return lhs.m_value < static_cast<double>(rhs) || lhs == rhs; + } + + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> + friend bool operator >= ( T const& lhs, Approx const& rhs ) { + return static_cast<double>(lhs) > rhs.m_value || lhs == rhs; + } + + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> + friend bool operator >= ( Approx const& lhs, T const& rhs ) { + return lhs.m_value > static_cast<double>(rhs) || lhs == rhs; + } + + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> + Approx& epsilon( T const& newEpsilon ) { + double epsilonAsDouble = static_cast<double>(newEpsilon); + setEpsilon(epsilonAsDouble); + return *this; + } + + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> + Approx& margin( T const& newMargin ) { + double marginAsDouble = static_cast<double>(newMargin); + setMargin(marginAsDouble); + return *this; + } + + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> + 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; + }; + +namespace literals { + Approx operator "" _a(long double val); + Approx operator "" _a(unsigned long long val); +} // end namespace literals + +template<> +struct StringMaker<Catch::Approx> { + static std::string convert(Catch::Approx const& value); +}; + +} // end namespace Catch + +#endif // CATCH_APPROX_HPP_INCLUDED + + +#ifndef CATCH_CONFIG_HPP_INCLUDED +#define CATCH_CONFIG_HPP_INCLUDED + + + +#ifndef CATCH_TEST_SPEC_HPP_INCLUDED +#define CATCH_TEST_SPEC_HPP_INCLUDED + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif + + + +#ifndef CATCH_WILDCARD_PATTERN_HPP_INCLUDED +#define CATCH_WILDCARD_PATTERN_HPP_INCLUDED + + + +#ifndef CATCH_CASE_SENSITIVE_HPP_INCLUDED +#define CATCH_CASE_SENSITIVE_HPP_INCLUDED + +namespace Catch { + + enum class CaseSensitive { Yes, No }; + +} // namespace Catch + +#endif // CATCH_CASE_SENSITIVE_HPP_INCLUDED + +#include <string> + +namespace Catch +{ + class WildcardPattern { + enum WildcardPosition { + NoWildcard = 0, + WildcardAtStart = 1, + WildcardAtEnd = 2, + WildcardAtBothEnds = WildcardAtStart | WildcardAtEnd + }; + + public: + + WildcardPattern( std::string const& pattern, CaseSensitive caseSensitivity ); + virtual ~WildcardPattern() = default; + virtual bool matches( std::string const& str ) const; + + private: + std::string normaliseString( std::string const& str ) const; + CaseSensitive m_caseSensitivity; + WildcardPosition m_wildcard = NoWildcard; + std::string m_pattern; + }; +} + +#endif // CATCH_WILDCARD_PATTERN_HPP_INCLUDED + +#include <string> +#include <vector> + +namespace Catch { + + struct IConfig; + struct TestCaseInfo; + class TestCaseHandle; + + class TestSpec { + + class Pattern { + public: + explicit Pattern( std::string const& name ); + virtual ~Pattern(); + virtual bool matches( TestCaseInfo const& testCase ) const = 0; + std::string const& name() const; + private: + std::string const m_name; + }; + + class NamePattern : public Pattern { + public: + explicit NamePattern( std::string const& name, std::string const& filterString ); + bool matches( TestCaseInfo const& testCase ) const override; + private: + WildcardPattern m_wildcardPattern; + }; + + class TagPattern : public Pattern { + public: + explicit TagPattern( std::string const& tag, std::string const& filterString ); + bool matches( TestCaseInfo const& testCase ) const override; + private: + std::string m_tag; + }; + + struct Filter { + std::vector<Detail::unique_ptr<Pattern>> m_required; + std::vector<Detail::unique_ptr<Pattern>> m_forbidden; + + bool matches( TestCaseInfo const& testCase ) const; + std::string name() const; + }; + + public: + struct FilterMatch { + std::string name; + std::vector<TestCaseHandle const*> tests; + }; + using Matches = std::vector<FilterMatch>; + using vectorStrings = std::vector<std::string>; + + bool hasFilters() const; + bool matches( TestCaseInfo const& testCase ) const; + Matches matchesByFilter( std::vector<TestCaseHandle> const& testCases, IConfig const& config ) const; + const vectorStrings & getInvalidArgs() const; + + private: + std::vector<Filter> m_filters; + std::vector<std::string> m_invalidArgs; + friend class TestSpecParser; + }; +} + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +#endif // CATCH_TEST_SPEC_HPP_INCLUDED + +#include <vector> +#include <string> + +namespace Catch { + + struct IStream; + + struct ConfigData { + bool listTests = false; + bool listTags = false; + bool listReporters = 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; + + bool benchmarkNoAnalysis = false; + unsigned int benchmarkSamples = 100; + double benchmarkConfidenceInterval = 0.95; + unsigned int benchmarkResamples = 100000; + std::chrono::milliseconds::rep benchmarkWarmupTime = 100; + + Verbosity verbosity = Verbosity::Normal; + WarnAbout::What warnings = WarnAbout::Nothing; + ShowDurations showDurations = ShowDurations::DefaultForReporter; + double minDuration = -1; + TestRunOrder runOrder = TestRunOrder::Declared; + UseColour useColour = UseColour::Auto; + WaitForKeypress::When waitForKeypress = WaitForKeypress::Never; + + std::string outputFilename; + std::string name; + std::string processName; +#ifndef CATCH_CONFIG_DEFAULT_REPORTER +#define CATCH_CONFIG_DEFAULT_REPORTER "console" +#endif + std::string reporterName = CATCH_CONFIG_DEFAULT_REPORTER; +#undef CATCH_CONFIG_DEFAULT_REPORTER + + std::vector<std::string> testsOrTags; + std::vector<std::string> sectionsToRun; + }; + + + class Config : public IConfig { + public: + + Config() = default; + Config( ConfigData const& data ); + ~Config() override; // = default in the cpp file + + std::string const& getFilename() const; + + bool listTests() const; + bool listTags() const; + bool listReporters() const; + + std::string getProcessName() const; + std::string const& getReporterName() const; + + std::vector<std::string> const& getTestsOrTags() const override; + std::vector<std::string> const& getSectionsToRun() const override; + + TestSpec const& testSpec() const override; + bool hasTestFilters() 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; + bool warnAboutNoTests() const override; + ShowDurations showDurations() const override; + double minDuration() const override; + TestRunOrder runOrder() const override; + unsigned int rngSeed() const override; + UseColour useColour() const override; + bool shouldDebugBreak() const override; + int abortAfter() const override; + bool showInvisibles() const override; + Verbosity verbosity() const override; + bool benchmarkNoAnalysis() const override; + int benchmarkSamples() const override; + double benchmarkConfidenceInterval() const override; + unsigned int benchmarkResamples() const override; + std::chrono::milliseconds benchmarkWarmupTime() const override; + + private: + + IStream const* openStream(); + ConfigData m_data; + + Detail::unique_ptr<IStream const> m_stream; + TestSpec m_testSpec; + bool m_hasTestFilters = false; + }; + +} // end namespace Catch + +#endif // CATCH_CONFIG_HPP_INCLUDED + + +#ifndef CATCH_MESSAGE_HPP_INCLUDED +#define CATCH_MESSAGE_HPP_INCLUDED + + +#include <string> +#include <vector> + +namespace Catch { + + struct MessageStream { + + template<typename T> + MessageStream& operator << ( T const& value ) { + m_stream << value; + return *this; + } + + ReusableStringStream m_stream; + }; + + struct MessageBuilder : MessageStream { + MessageBuilder( StringRef 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( ScopedMessage& duplicate ) = delete; + ScopedMessage( ScopedMessage&& old ) noexcept; + ~ScopedMessage(); + + MessageInfo m_info; + bool m_moved = false; + }; + + class Capturer { + std::vector<MessageInfo> m_messages; + IResultCapture& m_resultCapture = getResultCapture(); + size_t m_captured = 0; + public: + Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names ); + + Capturer(Capturer const&) = delete; + Capturer& operator=(Capturer const&) = delete; + + ~Capturer(); + + void captureValue( size_t index, std::string const& value ); + + template<typename T> + void captureValues( size_t index, T const& value ) { + captureValue( index, Catch::Detail::stringify( value ) ); + } + + template<typename T, typename... Ts> + void captureValues( size_t index, T const& value, Ts const&... values ) { + captureValue( index, Catch::Detail::stringify(value) ); + captureValues( index+1, values... ); + } + }; + +} // end namespace Catch + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_MSG( macroName, messageType, resultDisposition, ... ) \ + do { \ + Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::StringRef(), resultDisposition ); \ + catchAssertionHandler.handleMessage( messageType, ( Catch::MessageStream() << __VA_ARGS__ + ::Catch::StreamEndStop() ).m_stream.str() ); \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( false ) + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_CAPTURE( varName, macroName, ... ) \ + Catch::Capturer varName( macroName, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info, #__VA_ARGS__ ); \ + varName.captureValues( 0, __VA_ARGS__ ) + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_INFO( macroName, log ) \ + Catch::ScopedMessage INTERNAL_CATCH_UNIQUE_NAME( scopedMessage )( Catch::MessageBuilder( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log ) + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_UNSCOPED_INFO( macroName, log ) \ + Catch::getResultCapture().emplaceUnscopedMessage( Catch::MessageBuilder( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log ) + + +#if defined(CATCH_CONFIG_PREFIX_ALL) && !defined(CATCH_CONFIG_DISABLE) + + #define CATCH_INFO( msg ) INTERNAL_CATCH_INFO( "CATCH_INFO", msg ) + #define CATCH_UNSCOPED_INFO( msg ) INTERNAL_CATCH_UNSCOPED_INFO( "CATCH_UNSCOPED_INFO", msg ) + #define CATCH_WARN( msg ) INTERNAL_CATCH_MSG( "CATCH_WARN", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg ) + #define CATCH_CAPTURE( ... ) INTERNAL_CATCH_CAPTURE( INTERNAL_CATCH_UNIQUE_NAME(capturer), "CATCH_CAPTURE", __VA_ARGS__ ) + +#elif defined(CATCH_CONFIG_PREFIX_ALL) && defined(CATCH_CONFIG_DISABLE) + + #define CATCH_INFO( msg ) (void)(0) + #define CATCH_UNSCOPED_INFO( msg ) (void)(0) + #define CATCH_WARN( msg ) (void)(0) + #define CATCH_CAPTURE( ... ) (void)(0) + +#elif !defined(CATCH_CONFIG_PREFIX_ALL) && !defined(CATCH_CONFIG_DISABLE) + + #define INFO( msg ) INTERNAL_CATCH_INFO( "INFO", msg ) + #define UNSCOPED_INFO( msg ) INTERNAL_CATCH_UNSCOPED_INFO( "UNSCOPED_INFO", msg ) + #define WARN( msg ) INTERNAL_CATCH_MSG( "WARN", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg ) + #define CAPTURE( ... ) INTERNAL_CATCH_CAPTURE( INTERNAL_CATCH_UNIQUE_NAME(capturer), "CAPTURE", __VA_ARGS__ ) + +#elif !defined(CATCH_CONFIG_PREFIX_ALL) && defined(CATCH_CONFIG_DISABLE) + + #define INFO( msg ) (void)(0) + #define UNSCOPED_INFO( msg ) (void)(0) + #define WARN( msg ) (void)(0) + #define CAPTURE( ... ) (void)(0) + +#endif // end of user facing macro declarations + + + + +#endif // CATCH_MESSAGE_HPP_INCLUDED + + +#ifndef CATCH_REPORTER_REGISTRARS_HPP_INCLUDED +#define CATCH_REPORTER_REGISTRARS_HPP_INCLUDED + + + +#ifndef CATCH_INTERFACES_REPORTER_FACTORY_HPP_INCLUDED +#define CATCH_INTERFACES_REPORTER_FACTORY_HPP_INCLUDED + +namespace Catch { + + struct ReporterConfig; + + struct IReporterFactory { + virtual ~IReporterFactory(); // = default + + virtual IStreamingReporterPtr + create( ReporterConfig const& config ) const = 0; + virtual std::string getDescription() const = 0; + }; + using IReporterFactoryPtr = Detail::unique_ptr<IReporterFactory>; +} // namespace Catch + +#endif // CATCH_INTERFACES_REPORTER_FACTORY_HPP_INCLUDED + +namespace Catch { + + template <typename T> + class ReporterFactory : public IReporterFactory { + + IStreamingReporterPtr create( ReporterConfig const& config ) const override { + return Detail::make_unique<T>( config ); + } + + std::string getDescription() const override { + return T::getDescription(); + } + }; + + + template<typename T> + class ReporterRegistrar { + public: + explicit ReporterRegistrar( std::string const& name ) { + getMutableRegistryHub().registerReporter( name, Detail::make_unique<ReporterFactory<T>>() ); + } + }; + + template<typename T> + class ListenerRegistrar { + + class ListenerFactory : public IReporterFactory { + + IStreamingReporterPtr create( ReporterConfig const& config ) const override { + return Detail::make_unique<T>(config); + } + std::string getDescription() const override { + return std::string(); + } + }; + + public: + + ListenerRegistrar() { + getMutableRegistryHub().registerListener( Detail::make_unique<ListenerFactory>() ); + } + }; +} + +#if !defined(CATCH_CONFIG_DISABLE) + +#define CATCH_REGISTER_REPORTER( name, reporterType ) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::ReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name ); } \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION + +#define CATCH_REGISTER_LISTENER( listenerType ) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::ListenerRegistrar<listenerType> catch_internal_RegistrarFor##listenerType; } \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION +#else // CATCH_CONFIG_DISABLE + +#define CATCH_REGISTER_REPORTER(name, reporterType) +#define CATCH_REGISTER_LISTENER(listenerType) + +#endif // CATCH_CONFIG_DISABLE + +#endif // CATCH_REPORTER_REGISTRARS_HPP_INCLUDED + + +#ifndef CATCH_SESSION_HPP_INCLUDED +#define CATCH_SESSION_HPP_INCLUDED + + + +#ifndef CATCH_COMMANDLINE_HPP_INCLUDED +#define CATCH_COMMANDLINE_HPP_INCLUDED + + + +#ifndef CATCH_CLARA_HPP_INCLUDED +#define CATCH_CLARA_HPP_INCLUDED + +#if defined( __clang__ ) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wweak-vtables" +# pragma clang diagnostic ignored "-Wshadow" +# pragma clang diagnostic ignored "-Wdeprecated" +#endif + +#if defined( __GNUC__ ) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wsign-conversion" +#endif + +#ifndef CLARA_CONFIG_OPTIONAL_TYPE +# ifdef __has_include +# if __has_include( <optional>) && __cplusplus >= 201703L +# include <optional> +# define CLARA_CONFIG_OPTIONAL_TYPE std::optional +# endif +# endif +#endif + + +#include <cassert> +#include <cctype> +#include <memory> +#include <ostream> +#include <sstream> +#include <string> +#include <vector> + +namespace Catch { + namespace Clara { + + class Args; + class Parser; + + // enum of result types from a parse + enum class ParseResultType { + Matched, + NoMatch, + ShortCircuitAll, + ShortCircuitSame + }; + + 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; + + // 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; + }; + + // 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(); + + public: + explicit TokenStream( Args const& args ); + TokenStream( Iterator it, Iterator itEnd ); + + explicit operator bool() const { + return !m_tokenBuffer.empty() || it != itEnd; + } + + size_t count() const { + return m_tokenBuffer.size() + ( itEnd - it ); + } + + Token operator*() const { + assert( !m_tokenBuffer.empty() ); + return m_tokenBuffer.front(); + } + + Token const* operator->() const { + assert( !m_tokenBuffer.empty() ); + return &m_tokenBuffer.front(); + } + + TokenStream& operator++(); + }; + + //! Denotes type of a parsing result + enum class ResultType { + Ok, ///< No errors + LogicError, ///< Error in user-specified arguments for + ///< construction + RuntimeError ///< Error in parsing inputs + }; + + class ResultBase { + protected: + ResultBase( ResultType type ): m_type( type ) {} + virtual ~ResultBase(); // = default; + + + ResultBase(ResultBase const&) = default; + ResultBase& operator=(ResultBase const&) = default; + ResultBase(ResultBase&&) = default; + ResultBase& operator=(ResultBase&&) = default; + + virtual void enforceOk() const = 0; + + ResultType m_type; + }; + + template <typename T> class ResultValueBase : public ResultBase { + public: + auto value() const -> T const& { + enforceOk(); + return m_value; + } + + protected: + ResultValueBase( ResultType type ): ResultBase( type ) {} + + ResultValueBase( ResultValueBase const& other ): + ResultBase( other ) { + if ( m_type == ResultType::Ok ) + new ( &m_value ) T( other.m_value ); + } + + ResultValueBase( ResultType, T const& value ): ResultBase( ResultType::Ok ) { + new ( &m_value ) T( value ); + } + + auto operator=( ResultValueBase const& other ) + -> ResultValueBase& { + if ( m_type == ResultType::Ok ) + m_value.~T(); + ResultBase::operator=( other ); + if ( m_type == ResultType::Ok ) + new ( &m_value ) T( other.m_value ); + return *this; + } + + ~ResultValueBase() override { + if ( m_type == ResultType::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() != ResultType::Ok ); + } + + template <typename U> + static auto ok( U const& value ) -> BasicResult { + return { ResultType::Ok, value }; + } + static auto ok() -> BasicResult { return { ResultType::Ok }; } + static auto logicError( std::string const& message ) + -> BasicResult { + return { ResultType::LogicError, message }; + } + static auto runtimeError( std::string const& message ) + -> BasicResult { + return { ResultType::RuntimeError, message }; + } + + explicit operator bool() const { + return m_type == ResultType::Ok; + } + auto type() const -> ResultType { return m_type; } + auto errorMessage() const -> std::string { + return m_errorMessage; + } + + protected: + void enforceOk() const override { + + // Errors shouldn't reach this point, but if they do + // the actual error message will be in m_errorMessage + assert( m_type != ResultType::LogicError ); + assert( m_type != ResultType::RuntimeError ); + if ( m_type != ResultType::Ok ) + std::abort(); + } + + std::string + m_errorMessage; // Only populated if resultType is an error + + BasicResult( ResultType type, + std::string const& message ): + ResultValueBase<T>( type ), m_errorMessage( message ) { + assert( m_type != ResultType::Ok ); + } + + using ResultValueBase<T>::ResultValueBase; + using ResultBase::m_type; + }; + + class ParseState { + public: + ParseState( ParseResultType type, + TokenStream const& remainingTokens ); + + ParseResultType type() const { return m_type; } + TokenStream const& remainingTokens() const { + 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> + ParserResult convertInto( std::string const& source, T& target ) { + std::stringstream ss( source ); + ss >> target; + if ( ss.fail() ) { + return ParserResult::runtimeError( + "Unable to convert '" + source + + "' to destination type" ); + } else { + return ParserResult::ok( ParseResultType::Matched ); + } + } + ParserResult convertInto( std::string const& source, + std::string& target ); + ParserResult convertInto( std::string const& source, bool& target ); + +#ifdef CLARA_CONFIG_OPTIONAL_TYPE + template <typename T> + auto convertInto( std::string const& source, + CLARA_CONFIG_OPTIONAL_TYPE<T>& target ) + -> ParserResult { + T temp; + auto result = convertInto( source, temp ); + if ( result ) + target = std::move( temp ); + return result; + } +#endif // CLARA_CONFIG_OPTIONAL_TYPE + + struct BoundRef : Catch::Detail::NonCopyable { + virtual ~BoundRef() = default; + virtual bool isContainer() const; + virtual bool isFlag() const; + }; + struct BoundValueRefBase : BoundRef { + virtual auto setValue( std::string const& arg ) + -> ParserResult = 0; + }; + struct BoundFlagRefBase : BoundRef { + virtual auto setFlag( bool flag ) -> ParserResult = 0; + bool isFlag() const override; + }; + + template <typename T> struct BoundValueRef : BoundValueRefBase { + T& m_ref; + + explicit BoundValueRef( T& ref ): m_ref( ref ) {} + + ParserResult setValue( std::string const& arg ) 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 ) {} + + ParserResult setFlag( bool flag ) override; + }; + + 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> + 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 }; + + 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 size_t cardinality() const; + + InternalParseResult parse( Args const& args ) const; + }; + + template <typename DerivedT> + class ComposableParserImpl : public ParserBase { + public: + 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; + } + + std::string const& hint() const { return m_hint; } + }; + + } // namespace detail + + + // A parser for arguments + class Arg : public Detail::ParserRefImpl<Arg> { + public: + using ParserRefImpl::ParserRefImpl; + + Detail::InternalParseResult + parse(std::string const&, + Detail::TokenStream const& tokens) const override; + }; + + // A parser for options + class Opt : public Detail::ParserRefImpl<Opt> { + protected: + std::vector<std::string> m_optNames; + + public: + template <typename LambdaT> + explicit Opt(LambdaT const& ref) : + ParserRefImpl( + std::make_shared<Detail::BoundFlagLambda<LambdaT>>(ref)) {} + + explicit Opt(bool& 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; + } + + std::vector<Detail::HelpColumns> getHelpColumns() const; + + bool isMatch(std::string const& optToken) const; + + using ParserBase::parse; + + Detail::InternalParseResult + parse(std::string const&, + Detail::TokenStream const& tokens) const override; + + Detail::Result validate() const override; + }; + + // Specifies the name of the executable + class ExeName : public Detail::ComposableParserImpl<ExeName> { + std::shared_ptr<std::string> m_name; + std::shared_ptr<Detail::BoundValueRefBase> m_ref; + + template <typename LambdaT> + static auto makeRef(LambdaT const& lambda) + -> std::shared_ptr<Detail::BoundValueRefBase> { + return std::make_shared<Detail::BoundLambda<LambdaT>>(lambda); + } + + public: + ExeName(); + explicit ExeName(std::string& ref); + + template <typename LambdaT> + explicit ExeName(LambdaT const& lambda) : ExeName() { + m_ref = std::make_shared<Detail::BoundLambda<LambdaT>>(lambda); + } + + // The exe name is not parsed out of the normal tokens, but is + // handled specially + Detail::InternalParseResult + parse(std::string const&, + Detail::TokenStream const& tokens) const override; + + std::string const& name() const { return *m_name; } + Detail::ParserResult set(std::string const& newName); + }; + + + // A Combined parser + class Parser : Detail::ParserBase { + mutable ExeName m_exeName; + std::vector<Opt> m_options; + std::vector<Arg> m_args; + + public: + + 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; + } + + Parser& operator|=(Parser const& other); + + template <typename T> + auto operator|(T const& other) const -> Parser { + return Parser(*this) |= other; + } + + std::vector<Detail::HelpColumns> getHelpColumns() const; + + void writeToStream(std::ostream& os) const; + + friend auto operator<<(std::ostream& os, Parser const& parser) + -> std::ostream& { + parser.writeToStream(os); + return os; + } + + Detail::Result validate() const override; + + using ParserBase::parse; + Detail::InternalParseResult + parse(std::string const& exeName, + Detail::TokenStream const& tokens) const override; + }; + + // Transport for raw args (copied from main args, or supplied via + // init list for testing) + class Args { + friend Detail::TokenStream; + std::string m_exeName; + std::vector<std::string> m_args; + + public: + Args(int argc, char const* const* argv); + Args(std::initializer_list<std::string> args); + + std::string const& exeName() const { return m_exeName; } + }; + + + // Convenience wrapper for option parser that specifies the help option + struct Help : Opt { + Help(bool& showHelpFlag); + }; + + // Result type for parser operation + using Detail::ParserResult; + + namespace Detail { + template <typename DerivedT> + template <typename T> + Parser + ComposableParserImpl<DerivedT>::operator|(T const& other) const { + return Parser() | static_cast<DerivedT const&>(*this) | other; + } + } + + } // namespace Clara +} // namespace Catch + +#if defined( __clang__ ) +# pragma clang diagnostic pop +#endif + +#if defined( __GNUC__ ) +# pragma GCC diagnostic pop +#endif + +#endif // CATCH_CLARA_HPP_INCLUDED + +namespace Catch { + + struct ConfigData; + + Clara::Parser makeCommandLineParser( ConfigData& config ); + +} // end namespace Catch + +#endif // CATCH_COMMANDLINE_HPP_INCLUDED + +namespace Catch { + + class Session : Detail::NonCopyable { + public: + + Session(); + ~Session(); + + void showHelp() const; + void libIdentify(); + + int applyCommandLine( int argc, char const * const * argv ); + #if defined(CATCH_CONFIG_WCHAR) && defined(_WIN32) && defined(UNICODE) + int applyCommandLine( int argc, wchar_t const * const * argv ); + #endif + + void useConfigData( ConfigData const& configData ); + + template<typename CharT> + int run(int argc, CharT const * const argv[]) { + if (m_startupExceptions) + return 1; + int returnCode = applyCommandLine(argc, argv); + if (returnCode == 0) + returnCode = run(); + return returnCode; + } + + 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; + Detail::unique_ptr<Config> m_config; + bool m_startupExceptions = false; + }; + +} // end namespace Catch + +#endif // CATCH_SESSION_HPP_INCLUDED + + +#ifndef CATCH_TAG_ALIAS_HPP_INCLUDED +#define CATCH_TAG_ALIAS_HPP_INCLUDED + + +#include <string> + +namespace Catch { + + struct TagAlias { + TagAlias(std::string const& _tag, SourceLineInfo _lineInfo): + tag(_tag), + lineInfo(_lineInfo) + {} + + std::string tag; + SourceLineInfo lineInfo; + }; + +} // end namespace Catch + +#endif // CATCH_TAG_ALIAS_HPP_INCLUDED + + +#ifndef CATCH_TAG_ALIAS_AUTOREGISTRAR_HPP_INCLUDED +#define CATCH_TAG_ALIAS_AUTOREGISTRAR_HPP_INCLUDED + + +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_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::RegistrarForTagAliases INTERNAL_CATCH_UNIQUE_NAME( AutoRegisterTagAlias )( alias, spec, CATCH_INTERNAL_LINEINFO ); } \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION + +#endif // CATCH_TAG_ALIAS_AUTOREGISTRAR_HPP_INCLUDED + + +#ifndef CATCH_TEMPLATE_TEST_MACROS_HPP_INCLUDED +#define CATCH_TEMPLATE_TEST_MACROS_HPP_INCLUDED + +// We need this suppression to leak, because it took until GCC 10 +// for the front end to handle local suppression via _Pragma properly +// inside templates (so `TEMPLATE_TEST_CASE` and co). +// **THIS IS DIFFERENT FOR STANDARD TESTS, WHERE GCC 9 IS SUFFICIENT** +#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && __GNUC__ < 10 +#pragma GCC diagnostic ignored "-Wparentheses" +#endif + + + + +#ifndef CATCH_TEST_MACROS_HPP_INCLUDED +#define CATCH_TEST_MACROS_HPP_INCLUDED + + + +#ifndef CATCH_TEST_MACRO_IMPL_HPP_INCLUDED +#define CATCH_TEST_MACRO_IMPL_HPP_INCLUDED + + + +#ifndef CATCH_ASSERTION_HANDLER_HPP_INCLUDED +#define CATCH_ASSERTION_HANDLER_HPP_INCLUDED + + + +#ifndef CATCH_DECOMPOSER_HPP_INCLUDED +#define CATCH_DECOMPOSER_HPP_INCLUDED + + +#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 +#pragma warning(disable:4800) // Forcing result to true or false +#endif + +#ifdef __clang__ +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wsign-compare" +#elif defined __GNUC__ +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wsign-compare" +#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 ) + {} + + ITransientExpression() = default; + ITransientExpression(ITransientExpression const&) = default; + ITransientExpression& operator=(ITransientExpression const&) = default; + + // We don't actually need a virtual destructor, but many static analysers + // complain if it's not here :-( + virtual ~ITransientExpression(); // = default; + + bool m_isBinaryExpression; + bool m_result; + friend std::ostream& operator<<(std::ostream& out, ITransientExpression const& expr) { + expr.streamReconstructedExpression(out); + return out; + } + }; + + 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 T> + auto operator && ( T ) const -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<T>::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + + template<typename T> + auto operator || ( T ) const -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<T>::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + + template<typename T> + auto operator == ( T ) const -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<T>::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + + template<typename T> + auto operator != ( T ) const -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<T>::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + + template<typename T> + auto operator > ( T ) const -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<T>::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + + template<typename T> + auto operator < ( T ) const -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<T>::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + + template<typename T> + auto operator >= ( T ) const -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<T>::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + + template<typename T> + auto operator <= ( T ) const -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<T>::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + }; + + 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, static_cast<bool>(lhs) }, + 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, "=="_sr, rhs }; + } + auto operator == ( bool rhs ) -> BinaryExpr<LhsT, bool> const { + return { m_lhs == rhs, m_lhs, "=="_sr, rhs }; + } + + template<typename RhsT> + auto operator != ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const { + return { compareNotEqual( m_lhs, rhs ), m_lhs, "!="_sr, rhs }; + } + auto operator != ( bool rhs ) -> BinaryExpr<LhsT, bool> const { + return { m_lhs != rhs, m_lhs, "!="_sr, rhs }; + } + + template<typename RhsT> + auto operator > ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const { + return { static_cast<bool>(m_lhs > rhs), m_lhs, ">"_sr, rhs }; + } + template<typename RhsT> + auto operator < ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const { + return { static_cast<bool>(m_lhs < rhs), m_lhs, "<"_sr, rhs }; + } + template<typename RhsT> + auto operator >= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const { + return { static_cast<bool>(m_lhs >= rhs), m_lhs, ">="_sr, rhs }; + } + template<typename RhsT> + auto operator <= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const { + return { static_cast<bool>(m_lhs <= rhs), m_lhs, "<="_sr, rhs }; + } + template <typename RhsT> + auto operator | (RhsT const& rhs) -> BinaryExpr<LhsT, RhsT const&> const { + return { static_cast<bool>(m_lhs | rhs), m_lhs, "|"_sr, rhs }; + } + template <typename RhsT> + auto operator & (RhsT const& rhs) -> BinaryExpr<LhsT, RhsT const&> const { + return { static_cast<bool>(m_lhs & rhs), m_lhs, "&"_sr, rhs }; + } + template <typename RhsT> + auto operator ^ (RhsT const& rhs) -> BinaryExpr<LhsT, RhsT const&> const { + return { static_cast<bool>(m_lhs ^ rhs), m_lhs, "^"_sr, rhs }; + } + + template<typename RhsT> + auto operator && ( RhsT const& ) -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<RhsT>::value, + "operator&& is not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + + template<typename RhsT> + auto operator || ( RhsT const& ) -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<RhsT>::value, + "operator|| is not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + + 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 +#ifdef __clang__ +# pragma clang diagnostic pop +#elif defined __GNUC__ +# pragma GCC diagnostic pop +#endif + +#endif // CATCH_DECOMPOSER_HPP_INCLUDED + +namespace Catch { + + struct TestFailureException{}; + struct AssertionResultData; + struct IResultCapture; + class RunContext; + + 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 const& 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 const& matcherString ); + +} // namespace Catch + +#endif // CATCH_ASSERTION_HANDLER_HPP_INCLUDED + +// We need this suppression to leak, because it took until GCC 9 +// for the front end to handle local suppression via _Pragma properly +#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && __GNUC__ < 9 + #pragma GCC diagnostic ignored "-Wparentheses" +#endif + +#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) || defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + +/////////////////////////////////////////////////////////////////////////////// +// 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 { \ + /* The expression should not be evaluated, but warnings should hopefully be checked */ \ + CATCH_INTERNAL_IGNORE_BUT_WARN(__VA_ARGS__); \ + Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \ + INTERNAL_CATCH_TRY { \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ + catchAssertionHandler.handleExpr( Catch::Decomposer() <= __VA_ARGS__ ); \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ + } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( (void)0, (false) && static_cast<bool>( !!(__VA_ARGS__) ) ) + +/////////////////////////////////////////////////////////////////////////////// +#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_sr, 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_sr, 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_sr, 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 ) + + + +/////////////////////////////////////////////////////////////////////////////// +// 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_sr, 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##_catch_sr ); \ + } \ + else \ + catchAssertionHandler.handleThrowingCallSkipped(); \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( false ) + +#endif // CATCH_CONFIG_DISABLE + +#endif // CATCH_TEST_MACRO_IMPL_HPP_INCLUDED + + +#ifndef CATCH_PREPROCESSOR_HPP_INCLUDED +#define CATCH_PREPROCESSOR_HPP_INCLUDED + + +#if defined(__GNUC__) +// We need to silence "empty __VA_ARGS__ warning", and using just _Pragma does not work +#pragma GCC system_header +#endif + + +#define CATCH_RECURSION_LEVEL0(...) __VA_ARGS__ +#define CATCH_RECURSION_LEVEL1(...) CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(__VA_ARGS__))) +#define CATCH_RECURSION_LEVEL2(...) CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(__VA_ARGS__))) +#define CATCH_RECURSION_LEVEL3(...) CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(__VA_ARGS__))) +#define CATCH_RECURSION_LEVEL4(...) CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(__VA_ARGS__))) +#define CATCH_RECURSION_LEVEL5(...) CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(__VA_ARGS__))) + +#ifdef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#define INTERNAL_CATCH_EXPAND_VARGS(...) __VA_ARGS__ +// MSVC needs more evaluations +#define CATCH_RECURSION_LEVEL6(...) CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(__VA_ARGS__))) +#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL6(CATCH_RECURSION_LEVEL6(__VA_ARGS__)) +#else +#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL5(__VA_ARGS__) +#endif + +#define CATCH_REC_END(...) +#define CATCH_REC_OUT + +#define CATCH_EMPTY() +#define CATCH_DEFER(id) id CATCH_EMPTY() + +#define CATCH_REC_GET_END2() 0, CATCH_REC_END +#define CATCH_REC_GET_END1(...) CATCH_REC_GET_END2 +#define CATCH_REC_GET_END(...) CATCH_REC_GET_END1 +#define CATCH_REC_NEXT0(test, next, ...) next CATCH_REC_OUT +#define CATCH_REC_NEXT1(test, next) CATCH_DEFER ( CATCH_REC_NEXT0 ) ( test, next, 0) +#define CATCH_REC_NEXT(test, next) CATCH_REC_NEXT1(CATCH_REC_GET_END test, next) + +#define CATCH_REC_LIST0(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ ) +#define CATCH_REC_LIST1(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0) ) ( f, peek, __VA_ARGS__ ) +#define CATCH_REC_LIST2(f, x, peek, ...) f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ ) + +#define CATCH_REC_LIST0_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ ) +#define CATCH_REC_LIST1_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0_UD) ) ( f, userdata, peek, __VA_ARGS__ ) +#define CATCH_REC_LIST2_UD(f, userdata, x, peek, ...) f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ ) + +// Applies the function macro `f` to each of the remaining parameters, inserts commas between the results, +// and passes userdata as the first parameter to each invocation, +// e.g. CATCH_REC_LIST_UD(f, x, a, b, c) evaluates to f(x, a), f(x, b), f(x, c) +#define CATCH_REC_LIST_UD(f, userdata, ...) CATCH_RECURSE(CATCH_REC_LIST2_UD(f, userdata, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) + +#define CATCH_REC_LIST(f, ...) CATCH_RECURSE(CATCH_REC_LIST2(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) + +#define INTERNAL_CATCH_EXPAND1(param) INTERNAL_CATCH_EXPAND2(param) +#define INTERNAL_CATCH_EXPAND2(...) INTERNAL_CATCH_NO## __VA_ARGS__ +#define INTERNAL_CATCH_DEF(...) INTERNAL_CATCH_DEF __VA_ARGS__ +#define INTERNAL_CATCH_NOINTERNAL_CATCH_DEF +#define INTERNAL_CATCH_STRINGIZE(...) INTERNAL_CATCH_STRINGIZE2(__VA_ARGS__) +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#define INTERNAL_CATCH_STRINGIZE2(...) #__VA_ARGS__ +#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) +#else +// MSVC is adding extra space and needs another indirection to expand INTERNAL_CATCH_NOINTERNAL_CATCH_DEF +#define INTERNAL_CATCH_STRINGIZE2(...) INTERNAL_CATCH_STRINGIZE3(__VA_ARGS__) +#define INTERNAL_CATCH_STRINGIZE3(...) #__VA_ARGS__ +#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) (INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) + 1) +#endif + +#define INTERNAL_CATCH_MAKE_NAMESPACE2(...) ns_##__VA_ARGS__ +#define INTERNAL_CATCH_MAKE_NAMESPACE(name) INTERNAL_CATCH_MAKE_NAMESPACE2(name) + +#define INTERNAL_CATCH_REMOVE_PARENS(...) INTERNAL_CATCH_EXPAND1(INTERNAL_CATCH_DEF __VA_ARGS__) + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS_GEN(__VA_ARGS__)>()) +#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__)) +#else +#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) INTERNAL_CATCH_EXPAND_VARGS(decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS_GEN(__VA_ARGS__)>())) +#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__))) +#endif + +#define INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(...)\ + CATCH_REC_LIST(INTERNAL_CATCH_MAKE_TYPE_LIST,__VA_ARGS__) + +#define INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_0) INTERNAL_CATCH_REMOVE_PARENS(_0) +#define INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_0, _1) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_1) +#define INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_0, _1, _2) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_1, _2) +#define INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_0, _1, _2, _3) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_1, _2, _3) +#define INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_0, _1, _2, _3, _4) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_1, _2, _3, _4) +#define INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_0, _1, _2, _3, _4, _5) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_1, _2, _3, _4, _5) +#define INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_0, _1, _2, _3, _4, _5, _6) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_1, _2, _3, _4, _5, _6) +#define INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_0, _1, _2, _3, _4, _5, _6, _7) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_1, _2, _3, _4, _5, _6, _7) +#define INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_1, _2, _3, _4, _5, _6, _7, _8) +#define INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9) +#define INTERNAL_CATCH_REMOVE_PARENS_11_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) + +#define INTERNAL_CATCH_VA_NARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N + +#define INTERNAL_CATCH_TYPE_GEN\ + template<typename...> struct TypeList {};\ + template<typename...Ts>\ + constexpr auto get_wrapper() noexcept -> TypeList<Ts...> { return {}; }\ + template<template<typename...> class...> struct TemplateTypeList{};\ + template<template<typename...> class...Cs>\ + constexpr auto get_wrapper() noexcept -> TemplateTypeList<Cs...> { return {}; }\ + template<typename...>\ + struct append;\ + template<typename...>\ + struct rewrap;\ + template<template<typename...> class, typename...>\ + struct create;\ + template<template<typename...> class, typename>\ + struct convert;\ + \ + template<typename T> \ + struct append<T> { using type = T; };\ + template< template<typename...> class L1, typename...E1, template<typename...> class L2, typename...E2, typename...Rest>\ + struct append<L1<E1...>, L2<E2...>, Rest...> { using type = typename append<L1<E1...,E2...>, Rest...>::type; };\ + template< template<typename...> class L1, typename...E1, typename...Rest>\ + struct append<L1<E1...>, TypeList<mpl_::na>, Rest...> { using type = L1<E1...>; };\ + \ + template< template<typename...> class Container, template<typename...> class List, typename...elems>\ + struct rewrap<TemplateTypeList<Container>, List<elems...>> { using type = TypeList<Container<elems...>>; };\ + template< template<typename...> class Container, template<typename...> class List, class...Elems, typename...Elements>\ + struct rewrap<TemplateTypeList<Container>, List<Elems...>, Elements...> { using type = typename append<TypeList<Container<Elems...>>, typename rewrap<TemplateTypeList<Container>, Elements...>::type>::type; };\ + \ + template<template <typename...> class Final, template< typename...> class...Containers, typename...Types>\ + struct create<Final, TemplateTypeList<Containers...>, TypeList<Types...>> { using type = typename append<Final<>, typename rewrap<TemplateTypeList<Containers>, Types...>::type...>::type; };\ + template<template <typename...> class Final, template <typename...> class List, typename...Ts>\ + struct convert<Final, List<Ts...>> { using type = typename append<Final<>,TypeList<Ts>...>::type; }; + +#define INTERNAL_CATCH_NTTP_1(signature, ...)\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)> struct Nttp{};\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\ + constexpr auto get_wrapper() noexcept -> Nttp<__VA_ARGS__> { return {}; } \ + template<template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class...> struct NttpTemplateTypeList{};\ + template<template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class...Cs>\ + constexpr auto get_wrapper() noexcept -> NttpTemplateTypeList<Cs...> { return {}; } \ + \ + template< template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class Container, template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class List, INTERNAL_CATCH_REMOVE_PARENS(signature)>\ + struct rewrap<NttpTemplateTypeList<Container>, List<__VA_ARGS__>> { using type = TypeList<Container<__VA_ARGS__>>; };\ + template< template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class Container, template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class List, INTERNAL_CATCH_REMOVE_PARENS(signature), typename...Elements>\ + struct rewrap<NttpTemplateTypeList<Container>, List<__VA_ARGS__>, Elements...> { using type = typename append<TypeList<Container<__VA_ARGS__>>, typename rewrap<NttpTemplateTypeList<Container>, Elements...>::type>::type; };\ + template<template <typename...> class Final, template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class...Containers, typename...Types>\ + struct create<Final, NttpTemplateTypeList<Containers...>, TypeList<Types...>> { using type = typename append<Final<>, typename rewrap<NttpTemplateTypeList<Containers>, Types...>::type...>::type; }; + +#define INTERNAL_CATCH_DECLARE_SIG_TEST0(TestName) +#define INTERNAL_CATCH_DECLARE_SIG_TEST1(TestName, signature)\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\ + static void TestName() +#define INTERNAL_CATCH_DECLARE_SIG_TEST_X(TestName, signature, ...)\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\ + static void TestName() + +#define INTERNAL_CATCH_DEFINE_SIG_TEST0(TestName) +#define INTERNAL_CATCH_DEFINE_SIG_TEST1(TestName, signature)\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\ + static void TestName() +#define INTERNAL_CATCH_DEFINE_SIG_TEST_X(TestName, signature,...)\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\ + static void TestName() + +#define INTERNAL_CATCH_NTTP_REGISTER0(TestFunc, signature)\ + template<typename Type>\ + void reg_test(TypeList<Type>, Catch::NameAndTags nameAndTags)\ + {\ + Catch::AutoReg( Catch::makeTestInvoker(&TestFunc<Type>), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), nameAndTags);\ + } + +#define INTERNAL_CATCH_NTTP_REGISTER(TestFunc, signature, ...)\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\ + void reg_test(Nttp<__VA_ARGS__>, Catch::NameAndTags nameAndTags)\ + {\ + Catch::AutoReg( Catch::makeTestInvoker(&TestFunc<__VA_ARGS__>), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), nameAndTags);\ + } + +#define INTERNAL_CATCH_NTTP_REGISTER_METHOD0(TestName, signature, ...)\ + template<typename Type>\ + void reg_test(TypeList<Type>, Catch::StringRef className, Catch::NameAndTags nameAndTags)\ + {\ + Catch::AutoReg( Catch::makeTestInvoker(&TestName<Type>::test), CATCH_INTERNAL_LINEINFO, className, nameAndTags);\ + } + +#define INTERNAL_CATCH_NTTP_REGISTER_METHOD(TestName, signature, ...)\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\ + void reg_test(Nttp<__VA_ARGS__>, Catch::StringRef className, Catch::NameAndTags nameAndTags)\ + {\ + Catch::AutoReg( Catch::makeTestInvoker(&TestName<__VA_ARGS__>::test), CATCH_INTERNAL_LINEINFO, className, nameAndTags);\ + } + +#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD0(TestName, ClassName) +#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD1(TestName, ClassName, signature)\ + template<typename TestType> \ + struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName)<TestType> { \ + void test();\ + } + +#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X(TestName, ClassName, signature, ...)\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)> \ + struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName)<__VA_ARGS__> { \ + void test();\ + } + +#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD0(TestName) +#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD1(TestName, signature)\ + template<typename TestType> \ + void INTERNAL_CATCH_MAKE_NAMESPACE(TestName)::TestName<TestType>::test() +#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X(TestName, signature, ...)\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)> \ + void INTERNAL_CATCH_MAKE_NAMESPACE(TestName)::TestName<__VA_ARGS__>::test() + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#define INTERNAL_CATCH_NTTP_0 +#define INTERNAL_CATCH_NTTP_GEN(...) INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__),INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_0) +#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD1, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD0)(TestName, __VA_ARGS__) +#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD1, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD0)(TestName, ClassName, __VA_ARGS__) +#define INTERNAL_CATCH_NTTP_REG_METHOD_GEN(TestName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD0, INTERNAL_CATCH_NTTP_REGISTER_METHOD0)(TestName, __VA_ARGS__) +#define INTERNAL_CATCH_NTTP_REG_GEN(TestFunc, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER0, INTERNAL_CATCH_NTTP_REGISTER0)(TestFunc, __VA_ARGS__) +#define INTERNAL_CATCH_DEFINE_SIG_TEST(TestName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DEFINE_SIG_TEST1, INTERNAL_CATCH_DEFINE_SIG_TEST0)(TestName, __VA_ARGS__) +#define INTERNAL_CATCH_DECLARE_SIG_TEST(TestName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DECLARE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST1, INTERNAL_CATCH_DECLARE_SIG_TEST0)(TestName, __VA_ARGS__) +#define INTERNAL_CATCH_REMOVE_PARENS_GEN(...) INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_REMOVE_PARENS_11_ARG,INTERNAL_CATCH_REMOVE_PARENS_10_ARG,INTERNAL_CATCH_REMOVE_PARENS_9_ARG,INTERNAL_CATCH_REMOVE_PARENS_8_ARG,INTERNAL_CATCH_REMOVE_PARENS_7_ARG,INTERNAL_CATCH_REMOVE_PARENS_6_ARG,INTERNAL_CATCH_REMOVE_PARENS_5_ARG,INTERNAL_CATCH_REMOVE_PARENS_4_ARG,INTERNAL_CATCH_REMOVE_PARENS_3_ARG,INTERNAL_CATCH_REMOVE_PARENS_2_ARG,INTERNAL_CATCH_REMOVE_PARENS_1_ARG)(__VA_ARGS__) +#else +#define INTERNAL_CATCH_NTTP_0(signature) +#define INTERNAL_CATCH_NTTP_GEN(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1,INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_0)( __VA_ARGS__)) +#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD1, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD0)(TestName, __VA_ARGS__)) +#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD1, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD0)(TestName, ClassName, __VA_ARGS__)) +#define INTERNAL_CATCH_NTTP_REG_METHOD_GEN(TestName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD0, INTERNAL_CATCH_NTTP_REGISTER_METHOD0)(TestName, __VA_ARGS__)) +#define INTERNAL_CATCH_NTTP_REG_GEN(TestFunc, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER0, INTERNAL_CATCH_NTTP_REGISTER0)(TestFunc, __VA_ARGS__)) +#define INTERNAL_CATCH_DEFINE_SIG_TEST(TestName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DEFINE_SIG_TEST1, INTERNAL_CATCH_DEFINE_SIG_TEST0)(TestName, __VA_ARGS__)) +#define INTERNAL_CATCH_DECLARE_SIG_TEST(TestName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DECLARE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST1, INTERNAL_CATCH_DECLARE_SIG_TEST0)(TestName, __VA_ARGS__)) +#define INTERNAL_CATCH_REMOVE_PARENS_GEN(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_REMOVE_PARENS_11_ARG,INTERNAL_CATCH_REMOVE_PARENS_10_ARG,INTERNAL_CATCH_REMOVE_PARENS_9_ARG,INTERNAL_CATCH_REMOVE_PARENS_8_ARG,INTERNAL_CATCH_REMOVE_PARENS_7_ARG,INTERNAL_CATCH_REMOVE_PARENS_6_ARG,INTERNAL_CATCH_REMOVE_PARENS_5_ARG,INTERNAL_CATCH_REMOVE_PARENS_4_ARG,INTERNAL_CATCH_REMOVE_PARENS_3_ARG,INTERNAL_CATCH_REMOVE_PARENS_2_ARG,INTERNAL_CATCH_REMOVE_PARENS_1_ARG)(__VA_ARGS__)) +#endif + +#endif // CATCH_PREPROCESSOR_HPP_INCLUDED + + +#ifndef CATCH_SECTION_HPP_INCLUDED +#define CATCH_SECTION_HPP_INCLUDED + + + +#ifndef CATCH_TIMER_HPP_INCLUDED +#define CATCH_TIMER_HPP_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 // CATCH_TIMER_HPP_INCLUDED + +#include <string> + +namespace Catch { + + class Section : Detail::NonCopyable { + public: + Section( SectionInfo&& info ); + ~Section(); + + // This indicates whether the section should be executed or not + explicit operator bool() const; + + private: + SectionInfo m_info; + + Counts m_assertions; + bool m_sectionIncluded; + Timer m_timer; + }; + +} // end namespace Catch + +#define INTERNAL_CATCH_SECTION( ... ) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) ) \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION + +#define INTERNAL_CATCH_DYNAMIC_SECTION( ... ) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, (Catch::ReusableStringStream() << __VA_ARGS__).str() ) ) \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION + +#endif // CATCH_SECTION_HPP_INCLUDED + + +#ifndef CATCH_TEST_REGISTRY_HPP_INCLUDED +#define CATCH_TEST_REGISTRY_HPP_INCLUDED + + + +#ifndef CATCH_INTERFACES_TESTCASE_HPP_INCLUDED +#define CATCH_INTERFACES_TESTCASE_HPP_INCLUDED + +#include <vector> + +namespace Catch { + + class TestSpec; + struct TestCaseInfo; + + struct ITestInvoker { + virtual void invoke () const = 0; + virtual ~ITestInvoker(); + }; + + class TestCaseHandle; + struct IConfig; + + struct ITestCaseRegistry { + virtual ~ITestCaseRegistry(); + // TODO: this exists only for adding filenames to test cases -- let's expose this in a saner way later + virtual std::vector<TestCaseInfo* > const& getAllInfos() const = 0; + virtual std::vector<TestCaseHandle> const& getAllTests() const = 0; + virtual std::vector<TestCaseHandle> const& getAllTestsSorted( IConfig const& config ) const = 0; + }; + + bool isThrowSafe( TestCaseHandle const& testCase, IConfig const& config ); + bool matchTest( TestCaseHandle const& testCase, TestSpec const& testSpec, IConfig const& config ); + std::vector<TestCaseHandle> filterTests( std::vector<TestCaseHandle> const& testCases, TestSpec const& testSpec, IConfig const& config ); + std::vector<TestCaseHandle> const& getAllTestCasesSorted( IConfig const& config ); + +} + +#endif // CATCH_INTERFACES_TESTCASE_HPP_INCLUDED + +// GCC 5 and older do not properly handle disabling unused-variable warning +// with a _Pragma. This means that we have to leak the suppression to the +// user code as well :-( +#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ <= 5 +#pragma GCC diagnostic ignored "-Wunused-variable" +#endif + + + +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)(); + } +}; + +Detail::unique_ptr<ITestInvoker> makeTestInvoker( void(*testAsFunction)() ); + +template<typename C> +Detail::unique_ptr<ITestInvoker> makeTestInvoker( void (C::*testAsMethod)() ) { + return Detail::unique_ptr<ITestInvoker>( new TestInvokerAsMethod<C>(testAsMethod) ); +} + +struct NameAndTags { + NameAndTags(StringRef const& name_ = StringRef(), + StringRef const& tags_ = StringRef()) noexcept: + name(name_), tags(tags_) {} + StringRef name; + StringRef tags; +}; + +struct AutoReg : Detail::NonCopyable { + AutoReg( Detail::unique_ptr<ITestInvoker> invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept; +}; + +} // end namespace Catch + +#if defined(CATCH_CONFIG_DISABLE) + #define INTERNAL_CATCH_TESTCASE_NO_REGISTRATION( TestName, ... ) \ + static inline void TestName() + #define INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION( TestName, ClassName, ... ) \ + namespace{ \ + struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) { \ + void test(); \ + }; \ + } \ + void TestName::test() +#endif + + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \ + static void TestName(); \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &TestName ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ + static void TestName() + #define INTERNAL_CATCH_TESTCASE( ... ) \ + INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), __VA_ARGS__ ) + + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + 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_STOP_WARNINGS_SUPPRESSION + + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ \ + struct TestName : INTERNAL_CATCH_REMOVE_PARENS(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_STOP_WARNINGS_SUPPRESSION \ + void TestName::test() + #define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... ) \ + INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, __VA_ARGS__ ) + + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \ + do { \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( Function ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ + } while(false) + + +#endif // CATCH_TEST_REGISTRY_HPP_INCLUDED + +// All of our user-facing macros support configuration toggle, that +// forces them to be defined prefixed with CATCH_. We also like to +// support another toggle that can minimize (disable) their implementation. +// Given this, we have 4 different configuration options below + +#if defined(CATCH_CONFIG_PREFIX_ALL) && !defined(CATCH_CONFIG_DISABLE) + + #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_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_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CATCH_CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) + + #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_DYNAMIC_SECTION( ... ) INTERNAL_CATCH_DYNAMIC_SECTION( __VA_ARGS__ ) + #define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ ) + #define CATCH_FAIL_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__ ) + + + #if !defined(CATCH_CONFIG_RUNTIME_STATIC_REQUIRE) + #define CATCH_STATIC_REQUIRE( ... ) static_assert( __VA_ARGS__ , #__VA_ARGS__ ); CATCH_SUCCEED( #__VA_ARGS__ ) + #define CATCH_STATIC_REQUIRE_FALSE( ... ) static_assert( !(__VA_ARGS__), "!(" #__VA_ARGS__ ")" ); CATCH_SUCCEED( #__VA_ARGS__ ) + #else + #define CATCH_STATIC_REQUIRE( ... ) CATCH_REQUIRE( __VA_ARGS__ ) + #define CATCH_STATIC_REQUIRE_FALSE( ... ) CATCH_REQUIRE_FALSE( __VA_ARGS__ ) + #endif + + + // "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 ) INTERNAL_CATCH_DYNAMIC_SECTION( " Given: " << desc ) + #define CATCH_AND_GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( "And given: " << desc ) + #define CATCH_WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " When: " << desc ) + #define CATCH_AND_WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And when: " << desc ) + #define CATCH_THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " Then: " << desc ) + #define CATCH_AND_THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And: " << desc ) + +#elif defined(CATCH_CONFIG_PREFIX_ALL) && defined(CATCH_CONFIG_DISABLE) // ^^ prefixed, implemented | vv prefixed, disabled + + #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_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_NOTHROW( ... ) (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_DYNAMIC_SECTION( ... ) + #define CATCH_FAIL( ... ) (void)(0) + #define CATCH_FAIL_CHECK( ... ) (void)(0) + #define CATCH_SUCCEED( ... ) (void)(0) + + #define CATCH_STATIC_REQUIRE( ... ) (void)(0) + #define CATCH_STATIC_REQUIRE_FALSE( ... ) (void)(0) + + // "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_AND_GIVEN( desc ) + #define CATCH_WHEN( desc ) + #define CATCH_AND_WHEN( desc ) + #define CATCH_THEN( desc ) + #define CATCH_AND_THEN( desc ) + +#elif !defined(CATCH_CONFIG_PREFIX_ALL) && !defined(CATCH_CONFIG_DISABLE) // ^^ prefixed, disabled | vv unprefixed, implemented + + #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_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_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) + + #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 DYNAMIC_SECTION( ... ) INTERNAL_CATCH_DYNAMIC_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__ ) + + + #if !defined(CATCH_CONFIG_RUNTIME_STATIC_REQUIRE) + #define STATIC_REQUIRE( ... ) static_assert( __VA_ARGS__, #__VA_ARGS__ ); SUCCEED( #__VA_ARGS__ ) + #define STATIC_REQUIRE_FALSE( ... ) static_assert( !(__VA_ARGS__), "!(" #__VA_ARGS__ ")" ); SUCCEED( "!(" #__VA_ARGS__ ")" ) + #else + #define STATIC_REQUIRE( ... ) REQUIRE( __VA_ARGS__ ) + #define STATIC_REQUIRE_FALSE( ... ) REQUIRE_FALSE( __VA_ARGS__ ) + #endif + + // "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 ) INTERNAL_CATCH_DYNAMIC_SECTION( " Given: " << desc ) + #define AND_GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( "And given: " << desc ) + #define WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " When: " << desc ) + #define AND_WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And when: " << desc ) + #define THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " Then: " << desc ) + #define AND_THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And: " << desc ) + +#elif !defined(CATCH_CONFIG_PREFIX_ALL) && defined(CATCH_CONFIG_DISABLE) // ^^ unprefixed, implemented | vv unprefixed, disabled + + #define REQUIRE( ... ) (void)(0) + #define REQUIRE_FALSE( ... ) (void)(0) + + #define REQUIRE_THROWS( ... ) (void)(0) + #define REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0) + #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_NOTHROW( ... ) (void)(0) + + #define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), __VA_ARGS__) + #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 DYNAMIC_SECTION( ... ) + #define FAIL( ... ) (void)(0) + #define FAIL_CHECK( ... ) (void)(0) + #define SUCCEED( ... ) (void)(0) + + #define STATIC_REQUIRE( ... ) (void)(0) + #define STATIC_REQUIRE_FALSE( ... ) (void)(0) + + // "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 AND_GIVEN( desc ) + #define WHEN( desc ) + #define AND_WHEN( desc ) + #define THEN( desc ) + #define AND_THEN( desc ) + +#endif // ^^ unprefixed, disabled + +// end of user facing macros + +#endif // CATCH_TEST_MACROS_HPP_INCLUDED + + +#ifndef CATCH_TEMPLATE_TEST_REGISTRY_HPP_INCLUDED +#define CATCH_TEMPLATE_TEST_REGISTRY_HPP_INCLUDED + + +// GCC 5 and older do not properly handle disabling unused-variable warning +// with a _Pragma. This means that we have to leak the suppression to the +// user code as well :-( +#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ <= 5 +#pragma GCC diagnostic ignored "-Wunused-variable" +#endif + +#if defined(CATCH_CONFIG_DISABLE) + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( TestName, TestFunc, Name, Tags, Signature, ... ) \ + INTERNAL_CATCH_DEFINE_SIG_TEST(TestFunc, INTERNAL_CATCH_REMOVE_PARENS(Signature)) + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( TestNameClass, TestName, ClassName, Name, Tags, Signature, ... ) \ + namespace{ \ + namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) { \ + INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, INTERNAL_CATCH_REMOVE_PARENS(Signature));\ + } \ + } \ + INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature)) + + #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(Name, Tags, ...) \ + INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename TestType, __VA_ARGS__ ) + #else + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(Name, Tags, ...) \ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename TestType, __VA_ARGS__ ) ) + #endif + + #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(Name, Tags, Signature, ...) \ + INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ ) + #else + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(Name, Tags, Signature, ...) \ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ ) ) + #endif + + #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION( ClassName, Name, Tags,... ) \ + INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) + #else + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION( ClassName, Name, Tags,... ) \ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) ) + #endif + + #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION( ClassName, Name, Tags, Signature, ... ) \ + INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) + #else + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION( ClassName, Name, Tags, Signature, ... ) \ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) ) + #endif +#endif + + + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_2(TestName, TestFunc, Name, Tags, Signature, ... )\ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + INTERNAL_CATCH_DECLARE_SIG_TEST(TestFunc, INTERNAL_CATCH_REMOVE_PARENS(Signature));\ + namespace {\ + namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){\ + INTERNAL_CATCH_TYPE_GEN\ + INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))\ + INTERNAL_CATCH_NTTP_REG_GEN(TestFunc,INTERNAL_CATCH_REMOVE_PARENS(Signature))\ + template<typename...Types> \ + struct TestName{\ + TestName(){\ + int index = 0; \ + constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\ + using expander = int[];\ + (void)expander{(reg_test(Types{}, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++)... };/* NOLINT */ \ + }\ + };\ + static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\ + TestName<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(__VA_ARGS__)>();\ + return 0;\ + }();\ + }\ + }\ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ + INTERNAL_CATCH_DEFINE_SIG_TEST(TestFunc,INTERNAL_CATCH_REMOVE_PARENS(Signature)) + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \ + INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename TestType, __VA_ARGS__ ) +#else + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename TestType, __VA_ARGS__ ) ) +#endif + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG(Name, Tags, Signature, ...) \ + INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ ) +#else + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG(Name, Tags, Signature, ...) \ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ ) ) +#endif + + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(TestName, TestFuncName, Name, Tags, Signature, TmplTypes, TypesList) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + template<typename TestType> static void TestFuncName(); \ + namespace {\ + namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) { \ + INTERNAL_CATCH_TYPE_GEN \ + INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature)) \ + template<typename... Types> \ + struct TestName { \ + void reg_tests() { \ + int index = 0; \ + using expander = int[]; \ + constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};\ + constexpr char const* types_list[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};\ + constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);\ + (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFuncName<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + "<" + std::string(types_list[index % num_types]) + ">", Tags } ), index++)... };/* NOLINT */\ + } \ + }; \ + static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \ + using TestInit = typename create<TestName, decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS(TmplTypes)>()), TypeList<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(INTERNAL_CATCH_REMOVE_PARENS(TypesList))>>::type; \ + TestInit t; \ + t.reg_tests(); \ + return 0; \ + }(); \ + } \ + } \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ + template<typename TestType> \ + static void TestFuncName() + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE(Name, Tags, ...)\ + INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename T,__VA_ARGS__) +#else + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE(Name, Tags, ...)\ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename T, __VA_ARGS__ ) ) +#endif + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG(Name, Tags, Signature, ...)\ + INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__) +#else + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG(Name, Tags, Signature, ...)\ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ ) ) +#endif + + #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2(TestName, TestFunc, Name, Tags, TmplList)\ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + template<typename TestType> static void TestFunc(); \ + namespace {\ + namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){\ + INTERNAL_CATCH_TYPE_GEN\ + template<typename... Types> \ + struct TestName { \ + void reg_tests() { \ + int index = 0; \ + using expander = int[]; \ + (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFunc<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + " - " + std::to_string(index), Tags } ), index++)... };/* NOLINT */\ + } \ + };\ + static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \ + using TestInit = typename convert<TestName, TmplList>::type; \ + TestInit t; \ + t.reg_tests(); \ + return 0; \ + }(); \ + }}\ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ + template<typename TestType> \ + static void TestFunc() + + #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE(Name, Tags, TmplList) \ + INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, TmplList ) + + + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, Signature, ... ) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + namespace {\ + namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){ \ + INTERNAL_CATCH_TYPE_GEN\ + INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))\ + INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, INTERNAL_CATCH_REMOVE_PARENS(Signature));\ + INTERNAL_CATCH_NTTP_REG_METHOD_GEN(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature))\ + template<typename...Types> \ + struct TestNameClass{\ + TestNameClass(){\ + int index = 0; \ + constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\ + using expander = int[];\ + (void)expander{(reg_test(Types{}, #ClassName, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++)... };/* NOLINT */ \ + }\ + };\ + static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\ + TestNameClass<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(__VA_ARGS__)>();\ + return 0;\ + }();\ + }\ + }\ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ + INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature)) + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \ + INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) +#else + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) ) +#endif + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... ) \ + INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) +#else + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... ) \ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) ) +#endif + + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2(TestNameClass, TestName, ClassName, Name, Tags, Signature, TmplTypes, TypesList)\ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + template<typename TestType> \ + struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName <TestType>) { \ + void test();\ + };\ + namespace {\ + namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestNameClass) {\ + INTERNAL_CATCH_TYPE_GEN \ + INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))\ + template<typename...Types>\ + struct TestNameClass{\ + void reg_tests(){\ + int index = 0;\ + using expander = int[];\ + constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};\ + constexpr char const* types_list[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};\ + constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);\ + (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + "<" + std::string(types_list[index % num_types]) + ">", Tags } ), index++)... };/* NOLINT */ \ + }\ + };\ + static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\ + using TestInit = typename create<TestNameClass, decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS(TmplTypes)>()), TypeList<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(INTERNAL_CATCH_REMOVE_PARENS(TypesList))>>::type;\ + TestInit t;\ + t.reg_tests();\ + return 0;\ + }(); \ + }\ + }\ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ + template<typename TestType> \ + void TestName<TestType>::test() + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( ClassName, Name, Tags, ... )\ + INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, typename T, __VA_ARGS__ ) +#else + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( ClassName, Name, Tags, ... )\ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, typename T,__VA_ARGS__ ) ) +#endif + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... )\ + INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, Signature, __VA_ARGS__ ) +#else + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... )\ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, Signature,__VA_ARGS__ ) ) +#endif + + #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, TmplList) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + template<typename TestType> \ + struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName <TestType>) { \ + void test();\ + };\ + namespace {\ + namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){ \ + INTERNAL_CATCH_TYPE_GEN\ + template<typename...Types>\ + struct TestNameClass{\ + void reg_tests(){\ + int index = 0;\ + using expander = int[];\ + (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + " - " + std::to_string(index), Tags } ), index++)... };/* NOLINT */ \ + }\ + };\ + static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\ + using TestInit = typename convert<TestNameClass, TmplList>::type;\ + TestInit t;\ + t.reg_tests();\ + return 0;\ + }(); \ + }}\ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ + template<typename TestType> \ + void TestName<TestType>::test() + +#define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD(ClassName, Name, Tags, TmplList) \ + INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, TmplList ) + + +#endif // CATCH_TEMPLATE_TEST_REGISTRY_HPP_INCLUDED + + +#if defined(CATCH_CONFIG_PREFIX_ALL) && !defined(CATCH_CONFIG_DISABLE) + + #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) + #define CATCH_TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG( __VA_ARGS__ ) + #define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) + #define CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) + #define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ ) + #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( __VA_ARGS__ ) + #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ ) + #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) + #define CATCH_TEMPLATE_LIST_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE(__VA_ARGS__) + #define CATCH_TEMPLATE_LIST_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD( className, __VA_ARGS__ ) + #else + #define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) ) + #define CATCH_TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG( __VA_ARGS__ ) ) + #define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) ) + #define CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) ) + #define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ ) ) + #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( __VA_ARGS__ ) ) + #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ ) ) + #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) ) + #define CATCH_TEMPLATE_LIST_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE( __VA_ARGS__ ) ) + #define CATCH_TEMPLATE_LIST_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD( className, __VA_ARGS__ ) ) + #endif + +#elif defined(CATCH_CONFIG_PREFIX_ALL) && defined(CATCH_CONFIG_DISABLE) + + #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__) + #define CATCH_TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(__VA_ARGS__) + #define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(className, __VA_ARGS__) + #define CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(className, __VA_ARGS__ ) + #else + #define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__) ) + #define CATCH_TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(__VA_ARGS__) ) + #define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(className, __VA_ARGS__ ) ) + #define CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(className, __VA_ARGS__ ) ) + #endif + + // When disabled, these can be shared between proper preprocessor and MSVC preprocessor + #define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) + #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) + #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) + #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) + #define CATCH_TEMPLATE_LIST_TEST_CASE( ... ) CATCH_TEMPLATE_TEST_CASE(__VA_ARGS__) + #define CATCH_TEMPLATE_LIST_TEST_CASE_METHOD( className, ... ) CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) + +#elif !defined(CATCH_CONFIG_PREFIX_ALL) && !defined(CATCH_CONFIG_DISABLE) + + #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) + #define TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG( __VA_ARGS__ ) + #define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) + #define TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) + #define TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ ) + #define TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( __VA_ARGS__ ) + #define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ ) + #define TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) + #define TEMPLATE_LIST_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE(__VA_ARGS__) + #define TEMPLATE_LIST_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD( className, __VA_ARGS__ ) + #else + #define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) ) + #define TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG( __VA_ARGS__ ) ) + #define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) ) + #define TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) ) + #define TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ ) ) + #define TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( __VA_ARGS__ ) ) + #define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ ) ) + #define TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) ) + #define TEMPLATE_LIST_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE( __VA_ARGS__ ) ) + #define TEMPLATE_LIST_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD( className, __VA_ARGS__ ) ) + #endif + +#elif !defined(CATCH_CONFIG_PREFIX_ALL) && defined(CATCH_CONFIG_DISABLE) + + #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__) + #define TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(__VA_ARGS__) + #define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(className, __VA_ARGS__) + #define TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(className, __VA_ARGS__ ) + #else + #define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__) ) + #define TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(__VA_ARGS__) ) + #define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(className, __VA_ARGS__ ) ) + #define TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(className, __VA_ARGS__ ) ) + #endif + + // When disabled, these can be shared between proper preprocessor and MSVC preprocessor + #define TEMPLATE_PRODUCT_TEST_CASE( ... ) TEMPLATE_TEST_CASE( __VA_ARGS__ ) + #define TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) TEMPLATE_TEST_CASE( __VA_ARGS__ ) + #define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) + #define TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) + #define TEMPLATE_LIST_TEST_CASE( ... ) TEMPLATE_TEST_CASE(__VA_ARGS__) + #define TEMPLATE_LIST_TEST_CASE_METHOD( className, ... ) TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) + +#endif // end of user facing macro declarations + + +#endif // CATCH_TEMPLATE_TEST_MACROS_HPP_INCLUDED + + +#ifndef CATCH_TEST_CASE_INFO_HPP_INCLUDED +#define CATCH_TEST_CASE_INFO_HPP_INCLUDED + + + +#include <string> +#include <vector> + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif + +namespace Catch { + + struct Tag { + Tag(StringRef original_, StringRef lowerCased_): + original(original_), lowerCased(lowerCased_) + {} + StringRef original, lowerCased; + }; + + struct ITestInvoker; + + enum class TestCaseProperties : uint8_t { + None = 0, + IsHidden = 1 << 1, + ShouldFail = 1 << 2, + MayFail = 1 << 3, + Throws = 1 << 4, + NonPortable = 1 << 5, + Benchmark = 1 << 6 + }; + + + struct TestCaseInfo : Detail::NonCopyable { + + TestCaseInfo(std::string const& _className, + NameAndTags const& _tags, + SourceLineInfo const& _lineInfo); + + bool isHidden() const; + bool throws() const; + bool okToFail() const; + bool expectedToFail() const; + + // Adds the tag(s) with test's filename (for the -# flag) + void addFilenameTag(); + + + std::string tagsAsString() const; + + std::string name; + std::string className; + private: + std::string backingTags, backingLCaseTags; + // Internally we copy tags to the backing storage and then add + // refs to this storage to the tags vector. + void internalAppendTag(StringRef tagString); + public: + std::vector<Tag> tags; + SourceLineInfo lineInfo; + TestCaseProperties properties = TestCaseProperties::None; + }; + + class TestCaseHandle { + TestCaseInfo* m_info; + ITestInvoker* m_invoker; + public: + TestCaseHandle(TestCaseInfo* info, ITestInvoker* invoker) : + m_info(info), m_invoker(invoker) {} + + void invoke() const { + m_invoker->invoke(); + } + + TestCaseInfo const& getTestCaseInfo() const; + + bool operator== ( TestCaseHandle const& rhs ) const; + bool operator < ( TestCaseHandle const& rhs ) const; + }; + + Detail::unique_ptr<TestCaseInfo> makeTestCaseInfo( std::string const& className, + NameAndTags const& nameAndTags, + SourceLineInfo const& lineInfo ); +} + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +#endif // CATCH_TEST_CASE_INFO_HPP_INCLUDED + + +#ifndef CATCH_TRANSLATE_EXCEPTION_HPP_INCLUDED +#define CATCH_TRANSLATE_EXCEPTION_HPP_INCLUDED + + + +#ifndef CATCH_INTERFACES_EXCEPTION_HPP_INCLUDED +#define CATCH_INTERFACES_EXCEPTION_HPP_INCLUDED + + +#include <string> +#include <vector> + +namespace Catch { + using exceptionTranslateFunction = std::string(*)(); + + struct IExceptionTranslator; + using ExceptionTranslators = std::vector<Detail::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; + }; + +} // namespace Catch + +#endif // CATCH_INTERFACES_EXCEPTION_HPP_INCLUDED + +#include <exception> + +namespace Catch { + + class ExceptionTranslatorRegistrar { + template<typename T> + class ExceptionTranslator : public IExceptionTranslator { + public: + + ExceptionTranslator( std::string(*translateFunction)( T const& ) ) + : m_translateFunction( translateFunction ) + {} + + std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const override { +#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + try { + if( it == itEnd ) + std::rethrow_exception(std::current_exception()); + else + return (*it)->translate( it+1, itEnd ); + } + catch( T const& ex ) { + return m_translateFunction( ex ); + } +#else + return "You should never get here!"; +#endif + } + + protected: + std::string(*m_translateFunction)( T const& ); + }; + + public: + template<typename T> + ExceptionTranslatorRegistrar( std::string(*translateFunction)( T const& ) ) { + getMutableRegistryHub().registerTranslator + ( new ExceptionTranslator<T>( translateFunction ) ); + } + }; + +} // namespace Catch + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_TRANSLATE_EXCEPTION2( translatorName, signature ) \ + static std::string translatorName( signature ); \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::ExceptionTranslatorRegistrar INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionRegistrar )( &translatorName ); } \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ + static std::string translatorName( signature ) + +#define INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION2( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature ) + +#if defined(CATCH_CONFIG_DISABLE) + #define INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( translatorName, signature) \ + static std::string translatorName( signature ) +#endif + + +// This macro is always prefixed +#if !defined(CATCH_CONFIG_DISABLE) +#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) +#else +#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature ) +#endif + + +#endif // CATCH_TRANSLATE_EXCEPTION_HPP_INCLUDED + +#ifndef CATCH_VERSION_HPP_INCLUDED +#define CATCH_VERSION_HPP_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 // CATCH_VERSION_HPP_INCLUDED + + +#ifndef CATCH_VERSION_MACROS_HPP_INCLUDED +#define CATCH_VERSION_MACROS_HPP_INCLUDED + +#define CATCH_VERSION_MAJOR 3 +#define CATCH_VERSION_MINOR 0 +#define CATCH_VERSION_PATCH 0 + +#endif // CATCH_VERSION_MACROS_HPP_INCLUDED + + +/** \file + * This is a convenience header for Catch2's Generator support. It includes + * **all** of Catch2 headers related to generators. + * + * Generally the Catch2 users should use specific includes they need, + * but this header can be used instead for ease-of-experimentation, or + * just plain convenience, at the cost of (significantly) increased + * compilation times. + * + * When a new header is added to either the `generators` folder, + * or to the corresponding internal subfolder, it should be added here. + */ + +#ifndef CATCH_GENERATORS_ALL_HPP_INCLUDED +#define CATCH_GENERATORS_ALL_HPP_INCLUDED + + + +#ifndef CATCH_GENERATOR_EXCEPTION_HPP_INCLUDED +#define CATCH_GENERATOR_EXCEPTION_HPP_INCLUDED + +#include <exception> + +namespace Catch { + + // Exception type to be thrown when a Generator runs into an error, + // e.g. it cannot initialize the first return value based on + // runtime information + class GeneratorException : public std::exception { + const char* const m_msg = ""; + + public: + GeneratorException(const char* msg): + m_msg(msg) + {} + + const char* what() const noexcept override final; + }; + +} // end namespace Catch + +#endif // CATCH_GENERATOR_EXCEPTION_HPP_INCLUDED + + +#ifndef CATCH_GENERATORS_HPP_INCLUDED +#define CATCH_GENERATORS_HPP_INCLUDED + + + +#ifndef CATCH_INTERFACES_GENERATORTRACKER_HPP_INCLUDED +#define CATCH_INTERFACES_GENERATORTRACKER_HPP_INCLUDED + + +namespace Catch { + + namespace Generators { + class GeneratorUntypedBase { + public: + GeneratorUntypedBase() = default; + // Generation of copy ops is deprecated (and Clang will complain) + // if there is a user destructor defined + GeneratorUntypedBase(GeneratorUntypedBase const&) = default; + GeneratorUntypedBase& operator=(GeneratorUntypedBase const&) = default; + + virtual ~GeneratorUntypedBase(); // = default; + + // Attempts to move the generator to the next element + // + // Returns true iff the move succeeded (and a valid element + // can be retrieved). + virtual bool next() = 0; + }; + using GeneratorBasePtr = Catch::Detail::unique_ptr<GeneratorUntypedBase>; + + } // namespace Generators + + struct IGeneratorTracker { + virtual ~IGeneratorTracker(); // = default; + virtual auto hasGenerator() const -> bool = 0; + virtual auto getGenerator() const -> Generators::GeneratorBasePtr const& = 0; + virtual void setGenerator( Generators::GeneratorBasePtr&& generator ) = 0; + }; + +} // namespace Catch + +#endif // CATCH_INTERFACES_GENERATORTRACKER_HPP_INCLUDED + +#include <vector> +#include <tuple> +#include <utility> + +namespace Catch { + +namespace Generators { + +namespace Detail { + + //! Throws GeneratorException with the provided message + [[noreturn]] + void throw_generator_exception(char const * msg); + +} // end namespace detail + + template<typename T> + struct IGenerator : GeneratorUntypedBase { + ~IGenerator() override = default; + IGenerator() = default; + IGenerator(IGenerator const&) = default; + IGenerator& operator=(IGenerator const&) = default; + + + // Returns the current element of the generator + // + // \Precondition The generator is either freshly constructed, + // or the last call to `next()` returned true + virtual T const& get() const = 0; + using type = T; + }; + + template <typename T> + using GeneratorPtr = Catch::Detail::unique_ptr<IGenerator<T>>; + + template <typename T> + class GeneratorWrapper final { + GeneratorPtr<T> m_generator; + public: + //! Takes ownership of the passed pointer. + GeneratorWrapper(IGenerator<T>* generator): + m_generator(generator) {} + GeneratorWrapper(GeneratorPtr<T> generator): + m_generator(std::move(generator)) {} + + T const& get() const { + return m_generator->get(); + } + bool next() { + return m_generator->next(); + } + }; + + + template<typename T> + class SingleValueGenerator final : public IGenerator<T> { + T m_value; + public: + SingleValueGenerator(T&& value): + m_value(std::forward<T>(value)) + {} + + T const& get() const override { + return m_value; + } + bool next() override { + return false; + } + }; + + template<typename T> + class FixedValuesGenerator final : public IGenerator<T> { + static_assert(!std::is_same<T, bool>::value, + "FixedValuesGenerator does not support bools because of std::vector<bool>" + "specialization, use SingleValue Generator instead."); + std::vector<T> m_values; + size_t m_idx = 0; + public: + FixedValuesGenerator( std::initializer_list<T> values ) : m_values( values ) {} + + T const& get() const override { + return m_values[m_idx]; + } + bool next() override { + ++m_idx; + return m_idx < m_values.size(); + } + }; + + template <typename T> + GeneratorWrapper<T> value(T&& value) { + return GeneratorWrapper<T>(Catch::Detail::make_unique<SingleValueGenerator<T>>(std::forward<T>(value))); + } + template <typename T> + GeneratorWrapper<T> values(std::initializer_list<T> values) { + return GeneratorWrapper<T>(Catch::Detail::make_unique<FixedValuesGenerator<T>>(values)); + } + + template<typename T> + class Generators : public IGenerator<T> { + std::vector<GeneratorWrapper<T>> m_generators; + size_t m_current = 0; + + void populate(GeneratorWrapper<T>&& generator) { + m_generators.emplace_back(std::move(generator)); + } + void populate(T&& val) { + m_generators.emplace_back(value(std::forward<T>(val))); + } + template<typename U> + void populate(U&& val) { + populate(T(std::forward<U>(val))); + } + template<typename U, typename... Gs> + void populate(U&& valueOrGenerator, Gs &&... moreGenerators) { + populate(std::forward<U>(valueOrGenerator)); + populate(std::forward<Gs>(moreGenerators)...); + } + + public: + template <typename... Gs> + Generators(Gs &&... moreGenerators) { + m_generators.reserve(sizeof...(Gs)); + populate(std::forward<Gs>(moreGenerators)...); + } + + T const& get() const override { + return m_generators[m_current].get(); + } + + bool next() override { + if (m_current >= m_generators.size()) { + return false; + } + const bool current_status = m_generators[m_current].next(); + if (!current_status) { + ++m_current; + } + return m_current < m_generators.size(); + } + }; + + + template<typename... Ts> + GeneratorWrapper<std::tuple<Ts...>> table( std::initializer_list<std::tuple<std::decay_t<Ts>...>> tuples ) { + return values<std::tuple<Ts...>>( tuples ); + } + + // Tag type to signal that a generator sequence should convert arguments to a specific type + template <typename T> + struct as {}; + + template<typename T, typename... Gs> + auto makeGenerators( GeneratorWrapper<T>&& generator, Gs &&... moreGenerators ) -> Generators<T> { + return Generators<T>(std::move(generator), std::forward<Gs>(moreGenerators)...); + } + template<typename T> + auto makeGenerators( GeneratorWrapper<T>&& generator ) -> Generators<T> { + return Generators<T>(std::move(generator)); + } + template<typename T, typename... Gs> + auto makeGenerators( T&& val, Gs &&... moreGenerators ) -> Generators<T> { + return makeGenerators( value( std::forward<T>( val ) ), std::forward<Gs>( moreGenerators )... ); + } + template<typename T, typename U, typename... Gs> + auto makeGenerators( as<T>, U&& val, Gs &&... moreGenerators ) -> Generators<T> { + return makeGenerators( value( T( std::forward<U>( val ) ) ), std::forward<Gs>( moreGenerators )... ); + } + + auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker&; + + template<typename L> + // Note: The type after -> is weird, because VS2015 cannot parse + // the expression used in the typedef inside, when it is in + // return type. Yeah. + auto generate( StringRef generatorName, SourceLineInfo const& lineInfo, L const& generatorExpression ) -> decltype(std::declval<decltype(generatorExpression())>().get()) { + using UnderlyingType = typename decltype(generatorExpression())::type; + + IGeneratorTracker& tracker = acquireGeneratorTracker( generatorName, lineInfo ); + if (!tracker.hasGenerator()) { + tracker.setGenerator(Catch::Detail::make_unique<Generators<UnderlyingType>>(generatorExpression())); + } + + auto const& generator = static_cast<IGenerator<UnderlyingType> const&>( *tracker.getGenerator() ); + return generator.get(); + } + +} // namespace Generators +} // namespace Catch + +#define GENERATE( ... ) \ + Catch::Generators::generate( INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \ + CATCH_INTERNAL_LINEINFO, \ + [ ]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace) +#define GENERATE_COPY( ... ) \ + Catch::Generators::generate( INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \ + CATCH_INTERNAL_LINEINFO, \ + [=]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace) +#define GENERATE_REF( ... ) \ + Catch::Generators::generate( INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \ + CATCH_INTERNAL_LINEINFO, \ + [&]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace) + +#endif // CATCH_GENERATORS_HPP_INCLUDED + + +#ifndef CATCH_GENERATORS_ADAPTERS_HPP_INCLUDED +#define CATCH_GENERATORS_ADAPTERS_HPP_INCLUDED + + +namespace Catch { +namespace Generators { + + template <typename T> + class TakeGenerator final : public IGenerator<T> { + GeneratorWrapper<T> m_generator; + size_t m_returned = 0; + size_t m_target; + public: + TakeGenerator(size_t target, GeneratorWrapper<T>&& generator): + m_generator(std::move(generator)), + m_target(target) + { + assert(target != 0 && "Empty generators are not allowed"); + } + T const& get() const override { + return m_generator.get(); + } + bool next() override { + ++m_returned; + if (m_returned >= m_target) { + return false; + } + + const auto success = m_generator.next(); + // If the underlying generator does not contain enough values + // then we cut short as well + if (!success) { + m_returned = m_target; + } + return success; + } + }; + + template <typename T> + GeneratorWrapper<T> take(size_t target, GeneratorWrapper<T>&& generator) { + return GeneratorWrapper<T>(Catch::Detail::make_unique<TakeGenerator<T>>(target, std::move(generator))); + } + + + template <typename T, typename Predicate> + class FilterGenerator final : public IGenerator<T> { + GeneratorWrapper<T> m_generator; + Predicate m_predicate; + public: + template <typename P = Predicate> + FilterGenerator(P&& pred, GeneratorWrapper<T>&& generator): + m_generator(std::move(generator)), + m_predicate(std::forward<P>(pred)) + { + if (!m_predicate(m_generator.get())) { + // It might happen that there are no values that pass the + // filter. In that case we throw an exception. + auto has_initial_value = next(); + if (!has_initial_value) { + Detail::throw_generator_exception("No valid value found in filtered generator"); + } + } + } + + T const& get() const override { + return m_generator.get(); + } + + bool next() override { + bool success = m_generator.next(); + if (!success) { + return false; + } + while (!m_predicate(m_generator.get()) && (success = m_generator.next()) == true); + return success; + } + }; + + + template <typename T, typename Predicate> + GeneratorWrapper<T> filter(Predicate&& pred, GeneratorWrapper<T>&& generator) { + return GeneratorWrapper<T>(Catch::Detail::make_unique<FilterGenerator<T, Predicate>>(std::forward<Predicate>(pred), std::move(generator))); + } + + template <typename T> + class RepeatGenerator final : public IGenerator<T> { + static_assert(!std::is_same<T, bool>::value, + "RepeatGenerator currently does not support bools" + "because of std::vector<bool> specialization"); + GeneratorWrapper<T> m_generator; + mutable std::vector<T> m_returned; + size_t m_target_repeats; + size_t m_current_repeat = 0; + size_t m_repeat_index = 0; + public: + RepeatGenerator(size_t repeats, GeneratorWrapper<T>&& generator): + m_generator(std::move(generator)), + m_target_repeats(repeats) + { + assert(m_target_repeats > 0 && "Repeat generator must repeat at least once"); + } + + T const& get() const override { + if (m_current_repeat == 0) { + m_returned.push_back(m_generator.get()); + return m_returned.back(); + } + return m_returned[m_repeat_index]; + } + + bool next() override { + // There are 2 basic cases: + // 1) We are still reading the generator + // 2) We are reading our own cache + + // In the first case, we need to poke the underlying generator. + // If it happily moves, we are left in that state, otherwise it is time to start reading from our cache + if (m_current_repeat == 0) { + const auto success = m_generator.next(); + if (!success) { + ++m_current_repeat; + } + return m_current_repeat < m_target_repeats; + } + + // In the second case, we need to move indices forward and check that we haven't run up against the end + ++m_repeat_index; + if (m_repeat_index == m_returned.size()) { + m_repeat_index = 0; + ++m_current_repeat; + } + return m_current_repeat < m_target_repeats; + } + }; + + template <typename T> + GeneratorWrapper<T> repeat(size_t repeats, GeneratorWrapper<T>&& generator) { + return GeneratorWrapper<T>(Catch::Detail::make_unique<RepeatGenerator<T>>(repeats, std::move(generator))); + } + + template <typename T, typename U, typename Func> + class MapGenerator final : public IGenerator<T> { + // TBD: provide static assert for mapping function, for friendly error message + GeneratorWrapper<U> m_generator; + Func m_function; + // To avoid returning dangling reference, we have to save the values + T m_cache; + public: + template <typename F2 = Func> + MapGenerator(F2&& function, GeneratorWrapper<U>&& generator) : + m_generator(std::move(generator)), + m_function(std::forward<F2>(function)), + m_cache(m_function(m_generator.get())) + {} + + T const& get() const override { + return m_cache; + } + bool next() override { + const auto success = m_generator.next(); + if (success) { + m_cache = m_function(m_generator.get()); + } + return success; + } + }; + + template <typename Func, typename U, typename T = FunctionReturnType<Func, U>> + GeneratorWrapper<T> map(Func&& function, GeneratorWrapper<U>&& generator) { + return GeneratorWrapper<T>( + Catch::Detail::make_unique<MapGenerator<T, U, Func>>(std::forward<Func>(function), std::move(generator)) + ); + } + + template <typename T, typename U, typename Func> + GeneratorWrapper<T> map(Func&& function, GeneratorWrapper<U>&& generator) { + return GeneratorWrapper<T>( + Catch::Detail::make_unique<MapGenerator<T, U, Func>>(std::forward<Func>(function), std::move(generator)) + ); + } + + template <typename T> + class ChunkGenerator final : public IGenerator<std::vector<T>> { + std::vector<T> m_chunk; + size_t m_chunk_size; + GeneratorWrapper<T> m_generator; + bool m_used_up = false; + public: + ChunkGenerator(size_t size, GeneratorWrapper<T> generator) : + m_chunk_size(size), m_generator(std::move(generator)) + { + m_chunk.reserve(m_chunk_size); + if (m_chunk_size != 0) { + m_chunk.push_back(m_generator.get()); + for (size_t i = 1; i < m_chunk_size; ++i) { + if (!m_generator.next()) { + Detail::throw_generator_exception("Not enough values to initialize the first chunk"); + } + m_chunk.push_back(m_generator.get()); + } + } + } + std::vector<T> const& get() const override { + return m_chunk; + } + bool next() override { + m_chunk.clear(); + for (size_t idx = 0; idx < m_chunk_size; ++idx) { + if (!m_generator.next()) { + return false; + } + m_chunk.push_back(m_generator.get()); + } + return true; + } + }; + + template <typename T> + GeneratorWrapper<std::vector<T>> chunk(size_t size, GeneratorWrapper<T>&& generator) { + return GeneratorWrapper<std::vector<T>>( + Catch::Detail::make_unique<ChunkGenerator<T>>(size, std::move(generator)) + ); + } + +} // namespace Generators +} // namespace Catch + + +#endif // CATCH_GENERATORS_ADAPTERS_HPP_INCLUDED + + +#ifndef CATCH_GENERATORS_RANDOM_HPP_INCLUDED +#define CATCH_GENERATORS_RANDOM_HPP_INCLUDED + + + +#ifndef CATCH_RANDOM_NUMBER_GENERATOR_HPP_INCLUDED +#define CATCH_RANDOM_NUMBER_GENERATOR_HPP_INCLUDED + +#include <cstdint> + +namespace Catch { + + // This is a simple implementation of C++11 Uniform Random Number + // Generator. It does not provide all operators, because Catch2 + // does not use it, but it should behave as expected inside stdlib's + // distributions. + // The implementation is based on the PCG family (http://pcg-random.org) + class SimplePcg32 { + using state_type = std::uint64_t; + public: + using result_type = std::uint32_t; + static constexpr result_type (min)() { + return 0; + } + static constexpr result_type (max)() { + return static_cast<result_type>(-1); + } + + // Provide some default initial state for the default constructor + SimplePcg32():SimplePcg32(0xed743cc4U) {} + + explicit SimplePcg32(result_type seed_); + + void seed(result_type seed_); + void discard(uint64_t skip); + + result_type operator()(); + + private: + friend bool operator==(SimplePcg32 const& lhs, SimplePcg32 const& rhs); + friend bool operator!=(SimplePcg32 const& lhs, SimplePcg32 const& rhs); + + // In theory we also need operator<< and operator>> + // In practice we do not use them, so we will skip them for now + + + std::uint64_t m_state; + // This part of the state determines which "stream" of the numbers + // is chosen -- we take it as a constant for Catch2, so we only + // need to deal with seeding the main state. + // Picked by reading 8 bytes from `/dev/random` :-) + static const std::uint64_t s_inc = (0x13ed0cc53f939476ULL << 1ULL) | 1ULL; + }; + +} // end namespace Catch + +#endif // CATCH_RANDOM_NUMBER_GENERATOR_HPP_INCLUDED + +#include <random> + +namespace Catch { +namespace Generators { + +template <typename Float> +class RandomFloatingGenerator final : public IGenerator<Float> { + Catch::SimplePcg32& m_rng; + std::uniform_real_distribution<Float> m_dist; + Float m_current_number; +public: + + RandomFloatingGenerator(Float a, Float b): + m_rng(rng()), + m_dist(a, b) { + static_cast<void>(next()); + } + + Float const& get() const override { + return m_current_number; + } + bool next() override { + m_current_number = m_dist(m_rng); + return true; + } +}; + +template <typename Integer> +class RandomIntegerGenerator final : public IGenerator<Integer> { + Catch::SimplePcg32& m_rng; + std::uniform_int_distribution<Integer> m_dist; + Integer m_current_number; +public: + + RandomIntegerGenerator(Integer a, Integer b): + m_rng(rng()), + m_dist(a, b) { + static_cast<void>(next()); + } + + Integer const& get() const override { + return m_current_number; + } + bool next() override { + m_current_number = m_dist(m_rng); + return true; + } +}; + +// TODO: Ideally this would be also constrained against the various char types, +// but I don't expect users to run into that in practice. +template <typename T> +std::enable_if_t<std::is_integral<T>::value && !std::is_same<T, bool>::value, +GeneratorWrapper<T>> +random(T a, T b) { + return GeneratorWrapper<T>( + Catch::Detail::make_unique<RandomIntegerGenerator<T>>(a, b) + ); +} + +template <typename T> +std::enable_if_t<std::is_floating_point<T>::value, +GeneratorWrapper<T>> +random(T a, T b) { + return GeneratorWrapper<T>( + Catch::Detail::make_unique<RandomFloatingGenerator<T>>(a, b) + ); +} + + +} // namespace Generators +} // namespace Catch + + +#endif // CATCH_GENERATORS_RANDOM_HPP_INCLUDED + + +#ifndef CATCH_GENERATORS_RANGE_HPP_INCLUDED +#define CATCH_GENERATORS_RANGE_HPP_INCLUDED + + +#include <iterator> +#include <type_traits> + +namespace Catch { +namespace Generators { + + +template <typename T> +class RangeGenerator final : public IGenerator<T> { + T m_current; + T m_end; + T m_step; + bool m_positive; + +public: + RangeGenerator(T const& start, T const& end, T const& step): + m_current(start), + m_end(end), + m_step(step), + m_positive(m_step > T(0)) + { + assert(m_current != m_end && "Range start and end cannot be equal"); + assert(m_step != T(0) && "Step size cannot be zero"); + assert(((m_positive && m_current <= m_end) || (!m_positive && m_current >= m_end)) && "Step moves away from end"); + } + + RangeGenerator(T const& start, T const& end): + RangeGenerator(start, end, (start < end) ? T(1) : T(-1)) + {} + + T const& get() const override { + return m_current; + } + + bool next() override { + m_current += m_step; + return (m_positive) ? (m_current < m_end) : (m_current > m_end); + } +}; + +template <typename T> +GeneratorWrapper<T> range(T const& start, T const& end, T const& step) { + static_assert(std::is_arithmetic<T>::value && !std::is_same<T, bool>::value, "Type must be numeric"); + return GeneratorWrapper<T>(Catch::Detail::make_unique<RangeGenerator<T>>(start, end, step)); +} + +template <typename T> +GeneratorWrapper<T> range(T const& start, T const& end) { + static_assert(std::is_integral<T>::value && !std::is_same<T, bool>::value, "Type must be an integer"); + return GeneratorWrapper<T>(Catch::Detail::make_unique<RangeGenerator<T>>(start, end)); +} + + +template <typename T> +class IteratorGenerator final : public IGenerator<T> { + static_assert(!std::is_same<T, bool>::value, + "IteratorGenerator currently does not support bools" + "because of std::vector<bool> specialization"); + + std::vector<T> m_elems; + size_t m_current = 0; +public: + template <typename InputIterator, typename InputSentinel> + IteratorGenerator(InputIterator first, InputSentinel last):m_elems(first, last) { + if (m_elems.empty()) { + Detail::throw_generator_exception("IteratorGenerator received no valid values"); + } + } + + T const& get() const override { + return m_elems[m_current]; + } + + bool next() override { + ++m_current; + return m_current != m_elems.size(); + } +}; + +template <typename InputIterator, + typename InputSentinel, + typename ResultType = typename std::iterator_traits<InputIterator>::value_type> +GeneratorWrapper<ResultType> from_range(InputIterator from, InputSentinel to) { + return GeneratorWrapper<ResultType>(Catch::Detail::make_unique<IteratorGenerator<ResultType>>(from, to)); +} + +template <typename Container, + typename ResultType = typename Container::value_type> +GeneratorWrapper<ResultType> from_range(Container const& cnt) { + return GeneratorWrapper<ResultType>(Catch::Detail::make_unique<IteratorGenerator<ResultType>>(cnt.begin(), cnt.end())); +} + + +} // namespace Generators +} // namespace Catch + + +#endif // CATCH_GENERATORS_RANGE_HPP_INCLUDED + +#endif // CATCH_GENERATORS_ALL_HPP_INCLUDED + + +/** \file + * This is a convenience header for Catch2's interfaces. It includes + * **all** of Catch2 headers related to interfaces. + * + * Generally the Catch2 users should use specific includes they need, + * but this header can be used instead for ease-of-experimentation, or + * just plain convenience, at the cost of somewhat increased compilation + * times. + * + * When a new header is added to either the `interfaces` folder, or to + * the corresponding internal subfolder, it should be added here. + */ + + +#ifndef CATCH_INTERFACES_ALL_HPP_INCLUDED +#define CATCH_INTERFACES_ALL_HPP_INCLUDED + + + +#ifndef CATCH_INTERFACES_REPORTER_REGISTRY_HPP_INCLUDED +#define CATCH_INTERFACES_REPORTER_REGISTRY_HPP_INCLUDED + + +#include <string> +#include <vector> +#include <map> + +namespace Catch { + + struct IConfig; + + struct IStreamingReporter; + using IStreamingReporterPtr = Detail::unique_ptr<IStreamingReporter>; + struct IReporterFactory; + using IReporterFactoryPtr = Detail::unique_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, IConfig const* config ) const = 0; + virtual FactoryMap const& getFactories() const = 0; + virtual Listeners const& getListeners() const = 0; + }; + +} // end namespace Catch + +#endif // CATCH_INTERFACES_REPORTER_REGISTRY_HPP_INCLUDED + + +#ifndef CATCH_INTERFACES_RUNNER_HPP_INCLUDED +#define CATCH_INTERFACES_RUNNER_HPP_INCLUDED + +namespace Catch { + + struct IRunner { + virtual ~IRunner(); + virtual bool aborting() const = 0; + }; +} + +#endif // CATCH_INTERFACES_RUNNER_HPP_INCLUDED + + +#ifndef CATCH_INTERFACES_TAG_ALIAS_REGISTRY_HPP_INCLUDED +#define CATCH_INTERFACES_TAG_ALIAS_REGISTRY_HPP_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 // CATCH_INTERFACES_TAG_ALIAS_REGISTRY_HPP_INCLUDED + +#endif // CATCH_INTERFACES_ALL_HPP_INCLUDED + + + +/** \file + * Wrapper for UNCAUGHT_EXCEPTIONS configuration option + * + * For some functionality, Catch2 requires to know whether there is + * an active exception. Because `std::uncaught_exception` is deprecated + * in C++17, we want to use `std::uncaught_exceptions` if possible. + */ + +#ifndef CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP +#define CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP + +#if defined(_MSC_VER) +# if _MSC_VER >= 1900 // Visual Studio 2015 or newer +# define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS +# endif +#endif + + +#include <exception> + +#if defined(__cpp_lib_uncaught_exceptions) \ + && !defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) + +# define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS +#endif // __cpp_lib_uncaught_exceptions + + +#if defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) \ + && !defined(CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS) \ + && !defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) + +# define CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS +#endif + + +#endif // CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP + + +#ifndef CATCH_CONSOLE_COLOUR_HPP_INCLUDED +#define CATCH_CONSOLE_COLOUR_HPP_INCLUDED + + +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; + + friend std::ostream& operator << (std::ostream& os, Colour const&); + }; + + +} // end namespace Catch + +#endif // CATCH_CONSOLE_COLOUR_HPP_INCLUDED + + +#ifndef CATCH_CONSOLE_WIDTH_HPP_INCLUDED +#define CATCH_CONSOLE_WIDTH_HPP_INCLUDED + +#ifndef CATCH_CONFIG_CONSOLE_WIDTH +#define CATCH_CONFIG_CONSOLE_WIDTH 80 +#endif + +#endif // CATCH_CONSOLE_WIDTH_HPP_INCLUDED + +#ifndef CATCH_CONTAINER_NONMEMBERS_HPP_INCLUDED +#define CATCH_CONTAINER_NONMEMBERS_HPP_INCLUDED + + + +// We want a simple polyfill over `std::empty`, `std::size` and so on +// for C++14 or C++ libraries with incomplete support. +// We also have to handle that MSVC std lib will happily provide these +// under older standards. +#if defined(CATCH_CPP17_OR_GREATER) || defined(_MSC_VER) + +// We are already using this header either way, so there shouldn't +// be much additional overhead in including it to get the feature +// test macros +#include <string> + +# if !defined(__cpp_lib_nonmember_container_access) +# define CATCH_CONFIG_POLYFILL_NONMEMBER_CONTAINER_ACCESS +# endif + +#else +#define CATCH_CONFIG_POLYFILL_NONMEMBER_CONTAINER_ACCESS +#endif + + + +namespace Catch { +namespace Detail { + +#if defined(CATCH_CONFIG_POLYFILL_NONMEMBER_CONTAINER_ACCESS) + template <typename Container> + constexpr auto empty(Container const& cont) -> decltype(cont.empty()) { + return cont.empty(); + } + template <typename T, std::size_t N> + constexpr bool empty(const T (&)[N]) noexcept { + // GCC < 7 does not support the const T(&)[] parameter syntax + // so we have to ignore the length explicitly + (void)N; + return false; + } + template <typename T> + constexpr bool empty(std::initializer_list<T> list) noexcept { + return list.size() > 0; + } + + + template <typename Container> + constexpr auto size(Container const& cont) -> decltype(cont.size()) { + return cont.size(); + } + template <typename T, std::size_t N> + constexpr std::size_t size(const T(&)[N]) noexcept { + return N; + } +#endif // CATCH_CONFIG_POLYFILL_NONMEMBER_CONTAINER_ACCESS + +} // end namespace Detail +} // end namespace Catch + + + +#endif // CATCH_CONTAINER_NONMEMBERS_HPP_INCLUDED + + +#ifndef CATCH_DEBUG_CONSOLE_HPP_INCLUDED +#define CATCH_DEBUG_CONSOLE_HPP_INCLUDED + +#include <string> + +namespace Catch { + void writeToDebugConsole( std::string const& text ); +} + +#endif // CATCH_DEBUG_CONSOLE_HPP_INCLUDED + + +#ifndef CATCH_DEBUGGER_HPP_INCLUDED +#define CATCH_DEBUGGER_HPP_INCLUDED + + +namespace Catch { + bool isDebuggerActive(); +} + +#ifdef CATCH_PLATFORM_MAC + + #if defined(__i386__) || defined(__x86_64__) + #define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */ + #elif defined(__aarch64__) + #define CATCH_TRAP() __asm__(".inst 0xd4200000") + #endif + +#elif defined(CATCH_PLATFORM_IPHONE) + + // use inline assembler + #if defined(__i386__) || defined(__x86_64__) + #define CATCH_TRAP() __asm__("int $3") + #elif defined(__aarch64__) + #define CATCH_TRAP() __asm__(".inst 0xd4200000") + #elif defined(__arm__) && !defined(__thumb__) + #define CATCH_TRAP() __asm__(".inst 0xe7f001f0") + #elif defined(__arm__) && defined(__thumb__) + #define CATCH_TRAP() __asm__(".inst 0xde01") + #endif + +#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 + +#ifndef CATCH_BREAK_INTO_DEBUGGER + #ifdef CATCH_TRAP + #define CATCH_BREAK_INTO_DEBUGGER() []{ if( Catch::isDebuggerActive() ) { CATCH_TRAP(); } }() + #else + #define CATCH_BREAK_INTO_DEBUGGER() []{}() + #endif +#endif + +#endif // CATCH_DEBUGGER_HPP_INCLUDED + + +#ifndef CATCH_ENUM_VALUES_REGISTRY_HPP_INCLUDED +#define CATCH_ENUM_VALUES_REGISTRY_HPP_INCLUDED + + +#include <vector> + +namespace Catch { + + namespace Detail { + + Catch::Detail::unique_ptr<EnumInfo> makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector<int> const& values ); + + class EnumValuesRegistry : public IMutableEnumValuesRegistry { + + std::vector<Catch::Detail::unique_ptr<EnumInfo>> m_enumInfos; + + EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::vector<int> const& values) override; + }; + + std::vector<StringRef> parseEnums( StringRef enums ); + + } // Detail + +} // Catch + +#endif // CATCH_ENUM_VALUES_REGISTRY_HPP_INCLUDED + + +#ifndef CATCH_ERRNO_GUARD_HPP_INCLUDED +#define CATCH_ERRNO_GUARD_HPP_INCLUDED + +namespace Catch { + + //! Simple RAII class that stores the value of `errno` + //! at construction and restores it at destruction. + class ErrnoGuard { + public: + // Keep these outlined to avoid dragging in macros from <cerrno> + + ErrnoGuard(); + ~ErrnoGuard(); + private: + int m_oldErrno; + }; + +} + +#endif // CATCH_ERRNO_GUARD_HPP_INCLUDED + + +#ifndef CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED +#define CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED + +#include <vector> +#include <string> + +namespace Catch { + + class ExceptionTranslatorRegistry : public IExceptionTranslatorRegistry { + public: + ~ExceptionTranslatorRegistry(); + virtual void registerTranslator( const IExceptionTranslator* translator ); + std::string translateActiveException() const override; + std::string tryTranslators() const; + + private: + ExceptionTranslators m_translators; + }; +} + +#endif // CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED + + +#ifndef CATCH_FATAL_CONDITION_HANDLER_HPP_INCLUDED +#define CATCH_FATAL_CONDITION_HANDLER_HPP_INCLUDED + + + +#ifndef CATCH_WINDOWS_H_PROXY_HPP_INCLUDED +#define CATCH_WINDOWS_H_PROXY_HPP_INCLUDED + + +#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 // CATCH_WINDOWS_H_PROXY_HPP_INCLUDED + + +#if defined( CATCH_CONFIG_WINDOWS_SEH ) + +namespace Catch { + + struct FatalConditionHandler { + + static LONG CALLBACK handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo); + FatalConditionHandler(); + static void reset(); + ~FatalConditionHandler() { reset(); } + + private: + static bool isSet; + static ULONG guaranteeSize; + static PVOID exceptionHandlerHandle; + }; + +} // namespace Catch + +#elif defined ( CATCH_CONFIG_POSIX_SIGNALS ) + +#include <signal.h> + +namespace Catch { + + struct FatalConditionHandler { + + static bool isSet; + static struct sigaction oldSigActions[]; + static stack_t oldSigStack; + static char altStackMem[]; + + static void handleSignal( int sig ); + + FatalConditionHandler(); + ~FatalConditionHandler() { reset(); } + static void reset(); + }; + +} // namespace Catch + + +#else + +namespace Catch { + struct FatalConditionHandler {}; +} + +#endif + +#endif // CATCH_FATAL_CONDITION_HANDLER_HPP_INCLUDED + + +#ifndef CATCH_LEAK_DETECTOR_HPP_INCLUDED +#define CATCH_LEAK_DETECTOR_HPP_INCLUDED + +namespace Catch { + + struct LeakDetector { + LeakDetector(); + ~LeakDetector(); + }; + +} +#endif // CATCH_LEAK_DETECTOR_HPP_INCLUDED + + +#ifndef CATCH_LIST_HPP_INCLUDED +#define CATCH_LIST_HPP_INCLUDED + + +#include <set> +#include <string> + + +namespace Catch { + + struct IStreamingReporter; + class Config; + + + struct ReporterDescription { + std::string name, description; + }; + + struct TagInfo { + void add(StringRef spelling); + std::string all() const; + + std::set<StringRef> spellings; + std::size_t count = 0; + }; + + bool list( IStreamingReporter& reporter, Config const& config ); + +} // end namespace Catch + +#endif // CATCH_LIST_HPP_INCLUDED + + +#ifndef CATCH_OPTION_HPP_INCLUDED +#define 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 // CATCH_OPTION_HPP_INCLUDED + + +#ifndef CATCH_OUTPUT_REDIRECT_HPP_INCLUDED +#define CATCH_OUTPUT_REDIRECT_HPP_INCLUDED + + +#include <cstdio> +#include <iosfwd> +#include <string> + +namespace Catch { + + class RedirectedStream { + std::ostream& m_originalStream; + std::ostream& m_redirectionStream; + std::streambuf* m_prevBuf; + + public: + RedirectedStream( std::ostream& originalStream, std::ostream& redirectionStream ); + ~RedirectedStream(); + }; + + class RedirectedStdOut { + ReusableStringStream m_rss; + RedirectedStream m_cout; + public: + RedirectedStdOut(); + auto str() const -> std::string; + }; + + // 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(); + auto str() const -> std::string; + }; + + class RedirectedStreams { + public: + RedirectedStreams(RedirectedStreams const&) = delete; + RedirectedStreams& operator=(RedirectedStreams const&) = delete; + RedirectedStreams(RedirectedStreams&&) = delete; + RedirectedStreams& operator=(RedirectedStreams&&) = delete; + + RedirectedStreams(std::string& redirectedCout, std::string& redirectedCerr); + ~RedirectedStreams(); + private: + std::string& m_redirectedCout; + std::string& m_redirectedCerr; + RedirectedStdOut m_redirectedStdOut; + RedirectedStdErr m_redirectedStdErr; + }; + +#if defined(CATCH_CONFIG_NEW_CAPTURE) + + // Windows's implementation of std::tmpfile is terrible (it tries + // to create a file inside system folder, thus requiring elevated + // privileges for the binary), so we have to use tmpnam(_s) and + // create the file ourselves there. + class TempFile { + public: + TempFile(TempFile const&) = delete; + TempFile& operator=(TempFile const&) = delete; + TempFile(TempFile&&) = delete; + TempFile& operator=(TempFile&&) = delete; + + TempFile(); + ~TempFile(); + + std::FILE* getFile(); + std::string getContents(); + + private: + std::FILE* m_file = nullptr; + #if defined(_MSC_VER) + char m_buffer[L_tmpnam] = { 0 }; + #endif + }; + + + class OutputRedirect { + public: + OutputRedirect(OutputRedirect const&) = delete; + OutputRedirect& operator=(OutputRedirect const&) = delete; + OutputRedirect(OutputRedirect&&) = delete; + OutputRedirect& operator=(OutputRedirect&&) = delete; + + + OutputRedirect(std::string& stdout_dest, std::string& stderr_dest); + ~OutputRedirect(); + + private: + int m_originalStdout = -1; + int m_originalStderr = -1; + TempFile m_stdoutFile; + TempFile m_stderrFile; + std::string& m_stdoutDest; + std::string& m_stderrDest; + }; + +#endif + +} // end namespace Catch + +#endif // CATCH_OUTPUT_REDIRECT_HPP_INCLUDED + + +#ifndef CATCH_POLYFILLS_HPP_INCLUDED +#define CATCH_POLYFILLS_HPP_INCLUDED + +namespace Catch { + bool isnan(float f); + bool isnan(double d); +} + +#endif // CATCH_POLYFILLS_HPP_INCLUDED + + +#ifndef CATCH_REPORTER_REGISTRY_HPP_INCLUDED +#define CATCH_REPORTER_REGISTRY_HPP_INCLUDED + + +#include <map> + +namespace Catch { + + class ReporterRegistry : public IReporterRegistry { + public: + + ReporterRegistry(); + ~ReporterRegistry() override; // = default, out of line to allow fwd decl + + IStreamingReporterPtr create( std::string const& name, IConfig const* config ) const override; + + void registerReporter( std::string const& name, IReporterFactoryPtr factory ); + void registerListener( IReporterFactoryPtr factory ); + + FactoryMap const& getFactories() const override; + Listeners const& getListeners() const override; + + private: + FactoryMap m_factories; + Listeners m_listeners; + }; +} + +#endif // CATCH_REPORTER_REGISTRY_HPP_INCLUDED + + +#ifndef CATCH_RUN_CONTEXT_HPP_INCLUDED +#define CATCH_RUN_CONTEXT_HPP_INCLUDED + + + +#ifndef CATCH_TEST_CASE_TRACKER_HPP_INCLUDED +#define CATCH_TEST_CASE_TRACKER_HPP_INCLUDED + + +#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 ); + friend bool operator==(NameAndLocation const& lhs, NameAndLocation const& rhs) { + return lhs.name == rhs.name + && lhs.location == rhs.location; + } + }; + + class ITracker; + + using ITrackerPtr = std::shared_ptr<ITracker>; + + class ITracker { + NameAndLocation m_nameAndLocation; + + using Children = std::vector<ITrackerPtr>; + + protected: + Children m_children; + + public: + ITracker(NameAndLocation const& nameAndLoc) : + m_nameAndLocation(nameAndLoc) + {} + + + // static queries + NameAndLocation const& nameAndLocation() const { + return m_nameAndLocation; + } + + virtual ~ITracker(); + + + // dynamic queries + virtual bool isComplete() const = 0; // Successfully completed or failed + virtual bool isSuccessfullyCompleted() const = 0; + virtual bool isOpen() const = 0; // Started but not complete + virtual bool hasStarted() const = 0; + + virtual ITracker& parent() = 0; + + // actions + virtual void close() = 0; // Successfully complete + virtual void fail() = 0; + virtual void markAsNeedingAnotherRun() = 0; + + //! Register a nested ITracker + void addChild( ITrackerPtr const& child ); + /** + * Returns ptr to specific child if register with this tracker. + * + * Returns nullptr if not found. + */ + ITrackerPtr findChild( NameAndLocation const& nameAndLocation ); + //! Have any children been added? + bool hasChildren() const { + return !m_children.empty(); + } + + + virtual void openChild() = 0; + + // Debug/ checking + virtual bool isSectionTracker() const = 0; + virtual bool isGeneratorTracker() const = 0; + }; + + class TrackerContext { + + enum RunState { + NotStarted, + Executing, + CompletedCycle + }; + + ITrackerPtr m_rootTracker; + ITracker* m_currentTracker = nullptr; + RunState m_runState = NotStarted; + + public: + + 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 + }; + + TrackerContext& m_ctx; + ITracker* m_parent; + CycleState m_runState = NotStarted; + + public: + TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ); + + bool isComplete() const override; + bool isSuccessfullyCompleted() const override; + bool isOpen() const override; + bool hasStarted() const override { + return m_runState != NotStarted; + } + + ITracker& parent() override; + + void openChild() override; + + bool isSectionTracker() const override; + bool isGeneratorTracker() 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; + std::string m_trimmed_name; + public: + SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ); + + bool isSectionTracker() const override; + + bool isComplete() 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 ); + }; + +} // namespace TestCaseTracking + +using TestCaseTracking::ITracker; +using TestCaseTracking::TrackerContext; +using TestCaseTracking::SectionTracker; + +} // namespace Catch + +#endif // CATCH_TEST_CASE_TRACKER_HPP_INCLUDED + +#include <string> + +namespace Catch { + + struct IMutableContext; + struct IGeneratorTracker; + struct IConfig; + + /////////////////////////////////////////////////////////////////////////// + + class RunContext : public IResultCapture, public IRunner { + + public: + RunContext( RunContext const& ) = delete; + RunContext& operator =( RunContext const& ) = delete; + + explicit RunContext( IConfig 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(TestCaseHandle const& testCase); + + 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; + + auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& override; + + void benchmarkPreparing( std::string const& name ) override; + void benchmarkStarting( BenchmarkInfo const& info ) override; + void benchmarkEnded( BenchmarkStats<> const& stats ) override; + void benchmarkFailed( std::string const& error ) override; + + void pushScopedMessage( MessageInfo const& message ) override; + void popScopedMessage( MessageInfo const& message ) override; + + void emplaceUnscopedMessage( MessageBuilder const& builder ) 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; + TestCaseHandle const* m_activeTestCase = nullptr; + ITracker* m_testCaseTracker = nullptr; + Option<AssertionResult> m_lastResult; + + IConfig const* m_config; + Totals m_totals; + IStreamingReporterPtr m_reporter; + std::vector<MessageInfo> m_messages; + std::vector<ScopedMessage> m_messageScopes; /* Keeps owners of so-called unscoped 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; + }; + + void seedRng(IConfig const& config); + unsigned int rngSeed(); +} // end namespace Catch + +#endif // CATCH_RUN_CONTEXT_HPP_INCLUDED + + +#ifndef CATCH_SINGLETONS_HPP_INCLUDED +#define CATCH_SINGLETONS_HPP_INCLUDED + +namespace Catch { + + struct ISingleton { + virtual ~ISingleton(); + }; + + + void addSingleton( ISingleton* singleton ); + void cleanupSingletons(); + + + template<typename SingletonImplT, typename InterfaceT = SingletonImplT, typename MutableInterfaceT = InterfaceT> + class Singleton : SingletonImplT, public ISingleton { + + static auto getInternal() -> Singleton* { + static Singleton* s_instance = nullptr; + if( !s_instance ) { + s_instance = new Singleton; + addSingleton( s_instance ); + } + return s_instance; + } + + public: + static auto get() -> InterfaceT const& { + return *getInternal(); + } + static auto getMutable() -> MutableInterfaceT& { + return *getInternal(); + } + }; + +} // namespace Catch + +#endif // CATCH_SINGLETONS_HPP_INCLUDED + + +#ifndef CATCH_STARTUP_EXCEPTION_REGISTRY_HPP_INCLUDED +#define CATCH_STARTUP_EXCEPTION_REGISTRY_HPP_INCLUDED + + +#include <vector> +#include <exception> + +namespace Catch { + + class StartupExceptionRegistry { +#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + public: + void add(std::exception_ptr const& exception) noexcept; + std::vector<std::exception_ptr> const& getExceptions() const noexcept; + private: + std::vector<std::exception_ptr> m_exceptions; +#endif + }; + +} // end namespace Catch + +#endif // CATCH_STARTUP_EXCEPTION_REGISTRY_HPP_INCLUDED + + +#ifndef CATCH_STRING_MANIP_HPP_INCLUDED +#define CATCH_STRING_MANIP_HPP_INCLUDED + + +#include <string> +#include <iosfwd> +#include <vector> + +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 ); + //! Returns a new string without whitespace at the start/end + std::string trim( std::string const& str ); + //! Returns a substring of the original ref without whitespace. Beware lifetimes! + StringRef trim(StringRef ref); + + // !!! Be aware, returns refs into original string - make sure original string outlives them + std::vector<StringRef> splitStringRef( StringRef str, char delimiter ); + 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 // CATCH_STRING_MANIP_HPP_INCLUDED + + +#ifndef CATCH_TAG_ALIAS_REGISTRY_HPP_INCLUDED +#define CATCH_TAG_ALIAS_REGISTRY_HPP_INCLUDED + + +#include <map> +#include <string> + +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 // CATCH_TAG_ALIAS_REGISTRY_HPP_INCLUDED + + +#ifndef CATCH_TEST_CASE_REGISTRY_IMPL_HPP_INCLUDED +#define CATCH_TEST_CASE_REGISTRY_IMPL_HPP_INCLUDED + + +#include <vector> + +namespace Catch { + + class TestCaseHandle; + struct IConfig; + class TestSpec; + + std::vector<TestCaseHandle> sortTests( IConfig const& config, std::vector<TestCaseHandle> const& unsortedTestCases ); + + bool isThrowSafe( TestCaseHandle const& testCase, IConfig const& config ); + bool matchTest( TestCaseHandle const& testCase, TestSpec const& testSpec, IConfig const& config ); + + void enforceNoDuplicateTestCases( std::vector<TestCaseHandle> const& functions ); + + std::vector<TestCaseHandle> filterTests( std::vector<TestCaseHandle> const& testCases, TestSpec const& testSpec, IConfig const& config ); + std::vector<TestCaseHandle> const& getAllTestCasesSorted( IConfig const& config ); + + class TestRegistry : public ITestCaseRegistry { + public: + ~TestRegistry() override = default; + + void registerTest( Detail::unique_ptr<TestCaseInfo> testInfo, Detail::unique_ptr<ITestInvoker> testInvoker ); + + std::vector<TestCaseInfo*> const& getAllInfos() const override; + std::vector<TestCaseHandle> const& getAllTests() const override; + std::vector<TestCaseHandle> const& getAllTestsSorted( IConfig const& config ) const override; + + private: + std::vector<Detail::unique_ptr<TestCaseInfo>> m_owned_test_infos; + // Keeps a materialized vector for `getAllInfos`. + // We should get rid of that eventually (see interface note) + std::vector<TestCaseInfo*> m_viewed_test_infos; + + std::vector<Detail::unique_ptr<ITestInvoker>> m_invokers; + std::vector<TestCaseHandle> m_handles; + mutable TestRunOrder m_currentSortOrder = TestRunOrder::Declared; + mutable std::vector<TestCaseHandle> m_sortedFunctions; + }; + + /////////////////////////////////////////////////////////////////////////// + + class TestInvokerAsFunction final : public ITestInvoker { + using TestType = void(*)(); + TestType m_testAsFunction; + public: + TestInvokerAsFunction(TestType testAsFunction) noexcept: + m_testAsFunction(testAsFunction) {} + + void invoke() const override; + }; + + + std::string extractClassName( StringRef const& classOrQualifiedMethodName ); + + /////////////////////////////////////////////////////////////////////////// + + +} // end namespace Catch + + +#endif // CATCH_TEST_CASE_REGISTRY_IMPL_HPP_INCLUDED + + +#ifndef CATCH_TEST_SPEC_PARSER_HPP_INCLUDED +#define CATCH_TEST_SPEC_PARSER_HPP_INCLUDED + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif + + +#include <vector> +#include <string> + +namespace Catch { + + struct ITagAliasRegistry; + + class TestSpecParser { + enum Mode{ None, Name, QuotedName, Tag, EscapedName }; + Mode m_mode = None; + Mode lastMode = None; + bool m_exclusion = false; + std::size_t m_pos = 0; + std::size_t m_realPatternPos = 0; + std::string m_arg; + std::string m_substring; + std::string m_patternName; + 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: + bool visitChar( char c ); + void startNewMode( Mode mode ); + bool processNoneChar( char c ); + void processNameChar( char c ); + bool processOtherChar( char c ); + void endMode(); + void escape(); + bool isControlChar( char c ) const; + void saveLastMode(); + void revertBackToLastMode(); + void addFilter(); + bool separate(); + + // Handles common preprocessing of the pattern for name/tag patterns + std::string preprocessPattern(); + // Adds the current pattern as a test name + void addNamePattern(); + // Adds the current pattern as a tag + void addTagPattern(); + + inline void addCharToPattern(char c) { + m_substring += c; + m_patternName += c; + m_realPatternPos++; + } + + }; + TestSpec parseTestSpec( std::string const& arg ); + +} // namespace Catch + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +#endif // CATCH_TEST_SPEC_PARSER_HPP_INCLUDED + + +#ifndef CATCH_TEXTFLOW_HPP_INCLUDED +#define CATCH_TEXTFLOW_HPP_INCLUDED + +#include <cassert> +#include <string> +#include <vector> + +namespace Catch { + namespace TextFlow { + + class Columns; + + class Column { + std::string m_string; + size_t m_width = CATCH_CONFIG_CONSOLE_WIDTH - 1; + size_t m_indent = 0; + size_t m_initialIndent = std::string::npos; + + public: + class iterator { + friend Column; + struct EndTag {}; + + Column const& m_column; + size_t m_pos = 0; + + size_t m_len = 0; + size_t m_end = 0; + bool m_suffix = false; + + iterator( Column const& column, EndTag ): + m_column( column ), m_pos( m_column.m_string.size() ) {} + + void calcLength(); + + // Returns current indention width + size_t indent() const; + + // Creates an indented and (optionally) suffixed string from + // current iterator position, indentation and length. + std::string addIndentAndSuffix( size_t position, + size_t length ) const; + + public: + using difference_type = std::ptrdiff_t; + using value_type = std::string; + using pointer = value_type*; + using reference = value_type&; + using iterator_category = std::forward_iterator_tag; + + explicit iterator( Column const& column ); + + std::string operator*() const; + + iterator& operator++(); + iterator operator++( int ); + + bool operator==( iterator const& other ) const { + return m_pos == other.m_pos && &m_column == &other.m_column; + } + bool operator!=( iterator const& other ) const { + return !operator==( other ); + } + }; + using const_iterator = iterator; + + explicit Column( std::string const& text ): m_string( text ) {} + + Column& width( size_t newWidth ) { + assert( newWidth > 0 ); + m_width = newWidth; + return *this; + } + Column& indent( size_t newIndent ) { + m_indent = newIndent; + return *this; + } + Column& initialIndent( size_t newIndent ) { + m_initialIndent = newIndent; + return *this; + } + + size_t width() const { return m_width; } + iterator begin() const { return iterator( *this ); } + iterator end() const { return { *this, iterator::EndTag{} }; } + + friend std::ostream& operator<<( std::ostream& os, + Column const& col ); + + Columns operator+( Column const& other ); + }; + + //! Creates a column that serves as an empty space of specific width + Column Spacer( size_t 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 ); + + public: + using difference_type = std::ptrdiff_t; + using value_type = std::string; + using pointer = value_type*; + using reference = value_type&; + using iterator_category = std::forward_iterator_tag; + + explicit iterator( Columns const& columns ); + + 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; + } + std::string operator*() const; + iterator& operator++(); + iterator operator++( int ); + }; + using const_iterator = iterator; + + iterator begin() const { return iterator( *this ); } + iterator end() const { return { *this, iterator::EndTag() }; } + + Columns& operator+=( Column const& col ); + Columns operator+( Column const& col ); + + friend std::ostream& operator<<( std::ostream& os, + Columns const& cols ); + }; + + } // namespace TextFlow +} // namespace Catch +#endif // CATCH_TEXTFLOW_HPP_INCLUDED + + +#ifndef CATCH_TO_STRING_HPP_INCLUDED +#define CATCH_TO_STRING_HPP_INCLUDED + +#include <string> + + +namespace Catch { + template <typename T> + std::string to_string(T const& t) { +#if defined(CATCH_CONFIG_CPP11_TO_STRING) + return std::to_string(t); +#else + ReusableStringStream rss; + rss << t; + return rss.str(); +#endif + } +} // end namespace Catch + +#endif // CATCH_TO_STRING_HPP_INCLUDED + + +#ifndef CATCH_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED +#define CATCH_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED + +namespace Catch { + bool uncaught_exceptions(); +} // end namespace Catch + +#endif // CATCH_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED + + +#ifndef CATCH_XMLWRITER_HPP_INCLUDED +#define CATCH_XMLWRITER_HPP_INCLUDED + + +// FixMe: Without this include (and something inside it), MSVC goes crazy +// and reports that calls to XmlEncode's op << are ambiguous between +// the declaration and definition. +// It also has to be in the header. + + +#include <vector> + +namespace Catch { + enum class XmlFormatting { + None = 0x00, + Indent = 0x01, + Newline = 0x02, + }; + + XmlFormatting operator | (XmlFormatting lhs, XmlFormatting rhs); + XmlFormatting operator & (XmlFormatting lhs, XmlFormatting rhs); + + 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, XmlFormatting fmt ); + + ScopedElement( ScopedElement&& other ) noexcept; + ScopedElement& operator=( ScopedElement&& other ) noexcept; + + ~ScopedElement(); + + ScopedElement& writeText( std::string const& text, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent ); + + 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; + XmlFormatting m_fmt; + }; + + XmlWriter( std::ostream& os = Catch::cout() ); + ~XmlWriter(); + + XmlWriter( XmlWriter const& ) = delete; + XmlWriter& operator=( XmlWriter const& ) = delete; + + XmlWriter& startElement( std::string const& name, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent); + + ScopedElement scopedElement( std::string const& name, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent); + + XmlWriter& endElement(XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent); + + 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, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent); + + XmlWriter& writeComment(std::string const& text, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent); + + void writeStylesheetRef( std::string const& url ); + + XmlWriter& writeBlankLine(); + + void ensureTagClosed(); + + private: + + void applyFormatting(XmlFormatting fmt); + + 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 // CATCH_XMLWRITER_HPP_INCLUDED + + +/** \file + * This is a convenience header for Catch2's Matcher support. It includes + * **all** of Catch2 headers related to matchers. + * + * Generally the Catch2 users should use specific includes they need, + * but this header can be used instead for ease-of-experimentation, or + * just plain convenience, at the cost of increased compilation times. + * + * When a new header is added to either the `matchers` folder, or to + * the corresponding internal subfolder, it should be added here. + */ + +#ifndef CATCH_MATCHERS_ALL_HPP_INCLUDED +#define CATCH_MATCHERS_ALL_HPP_INCLUDED + + + +#ifndef CATCH_MATCHERS_HPP_INCLUDED +#define CATCH_MATCHERS_HPP_INCLUDED + + + +#ifndef CATCH_MATCHERS_IMPL_HPP_INCLUDED +#define CATCH_MATCHERS_IMPL_HPP_INCLUDED + + +namespace Catch { + + template<typename ArgT, typename MatcherT> + class MatchExpr : public ITransientExpression { + ArgT && m_arg; + MatcherT const& m_matcher; + StringRef m_matcherString; + public: + MatchExpr( ArgT && arg, MatcherT const& matcher, StringRef const& matcherString ) + : ITransientExpression{ true, matcher.match( arg ) }, // not forwarding arg here on purpose + m_arg( std::forward<ArgT>(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; + } + }; + + namespace Matchers { + template <typename ArgT> + struct MatcherBase; + } + + using StringMatcher = Matchers::MatcherBase<std::string>; + + void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef const& matcherString ); + + template<typename ArgT, typename MatcherT> + auto makeMatchExpr( ArgT && arg, MatcherT const& matcher, StringRef const& matcherString ) -> MatchExpr<ArgT, MatcherT> { + return MatchExpr<ArgT, MatcherT>( std::forward<ArgT>(arg), matcher, matcherString ); + } + +} // namespace Catch + + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CHECK_THAT( macroName, matcher, resultDisposition, arg ) \ + do { \ + Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(arg) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \ + INTERNAL_CATCH_TRY { \ + catchAssertionHandler.handleExpr( Catch::makeMatchExpr( arg, matcher, #matcher##_catch_sr ) ); \ + } 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_sr, 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_sr ) ); \ + } \ + catch( ... ) { \ + catchAssertionHandler.handleUnexpectedInflightException(); \ + } \ + else \ + catchAssertionHandler.handleThrowingCallSkipped(); \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( false ) + + +#endif // CATCH_MATCHERS_IMPL_HPP_INCLUDED + +#include <string> +#include <vector> + +namespace Catch { +namespace Matchers { + + class MatcherUntypedBase { + public: + MatcherUntypedBase() = default; + + MatcherUntypedBase(MatcherUntypedBase const&) = default; + MatcherUntypedBase(MatcherUntypedBase&&) = default; + + MatcherUntypedBase& operator = (MatcherUntypedBase const&) = delete; + MatcherUntypedBase& operator = (MatcherUntypedBase&&) = delete; + + std::string toString() const; + + protected: + virtual ~MatcherUntypedBase(); // = default; + virtual std::string describe() const = 0; + mutable std::string m_cachedToString; + }; + +#ifdef __clang__ +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wnon-virtual-dtor" +#endif + + template<typename ObjectT> + struct MatcherMethod { + virtual bool match(ObjectT const& arg) const = 0; + }; + +#ifdef __clang__ +# pragma clang diagnostic pop +#endif + + template<typename T> + struct MatcherBase : MatcherUntypedBase, MatcherMethod<T> {}; + + namespace Detail { + + template<typename ArgT> + struct MatchAllOf final : MatcherBase<ArgT> { + MatchAllOf() = default; + MatchAllOf(MatchAllOf const&) = delete; + MatchAllOf& operator=(MatchAllOf const&) = delete; + MatchAllOf(MatchAllOf&&) = default; + MatchAllOf& operator=(MatchAllOf&&) = default; + + + 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; + } + + friend MatchAllOf operator&& (MatchAllOf&& lhs, MatcherBase<ArgT> const& rhs) { + lhs.m_matchers.push_back(&rhs); + return std::move(lhs); + } + friend MatchAllOf operator&& (MatcherBase<ArgT> const& lhs, MatchAllOf&& rhs) { + rhs.m_matchers.insert(rhs.m_matchers.begin(), &lhs); + return std::move(rhs); + } + + private: + std::vector<MatcherBase<ArgT> const*> m_matchers; + }; + + //! lvalue overload is intentionally deleted, users should + //! not be trying to compose stored composition matchers + template<typename ArgT> + MatchAllOf<ArgT> operator&& (MatchAllOf<ArgT> const& lhs, MatcherBase<ArgT> const& rhs) = delete; + //! lvalue overload is intentionally deleted, users should + //! not be trying to compose stored composition matchers + template<typename ArgT> + MatchAllOf<ArgT> operator&& (MatcherBase<ArgT> const& lhs, MatchAllOf<ArgT> const& rhs) = delete; + + template<typename ArgT> + struct MatchAnyOf final : MatcherBase<ArgT> { + MatchAnyOf() = default; + MatchAnyOf(MatchAnyOf const&) = delete; + MatchAnyOf& operator=(MatchAnyOf const&) = delete; + MatchAnyOf(MatchAnyOf&&) = default; + MatchAnyOf& operator=(MatchAnyOf&&) = default; + + 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; + } + + friend MatchAnyOf operator|| (MatchAnyOf&& lhs, MatcherBase<ArgT> const& rhs) { + lhs.m_matchers.push_back(&rhs); + return std::move(lhs); + } + friend MatchAnyOf operator|| (MatcherBase<ArgT> const& lhs, MatchAnyOf&& rhs) { + rhs.m_matchers.insert(rhs.m_matchers.begin(), &lhs); + return std::move(rhs); + } + + private: + std::vector<MatcherBase<ArgT> const*> m_matchers; + }; + + //! lvalue overload is intentionally deleted, users should + //! not be trying to compose stored composition matchers + template<typename ArgT> + MatchAnyOf<ArgT> operator|| (MatchAnyOf<ArgT> const& lhs, MatcherBase<ArgT> const& rhs) = delete; + //! lvalue overload is intentionally deleted, users should + //! not be trying to compose stored composition matchers + template<typename ArgT> + MatchAnyOf<ArgT> operator|| (MatcherBase<ArgT> const& lhs, MatchAnyOf<ArgT> const& rhs) = delete; + + template<typename ArgT> + struct MatchNotOf final : MatcherBase<ArgT> { + + explicit 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(); + } + + private: + MatcherBase<ArgT> const& m_underlyingMatcher; + }; + + } // namespace Detail + + template <typename T> + Detail::MatchAllOf<T> operator&& (MatcherBase<T> const& lhs, MatcherBase<T> const& rhs) { + return Detail::MatchAllOf<T>{} && lhs && rhs; + } + template <typename T> + Detail::MatchAnyOf<T> operator|| (MatcherBase<T> const& lhs, MatcherBase<T> const& rhs) { + return Detail::MatchAnyOf<T>{} || lhs || rhs; + } + + template <typename T> + Detail::MatchNotOf<T> operator! (MatcherBase<T> const& matcher) { + return Detail::MatchNotOf<T>{ matcher }; + } + + +} // namespace Matchers +} // namespace Catch + + +#if defined(CATCH_CONFIG_PREFIX_ALL) && !defined(CATCH_CONFIG_DISABLE) + #define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CATCH_REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr ) + #define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CATCH_REQUIRE_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::Normal, matcher, expr ) + + #define CATCH_CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CATCH_CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr ) + #define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CATCH_CHECK_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr ) + + #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 ) + +#elif defined(CATCH_CONFIG_PREFIX_ALL) && defined(CATCH_CONFIG_DISABLE) + + #define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) (void)(0) + #define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0) + + #define CATCH_CHECK_THROWS_WITH( expr, matcher ) (void)(0) + #define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0) + + #define CATCH_CHECK_THAT( arg, matcher ) (void)(0) + #define CATCH_REQUIRE_THAT( arg, matcher ) (void)(0) + +#elif !defined(CATCH_CONFIG_PREFIX_ALL) && !defined(CATCH_CONFIG_DISABLE) + + #define REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr ) + #define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "REQUIRE_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::Normal, matcher, expr ) + + #define CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr ) + #define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CHECK_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr ) + + #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 ) + +#elif !defined(CATCH_CONFIG_PREFIX_ALL) && defined(CATCH_CONFIG_DISABLE) + + #define REQUIRE_THROWS_WITH( expr, matcher ) (void)(0) + #define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0) + + #define CHECK_THROWS_WITH( expr, matcher ) (void)(0) + #define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0) + + #define CHECK_THAT( arg, matcher ) (void)(0) + #define REQUIRE_THAT( arg, matcher ) (void)(0) + +#endif // end of user facing macro declarations + +#endif // CATCH_MATCHERS_HPP_INCLUDED + + +#ifndef CATCH_MATCHERS_CONTAINER_PROPERTIES_HPP_INCLUDED +#define CATCH_MATCHERS_CONTAINER_PROPERTIES_HPP_INCLUDED + + + +#ifndef CATCH_MATCHERS_TEMPLATED_HPP_INCLUDED +#define CATCH_MATCHERS_TEMPLATED_HPP_INCLUDED + + +#include <array> +#include <algorithm> +#include <string> +#include <type_traits> +#include <utility> + +namespace Catch { +namespace Matchers { + struct MatcherGenericBase : MatcherUntypedBase { + MatcherGenericBase() = default; + virtual ~MatcherGenericBase(); // = default; + + MatcherGenericBase(MatcherGenericBase&) = default; + MatcherGenericBase(MatcherGenericBase&&) = default; + + MatcherGenericBase& operator=(MatcherGenericBase const&) = delete; + MatcherGenericBase& operator=(MatcherGenericBase&&) = delete; + }; + + + namespace Detail { + template<std::size_t N, std::size_t M> + std::array<void const*, N + M> array_cat(std::array<void const*, N> && lhs, std::array<void const*, M> && rhs) { + std::array<void const*, N + M> arr{}; + std::copy_n(lhs.begin(), N, arr.begin()); + std::copy_n(rhs.begin(), M, arr.begin() + N); + return arr; + } + + template<std::size_t N> + std::array<void const*, N+1> array_cat(std::array<void const*, N> && lhs, void const* rhs) { + std::array<void const*, N+1> arr{}; + std::copy_n(lhs.begin(), N, arr.begin()); + arr[N] = rhs; + return arr; + } + + template<std::size_t N> + std::array<void const*, N+1> array_cat(void const* lhs, std::array<void const*, N> && rhs) { + std::array<void const*, N + 1> arr{ {lhs} }; + std::copy_n(rhs.begin(), N, arr.begin() + 1); + return arr; + } + + #ifdef CATCH_CPP17_OR_GREATER + + using std::conjunction; + + #else // CATCH_CPP17_OR_GREATER + + template<typename... Cond> + struct conjunction : std::true_type {}; + + template<typename Cond, typename... Rest> + struct conjunction<Cond, Rest...> : std::integral_constant<bool, Cond::value && conjunction<Rest...>::value> {}; + + #endif // CATCH_CPP17_OR_GREATER + + template<typename T> + using is_generic_matcher = std::is_base_of< + Catch::Matchers::MatcherGenericBase, + std::remove_cv_t<std::remove_reference_t<T>> + >; + + template<typename... Ts> + using are_generic_matchers = conjunction<is_generic_matcher<Ts>...>; + + template<typename T> + using is_matcher = std::is_base_of< + Catch::Matchers::MatcherUntypedBase, + std::remove_cv_t<std::remove_reference_t<T>> + >; + + + template<std::size_t N, typename Arg> + bool match_all_of(Arg&&, std::array<void const*, N> const&, std::index_sequence<>) { + return true; + } + + template<typename T, typename... MatcherTs, std::size_t N, typename Arg, std::size_t Idx, std::size_t... Indices> + bool match_all_of(Arg&& arg, std::array<void const*, N> const& matchers, std::index_sequence<Idx, Indices...>) { + return static_cast<T const*>(matchers[Idx])->match(arg) && match_all_of<MatcherTs...>(arg, matchers, std::index_sequence<Indices...>{}); + } + + + template<std::size_t N, typename Arg> + bool match_any_of(Arg&&, std::array<void const*, N> const&, std::index_sequence<>) { + return false; + } + + template<typename T, typename... MatcherTs, std::size_t N, typename Arg, std::size_t Idx, std::size_t... Indices> + bool match_any_of(Arg&& arg, std::array<void const*, N> const& matchers, std::index_sequence<Idx, Indices...>) { + return static_cast<T const*>(matchers[Idx])->match(arg) || match_any_of<MatcherTs...>(arg, matchers, std::index_sequence<Indices...>{}); + } + + std::string describe_multi_matcher(StringRef combine, std::string const* descriptions_begin, std::string const* descriptions_end); + + template<typename... MatcherTs, std::size_t... Idx> + std::string describe_multi_matcher(StringRef combine, std::array<void const*, sizeof...(MatcherTs)> const& matchers, std::index_sequence<Idx...>) { + std::array<std::string, sizeof...(MatcherTs)> descriptions {{ + static_cast<MatcherTs const*>(matchers[Idx])->toString()... + }}; + + return describe_multi_matcher(combine, descriptions.data(), descriptions.data() + descriptions.size()); + } + + + template<typename... MatcherTs> + struct MatchAllOfGeneric final : MatcherGenericBase { + MatchAllOfGeneric(MatchAllOfGeneric const&) = delete; + MatchAllOfGeneric& operator=(MatchAllOfGeneric const&) = delete; + MatchAllOfGeneric(MatchAllOfGeneric&&) = default; + MatchAllOfGeneric& operator=(MatchAllOfGeneric&&) = default; + + MatchAllOfGeneric(MatcherTs const&... matchers) : m_matchers{ {std::addressof(matchers)...} } {} + explicit MatchAllOfGeneric(std::array<void const*, sizeof...(MatcherTs)> matchers) : m_matchers{matchers} {} + + template<typename Arg> + bool match(Arg&& arg) const { + return match_all_of<MatcherTs...>(arg, m_matchers, std::index_sequence_for<MatcherTs...>{}); + } + + std::string describe() const override { + return describe_multi_matcher<MatcherTs...>(" and "_sr, m_matchers, std::index_sequence_for<MatcherTs...>{}); + } + + std::array<void const*, sizeof...(MatcherTs)> m_matchers; + + //! Avoids type nesting for `GenericAllOf && GenericAllOf` case + template<typename... MatchersRHS> + friend + MatchAllOfGeneric<MatcherTs..., MatchersRHS...> operator && ( + MatchAllOfGeneric<MatcherTs...>&& lhs, + MatchAllOfGeneric<MatchersRHS...>&& rhs) { + return MatchAllOfGeneric<MatcherTs..., MatchersRHS...>{array_cat(std::move(lhs.m_matchers), std::move(rhs.m_matchers))}; + } + + //! Avoids type nesting for `GenericAllOf && some matcher` case + template<typename MatcherRHS> + friend std::enable_if_t<is_matcher<MatcherRHS>::value, + MatchAllOfGeneric<MatcherTs..., MatcherRHS>> operator && ( + MatchAllOfGeneric<MatcherTs...>&& lhs, + MatcherRHS const& rhs) { + return MatchAllOfGeneric<MatcherTs..., MatcherRHS>{array_cat(std::move(lhs.m_matchers), static_cast<void const*>(&rhs))}; + } + + //! Avoids type nesting for `some matcher && GenericAllOf` case + template<typename MatcherLHS> + friend std::enable_if_t<is_matcher<MatcherLHS>::value, + MatchAllOfGeneric<MatcherLHS, MatcherTs...>> operator && ( + MatcherLHS const& lhs, + MatchAllOfGeneric<MatcherTs...>&& rhs) { + return MatchAllOfGeneric<MatcherLHS, MatcherTs...>{array_cat(static_cast<void const*>(std::addressof(lhs)), std::move(rhs.m_matchers))}; + } + }; + + + template<typename... MatcherTs> + struct MatchAnyOfGeneric final : MatcherGenericBase { + MatchAnyOfGeneric(MatchAnyOfGeneric const&) = delete; + MatchAnyOfGeneric& operator=(MatchAnyOfGeneric const&) = delete; + MatchAnyOfGeneric(MatchAnyOfGeneric&&) = default; + MatchAnyOfGeneric& operator=(MatchAnyOfGeneric&&) = default; + + MatchAnyOfGeneric(MatcherTs const&... matchers) : m_matchers{ {std::addressof(matchers)...} } {} + explicit MatchAnyOfGeneric(std::array<void const*, sizeof...(MatcherTs)> matchers) : m_matchers{matchers} {} + + template<typename Arg> + bool match(Arg&& arg) const { + return match_any_of<MatcherTs...>(arg, m_matchers, std::index_sequence_for<MatcherTs...>{}); + } + + std::string describe() const override { + return describe_multi_matcher<MatcherTs...>(" or "_sr, m_matchers, std::index_sequence_for<MatcherTs...>{}); + } + + std::array<void const*, sizeof...(MatcherTs)> m_matchers; + + //! Avoids type nesting for `GenericAnyOf || GenericAnyOf` case + template<typename... MatchersRHS> + friend MatchAnyOfGeneric<MatcherTs..., MatchersRHS...> operator || ( + MatchAnyOfGeneric<MatcherTs...>&& lhs, + MatchAnyOfGeneric<MatchersRHS...>&& rhs) { + return MatchAnyOfGeneric<MatcherTs..., MatchersRHS...>{array_cat(std::move(lhs.m_matchers), std::move(rhs.m_matchers))}; + } + + //! Avoids type nesting for `GenericAnyOf || some matcher` case + template<typename MatcherRHS> + friend std::enable_if_t<is_matcher<MatcherRHS>::value, + MatchAnyOfGeneric<MatcherTs..., MatcherRHS>> operator || ( + MatchAnyOfGeneric<MatcherTs...>&& lhs, + MatcherRHS const& rhs) { + return MatchAnyOfGeneric<MatcherTs..., MatcherRHS>{array_cat(std::move(lhs.m_matchers), static_cast<void const*>(std::addressof(rhs)))}; + } + + //! Avoids type nesting for `some matcher || GenericAnyOf` case + template<typename MatcherLHS> + friend std::enable_if_t<is_matcher<MatcherLHS>::value, + MatchAnyOfGeneric<MatcherLHS, MatcherTs...>> operator || ( + MatcherLHS const& lhs, + MatchAnyOfGeneric<MatcherTs...>&& rhs) { + return MatchAnyOfGeneric<MatcherLHS, MatcherTs...>{array_cat(static_cast<void const*>(std::addressof(lhs)), std::move(rhs.m_matchers))}; + } + }; + + + template<typename MatcherT> + struct MatchNotOfGeneric final : MatcherGenericBase { + MatchNotOfGeneric(MatchNotOfGeneric const&) = delete; + MatchNotOfGeneric& operator=(MatchNotOfGeneric const&) = delete; + MatchNotOfGeneric(MatchNotOfGeneric&&) = default; + MatchNotOfGeneric& operator=(MatchNotOfGeneric&&) = default; + + explicit MatchNotOfGeneric(MatcherT const& matcher) : m_matcher{matcher} {} + + template<typename Arg> + bool match(Arg&& arg) const { + return !m_matcher.match(arg); + } + + std::string describe() const override { + return "not " + m_matcher.toString(); + } + + //! Negating negation can just unwrap and return underlying matcher + friend MatcherT const& operator ! (MatchNotOfGeneric<MatcherT> const& matcher) { + return matcher.m_matcher; + } + private: + MatcherT const& m_matcher; + }; + } // namespace Detail + + + // compose only generic matchers + template<typename MatcherLHS, typename MatcherRHS> + std::enable_if_t<Detail::are_generic_matchers<MatcherLHS, MatcherRHS>::value, Detail::MatchAllOfGeneric<MatcherLHS, MatcherRHS>> + operator && (MatcherLHS const& lhs, MatcherRHS const& rhs) { + return { lhs, rhs }; + } + + template<typename MatcherLHS, typename MatcherRHS> + std::enable_if_t<Detail::are_generic_matchers<MatcherLHS, MatcherRHS>::value, Detail::MatchAnyOfGeneric<MatcherLHS, MatcherRHS>> + operator || (MatcherLHS const& lhs, MatcherRHS const& rhs) { + return { lhs, rhs }; + } + + //! Wrap provided generic matcher in generic negator + template<typename MatcherT> + std::enable_if_t<Detail::is_generic_matcher<MatcherT>::value, Detail::MatchNotOfGeneric<MatcherT>> + operator ! (MatcherT const& matcher) { + return Detail::MatchNotOfGeneric<MatcherT>{matcher}; + } + + + // compose mixed generic and non-generic matchers + template<typename MatcherLHS, typename ArgRHS> + std::enable_if_t<Detail::is_generic_matcher<MatcherLHS>::value, Detail::MatchAllOfGeneric<MatcherLHS, MatcherBase<ArgRHS>>> + operator && (MatcherLHS const& lhs, MatcherBase<ArgRHS> const& rhs) { + return { lhs, rhs }; + } + + template<typename ArgLHS, typename MatcherRHS> + std::enable_if_t<Detail::is_generic_matcher<MatcherRHS>::value, Detail::MatchAllOfGeneric<MatcherBase<ArgLHS>, MatcherRHS>> + operator && (MatcherBase<ArgLHS> const& lhs, MatcherRHS const& rhs) { + return { lhs, rhs }; + } + + template<typename MatcherLHS, typename ArgRHS> + std::enable_if_t<Detail::is_generic_matcher<MatcherLHS>::value, Detail::MatchAnyOfGeneric<MatcherLHS, MatcherBase<ArgRHS>>> + operator || (MatcherLHS const& lhs, MatcherBase<ArgRHS> const& rhs) { + return { lhs, rhs }; + } + + template<typename ArgLHS, typename MatcherRHS> + std::enable_if_t<Detail::is_generic_matcher<MatcherRHS>::value, Detail::MatchAnyOfGeneric<MatcherBase<ArgLHS>, MatcherRHS>> + operator || (MatcherBase<ArgLHS> const& lhs, MatcherRHS const& rhs) { + return { lhs, rhs }; + } + +} // namespace Matchers +} // namespace Catch + +#endif // CATCH_MATCHERS_TEMPLATED_HPP_INCLUDED + +namespace Catch { + namespace Matchers { + + class IsEmptyMatcher final : public MatcherGenericBase { + public: + // todo: Use polyfills + template <typename RangeLike> + bool match(RangeLike&& rng) const { +#if defined(CATCH_CONFIG_POLYFILL_NONMEMBER_CONTAINER_ACCESS) + using Catch::Detail::empty; +#else + using std::empty; +#endif + return empty(rng); + } + + std::string describe() const override; + }; + + class HasSizeMatcher final : public MatcherGenericBase { + std::size_t m_target_size; + public: + explicit HasSizeMatcher(std::size_t target_size): + m_target_size(target_size) + {} + + template <typename RangeLike> + bool match(RangeLike&& rng) const { +#if defined(CATCH_CONFIG_POLYFILL_NONMEMBER_CONTAINER_ACCESS) + using Catch::Detail::size; +#else + using std::size; +#endif + return size(rng) == m_target_size; + } + + std::string describe() const override; + }; + + template <typename Matcher> + class SizeMatchesMatcher final : public MatcherGenericBase { + Matcher m_matcher; + public: + explicit SizeMatchesMatcher(Matcher m): + m_matcher(std::move(m)) + {} + + template <typename RangeLike> + bool match(RangeLike&& rng) const { +#if defined(CATCH_CONFIG_POLYFILL_NONMEMBER_CONTAINER_ACCESS) + using Catch::Detail::size; +#else + using std::size; +#endif + return m_matcher.match(size(rng)); + } + + std::string describe() const override { + return "size matches " + m_matcher.describe(); + } + }; + + + //! Creates a matcher that accepts empty ranges/containers + IsEmptyMatcher IsEmpty(); + //! Creates a matcher that accepts ranges/containers with specific size + HasSizeMatcher SizeIs(std::size_t sz); + template <typename Matcher> + std::enable_if_t<Detail::is_matcher<Matcher>::value, + SizeMatchesMatcher<Matcher>> SizeIs(Matcher&& m) { + return SizeMatchesMatcher<Matcher>{std::forward<Matcher>(m)}; + } + + } // end namespace Matchers +} // end namespace Catch + +#endif // CATCH_MATCHERS_CONTAINER_PROPERTIES_HPP_INCLUDED + + +#ifndef CATCH_MATCHERS_CONTAINS_HPP_INCLUDED +#define CATCH_MATCHERS_CONTAINS_HPP_INCLUDED + + +#include <algorithm> +#include <functional> +#include <utility> + +namespace Catch { + namespace Matchers { + //! Matcher for checking that an element in range is equal to specific element + template <typename T, typename Equality> + class ContainsElementMatcher final : public MatcherGenericBase { + T m_desired; + Equality m_eq; + public: + template <typename T2, typename Equality2> + ContainsElementMatcher(T2&& target, Equality2&& predicate): + m_desired(std::forward<T2>(target)), + m_eq(std::forward<Equality2>(predicate)) + {} + + std::string describe() const override { + return "contains element " + Catch::Detail::stringify(m_desired); + } + + template <typename RangeLike> + bool match(RangeLike&& rng) const { + using std::begin; using std::end; + + return end(rng) != std::find_if(begin(rng), end(rng), + [&](auto const& elem) { + return m_eq(elem, m_desired); + }); + } + }; + + //! Meta-matcher for checking that an element in a range matches a specific matcher + template <typename Matcher> + class ContainsMatcherMatcher final : public MatcherGenericBase { + Matcher m_matcher; + public: + // Note that we do a copy+move to avoid having to SFINAE this + // constructor (and also avoid some perfect forwarding failure + // cases) + ContainsMatcherMatcher(Matcher matcher): + m_matcher(std::move(matcher)) + {} + + template <typename RangeLike> + bool match(RangeLike&& rng) const { + using std::begin; using std::endl; + for (auto&& elem : rng) { + if (m_matcher.match(elem)) { + return true; + } + } + return false; + } + + std::string describe() const override { + return "contains element matching " + m_matcher.describe(); + } + }; + + /** + * Creates a matcher that checks whether a range contains a specific element. + * + * Uses `std::equal_to` to do the comparison + */ + template <typename T> + std::enable_if_t<!Detail::is_matcher<T>::value, + ContainsElementMatcher<T, std::equal_to<>>> Contains(T&& elem) { + return { std::forward<T>(elem), std::equal_to<>{} }; + } + + //! Creates a matcher that checks whether a range contains element matching a matcher + template <typename Matcher> + std::enable_if_t<Detail::is_matcher<Matcher>::value, + ContainsMatcherMatcher<Matcher>> Contains(Matcher&& matcher) { + return { std::forward<Matcher>(matcher) }; + } + + /** + * Creates a matcher that checks whether a range contains a specific element. + * + * Uses `eq` to do the comparisons + */ + template <typename T, typename Equality> + ContainsElementMatcher<T, Equality> Contains(T&& elem, Equality&& eq) { + return { std::forward<T>(elem), std::forward<Equality>(eq) }; + } + + } +} + +#endif // CATCH_MATCHERS_CONTAINS_HPP_INCLUDED + + +#ifndef CATCH_MATCHERS_EXCEPTION_HPP_INCLUDED +#define CATCH_MATCHERS_EXCEPTION_HPP_INCLUDED + + +namespace Catch { +namespace Matchers { + +class ExceptionMessageMatcher final : public MatcherBase<std::exception> { + std::string m_message; +public: + + ExceptionMessageMatcher(std::string const& message): + m_message(message) + {} + + bool match(std::exception const& ex) const override; + + std::string describe() const override; +}; + +//! Creates a matcher that checks whether a std derived exception has the provided message +ExceptionMessageMatcher Message(std::string const& message); + +} // namespace Matchers +} // namespace Catch + +#endif // CATCH_MATCHERS_EXCEPTION_HPP_INCLUDED + + +#ifndef CATCH_MATCHERS_FLOATING_HPP_INCLUDED +#define CATCH_MATCHERS_FLOATING_HPP_INCLUDED + + +namespace Catch { +namespace Matchers { + + namespace Detail { + enum class FloatingPointKind : uint8_t; + } + + struct WithinAbsMatcher final : 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 final : MatcherBase<double> { + WithinUlpsMatcher(double target, uint64_t ulps, Detail::FloatingPointKind baseType); + bool match(double const& matchee) const override; + std::string describe() const override; + private: + double m_target; + uint64_t m_ulps; + Detail::FloatingPointKind m_type; + }; + + // Given IEEE-754 format for floats and doubles, we can assume + // that float -> double promotion is lossless. Given this, we can + // assume that if we do the standard relative comparison of + // |lhs - rhs| <= epsilon * max(fabs(lhs), fabs(rhs)), then we get + // the same result if we do this for floats, as if we do this for + // doubles that were promoted from floats. + struct WithinRelMatcher final : MatcherBase<double> { + WithinRelMatcher(double target, double epsilon); + bool match(double const& matchee) const override; + std::string describe() const override; + private: + double m_target; + double m_epsilon; + }; + + //! Creates a matcher that accepts doubles within certain ULP range of target + WithinUlpsMatcher WithinULP(double target, uint64_t maxUlpDiff); + //! Creates a matcher that accepts floats within certain ULP range of target + WithinUlpsMatcher WithinULP(float target, uint64_t maxUlpDiff); + //! Creates a matcher that accepts numbers within certain range of target + WithinAbsMatcher WithinAbs(double target, double margin); + + //! Creates a matcher that accepts doubles within certain relative range of target + WithinRelMatcher WithinRel(double target, double eps); + //! Creates a matcher that accepts doubles within 100*DBL_EPS relative range of target + WithinRelMatcher WithinRel(double target); + //! Creates a matcher that accepts doubles within certain relative range of target + WithinRelMatcher WithinRel(float target, float eps); + //! Creates a matcher that accepts floats within 100*FLT_EPS relative range of target + WithinRelMatcher WithinRel(float target); + +} // namespace Matchers +} // namespace Catch + +#endif // CATCH_MATCHERS_FLOATING_HPP_INCLUDED + + +#ifndef CATCH_MATCHERS_PREDICATE_HPP_INCLUDED +#define CATCH_MATCHERS_PREDICATE_HPP_INCLUDED + + +#include <string> +#include <utility> + +namespace Catch { +namespace Matchers { + +namespace Detail { + std::string finalizeDescription(const std::string& desc); +} // namespace Detail + +template <typename T, typename Predicate> +class PredicateMatcher final : public MatcherBase<T> { + Predicate m_predicate; + std::string m_description; +public: + + PredicateMatcher(Predicate&& elem, std::string const& descr) + :m_predicate(std::forward<Predicate>(elem)), + m_description(Detail::finalizeDescription(descr)) + {} + + bool match( T const& item ) const override { + return m_predicate(item); + } + + std::string describe() const override { + return m_description; + } +}; + + /** + * Creates a matcher that calls delegates `match` to the provided predicate. + * + * The user has to explicitly specify the argument type to the matcher + */ + template<typename T, typename Pred> + PredicateMatcher<T, Pred> Predicate(Pred&& predicate, std::string const& description = "") { + static_assert(is_callable<Pred(T)>::value, "Predicate not callable with argument T"); + static_assert(std::is_same<bool, FunctionReturnType<Pred, T>>::value, "Predicate does not return bool"); + return PredicateMatcher<T, Pred>(std::forward<Pred>(predicate), description); + } + +} // namespace Matchers +} // namespace Catch + +#endif // CATCH_MATCHERS_PREDICATE_HPP_INCLUDED + + +#ifndef CATCH_MATCHERS_STRING_HPP_INCLUDED +#define CATCH_MATCHERS_STRING_HPP_INCLUDED + + +#include <string> + +namespace Catch { +namespace Matchers { + + struct CasedString { + CasedString( std::string const& str, CaseSensitive caseSensitivity ); + std::string adjustString( std::string const& str ) const; + StringRef caseSensitivitySuffix() const; + + CaseSensitive 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 StringEqualsMatcher final : StringMatcherBase { + StringEqualsMatcher( CasedString const& comparator ); + bool match( std::string const& source ) const override; + }; + struct StringContainsMatcher final : StringMatcherBase { + StringContainsMatcher( CasedString const& comparator ); + bool match( std::string const& source ) const override; + }; + struct StartsWithMatcher final : StringMatcherBase { + StartsWithMatcher( CasedString const& comparator ); + bool match( std::string const& source ) const override; + }; + struct EndsWithMatcher final : StringMatcherBase { + EndsWithMatcher( CasedString const& comparator ); + bool match( std::string const& source ) const override; + }; + + struct RegexMatcher final : MatcherBase<std::string> { + RegexMatcher( std::string regex, CaseSensitive caseSensitivity ); + bool match( std::string const& matchee ) const override; + std::string describe() const override; + + private: + std::string m_regex; + CaseSensitive m_caseSensitivity; + }; + + //! Creates matcher that accepts strings that are exactly equal to `str` + StringEqualsMatcher Equals( std::string const& str, CaseSensitive caseSensitivity = CaseSensitive::Yes ); + //! Creates matcher that accepts strings that contain `str` + StringContainsMatcher Contains( std::string const& str, CaseSensitive caseSensitivity = CaseSensitive::Yes ); + //! Creates matcher that accepts strings that _end_ with `str` + EndsWithMatcher EndsWith( std::string const& str, CaseSensitive caseSensitivity = CaseSensitive::Yes ); + //! Creates matcher that accepts strings that _start_ with `str` + StartsWithMatcher StartsWith( std::string const& str, CaseSensitive caseSensitivity = CaseSensitive::Yes ); + //! Creates matcher that accepts strings matching `regex` + RegexMatcher Matches( std::string const& regex, CaseSensitive caseSensitivity = CaseSensitive::Yes ); + +} // namespace Matchers +} // namespace Catch + +#endif // CATCH_MATCHERS_STRING_HPP_INCLUDED + + +#ifndef CATCH_MATCHERS_VECTOR_HPP_INCLUDED +#define CATCH_MATCHERS_VECTOR_HPP_INCLUDED + + +#include <algorithm> + +namespace Catch { +namespace Matchers { + + template<typename T, typename Alloc> + struct VectorContainsElementMatcher final : MatcherBase<std::vector<T, Alloc>> { + + VectorContainsElementMatcher(T const& comparator): + m_comparator(comparator) + {} + + bool match(std::vector<T, Alloc> 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, typename AllocComp, typename AllocMatch> + struct ContainsMatcher final : MatcherBase<std::vector<T, AllocMatch>> { + + ContainsMatcher(std::vector<T, AllocComp> const& comparator): + m_comparator( comparator ) + {} + + bool match(std::vector<T, AllocMatch> 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, AllocComp> const& m_comparator; + }; + + template<typename T, typename AllocComp, typename AllocMatch> + struct EqualsMatcher final : MatcherBase<std::vector<T, AllocMatch>> { + + EqualsMatcher(std::vector<T, AllocComp> const& comparator): + m_comparator( comparator ) + {} + + bool match(std::vector<T, AllocMatch> 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, AllocComp> const& m_comparator; + }; + + template<typename T, typename AllocComp, typename AllocMatch> + struct ApproxMatcher final : MatcherBase<std::vector<T, AllocMatch>> { + + ApproxMatcher(std::vector<T, AllocComp> const& comparator): + m_comparator( comparator ) + {} + + bool match(std::vector<T, AllocMatch> const& v) const override { + if (m_comparator.size() != v.size()) + return false; + for (std::size_t i = 0; i < v.size(); ++i) + if (m_comparator[i] != approx(v[i])) + return false; + return true; + } + std::string describe() const override { + return "is approx: " + ::Catch::Detail::stringify( m_comparator ); + } + template <typename = std::enable_if_t<std::is_constructible<double, T>::value>> + ApproxMatcher& epsilon( T const& newEpsilon ) { + approx.epsilon(static_cast<double>(newEpsilon)); + return *this; + } + template <typename = std::enable_if_t<std::is_constructible<double, T>::value>> + ApproxMatcher& margin( T const& newMargin ) { + approx.margin(static_cast<double>(newMargin)); + return *this; + } + template <typename = std::enable_if_t<std::is_constructible<double, T>::value>> + ApproxMatcher& scale( T const& newScale ) { + approx.scale(static_cast<double>(newScale)); + return *this; + } + + std::vector<T, AllocComp> const& m_comparator; + mutable Catch::Approx approx = Catch::Approx::custom(); + }; + + template<typename T, typename AllocComp, typename AllocMatch> + struct UnorderedEqualsMatcher final : MatcherBase<std::vector<T, AllocMatch>> { + UnorderedEqualsMatcher(std::vector<T, AllocComp> const& target): + m_target(target) + {} + bool match(std::vector<T, AllocMatch> const& vec) const override { + if (m_target.size() != vec.size()) { + return false; + } + return std::is_permutation(m_target.begin(), m_target.end(), vec.begin()); + } + + std::string describe() const override { + return "UnorderedEquals: " + ::Catch::Detail::stringify(m_target); + } + private: + std::vector<T, AllocComp> const& m_target; + }; + + + // The following functions create the actual matcher objects. + // This allows the types to be inferred + + + //! Creates a matcher that matches vectors that contain all elements in `comparator` + template<typename T, typename AllocComp = std::allocator<T>, typename AllocMatch = AllocComp> + ContainsMatcher<T, AllocComp, AllocMatch> Contains( std::vector<T, AllocComp> const& comparator ) { + return ContainsMatcher<T, AllocComp, AllocMatch>(comparator); + } + + //! Creates a matcher that matches vectors that contain `comparator` as an element + template<typename T, typename Alloc = std::allocator<T>> + VectorContainsElementMatcher<T, Alloc> VectorContains( T const& comparator ) { + return VectorContainsElementMatcher<T, Alloc>(comparator); + } + + //! Creates a matcher that matches vectors that are exactly equal to `comparator` + template<typename T, typename AllocComp = std::allocator<T>, typename AllocMatch = AllocComp> + EqualsMatcher<T, AllocComp, AllocMatch> Equals( std::vector<T, AllocComp> const& comparator ) { + return EqualsMatcher<T, AllocComp, AllocMatch>(comparator); + } + + //! Creates a matcher that matches vectors that `comparator` as an element + template<typename T, typename AllocComp = std::allocator<T>, typename AllocMatch = AllocComp> + ApproxMatcher<T, AllocComp, AllocMatch> Approx( std::vector<T, AllocComp> const& comparator ) { + return ApproxMatcher<T, AllocComp, AllocMatch>(comparator); + } + + //! Creates a matcher that matches vectors that is equal to `target` modulo permutation + template<typename T, typename AllocComp = std::allocator<T>, typename AllocMatch = AllocComp> + UnorderedEqualsMatcher<T, AllocComp, AllocMatch> UnorderedEquals(std::vector<T, AllocComp> const& target) { + return UnorderedEqualsMatcher<T, AllocComp, AllocMatch>(target); + } + +} // namespace Matchers +} // namespace Catch + +#endif // CATCH_MATCHERS_VECTOR_HPP_INCLUDED + +#endif // CATCH_MATCHERS_ALL_HPP_INCLUDED + + +/** \file + * This is a convenience header for Catch2's Reporter support. It includes + * **all** of Catch2 headers related to reporters, including all reporters. + * + * Generally the Catch2 users should use specific includes they need, + * but this header can be used instead for ease-of-experimentation, or + * just plain convenience, at the cost of (significantly) increased + * compilation times. + * + * When a new header (reporter) is added to either the `reporter` folder, + * or to the corresponding internal subfolder, it should be added here. + */ + +#ifndef CATCH_REPORTERS_ALL_HPP_INCLUDED +#define CATCH_REPORTERS_ALL_HPP_INCLUDED + + + +#ifndef CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED +#define CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED + + + +#ifndef CATCH_REPORTER_STREAMING_BASE_HPP_INCLUDED +#define CATCH_REPORTER_STREAMING_BASE_HPP_INCLUDED + + + +#include <iosfwd> +#include <string> +#include <vector> + +namespace Catch { + + 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 StreamingReporterBase : IStreamingReporter { + + StreamingReporterBase( ReporterConfig const& _config ): + m_config( _config.fullConfig() ), stream( _config.stream() ) { + } + + + ~StreamingReporterBase() override; + + void noMatchingTestCases(std::string const&) override {} + + void reportInvalidArguments(std::string const&) override {} + + void testRunStarting( TestRunInfo const& _testRunInfo ) override; + + void testGroupStarting( GroupInfo const& _groupInfo ) override; + + 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 = nullptr; + } + void testGroupEnded( TestGroupStats const& ) override; + void testRunEnded( TestRunStats const& /* _testRunStats */ ) override; + + void skipTest(TestCaseInfo const&) override { + // Don't do anything with this by default. + // It can optionally be overridden in the derived class. + } + + IConfig const* m_config; + std::ostream& stream; + + LazyStat<TestRunInfo> currentTestRunInfo; + LazyStat<GroupInfo> currentGroupInfo; + TestCaseInfo const* currentTestCaseInfo = nullptr; + + std::vector<SectionInfo> m_sectionStack; + }; + +} // end namespace Catch + +#endif // CATCH_REPORTER_STREAMING_BASE_HPP_INCLUDED + +namespace Catch { + + struct AutomakeReporter : StreamingReporterBase { + AutomakeReporter( ReporterConfig const& _config ) + : StreamingReporterBase( _config ) + {} + + ~AutomakeReporter() override; + + static std::string getDescription() { + using namespace std::string_literals; + return "Reports test results in the format of Automake .trs files"s; + } + + void assertionStarting( AssertionInfo const& ) override {} + + bool assertionEnded( AssertionStats const& /*_assertionStats*/ ) override { return true; } + + void testCaseEnded(TestCaseStats const& _testCaseStats) override; + + void skipTest(TestCaseInfo const& testInfo) override; + + }; + +} // end namespace Catch + +#endif // CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED + + +#ifndef CATCH_REPORTER_COMPACT_HPP_INCLUDED +#define CATCH_REPORTER_COMPACT_HPP_INCLUDED + + + + +namespace Catch { + + struct CompactReporter : StreamingReporterBase { + + using StreamingReporterBase::StreamingReporterBase; + + ~CompactReporter() override; + + static std::string getDescription(); + + 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 // CATCH_REPORTER_COMPACT_HPP_INCLUDED + + +#ifndef CATCH_REPORTER_CONSOLE_HPP_INCLUDED +#define CATCH_REPORTER_CONSOLE_HPP_INCLUDED + + +#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 { + Detail::unique_ptr<TablePrinter> m_tablePrinter; + + ConsoleReporter(ReporterConfig const& config); + ~ConsoleReporter() override; + static std::string getDescription(); + + void noMatchingTestCases(std::string const& spec) override; + + void reportInvalidArguments(std::string const&arg) 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 benchmarkPreparing(std::string const& name) override; + void benchmarkStarting(BenchmarkInfo const& info) override; + void benchmarkEnded(BenchmarkStats<> const& stats) override; + void benchmarkFailed(std::string const& error) override; + + void testCaseEnded(TestCaseStats const& _testCaseStats) override; + void testGroupEnded(TestGroupStats const& _testGroupStats) override; + void testRunEnded(TestRunStats const& _testRunStats) override; + void testRunStarting(TestRunInfo const& _testRunInfo) 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(); + void printTestFilters(); + + private: + bool m_headerPrinted = false; + }; + +} // end namespace Catch + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif + +#endif // CATCH_REPORTER_CONSOLE_HPP_INCLUDED + + +#ifndef CATCH_REPORTER_CUMULATIVE_BASE_HPP_INCLUDED +#define CATCH_REPORTER_CUMULATIVE_BASE_HPP_INCLUDED + + +#include <iosfwd> +#include <memory> +#include <string> +#include <vector> + +namespace Catch { + + 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) {} + + bool operator == (SectionNode const& other) const { + return stats.sectionInfo.lineInfo == other.stats.sectionInfo.lineInfo; + } + + 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; + }; + + + 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() ) {} + ~CumulativeReporterBase() override; + + void testRunStarting( TestRunInfo const& ) override {} + void testGroupStarting( GroupInfo const& ) override {} + + void testCaseStarting( TestCaseInfo const& ) 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; + virtual void testRunEndedCumulative() = 0; + + void skipTest(TestCaseInfo const&) override {} + + IConfig const* 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; + }; + +} // end namespace Catch + +#endif // CATCH_REPORTER_CUMULATIVE_BASE_HPP_INCLUDED + + +#ifndef CATCH_REPORTER_EVENT_LISTENER_HPP_INCLUDED +#define CATCH_REPORTER_EVENT_LISTENER_HPP_INCLUDED + + +namespace Catch { + + /** + * Base class identifying listeners. + * + * Provides default implementation for all IStreamingReporter member + * functions, so that listeners implementations can pick which + * member functions it actually cares about. + */ + class EventListenerBase : public IStreamingReporter { + IConfig const* m_config; + + public: + EventListenerBase( ReporterConfig const& config ): + m_config( config.fullConfig() ) {} + + void assertionStarting( AssertionInfo const& assertionInfo ) override; + bool assertionEnded( AssertionStats const& assertionStats ) override; + + void + listReporters( std::vector<ReporterDescription> const& descriptions, + IConfig const& config ) override; + void listTests( std::vector<TestCaseHandle> const& tests, + IConfig const& config ) override; + void listTags( std::vector<TagInfo> const& tagInfos, + IConfig const& config ) override; + + void noMatchingTestCases( std::string const& spec ) 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 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; + }; + +} // end namespace Catch + +#endif // CATCH_REPORTER_EVENT_LISTENER_HPP_INCLUDED + + +#ifndef CATCH_REPORTER_HELPERS_HPP_INCLUDED +#define CATCH_REPORTER_HELPERS_HPP_INCLUDED + +#include <iosfwd> +#include <string> +#include <vector> + +namespace Catch { + + struct IConfig; + + // Returns double formatted as %.3f (format expected on output) + std::string getFormattedDuration( double duration ); + + //! Should the reporter show duration of test given current configuration? + bool shouldShowDuration( IConfig const& config, double duration ); + + std::string serializeFilters( std::vector<std::string> const& filters ); + + struct lineOfChars { + char c; + constexpr lineOfChars( char c_ ): c( c_ ) {} + + friend std::ostream& operator<<( std::ostream& out, lineOfChars value ); + }; + +} // end namespace Catch + +#endif // CATCH_REPORTER_HELPERS_HPP_INCLUDED + + +#ifndef CATCH_REPORTER_JUNIT_HPP_INCLUDED +#define CATCH_REPORTER_JUNIT_HPP_INCLUDED + + + +namespace Catch { + + class JunitReporter : public CumulativeReporterBase { + 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 // CATCH_REPORTER_JUNIT_HPP_INCLUDED + + +#ifndef CATCH_REPORTER_LISTENING_HPP_INCLUDED +#define CATCH_REPORTER_LISTENING_HPP_INCLUDED + + +namespace Catch { + + class ListeningReporter final : public IStreamingReporter { + using Reporters = std::vector<IStreamingReporterPtr>; + Reporters m_listeners; + IStreamingReporterPtr m_reporter = nullptr; + + public: + ListeningReporter(); + + void addListener( IStreamingReporterPtr&& listener ); + void addReporter( IStreamingReporterPtr&& reporter ); + + public: // IStreamingReporter + + void noMatchingTestCases( std::string const& spec ) override; + + void reportInvalidArguments(std::string const&arg) override; + + void benchmarkPreparing(std::string const& name) override; + void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override; + void benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) override; + void benchmarkFailed(std::string const&) 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; + + void listReporters(std::vector<ReporterDescription> const& descriptions, IConfig const& config) override; + void listTests(std::vector<TestCaseHandle> const& tests, IConfig const& config) override; + void listTags(std::vector<TagInfo> const& tags, IConfig const& config) override; + + + }; + +} // end namespace Catch + +#endif // CATCH_REPORTER_LISTENING_HPP_INCLUDED + + +#ifndef CATCH_REPORTER_SONARQUBE_HPP_INCLUDED +#define CATCH_REPORTER_SONARQUBE_HPP_INCLUDED + + + +namespace Catch { + + struct SonarQubeReporter : CumulativeReporterBase { + + SonarQubeReporter(ReporterConfig const& config) + : CumulativeReporterBase(config) + , xml(config.stream()) { + m_preferences.shouldRedirectStdOut = true; + m_preferences.shouldReportAllAssertions = true; + } + + ~SonarQubeReporter() override; + + static std::string getDescription() { + using namespace std::string_literals; + return "Reports test results in the Generic Test Data SonarQube XML format"s; + } + + void noMatchingTestCases(std::string const& /*spec*/) override {} + + void testRunStarting(TestRunInfo const& testRunInfo) override; + + void testGroupEnded(TestGroupStats const& testGroupStats) override; + + void testRunEndedCumulative() override { + xml.endElement(); + } + + void writeGroup(TestGroupNode const& groupNode); + + void writeTestFile(std::string const& filename, TestGroupNode::ChildNodes const& testCaseNodes); + + void writeTestCase(TestCaseNode const& testCaseNode); + + void writeSection(std::string const& rootName, SectionNode const& sectionNode, bool okToFail); + + void writeAssertions(SectionNode const& sectionNode, bool okToFail); + + void writeAssertion(AssertionStats const& stats, bool okToFail); + + private: + XmlWriter xml; + }; + + +} // end namespace Catch + +#endif // CATCH_REPORTER_SONARQUBE_HPP_INCLUDED + + +#ifndef CATCH_REPORTER_TAP_HPP_INCLUDED +#define CATCH_REPORTER_TAP_HPP_INCLUDED + + +namespace Catch { + + struct TAPReporter : StreamingReporterBase { + + TAPReporter( ReporterConfig const& config ): + StreamingReporterBase( config ) { + m_preferences.shouldReportAllAssertions = true; + } + ~TAPReporter() override; + + static std::string getDescription() { + using namespace std::string_literals; + return "Reports test results in TAP format, suitable for test harnesses"s; + } + + void noMatchingTestCases(std::string const& spec) override; + + void assertionStarting( AssertionInfo const& ) override {} + + bool assertionEnded(AssertionStats const& _assertionStats) override; + + void testRunEnded(TestRunStats const& _testRunStats) override; + + private: + std::size_t counter = 0; + }; + +} // end namespace Catch + +#endif // CATCH_REPORTER_TAP_HPP_INCLUDED + + +#ifndef CATCH_REPORTER_TEAMCITY_HPP_INCLUDED +#define CATCH_REPORTER_TEAMCITY_HPP_INCLUDED + + +#include <cstring> + +#ifdef __clang__ +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wpadded" +#endif + +namespace Catch { + + struct TeamCityReporter : StreamingReporterBase { + TeamCityReporter( ReporterConfig const& _config ) + : StreamingReporterBase( _config ) + { + m_preferences.shouldRedirectStdOut = true; + } + + ~TeamCityReporter() override; + + static std::string getDescription() { + using namespace std::string_literals; + return "Reports test results as TeamCity service messages"s; + } + + void skipTest( TestCaseInfo const& /* testInfo */ ) override {} + + void noMatchingTestCases( std::string const& /* spec */ ) override {} + + void testGroupStarting(GroupInfo const& groupInfo) override; + void testGroupEnded(TestGroupStats const& testGroupStats) override; + + + void assertionStarting(AssertionInfo const&) override {} + + bool assertionEnded(AssertionStats const& assertionStats) override; + + void sectionStarting(SectionInfo const& sectionInfo) override { + m_headerPrintedForThisSection = false; + StreamingReporterBase::sectionStarting( sectionInfo ); + } + + void testCaseStarting(TestCaseInfo const& testInfo) override; + + void testCaseEnded(TestCaseStats const& testCaseStats) override; + + private: + void printSectionHeader(std::ostream& os); + + private: + bool m_headerPrintedForThisSection = false; + Timer m_testTimer; + }; + +} // end namespace Catch + +#ifdef __clang__ +# pragma clang diagnostic pop +#endif + +#endif // CATCH_REPORTER_TEAMCITY_HPP_INCLUDED + + +#ifndef CATCH_REPORTER_XML_HPP_INCLUDED +#define CATCH_REPORTER_XML_HPP_INCLUDED + + + + +namespace Catch { + class XmlReporter : public StreamingReporterBase { + 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; + + void benchmarkPreparing(std::string const& name) override; + void benchmarkStarting(BenchmarkInfo const&) override; + void benchmarkEnded(BenchmarkStats<> const&) override; + void benchmarkFailed(std::string const&) override; + + void listReporters(std::vector<ReporterDescription> const& descriptions, IConfig const& config) override; + void listTests(std::vector<TestCaseHandle> const& tests, IConfig const& config) override; + void listTags(std::vector<TagInfo> const& tags, IConfig const& config) override; + + private: + Timer m_testCaseTimer; + XmlWriter m_xml; + int m_sectionDepth = 0; + }; + +} // end namespace Catch + +#endif // CATCH_REPORTER_XML_HPP_INCLUDED + +#endif // CATCH_REPORTERS_ALL_HPP_INCLUDED + +#endif // CATCH_ALL_HPP_INCLUDED +#endif // CATCH_AMALGAMATED_HPP_INCLUDED diff --git a/packages/Catch2/extras/gdbinit b/packages/Catch2/extras/gdbinit new file mode 100644 index 0000000000000000000000000000000000000000..fb3608aebafc2e07cea24510cf00eb8c8fb611f2 --- /dev/null +++ b/packages/Catch2/extras/gdbinit @@ -0,0 +1,16 @@ +# +# This file provides a way to skip stepping into Catch code when debugging with gdb. +# +# With the gdb "skip" command you can tell gdb to skip files or functions during debugging. +# see https://xaizek.github.io/2016-05-26/skipping-standard-library-in-gdb/ for an example +# +# Basically the following line tells gdb to skip all functions containing the +# regexp "Catch", which matches the complete Catch namespace. +# If you want to skip just some parts of the Catch code you can modify the +# regexp accordingly. +# +# If you want to permanently skip stepping into Catch code copy the following +# line into your ~/.gdbinit file +# + +skip -rfu Catch diff --git a/packages/Catch2/extras/lldbinit b/packages/Catch2/extras/lldbinit new file mode 100644 index 0000000000000000000000000000000000000000..4f13634d0b483e69df9fcd6a35ba166aca971c80 --- /dev/null +++ b/packages/Catch2/extras/lldbinit @@ -0,0 +1,16 @@ +# +# This file provides a way to skip stepping into Catch code when debugging with lldb. +# +# With the setting "target.process.thread.step-avoid-regexp" you can tell lldb +# to skip functions matching the regexp +# +# Basically the following line tells lldb to skip all functions containing the +# regexp "Catch", which matches the complete Catch namespace. +# If you want to skip just some parts of the Catch code you can modify the +# regexp accordingly. +# +# If you want to permanently skip stepping into Catch code copy the following +# line into your ~/.lldbinit file +# + +settings set target.process.thread.step-avoid-regexp Catch \ No newline at end of file diff --git a/packages/Catch2/fuzzing/CMakeLists.txt b/packages/Catch2/fuzzing/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..daba61df85f13f1e08965df32c31db4fcc8ca2ca --- /dev/null +++ b/packages/Catch2/fuzzing/CMakeLists.txt @@ -0,0 +1,20 @@ +# License: Boost 1.0 +# By Paul Dreik 2020 + +# add a library that brings in the main() function from libfuzzer +# and has all the dependencies, so the individual fuzzers can be +# added one line each. +add_library(fuzzhelper NullOStream.h NullOStream.cpp) +target_link_libraries(fuzzhelper PUBLIC Catch2::Catch2) + +# use C++17 so we can get string_view +target_compile_features(fuzzhelper PUBLIC cxx_std_17) + +# This should be possible to set from the outside to be oss-fuzz compatible, +# fix later. For now, target libFuzzer only. +target_link_options(fuzzhelper PUBLIC "-fsanitize=fuzzer") + +foreach(fuzzer TestSpecParser XmlWriter textflow) +add_executable(fuzz_${fuzzer} fuzz_${fuzzer}.cpp) +target_link_libraries(fuzz_${fuzzer} PRIVATE fuzzhelper) +endforeach() diff --git a/packages/Catch2/fuzzing/NullOStream.cpp b/packages/Catch2/fuzzing/NullOStream.cpp new file mode 100644 index 0000000000000000000000000000000000000000..53e0893dcc915922614f1665c89a64a449fc841e --- /dev/null +++ b/packages/Catch2/fuzzing/NullOStream.cpp @@ -0,0 +1,10 @@ +#include "NullOStream.h" + +void NullOStream::avoidOutOfLineVirtualCompilerWarning() +{ +} + +int NullStreambuf::overflow(int c){ + setp(dummyBuffer, dummyBuffer + sizeof(dummyBuffer)); + return (c == traits_type::eof()) ? '\0' : c; +} diff --git a/packages/Catch2/fuzzing/NullOStream.h b/packages/Catch2/fuzzing/NullOStream.h new file mode 100644 index 0000000000000000000000000000000000000000..e1fe15b088733ba1dd455a64bada004b22bf6321 --- /dev/null +++ b/packages/Catch2/fuzzing/NullOStream.h @@ -0,0 +1,20 @@ +#pragma once + +#include <ostream> +#include <streambuf> + +// from https://stackoverflow.com/a/8244052 +class NullStreambuf : public std::streambuf { + char dummyBuffer[64]; + +protected: + virtual int overflow(int c) override final; +}; + +class NullOStream final : private NullStreambuf, public std::ostream { +public: + NullOStream() : std::ostream(this) {} + NullStreambuf *rdbuf() { return this; } + virtual void avoidOutOfLineVirtualCompilerWarning(); +}; + diff --git a/packages/Catch2/fuzzing/build_fuzzers.sh b/packages/Catch2/fuzzing/build_fuzzers.sh new file mode 100755 index 0000000000000000000000000000000000000000..9788c68c5f31b6fd8de6b26754ef556b31c76510 --- /dev/null +++ b/packages/Catch2/fuzzing/build_fuzzers.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# +# Builds the fuzzers +# +# By Paul Dreik 20200923 +set -exu + +CATCHROOT=$(readlink -f $(dirname $0)/..) + + +BUILDDIR=$CATCHROOT/build-fuzzers +mkdir -p $BUILDDIR +cd $BUILDDIR + +if which /usr/lib/ccache/clang++ >/dev/null 2>&1 ; then + CXX=/usr/lib/ccache/clang++ +else + CXX=clang++ +fi + +cmake $CATCHROOT \ + -DCMAKE_CXX_COMPILER=$CXX \ + -DCMAKE_CXX_FLAGS="-fsanitize=fuzzer-no-link,address,undefined -O3 -g" \ + -DCATCH_DEVELOPMENT_BUILD=On \ + -DCATCH_BUILD_EXAMPLES=Off \ + -DCATCH_BUILD_EXTRA_TESTS=Off \ + -DCATCH_BUILD_TESTING=Off \ + -DBUILD_TESTING=Off \ + -DCATCH_ENABLE_WERROR=Off \ + -DCATCH_BUILD_FUZZERS=On + +cmake --build . -j $(nproc) + diff --git a/packages/Catch2/fuzzing/fuzz_TestSpecParser.cpp b/packages/Catch2/fuzzing/fuzz_TestSpecParser.cpp new file mode 100644 index 0000000000000000000000000000000000000000..af4de4062387da3e61a73cbb4a620c4dd4af9d8a --- /dev/null +++ b/packages/Catch2/fuzzing/fuzz_TestSpecParser.cpp @@ -0,0 +1,16 @@ +//License: Boost 1.0 +//By Paul Dreik 2020 + +#include <catch2/internal/catch_test_spec_parser.hpp> +#include <catch2/internal/catch_tag_alias_registry.hpp> + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { + + Catch::TagAliasRegistry tar; + Catch::TestSpecParser tsp(tar); + + std::string buf(Data,Data+Size); + tsp.parse(buf); + + return 0; +} diff --git a/packages/Catch2/fuzzing/fuzz_XmlWriter.cpp b/packages/Catch2/fuzzing/fuzz_XmlWriter.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f8e5a0d9a30b442bf02c3490c17eb7e0b7267f28 --- /dev/null +++ b/packages/Catch2/fuzzing/fuzz_XmlWriter.cpp @@ -0,0 +1,16 @@ +//License: Boost 1.0 +//By Paul Dreik 2020 + +#include <catch2/internal/catch_xmlwriter.hpp> + +#include "NullOStream.h" + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { + + std::string buf(Data,Data+Size); + NullOStream nul; + Catch::XmlEncode encode(buf); + encode.encodeTo(nul); + return 0; +} + diff --git a/packages/Catch2/fuzzing/fuzz_textflow.cpp b/packages/Catch2/fuzzing/fuzz_textflow.cpp new file mode 100644 index 0000000000000000000000000000000000000000..eafe79febf6163005fdf7312a3bffb9d50476b1e --- /dev/null +++ b/packages/Catch2/fuzzing/fuzz_textflow.cpp @@ -0,0 +1,47 @@ +//License: Boost 1.0 +//By Paul Dreik 2020 + +#include <catch2/internal/catch_textflow.hpp> + +#include "NullOStream.h" + +#include <string> +#include <string_view> + + +template<class Callback> +void split(const char *Data, size_t Size, Callback callback) { + + using namespace std::literals; + constexpr auto sep="\n~~~\n"sv; + + std::string_view remainder(Data,Size); + for (;;) { + auto pos=remainder.find(sep); + if(pos==std::string_view::npos) { + //not found. use the remainder and exit + callback(remainder); + return; + } else { + //found. invoke callback on the first part, then proceed with the rest. + callback(remainder.substr(0,pos)); + remainder=remainder.substr(pos+sep.size()); + } + } +} + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { + + Catch::TextFlow::Columns columns; + + // break the input on separator + split((const char*)Data,Size,[&](std::string_view word) { + columns+=Catch::TextFlow::Column(std::string(word)); + }); + + NullOStream nul; + nul << columns; + + return 0; +} + diff --git a/packages/Catch2/mdsnippets.json b/packages/Catch2/mdsnippets.json new file mode 100644 index 0000000000000000000000000000000000000000..5a60dadba98f0bf420c066fb0d0f69455138096e --- /dev/null +++ b/packages/Catch2/mdsnippets.json @@ -0,0 +1,9 @@ +{ + "ReadOnly": false, + "TocLevel": 5, + "Exclude": [ + "cmake-build" + ], + "WriteHeader": false, + "Convention": "InPlaceOverwrite" +} diff --git a/packages/Catch2/src/CMakeLists.txt b/packages/Catch2/src/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..f22236395c8468eba7ea842c21f31a20724d62e2 --- /dev/null +++ b/packages/Catch2/src/CMakeLists.txt @@ -0,0 +1,359 @@ +include(MiscFunctions) + +# Please keep these ordered alphabetically +set(BENCHMARK_HEADERS + ${SOURCES_DIR}/benchmark/catch_benchmark.hpp + ${SOURCES_DIR}/benchmark/catch_benchmark_all.hpp + ${SOURCES_DIR}/benchmark/catch_chronometer.hpp + ${SOURCES_DIR}/benchmark/catch_clock.hpp + ${SOURCES_DIR}/benchmark/catch_constructor.hpp + ${SOURCES_DIR}/benchmark/catch_environment.hpp + ${SOURCES_DIR}/benchmark/catch_estimate.hpp + ${SOURCES_DIR}/benchmark/catch_execution_plan.hpp + ${SOURCES_DIR}/benchmark/catch_optimizer.hpp + ${SOURCES_DIR}/benchmark/catch_outlier_classification.hpp + ${SOURCES_DIR}/benchmark/catch_sample_analysis.hpp + ${SOURCES_DIR}/benchmark/detail/catch_analyse.hpp + ${SOURCES_DIR}/benchmark/detail/catch_benchmark_function.hpp + ${SOURCES_DIR}/benchmark/detail/catch_complete_invoke.hpp + ${SOURCES_DIR}/benchmark/detail/catch_estimate_clock.hpp + ${SOURCES_DIR}/benchmark/detail/catch_measure.hpp + ${SOURCES_DIR}/benchmark/detail/catch_repeat.hpp + ${SOURCES_DIR}/benchmark/detail/catch_run_for_at_least.hpp + ${SOURCES_DIR}/benchmark/detail/catch_stats.hpp + ${SOURCES_DIR}/benchmark/detail/catch_timing.hpp +) +set(BENCHMARK_SOURCES + ${SOURCES_DIR}/benchmark/internal/catch_benchmark_combined_tu.cpp + ${SOURCES_DIR}/benchmark/detail/catch_stats.cpp +) + +SOURCE_GROUP("benchmark" FILES ${BENCHMARK_HEADERS} ${BENCHMARK_SOURCES}) + +set(INTERNAL_HEADERS + ${SOURCES_DIR}/catch_all.hpp + ${SOURCES_DIR}/matchers/catch_matchers_all.hpp + ${SOURCES_DIR}/generators/catch_generators_all.hpp + ${SOURCES_DIR}/interfaces/catch_interfaces_all.hpp + ${SOURCES_DIR}/matchers/internal/catch_matchers_impl.hpp + ${SOURCES_DIR}/internal/catch_console_width.hpp + ${SOURCES_DIR}/internal/catch_container_nonmembers.hpp + ${SOURCES_DIR}/internal/catch_noncopyable.hpp + ${SOURCES_DIR}/catch_approx.hpp + ${SOURCES_DIR}/internal/catch_assertion_handler.hpp + ${SOURCES_DIR}/catch_assertion_info.hpp + ${SOURCES_DIR}/catch_assertion_result.hpp + ${SOURCES_DIR}/internal/catch_test_macro_impl.hpp + ${SOURCES_DIR}/internal/catch_test_failure_exception.hpp + ${SOURCES_DIR}/internal/catch_case_sensitive.hpp + ${SOURCES_DIR}/internal/catch_clara.hpp + ${SOURCES_DIR}/internal/catch_commandline.hpp + ${SOURCES_DIR}/internal/catch_source_line_info.hpp + ${SOURCES_DIR}/internal/catch_compiler_capabilities.hpp + ${SOURCES_DIR}/catch_config.hpp + ${SOURCES_DIR}/internal/catch_config_android_logwrite.hpp + ${SOURCES_DIR}/internal/catch_config_counter.hpp + ${SOURCES_DIR}/internal/catch_config_uncaught_exceptions.hpp + ${SOURCES_DIR}/internal/catch_config_wchar.hpp + ${SOURCES_DIR}/internal/catch_console_colour.hpp + ${SOURCES_DIR}/internal/catch_context.hpp + ${SOURCES_DIR}/internal/catch_debug_console.hpp + ${SOURCES_DIR}/internal/catch_debugger.hpp + ${SOURCES_DIR}/internal/catch_decomposer.hpp + ${SOURCES_DIR}/internal/catch_enforce.hpp + ${SOURCES_DIR}/internal/catch_enum_values_registry.hpp + ${SOURCES_DIR}/internal/catch_errno_guard.hpp + ${SOURCES_DIR}/internal/catch_exception_translator_registry.hpp + ${SOURCES_DIR}/internal/catch_fatal_condition_handler.hpp + ${SOURCES_DIR}/generators/catch_generator_exception.hpp + ${SOURCES_DIR}/generators/catch_generators.hpp + ${SOURCES_DIR}/generators/catch_generators_adapters.hpp + ${SOURCES_DIR}/generators/catch_generators_random.hpp + ${SOURCES_DIR}/generators/catch_generators_range.hpp + ${SOURCES_DIR}/interfaces/catch_interfaces_capture.hpp + ${SOURCES_DIR}/interfaces/catch_interfaces_config.hpp + ${SOURCES_DIR}/interfaces/catch_interfaces_enum_values_registry.hpp + ${SOURCES_DIR}/interfaces/catch_interfaces_exception.hpp + ${SOURCES_DIR}/interfaces/catch_interfaces_generatortracker.hpp + ${SOURCES_DIR}/interfaces/catch_interfaces_registry_hub.hpp + ${SOURCES_DIR}/interfaces/catch_interfaces_reporter.hpp + ${SOURCES_DIR}/interfaces/catch_interfaces_reporter_factory.hpp + ${SOURCES_DIR}/interfaces/catch_interfaces_reporter_registry.hpp + ${SOURCES_DIR}/interfaces/catch_interfaces_runner.hpp + ${SOURCES_DIR}/interfaces/catch_interfaces_tag_alias_registry.hpp + ${SOURCES_DIR}/interfaces/catch_interfaces_testcase.hpp + ${SOURCES_DIR}/internal/catch_lazy_expr.hpp + ${SOURCES_DIR}/internal/catch_leak_detector.hpp + ${SOURCES_DIR}/internal/catch_list.hpp + ${SOURCES_DIR}/matchers/catch_matchers.hpp + ${SOURCES_DIR}/matchers/catch_matchers_container_properties.hpp + ${SOURCES_DIR}/matchers/catch_matchers_contains.hpp + ${SOURCES_DIR}/matchers/catch_matchers_exception.hpp + ${SOURCES_DIR}/matchers/catch_matchers_floating_point.hpp + ${SOURCES_DIR}/matchers/catch_matchers_predicate.hpp + ${SOURCES_DIR}/matchers/catch_matchers_quantifiers.hpp + ${SOURCES_DIR}/matchers/catch_matchers_string.hpp + ${SOURCES_DIR}/matchers/catch_matchers_templated.hpp + ${SOURCES_DIR}/matchers/catch_matchers_vector.hpp + ${SOURCES_DIR}/catch_message.hpp + ${SOURCES_DIR}/internal/catch_message_info.hpp + ${SOURCES_DIR}/internal/catch_meta.hpp + ${SOURCES_DIR}/internal/catch_option.hpp + ${SOURCES_DIR}/internal/catch_output_redirect.hpp + ${SOURCES_DIR}/internal/catch_platform.hpp + ${SOURCES_DIR}/internal/catch_polyfills.hpp + ${SOURCES_DIR}/internal/catch_preprocessor.hpp + ${SOURCES_DIR}/internal/catch_random_number_generator.hpp + ${SOURCES_DIR}/catch_reporter_registrars.hpp + ${SOURCES_DIR}/internal/catch_reporter_registry.hpp + ${SOURCES_DIR}/internal/catch_result_type.hpp + ${SOURCES_DIR}/internal/catch_run_context.hpp + ${SOURCES_DIR}/internal/catch_section.hpp + ${SOURCES_DIR}/catch_section_info.hpp + ${SOURCES_DIR}/catch_session.hpp + ${SOURCES_DIR}/internal/catch_singletons.hpp + ${SOURCES_DIR}/internal/catch_startup_exception_registry.hpp + ${SOURCES_DIR}/internal/catch_stream.hpp + ${SOURCES_DIR}/internal/catch_stream_end_stop.hpp + ${SOURCES_DIR}/internal/catch_string_manip.hpp + ${SOURCES_DIR}/internal/catch_stringref.hpp + ${SOURCES_DIR}/catch_tag_alias.hpp + ${SOURCES_DIR}/catch_tag_alias_autoregistrar.hpp + ${SOURCES_DIR}/internal/catch_tag_alias_registry.hpp + ${SOURCES_DIR}/catch_test_case_info.hpp + ${SOURCES_DIR}/internal/catch_test_case_registry_impl.hpp + ${SOURCES_DIR}/internal/catch_test_case_tracker.hpp + ${SOURCES_DIR}/catch_template_test_macros.hpp + ${SOURCES_DIR}/catch_test_macros.hpp + ${SOURCES_DIR}/internal/catch_template_test_registry.hpp + ${SOURCES_DIR}/internal/catch_test_registry.hpp + ${SOURCES_DIR}/catch_test_spec.hpp + ${SOURCES_DIR}/internal/catch_test_spec_parser.hpp + ${SOURCES_DIR}/internal/catch_textflow.hpp + ${SOURCES_DIR}/catch_timer.hpp + ${SOURCES_DIR}/internal/catch_to_string.hpp + ${SOURCES_DIR}/catch_tostring.hpp + ${SOURCES_DIR}/catch_totals.hpp + ${SOURCES_DIR}/catch_translate_exception.hpp + ${SOURCES_DIR}/internal/catch_uncaught_exceptions.hpp + ${SOURCES_DIR}/internal/catch_unique_ptr.hpp + ${SOURCES_DIR}/catch_version.hpp + ${SOURCES_DIR}/catch_version_macros.hpp + ${SOURCES_DIR}/internal/catch_wildcard_pattern.hpp + ${SOURCES_DIR}/internal/catch_windows_h_proxy.hpp + ${SOURCES_DIR}/internal/catch_xmlwriter.hpp +) +set(IMPL_SOURCES + ${SOURCES_DIR}/catch_approx.cpp + ${SOURCES_DIR}/internal/catch_assertion_handler.cpp + ${SOURCES_DIR}/catch_assertion_result.cpp + ${SOURCES_DIR}/matchers/internal/catch_matchers_combined_tu.cpp + ${SOURCES_DIR}/internal/catch_clara.cpp + ${SOURCES_DIR}/internal/catch_commandline.cpp + ${SOURCES_DIR}/internal/catch_source_line_info.cpp + ${SOURCES_DIR}/catch_config.cpp + ${SOURCES_DIR}/internal/catch_console_colour.cpp + ${SOURCES_DIR}/internal/catch_context.cpp + ${SOURCES_DIR}/internal/catch_debug_console.cpp + ${SOURCES_DIR}/internal/catch_debugger.cpp + ${SOURCES_DIR}/internal/catch_enforce.cpp + ${SOURCES_DIR}/internal/catch_enum_values_registry.cpp + ${SOURCES_DIR}/internal/catch_exception_translator_registry.cpp + ${SOURCES_DIR}/internal/catch_fatal_condition_handler.cpp + ${SOURCES_DIR}/generators/internal/catch_generators_combined_tu.cpp + ${SOURCES_DIR}/interfaces/catch_interfaces_combined_tu.cpp + ${SOURCES_DIR}/interfaces/catch_interfaces_reporter.cpp + ${SOURCES_DIR}/internal/catch_list.cpp + ${SOURCES_DIR}/matchers/catch_matchers_floating_point.cpp + ${SOURCES_DIR}/matchers/catch_matchers_string.cpp + ${SOURCES_DIR}/matchers/catch_matchers_templated.cpp + ${SOURCES_DIR}/catch_message.cpp + ${SOURCES_DIR}/internal/catch_output_redirect.cpp + ${SOURCES_DIR}/catch_registry_hub.cpp + ${SOURCES_DIR}/internal/catch_combined_tu.cpp + ${SOURCES_DIR}/internal/catch_random_number_generator.cpp + ${SOURCES_DIR}/internal/catch_reporter_registry.cpp + ${SOURCES_DIR}/internal/catch_result_type.cpp + ${SOURCES_DIR}/internal/catch_run_context.cpp + ${SOURCES_DIR}/internal/catch_section.cpp + ${SOURCES_DIR}/catch_session.cpp + ${SOURCES_DIR}/internal/catch_singletons.cpp + ${SOURCES_DIR}/internal/catch_stream.cpp + ${SOURCES_DIR}/internal/catch_stringref.cpp + ${SOURCES_DIR}/internal/catch_string_manip.cpp + ${SOURCES_DIR}/internal/catch_tag_alias_registry.cpp + ${SOURCES_DIR}/catch_test_case_info.cpp + ${SOURCES_DIR}/internal/catch_test_case_registry_impl.cpp + ${SOURCES_DIR}/internal/catch_test_case_tracker.cpp + ${SOURCES_DIR}/internal/catch_test_registry.cpp + ${SOURCES_DIR}/internal/catch_textflow.cpp + ${SOURCES_DIR}/catch_test_spec.cpp + ${SOURCES_DIR}/internal/catch_test_spec_parser.cpp + ${SOURCES_DIR}/catch_timer.cpp + ${SOURCES_DIR}/catch_tostring.cpp + ${SOURCES_DIR}/catch_totals.cpp + ${SOURCES_DIR}/catch_version.cpp + ${SOURCES_DIR}/internal/catch_wildcard_pattern.cpp + ${SOURCES_DIR}/internal/catch_xmlwriter.cpp +) +set(INTERNAL_FILES ${IMPL_SOURCES} ${INTERNAL_HEADERS}) + +# Please keep these ordered alphabetically +set(REPORTER_HEADERS + ${SOURCES_DIR}/reporters/catch_reporters_all.hpp + ${SOURCES_DIR}/reporters/catch_reporter_automake.hpp + ${SOURCES_DIR}/reporters/catch_reporter_compact.hpp + ${SOURCES_DIR}/reporters/catch_reporter_console.hpp + ${SOURCES_DIR}/reporters/catch_reporter_cumulative_base.hpp + ${SOURCES_DIR}/reporters/catch_reporter_event_listener.hpp + ${SOURCES_DIR}/reporters/catch_reporter_helpers.hpp + ${SOURCES_DIR}/reporters/catch_reporter_junit.hpp + ${SOURCES_DIR}/reporters/catch_reporter_listening.hpp + ${SOURCES_DIR}/reporters/catch_reporter_sonarqube.hpp + ${SOURCES_DIR}/reporters/catch_reporter_streaming_base.hpp + ${SOURCES_DIR}/reporters/catch_reporter_tap.hpp + ${SOURCES_DIR}/reporters/catch_reporter_teamcity.hpp + ${SOURCES_DIR}/reporters/catch_reporter_xml.hpp +) +set(REPORTER_SOURCES + ${SOURCES_DIR}/reporters/catch_reporter_automake.cpp + ${SOURCES_DIR}/reporters/catch_reporter_combined_tu.cpp + ${SOURCES_DIR}/reporters/catch_reporter_compact.cpp + ${SOURCES_DIR}/reporters/catch_reporter_console.cpp + ${SOURCES_DIR}/reporters/catch_reporter_cumulative_base.cpp + ${SOURCES_DIR}/reporters/catch_reporter_junit.cpp + ${SOURCES_DIR}/reporters/catch_reporter_listening.cpp + ${SOURCES_DIR}/reporters/catch_reporter_sonarqube.cpp + ${SOURCES_DIR}/reporters/catch_reporter_streaming_base.cpp + ${SOURCES_DIR}/reporters/catch_reporter_tap.cpp + ${SOURCES_DIR}/reporters/catch_reporter_teamcity.cpp + ${SOURCES_DIR}/reporters/catch_reporter_xml.cpp +) +set(REPORTER_FILES ${REPORTER_HEADERS} ${REPORTER_SOURCES}) + +# Fixme: STATIC because for dynamic, we would need to handle visibility +# and I don't want to do the annotations right now +add_library(Catch2 STATIC + ${REPORTER_FILES} + ${INTERNAL_FILES} + ${BENCHMARK_HEADERS} + ${BENCHMARK_SOURCES} +) +add_library(Catch2::Catch2 ALIAS Catch2) + +if (ANDROID) + target_link_libraries(Catch2 INTERFACE log) +endif() + +# depend on bunch of C++11 and C++14 features to have C++14 enabled by default +target_compile_features(Catch2 + PUBLIC + cxx_alignas + cxx_alignof + cxx_attributes + cxx_auto_type + cxx_constexpr + cxx_defaulted_functions + cxx_deleted_functions + cxx_final + cxx_lambdas + cxx_noexcept + cxx_override + cxx_range_for + cxx_rvalue_references + cxx_static_assert + cxx_strong_enums + cxx_trailing_return_types + cxx_unicode_literals + cxx_user_literals + cxx_variable_templates + cxx_variadic_macros +) + +target_include_directories(Catch2 + PUBLIC + $<BUILD_INTERFACE:${SOURCES_DIR}/..> + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> +) + + +add_library(Catch2WithMain STATIC + ${SOURCES_DIR}/internal/catch_main.cpp +) +add_library(Catch2::Catch2WithMain ALIAS Catch2WithMain) +target_link_libraries(Catch2WithMain PUBLIC Catch2) +set_target_properties(Catch2WithMain + PROPERTIES + OUTPUT_NAME "Catch2Main" +) + +if (NOT_SUBPROJECT) + # create and install an export set for catch target as Catch2::Catch + install( + TARGETS + Catch2 + Catch2WithMain + EXPORT + Catch2Targets + DESTINATION + ${CMAKE_INSTALL_LIBDIR} + ) + + + install( + EXPORT + Catch2Targets + NAMESPACE + Catch2:: + DESTINATION + ${CATCH_CMAKE_CONFIG_DESTINATION} + ) + # Install the headers + install(DIRECTORY ${SOURCES_DIR} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FILES_MATCHING PATTERN "*.h*") +endif() + +# Some tests require a full recompilation of Catch2 lib with different +# compilation flags. They can link against this target to recompile all +# the sources into the binary. +if (CATCH_BUILD_EXAMPLES OR CATCH_BUILD_EXTRA_TESTS) + add_library(Catch2_buildall_interface INTERFACE) + target_sources(Catch2_buildall_interface INTERFACE + ${REPORTER_FILES} + ${INTERNAL_FILES} + ${BENCHMARK_HEADERS} + ${BENCHMARK_SOURCES} + # Also include main entry point + ${SOURCES_DIR}/internal/catch_main.cpp + ) + target_include_directories(Catch2_buildall_interface + INTERFACE + $<BUILD_INTERFACE:${SOURCES_DIR}/..> + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> + ) + target_compile_features(Catch2_buildall_interface + INTERFACE + cxx_alignas + cxx_alignof + cxx_attributes + cxx_auto_type + cxx_constexpr + cxx_defaulted_functions + cxx_deleted_functions + cxx_final + cxx_lambdas + cxx_noexcept + cxx_override + cxx_range_for + cxx_rvalue_references + cxx_static_assert + cxx_strong_enums + cxx_trailing_return_types + cxx_unicode_literals + cxx_user_literals + cxx_variable_templates + cxx_variadic_macros + ) +endif() + +list(APPEND CATCH_WARNING_TARGETS Catch2 Catch2WithMain) +set(CATCH_WARNING_TARGETS ${CATCH_WARNING_TARGETS} PARENT_SCOPE) diff --git a/packages/Catch2/src/catch2/benchmark/catch_benchmark.hpp b/packages/Catch2/src/catch2/benchmark/catch_benchmark.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8ff69b4ac88c443819985a08c6d0e351152076b3 --- /dev/null +++ b/packages/Catch2/src/catch2/benchmark/catch_benchmark.hpp @@ -0,0 +1,137 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +// Adapted from donated nonius code. + +#ifndef CATCH_BENCHMARK_HPP_INCLUDED +#define CATCH_BENCHMARK_HPP_INCLUDED + +#include <catch2/interfaces/catch_interfaces_config.hpp> +#include <catch2/internal/catch_context.hpp> +#include <catch2/interfaces/catch_interfaces_reporter.hpp> + +#include <catch2/benchmark/catch_chronometer.hpp> +#include <catch2/benchmark/catch_clock.hpp> +#include <catch2/benchmark/catch_environment.hpp> +#include <catch2/benchmark/catch_execution_plan.hpp> +#include <catch2/benchmark/detail/catch_estimate_clock.hpp> +#include <catch2/benchmark/detail/catch_complete_invoke.hpp> +#include <catch2/benchmark/detail/catch_analyse.hpp> +#include <catch2/benchmark/detail/catch_benchmark_function.hpp> +#include <catch2/benchmark/detail/catch_run_for_at_least.hpp> + +#include <algorithm> +#include <functional> +#include <string> +#include <vector> +#include <cmath> + +namespace Catch { + namespace Benchmark { + struct Benchmark { + Benchmark(std::string&& benchmarkName) + : name(std::move(benchmarkName)) {} + + template <class FUN> + Benchmark(std::string&& benchmarkName , FUN &&func) + : fun(std::move(func)), name(std::move(benchmarkName)) {} + + template <typename Clock> + ExecutionPlan<FloatDuration<Clock>> prepare(const IConfig &cfg, Environment<FloatDuration<Clock>> env) const { + auto min_time = env.clock_resolution.mean * Detail::minimum_ticks; + auto run_time = std::max(min_time, std::chrono::duration_cast<decltype(min_time)>(cfg.benchmarkWarmupTime())); + auto&& test = Detail::run_for_at_least<Clock>(std::chrono::duration_cast<ClockDuration<Clock>>(run_time), 1, fun); + int new_iters = static_cast<int>(std::ceil(min_time * test.iterations / test.elapsed)); + return { new_iters, test.elapsed / test.iterations * new_iters * cfg.benchmarkSamples(), fun, std::chrono::duration_cast<FloatDuration<Clock>>(cfg.benchmarkWarmupTime()), Detail::warmup_iterations }; + } + + template <typename Clock = default_clock> + void run() { + auto const* cfg = getCurrentContext().getConfig(); + + auto env = Detail::measure_environment<Clock>(); + + getResultCapture().benchmarkPreparing(name); + CATCH_TRY{ + auto plan = user_code([&] { + return prepare<Clock>(*cfg, env); + }); + + BenchmarkInfo info { + name, + plan.estimated_duration.count(), + plan.iterations_per_sample, + cfg->benchmarkSamples(), + cfg->benchmarkResamples(), + env.clock_resolution.mean.count(), + env.clock_cost.mean.count() + }; + + getResultCapture().benchmarkStarting(info); + + auto samples = user_code([&] { + return plan.template run<Clock>(*cfg, env); + }); + + auto analysis = Detail::analyse(*cfg, env, samples.begin(), samples.end()); + BenchmarkStats<FloatDuration<Clock>> stats{ info, analysis.samples, analysis.mean, analysis.standard_deviation, analysis.outliers, analysis.outlier_variance }; + getResultCapture().benchmarkEnded(stats); + + } CATCH_CATCH_ALL{ + if (translateActiveException() != Detail::benchmarkErrorMsg) // benchmark errors have been reported, otherwise rethrow. + std::rethrow_exception(std::current_exception()); + } + } + + // sets lambda to be used in fun *and* executes benchmark! + template <typename Fun, + typename std::enable_if<!Detail::is_related<Fun, Benchmark>::value, int>::type = 0> + Benchmark & operator=(Fun func) { + fun = Detail::BenchmarkFunction(func); + run(); + return *this; + } + + explicit operator bool() { + return true; + } + + private: + Detail::BenchmarkFunction fun; + std::string name; + }; + } +} // namespace Catch + +#define INTERNAL_CATCH_GET_1_ARG(arg1, arg2, ...) arg1 +#define INTERNAL_CATCH_GET_2_ARG(arg1, arg2, ...) arg2 + +#define INTERNAL_CATCH_BENCHMARK(BenchmarkName, name, benchmarkIndex)\ + if( Catch::Benchmark::Benchmark BenchmarkName{name} ) \ + BenchmarkName = [&](int benchmarkIndex) + +#define INTERNAL_CATCH_BENCHMARK_ADVANCED(BenchmarkName, name)\ + if( Catch::Benchmark::Benchmark BenchmarkName{name} ) \ + BenchmarkName = [&] + +#if defined(CATCH_CONFIG_PREFIX_ALL) + +#define CATCH_BENCHMARK(...) \ + INTERNAL_CATCH_BENCHMARK(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____B_E_N_C_H____), INTERNAL_CATCH_GET_1_ARG(__VA_ARGS__,,), INTERNAL_CATCH_GET_2_ARG(__VA_ARGS__,,)) +#define CATCH_BENCHMARK_ADVANCED(name) \ + INTERNAL_CATCH_BENCHMARK_ADVANCED(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____B_E_N_C_H____), name) + +#else + +#define BENCHMARK(...) \ + INTERNAL_CATCH_BENCHMARK(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____B_E_N_C_H____), INTERNAL_CATCH_GET_1_ARG(__VA_ARGS__,,), INTERNAL_CATCH_GET_2_ARG(__VA_ARGS__,,)) +#define BENCHMARK_ADVANCED(name) \ + INTERNAL_CATCH_BENCHMARK_ADVANCED(INTERNAL_CATCH_UNIQUE_NAME(____C_A_T_C_H____B_E_N_C_H____), name) + +#endif + +#endif // CATCH_BENCHMARK_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/benchmark/catch_benchmark_all.hpp b/packages/Catch2/src/catch2/benchmark/catch_benchmark_all.hpp new file mode 100644 index 0000000000000000000000000000000000000000..913942b395d9becbb7da89d2ac6b1bca81a4895b --- /dev/null +++ b/packages/Catch2/src/catch2/benchmark/catch_benchmark_all.hpp @@ -0,0 +1,44 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +/** \file + * This is a convenience header for Catch2's benchmarking. It includes + * **all** of Catch2 headers related to benchmarking. + * + * Generally the Catch2 users should use specific includes they need, + * but this header can be used instead for ease-of-experimentation, or + * just plain convenience, at the cost of (significantly) increased + * compilation times. + * + * When a new header is added to either the `benchmark` folder, or to + * the corresponding internal (detail) subfolder, it should be added here. + */ + +#ifndef CATCH_BENCHMARK_ALL_HPP_INCLUDED +#define CATCH_BENCHMARK_ALL_HPP_INCLUDED + +#include <catch2/benchmark/catch_benchmark.hpp> +#include <catch2/benchmark/catch_chronometer.hpp> +#include <catch2/benchmark/catch_clock.hpp> +#include <catch2/benchmark/catch_constructor.hpp> +#include <catch2/benchmark/catch_environment.hpp> +#include <catch2/benchmark/catch_estimate.hpp> +#include <catch2/benchmark/catch_execution_plan.hpp> +#include <catch2/benchmark/catch_optimizer.hpp> +#include <catch2/benchmark/catch_outlier_classification.hpp> +#include <catch2/benchmark/catch_sample_analysis.hpp> +#include <catch2/benchmark/detail/catch_analyse.hpp> +#include <catch2/benchmark/detail/catch_benchmark_function.hpp> +#include <catch2/benchmark/detail/catch_complete_invoke.hpp> +#include <catch2/benchmark/detail/catch_estimate_clock.hpp> +#include <catch2/benchmark/detail/catch_measure.hpp> +#include <catch2/benchmark/detail/catch_repeat.hpp> +#include <catch2/benchmark/detail/catch_run_for_at_least.hpp> +#include <catch2/benchmark/detail/catch_stats.hpp> +#include <catch2/benchmark/detail/catch_timing.hpp> + +#endif // CATCH_BENCHMARK_ALL_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/benchmark/catch_chronometer.hpp b/packages/Catch2/src/catch2/benchmark/catch_chronometer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..10fd5a2753f0596c2438249a4eb844991089448f --- /dev/null +++ b/packages/Catch2/src/catch2/benchmark/catch_chronometer.hpp @@ -0,0 +1,74 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +// Adapted from donated nonius code. + +#ifndef CATCH_CHRONOMETER_HPP_INCLUDED +#define CATCH_CHRONOMETER_HPP_INCLUDED + +#include <catch2/benchmark/catch_clock.hpp> +#include <catch2/benchmark/catch_optimizer.hpp> +#include <catch2/benchmark/detail/catch_complete_invoke.hpp> +#include <catch2/internal/catch_meta.hpp> + +namespace Catch { + namespace Benchmark { + namespace Detail { + struct ChronometerConcept { + virtual void start() = 0; + virtual void finish() = 0; + virtual ~ChronometerConcept(); // = default; + + ChronometerConcept() = default; + ChronometerConcept(ChronometerConcept const&) = default; + ChronometerConcept& operator=(ChronometerConcept const&) = default; + }; + template <typename Clock> + struct ChronometerModel final : public ChronometerConcept { + void start() override { started = Clock::now(); } + void finish() override { finished = Clock::now(); } + + ClockDuration<Clock> elapsed() const { return finished - started; } + + TimePoint<Clock> started; + TimePoint<Clock> finished; + }; + } // namespace Detail + + struct Chronometer { + public: + template <typename Fun> + void measure(Fun&& fun) { measure(std::forward<Fun>(fun), is_callable<Fun(int)>()); } + + int runs() const { return repeats; } + + Chronometer(Detail::ChronometerConcept& meter, int repeats_) + : impl(&meter) + , repeats(repeats_) {} + + private: + template <typename Fun> + void measure(Fun&& fun, std::false_type) { + measure([&fun](int) { return fun(); }, std::true_type()); + } + + template <typename Fun> + void measure(Fun&& fun, std::true_type) { + Detail::optimizer_barrier(); + impl->start(); + for (int i = 0; i < repeats; ++i) invoke_deoptimized(fun, i); + impl->finish(); + Detail::optimizer_barrier(); + } + + Detail::ChronometerConcept* impl; + int repeats; + }; + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_CHRONOMETER_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/benchmark/catch_clock.hpp b/packages/Catch2/src/catch2/benchmark/catch_clock.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e0cf4aaeb4a4f6a89c327df35a028eccb655cf68 --- /dev/null +++ b/packages/Catch2/src/catch2/benchmark/catch_clock.hpp @@ -0,0 +1,39 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +// Adapted from donated nonius code. + +#ifndef CATCH_CLOCK_HPP_INCLUDED +#define CATCH_CLOCK_HPP_INCLUDED + +#include <chrono> +#include <ratio> + +namespace Catch { + namespace Benchmark { + template <typename Clock> + using ClockDuration = typename Clock::duration; + template <typename Clock> + using FloatDuration = std::chrono::duration<double, typename Clock::period>; + + template <typename Clock> + using TimePoint = typename Clock::time_point; + + using default_clock = std::chrono::steady_clock; + + template <typename Clock> + struct now { + TimePoint<Clock> operator()() const { + return Clock::now(); + } + }; + + using fp_seconds = std::chrono::duration<double, std::ratio<1>>; + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_CLOCK_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/benchmark/catch_constructor.hpp b/packages/Catch2/src/catch2/benchmark/catch_constructor.hpp new file mode 100644 index 0000000000000000000000000000000000000000..59600f21c107f8b2bd5a783fcc28c5ececaf0478 --- /dev/null +++ b/packages/Catch2/src/catch2/benchmark/catch_constructor.hpp @@ -0,0 +1,78 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +// Adapted from donated nonius code. + +#ifndef CATCH_CONSTRUCTOR_HPP_INCLUDED +#define CATCH_CONSTRUCTOR_HPP_INCLUDED + +#include <type_traits> + +namespace Catch { + namespace Benchmark { + namespace Detail { + template <typename T, bool Destruct> + struct ObjectStorage + { + using TStorage = typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type; + + ObjectStorage() : data() {} + + ObjectStorage(const ObjectStorage& other) + { + new(&data) T(other.stored_object()); + } + + ObjectStorage(ObjectStorage&& other) + { + new(&data) T(std::move(other.stored_object())); + } + + ~ObjectStorage() { destruct_on_exit<T>(); } + + template <typename... Args> + void construct(Args&&... args) + { + new (&data) T(std::forward<Args>(args)...); + } + + template <bool AllowManualDestruction = !Destruct> + typename std::enable_if<AllowManualDestruction>::type destruct() + { + stored_object().~T(); + } + + private: + // If this is a constructor benchmark, destruct the underlying object + template <typename U> + void destruct_on_exit(typename std::enable_if<Destruct, U>::type* = 0) { destruct<true>(); } + // Otherwise, don't + template <typename U> + void destruct_on_exit(typename std::enable_if<!Destruct, U>::type* = 0) { } + + T& stored_object() { + return *static_cast<T*>(static_cast<void*>(&data)); + } + + T const& stored_object() const { + return *static_cast<T*>(static_cast<void*>(&data)); + } + + + TStorage data; + }; + } // namespace Detail + + template <typename T> + using storage_for = Detail::ObjectStorage<T, true>; + + template <typename T> + using destructable_object = Detail::ObjectStorage<T, false>; + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_CONSTRUCTOR_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/benchmark/catch_environment.hpp b/packages/Catch2/src/catch2/benchmark/catch_environment.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cadd7bc392358f2432eafce76ffe11fd3469f591 --- /dev/null +++ b/packages/Catch2/src/catch2/benchmark/catch_environment.hpp @@ -0,0 +1,37 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +// Adapted from donated nonius code. + +#ifndef CATCH_ENVIRONMENT_HPP_INCLUDED +#define CATCH_ENVIRONMENT_HPP_INCLUDED + +#include <catch2/benchmark/catch_clock.hpp> +#include <catch2/benchmark/catch_outlier_classification.hpp> + +namespace Catch { + namespace Benchmark { + template <typename Duration> + struct EnvironmentEstimate { + Duration mean; + OutlierClassification outliers; + + template <typename Duration2> + operator EnvironmentEstimate<Duration2>() const { + return { mean, outliers }; + } + }; + template <typename Clock> + struct Environment { + using clock_type = Clock; + EnvironmentEstimate<FloatDuration<Clock>> clock_resolution; + EnvironmentEstimate<FloatDuration<Clock>> clock_cost; + }; + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_ENVIRONMENT_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/benchmark/catch_estimate.hpp b/packages/Catch2/src/catch2/benchmark/catch_estimate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..884a4614eaaae43f3f6bfc4fb6ae10aee50214b8 --- /dev/null +++ b/packages/Catch2/src/catch2/benchmark/catch_estimate.hpp @@ -0,0 +1,30 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +// Adapted from donated nonius code. + +#ifndef CATCH_ESTIMATE_HPP_INCLUDED +#define CATCH_ESTIMATE_HPP_INCLUDED + +namespace Catch { + namespace Benchmark { + template <typename Duration> + struct Estimate { + Duration point; + Duration lower_bound; + Duration upper_bound; + double confidence_interval; + + template <typename Duration2> + operator Estimate<Duration2>() const { + return { point, lower_bound, upper_bound, confidence_interval }; + } + }; + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_ESTIMATE_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/benchmark/catch_execution_plan.hpp b/packages/Catch2/src/catch2/benchmark/catch_execution_plan.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1dd0d9b01d595c5594d398b70f76f05e29fee978 --- /dev/null +++ b/packages/Catch2/src/catch2/benchmark/catch_execution_plan.hpp @@ -0,0 +1,57 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +// Adapted from donated nonius code. + +#ifndef CATCH_EXECUTION_PLAN_HPP_INCLUDED +#define CATCH_EXECUTION_PLAN_HPP_INCLUDED + +#include <catch2/interfaces/catch_interfaces_config.hpp> +#include <catch2/benchmark/catch_clock.hpp> +#include <catch2/benchmark/catch_environment.hpp> +#include <catch2/benchmark/detail/catch_benchmark_function.hpp> +#include <catch2/benchmark/detail/catch_repeat.hpp> +#include <catch2/benchmark/detail/catch_run_for_at_least.hpp> + +#include <algorithm> + +namespace Catch { + namespace Benchmark { + template <typename Duration> + struct ExecutionPlan { + int iterations_per_sample; + Duration estimated_duration; + Detail::BenchmarkFunction benchmark; + Duration warmup_time; + int warmup_iterations; + + template <typename Duration2> + operator ExecutionPlan<Duration2>() const { + return { iterations_per_sample, estimated_duration, benchmark, warmup_time, warmup_iterations }; + } + + template <typename Clock> + std::vector<FloatDuration<Clock>> run(const IConfig &cfg, Environment<FloatDuration<Clock>> env) const { + // warmup a bit + Detail::run_for_at_least<Clock>(std::chrono::duration_cast<ClockDuration<Clock>>(warmup_time), warmup_iterations, Detail::repeat(now<Clock>{})); + + std::vector<FloatDuration<Clock>> times; + times.reserve(cfg.benchmarkSamples()); + std::generate_n(std::back_inserter(times), cfg.benchmarkSamples(), [this, env] { + Detail::ChronometerModel<Clock> model; + this->benchmark(Chronometer(model, iterations_per_sample)); + auto sample_time = model.elapsed() - env.clock_cost.mean; + if (sample_time < FloatDuration<Clock>::zero()) sample_time = FloatDuration<Clock>::zero(); + return sample_time / iterations_per_sample; + }); + return times; + } + }; + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_EXECUTION_PLAN_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/benchmark/catch_optimizer.hpp b/packages/Catch2/src/catch2/benchmark/catch_optimizer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6f03ea0d475c1d94e6f67e9e56a1989764cdf822 --- /dev/null +++ b/packages/Catch2/src/catch2/benchmark/catch_optimizer.hpp @@ -0,0 +1,70 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +// Adapted from donated nonius code. + +#ifndef CATCH_OPTIMIZER_HPP_INCLUDED +#define CATCH_OPTIMIZER_HPP_INCLUDED + +#if defined(_MSC_VER) +# include <atomic> // atomic_thread_fence +#endif + +#include <type_traits> +#include <utility> + +namespace Catch { + namespace Benchmark { +#if defined(__GNUC__) || defined(__clang__) + template <typename T> + inline void keep_memory(T* p) { + asm volatile("" : : "g"(p) : "memory"); + } + inline void keep_memory() { + asm volatile("" : : : "memory"); + } + + namespace Detail { + inline void optimizer_barrier() { keep_memory(); } + } // namespace Detail +#elif defined(_MSC_VER) + +#pragma optimize("", off) + template <typename T> + inline void keep_memory(T* p) { + // thanks @milleniumbug + *reinterpret_cast<char volatile*>(p) = *reinterpret_cast<char const volatile*>(p); + } + // TODO equivalent keep_memory() +#pragma optimize("", on) + + namespace Detail { + inline void optimizer_barrier() { + std::atomic_thread_fence(std::memory_order_seq_cst); + } + } // namespace Detail + +#endif + + template <typename T> + inline void deoptimize_value(T&& x) { + keep_memory(&x); + } + + template <typename Fn, typename... Args> + inline auto invoke_deoptimized(Fn&& fn, Args&&... args) -> typename std::enable_if<!std::is_same<void, decltype(fn(args...))>::value>::type { + deoptimize_value(std::forward<Fn>(fn) (std::forward<Args...>(args...))); + } + + template <typename Fn, typename... Args> + inline auto invoke_deoptimized(Fn&& fn, Args&&... args) -> typename std::enable_if<std::is_same<void, decltype(fn(args...))>::value>::type { + std::forward<Fn>(fn) (std::forward<Args...>(args...)); + } + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_OPTIMIZER_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/benchmark/catch_outlier_classification.hpp b/packages/Catch2/src/catch2/benchmark/catch_outlier_classification.hpp new file mode 100644 index 0000000000000000000000000000000000000000..933f045997ae41c2bdafe2dad98825ed0d726613 --- /dev/null +++ b/packages/Catch2/src/catch2/benchmark/catch_outlier_classification.hpp @@ -0,0 +1,29 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +// Adapted from donated nonius code. + +#ifndef CATCH_OUTLIER_CLASSIFICATION_HPP_INCLUDED +#define CATCH_OUTLIER_CLASSIFICATION_HPP_INCLUDED + +namespace Catch { + namespace Benchmark { + struct OutlierClassification { + int samples_seen = 0; + int low_severe = 0; // more than 3 times IQR below Q1 + int low_mild = 0; // 1.5 to 3 times IQR below Q1 + int high_mild = 0; // 1.5 to 3 times IQR above Q3 + int high_severe = 0; // more than 3 times IQR above Q3 + + int total() const { + return low_severe + low_mild + high_mild + high_severe; + } + }; + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_OUTLIERS_CLASSIFICATION_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/benchmark/catch_sample_analysis.hpp b/packages/Catch2/src/catch2/benchmark/catch_sample_analysis.hpp new file mode 100644 index 0000000000000000000000000000000000000000..579e7af9547481846405a3520baca197f833672a --- /dev/null +++ b/packages/Catch2/src/catch2/benchmark/catch_sample_analysis.hpp @@ -0,0 +1,49 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +// Adapted from donated nonius code. + +#ifndef CATCH_SAMPLE_ANALYSIS_HPP_INCLUDED +#define CATCH_SAMPLE_ANALYSIS_HPP_INCLUDED + +#include <catch2/benchmark/catch_clock.hpp> +#include <catch2/benchmark/catch_estimate.hpp> +#include <catch2/benchmark/catch_outlier_classification.hpp> + +#include <algorithm> +#include <vector> +#include <string> +#include <iterator> + +namespace Catch { + namespace Benchmark { + template <typename Duration> + struct SampleAnalysis { + std::vector<Duration> samples; + Estimate<Duration> mean; + Estimate<Duration> standard_deviation; + OutlierClassification outliers; + double outlier_variance; + + template <typename Duration2> + operator SampleAnalysis<Duration2>() const { + std::vector<Duration2> samples2; + samples2.reserve(samples.size()); + std::transform(samples.begin(), samples.end(), std::back_inserter(samples2), [](Duration d) { return Duration2(d); }); + return { + std::move(samples2), + mean, + standard_deviation, + outliers, + outlier_variance, + }; + } + }; + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_SAMPLE_ANALYSIS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/benchmark/detail/catch_analyse.hpp b/packages/Catch2/src/catch2/benchmark/detail/catch_analyse.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0a52a8451ae4740fc681039be2b7426891e69980 --- /dev/null +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_analyse.hpp @@ -0,0 +1,77 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +// Adapted from donated nonius code. + +#ifndef CATCH_ANALYSE_HPP_INCLUDED +#define CATCH_ANALYSE_HPP_INCLUDED + +#include <catch2/benchmark/catch_clock.hpp> +#include <catch2/benchmark/catch_sample_analysis.hpp> +#include <catch2/benchmark/detail/catch_stats.hpp> + +#include <algorithm> +#include <iterator> +#include <vector> + +namespace Catch { + namespace Benchmark { + namespace Detail { + template <typename Duration, typename Iterator> + SampleAnalysis<Duration> analyse(const IConfig &cfg, Environment<Duration>, Iterator first, Iterator last) { + if (!cfg.benchmarkNoAnalysis()) { + std::vector<double> samples; + samples.reserve(last - first); + std::transform(first, last, std::back_inserter(samples), [](Duration d) { return d.count(); }); + + auto analysis = Catch::Benchmark::Detail::analyse_samples(cfg.benchmarkConfidenceInterval(), cfg.benchmarkResamples(), samples.begin(), samples.end()); + auto outliers = Catch::Benchmark::Detail::classify_outliers(samples.begin(), samples.end()); + + auto wrap_estimate = [](Estimate<double> e) { + return Estimate<Duration> { + Duration(e.point), + Duration(e.lower_bound), + Duration(e.upper_bound), + e.confidence_interval, + }; + }; + std::vector<Duration> samples2; + samples2.reserve(samples.size()); + std::transform(samples.begin(), samples.end(), std::back_inserter(samples2), [](double d) { return Duration(d); }); + return { + std::move(samples2), + wrap_estimate(analysis.mean), + wrap_estimate(analysis.standard_deviation), + outliers, + analysis.outlier_variance, + }; + } else { + std::vector<Duration> samples; + samples.reserve(last - first); + + Duration mean = Duration(0); + int i = 0; + for (auto it = first; it < last; ++it, ++i) { + samples.push_back(Duration(*it)); + mean += Duration(*it); + } + mean /= i; + + return { + std::move(samples), + Estimate<Duration>{mean, mean, mean, 0.0}, + Estimate<Duration>{Duration(0), Duration(0), Duration(0), 0.0}, + OutlierClassification{}, + 0.0 + }; + } + } + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_ANALYSE_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/benchmark/detail/catch_benchmark_function.hpp b/packages/Catch2/src/catch2/benchmark/detail/catch_benchmark_function.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4e0c55ffcfdfb74c5366cfe0505dcac5d6c9f9f2 --- /dev/null +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_benchmark_function.hpp @@ -0,0 +1,109 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +// Adapted from donated nonius code. + +#ifndef CATCH_BENCHMARK_FUNCTION_HPP_INCLUDED +#define CATCH_BENCHMARK_FUNCTION_HPP_INCLUDED + +#include <catch2/benchmark/catch_chronometer.hpp> +#include <catch2/benchmark/detail/catch_complete_invoke.hpp> +#include <catch2/internal/catch_meta.hpp> +#include <catch2/internal/catch_unique_ptr.hpp> + +#include <cassert> +#include <type_traits> +#include <utility> + +namespace Catch { + namespace Benchmark { + namespace Detail { + template <typename T> + using Decay = typename std::decay<T>::type; + template <typename T, typename U> + struct is_related + : std::is_same<Decay<T>, Decay<U>> {}; + + /// We need to reinvent std::function because every piece of code that might add overhead + /// in a measurement context needs to have consistent performance characteristics so that we + /// can account for it in the measurement. + /// Implementations of std::function with optimizations that aren't always applicable, like + /// small buffer optimizations, are not uncommon. + /// This is effectively an implementation of std::function without any such optimizations; + /// it may be slow, but it is consistently slow. + struct BenchmarkFunction { + private: + struct callable { + virtual void call(Chronometer meter) const = 0; + virtual callable* clone() const = 0; + virtual ~callable(); // = default; + + callable() = default; + callable(callable const&) = default; + callable& operator=(callable const&) = default; + }; + template <typename Fun> + struct model : public callable { + model(Fun&& fun_) : fun(std::move(fun_)) {} + model(Fun const& fun_) : fun(fun_) {} + + model<Fun>* clone() const override { return new model<Fun>(*this); } + + void call(Chronometer meter) const override { + call(meter, is_callable<Fun(Chronometer)>()); + } + void call(Chronometer meter, std::true_type) const { + fun(meter); + } + void call(Chronometer meter, std::false_type) const { + meter.measure(fun); + } + + Fun fun; + }; + + struct do_nothing { void operator()() const {} }; + + template <typename T> + BenchmarkFunction(model<T>* c) : f(c) {} + + public: + BenchmarkFunction() + : f(new model<do_nothing>{ {} }) {} + + template <typename Fun, + typename std::enable_if<!is_related<Fun, BenchmarkFunction>::value, int>::type = 0> + BenchmarkFunction(Fun&& fun) + : f(new model<typename std::decay<Fun>::type>(std::forward<Fun>(fun))) {} + + BenchmarkFunction( BenchmarkFunction&& that ) noexcept: + f( std::move( that.f ) ) {} + + BenchmarkFunction(BenchmarkFunction const& that) + : f(that.f->clone()) {} + + BenchmarkFunction& + operator=( BenchmarkFunction&& that ) noexcept { + f = std::move( that.f ); + return *this; + } + + BenchmarkFunction& operator=(BenchmarkFunction const& that) { + f.reset(that.f->clone()); + return *this; + } + + void operator()(Chronometer meter) const { f->call(meter); } + + private: + Catch::Detail::unique_ptr<callable> f; + }; + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_BENCHMARK_FUNCTION_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/benchmark/detail/catch_complete_invoke.hpp b/packages/Catch2/src/catch2/benchmark/detail/catch_complete_invoke.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8cb132112124a51760df577fed1b5776c7544b5b --- /dev/null +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_complete_invoke.hpp @@ -0,0 +1,69 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +// Adapted from donated nonius code. + +#ifndef CATCH_COMPLETE_INVOKE_HPP_INCLUDED +#define CATCH_COMPLETE_INVOKE_HPP_INCLUDED + +#include <catch2/internal/catch_enforce.hpp> +#include <catch2/internal/catch_meta.hpp> +#include <catch2/interfaces/catch_interfaces_capture.hpp> +#include <catch2/interfaces/catch_interfaces_registry_hub.hpp> + +#include <type_traits> +#include <utility> + +namespace Catch { + namespace Benchmark { + namespace Detail { + template <typename T> + struct CompleteType { using type = T; }; + template <> + struct CompleteType<void> { struct type {}; }; + + template <typename T> + using CompleteType_t = typename CompleteType<T>::type; + + template <typename Result> + struct CompleteInvoker { + template <typename Fun, typename... Args> + static Result invoke(Fun&& fun, Args&&... args) { + return std::forward<Fun>(fun)(std::forward<Args>(args)...); + } + }; + template <> + struct CompleteInvoker<void> { + template <typename Fun, typename... Args> + static CompleteType_t<void> invoke(Fun&& fun, Args&&... args) { + std::forward<Fun>(fun)(std::forward<Args>(args)...); + return {}; + } + }; + + // invoke and not return void :( + template <typename Fun, typename... Args> + CompleteType_t<FunctionReturnType<Fun, Args...>> complete_invoke(Fun&& fun, Args&&... args) { + return CompleteInvoker<FunctionReturnType<Fun, Args...>>::invoke(std::forward<Fun>(fun), std::forward<Args>(args)...); + } + + extern const std::string benchmarkErrorMsg; + } // namespace Detail + + template <typename Fun> + Detail::CompleteType_t<FunctionReturnType<Fun>> user_code(Fun&& fun) { + CATCH_TRY{ + return Detail::complete_invoke(std::forward<Fun>(fun)); + } CATCH_CATCH_ALL{ + getResultCapture().benchmarkFailed(translateActiveException()); + CATCH_RUNTIME_ERROR(Detail::benchmarkErrorMsg); + } + } + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_COMPLETE_INVOKE_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/benchmark/detail/catch_estimate_clock.hpp b/packages/Catch2/src/catch2/benchmark/detail/catch_estimate_clock.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0a49e51374b29d65476de8830e8e73361393ed35 --- /dev/null +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_estimate_clock.hpp @@ -0,0 +1,111 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +// Adapted from donated nonius code. + +#ifndef CATCH_ESTIMATE_CLOCK_HPP_INCLUDED +#define CATCH_ESTIMATE_CLOCK_HPP_INCLUDED + +#include <catch2/benchmark/catch_clock.hpp> +#include <catch2/benchmark/catch_environment.hpp> +#include <catch2/benchmark/detail/catch_stats.hpp> +#include <catch2/benchmark/detail/catch_measure.hpp> +#include <catch2/benchmark/detail/catch_run_for_at_least.hpp> +#include <catch2/benchmark/catch_clock.hpp> + +#include <algorithm> +#include <iterator> +#include <vector> +#include <cmath> + +namespace Catch { + namespace Benchmark { + namespace Detail { + template <typename Clock> + std::vector<double> resolution(int k) { + std::vector<TimePoint<Clock>> times; + times.reserve(k + 1); + std::generate_n(std::back_inserter(times), k + 1, now<Clock>{}); + + std::vector<double> deltas; + deltas.reserve(k); + std::transform(std::next(times.begin()), times.end(), times.begin(), + std::back_inserter(deltas), + [](TimePoint<Clock> a, TimePoint<Clock> b) { return static_cast<double>((a - b).count()); }); + + return deltas; + } + + const auto warmup_iterations = 10000; + const auto warmup_time = std::chrono::milliseconds(100); + const auto minimum_ticks = 1000; + const auto warmup_seed = 10000; + const auto clock_resolution_estimation_time = std::chrono::milliseconds(500); + const auto clock_cost_estimation_time_limit = std::chrono::seconds(1); + const auto clock_cost_estimation_tick_limit = 100000; + const auto clock_cost_estimation_time = std::chrono::milliseconds(10); + const auto clock_cost_estimation_iterations = 10000; + + template <typename Clock> + int warmup() { + return run_for_at_least<Clock>(std::chrono::duration_cast<ClockDuration<Clock>>(warmup_time), warmup_seed, &resolution<Clock>) + .iterations; + } + template <typename Clock> + EnvironmentEstimate<FloatDuration<Clock>> estimate_clock_resolution(int iterations) { + auto r = run_for_at_least<Clock>(std::chrono::duration_cast<ClockDuration<Clock>>(clock_resolution_estimation_time), iterations, &resolution<Clock>) + .result; + return { + FloatDuration<Clock>(mean(r.begin(), r.end())), + classify_outliers(r.begin(), r.end()), + }; + } + template <typename Clock> + EnvironmentEstimate<FloatDuration<Clock>> estimate_clock_cost(FloatDuration<Clock> resolution) { + auto time_limit = std::min(resolution * clock_cost_estimation_tick_limit, FloatDuration<Clock>(clock_cost_estimation_time_limit)); + auto time_clock = [](int k) { + return Detail::measure<Clock>([k] { + for (int i = 0; i < k; ++i) { + volatile auto ignored = Clock::now(); + (void)ignored; + } + }).elapsed; + }; + time_clock(1); + int iters = clock_cost_estimation_iterations; + auto&& r = run_for_at_least<Clock>(std::chrono::duration_cast<ClockDuration<Clock>>(clock_cost_estimation_time), iters, time_clock); + std::vector<double> times; + int nsamples = static_cast<int>(std::ceil(time_limit / r.elapsed)); + times.reserve(nsamples); + std::generate_n(std::back_inserter(times), nsamples, [time_clock, &r] { + return static_cast<double>((time_clock(r.iterations) / r.iterations).count()); + }); + return { + FloatDuration<Clock>(mean(times.begin(), times.end())), + classify_outliers(times.begin(), times.end()), + }; + } + + template <typename Clock> + Environment<FloatDuration<Clock>> measure_environment() { + static Environment<FloatDuration<Clock>>* env = nullptr; + if (env) { + return *env; + } + + auto iters = Detail::warmup<Clock>(); + auto resolution = Detail::estimate_clock_resolution<Clock>(iters); + auto cost = Detail::estimate_clock_cost<Clock>(resolution.mean); + + env = new Environment<FloatDuration<Clock>>{ resolution, cost }; + return *env; + } + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_ESTIMATE_CLOCK_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/benchmark/detail/catch_measure.hpp b/packages/Catch2/src/catch2/benchmark/detail/catch_measure.hpp new file mode 100644 index 0000000000000000000000000000000000000000..49df259ad486e57471409a7c45b00e35f29eafef --- /dev/null +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_measure.hpp @@ -0,0 +1,34 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +// Adapted from donated nonius code. + +#ifndef CATCH_MEASURE_HPP_INCLUDED +#define CATCH_MEASURE_HPP_INCLUDED + +#include <catch2/benchmark/catch_clock.hpp> +#include <catch2/benchmark/detail/catch_complete_invoke.hpp> +#include <catch2/benchmark/detail/catch_timing.hpp> + +#include <utility> + +namespace Catch { + namespace Benchmark { + namespace Detail { + template <typename Clock, typename Fun, typename... Args> + TimingOf<Clock, Fun, Args...> measure(Fun&& fun, Args&&... args) { + auto start = Clock::now(); + auto&& r = Detail::complete_invoke(fun, std::forward<Args>(args)...); + auto end = Clock::now(); + auto delta = end - start; + return { delta, std::forward<decltype(r)>(r), 1 }; + } + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_MEASURE_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/benchmark/detail/catch_repeat.hpp b/packages/Catch2/src/catch2/benchmark/detail/catch_repeat.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cc2ea0241af72f5a2cf6075c40f3b7281703d096 --- /dev/null +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_repeat.hpp @@ -0,0 +1,36 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +// Adapted from donated nonius code. + +#ifndef CATCH_REPEAT_HPP_INCLUDED +#define CATCH_REPEAT_HPP_INCLUDED + +#include <type_traits> +#include <utility> + +namespace Catch { + namespace Benchmark { + namespace Detail { + template <typename Fun> + struct repeater { + void operator()(int k) const { + for (int i = 0; i < k; ++i) { + fun(); + } + } + Fun fun; + }; + template <typename Fun> + repeater<typename std::decay<Fun>::type> repeat(Fun&& fun) { + return { std::forward<Fun>(fun) }; + } + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_REPEAT_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/benchmark/detail/catch_run_for_at_least.hpp b/packages/Catch2/src/catch2/benchmark/detail/catch_run_for_at_least.hpp new file mode 100644 index 0000000000000000000000000000000000000000..da08a92ba06cb29cf38b77591af397fe78eb1fde --- /dev/null +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_run_for_at_least.hpp @@ -0,0 +1,62 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +// Adapted from donated nonius code. + +#ifndef CATCH_RUN_FOR_AT_LEAST_HPP_INCLUDED +#define CATCH_RUN_FOR_AT_LEAST_HPP_INCLUDED + +#include <catch2/benchmark/catch_clock.hpp> +#include <catch2/benchmark/catch_chronometer.hpp> +#include <catch2/benchmark/detail/catch_measure.hpp> +#include <catch2/benchmark/detail/catch_complete_invoke.hpp> +#include <catch2/benchmark/detail/catch_timing.hpp> +#include <catch2/internal/catch_meta.hpp> + +#include <utility> +#include <type_traits> + +namespace Catch { + namespace Benchmark { + namespace Detail { + template <typename Clock, typename Fun> + TimingOf<Clock, Fun, int> measure_one(Fun&& fun, int iters, std::false_type) { + return Detail::measure<Clock>(fun, iters); + } + template <typename Clock, typename Fun> + TimingOf<Clock, Fun, Chronometer> measure_one(Fun&& fun, int iters, std::true_type) { + Detail::ChronometerModel<Clock> meter; + auto&& result = Detail::complete_invoke(fun, Chronometer(meter, iters)); + + return { meter.elapsed(), std::move(result), iters }; + } + + template <typename Clock, typename Fun> + using run_for_at_least_argument_t = typename std::conditional<is_callable<Fun(Chronometer)>::value, Chronometer, int>::type; + + + [[noreturn]] + void throw_optimized_away_error(); + + template <typename Clock, typename Fun> + TimingOf<Clock, Fun, run_for_at_least_argument_t<Clock, Fun>> run_for_at_least(ClockDuration<Clock> how_long, int seed, Fun&& fun) { + auto iters = seed; + while (iters < (1 << 30)) { + auto&& Timing = measure_one<Clock>(fun, iters, is_callable<Fun(Chronometer)>()); + + if (Timing.elapsed >= how_long) { + return { Timing.elapsed, std::move(Timing.result), iters }; + } + iters *= 2; + } + throw_optimized_away_error(); + } + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_RUN_FOR_AT_LEAST_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/benchmark/detail/catch_stats.cpp b/packages/Catch2/src/catch2/benchmark/detail/catch_stats.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8e14bfd71ead287d73065f31031826db1095fcdd --- /dev/null +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_stats.cpp @@ -0,0 +1,241 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +// Adapted from donated nonius code. + +#include <catch2/benchmark/detail/catch_stats.hpp> + +#include <catch2/internal/catch_compiler_capabilities.hpp> + +#include <cassert> +#include <iterator> +#include <random> + + +#if defined(CATCH_CONFIG_USE_ASYNC) +#include <future> +#endif + +namespace { + +using Catch::Benchmark::Detail::sample; + + template <typename URng, typename Estimator> + sample resample(URng& rng, int resamples, std::vector<double>::iterator first, std::vector<double>::iterator last, Estimator& estimator) { + auto n = last - first; + std::uniform_int_distribution<decltype(n)> dist(0, n - 1); + + sample out; + out.reserve(resamples); + std::generate_n(std::back_inserter(out), resamples, [n, first, &estimator, &dist, &rng] { + std::vector<double> resampled; + resampled.reserve(n); + std::generate_n(std::back_inserter(resampled), n, [first, &dist, &rng] { return first[dist(rng)]; }); + return estimator(resampled.begin(), resampled.end()); + }); + std::sort(out.begin(), out.end()); + return out; + } + + + double erf_inv(double x) { + // Code accompanying the article "Approximating the erfinv function" in GPU Computing Gems, Volume 2 + double w, p; + + w = -log((1.0 - x) * (1.0 + x)); + + if (w < 6.250000) { + w = w - 3.125000; + p = -3.6444120640178196996e-21; + p = -1.685059138182016589e-19 + p * w; + p = 1.2858480715256400167e-18 + p * w; + p = 1.115787767802518096e-17 + p * w; + p = -1.333171662854620906e-16 + p * w; + p = 2.0972767875968561637e-17 + p * w; + p = 6.6376381343583238325e-15 + p * w; + p = -4.0545662729752068639e-14 + p * w; + p = -8.1519341976054721522e-14 + p * w; + p = 2.6335093153082322977e-12 + p * w; + p = -1.2975133253453532498e-11 + p * w; + p = -5.4154120542946279317e-11 + p * w; + p = 1.051212273321532285e-09 + p * w; + p = -4.1126339803469836976e-09 + p * w; + p = -2.9070369957882005086e-08 + p * w; + p = 4.2347877827932403518e-07 + p * w; + p = -1.3654692000834678645e-06 + p * w; + p = -1.3882523362786468719e-05 + p * w; + p = 0.0001867342080340571352 + p * w; + p = -0.00074070253416626697512 + p * w; + p = -0.0060336708714301490533 + p * w; + p = 0.24015818242558961693 + p * w; + p = 1.6536545626831027356 + p * w; + } else if (w < 16.000000) { + w = sqrt(w) - 3.250000; + p = 2.2137376921775787049e-09; + p = 9.0756561938885390979e-08 + p * w; + p = -2.7517406297064545428e-07 + p * w; + p = 1.8239629214389227755e-08 + p * w; + p = 1.5027403968909827627e-06 + p * w; + p = -4.013867526981545969e-06 + p * w; + p = 2.9234449089955446044e-06 + p * w; + p = 1.2475304481671778723e-05 + p * w; + p = -4.7318229009055733981e-05 + p * w; + p = 6.8284851459573175448e-05 + p * w; + p = 2.4031110387097893999e-05 + p * w; + p = -0.0003550375203628474796 + p * w; + p = 0.00095328937973738049703 + p * w; + p = -0.0016882755560235047313 + p * w; + p = 0.0024914420961078508066 + p * w; + p = -0.0037512085075692412107 + p * w; + p = 0.005370914553590063617 + p * w; + p = 1.0052589676941592334 + p * w; + p = 3.0838856104922207635 + p * w; + } else { + w = sqrt(w) - 5.000000; + p = -2.7109920616438573243e-11; + p = -2.5556418169965252055e-10 + p * w; + p = 1.5076572693500548083e-09 + p * w; + p = -3.7894654401267369937e-09 + p * w; + p = 7.6157012080783393804e-09 + p * w; + p = -1.4960026627149240478e-08 + p * w; + p = 2.9147953450901080826e-08 + p * w; + p = -6.7711997758452339498e-08 + p * w; + p = 2.2900482228026654717e-07 + p * w; + p = -9.9298272942317002539e-07 + p * w; + p = 4.5260625972231537039e-06 + p * w; + p = -1.9681778105531670567e-05 + p * w; + p = 7.5995277030017761139e-05 + p * w; + p = -0.00021503011930044477347 + p * w; + p = -0.00013871931833623122026 + p * w; + p = 1.0103004648645343977 + p * w; + p = 4.8499064014085844221 + p * w; + } + return p * x; + } + + double standard_deviation(std::vector<double>::iterator first, std::vector<double>::iterator last) { + auto m = Catch::Benchmark::Detail::mean(first, last); + double variance = std::accumulate(first, last, 0., [m](double a, double b) { + double diff = b - m; + return a + diff * diff; + }) / (last - first); + return std::sqrt(variance); + } + +} + +namespace Catch { + namespace Benchmark { + namespace Detail { + + double weighted_average_quantile(int k, int q, std::vector<double>::iterator first, std::vector<double>::iterator last) { + auto count = last - first; + double idx = (count - 1) * k / static_cast<double>(q); + int j = static_cast<int>(idx); + double g = idx - j; + std::nth_element(first, first + j, last); + auto xj = first[j]; + if (g == 0) return xj; + + auto xj1 = *std::min_element(first + (j + 1), last); + return xj + g * (xj1 - xj); + } + + + double erfc_inv(double x) { + return erf_inv(1.0 - x); + } + + double normal_quantile(double p) { + static const double ROOT_TWO = std::sqrt(2.0); + + double result = 0.0; + assert(p >= 0 && p <= 1); + if (p < 0 || p > 1) { + return result; + } + + result = -erfc_inv(2.0 * p); + // result *= normal distribution standard deviation (1.0) * sqrt(2) + result *= /*sd * */ ROOT_TWO; + // result += normal disttribution mean (0) + return result; + } + + + double outlier_variance(Estimate<double> mean, Estimate<double> stddev, int n) { + double sb = stddev.point; + double mn = mean.point / n; + double mg_min = mn / 2.; + double sg = std::min(mg_min / 4., sb / std::sqrt(n)); + double sg2 = sg * sg; + double sb2 = sb * sb; + + auto c_max = [n, mn, sb2, sg2](double x) -> double { + double k = mn - x; + double d = k * k; + double nd = n * d; + double k0 = -n * nd; + double k1 = sb2 - n * sg2 + nd; + double det = k1 * k1 - 4 * sg2 * k0; + return static_cast<int>(-2. * k0 / (k1 + std::sqrt(det))); + }; + + auto var_out = [n, sb2, sg2](double c) { + double nc = n - c; + return (nc / n) * (sb2 - nc * sg2); + }; + + return std::min(var_out(1), var_out(std::min(c_max(0.), c_max(mg_min)))) / sb2; + } + + + bootstrap_analysis analyse_samples(double confidence_level, int n_resamples, std::vector<double>::iterator first, std::vector<double>::iterator last) { + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS + static std::random_device entropy; + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION + + auto n = static_cast<int>(last - first); // seriously, one can't use integral types without hell in C++ + + auto mean = &Detail::mean<std::vector<double>::iterator>; + auto stddev = &standard_deviation; + +#if defined(CATCH_CONFIG_USE_ASYNC) + auto Estimate = [=](double(*f)(std::vector<double>::iterator, std::vector<double>::iterator)) { + auto seed = entropy(); + return std::async(std::launch::async, [=] { + std::mt19937 rng(seed); + auto resampled = resample(rng, n_resamples, first, last, f); + return bootstrap(confidence_level, first, last, resampled, f); + }); + }; + + auto mean_future = Estimate(mean); + auto stddev_future = Estimate(stddev); + + auto mean_estimate = mean_future.get(); + auto stddev_estimate = stddev_future.get(); +#else + auto Estimate = [=](double(*f)(std::vector<double>::iterator, std::vector<double>::iterator)) { + auto seed = entropy(); + std::mt19937 rng(seed); + auto resampled = resample(rng, n_resamples, first, last, f); + return bootstrap(confidence_level, first, last, resampled, f); + }; + + auto mean_estimate = Estimate(mean); + auto stddev_estimate = Estimate(stddev); +#endif // CATCH_USE_ASYNC + + double outlier_variance = Detail::outlier_variance(mean_estimate, stddev_estimate, n); + + return { mean_estimate, stddev_estimate, outlier_variance }; + } + } // namespace Detail + } // namespace Benchmark +} // namespace Catch diff --git a/packages/Catch2/src/catch2/benchmark/detail/catch_stats.hpp b/packages/Catch2/src/catch2/benchmark/detail/catch_stats.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b8044131acf40186aa0fe43057e1b9908cd7a94a --- /dev/null +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_stats.hpp @@ -0,0 +1,138 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +// Adapted from donated nonius code. + +#ifndef CATCH_STATS_HPP_INCLUDED +#define CATCH_STATS_HPP_INCLUDED + +#include <catch2/benchmark/catch_estimate.hpp> +#include <catch2/benchmark/catch_outlier_classification.hpp> + +#include <algorithm> +#include <vector> +#include <numeric> +#include <tuple> +#include <cmath> +#include <utility> + +namespace Catch { + namespace Benchmark { + namespace Detail { + using sample = std::vector<double>; + + double weighted_average_quantile(int k, int q, std::vector<double>::iterator first, std::vector<double>::iterator last); + + template <typename Iterator> + OutlierClassification classify_outliers(Iterator first, Iterator last) { + std::vector<double> copy(first, last); + + auto q1 = weighted_average_quantile(1, 4, copy.begin(), copy.end()); + auto q3 = weighted_average_quantile(3, 4, copy.begin(), copy.end()); + auto iqr = q3 - q1; + auto los = q1 - (iqr * 3.); + auto lom = q1 - (iqr * 1.5); + auto him = q3 + (iqr * 1.5); + auto his = q3 + (iqr * 3.); + + OutlierClassification o; + for (; first != last; ++first) { + auto&& t = *first; + if (t < los) ++o.low_severe; + else if (t < lom) ++o.low_mild; + else if (t > his) ++o.high_severe; + else if (t > him) ++o.high_mild; + ++o.samples_seen; + } + return o; + } + + template <typename Iterator> + double mean(Iterator first, Iterator last) { + auto count = last - first; + double sum = std::accumulate(first, last, 0.); + return sum / count; + } + + template <typename Estimator, typename Iterator> + sample jackknife(Estimator&& estimator, Iterator first, Iterator last) { + auto n = last - first; + auto second = first; + ++second; + sample results; + results.reserve(n); + + for (auto it = first; it != last; ++it) { + std::iter_swap(it, first); + results.push_back(estimator(second, last)); + } + + return results; + } + + inline double normal_cdf(double x) { + return std::erfc(-x / std::sqrt(2.0)) / 2.0; + } + + double erfc_inv(double x); + + double normal_quantile(double p); + + template <typename Iterator, typename Estimator> + Estimate<double> bootstrap(double confidence_level, Iterator first, Iterator last, sample const& resample, Estimator&& estimator) { + auto n_samples = last - first; + + double point = estimator(first, last); + // Degenerate case with a single sample + if (n_samples == 1) return { point, point, point, confidence_level }; + + sample jack = jackknife(estimator, first, last); + double jack_mean = mean(jack.begin(), jack.end()); + double sum_squares, sum_cubes; + std::tie(sum_squares, sum_cubes) = std::accumulate(jack.begin(), jack.end(), std::make_pair(0., 0.), [jack_mean](std::pair<double, double> sqcb, double x) -> std::pair<double, double> { + auto d = jack_mean - x; + auto d2 = d * d; + auto d3 = d2 * d; + return { sqcb.first + d2, sqcb.second + d3 }; + }); + + double accel = sum_cubes / (6 * std::pow(sum_squares, 1.5)); + int n = static_cast<int>(resample.size()); + double prob_n = std::count_if(resample.begin(), resample.end(), [point](double x) { return x < point; }) / static_cast<double>(n); + // degenerate case with uniform samples + if (prob_n == 0) return { point, point, point, confidence_level }; + + double bias = normal_quantile(prob_n); + double z1 = normal_quantile((1. - confidence_level) / 2.); + + auto cumn = [n](double x) -> int { + return std::lround(normal_cdf(x) * n); }; + auto a = [bias, accel](double b) { return bias + b / (1. - accel * b); }; + double b1 = bias + z1; + double b2 = bias - z1; + double a1 = a(b1); + double a2 = a(b2); + auto lo = std::max(cumn(a1), 0); + auto hi = std::min(cumn(a2), n - 1); + + return { point, resample[lo], resample[hi], confidence_level }; + } + + double outlier_variance(Estimate<double> mean, Estimate<double> stddev, int n); + + struct bootstrap_analysis { + Estimate<double> mean; + Estimate<double> standard_deviation; + double outlier_variance; + }; + + bootstrap_analysis analyse_samples(double confidence_level, int n_resamples, std::vector<double>::iterator first, std::vector<double>::iterator last); + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_STATS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/benchmark/detail/catch_timing.hpp b/packages/Catch2/src/catch2/benchmark/detail/catch_timing.hpp new file mode 100644 index 0000000000000000000000000000000000000000..40a9512b7d54ac6643746c0aad72b653a0a80d91 --- /dev/null +++ b/packages/Catch2/src/catch2/benchmark/detail/catch_timing.hpp @@ -0,0 +1,31 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +// Adapted from donated nonius code. + +#ifndef CATCH_TIMING_HPP_INCLUDED +#define CATCH_TIMING_HPP_INCLUDED + +#include <catch2/benchmark/catch_clock.hpp> +#include <catch2/benchmark/detail/catch_complete_invoke.hpp> + +#include <type_traits> + +namespace Catch { + namespace Benchmark { + template <typename Duration, typename Result> + struct Timing { + Duration elapsed; + Result result; + int iterations; + }; + template <typename Clock, typename Func, typename... Args> + using TimingOf = Timing<ClockDuration<Clock>, Detail::CompleteType_t<FunctionReturnType<Func, Args...>>>; + } // namespace Benchmark +} // namespace Catch + +#endif // CATCH_TIMING_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/benchmark/internal/catch_benchmark_combined_tu.cpp b/packages/Catch2/src/catch2/benchmark/internal/catch_benchmark_combined_tu.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c7234966fc23710250709140a109c2fe4b6d4966 --- /dev/null +++ b/packages/Catch2/src/catch2/benchmark/internal/catch_benchmark_combined_tu.cpp @@ -0,0 +1,95 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +/** \file + * This is a special TU that combines what would otherwise be a very + * small benchmarking-related TUs into one bigger TU. + * + * The reason for this is compilation performance improvements by + * avoiding reparsing headers for many small TUs, instead having this + * one TU include bit more, but having it all parsed only once. + * + * To avoid heavy-tail problem with compilation times, each "subpart" + * of Catch2 has its own combined TU like this. + */ + +//////////////////////////////////////////// +// vvv formerly catch_chronometer.cpp vvv // +//////////////////////////////////////////// + +#include <catch2/benchmark/catch_chronometer.hpp> + +namespace Catch { + namespace Benchmark { + namespace Detail { + ChronometerConcept::~ChronometerConcept() = default; + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + + +/////////////////////////////////////////////////// +// vvv formerly catch_benchmark_function.cpp vvv // +/////////////////////////////////////////////////// + +#include <catch2/benchmark/detail/catch_benchmark_function.hpp> + +namespace Catch { + namespace Benchmark { + namespace Detail { + BenchmarkFunction::callable::~callable() = default; + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + + +//////////////////////////////////////////////// +// vvv formerly catch_complete_invoke.cpp vvv // +//////////////////////////////////////////////// + +#include <catch2/benchmark/detail/catch_complete_invoke.hpp> + +namespace Catch { + namespace Benchmark { + namespace Detail { + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS + const std::string benchmarkErrorMsg = "a benchmark failed to run successfully"; + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION + } // namespace Detail + } // namespace Benchmark +} // namespace Catch + + + + +///////////////////////////////////////////////// +// vvv formerly catch_run_for_at_least.cpp vvv // +///////////////////////////////////////////////// + +#include <catch2/benchmark/detail/catch_run_for_at_least.hpp> +#include <exception> +#include <catch2/internal/catch_enforce.hpp> + +namespace Catch { + namespace Benchmark { + namespace Detail { + struct optimized_away_error : std::exception { + const char* what() const noexcept override; + }; + + const char* optimized_away_error::what() const noexcept { + return "could not measure benchmark, maybe it was optimized away"; + } + + void throw_optimized_away_error() { + Catch::throw_exception(optimized_away_error{}); + } + + } // namespace Detail + } // namespace Benchmark +} // namespace Catch diff --git a/packages/Catch2/src/catch2/catch_all.hpp b/packages/Catch2/src/catch2/catch_all.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3bd6d9c85e16d134703c3775f549c7cede6db314 --- /dev/null +++ b/packages/Catch2/src/catch2/catch_all.hpp @@ -0,0 +1,110 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +/** \file + * This is a convenience header for Catch2. It includes **all** of Catch2 headers. + * + * Generally the Catch2 users should use specific includes they need, + * but this header can be used instead for ease-of-experimentation, or + * just plain convenience, at the cost of (significantly) increased + * compilation times. + * + * When a new header is added to either the top level folder, or to the + * corresponding internal subfolder, it should be added here. Headers + * added to the various subparts (e.g. matchers, generators, etc...), + * should go their respective catch-all headers. + */ + +#ifndef CATCH_ALL_HPP_INCLUDED +#define CATCH_ALL_HPP_INCLUDED + +#include <catch2/benchmark/catch_benchmark_all.hpp> +#include <catch2/catch_approx.hpp> +#include <catch2/catch_assertion_info.hpp> +#include <catch2/catch_assertion_result.hpp> +#include <catch2/catch_config.hpp> +#include <catch2/catch_message.hpp> +#include <catch2/catch_reporter_registrars.hpp> +#include <catch2/catch_section_info.hpp> +#include <catch2/catch_session.hpp> +#include <catch2/catch_tag_alias.hpp> +#include <catch2/catch_tag_alias_autoregistrar.hpp> +#include <catch2/catch_template_test_macros.hpp> +#include <catch2/catch_test_case_info.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/catch_test_spec.hpp> +#include <catch2/catch_timer.hpp> +#include <catch2/catch_tostring.hpp> +#include <catch2/catch_totals.hpp> +#include <catch2/catch_translate_exception.hpp> +#include <catch2/catch_version.hpp> +#include <catch2/catch_version_macros.hpp> +#include <catch2/generators/catch_generators_all.hpp> +#include <catch2/interfaces/catch_interfaces_all.hpp> +#include <catch2/internal/catch_assertion_handler.hpp> +#include <catch2/internal/catch_case_sensitive.hpp> +#include <catch2/internal/catch_clara.hpp> +#include <catch2/internal/catch_commandline.hpp> +#include <catch2/internal/catch_compiler_capabilities.hpp> +#include <catch2/internal/catch_config_android_logwrite.hpp> +#include <catch2/internal/catch_config_counter.hpp> +#include <catch2/internal/catch_config_uncaught_exceptions.hpp> +#include <catch2/internal/catch_config_wchar.hpp> +#include <catch2/internal/catch_console_colour.hpp> +#include <catch2/internal/catch_console_width.hpp> +#include <catch2/internal/catch_container_nonmembers.hpp> +#include <catch2/internal/catch_context.hpp> +#include <catch2/internal/catch_debug_console.hpp> +#include <catch2/internal/catch_debugger.hpp> +#include <catch2/internal/catch_decomposer.hpp> +#include <catch2/internal/catch_enforce.hpp> +#include <catch2/internal/catch_enum_values_registry.hpp> +#include <catch2/internal/catch_errno_guard.hpp> +#include <catch2/internal/catch_exception_translator_registry.hpp> +#include <catch2/internal/catch_fatal_condition_handler.hpp> +#include <catch2/internal/catch_lazy_expr.hpp> +#include <catch2/internal/catch_leak_detector.hpp> +#include <catch2/internal/catch_list.hpp> +#include <catch2/internal/catch_message_info.hpp> +#include <catch2/internal/catch_meta.hpp> +#include <catch2/internal/catch_noncopyable.hpp> +#include <catch2/internal/catch_option.hpp> +#include <catch2/internal/catch_output_redirect.hpp> +#include <catch2/internal/catch_platform.hpp> +#include <catch2/internal/catch_polyfills.hpp> +#include <catch2/internal/catch_preprocessor.hpp> +#include <catch2/internal/catch_random_number_generator.hpp> +#include <catch2/internal/catch_reporter_registry.hpp> +#include <catch2/internal/catch_result_type.hpp> +#include <catch2/internal/catch_run_context.hpp> +#include <catch2/internal/catch_section.hpp> +#include <catch2/internal/catch_singletons.hpp> +#include <catch2/internal/catch_source_line_info.hpp> +#include <catch2/internal/catch_startup_exception_registry.hpp> +#include <catch2/internal/catch_stream.hpp> +#include <catch2/internal/catch_stream_end_stop.hpp> +#include <catch2/internal/catch_string_manip.hpp> +#include <catch2/internal/catch_stringref.hpp> +#include <catch2/internal/catch_tag_alias_registry.hpp> +#include <catch2/internal/catch_template_test_registry.hpp> +#include <catch2/internal/catch_test_case_registry_impl.hpp> +#include <catch2/internal/catch_test_case_tracker.hpp> +#include <catch2/internal/catch_test_failure_exception.hpp> +#include <catch2/internal/catch_test_macro_impl.hpp> +#include <catch2/internal/catch_test_registry.hpp> +#include <catch2/internal/catch_test_spec_parser.hpp> +#include <catch2/internal/catch_textflow.hpp> +#include <catch2/internal/catch_to_string.hpp> +#include <catch2/internal/catch_uncaught_exceptions.hpp> +#include <catch2/internal/catch_unique_ptr.hpp> +#include <catch2/internal/catch_wildcard_pattern.hpp> +#include <catch2/internal/catch_windows_h_proxy.hpp> +#include <catch2/internal/catch_xmlwriter.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> +#include <catch2/reporters/catch_reporters_all.hpp> + +#endif // CATCH_ALL_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/catch_approx.cpp b/packages/Catch2/src/catch2/catch_approx.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3dfebf46601426fb41f602c6e9dfc7e7deb4598b --- /dev/null +++ b/packages/Catch2/src/catch2/catch_approx.cpp @@ -0,0 +1,84 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/catch_approx.hpp> +#include <catch2/internal/catch_enforce.hpp> + +#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 { + + 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 ); + } + + Approx Approx::operator-() const { + auto temp(*this); + temp.m_value = -temp.m_value; + return temp; + } + + + 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(std::isinf(m_value)? 0 : m_value))); + } + + void Approx::setMargin(double newMargin) { + CATCH_ENFORCE(newMargin >= 0, + "Invalid Approx::margin: " << newMargin << '.' + << " Approx::Margin has to be non-negative."); + m_margin = newMargin; + } + + void Approx::setEpsilon(double newEpsilon) { + CATCH_ENFORCE(newEpsilon >= 0 && newEpsilon <= 1.0, + "Invalid Approx::epsilon: " << newEpsilon << '.' + << " Approx::epsilon has to be in [0, 1]"); + m_epsilon = newEpsilon; + } + +namespace literals { + Approx operator "" _a(long double val) { + return Approx(val); + } + Approx operator "" _a(unsigned long long val) { + return Approx(val); + } +} // end namespace literals + +std::string StringMaker<Catch::Approx>::convert(Catch::Approx const& value) { + return value.toString(); +} + +} // end namespace Catch diff --git a/packages/Catch2/src/catch2/catch_approx.hpp b/packages/Catch2/src/catch2/catch_approx.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7483349477913e77663a96a97b1042408acf7383 --- /dev/null +++ b/packages/Catch2/src/catch2/catch_approx.hpp @@ -0,0 +1,128 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_APPROX_HPP_INCLUDED +#define CATCH_APPROX_HPP_INCLUDED + +#include <catch2/catch_tostring.hpp> + +#include <type_traits> + +namespace Catch { + + class Approx { + private: + bool equalityComparisonImpl(double other) const; + // Sets and validates the new margin (margin >= 0) + void setMargin(double margin); + // Sets and validates the new epsilon (0 < epsilon < 1) + void setEpsilon(double epsilon); + + public: + explicit Approx ( double value ); + + static Approx custom(); + + Approx operator-() const; + + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> + Approx operator()( T const& value ) { + Approx approx( static_cast<double>(value) ); + approx.m_epsilon = m_epsilon; + approx.m_margin = m_margin; + approx.m_scale = m_scale; + return approx; + } + + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> + explicit Approx( T const& value ): Approx(static_cast<double>(value)) + {} + + + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> + 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 = std::enable_if_t<std::is_constructible<double, T>::value>> + friend bool operator == ( Approx const& lhs, const T& rhs ) { + return operator==( rhs, lhs ); + } + + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> + friend bool operator != ( T const& lhs, Approx const& rhs ) { + return !operator==( lhs, rhs ); + } + + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> + friend bool operator != ( Approx const& lhs, T const& rhs ) { + return !operator==( rhs, lhs ); + } + + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> + friend bool operator <= ( T const& lhs, Approx const& rhs ) { + return static_cast<double>(lhs) < rhs.m_value || lhs == rhs; + } + + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> + friend bool operator <= ( Approx const& lhs, T const& rhs ) { + return lhs.m_value < static_cast<double>(rhs) || lhs == rhs; + } + + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> + friend bool operator >= ( T const& lhs, Approx const& rhs ) { + return static_cast<double>(lhs) > rhs.m_value || lhs == rhs; + } + + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> + friend bool operator >= ( Approx const& lhs, T const& rhs ) { + return lhs.m_value > static_cast<double>(rhs) || lhs == rhs; + } + + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> + Approx& epsilon( T const& newEpsilon ) { + double epsilonAsDouble = static_cast<double>(newEpsilon); + setEpsilon(epsilonAsDouble); + return *this; + } + + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> + Approx& margin( T const& newMargin ) { + double marginAsDouble = static_cast<double>(newMargin); + setMargin(marginAsDouble); + return *this; + } + + template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> + 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; + }; + +namespace literals { + Approx operator "" _a(long double val); + Approx operator "" _a(unsigned long long val); +} // end namespace literals + +template<> +struct StringMaker<Catch::Approx> { + static std::string convert(Catch::Approx const& value); +}; + +} // end namespace Catch + +#endif // CATCH_APPROX_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/catch_assertion_info.hpp b/packages/Catch2/src/catch2/catch_assertion_info.hpp new file mode 100644 index 0000000000000000000000000000000000000000..516c324c5c9720edf7c051470ecb2c2fae666e80 --- /dev/null +++ b/packages/Catch2/src/catch2/catch_assertion_info.hpp @@ -0,0 +1,28 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_ASSERTION_INFO_HPP_INCLUDED +#define CATCH_ASSERTION_INFO_HPP_INCLUDED + +#include <catch2/internal/catch_result_type.hpp> +#include <catch2/internal/catch_source_line_info.hpp> +#include <catch2/internal/catch_stringref.hpp> + +namespace Catch { + + struct AssertionInfo { + // AssertionInfo() = delete; + + StringRef macroName; + SourceLineInfo lineInfo; + StringRef capturedExpression; + ResultDisposition::Flags resultDisposition; + }; + +} // end namespace Catch + +#endif // CATCH_ASSERTION_INFO_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/catch_assertion_result.cpp b/packages/Catch2/src/catch2/catch_assertion_result.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4e1609153672edb0f5b1d0e617cb00681c2abc88 --- /dev/null +++ b/packages/Catch2/src/catch2/catch_assertion_result.cpp @@ -0,0 +1,105 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/catch_assertion_result.hpp> +#include <catch2/internal/catch_stream.hpp> + +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.empty(); + } + + bool AssertionResult::hasMessage() const { + return !m_resultData.message.empty(); + } + + std::string AssertionResult::getExpression() const { + // Possibly overallocating by 3 characters should be basically free + std::string expr; expr.reserve(m_info.capturedExpression.size() + 3); + if (isFalseTest(m_info.resultDisposition)) { + expr += "!("; + } + expr += m_info.capturedExpression; + if (isFalseTest(m_info.resultDisposition)) { + expr += ')'; + } + return expr; + } + + std::string AssertionResult::getExpressionInMacro() const { + std::string expr; + if( m_info.macroName.empty() ) + expr = static_cast<std::string>(m_info.capturedExpression); + else { + expr.reserve( m_info.macroName.size() + m_info.capturedExpression.size() + 4 ); + expr += m_info.macroName; + expr += "( "; + expr += m_info.capturedExpression; + 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/packages/Catch2/src/catch2/catch_assertion_result.hpp b/packages/Catch2/src/catch2/catch_assertion_result.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0afb0e02e2eb4daf1b90a270b39e824561b44c08 --- /dev/null +++ b/packages/Catch2/src/catch2/catch_assertion_result.hpp @@ -0,0 +1,60 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_ASSERTION_RESULT_HPP_INCLUDED +#define CATCH_ASSERTION_RESULT_HPP_INCLUDED + +#include <catch2/catch_assertion_info.hpp> +#include <catch2/internal/catch_result_type.hpp> +#include <catch2/internal/catch_source_line_info.hpp> +#include <catch2/internal/catch_stringref.hpp> +#include <catch2/internal/catch_lazy_expr.hpp> + +#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 + +#endif // CATCH_ASSERTION_RESULT_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/catch_config.cpp b/packages/Catch2/src/catch2/catch_config.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7a4a0bdaed38628e8ecca2281e87b455d723244c --- /dev/null +++ b/packages/Catch2/src/catch2/catch_config.cpp @@ -0,0 +1,93 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/catch_config.hpp> +#include <catch2/internal/catch_enforce.hpp> +#include <catch2/internal/catch_stream.hpp> +#include <catch2/internal/catch_stringref.hpp> +#include <catch2/internal/catch_string_manip.hpp> +#include <catch2/internal/catch_test_spec_parser.hpp> +#include <catch2/interfaces/catch_interfaces_tag_alias_registry.hpp> + + +namespace Catch { + + Config::Config( ConfigData const& data ) + : m_data( data ), + m_stream( openStream() ) + { + // We need to trim filter specs to avoid trouble with superfluous + // whitespace (esp. important for bdd macros, as those are manually + // aligned with whitespace). + + for (auto& elem : m_data.testsOrTags) { + elem = trim(elem); + } + for (auto& elem : m_data.sectionsToRun) { + elem = trim(elem); + } + + TestSpecParser parser(ITagAliasRegistry::get()); + if (!m_data.testsOrTags.empty()) { + m_hasTestFilters = true; + for (auto const& testOrTags : m_data.testsOrTags) { + parser.parse(testOrTags); + } + } + m_testSpec = parser.testSpec(); + } + + Config::~Config() = default; + + + std::string const& Config::getFilename() const { + return m_data.outputFilename ; + } + + bool Config::listTests() const { return m_data.listTests; } + 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::string const& Config::getReporterName() const { return m_data.reporterName; } + + std::vector<std::string> const& Config::getTestsOrTags() const { return m_data.testsOrTags; } + std::vector<std::string> const& Config::getSectionsToRun() const { return m_data.sectionsToRun; } + + TestSpec const& Config::testSpec() const { return m_testSpec; } + bool Config::hasTestFilters() const { return m_hasTestFilters; } + + 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); } + bool Config::warnAboutNoTests() const { return !!(m_data.warnings & WarnAbout::NoTests); } + ShowDurations Config::showDurations() const { return m_data.showDurations; } + double Config::minDuration() const { return m_data.minDuration; } + TestRunOrder Config::runOrder() const { return m_data.runOrder; } + unsigned int Config::rngSeed() const { return m_data.rngSeed; } + UseColour 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; } + + bool Config::benchmarkNoAnalysis() const { return m_data.benchmarkNoAnalysis; } + int Config::benchmarkSamples() const { return m_data.benchmarkSamples; } + double Config::benchmarkConfidenceInterval() const { return m_data.benchmarkConfidenceInterval; } + unsigned int Config::benchmarkResamples() const { return m_data.benchmarkResamples; } + std::chrono::milliseconds Config::benchmarkWarmupTime() const { return std::chrono::milliseconds(m_data.benchmarkWarmupTime); } + + IStream const* Config::openStream() { + return Catch::makeStream(m_data.outputFilename); + } + +} // end namespace Catch diff --git a/packages/Catch2/src/catch2/catch_config.hpp b/packages/Catch2/src/catch2/catch_config.hpp new file mode 100644 index 0000000000000000000000000000000000000000..10d0487a84202388bff1ca262f6b4aa2526714a6 --- /dev/null +++ b/packages/Catch2/src/catch2/catch_config.hpp @@ -0,0 +1,124 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_CONFIG_HPP_INCLUDED +#define CATCH_CONFIG_HPP_INCLUDED + +#include <catch2/catch_test_spec.hpp> +#include <catch2/interfaces/catch_interfaces_config.hpp> +#include <catch2/internal/catch_unique_ptr.hpp> + +#include <vector> +#include <string> + +namespace Catch { + + struct IStream; + + struct ConfigData { + bool listTests = false; + bool listTags = false; + bool listReporters = 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; + + bool benchmarkNoAnalysis = false; + unsigned int benchmarkSamples = 100; + double benchmarkConfidenceInterval = 0.95; + unsigned int benchmarkResamples = 100000; + std::chrono::milliseconds::rep benchmarkWarmupTime = 100; + + Verbosity verbosity = Verbosity::Normal; + WarnAbout::What warnings = WarnAbout::Nothing; + ShowDurations showDurations = ShowDurations::DefaultForReporter; + double minDuration = -1; + TestRunOrder runOrder = TestRunOrder::Declared; + UseColour useColour = UseColour::Auto; + WaitForKeypress::When waitForKeypress = WaitForKeypress::Never; + + std::string outputFilename; + std::string name; + std::string processName; +#ifndef CATCH_CONFIG_DEFAULT_REPORTER +#define CATCH_CONFIG_DEFAULT_REPORTER "console" +#endif + std::string reporterName = CATCH_CONFIG_DEFAULT_REPORTER; +#undef CATCH_CONFIG_DEFAULT_REPORTER + + std::vector<std::string> testsOrTags; + std::vector<std::string> sectionsToRun; + }; + + + class Config : public IConfig { + public: + + Config() = default; + Config( ConfigData const& data ); + ~Config() override; // = default in the cpp file + + std::string const& getFilename() const; + + bool listTests() const; + bool listTags() const; + bool listReporters() const; + + std::string getProcessName() const; + std::string const& getReporterName() const; + + std::vector<std::string> const& getTestsOrTags() const override; + std::vector<std::string> const& getSectionsToRun() const override; + + TestSpec const& testSpec() const override; + bool hasTestFilters() 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; + bool warnAboutNoTests() const override; + ShowDurations showDurations() const override; + double minDuration() const override; + TestRunOrder runOrder() const override; + unsigned int rngSeed() const override; + UseColour useColour() const override; + bool shouldDebugBreak() const override; + int abortAfter() const override; + bool showInvisibles() const override; + Verbosity verbosity() const override; + bool benchmarkNoAnalysis() const override; + int benchmarkSamples() const override; + double benchmarkConfidenceInterval() const override; + unsigned int benchmarkResamples() const override; + std::chrono::milliseconds benchmarkWarmupTime() const override; + + private: + + IStream const* openStream(); + ConfigData m_data; + + Detail::unique_ptr<IStream const> m_stream; + TestSpec m_testSpec; + bool m_hasTestFilters = false; + }; + +} // end namespace Catch + +#endif // CATCH_CONFIG_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/catch_message.cpp b/packages/Catch2/src/catch2/catch_message.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c140c08e1bc6168d7fad0aeebcc522d8dda6df60 --- /dev/null +++ b/packages/Catch2/src/catch2/catch_message.cpp @@ -0,0 +1,118 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/catch_message.hpp> +#include <catch2/interfaces/catch_interfaces_capture.hpp> +#include <catch2/internal/catch_uncaught_exceptions.hpp> +#include <catch2/internal/catch_enforce.hpp> + +#include <cassert> +#include <stack> + +namespace Catch { + + //////////////////////////////////////////////////////////////////////////// + + Catch::MessageBuilder::MessageBuilder( StringRef 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( ScopedMessage&& old ) noexcept: + m_info( std::move( old.m_info ) ) { + old.m_moved = true; + } + + ScopedMessage::~ScopedMessage() { + if ( !uncaught_exceptions() && !m_moved ){ + getResultCapture().popScopedMessage(m_info); + } + } + + + Capturer::Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names ) { + auto trimmed = [&] (size_t start, size_t end) { + while (names[start] == ',' || isspace(static_cast<unsigned char>(names[start]))) { + ++start; + } + while (names[end] == ',' || isspace(static_cast<unsigned char>(names[end]))) { + --end; + } + return names.substr(start, end - start + 1); + }; + auto skipq = [&] (size_t start, char quote) { + for (auto i = start + 1; i < names.size() ; ++i) { + if (names[i] == quote) + return i; + if (names[i] == '\\') + ++i; + } + CATCH_INTERNAL_ERROR("CAPTURE parsing encountered unmatched quote"); + }; + + size_t start = 0; + std::stack<char> openings; + for (size_t pos = 0; pos < names.size(); ++pos) { + char c = names[pos]; + switch (c) { + case '[': + case '{': + case '(': + // It is basically impossible to disambiguate between + // comparison and start of template args in this context +// case '<': + openings.push(c); + break; + case ']': + case '}': + case ')': +// case '>': + openings.pop(); + break; + case '"': + case '\'': + pos = skipq(pos, c); + break; + case ',': + if (start != pos && openings.empty()) { + m_messages.emplace_back(macroName, lineInfo, resultType); + m_messages.back().message = static_cast<std::string>(trimmed(start, pos)); + m_messages.back().message += " := "; + start = pos; + } + } + } + assert(openings.empty() && "Mismatched openings"); + m_messages.emplace_back(macroName, lineInfo, resultType); + m_messages.back().message = static_cast<std::string>(trimmed(start, names.size() - 1)); + m_messages.back().message += " := "; + } + Capturer::~Capturer() { + if ( !uncaught_exceptions() ){ + assert( m_captured == m_messages.size() ); + for( size_t i = 0; i < m_captured; ++i ) + m_resultCapture.popScopedMessage( m_messages[i] ); + } + } + + void Capturer::captureValue( size_t index, std::string const& value ) { + assert( index < m_messages.size() ); + m_messages[index].message += value; + m_resultCapture.pushScopedMessage( m_messages[index] ); + m_captured++; + } + +} // end namespace Catch diff --git a/packages/Catch2/src/catch2/catch_message.hpp b/packages/Catch2/src/catch2/catch_message.hpp new file mode 100644 index 0000000000000000000000000000000000000000..db60b6bf8f385fd9aa2b4ef63e4bbafdc9bc8839 --- /dev/null +++ b/packages/Catch2/src/catch2/catch_message.hpp @@ -0,0 +1,144 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_MESSAGE_HPP_INCLUDED +#define CATCH_MESSAGE_HPP_INCLUDED + +#include <catch2/internal/catch_result_type.hpp> +#include <catch2/internal/catch_stream.hpp> +#include <catch2/internal/catch_stream_end_stop.hpp> +#include <catch2/internal/catch_message_info.hpp> +#include <catch2/interfaces/catch_interfaces_capture.hpp> +#include <catch2/catch_tostring.hpp> + +#include <string> +#include <vector> + +namespace Catch { + + struct SourceLineInfo; + + struct MessageStream { + + template<typename T> + MessageStream& operator << ( T const& value ) { + m_stream << value; + return *this; + } + + ReusableStringStream m_stream; + }; + + struct MessageBuilder : MessageStream { + MessageBuilder( StringRef 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( ScopedMessage& duplicate ) = delete; + ScopedMessage( ScopedMessage&& old ) noexcept; + ~ScopedMessage(); + + MessageInfo m_info; + bool m_moved = false; + }; + + class Capturer { + std::vector<MessageInfo> m_messages; + IResultCapture& m_resultCapture = getResultCapture(); + size_t m_captured = 0; + public: + Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names ); + + Capturer(Capturer const&) = delete; + Capturer& operator=(Capturer const&) = delete; + + ~Capturer(); + + void captureValue( size_t index, std::string const& value ); + + template<typename T> + void captureValues( size_t index, T const& value ) { + captureValue( index, Catch::Detail::stringify( value ) ); + } + + template<typename T, typename... Ts> + void captureValues( size_t index, T const& value, Ts const&... values ) { + captureValue( index, Catch::Detail::stringify(value) ); + captureValues( index+1, values... ); + } + }; + +} // end namespace Catch + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_MSG( macroName, messageType, resultDisposition, ... ) \ + do { \ + Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::StringRef(), resultDisposition ); \ + catchAssertionHandler.handleMessage( messageType, ( Catch::MessageStream() << __VA_ARGS__ + ::Catch::StreamEndStop() ).m_stream.str() ); \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( false ) + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_CAPTURE( varName, macroName, ... ) \ + Catch::Capturer varName( macroName, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info, #__VA_ARGS__ ); \ + varName.captureValues( 0, __VA_ARGS__ ) + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_INFO( macroName, log ) \ + Catch::ScopedMessage INTERNAL_CATCH_UNIQUE_NAME( scopedMessage )( Catch::MessageBuilder( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log ) + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_UNSCOPED_INFO( macroName, log ) \ + Catch::getResultCapture().emplaceUnscopedMessage( Catch::MessageBuilder( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log ) + + +#if defined(CATCH_CONFIG_PREFIX_ALL) && !defined(CATCH_CONFIG_DISABLE) + + #define CATCH_INFO( msg ) INTERNAL_CATCH_INFO( "CATCH_INFO", msg ) + #define CATCH_UNSCOPED_INFO( msg ) INTERNAL_CATCH_UNSCOPED_INFO( "CATCH_UNSCOPED_INFO", msg ) + #define CATCH_WARN( msg ) INTERNAL_CATCH_MSG( "CATCH_WARN", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg ) + #define CATCH_CAPTURE( ... ) INTERNAL_CATCH_CAPTURE( INTERNAL_CATCH_UNIQUE_NAME(capturer), "CATCH_CAPTURE", __VA_ARGS__ ) + +#elif defined(CATCH_CONFIG_PREFIX_ALL) && defined(CATCH_CONFIG_DISABLE) + + #define CATCH_INFO( msg ) (void)(0) + #define CATCH_UNSCOPED_INFO( msg ) (void)(0) + #define CATCH_WARN( msg ) (void)(0) + #define CATCH_CAPTURE( ... ) (void)(0) + +#elif !defined(CATCH_CONFIG_PREFIX_ALL) && !defined(CATCH_CONFIG_DISABLE) + + #define INFO( msg ) INTERNAL_CATCH_INFO( "INFO", msg ) + #define UNSCOPED_INFO( msg ) INTERNAL_CATCH_UNSCOPED_INFO( "UNSCOPED_INFO", msg ) + #define WARN( msg ) INTERNAL_CATCH_MSG( "WARN", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg ) + #define CAPTURE( ... ) INTERNAL_CATCH_CAPTURE( INTERNAL_CATCH_UNIQUE_NAME(capturer), "CAPTURE", __VA_ARGS__ ) + +#elif !defined(CATCH_CONFIG_PREFIX_ALL) && defined(CATCH_CONFIG_DISABLE) + + #define INFO( msg ) (void)(0) + #define UNSCOPED_INFO( msg ) (void)(0) + #define WARN( msg ) (void)(0) + #define CAPTURE( ... ) (void)(0) + +#endif // end of user facing macro declarations + + + + +#endif // CATCH_MESSAGE_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/catch_registry_hub.cpp b/packages/Catch2/src/catch2/catch_registry_hub.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e3a222dfccd4b1e39cda717e4e79e671985a857b --- /dev/null +++ b/packages/Catch2/src/catch2/catch_registry_hub.cpp @@ -0,0 +1,103 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/interfaces/catch_interfaces_registry_hub.hpp> + +#include <catch2/internal/catch_context.hpp> +#include <catch2/internal/catch_enforce.hpp> +#include <catch2/internal/catch_test_case_registry_impl.hpp> +#include <catch2/internal/catch_reporter_registry.hpp> +#include <catch2/internal/catch_exception_translator_registry.hpp> +#include <catch2/internal/catch_tag_alias_registry.hpp> +#include <catch2/internal/catch_startup_exception_registry.hpp> +#include <catch2/internal/catch_singletons.hpp> +#include <catch2/internal/catch_enum_values_registry.hpp> +#include <catch2/catch_test_case_info.hpp> +#include <catch2/internal/catch_noncopyable.hpp> +#include <catch2/interfaces/catch_interfaces_reporter_factory.hpp> + +namespace Catch { + + namespace { + + class RegistryHub : public IRegistryHub, + public IMutableRegistryHub, + private Detail::NonCopyable { + + public: // IRegistryHub + RegistryHub() = default; + IReporterRegistry const& getReporterRegistry() const override { + return m_reporterRegistry; + } + ITestCaseRegistry const& getTestCaseRegistry() const override { + return m_testCaseRegistry; + } + IExceptionTranslatorRegistry const& getExceptionTranslatorRegistry() const 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 factory ) override { + m_reporterRegistry.registerReporter( name, std::move(factory) ); + } + void registerListener( IReporterFactoryPtr factory ) override { + m_reporterRegistry.registerListener( std::move(factory) ); + } + void registerTest( Detail::unique_ptr<TestCaseInfo>&& testInfo, Detail::unique_ptr<ITestInvoker>&& invoker ) override { + m_testCaseRegistry.registerTest( std::move(testInfo), std::move(invoker) ); + } + 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 { +#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + m_exceptionRegistry.add(std::current_exception()); +#else + CATCH_INTERNAL_ERROR("Attempted to register active exception under CATCH_CONFIG_DISABLE_EXCEPTIONS!"); +#endif + } + IMutableEnumValuesRegistry& getMutableEnumValuesRegistry() override { + return m_enumValuesRegistry; + } + + private: + TestRegistry m_testCaseRegistry; + ReporterRegistry m_reporterRegistry; + ExceptionTranslatorRegistry m_exceptionTranslatorRegistry; + TagAliasRegistry m_tagAliasRegistry; + StartupExceptionRegistry m_exceptionRegistry; + Detail::EnumValuesRegistry m_enumValuesRegistry; + }; + } + + using RegistryHubSingleton = Singleton<RegistryHub, IRegistryHub, IMutableRegistryHub>; + + IRegistryHub const& getRegistryHub() { + return RegistryHubSingleton::get(); + } + IMutableRegistryHub& getMutableRegistryHub() { + return RegistryHubSingleton::getMutable(); + } + void cleanUp() { + cleanupSingletons(); + cleanUpContext(); + } + std::string translateActiveException() { + return getRegistryHub().getExceptionTranslatorRegistry().translateActiveException(); + } + + +} // end namespace Catch diff --git a/packages/Catch2/src/catch2/catch_reporter_registrars.hpp b/packages/Catch2/src/catch2/catch_reporter_registrars.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e7375aa7b67bdb30326cd135722e425aee220f40 --- /dev/null +++ b/packages/Catch2/src/catch2/catch_reporter_registrars.hpp @@ -0,0 +1,79 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_REPORTER_REGISTRARS_HPP_INCLUDED +#define CATCH_REPORTER_REGISTRARS_HPP_INCLUDED + +#include <catch2/interfaces/catch_interfaces_registry_hub.hpp> +#include <catch2/interfaces/catch_interfaces_reporter_factory.hpp> +#include <catch2/internal/catch_unique_ptr.hpp> + +namespace Catch { + + template <typename T> + class ReporterFactory : public IReporterFactory { + + IStreamingReporterPtr create( ReporterConfig const& config ) const override { + return Detail::make_unique<T>( config ); + } + + std::string getDescription() const override { + return T::getDescription(); + } + }; + + + template<typename T> + class ReporterRegistrar { + public: + explicit ReporterRegistrar( std::string const& name ) { + getMutableRegistryHub().registerReporter( name, Detail::make_unique<ReporterFactory<T>>() ); + } + }; + + template<typename T> + class ListenerRegistrar { + + class ListenerFactory : public IReporterFactory { + + IStreamingReporterPtr create( ReporterConfig const& config ) const override { + return Detail::make_unique<T>(config); + } + std::string getDescription() const override { + return std::string(); + } + }; + + public: + + ListenerRegistrar() { + getMutableRegistryHub().registerListener( Detail::make_unique<ListenerFactory>() ); + } + }; +} + +#if !defined(CATCH_CONFIG_DISABLE) + +#define CATCH_REGISTER_REPORTER( name, reporterType ) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::ReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name ); } \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION + +#define CATCH_REGISTER_LISTENER( listenerType ) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::ListenerRegistrar<listenerType> catch_internal_RegistrarFor##listenerType; } \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION +#else // CATCH_CONFIG_DISABLE + +#define CATCH_REGISTER_REPORTER(name, reporterType) +#define CATCH_REGISTER_LISTENER(listenerType) + +#endif // CATCH_CONFIG_DISABLE + +#endif // CATCH_REPORTER_REGISTRARS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/catch_section_info.hpp b/packages/Catch2/src/catch2/catch_section_info.hpp new file mode 100644 index 0000000000000000000000000000000000000000..df0732ec35400228e6bd2298a9f4b9895161afc3 --- /dev/null +++ b/packages/Catch2/src/catch2/catch_section_info.hpp @@ -0,0 +1,41 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_SECTION_INFO_HPP_INCLUDED +#define CATCH_SECTION_INFO_HPP_INCLUDED + +#include <catch2/internal/catch_source_line_info.hpp> +#include <catch2/internal/catch_stringref.hpp> +#include <catch2/catch_totals.hpp> + +#include <string> + +namespace Catch { + + struct SectionInfo { + // The last argument is ignored, so that people can write + // SECTION("ShortName", "Proper description that is long") and + // still use the `-c` flag comfortably. + SectionInfo( SourceLineInfo const& _lineInfo, std::string _name, + const char* const = nullptr ): + name(std::move(_name)), + lineInfo(_lineInfo) + {} + + std::string name; + SourceLineInfo lineInfo; + }; + + struct SectionEndInfo { + SectionInfo sectionInfo; + Counts prevAssertions; + double durationInSeconds; + }; + +} // end namespace Catch + +#endif // CATCH_SECTION_INFO_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/catch_session.cpp b/packages/Catch2/src/catch2/catch_session.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5b1a50a9298e7a7ac871866f5e9f6fc4563ceb45 --- /dev/null +++ b/packages/Catch2/src/catch2/catch_session.cpp @@ -0,0 +1,305 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/catch_session.hpp> +#include <catch2/internal/catch_console_colour.hpp> +#include <catch2/internal/catch_enforce.hpp> +#include <catch2/internal/catch_list.hpp> +#include <catch2/internal/catch_context.hpp> +#include <catch2/internal/catch_run_context.hpp> +#include <catch2/internal/catch_stream.hpp> +#include <catch2/catch_test_spec.hpp> +#include <catch2/catch_version.hpp> +#include <catch2/interfaces/catch_interfaces_reporter.hpp> +#include <catch2/internal/catch_startup_exception_registry.hpp> +#include <catch2/internal/catch_textflow.hpp> +#include <catch2/internal/catch_windows_h_proxy.hpp> +#include <catch2/reporters/catch_reporter_listening.hpp> +#include <catch2/interfaces/catch_interfaces_reporter_registry.hpp> +#include <catch2/interfaces/catch_interfaces_reporter_factory.hpp> + +#include <algorithm> +#include <iomanip> +#include <set> + +namespace Catch { + + namespace { + const int MaxExitCode = 255; + + IStreamingReporterPtr createReporter(std::string const& reporterName, IConfig const* config) { + auto reporter = Catch::getRegistryHub().getReporterRegistry().create(reporterName, config); + CATCH_ENFORCE(reporter, "No reporter registered with name: '" << reporterName << "'"); + + return reporter; + } + + IStreamingReporterPtr makeReporter(Config const* config) { + if (Catch::getRegistryHub().getReporterRegistry().getListeners().empty()) { + return createReporter(config->getReporterName(), config); + } + + // On older platforms, returning unique_ptr<ListeningReporter> + // when the return type is unique_ptr<IStreamingReporter> + // doesn't compile without a std::move call. However, this causes + // a warning on newer platforms. Thus, we have to work around + // it a bit and downcast the pointer manually. + auto ret = Detail::unique_ptr<IStreamingReporter>(new ListeningReporter(config)); + auto& multi = static_cast<ListeningReporter&>(*ret); + auto const& listeners = Catch::getRegistryHub().getReporterRegistry().getListeners(); + for (auto const& listener : listeners) { + multi.addListener(listener->create(Catch::ReporterConfig(config))); + } + multi.addReporter(createReporter(config->getReporterName(), config)); + return ret; + } + + class TestGroup { + public: + explicit TestGroup(IStreamingReporterPtr&& reporter, Config const* config): + m_reporter(reporter.get()), + m_config{config}, + m_context{config, std::move(reporter)} { + + auto const& allTestCases = getAllTestCasesSorted(*m_config); + m_matches = m_config->testSpec().matchesByFilter(allTestCases, *m_config); + auto const& invalidArgs = m_config->testSpec().getInvalidArgs(); + + if (m_matches.empty() && invalidArgs.empty()) { + for (auto const& test : allTestCases) + if (!test.getTestCaseInfo().isHidden()) + m_tests.emplace(&test); + } else { + for (auto const& match : m_matches) + m_tests.insert(match.tests.begin(), match.tests.end()); + } + } + + Totals execute() { + auto const& invalidArgs = m_config->testSpec().getInvalidArgs(); + Totals totals; + m_context.testGroupStarting(m_config->name(), 1, 1); + for (auto const& testCase : m_tests) { + if (!m_context.aborting()) + totals += m_context.runTest(*testCase); + else + m_reporter->skipTest(testCase->getTestCaseInfo()); + } + + for (auto const& match : m_matches) { + if (match.tests.empty()) { + m_reporter->noMatchingTestCases(match.name); + totals.error = -1; + } + } + + if (!invalidArgs.empty()) { + for (auto const& invalidArg: invalidArgs) + m_reporter->reportInvalidArguments(invalidArg); + } + + m_context.testGroupEnded(m_config->name(), totals, 1, 1); + return totals; + } + + private: + using Tests = std::set<TestCaseHandle const*>; + + IStreamingReporter* m_reporter; + Config const* m_config; + RunContext m_context; + Tests m_tests; + TestSpec::Matches m_matches; + }; + + void applyFilenamesAsTags() { + for (auto const& testInfo : getRegistryHub().getTestCaseRegistry().getAllInfos()) { + testInfo->addFilenameTag(); + } + } + + } // anon namespace + + Session::Session() { + static bool alreadyInstantiated = false; + if( alreadyInstantiated ) { + CATCH_TRY { CATCH_INTERNAL_ERROR( "Only one instance of Catch::Session can ever be used" ); } + CATCH_CATCH_ALL { getMutableRegistryHub().registerStartupException(); } + } + + // There cannot be exceptions at startup in no-exception mode. +#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + const auto& exceptions = getRegistryHub().getStartupExceptionRegistry().getExceptions(); + if ( !exceptions.empty() ) { + config(); + getCurrentMutableContext().setConfig(m_config.get()); + + m_startupExceptions = true; + Colour colourGuard( Colour::Red ); + Catch::cerr() << "Errors occurred 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() << TextFlow::Column( ex.what() ).indent(2) << '\n'; + } + } + } +#endif + + 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 Catch2 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 const * const * argv ) { + if( m_startupExceptions ) + return 1; + + auto result = m_cli.parse( Clara::Args( argc, argv ) ); + if( !result ) { + config(); + getCurrentMutableContext().setConfig(m_config.get()); + Catch::cerr() + << Colour( Colour::Red ) + << "\nError(s) in input:\n" + << TextFlow::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; + } + +#if defined(CATCH_CONFIG_WCHAR) && defined(_WIN32) && defined(UNICODE) + int Session::applyCommandLine( int argc, wchar_t const * const * argv ) { + + char **utf8Argv = new char *[ argc ]; + + for ( int i = 0; i < argc; ++i ) { + int bufSize = WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, nullptr, 0, nullptr, nullptr ); + + utf8Argv[ i ] = new char[ bufSize ]; + + WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, utf8Argv[i], bufSize, nullptr, nullptr ); + } + + int returnCode = applyCommandLine( argc, utf8Argv ); + + for ( int i = 0; i < argc; ++i ) + delete [] utf8Argv[ i ]; + + delete [] utf8Argv; + + return returnCode; + } +#endif + + void Session::useConfigData( ConfigData const& configData ) { + m_configData = configData; + m_config.reset(); + } + + 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 = Detail::make_unique<Config>( m_configData ); + return *m_config; + } + + int Session::runInternal() { + if( m_startupExceptions ) + return 1; + + if (m_configData.showHelp || m_configData.libIdentify) { + return 0; + } + + CATCH_TRY { + config(); // Force config to be constructed + + seedRng( *m_config ); + + if (m_configData.filenamesAsTags) { + applyFilenamesAsTags(); + } + + // Set up global config instance before we start calling into other functions + getCurrentMutableContext().setConfig(m_config.get()); + + // Create reporter(s) so we can route listings through them + auto reporter = makeReporter(m_config.get()); + + // Handle list request + if (list(*reporter, *m_config)) { + return 0; + } + + TestGroup tests { std::move(reporter), m_config.get() }; + auto const totals = tests.execute(); + + if( m_config->warnAboutNoTests() && totals.error == -1 ) + return 2; + + // 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, (std::max) (totals.error, static_cast<int>(totals.assertions.failed))); + } +#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + catch( std::exception& ex ) { + Catch::cerr() << ex.what() << std::endl; + return MaxExitCode; + } +#endif + } + +} // end namespace Catch diff --git a/packages/Catch2/src/catch2/catch_session.hpp b/packages/Catch2/src/catch2/catch_session.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b2d3eb0bce288b7f1857d0a058c76cb27740e0bd --- /dev/null +++ b/packages/Catch2/src/catch2/catch_session.hpp @@ -0,0 +1,62 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_SESSION_HPP_INCLUDED +#define CATCH_SESSION_HPP_INCLUDED + +#include <catch2/internal/catch_commandline.hpp> +#include <catch2/internal/catch_noncopyable.hpp> +#include <catch2/catch_config.hpp> +#include <catch2/internal/catch_unique_ptr.hpp> +#include <catch2/internal/catch_config_wchar.hpp> + +namespace Catch { + + class Session : Detail::NonCopyable { + public: + + Session(); + ~Session(); + + void showHelp() const; + void libIdentify(); + + int applyCommandLine( int argc, char const * const * argv ); + #if defined(CATCH_CONFIG_WCHAR) && defined(_WIN32) && defined(UNICODE) + int applyCommandLine( int argc, wchar_t const * const * argv ); + #endif + + void useConfigData( ConfigData const& configData ); + + template<typename CharT> + int run(int argc, CharT const * const argv[]) { + if (m_startupExceptions) + return 1; + int returnCode = applyCommandLine(argc, argv); + if (returnCode == 0) + returnCode = run(); + return returnCode; + } + + 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; + Detail::unique_ptr<Config> m_config; + bool m_startupExceptions = false; + }; + +} // end namespace Catch + +#endif // CATCH_SESSION_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/catch_tag_alias.hpp b/packages/Catch2/src/catch2/catch_tag_alias.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d566d70cb7025c2931a905830635fa57458cd746 --- /dev/null +++ b/packages/Catch2/src/catch2/catch_tag_alias.hpp @@ -0,0 +1,29 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_TAG_ALIAS_HPP_INCLUDED +#define CATCH_TAG_ALIAS_HPP_INCLUDED + +#include <catch2/internal/catch_source_line_info.hpp> + +#include <string> + +namespace Catch { + + struct TagAlias { + TagAlias(std::string const& _tag, SourceLineInfo _lineInfo): + tag(_tag), + lineInfo(_lineInfo) + {} + + std::string tag; + SourceLineInfo lineInfo; + }; + +} // end namespace Catch + +#endif // CATCH_TAG_ALIAS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/catch_tag_alias_autoregistrar.hpp b/packages/Catch2/src/catch2/catch_tag_alias_autoregistrar.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6b5c2f1c8ad315eaebf314454accf3b794b4106c --- /dev/null +++ b/packages/Catch2/src/catch2/catch_tag_alias_autoregistrar.hpp @@ -0,0 +1,28 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_TAG_ALIAS_AUTOREGISTRAR_HPP_INCLUDED +#define CATCH_TAG_ALIAS_AUTOREGISTRAR_HPP_INCLUDED + +#include <catch2/internal/catch_compiler_capabilities.hpp> +#include <catch2/internal/catch_source_line_info.hpp> + +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_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::RegistrarForTagAliases INTERNAL_CATCH_UNIQUE_NAME( AutoRegisterTagAlias )( alias, spec, CATCH_INTERNAL_LINEINFO ); } \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION + +#endif // CATCH_TAG_ALIAS_AUTOREGISTRAR_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/catch_template_test_macros.hpp b/packages/Catch2/src/catch2/catch_template_test_macros.hpp new file mode 100644 index 0000000000000000000000000000000000000000..66b1bc4de2d51251d52b84c8772256a93c09b50c --- /dev/null +++ b/packages/Catch2/src/catch2/catch_template_test_macros.hpp @@ -0,0 +1,124 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_TEMPLATE_TEST_MACROS_HPP_INCLUDED +#define CATCH_TEMPLATE_TEST_MACROS_HPP_INCLUDED + +// We need this suppression to leak, because it took until GCC 10 +// for the front end to handle local suppression via _Pragma properly +// inside templates (so `TEMPLATE_TEST_CASE` and co). +// **THIS IS DIFFERENT FOR STANDARD TESTS, WHERE GCC 9 IS SUFFICIENT** +#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && __GNUC__ < 10 +#pragma GCC diagnostic ignored "-Wparentheses" +#endif + + +#include <catch2/catch_test_macros.hpp> +#include <catch2/internal/catch_template_test_registry.hpp> +#include <catch2/internal/catch_preprocessor.hpp> + + +#if defined(CATCH_CONFIG_PREFIX_ALL) && !defined(CATCH_CONFIG_DISABLE) + + #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) + #define CATCH_TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG( __VA_ARGS__ ) + #define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) + #define CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) + #define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ ) + #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( __VA_ARGS__ ) + #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ ) + #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) + #define CATCH_TEMPLATE_LIST_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE(__VA_ARGS__) + #define CATCH_TEMPLATE_LIST_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD( className, __VA_ARGS__ ) + #else + #define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) ) + #define CATCH_TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG( __VA_ARGS__ ) ) + #define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) ) + #define CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) ) + #define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ ) ) + #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( __VA_ARGS__ ) ) + #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ ) ) + #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) ) + #define CATCH_TEMPLATE_LIST_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE( __VA_ARGS__ ) ) + #define CATCH_TEMPLATE_LIST_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD( className, __VA_ARGS__ ) ) + #endif + +#elif defined(CATCH_CONFIG_PREFIX_ALL) && defined(CATCH_CONFIG_DISABLE) + + #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__) + #define CATCH_TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(__VA_ARGS__) + #define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(className, __VA_ARGS__) + #define CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(className, __VA_ARGS__ ) + #else + #define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__) ) + #define CATCH_TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(__VA_ARGS__) ) + #define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(className, __VA_ARGS__ ) ) + #define CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(className, __VA_ARGS__ ) ) + #endif + + // When disabled, these can be shared between proper preprocessor and MSVC preprocessor + #define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) + #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) + #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) + #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) + #define CATCH_TEMPLATE_LIST_TEST_CASE( ... ) CATCH_TEMPLATE_TEST_CASE(__VA_ARGS__) + #define CATCH_TEMPLATE_LIST_TEST_CASE_METHOD( className, ... ) CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) + +#elif !defined(CATCH_CONFIG_PREFIX_ALL) && !defined(CATCH_CONFIG_DISABLE) + + #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) + #define TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG( __VA_ARGS__ ) + #define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) + #define TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) + #define TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ ) + #define TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( __VA_ARGS__ ) + #define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ ) + #define TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) + #define TEMPLATE_LIST_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE(__VA_ARGS__) + #define TEMPLATE_LIST_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD( className, __VA_ARGS__ ) + #else + #define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) ) + #define TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG( __VA_ARGS__ ) ) + #define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) ) + #define TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) ) + #define TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ ) ) + #define TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( __VA_ARGS__ ) ) + #define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ ) ) + #define TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) ) + #define TEMPLATE_LIST_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE( __VA_ARGS__ ) ) + #define TEMPLATE_LIST_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD( className, __VA_ARGS__ ) ) + #endif + +#elif !defined(CATCH_CONFIG_PREFIX_ALL) && defined(CATCH_CONFIG_DISABLE) + + #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__) + #define TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(__VA_ARGS__) + #define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(className, __VA_ARGS__) + #define TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(className, __VA_ARGS__ ) + #else + #define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__) ) + #define TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(__VA_ARGS__) ) + #define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(className, __VA_ARGS__ ) ) + #define TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(className, __VA_ARGS__ ) ) + #endif + + // When disabled, these can be shared between proper preprocessor and MSVC preprocessor + #define TEMPLATE_PRODUCT_TEST_CASE( ... ) TEMPLATE_TEST_CASE( __VA_ARGS__ ) + #define TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) TEMPLATE_TEST_CASE( __VA_ARGS__ ) + #define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) + #define TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) + #define TEMPLATE_LIST_TEST_CASE( ... ) TEMPLATE_TEST_CASE(__VA_ARGS__) + #define TEMPLATE_LIST_TEST_CASE_METHOD( className, ... ) TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) + +#endif // end of user facing macro declarations + + +#endif // CATCH_TEMPLATE_TEST_MACROS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/catch_test_case_info.cpp b/packages/Catch2/src/catch2/catch_test_case_info.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e8029e9c23a29040144a9d09d02c70bb9167cfe7 --- /dev/null +++ b/packages/Catch2/src/catch2/catch_test_case_info.cpp @@ -0,0 +1,245 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/catch_test_case_info.hpp> +#include <catch2/internal/catch_enforce.hpp> +#include <catch2/catch_test_spec.hpp> +#include <catch2/interfaces/catch_interfaces_testcase.hpp> +#include <catch2/internal/catch_string_manip.hpp> + +#include <cassert> +#include <cctype> +#include <algorithm> + +namespace Catch { + + namespace { + using TCP_underlying_type = uint8_t; + static_assert(sizeof(TestCaseProperties) == sizeof(TCP_underlying_type), + "The size of the TestCaseProperties is different from the assumed size"); + + TestCaseProperties operator|(TestCaseProperties lhs, TestCaseProperties rhs) { + return static_cast<TestCaseProperties>( + static_cast<TCP_underlying_type>(lhs) | static_cast<TCP_underlying_type>(rhs) + ); + } + + TestCaseProperties& operator|=(TestCaseProperties& lhs, TestCaseProperties rhs) { + lhs = static_cast<TestCaseProperties>( + static_cast<TCP_underlying_type>(lhs) | static_cast<TCP_underlying_type>(rhs) + ); + return lhs; + } + + TestCaseProperties operator&(TestCaseProperties lhs, TestCaseProperties rhs) { + return static_cast<TestCaseProperties>( + static_cast<TCP_underlying_type>(lhs) & static_cast<TCP_underlying_type>(rhs) + ); + } + + bool applies(TestCaseProperties tcp) { + static_assert(static_cast<TCP_underlying_type>(TestCaseProperties::None) == 0, + "TestCaseProperties::None must be equal to 0"); + return tcp != TestCaseProperties::None; + } + + TestCaseProperties parseSpecialTag( StringRef tag ) { + if( !tag.empty() && tag[0] == '.' ) + return TestCaseProperties::IsHidden; + else if( tag == "!throws"_sr ) + return TestCaseProperties::Throws; + else if( tag == "!shouldfail"_sr ) + return TestCaseProperties::ShouldFail; + else if( tag == "!mayfail"_sr ) + return TestCaseProperties::MayFail; + else if( tag == "!nonportable"_sr ) + return TestCaseProperties::NonPortable; + else if( tag == "!benchmark"_sr ) + return static_cast<TestCaseProperties>(TestCaseProperties::Benchmark | TestCaseProperties::IsHidden ); + else + return TestCaseProperties::None; + } + bool isReservedTag( StringRef tag ) { + return parseSpecialTag( tag ) == TestCaseProperties::None + && tag.size() > 0 + && !std::isalnum( static_cast<unsigned char>(tag[0]) ); + } + void enforceNotReservedTag( StringRef tag, SourceLineInfo const& _lineInfo ) { + CATCH_ENFORCE( !isReservedTag(tag), + "Tag name: [" << tag << "] is not allowed.\n" + << "Tag names starting with non alphanumeric characters are reserved\n" + << _lineInfo ); + } + + std::string makeDefaultName() { + static size_t counter = 0; + return "Anonymous test case " + std::to_string(++counter); + } + + StringRef extractFilenamePart(StringRef filename) { + size_t lastDot = filename.size(); + while (lastDot > 0 && filename[lastDot - 1] != '.') { + --lastDot; + } + --lastDot; + + size_t nameStart = lastDot; + while (nameStart > 0 && filename[nameStart - 1] != '/' && filename[nameStart - 1] != '\\') { + --nameStart; + } + + return filename.substr(nameStart, lastDot - nameStart); + } + + // Returns the upper bound on size of extra tags ([#file]+[.]) + size_t sizeOfExtraTags(StringRef filepath) { + // [.] is 3, [#] is another 3 + const size_t extras = 3 + 3; + return extractFilenamePart(filepath).size() + extras; + } + } + + Detail::unique_ptr<TestCaseInfo> + makeTestCaseInfo(std::string const& _className, + NameAndTags const& nameAndTags, + SourceLineInfo const& _lineInfo ) { + return Detail::unique_ptr<TestCaseInfo>(new TestCaseInfo(_className, nameAndTags, _lineInfo)); + } + + TestCaseInfo::TestCaseInfo(std::string const& _className, + NameAndTags const& _nameAndTags, + SourceLineInfo const& _lineInfo): + name( _nameAndTags.name.empty() ? makeDefaultName() : _nameAndTags.name ), + className( _className ), + lineInfo( _lineInfo ) + { + StringRef originalTags = _nameAndTags.tags; + // We need to reserve enough space to store all of the tags + // (including optional hidden tag and filename tag) + auto requiredSize = originalTags.size() + sizeOfExtraTags(_lineInfo.file); + backingTags.reserve(requiredSize); + backingLCaseTags.reserve(requiredSize); + + // We cannot copy the tags directly, as we need to normalize + // some tags, so that [.foo] is copied as [.][foo]. + size_t tagStart = 0; + size_t tagEnd = 0; + bool inTag = false; + for (size_t idx = 0; idx < originalTags.size(); ++idx) { + auto c = originalTags[idx]; + if (c == '[') { + assert(!inTag); + inTag = true; + tagStart = idx; + } + if (c == ']') { + assert(inTag); + inTag = false; + tagEnd = idx; + assert(tagStart < tagEnd); + + // We need to check the tag for special meanings, copy + // it over to backing storage and actually reference the + // backing storage in the saved tags + StringRef tagStr = originalTags.substr(tagStart+1, tagEnd - tagStart - 1); + enforceNotReservedTag(tagStr, lineInfo); + properties |= parseSpecialTag(tagStr); + // When copying a tag to the backing storage, we need to + // check if it is a merged hide tag, such as [.foo], and + // if it is, we need to handle it as if it was [foo]. + if (tagStr.size() > 1 && tagStr[0] == '.') { + tagStr = tagStr.substr(1, tagStr.size() - 1); + } + // We skip over dealing with the [.] tag, as we will add + // it later unconditionally and then sort and unique all + // the tags. + internalAppendTag(tagStr); + } + (void)inTag; // Silence "set-but-unused" warning in release mode. + } + // Add [.] if relevant + if (isHidden()) { + internalAppendTag("."_sr); + } + + // Sort and prepare tags + toLowerInPlace(backingLCaseTags); + std::sort(begin(tags), end(tags), [](Tag lhs, Tag rhs) { return lhs.lowerCased < rhs.lowerCased; }); + tags.erase(std::unique(begin(tags), end(tags), [](Tag lhs, Tag rhs) {return lhs.lowerCased == rhs.lowerCased; }), + end(tags)); + } + + bool TestCaseInfo::isHidden() const { + return applies( properties & TestCaseProperties::IsHidden ); + } + bool TestCaseInfo::throws() const { + return applies( properties & TestCaseProperties::Throws ); + } + bool TestCaseInfo::okToFail() const { + return applies( properties & (TestCaseProperties::ShouldFail | TestCaseProperties::MayFail ) ); + } + bool TestCaseInfo::expectedToFail() const { + return applies( properties & (TestCaseProperties::ShouldFail) ); + } + + void TestCaseInfo::addFilenameTag() { + std::string combined("#"); + combined += extractFilenamePart(lineInfo.file); + internalAppendTag(combined); + // TBD: Running this over all tags again is inefficient, but + // simple enough. In practice, the overhead is small enough. + toLowerInPlace(backingLCaseTags); + } + + 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.original.size(); + } + ret.reserve(full_size); + for (const auto& tag : tags) { + ret.push_back('['); + ret += tag.original; + ret.push_back(']'); + } + + return ret; + } + + void TestCaseInfo::internalAppendTag(StringRef tagStr) { + backingTags += '['; + const auto backingStart = backingTags.size(); + backingTags += tagStr; + const auto backingEnd = backingTags.size(); + backingTags += ']'; + backingLCaseTags += '['; + // We append the tag to the lower-case backing storage as-is, + // because we will perform the lower casing later, in bulk + backingLCaseTags += tagStr; + backingLCaseTags += ']'; + tags.emplace_back(StringRef(backingTags.c_str() + backingStart, backingEnd - backingStart), + StringRef(backingLCaseTags.c_str() + backingStart, backingEnd - backingStart)); + } + + + bool TestCaseHandle::operator == ( TestCaseHandle const& rhs ) const { + return m_invoker == rhs.m_invoker + && m_info->name == rhs.m_info->name + && m_info->className == rhs.m_info->className; + } + + bool TestCaseHandle::operator < ( TestCaseHandle const& rhs ) const { + return m_info->name < rhs.m_info->name; + } + + TestCaseInfo const& TestCaseHandle::getTestCaseInfo() const { + return *m_info; + } + +} // end namespace Catch diff --git a/packages/Catch2/src/catch2/catch_test_case_info.hpp b/packages/Catch2/src/catch2/catch_test_case_info.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1383f11b9efc732cf4457541273f53fb07818567 --- /dev/null +++ b/packages/Catch2/src/catch2/catch_test_case_info.hpp @@ -0,0 +1,104 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_TEST_CASE_INFO_HPP_INCLUDED +#define CATCH_TEST_CASE_INFO_HPP_INCLUDED + +#include <catch2/internal/catch_source_line_info.hpp> +#include <catch2/internal/catch_noncopyable.hpp> +#include <catch2/internal/catch_stringref.hpp> +#include <catch2/internal/catch_test_registry.hpp> +#include <catch2/internal/catch_unique_ptr.hpp> + + +#include <string> +#include <vector> + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif + +namespace Catch { + + struct Tag { + Tag(StringRef original_, StringRef lowerCased_): + original(original_), lowerCased(lowerCased_) + {} + StringRef original, lowerCased; + }; + + struct ITestInvoker; + + enum class TestCaseProperties : uint8_t { + None = 0, + IsHidden = 1 << 1, + ShouldFail = 1 << 2, + MayFail = 1 << 3, + Throws = 1 << 4, + NonPortable = 1 << 5, + Benchmark = 1 << 6 + }; + + + struct TestCaseInfo : Detail::NonCopyable { + + TestCaseInfo(std::string const& _className, + NameAndTags const& _tags, + SourceLineInfo const& _lineInfo); + + bool isHidden() const; + bool throws() const; + bool okToFail() const; + bool expectedToFail() const; + + // Adds the tag(s) with test's filename (for the -# flag) + void addFilenameTag(); + + + std::string tagsAsString() const; + + std::string name; + std::string className; + private: + std::string backingTags, backingLCaseTags; + // Internally we copy tags to the backing storage and then add + // refs to this storage to the tags vector. + void internalAppendTag(StringRef tagString); + public: + std::vector<Tag> tags; + SourceLineInfo lineInfo; + TestCaseProperties properties = TestCaseProperties::None; + }; + + class TestCaseHandle { + TestCaseInfo* m_info; + ITestInvoker* m_invoker; + public: + TestCaseHandle(TestCaseInfo* info, ITestInvoker* invoker) : + m_info(info), m_invoker(invoker) {} + + void invoke() const { + m_invoker->invoke(); + } + + TestCaseInfo const& getTestCaseInfo() const; + + bool operator== ( TestCaseHandle const& rhs ) const; + bool operator < ( TestCaseHandle const& rhs ) const; + }; + + Detail::unique_ptr<TestCaseInfo> makeTestCaseInfo( std::string const& className, + NameAndTags const& nameAndTags, + SourceLineInfo const& lineInfo ); +} + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +#endif // CATCH_TEST_CASE_INFO_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/catch_test_macros.hpp b/packages/Catch2/src/catch2/catch_test_macros.hpp new file mode 100644 index 0000000000000000000000000000000000000000..dcbe53db9ab8b947a9a76da0074ed91a2876b1fe --- /dev/null +++ b/packages/Catch2/src/catch2/catch_test_macros.hpp @@ -0,0 +1,208 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_TEST_MACROS_HPP_INCLUDED +#define CATCH_TEST_MACROS_HPP_INCLUDED + +#include <catch2/internal/catch_test_macro_impl.hpp> +#include <catch2/catch_message.hpp> +#include <catch2/internal/catch_preprocessor.hpp> +#include <catch2/internal/catch_section.hpp> +#include <catch2/internal/catch_test_registry.hpp> + +// All of our user-facing macros support configuration toggle, that +// forces them to be defined prefixed with CATCH_. We also like to +// support another toggle that can minimize (disable) their implementation. +// Given this, we have 4 different configuration options below + +#if defined(CATCH_CONFIG_PREFIX_ALL) && !defined(CATCH_CONFIG_DISABLE) + + #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_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_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CATCH_CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) + + #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_DYNAMIC_SECTION( ... ) INTERNAL_CATCH_DYNAMIC_SECTION( __VA_ARGS__ ) + #define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ ) + #define CATCH_FAIL_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__ ) + + + #if !defined(CATCH_CONFIG_RUNTIME_STATIC_REQUIRE) + #define CATCH_STATIC_REQUIRE( ... ) static_assert( __VA_ARGS__ , #__VA_ARGS__ ); CATCH_SUCCEED( #__VA_ARGS__ ) + #define CATCH_STATIC_REQUIRE_FALSE( ... ) static_assert( !(__VA_ARGS__), "!(" #__VA_ARGS__ ")" ); CATCH_SUCCEED( #__VA_ARGS__ ) + #else + #define CATCH_STATIC_REQUIRE( ... ) CATCH_REQUIRE( __VA_ARGS__ ) + #define CATCH_STATIC_REQUIRE_FALSE( ... ) CATCH_REQUIRE_FALSE( __VA_ARGS__ ) + #endif + + + // "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 ) INTERNAL_CATCH_DYNAMIC_SECTION( " Given: " << desc ) + #define CATCH_AND_GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( "And given: " << desc ) + #define CATCH_WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " When: " << desc ) + #define CATCH_AND_WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And when: " << desc ) + #define CATCH_THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " Then: " << desc ) + #define CATCH_AND_THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And: " << desc ) + +#elif defined(CATCH_CONFIG_PREFIX_ALL) && defined(CATCH_CONFIG_DISABLE) // ^^ prefixed, implemented | vv prefixed, disabled + + #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_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_NOTHROW( ... ) (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_DYNAMIC_SECTION( ... ) + #define CATCH_FAIL( ... ) (void)(0) + #define CATCH_FAIL_CHECK( ... ) (void)(0) + #define CATCH_SUCCEED( ... ) (void)(0) + + #define CATCH_STATIC_REQUIRE( ... ) (void)(0) + #define CATCH_STATIC_REQUIRE_FALSE( ... ) (void)(0) + + // "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_AND_GIVEN( desc ) + #define CATCH_WHEN( desc ) + #define CATCH_AND_WHEN( desc ) + #define CATCH_THEN( desc ) + #define CATCH_AND_THEN( desc ) + +#elif !defined(CATCH_CONFIG_PREFIX_ALL) && !defined(CATCH_CONFIG_DISABLE) // ^^ prefixed, disabled | vv unprefixed, implemented + + #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_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_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) + + #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 DYNAMIC_SECTION( ... ) INTERNAL_CATCH_DYNAMIC_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__ ) + + + #if !defined(CATCH_CONFIG_RUNTIME_STATIC_REQUIRE) + #define STATIC_REQUIRE( ... ) static_assert( __VA_ARGS__, #__VA_ARGS__ ); SUCCEED( #__VA_ARGS__ ) + #define STATIC_REQUIRE_FALSE( ... ) static_assert( !(__VA_ARGS__), "!(" #__VA_ARGS__ ")" ); SUCCEED( "!(" #__VA_ARGS__ ")" ) + #else + #define STATIC_REQUIRE( ... ) REQUIRE( __VA_ARGS__ ) + #define STATIC_REQUIRE_FALSE( ... ) REQUIRE_FALSE( __VA_ARGS__ ) + #endif + + // "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 ) INTERNAL_CATCH_DYNAMIC_SECTION( " Given: " << desc ) + #define AND_GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( "And given: " << desc ) + #define WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " When: " << desc ) + #define AND_WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And when: " << desc ) + #define THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " Then: " << desc ) + #define AND_THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And: " << desc ) + +#elif !defined(CATCH_CONFIG_PREFIX_ALL) && defined(CATCH_CONFIG_DISABLE) // ^^ unprefixed, implemented | vv unprefixed, disabled + + #define REQUIRE( ... ) (void)(0) + #define REQUIRE_FALSE( ... ) (void)(0) + + #define REQUIRE_THROWS( ... ) (void)(0) + #define REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0) + #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_NOTHROW( ... ) (void)(0) + + #define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), __VA_ARGS__) + #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 DYNAMIC_SECTION( ... ) + #define FAIL( ... ) (void)(0) + #define FAIL_CHECK( ... ) (void)(0) + #define SUCCEED( ... ) (void)(0) + + #define STATIC_REQUIRE( ... ) (void)(0) + #define STATIC_REQUIRE_FALSE( ... ) (void)(0) + + // "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 AND_GIVEN( desc ) + #define WHEN( desc ) + #define AND_WHEN( desc ) + #define THEN( desc ) + #define AND_THEN( desc ) + +#endif // ^^ unprefixed, disabled + +// end of user facing macros + +#endif // CATCH_TEST_MACROS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/catch_test_spec.cpp b/packages/Catch2/src/catch2/catch_test_spec.cpp new file mode 100644 index 0000000000000000000000000000000000000000..df0d570f6e35e16e5cf49556df7a1aac1815e4d1 --- /dev/null +++ b/packages/Catch2/src/catch2/catch_test_spec.cpp @@ -0,0 +1,105 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/catch_test_spec.hpp> +#include <catch2/internal/catch_string_manip.hpp> +#include <catch2/catch_test_case_info.hpp> + +#include <algorithm> +#include <string> +#include <vector> + +namespace Catch { + + TestSpec::Pattern::Pattern( std::string const& name ) + : m_name( name ) + {} + + TestSpec::Pattern::~Pattern() = default; + + std::string const& TestSpec::Pattern::name() const { + return m_name; + } + + + TestSpec::NamePattern::NamePattern( std::string const& name, std::string const& filterString ) + : Pattern( filterString ) + , m_wildcardPattern( toLower( name ), CaseSensitive::No ) + {} + + bool TestSpec::NamePattern::matches( TestCaseInfo const& testCase ) const { + return m_wildcardPattern.matches( testCase.name ); + } + + + TestSpec::TagPattern::TagPattern( std::string const& tag, std::string const& filterString ) + : Pattern( filterString ) + , m_tag( toLower( tag ) ) + {} + + bool TestSpec::TagPattern::matches( TestCaseInfo const& testCase ) const { + return std::find_if(begin(testCase.tags), + end(testCase.tags), + [&](Tag const& tag) { + return tag.lowerCased == m_tag; + }) != end(testCase.tags); + } + + bool TestSpec::Filter::matches( TestCaseInfo const& testCase ) const { + bool should_use = !testCase.isHidden(); + for (auto const& pattern : m_required) { + should_use = true; + if (!pattern->matches(testCase)) { + return false; + } + } + for (auto const& pattern : m_forbidden) { + if (pattern->matches(testCase)) { + return false; + } + } + return should_use; + } + + std::string TestSpec::Filter::name() const { + std::string name; + for (auto const& p : m_required) { + name += p->name(); + } + for (auto const& p : m_forbidden) { + name += p->name(); + } + return name; + } + + + bool TestSpec::hasFilters() const { + return !m_filters.empty(); + } + + bool TestSpec::matches( TestCaseInfo const& testCase ) const { + return std::any_of( m_filters.begin(), m_filters.end(), [&]( Filter const& f ){ return f.matches( testCase ); } ); + } + + TestSpec::Matches TestSpec::matchesByFilter( std::vector<TestCaseHandle> const& testCases, IConfig const& config ) const + { + Matches matches( m_filters.size() ); + std::transform( m_filters.begin(), m_filters.end(), matches.begin(), [&]( Filter const& filter ){ + std::vector<TestCaseHandle const*> currentMatches; + for( auto const& test : testCases ) + if( isThrowSafe( test, config ) && filter.matches( test.getTestCaseInfo() ) ) + currentMatches.emplace_back( &test ); + return FilterMatch{ filter.name(), currentMatches }; + } ); + return matches; + } + + const TestSpec::vectorStrings& TestSpec::getInvalidArgs() const{ + return (m_invalidArgs); + } + +} diff --git a/packages/Catch2/src/catch2/catch_test_spec.hpp b/packages/Catch2/src/catch2/catch_test_spec.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c8804a2cb7b121a7f511801f964d36e4d680276c --- /dev/null +++ b/packages/Catch2/src/catch2/catch_test_spec.hpp @@ -0,0 +1,88 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_TEST_SPEC_HPP_INCLUDED +#define CATCH_TEST_SPEC_HPP_INCLUDED + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif + +#include <catch2/internal/catch_unique_ptr.hpp> +#include <catch2/internal/catch_wildcard_pattern.hpp> + +#include <string> +#include <vector> + +namespace Catch { + + struct IConfig; + struct TestCaseInfo; + class TestCaseHandle; + + class TestSpec { + + class Pattern { + public: + explicit Pattern( std::string const& name ); + virtual ~Pattern(); + virtual bool matches( TestCaseInfo const& testCase ) const = 0; + std::string const& name() const; + private: + std::string const m_name; + }; + + class NamePattern : public Pattern { + public: + explicit NamePattern( std::string const& name, std::string const& filterString ); + bool matches( TestCaseInfo const& testCase ) const override; + private: + WildcardPattern m_wildcardPattern; + }; + + class TagPattern : public Pattern { + public: + explicit TagPattern( std::string const& tag, std::string const& filterString ); + bool matches( TestCaseInfo const& testCase ) const override; + private: + std::string m_tag; + }; + + struct Filter { + std::vector<Detail::unique_ptr<Pattern>> m_required; + std::vector<Detail::unique_ptr<Pattern>> m_forbidden; + + bool matches( TestCaseInfo const& testCase ) const; + std::string name() const; + }; + + public: + struct FilterMatch { + std::string name; + std::vector<TestCaseHandle const*> tests; + }; + using Matches = std::vector<FilterMatch>; + using vectorStrings = std::vector<std::string>; + + bool hasFilters() const; + bool matches( TestCaseInfo const& testCase ) const; + Matches matchesByFilter( std::vector<TestCaseHandle> const& testCases, IConfig const& config ) const; + const vectorStrings & getInvalidArgs() const; + + private: + std::vector<Filter> m_filters; + std::vector<std::string> m_invalidArgs; + friend class TestSpecParser; + }; +} + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +#endif // CATCH_TEST_SPEC_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/catch_timer.cpp b/packages/Catch2/src/catch2/catch_timer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..659292dd1b7e4e63b13afb575dbeb9aa2ff9a6a4 --- /dev/null +++ b/packages/Catch2/src/catch2/catch_timer.cpp @@ -0,0 +1,73 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/catch_timer.hpp> + +#include <chrono> + +static const uint64_t nanosecondsInSecond = 1000000000; + +namespace Catch { + + auto getCurrentNanosecondsSinceEpoch() -> uint64_t { + return std::chrono::duration_cast<std::chrono::nanoseconds>( std::chrono::high_resolution_clock::now().time_since_epoch() ).count(); + } + + namespace { + auto estimateClockResolution() -> uint64_t { + uint64_t sum = 0; + static const uint64_t iterations = 1000000; + + auto startTime = getCurrentNanosecondsSinceEpoch(); + + 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; + + // If we have been calibrating for over 3 seconds -- the clock + // is terrible and we should move on. + // TBD: How to signal that the measured resolution is probably wrong? + if (ticks > startTime + 3 * nanosecondsInSecond) { + return sum / ( i + 1u ); + } + } + + // 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/packages/Catch2/src/catch2/catch_timer.hpp b/packages/Catch2/src/catch2/catch_timer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..03bbf497177392cbb2b071135d1460df5a971af3 --- /dev/null +++ b/packages/Catch2/src/catch2/catch_timer.hpp @@ -0,0 +1,30 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_TIMER_HPP_INCLUDED +#define CATCH_TIMER_HPP_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 // CATCH_TIMER_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/catch_tostring.cpp b/packages/Catch2/src/catch2/catch_tostring.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8b0ffe01b577bbf83f8daf6a99b084c26d6320eb --- /dev/null +++ b/packages/Catch2/src/catch2/catch_tostring.cpp @@ -0,0 +1,244 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wexit-time-destructors" +# pragma clang diagnostic ignored "-Wglobal-constructors" +#endif + + +#include <catch2/catch_tostring.hpp> +#include <catch2/interfaces/catch_interfaces_config.hpp> +#include <catch2/internal/catch_context.hpp> +#include <catch2/internal/catch_polyfills.hpp> + +#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() { + int one = 1; + // If the lowest byte we read is non-zero, we can assume + // that little endian format is used. + auto value = *reinterpret_cast<char*>(&one); + return value ? Little : Big; + } + }; + + template<typename T> + std::string fpToString(T value, int precision) { + if (Catch::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; + } + } // end unnamed namespace + + 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(); + } +} // end Detail namespace + + + +//// ======================================================= //// +// +// 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; +} + +#ifdef CATCH_CONFIG_CPP17_STRING_VIEW +std::string StringMaker<std::string_view>::convert(std::string_view str) { + return ::Catch::Detail::stringify(std::string{ str }); +} +#endif + +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}" }; + } +} + +#ifdef CATCH_CONFIG_WCHAR +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); +} + +# ifdef CATCH_CONFIG_CPP17_STRING_VIEW +std::string StringMaker<std::wstring_view>::convert(std::wstring_view str) { + return StringMaker<std::wstring>::convert(std::wstring(str)); +} +# endif + +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}" }; + } +} +#endif + +#if defined(CATCH_CONFIG_CPP17_BYTE) +#include <cstddef> +std::string StringMaker<std::byte>::convert(std::byte value) { + return ::Catch::Detail::stringify(std::to_integer<unsigned long long>(value)); +} +#endif // defined(CATCH_CONFIG_CPP17_BYTE) + +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<signed char>::convert(signed 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<char>::convert(char c) { + return ::Catch::Detail::stringify(static_cast<signed char>(c)); +} +std::string StringMaker<unsigned char>::convert(unsigned char c) { + return ::Catch::Detail::stringify(static_cast<char>(c)); +} + +int StringMaker<float>::precision = 5; + +std::string StringMaker<float>::convert(float value) { + return Detail::fpToString(value, precision) + 'f'; +} + +int StringMaker<double>::precision = 10; + +std::string StringMaker<double>::convert(double value) { + return Detail::fpToString(value, precision); +} + +} // end namespace Catch + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif + diff --git a/packages/Catch2/src/catch2/catch_tostring.hpp b/packages/Catch2/src/catch2/catch_tostring.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d0f799a0279d6106e03fe611786af262e67e8f24 --- /dev/null +++ b/packages/Catch2/src/catch2/catch_tostring.hpp @@ -0,0 +1,651 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_TOSTRING_HPP_INCLUDED +#define CATCH_TOSTRING_HPP_INCLUDED + + +#include <vector> +#include <cstddef> +#include <type_traits> +#include <string> +#include <catch2/internal/catch_compiler_capabilities.hpp> +#include <catch2/internal/catch_config_wchar.hpp> +#include <catch2/internal/catch_stream.hpp> +#include <catch2/interfaces/catch_interfaces_enum_values_registry.hpp> + +#ifdef CATCH_CONFIG_CPP17_STRING_VIEW +#include <string_view> +#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 + +namespace Catch { + 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 Stream, typename U> + static auto test(int) + -> decltype(std::declval<Stream&>() << std::declval<U>(), 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> + std::enable_if_t< + !std::is_enum<T>::value && !std::is_base_of<std::exception, T>::value, + std::string> convertUnstreamable( T const& ) { + return Detail::unprintableString; + } + template<typename T> + std::enable_if_t< + !std::is_enum<T>::value && std::is_base_of<std::exception, T>::value, + std::string> convertUnstreamable(T const& ex) { + return ex.what(); + } + + + template<typename T> + std::enable_if_t< + std::is_enum<T>::value, + std::string> convertUnstreamable( T const& value ) { + return convertUnknownEnumToString( value ); + } + +#if defined(_MANAGED) + //! Convert a CLR string to a utf8 std::string + template<typename T> + std::string clrReferenceToString( T^ ref ) { + if (ref == nullptr) + return std::string("null"); + auto bytes = System::Text::Encoding::UTF8->GetBytes(ref->ToString()); + cli::pin_ptr<System::Byte> p = &bytes[0]; + return std::string(reinterpret_cast<char const *>(p), bytes->Length); + } +#endif + + } // 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 + std::enable_if_t<::Catch::Detail::IsStreamInsertable<Fake>::value, std::string> + convert(const Fake& value) { + ReusableStringStream rss; + // NB: call using the function-like syntax to avoid ambiguity with + // user-defined templated operator<< under clang. + rss.operator<<(value); + return rss.str(); + } + + template <typename Fake = T> + static + std::enable_if_t<!::Catch::Detail::IsStreamInsertable<Fake>::value, std::string> + convert( const Fake& value ) { +#if !defined(CATCH_CONFIG_FALLBACK_STRINGIFIER) + return Detail::convertUnstreamable(value); +#else + return CATCH_CONFIG_FALLBACK_STRINGIFIER(value); +#endif + } + }; + + 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<std::remove_cv_t<std::remove_reference_t<T>>>::convert(e); + } + + template<typename E> + std::string convertUnknownEnumToString( E e ) { + return ::Catch::Detail::stringify(static_cast<std::underlying_type_t<E>>(e)); + } + +#if defined(_MANAGED) + template <typename T> + std::string stringify( T^ e ) { + return ::Catch::StringMaker<T^>::convert(e); + } +#endif + + } // namespace Detail + + // Some predefined specializations + + template<> + struct StringMaker<std::string> { + static std::string convert(const std::string& str); + }; + +#ifdef CATCH_CONFIG_CPP17_STRING_VIEW + template<> + struct StringMaker<std::string_view> { + static std::string convert(std::string_view str); + }; +#endif + + template<> + struct StringMaker<char const *> { + static std::string convert(char const * str); + }; + template<> + struct StringMaker<char *> { + static std::string convert(char * str); + }; + +#if defined(CATCH_CONFIG_WCHAR) + template<> + struct StringMaker<std::wstring> { + static std::string convert(const std::wstring& wstr); + }; + +# ifdef CATCH_CONFIG_CPP17_STRING_VIEW + template<> + struct StringMaker<std::wstring_view> { + static std::string convert(std::wstring_view str); + }; +# endif + + 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); + }; +#endif // CATCH_CONFIG_WCHAR + + // TBD: Should we use `strnlen` to ensure that we don't go out of the buffer, + // while keeping string semantics? + template<int SZ> + struct StringMaker<char[SZ]> { + static std::string convert(char const* str) { + return ::Catch::Detail::stringify(std::string{ str }); + } + }; + template<int SZ> + struct StringMaker<signed char[SZ]> { + static std::string convert(signed char const* str) { + return ::Catch::Detail::stringify(std::string{ reinterpret_cast<char const *>(str) }); + } + }; + template<int SZ> + struct StringMaker<unsigned char[SZ]> { + static std::string convert(unsigned char const* str) { + return ::Catch::Detail::stringify(std::string{ reinterpret_cast<char const *>(str) }); + } + }; + +#if defined(CATCH_CONFIG_CPP17_BYTE) + template<> + struct StringMaker<std::byte> { + static std::string convert(std::byte value); + }; +#endif // defined(CATCH_CONFIG_CPP17_BYTE) + 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) { + using namespace std::string_literals; + return b ? "true"s : "false"s; + } + }; + + 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) { + using namespace std::string_literals; + return "nullptr"s; + } + }; + + template<> + struct StringMaker<float> { + static std::string convert(float value); + static int precision; + }; + + template<> + struct StringMaker<double> { + static std::string convert(double value); + static int precision; + }; + + 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"; + } + } + }; + +#if defined(_MANAGED) + template <typename T> + struct StringMaker<T^> { + static std::string convert( T^ ref ) { + return ::Catch::Detail::clrReferenceToString(ref); + } + }; +#endif + + namespace Detail { + template<typename InputIterator, typename Sentinel = InputIterator> + std::string rangeToString(InputIterator first, Sentinel 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(); + } + } + +} // namespace Catch + +////////////////////////////////////////////////////// +// Separate std-lib types stringification, so it can be selectively enabled +// This means that we do not bring in their headers + +#if defined(CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS) +# define CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER +# define CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER +# define CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER +# define CATCH_CONFIG_ENABLE_OPTIONAL_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 + +#if defined(CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER) && defined(CATCH_CONFIG_CPP17_OPTIONAL) +#include <optional> +namespace Catch { + template<typename T> + struct StringMaker<std::optional<T> > { + static std::string convert(const std::optional<T>& optional) { + ReusableStringStream rss; + if (optional.has_value()) { + rss << ::Catch::Detail::stringify(*optional); + } else { + rss << "{ }"; + } + return rss.str(); + } + }; +} +#endif // CATCH_CONFIG_ENABLE_OPTIONAL_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 + +#if defined(CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER) && defined(CATCH_CONFIG_CPP17_VARIANT) +#include <variant> +namespace Catch { + template<> + struct StringMaker<std::monostate> { + static std::string convert(const std::monostate&) { + return "{ }"; + } + }; + + template<typename... Elements> + struct StringMaker<std::variant<Elements...>> { + static std::string convert(const std::variant<Elements...>& variant) { + if (variant.valueless_by_exception()) { + return "{valueless variant}"; + } else { + return std::visit( + [](const auto& value) { + return ::Catch::Detail::stringify(value); + }, + variant + ); + } + } + }; +} +#endif // CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER + +namespace Catch { + // Import begin/ end from std here + using std::begin; + using std::end; + + namespace detail { + template <typename...> + struct void_type { + using type = void; + }; + + template <typename T, typename = void> + struct is_range_impl : std::false_type { + }; + + template <typename T> + struct is_range_impl<T, typename void_type<decltype(begin(std::declval<T>()))>::type> : std::true_type { + }; + } // namespace detail + + template <typename T> + struct is_range : detail::is_range_impl<T> { + }; + +#if defined(_MANAGED) // Managed types are never ranges + template <typename T> + struct is_range<T^> { + static const bool value = false; + }; +#endif + + 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, std::enable_if_t<is_range<R>::value && !::Catch::Detail::IsStreamInsertable<R>::value>> { + 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 +#include <ctime> +#include <ratio> +#include <chrono> + + +namespace Catch { + +template <class Ratio> +struct ratio_string { + static std::string symbol() { + Catch::ReusableStringStream rss; + rss << '[' << Ratio::num << '/' + << Ratio::den << ']'; + return rss.str(); + } +}; + +template <> +struct ratio_string<std::atto> { + static std::string symbol() { return "a"; } +}; +template <> +struct ratio_string<std::femto> { + static std::string symbol() { return "f"; } +}; +template <> +struct ratio_string<std::pico> { + static std::string symbol() { return "p"; } +}; +template <> +struct ratio_string<std::nano> { + static std::string symbol() { return "n"; } +}; +template <> +struct ratio_string<std::micro> { + static std::string symbol() { return "u"; } +}; +template <> +struct ratio_string<std::milli> { + static std::string symbol() { return "m"; } +}; + + //////////// + // 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); + } + }; +} + +#include <catch2/interfaces/catch_interfaces_registry_hub.hpp> + +#define INTERNAL_CATCH_REGISTER_ENUM( enumName, ... ) \ +namespace Catch { \ + template<> struct StringMaker<enumName> { \ + static std::string convert( enumName value ) { \ + static const auto& enumInfo = ::Catch::getMutableRegistryHub().getMutableEnumValuesRegistry().registerEnum( #enumName, #__VA_ARGS__, { __VA_ARGS__ } ); \ + return static_cast<std::string>(enumInfo.lookup( static_cast<int>( value ) )); \ + } \ + }; \ +} + +#define CATCH_REGISTER_ENUM( enumName, ... ) INTERNAL_CATCH_REGISTER_ENUM( enumName, __VA_ARGS__ ) + +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#endif // CATCH_TOSTRING_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/catch_totals.cpp b/packages/Catch2/src/catch2/catch_totals.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a283c6589da4bf8265b96c93d3d4a38e7ebcce7b --- /dev/null +++ b/packages/Catch2/src/catch2/catch_totals.cpp @@ -0,0 +1,61 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/catch_totals.hpp> + +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/packages/Catch2/src/catch2/catch_totals.hpp b/packages/Catch2/src/catch2/catch_totals.hpp new file mode 100644 index 0000000000000000000000000000000000000000..76d6ae47d647c2e078c99de8bb677d6c6f8166d1 --- /dev/null +++ b/packages/Catch2/src/catch2/catch_totals.hpp @@ -0,0 +1,41 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_TOTALS_HPP_INCLUDED +#define 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; + + int error = 0; + Counts assertions; + Counts testCases; + }; +} + +#endif // CATCH_TOTALS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/catch_translate_exception.hpp b/packages/Catch2/src/catch2/catch_translate_exception.hpp new file mode 100644 index 0000000000000000000000000000000000000000..412a1062e4b21755df39acf6b8c7c96c2cd2b27b --- /dev/null +++ b/packages/Catch2/src/catch2/catch_translate_exception.hpp @@ -0,0 +1,81 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_TRANSLATE_EXCEPTION_HPP_INCLUDED +#define CATCH_TRANSLATE_EXCEPTION_HPP_INCLUDED + +#include <catch2/interfaces/catch_interfaces_exception.hpp> + +#include <exception> + +namespace Catch { + + class ExceptionTranslatorRegistrar { + template<typename T> + class ExceptionTranslator : public IExceptionTranslator { + public: + + ExceptionTranslator( std::string(*translateFunction)( T const& ) ) + : m_translateFunction( translateFunction ) + {} + + std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const override { +#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + try { + if( it == itEnd ) + std::rethrow_exception(std::current_exception()); + else + return (*it)->translate( it+1, itEnd ); + } + catch( T const& ex ) { + return m_translateFunction( ex ); + } +#else + return "You should never get here!"; +#endif + } + + protected: + std::string(*m_translateFunction)( T const& ); + }; + + public: + template<typename T> + ExceptionTranslatorRegistrar( std::string(*translateFunction)( T const& ) ) { + getMutableRegistryHub().registerTranslator + ( new ExceptionTranslator<T>( translateFunction ) ); + } + }; + +} // namespace Catch + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_TRANSLATE_EXCEPTION2( translatorName, signature ) \ + static std::string translatorName( signature ); \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::ExceptionTranslatorRegistrar INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionRegistrar )( &translatorName ); } \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ + static std::string translatorName( signature ) + +#define INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION2( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature ) + +#if defined(CATCH_CONFIG_DISABLE) + #define INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( translatorName, signature) \ + static std::string translatorName( signature ) +#endif + + +// This macro is always prefixed +#if !defined(CATCH_CONFIG_DISABLE) +#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) +#else +#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature ) +#endif + + +#endif // CATCH_TRANSLATE_EXCEPTION_HPP_INCLUDED \ No newline at end of file diff --git a/packages/Catch2/src/catch2/catch_version.cpp b/packages/Catch2/src/catch2/catch_version.cpp new file mode 100644 index 0000000000000000000000000000000000000000..96ab364072b20f878b07466f91c489b992bb7a1c --- /dev/null +++ b/packages/Catch2/src/catch2/catch_version.cpp @@ -0,0 +1,43 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/catch_version.hpp> +#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( 3, 0, 0, "preview", 3 ); + return version; + } + +} diff --git a/packages/Catch2/src/catch2/catch_version.hpp b/packages/Catch2/src/catch2/catch_version.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1f64d163760e4c889d701ea04a197dd03fe2e7cd --- /dev/null +++ b/packages/Catch2/src/catch2/catch_version.hpp @@ -0,0 +1,39 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_VERSION_HPP_INCLUDED +#define CATCH_VERSION_HPP_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 // CATCH_VERSION_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/catch_version_macros.hpp b/packages/Catch2/src/catch2/catch_version_macros.hpp new file mode 100644 index 0000000000000000000000000000000000000000..51e50c5ce084eae5bef891f7cbb8e6e584bb3fc9 --- /dev/null +++ b/packages/Catch2/src/catch2/catch_version_macros.hpp @@ -0,0 +1,15 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_VERSION_MACROS_HPP_INCLUDED +#define CATCH_VERSION_MACROS_HPP_INCLUDED + +#define CATCH_VERSION_MAJOR 3 +#define CATCH_VERSION_MINOR 0 +#define CATCH_VERSION_PATCH 0 + +#endif // CATCH_VERSION_MACROS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/generators/catch_generator_exception.hpp b/packages/Catch2/src/catch2/generators/catch_generator_exception.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a049452cd2c75ac1759c9faa7340752e48641294 --- /dev/null +++ b/packages/Catch2/src/catch2/generators/catch_generator_exception.hpp @@ -0,0 +1,31 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_GENERATOR_EXCEPTION_HPP_INCLUDED +#define CATCH_GENERATOR_EXCEPTION_HPP_INCLUDED + +#include <exception> + +namespace Catch { + + // Exception type to be thrown when a Generator runs into an error, + // e.g. it cannot initialize the first return value based on + // runtime information + class GeneratorException : public std::exception { + const char* const m_msg = ""; + + public: + GeneratorException(const char* msg): + m_msg(msg) + {} + + const char* what() const noexcept override final; + }; + +} // end namespace Catch + +#endif // CATCH_GENERATOR_EXCEPTION_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/generators/catch_generators.hpp b/packages/Catch2/src/catch2/generators/catch_generators.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4ac73005160cef2c58581ebe085844333b441a68 --- /dev/null +++ b/packages/Catch2/src/catch2/generators/catch_generators.hpp @@ -0,0 +1,233 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_GENERATORS_HPP_INCLUDED +#define CATCH_GENERATORS_HPP_INCLUDED + +#include <catch2/interfaces/catch_interfaces_generatortracker.hpp> +#include <catch2/internal/catch_source_line_info.hpp> +#include <catch2/internal/catch_stringref.hpp> + +#include <vector> +#include <tuple> +#include <utility> + +namespace Catch { + +namespace Generators { + +namespace Detail { + + //! Throws GeneratorException with the provided message + [[noreturn]] + void throw_generator_exception(char const * msg); + +} // end namespace detail + + template<typename T> + struct IGenerator : GeneratorUntypedBase { + ~IGenerator() override = default; + IGenerator() = default; + IGenerator(IGenerator const&) = default; + IGenerator& operator=(IGenerator const&) = default; + + + // Returns the current element of the generator + // + // \Precondition The generator is either freshly constructed, + // or the last call to `next()` returned true + virtual T const& get() const = 0; + using type = T; + }; + + template <typename T> + using GeneratorPtr = Catch::Detail::unique_ptr<IGenerator<T>>; + + template <typename T> + class GeneratorWrapper final { + GeneratorPtr<T> m_generator; + public: + //! Takes ownership of the passed pointer. + GeneratorWrapper(IGenerator<T>* generator): + m_generator(generator) {} + GeneratorWrapper(GeneratorPtr<T> generator): + m_generator(std::move(generator)) {} + + T const& get() const { + return m_generator->get(); + } + bool next() { + return m_generator->next(); + } + }; + + + template<typename T> + class SingleValueGenerator final : public IGenerator<T> { + T m_value; + public: + SingleValueGenerator(T const& value) : + m_value(value) + {} + SingleValueGenerator(T&& value): + m_value(std::move(value)) + {} + + T const& get() const override { + return m_value; + } + bool next() override { + return false; + } + }; + + template<typename T> + class FixedValuesGenerator final : public IGenerator<T> { + static_assert(!std::is_same<T, bool>::value, + "FixedValuesGenerator does not support bools because of std::vector<bool>" + "specialization, use SingleValue Generator instead."); + std::vector<T> m_values; + size_t m_idx = 0; + public: + FixedValuesGenerator( std::initializer_list<T> values ) : m_values( values ) {} + + T const& get() const override { + return m_values[m_idx]; + } + bool next() override { + ++m_idx; + return m_idx < m_values.size(); + } + }; + + template <typename T, typename DecayedT = std::decay_t<T>> + GeneratorWrapper<DecayedT> value( T&& value ) { + return GeneratorWrapper<DecayedT>( + Catch::Detail::make_unique<SingleValueGenerator<DecayedT>>( + std::forward<T>( value ) ) ); + } + template <typename T> + GeneratorWrapper<T> values(std::initializer_list<T> values) { + return GeneratorWrapper<T>(Catch::Detail::make_unique<FixedValuesGenerator<T>>(values)); + } + + template<typename T> + class Generators : public IGenerator<T> { + std::vector<GeneratorWrapper<T>> m_generators; + size_t m_current = 0; + + void add_generator( GeneratorWrapper<T>&& generator ) { + m_generators.emplace_back( std::move( generator ) ); + } + void add_generator( T const& val ) { + m_generators.emplace_back( value( val ) ); + } + void add_generator( T&& val ) { + m_generators.emplace_back( value( std::move( val ) ) ); + } + template <typename U> + std::enable_if_t<!std::is_same<std::decay_t<U>, T>::value> + add_generator( U&& val ) { + add_generator( T( std::forward<U>( val ) ) ); + } + + template <typename U> void add_generators( U&& valueOrGenerator ) { + add_generator( std::forward<U>( valueOrGenerator ) ); + } + + template <typename U, typename... Gs> + void add_generators( U&& valueOrGenerator, Gs&&... moreGenerators ) { + add_generator( std::forward<U>( valueOrGenerator ) ); + add_generators( std::forward<Gs>( moreGenerators )... ); + } + + public: + template <typename... Gs> + Generators(Gs &&... moreGenerators) { + m_generators.reserve(sizeof...(Gs)); + add_generators(std::forward<Gs>(moreGenerators)...); + } + + T const& get() const override { + return m_generators[m_current].get(); + } + + bool next() override { + if (m_current >= m_generators.size()) { + return false; + } + const bool current_status = m_generators[m_current].next(); + if (!current_status) { + ++m_current; + } + return m_current < m_generators.size(); + } + }; + + + template <typename... Ts> + GeneratorWrapper<std::tuple<std::decay_t<Ts>...>> + table( std::initializer_list<std::tuple<std::decay_t<Ts>...>> tuples ) { + return values<std::tuple<Ts...>>( tuples ); + } + + // Tag type to signal that a generator sequence should convert arguments to a specific type + template <typename T> + struct as {}; + + template<typename T, typename... Gs> + auto makeGenerators( GeneratorWrapper<T>&& generator, Gs &&... moreGenerators ) -> Generators<T> { + return Generators<T>(std::move(generator), std::forward<Gs>(moreGenerators)...); + } + template<typename T> + auto makeGenerators( GeneratorWrapper<T>&& generator ) -> Generators<T> { + return Generators<T>(std::move(generator)); + } + template<typename T, typename... Gs> + auto makeGenerators( T&& val, Gs &&... moreGenerators ) -> Generators<std::decay_t<T>> { + return makeGenerators( value( std::forward<T>( val ) ), std::forward<Gs>( moreGenerators )... ); + } + template<typename T, typename U, typename... Gs> + auto makeGenerators( as<T>, U&& val, Gs &&... moreGenerators ) -> Generators<T> { + return makeGenerators( value( T( std::forward<U>( val ) ) ), std::forward<Gs>( moreGenerators )... ); + } + + auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker&; + + template<typename L> + // Note: The type after -> is weird, because VS2015 cannot parse + // the expression used in the typedef inside, when it is in + // return type. Yeah. + auto generate( StringRef generatorName, SourceLineInfo const& lineInfo, L const& generatorExpression ) -> decltype(std::declval<decltype(generatorExpression())>().get()) { + using UnderlyingType = typename decltype(generatorExpression())::type; + + IGeneratorTracker& tracker = acquireGeneratorTracker( generatorName, lineInfo ); + if (!tracker.hasGenerator()) { + tracker.setGenerator(Catch::Detail::make_unique<Generators<UnderlyingType>>(generatorExpression())); + } + + auto const& generator = static_cast<IGenerator<UnderlyingType> const&>( *tracker.getGenerator() ); + return generator.get(); + } + +} // namespace Generators +} // namespace Catch + +#define GENERATE( ... ) \ + Catch::Generators::generate( INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \ + CATCH_INTERNAL_LINEINFO, \ + [ ]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace) +#define GENERATE_COPY( ... ) \ + Catch::Generators::generate( INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \ + CATCH_INTERNAL_LINEINFO, \ + [=]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace) +#define GENERATE_REF( ... ) \ + Catch::Generators::generate( INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \ + CATCH_INTERNAL_LINEINFO, \ + [&]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace) + +#endif // CATCH_GENERATORS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/generators/catch_generators_adapters.hpp b/packages/Catch2/src/catch2/generators/catch_generators_adapters.hpp new file mode 100644 index 0000000000000000000000000000000000000000..393b070000ea8080c89ed4cf095974254c190584 --- /dev/null +++ b/packages/Catch2/src/catch2/generators/catch_generators_adapters.hpp @@ -0,0 +1,238 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_GENERATORS_ADAPTERS_HPP_INCLUDED +#define CATCH_GENERATORS_ADAPTERS_HPP_INCLUDED + +#include <catch2/generators/catch_generators.hpp> +#include <catch2/internal/catch_meta.hpp> + +namespace Catch { +namespace Generators { + + template <typename T> + class TakeGenerator final : public IGenerator<T> { + GeneratorWrapper<T> m_generator; + size_t m_returned = 0; + size_t m_target; + public: + TakeGenerator(size_t target, GeneratorWrapper<T>&& generator): + m_generator(std::move(generator)), + m_target(target) + { + assert(target != 0 && "Empty generators are not allowed"); + } + T const& get() const override { + return m_generator.get(); + } + bool next() override { + ++m_returned; + if (m_returned >= m_target) { + return false; + } + + const auto success = m_generator.next(); + // If the underlying generator does not contain enough values + // then we cut short as well + if (!success) { + m_returned = m_target; + } + return success; + } + }; + + template <typename T> + GeneratorWrapper<T> take(size_t target, GeneratorWrapper<T>&& generator) { + return GeneratorWrapper<T>(Catch::Detail::make_unique<TakeGenerator<T>>(target, std::move(generator))); + } + + + template <typename T, typename Predicate> + class FilterGenerator final : public IGenerator<T> { + GeneratorWrapper<T> m_generator; + Predicate m_predicate; + public: + template <typename P = Predicate> + FilterGenerator(P&& pred, GeneratorWrapper<T>&& generator): + m_generator(std::move(generator)), + m_predicate(std::forward<P>(pred)) + { + if (!m_predicate(m_generator.get())) { + // It might happen that there are no values that pass the + // filter. In that case we throw an exception. + auto has_initial_value = next(); + if (!has_initial_value) { + Detail::throw_generator_exception("No valid value found in filtered generator"); + } + } + } + + T const& get() const override { + return m_generator.get(); + } + + bool next() override { + bool success = m_generator.next(); + if (!success) { + return false; + } + while (!m_predicate(m_generator.get()) && (success = m_generator.next()) == true); + return success; + } + }; + + + template <typename T, typename Predicate> + GeneratorWrapper<T> filter(Predicate&& pred, GeneratorWrapper<T>&& generator) { + return GeneratorWrapper<T>(Catch::Detail::make_unique<FilterGenerator<T, Predicate>>(std::forward<Predicate>(pred), std::move(generator))); + } + + template <typename T> + class RepeatGenerator final : public IGenerator<T> { + static_assert(!std::is_same<T, bool>::value, + "RepeatGenerator currently does not support bools" + "because of std::vector<bool> specialization"); + GeneratorWrapper<T> m_generator; + mutable std::vector<T> m_returned; + size_t m_target_repeats; + size_t m_current_repeat = 0; + size_t m_repeat_index = 0; + public: + RepeatGenerator(size_t repeats, GeneratorWrapper<T>&& generator): + m_generator(std::move(generator)), + m_target_repeats(repeats) + { + assert(m_target_repeats > 0 && "Repeat generator must repeat at least once"); + } + + T const& get() const override { + if (m_current_repeat == 0) { + m_returned.push_back(m_generator.get()); + return m_returned.back(); + } + return m_returned[m_repeat_index]; + } + + bool next() override { + // There are 2 basic cases: + // 1) We are still reading the generator + // 2) We are reading our own cache + + // In the first case, we need to poke the underlying generator. + // If it happily moves, we are left in that state, otherwise it is time to start reading from our cache + if (m_current_repeat == 0) { + const auto success = m_generator.next(); + if (!success) { + ++m_current_repeat; + } + return m_current_repeat < m_target_repeats; + } + + // In the second case, we need to move indices forward and check that we haven't run up against the end + ++m_repeat_index; + if (m_repeat_index == m_returned.size()) { + m_repeat_index = 0; + ++m_current_repeat; + } + return m_current_repeat < m_target_repeats; + } + }; + + template <typename T> + GeneratorWrapper<T> repeat(size_t repeats, GeneratorWrapper<T>&& generator) { + return GeneratorWrapper<T>(Catch::Detail::make_unique<RepeatGenerator<T>>(repeats, std::move(generator))); + } + + template <typename T, typename U, typename Func> + class MapGenerator final : public IGenerator<T> { + // TBD: provide static assert for mapping function, for friendly error message + GeneratorWrapper<U> m_generator; + Func m_function; + // To avoid returning dangling reference, we have to save the values + T m_cache; + public: + template <typename F2 = Func> + MapGenerator(F2&& function, GeneratorWrapper<U>&& generator) : + m_generator(std::move(generator)), + m_function(std::forward<F2>(function)), + m_cache(m_function(m_generator.get())) + {} + + T const& get() const override { + return m_cache; + } + bool next() override { + const auto success = m_generator.next(); + if (success) { + m_cache = m_function(m_generator.get()); + } + return success; + } + }; + + template <typename Func, typename U, typename T = FunctionReturnType<Func, U>> + GeneratorWrapper<T> map(Func&& function, GeneratorWrapper<U>&& generator) { + return GeneratorWrapper<T>( + Catch::Detail::make_unique<MapGenerator<T, U, Func>>(std::forward<Func>(function), std::move(generator)) + ); + } + + template <typename T, typename U, typename Func> + GeneratorWrapper<T> map(Func&& function, GeneratorWrapper<U>&& generator) { + return GeneratorWrapper<T>( + Catch::Detail::make_unique<MapGenerator<T, U, Func>>(std::forward<Func>(function), std::move(generator)) + ); + } + + template <typename T> + class ChunkGenerator final : public IGenerator<std::vector<T>> { + std::vector<T> m_chunk; + size_t m_chunk_size; + GeneratorWrapper<T> m_generator; + bool m_used_up = false; + public: + ChunkGenerator(size_t size, GeneratorWrapper<T> generator) : + m_chunk_size(size), m_generator(std::move(generator)) + { + m_chunk.reserve(m_chunk_size); + if (m_chunk_size != 0) { + m_chunk.push_back(m_generator.get()); + for (size_t i = 1; i < m_chunk_size; ++i) { + if (!m_generator.next()) { + Detail::throw_generator_exception("Not enough values to initialize the first chunk"); + } + m_chunk.push_back(m_generator.get()); + } + } + } + std::vector<T> const& get() const override { + return m_chunk; + } + bool next() override { + m_chunk.clear(); + for (size_t idx = 0; idx < m_chunk_size; ++idx) { + if (!m_generator.next()) { + return false; + } + m_chunk.push_back(m_generator.get()); + } + return true; + } + }; + + template <typename T> + GeneratorWrapper<std::vector<T>> chunk(size_t size, GeneratorWrapper<T>&& generator) { + return GeneratorWrapper<std::vector<T>>( + Catch::Detail::make_unique<ChunkGenerator<T>>(size, std::move(generator)) + ); + } + +} // namespace Generators +} // namespace Catch + + +#endif // CATCH_GENERATORS_ADAPTERS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/generators/catch_generators_all.hpp b/packages/Catch2/src/catch2/generators/catch_generators_all.hpp new file mode 100644 index 0000000000000000000000000000000000000000..845e6516d72859016184be5e71bcae302f7a0d8f --- /dev/null +++ b/packages/Catch2/src/catch2/generators/catch_generators_all.hpp @@ -0,0 +1,30 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +/** \file + * This is a convenience header for Catch2's Generator support. It includes + * **all** of Catch2 headers related to generators. + * + * Generally the Catch2 users should use specific includes they need, + * but this header can be used instead for ease-of-experimentation, or + * just plain convenience, at the cost of (significantly) increased + * compilation times. + * + * When a new header is added to either the `generators` folder, + * or to the corresponding internal subfolder, it should be added here. + */ + +#ifndef CATCH_GENERATORS_ALL_HPP_INCLUDED +#define CATCH_GENERATORS_ALL_HPP_INCLUDED + +#include <catch2/generators/catch_generator_exception.hpp> +#include <catch2/generators/catch_generators.hpp> +#include <catch2/generators/catch_generators_adapters.hpp> +#include <catch2/generators/catch_generators_random.hpp> +#include <catch2/generators/catch_generators_range.hpp> + +#endif // CATCH_GENERATORS_ALL_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/generators/catch_generators_random.hpp b/packages/Catch2/src/catch2/generators/catch_generators_random.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cc66f908050c9202a627a87971474551a88b734c --- /dev/null +++ b/packages/Catch2/src/catch2/generators/catch_generators_random.hpp @@ -0,0 +1,89 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_GENERATORS_RANDOM_HPP_INCLUDED +#define CATCH_GENERATORS_RANDOM_HPP_INCLUDED + +#include <catch2/internal/catch_context.hpp> +#include <catch2/generators/catch_generators.hpp> +#include <catch2/internal/catch_random_number_generator.hpp> + +#include <random> + +namespace Catch { +namespace Generators { + +template <typename Float> +class RandomFloatingGenerator final : public IGenerator<Float> { + Catch::SimplePcg32& m_rng; + std::uniform_real_distribution<Float> m_dist; + Float m_current_number; +public: + + RandomFloatingGenerator(Float a, Float b): + m_rng(rng()), + m_dist(a, b) { + static_cast<void>(next()); + } + + Float const& get() const override { + return m_current_number; + } + bool next() override { + m_current_number = m_dist(m_rng); + return true; + } +}; + +template <typename Integer> +class RandomIntegerGenerator final : public IGenerator<Integer> { + Catch::SimplePcg32& m_rng; + std::uniform_int_distribution<Integer> m_dist; + Integer m_current_number; +public: + + RandomIntegerGenerator(Integer a, Integer b): + m_rng(rng()), + m_dist(a, b) { + static_cast<void>(next()); + } + + Integer const& get() const override { + return m_current_number; + } + bool next() override { + m_current_number = m_dist(m_rng); + return true; + } +}; + +// TODO: Ideally this would be also constrained against the various char types, +// but I don't expect users to run into that in practice. +template <typename T> +std::enable_if_t<std::is_integral<T>::value && !std::is_same<T, bool>::value, +GeneratorWrapper<T>> +random(T a, T b) { + return GeneratorWrapper<T>( + Catch::Detail::make_unique<RandomIntegerGenerator<T>>(a, b) + ); +} + +template <typename T> +std::enable_if_t<std::is_floating_point<T>::value, +GeneratorWrapper<T>> +random(T a, T b) { + return GeneratorWrapper<T>( + Catch::Detail::make_unique<RandomFloatingGenerator<T>>(a, b) + ); +} + + +} // namespace Generators +} // namespace Catch + + +#endif // CATCH_GENERATORS_RANDOM_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/generators/catch_generators_range.hpp b/packages/Catch2/src/catch2/generators/catch_generators_range.hpp new file mode 100644 index 0000000000000000000000000000000000000000..054af15d546891e03bde83eb0d7b143e5ebab3af --- /dev/null +++ b/packages/Catch2/src/catch2/generators/catch_generators_range.hpp @@ -0,0 +1,110 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_GENERATORS_RANGE_HPP_INCLUDED +#define CATCH_GENERATORS_RANGE_HPP_INCLUDED + +#include <catch2/generators/catch_generators.hpp> + +#include <iterator> +#include <type_traits> + +namespace Catch { +namespace Generators { + + +template <typename T> +class RangeGenerator final : public IGenerator<T> { + T m_current; + T m_end; + T m_step; + bool m_positive; + +public: + RangeGenerator(T const& start, T const& end, T const& step): + m_current(start), + m_end(end), + m_step(step), + m_positive(m_step > T(0)) + { + assert(m_current != m_end && "Range start and end cannot be equal"); + assert(m_step != T(0) && "Step size cannot be zero"); + assert(((m_positive && m_current <= m_end) || (!m_positive && m_current >= m_end)) && "Step moves away from end"); + } + + RangeGenerator(T const& start, T const& end): + RangeGenerator(start, end, (start < end) ? T(1) : T(-1)) + {} + + T const& get() const override { + return m_current; + } + + bool next() override { + m_current += m_step; + return (m_positive) ? (m_current < m_end) : (m_current > m_end); + } +}; + +template <typename T> +GeneratorWrapper<T> range(T const& start, T const& end, T const& step) { + static_assert(std::is_arithmetic<T>::value && !std::is_same<T, bool>::value, "Type must be numeric"); + return GeneratorWrapper<T>(Catch::Detail::make_unique<RangeGenerator<T>>(start, end, step)); +} + +template <typename T> +GeneratorWrapper<T> range(T const& start, T const& end) { + static_assert(std::is_integral<T>::value && !std::is_same<T, bool>::value, "Type must be an integer"); + return GeneratorWrapper<T>(Catch::Detail::make_unique<RangeGenerator<T>>(start, end)); +} + + +template <typename T> +class IteratorGenerator final : public IGenerator<T> { + static_assert(!std::is_same<T, bool>::value, + "IteratorGenerator currently does not support bools" + "because of std::vector<bool> specialization"); + + std::vector<T> m_elems; + size_t m_current = 0; +public: + template <typename InputIterator, typename InputSentinel> + IteratorGenerator(InputIterator first, InputSentinel last):m_elems(first, last) { + if (m_elems.empty()) { + Detail::throw_generator_exception("IteratorGenerator received no valid values"); + } + } + + T const& get() const override { + return m_elems[m_current]; + } + + bool next() override { + ++m_current; + return m_current != m_elems.size(); + } +}; + +template <typename InputIterator, + typename InputSentinel, + typename ResultType = typename std::iterator_traits<InputIterator>::value_type> +GeneratorWrapper<ResultType> from_range(InputIterator from, InputSentinel to) { + return GeneratorWrapper<ResultType>(Catch::Detail::make_unique<IteratorGenerator<ResultType>>(from, to)); +} + +template <typename Container, + typename ResultType = typename Container::value_type> +GeneratorWrapper<ResultType> from_range(Container const& cnt) { + return GeneratorWrapper<ResultType>(Catch::Detail::make_unique<IteratorGenerator<ResultType>>(cnt.begin(), cnt.end())); +} + + +} // namespace Generators +} // namespace Catch + + +#endif // CATCH_GENERATORS_RANGE_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/generators/internal/catch_generators_combined_tu.cpp b/packages/Catch2/src/catch2/generators/internal/catch_generators_combined_tu.cpp new file mode 100644 index 0000000000000000000000000000000000000000..da1b62e9d4cc73842a45af220e703bdfc0613c39 --- /dev/null +++ b/packages/Catch2/src/catch2/generators/internal/catch_generators_combined_tu.cpp @@ -0,0 +1,65 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +/** \file + * This is a special TU that combines what would otherwise be a very + * small generator-related TUs into one bigger TU. + * + * The reason for this is compilation performance improvements by + * avoiding reparsing headers for many small TUs, instead having this + * one TU include bit more, but having it all parsed only once. + * + * To avoid heavy-tail problem with compilation times, each "subpart" + * of Catch2 has its own combined TU like this. + */ + +//////////////////////////////////////////////////// +// vvv formerly catch_generator_exception.cpp vvv // +//////////////////////////////////////////////////// + +#include <catch2/generators/catch_generator_exception.hpp> + +namespace Catch { + + const char* GeneratorException::what() const noexcept { + return m_msg; + } + +} // end namespace Catch + + +/////////////////////////////////////////// +// vvv formerly catch_generators.cpp vvv // +/////////////////////////////////////////// + +#include <catch2/generators/catch_generators.hpp> +#include <catch2/internal/catch_enforce.hpp> +#include <catch2/generators/catch_generator_exception.hpp> +#include <catch2/interfaces/catch_interfaces_capture.hpp> + +namespace Catch { + + IGeneratorTracker::~IGeneratorTracker() = default; + +namespace Generators { + +namespace Detail { + + [[noreturn]] + void throw_generator_exception(char const* msg) { + Catch::throw_exception(GeneratorException{ msg }); + } +} // end namespace Detail + + GeneratorUntypedBase::~GeneratorUntypedBase() = default; + + auto acquireGeneratorTracker(StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& { + return getResultCapture().acquireGeneratorTracker( generatorName, lineInfo ); + } + +} // namespace Generators +} // namespace Catch diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_all.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_all.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6dc4ebf17bf745b8263b878d0016f8a410dc3c90 --- /dev/null +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_all.hpp @@ -0,0 +1,38 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +/** \file + * This is a convenience header for Catch2's interfaces. It includes + * **all** of Catch2 headers related to interfaces. + * + * Generally the Catch2 users should use specific includes they need, + * but this header can be used instead for ease-of-experimentation, or + * just plain convenience, at the cost of somewhat increased compilation + * times. + * + * When a new header is added to either the `interfaces` folder, or to + * the corresponding internal subfolder, it should be added here. + */ + + +#ifndef CATCH_INTERFACES_ALL_HPP_INCLUDED +#define CATCH_INTERFACES_ALL_HPP_INCLUDED + +#include <catch2/interfaces/catch_interfaces_capture.hpp> +#include <catch2/interfaces/catch_interfaces_config.hpp> +#include <catch2/interfaces/catch_interfaces_enum_values_registry.hpp> +#include <catch2/interfaces/catch_interfaces_exception.hpp> +#include <catch2/interfaces/catch_interfaces_generatortracker.hpp> +#include <catch2/interfaces/catch_interfaces_registry_hub.hpp> +#include <catch2/interfaces/catch_interfaces_reporter.hpp> +#include <catch2/interfaces/catch_interfaces_reporter_factory.hpp> +#include <catch2/interfaces/catch_interfaces_reporter_registry.hpp> +#include <catch2/interfaces/catch_interfaces_runner.hpp> +#include <catch2/interfaces/catch_interfaces_tag_alias_registry.hpp> +#include <catch2/interfaces/catch_interfaces_testcase.hpp> + +#endif // CATCH_INTERFACES_ALL_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_capture.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_capture.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bfd0c0232ab12476f48870066ab1e2b213208601 --- /dev/null +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_capture.hpp @@ -0,0 +1,96 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_INTERFACES_CAPTURE_HPP_INCLUDED +#define CATCH_INTERFACES_CAPTURE_HPP_INCLUDED + +#include <string> +#include <chrono> + +#include <catch2/internal/catch_stringref.hpp> +#include <catch2/internal/catch_result_type.hpp> + +namespace Catch { + + class AssertionResult; + struct AssertionInfo; + struct SectionInfo; + struct SectionEndInfo; + struct MessageInfo; + struct MessageBuilder; + struct Counts; + struct AssertionReaction; + struct SourceLineInfo; + + struct ITransientExpression; + struct IGeneratorTracker; + + struct BenchmarkInfo; + template <typename Duration = std::chrono::duration<double, std::nano>> + struct BenchmarkStats; + + 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 auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& = 0; + + virtual void benchmarkPreparing( std::string const& name ) = 0; + virtual void benchmarkStarting( BenchmarkInfo const& info ) = 0; + virtual void benchmarkEnded( BenchmarkStats<> const& stats ) = 0; + virtual void benchmarkFailed( std::string const& error ) = 0; + + virtual void pushScopedMessage( MessageInfo const& message ) = 0; + virtual void popScopedMessage( MessageInfo const& message ) = 0; + + virtual void emplaceUnscopedMessage( MessageBuilder const& builder ) = 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 // CATCH_INTERFACES_CAPTURE_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_combined_tu.cpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_combined_tu.cpp new file mode 100644 index 0000000000000000000000000000000000000000..46d7c38cf3a9f1a23d47daffcf73db2612d46e77 --- /dev/null +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_combined_tu.cpp @@ -0,0 +1,99 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +/** \file + * This is a special TU that combines what would otherwise be a very + * small interfaces-related TUs into one bigger TU. + * + * The reason for this is compilation performance improvements by + * avoiding reparsing headers for many small TUs, instead having this + * one TU include bit more, but having it all parsed only once. + * + * To avoid heavy-tail problem with compilation times, each "subpart" + * of Catch2 has its own combined TU like this. + */ + +/////////////////////////////////////////////////// +// vvv formerly catch_interfaces_capture.cpp vvv // +/////////////////////////////////////////////////// + +#include <catch2/interfaces/catch_interfaces_capture.hpp> + +namespace Catch { + IResultCapture::~IResultCapture() = default; +} + + +////////////////////////////////////////////////// +// vvv formerly catch_interfaces_config.cpp vvv // +////////////////////////////////////////////////// + +#include <catch2/interfaces/catch_interfaces_config.hpp> + +namespace Catch { + IConfig::~IConfig() = default; +} + + +///////////////////////////////////////////////////// +// vvv formerly catch_interfaces_exception.cpp vvv // +///////////////////////////////////////////////////// + +#include <catch2/interfaces/catch_interfaces_exception.hpp> + +namespace Catch { + IExceptionTranslator::~IExceptionTranslator() = default; + IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() = default; +} + + +//////////////////////////////////////////////////////// +// vvv formerly catch_interfaces_registry_hub.cpp vvv // +//////////////////////////////////////////////////////// + +#include <catch2/interfaces/catch_interfaces_registry_hub.hpp> + +namespace Catch { + IRegistryHub::~IRegistryHub() = default; + IMutableRegistryHub::~IMutableRegistryHub() = default; +} + + +////////////////////////////////////////////////// +// vvv formerly catch_interfaces_runner.cpp vvv // +////////////////////////////////////////////////// + +#include <catch2/interfaces/catch_interfaces_runner.hpp> + +namespace Catch { + IRunner::~IRunner() = default; +} + + +//////////////////////////////////////////////////// +// vvv formerly catch_interfaces_testcase.cpp vvv // +//////////////////////////////////////////////////// + +#include <catch2/interfaces/catch_interfaces_testcase.hpp> + +namespace Catch { + ITestInvoker::~ITestInvoker() = default; + ITestCaseRegistry::~ITestCaseRegistry() = default; +} + + +#include <catch2/interfaces/catch_interfaces_reporter_registry.hpp> +namespace Catch { + IReporterRegistry::~IReporterRegistry() = default; +} + + +#include <catch2/interfaces/catch_interfaces_reporter_factory.hpp> + +namespace Catch { + IReporterFactory::~IReporterFactory() = default; +} diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_config.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_config.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f09b0c0fe95c163702906fae406c385893399ff9 --- /dev/null +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_config.hpp @@ -0,0 +1,88 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_INTERFACES_CONFIG_HPP_INCLUDED +#define CATCH_INTERFACES_CONFIG_HPP_INCLUDED + +#include <catch2/internal/catch_noncopyable.hpp> + +#include <chrono> +#include <iosfwd> +#include <string> +#include <vector> + +namespace Catch { + + enum class Verbosity { + Quiet = 0, + Normal, + High + }; + + struct WarnAbout { enum What { + Nothing = 0x00, + NoAssertions = 0x01, + NoTests = 0x02 + }; }; + + enum class ShowDurations { + DefaultForReporter, + Always, + Never + }; + enum class TestRunOrder { + Declared, + LexicographicallySorted, + Randomized + }; + enum class UseColour { + Auto, + Yes, + No + }; + struct WaitForKeypress { enum When { + Never, + BeforeStart = 1, + BeforeExit = 2, + BeforeStartAndExit = BeforeStart | BeforeExit + }; }; + + class TestSpec; + + struct IConfig : Detail::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 bool warnAboutNoTests() const = 0; + virtual int abortAfter() const = 0; + virtual bool showInvisibles() const = 0; + virtual ShowDurations showDurations() const = 0; + virtual double minDuration() const = 0; + virtual TestSpec const& testSpec() const = 0; + virtual bool hasTestFilters() const = 0; + virtual std::vector<std::string> const& getTestsOrTags() const = 0; + virtual TestRunOrder runOrder() const = 0; + virtual unsigned int rngSeed() const = 0; + virtual UseColour useColour() const = 0; + virtual std::vector<std::string> const& getSectionsToRun() const = 0; + virtual Verbosity verbosity() const = 0; + + virtual bool benchmarkNoAnalysis() const = 0; + virtual int benchmarkSamples() const = 0; + virtual double benchmarkConfidenceInterval() const = 0; + virtual unsigned int benchmarkResamples() const = 0; + virtual std::chrono::milliseconds benchmarkWarmupTime() const = 0; + }; +} + +#endif // CATCH_INTERFACES_CONFIG_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_enum_values_registry.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_enum_values_registry.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2c18059a442fb864662d45ee52998a0aef61c383 --- /dev/null +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_enum_values_registry.hpp @@ -0,0 +1,46 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_INTERFACES_ENUM_VALUES_REGISTRY_HPP_INCLUDED +#define CATCH_INTERFACES_ENUM_VALUES_REGISTRY_HPP_INCLUDED + +#include <catch2/internal/catch_stringref.hpp> + +#include <vector> + +namespace Catch { + + namespace Detail { + struct EnumInfo { + StringRef m_name; + std::vector<std::pair<int, StringRef>> m_values; + + ~EnumInfo(); + + StringRef lookup( int value ) const; + }; + } // namespace Detail + + struct IMutableEnumValuesRegistry { + virtual ~IMutableEnumValuesRegistry(); + + virtual Detail::EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::vector<int> const& values ) = 0; + + template<typename E> + Detail::EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::initializer_list<E> values ) { + static_assert(sizeof(int) >= sizeof(E), "Cannot serialize enum to int"); + std::vector<int> intValues; + intValues.reserve( values.size() ); + for( auto enumValue : values ) + intValues.push_back( static_cast<int>( enumValue ) ); + return registerEnum( enumName, allEnums, intValues ); + } + }; + +} // Catch + +#endif // CATCH_INTERFACES_ENUM_VALUES_REGISTRY_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_exception.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_exception.hpp new file mode 100644 index 0000000000000000000000000000000000000000..84bb4974d104cd78da2ec4c8c902b0dc0237d1dc --- /dev/null +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_exception.hpp @@ -0,0 +1,37 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_INTERFACES_EXCEPTION_HPP_INCLUDED +#define CATCH_INTERFACES_EXCEPTION_HPP_INCLUDED + +#include <catch2/interfaces/catch_interfaces_registry_hub.hpp> +#include <catch2/internal/catch_compiler_capabilities.hpp> +#include <catch2/internal/catch_unique_ptr.hpp> + +#include <string> +#include <vector> + +namespace Catch { + using exceptionTranslateFunction = std::string(*)(); + + struct IExceptionTranslator; + using ExceptionTranslators = std::vector<Detail::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; + }; + +} // namespace Catch + +#endif // CATCH_INTERFACES_EXCEPTION_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_generatortracker.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_generatortracker.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f1ca34417aede4fe7ff2afff25ed9e78705f1562 --- /dev/null +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_generatortracker.hpp @@ -0,0 +1,45 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_INTERFACES_GENERATORTRACKER_HPP_INCLUDED +#define CATCH_INTERFACES_GENERATORTRACKER_HPP_INCLUDED + +#include <catch2/internal/catch_unique_ptr.hpp> + +namespace Catch { + + namespace Generators { + class GeneratorUntypedBase { + public: + GeneratorUntypedBase() = default; + // Generation of copy ops is deprecated (and Clang will complain) + // if there is a user destructor defined + GeneratorUntypedBase(GeneratorUntypedBase const&) = default; + GeneratorUntypedBase& operator=(GeneratorUntypedBase const&) = default; + + virtual ~GeneratorUntypedBase(); // = default; + + // Attempts to move the generator to the next element + // + // Returns true iff the move succeeded (and a valid element + // can be retrieved). + virtual bool next() = 0; + }; + using GeneratorBasePtr = Catch::Detail::unique_ptr<GeneratorUntypedBase>; + + } // namespace Generators + + struct IGeneratorTracker { + virtual ~IGeneratorTracker(); // = default; + virtual auto hasGenerator() const -> bool = 0; + virtual auto getGenerator() const -> Generators::GeneratorBasePtr const& = 0; + virtual void setGenerator( Generators::GeneratorBasePtr&& generator ) = 0; + }; + +} // namespace Catch + +#endif // CATCH_INTERFACES_GENERATORTRACKER_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_registry_hub.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_registry_hub.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bea1f7d480727179c95e3ab6c90a604d82ba97be --- /dev/null +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_registry_hub.hpp @@ -0,0 +1,63 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_INTERFACES_REGISTRY_HUB_HPP_INCLUDED +#define CATCH_INTERFACES_REGISTRY_HUB_HPP_INCLUDED + +#include <catch2/internal/catch_unique_ptr.hpp> + +#include <string> + +namespace Catch { + + class TestCaseHandle; + struct TestCaseInfo; + struct ITestCaseRegistry; + struct IExceptionTranslatorRegistry; + struct IExceptionTranslator; + struct IReporterRegistry; + struct IReporterFactory; + struct ITagAliasRegistry; + struct ITestInvoker; + struct IMutableEnumValuesRegistry; + struct SourceLineInfo; + + class StartupExceptionRegistry; + + using IReporterFactoryPtr = Detail::unique_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 const& getExceptionTranslatorRegistry() const = 0; + + + virtual StartupExceptionRegistry const& getStartupExceptionRegistry() const = 0; + }; + + struct IMutableRegistryHub { + virtual ~IMutableRegistryHub(); + virtual void registerReporter( std::string const& name, IReporterFactoryPtr factory ) = 0; + virtual void registerListener( IReporterFactoryPtr factory ) = 0; + virtual void registerTest(Detail::unique_ptr<TestCaseInfo>&& testInfo, Detail::unique_ptr<ITestInvoker>&& invoker) = 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; + virtual IMutableEnumValuesRegistry& getMutableEnumValuesRegistry() = 0; + }; + + IRegistryHub const& getRegistryHub(); + IMutableRegistryHub& getMutableRegistryHub(); + void cleanUp(); + std::string translateActiveException(); + +} + +#endif // CATCH_INTERFACES_REGISTRY_HUB_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter.cpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter.cpp new file mode 100644 index 0000000000000000000000000000000000000000..194161302d6a9fec3cff227eaee56b813aea4fa0 --- /dev/null +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter.cpp @@ -0,0 +1,111 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/interfaces/catch_interfaces_reporter.hpp> +#include <catch2/interfaces/catch_interfaces_config.hpp> +#include <catch2/internal/catch_console_colour.hpp> +#include <catch2/internal/catch_console_width.hpp> +#include <catch2/catch_message.hpp> +#include <catch2/internal/catch_list.hpp> +#include <catch2/internal/catch_string_manip.hpp> +#include <catch2/catch_test_case_info.hpp> +#include <catch2/reporters/catch_reporter_helpers.hpp> + +#include <algorithm> +#include <iomanip> + +namespace Catch { + + ReporterConfig::ReporterConfig( IConfig const* _fullConfig ) + : m_stream( &_fullConfig->stream() ), m_fullConfig( _fullConfig ) {} + + ReporterConfig::ReporterConfig( IConfig const* _fullConfig, std::ostream& _stream ) + : m_stream( &_stream ), m_fullConfig( _fullConfig ) {} + + std::ostream& ReporterConfig::stream() const { return *m_stream; } + IConfig const * 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 ); + } + } + + SectionStats::SectionStats( SectionInfo const& _sectionInfo, + Counts const& _assertions, + double _durationInSeconds, + bool _missingAssertions ) + : sectionInfo( _sectionInfo ), + assertions( _assertions ), + durationInSeconds( _durationInSeconds ), + missingAssertions( _missingAssertions ) + {} + + + 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 ) + {} + + + 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 ) + {} + + + TestRunStats::TestRunStats( TestRunInfo const& _runInfo, + Totals const& _totals, + bool _aborting ) + : runInfo( _runInfo ), + totals( _totals ), + aborting( _aborting ) + {} + + void IStreamingReporter::fatalErrorEncountered( StringRef ) {} + +} // end namespace Catch diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5a4c31a8df65760f8401e11d707d2c19eb55ebd7 --- /dev/null +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter.hpp @@ -0,0 +1,236 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_INTERFACES_REPORTER_HPP_INCLUDED +#define CATCH_INTERFACES_REPORTER_HPP_INCLUDED + +#include <catch2/catch_section_info.hpp> +#include <catch2/catch_totals.hpp> +#include <catch2/catch_assertion_result.hpp> +#include <catch2/internal/catch_message_info.hpp> +#include <catch2/internal/catch_stringref.hpp> +#include <catch2/internal/catch_unique_ptr.hpp> + +#include <catch2/benchmark/catch_estimate.hpp> +#include <catch2/benchmark/catch_outlier_classification.hpp> + + +#include <string> +#include <vector> +#include <iosfwd> + +namespace Catch { + + struct ReporterDescription; + struct TagInfo; + struct TestCaseInfo; + class TestCaseHandle; + struct IConfig; + + struct ReporterConfig { + explicit ReporterConfig( IConfig const* _fullConfig ); + + ReporterConfig( IConfig const* _fullConfig, std::ostream& _stream ); + + std::ostream& stream() const; + IConfig const* fullConfig() const; + + private: + std::ostream* m_stream; + IConfig const* m_fullConfig; + }; + + 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& ) = delete; + AssertionStats& operator = ( AssertionStats && ) = delete; + + AssertionResult assertionResult; + std::vector<MessageInfo> infoMessages; + Totals totals; + }; + + struct SectionStats { + SectionStats( SectionInfo const& _sectionInfo, + Counts const& _assertions, + double _durationInSeconds, + bool _missingAssertions ); + + 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 ); + + TestCaseInfo const * 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 ); + + GroupInfo groupInfo; + Totals totals; + bool aborting; + }; + + struct TestRunStats { + TestRunStats( TestRunInfo const& _runInfo, + Totals const& _totals, + bool _aborting ); + + TestRunInfo runInfo; + Totals totals; + bool aborting; + }; + + + struct BenchmarkInfo { + std::string name; + double estimatedDuration; + int iterations; + int samples; + unsigned int resamples; + double clockResolution; + double clockCost; + }; + + template <class Duration> + struct BenchmarkStats { + BenchmarkInfo info; + + std::vector<Duration> samples; + Benchmark::Estimate<Duration> mean; + Benchmark::Estimate<Duration> standardDeviation; + Benchmark::OutlierClassification outliers; + double outlierVariance; + + template <typename Duration2> + operator BenchmarkStats<Duration2>() const { + std::vector<Duration2> samples2; + samples2.reserve(samples.size()); + for (auto const& sample : samples) { + samples2.push_back(Duration2(sample)); + } + return { + info, + std::move(samples2), + mean, + standardDeviation, + outliers, + outlierVariance, + }; + } + }; + + //! By setting up its preferences, a reporter can modify Catch2's behaviour + //! in some regards, e.g. it can request Catch2 to capture writes to + //! stdout/stderr during test execution, and pass them to the reporter. + struct ReporterPreferences { + //! Catch2 should redirect writes to stdout and pass them to the + //! reporter + bool shouldRedirectStdOut = false; + //! Catch2 should call `Reporter::assertionEnded` even for passing + //! assertions + bool shouldReportAllAssertions = false; + }; + + + struct IStreamingReporter { + protected: + //! Derived classes can set up their preferences here + ReporterPreferences m_preferences; + //! The test run's config as filled in from CLI and defaults + IConfig const* m_config; + + public: + IStreamingReporter( IConfig const* config ): m_config( config ) {} + + virtual ~IStreamingReporter() = default; + + // Implementing class must also provide the following static methods: + // static std::string getDescription(); + + ReporterPreferences const& getPreferences() const { + return m_preferences; + } + + virtual void noMatchingTestCases( std::string const& spec ) = 0; + + virtual void reportInvalidArguments(std::string const&) {} + + 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; + + virtual void benchmarkPreparing( std::string const& ) {} + virtual void benchmarkStarting( BenchmarkInfo const& ) {} + virtual void benchmarkEnded( BenchmarkStats<> const& ) {} + virtual void benchmarkFailed( std::string 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; + + 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 ); + + //! Writes out information about provided reporters using reporter-specific format + virtual void listReporters(std::vector<ReporterDescription> const& descriptions) = 0; + //! Writes out information about provided tests using reporter-specific format + virtual void listTests(std::vector<TestCaseHandle> const& tests) = 0; + //! Writes out information about the provided tags using reporter-specific format + virtual void listTags(std::vector<TagInfo> const& tags) = 0; + + }; + using IStreamingReporterPtr = Detail::unique_ptr<IStreamingReporter>; + +} // end namespace Catch + +#endif // CATCH_INTERFACES_REPORTER_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_factory.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_factory.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9bcf94f0b9efd4683b448fae75d2bae5dcfa06ca --- /dev/null +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_factory.hpp @@ -0,0 +1,25 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_INTERFACES_REPORTER_FACTORY_HPP_INCLUDED +#define CATCH_INTERFACES_REPORTER_FACTORY_HPP_INCLUDED + +namespace Catch { + + struct ReporterConfig; + + struct IReporterFactory { + virtual ~IReporterFactory(); // = default + + virtual IStreamingReporterPtr + create( ReporterConfig const& config ) const = 0; + virtual std::string getDescription() const = 0; + }; + using IReporterFactoryPtr = Detail::unique_ptr<IReporterFactory>; +} // namespace Catch + +#endif // CATCH_INTERFACES_REPORTER_FACTORY_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_registry.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_registry.hpp new file mode 100644 index 0000000000000000000000000000000000000000..05195f370ec85731c7f0781efe906f3470ad3124 --- /dev/null +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_reporter_registry.hpp @@ -0,0 +1,38 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_INTERFACES_REPORTER_REGISTRY_HPP_INCLUDED +#define CATCH_INTERFACES_REPORTER_REGISTRY_HPP_INCLUDED + +#include <catch2/internal/catch_unique_ptr.hpp> + +#include <string> +#include <vector> +#include <map> + +namespace Catch { + + struct IConfig; + + struct IStreamingReporter; + using IStreamingReporterPtr = Detail::unique_ptr<IStreamingReporter>; + struct IReporterFactory; + using IReporterFactoryPtr = Detail::unique_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, IConfig const* config ) const = 0; + virtual FactoryMap const& getFactories() const = 0; + virtual Listeners const& getListeners() const = 0; + }; + +} // end namespace Catch + +#endif // CATCH_INTERFACES_REPORTER_REGISTRY_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_runner.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_runner.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9072d72123f6c1eeb001e6b29ec7cef4fc047b0c --- /dev/null +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_runner.hpp @@ -0,0 +1,19 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_INTERFACES_RUNNER_HPP_INCLUDED +#define CATCH_INTERFACES_RUNNER_HPP_INCLUDED + +namespace Catch { + + struct IRunner { + virtual ~IRunner(); + virtual bool aborting() const = 0; + }; +} + +#endif // CATCH_INTERFACES_RUNNER_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_tag_alias_registry.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_tag_alias_registry.hpp new file mode 100644 index 0000000000000000000000000000000000000000..152fdc2341436bcf48e58c47b00a1e2c37d05fb5 --- /dev/null +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_tag_alias_registry.hpp @@ -0,0 +1,28 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_INTERFACES_TAG_ALIAS_REGISTRY_HPP_INCLUDED +#define CATCH_INTERFACES_TAG_ALIAS_REGISTRY_HPP_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 // CATCH_INTERFACES_TAG_ALIAS_REGISTRY_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/interfaces/catch_interfaces_testcase.hpp b/packages/Catch2/src/catch2/interfaces/catch_interfaces_testcase.hpp new file mode 100644 index 0000000000000000000000000000000000000000..aad5ea20e3a66f0dbe5e83d5b8533ece6d5c6740 --- /dev/null +++ b/packages/Catch2/src/catch2/interfaces/catch_interfaces_testcase.hpp @@ -0,0 +1,41 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_INTERFACES_TESTCASE_HPP_INCLUDED +#define CATCH_INTERFACES_TESTCASE_HPP_INCLUDED + +#include <vector> + +namespace Catch { + + class TestSpec; + struct TestCaseInfo; + + struct ITestInvoker { + virtual void invoke () const = 0; + virtual ~ITestInvoker(); + }; + + class TestCaseHandle; + struct IConfig; + + struct ITestCaseRegistry { + virtual ~ITestCaseRegistry(); + // TODO: this exists only for adding filenames to test cases -- let's expose this in a saner way later + virtual std::vector<TestCaseInfo* > const& getAllInfos() const = 0; + virtual std::vector<TestCaseHandle> const& getAllTests() const = 0; + virtual std::vector<TestCaseHandle> const& getAllTestsSorted( IConfig const& config ) const = 0; + }; + + bool isThrowSafe( TestCaseHandle const& testCase, IConfig const& config ); + bool matchTest( TestCaseHandle const& testCase, TestSpec const& testSpec, IConfig const& config ); + std::vector<TestCaseHandle> filterTests( std::vector<TestCaseHandle> const& testCases, TestSpec const& testSpec, IConfig const& config ); + std::vector<TestCaseHandle> const& getAllTestCasesSorted( IConfig const& config ); + +} + +#endif // CATCH_INTERFACES_TESTCASE_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_assertion_handler.cpp b/packages/Catch2/src/catch2/internal/catch_assertion_handler.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7774ca68f116c5187fabe07098fcb706e3e9ef29 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_assertion_handler.cpp @@ -0,0 +1,87 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/internal/catch_assertion_handler.hpp> +#include <catch2/interfaces/catch_interfaces_config.hpp> +#include <catch2/internal/catch_context.hpp> +#include <catch2/internal/catch_enforce.hpp> +#include <catch2/internal/catch_debugger.hpp> +#include <catch2/internal/catch_test_failure_exception.hpp> +#include <catch2/interfaces/catch_interfaces_registry_hub.hpp> +#include <catch2/internal/catch_run_context.hpp> +#include <catch2/matchers/catch_matchers_string.hpp> + +namespace Catch { + + AssertionHandler::AssertionHandler + ( StringRef const& 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) { +#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + throw Catch::TestFailureException(); +#else + CATCH_ERROR( "Test failure requires aborting test!" ); +#endif + } + } + 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 const& matcherString ) { + handleExceptionMatchExpr( handler, Matchers::Equals( str ), matcherString ); + } + +} // namespace Catch diff --git a/packages/Catch2/src/catch2/internal/catch_assertion_handler.hpp b/packages/Catch2/src/catch2/internal/catch_assertion_handler.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8e266ade62a8fbb906e506ddbab7895a343418a4 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_assertion_handler.hpp @@ -0,0 +1,71 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_ASSERTION_HANDLER_HPP_INCLUDED +#define CATCH_ASSERTION_HANDLER_HPP_INCLUDED + +#include <catch2/catch_assertion_info.hpp> +#include <catch2/internal/catch_decomposer.hpp> +#include <catch2/interfaces/catch_interfaces_capture.hpp> +#include <catch2/internal/catch_lazy_expr.hpp> + +namespace Catch { + + struct AssertionResultData; + struct IResultCapture; + class RunContext; + + 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 const& 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 const& matcherString ); + +} // namespace Catch + +#endif // CATCH_ASSERTION_HANDLER_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_case_sensitive.hpp b/packages/Catch2/src/catch2/internal/catch_case_sensitive.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f941d1f2f153cd74d1719c7a29f83203537f66d7 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_case_sensitive.hpp @@ -0,0 +1,17 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_CASE_SENSITIVE_HPP_INCLUDED +#define CATCH_CASE_SENSITIVE_HPP_INCLUDED + +namespace Catch { + + enum class CaseSensitive { Yes, No }; + +} // namespace Catch + +#endif // CATCH_CASE_SENSITIVE_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_clara.cpp b/packages/Catch2/src/catch2/internal/catch_clara.cpp new file mode 100644 index 0000000000000000000000000000000000000000..eb7dacaea1a08493a65cd638524ae3708197d275 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_clara.cpp @@ -0,0 +1,445 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <algorithm> +#include <catch2/internal/catch_clara.hpp> +#include <catch2/internal/catch_console_width.hpp> +#include <catch2/internal/catch_platform.hpp> +#include <catch2/internal/catch_string_manip.hpp> +#include <catch2/internal/catch_textflow.hpp> + +namespace { + bool isOptPrefix( char c ) { + return c == '-' +#ifdef CATCH_PLATFORM_WINDOWS + || c == '/' +#endif + ; + } + + std::string normaliseOpt( std::string const& optName ) { +#ifdef CATCH_PLATFORM_WINDOWS + if ( optName[0] == '/' ) + return "-" + optName.substr( 1 ); + else +#endif + return optName; + } + +} // namespace + +namespace Catch { + namespace Clara { + namespace Detail { + + void TokenStream::loadBuffer() { + m_tokenBuffer.clear(); + + // 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 } ); + } + } + } + + TokenStream::TokenStream( Args const& args ): + TokenStream( args.m_args.begin(), args.m_args.end() ) {} + + TokenStream::TokenStream( Iterator it_, Iterator itEnd_ ): + it( it_ ), itEnd( itEnd_ ) { + loadBuffer(); + } + + TokenStream& TokenStream::operator++() { + if ( m_tokenBuffer.size() >= 2 ) { + m_tokenBuffer.erase( m_tokenBuffer.begin() ); + } else { + if ( it != itEnd ) + ++it; + loadBuffer(); + } + return *this; + } + + ParserResult convertInto( std::string const& source, + std::string& target ) { + target = source; + return ParserResult::ok( ParseResultType::Matched ); + } + + ParserResult convertInto( std::string const& source, + bool& target ) { + std::string srcLC = toLower( source ); + + 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 ); + } + + size_t ParserBase::cardinality() const { return 1; } + + InternalParseResult ParserBase::parse( Args const& args ) const { + return parse( args.exeName(), TokenStream( args ) ); + } + + ParseState::ParseState( ParseResultType type, + TokenStream const& remainingTokens ): + m_type( type ), m_remainingTokens( remainingTokens ) {} + + ParserResult BoundFlagRef::setFlag( bool flag ) { + m_ref = flag; + return ParserResult::ok( ParseResultType::Matched ); + } + + ResultBase::~ResultBase() = default; + + bool BoundRef::isContainer() const { return false; } + + bool BoundRef::isFlag() const { return false; } + + bool BoundFlagRefBase::isFlag() const { return true; } + +} // namespace Detail + + Detail::InternalParseResult Arg::parse(std::string const&, + Detail::TokenStream const& tokens) const { + auto validationResult = validate(); + if (!validationResult) + return Detail::InternalParseResult(validationResult); + + auto remainingTokens = tokens; + auto const& token = *remainingTokens; + if (token.type != Detail::TokenType::Argument) + return Detail::InternalParseResult::ok(Detail::ParseState( + ParseResultType::NoMatch, remainingTokens)); + + assert(!m_ref->isFlag()); + auto valueRef = + static_cast<Detail::BoundValueRefBase*>(m_ref.get()); + + auto result = valueRef->setValue(remainingTokens->token); + if (!result) + return Detail::InternalParseResult(result); + else + return Detail::InternalParseResult::ok(Detail::ParseState( + ParseResultType::Matched, ++remainingTokens)); + } + + Opt::Opt(bool& ref) : + ParserRefImpl(std::make_shared<Detail::BoundFlagRef>(ref)) {} + + std::vector<Detail::HelpColumns> Opt::getHelpColumns() const { + 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 } }; + } + + bool Opt::isMatch(std::string const& optToken) const { + auto normalisedToken = normaliseOpt(optToken); + for (auto const& name : m_optNames) { + if (normaliseOpt(name) == normalisedToken) + return true; + } + return false; + } + + Detail::InternalParseResult Opt::parse(std::string const&, + Detail::TokenStream const& tokens) const { + auto validationResult = validate(); + if (!validationResult) + return Detail::InternalParseResult(validationResult); + + auto remainingTokens = tokens; + if (remainingTokens && + remainingTokens->type == Detail::TokenType::Option) { + auto const& token = *remainingTokens; + if (isMatch(token.token)) { + if (m_ref->isFlag()) { + auto flagRef = + static_cast<Detail::BoundFlagRefBase*>( + m_ref.get()); + auto result = flagRef->setFlag(true); + if (!result) + return Detail::InternalParseResult(result); + if (result.value() == + ParseResultType::ShortCircuitAll) + return Detail::InternalParseResult::ok(Detail::ParseState( + result.value(), remainingTokens)); + } else { + auto valueRef = + static_cast<Detail::BoundValueRefBase*>( + m_ref.get()); + ++remainingTokens; + if (!remainingTokens) + return Detail::InternalParseResult::runtimeError( + "Expected argument following " + + token.token); + auto const& argToken = *remainingTokens; + if (argToken.type != Detail::TokenType::Argument) + return Detail::InternalParseResult::runtimeError( + "Expected argument following " + + token.token); + auto result = valueRef->setValue(argToken.token); + if (!result) + return Detail::InternalParseResult(result); + if (result.value() == + ParseResultType::ShortCircuitAll) + return Detail::InternalParseResult::ok(Detail::ParseState( + result.value(), remainingTokens)); + } + return Detail::InternalParseResult::ok(Detail::ParseState( + ParseResultType::Matched, ++remainingTokens)); + } + } + return Detail::InternalParseResult::ok( + Detail::ParseState(ParseResultType::NoMatch, remainingTokens)); + } + + Detail::Result Opt::validate() const { + if (m_optNames.empty()) + return Detail::Result::logicError("No options supplied to Opt"); + for (auto const& name : m_optNames) { + if (name.empty()) + return Detail::Result::logicError( + "Option name cannot be empty"); +#ifdef CATCH_PLATFORM_WINDOWS + if (name[0] != '-' && name[0] != '/') + return Detail::Result::logicError( + "Option name must begin with '-' or '/'"); +#else + if (name[0] != '-') + return Detail::Result::logicError( + "Option name must begin with '-'"); +#endif + } + return ParserRefImpl::validate(); + } + + ExeName::ExeName() : + m_name(std::make_shared<std::string>("<executable>")) {} + + ExeName::ExeName(std::string& ref) : ExeName() { + m_ref = std::make_shared<Detail::BoundValueRef<std::string>>(ref); + } + + Detail::InternalParseResult + ExeName::parse(std::string const&, + Detail::TokenStream const& tokens) const { + return Detail::InternalParseResult::ok( + Detail::ParseState(ParseResultType::NoMatch, tokens)); + } + + ParserResult ExeName::set(std::string const& newName) { + 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); + } + + + + + Parser& Parser::operator|=( Parser const& other ) { + 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; + } + + std::vector<Detail::HelpColumns> Parser::getHelpColumns() const { + std::vector<Detail::HelpColumns> cols; + for ( auto const& o : m_options ) { + auto childCols = o.getHelpColumns(); + cols.insert( cols.end(), childCols.begin(), childCols.end() ); + } + return cols; + } + + void Parser::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:\n"; + } + + auto rows = getHelpColumns(); + size_t consoleWidth = CATCH_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 << '\n'; + } + } + + Detail::Result Parser::validate() const { + 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 Detail::Result::ok(); + } + + Detail::InternalParseResult + Parser::parse( std::string const& exeName, + Detail::TokenStream const& tokens ) const { + + struct ParserInfo { + ParserBase const* parser = nullptr; + size_t count = 0; + }; + std::vector<ParserInfo> parseInfos; + parseInfos.reserve( m_options.size() + m_args.size() ); + for ( auto const& opt : m_options ) { + parseInfos.push_back( { &opt, 0 } ); + } + for ( auto const& arg : m_args ) { + parseInfos.push_back( { &arg, 0 } ); + } + + m_exeName.set( exeName ); + + auto result = Detail::InternalParseResult::ok( + Detail::ParseState( ParseResultType::NoMatch, tokens ) ); + while ( result.value().remainingTokens() ) { + bool tokenParsed = false; + + for ( auto& parseInfo : parseInfos ) { + 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 Detail::InternalParseResult::runtimeError( + "Unrecognised token: " + + result.value().remainingTokens()->token ); + } + // !TBD Check missing required options + return result; + } + + Args::Args(int argc, char const* const* argv) : + m_exeName(argv[0]), m_args(argv + 1, argv + argc) {} + + Args::Args(std::initializer_list<std::string> args) : + m_exeName(*args.begin()), + m_args(args.begin() + 1, args.end()) {} + + + Help::Help( bool& showHelpFlag ): + Opt( [&]( bool flag ) { + showHelpFlag = flag; + return ParserResult::ok( ParseResultType::ShortCircuitAll ); + } ) { + static_cast<Opt&> ( *this )( + "display usage information" )["-?"]["-h"]["--help"] + .optional(); + } + + } // namespace Clara +} // namespace Catch diff --git a/packages/Catch2/src/catch2/internal/catch_clara.hpp b/packages/Catch2/src/catch2/internal/catch_clara.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2da6919a229d49e8beb52def386a7cb665a3ab06 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_clara.hpp @@ -0,0 +1,665 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_CLARA_HPP_INCLUDED +#define CATCH_CLARA_HPP_INCLUDED + +#if defined( __clang__ ) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wweak-vtables" +# pragma clang diagnostic ignored "-Wshadow" +# pragma clang diagnostic ignored "-Wdeprecated" +#endif + +#if defined( __GNUC__ ) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wsign-conversion" +#endif + +#ifndef CLARA_CONFIG_OPTIONAL_TYPE +# ifdef __has_include +# if __has_include( <optional>) && __cplusplus >= 201703L +# include <optional> +# define CLARA_CONFIG_OPTIONAL_TYPE std::optional +# endif +# endif +#endif + +#include <catch2/internal/catch_noncopyable.hpp> + +#include <cassert> +#include <cctype> +#include <memory> +#include <ostream> +#include <sstream> +#include <string> +#include <vector> + +namespace Catch { + namespace Clara { + + class Args; + class Parser; + + // enum of result types from a parse + enum class ParseResultType { + Matched, + NoMatch, + ShortCircuitAll, + ShortCircuitSame + }; + + 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; + + // 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; + }; + + // 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(); + + public: + explicit TokenStream( Args const& args ); + TokenStream( Iterator it, Iterator itEnd ); + + explicit operator bool() const { + return !m_tokenBuffer.empty() || it != itEnd; + } + + size_t count() const { + return m_tokenBuffer.size() + ( itEnd - it ); + } + + Token operator*() const { + assert( !m_tokenBuffer.empty() ); + return m_tokenBuffer.front(); + } + + Token const* operator->() const { + assert( !m_tokenBuffer.empty() ); + return &m_tokenBuffer.front(); + } + + TokenStream& operator++(); + }; + + //! Denotes type of a parsing result + enum class ResultType { + Ok, ///< No errors + LogicError, ///< Error in user-specified arguments for + ///< construction + RuntimeError ///< Error in parsing inputs + }; + + class ResultBase { + protected: + ResultBase( ResultType type ): m_type( type ) {} + virtual ~ResultBase(); // = default; + + + ResultBase(ResultBase const&) = default; + ResultBase& operator=(ResultBase const&) = default; + ResultBase(ResultBase&&) = default; + ResultBase& operator=(ResultBase&&) = default; + + virtual void enforceOk() const = 0; + + ResultType m_type; + }; + + template <typename T> class ResultValueBase : public ResultBase { + public: + auto value() const -> T const& { + enforceOk(); + return m_value; + } + + protected: + ResultValueBase( ResultType type ): ResultBase( type ) {} + + ResultValueBase( ResultValueBase const& other ): + ResultBase( other ) { + if ( m_type == ResultType::Ok ) + new ( &m_value ) T( other.m_value ); + } + + ResultValueBase( ResultType, T const& value ): ResultBase( ResultType::Ok ) { + new ( &m_value ) T( value ); + } + + auto operator=( ResultValueBase const& other ) + -> ResultValueBase& { + if ( m_type == ResultType::Ok ) + m_value.~T(); + ResultBase::operator=( other ); + if ( m_type == ResultType::Ok ) + new ( &m_value ) T( other.m_value ); + return *this; + } + + ~ResultValueBase() override { + if ( m_type == ResultType::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() != ResultType::Ok ); + } + + template <typename U> + static auto ok( U const& value ) -> BasicResult { + return { ResultType::Ok, value }; + } + static auto ok() -> BasicResult { return { ResultType::Ok }; } + static auto logicError( std::string const& message ) + -> BasicResult { + return { ResultType::LogicError, message }; + } + static auto runtimeError( std::string const& message ) + -> BasicResult { + return { ResultType::RuntimeError, message }; + } + + explicit operator bool() const { + return m_type == ResultType::Ok; + } + auto type() const -> ResultType { return m_type; } + auto errorMessage() const -> std::string { + return m_errorMessage; + } + + protected: + void enforceOk() const override { + + // Errors shouldn't reach this point, but if they do + // the actual error message will be in m_errorMessage + assert( m_type != ResultType::LogicError ); + assert( m_type != ResultType::RuntimeError ); + if ( m_type != ResultType::Ok ) + std::abort(); + } + + std::string + m_errorMessage; // Only populated if resultType is an error + + BasicResult( ResultType type, + std::string const& message ): + ResultValueBase<T>( type ), m_errorMessage( message ) { + assert( m_type != ResultType::Ok ); + } + + using ResultValueBase<T>::ResultValueBase; + using ResultBase::m_type; + }; + + class ParseState { + public: + ParseState( ParseResultType type, + TokenStream const& remainingTokens ); + + ParseResultType type() const { return m_type; } + TokenStream const& remainingTokens() const { + 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> + ParserResult convertInto( std::string const& source, T& target ) { + std::stringstream ss( source ); + ss >> target; + if ( ss.fail() ) { + return ParserResult::runtimeError( + "Unable to convert '" + source + + "' to destination type" ); + } else { + return ParserResult::ok( ParseResultType::Matched ); + } + } + ParserResult convertInto( std::string const& source, + std::string& target ); + ParserResult convertInto( std::string const& source, bool& target ); + +#ifdef CLARA_CONFIG_OPTIONAL_TYPE + template <typename T> + auto convertInto( std::string const& source, + CLARA_CONFIG_OPTIONAL_TYPE<T>& target ) + -> ParserResult { + T temp; + auto result = convertInto( source, temp ); + if ( result ) + target = std::move( temp ); + return result; + } +#endif // CLARA_CONFIG_OPTIONAL_TYPE + + struct BoundRef : Catch::Detail::NonCopyable { + virtual ~BoundRef() = default; + virtual bool isContainer() const; + virtual bool isFlag() const; + }; + struct BoundValueRefBase : BoundRef { + virtual auto setValue( std::string const& arg ) + -> ParserResult = 0; + }; + struct BoundFlagRefBase : BoundRef { + virtual auto setFlag( bool flag ) -> ParserResult = 0; + bool isFlag() const override; + }; + + template <typename T> struct BoundValueRef : BoundValueRefBase { + T& m_ref; + + explicit BoundValueRef( T& ref ): m_ref( ref ) {} + + ParserResult setValue( std::string const& arg ) 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 ) {} + + ParserResult setFlag( bool flag ) override; + }; + + 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> + 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 }; + + 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 size_t cardinality() const; + + InternalParseResult parse( Args const& args ) const; + }; + + template <typename DerivedT> + class ComposableParserImpl : public ParserBase { + public: + 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; + } + + std::string const& hint() const { return m_hint; } + }; + + } // namespace detail + + + // A parser for arguments + class Arg : public Detail::ParserRefImpl<Arg> { + public: + using ParserRefImpl::ParserRefImpl; + using ParserBase::parse; + + Detail::InternalParseResult + parse(std::string const&, + Detail::TokenStream const& tokens) const override; + }; + + // A parser for options + class Opt : public Detail::ParserRefImpl<Opt> { + protected: + std::vector<std::string> m_optNames; + + public: + template <typename LambdaT> + explicit Opt(LambdaT const& ref) : + ParserRefImpl( + std::make_shared<Detail::BoundFlagLambda<LambdaT>>(ref)) {} + + explicit Opt(bool& 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; + } + + std::vector<Detail::HelpColumns> getHelpColumns() const; + + bool isMatch(std::string const& optToken) const; + + using ParserBase::parse; + + Detail::InternalParseResult + parse(std::string const&, + Detail::TokenStream const& tokens) const override; + + Detail::Result validate() const override; + }; + + // Specifies the name of the executable + class ExeName : public Detail::ComposableParserImpl<ExeName> { + std::shared_ptr<std::string> m_name; + std::shared_ptr<Detail::BoundValueRefBase> m_ref; + + template <typename LambdaT> + static auto makeRef(LambdaT const& lambda) + -> std::shared_ptr<Detail::BoundValueRefBase> { + return std::make_shared<Detail::BoundLambda<LambdaT>>(lambda); + } + + public: + ExeName(); + explicit ExeName(std::string& ref); + + template <typename LambdaT> + explicit ExeName(LambdaT const& lambda) : ExeName() { + m_ref = std::make_shared<Detail::BoundLambda<LambdaT>>(lambda); + } + + // The exe name is not parsed out of the normal tokens, but is + // handled specially + Detail::InternalParseResult + parse(std::string const&, + Detail::TokenStream const& tokens) const override; + + std::string const& name() const { return *m_name; } + Detail::ParserResult set(std::string const& newName); + }; + + + // A Combined parser + class Parser : Detail::ParserBase { + mutable ExeName m_exeName; + std::vector<Opt> m_options; + std::vector<Arg> m_args; + + public: + + 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; + } + + Parser& operator|=(Parser const& other); + + template <typename T> + auto operator|(T const& other) const -> Parser { + return Parser(*this) |= other; + } + + std::vector<Detail::HelpColumns> getHelpColumns() const; + + void writeToStream(std::ostream& os) const; + + friend auto operator<<(std::ostream& os, Parser const& parser) + -> std::ostream& { + parser.writeToStream(os); + return os; + } + + Detail::Result validate() const override; + + using ParserBase::parse; + Detail::InternalParseResult + parse(std::string const& exeName, + Detail::TokenStream const& tokens) const override; + }; + + // Transport for raw args (copied from main args, or supplied via + // init list for testing) + class Args { + friend Detail::TokenStream; + std::string m_exeName; + std::vector<std::string> m_args; + + public: + Args(int argc, char const* const* argv); + Args(std::initializer_list<std::string> args); + + std::string const& exeName() const { return m_exeName; } + }; + + + // Convenience wrapper for option parser that specifies the help option + struct Help : Opt { + Help(bool& showHelpFlag); + }; + + // Result type for parser operation + using Detail::ParserResult; + + namespace Detail { + template <typename DerivedT> + template <typename T> + Parser + ComposableParserImpl<DerivedT>::operator|(T const& other) const { + return Parser() | static_cast<DerivedT const&>(*this) | other; + } + } + + } // namespace Clara +} // namespace Catch + +#if defined( __clang__ ) +# pragma clang diagnostic pop +#endif + +#if defined( __GNUC__ ) +# pragma GCC diagnostic pop +#endif + +#endif // CATCH_CLARA_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_combined_tu.cpp b/packages/Catch2/src/catch2/internal/catch_combined_tu.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c3ed9e2bc7abead4b9a86462fa02714bb64b0665 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_combined_tu.cpp @@ -0,0 +1,237 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +/** \file + * This is a special TU that combines what would otherwise be a very + * small top-level TUs into one bigger TU. + * + * The reason for this is compilation performance improvements by + * avoiding reparsing headers for many small TUs, instead having this + * one TU include bit more, but having it all parsed only once. + * + * To avoid heavy-tail problem with compilation times, each "subpart" + * of Catch2 has its own combined TU like this. + */ + + +//////////////////////////////////////////////////////// +// vvv formerly catch_tag_alias_autoregistrar.cpp vvv // +//////////////////////////////////////////////////////// + +#include <catch2/catch_tag_alias_autoregistrar.hpp> +#include <catch2/internal/catch_compiler_capabilities.hpp> +#include <catch2/interfaces/catch_interfaces_registry_hub.hpp> + +namespace Catch { + + RegistrarForTagAliases::RegistrarForTagAliases(char const* alias, char const* tag, SourceLineInfo const& lineInfo) { + CATCH_TRY { + getMutableRegistryHub().registerTagAlias(alias, tag, lineInfo); + } CATCH_CATCH_ALL { + // Do not throw when constructing global objects, instead register the exception to be processed later + getMutableRegistryHub().registerStartupException(); + } + } + +} + + +////////////////////////////////////////// +// vvv formerly catch_polyfills.cpp vvv // +////////////////////////////////////////// + +#include <catch2/internal/catch_polyfills.hpp> +#include <catch2/internal/catch_compiler_capabilities.hpp> +#include <cmath> + +namespace Catch { + +#if !defined(CATCH_CONFIG_POLYFILL_ISNAN) + bool isnan(float f) { + return std::isnan(f); + } + bool isnan(double d) { + return std::isnan(d); + } +#else + // For now we only use this for embarcadero + bool isnan(float f) { + return std::_isnan(f); + } + bool isnan(double d) { + return std::_isnan(d); + } +#endif + +} // end namespace Catch + + +//////////////////////////////////////////////////// +// vvv formerly catch_uncaught_exceptions.cpp vvv // +//////////////////////////////////////////////////// + +#include <catch2/internal/catch_compiler_capabilities.hpp> +#include <catch2/internal/catch_uncaught_exceptions.hpp> +#include <catch2/internal/catch_config_uncaught_exceptions.hpp> + +#include <exception> + +namespace Catch { + bool uncaught_exceptions() { +#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + return false; +#elif defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) + return std::uncaught_exceptions() > 0; +#else + return std::uncaught_exception(); +#endif + } +} // end namespace Catch + + +//////////////////////////////////////////// +// vvv formerly catch_errno_guard.cpp vvv // +//////////////////////////////////////////// +#include <catch2/internal/catch_errno_guard.hpp> + +#include <cerrno> + +namespace Catch { + ErrnoGuard::ErrnoGuard():m_oldErrno(errno){} + ErrnoGuard::~ErrnoGuard() { errno = m_oldErrno; } +} + + +/////////////////////////////////////////// +// vvv formerly catch_decomposer.cpp vvv // +/////////////////////////////////////////// +#include <catch2/internal/catch_decomposer.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; + } +} + + +/////////////////////////////////////////////////////////// +// vvv formerly catch_startup_exception_registry.cpp vvv // +/////////////////////////////////////////////////////////// +#include <catch2/internal/catch_startup_exception_registry.hpp> +#include <catch2/internal/catch_compiler_capabilities.hpp> + +namespace Catch { +#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + void StartupExceptionRegistry::add( std::exception_ptr const& exception ) noexcept { + CATCH_TRY { + m_exceptions.push_back(exception); + } CATCH_CATCH_ALL { + // 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; + } +#endif + +} // end namespace Catch + + +////////////////////////////////////////////// +// vvv formerly catch_leak_detector.cpp vvv // +////////////////////////////////////////////// +#include <catch2/internal/catch_leak_detector.hpp> +#include <catch2/interfaces/catch_interfaces_registry_hub.hpp> + + +#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 // ^^ Windows crt debug heap enabled // Windows crt debug heap disabled vv + + Catch::LeakDetector::LeakDetector() {} + +#endif // CATCH_CONFIG_WINDOWS_CRTDBG + +Catch::LeakDetector::~LeakDetector() { + Catch::cleanUp(); +} + + +///////////////////////////////////////////// +// vvv formerly catch_message_info.cpp vvv // +///////////////////////////////////////////// + +#include <catch2/internal/catch_message_info.hpp> + +namespace Catch { + + MessageInfo::MessageInfo( StringRef const& _macroName, + SourceLineInfo const& _lineInfo, + ResultWas::OfType _type ) + : macroName( _macroName ), + lineInfo( _lineInfo ), + type( _type ), + sequence( ++globalCount ) + {} + + // This may need protecting if threading support is added + unsigned int MessageInfo::globalCount = 0; + +} // end namespace Catch + + + + +////////////////////////////////////////// +// vvv formerly catch_lazy_expr.cpp vvv // +////////////////////////////////////////// +#include <catch2/internal/catch_lazy_expr.hpp> +#include <catch2/internal/catch_decomposer.hpp> + +namespace Catch { + + 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; + } + +} // namespace Catch diff --git a/packages/Catch2/src/catch2/internal/catch_commandline.cpp b/packages/Catch2/src/catch2/internal/catch_commandline.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0cb160e06c5362c63816f7860d56fd388a265c53 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_commandline.cpp @@ -0,0 +1,227 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/internal/catch_commandline.hpp> + +#include <catch2/catch_config.hpp> +#include <catch2/internal/catch_string_manip.hpp> +#include <catch2/interfaces/catch_interfaces_registry_hub.hpp> +#include <catch2/interfaces/catch_interfaces_reporter_registry.hpp> +#include <catch2/interfaces/catch_interfaces_reporter.hpp> + +#include <fstream> +#include <ctime> + +namespace Catch { + + Clara::Parser makeCommandLineParser( ConfigData& config ) { + + using namespace Clara; + + auto const setWarning = [&]( std::string const& warning ) { + auto warningSet = [&]() { + if( warning == "NoAssertions" ) + return WarnAbout::NoAssertions; + + if ( warning == "NoTests" ) + return WarnAbout::NoTests; + + return WarnAbout::Nothing; + }(); + + if (warningSet == WarnAbout::Nothing) + return ParserResult::runtimeError( "Unrecognised warning: '" + warning + "'" ); + config.warnings = static_cast<WarnAbout::What>( config.warnings | warningSet ); + 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 ); + config.testsOrTags.emplace_back( "," ); + } + } + //Remove comma in the end + if(!config.testsOrTags.empty()) + config.testsOrTags.erase( config.testsOrTags.end()-1 ); + + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const setTestOrder = [&]( std::string const& order ) { + if( startsWith( "declared", order ) ) + config.runOrder = TestRunOrder::Declared; + else if( startsWith( "lexical", order ) ) + config.runOrder = TestRunOrder::LexicographicallySorted; + else if( startsWith( "random", order ) ) + config.runOrder = TestRunOrder::Randomized; + else + return 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 == "never") + config.waitForKeypress = WaitForKeypress::Never; + else 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: never, 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 const setReporter = [&]( std::string const& reporter ) { + IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories(); + + auto lcReporter = toLower( reporter ); + auto result = factories.find( lcReporter ); + + if( factories.end() != result ) + config.reporterName = lcReporter; + else + return ParserResult::runtimeError( "Unrecognized reporter, '" + reporter + "'. Check available with --list-reporters" ); + 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( setReporter, "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( config.minDuration, "seconds" ) + ["-D"]["--min-duration"] + ( "show test durations for tests taking at least the given number of seconds" ) + | Opt( loadTestNamesFromFile, "filename" ) + ["-f"]["--input-file"] + ( "load test names to run from a file" ) + | 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.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, "never|start|exit|both" ) + ["--wait-for-keypress"] + ( "waits for a keypress before exiting" ) + | Opt( config.benchmarkSamples, "samples" ) + ["--benchmark-samples"] + ( "number of samples to collect (default: 100)" ) + | Opt( config.benchmarkResamples, "resamples" ) + ["--benchmark-resamples"] + ( "number of resamples for the bootstrap (default: 100000)" ) + | Opt( config.benchmarkConfidenceInterval, "confidence interval" ) + ["--benchmark-confidence-interval"] + ( "confidence interval for the bootstrap (between 0 and 1, default: 0.95)" ) + | Opt( config.benchmarkNoAnalysis ) + ["--benchmark-no-analysis"] + ( "perform only measurements; do not perform any analysis" ) + | Opt( config.benchmarkWarmupTime, "benchmarkWarmupTime" ) + ["--benchmark-warmup-time"] + ( "amount of time in milliseconds spent on warming up each test (default: 100)" ) + | Arg( config.testsOrTags, "test name|pattern|tags" ) + ( "which test or tests to use" ); + + return cli; + } + +} // end namespace Catch diff --git a/packages/Catch2/src/catch2/internal/catch_commandline.hpp b/packages/Catch2/src/catch2/internal/catch_commandline.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1e03085644bae7ac3922b0febb1e39166b8efb6e --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_commandline.hpp @@ -0,0 +1,21 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_COMMANDLINE_HPP_INCLUDED +#define CATCH_COMMANDLINE_HPP_INCLUDED + +#include <catch2/internal/catch_clara.hpp> + +namespace Catch { + + struct ConfigData; + + Clara::Parser makeCommandLineParser( ConfigData& config ); + +} // end namespace Catch + +#endif // CATCH_COMMANDLINE_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_compiler_capabilities.hpp b/packages/Catch2/src/catch2/internal/catch_compiler_capabilities.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3c24cf2b819898252e2f9401afeb53b6fe4a66cd --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_compiler_capabilities.hpp @@ -0,0 +1,353 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED +#define CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED + +// Detect a number of compiler features - by compiler +// The following features are defined: +// +// CATCH_CONFIG_WINDOWS_SEH : is Windows SEH supported? +// CATCH_CONFIG_POSIX_SIGNALS : are POSIX signals supported? +// CATCH_CONFIG_DISABLE_EXCEPTIONS : Are exceptions enabled? +// **************** +// 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. + +#include <catch2/internal/catch_platform.hpp> + +#ifdef __cplusplus + +# if (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) +# define CATCH_CPP14_OR_GREATER +# endif + +# if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) +# define CATCH_CPP17_OR_GREATER +# endif + +#endif + +// We have to avoid both ICC and Clang, because they try to mask themselves +// as gcc, and we want only GCC in this block +#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && !defined(__CUDACC__) +# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic push" ) +# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic pop" ) + +// This only works on GCC 9+. so we have to also add a global suppression of Wparentheses +// for older versions of GCC. +# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ + _Pragma( "GCC diagnostic ignored \"-Wparentheses\"" ) + +# define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + _Pragma( "GCC diagnostic ignored \"-Wunused-variable\"" ) + +# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) + +#endif + +#if defined(__clang__) && !defined(_MSC_VER) + +# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic push" ) +# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic pop" ) + +// As of this writing, IBM XL's implementation of __builtin_constant_p has a bug +// which results in calls to destructors being emitted for each temporary, +// without a matching initialization. In practice, this can result in something +// like `std::string::~string` being called on an uninitialized value. +// +// For example, this code will likely segfault under IBM XL: +// ``` +// REQUIRE(std::string("12") + "34" == "1234") +// ``` +// +// Therefore, `CATCH_INTERNAL_IGNORE_BUT_WARN` is not implemented. +# if !defined(__ibmxl__) && !defined(__CUDACC__) +# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) /* NOLINT(cppcoreguidelines-pro-type-vararg, hicpp-vararg) */ +# endif + + +# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) \ + _Pragma( "clang diagnostic ignored \"-Wglobal-constructors\"") + +# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wparentheses\"" ) + +# define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wunused-variable\"" ) + +# define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wgnu-zero-variadic-macro-arguments\"" ) + +# define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wunused-template\"" ) + +#endif // __clang__ + + +//////////////////////////////////////////////////////////////////////////////// +// Assume that non-Windows platforms support posix signals by default +#if !defined(CATCH_PLATFORM_WINDOWS) + #define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS +#endif + +//////////////////////////////////////////////////////////////////////////////// +// We know some environments not to support full POSIX signals +#if defined(__CYGWIN__) || defined(__QNX__) || defined(__EMSCRIPTEN__) || defined(__DJGPP__) + #define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS +#endif + +#ifdef __OS400__ +# define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS +# define CATCH_CONFIG_COLOUR_NONE +#endif + +//////////////////////////////////////////////////////////////////////////////// +// Android somehow still does not support std::to_string +#if defined(__ANDROID__) +# define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING +#endif + +//////////////////////////////////////////////////////////////////////////////// +// Not all Windows environments support SEH properly +#if defined(__MINGW32__) +# define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH +#endif + +//////////////////////////////////////////////////////////////////////////////// +// PS4 +#if defined(__ORBIS__) +# define CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE +#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 +// some versions of cygwin (most) do not support std::to_string. Use the libstd check. +// https://gcc.gnu.org/onlinedocs/gcc-4.8.2/libstdc++/api/a01053_source.html line 2812-2813 +# if !((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \ + && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF)) + +# define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING + +# endif +#endif // __CYGWIN__ + +//////////////////////////////////////////////////////////////////////////////// +// Visual C++ +#if defined(_MSC_VER) + +# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma( warning(push) ) +# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION __pragma( warning(pop) ) + +// 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 + +// MSVC traditional preprocessor needs some workaround for __VA_ARGS__ +// _MSVC_TRADITIONAL == 0 means new conformant preprocessor +// _MSVC_TRADITIONAL == 1 means old traditional non-conformant preprocessor +# if !defined(__clang__) // Handle Clang masquerading for msvc +# if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL) +# define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +# endif // MSVC_TRADITIONAL +# endif // __clang__ + +#endif // _MSC_VER + +#if defined(_REENTRANT) || defined(_MSC_VER) +// Enable async processing, as -pthread is specified or no additional linking is required +# define CATCH_INTERNAL_CONFIG_USE_ASYNC +#endif // _MSC_VER + +//////////////////////////////////////////////////////////////////////////////// +// Check if we are compiled with -fno-exceptions or equivalent +#if defined(__EXCEPTIONS) || defined(__cpp_exceptions) || defined(_CPPUNWIND) +# define CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED +#endif + + +//////////////////////////////////////////////////////////////////////////////// +// Embarcadero C++Build +#if defined(__BORLANDC__) + #define CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN +#endif + +//////////////////////////////////////////////////////////////////////////////// + +// RTX is a special version of Windows that is real time. +// This means that it is detected as Windows, but does not provide +// the same set of capabilities as real Windows does. +#if defined(UNDER_RTSS) || defined(RTX64_BUILD) + #define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH + #define CATCH_INTERNAL_CONFIG_NO_ASYNC + #define CATCH_CONFIG_COLOUR_NONE +#endif + +#if !defined(_GLIBCXX_USE_C99_MATH_TR1) +#define CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER +#endif + +// Various stdlib support checks that require __has_include +#if defined(__has_include) + // Check if string_view is available and usable + #if __has_include(<string_view>) && defined(CATCH_CPP17_OR_GREATER) + # define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW + #endif + + // Check if optional is available and usable + # if __has_include(<optional>) && defined(CATCH_CPP17_OR_GREATER) + # define CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL + # endif // __has_include(<optional>) && defined(CATCH_CPP17_OR_GREATER) + + // Check if byte is available and usable + # if __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER) + # include <cstddef> + # if __cpp_lib_byte > 0 + # define CATCH_INTERNAL_CONFIG_CPP17_BYTE + # endif + # endif // __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER) + + // Check if variant is available and usable + # if __has_include(<variant>) && defined(CATCH_CPP17_OR_GREATER) + # if defined(__clang__) && (__clang_major__ < 8) + // work around clang bug with libstdc++ https://bugs.llvm.org/show_bug.cgi?id=31852 + // fix should be in clang 8, workaround in libstdc++ 8.2 + # include <ciso646> + # if defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) + # define CATCH_CONFIG_NO_CPP17_VARIANT + # else + # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT + # endif // defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) + # else + # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT + # endif // defined(__clang__) && (__clang_major__ < 8) + # endif // __has_include(<variant>) && defined(CATCH_CPP17_OR_GREATER) +#endif // defined(__has_include) + + +#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH) && !defined(CATCH_INTERNAL_CONFIG_NO_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_POSIX_SIGNALS) && !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_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_CPP11_TO_STRING) +# define CATCH_CONFIG_CPP11_TO_STRING +#endif + +#if defined(CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_NO_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_CPP17_OPTIONAL) +# define CATCH_CONFIG_CPP17_OPTIONAL +#endif + +#if defined(CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_NO_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_CPP17_STRING_VIEW) +# define CATCH_CONFIG_CPP17_STRING_VIEW +#endif + +#if defined(CATCH_INTERNAL_CONFIG_CPP17_VARIANT) && !defined(CATCH_CONFIG_NO_CPP17_VARIANT) && !defined(CATCH_CONFIG_CPP17_VARIANT) +# define CATCH_CONFIG_CPP17_VARIANT +#endif + +#if defined(CATCH_INTERNAL_CONFIG_CPP17_BYTE) && !defined(CATCH_CONFIG_NO_CPP17_BYTE) && !defined(CATCH_CONFIG_CPP17_BYTE) +# define CATCH_CONFIG_CPP17_BYTE +#endif + + +#if defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT) +# define CATCH_INTERNAL_CONFIG_NEW_CAPTURE +#endif + +#if defined(CATCH_INTERNAL_CONFIG_NEW_CAPTURE) && !defined(CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NEW_CAPTURE) +# define CATCH_CONFIG_NEW_CAPTURE +#endif + +#if !defined(CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) +# define CATCH_CONFIG_DISABLE_EXCEPTIONS +#endif + +#if defined(CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_NO_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_POLYFILL_ISNAN) +# define CATCH_CONFIG_POLYFILL_ISNAN +#endif + +#if defined(CATCH_INTERNAL_CONFIG_USE_ASYNC) && !defined(CATCH_INTERNAL_CONFIG_NO_ASYNC) && !defined(CATCH_CONFIG_NO_USE_ASYNC) && !defined(CATCH_CONFIG_USE_ASYNC) +# define CATCH_CONFIG_USE_ASYNC +#endif + +#if defined(CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_NO_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_GLOBAL_NEXTAFTER) +# define CATCH_CONFIG_GLOBAL_NEXTAFTER +#endif + + +// Even if we do not think the compiler has that warning, we still have +// to provide a macro that can be used by the code. +#if !defined(CATCH_INTERNAL_START_WARNINGS_SUPPRESSION) +# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION +#endif +#if !defined(CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION) +# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION +#endif +#if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS) +# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS +#endif +#if !defined(CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS) +# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS +#endif +#if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS) +# define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS +#endif +#if !defined(CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS) +# define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS +#endif + +// The goal of this macro is to avoid evaluation of the arguments, but +// still have the compiler warn on problems inside... +#if !defined(CATCH_INTERNAL_IGNORE_BUT_WARN) +# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) +#endif + +#if defined(__APPLE__) && defined(__apple_build_version__) && (__clang_major__ < 10) +# undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS +#elif defined(__clang__) && (__clang_major__ < 5) +# undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS +#endif + +#if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS) +# define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS +#endif + +#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) +#define CATCH_TRY if ((true)) +#define CATCH_CATCH_ALL if ((false)) +#define CATCH_CATCH_ANON(type) if ((false)) +#else +#define CATCH_TRY try +#define CATCH_CATCH_ALL catch (...) +#define CATCH_CATCH_ANON(type) catch (type) +#endif + +#if defined(CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_NO_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) +#define CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#endif + +#endif // CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_config_android_logwrite.hpp b/packages/Catch2/src/catch2/internal/catch_config_android_logwrite.hpp new file mode 100644 index 0000000000000000000000000000000000000000..199c937598b5f725a476d6fe7d669714d42ef3de --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_config_android_logwrite.hpp @@ -0,0 +1,31 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +/** \file + * Wrapper for ANDROID_LOGWRITE configuration option + * + * We want to default to enabling it when compiled for android, but + * users of the library should also be able to disable it if they want + * to. + */ + +#ifndef CATCH_CONFIG_ANDROID_LOGWRITE_HPP_INCLUDED +#define CATCH_CONFIG_ANDROID_LOGWRITE_HPP_INCLUDED + +#if defined(__ANDROID__) +# define CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE +#endif + + +#if defined( CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE ) && \ + !defined( CATCH_CONFIG_NO_ANDROID_LOGWRITE ) && \ + !defined( CATCH_CONFIG_ANDROID_LOGWRITE ) +# define CATCH_CONFIG_ANDROID_LOGWRITE +#endif + +#endif // CATCH_CONFIG_ANDROID_LOGWRITE_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_config_counter.hpp b/packages/Catch2/src/catch2/internal/catch_config_counter.hpp new file mode 100644 index 0000000000000000000000000000000000000000..febb3eeef4ff228361e4f1c0c418d5a0cb962794 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_config_counter.hpp @@ -0,0 +1,32 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +/** \file + * Wrapper for the CONFIG configuration option + * + * When generating internal unique names, there are two options. Either + * we mix in the current line number, or mix in an incrementing number. + * We prefer the latter, using `__COUNTER__`, but users might want to + * use the former. + */ + +#ifndef CATCH_CONFIG_COUNTER_HPP_INCLUDED +#define CATCH_CONFIG_COUNTER_HPP_INCLUDED + +#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 + + +#endif // CATCH_CONFIG_COUNTER_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_config_uncaught_exceptions.hpp b/packages/Catch2/src/catch2/internal/catch_config_uncaught_exceptions.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c853e673c5d34f62d4f639126f99339f63202eda --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_config_uncaught_exceptions.hpp @@ -0,0 +1,44 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +/** \file + * Wrapper for UNCAUGHT_EXCEPTIONS configuration option + * + * For some functionality, Catch2 requires to know whether there is + * an active exception. Because `std::uncaught_exception` is deprecated + * in C++17, we want to use `std::uncaught_exceptions` if possible. + */ + +#ifndef CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED +#define CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED + +#if defined(_MSC_VER) +# if _MSC_VER >= 1900 // Visual Studio 2015 or newer +# define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS +# endif +#endif + + +#include <exception> + +#if defined(__cpp_lib_uncaught_exceptions) \ + && !defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) + +# define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS +#endif // __cpp_lib_uncaught_exceptions + + +#if defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) \ + && !defined(CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS) \ + && !defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) + +# define CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS +#endif + + +#endif // CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_config_wchar.hpp b/packages/Catch2/src/catch2/internal/catch_config_wchar.hpp new file mode 100644 index 0000000000000000000000000000000000000000..fb64daf280b4d09da1eba56850bd1a8f349ce425 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_config_wchar.hpp @@ -0,0 +1,33 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +/** \file + * Wrapper for the WCHAR configuration option + * + * We want to support platforms that do not provide `wchar_t`, so we + * sometimes have to disable providing wchar_t overloads through Catch2, + * e.g. the StringMaker specialization for `std::wstring`. + */ + +#ifndef CATCH_CONFIG_WCHAR_HPP_INCLUDED +#define CATCH_CONFIG_WCHAR_HPP_INCLUDED + +// We assume that WCHAR should be enabled by default, and only disabled +// for a shortlist (so far only DJGPP) of compilers. + +#if defined(__DJGPP__) +# define CATCH_INTERNAL_CONFIG_NO_WCHAR +#endif // __DJGPP__ + +#if !defined( CATCH_INTERNAL_CONFIG_NO_WCHAR ) && \ + !defined( CATCH_CONFIG_NO_WCHAR ) && \ + !defined( CATCH_CONFIG_WCHAR ) +# define CATCH_CONFIG_WCHAR +#endif + +#endif // CATCH_CONFIG_WCHAR_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_console_colour.cpp b/packages/Catch2/src/catch2/internal/catch_console_colour.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e524b0baf97a7987d48be20364ef93b5615736ab --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_console_colour.cpp @@ -0,0 +1,242 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wexit-time-destructors" +#endif + + +#include <catch2/internal/catch_console_colour.hpp> +#include <catch2/internal/catch_enforce.hpp> +#include <catch2/internal/catch_errno_guard.hpp> +#include <catch2/interfaces/catch_interfaces_config.hpp> +#include <catch2/internal/catch_stream.hpp> +#include <catch2/internal/catch_context.hpp> +#include <catch2/internal/catch_platform.hpp> +#include <catch2/internal/catch_debugger.hpp> +#include <catch2/internal/catch_windows_h_proxy.hpp> + +#include <ostream> + +namespace Catch { + namespace { + + struct IColourImpl { + virtual ~IColourImpl() = default; + virtual void use( Colour::Code _colourCode ) = 0; + }; + + struct NoColourImpl : IColourImpl { + void use( Colour::Code ) override {} + + 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 ); + } + + 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; + + auto const* config = getCurrentContext().getConfig(); + UseColour 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: + 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 ) { + // The escape sequence must be flushed to console, otherwise if + // stdin and stderr are intermixed, we'd get accidentally coloured output. + getCurrentContext().getConfig()->stream() + << '\033' << _escapeCode << std::flush; + } + }; + + bool useColourOnPlatform() { + return +#if defined(CATCH_PLATFORM_MAC) || defined(CATCH_PLATFORM_IPHONE) + !isDebuggerActive() && +#endif +#if !(defined(__DJGPP__) && defined(__STRICT_ANSI__)) + isatty(STDOUT_FILENO) +#else + false +#endif + ; + } + IColourImpl* platformColourInstance() { + ErrnoGuard guard; + auto const* config = getCurrentContext().getConfig(); + UseColour 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&& other ) noexcept { + m_moved = other.m_moved; + other.m_moved = true; + } + Colour& Colour::operator=( Colour&& other ) noexcept { + m_moved = other.m_moved; + other.m_moved = true; + return *this; + } + + Colour::~Colour(){ if( !m_moved ) use( None ); } + + void Colour::use( Code _colourCode ) { + static IColourImpl* impl = platformColourInstance(); + // Strictly speaking, this cannot possibly happen. + // However, under some conditions it does happen (see #1626), + // and this change is small enough that we can let practicality + // triumph over purity in this case. + if (impl != nullptr) { + 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/packages/Catch2/src/catch2/internal/catch_console_colour.hpp b/packages/Catch2/src/catch2/internal/catch_console_colour.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7b102013c8a0295089cc81b9be1339f5a56b09fd --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_console_colour.hpp @@ -0,0 +1,70 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_CONSOLE_COLOUR_HPP_INCLUDED +#define CATCH_CONSOLE_COLOUR_HPP_INCLUDED + +#include <iosfwd> + +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; + + friend std::ostream& operator << (std::ostream& os, Colour const&); + }; + + +} // end namespace Catch + +#endif // CATCH_CONSOLE_COLOUR_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_console_width.hpp b/packages/Catch2/src/catch2/internal/catch_console_width.hpp new file mode 100644 index 0000000000000000000000000000000000000000..52ef0f0ee7c1d7ce8d789cf3bb7ee9cbcdcdf2a6 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_console_width.hpp @@ -0,0 +1,15 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_CONSOLE_WIDTH_HPP_INCLUDED +#define CATCH_CONSOLE_WIDTH_HPP_INCLUDED + +#ifndef CATCH_CONFIG_CONSOLE_WIDTH +#define CATCH_CONFIG_CONSOLE_WIDTH 80 +#endif + +#endif // CATCH_CONSOLE_WIDTH_HPP_INCLUDED \ No newline at end of file diff --git a/packages/Catch2/src/catch2/internal/catch_container_nonmembers.hpp b/packages/Catch2/src/catch2/internal/catch_container_nonmembers.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f1dedeb6a4ca9ecea25e9f33b1d5a76ff0e8f4c4 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_container_nonmembers.hpp @@ -0,0 +1,71 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_CONTAINER_NONMEMBERS_HPP_INCLUDED +#define CATCH_CONTAINER_NONMEMBERS_HPP_INCLUDED + +#include <catch2/internal/catch_compiler_capabilities.hpp> + + +// We want a simple polyfill over `std::empty`, `std::size` and so on +// for C++14 or C++ libraries with incomplete support. +// We also have to handle that MSVC std lib will happily provide these +// under older standards. +#if defined(CATCH_CPP17_OR_GREATER) || defined(_MSC_VER) + +// We are already using this header either way, so there shouldn't +// be much additional overhead in including it to get the feature +// test macros +#include <string> + +# if !defined(__cpp_lib_nonmember_container_access) +# define CATCH_CONFIG_POLYFILL_NONMEMBER_CONTAINER_ACCESS +# endif + +#else +#define CATCH_CONFIG_POLYFILL_NONMEMBER_CONTAINER_ACCESS +#endif + + + +namespace Catch { +namespace Detail { + +#if defined(CATCH_CONFIG_POLYFILL_NONMEMBER_CONTAINER_ACCESS) + template <typename Container> + constexpr auto empty(Container const& cont) -> decltype(cont.empty()) { + return cont.empty(); + } + template <typename T, std::size_t N> + constexpr bool empty(const T (&)[N]) noexcept { + // GCC < 7 does not support the const T(&)[] parameter syntax + // so we have to ignore the length explicitly + (void)N; + return false; + } + template <typename T> + constexpr bool empty(std::initializer_list<T> list) noexcept { + return list.size() > 0; + } + + + template <typename Container> + constexpr auto size(Container const& cont) -> decltype(cont.size()) { + return cont.size(); + } + template <typename T, std::size_t N> + constexpr std::size_t size(const T(&)[N]) noexcept { + return N; + } +#endif // CATCH_CONFIG_POLYFILL_NONMEMBER_CONTAINER_ACCESS + +} // end namespace Detail +} // end namespace Catch + + + +#endif // CATCH_CONTAINER_NONMEMBERS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_context.cpp b/packages/Catch2/src/catch2/internal/catch_context.cpp new file mode 100644 index 0000000000000000000000000000000000000000..86c56a6f5b577f27f8da7b2bf43091a01659eb73 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_context.cpp @@ -0,0 +1,70 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/internal/catch_context.hpp> +#include <catch2/internal/catch_noncopyable.hpp> +#include <catch2/internal/catch_random_number_generator.hpp> + +namespace Catch { + + class Context : public IMutableContext, private Detail::NonCopyable { + + public: // IContext + IResultCapture* getResultCapture() override { + return m_resultCapture; + } + IRunner* getRunner() override { + return m_runner; + } + + IConfig const* getConfig() const override { + return m_config; + } + + ~Context() override; + + public: // IMutableContext + void setResultCapture( IResultCapture* resultCapture ) override { + m_resultCapture = resultCapture; + } + void setRunner( IRunner* runner ) override { + m_runner = runner; + } + void setConfig( IConfig const* config ) override { + m_config = config; + } + + friend IMutableContext& getCurrentMutableContext(); + + private: + IConfig const* m_config = nullptr; + 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; + + + SimplePcg32& rng() { + static SimplePcg32 s_rng; + return s_rng; + } + +} diff --git a/packages/Catch2/src/catch2/internal/catch_context.hpp b/packages/Catch2/src/catch2/internal/catch_context.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6f660f3a039788deaf042e0580273d56d4804d82 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_context.hpp @@ -0,0 +1,59 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_CONTEXT_HPP_INCLUDED +#define CATCH_CONTEXT_HPP_INCLUDED + +namespace Catch { + + struct IResultCapture; + struct IRunner; + struct IConfig; + + struct IContext + { + virtual ~IContext(); + + virtual IResultCapture* getResultCapture() = 0; + virtual IRunner* getRunner() = 0; + virtual IConfig const* getConfig() const = 0; + }; + + struct IMutableContext : IContext + { + virtual ~IMutableContext(); + virtual void setResultCapture( IResultCapture* resultCapture ) = 0; + virtual void setRunner( IRunner* runner ) = 0; + virtual void setConfig( IConfig const* config ) = 0; + + private: + static IMutableContext *currentContext; + friend IMutableContext& getCurrentMutableContext(); + friend void cleanUpContext(); + static void createContext(); + }; + + inline IMutableContext& getCurrentMutableContext() + { + if( !IMutableContext::currentContext ) + IMutableContext::createContext(); + // NOLINTNEXTLINE(clang-analyzer-core.uninitialized.UndefReturn) + return *IMutableContext::currentContext; + } + + inline IContext& getCurrentContext() + { + return getCurrentMutableContext(); + } + + void cleanUpContext(); + + class SimplePcg32; + SimplePcg32& rng(); +} + +#endif // CATCH_CONTEXT_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_debug_console.cpp b/packages/Catch2/src/catch2/internal/catch_debug_console.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5942524eb41163d677b22ea26f59b95749d8c17b --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_debug_console.cpp @@ -0,0 +1,40 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/internal/catch_debug_console.hpp> +#include <catch2/internal/catch_config_android_logwrite.hpp> +#include <catch2/internal/catch_stream.hpp> +#include <catch2/internal/catch_platform.hpp> +#include <catch2/internal/catch_windows_h_proxy.hpp> + +#if defined(CATCH_CONFIG_ANDROID_LOGWRITE) +#include <android/log.h> + + namespace Catch { + void writeToDebugConsole( std::string const& text ) { + __android_log_write( ANDROID_LOG_DEBUG, "Catch", text.c_str() ); + } + } + +#elif defined(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 diff --git a/packages/Catch2/src/catch2/internal/catch_debug_console.hpp b/packages/Catch2/src/catch2/internal/catch_debug_console.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a4b80f09b9e5cb636619f02fea7350b1156c021d --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_debug_console.hpp @@ -0,0 +1,17 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_DEBUG_CONSOLE_HPP_INCLUDED +#define CATCH_DEBUG_CONSOLE_HPP_INCLUDED + +#include <string> + +namespace Catch { + void writeToDebugConsole( std::string const& text ); +} + +#endif // CATCH_DEBUG_CONSOLE_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_debugger.cpp b/packages/Catch2/src/catch2/internal/catch_debugger.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e1764034b6a0bfc4c78492b5fefd0e7226a563fd --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_debugger.cpp @@ -0,0 +1,120 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/internal/catch_debugger.hpp> +#include <catch2/internal/catch_errno_guard.hpp> +#include <catch2/internal/catch_stream.hpp> +#include <catch2/internal/catch_platform.hpp> + +#if defined(CATCH_PLATFORM_MAC) || defined(CATCH_PLATFORM_IPHONE) + +# include <cassert> +# include <sys/types.h> +# include <unistd.h> +# include <cstddef> +# include <ostream> + +#ifdef __apple_build_version__ + // These headers will only compile with AppleClang (XCode) + // For other compilers (Clang, GCC, ... ) we need to exclude them +# include <sys/sysctl.h> +#endif + + namespace Catch { + #ifdef __apple_build_version__ + // The following function is taken directly from the following technical note: + // https://developer.apple.com/library/archive/qa/qa1361/_index.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 ); + } + #else + bool isDebuggerActive() { + // We need to find another way to determine this for non-appleclang compilers on macOS + return false; + } + #endif + } // 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/packages/Catch2/src/catch2/internal/catch_debugger.hpp b/packages/Catch2/src/catch2/internal/catch_debugger.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c300da72cdb52169db4d36f45057768501b42f76 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_debugger.hpp @@ -0,0 +1,64 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_DEBUGGER_HPP_INCLUDED +#define CATCH_DEBUGGER_HPP_INCLUDED + +#include <catch2/internal/catch_platform.hpp> + +namespace Catch { + bool isDebuggerActive(); +} + +#ifdef CATCH_PLATFORM_MAC + + #if defined(__i386__) || defined(__x86_64__) + #define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */ + #elif defined(__aarch64__) + #define CATCH_TRAP() __asm__(".inst 0xd4200000") + #endif + +#elif defined(CATCH_PLATFORM_IPHONE) + + // use inline assembler + #if defined(__i386__) || defined(__x86_64__) + #define CATCH_TRAP() __asm__("int $3") + #elif defined(__aarch64__) + #define CATCH_TRAP() __asm__(".inst 0xd4200000") + #elif defined(__arm__) && !defined(__thumb__) + #define CATCH_TRAP() __asm__(".inst 0xe7f001f0") + #elif defined(__arm__) && defined(__thumb__) + #define CATCH_TRAP() __asm__(".inst 0xde01") + #endif + +#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 + +#ifndef CATCH_BREAK_INTO_DEBUGGER + #ifdef CATCH_TRAP + #define CATCH_BREAK_INTO_DEBUGGER() []{ if( Catch::isDebuggerActive() ) { CATCH_TRAP(); } }() + #else + #define CATCH_BREAK_INTO_DEBUGGER() []{}() + #endif +#endif + +#endif // CATCH_DEBUGGER_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_decomposer.hpp b/packages/Catch2/src/catch2/internal/catch_decomposer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9af5c19f706c9a59c2701396f08a21e7e2920c84 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_decomposer.hpp @@ -0,0 +1,279 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_DECOMPOSER_HPP_INCLUDED +#define CATCH_DECOMPOSER_HPP_INCLUDED + +#include <catch2/catch_tostring.hpp> +#include <catch2/internal/catch_stringref.hpp> +#include <catch2/internal/catch_meta.hpp> + +#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 +#pragma warning(disable:4800) // Forcing result to true or false +#endif + +#ifdef __clang__ +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wsign-compare" +#elif defined __GNUC__ +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wsign-compare" +#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 ) + {} + + ITransientExpression() = default; + ITransientExpression(ITransientExpression const&) = default; + ITransientExpression& operator=(ITransientExpression const&) = default; + + // We don't actually need a virtual destructor, but many static analysers + // complain if it's not here :-( + virtual ~ITransientExpression(); // = default; + + bool m_isBinaryExpression; + bool m_result; + friend std::ostream& operator<<(std::ostream& out, ITransientExpression const& expr) { + expr.streamReconstructedExpression(out); + return out; + } + }; + + 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 T> + auto operator && ( T ) const -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<T>::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + + template<typename T> + auto operator || ( T ) const -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<T>::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + + template<typename T> + auto operator == ( T ) const -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<T>::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + + template<typename T> + auto operator != ( T ) const -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<T>::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + + template<typename T> + auto operator > ( T ) const -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<T>::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + + template<typename T> + auto operator < ( T ) const -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<T>::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + + template<typename T> + auto operator >= ( T ) const -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<T>::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + + template<typename T> + auto operator <= ( T ) const -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<T>::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + }; + + 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, static_cast<bool>(lhs) }, + 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, "=="_sr, rhs }; + } + auto operator == ( bool rhs ) -> BinaryExpr<LhsT, bool> const { + return { m_lhs == rhs, m_lhs, "=="_sr, rhs }; + } + + template<typename RhsT> + auto operator != ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const { + return { compareNotEqual( m_lhs, rhs ), m_lhs, "!="_sr, rhs }; + } + auto operator != ( bool rhs ) -> BinaryExpr<LhsT, bool> const { + return { m_lhs != rhs, m_lhs, "!="_sr, rhs }; + } + + template<typename RhsT> + auto operator > ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const { + return { static_cast<bool>(m_lhs > rhs), m_lhs, ">"_sr, rhs }; + } + template<typename RhsT> + auto operator < ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const { + return { static_cast<bool>(m_lhs < rhs), m_lhs, "<"_sr, rhs }; + } + template<typename RhsT> + auto operator >= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const { + return { static_cast<bool>(m_lhs >= rhs), m_lhs, ">="_sr, rhs }; + } + template<typename RhsT> + auto operator <= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const { + return { static_cast<bool>(m_lhs <= rhs), m_lhs, "<="_sr, rhs }; + } + template <typename RhsT> + auto operator | (RhsT const& rhs) -> BinaryExpr<LhsT, RhsT const&> const { + return { static_cast<bool>(m_lhs | rhs), m_lhs, "|"_sr, rhs }; + } + template <typename RhsT> + auto operator & (RhsT const& rhs) -> BinaryExpr<LhsT, RhsT const&> const { + return { static_cast<bool>(m_lhs & rhs), m_lhs, "&"_sr, rhs }; + } + template <typename RhsT> + auto operator ^ (RhsT const& rhs) -> BinaryExpr<LhsT, RhsT const&> const { + return { static_cast<bool>(m_lhs ^ rhs), m_lhs, "^"_sr, rhs }; + } + + template<typename RhsT> + auto operator && ( RhsT const& ) -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<RhsT>::value, + "operator&& is not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + + template<typename RhsT> + auto operator || ( RhsT const& ) -> BinaryExpr<LhsT, RhsT const&> const { + static_assert(always_false<RhsT>::value, + "operator|| is not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + + 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 +#ifdef __clang__ +# pragma clang diagnostic pop +#elif defined __GNUC__ +# pragma GCC diagnostic pop +#endif + +#endif // CATCH_DECOMPOSER_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_enforce.cpp b/packages/Catch2/src/catch2/internal/catch_enforce.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3f4962cbfac07209657f34bfd70f32e6d2fd285a --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_enforce.cpp @@ -0,0 +1,40 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/internal/catch_enforce.hpp> + +#include <stdexcept> + + +namespace Catch { +#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER) + [[noreturn]] + void throw_exception(std::exception const& e) { + Catch::cerr() << "Catch will terminate because it needed to throw an exception.\n" + << "The message was: " << e.what() << '\n'; + std::terminate(); + } +#endif + + [[noreturn]] + void throw_logic_error(std::string const& msg) { + throw_exception(std::logic_error(msg)); + } + + [[noreturn]] + void throw_domain_error(std::string const& msg) { + throw_exception(std::domain_error(msg)); + } + + [[noreturn]] + void throw_runtime_error(std::string const& msg) { + throw_exception(std::runtime_error(msg)); + } + + + +} // namespace Catch; diff --git a/packages/Catch2/src/catch2/internal/catch_enforce.hpp b/packages/Catch2/src/catch2/internal/catch_enforce.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3f81ef1a03a235d01cdbbb02e04bf183fae8e18b --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_enforce.hpp @@ -0,0 +1,54 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_ENFORCE_HPP_INCLUDED +#define CATCH_ENFORCE_HPP_INCLUDED + +#include <catch2/internal/catch_source_line_info.hpp> +#include <catch2/internal/catch_compiler_capabilities.hpp> +#include <catch2/internal/catch_stream.hpp> + +#include <exception> + +namespace Catch { +#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + template <typename Ex> + [[noreturn]] + void throw_exception(Ex const& e) { + throw e; + } +#else // ^^ Exceptions are enabled // Exceptions are disabled vv + [[noreturn]] + void throw_exception(std::exception const& e); +#endif + + [[noreturn]] + void throw_logic_error(std::string const& msg); + [[noreturn]] + void throw_domain_error(std::string const& msg); + [[noreturn]] + void throw_runtime_error(std::string const& msg); + +} // namespace Catch; + +#define CATCH_MAKE_MSG(...) \ + (Catch::ReusableStringStream() << __VA_ARGS__).str() + +#define CATCH_INTERNAL_ERROR(...) \ + Catch::throw_logic_error(CATCH_MAKE_MSG( CATCH_INTERNAL_LINEINFO << ": Internal Catch2 error: " << __VA_ARGS__)) + +#define CATCH_ERROR(...) \ + Catch::throw_domain_error(CATCH_MAKE_MSG( __VA_ARGS__ )) + +#define CATCH_RUNTIME_ERROR(...) \ + Catch::throw_runtime_error(CATCH_MAKE_MSG( __VA_ARGS__ )) + +#define CATCH_ENFORCE( condition, ... ) \ + do{ if( !(condition) ) CATCH_ERROR( __VA_ARGS__ ); } while(false) + + +#endif // CATCH_ENFORCE_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_enum_values_registry.cpp b/packages/Catch2/src/catch2/internal/catch_enum_values_registry.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cfa206f99abadfe7e528744460f5100cc590a6ac --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_enum_values_registry.cpp @@ -0,0 +1,74 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/internal/catch_enum_values_registry.hpp> +#include <catch2/internal/catch_string_manip.hpp> +#include <catch2/internal/catch_stream.hpp> + +#include <cassert> + +namespace Catch { + + IMutableEnumValuesRegistry::~IMutableEnumValuesRegistry() {} + + namespace Detail { + + namespace { + // Extracts the actual name part of an enum instance + // In other words, it returns the Blue part of Bikeshed::Colour::Blue + StringRef extractInstanceName(StringRef enumInstance) { + // Find last occurence of ":" + size_t name_start = enumInstance.size(); + while (name_start > 0 && enumInstance[name_start - 1] != ':') { + --name_start; + } + return enumInstance.substr(name_start, enumInstance.size() - name_start); + } + } + + std::vector<StringRef> parseEnums( StringRef enums ) { + auto enumValues = splitStringRef( enums, ',' ); + std::vector<StringRef> parsed; + parsed.reserve( enumValues.size() ); + for( auto const& enumValue : enumValues ) { + parsed.push_back(trim(extractInstanceName(enumValue))); + } + return parsed; + } + + EnumInfo::~EnumInfo() {} + + StringRef EnumInfo::lookup( int value ) const { + for( auto const& valueToName : m_values ) { + if( valueToName.first == value ) + return valueToName.second; + } + return "{** unexpected enum value **}"_sr; + } + + Catch::Detail::unique_ptr<EnumInfo> makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector<int> const& values ) { + auto enumInfo = Catch::Detail::make_unique<EnumInfo>(); + enumInfo->m_name = enumName; + enumInfo->m_values.reserve( values.size() ); + + const auto valueNames = Catch::Detail::parseEnums( allValueNames ); + assert( valueNames.size() == values.size() ); + std::size_t i = 0; + for( auto value : values ) + enumInfo->m_values.emplace_back(value, valueNames[i++]); + + return enumInfo; + } + + EnumInfo const& EnumValuesRegistry::registerEnum( StringRef enumName, StringRef allValueNames, std::vector<int> const& values ) { + m_enumInfos.push_back(makeEnumInfo(enumName, allValueNames, values)); + return *m_enumInfos.back(); + } + + } // Detail +} // Catch + diff --git a/packages/Catch2/src/catch2/internal/catch_enum_values_registry.hpp b/packages/Catch2/src/catch2/internal/catch_enum_values_registry.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0c16a4c15d59fd52a9ee6eb9333f2063c5699d4b --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_enum_values_registry.hpp @@ -0,0 +1,36 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_ENUM_VALUES_REGISTRY_HPP_INCLUDED +#define CATCH_ENUM_VALUES_REGISTRY_HPP_INCLUDED + +#include <catch2/interfaces/catch_interfaces_enum_values_registry.hpp> +#include <catch2/internal/catch_unique_ptr.hpp> +#include <catch2/internal/catch_stringref.hpp> + +#include <vector> + +namespace Catch { + + namespace Detail { + + Catch::Detail::unique_ptr<EnumInfo> makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector<int> const& values ); + + class EnumValuesRegistry : public IMutableEnumValuesRegistry { + + std::vector<Catch::Detail::unique_ptr<EnumInfo>> m_enumInfos; + + EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::vector<int> const& values) override; + }; + + std::vector<StringRef> parseEnums( StringRef enums ); + + } // Detail + +} // Catch + +#endif // CATCH_ENUM_VALUES_REGISTRY_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_errno_guard.hpp b/packages/Catch2/src/catch2/internal/catch_errno_guard.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9082c508559f62e898e7cce7d0a2b7ddf48c0702 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_errno_guard.hpp @@ -0,0 +1,27 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_ERRNO_GUARD_HPP_INCLUDED +#define CATCH_ERRNO_GUARD_HPP_INCLUDED + +namespace Catch { + + //! Simple RAII class that stores the value of `errno` + //! at construction and restores it at destruction. + class ErrnoGuard { + public: + // Keep these outlined to avoid dragging in macros from <cerrno> + + ErrnoGuard(); + ~ErrnoGuard(); + private: + int m_oldErrno; + }; + +} + +#endif // CATCH_ERRNO_GUARD_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_exception_translator_registry.cpp b/packages/Catch2/src/catch2/internal/catch_exception_translator_registry.cpp new file mode 100644 index 0000000000000000000000000000000000000000..084838894e5697b7738d8df0fd5cc7716d7d975d --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_exception_translator_registry.cpp @@ -0,0 +1,74 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/internal/catch_exception_translator_registry.hpp> +#include <catch2/internal/catch_compiler_capabilities.hpp> +#include <catch2/internal/catch_enforce.hpp> +#include <catch2/internal/catch_test_failure_exception.hpp> + +namespace Catch { + + ExceptionTranslatorRegistry::~ExceptionTranslatorRegistry() { + } + + void ExceptionTranslatorRegistry::registerTranslator( const IExceptionTranslator* translator ) { + m_translators.push_back( Detail::unique_ptr<const IExceptionTranslator>( translator ) ); + } + +#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + std::string ExceptionTranslatorRegistry::translateActiveException() const { + try { + // 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(); + } + 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()); + } + } + +#else // ^^ Exceptions are enabled // Exceptions are disabled vv + std::string ExceptionTranslatorRegistry::translateActiveException() const { + CATCH_INTERNAL_ERROR("Attempted to translate active exception under CATCH_CONFIG_DISABLE_EXCEPTIONS!"); + } + + std::string ExceptionTranslatorRegistry::tryTranslators() const { + CATCH_INTERNAL_ERROR("Attempted to use exception translators under CATCH_CONFIG_DISABLE_EXCEPTIONS!"); + } +#endif + + +} diff --git a/packages/Catch2/src/catch2/internal/catch_exception_translator_registry.hpp b/packages/Catch2/src/catch2/internal/catch_exception_translator_registry.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f4a28d91acfcabdfe21ed76c0dc235db0c49e0a8 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_exception_translator_registry.hpp @@ -0,0 +1,29 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED +#define CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED + +#include <catch2/interfaces/catch_interfaces_exception.hpp> +#include <vector> +#include <string> + +namespace Catch { + + class ExceptionTranslatorRegistry : public IExceptionTranslatorRegistry { + public: + ~ExceptionTranslatorRegistry(); + virtual void registerTranslator( const IExceptionTranslator* translator ); + std::string translateActiveException() const override; + std::string tryTranslators() const; + + private: + ExceptionTranslators m_translators; + }; +} + +#endif // CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_fatal_condition_handler.cpp b/packages/Catch2/src/catch2/internal/catch_fatal_condition_handler.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1b1e5c7fd2bd1c4e61fd736ca757290bf6fbf943 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_fatal_condition_handler.cpp @@ -0,0 +1,159 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/internal/catch_fatal_condition_handler.hpp> + +#include <catch2/internal/catch_context.hpp> +#include <catch2/interfaces/catch_interfaces_capture.hpp> + +#if defined(__GNUC__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#endif + +#if 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 // signals/SEH handling + +#if defined( CATCH_CONFIG_WINDOWS_SEH ) + +namespace Catch { + struct SignalDefs { DWORD id; const char* name; }; + + // There is no 1-1 mapping between signals and windows exceptions. + // Windows can easily distinguish between SO and SigSegV, + // but SigInt, SigTerm, etc are handled differently. + static SignalDefs signalDefs[] = { + { static_cast<DWORD>(EXCEPTION_ILLEGAL_INSTRUCTION), "SIGILL - Illegal instruction signal" }, + { static_cast<DWORD>(EXCEPTION_STACK_OVERFLOW), "SIGSEGV - Stack overflow" }, + { static_cast<DWORD>(EXCEPTION_ACCESS_VIOLATION), "SIGSEGV - Segmentation violation signal" }, + { static_cast<DWORD>(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) { + RemoveVectoredExceptionHandler(exceptionHandlerHandle); + SetThreadStackGuarantee(&guaranteeSize); + exceptionHandlerHandle = nullptr; + isSet = false; + } + } + +bool FatalConditionHandler::isSet = false; +ULONG FatalConditionHandler::guaranteeSize = 0; +PVOID FatalConditionHandler::exceptionHandlerHandle = nullptr; + + +} // namespace Catch + +#elif defined( CATCH_CONFIG_POSIX_SIGNALS ) + +namespace Catch { + + struct SignalDefs { + int id; + const char* name; + }; + + // 32kb for the alternate stack seems to be sufficient. However, this value + // is experimentally determined, so that's not guaranteed. + static constexpr std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ; + + static SignalDefs signalDefs[] = { + { SIGINT, "SIGINT - Terminal interrupt signal" }, + { 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 = sigStackSize; + 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]); + } + } + + void FatalConditionHandler::reset() { + if( isSet ) { + // Set signals back to previous values -- hopefully nobody overwrote them in the meantime + for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) { + sigaction(signalDefs[i].id, &oldSigActions[i], nullptr); + } + // Return the old stack + sigaltstack(&oldSigStack, nullptr); + isSet = false; + } + } + + bool FatalConditionHandler::isSet = false; + struct sigaction FatalConditionHandler::oldSigActions[sizeof(signalDefs)/sizeof(SignalDefs)] = {}; + stack_t FatalConditionHandler::oldSigStack = {}; + char FatalConditionHandler::altStackMem[sigStackSize] = {}; + + +} // namespace Catch + +#endif // signals/SEH handling + +#if defined(__GNUC__) +# pragma GCC diagnostic pop +#endif diff --git a/packages/Catch2/src/catch2/internal/catch_fatal_condition_handler.hpp b/packages/Catch2/src/catch2/internal/catch_fatal_condition_handler.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1b23c0b88fe70599fa1c581012ccd9488d7ad6e3 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_fatal_condition_handler.hpp @@ -0,0 +1,66 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_FATAL_CONDITION_HANDLER_HPP_INCLUDED +#define CATCH_FATAL_CONDITION_HANDLER_HPP_INCLUDED + +#include <catch2/internal/catch_platform.hpp> +#include <catch2/internal/catch_compiler_capabilities.hpp> +#include <catch2/internal/catch_windows_h_proxy.hpp> + + +#if defined( CATCH_CONFIG_WINDOWS_SEH ) + +namespace Catch { + + struct FatalConditionHandler { + + static LONG CALLBACK handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo); + FatalConditionHandler(); + static void reset(); + ~FatalConditionHandler() { reset(); } + + private: + static bool isSet; + static ULONG guaranteeSize; + static PVOID exceptionHandlerHandle; + }; + +} // namespace Catch + +#elif defined ( CATCH_CONFIG_POSIX_SIGNALS ) + +#include <signal.h> + +namespace Catch { + + struct FatalConditionHandler { + + static bool isSet; + static struct sigaction oldSigActions[]; + static stack_t oldSigStack; + static char altStackMem[]; + + static void handleSignal( int sig ); + + FatalConditionHandler(); + ~FatalConditionHandler() { reset(); } + static void reset(); + }; + +} // namespace Catch + + +#else + +namespace Catch { + struct FatalConditionHandler {}; +} + +#endif + +#endif // CATCH_FATAL_CONDITION_HANDLER_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_lazy_expr.hpp b/packages/Catch2/src/catch2/internal/catch_lazy_expr.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e69a72ef30d4918b2e93dbb32a363443cfd3b9f8 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_lazy_expr.hpp @@ -0,0 +1,40 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_LAZY_EXPR_HPP_INCLUDED +#define CATCH_LAZY_EXPR_HPP_INCLUDED + +#include <iosfwd> + +namespace Catch { + + struct ITransientExpression; + + class LazyExpression { + friend class AssertionHandler; + friend struct AssertionStats; + friend class RunContext; + + ITransientExpression const* m_transientExpression = nullptr; + bool m_isNegated; + public: + LazyExpression( bool isNegated ): + m_isNegated(isNegated) + {} + LazyExpression(LazyExpression const& other) = default; + LazyExpression& operator = ( LazyExpression const& ) = delete; + + explicit operator bool() const { + return m_transientExpression != nullptr; + } + + friend auto operator << ( std::ostream& os, LazyExpression const& lazyExpr ) -> std::ostream&; + }; + +} // namespace Catch + +#endif // CATCH_LAZY_EXPR_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_leak_detector.hpp b/packages/Catch2/src/catch2/internal/catch_leak_detector.hpp new file mode 100644 index 0000000000000000000000000000000000000000..eecdfca70d8d10d1395fefbcf8016f5d72464b75 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_leak_detector.hpp @@ -0,0 +1,19 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_LEAK_DETECTOR_HPP_INCLUDED +#define CATCH_LEAK_DETECTOR_HPP_INCLUDED + +namespace Catch { + + struct LeakDetector { + LeakDetector(); + ~LeakDetector(); + }; + +} +#endif // CATCH_LEAK_DETECTOR_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_list.cpp b/packages/Catch2/src/catch2/internal/catch_list.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d7969096e372330580a23c482d158be9e690067a --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_list.cpp @@ -0,0 +1,104 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/internal/catch_list.hpp> + +#include <catch2/interfaces/catch_interfaces_registry_hub.hpp> +#include <catch2/interfaces/catch_interfaces_reporter.hpp> +#include <catch2/interfaces/catch_interfaces_reporter_registry.hpp> +#include <catch2/interfaces/catch_interfaces_testcase.hpp> +#include <catch2/interfaces/catch_interfaces_reporter_factory.hpp> + +#include <catch2/internal/catch_context.hpp> +#include <catch2/catch_config.hpp> +#include <catch2/catch_test_spec.hpp> +#include <catch2/catch_test_case_info.hpp> + +namespace Catch { + namespace { + + void listTests(IStreamingReporter& reporter, IConfig const& config) { + auto const& testSpec = config.testSpec(); + auto matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config); + reporter.listTests(matchedTestCases); + } + + void listTags(IStreamingReporter& reporter, IConfig const& config) { + auto const& testSpec = config.testSpec(); + std::vector<TestCaseHandle> matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config); + + std::map<StringRef, TagInfo> tagCounts; + for (auto const& testCase : matchedTestCases) { + for (auto const& tagName : testCase.getTestCaseInfo().tags) { + auto it = tagCounts.find(tagName.lowerCased); + if (it == tagCounts.end()) + it = tagCounts.insert(std::make_pair(tagName.lowerCased, TagInfo())).first; + it->second.add(tagName.original); + } + } + + std::vector<TagInfo> infos; infos.reserve(tagCounts.size()); + for (auto& tagc : tagCounts) { + infos.push_back(std::move(tagc.second)); + } + + reporter.listTags(infos); + } + + void listReporters(IStreamingReporter& reporter) { + std::vector<ReporterDescription> descriptions; + + IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories(); + descriptions.reserve(factories.size()); + for (auto const& fac : factories) { + descriptions.push_back({ fac.first, fac.second->getDescription() }); + } + + reporter.listReporters(descriptions); + } + + } // end anonymous namespace + + void TagInfo::add( StringRef spelling ) { + ++count; + spellings.insert( spelling ); + } + + std::string TagInfo::all() const { + // 2 per tag for brackets '[' and ']' + size_t size = spellings.size() * 2; + for (auto const& spelling : spellings) { + size += spelling.size(); + } + + std::string out; out.reserve(size); + for (auto const& spelling : spellings) { + out += '['; + out += spelling; + out += ']'; + } + return out; + } + + bool list( IStreamingReporter& reporter, Config const& config ) { + bool listed = false; + if (config.listTests()) { + listed = true; + listTests(reporter, config); + } + if (config.listTags()) { + listed = true; + listTags(reporter, config); + } + if (config.listReporters()) { + listed = true; + listReporters(reporter); + } + return listed; + } + +} // end namespace Catch diff --git a/packages/Catch2/src/catch2/internal/catch_list.hpp b/packages/Catch2/src/catch2/internal/catch_list.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2d1952c5950357b60ab9b60cf410457dbcbb98cc --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_list.hpp @@ -0,0 +1,39 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_LIST_HPP_INCLUDED +#define CATCH_LIST_HPP_INCLUDED + +#include <catch2/internal/catch_stringref.hpp> + +#include <set> +#include <string> + + +namespace Catch { + + struct IStreamingReporter; + class Config; + + + struct ReporterDescription { + std::string name, description; + }; + + struct TagInfo { + void add(StringRef spelling); + std::string all() const; + + std::set<StringRef> spellings; + std::size_t count = 0; + }; + + bool list( IStreamingReporter& reporter, Config const& config ); + +} // end namespace Catch + +#endif // CATCH_LIST_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_main.cpp b/packages/Catch2/src/catch2/internal/catch_main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..940ac3bc2d46ba9db03e39ce201364050c3ac434 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_main.cpp @@ -0,0 +1,34 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/catch_session.hpp> +#include <catch2/internal/catch_compiler_capabilities.hpp> +#include <catch2/internal/catch_config_wchar.hpp> +#include <catch2/internal/catch_leak_detector.hpp> +#include <catch2/internal/catch_platform.hpp> + +namespace Catch { + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS + LeakDetector leakDetector; + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION +} + +#if defined(CATCH_CONFIG_WCHAR) && defined(CATCH_PLATFORM_WINDOWS) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN) +// Standard C/C++ Win32 Unicode wmain entry point +extern "C" int wmain (int argc, wchar_t * argv[], wchar_t * []) { +#else +// Standard C/C++ main entry point +int main (int argc, char * argv[]) { +#endif + + // We want to force the linker not to discard the global variable + // and its constructor, as it (optionally) registers leak detector + (void)&Catch::leakDetector; + + return Catch::Session().run( argc, argv ); +} diff --git a/packages/Catch2/src/catch2/internal/catch_message_info.hpp b/packages/Catch2/src/catch2/internal/catch_message_info.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0c3076eae0069dcbe9d28f30fdcaa598996c17b9 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_message_info.hpp @@ -0,0 +1,42 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_MESSAGE_INFO_HPP_INCLUDED +#define CATCH_MESSAGE_INFO_HPP_INCLUDED + +#include <catch2/internal/catch_result_type.hpp> +#include <catch2/internal/catch_source_line_info.hpp> +#include <catch2/interfaces/catch_interfaces_capture.hpp> + +#include <string> + +namespace Catch { + + struct MessageInfo { + MessageInfo( StringRef const& _macroName, + SourceLineInfo const& _lineInfo, + ResultWas::OfType _type ); + + StringRef macroName; + std::string message; + SourceLineInfo lineInfo; + ResultWas::OfType type; + unsigned int sequence; + + bool operator == (MessageInfo const& other) const { + return sequence == other.sequence; + } + bool operator < (MessageInfo const& other) const { + return sequence < other.sequence; + } + private: + static unsigned int globalCount; + }; + +} // end namespace Catch + +#endif // CATCH_MESSAGE_INFO_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_meta.hpp b/packages/Catch2/src/catch2/internal/catch_meta.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7d573585904fab3280c9de11be6a8bfb2a571ee7 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_meta.hpp @@ -0,0 +1,48 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_META_HPP_INCLUDED +#define CATCH_META_HPP_INCLUDED + +#include <type_traits> + +namespace Catch { + template<typename T> + struct always_false : std::false_type {}; + + template <typename> struct true_given : std::true_type {}; + struct is_callable_tester { + template <typename Fun, typename... Args> + true_given<decltype(std::declval<Fun>()(std::declval<Args>()...))> static test(int); + template <typename...> + std::false_type static test(...); + }; + + template <typename T> + struct is_callable; + + template <typename Fun, typename... Args> + struct is_callable<Fun(Args...)> : decltype(is_callable_tester::test<Fun, Args...>(0)) {}; + + +#if defined(__cpp_lib_is_invocable) && __cpp_lib_is_invocable >= 201703 + // std::result_of is deprecated in C++17 and removed in C++20. Hence, it is + // replaced with std::invoke_result here. + template <typename Func, typename... U> + using FunctionReturnType = std::remove_reference_t<std::remove_cv_t<std::invoke_result_t<Func, U...>>>; +#else + template <typename Func, typename... U> + using FunctionReturnType = std::remove_reference_t<std::remove_cv_t<std::result_of_t<Func(U...)>>>; +#endif + +} // namespace Catch + +namespace mpl_{ + struct na; +} + +#endif // CATCH_META_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_noncopyable.hpp b/packages/Catch2/src/catch2/internal/catch_noncopyable.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f08b1578002bb40e5d532ac0f81becfe17c507ca --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_noncopyable.hpp @@ -0,0 +1,28 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_NONCOPYABLE_HPP_INCLUDED +#define CATCH_NONCOPYABLE_HPP_INCLUDED + +namespace Catch { + namespace Detail { + + //! Deriving classes become noncopyable and nonmovable + class NonCopyable { + NonCopyable( NonCopyable const& ) = delete; + NonCopyable( NonCopyable&& ) = delete; + NonCopyable& operator=( NonCopyable const& ) = delete; + NonCopyable& operator=( NonCopyable&& ) = delete; + + protected: + NonCopyable() noexcept = default; + }; + + } // namespace Detail +} // namespace Catch + +#endif // CATCH_NONCOPYABLE_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_option.hpp b/packages/Catch2/src/catch2/internal/catch_option.hpp new file mode 100644 index 0000000000000000000000000000000000000000..04e4d69ec677d602727c2af9c076bebff0d3047e --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_option.hpp @@ -0,0 +1,73 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_OPTION_HPP_INCLUDED +#define 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 // CATCH_OPTION_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_output_redirect.cpp b/packages/Catch2/src/catch2/internal/catch_output_redirect.cpp new file mode 100644 index 0000000000000000000000000000000000000000..49cfaa0d3eb3ecd8aeed6ff16dd914415e769c0d --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_output_redirect.cpp @@ -0,0 +1,145 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/internal/catch_output_redirect.hpp> +#include <catch2/internal/catch_enforce.hpp> + +#include <cstdio> +#include <cstring> +#include <sstream> + +#if defined(CATCH_CONFIG_NEW_CAPTURE) + #if defined(_MSC_VER) + #include <io.h> //_dup and _dup2 + #define dup _dup + #define dup2 _dup2 + #define fileno _fileno + #else + #include <unistd.h> // dup and dup2 + #endif +#endif + + +namespace Catch { + + RedirectedStream::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::~RedirectedStream() { + m_originalStream.rdbuf( m_prevBuf ); + } + + RedirectedStdOut::RedirectedStdOut() : m_cout( Catch::cout(), m_rss.get() ) {} + auto RedirectedStdOut::str() const -> std::string { return m_rss.str(); } + + RedirectedStdErr::RedirectedStdErr() + : m_cerr( Catch::cerr(), m_rss.get() ), + m_clog( Catch::clog(), m_rss.get() ) + {} + auto RedirectedStdErr::str() const -> std::string { return m_rss.str(); } + + RedirectedStreams::RedirectedStreams(std::string& redirectedCout, std::string& redirectedCerr) + : m_redirectedCout(redirectedCout), + m_redirectedCerr(redirectedCerr) + {} + + RedirectedStreams::~RedirectedStreams() { + m_redirectedCout += m_redirectedStdOut.str(); + m_redirectedCerr += m_redirectedStdErr.str(); + } + +#if defined(CATCH_CONFIG_NEW_CAPTURE) + +#if defined(_MSC_VER) + TempFile::TempFile() { + if (tmpnam_s(m_buffer)) { + CATCH_RUNTIME_ERROR("Could not get a temp filename"); + } + if (fopen_s(&m_file, m_buffer, "w+")) { + char buffer[100]; + if (strerror_s(buffer, errno)) { + CATCH_RUNTIME_ERROR("Could not translate errno to a string"); + } + CATCH_RUNTIME_ERROR("Could not open the temp file: '" << m_buffer << "' because: " << buffer); + } + } +#else + TempFile::TempFile() { + m_file = std::tmpfile(); + if (!m_file) { + CATCH_RUNTIME_ERROR("Could not create a temp file."); + } + } + +#endif + + TempFile::~TempFile() { + // TBD: What to do about errors here? + std::fclose(m_file); + // We manually create the file on Windows only, on Linux + // it will be autodeleted +#if defined(_MSC_VER) + std::remove(m_buffer); +#endif + } + + + FILE* TempFile::getFile() { + return m_file; + } + + std::string TempFile::getContents() { + std::stringstream sstr; + char buffer[100] = {}; + std::rewind(m_file); + while (std::fgets(buffer, sizeof(buffer), m_file)) { + sstr << buffer; + } + return sstr.str(); + } + + OutputRedirect::OutputRedirect(std::string& stdout_dest, std::string& stderr_dest) : + m_originalStdout(dup(1)), + m_originalStderr(dup(2)), + m_stdoutDest(stdout_dest), + m_stderrDest(stderr_dest) { + dup2(fileno(m_stdoutFile.getFile()), 1); + dup2(fileno(m_stderrFile.getFile()), 2); + } + + OutputRedirect::~OutputRedirect() { + Catch::cout() << std::flush; + fflush(stdout); + // Since we support overriding these streams, we flush cerr + // even though std::cerr is unbuffered + Catch::cerr() << std::flush; + Catch::clog() << std::flush; + fflush(stderr); + + dup2(m_originalStdout, 1); + dup2(m_originalStderr, 2); + + m_stdoutDest += m_stdoutFile.getContents(); + m_stderrDest += m_stderrFile.getContents(); + } + +#endif // CATCH_CONFIG_NEW_CAPTURE + +} // namespace Catch + +#if defined(CATCH_CONFIG_NEW_CAPTURE) + #if defined(_MSC_VER) + #undef dup + #undef dup2 + #undef fileno + #endif +#endif diff --git a/packages/Catch2/src/catch2/internal/catch_output_redirect.hpp b/packages/Catch2/src/catch2/internal/catch_output_redirect.hpp new file mode 100644 index 0000000000000000000000000000000000000000..26334d165bb8e2105dd5104702fa13be77fda20c --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_output_redirect.hpp @@ -0,0 +1,117 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_OUTPUT_REDIRECT_HPP_INCLUDED +#define CATCH_OUTPUT_REDIRECT_HPP_INCLUDED + +#include <catch2/internal/catch_platform.hpp> +#include <catch2/internal/catch_stream.hpp> + +#include <cstdio> +#include <iosfwd> +#include <string> + +namespace Catch { + + class RedirectedStream { + std::ostream& m_originalStream; + std::ostream& m_redirectionStream; + std::streambuf* m_prevBuf; + + public: + RedirectedStream( std::ostream& originalStream, std::ostream& redirectionStream ); + ~RedirectedStream(); + }; + + class RedirectedStdOut { + ReusableStringStream m_rss; + RedirectedStream m_cout; + public: + RedirectedStdOut(); + auto str() const -> std::string; + }; + + // 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(); + auto str() const -> std::string; + }; + + class RedirectedStreams { + public: + RedirectedStreams(RedirectedStreams const&) = delete; + RedirectedStreams& operator=(RedirectedStreams const&) = delete; + RedirectedStreams(RedirectedStreams&&) = delete; + RedirectedStreams& operator=(RedirectedStreams&&) = delete; + + RedirectedStreams(std::string& redirectedCout, std::string& redirectedCerr); + ~RedirectedStreams(); + private: + std::string& m_redirectedCout; + std::string& m_redirectedCerr; + RedirectedStdOut m_redirectedStdOut; + RedirectedStdErr m_redirectedStdErr; + }; + +#if defined(CATCH_CONFIG_NEW_CAPTURE) + + // Windows's implementation of std::tmpfile is terrible (it tries + // to create a file inside system folder, thus requiring elevated + // privileges for the binary), so we have to use tmpnam(_s) and + // create the file ourselves there. + class TempFile { + public: + TempFile(TempFile const&) = delete; + TempFile& operator=(TempFile const&) = delete; + TempFile(TempFile&&) = delete; + TempFile& operator=(TempFile&&) = delete; + + TempFile(); + ~TempFile(); + + std::FILE* getFile(); + std::string getContents(); + + private: + std::FILE* m_file = nullptr; + #if defined(_MSC_VER) + char m_buffer[L_tmpnam] = { 0 }; + #endif + }; + + + class OutputRedirect { + public: + OutputRedirect(OutputRedirect const&) = delete; + OutputRedirect& operator=(OutputRedirect const&) = delete; + OutputRedirect(OutputRedirect&&) = delete; + OutputRedirect& operator=(OutputRedirect&&) = delete; + + + OutputRedirect(std::string& stdout_dest, std::string& stderr_dest); + ~OutputRedirect(); + + private: + int m_originalStdout = -1; + int m_originalStderr = -1; + TempFile m_stdoutFile; + TempFile m_stderrFile; + std::string& m_stdoutDest; + std::string& m_stderrDest; + }; + +#endif + +} // end namespace Catch + +#endif // CATCH_OUTPUT_REDIRECT_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_platform.hpp b/packages/Catch2/src/catch2/internal/catch_platform.hpp new file mode 100644 index 0000000000000000000000000000000000000000..537abce5205c726018831802c8551b196c863b29 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_platform.hpp @@ -0,0 +1,26 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_PLATFORM_HPP_INCLUDED +#define CATCH_PLATFORM_HPP_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) || defined(__MINGW32__) +# define CATCH_PLATFORM_WINDOWS +#endif + +#endif // CATCH_PLATFORM_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_polyfills.hpp b/packages/Catch2/src/catch2/internal/catch_polyfills.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e8444836a72784ae7807bcf67732814cb8edb439 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_polyfills.hpp @@ -0,0 +1,16 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_POLYFILLS_HPP_INCLUDED +#define CATCH_POLYFILLS_HPP_INCLUDED + +namespace Catch { + bool isnan(float f); + bool isnan(double d); +} + +#endif // CATCH_POLYFILLS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_preprocessor.hpp b/packages/Catch2/src/catch2/internal/catch_preprocessor.hpp new file mode 100644 index 0000000000000000000000000000000000000000..00859b150a377d5b525f2bf1f8a4c71b506978bd --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_preprocessor.hpp @@ -0,0 +1,242 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_PREPROCESSOR_HPP_INCLUDED +#define CATCH_PREPROCESSOR_HPP_INCLUDED + + +#if defined(__GNUC__) +// We need to silence "empty __VA_ARGS__ warning", and using just _Pragma does not work +#pragma GCC system_header +#endif + + +#define CATCH_RECURSION_LEVEL0(...) __VA_ARGS__ +#define CATCH_RECURSION_LEVEL1(...) CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(__VA_ARGS__))) +#define CATCH_RECURSION_LEVEL2(...) CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(__VA_ARGS__))) +#define CATCH_RECURSION_LEVEL3(...) CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(__VA_ARGS__))) +#define CATCH_RECURSION_LEVEL4(...) CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(__VA_ARGS__))) +#define CATCH_RECURSION_LEVEL5(...) CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(__VA_ARGS__))) + +#ifdef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#define INTERNAL_CATCH_EXPAND_VARGS(...) __VA_ARGS__ +// MSVC needs more evaluations +#define CATCH_RECURSION_LEVEL6(...) CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(__VA_ARGS__))) +#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL6(CATCH_RECURSION_LEVEL6(__VA_ARGS__)) +#else +#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL5(__VA_ARGS__) +#endif + +#define CATCH_REC_END(...) +#define CATCH_REC_OUT + +#define CATCH_EMPTY() +#define CATCH_DEFER(id) id CATCH_EMPTY() + +#define CATCH_REC_GET_END2() 0, CATCH_REC_END +#define CATCH_REC_GET_END1(...) CATCH_REC_GET_END2 +#define CATCH_REC_GET_END(...) CATCH_REC_GET_END1 +#define CATCH_REC_NEXT0(test, next, ...) next CATCH_REC_OUT +#define CATCH_REC_NEXT1(test, next) CATCH_DEFER ( CATCH_REC_NEXT0 ) ( test, next, 0) +#define CATCH_REC_NEXT(test, next) CATCH_REC_NEXT1(CATCH_REC_GET_END test, next) + +#define CATCH_REC_LIST0(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ ) +#define CATCH_REC_LIST1(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0) ) ( f, peek, __VA_ARGS__ ) +#define CATCH_REC_LIST2(f, x, peek, ...) f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ ) + +#define CATCH_REC_LIST0_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ ) +#define CATCH_REC_LIST1_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0_UD) ) ( f, userdata, peek, __VA_ARGS__ ) +#define CATCH_REC_LIST2_UD(f, userdata, x, peek, ...) f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ ) + +// Applies the function macro `f` to each of the remaining parameters, inserts commas between the results, +// and passes userdata as the first parameter to each invocation, +// e.g. CATCH_REC_LIST_UD(f, x, a, b, c) evaluates to f(x, a), f(x, b), f(x, c) +#define CATCH_REC_LIST_UD(f, userdata, ...) CATCH_RECURSE(CATCH_REC_LIST2_UD(f, userdata, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) + +#define CATCH_REC_LIST(f, ...) CATCH_RECURSE(CATCH_REC_LIST2(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) + +#define INTERNAL_CATCH_EXPAND1(param) INTERNAL_CATCH_EXPAND2(param) +#define INTERNAL_CATCH_EXPAND2(...) INTERNAL_CATCH_NO## __VA_ARGS__ +#define INTERNAL_CATCH_DEF(...) INTERNAL_CATCH_DEF __VA_ARGS__ +#define INTERNAL_CATCH_NOINTERNAL_CATCH_DEF +#define INTERNAL_CATCH_STRINGIZE(...) INTERNAL_CATCH_STRINGIZE2(__VA_ARGS__) +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#define INTERNAL_CATCH_STRINGIZE2(...) #__VA_ARGS__ +#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) +#else +// MSVC is adding extra space and needs another indirection to expand INTERNAL_CATCH_NOINTERNAL_CATCH_DEF +#define INTERNAL_CATCH_STRINGIZE2(...) INTERNAL_CATCH_STRINGIZE3(__VA_ARGS__) +#define INTERNAL_CATCH_STRINGIZE3(...) #__VA_ARGS__ +#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) (INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) + 1) +#endif + +#define INTERNAL_CATCH_MAKE_NAMESPACE2(...) ns_##__VA_ARGS__ +#define INTERNAL_CATCH_MAKE_NAMESPACE(name) INTERNAL_CATCH_MAKE_NAMESPACE2(name) + +#define INTERNAL_CATCH_REMOVE_PARENS(...) INTERNAL_CATCH_EXPAND1(INTERNAL_CATCH_DEF __VA_ARGS__) + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS_GEN(__VA_ARGS__)>()) +#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__)) +#else +#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) INTERNAL_CATCH_EXPAND_VARGS(decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS_GEN(__VA_ARGS__)>())) +#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__))) +#endif + +#define INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(...)\ + CATCH_REC_LIST(INTERNAL_CATCH_MAKE_TYPE_LIST,__VA_ARGS__) + +#define INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_0) INTERNAL_CATCH_REMOVE_PARENS(_0) +#define INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_0, _1) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_1) +#define INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_0, _1, _2) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_1, _2) +#define INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_0, _1, _2, _3) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_1, _2, _3) +#define INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_0, _1, _2, _3, _4) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_1, _2, _3, _4) +#define INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_0, _1, _2, _3, _4, _5) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_1, _2, _3, _4, _5) +#define INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_0, _1, _2, _3, _4, _5, _6) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_1, _2, _3, _4, _5, _6) +#define INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_0, _1, _2, _3, _4, _5, _6, _7) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_1, _2, _3, _4, _5, _6, _7) +#define INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_1, _2, _3, _4, _5, _6, _7, _8) +#define INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9) +#define INTERNAL_CATCH_REMOVE_PARENS_11_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) + +#define INTERNAL_CATCH_VA_NARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N + +#define INTERNAL_CATCH_TYPE_GEN\ + template<typename...> struct TypeList {};\ + template<typename...Ts>\ + constexpr auto get_wrapper() noexcept -> TypeList<Ts...> { return {}; }\ + template<template<typename...> class...> struct TemplateTypeList{};\ + template<template<typename...> class...Cs>\ + constexpr auto get_wrapper() noexcept -> TemplateTypeList<Cs...> { return {}; }\ + template<typename...>\ + struct append;\ + template<typename...>\ + struct rewrap;\ + template<template<typename...> class, typename...>\ + struct create;\ + template<template<typename...> class, typename>\ + struct convert;\ + \ + template<typename T> \ + struct append<T> { using type = T; };\ + template< template<typename...> class L1, typename...E1, template<typename...> class L2, typename...E2, typename...Rest>\ + struct append<L1<E1...>, L2<E2...>, Rest...> { using type = typename append<L1<E1...,E2...>, Rest...>::type; };\ + template< template<typename...> class L1, typename...E1, typename...Rest>\ + struct append<L1<E1...>, TypeList<mpl_::na>, Rest...> { using type = L1<E1...>; };\ + \ + template< template<typename...> class Container, template<typename...> class List, typename...elems>\ + struct rewrap<TemplateTypeList<Container>, List<elems...>> { using type = TypeList<Container<elems...>>; };\ + template< template<typename...> class Container, template<typename...> class List, class...Elems, typename...Elements>\ + struct rewrap<TemplateTypeList<Container>, List<Elems...>, Elements...> { using type = typename append<TypeList<Container<Elems...>>, typename rewrap<TemplateTypeList<Container>, Elements...>::type>::type; };\ + \ + template<template <typename...> class Final, template< typename...> class...Containers, typename...Types>\ + struct create<Final, TemplateTypeList<Containers...>, TypeList<Types...>> { using type = typename append<Final<>, typename rewrap<TemplateTypeList<Containers>, Types...>::type...>::type; };\ + template<template <typename...> class Final, template <typename...> class List, typename...Ts>\ + struct convert<Final, List<Ts...>> { using type = typename append<Final<>,TypeList<Ts>...>::type; }; + +#define INTERNAL_CATCH_NTTP_1(signature, ...)\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)> struct Nttp{};\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\ + constexpr auto get_wrapper() noexcept -> Nttp<__VA_ARGS__> { return {}; } \ + template<template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class...> struct NttpTemplateTypeList{};\ + template<template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class...Cs>\ + constexpr auto get_wrapper() noexcept -> NttpTemplateTypeList<Cs...> { return {}; } \ + \ + template< template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class Container, template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class List, INTERNAL_CATCH_REMOVE_PARENS(signature)>\ + struct rewrap<NttpTemplateTypeList<Container>, List<__VA_ARGS__>> { using type = TypeList<Container<__VA_ARGS__>>; };\ + template< template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class Container, template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class List, INTERNAL_CATCH_REMOVE_PARENS(signature), typename...Elements>\ + struct rewrap<NttpTemplateTypeList<Container>, List<__VA_ARGS__>, Elements...> { using type = typename append<TypeList<Container<__VA_ARGS__>>, typename rewrap<NttpTemplateTypeList<Container>, Elements...>::type>::type; };\ + template<template <typename...> class Final, template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class...Containers, typename...Types>\ + struct create<Final, NttpTemplateTypeList<Containers...>, TypeList<Types...>> { using type = typename append<Final<>, typename rewrap<NttpTemplateTypeList<Containers>, Types...>::type...>::type; }; + +#define INTERNAL_CATCH_DECLARE_SIG_TEST0(TestName) +#define INTERNAL_CATCH_DECLARE_SIG_TEST1(TestName, signature)\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\ + static void TestName() +#define INTERNAL_CATCH_DECLARE_SIG_TEST_X(TestName, signature, ...)\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\ + static void TestName() + +#define INTERNAL_CATCH_DEFINE_SIG_TEST0(TestName) +#define INTERNAL_CATCH_DEFINE_SIG_TEST1(TestName, signature)\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\ + static void TestName() +#define INTERNAL_CATCH_DEFINE_SIG_TEST_X(TestName, signature,...)\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\ + static void TestName() + +#define INTERNAL_CATCH_NTTP_REGISTER0(TestFunc, signature)\ + template<typename Type>\ + void reg_test(TypeList<Type>, Catch::NameAndTags nameAndTags)\ + {\ + Catch::AutoReg( Catch::makeTestInvoker(&TestFunc<Type>), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), nameAndTags);\ + } + +#define INTERNAL_CATCH_NTTP_REGISTER(TestFunc, signature, ...)\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\ + void reg_test(Nttp<__VA_ARGS__>, Catch::NameAndTags nameAndTags)\ + {\ + Catch::AutoReg( Catch::makeTestInvoker(&TestFunc<__VA_ARGS__>), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), nameAndTags);\ + } + +#define INTERNAL_CATCH_NTTP_REGISTER_METHOD0(TestName, signature, ...)\ + template<typename Type>\ + void reg_test(TypeList<Type>, Catch::StringRef className, Catch::NameAndTags nameAndTags)\ + {\ + Catch::AutoReg( Catch::makeTestInvoker(&TestName<Type>::test), CATCH_INTERNAL_LINEINFO, className, nameAndTags);\ + } + +#define INTERNAL_CATCH_NTTP_REGISTER_METHOD(TestName, signature, ...)\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\ + void reg_test(Nttp<__VA_ARGS__>, Catch::StringRef className, Catch::NameAndTags nameAndTags)\ + {\ + Catch::AutoReg( Catch::makeTestInvoker(&TestName<__VA_ARGS__>::test), CATCH_INTERNAL_LINEINFO, className, nameAndTags);\ + } + +#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD0(TestName, ClassName) +#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD1(TestName, ClassName, signature)\ + template<typename TestType> \ + struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName)<TestType> { \ + void test();\ + } + +#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X(TestName, ClassName, signature, ...)\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)> \ + struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName)<__VA_ARGS__> { \ + void test();\ + } + +#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD0(TestName) +#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD1(TestName, signature)\ + template<typename TestType> \ + void INTERNAL_CATCH_MAKE_NAMESPACE(TestName)::TestName<TestType>::test() +#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X(TestName, signature, ...)\ + template<INTERNAL_CATCH_REMOVE_PARENS(signature)> \ + void INTERNAL_CATCH_MAKE_NAMESPACE(TestName)::TestName<__VA_ARGS__>::test() + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#define INTERNAL_CATCH_NTTP_0 +#define INTERNAL_CATCH_NTTP_GEN(...) INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__),INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_0) +#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD1, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD0)(TestName, __VA_ARGS__) +#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD1, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD0)(TestName, ClassName, __VA_ARGS__) +#define INTERNAL_CATCH_NTTP_REG_METHOD_GEN(TestName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD0, INTERNAL_CATCH_NTTP_REGISTER_METHOD0)(TestName, __VA_ARGS__) +#define INTERNAL_CATCH_NTTP_REG_GEN(TestFunc, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER0, INTERNAL_CATCH_NTTP_REGISTER0)(TestFunc, __VA_ARGS__) +#define INTERNAL_CATCH_DEFINE_SIG_TEST(TestName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DEFINE_SIG_TEST1, INTERNAL_CATCH_DEFINE_SIG_TEST0)(TestName, __VA_ARGS__) +#define INTERNAL_CATCH_DECLARE_SIG_TEST(TestName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DECLARE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST1, INTERNAL_CATCH_DECLARE_SIG_TEST0)(TestName, __VA_ARGS__) +#define INTERNAL_CATCH_REMOVE_PARENS_GEN(...) INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_REMOVE_PARENS_11_ARG,INTERNAL_CATCH_REMOVE_PARENS_10_ARG,INTERNAL_CATCH_REMOVE_PARENS_9_ARG,INTERNAL_CATCH_REMOVE_PARENS_8_ARG,INTERNAL_CATCH_REMOVE_PARENS_7_ARG,INTERNAL_CATCH_REMOVE_PARENS_6_ARG,INTERNAL_CATCH_REMOVE_PARENS_5_ARG,INTERNAL_CATCH_REMOVE_PARENS_4_ARG,INTERNAL_CATCH_REMOVE_PARENS_3_ARG,INTERNAL_CATCH_REMOVE_PARENS_2_ARG,INTERNAL_CATCH_REMOVE_PARENS_1_ARG)(__VA_ARGS__) +#else +#define INTERNAL_CATCH_NTTP_0(signature) +#define INTERNAL_CATCH_NTTP_GEN(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1,INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_0)( __VA_ARGS__)) +#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD1, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD0)(TestName, __VA_ARGS__)) +#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD1, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD0)(TestName, ClassName, __VA_ARGS__)) +#define INTERNAL_CATCH_NTTP_REG_METHOD_GEN(TestName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD0, INTERNAL_CATCH_NTTP_REGISTER_METHOD0)(TestName, __VA_ARGS__)) +#define INTERNAL_CATCH_NTTP_REG_GEN(TestFunc, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER0, INTERNAL_CATCH_NTTP_REGISTER0)(TestFunc, __VA_ARGS__)) +#define INTERNAL_CATCH_DEFINE_SIG_TEST(TestName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DEFINE_SIG_TEST1, INTERNAL_CATCH_DEFINE_SIG_TEST0)(TestName, __VA_ARGS__)) +#define INTERNAL_CATCH_DECLARE_SIG_TEST(TestName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( "dummy", __VA_ARGS__, INTERNAL_CATCH_DECLARE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST1, INTERNAL_CATCH_DECLARE_SIG_TEST0)(TestName, __VA_ARGS__)) +#define INTERNAL_CATCH_REMOVE_PARENS_GEN(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_REMOVE_PARENS_11_ARG,INTERNAL_CATCH_REMOVE_PARENS_10_ARG,INTERNAL_CATCH_REMOVE_PARENS_9_ARG,INTERNAL_CATCH_REMOVE_PARENS_8_ARG,INTERNAL_CATCH_REMOVE_PARENS_7_ARG,INTERNAL_CATCH_REMOVE_PARENS_6_ARG,INTERNAL_CATCH_REMOVE_PARENS_5_ARG,INTERNAL_CATCH_REMOVE_PARENS_4_ARG,INTERNAL_CATCH_REMOVE_PARENS_3_ARG,INTERNAL_CATCH_REMOVE_PARENS_2_ARG,INTERNAL_CATCH_REMOVE_PARENS_1_ARG)(__VA_ARGS__)) +#endif + +#endif // CATCH_PREPROCESSOR_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_random_number_generator.cpp b/packages/Catch2/src/catch2/internal/catch_random_number_generator.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f71c2323a6e55c807d594160b3af3a328ca70ccd --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_random_number_generator.cpp @@ -0,0 +1,70 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/internal/catch_random_number_generator.hpp> + +namespace Catch { + +namespace { + +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4146) // we negate uint32 during the rotate +#endif + // Safe rotr implementation thanks to John Regehr + uint32_t rotate_right(uint32_t val, uint32_t count) { + const uint32_t mask = 31; + count &= mask; + return (val >> count) | (val << (-count & mask)); + } + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif + +} + + + SimplePcg32::SimplePcg32(result_type seed_) { + seed(seed_); + } + + + void SimplePcg32::seed(result_type seed_) { + m_state = 0; + (*this)(); + m_state += seed_; + (*this)(); + } + + void SimplePcg32::discard(uint64_t skip) { + // We could implement this to run in O(log n) steps, but this + // should suffice for our use case. + for (uint64_t s = 0; s < skip; ++s) { + static_cast<void>((*this)()); + } + } + + SimplePcg32::result_type SimplePcg32::operator()() { + // prepare the output value + const uint32_t xorshifted = static_cast<uint32_t>(((m_state >> 18u) ^ m_state) >> 27u); + const auto output = rotate_right(xorshifted, m_state >> 59u); + + // advance state + m_state = m_state * 6364136223846793005ULL + s_inc; + + return output; + } + + bool operator==(SimplePcg32 const& lhs, SimplePcg32 const& rhs) { + return lhs.m_state == rhs.m_state; + } + + bool operator!=(SimplePcg32 const& lhs, SimplePcg32 const& rhs) { + return lhs.m_state != rhs.m_state; + } +} diff --git a/packages/Catch2/src/catch2/internal/catch_random_number_generator.hpp b/packages/Catch2/src/catch2/internal/catch_random_number_generator.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6c4b028b239689bf965d13da82bbdce2b9651f84 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_random_number_generator.hpp @@ -0,0 +1,59 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_RANDOM_NUMBER_GENERATOR_HPP_INCLUDED +#define CATCH_RANDOM_NUMBER_GENERATOR_HPP_INCLUDED + +#include <cstdint> + +namespace Catch { + + // This is a simple implementation of C++11 Uniform Random Number + // Generator. It does not provide all operators, because Catch2 + // does not use it, but it should behave as expected inside stdlib's + // distributions. + // The implementation is based on the PCG family (http://pcg-random.org) + class SimplePcg32 { + using state_type = std::uint64_t; + public: + using result_type = std::uint32_t; + static constexpr result_type (min)() { + return 0; + } + static constexpr result_type (max)() { + return static_cast<result_type>(-1); + } + + // Provide some default initial state for the default constructor + SimplePcg32():SimplePcg32(0xed743cc4U) {} + + explicit SimplePcg32(result_type seed_); + + void seed(result_type seed_); + void discard(uint64_t skip); + + result_type operator()(); + + private: + friend bool operator==(SimplePcg32 const& lhs, SimplePcg32 const& rhs); + friend bool operator!=(SimplePcg32 const& lhs, SimplePcg32 const& rhs); + + // In theory we also need operator<< and operator>> + // In practice we do not use them, so we will skip them for now + + + std::uint64_t m_state; + // This part of the state determines which "stream" of the numbers + // is chosen -- we take it as a constant for Catch2, so we only + // need to deal with seeding the main state. + // Picked by reading 8 bytes from `/dev/random` :-) + static const std::uint64_t s_inc = (0x13ed0cc53f939476ULL << 1ULL) | 1ULL; + }; + +} // end namespace Catch + +#endif // CATCH_RANDOM_NUMBER_GENERATOR_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_reporter_registry.cpp b/packages/Catch2/src/catch2/internal/catch_reporter_registry.cpp new file mode 100644 index 0000000000000000000000000000000000000000..372a0e3776760a2a714b56a8f4310424013a1b24 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_reporter_registry.cpp @@ -0,0 +1,59 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/internal/catch_reporter_registry.hpp> + +#include <catch2/catch_reporter_registrars.hpp> +#include <catch2/reporters/catch_reporter_automake.hpp> +#include <catch2/reporters/catch_reporter_compact.hpp> +#include <catch2/reporters/catch_reporter_console.hpp> +#include <catch2/reporters/catch_reporter_junit.hpp> +#include <catch2/reporters/catch_reporter_sonarqube.hpp> +#include <catch2/reporters/catch_reporter_tap.hpp> +#include <catch2/reporters/catch_reporter_teamcity.hpp> +#include <catch2/reporters/catch_reporter_xml.hpp> + +namespace Catch { + + ReporterRegistry::ReporterRegistry() { + // Because it is impossible to move out of initializer list, + // we have to add the elements manually + m_factories["automake"] = Detail::make_unique<ReporterFactory<AutomakeReporter>>(); + m_factories["compact"] = Detail::make_unique<ReporterFactory<CompactReporter>>(); + m_factories["console"] = Detail::make_unique<ReporterFactory<ConsoleReporter>>(); + m_factories["junit"] = Detail::make_unique<ReporterFactory<JunitReporter>>(); + m_factories["sonarqube"] = Detail::make_unique<ReporterFactory<SonarQubeReporter>>(); + m_factories["tap"] = Detail::make_unique<ReporterFactory<TAPReporter>>(); + m_factories["teamcity"] = Detail::make_unique<ReporterFactory<TeamCityReporter>>(); + m_factories["xml"] = Detail::make_unique<ReporterFactory<XmlReporter>>(); + } + + ReporterRegistry::~ReporterRegistry() = default; + + + IStreamingReporterPtr ReporterRegistry::create( std::string const& name, IConfig 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 factory ) { + m_factories.emplace(name, std::move(factory)); + } + void ReporterRegistry::registerListener( IReporterFactoryPtr factory ) { + m_listeners.push_back( std::move(factory) ); + } + + IReporterRegistry::FactoryMap const& ReporterRegistry::getFactories() const { + return m_factories; + } + IReporterRegistry::Listeners const& ReporterRegistry::getListeners() const { + return m_listeners; + } + +} diff --git a/packages/Catch2/src/catch2/internal/catch_reporter_registry.hpp b/packages/Catch2/src/catch2/internal/catch_reporter_registry.hpp new file mode 100644 index 0000000000000000000000000000000000000000..62c2023e9a97281be109133a037c59b1db1043ea --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_reporter_registry.hpp @@ -0,0 +1,38 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_REPORTER_REGISTRY_HPP_INCLUDED +#define CATCH_REPORTER_REGISTRY_HPP_INCLUDED + +#include <catch2/interfaces/catch_interfaces_reporter.hpp> +#include <catch2/interfaces/catch_interfaces_reporter_registry.hpp> + +#include <map> + +namespace Catch { + + class ReporterRegistry : public IReporterRegistry { + public: + + ReporterRegistry(); + ~ReporterRegistry() override; // = default, out of line to allow fwd decl + + IStreamingReporterPtr create( std::string const& name, IConfig const* config ) const override; + + void registerReporter( std::string const& name, IReporterFactoryPtr factory ); + void registerListener( IReporterFactoryPtr factory ); + + FactoryMap const& getFactories() const override; + Listeners const& getListeners() const override; + + private: + FactoryMap m_factories; + Listeners m_listeners; + }; +} + +#endif // CATCH_REPORTER_REGISTRY_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_result_type.cpp b/packages/Catch2/src/catch2/internal/catch_result_type.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7dea5b4738f4caed1cd601683ac044f32a944867 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_result_type.cpp @@ -0,0 +1,26 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/internal/catch_result_type.hpp> + +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/packages/Catch2/src/catch2/internal/catch_result_type.hpp b/packages/Catch2/src/catch2/internal/catch_result_type.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f0906fcd303d6dd7547f04780314af30bd2acc71 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_result_type.hpp @@ -0,0 +1,55 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_RESULT_TYPE_HPP_INCLUDED +#define CATCH_RESULT_TYPE_HPP_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 // CATCH_RESULT_TYPE_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_run_context.cpp b/packages/Catch2/src/catch2/internal/catch_run_context.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8379a7aa02ff2a0e3ce97366c0d105a0e1b48f70 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_run_context.cpp @@ -0,0 +1,605 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/internal/catch_run_context.hpp> + +#include <catch2/interfaces/catch_interfaces_generatortracker.hpp> +#include <catch2/interfaces/catch_interfaces_config.hpp> +#include <catch2/internal/catch_compiler_capabilities.hpp> +#include <catch2/internal/catch_context.hpp> +#include <catch2/internal/catch_enforce.hpp> +#include <catch2/internal/catch_fatal_condition_handler.hpp> +#include <catch2/internal/catch_random_number_generator.hpp> +#include <catch2/catch_timer.hpp> +#include <catch2/internal/catch_output_redirect.hpp> +#include <catch2/internal/catch_assertion_handler.hpp> +#include <catch2/internal/catch_test_failure_exception.hpp> + +#include <cassert> +#include <algorithm> + +namespace Catch { + + namespace Generators { + struct GeneratorTracker : TestCaseTracking::TrackerBase, IGeneratorTracker { + GeneratorBasePtr m_generator; + + GeneratorTracker( TestCaseTracking::NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ) + : TrackerBase( nameAndLocation, ctx, parent ) + {} + ~GeneratorTracker(); + + static GeneratorTracker& acquire( TrackerContext& ctx, TestCaseTracking::NameAndLocation const& nameAndLocation ) { + GeneratorTracker* tracker; + + ITracker& currentTracker = ctx.currentTracker(); + // Under specific circumstances, the generator we want + // to acquire is also the current tracker. If this is + // the case, we have to avoid looking through current + // tracker's children, and instead return the current + // tracker. + // A case where this check is important is e.g. + // for (int i = 0; i < 5; ++i) { + // int n = GENERATE(1, 2); + // } + // + // without it, the code above creates 5 nested generators. + if ( currentTracker.nameAndLocation() == nameAndLocation ) { + auto thisTracker = + currentTracker.parent().findChild( nameAndLocation ); + assert( thisTracker ); + assert( thisTracker->isGeneratorTracker() ); + tracker = static_cast<GeneratorTracker*>( thisTracker ); + } else if ( ITracker* childTracker = + currentTracker.findChild( nameAndLocation ) ) { + assert( childTracker ); + assert( childTracker->isGeneratorTracker() ); + tracker = static_cast<GeneratorTracker*>( childTracker ); + } else { + auto newTracker = + Catch::Detail::make_unique<GeneratorTracker>( + nameAndLocation, ctx, ¤tTracker ); + tracker = newTracker.get(); + currentTracker.addChild( std::move(newTracker) ); + } + + if( !tracker->isComplete() ) { + tracker->open(); + } + + return *tracker; + } + + // TrackerBase interface + bool isGeneratorTracker() const override { return true; } + auto hasGenerator() const -> bool override { + return !!m_generator; + } + void close() override { + TrackerBase::close(); + // If a generator has a child (it is followed by a section) + // and none of its children have started, then we must wait + // until later to start consuming its values. + // This catches cases where `GENERATE` is placed between two + // `SECTION`s. + // **The check for m_children.empty cannot be removed**. + // doing so would break `GENERATE` _not_ followed by `SECTION`s. + const bool should_wait_for_child = [&]() { + // No children -> nobody to wait for + if ( m_children.empty() ) { + return false; + } + // If at least one child started executing, don't wait + if ( std::find_if( + m_children.begin(), + m_children.end(), + []( TestCaseTracking::ITrackerPtr const& tracker ) { + return tracker->hasStarted(); + } ) != m_children.end() ) { + return false; + } + + // No children have started. We need to check if they _can_ + // start, and thus we should wait for them, or they cannot + // start (due to filters), and we shouldn't wait for them + ITracker* parent = m_parent; + // This is safe: there is always at least one section + // tracker in a test case tracking tree + while ( !parent->isSectionTracker() ) { + parent = &( parent->parent() ); + } + assert( parent && + "Missing root (test case) level section" ); + + auto const& parentSection = + static_cast<SectionTracker const&>( *parent ); + auto const& filters = parentSection.getFilters(); + // No filters -> no restrictions on running sections + if ( filters.empty() ) { + return true; + } + + for ( auto const& child : m_children ) { + if ( child->isSectionTracker() && + std::find( + filters.begin(), + filters.end(), + static_cast<SectionTracker const&>( *child ) + .trimmedName() ) != filters.end() ) { + return true; + } + } + return false; + }(); + + // This check is a bit tricky, because m_generator->next() + // has a side-effect, where it consumes generator's current + // value, but we do not want to invoke the side-effect if + // this generator is still waiting for any child to start. + if ( should_wait_for_child || + ( m_runState == CompletedSuccessfully && + m_generator->next() ) ) { + m_children.clear(); + m_runState = Executing; + } + } + + // IGeneratorTracker interface + auto getGenerator() const -> GeneratorBasePtr const& override { + return m_generator; + } + void setGenerator( GeneratorBasePtr&& generator ) override { + m_generator = std::move( generator ); + } + }; + GeneratorTracker::~GeneratorTracker() {} + } + + RunContext::RunContext(IConfig const* _config, IStreamingReporterPtr&& reporter) + : m_runInfo(_config->name()), + m_context(getCurrentMutableContext()), + m_config(_config), + m_reporter(std::move(reporter)), + m_lastAssertionInfo{ StringRef(), SourceLineInfo("",0), StringRef(), ResultDisposition::Normal }, + m_includeSuccessfulResults( m_config->includeSuccessfulResults() || m_reporter->getPreferences().shouldReportAllAssertions ) + { + m_context.setRunner(this); + 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(TestCaseHandle const& testCase) { + Totals prevTotals = m_totals; + + std::string redirectedCout; + std::string redirectedCerr; + + auto const& 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; + } + + + 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))); + + if (result.getResultType() != ResultWas::Warning) + m_messageScopes.clear(); + + // 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; + } + auto RunContext::acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& { + using namespace Generators; + GeneratorTracker& tracker = GeneratorTracker::acquire(m_trackerContext, + TestCaseTracking::NameAndLocation( static_cast<std::string>(generatorName), lineInfo ) ); + m_lastAssertionInfo.lineInfo = lineInfo; + return tracker; + } + + 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(); + m_messageScopes.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::benchmarkPreparing(std::string const& name) { + m_reporter->benchmarkPreparing(name); + } + void RunContext::benchmarkStarting( BenchmarkInfo const& info ) { + m_reporter->benchmarkStarting( info ); + } + void RunContext::benchmarkEnded( BenchmarkStats<> const& stats ) { + m_reporter->benchmarkEnded( stats ); + } + void RunContext::benchmarkFailed(std::string const & error) { + m_reporter->benchmarkFailed(error); + } + + void RunContext::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()); + } + + void RunContext::emplaceUnscopedMessage( MessageBuilder const& builder ) { + m_messageScopes.emplace_back( builder ); + } + + 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 = static_cast<std::string>(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); + + 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(); + m_messageScopes.clear(); + } + + 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); + m_reporter->sectionStarting(testCaseSection); + Counts prevAssertions = m_totals.assertions; + double duration = 0; + m_shouldReportUnexpected = true; + m_lastAssertionInfo = { "TEST_CASE"_sr, testCaseInfo.lineInfo, StringRef(), ResultDisposition::Normal }; + + seedRng(*m_config); + + Timer timer; + CATCH_TRY { + if (m_reporter->getPreferences().shouldRedirectStdOut) { +#if !defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT) + RedirectedStreams redirectedStreams(redirectedCout, redirectedCerr); + + timer.start(); + invokeActiveTestCase(); +#else + OutputRedirect r(redirectedCout, redirectedCerr); + timer.start(); + invokeActiveTestCase(); +#endif + } else { + timer.start(); + invokeActiveTestCase(); + } + duration = timer.getElapsedSeconds(); + } CATCH_CATCH_ANON (TestFailureException&) { + // This just means the test was aborted due to failure + } CATCH_CATCH_ALL { + // 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(); + m_messageScopes.clear(); + + SectionStats testCaseSectionStats(testCaseSection, assertions, duration, missingAssertions); + m_reporter->sectionEnded(testCaseSectionStats); + } + + void RunContext::invokeActiveTestCase() { + // We need to register a handler for signals/structured exceptions + // before running the tests themselves, or the binary can crash + // without failed test being reported. + FatalConditionHandler _; + m_activeTestCase->invoke(); + } + + 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 = static_cast<std::string>(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"); + } + + void seedRng(IConfig const& config) { + if (config.rngSeed() != 0) { + std::srand(config.rngSeed()); + rng().seed(config.rngSeed()); + } + } + + unsigned int rngSeed() { + return getCurrentContext().getConfig()->rngSeed(); + } + +} diff --git a/packages/Catch2/src/catch2/internal/catch_run_context.hpp b/packages/Catch2/src/catch2/internal/catch_run_context.hpp new file mode 100644 index 0000000000000000000000000000000000000000..24e0c99a3ebef042bea6c5f0f20f7c82b1ec605f --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_run_context.hpp @@ -0,0 +1,151 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_RUN_CONTEXT_HPP_INCLUDED +#define CATCH_RUN_CONTEXT_HPP_INCLUDED + +#include <catch2/interfaces/catch_interfaces_runner.hpp> +#include <catch2/interfaces/catch_interfaces_reporter.hpp> +#include <catch2/internal/catch_test_registry.hpp> +#include <catch2/catch_test_case_info.hpp> +#include <catch2/catch_message.hpp> +#include <catch2/catch_totals.hpp> +#include <catch2/internal/catch_test_case_tracker.hpp> +#include <catch2/catch_assertion_info.hpp> +#include <catch2/catch_assertion_result.hpp> +#include <catch2/internal/catch_option.hpp> + +#include <string> + +namespace Catch { + + struct IMutableContext; + struct IGeneratorTracker; + struct IConfig; + + /////////////////////////////////////////////////////////////////////////// + + class RunContext : public IResultCapture, public IRunner { + + public: + RunContext( RunContext const& ) = delete; + RunContext& operator =( RunContext const& ) = delete; + + explicit RunContext( IConfig 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(TestCaseHandle const& testCase); + + 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; + + auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& override; + + void benchmarkPreparing( std::string const& name ) override; + void benchmarkStarting( BenchmarkInfo const& info ) override; + void benchmarkEnded( BenchmarkStats<> const& stats ) override; + void benchmarkFailed( std::string const& error ) override; + + void pushScopedMessage( MessageInfo const& message ) override; + void popScopedMessage( MessageInfo const& message ) override; + + void emplaceUnscopedMessage( MessageBuilder const& builder ) 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; + TestCaseHandle const* m_activeTestCase = nullptr; + ITracker* m_testCaseTracker = nullptr; + Option<AssertionResult> m_lastResult; + + IConfig const* m_config; + Totals m_totals; + IStreamingReporterPtr m_reporter; + std::vector<MessageInfo> m_messages; + std::vector<ScopedMessage> m_messageScopes; /* Keeps owners of so-called unscoped 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; + }; + + void seedRng(IConfig const& config); + unsigned int rngSeed(); +} // end namespace Catch + +#endif // CATCH_RUN_CONTEXT_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_section.cpp b/packages/Catch2/src/catch2/internal/catch_section.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6c13c7dd77094908796d9a11a197606a02e11ae0 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_section.cpp @@ -0,0 +1,43 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/internal/catch_section.hpp> +#include <catch2/internal/catch_test_macro_impl.hpp> +#include <catch2/internal/catch_uncaught_exceptions.hpp> + +#include <utility> + +namespace Catch { + + Section::Section( SectionInfo&& info ): + m_info( std::move( info ) ), + m_sectionIncluded( + getResultCapture().sectionStarted( m_info, m_assertions ) ) { + // Non-"included" sections will not use the timing information + // anyway, so don't bother with the potential syscall. + if (m_sectionIncluded) { + 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/packages/Catch2/src/catch2/internal/catch_section.hpp b/packages/Catch2/src/catch2/internal/catch_section.hpp new file mode 100644 index 0000000000000000000000000000000000000000..36d900bbeb094bb906da78b467afb755e3aaf751 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_section.hpp @@ -0,0 +1,51 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_SECTION_HPP_INCLUDED +#define CATCH_SECTION_HPP_INCLUDED + +#include <catch2/internal/catch_compiler_capabilities.hpp> +#include <catch2/internal/catch_noncopyable.hpp> +#include <catch2/catch_section_info.hpp> +#include <catch2/catch_timer.hpp> +#include <catch2/catch_totals.hpp> + +#include <string> + +namespace Catch { + + class Section : Detail::NonCopyable { + public: + Section( SectionInfo&& info ); + ~Section(); + + // This indicates whether the section should be executed or not + explicit operator bool() const; + + private: + SectionInfo m_info; + + Counts m_assertions; + bool m_sectionIncluded; + Timer m_timer; + }; + +} // end namespace Catch + +#define INTERNAL_CATCH_SECTION( ... ) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) ) \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION + +#define INTERNAL_CATCH_DYNAMIC_SECTION( ... ) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, (Catch::ReusableStringStream() << __VA_ARGS__).str() ) ) \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION + +#endif // CATCH_SECTION_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_singletons.cpp b/packages/Catch2/src/catch2/internal/catch_singletons.cpp new file mode 100644 index 0000000000000000000000000000000000000000..36e0e7bdae1ea69951907a89d32974432e8e37a8 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_singletons.cpp @@ -0,0 +1,36 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/internal/catch_singletons.hpp> + +#include <vector> + +namespace Catch { + + namespace { + static auto getSingletons() -> std::vector<ISingleton*>*& { + static std::vector<ISingleton*>* g_singletons = nullptr; + if( !g_singletons ) + g_singletons = new std::vector<ISingleton*>(); + return g_singletons; + } + } + + ISingleton::~ISingleton() {} + + void addSingleton(ISingleton* singleton ) { + getSingletons()->push_back( singleton ); + } + void cleanupSingletons() { + auto& singletons = getSingletons(); + for( auto singleton : *singletons ) + delete singleton; + delete singletons; + singletons = nullptr; + } + +} // namespace Catch diff --git a/packages/Catch2/src/catch2/internal/catch_singletons.hpp b/packages/Catch2/src/catch2/internal/catch_singletons.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0a7f7cccb4974bcb3c6777fdbacd44a0cefd174f --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_singletons.hpp @@ -0,0 +1,45 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_SINGLETONS_HPP_INCLUDED +#define CATCH_SINGLETONS_HPP_INCLUDED + +namespace Catch { + + struct ISingleton { + virtual ~ISingleton(); + }; + + + void addSingleton( ISingleton* singleton ); + void cleanupSingletons(); + + + template<typename SingletonImplT, typename InterfaceT = SingletonImplT, typename MutableInterfaceT = InterfaceT> + class Singleton : SingletonImplT, public ISingleton { + + static auto getInternal() -> Singleton* { + static Singleton* s_instance = nullptr; + if( !s_instance ) { + s_instance = new Singleton; + addSingleton( s_instance ); + } + return s_instance; + } + + public: + static auto get() -> InterfaceT const& { + return *getInternal(); + } + static auto getMutable() -> MutableInterfaceT& { + return *getInternal(); + } + }; + +} // namespace Catch + +#endif // CATCH_SINGLETONS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_source_line_info.cpp b/packages/Catch2/src/catch2/internal/catch_source_line_info.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9a4fe74e511b3b06f56119bd39246f59659eabaf --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_source_line_info.cpp @@ -0,0 +1,33 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/internal/catch_source_line_info.hpp> + +#include <cstring> +#include <ostream> + +namespace Catch { + + 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 { + // We can assume that the same file will usually have the same pointer. + // Thus, if the pointers are the same, there is no point in calling the strcmp + return line < other.line || ( line == other.line && file != other.file && (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; + } + +} // end namespace Catch diff --git a/packages/Catch2/src/catch2/internal/catch_source_line_info.hpp b/packages/Catch2/src/catch2/internal/catch_source_line_info.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8aca4867396e7f22d288d1600eb43cfd3fd742cb --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_source_line_info.hpp @@ -0,0 +1,57 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_SOURCE_LINE_INFO_HPP_INCLUDED +#define CATCH_SOURCE_LINE_INFO_HPP_INCLUDED + +#include <catch2/internal/catch_config_counter.hpp> + +#include <cstddef> +#include <iosfwd> + +#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 + +// 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 { + + struct SourceLineInfo { + + SourceLineInfo() = delete; + constexpr SourceLineInfo( char const* _file, std::size_t _line ) noexcept: + file( _file ), + line( _line ) + {} + + bool operator == ( SourceLineInfo const& other ) const noexcept; + bool operator < ( SourceLineInfo const& other ) const noexcept; + + char const* file; + std::size_t line; + + friend std::ostream& operator << (std::ostream& os, SourceLineInfo const& info); + }; + + + // Bring in operator<< from global namespace into Catch namespace + // This is necessary because the overload of operator<< above makes + // lookup stop at namespace Catch + using ::operator<<; +} + +#define CATCH_INTERNAL_LINEINFO \ + ::Catch::SourceLineInfo( __FILE__, static_cast<std::size_t>( __LINE__ ) ) + +#endif // CATCH_SOURCE_LINE_INFO_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_startup_exception_registry.hpp b/packages/Catch2/src/catch2/internal/catch_startup_exception_registry.hpp new file mode 100644 index 0000000000000000000000000000000000000000..943772b8ddd6eb57b4f56bd19a5787988e445205 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_startup_exception_registry.hpp @@ -0,0 +1,29 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_STARTUP_EXCEPTION_REGISTRY_HPP_INCLUDED +#define CATCH_STARTUP_EXCEPTION_REGISTRY_HPP_INCLUDED + + +#include <vector> +#include <exception> + +namespace Catch { + + class StartupExceptionRegistry { +#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + public: + void add(std::exception_ptr const& exception) noexcept; + std::vector<std::exception_ptr> const& getExceptions() const noexcept; + private: + std::vector<std::exception_ptr> m_exceptions; +#endif + }; + +} // end namespace Catch + +#endif // CATCH_STARTUP_EXCEPTION_REGISTRY_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_stream.cpp b/packages/Catch2/src/catch2/internal/catch_stream.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3014256de3d09ff195c7c38296dfd1bea4a20ef0 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_stream.cpp @@ -0,0 +1,190 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/internal/catch_enforce.hpp> +#include <catch2/internal/catch_stream.hpp> +#include <catch2/internal/catch_debug_console.hpp> +#include <catch2/internal/catch_stringref.hpp> +#include <catch2/internal/catch_singletons.hpp> +#include <catch2/internal/catch_unique_ptr.hpp> + +#include <cstdio> +#include <iostream> +#include <fstream> +#include <sstream> +#include <vector> + +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 { + Detail::unique_ptr<StreamBufImpl<OutputDebugWriter>> m_streamBuf; + mutable std::ostream m_os; + public: + DebugOutStream() + : m_streamBuf( Detail::make_unique<StreamBufImpl<OutputDebugWriter>>() ), + m_os( m_streamBuf.get() ) + {} + + ~DebugOutStream() override = default; + + public: // IStream + std::ostream& stream() const override { return m_os; } + }; + + } // unnamed namespace +} // namespace 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<Detail::unique_ptr<std::ostringstream>> m_streams; + std::vector<std::size_t> m_unused; + std::ostringstream m_referenceStream; // Used for copy state/ flags from + + auto add() -> std::size_t { + if( m_unused.empty() ) { + m_streams.push_back( Detail::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); + } + }; + + ReusableStringStream::ReusableStringStream() + : m_index( Singleton<StringStreams>::getMutable().add() ), + m_oss( Singleton<StringStreams>::getMutable().m_streams[m_index].get() ) + {} + + ReusableStringStream::~ReusableStringStream() { + static_cast<std::ostringstream*>( m_oss )->str(""); + m_oss->clear(); + Singleton<StringStreams>::getMutable().release( m_index ); + } + + std::string ReusableStringStream::str() const { + return static_cast<std::ostringstream*>( m_oss )->str(); + } + + void ReusableStringStream::str( std::string const& str ) { + static_cast<std::ostringstream*>( m_oss )->str( 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 +} diff --git a/packages/Catch2/src/catch2/internal/catch_stream.hpp b/packages/Catch2/src/catch2/internal/catch_stream.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5f24fc38df285f583aa1ee12fbc6e120cd3a5719 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_stream.hpp @@ -0,0 +1,69 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_STREAM_HPP_INCLUDED +#define CATCH_STREAM_HPP_INCLUDED + +#include <catch2/internal/catch_noncopyable.hpp> + +#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 : Detail::NonCopyable { + std::size_t m_index; + std::ostream* m_oss; + public: + ReusableStringStream(); + ~ReusableStringStream(); + + //! Returns the serialized state + std::string str() const; + //! Sets internal state to `str` + void str(std::string const& str); + +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic push +// Old versions of GCC do not understand -Wnonnull-compare +#pragma GCC diagnostic ignored "-Wpragmas" +// Streaming a function pointer triggers Waddress and Wnonnull-compare +// on GCC, because it implicitly converts it to bool and then decides +// that the check it uses (a? true : false) is tautological and cannot +// be null... +#pragma GCC diagnostic ignored "-Waddress" +#pragma GCC diagnostic ignored "-Wnonnull-compare" +#endif + + template<typename T> + auto operator << ( T const& value ) -> ReusableStringStream& { + *m_oss << value; + return *this; + } + +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic pop +#endif + auto get() -> std::ostream& { return *m_oss; } + }; +} + +#endif // CATCH_STREAM_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_stream_end_stop.hpp b/packages/Catch2/src/catch2/internal/catch_stream_end_stop.hpp new file mode 100644 index 0000000000000000000000000000000000000000..452ca1e97357f30e26c2d584f4b4b856b1f7084e --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_stream_end_stop.hpp @@ -0,0 +1,30 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_STREAM_END_STOP_HPP_INCLUDED +#define CATCH_STREAM_END_STOP_HPP_INCLUDED + +#include <catch2/internal/catch_stringref.hpp> + +namespace Catch { + + // Use this in variadic streaming macros to allow + // << +StreamEndStop + // as well as + // << stuff +StreamEndStop + struct StreamEndStop { + StringRef operator+() const { return StringRef(); } + + template <typename T> + friend T const& operator+( T const& value, StreamEndStop ) { + return value; + } + }; + +} // namespace Catch + +#endif // CATCH_STREAM_END_STOP_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_string_manip.cpp b/packages/Catch2/src/catch2/internal/catch_string_manip.cpp new file mode 100644 index 0000000000000000000000000000000000000000..df6b6c3485be8f4d6f5366a49e838945cafcd9e9 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_string_manip.cpp @@ -0,0 +1,109 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/internal/catch_string_manip.hpp> +#include <catch2/internal/catch_stringref.hpp> + +#include <algorithm> +#include <ostream> +#include <cstring> +#include <cctype> +#include <vector> + +namespace Catch { + + namespace { + char toLowerCh(char c) { + return static_cast<char>( std::tolower( static_cast<unsigned char>(c) ) ); + } + } + + 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; + } + 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(); + } + + StringRef trim(StringRef ref) { + const auto is_ws = [](char c) { + return c == ' ' || c == '\t' || c == '\n' || c == '\r'; + }; + size_t real_begin = 0; + while (real_begin < ref.size() && is_ws(ref[real_begin])) { ++real_begin; } + size_t real_end = ref.size(); + while (real_end > real_begin && is_ws(ref[real_end - 1])) { --real_end; } + + return ref.substr(real_begin, real_end - real_begin); + } + + 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; + } + + std::vector<StringRef> splitStringRef( StringRef str, char delimiter ) { + std::vector<StringRef> subStrings; + std::size_t start = 0; + for(std::size_t pos = 0; pos < str.size(); ++pos ) { + if( str[pos] == delimiter ) { + if( pos - start > 1 ) + subStrings.push_back( str.substr( start, pos-start ) ); + start = pos+1; + } + } + if( start < str.size() ) + subStrings.push_back( str.substr( start, str.size()-start ) ); + return subStrings; + } + + 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/packages/Catch2/src/catch2/internal/catch_string_manip.hpp b/packages/Catch2/src/catch2/internal/catch_string_manip.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d4a2fbafe5c18818017408e19bfbc32c5db24f62 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_string_manip.hpp @@ -0,0 +1,45 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_STRING_MANIP_HPP_INCLUDED +#define CATCH_STRING_MANIP_HPP_INCLUDED + +#include <catch2/internal/catch_stringref.hpp> + +#include <string> +#include <iosfwd> +#include <vector> + +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 ); + //! Returns a new string without whitespace at the start/end + std::string trim( std::string const& str ); + //! Returns a substring of the original ref without whitespace. Beware lifetimes! + StringRef trim(StringRef ref); + + // !!! Be aware, returns refs into original string - make sure original string outlives them + std::vector<StringRef> splitStringRef( StringRef str, char delimiter ); + 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 // CATCH_STRING_MANIP_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_stringref.cpp b/packages/Catch2/src/catch2/internal/catch_stringref.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a318857cadd6ab14f7220c0e5bc1991ddd8836ae --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_stringref.cpp @@ -0,0 +1,55 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/internal/catch_enforce.hpp> +#include <catch2/internal/catch_stringref.hpp> + +#include <algorithm> +#include <ostream> +#include <cstring> +#include <cstdint> + +namespace Catch { + StringRef::StringRef( char const* rawChars ) noexcept + : StringRef( rawChars, static_cast<StringRef::size_type>(std::strlen(rawChars) ) ) + {} + + auto StringRef::c_str() const -> char const* { + CATCH_ENFORCE(isNullTerminated(), "Called StringRef::c_str() on a non-null-terminated instance"); + return m_start; + } + + auto StringRef::operator == ( StringRef const& other ) const noexcept -> bool { + return m_size == other.m_size + && (std::memcmp( m_start, other.m_start, m_size ) == 0); + } + + bool StringRef::operator<(StringRef const& rhs) const noexcept { + if (m_size < rhs.m_size) { + return strncmp(m_start, rhs.m_start, m_size) <= 0; + } + return strncmp(m_start, rhs.m_start, rhs.m_size) < 0; + } + + auto operator << ( std::ostream& os, StringRef const& str ) -> std::ostream& { + return os.write(str.data(), str.size()); + } + + std::string operator+(StringRef lhs, StringRef rhs) { + std::string ret; + ret.reserve(lhs.size() + rhs.size()); + ret += lhs; + ret += rhs; + return ret; + } + + auto operator+=( std::string& lhs, StringRef const& rhs ) -> std::string& { + lhs.append(rhs.data(), rhs.size()); + return lhs; + } + +} // namespace Catch diff --git a/packages/Catch2/src/catch2/internal/catch_stringref.hpp b/packages/Catch2/src/catch2/internal/catch_stringref.hpp new file mode 100644 index 0000000000000000000000000000000000000000..33b35ef6c682e65daffc78d1d65559db506c7aea --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_stringref.hpp @@ -0,0 +1,118 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_STRINGREF_HPP_INCLUDED +#define CATCH_STRINGREF_HPP_INCLUDED + +#include <cstddef> +#include <string> +#include <iosfwd> +#include <cassert> + +namespace Catch { + + /// 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. + class StringRef { + public: + using size_type = std::size_t; + using const_iterator = const char*; + + private: + static constexpr char const* const s_empty = ""; + + char const* m_start = s_empty; + size_type m_size = 0; + + public: // construction + constexpr StringRef() noexcept = default; + + StringRef( char const* rawChars ) noexcept; + + constexpr 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() ) + {} + + explicit operator std::string() const { + return std::string(m_start, m_size); + } + + public: // operators + auto operator == ( StringRef const& other ) const noexcept -> bool; + auto operator != (StringRef const& other) const noexcept -> bool { + return !(*this == other); + } + + constexpr auto operator[] ( size_type index ) const noexcept -> char { + assert(index < m_size); + return m_start[index]; + } + + bool operator<(StringRef const& rhs) const noexcept; + + public: // named queries + constexpr auto empty() const noexcept -> bool { + return m_size == 0; + } + constexpr auto size() const noexcept -> size_type { + return m_size; + } + + // Returns the current start pointer. If the StringRef is not + // null-terminated, throws std::domain_exception + auto c_str() const -> char const*; + + public: // substrings and searches + // Returns a substring of [start, start + length). + // If start + length > size(), then the substring is [start, start + size()). + // If start > size(), then the substring is empty. + constexpr StringRef substr(size_type start, size_type length) const noexcept { + if (start < m_size) { + const auto shortened_size = m_size - start; + return StringRef(m_start + start, (shortened_size < length) ? shortened_size : length); + } else { + return StringRef(); + } + } + + // Returns the current start pointer. May not be null-terminated. + constexpr char const* data() const noexcept { + return m_start; + } + + constexpr auto isNullTerminated() const noexcept -> bool { + return m_start[m_size] == '\0'; + } + + public: // iterators + constexpr const_iterator begin() const { return m_start; } + constexpr const_iterator end() const { return m_start + m_size; } + + + friend std::string& operator += (std::string& lhs, StringRef const& sr); + friend std::ostream& operator << (std::ostream& os, StringRef const& sr); + friend std::string operator+(StringRef lhs, StringRef rhs); + }; + + + constexpr auto operator "" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef { + return StringRef( rawChars, size ); + } +} // namespace Catch + +constexpr auto operator "" _catch_sr( char const* rawChars, std::size_t size ) noexcept -> Catch::StringRef { + return Catch::StringRef( rawChars, size ); +} + +#endif // CATCH_STRINGREF_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_tag_alias_registry.cpp b/packages/Catch2/src/catch2/internal/catch_tag_alias_registry.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5df3c02ba8988d2b6850bd6a41987869d86b8977 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_tag_alias_registry.cpp @@ -0,0 +1,55 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/internal/catch_tag_alias_registry.hpp> +#include <catch2/internal/catch_console_colour.hpp> +#include <catch2/internal/catch_enforce.hpp> +#include <catch2/interfaces/catch_interfaces_registry_hub.hpp> +#include <catch2/internal/catch_string_manip.hpp> + +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/packages/Catch2/src/catch2/internal/catch_tag_alias_registry.hpp b/packages/Catch2/src/catch2/internal/catch_tag_alias_registry.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9dd86c13aab9815d7da2d6c875e097e084932a61 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_tag_alias_registry.hpp @@ -0,0 +1,32 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_TAG_ALIAS_REGISTRY_HPP_INCLUDED +#define CATCH_TAG_ALIAS_REGISTRY_HPP_INCLUDED + +#include <catch2/interfaces/catch_interfaces_tag_alias_registry.hpp> +#include <catch2/catch_tag_alias.hpp> + +#include <map> +#include <string> + +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 // CATCH_TAG_ALIAS_REGISTRY_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_template_test_registry.hpp b/packages/Catch2/src/catch2/internal/catch_template_test_registry.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3617109b3eb18fcb0c31abea5c68eaa895cf7851 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_template_test_registry.hpp @@ -0,0 +1,331 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_TEMPLATE_TEST_REGISTRY_HPP_INCLUDED +#define CATCH_TEMPLATE_TEST_REGISTRY_HPP_INCLUDED + +#include <catch2/internal/catch_test_registry.hpp> +#include <catch2/internal/catch_compiler_capabilities.hpp> +#include <catch2/internal/catch_preprocessor.hpp> +#include <catch2/internal/catch_meta.hpp> + +// GCC 5 and older do not properly handle disabling unused-variable warning +// with a _Pragma. This means that we have to leak the suppression to the +// user code as well :-( +#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ <= 5 +#pragma GCC diagnostic ignored "-Wunused-variable" +#endif + +#if defined(CATCH_CONFIG_DISABLE) + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( TestName, TestFunc, Name, Tags, Signature, ... ) \ + INTERNAL_CATCH_DEFINE_SIG_TEST(TestFunc, INTERNAL_CATCH_REMOVE_PARENS(Signature)) + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( TestNameClass, TestName, ClassName, Name, Tags, Signature, ... ) \ + namespace{ \ + namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) { \ + INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, INTERNAL_CATCH_REMOVE_PARENS(Signature));\ + } \ + } \ + INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature)) + + #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(Name, Tags, ...) \ + INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename TestType, __VA_ARGS__ ) + #else + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(Name, Tags, ...) \ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename TestType, __VA_ARGS__ ) ) + #endif + + #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(Name, Tags, Signature, ...) \ + INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ ) + #else + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(Name, Tags, Signature, ...) \ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ ) ) + #endif + + #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION( ClassName, Name, Tags,... ) \ + INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) + #else + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION( ClassName, Name, Tags,... ) \ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) ) + #endif + + #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION( ClassName, Name, Tags, Signature, ... ) \ + INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) + #else + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION( ClassName, Name, Tags, Signature, ... ) \ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) ) + #endif +#endif + + + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_2(TestName, TestFunc, Name, Tags, Signature, ... )\ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + INTERNAL_CATCH_DECLARE_SIG_TEST(TestFunc, INTERNAL_CATCH_REMOVE_PARENS(Signature));\ + namespace {\ + namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){\ + INTERNAL_CATCH_TYPE_GEN\ + INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))\ + INTERNAL_CATCH_NTTP_REG_GEN(TestFunc,INTERNAL_CATCH_REMOVE_PARENS(Signature))\ + template<typename...Types> \ + struct TestName{\ + TestName(){\ + int index = 0; \ + constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\ + using expander = int[];\ + (void)expander{(reg_test(Types{}, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++)... };/* NOLINT */ \ + }\ + };\ + static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\ + TestName<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(__VA_ARGS__)>();\ + return 0;\ + }();\ + }\ + }\ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ + INTERNAL_CATCH_DEFINE_SIG_TEST(TestFunc,INTERNAL_CATCH_REMOVE_PARENS(Signature)) + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \ + INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename TestType, __VA_ARGS__ ) +#else + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename TestType, __VA_ARGS__ ) ) +#endif + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG(Name, Tags, Signature, ...) \ + INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ ) +#else + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG(Name, Tags, Signature, ...) \ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ ) ) +#endif + + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(TestName, TestFuncName, Name, Tags, Signature, TmplTypes, TypesList) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + template<typename TestType> static void TestFuncName(); \ + namespace {\ + namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) { \ + INTERNAL_CATCH_TYPE_GEN \ + INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature)) \ + template<typename... Types> \ + struct TestName { \ + void reg_tests() { \ + int index = 0; \ + using expander = int[]; \ + constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};\ + constexpr char const* types_list[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};\ + constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);\ + (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFuncName<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + "<" + std::string(types_list[index % num_types]) + ">", Tags } ), index++)... };/* NOLINT */\ + } \ + }; \ + static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \ + using TestInit = typename create<TestName, decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS(TmplTypes)>()), TypeList<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(INTERNAL_CATCH_REMOVE_PARENS(TypesList))>>::type; \ + TestInit t; \ + t.reg_tests(); \ + return 0; \ + }(); \ + } \ + } \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ + template<typename TestType> \ + static void TestFuncName() + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE(Name, Tags, ...)\ + INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename T,__VA_ARGS__) +#else + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE(Name, Tags, ...)\ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, typename T, __VA_ARGS__ ) ) +#endif + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG(Name, Tags, Signature, ...)\ + INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__) +#else + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG(Name, Tags, Signature, ...)\ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, Signature, __VA_ARGS__ ) ) +#endif + + #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2(TestName, TestFunc, Name, Tags, TmplList)\ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + template<typename TestType> static void TestFunc(); \ + namespace {\ + namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){\ + INTERNAL_CATCH_TYPE_GEN\ + template<typename... Types> \ + struct TestName { \ + void reg_tests() { \ + int index = 0; \ + using expander = int[]; \ + (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFunc<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + " - " + std::to_string(index), Tags } ), index++)... };/* NOLINT */\ + } \ + };\ + static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \ + using TestInit = typename convert<TestName, TmplList>::type; \ + TestInit t; \ + t.reg_tests(); \ + return 0; \ + }(); \ + }}\ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ + template<typename TestType> \ + static void TestFunc() + + #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE(Name, Tags, TmplList) \ + INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, TmplList ) + + + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, Signature, ... ) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + namespace {\ + namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){ \ + INTERNAL_CATCH_TYPE_GEN\ + INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))\ + INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, INTERNAL_CATCH_REMOVE_PARENS(Signature));\ + INTERNAL_CATCH_NTTP_REG_METHOD_GEN(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature))\ + template<typename...Types> \ + struct TestNameClass{\ + TestNameClass(){\ + int index = 0; \ + constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\ + using expander = int[];\ + (void)expander{(reg_test(Types{}, #ClassName, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index]), Tags } ), index++)... };/* NOLINT */ \ + }\ + };\ + static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\ + TestNameClass<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(__VA_ARGS__)>();\ + return 0;\ + }();\ + }\ + }\ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ + INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature)) + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \ + INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) +#else + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) ) +#endif + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... ) \ + INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) +#else + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... ) \ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) ) +#endif + + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2(TestNameClass, TestName, ClassName, Name, Tags, Signature, TmplTypes, TypesList)\ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + template<typename TestType> \ + struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName <TestType>) { \ + void test();\ + };\ + namespace {\ + namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestNameClass) {\ + INTERNAL_CATCH_TYPE_GEN \ + INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))\ + template<typename...Types>\ + struct TestNameClass{\ + void reg_tests(){\ + int index = 0;\ + using expander = int[];\ + constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};\ + constexpr char const* types_list[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};\ + constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);\ + (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + "<" + std::string(types_list[index % num_types]) + ">", Tags } ), index++)... };/* NOLINT */ \ + }\ + };\ + static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\ + using TestInit = typename create<TestNameClass, decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS(TmplTypes)>()), TypeList<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(INTERNAL_CATCH_REMOVE_PARENS(TypesList))>>::type;\ + TestInit t;\ + t.reg_tests();\ + return 0;\ + }(); \ + }\ + }\ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ + template<typename TestType> \ + void TestName<TestType>::test() + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( ClassName, Name, Tags, ... )\ + INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, typename T, __VA_ARGS__ ) +#else + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( ClassName, Name, Tags, ... )\ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, typename T,__VA_ARGS__ ) ) +#endif + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... )\ + INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, Signature, __VA_ARGS__ ) +#else + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... )\ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, Signature,__VA_ARGS__ ) ) +#endif + + #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, TmplList) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \ + template<typename TestType> \ + struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName <TestType>) { \ + void test();\ + };\ + namespace {\ + namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){ \ + INTERNAL_CATCH_TYPE_GEN\ + template<typename...Types>\ + struct TestNameClass{\ + void reg_tests(){\ + int index = 0;\ + using expander = int[];\ + (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name " - " + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + " - " + std::to_string(index), Tags } ), index++)... };/* NOLINT */ \ + }\ + };\ + static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\ + using TestInit = typename convert<TestNameClass, TmplList>::type;\ + TestInit t;\ + t.reg_tests();\ + return 0;\ + }(); \ + }}\ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ + template<typename TestType> \ + void TestName<TestType>::test() + +#define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD(ClassName, Name, Tags, TmplList) \ + INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), ClassName, Name, Tags, TmplList ) + + +#endif // CATCH_TEMPLATE_TEST_REGISTRY_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_test_case_registry_impl.cpp b/packages/Catch2/src/catch2/internal/catch_test_case_registry_impl.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7f7f101d18ad7079d1bc73b54c039eda33f20cdb --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_test_case_registry_impl.cpp @@ -0,0 +1,162 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/internal/catch_test_case_registry_impl.hpp> + +#include <catch2/internal/catch_context.hpp> +#include <catch2/internal/catch_enforce.hpp> +#include <catch2/interfaces/catch_interfaces_registry_hub.hpp> +#include <catch2/internal/catch_random_number_generator.hpp> +#include <catch2/internal/catch_run_context.hpp> +#include <catch2/internal/catch_string_manip.hpp> +#include <catch2/catch_test_case_info.hpp> +#include <catch2/catch_test_spec.hpp> + +#include <algorithm> +#include <set> + +namespace Catch { + +namespace { + struct HashTest { + explicit HashTest(SimplePcg32& rng_inst) { + basis = rng_inst(); + basis <<= 32; + basis |= rng_inst(); + } + + uint64_t basis; + + uint64_t operator()(TestCaseInfo const& t) const { + // Modified FNV-1a hash + static constexpr uint64_t prime = 1099511628211; + uint64_t hash = basis; + for (const char c : t.name) { + hash ^= c; + hash *= prime; + } + return hash; + } + }; +} // end anonymous namespace + + std::vector<TestCaseHandle> sortTests( IConfig const& config, std::vector<TestCaseHandle> const& unsortedTestCases ) { + switch (config.runOrder()) { + case TestRunOrder::Declared: + return unsortedTestCases; + + case TestRunOrder::LexicographicallySorted: { + std::vector<TestCaseHandle> sorted = unsortedTestCases; + std::sort(sorted.begin(), sorted.end()); + return sorted; + } + case TestRunOrder::Randomized: { + seedRng(config); + HashTest h(rng()); + std::vector<std::pair<uint64_t, TestCaseHandle>> indexed_tests; + indexed_tests.reserve(unsortedTestCases.size()); + + for (auto const& handle : unsortedTestCases) { + indexed_tests.emplace_back(h(handle.getTestCaseInfo()), handle); + } + + std::sort(indexed_tests.begin(), indexed_tests.end()); + + std::vector<TestCaseHandle> randomized; + randomized.reserve(indexed_tests.size()); + + for (auto const& indexed : indexed_tests) { + randomized.push_back(indexed.second); + } + + return randomized; + } + } + + CATCH_INTERNAL_ERROR("Unknown test order value!"); + } + + bool isThrowSafe( TestCaseHandle const& testCase, IConfig const& config ) { + return !testCase.getTestCaseInfo().throws() || config.allowThrows(); + } + + bool matchTest( TestCaseHandle const& testCase, TestSpec const& testSpec, IConfig const& config ) { + return testSpec.matches( testCase.getTestCaseInfo() ) && isThrowSafe( testCase, config ); + } + + void enforceNoDuplicateTestCases( std::vector<TestCaseHandle> const& functions ) { + std::set<TestCaseHandle> seenFunctions; + for( auto const& function : functions ) { + auto prev = seenFunctions.insert( function ); + CATCH_ENFORCE( prev.second, + "error: TEST_CASE( \"" << function.getTestCaseInfo().name << "\" ) already defined.\n" + << "\tFirst seen at " << prev.first->getTestCaseInfo().lineInfo << "\n" + << "\tRedefined at " << function.getTestCaseInfo().lineInfo ); + } + } + + std::vector<TestCaseHandle> filterTests( std::vector<TestCaseHandle> const& testCases, TestSpec const& testSpec, IConfig const& config ) { + std::vector<TestCaseHandle> filtered; + filtered.reserve( testCases.size() ); + for (auto const& testCase : testCases) { + if ((!testSpec.hasFilters() && !testCase.getTestCaseInfo().isHidden()) || + (testSpec.hasFilters() && matchTest(testCase, testSpec, config))) { + filtered.push_back(testCase); + } + } + return filtered; + } + std::vector<TestCaseHandle> const& getAllTestCasesSorted( IConfig const& config ) { + return getRegistryHub().getTestCaseRegistry().getAllTestsSorted( config ); + } + + void TestRegistry::registerTest(Detail::unique_ptr<TestCaseInfo> testInfo, Detail::unique_ptr<ITestInvoker> testInvoker) { + m_handles.emplace_back(testInfo.get(), testInvoker.get()); + m_viewed_test_infos.push_back(testInfo.get()); + m_owned_test_infos.push_back(std::move(testInfo)); + m_invokers.push_back(std::move(testInvoker)); + } + + std::vector<TestCaseInfo*> const& TestRegistry::getAllInfos() const { + return m_viewed_test_infos; + } + + std::vector<TestCaseHandle> const& TestRegistry::getAllTests() const { + return m_handles; + } + std::vector<TestCaseHandle> const& TestRegistry::getAllTestsSorted( IConfig const& config ) const { + if( m_sortedFunctions.empty() ) + enforceNoDuplicateTestCases( m_handles ); + + if( m_currentSortOrder != config.runOrder() || m_sortedFunctions.empty() ) { + m_sortedFunctions = sortTests( config, m_handles ); + m_currentSortOrder = config.runOrder(); + } + return m_sortedFunctions; + } + + + + /////////////////////////////////////////////////////////////////////////// + void TestInvokerAsFunction::invoke() const { + m_testAsFunction(); + } + + std::string extractClassName( StringRef 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/packages/Catch2/src/catch2/internal/catch_test_case_registry_impl.hpp b/packages/Catch2/src/catch2/internal/catch_test_case_registry_impl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f7fc37ef3a32a252d35e2fd03655a5fdfc24a6da --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_test_case_registry_impl.hpp @@ -0,0 +1,75 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_TEST_CASE_REGISTRY_IMPL_HPP_INCLUDED +#define CATCH_TEST_CASE_REGISTRY_IMPL_HPP_INCLUDED + +#include <catch2/internal/catch_test_registry.hpp> +#include <catch2/interfaces/catch_interfaces_config.hpp> + +#include <vector> + +namespace Catch { + + class TestCaseHandle; + struct IConfig; + class TestSpec; + + std::vector<TestCaseHandle> sortTests( IConfig const& config, std::vector<TestCaseHandle> const& unsortedTestCases ); + + bool isThrowSafe( TestCaseHandle const& testCase, IConfig const& config ); + bool matchTest( TestCaseHandle const& testCase, TestSpec const& testSpec, IConfig const& config ); + + void enforceNoDuplicateTestCases( std::vector<TestCaseHandle> const& functions ); + + std::vector<TestCaseHandle> filterTests( std::vector<TestCaseHandle> const& testCases, TestSpec const& testSpec, IConfig const& config ); + std::vector<TestCaseHandle> const& getAllTestCasesSorted( IConfig const& config ); + + class TestRegistry : public ITestCaseRegistry { + public: + ~TestRegistry() override = default; + + void registerTest( Detail::unique_ptr<TestCaseInfo> testInfo, Detail::unique_ptr<ITestInvoker> testInvoker ); + + std::vector<TestCaseInfo*> const& getAllInfos() const override; + std::vector<TestCaseHandle> const& getAllTests() const override; + std::vector<TestCaseHandle> const& getAllTestsSorted( IConfig const& config ) const override; + + private: + std::vector<Detail::unique_ptr<TestCaseInfo>> m_owned_test_infos; + // Keeps a materialized vector for `getAllInfos`. + // We should get rid of that eventually (see interface note) + std::vector<TestCaseInfo*> m_viewed_test_infos; + + std::vector<Detail::unique_ptr<ITestInvoker>> m_invokers; + std::vector<TestCaseHandle> m_handles; + mutable TestRunOrder m_currentSortOrder = TestRunOrder::Declared; + mutable std::vector<TestCaseHandle> m_sortedFunctions; + }; + + /////////////////////////////////////////////////////////////////////////// + + class TestInvokerAsFunction final : public ITestInvoker { + using TestType = void(*)(); + TestType m_testAsFunction; + public: + TestInvokerAsFunction(TestType testAsFunction) noexcept: + m_testAsFunction(testAsFunction) {} + + void invoke() const override; + }; + + + std::string extractClassName( StringRef const& classOrQualifiedMethodName ); + + /////////////////////////////////////////////////////////////////////////// + + +} // end namespace Catch + + +#endif // CATCH_TEST_CASE_REGISTRY_IMPL_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_test_case_tracker.cpp b/packages/Catch2/src/catch2/internal/catch_test_case_tracker.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2e8c3169f61055c384b9e7d2ce71bc840931be4c --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_test_case_tracker.cpp @@ -0,0 +1,255 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/internal/catch_test_case_tracker.hpp> + +#include <catch2/internal/catch_enforce.hpp> +#include <catch2/internal/catch_string_manip.hpp> + +#include <algorithm> +#include <cassert> + +#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; + + void ITracker::addChild( ITrackerPtr&& child ) { + m_children.push_back( std::move(child) ); + } + + ITracker* ITracker::findChild( NameAndLocation const& nameAndLocation ) { + auto it = std::find_if( + m_children.begin(), + m_children.end(), + [&nameAndLocation]( ITrackerPtr const& tracker ) { + return tracker->nameAndLocation().location == + nameAndLocation.location && + tracker->nameAndLocation().name == nameAndLocation.name; + } ); + return ( it != m_children.end() ) ? it->get() : nullptr; + } + + + + ITracker& TrackerContext::startRun() { + using namespace std::string_literals; + m_rootTracker = Catch::Detail::make_unique<SectionTracker>( + NameAndLocation( "{root}"s, 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::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ): + ITracker(nameAndLocation), + m_ctx( ctx ), + m_parent( parent ) + {} + + 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(); + } + + 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::isGeneratorTracker() 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( std::all_of(m_children.begin(), m_children.end(), [](ITrackerPtr const& t){ return t->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 ), + m_trimmed_name(trim(nameAndLocation.name)) + { + if( parent ) { + while( !parent->isSectionTracker() ) + parent = &parent->parent(); + + SectionTracker& parentSection = static_cast<SectionTracker&>( *parent ); + addNextFilters( parentSection.m_filters ); + } + } + + bool SectionTracker::isComplete() const { + bool complete = true; + + if (m_filters.empty() + || m_filters[0] == "" + || std::find(m_filters.begin(), m_filters.end(), m_trimmed_name) != m_filters.end()) { + complete = TrackerBase::isComplete(); + } + return complete; + } + + bool SectionTracker::isSectionTracker() const { return true; } + + SectionTracker& SectionTracker::acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation ) { + SectionTracker* section; + + ITracker& currentTracker = ctx.currentTracker(); + if ( ITracker* childTracker = + currentTracker.findChild( nameAndLocation ) ) { + assert( childTracker ); + assert( childTracker->isSectionTracker() ); + section = static_cast<SectionTracker*>( childTracker ); + } else { + auto newSection = Catch::Detail::make_unique<SectionTracker>( + nameAndLocation, ctx, ¤tTracker ); + section = newSection.get(); + currentTracker.addChild( std::move( newSection ) ); + } + if( !ctx.completedCycle() ) + section->tryOpen(); + return *section; + } + + void SectionTracker::tryOpen() { + if( !isComplete() ) + open(); + } + + void SectionTracker::addInitialFilters( std::vector<std::string> const& filters ) { + if( !filters.empty() ) { + m_filters.reserve( m_filters.size() + filters.size() + 2 ); + m_filters.emplace_back(""); // Root - should never be consulted + m_filters.emplace_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()+1, filters.end() ); + } + + std::vector<std::string> const& SectionTracker::getFilters() const { + return m_filters; + } + + std::string const& SectionTracker::trimmedName() const { + return m_trimmed_name; + } + +} // namespace TestCaseTracking + +using TestCaseTracking::ITracker; +using TestCaseTracking::TrackerContext; +using TestCaseTracking::SectionTracker; + +} // namespace Catch + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif diff --git a/packages/Catch2/src/catch2/internal/catch_test_case_tracker.hpp b/packages/Catch2/src/catch2/internal/catch_test_case_tracker.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c3ed1ae0950bb88402d7b44c36e97d03b0625625 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_test_case_tracker.hpp @@ -0,0 +1,189 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_TEST_CASE_TRACKER_HPP_INCLUDED +#define CATCH_TEST_CASE_TRACKER_HPP_INCLUDED + +#include <catch2/internal/catch_source_line_info.hpp> +#include <catch2/internal/catch_unique_ptr.hpp> + +#include <string> +#include <vector> + +namespace Catch { +namespace TestCaseTracking { + + struct NameAndLocation { + std::string name; + SourceLineInfo location; + + NameAndLocation( std::string const& _name, SourceLineInfo const& _location ); + friend bool operator==(NameAndLocation const& lhs, NameAndLocation const& rhs) { + return lhs.name == rhs.name + && lhs.location == rhs.location; + } + }; + + class ITracker; + + using ITrackerPtr = Catch::Detail::unique_ptr<ITracker>; + + class ITracker { + NameAndLocation m_nameAndLocation; + + using Children = std::vector<ITrackerPtr>; + + protected: + Children m_children; + + public: + ITracker(NameAndLocation const& nameAndLoc) : + m_nameAndLocation(nameAndLoc) + {} + + + // static queries + NameAndLocation const& nameAndLocation() const { + return m_nameAndLocation; + } + + virtual ~ITracker(); + + + // dynamic queries + virtual bool isComplete() const = 0; // Successfully completed or failed + virtual bool isSuccessfullyCompleted() const = 0; + virtual bool isOpen() const = 0; // Started but not complete + virtual bool hasStarted() const = 0; + + virtual ITracker& parent() = 0; + + // actions + virtual void close() = 0; // Successfully complete + virtual void fail() = 0; + virtual void markAsNeedingAnotherRun() = 0; + + //! Register a nested ITracker + void addChild( ITrackerPtr&& child ); + /** + * Returns ptr to specific child if register with this tracker. + * + * Returns nullptr if not found. + */ + ITracker* findChild( NameAndLocation const& nameAndLocation ); + //! Have any children been added? + bool hasChildren() const { + return !m_children.empty(); + } + + + virtual void openChild() = 0; + + // Debug/ checking + virtual bool isSectionTracker() const = 0; + virtual bool isGeneratorTracker() const = 0; + }; + + class TrackerContext { + + enum RunState { + NotStarted, + Executing, + CompletedCycle + }; + + ITrackerPtr m_rootTracker; + ITracker* m_currentTracker = nullptr; + RunState m_runState = NotStarted; + + public: + + 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 + }; + + TrackerContext& m_ctx; + ITracker* m_parent; + CycleState m_runState = NotStarted; + + public: + TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ); + + bool isComplete() const override; + bool isSuccessfullyCompleted() const override; + bool isOpen() const override; + bool hasStarted() const override { + return m_runState != NotStarted; + } + + ITracker& parent() override; + + void openChild() override; + + bool isSectionTracker() const override; + bool isGeneratorTracker() 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; + std::string m_trimmed_name; + public: + SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ); + + bool isSectionTracker() const override; + + bool isComplete() 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 ); + //! Returns filters active in this tracker + std::vector<std::string> const& getFilters() const; + //! Returns whitespace-trimmed name of the tracked section + std::string const& trimmedName() const; + }; + +} // namespace TestCaseTracking + +using TestCaseTracking::ITracker; +using TestCaseTracking::TrackerContext; +using TestCaseTracking::SectionTracker; + +} // namespace Catch + +#endif // CATCH_TEST_CASE_TRACKER_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_test_failure_exception.hpp b/packages/Catch2/src/catch2/internal/catch_test_failure_exception.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bb6803bae3c764167fa73c5ceda017266a7f91c7 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_test_failure_exception.hpp @@ -0,0 +1,18 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_TEST_FAILURE_EXCEPTION_HPP_INCLUDED +#define CATCH_TEST_FAILURE_EXCEPTION_HPP_INCLUDED + +namespace Catch { + + //! Used to signal that an assertion macro failed + struct TestFailureException{}; + +} // namespace Catch + +#endif // CATCH_TEST_FAILURE_EXCEPTION_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_test_macro_impl.hpp b/packages/Catch2/src/catch2/internal/catch_test_macro_impl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9ceb03ab096985c960ca170673cf3a82f01e8d23 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_test_macro_impl.hpp @@ -0,0 +1,144 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_TEST_MACRO_IMPL_HPP_INCLUDED +#define CATCH_TEST_MACRO_IMPL_HPP_INCLUDED + +#include <catch2/internal/catch_assertion_handler.hpp> +#include <catch2/interfaces/catch_interfaces_capture.hpp> +#include <catch2/internal/catch_stringref.hpp> + +// We need this suppression to leak, because it took until GCC 9 +// for the front end to handle local suppression via _Pragma properly +#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && __GNUC__ < 9 + #pragma GCC diagnostic ignored "-Wparentheses" +#endif + +#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) || defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + +/////////////////////////////////////////////////////////////////////////////// +// 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 { \ + /* The expression should not be evaluated, but warnings should hopefully be checked */ \ + CATCH_INTERNAL_IGNORE_BUT_WARN(__VA_ARGS__); \ + Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \ + INTERNAL_CATCH_TRY { \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ + catchAssertionHandler.handleExpr( Catch::Decomposer() <= __VA_ARGS__ ); \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ + } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( (void)0, (false) && static_cast<const bool&>( !!(__VA_ARGS__) ) ) + +/////////////////////////////////////////////////////////////////////////////// +#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_sr, 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_sr, 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_sr, 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 ) + + + +/////////////////////////////////////////////////////////////////////////////// +// 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_sr, 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##_catch_sr ); \ + } \ + else \ + catchAssertionHandler.handleThrowingCallSkipped(); \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( false ) + +#endif // CATCH_CONFIG_DISABLE + +#endif // CATCH_TEST_MACRO_IMPL_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_test_registry.cpp b/packages/Catch2/src/catch2/internal/catch_test_registry.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c4f26181b0497d0be4a57f5cc36ead093ccd11bc --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_test_registry.cpp @@ -0,0 +1,35 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/internal/catch_test_registry.hpp> +#include <catch2/internal/catch_compiler_capabilities.hpp> +#include <catch2/catch_test_case_info.hpp> +#include <catch2/internal/catch_test_case_registry_impl.hpp> +#include <catch2/interfaces/catch_interfaces_registry_hub.hpp> + +namespace Catch { + + Detail::unique_ptr<ITestInvoker> makeTestInvoker( void(*testAsFunction)() ) { + return Detail::unique_ptr<ITestInvoker>( new TestInvokerAsFunction( testAsFunction )); + } + + AutoReg::AutoReg( Detail::unique_ptr<ITestInvoker> invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept { + CATCH_TRY { + getMutableRegistryHub() + .registerTest( + makeTestCaseInfo( + extractClassName( classOrMethod ), + nameAndTags, + lineInfo), + std::move(invoker) + ); + } CATCH_CATCH_ALL { + // Do not throw when constructing global objects, instead register the exception to be processed later + getMutableRegistryHub().registerStartupException(); + } + } +} diff --git a/packages/Catch2/src/catch2/internal/catch_test_registry.hpp b/packages/Catch2/src/catch2/internal/catch_test_registry.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0f5ec48837bc407d4110a868e36e9f02badda5be --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_test_registry.hpp @@ -0,0 +1,116 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_TEST_REGISTRY_HPP_INCLUDED +#define CATCH_TEST_REGISTRY_HPP_INCLUDED + +#include <catch2/internal/catch_source_line_info.hpp> +#include <catch2/internal/catch_noncopyable.hpp> +#include <catch2/interfaces/catch_interfaces_testcase.hpp> +#include <catch2/internal/catch_stringref.hpp> +#include <catch2/internal/catch_unique_ptr.hpp> + +// GCC 5 and older do not properly handle disabling unused-variable warning +// with a _Pragma. This means that we have to leak the suppression to the +// user code as well :-( +#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ <= 5 +#pragma GCC diagnostic ignored "-Wunused-variable" +#endif + + + +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)(); + } +}; + +Detail::unique_ptr<ITestInvoker> makeTestInvoker( void(*testAsFunction)() ); + +template<typename C> +Detail::unique_ptr<ITestInvoker> makeTestInvoker( void (C::*testAsMethod)() ) { + return Detail::unique_ptr<ITestInvoker>( new TestInvokerAsMethod<C>(testAsMethod) ); +} + +struct NameAndTags { + NameAndTags(StringRef const& name_ = StringRef(), + StringRef const& tags_ = StringRef()) noexcept: + name(name_), tags(tags_) {} + StringRef name; + StringRef tags; +}; + +struct AutoReg : Detail::NonCopyable { + AutoReg( Detail::unique_ptr<ITestInvoker> invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept; +}; + +} // end namespace Catch + +#if defined(CATCH_CONFIG_DISABLE) + #define INTERNAL_CATCH_TESTCASE_NO_REGISTRATION( TestName, ... ) \ + static inline void TestName() + #define INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION( TestName, ClassName, ... ) \ + namespace{ \ + struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) { \ + void test(); \ + }; \ + } \ + void TestName::test() +#endif + + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \ + static void TestName(); \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &TestName ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ + static void TestName() + #define INTERNAL_CATCH_TESTCASE( ... ) \ + INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), __VA_ARGS__ ) + + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + 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_STOP_WARNINGS_SUPPRESSION + + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ \ + struct TestName : INTERNAL_CATCH_REMOVE_PARENS(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_STOP_WARNINGS_SUPPRESSION \ + void TestName::test() + #define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... ) \ + INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, __VA_ARGS__ ) + + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \ + do { \ + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( Function ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \ + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ + } while(false) + + +#endif // CATCH_TEST_REGISTRY_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_test_spec_parser.cpp b/packages/Catch2/src/catch2/internal/catch_test_spec_parser.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e9d77e74fc98a9a1aba0ee3d0599a3d4613ce8c9 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_test_spec_parser.cpp @@ -0,0 +1,244 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/internal/catch_test_spec_parser.hpp> + +#include <catch2/internal/catch_string_manip.hpp> +#include <catch2/interfaces/catch_interfaces_tag_alias_registry.hpp> + + +namespace Catch { + + TestSpecParser::TestSpecParser( ITagAliasRegistry const& tagAliases ) : m_tagAliases( &tagAliases ) {} + + TestSpecParser& TestSpecParser::parse( std::string const& arg ) { + m_mode = None; + m_exclusion = false; + m_arg = m_tagAliases->expandAliases( arg ); + m_escapeChars.clear(); + m_substring.reserve(m_arg.size()); + m_patternName.reserve(m_arg.size()); + m_realPatternPos = 0; + + for( m_pos = 0; m_pos < m_arg.size(); ++m_pos ) + //if visitChar fails + if( !visitChar( m_arg[m_pos] ) ){ + m_testSpec.m_invalidArgs.push_back(arg); + break; + } + endMode(); + return *this; + } + TestSpec TestSpecParser::testSpec() { + addFilter(); + return std::move(m_testSpec); + } + bool TestSpecParser::visitChar( char c ) { + if( (m_mode != EscapedName) && (c == '\\') ) { + escape(); + addCharToPattern(c); + return true; + }else if((m_mode != EscapedName) && (c == ',') ) { + return separate(); + } + + switch( m_mode ) { + case None: + if( processNoneChar( c ) ) + return true; + break; + case Name: + processNameChar( c ); + break; + case EscapedName: + endMode(); + addCharToPattern(c); + return true; + default: + case Tag: + case QuotedName: + if( processOtherChar( c ) ) + return true; + break; + } + + m_substring += c; + if( !isControlChar( c ) ) { + m_patternName += c; + m_realPatternPos++; + } + return true; + } + // Two of the processing methods return true to signal the caller to return + // without adding the given character to the current pattern strings + bool TestSpecParser::processNoneChar( char c ) { + switch( c ) { + case ' ': + return true; + case '~': + m_exclusion = true; + return false; + case '[': + startNewMode( Tag ); + return false; + case '"': + startNewMode( QuotedName ); + return false; + default: + startNewMode( Name ); + return false; + } + } + void TestSpecParser::processNameChar( char c ) { + if( c == '[' ) { + if( m_substring == "exclude:" ) + m_exclusion = true; + else + endMode(); + startNewMode( Tag ); + } + } + bool TestSpecParser::processOtherChar( char c ) { + if( !isControlChar( c ) ) + return false; + m_substring += c; + endMode(); + return true; + } + void TestSpecParser::startNewMode( Mode mode ) { + m_mode = mode; + } + void TestSpecParser::endMode() { + switch( m_mode ) { + case Name: + case QuotedName: + return addNamePattern(); + case Tag: + return addTagPattern(); + case EscapedName: + revertBackToLastMode(); + return; + case None: + default: + return startNewMode( None ); + } + } + void TestSpecParser::escape() { + saveLastMode(); + m_mode = EscapedName; + m_escapeChars.push_back(m_realPatternPos); + } + bool TestSpecParser::isControlChar( char c ) const { + switch( m_mode ) { + default: + return false; + case None: + return c == '~'; + case Name: + return c == '['; + case EscapedName: + return true; + case QuotedName: + return c == '"'; + case Tag: + return c == '[' || c == ']'; + } + } + + void TestSpecParser::addFilter() { + if( !m_currentFilter.m_required.empty() || !m_currentFilter.m_forbidden.empty() ) { + m_testSpec.m_filters.push_back( std::move(m_currentFilter) ); + m_currentFilter = TestSpec::Filter(); + } + } + + void TestSpecParser::saveLastMode() { + lastMode = m_mode; + } + + void TestSpecParser::revertBackToLastMode() { + m_mode = lastMode; + } + + bool TestSpecParser::separate() { + if( (m_mode==QuotedName) || (m_mode==Tag) ){ + //invalid argument, signal failure to previous scope. + m_mode = None; + m_pos = m_arg.size(); + m_substring.clear(); + m_patternName.clear(); + m_realPatternPos = 0; + return false; + } + endMode(); + addFilter(); + return true; //success + } + + std::string TestSpecParser::preprocessPattern() { + std::string token = m_patternName; + for (std::size_t i = 0; i < m_escapeChars.size(); ++i) + token = token.substr(0, m_escapeChars[i] - i) + token.substr(m_escapeChars[i] - i + 1); + m_escapeChars.clear(); + if (startsWith(token, "exclude:")) { + m_exclusion = true; + token = token.substr(8); + } + + m_patternName.clear(); + m_realPatternPos = 0; + + return token; + } + + void TestSpecParser::addNamePattern() { + auto token = preprocessPattern(); + + if (!token.empty()) { + if (m_exclusion) { + m_currentFilter.m_forbidden.emplace_back(Detail::make_unique<TestSpec::NamePattern>(token, m_substring)); + } else { + m_currentFilter.m_required.emplace_back(Detail::make_unique<TestSpec::NamePattern>(token, m_substring)); + } + } + m_substring.clear(); + m_exclusion = false; + m_mode = None; + } + + void TestSpecParser::addTagPattern() { + auto token = preprocessPattern(); + + if (!token.empty()) { + // If the tag pattern is the "hide and tag" shorthand (e.g. [.foo]) + // we have to create a separate hide tag and shorten the real one + if (token.size() > 1 && token[0] == '.') { + token.erase(token.begin()); + if (m_exclusion) { + m_currentFilter.m_forbidden.emplace_back(Detail::make_unique<TestSpec::TagPattern>(".", m_substring)); + m_currentFilter.m_forbidden.emplace_back(Detail::make_unique<TestSpec::TagPattern>(token, m_substring)); + } else { + m_currentFilter.m_required.emplace_back(Detail::make_unique<TestSpec::TagPattern>(".", m_substring)); + m_currentFilter.m_required.emplace_back(Detail::make_unique<TestSpec::TagPattern>(token, m_substring)); + } + } + if (m_exclusion) { + m_currentFilter.m_forbidden.emplace_back(Detail::make_unique<TestSpec::TagPattern>(token, m_substring)); + } else { + m_currentFilter.m_required.emplace_back(Detail::make_unique<TestSpec::TagPattern>(token, m_substring)); + } + } + m_substring.clear(); + m_exclusion = false; + m_mode = None; + } + + TestSpec parseTestSpec( std::string const& arg ) { + return TestSpecParser( ITagAliasRegistry::get() ).parse( arg ).testSpec(); + } + +} // namespace Catch diff --git a/packages/Catch2/src/catch2/internal/catch_test_spec_parser.hpp b/packages/Catch2/src/catch2/internal/catch_test_spec_parser.hpp new file mode 100644 index 0000000000000000000000000000000000000000..22b288ebb3f3e7f2bd61c348ad858d6d110b07d6 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_test_spec_parser.hpp @@ -0,0 +1,82 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_TEST_SPEC_PARSER_HPP_INCLUDED +#define CATCH_TEST_SPEC_PARSER_HPP_INCLUDED + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif + +#include <catch2/catch_test_spec.hpp> + +#include <vector> +#include <string> + +namespace Catch { + + struct ITagAliasRegistry; + + class TestSpecParser { + enum Mode{ None, Name, QuotedName, Tag, EscapedName }; + Mode m_mode = None; + Mode lastMode = None; + bool m_exclusion = false; + std::size_t m_pos = 0; + std::size_t m_realPatternPos = 0; + std::string m_arg; + std::string m_substring; + std::string m_patternName; + 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: + bool visitChar( char c ); + void startNewMode( Mode mode ); + bool processNoneChar( char c ); + void processNameChar( char c ); + bool processOtherChar( char c ); + void endMode(); + void escape(); + bool isControlChar( char c ) const; + void saveLastMode(); + void revertBackToLastMode(); + void addFilter(); + bool separate(); + + // Handles common preprocessing of the pattern for name/tag patterns + std::string preprocessPattern(); + // Adds the current pattern as a test name + void addNamePattern(); + // Adds the current pattern as a tag + void addTagPattern(); + + inline void addCharToPattern(char c) { + m_substring += c; + m_patternName += c; + m_realPatternPos++; + } + + }; + TestSpec parseTestSpec( std::string const& arg ); + +} // namespace Catch + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +#endif // CATCH_TEST_SPEC_PARSER_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_textflow.cpp b/packages/Catch2/src/catch2/internal/catch_textflow.cpp new file mode 100644 index 0000000000000000000000000000000000000000..01fd2df59cd4b43f35e96474f5e33ee64da14b42 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_textflow.cpp @@ -0,0 +1,242 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/internal/catch_textflow.hpp> +#include <cstring> +#include <ostream> + +namespace { + bool isWhitespace( char c ) { + return c == ' ' || c == '\t' || c == '\n' || c == '\r'; + } + + bool isBreakableBefore( char c ) { + static const char chars[] = "[({<|"; + return std::memchr( chars, c, sizeof( chars ) - 1 ) != nullptr; + } + + bool isBreakableAfter( char c ) { + static const char chars[] = "])}>.,:;*+-=&/\\"; + return std::memchr( chars, c, sizeof( chars ) - 1 ) != nullptr; + } + + bool isBoundary( std::string const& line, size_t at ) { + 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] ); + } + +} // namespace + +namespace Catch { + namespace TextFlow { + + void Column::iterator::calcLength() { + m_suffix = false; + auto width = m_column.m_width - indent(); + m_end = m_pos; + std::string const& current_line = m_column.m_string; + if ( current_line[m_pos] == '\n' ) { + ++m_end; + } + while ( m_end < current_line.size() && + current_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( current_line, m_pos + len ) ) { + --len; + } + while ( len > 0 && + isWhitespace( current_line[m_pos + len - 1] ) ) { + --len; + } + + if ( len > 0 ) { + m_len = len; + } else { + m_suffix = true; + m_len = width - 1; + } + } + } + + size_t Column::iterator::indent() const { + auto initial = + m_pos == 0 ? m_column.m_initialIndent : std::string::npos; + return initial == std::string::npos ? m_column.m_indent : initial; + } + + std::string + Column::iterator::addIndentAndSuffix( size_t position, + size_t length ) const { + std::string ret; + const auto desired_indent = indent(); + ret.reserve( desired_indent + length + m_suffix ); + ret.append( desired_indent, ' ' ); + ret.append( m_column.m_string, position, length ); + if ( m_suffix ) { + ret.push_back( '-' ); + } + + return ret; + } + + Column::iterator::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_pos = m_column.m_string.size(); + } + } + + std::string Column::iterator::operator*() const { + assert( m_pos <= m_end ); + return addIndentAndSuffix( m_pos, m_len ); + } + + Column::iterator& Column::iterator::operator++() { + m_pos += m_len; + std::string const& current_line = m_column.m_string; + if ( m_pos < current_line.size() && current_line[m_pos] == '\n' ) { + m_pos += 1; + } else { + while ( m_pos < current_line.size() && + isWhitespace( current_line[m_pos] ) ) { + ++m_pos; + } + } + + if ( m_pos != current_line.size() ) { + calcLength(); + } + return *this; + } + + Column::iterator Column::iterator::operator++( int ) { + iterator prev( *this ); + operator++(); + return prev; + } + + 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; + } + + Column Spacer( size_t spaceWidth ) { + Column ret{ "" }; + ret.width( spaceWidth ); + return ret; + } + + Columns::iterator::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() ); + } + } + + Columns::iterator::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() ); + } + } + + std::string Columns::iterator::operator*() const { + std::string row, padding; + + for ( size_t i = 0; i < m_columns.size(); ++i ) { + const auto width = m_columns[i].width(); + if ( m_iterators[i] != m_columns[i].end() ) { + std::string col = *m_iterators[i]; + row += padding; + row += col; + + padding.clear(); + if ( col.size() < width ) { + padding.append( width - col.size(), ' ' ); + } + } else { + padding.append( width, ' ' ); + } + } + return row; + } + + Columns::iterator& Columns::iterator::operator++() { + for ( size_t i = 0; i < m_columns.size(); ++i ) { + if ( m_iterators[i] != m_columns[i].end() ) { + ++m_iterators[i]; + } + } + return *this; + } + + Columns::iterator Columns::iterator::operator++( int ) { + iterator prev( *this ); + operator++(); + return prev; + } + + 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; + } + + Columns Column::operator+( Column const& other ) { + Columns cols; + cols += *this; + cols += other; + return cols; + } + + Columns& Columns::operator+=( Column const& col ) { + m_columns.push_back( col ); + return *this; + } + + Columns Columns::operator+( Column const& col ) { + Columns combined = *this; + combined += col; + return combined; + } + + } // namespace TextFlow +} // namespace Catch diff --git a/packages/Catch2/src/catch2/internal/catch_textflow.hpp b/packages/Catch2/src/catch2/internal/catch_textflow.hpp new file mode 100644 index 0000000000000000000000000000000000000000..074146c871f013d8ef5644787c639cdb0309b835 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_textflow.hpp @@ -0,0 +1,151 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_TEXTFLOW_HPP_INCLUDED +#define CATCH_TEXTFLOW_HPP_INCLUDED + +#include <cassert> +#include <catch2/internal/catch_console_width.hpp> +#include <string> +#include <vector> + +namespace Catch { + namespace TextFlow { + + class Columns; + + class Column { + std::string m_string; + size_t m_width = CATCH_CONFIG_CONSOLE_WIDTH - 1; + size_t m_indent = 0; + size_t m_initialIndent = std::string::npos; + + public: + class iterator { + friend Column; + struct EndTag {}; + + Column const& m_column; + size_t m_pos = 0; + + size_t m_len = 0; + size_t m_end = 0; + bool m_suffix = false; + + iterator( Column const& column, EndTag ): + m_column( column ), m_pos( m_column.m_string.size() ) {} + + void calcLength(); + + // Returns current indention width + size_t indent() const; + + // Creates an indented and (optionally) suffixed string from + // current iterator position, indentation and length. + std::string addIndentAndSuffix( size_t position, + size_t length ) const; + + public: + using difference_type = std::ptrdiff_t; + using value_type = std::string; + using pointer = value_type*; + using reference = value_type&; + using iterator_category = std::forward_iterator_tag; + + explicit iterator( Column const& column ); + + std::string operator*() const; + + iterator& operator++(); + iterator operator++( int ); + + bool operator==( iterator const& other ) const { + return m_pos == other.m_pos && &m_column == &other.m_column; + } + bool operator!=( iterator const& other ) const { + return !operator==( other ); + } + }; + using const_iterator = iterator; + + explicit Column( std::string const& text ): m_string( text ) {} + + Column& width( size_t newWidth ) { + assert( newWidth > 0 ); + m_width = newWidth; + return *this; + } + Column& indent( size_t newIndent ) { + m_indent = newIndent; + return *this; + } + Column& initialIndent( size_t newIndent ) { + m_initialIndent = newIndent; + return *this; + } + + size_t width() const { return m_width; } + iterator begin() const { return iterator( *this ); } + iterator end() const { return { *this, iterator::EndTag{} }; } + + friend std::ostream& operator<<( std::ostream& os, + Column const& col ); + + Columns operator+( Column const& other ); + }; + + //! Creates a column that serves as an empty space of specific width + Column Spacer( size_t 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 ); + + public: + using difference_type = std::ptrdiff_t; + using value_type = std::string; + using pointer = value_type*; + using reference = value_type&; + using iterator_category = std::forward_iterator_tag; + + explicit iterator( Columns const& columns ); + + 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; + } + std::string operator*() const; + iterator& operator++(); + iterator operator++( int ); + }; + using const_iterator = iterator; + + iterator begin() const { return iterator( *this ); } + iterator end() const { return { *this, iterator::EndTag() }; } + + Columns& operator+=( Column const& col ); + Columns operator+( Column const& col ); + + friend std::ostream& operator<<( std::ostream& os, + Columns const& cols ); + }; + + } // namespace TextFlow +} // namespace Catch +#endif // CATCH_TEXTFLOW_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_to_string.hpp b/packages/Catch2/src/catch2/internal/catch_to_string.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d8ff35cfc534c22f7f2076dc9eb50675072cf950 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_to_string.hpp @@ -0,0 +1,29 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_TO_STRING_HPP_INCLUDED +#define CATCH_TO_STRING_HPP_INCLUDED + +#include <string> + +#include <catch2/internal/catch_compiler_capabilities.hpp> +#include <catch2/internal/catch_stream.hpp> + +namespace Catch { + template <typename T> + std::string to_string(T const& t) { +#if defined(CATCH_CONFIG_CPP11_TO_STRING) + return std::to_string(t); +#else + ReusableStringStream rss; + rss << t; + return rss.str(); +#endif + } +} // end namespace Catch + +#endif // CATCH_TO_STRING_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_uncaught_exceptions.hpp b/packages/Catch2/src/catch2/internal/catch_uncaught_exceptions.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a287bacd87eb18527c6bd77431b9e59c8ad57f79 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_uncaught_exceptions.hpp @@ -0,0 +1,15 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED +#define CATCH_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED + +namespace Catch { + bool uncaught_exceptions(); +} // end namespace Catch + +#endif // CATCH_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_unique_ptr.hpp b/packages/Catch2/src/catch2/internal/catch_unique_ptr.hpp new file mode 100644 index 0000000000000000000000000000000000000000..758b22da63045a7572064ee3f2de85fa961ba031 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_unique_ptr.hpp @@ -0,0 +1,117 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_UNIQUE_PTR_HPP_INCLUDED +#define CATCH_UNIQUE_PTR_HPP_INCLUDED + +#include <cassert> +#include <type_traits> + +namespace Catch { +namespace Detail { + // reimplementation of unique_ptr for improved compilation times + // Does not support custom deleters (and thus does not require EBO) + // Does not support arrays + template <typename T> + class unique_ptr { + T* m_ptr; + public: + constexpr unique_ptr(std::nullptr_t = nullptr): + m_ptr{} + {} + explicit constexpr unique_ptr(T* ptr): + m_ptr(ptr) + {} + + template <typename U, typename = std::enable_if_t<std::is_base_of<T, U>::value>> + unique_ptr(unique_ptr<U>&& from): + m_ptr(from.release()) + {} + + template <typename U, typename = std::enable_if_t<std::is_base_of<T, U>::value>> + unique_ptr& operator=(unique_ptr<U>&& from) { + reset(from.release()); + + return *this; + } + + unique_ptr(unique_ptr const&) = delete; + unique_ptr& operator=(unique_ptr const&) = delete; + + unique_ptr(unique_ptr&& rhs) noexcept: + m_ptr(rhs.m_ptr) { + rhs.m_ptr = nullptr; + } + unique_ptr& operator=(unique_ptr&& rhs) noexcept { + reset(rhs.release()); + + return *this; + } + + ~unique_ptr() { + delete m_ptr; + } + + T& operator*() { + assert(m_ptr); + return *m_ptr; + } + T const& operator*() const { + assert(m_ptr); + return *m_ptr; + } + T* operator->() const noexcept { + assert(m_ptr); + return m_ptr; + } + + T* get() { return m_ptr; } + T const* get() const { return m_ptr; } + + void reset(T* ptr = nullptr) { + delete m_ptr; + m_ptr = ptr; + } + + T* release() { + auto temp = m_ptr; + m_ptr = nullptr; + return temp; + } + + explicit operator bool() const { + return m_ptr; + } + + friend void swap(unique_ptr& lhs, unique_ptr& rhs) { + auto temp = lhs.m_ptr; + lhs.m_ptr = rhs.m_ptr; + rhs.m_ptr = temp; + } + }; + + // Purposefully doesn't exist + // We could also rely on compiler warning + werror for calling plain delete + // on a T[], but this seems better. + // Maybe add definition and a static assert? + template <typename T> + class unique_ptr<T[]>; + + template <typename T, typename... Args> + unique_ptr<T> make_unique(Args&&... args) { + // static_cast<Args&&> does the same thing as std::forward in + // this case, but does not require including big header (<utility>) + // and compiles faster thanks to not requiring template instantiation + // and overload resolution + return unique_ptr<T>(new T(static_cast<Args&&>(args)...)); + } + + +} // end namespace Detail +} // end namespace Catch + +#endif // CATCH_UNIQUE_PTR_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_wildcard_pattern.cpp b/packages/Catch2/src/catch2/internal/catch_wildcard_pattern.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d71ca37ac69e73b152923f8b9274aae81d41bac4 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_wildcard_pattern.cpp @@ -0,0 +1,47 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/internal/catch_wildcard_pattern.hpp> +#include <catch2/internal/catch_enforce.hpp> +#include <catch2/internal/catch_string_manip.hpp> + +namespace Catch { + + WildcardPattern::WildcardPattern( std::string const& pattern, + CaseSensitive caseSensitivity ) + : m_caseSensitivity( caseSensitivity ), + m_pattern( normaliseString( 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 == normaliseString( str ); + case WildcardAtStart: + return endsWith( normaliseString( str ), m_pattern ); + case WildcardAtEnd: + return startsWith( normaliseString( str ), m_pattern ); + case WildcardAtBothEnds: + return contains( normaliseString( str ), m_pattern ); + default: + CATCH_INTERNAL_ERROR( "Unknown enum" ); + } + } + + std::string WildcardPattern::normaliseString( std::string const& str ) const { + return trim( m_caseSensitivity == CaseSensitive::No ? toLower( str ) : str ); + } +} diff --git a/packages/Catch2/src/catch2/internal/catch_wildcard_pattern.hpp b/packages/Catch2/src/catch2/internal/catch_wildcard_pattern.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6e9f6d57a7556d9f5a19008a5edd09f7c3812e75 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_wildcard_pattern.hpp @@ -0,0 +1,38 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_WILDCARD_PATTERN_HPP_INCLUDED +#define CATCH_WILDCARD_PATTERN_HPP_INCLUDED + +#include <catch2/internal/catch_case_sensitive.hpp> + +#include <string> + +namespace Catch +{ + class WildcardPattern { + enum WildcardPosition { + NoWildcard = 0, + WildcardAtStart = 1, + WildcardAtEnd = 2, + WildcardAtBothEnds = WildcardAtStart | WildcardAtEnd + }; + + public: + + WildcardPattern( std::string const& pattern, CaseSensitive caseSensitivity ); + bool matches( std::string const& str ) const; + + private: + std::string normaliseString( std::string const& str ) const; + CaseSensitive m_caseSensitivity; + WildcardPosition m_wildcard = NoWildcard; + std::string m_pattern; + }; +} + +#endif // CATCH_WILDCARD_PATTERN_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_windows_h_proxy.hpp b/packages/Catch2/src/catch2/internal/catch_windows_h_proxy.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a4c11fa624b21c0c7f8dfc3a5d2f3236dfae649a --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_windows_h_proxy.hpp @@ -0,0 +1,39 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_WINDOWS_H_PROXY_HPP_INCLUDED +#define CATCH_WINDOWS_H_PROXY_HPP_INCLUDED + +#include <catch2/internal/catch_platform.hpp> + +#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 // CATCH_WINDOWS_H_PROXY_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/internal/catch_xmlwriter.cpp b/packages/Catch2/src/catch2/internal/catch_xmlwriter.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f69256cf4ef90a9d059f67dd9fdd4d4751196a8e --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_xmlwriter.cpp @@ -0,0 +1,334 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/internal/catch_xmlwriter.hpp> + +#include <catch2/internal/catch_enforce.hpp> + +#include <iomanip> +#include <type_traits> + +namespace Catch { + +namespace { + + size_t trailingBytes(unsigned char c) { + if ((c & 0xE0) == 0xC0) { + return 2; + } + if ((c & 0xF0) == 0xE0) { + return 3; + } + if ((c & 0xF8) == 0xF0) { + return 4; + } + CATCH_INTERNAL_ERROR("Invalid multibyte utf-8 start byte encountered"); + } + + uint32_t headerValue(unsigned char c) { + if ((c & 0xE0) == 0xC0) { + return c & 0x1F; + } + if ((c & 0xF0) == 0xE0) { + return c & 0x0F; + } + if ((c & 0xF8) == 0xF0) { + return c & 0x07; + } + CATCH_INTERNAL_ERROR("Invalid multibyte utf-8 start byte encountered"); + } + + void hexEscapeChar(std::ostream& os, unsigned char c) { + std::ios_base::fmtflags f(os.flags()); + os << "\\x" + << std::uppercase << std::hex << std::setfill('0') << std::setw(2) + << static_cast<int>(c); + os.flags(f); + } + + bool shouldNewline(XmlFormatting fmt) { + return !!(static_cast<std::underlying_type_t<XmlFormatting>>(fmt & XmlFormatting::Newline)); + } + + bool shouldIndent(XmlFormatting fmt) { + return !!(static_cast<std::underlying_type_t<XmlFormatting>>(fmt & XmlFormatting::Indent)); + } + +} // anonymous namespace + + XmlFormatting operator | (XmlFormatting lhs, XmlFormatting rhs) { + return static_cast<XmlFormatting>( + static_cast<std::underlying_type_t<XmlFormatting>>(lhs) | + static_cast<std::underlying_type_t<XmlFormatting>>(rhs) + ); + } + + XmlFormatting operator & (XmlFormatting lhs, XmlFormatting rhs) { + return static_cast<XmlFormatting>( + static_cast<std::underlying_type_t<XmlFormatting>>(lhs) & + static_cast<std::underlying_type_t<XmlFormatting>>(rhs) + ); + } + + + 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 idx = 0; idx < m_str.size(); ++ idx ) { + unsigned char c = m_str[idx]; + switch (c) { + case '<': os << "<"; break; + case '&': os << "&"; break; + + case '>': + // See: http://www.w3.org/TR/xml/#syntax + if (idx > 2 && m_str[idx - 1] == ']' && m_str[idx - 2] == ']') + os << ">"; + else + os << c; + break; + + case '\"': + if (m_forWhat == ForAttributes) + os << """; + else + os << c; + break; + + default: + // Check for control characters and invalid utf-8 + + // Escape control characters in standard ascii + // see http://stackoverflow.com/questions/404107/why-are-control-characters-illegal-in-xml-1-0 + if (c < 0x09 || (c > 0x0D && c < 0x20) || c == 0x7F) { + hexEscapeChar(os, c); + break; + } + + // Plain ASCII: Write it to stream + if (c < 0x7F) { + os << c; + break; + } + + // UTF-8 territory + // Check if the encoding is valid and if it is not, hex escape bytes. + // Important: We do not check the exact decoded values for validity, only the encoding format + // First check that this bytes is a valid lead byte: + // This means that it is not encoded as 1111 1XXX + // Or as 10XX XXXX + if (c < 0xC0 || + c >= 0xF8) { + hexEscapeChar(os, c); + break; + } + + auto encBytes = trailingBytes(c); + // Are there enough bytes left to avoid accessing out-of-bounds memory? + if (idx + encBytes - 1 >= m_str.size()) { + hexEscapeChar(os, c); + break; + } + // The header is valid, check data + // The next encBytes bytes must together be a valid utf-8 + // This means: bitpattern 10XX XXXX and the extracted value is sane (ish) + bool valid = true; + uint32_t value = headerValue(c); + for (std::size_t n = 1; n < encBytes; ++n) { + unsigned char nc = m_str[idx + n]; + valid &= ((nc & 0xC0) == 0x80); + value = (value << 6) | (nc & 0x3F); + } + + if ( + // Wrong bit pattern of following bytes + (!valid) || + // Overlong encodings + (value < 0x80) || + (0x80 <= value && value < 0x800 && encBytes > 2) || + (0x800 < value && value < 0x10000 && encBytes > 3) || + // Encoded value out of range + (value >= 0x110000) + ) { + hexEscapeChar(os, c); + break; + } + + // If we got here, this is in fact a valid(ish) utf-8 sequence + for (std::size_t n = 0; n < encBytes; ++n) { + os << m_str[idx + n]; + } + idx += encBytes - 1; + break; + } + } + } + + std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode ) { + xmlEncode.encodeTo( os ); + return os; + } + + XmlWriter::ScopedElement::ScopedElement( XmlWriter* writer, XmlFormatting fmt ) + : m_writer( writer ), + m_fmt(fmt) + {} + + XmlWriter::ScopedElement::ScopedElement( ScopedElement&& other ) noexcept + : m_writer( other.m_writer ), + m_fmt(other.m_fmt) + { + other.m_writer = nullptr; + other.m_fmt = XmlFormatting::None; + } + XmlWriter::ScopedElement& XmlWriter::ScopedElement::operator=( ScopedElement&& other ) noexcept { + if ( m_writer ) { + m_writer->endElement(); + } + m_writer = other.m_writer; + other.m_writer = nullptr; + m_fmt = other.m_fmt; + other.m_fmt = XmlFormatting::None; + return *this; + } + + + XmlWriter::ScopedElement::~ScopedElement() { + if (m_writer) { + m_writer->endElement(m_fmt); + } + } + + XmlWriter::ScopedElement& XmlWriter::ScopedElement::writeText( std::string const& text, XmlFormatting fmt ) { + m_writer->writeText( text, fmt ); + return *this; + } + + XmlWriter::XmlWriter( std::ostream& os ) : m_os( os ) + { + writeDeclaration(); + } + + XmlWriter::~XmlWriter() { + while (!m_tags.empty()) { + endElement(); + } + newlineIfNecessary(); + } + + XmlWriter& XmlWriter::startElement( std::string const& name, XmlFormatting fmt ) { + ensureTagClosed(); + newlineIfNecessary(); + if (shouldIndent(fmt)) { + m_os << m_indent; + m_indent += " "; + } + m_os << '<' << name; + m_tags.push_back( name ); + m_tagIsOpen = true; + applyFormatting(fmt); + return *this; + } + + XmlWriter::ScopedElement XmlWriter::scopedElement( std::string const& name, XmlFormatting fmt ) { + ScopedElement scoped( this, fmt ); + startElement( name, fmt ); + return scoped; + } + + XmlWriter& XmlWriter::endElement(XmlFormatting fmt) { + m_indent = m_indent.substr(0, m_indent.size() - 2); + + if( m_tagIsOpen ) { + m_os << "/>"; + m_tagIsOpen = false; + } else { + newlineIfNecessary(); + if (shouldIndent(fmt)) { + m_os << m_indent; + } + m_os << "</" << m_tags.back() << ">"; + } + m_os << std::flush; + applyFormatting(fmt); + 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, XmlFormatting fmt) { + if( !text.empty() ){ + bool tagWasOpen = m_tagIsOpen; + ensureTagClosed(); + if (tagWasOpen && shouldIndent(fmt)) { + m_os << m_indent; + } + m_os << XmlEncode( text ); + applyFormatting(fmt); + } + return *this; + } + + XmlWriter& XmlWriter::writeComment( std::string const& text, XmlFormatting fmt) { + ensureTagClosed(); + if (shouldIndent(fmt)) { + m_os << m_indent; + } + m_os << "<!--" << text << "-->"; + applyFormatting(fmt); + 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::flush; + newlineIfNecessary(); + m_tagIsOpen = false; + } + } + + void XmlWriter::applyFormatting(XmlFormatting fmt) { + m_needsNewline = shouldNewline(fmt); + } + + 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/packages/Catch2/src/catch2/internal/catch_xmlwriter.hpp b/packages/Catch2/src/catch2/internal/catch_xmlwriter.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c2e7473e1fa8c59877fc09bc731a08c5dc8f9072 --- /dev/null +++ b/packages/Catch2/src/catch2/internal/catch_xmlwriter.hpp @@ -0,0 +1,122 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_XMLWRITER_HPP_INCLUDED +#define CATCH_XMLWRITER_HPP_INCLUDED + +#include <catch2/internal/catch_stream.hpp> + +// FixMe: Without this include (and something inside it), MSVC goes crazy +// and reports that calls to XmlEncode's op << are ambiguous between +// the declaration and definition. +// It also has to be in the header. +#include <catch2/internal/catch_source_line_info.hpp> + + +#include <vector> + +namespace Catch { + enum class XmlFormatting { + None = 0x00, + Indent = 0x01, + Newline = 0x02, + }; + + XmlFormatting operator | (XmlFormatting lhs, XmlFormatting rhs); + XmlFormatting operator & (XmlFormatting lhs, XmlFormatting rhs); + + 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, XmlFormatting fmt ); + + ScopedElement( ScopedElement&& other ) noexcept; + ScopedElement& operator=( ScopedElement&& other ) noexcept; + + ~ScopedElement(); + + ScopedElement& writeText( std::string const& text, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent ); + + 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; + XmlFormatting m_fmt; + }; + + XmlWriter( std::ostream& os = Catch::cout() ); + ~XmlWriter(); + + XmlWriter( XmlWriter const& ) = delete; + XmlWriter& operator=( XmlWriter const& ) = delete; + + XmlWriter& startElement( std::string const& name, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent); + + ScopedElement scopedElement( std::string const& name, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent); + + XmlWriter& endElement(XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent); + + 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, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent); + + XmlWriter& writeComment(std::string const& text, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent); + + void writeStylesheetRef( std::string const& url ); + + XmlWriter& writeBlankLine(); + + void ensureTagClosed(); + + private: + + void applyFormatting(XmlFormatting fmt); + + 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 // CATCH_XMLWRITER_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers.hpp new file mode 100644 index 0000000000000000000000000000000000000000..fe8f48c4b71ca45d2e362375cdddc3115db3d20b --- /dev/null +++ b/packages/Catch2/src/catch2/matchers/catch_matchers.hpp @@ -0,0 +1,248 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_MATCHERS_HPP_INCLUDED +#define CATCH_MATCHERS_HPP_INCLUDED + +#include <catch2/matchers/internal/catch_matchers_impl.hpp> + +#include <string> +#include <vector> + +namespace Catch { +namespace Matchers { + + class MatcherUntypedBase { + public: + MatcherUntypedBase() = default; + + MatcherUntypedBase(MatcherUntypedBase const&) = default; + MatcherUntypedBase(MatcherUntypedBase&&) = default; + + MatcherUntypedBase& operator = (MatcherUntypedBase const&) = delete; + MatcherUntypedBase& operator = (MatcherUntypedBase&&) = delete; + + std::string toString() const; + + protected: + virtual ~MatcherUntypedBase(); // = default; + virtual std::string describe() const = 0; + mutable std::string m_cachedToString; + }; + +#ifdef __clang__ +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wnon-virtual-dtor" +#endif + + template<typename ObjectT> + struct MatcherMethod { + virtual bool match(ObjectT const& arg) const = 0; + }; + +#ifdef __clang__ +# pragma clang diagnostic pop +#endif + + template<typename T> + struct MatcherBase : MatcherUntypedBase, MatcherMethod<T> {}; + + namespace Detail { + + template<typename ArgT> + struct MatchAllOf final : MatcherBase<ArgT> { + MatchAllOf() = default; + MatchAllOf(MatchAllOf const&) = delete; + MatchAllOf& operator=(MatchAllOf const&) = delete; + MatchAllOf(MatchAllOf&&) = default; + MatchAllOf& operator=(MatchAllOf&&) = default; + + + 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; + } + + friend MatchAllOf operator&& (MatchAllOf&& lhs, MatcherBase<ArgT> const& rhs) { + lhs.m_matchers.push_back(&rhs); + return std::move(lhs); + } + friend MatchAllOf operator&& (MatcherBase<ArgT> const& lhs, MatchAllOf&& rhs) { + rhs.m_matchers.insert(rhs.m_matchers.begin(), &lhs); + return std::move(rhs); + } + + private: + std::vector<MatcherBase<ArgT> const*> m_matchers; + }; + + //! lvalue overload is intentionally deleted, users should + //! not be trying to compose stored composition matchers + template<typename ArgT> + MatchAllOf<ArgT> operator&& (MatchAllOf<ArgT> const& lhs, MatcherBase<ArgT> const& rhs) = delete; + //! lvalue overload is intentionally deleted, users should + //! not be trying to compose stored composition matchers + template<typename ArgT> + MatchAllOf<ArgT> operator&& (MatcherBase<ArgT> const& lhs, MatchAllOf<ArgT> const& rhs) = delete; + + template<typename ArgT> + struct MatchAnyOf final : MatcherBase<ArgT> { + MatchAnyOf() = default; + MatchAnyOf(MatchAnyOf const&) = delete; + MatchAnyOf& operator=(MatchAnyOf const&) = delete; + MatchAnyOf(MatchAnyOf&&) = default; + MatchAnyOf& operator=(MatchAnyOf&&) = default; + + 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; + } + + friend MatchAnyOf operator|| (MatchAnyOf&& lhs, MatcherBase<ArgT> const& rhs) { + lhs.m_matchers.push_back(&rhs); + return std::move(lhs); + } + friend MatchAnyOf operator|| (MatcherBase<ArgT> const& lhs, MatchAnyOf&& rhs) { + rhs.m_matchers.insert(rhs.m_matchers.begin(), &lhs); + return std::move(rhs); + } + + private: + std::vector<MatcherBase<ArgT> const*> m_matchers; + }; + + //! lvalue overload is intentionally deleted, users should + //! not be trying to compose stored composition matchers + template<typename ArgT> + MatchAnyOf<ArgT> operator|| (MatchAnyOf<ArgT> const& lhs, MatcherBase<ArgT> const& rhs) = delete; + //! lvalue overload is intentionally deleted, users should + //! not be trying to compose stored composition matchers + template<typename ArgT> + MatchAnyOf<ArgT> operator|| (MatcherBase<ArgT> const& lhs, MatchAnyOf<ArgT> const& rhs) = delete; + + template<typename ArgT> + struct MatchNotOf final : MatcherBase<ArgT> { + + explicit 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(); + } + + private: + MatcherBase<ArgT> const& m_underlyingMatcher; + }; + + } // namespace Detail + + template <typename T> + Detail::MatchAllOf<T> operator&& (MatcherBase<T> const& lhs, MatcherBase<T> const& rhs) { + return Detail::MatchAllOf<T>{} && lhs && rhs; + } + template <typename T> + Detail::MatchAnyOf<T> operator|| (MatcherBase<T> const& lhs, MatcherBase<T> const& rhs) { + return Detail::MatchAnyOf<T>{} || lhs || rhs; + } + + template <typename T> + Detail::MatchNotOf<T> operator! (MatcherBase<T> const& matcher) { + return Detail::MatchNotOf<T>{ matcher }; + } + + +} // namespace Matchers +} // namespace Catch + + +#if defined(CATCH_CONFIG_PREFIX_ALL) && !defined(CATCH_CONFIG_DISABLE) + #define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CATCH_REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr ) + #define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CATCH_REQUIRE_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::Normal, matcher, expr ) + + #define CATCH_CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CATCH_CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr ) + #define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CATCH_CHECK_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr ) + + #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 ) + +#elif defined(CATCH_CONFIG_PREFIX_ALL) && defined(CATCH_CONFIG_DISABLE) + + #define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) (void)(0) + #define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0) + + #define CATCH_CHECK_THROWS_WITH( expr, matcher ) (void)(0) + #define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0) + + #define CATCH_CHECK_THAT( arg, matcher ) (void)(0) + #define CATCH_REQUIRE_THAT( arg, matcher ) (void)(0) + +#elif !defined(CATCH_CONFIG_PREFIX_ALL) && !defined(CATCH_CONFIG_DISABLE) + + #define REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr ) + #define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "REQUIRE_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::Normal, matcher, expr ) + + #define CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr ) + #define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CHECK_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr ) + + #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 ) + +#elif !defined(CATCH_CONFIG_PREFIX_ALL) && defined(CATCH_CONFIG_DISABLE) + + #define REQUIRE_THROWS_WITH( expr, matcher ) (void)(0) + #define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0) + + #define CHECK_THROWS_WITH( expr, matcher ) (void)(0) + #define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0) + + #define CHECK_THAT( arg, matcher ) (void)(0) + #define REQUIRE_THAT( arg, matcher ) (void)(0) + +#endif // end of user facing macro declarations + +#endif // CATCH_MATCHERS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_all.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers_all.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3c0bb9f51c76d415b70e2f646161dd4e4d9a6dc4 --- /dev/null +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_all.hpp @@ -0,0 +1,35 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +/** \file + * This is a convenience header for Catch2's Matcher support. It includes + * **all** of Catch2 headers related to matchers. + * + * Generally the Catch2 users should use specific includes they need, + * but this header can be used instead for ease-of-experimentation, or + * just plain convenience, at the cost of increased compilation times. + * + * When a new header is added to either the `matchers` folder, or to + * the corresponding internal subfolder, it should be added here. + */ + +#ifndef CATCH_MATCHERS_ALL_HPP_INCLUDED +#define CATCH_MATCHERS_ALL_HPP_INCLUDED + +#include <catch2/matchers/catch_matchers.hpp> +#include <catch2/matchers/catch_matchers_container_properties.hpp> +#include <catch2/matchers/catch_matchers_contains.hpp> +#include <catch2/matchers/catch_matchers_exception.hpp> +#include <catch2/matchers/catch_matchers_floating_point.hpp> +#include <catch2/matchers/catch_matchers_predicate.hpp> +#include <catch2/matchers/catch_matchers_quantifiers.hpp> +#include <catch2/matchers/catch_matchers_string.hpp> +#include <catch2/matchers/catch_matchers_templated.hpp> +#include <catch2/matchers/catch_matchers_vector.hpp> +#include <catch2/matchers/internal/catch_matchers_impl.hpp> + +#endif // CATCH_MATCHERS_ALL_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_container_properties.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers_container_properties.hpp new file mode 100644 index 0000000000000000000000000000000000000000..81273995538dc576176eb16321cc02041ba2d3e4 --- /dev/null +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_container_properties.hpp @@ -0,0 +1,90 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_MATCHERS_CONTAINER_PROPERTIES_HPP_INCLUDED +#define CATCH_MATCHERS_CONTAINER_PROPERTIES_HPP_INCLUDED + +#include <catch2/matchers/catch_matchers_templated.hpp> +#include <catch2/internal/catch_container_nonmembers.hpp> + +namespace Catch { + namespace Matchers { + + class IsEmptyMatcher final : public MatcherGenericBase { + public: + // todo: Use polyfills + template <typename RangeLike> + bool match(RangeLike&& rng) const { +#if defined(CATCH_CONFIG_POLYFILL_NONMEMBER_CONTAINER_ACCESS) + using Catch::Detail::empty; +#else + using std::empty; +#endif + return empty(rng); + } + + std::string describe() const override; + }; + + class HasSizeMatcher final : public MatcherGenericBase { + std::size_t m_target_size; + public: + explicit HasSizeMatcher(std::size_t target_size): + m_target_size(target_size) + {} + + template <typename RangeLike> + bool match(RangeLike&& rng) const { +#if defined(CATCH_CONFIG_POLYFILL_NONMEMBER_CONTAINER_ACCESS) + using Catch::Detail::size; +#else + using std::size; +#endif + return size(rng) == m_target_size; + } + + std::string describe() const override; + }; + + template <typename Matcher> + class SizeMatchesMatcher final : public MatcherGenericBase { + Matcher m_matcher; + public: + explicit SizeMatchesMatcher(Matcher m): + m_matcher(std::move(m)) + {} + + template <typename RangeLike> + bool match(RangeLike&& rng) const { +#if defined(CATCH_CONFIG_POLYFILL_NONMEMBER_CONTAINER_ACCESS) + using Catch::Detail::size; +#else + using std::size; +#endif + return m_matcher.match(size(rng)); + } + + std::string describe() const override { + return "size matches " + m_matcher.describe(); + } + }; + + + //! Creates a matcher that accepts empty ranges/containers + IsEmptyMatcher IsEmpty(); + //! Creates a matcher that accepts ranges/containers with specific size + HasSizeMatcher SizeIs(std::size_t sz); + template <typename Matcher> + std::enable_if_t<Detail::is_matcher<Matcher>::value, + SizeMatchesMatcher<Matcher>> SizeIs(Matcher&& m) { + return SizeMatchesMatcher<Matcher>{std::forward<Matcher>(m)}; + } + + } // end namespace Matchers +} // end namespace Catch + +#endif // CATCH_MATCHERS_CONTAINER_PROPERTIES_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_contains.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers_contains.hpp new file mode 100644 index 0000000000000000000000000000000000000000..be1b9379ff53b3afaa4063fb7948a06e15599da2 --- /dev/null +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_contains.hpp @@ -0,0 +1,105 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_MATCHERS_CONTAINS_HPP_INCLUDED +#define CATCH_MATCHERS_CONTAINS_HPP_INCLUDED + +#include <catch2/matchers/catch_matchers_templated.hpp> + +#include <algorithm> +#include <functional> +#include <utility> + +namespace Catch { + namespace Matchers { + //! Matcher for checking that an element in range is equal to specific element + template <typename T, typename Equality> + class ContainsElementMatcher final : public MatcherGenericBase { + T m_desired; + Equality m_eq; + public: + template <typename T2, typename Equality2> + ContainsElementMatcher(T2&& target, Equality2&& predicate): + m_desired(std::forward<T2>(target)), + m_eq(std::forward<Equality2>(predicate)) + {} + + std::string describe() const override { + return "contains element " + Catch::Detail::stringify(m_desired); + } + + template <typename RangeLike> + bool match(RangeLike&& rng) const { + using std::begin; using std::end; + + return end(rng) != std::find_if(begin(rng), end(rng), + [&](auto const& elem) { + return m_eq(elem, m_desired); + }); + } + }; + + //! Meta-matcher for checking that an element in a range matches a specific matcher + template <typename Matcher> + class ContainsMatcherMatcher final : public MatcherGenericBase { + Matcher m_matcher; + public: + // Note that we do a copy+move to avoid having to SFINAE this + // constructor (and also avoid some perfect forwarding failure + // cases) + ContainsMatcherMatcher(Matcher matcher): + m_matcher(std::move(matcher)) + {} + + template <typename RangeLike> + bool match(RangeLike&& rng) const { + using std::begin; using std::endl; + for (auto&& elem : rng) { + if (m_matcher.match(elem)) { + return true; + } + } + return false; + } + + std::string describe() const override { + return "contains element matching " + m_matcher.describe(); + } + }; + + /** + * Creates a matcher that checks whether a range contains a specific element. + * + * Uses `std::equal_to` to do the comparison + */ + template <typename T> + std::enable_if_t<!Detail::is_matcher<T>::value, + ContainsElementMatcher<T, std::equal_to<>>> Contains(T&& elem) { + return { std::forward<T>(elem), std::equal_to<>{} }; + } + + //! Creates a matcher that checks whether a range contains element matching a matcher + template <typename Matcher> + std::enable_if_t<Detail::is_matcher<Matcher>::value, + ContainsMatcherMatcher<Matcher>> Contains(Matcher&& matcher) { + return { std::forward<Matcher>(matcher) }; + } + + /** + * Creates a matcher that checks whether a range contains a specific element. + * + * Uses `eq` to do the comparisons + */ + template <typename T, typename Equality> + ContainsElementMatcher<T, Equality> Contains(T&& elem, Equality&& eq) { + return { std::forward<T>(elem), std::forward<Equality>(eq) }; + } + + } +} + +#endif // CATCH_MATCHERS_CONTAINS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_exception.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers_exception.hpp new file mode 100644 index 0000000000000000000000000000000000000000..eca9327d3b433a7371e3b339028463bf2358ec02 --- /dev/null +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_exception.hpp @@ -0,0 +1,35 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_MATCHERS_EXCEPTION_HPP_INCLUDED +#define CATCH_MATCHERS_EXCEPTION_HPP_INCLUDED + +#include <catch2/matchers/catch_matchers.hpp> + +namespace Catch { +namespace Matchers { + +class ExceptionMessageMatcher final : public MatcherBase<std::exception> { + std::string m_message; +public: + + ExceptionMessageMatcher(std::string const& message): + m_message(message) + {} + + bool match(std::exception const& ex) const override; + + std::string describe() const override; +}; + +//! Creates a matcher that checks whether a std derived exception has the provided message +ExceptionMessageMatcher Message(std::string const& message); + +} // namespace Matchers +} // namespace Catch + +#endif // CATCH_MATCHERS_EXCEPTION_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_floating_point.cpp b/packages/Catch2/src/catch2/matchers/catch_matchers_floating_point.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fc5d916525251bdcb6c5d0e800e975813f928da2 --- /dev/null +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_floating_point.cpp @@ -0,0 +1,234 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/matchers/catch_matchers_floating_point.hpp> +#include <catch2/internal/catch_enforce.hpp> +#include <catch2/internal/catch_polyfills.hpp> +#include <catch2/internal/catch_to_string.hpp> +#include <catch2/catch_tostring.hpp> + +#include <algorithm> +#include <cmath> +#include <cstdlib> +#include <cstdint> +#include <cstring> +#include <sstream> +#include <iomanip> +#include <limits> + + +namespace Catch { +namespace { + + int32_t convert(float f) { + static_assert(sizeof(float) == sizeof(int32_t), "Important ULP matcher assumption violated"); + int32_t i; + std::memcpy(&i, &f, sizeof(f)); + return i; + } + + int64_t convert(double d) { + static_assert(sizeof(double) == sizeof(int64_t), "Important ULP matcher assumption violated"); + int64_t i; + std::memcpy(&i, &d, sizeof(d)); + return i; + } + + template <typename FP> + bool almostEqualUlps(FP lhs, FP rhs, uint64_t maxUlpDiff) { + // Comparison with NaN should always be false. + // This way we can rule it out before getting into the ugly details + if (Catch::isnan(lhs) || Catch::isnan(rhs)) { + return false; + } + + auto lc = convert(lhs); + auto rc = convert(rhs); + + if ((lc < 0) != (rc < 0)) { + // Potentially we can have +0 and -0 + return lhs == rhs; + } + + auto ulpDiff = std::abs(lc - rc); + return static_cast<uint64_t>(ulpDiff) <= maxUlpDiff; + } + +#if defined(CATCH_CONFIG_GLOBAL_NEXTAFTER) + + float nextafter(float x, float y) { + return ::nextafterf(x, y); + } + + double nextafter(double x, double y) { + return ::nextafter(x, y); + } + +#endif // ^^^ CATCH_CONFIG_GLOBAL_NEXTAFTER ^^^ + +template <typename FP> +FP step(FP start, FP direction, uint64_t steps) { + for (uint64_t i = 0; i < steps; ++i) { +#if defined(CATCH_CONFIG_GLOBAL_NEXTAFTER) + start = Catch::nextafter(start, direction); +#else + start = std::nextafter(start, direction); +#endif + } + return start; +} + +// 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); +} + +template <typename FloatingPoint> +void write(std::ostream& out, FloatingPoint num) { + out << std::scientific + << std::setprecision(std::numeric_limits<FloatingPoint>::max_digits10 - 1) + << num; +} + +} // end anonymous namespace + +namespace Matchers { +namespace Detail { + + enum class FloatingPointKind : uint8_t { + Float, + Double + }; + +} // end namespace Detail + + + WithinAbsMatcher::WithinAbsMatcher(double target, double margin) + :m_target{ target }, m_margin{ margin } { + CATCH_ENFORCE(margin >= 0, "Invalid margin: " << margin << '.' + << " Margin has to be non-negative."); + } + + // 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 >= matchee); + } + + std::string WithinAbsMatcher::describe() const { + return "is within " + ::Catch::Detail::stringify(m_margin) + " of " + ::Catch::Detail::stringify(m_target); + } + + + WithinUlpsMatcher::WithinUlpsMatcher(double target, uint64_t ulps, Detail::FloatingPointKind baseType) + :m_target{ target }, m_ulps{ ulps }, m_type{ baseType } { + CATCH_ENFORCE(m_type == Detail::FloatingPointKind::Double + || m_ulps < (std::numeric_limits<uint32_t>::max)(), + "Provided ULP is impossibly large for a float comparison."); + } + +#if defined(__clang__) +#pragma clang diagnostic push +// Clang <3.5 reports on the default branch in the switch below +#pragma clang diagnostic ignored "-Wunreachable-code" +#endif + + bool WithinUlpsMatcher::match(double const& matchee) const { + switch (m_type) { + case Detail::FloatingPointKind::Float: + return almostEqualUlps<float>(static_cast<float>(matchee), static_cast<float>(m_target), m_ulps); + case Detail::FloatingPointKind::Double: + return almostEqualUlps<double>(matchee, m_target, m_ulps); + default: + CATCH_INTERNAL_ERROR( "Unknown Detail::FloatingPointKind value" ); + } + } + +#if defined(__clang__) +#pragma clang diagnostic pop +#endif + + std::string WithinUlpsMatcher::describe() const { + std::stringstream ret; + + ret << "is within " << m_ulps << " ULPs of "; + + if (m_type == Detail::FloatingPointKind::Float) { + write(ret, static_cast<float>(m_target)); + ret << 'f'; + } else { + write(ret, m_target); + } + + ret << " (["; + if (m_type == Detail::FloatingPointKind::Double) { + write(ret, step(m_target, static_cast<double>(-INFINITY), m_ulps)); + ret << ", "; + write(ret, step(m_target, static_cast<double>( INFINITY), m_ulps)); + } else { + // We have to cast INFINITY to float because of MinGW, see #1782 + write(ret, step(static_cast<float>(m_target), static_cast<float>(-INFINITY), m_ulps)); + ret << ", "; + write(ret, step(static_cast<float>(m_target), static_cast<float>( INFINITY), m_ulps)); + } + ret << "])"; + + return ret.str(); + } + + WithinRelMatcher::WithinRelMatcher(double target, double epsilon): + m_target(target), + m_epsilon(epsilon){ + CATCH_ENFORCE(m_epsilon >= 0., "Relative comparison with epsilon < 0 does not make sense."); + CATCH_ENFORCE(m_epsilon < 1., "Relative comparison with epsilon >= 1 does not make sense."); + } + + bool WithinRelMatcher::match(double const& matchee) const { + const auto relMargin = m_epsilon * (std::max)(std::fabs(matchee), std::fabs(m_target)); + return marginComparison(matchee, m_target, + std::isinf(relMargin)? 0 : relMargin); + } + + std::string WithinRelMatcher::describe() const { + Catch::ReusableStringStream sstr; + sstr << "and " << m_target << " are within " << m_epsilon * 100. << "% of each other"; + return sstr.str(); + } + + +WithinUlpsMatcher WithinULP(double target, uint64_t maxUlpDiff) { + return WithinUlpsMatcher(target, maxUlpDiff, Detail::FloatingPointKind::Double); +} + +WithinUlpsMatcher WithinULP(float target, uint64_t maxUlpDiff) { + return WithinUlpsMatcher(target, maxUlpDiff, Detail::FloatingPointKind::Float); +} + +WithinAbsMatcher WithinAbs(double target, double margin) { + return WithinAbsMatcher(target, margin); +} + +WithinRelMatcher WithinRel(double target, double eps) { + return WithinRelMatcher(target, eps); +} + +WithinRelMatcher WithinRel(double target) { + return WithinRelMatcher(target, std::numeric_limits<double>::epsilon() * 100); +} + +WithinRelMatcher WithinRel(float target, float eps) { + return WithinRelMatcher(target, eps); +} + +WithinRelMatcher WithinRel(float target) { + return WithinRelMatcher(target, std::numeric_limits<float>::epsilon() * 100); +} + + +} // namespace Matchers +} // namespace Catch diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_floating_point.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers_floating_point.hpp new file mode 100644 index 0000000000000000000000000000000000000000..dc0fa8f71fe8c174f8c8a6cb3d3f89ef2cd352ac --- /dev/null +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_floating_point.hpp @@ -0,0 +1,73 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_MATCHERS_FLOATING_POINT_HPP_INCLUDED +#define CATCH_MATCHERS_FLOATING_POINT_HPP_INCLUDED + +#include <catch2/matchers/catch_matchers.hpp> + +namespace Catch { +namespace Matchers { + + namespace Detail { + enum class FloatingPointKind : uint8_t; + } + + struct WithinAbsMatcher final : 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 final : MatcherBase<double> { + WithinUlpsMatcher(double target, uint64_t ulps, Detail::FloatingPointKind baseType); + bool match(double const& matchee) const override; + std::string describe() const override; + private: + double m_target; + uint64_t m_ulps; + Detail::FloatingPointKind m_type; + }; + + // Given IEEE-754 format for floats and doubles, we can assume + // that float -> double promotion is lossless. Given this, we can + // assume that if we do the standard relative comparison of + // |lhs - rhs| <= epsilon * max(fabs(lhs), fabs(rhs)), then we get + // the same result if we do this for floats, as if we do this for + // doubles that were promoted from floats. + struct WithinRelMatcher final : MatcherBase<double> { + WithinRelMatcher(double target, double epsilon); + bool match(double const& matchee) const override; + std::string describe() const override; + private: + double m_target; + double m_epsilon; + }; + + //! Creates a matcher that accepts doubles within certain ULP range of target + WithinUlpsMatcher WithinULP(double target, uint64_t maxUlpDiff); + //! Creates a matcher that accepts floats within certain ULP range of target + WithinUlpsMatcher WithinULP(float target, uint64_t maxUlpDiff); + //! Creates a matcher that accepts numbers within certain range of target + WithinAbsMatcher WithinAbs(double target, double margin); + + //! Creates a matcher that accepts doubles within certain relative range of target + WithinRelMatcher WithinRel(double target, double eps); + //! Creates a matcher that accepts doubles within 100*DBL_EPS relative range of target + WithinRelMatcher WithinRel(double target); + //! Creates a matcher that accepts doubles within certain relative range of target + WithinRelMatcher WithinRel(float target, float eps); + //! Creates a matcher that accepts floats within 100*FLT_EPS relative range of target + WithinRelMatcher WithinRel(float target); + +} // namespace Matchers +} // namespace Catch + +#endif // CATCH_MATCHERS_FLOATING_POINT_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_predicate.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers_predicate.hpp new file mode 100644 index 0000000000000000000000000000000000000000..99a01a4edb594a7d0d45dafc6d0d9570f52e2ca2 --- /dev/null +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_predicate.hpp @@ -0,0 +1,59 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_MATCHERS_PREDICATE_HPP_INCLUDED +#define CATCH_MATCHERS_PREDICATE_HPP_INCLUDED + +#include <catch2/matchers/catch_matchers.hpp> +#include <catch2/internal/catch_meta.hpp> + +#include <string> +#include <utility> + +namespace Catch { +namespace Matchers { + +namespace Detail { + std::string finalizeDescription(const std::string& desc); +} // namespace Detail + +template <typename T, typename Predicate> +class PredicateMatcher final : public MatcherBase<T> { + Predicate m_predicate; + std::string m_description; +public: + + PredicateMatcher(Predicate&& elem, std::string const& descr) + :m_predicate(std::forward<Predicate>(elem)), + m_description(Detail::finalizeDescription(descr)) + {} + + bool match( T const& item ) const override { + return m_predicate(item); + } + + std::string describe() const override { + return m_description; + } +}; + + /** + * Creates a matcher that calls delegates `match` to the provided predicate. + * + * The user has to explicitly specify the argument type to the matcher + */ + template<typename T, typename Pred> + PredicateMatcher<T, Pred> Predicate(Pred&& predicate, std::string const& description = "") { + static_assert(is_callable<Pred(T)>::value, "Predicate not callable with argument T"); + static_assert(std::is_same<bool, FunctionReturnType<Pred, T>>::value, "Predicate does not return bool"); + return PredicateMatcher<T, Pred>(std::forward<Pred>(predicate), description); + } + +} // namespace Matchers +} // namespace Catch + +#endif // CATCH_MATCHERS_PREDICATE_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_quantifiers.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers_quantifiers.hpp new file mode 100644 index 0000000000000000000000000000000000000000..09a8c1280e53daef26a6cfc439a234eb8f37a55b --- /dev/null +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_quantifiers.hpp @@ -0,0 +1,109 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_MATCHERS_QUANTIFIERS_HPP_INCLUDED +#define CATCH_MATCHERS_QUANTIFIERS_HPP_INCLUDED + +#include <catch2/matchers/catch_matchers_templated.hpp> + +#include <utility> + +namespace Catch { + namespace Matchers { + // Matcher for checking that all elements in range matches a given matcher. + template <typename Matcher> + class AllMatchMatcher final : public MatcherGenericBase { + Matcher m_matcher; + public: + AllMatchMatcher(Matcher matcher): + m_matcher(std::move(matcher)) + {} + + std::string describe() const override { + return "all match " + m_matcher.describe(); + } + + template <typename RangeLike> + bool match(RangeLike&& rng) const { + for (auto&& elem : rng) { + if (!m_matcher.match(elem)) { + return false; + } + } + return true; + } + }; + + // Matcher for checking that no element in range matches a given matcher. + template <typename Matcher> + class NoneMatchMatcher final : public MatcherGenericBase { + Matcher m_matcher; + public: + NoneMatchMatcher(Matcher matcher): + m_matcher(std::move(matcher)) + {} + + std::string describe() const override { + return "none match " + m_matcher.describe(); + } + + template <typename RangeLike> + bool match(RangeLike&& rng) const { + for (auto&& elem : rng) { + if (m_matcher.match(elem)) { + return false; + } + } + return true; + } + }; + + // Matcher for checking that at least one element in range matches a given matcher. + template <typename Matcher> + class AnyMatchMatcher final : public MatcherGenericBase { + Matcher m_matcher; + public: + AnyMatchMatcher(Matcher matcher): + m_matcher(std::move(matcher)) + {} + + std::string describe() const override { + return "any match " + m_matcher.describe(); + } + + template <typename RangeLike> + bool match(RangeLike&& rng) const { + for (auto&& elem : rng) { + if (m_matcher.match(elem)) { + return true; + } + } + return false; + } + }; + + // Creates a matcher that checks whether a range contains element matching a matcher + template <typename Matcher> + AllMatchMatcher<Matcher> AllMatch(Matcher&& matcher) { + return { std::forward<Matcher>(matcher) }; + } + + // Creates a matcher that checks whether no element in a range matches a matcher. + template <typename Matcher> + NoneMatchMatcher<Matcher> NoneMatch(Matcher&& matcher) { + return { std::forward<Matcher>(matcher) }; + } + + // Creates a matcher that checks whether any element in a range matches a matcher. + template <typename Matcher> + AnyMatchMatcher<Matcher> AnyMatch(Matcher&& matcher) { + return { std::forward<Matcher>(matcher) }; + } + } +} + +#endif // CATCH_MATCHERS_QUANTIFIERS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_string.cpp b/packages/Catch2/src/catch2/matchers/catch_matchers_string.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a81baddd599c1ce3f642290333edb5a585809a4b --- /dev/null +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_string.cpp @@ -0,0 +1,113 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/matchers/catch_matchers_string.hpp> +#include <catch2/internal/catch_string_manip.hpp> +#include <catch2/catch_tostring.hpp> + +#include <regex> + +namespace Catch { +namespace Matchers { + + CasedString::CasedString( std::string const& str, CaseSensitive 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; + } + StringRef CasedString::caseSensitivitySuffix() const { + return m_caseSensitivity == CaseSensitive::Yes + ? StringRef() + : " (case insensitive)"_sr; + } + + + 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; + } + + StringEqualsMatcher::StringEqualsMatcher( CasedString const& comparator ) : StringMatcherBase( "equals", comparator ) {} + + bool StringEqualsMatcher::match( std::string const& source ) const { + return m_comparator.adjustString( source ) == m_comparator.m_str; + } + + + StringContainsMatcher::StringContainsMatcher( CasedString const& comparator ) : StringMatcherBase( "contains", comparator ) {} + + bool StringContainsMatcher::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 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::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::Yes)? " case sensitively" : " case insensitively"); + } + + + StringEqualsMatcher Equals( std::string const& str, CaseSensitive caseSensitivity ) { + return StringEqualsMatcher( CasedString( str, caseSensitivity) ); + } + StringContainsMatcher Contains( std::string const& str, CaseSensitive caseSensitivity ) { + return StringContainsMatcher( CasedString( str, caseSensitivity) ); + } + EndsWithMatcher EndsWith( std::string const& str, CaseSensitive caseSensitivity ) { + return EndsWithMatcher( CasedString( str, caseSensitivity) ); + } + StartsWithMatcher StartsWith( std::string const& str, CaseSensitive caseSensitivity ) { + return StartsWithMatcher( CasedString( str, caseSensitivity) ); + } + + RegexMatcher Matches(std::string const& regex, CaseSensitive caseSensitivity) { + return RegexMatcher(regex, caseSensitivity); + } + +} // namespace Matchers +} // namespace Catch diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_string.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers_string.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ed2b1f68c9660abb2e4012bf0f9a74f57b6919d8 --- /dev/null +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_string.hpp @@ -0,0 +1,78 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_MATCHERS_STRING_HPP_INCLUDED +#define CATCH_MATCHERS_STRING_HPP_INCLUDED + +#include <catch2/matchers/catch_matchers.hpp> +#include <catch2/internal/catch_case_sensitive.hpp> +#include <catch2/internal/catch_stringref.hpp> + +#include <string> + +namespace Catch { +namespace Matchers { + + struct CasedString { + CasedString( std::string const& str, CaseSensitive caseSensitivity ); + std::string adjustString( std::string const& str ) const; + StringRef caseSensitivitySuffix() const; + + CaseSensitive 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 StringEqualsMatcher final : StringMatcherBase { + StringEqualsMatcher( CasedString const& comparator ); + bool match( std::string const& source ) const override; + }; + struct StringContainsMatcher final : StringMatcherBase { + StringContainsMatcher( CasedString const& comparator ); + bool match( std::string const& source ) const override; + }; + struct StartsWithMatcher final : StringMatcherBase { + StartsWithMatcher( CasedString const& comparator ); + bool match( std::string const& source ) const override; + }; + struct EndsWithMatcher final : StringMatcherBase { + EndsWithMatcher( CasedString const& comparator ); + bool match( std::string const& source ) const override; + }; + + struct RegexMatcher final : MatcherBase<std::string> { + RegexMatcher( std::string regex, CaseSensitive caseSensitivity ); + bool match( std::string const& matchee ) const override; + std::string describe() const override; + + private: + std::string m_regex; + CaseSensitive m_caseSensitivity; + }; + + //! Creates matcher that accepts strings that are exactly equal to `str` + StringEqualsMatcher Equals( std::string const& str, CaseSensitive caseSensitivity = CaseSensitive::Yes ); + //! Creates matcher that accepts strings that contain `str` + StringContainsMatcher Contains( std::string const& str, CaseSensitive caseSensitivity = CaseSensitive::Yes ); + //! Creates matcher that accepts strings that _end_ with `str` + EndsWithMatcher EndsWith( std::string const& str, CaseSensitive caseSensitivity = CaseSensitive::Yes ); + //! Creates matcher that accepts strings that _start_ with `str` + StartsWithMatcher StartsWith( std::string const& str, CaseSensitive caseSensitivity = CaseSensitive::Yes ); + //! Creates matcher that accepts strings matching `regex` + RegexMatcher Matches( std::string const& regex, CaseSensitive caseSensitivity = CaseSensitive::Yes ); + +} // namespace Matchers +} // namespace Catch + +#endif // CATCH_MATCHERS_STRING_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_templated.cpp b/packages/Catch2/src/catch2/matchers/catch_matchers_templated.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3431bde08d47399cd6ecedbb700615f354f0fbc4 --- /dev/null +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_templated.cpp @@ -0,0 +1,41 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/matchers/catch_matchers_templated.hpp> + +namespace Catch { +namespace Matchers { + MatcherGenericBase::~MatcherGenericBase() = default; + + namespace Detail { + + std::string describe_multi_matcher(StringRef combine, std::string const* descriptions_begin, std::string const* descriptions_end) { + std::string description; + std::size_t combined_size = 4; + for ( auto desc = descriptions_begin; desc != descriptions_end; ++desc ) { + combined_size += desc->size(); + } + combined_size += (descriptions_end - descriptions_begin - 1) * combine.size(); + + description.reserve(combined_size); + + description += "( "; + bool first = true; + for( auto desc = descriptions_begin; desc != descriptions_end; ++desc ) { + if( first ) + first = false; + else + description += combine; + description += *desc; + } + description += " )"; + return description; + } + + } // namespace Detail +} // namespace Matchers +} // namespace Catch diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_templated.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers_templated.hpp new file mode 100644 index 0000000000000000000000000000000000000000..544a2a5bedddedc54f04fb578a4972f6fdd10871 --- /dev/null +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_templated.hpp @@ -0,0 +1,297 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_MATCHERS_TEMPLATED_HPP_INCLUDED +#define CATCH_MATCHERS_TEMPLATED_HPP_INCLUDED + +#include <catch2/matchers/catch_matchers.hpp> +#include <catch2/internal/catch_stringref.hpp> + +#include <array> +#include <algorithm> +#include <string> +#include <type_traits> +#include <utility> + +namespace Catch { +namespace Matchers { + struct MatcherGenericBase : MatcherUntypedBase { + MatcherGenericBase() = default; + virtual ~MatcherGenericBase(); // = default; + + MatcherGenericBase(MatcherGenericBase&) = default; + MatcherGenericBase(MatcherGenericBase&&) = default; + + MatcherGenericBase& operator=(MatcherGenericBase const&) = delete; + MatcherGenericBase& operator=(MatcherGenericBase&&) = delete; + }; + + + namespace Detail { + template<std::size_t N, std::size_t M> + std::array<void const*, N + M> array_cat(std::array<void const*, N> && lhs, std::array<void const*, M> && rhs) { + std::array<void const*, N + M> arr{}; + std::copy_n(lhs.begin(), N, arr.begin()); + std::copy_n(rhs.begin(), M, arr.begin() + N); + return arr; + } + + template<std::size_t N> + std::array<void const*, N+1> array_cat(std::array<void const*, N> && lhs, void const* rhs) { + std::array<void const*, N+1> arr{}; + std::copy_n(lhs.begin(), N, arr.begin()); + arr[N] = rhs; + return arr; + } + + template<std::size_t N> + std::array<void const*, N+1> array_cat(void const* lhs, std::array<void const*, N> && rhs) { + std::array<void const*, N + 1> arr{ {lhs} }; + std::copy_n(rhs.begin(), N, arr.begin() + 1); + return arr; + } + + #ifdef CATCH_CPP17_OR_GREATER + + using std::conjunction; + + #else // CATCH_CPP17_OR_GREATER + + template<typename... Cond> + struct conjunction : std::true_type {}; + + template<typename Cond, typename... Rest> + struct conjunction<Cond, Rest...> : std::integral_constant<bool, Cond::value && conjunction<Rest...>::value> {}; + + #endif // CATCH_CPP17_OR_GREATER + + template<typename T> + using is_generic_matcher = std::is_base_of< + Catch::Matchers::MatcherGenericBase, + std::remove_cv_t<std::remove_reference_t<T>> + >; + + template<typename... Ts> + using are_generic_matchers = conjunction<is_generic_matcher<Ts>...>; + + template<typename T> + using is_matcher = std::is_base_of< + Catch::Matchers::MatcherUntypedBase, + std::remove_cv_t<std::remove_reference_t<T>> + >; + + + template<std::size_t N, typename Arg> + bool match_all_of(Arg&&, std::array<void const*, N> const&, std::index_sequence<>) { + return true; + } + + template<typename T, typename... MatcherTs, std::size_t N, typename Arg, std::size_t Idx, std::size_t... Indices> + bool match_all_of(Arg&& arg, std::array<void const*, N> const& matchers, std::index_sequence<Idx, Indices...>) { + return static_cast<T const*>(matchers[Idx])->match(arg) && match_all_of<MatcherTs...>(arg, matchers, std::index_sequence<Indices...>{}); + } + + + template<std::size_t N, typename Arg> + bool match_any_of(Arg&&, std::array<void const*, N> const&, std::index_sequence<>) { + return false; + } + + template<typename T, typename... MatcherTs, std::size_t N, typename Arg, std::size_t Idx, std::size_t... Indices> + bool match_any_of(Arg&& arg, std::array<void const*, N> const& matchers, std::index_sequence<Idx, Indices...>) { + return static_cast<T const*>(matchers[Idx])->match(arg) || match_any_of<MatcherTs...>(arg, matchers, std::index_sequence<Indices...>{}); + } + + std::string describe_multi_matcher(StringRef combine, std::string const* descriptions_begin, std::string const* descriptions_end); + + template<typename... MatcherTs, std::size_t... Idx> + std::string describe_multi_matcher(StringRef combine, std::array<void const*, sizeof...(MatcherTs)> const& matchers, std::index_sequence<Idx...>) { + std::array<std::string, sizeof...(MatcherTs)> descriptions {{ + static_cast<MatcherTs const*>(matchers[Idx])->toString()... + }}; + + return describe_multi_matcher(combine, descriptions.data(), descriptions.data() + descriptions.size()); + } + + + template<typename... MatcherTs> + struct MatchAllOfGeneric final : MatcherGenericBase { + MatchAllOfGeneric(MatchAllOfGeneric const&) = delete; + MatchAllOfGeneric& operator=(MatchAllOfGeneric const&) = delete; + MatchAllOfGeneric(MatchAllOfGeneric&&) = default; + MatchAllOfGeneric& operator=(MatchAllOfGeneric&&) = default; + + MatchAllOfGeneric(MatcherTs const&... matchers) : m_matchers{ {std::addressof(matchers)...} } {} + explicit MatchAllOfGeneric(std::array<void const*, sizeof...(MatcherTs)> matchers) : m_matchers{matchers} {} + + template<typename Arg> + bool match(Arg&& arg) const { + return match_all_of<MatcherTs...>(arg, m_matchers, std::index_sequence_for<MatcherTs...>{}); + } + + std::string describe() const override { + return describe_multi_matcher<MatcherTs...>(" and "_sr, m_matchers, std::index_sequence_for<MatcherTs...>{}); + } + + std::array<void const*, sizeof...(MatcherTs)> m_matchers; + + //! Avoids type nesting for `GenericAllOf && GenericAllOf` case + template<typename... MatchersRHS> + friend + MatchAllOfGeneric<MatcherTs..., MatchersRHS...> operator && ( + MatchAllOfGeneric<MatcherTs...>&& lhs, + MatchAllOfGeneric<MatchersRHS...>&& rhs) { + return MatchAllOfGeneric<MatcherTs..., MatchersRHS...>{array_cat(std::move(lhs.m_matchers), std::move(rhs.m_matchers))}; + } + + //! Avoids type nesting for `GenericAllOf && some matcher` case + template<typename MatcherRHS> + friend std::enable_if_t<is_matcher<MatcherRHS>::value, + MatchAllOfGeneric<MatcherTs..., MatcherRHS>> operator && ( + MatchAllOfGeneric<MatcherTs...>&& lhs, + MatcherRHS const& rhs) { + return MatchAllOfGeneric<MatcherTs..., MatcherRHS>{array_cat(std::move(lhs.m_matchers), static_cast<void const*>(&rhs))}; + } + + //! Avoids type nesting for `some matcher && GenericAllOf` case + template<typename MatcherLHS> + friend std::enable_if_t<is_matcher<MatcherLHS>::value, + MatchAllOfGeneric<MatcherLHS, MatcherTs...>> operator && ( + MatcherLHS const& lhs, + MatchAllOfGeneric<MatcherTs...>&& rhs) { + return MatchAllOfGeneric<MatcherLHS, MatcherTs...>{array_cat(static_cast<void const*>(std::addressof(lhs)), std::move(rhs.m_matchers))}; + } + }; + + + template<typename... MatcherTs> + struct MatchAnyOfGeneric final : MatcherGenericBase { + MatchAnyOfGeneric(MatchAnyOfGeneric const&) = delete; + MatchAnyOfGeneric& operator=(MatchAnyOfGeneric const&) = delete; + MatchAnyOfGeneric(MatchAnyOfGeneric&&) = default; + MatchAnyOfGeneric& operator=(MatchAnyOfGeneric&&) = default; + + MatchAnyOfGeneric(MatcherTs const&... matchers) : m_matchers{ {std::addressof(matchers)...} } {} + explicit MatchAnyOfGeneric(std::array<void const*, sizeof...(MatcherTs)> matchers) : m_matchers{matchers} {} + + template<typename Arg> + bool match(Arg&& arg) const { + return match_any_of<MatcherTs...>(arg, m_matchers, std::index_sequence_for<MatcherTs...>{}); + } + + std::string describe() const override { + return describe_multi_matcher<MatcherTs...>(" or "_sr, m_matchers, std::index_sequence_for<MatcherTs...>{}); + } + + std::array<void const*, sizeof...(MatcherTs)> m_matchers; + + //! Avoids type nesting for `GenericAnyOf || GenericAnyOf` case + template<typename... MatchersRHS> + friend MatchAnyOfGeneric<MatcherTs..., MatchersRHS...> operator || ( + MatchAnyOfGeneric<MatcherTs...>&& lhs, + MatchAnyOfGeneric<MatchersRHS...>&& rhs) { + return MatchAnyOfGeneric<MatcherTs..., MatchersRHS...>{array_cat(std::move(lhs.m_matchers), std::move(rhs.m_matchers))}; + } + + //! Avoids type nesting for `GenericAnyOf || some matcher` case + template<typename MatcherRHS> + friend std::enable_if_t<is_matcher<MatcherRHS>::value, + MatchAnyOfGeneric<MatcherTs..., MatcherRHS>> operator || ( + MatchAnyOfGeneric<MatcherTs...>&& lhs, + MatcherRHS const& rhs) { + return MatchAnyOfGeneric<MatcherTs..., MatcherRHS>{array_cat(std::move(lhs.m_matchers), static_cast<void const*>(std::addressof(rhs)))}; + } + + //! Avoids type nesting for `some matcher || GenericAnyOf` case + template<typename MatcherLHS> + friend std::enable_if_t<is_matcher<MatcherLHS>::value, + MatchAnyOfGeneric<MatcherLHS, MatcherTs...>> operator || ( + MatcherLHS const& lhs, + MatchAnyOfGeneric<MatcherTs...>&& rhs) { + return MatchAnyOfGeneric<MatcherLHS, MatcherTs...>{array_cat(static_cast<void const*>(std::addressof(lhs)), std::move(rhs.m_matchers))}; + } + }; + + + template<typename MatcherT> + struct MatchNotOfGeneric final : MatcherGenericBase { + MatchNotOfGeneric(MatchNotOfGeneric const&) = delete; + MatchNotOfGeneric& operator=(MatchNotOfGeneric const&) = delete; + MatchNotOfGeneric(MatchNotOfGeneric&&) = default; + MatchNotOfGeneric& operator=(MatchNotOfGeneric&&) = default; + + explicit MatchNotOfGeneric(MatcherT const& matcher) : m_matcher{matcher} {} + + template<typename Arg> + bool match(Arg&& arg) const { + return !m_matcher.match(arg); + } + + std::string describe() const override { + return "not " + m_matcher.toString(); + } + + //! Negating negation can just unwrap and return underlying matcher + friend MatcherT const& operator ! (MatchNotOfGeneric<MatcherT> const& matcher) { + return matcher.m_matcher; + } + private: + MatcherT const& m_matcher; + }; + } // namespace Detail + + + // compose only generic matchers + template<typename MatcherLHS, typename MatcherRHS> + std::enable_if_t<Detail::are_generic_matchers<MatcherLHS, MatcherRHS>::value, Detail::MatchAllOfGeneric<MatcherLHS, MatcherRHS>> + operator && (MatcherLHS const& lhs, MatcherRHS const& rhs) { + return { lhs, rhs }; + } + + template<typename MatcherLHS, typename MatcherRHS> + std::enable_if_t<Detail::are_generic_matchers<MatcherLHS, MatcherRHS>::value, Detail::MatchAnyOfGeneric<MatcherLHS, MatcherRHS>> + operator || (MatcherLHS const& lhs, MatcherRHS const& rhs) { + return { lhs, rhs }; + } + + //! Wrap provided generic matcher in generic negator + template<typename MatcherT> + std::enable_if_t<Detail::is_generic_matcher<MatcherT>::value, Detail::MatchNotOfGeneric<MatcherT>> + operator ! (MatcherT const& matcher) { + return Detail::MatchNotOfGeneric<MatcherT>{matcher}; + } + + + // compose mixed generic and non-generic matchers + template<typename MatcherLHS, typename ArgRHS> + std::enable_if_t<Detail::is_generic_matcher<MatcherLHS>::value, Detail::MatchAllOfGeneric<MatcherLHS, MatcherBase<ArgRHS>>> + operator && (MatcherLHS const& lhs, MatcherBase<ArgRHS> const& rhs) { + return { lhs, rhs }; + } + + template<typename ArgLHS, typename MatcherRHS> + std::enable_if_t<Detail::is_generic_matcher<MatcherRHS>::value, Detail::MatchAllOfGeneric<MatcherBase<ArgLHS>, MatcherRHS>> + operator && (MatcherBase<ArgLHS> const& lhs, MatcherRHS const& rhs) { + return { lhs, rhs }; + } + + template<typename MatcherLHS, typename ArgRHS> + std::enable_if_t<Detail::is_generic_matcher<MatcherLHS>::value, Detail::MatchAnyOfGeneric<MatcherLHS, MatcherBase<ArgRHS>>> + operator || (MatcherLHS const& lhs, MatcherBase<ArgRHS> const& rhs) { + return { lhs, rhs }; + } + + template<typename ArgLHS, typename MatcherRHS> + std::enable_if_t<Detail::is_generic_matcher<MatcherRHS>::value, Detail::MatchAnyOfGeneric<MatcherBase<ArgLHS>, MatcherRHS>> + operator || (MatcherBase<ArgLHS> const& lhs, MatcherRHS const& rhs) { + return { lhs, rhs }; + } + +} // namespace Matchers +} // namespace Catch + +#endif // CATCH_MATCHERS_TEMPLATED_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/matchers/catch_matchers_vector.hpp b/packages/Catch2/src/catch2/matchers/catch_matchers_vector.hpp new file mode 100644 index 0000000000000000000000000000000000000000..00ecbc33d272e366075d3d9bf59c35a8138e545a --- /dev/null +++ b/packages/Catch2/src/catch2/matchers/catch_matchers_vector.hpp @@ -0,0 +1,194 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_MATCHERS_VECTOR_HPP_INCLUDED +#define CATCH_MATCHERS_VECTOR_HPP_INCLUDED + +#include <catch2/matchers/catch_matchers.hpp> +#include <catch2/catch_approx.hpp> + +#include <algorithm> + +namespace Catch { +namespace Matchers { + + template<typename T, typename Alloc> + struct VectorContainsElementMatcher final : MatcherBase<std::vector<T, Alloc>> { + + VectorContainsElementMatcher(T const& comparator): + m_comparator(comparator) + {} + + bool match(std::vector<T, Alloc> 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, typename AllocComp, typename AllocMatch> + struct ContainsMatcher final : MatcherBase<std::vector<T, AllocMatch>> { + + ContainsMatcher(std::vector<T, AllocComp> const& comparator): + m_comparator( comparator ) + {} + + bool match(std::vector<T, AllocMatch> 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, AllocComp> const& m_comparator; + }; + + template<typename T, typename AllocComp, typename AllocMatch> + struct EqualsMatcher final : MatcherBase<std::vector<T, AllocMatch>> { + + EqualsMatcher(std::vector<T, AllocComp> const& comparator): + m_comparator( comparator ) + {} + + bool match(std::vector<T, AllocMatch> 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, AllocComp> const& m_comparator; + }; + + template<typename T, typename AllocComp, typename AllocMatch> + struct ApproxMatcher final : MatcherBase<std::vector<T, AllocMatch>> { + + ApproxMatcher(std::vector<T, AllocComp> const& comparator): + m_comparator( comparator ) + {} + + bool match(std::vector<T, AllocMatch> const& v) const override { + if (m_comparator.size() != v.size()) + return false; + for (std::size_t i = 0; i < v.size(); ++i) + if (m_comparator[i] != approx(v[i])) + return false; + return true; + } + std::string describe() const override { + return "is approx: " + ::Catch::Detail::stringify( m_comparator ); + } + template <typename = std::enable_if_t<std::is_constructible<double, T>::value>> + ApproxMatcher& epsilon( T const& newEpsilon ) { + approx.epsilon(static_cast<double>(newEpsilon)); + return *this; + } + template <typename = std::enable_if_t<std::is_constructible<double, T>::value>> + ApproxMatcher& margin( T const& newMargin ) { + approx.margin(static_cast<double>(newMargin)); + return *this; + } + template <typename = std::enable_if_t<std::is_constructible<double, T>::value>> + ApproxMatcher& scale( T const& newScale ) { + approx.scale(static_cast<double>(newScale)); + return *this; + } + + std::vector<T, AllocComp> const& m_comparator; + mutable Catch::Approx approx = Catch::Approx::custom(); + }; + + template<typename T, typename AllocComp, typename AllocMatch> + struct UnorderedEqualsMatcher final : MatcherBase<std::vector<T, AllocMatch>> { + UnorderedEqualsMatcher(std::vector<T, AllocComp> const& target): + m_target(target) + {} + bool match(std::vector<T, AllocMatch> const& vec) const override { + if (m_target.size() != vec.size()) { + return false; + } + return std::is_permutation(m_target.begin(), m_target.end(), vec.begin()); + } + + std::string describe() const override { + return "UnorderedEquals: " + ::Catch::Detail::stringify(m_target); + } + private: + std::vector<T, AllocComp> const& m_target; + }; + + + // The following functions create the actual matcher objects. + // This allows the types to be inferred + + + //! Creates a matcher that matches vectors that contain all elements in `comparator` + template<typename T, typename AllocComp = std::allocator<T>, typename AllocMatch = AllocComp> + ContainsMatcher<T, AllocComp, AllocMatch> Contains( std::vector<T, AllocComp> const& comparator ) { + return ContainsMatcher<T, AllocComp, AllocMatch>(comparator); + } + + //! Creates a matcher that matches vectors that contain `comparator` as an element + template<typename T, typename Alloc = std::allocator<T>> + VectorContainsElementMatcher<T, Alloc> VectorContains( T const& comparator ) { + return VectorContainsElementMatcher<T, Alloc>(comparator); + } + + //! Creates a matcher that matches vectors that are exactly equal to `comparator` + template<typename T, typename AllocComp = std::allocator<T>, typename AllocMatch = AllocComp> + EqualsMatcher<T, AllocComp, AllocMatch> Equals( std::vector<T, AllocComp> const& comparator ) { + return EqualsMatcher<T, AllocComp, AllocMatch>(comparator); + } + + //! Creates a matcher that matches vectors that `comparator` as an element + template<typename T, typename AllocComp = std::allocator<T>, typename AllocMatch = AllocComp> + ApproxMatcher<T, AllocComp, AllocMatch> Approx( std::vector<T, AllocComp> const& comparator ) { + return ApproxMatcher<T, AllocComp, AllocMatch>(comparator); + } + + //! Creates a matcher that matches vectors that is equal to `target` modulo permutation + template<typename T, typename AllocComp = std::allocator<T>, typename AllocMatch = AllocComp> + UnorderedEqualsMatcher<T, AllocComp, AllocMatch> UnorderedEquals(std::vector<T, AllocComp> const& target) { + return UnorderedEqualsMatcher<T, AllocComp, AllocMatch>(target); + } + +} // namespace Matchers +} // namespace Catch + +#endif // CATCH_MATCHERS_VECTOR_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/matchers/internal/catch_matchers_combined_tu.cpp b/packages/Catch2/src/catch2/matchers/internal/catch_matchers_combined_tu.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7104e4c8412f84256c51480e9f211f921c5722c7 --- /dev/null +++ b/packages/Catch2/src/catch2/matchers/internal/catch_matchers_combined_tu.cpp @@ -0,0 +1,134 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +/** \file + * This is a special TU that combines what would otherwise be a very + * small matcher-related TUs into one bigger TU. + * + * The reason for this is compilation performance improvements by + * avoiding reparsing headers for many small TUs, instead having this + * one TU include bit more, but having it all parsed only once. + * + * To avoid heavy-tail problem with compilation times, each "subpart" + * of Catch2 has its own combined TU like this. + */ + +////////////////////////////////////////////// +// vvv formerly catch_matchers_impl.cpp vvv // +////////////////////////////////////////////// +#include <catch2/matchers/internal/catch_matchers_impl.hpp> +#include <catch2/matchers/catch_matchers.hpp> +#include <catch2/interfaces/catch_interfaces_registry_hub.hpp> + +namespace Catch { + + // This is the general overload that takes a any string matcher + // There is another overload, in catch_assertionhandler.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 const& matcherString ) { + std::string exceptionMessage = Catch::translateActiveException(); + MatchExpr<std::string, StringMatcher const&> expr( std::move(exceptionMessage), matcher, matcherString ); + handler.handleExpr( expr ); + } + +} // namespace Catch + + +////////////////////////////////////////////////////////////// +// vvv formerly catch_matchers_container_properties.cpp vvv // +////////////////////////////////////////////////////////////// +#include <catch2/matchers/catch_matchers_container_properties.hpp> +#include <catch2/internal/catch_stream.hpp> + +namespace Catch { +namespace Matchers { + + std::string IsEmptyMatcher::describe() const { + return "is empty"; + } + + std::string HasSizeMatcher::describe() const { + ReusableStringStream sstr; + sstr << "has size == " << m_target_size; + return sstr.str(); + } + + IsEmptyMatcher IsEmpty() { + return {}; + } + + HasSizeMatcher SizeIs(std::size_t sz) { + return HasSizeMatcher{ sz }; + } + +} // end namespace Matchers +} // end namespace Catch + + + +///////////////////////////////////////// +// vvv formerly catch_matchers.cpp vvv // +///////////////////////////////////////// + +#include <catch2/matchers/catch_matchers.hpp> + +namespace Catch { +namespace Matchers { + + std::string MatcherUntypedBase::toString() const { + if (m_cachedToString.empty()) { + m_cachedToString = describe(); + } + return m_cachedToString; + } + + MatcherUntypedBase::~MatcherUntypedBase() = default; + +} // namespace Matchers +} // namespace Catch + + + +/////////////////////////////////////////////////// +// vvv formerly catch_matchers_predicate.cpp vvv // +/////////////////////////////////////////////////// +#include <catch2/matchers/catch_matchers_predicate.hpp> + +std::string Catch::Matchers::Detail::finalizeDescription(const std::string& desc) { + if (desc.empty()) { + return "matches undescribed predicate"; + } else { + return "matches predicate: \"" + desc + '"'; + } +} + + + + + +/////////////////////////////////////////////////// +// vvv formerly catch_matchers_exception.cpp vvv // +/////////////////////////////////////////////////// +#include <catch2/matchers/catch_matchers_exception.hpp> + +namespace Catch { +namespace Matchers { + +bool ExceptionMessageMatcher::match(std::exception const& ex) const { + return ex.what() == m_message; +} + +std::string ExceptionMessageMatcher::describe() const { + return "exception message matches \"" + m_message + "\""; +} + +ExceptionMessageMatcher Message(std::string const& message) { + return ExceptionMessageMatcher(message); +} + +} // namespace Matchers +} // namespace Catch diff --git a/packages/Catch2/src/catch2/matchers/internal/catch_matchers_impl.hpp b/packages/Catch2/src/catch2/matchers/internal/catch_matchers_impl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5a5448da560ede59b8fec946c9bdda58c3bbe53f --- /dev/null +++ b/packages/Catch2/src/catch2/matchers/internal/catch_matchers_impl.hpp @@ -0,0 +1,88 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_MATCHERS_IMPL_HPP_INCLUDED +#define CATCH_MATCHERS_IMPL_HPP_INCLUDED + +#include <catch2/internal/catch_test_macro_impl.hpp> +#include <catch2/internal/catch_stringref.hpp> + +namespace Catch { + + template<typename ArgT, typename MatcherT> + class MatchExpr : public ITransientExpression { + ArgT && m_arg; + MatcherT const& m_matcher; + StringRef m_matcherString; + public: + MatchExpr( ArgT && arg, MatcherT const& matcher, StringRef const& matcherString ) + : ITransientExpression{ true, matcher.match( arg ) }, // not forwarding arg here on purpose + m_arg( std::forward<ArgT>(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; + } + }; + + namespace Matchers { + template <typename ArgT> + struct MatcherBase; + } + + using StringMatcher = Matchers::MatcherBase<std::string>; + + void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef const& matcherString ); + + template<typename ArgT, typename MatcherT> + auto makeMatchExpr( ArgT && arg, MatcherT const& matcher, StringRef const& matcherString ) -> MatchExpr<ArgT, MatcherT> { + return MatchExpr<ArgT, MatcherT>( std::forward<ArgT>(arg), matcher, matcherString ); + } + +} // namespace Catch + + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CHECK_THAT( macroName, matcher, resultDisposition, arg ) \ + do { \ + Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(arg) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \ + INTERNAL_CATCH_TRY { \ + catchAssertionHandler.handleExpr( Catch::makeMatchExpr( arg, matcher, #matcher##_catch_sr ) ); \ + } 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_sr, 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_sr ) ); \ + } \ + catch( ... ) { \ + catchAssertionHandler.handleUnexpectedInflightException(); \ + } \ + else \ + catchAssertionHandler.handleThrowingCallSkipped(); \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( false ) + + +#endif // CATCH_MATCHERS_IMPL_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_automake.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_automake.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ec11f605f9fcf6a2ce2ad9154a82213de699a9be --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_automake.cpp @@ -0,0 +1,35 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/reporters/catch_reporter_automake.hpp> +#include <catch2/catch_test_case_info.hpp> + +#include <ostream> + +namespace Catch { + + AutomakeReporter::~AutomakeReporter() {} + + void AutomakeReporter::testCaseEnded(TestCaseStats const& _testCaseStats) { + // 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 AutomakeReporter::skipTest(TestCaseInfo const& testInfo) { + stream << ":test-result: SKIP " << testInfo.name << '\n'; + } + +} // end namespace Catch diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_automake.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_automake.hpp new file mode 100644 index 0000000000000000000000000000000000000000..209729c11b22f2502df4b98e54cf5540300cc95d --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_automake.hpp @@ -0,0 +1,39 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED +#define CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED + +#include <catch2/reporters/catch_reporter_streaming_base.hpp> + +namespace Catch { + + struct AutomakeReporter : StreamingReporterBase { + AutomakeReporter( ReporterConfig const& _config ) + : StreamingReporterBase( _config ) + {} + + ~AutomakeReporter() override; + + static std::string getDescription() { + using namespace std::string_literals; + return "Reports test results in the format of Automake .trs files"s; + } + + void assertionStarting( AssertionInfo const& ) override {} + + bool assertionEnded( AssertionStats const& /*_assertionStats*/ ) override { return true; } + + void testCaseEnded(TestCaseStats const& _testCaseStats) override; + + void skipTest(TestCaseInfo const& testInfo) override; + + }; + +} // end namespace Catch + +#endif // CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_combined_tu.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_combined_tu.cpp new file mode 100644 index 0000000000000000000000000000000000000000..25a52e9dacd2327767b3ed3b00c06a02e2694e4e --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_combined_tu.cpp @@ -0,0 +1,239 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +/** \file + * This is a special TU that combines what would otherwise be a very + * small reporter-related TUs into one bigger TU. + * + * The reason for this is compilation performance improvements by + * avoiding reparsing headers for many small TUs, instead having this + * one TU include bit more, but having it all parsed only once. + * + * To avoid heavy-tail problem with compilation times, each "subpart" + * of Catch2 has its own combined TU like this. + */ + +#include <catch2/reporters/catch_reporter_helpers.hpp> +#include <catch2/interfaces/catch_interfaces_config.hpp> +#include <catch2/internal/catch_console_width.hpp> +#include <catch2/internal/catch_errno_guard.hpp> +#include <catch2/internal/catch_textflow.hpp> +#include <catch2/internal/catch_stream.hpp> +#include <catch2/internal/catch_string_manip.hpp> +#include <catch2/internal/catch_console_colour.hpp> +#include <catch2/catch_tostring.hpp> +#include <catch2/catch_test_case_info.hpp> + +#include <algorithm> +#include <cfloat> +#include <cstdio> +#include <ostream> +#include <iomanip> + +namespace Catch { + + namespace { + void listTestNamesOnly(std::ostream& out, + std::vector<TestCaseHandle> const& tests) { + for (auto const& test : tests) { + auto const& testCaseInfo = test.getTestCaseInfo(); + + if (startsWith(testCaseInfo.name, '#')) { + out << '"' << testCaseInfo.name << '"'; + } else { + out << testCaseInfo.name; + } + + out << '\n'; + } + out << std::flush; + } + } // end unnamed namespace + + + // 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 + std::snprintf( buffer, maxDoubleSize, "%.3f", duration ); +#endif + return std::string( buffer ); + } + + bool shouldShowDuration( IConfig const& config, double duration ) { + if ( config.showDurations() == ShowDurations::Always ) { + return true; + } + if ( config.showDurations() == ShowDurations::Never ) { + return false; + } + const double min = config.minDuration(); + return min >= 0 && duration >= min; + } + + std::string serializeFilters( std::vector<std::string> const& filters ) { + // We add a ' ' separator between each filter + size_t serialized_size = filters.size() - 1; + for (auto const& filter : filters) { + serialized_size += filter.size(); + } + + std::string serialized; + serialized.reserve(serialized_size); + bool first = true; + + for (auto const& filter : filters) { + if (!first) { + serialized.push_back(' '); + } + first = false; + serialized.append(filter); + } + + return serialized; + } + + std::ostream& operator<<( std::ostream& out, lineOfChars value ) { + for ( size_t idx = 0; idx < CATCH_CONFIG_CONSOLE_WIDTH - 1; ++idx ) { + out.put( value.c ); + } + return out; + } + + void + defaultListReporters( std::ostream& out, + std::vector<ReporterDescription> const& descriptions, + Verbosity verbosity ) { + out << "Available reporters:\n"; + const auto maxNameLen = + std::max_element( descriptions.begin(), + descriptions.end(), + []( ReporterDescription const& lhs, + ReporterDescription const& rhs ) { + return lhs.name.size() < rhs.name.size(); + } ) + ->name.size(); + + for ( auto const& desc : descriptions ) { + if ( verbosity == Verbosity::Quiet ) { + out << TextFlow::Column( desc.name ) + .indent( 2 ) + .width( 5 + maxNameLen ) + << '\n'; + } else { + out << TextFlow::Column( desc.name + ":" ) + .indent( 2 ) + .width( 5 + maxNameLen ) + + TextFlow::Column( desc.description ) + .initialIndent( 0 ) + .indent( 2 ) + .width( CATCH_CONFIG_CONSOLE_WIDTH - maxNameLen - 8 ) + << '\n'; + } + } + out << '\n' << std::flush; + } + + void defaultListTags( std::ostream& out, + std::vector<TagInfo> const& tags, + bool isFiltered ) { + if ( isFiltered ) { + out << "Tags for matching test cases:\n"; + } else { + out << "All available tags:\n"; + } + + for ( auto const& tagCount : tags ) { + ReusableStringStream rss; + rss << " " << std::setw( 2 ) << tagCount.count << " "; + auto str = rss.str(); + auto wrapper = TextFlow::Column( tagCount.all() ) + .initialIndent( 0 ) + .indent( str.size() ) + .width( CATCH_CONFIG_CONSOLE_WIDTH - 10 ); + out << str << wrapper << '\n'; + } + out << pluralise( tags.size(), "tag" ) << '\n' << std::endl; + } + + void defaultListTests(std::ostream& out, std::vector<TestCaseHandle> const& tests, bool isFiltered, Verbosity verbosity) { + // We special case this to provide the equivalent of old + // `--list-test-names-only`, which could then be used by the + // `--input-file` option. + if (verbosity == Verbosity::Quiet) { + listTestNamesOnly(out, tests); + return; + } + + if (isFiltered) { + out << "Matching test cases:\n"; + } else { + out << "All available test cases:\n"; + } + + for (auto const& test : tests) { + auto const& testCaseInfo = test.getTestCaseInfo(); + Colour::Code colour = testCaseInfo.isHidden() + ? Colour::SecondaryText + : Colour::None; + Colour colourGuard(colour); + + out << TextFlow::Column(testCaseInfo.name).initialIndent(2).indent(4) << '\n'; + if (verbosity >= Verbosity::High) { + out << TextFlow::Column(Catch::Detail::stringify(testCaseInfo.lineInfo)).indent(4) << std::endl; + } + if (!testCaseInfo.tags.empty() && + verbosity > Verbosity::Quiet) { + out << TextFlow::Column(testCaseInfo.tagsAsString()).indent(6) << '\n'; + } + } + + if (isFiltered) { + out << pluralise(tests.size(), "matching test case") << '\n' << std::endl; + } else { + out << pluralise(tests.size(), "test case") << '\n' << std::endl; + } + } + +} // namespace Catch + + +#include <catch2/reporters/catch_reporter_event_listener.hpp> + +namespace Catch { + void EventListenerBase::assertionStarting( AssertionInfo const& ) {} + + bool EventListenerBase::assertionEnded( AssertionStats const& ) { + return false; + } + void EventListenerBase::listReporters( + std::vector<ReporterDescription> const& ) {} + void EventListenerBase::listTests( std::vector<TestCaseHandle> const& ) {} + void EventListenerBase::listTags( std::vector<TagInfo> const& ) {} + void EventListenerBase::noMatchingTestCases( std::string const& ) {} + void EventListenerBase::testRunStarting( TestRunInfo const& ) {} + void EventListenerBase::testGroupStarting( GroupInfo const& ) {} + void EventListenerBase::testCaseStarting( TestCaseInfo const& ) {} + void EventListenerBase::sectionStarting( SectionInfo const& ) {} + void EventListenerBase::sectionEnded( SectionStats const& ) {} + void EventListenerBase::testCaseEnded( TestCaseStats const& ) {} + void EventListenerBase::testGroupEnded( TestGroupStats const& ) {} + void EventListenerBase::testRunEnded( TestRunStats const& ) {} + void EventListenerBase::skipTest( TestCaseInfo const& ) {} +} // namespace Catch diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_compact.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_compact.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d59cb5a5c72ea4881c22a7ce18d609b9765fee6b --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_compact.cpp @@ -0,0 +1,301 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/reporters/catch_reporter_compact.hpp> + +#include <catch2/reporters/catch_reporter_helpers.hpp> +#include <catch2/interfaces/catch_interfaces_config.hpp> +#include <catch2/internal/catch_platform.hpp> +#include <catch2/internal/catch_console_colour.hpp> +#include <catch2/internal/catch_string_manip.hpp> +#include <catch2/internal/catch_stringref.hpp> + +#include <ostream> + +namespace { + + // Colour::LightGrey + Catch::Colour::Code dimColour() { return Catch::Colour::FileName; } + + Catch::StringRef bothOrAll( std::size_t count ) { + switch (count) { + case 1: + return Catch::StringRef{}; + case 2: + return "both "_catch_sr; + default: + return "all "_catch_sr; + } + } + +} // anon namespace + + +namespace Catch { +namespace { + +#ifdef CATCH_PLATFORM_MAC + static constexpr Catch::StringRef compactFailedString = "FAILED"_sr; + static constexpr Catch::StringRef compactPassedString = "PASSED"_sr; +#else + static constexpr Catch::StringRef compactFailedString = "failed"_sr; + static constexpr Catch::StringRef compactPassedString = "passed"_sr; +#endif + +// 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 StringRef qualify_assertions_failed = + totals.assertions.failed == totals.assertions.total() ? + bothOrAll(totals.assertions.failed) : StringRef{}; + 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, compactPassedString); + printOriginalExpression(); + printReconstructedExpression(); + if (!result.hasExpression()) + printRemainingMessages(Colour::None); + else + printRemainingMessages(); + break; + case ResultWas::ExpressionFailed: + if (result.isOk()) + printResultType(Colour::ResultSuccess, compactFailedString + " - but was ok"_sr); + else + printResultType(Colour::Error, compactFailedString); + printOriginalExpression(); + printReconstructedExpression(); + printRemainingMessages(); + break; + case ResultWas::ThrewException: + printResultType(Colour::Error, compactFailedString); + printIssue("unexpected exception with message:"); + printMessage(); + printExpressionWas(); + printRemainingMessages(); + break; + case ResultWas::FatalErrorCondition: + printResultType(Colour::Error, compactFailedString); + printIssue("fatal error condition with message:"); + printMessage(); + printExpressionWas(); + printRemainingMessages(); + break; + case ResultWas::DidntThrowException: + printResultType(Colour::Error, compactFailedString); + printIssue("expected exception, got none"); + printExpressionWas(); + printRemainingMessages(); + break; + case ResultWas::Info: + printResultType(Colour::None, "info"_sr); + printMessage(); + printRemainingMessages(); + break; + case ResultWas::Warning: + printResultType(Colour::None, "warning"_sr); + printMessage(); + printRemainingMessages(); + break; + case ResultWas::ExplicitFailure: + printResultType(Colour::Error, compactFailedString); + 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, StringRef passOrFail) const { + if (!passOrFail.empty()) { + { + Colour colourGuard(colour); + stream << ' ' << passOrFail; + } + stream << ':'; + } + } + + void printIssue(char 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; + + const auto itEnd = messages.cend(); + const auto N = static_cast<std::size_t>(std::distance(itMessage, itEnd)); + + { + Colour colourGuard(colour); + stream << " with " << pluralise(N, "message") << ':'; + } + + while (itMessage != itEnd) { + // If this assertion is a warning ignore any INFO messages + if (printInfoMessages || itMessage->type != ResultWas::Info) { + printMessage(); + if (itMessage != itEnd) { + Colour colourGuard(dimColour()); + stream << " and"; + } + continue; + } + ++itMessage; + } + } + +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"; + } + + 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) { + double dur = _sectionStats.durationInSeconds; + if ( shouldShowDuration( *m_config, dur ) ) { + stream << getFormattedDuration( dur ) << " 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() {} + +} // end namespace Catch diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_compact.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_compact.hpp new file mode 100644 index 0000000000000000000000000000000000000000..15f9531759d603f4ce30cdcad0ac539928f383fc --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_compact.hpp @@ -0,0 +1,39 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_REPORTER_COMPACT_HPP_INCLUDED +#define CATCH_REPORTER_COMPACT_HPP_INCLUDED + + +#include <catch2/reporters/catch_reporter_streaming_base.hpp> + + +namespace Catch { + + struct CompactReporter : StreamingReporterBase { + + using StreamingReporterBase::StreamingReporterBase; + + ~CompactReporter() override; + + static std::string getDescription(); + + 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 // CATCH_REPORTER_COMPACT_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_console.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_console.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e89702142251584c1b00b2a2b382aa9351e392d9 --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_console.cpp @@ -0,0 +1,702 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/reporters/catch_reporter_console.hpp> + +#include <catch2/interfaces/catch_interfaces_config.hpp> +#include <catch2/catch_test_spec.hpp> +#include <catch2/internal/catch_console_colour.hpp> +#include <catch2/internal/catch_string_manip.hpp> +#include <catch2/catch_version.hpp> +#include <catch2/internal/catch_textflow.hpp> +#include <catch2/internal/catch_stream.hpp> +#include <catch2/internal/catch_stringref.hpp> +#include <catch2/catch_test_case_info.hpp> +#include <catch2/internal/catch_console_width.hpp> +#include <catch2/reporters/catch_reporter_helpers.hpp> + +#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 + +#if defined(__clang__) +# pragma clang diagnostic push +// For simplicity, benchmarking-only helpers are always enabled +# pragma clang diagnostic ignored "-Wunused-function" +#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) { + 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 << TextFlow::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 << TextFlow::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; +} + +enum class Justification { Left, Right }; + +struct ColumnInfo { + 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; + + double m_inNanoseconds; + Unit m_units; + +public: + explicit Duration(double 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 m_inNanoseconds; + } + } + StringRef unitsAsString() const { + switch (m_units) { + case Unit::Nanoseconds: + return "ns"_sr; + case Unit::Microseconds: + return "us"_sr; + case Unit::Milliseconds: + return "ms"_sr; + case Unit::Seconds: + return "s"_sr; + case Unit::Minutes: + return "m"_sr; + default: + return "** internal error **"_sr; + } + + } + 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; + ReusableStringStream 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(); + + TextFlow::Columns headerCols; + auto spacer = TextFlow::Spacer(2); + for (auto const& info : m_columnInfos) { + headerCols += TextFlow::Column(info.name).width(static_cast<std::size_t>(info.width - 2)); + headerCols += spacer; + } + m_os << headerCols << '\n'; + + m_os << lineOfChars('-') << '\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(); + const auto strSize = colStr.size(); + 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 + 1 < static_cast<std::size_t>(colInfo.width)) + ? std::string(colInfo.width - (strSize + 1), ' ') + : std::string(); + if (colInfo.justification == Justification::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(), + [&config]() -> std::vector<ColumnInfo> { + if (config.fullConfig()->benchmarkNoAnalysis()) + { + return{ + { "benchmark name", CATCH_CONFIG_CONSOLE_WIDTH - 43, Justification::Left }, + { " samples", 14, Justification::Right }, + { " iterations", 14, Justification::Right }, + { " mean", 14, Justification::Right } + }; + } + else + { + return{ + { "benchmark name", CATCH_CONFIG_CONSOLE_WIDTH - 43, Justification::Left }, + { "samples mean std dev", 14, Justification::Right }, + { "iterations low mean low std dev", 14, Justification::Right }, + { "estimated high mean high std dev", 14, Justification::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::reportInvalidArguments(std::string const&arg){ + stream << "Invalid Filter: " << arg << 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_tablePrinter->close(); + 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; + } + double dur = _sectionStats.durationInSeconds; + if (shouldShowDuration(*m_config, dur)) { + stream << getFormattedDuration(dur) << " s: " << _sectionStats.sectionInfo.name << std::endl; + } + if (m_headerPrinted) { + m_headerPrinted = false; + } + StreamingReporterBase::sectionEnded(_sectionStats); +} + +void ConsoleReporter::benchmarkPreparing(std::string const& name) { + lazyPrintWithoutClosingBenchmarkTable(); + + auto nameCol = TextFlow::Column(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::benchmarkStarting(BenchmarkInfo const& info) { + (*m_tablePrinter) << info.samples << ColumnBreak() + << info.iterations << ColumnBreak(); + if (!m_config->benchmarkNoAnalysis()) + (*m_tablePrinter) << Duration(info.estimatedDuration) << ColumnBreak(); +} +void ConsoleReporter::benchmarkEnded(BenchmarkStats<> const& stats) { + if (m_config->benchmarkNoAnalysis()) + { + (*m_tablePrinter) << Duration(stats.mean.point.count()) << ColumnBreak(); + } + else + { + (*m_tablePrinter) << ColumnBreak() + << Duration(stats.mean.point.count()) << ColumnBreak() + << Duration(stats.mean.lower_bound.count()) << ColumnBreak() + << Duration(stats.mean.upper_bound.count()) << ColumnBreak() << ColumnBreak() + << Duration(stats.standardDeviation.point.count()) << ColumnBreak() + << Duration(stats.standardDeviation.lower_bound.count()) << ColumnBreak() + << Duration(stats.standardDeviation.upper_bound.count()) << ColumnBreak() << ColumnBreak() << ColumnBreak() << ColumnBreak() << ColumnBreak(); + } +} + +void ConsoleReporter::benchmarkFailed(std::string const& error) { + Colour colour(Colour::Red); + (*m_tablePrinter) + << "Benchmark failed (" << error << ')' + << ColumnBreak() << RowBreak(); +} + +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::testRunStarting(TestRunInfo const& _testInfo) { + StreamingReporterBase::testRunStarting(_testInfo); + printTestFilters(); +} + +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' << lineOfChars('~') << '\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; + + + stream << lineOfChars('-') << '\n'; + Colour colourGuard(Colour::FileName); + stream << lineInfo << '\n'; + stream << lineOfChars('.') << '\n' << std::endl; +} + +void ConsoleReporter::printClosedHeader(std::string const& _name) { + printOpenHeader(_name); + stream << lineOfChars('.') << '\n'; +} +void ConsoleReporter::printOpenHeader(std::string const& _name) { + stream << lineOfChars('-') << '\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 << TextFlow::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 << lineOfChars('-') << '\n'; +} + +void ConsoleReporter::printTestFilters() { + if (m_config->testSpec().hasFilters()) { + Colour guard(Colour::BrightYellow); + stream << "Filters: " << serializeFilters(m_config->getTestsOrTags()) << '\n'; + } +} + +} // end namespace Catch + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_console.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_console.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e446d8cc385f12de5517550155121ecb8cbc0c4e --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_console.hpp @@ -0,0 +1,88 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_REPORTER_CONSOLE_HPP_INCLUDED +#define CATCH_REPORTER_CONSOLE_HPP_INCLUDED + +#include <catch2/reporters/catch_reporter_streaming_base.hpp> +#include <catch2/internal/catch_unique_ptr.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 { + Detail::unique_ptr<TablePrinter> m_tablePrinter; + + ConsoleReporter(ReporterConfig const& config); + ~ConsoleReporter() override; + static std::string getDescription(); + + void noMatchingTestCases(std::string const& spec) override; + + void reportInvalidArguments(std::string const&arg) 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 benchmarkPreparing(std::string const& name) override; + void benchmarkStarting(BenchmarkInfo const& info) override; + void benchmarkEnded(BenchmarkStats<> const& stats) override; + void benchmarkFailed(std::string const& error) override; + + void testCaseEnded(TestCaseStats const& _testCaseStats) override; + void testGroupEnded(TestGroupStats const& _testGroupStats) override; + void testRunEnded(TestRunStats const& _testRunStats) override; + void testRunStarting(TestRunInfo const& _testRunInfo) 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(); + void printTestFilters(); + + private: + bool m_headerPrinted = false; + }; + +} // end namespace Catch + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif + +#endif // CATCH_REPORTER_CONSOLE_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_cumulative_base.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_cumulative_base.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a83a9ad0abd55b89373766327b77a96732aa593a --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_cumulative_base.cpp @@ -0,0 +1,129 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/reporters/catch_reporter_cumulative_base.hpp> +#include <catch2/reporters/catch_reporter_helpers.hpp> + +#include <algorithm> +#include <cassert> + +namespace Catch { + namespace { + struct BySectionInfo { + BySectionInfo( SectionInfo const& other ): m_other( other ) {} + BySectionInfo( BySectionInfo const& other ): + m_other( other.m_other ) {} + bool operator()( + Detail::unique_ptr<CumulativeReporterBase::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; + }; + + } // namespace + + + CumulativeReporterBase::~CumulativeReporterBase() = default; + + void + CumulativeReporterBase::sectionStarting( SectionInfo const& sectionInfo ) { + SectionStats incompleteStats( sectionInfo, Counts(), 0, false ); + SectionNode* node; + if ( m_sectionStack.empty() ) { + if ( !m_rootSection ) { + m_rootSection = + Detail::make_unique<SectionNode>( incompleteStats ); + } + node = m_rootSection.get(); + } else { + SectionNode& parentNode = *m_sectionStack.back(); + auto it = std::find_if( parentNode.childSections.begin(), + parentNode.childSections.end(), + BySectionInfo( sectionInfo ) ); + if ( it == parentNode.childSections.end() ) { + auto newNode = + Detail::make_unique<SectionNode>( incompleteStats ); + node = newNode.get(); + parentNode.childSections.push_back( std::move( newNode ) ); + } else { + node = it->get(); + } + } + + m_deepestSection = node; + m_sectionStack.push_back( node ); + } + + bool CumulativeReporterBase::assertionEnded( + AssertionStats const& assertionStats ) { + 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. + static_cast<void>( + assertionStats.assertionResult.getExpandedExpression() ); + SectionNode& sectionNode = *m_sectionStack.back(); + sectionNode.assertions.push_back( assertionStats ); + return true; + } + + void CumulativeReporterBase::sectionEnded( SectionStats const& sectionStats ) { + assert( !m_sectionStack.empty() ); + SectionNode& node = *m_sectionStack.back(); + node.stats = sectionStats; + m_sectionStack.pop_back(); + } + + void CumulativeReporterBase::testCaseEnded( + TestCaseStats const& testCaseStats ) { + auto node = Detail::make_unique<TestCaseNode>( testCaseStats ); + assert( m_sectionStack.size() == 0 ); + node->children.push_back( std::move(m_rootSection) ); + m_testCases.push_back( std::move(node) ); + + assert( m_deepestSection ); + m_deepestSection->stdOut = testCaseStats.stdOut; + m_deepestSection->stdErr = testCaseStats.stdErr; + } + + void CumulativeReporterBase::testGroupEnded( + TestGroupStats const& testGroupStats ) { + auto node = Detail::make_unique<TestGroupNode>( testGroupStats ); + node->children.swap( m_testCases ); + m_testGroups.push_back( std::move(node) ); + } + + void CumulativeReporterBase::testRunEnded( TestRunStats const& testRunStats ) { + m_testRuns.emplace_back( testRunStats ); + m_testRuns.back().children.swap( m_testGroups ); + testRunEndedCumulative(); + } + + void CumulativeReporterBase::listReporters(std::vector<ReporterDescription> const& descriptions) { + defaultListReporters(stream, descriptions, m_config->verbosity()); + } + + void CumulativeReporterBase::listTests(std::vector<TestCaseHandle> const& tests) { + defaultListTests(stream, + tests, + m_config->hasTestFilters(), + m_config->verbosity()); + } + + void CumulativeReporterBase::listTags(std::vector<TagInfo> const& tags) { + defaultListTags( stream, tags, m_config->hasTestFilters() ); + } + +} // end namespace Catch diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_cumulative_base.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_cumulative_base.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2820e9f6223022850513bc199254dc7110523a1a --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_cumulative_base.hpp @@ -0,0 +1,92 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_REPORTER_CUMULATIVE_BASE_HPP_INCLUDED +#define CATCH_REPORTER_CUMULATIVE_BASE_HPP_INCLUDED + +#include <catch2/interfaces/catch_interfaces_reporter.hpp> +#include <catch2/internal/catch_unique_ptr.hpp> + +#include <iosfwd> +#include <string> +#include <vector> + +namespace Catch { + + struct CumulativeReporterBase : IStreamingReporter { + template<typename T, typename ChildNodeT> + struct Node { + explicit Node( T const& _value ) : value( _value ) {} + + using ChildNodes = std::vector<Detail::unique_ptr<ChildNodeT>>; + T value; + ChildNodes children; + }; + struct SectionNode { + explicit SectionNode(SectionStats const& _stats) : stats(_stats) {} + + bool operator == (SectionNode const& other) const { + return stats.sectionInfo.lineInfo == other.stats.sectionInfo.lineInfo; + } + + SectionStats stats; + std::vector<Detail::unique_ptr<SectionNode>> childSections; + std::vector<AssertionStats> assertions; + std::string stdOut; + std::string stdErr; + }; + + + using TestCaseNode = Node<TestCaseStats, SectionNode>; + using TestGroupNode = Node<TestGroupStats, TestCaseNode>; + using TestRunNode = Node<TestRunStats, TestGroupNode>; + + CumulativeReporterBase( ReporterConfig const& _config ): + IStreamingReporter( _config.fullConfig() ), + stream( _config.stream() ) {} + ~CumulativeReporterBase() override; + + void testRunStarting( TestRunInfo const& ) override {} + void testGroupStarting( GroupInfo const& ) override {} + + void testCaseStarting( TestCaseInfo const& ) 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; + //! Customization point: called after last test finishes (testRunEnded has been handled) + virtual void testRunEndedCumulative() = 0; + + void skipTest(TestCaseInfo const&) override {} + + void listReporters( std::vector<ReporterDescription> const& descriptions ) override; + void listTests( std::vector<TestCaseHandle> const& tests ) override; + void listTags( std::vector<TagInfo> const& tags ) override; + + + std::ostream& stream; + // Note: We rely on pointer identity being stable, which is why + // which is why we store around pointers rather than values. + std::vector<Detail::unique_ptr<TestCaseNode>> m_testCases; + std::vector<Detail::unique_ptr<TestGroupNode>> m_testGroups; + + std::vector<TestRunNode> m_testRuns; + + Detail::unique_ptr<SectionNode> m_rootSection; + SectionNode* m_deepestSection = nullptr; + std::vector<SectionNode*> m_sectionStack; + }; + +} // end namespace Catch + +#endif // CATCH_REPORTER_CUMULATIVE_BASE_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_event_listener.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_event_listener.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ee65eebdfae30d4863315872d88e01488f59c715 --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_event_listener.hpp @@ -0,0 +1,49 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_REPORTER_EVENT_LISTENER_HPP_INCLUDED +#define CATCH_REPORTER_EVENT_LISTENER_HPP_INCLUDED + +#include <catch2/interfaces/catch_interfaces_reporter.hpp> + +namespace Catch { + + /** + * Base class identifying listeners. + * + * Provides default implementation for all IStreamingReporter member + * functions, so that listeners implementations can pick which + * member functions it actually cares about. + */ + class EventListenerBase : public IStreamingReporter { + public: + EventListenerBase( ReporterConfig const& config ): + IStreamingReporter( config.fullConfig() ) {} + + void assertionStarting( AssertionInfo const& assertionInfo ) override; + bool assertionEnded( AssertionStats const& assertionStats ) override; + + void listReporters( + std::vector<ReporterDescription> const& descriptions ) override; + void listTests( std::vector<TestCaseHandle> const& tests ) override; + void listTags( std::vector<TagInfo> const& tagInfos ) override; + + void noMatchingTestCases( std::string const& spec ) 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 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; + }; + +} // end namespace Catch + +#endif // CATCH_REPORTER_EVENT_LISTENER_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_helpers.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_helpers.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d16d92f207753780c274a814b2bb778f5cca9ee3 --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_helpers.hpp @@ -0,0 +1,76 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_REPORTER_HELPERS_HPP_INCLUDED +#define CATCH_REPORTER_HELPERS_HPP_INCLUDED + +#include <iosfwd> +#include <string> +#include <vector> + +#include <catch2/internal/catch_list.hpp> +#include <catch2/interfaces/catch_interfaces_config.hpp> + +namespace Catch { + + struct IConfig; + class TestCaseHandle; + + // Returns double formatted as %.3f (format expected on output) + std::string getFormattedDuration( double duration ); + + //! Should the reporter show duration of test given current configuration? + bool shouldShowDuration( IConfig const& config, double duration ); + + std::string serializeFilters( std::vector<std::string> const& filters ); + + struct lineOfChars { + char c; + constexpr lineOfChars( char c_ ): c( c_ ) {} + + friend std::ostream& operator<<( std::ostream& out, lineOfChars value ); + }; + + /** + * Lists reporter descriptions to the provided stream in user-friendly + * format + * + * Used as the default listing implementation by the first party reporter + * bases. The output should be backwards compatible with the output of + * Catch2 v2 binaries. + */ + void + defaultListReporters( std::ostream& out, + std::vector<ReporterDescription> const& descriptions, + Verbosity verbosity ); + + /** + * Lists tag information to the provided stream in user-friendly format + * + * Used as the default listing implementation by the first party reporter + * bases. The output should be backwards compatible with the output of + * Catch2 v2 binaries. + */ + void defaultListTags( std::ostream& out, std::vector<TagInfo> const& tags, bool isFiltered ); + + /** + * Lists test case information to the provided stream in user-friendly + * format + * + * Used as the default listing implementation by the first party reporter + * bases. The output is backwards compatible with the output of Catch2 + * v2 binaries, and also supports the format specific to the old + * `--list-test-names-only` option, for people who used it in integrations. + */ + void defaultListTests( std::ostream& out, + std::vector<TestCaseHandle> const& tests, + bool isFiltered, + Verbosity verbosity ); + +} // end namespace Catch + +#endif // CATCH_REPORTER_HELPERS_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_junit.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_junit.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cff5d7d7caf939dcd1f60155267dd85b9e785648 --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_junit.cpp @@ -0,0 +1,277 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/reporters/catch_reporter_junit.hpp> + +#include <catch2/reporters/catch_reporter_helpers.hpp> +#include <catch2/catch_tostring.hpp> +#include <catch2/internal/catch_string_manip.hpp> +#include <catch2/internal/catch_textflow.hpp> +#include <catch2/interfaces/catch_interfaces_config.hpp> +#include <catch2/catch_test_case_info.hpp> + +#include <cassert> +#include <ctime> +#include <algorithm> + +namespace Catch { + + namespace { + std::string getCurrentTimestamp() { + time_t rawtime; + std::time(&rawtime); + + std::tm timeInfo = {}; +#ifdef _MSC_VER + gmtime_s(&timeInfo, &rawtime); +#else + gmtime_r(&rawtime, &timeInfo); +#endif + + auto const timeStampSize = sizeof("2017-01-16T17:06:45Z"); + char timeStamp[timeStampSize]; + const char * const fmt = "%Y-%m-%dT%H:%M:%SZ"; + + std::strftime(timeStamp, timeStampSize, fmt, &timeInfo); + + return std::string(timeStamp); + } + + std::string fileNameTag(std::vector<Tag> const& tags) { + auto it = std::find_if(begin(tags), + end(tags), + [] (Tag const& tag) { + return tag.original.size() > 0 + && tag.original[0] == '#'; }); + if (it != tags.end()) { + return static_cast<std::string>( + it->original.substr(1, it->original.size() - 1) + ); + } + return std::string(); + } + } // anonymous namespace + + JunitReporter::JunitReporter( ReporterConfig const& _config ) + : CumulativeReporterBase( _config ), + xml( _config.stream() ) + { + m_preferences.shouldRedirectStdOut = true; + m_preferences.shouldReportAllAssertions = 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 properties if there are any + if (m_config->hasTestFilters() || m_config->rngSeed() != 0) { + auto properties = xml.scopedElement("properties"); + if (m_config->hasTestFilters()) { + xml.scopedElement("property") + .writeAttribute("name", "filters") + .writeAttribute("value", serializeFilters(m_config->getTestsOrTags())); + } + if (m_config->rngSeed() != 0) { + xml.scopedElement("property") + .writeAttribute("name", "random-seed") + .writeAttribute("value", m_config->rngSeed()); + } + } + + // Write test cases + for( auto const& child : groupNode.children ) + writeTestCase( *child ); + + xml.scopedElement( "system-out" ).writeText( trim( stdOutForSuite ), XmlFormatting::Newline ); + xml.scopedElement( "system-err" ).writeText( trim( stdErrForSuite ), XmlFormatting::Newline ); + } + + 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 ) ); + // This is not ideal, but it should be enough to mimic gtest's + // junit output. + // Ideally the JUnit reporter would also handle `skipTest` + // events and write those out appropriately. + xml.writeAttribute( "status", "run" ); + + writeAssertions( sectionNode ); + + if( !sectionNode.stdOut.empty() ) + xml.scopedElement( "system-out" ).writeText( trim( sectionNode.stdOut ), XmlFormatting::Newline ); + if( !sectionNode.stdErr.empty() ) + xml.scopedElement( "system-err" ).writeText( trim( sectionNode.stdErr ), XmlFormatting::Newline ); + } + 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: + case ResultWas::ExpressionFailed: + 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.getExpression() ); + xml.writeAttribute( "type", result.getTestMacroName() ); + + ReusableStringStream rss; + if (stats.totals.assertions.total() > 0) { + rss << "FAILED" << ":\n"; + if (result.hasExpression()) { + rss << " "; + rss << result.getExpressionInMacro(); + rss << '\n'; + } + if (result.hasExpandedExpression()) { + rss << "with expansion:\n"; + rss << TextFlow::Column(result.getExpandedExpression()).indent(2) << '\n'; + } + } else { + rss << '\n'; + } + + 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(), XmlFormatting::Newline ); + } + } + +} // end namespace Catch diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_junit.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_junit.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c76ddddefd1f6bd91fe3939299db47c8f06cc4e6 --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_junit.hpp @@ -0,0 +1,62 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_REPORTER_JUNIT_HPP_INCLUDED +#define CATCH_REPORTER_JUNIT_HPP_INCLUDED + + +#include <catch2/reporters/catch_reporter_cumulative_base.hpp> +#include <catch2/internal/catch_xmlwriter.hpp> +#include <catch2/catch_timer.hpp> + +namespace Catch { + + class JunitReporter : public CumulativeReporterBase { + 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 // CATCH_REPORTER_JUNIT_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_listening.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_listening.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d189388b1c140f99a42d2632ee3c3fe23016dbdd --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_listening.cpp @@ -0,0 +1,165 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/reporters/catch_reporter_listening.hpp> + +#include <cassert> + +namespace Catch { + + void ListeningReporter::addListener( IStreamingReporterPtr&& listener ) { + m_listeners.push_back( std::move( listener ) ); + } + + void ListeningReporter::addReporter(IStreamingReporterPtr&& reporter) { + assert(!m_reporter && "Listening reporter can wrap only 1 real reporter"); + m_reporter = std::move( reporter ); + m_preferences.shouldRedirectStdOut = m_reporter->getPreferences().shouldRedirectStdOut; + } + + void ListeningReporter::noMatchingTestCases( std::string const& spec ) { + for ( auto const& listener : m_listeners ) { + listener->noMatchingTestCases( spec ); + } + m_reporter->noMatchingTestCases( spec ); + } + + void ListeningReporter::reportInvalidArguments(std::string const&arg){ + for ( auto const& listener : m_listeners ) { + listener->reportInvalidArguments( arg ); + } + m_reporter->reportInvalidArguments( arg ); + } + + void ListeningReporter::benchmarkPreparing( std::string const& name ) { + for (auto const& listener : m_listeners) { + listener->benchmarkPreparing(name); + } + m_reporter->benchmarkPreparing(name); + } + void ListeningReporter::benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) { + for ( auto const& listener : m_listeners ) { + listener->benchmarkStarting( benchmarkInfo ); + } + m_reporter->benchmarkStarting( benchmarkInfo ); + } + void ListeningReporter::benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) { + for ( auto const& listener : m_listeners ) { + listener->benchmarkEnded( benchmarkStats ); + } + m_reporter->benchmarkEnded( benchmarkStats ); + } + + void ListeningReporter::benchmarkFailed( std::string const& error ) { + for (auto const& listener : m_listeners) { + listener->benchmarkFailed(error); + } + m_reporter->benchmarkFailed(error); + } + + void ListeningReporter::testRunStarting( TestRunInfo const& testRunInfo ) { + for ( auto const& listener : m_listeners ) { + listener->testRunStarting( testRunInfo ); + } + m_reporter->testRunStarting( testRunInfo ); + } + + void ListeningReporter::testGroupStarting( GroupInfo const& groupInfo ) { + for ( auto const& listener : m_listeners ) { + listener->testGroupStarting( groupInfo ); + } + m_reporter->testGroupStarting( groupInfo ); + } + + + void ListeningReporter::testCaseStarting( TestCaseInfo const& testInfo ) { + for ( auto const& listener : m_listeners ) { + listener->testCaseStarting( testInfo ); + } + m_reporter->testCaseStarting( testInfo ); + } + + void ListeningReporter::sectionStarting( SectionInfo const& sectionInfo ) { + for ( auto const& listener : m_listeners ) { + listener->sectionStarting( sectionInfo ); + } + m_reporter->sectionStarting( sectionInfo ); + } + + void ListeningReporter::assertionStarting( AssertionInfo const& assertionInfo ) { + for ( auto const& listener : m_listeners ) { + listener->assertionStarting( assertionInfo ); + } + m_reporter->assertionStarting( assertionInfo ); + } + + // The return value indicates if the messages buffer should be cleared: + bool ListeningReporter::assertionEnded( AssertionStats const& assertionStats ) { + for( auto const& listener : m_listeners ) { + static_cast<void>( listener->assertionEnded( assertionStats ) ); + } + return m_reporter->assertionEnded( assertionStats ); + } + + void ListeningReporter::sectionEnded( SectionStats const& sectionStats ) { + for ( auto const& listener : m_listeners ) { + listener->sectionEnded( sectionStats ); + } + m_reporter->sectionEnded( sectionStats ); + } + + void ListeningReporter::testCaseEnded( TestCaseStats const& testCaseStats ) { + for ( auto const& listener : m_listeners ) { + listener->testCaseEnded( testCaseStats ); + } + m_reporter->testCaseEnded( testCaseStats ); + } + + void ListeningReporter::testGroupEnded( TestGroupStats const& testGroupStats ) { + for ( auto const& listener : m_listeners ) { + listener->testGroupEnded( testGroupStats ); + } + m_reporter->testGroupEnded( testGroupStats ); + } + + void ListeningReporter::testRunEnded( TestRunStats const& testRunStats ) { + for ( auto const& listener : m_listeners ) { + listener->testRunEnded( testRunStats ); + } + m_reporter->testRunEnded( testRunStats ); + } + + + void ListeningReporter::skipTest( TestCaseInfo const& testInfo ) { + for ( auto const& listener : m_listeners ) { + listener->skipTest( testInfo ); + } + m_reporter->skipTest( testInfo ); + } + + void ListeningReporter::listReporters(std::vector<ReporterDescription> const& descriptions) { + for (auto const& listener : m_listeners) { + listener->listReporters(descriptions); + } + m_reporter->listReporters(descriptions); + } + + void ListeningReporter::listTests(std::vector<TestCaseHandle> const& tests) { + for (auto const& listener : m_listeners) { + listener->listTests(tests); + } + m_reporter->listTests(tests); + } + + void ListeningReporter::listTags(std::vector<TagInfo> const& tags) { + for (auto const& listener : m_listeners) { + listener->listTags(tags); + } + m_reporter->listTags(tags); + } + +} // end namespace Catch diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_listening.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_listening.hpp new file mode 100644 index 0000000000000000000000000000000000000000..88234cdc334bd2007f6cf1cbe9e60d71948c771e --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_listening.hpp @@ -0,0 +1,66 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_REPORTER_LISTENING_HPP_INCLUDED +#define CATCH_REPORTER_LISTENING_HPP_INCLUDED + +#include <catch2/interfaces/catch_interfaces_reporter.hpp> + +namespace Catch { + + class ListeningReporter final : public IStreamingReporter { + using Reporters = std::vector<IStreamingReporterPtr>; + Reporters m_listeners; + IStreamingReporterPtr m_reporter = nullptr; + + public: + ListeningReporter( IConfig const* config ): + IStreamingReporter( config ) { + // We will assume that listeners will always want all assertions + m_preferences.shouldReportAllAssertions = true; + } + + + void addListener( IStreamingReporterPtr&& listener ); + void addReporter( IStreamingReporterPtr&& reporter ); + + public: // IStreamingReporter + + void noMatchingTestCases( std::string const& spec ) override; + + void reportInvalidArguments(std::string const&arg) override; + + void benchmarkPreparing(std::string const& name) override; + void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override; + void benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) override; + void benchmarkFailed(std::string const&) 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; + + void listReporters(std::vector<ReporterDescription> const& descriptions) override; + void listTests(std::vector<TestCaseHandle> const& tests) override; + void listTags(std::vector<TagInfo> const& tags) override; + + + }; + +} // end namespace Catch + +#endif // CATCH_REPORTER_LISTENING_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_sonarqube.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_sonarqube.cpp new file mode 100644 index 0000000000000000000000000000000000000000..18ab3134eea90368184dcd2bc1c2193a2fae59c7 --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_sonarqube.cpp @@ -0,0 +1,142 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/reporters/catch_reporter_sonarqube.hpp> + +#include <catch2/internal/catch_string_manip.hpp> +#include <catch2/catch_test_case_info.hpp> + +#include <map> + +namespace Catch { + + SonarQubeReporter::~SonarQubeReporter() {} + + void SonarQubeReporter::testRunStarting(TestRunInfo const& testRunInfo) { + CumulativeReporterBase::testRunStarting(testRunInfo); + xml.startElement("testExecutions"); + xml.writeAttribute("version", '1'); + } + + void SonarQubeReporter::testGroupEnded(TestGroupStats const& testGroupStats) { + CumulativeReporterBase::testGroupEnded(testGroupStats); + writeGroup(*m_testGroups.back()); + } + + void SonarQubeReporter::writeGroup(TestGroupNode const& groupNode) { + std::map<std::string, std::vector<TestCaseNode const*>> testsPerFile; + for ( auto const& child : groupNode.children ) { + testsPerFile[child->value.testInfo->lineInfo.file].push_back( + child.get() ); + } + + for (auto const& kv : testsPerFile) + writeTestFile(kv.first, kv.second); + } + + void SonarQubeReporter::writeTestFile(std::string const& filename, std::vector<TestCaseNode const*> const& testCaseNodes) { + XmlWriter::ScopedElement e = xml.scopedElement("file"); + xml.writeAttribute("path", filename); + + for (auto const& child : testCaseNodes) + writeTestCase(*child); + } + + void SonarQubeReporter::writeTestCase(TestCaseNode const& testCaseNode) { + // 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(); + writeSection("", rootSection, testCaseNode.value.testInfo->okToFail()); + } + + void SonarQubeReporter::writeSection(std::string const& rootName, SectionNode const& sectionNode, bool okToFail) { + 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"); + xml.writeAttribute("name", name); + xml.writeAttribute("duration", static_cast<long>(sectionNode.stats.durationInSeconds * 1000)); + + writeAssertions(sectionNode, okToFail); + } + + for (auto const& childNode : sectionNode.childSections) + writeSection(name, *childNode, okToFail); + } + + void SonarQubeReporter::writeAssertions(SectionNode const& sectionNode, bool okToFail) { + for (auto const& assertion : sectionNode.assertions) + writeAssertion(assertion, okToFail); + } + + void SonarQubeReporter::writeAssertion(AssertionStats const& stats, bool okToFail) { + AssertionResult const& result = stats.assertionResult; + if (!result.isOk()) { + std::string elementName; + if (okToFail) { + elementName = "skipped"; + } else { + 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); + + ReusableStringStream messageRss; + messageRss << result.getTestMacroName() << "(" << result.getExpression() << ")"; + xml.writeAttribute("message", messageRss.str()); + + ReusableStringStream textRss; + if (stats.totals.assertions.total() > 0) { + textRss << "FAILED:\n"; + if (result.hasExpression()) { + textRss << "\t" << result.getExpressionInMacro() << "\n"; + } + if (result.hasExpandedExpression()) { + textRss << "with expansion:\n\t" << result.getExpandedExpression() << "\n"; + } + } + + if (!result.getMessage().empty()) + textRss << result.getMessage() << "\n"; + + for (auto const& msg : stats.infoMessages) + if (msg.type == ResultWas::Info) + textRss << msg.message << "\n"; + + textRss << "at " << result.getSourceInfo(); + xml.writeText(textRss.str(), XmlFormatting::Newline); + } + } + +} // end namespace Catch diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_sonarqube.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_sonarqube.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d46cb422d797876201d922dab03402cf63b8dc82 --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_sonarqube.hpp @@ -0,0 +1,62 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_REPORTER_SONARQUBE_HPP_INCLUDED +#define CATCH_REPORTER_SONARQUBE_HPP_INCLUDED + +#include <catch2/reporters/catch_reporter_cumulative_base.hpp> + +#include <catch2/internal/catch_xmlwriter.hpp> + +namespace Catch { + + struct SonarQubeReporter : CumulativeReporterBase { + + SonarQubeReporter(ReporterConfig const& config) + : CumulativeReporterBase(config) + , xml(config.stream()) { + m_preferences.shouldRedirectStdOut = true; + m_preferences.shouldReportAllAssertions = true; + } + + ~SonarQubeReporter() override; + + static std::string getDescription() { + using namespace std::string_literals; + return "Reports test results in the Generic Test Data SonarQube XML format"s; + } + + void noMatchingTestCases(std::string const& /*spec*/) override {} + + void testRunStarting(TestRunInfo const& testRunInfo) override; + + void testGroupEnded(TestGroupStats const& testGroupStats) override; + + void testRunEndedCumulative() override { + xml.endElement(); + } + + void writeGroup(TestGroupNode const& groupNode); + + void writeTestFile(std::string const& filename, std::vector<TestCaseNode const*> const& testCaseNodes); + + void writeTestCase(TestCaseNode const& testCaseNode); + + void writeSection(std::string const& rootName, SectionNode const& sectionNode, bool okToFail); + + void writeAssertions(SectionNode const& sectionNode, bool okToFail); + + void writeAssertion(AssertionStats const& stats, bool okToFail); + + private: + XmlWriter xml; + }; + + +} // end namespace Catch + +#endif // CATCH_REPORTER_SONARQUBE_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_streaming_base.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_streaming_base.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d0b8ae9491d23778bde4a26f283ce2f70356aea5 --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_streaming_base.cpp @@ -0,0 +1,50 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/reporters/catch_reporter_streaming_base.hpp> +#include <catch2/reporters/catch_reporter_helpers.hpp> + +namespace Catch { + + StreamingReporterBase::~StreamingReporterBase() = default; + + void + StreamingReporterBase::testRunStarting( TestRunInfo const& _testRunInfo ) { + currentTestRunInfo = _testRunInfo; + } + + void + StreamingReporterBase::testGroupStarting( GroupInfo const& _groupInfo ) { + currentGroupInfo = _groupInfo; + } + + void StreamingReporterBase::testGroupEnded( TestGroupStats const& ) { + currentGroupInfo.reset(); + } + + void StreamingReporterBase::testRunEnded( TestRunStats const& ) { + currentTestCaseInfo = nullptr; + currentGroupInfo.reset(); + currentTestRunInfo.reset(); + } + + void StreamingReporterBase::listReporters(std::vector<ReporterDescription> const& descriptions) { + defaultListReporters( stream, descriptions, m_config->verbosity() ); + } + + void StreamingReporterBase::listTests(std::vector<TestCaseHandle> const& tests) { + defaultListTests(stream, + tests, + m_config->hasTestFilters(), + m_config->verbosity()); + } + + void StreamingReporterBase::listTags(std::vector<TagInfo> const& tags) { + defaultListTags( stream, tags, m_config->hasTestFilters() ); + } + +} // end namespace Catch diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_streaming_base.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_streaming_base.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b0f1dd4969700c8e06045a0462915392fdabb2d0 --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_streaming_base.hpp @@ -0,0 +1,89 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_REPORTER_STREAMING_BASE_HPP_INCLUDED +#define CATCH_REPORTER_STREAMING_BASE_HPP_INCLUDED + +#include <catch2/interfaces/catch_interfaces_reporter.hpp> + +#include <catch2/internal/catch_option.hpp> + +#include <iosfwd> +#include <string> +#include <vector> + +namespace Catch { + + 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 StreamingReporterBase : IStreamingReporter { + + StreamingReporterBase( ReporterConfig const& _config ): + IStreamingReporter( _config.fullConfig() ), + stream( _config.stream() ) {} + + + ~StreamingReporterBase() override; + + void noMatchingTestCases(std::string const&) override {} + + void reportInvalidArguments(std::string const&) override {} + + void testRunStarting( TestRunInfo const& _testRunInfo ) override; + + void testGroupStarting( GroupInfo const& _groupInfo ) override; + + 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 = nullptr; + } + void testGroupEnded( TestGroupStats const& ) override; + void testRunEnded( TestRunStats const& /* _testRunStats */ ) override; + + void skipTest(TestCaseInfo const&) override { + // Don't do anything with this by default. + // It can optionally be overridden in the derived class. + } + + void listReporters( std::vector<ReporterDescription> const& descriptions ) override; + void listTests( std::vector<TestCaseHandle> const& tests ) override; + void listTags( std::vector<TagInfo> const& tags ) override; + + std::ostream& stream; + + LazyStat<TestRunInfo> currentTestRunInfo; + LazyStat<GroupInfo> currentGroupInfo; + TestCaseInfo const* currentTestCaseInfo = nullptr; + + std::vector<SectionInfo> m_sectionStack; + }; + +} // end namespace Catch + +#endif // CATCH_REPORTER_STREAMING_BASE_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_tap.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_tap.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6b0d5f42025b0fb01f8a4c5fe1909819ddde05a7 --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_tap.cpp @@ -0,0 +1,226 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/reporters/catch_reporter_tap.hpp> +#include <catch2/internal/catch_console_colour.hpp> +#include <catch2/internal/catch_string_manip.hpp> +#include <catch2/catch_test_case_info.hpp> + +#include <algorithm> +#include <ostream> + +namespace Catch { + + namespace { + // Yes, this has to be outside the class and namespaced by naming. + // Making older compiler happy is hard. + static constexpr StringRef tapFailedString = "not ok"_sr; + static constexpr StringRef tapPassedString = "ok"_sr; + + class TapAssertionPrinter { + public: + TapAssertionPrinter& operator= (TapAssertionPrinter const&) = delete; + TapAssertionPrinter(TapAssertionPrinter const&) = delete; + TapAssertionPrinter(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(tapPassedString); + printOriginalExpression(); + printReconstructedExpression(); + if (!result.hasExpression()) + printRemainingMessages(Colour::None); + else + printRemainingMessages(); + break; + case ResultWas::ExpressionFailed: + if (result.isOk()) { + printResultType(tapPassedString); + } else { + printResultType(tapFailedString); + } + printOriginalExpression(); + printReconstructedExpression(); + if (result.isOk()) { + printIssue(" # TODO"); + } + printRemainingMessages(); + break; + case ResultWas::ThrewException: + printResultType(tapFailedString); + printIssue("unexpected exception with message:"_sr); + printMessage(); + printExpressionWas(); + printRemainingMessages(); + break; + case ResultWas::FatalErrorCondition: + printResultType(tapFailedString); + printIssue("fatal error condition with message:"_sr); + printMessage(); + printExpressionWas(); + printRemainingMessages(); + break; + case ResultWas::DidntThrowException: + printResultType(tapFailedString); + printIssue("expected exception, got none"_sr); + printExpressionWas(); + printRemainingMessages(); + break; + case ResultWas::Info: + printResultType("info"_sr); + printMessage(); + printRemainingMessages(); + break; + case ResultWas::Warning: + printResultType("warning"_sr); + printMessage(); + printRemainingMessages(); + break; + case ResultWas::ExplicitFailure: + printResultType(tapFailedString); + printIssue("explicitly"_sr); + printRemainingMessages(Colour::None); + break; + // These cases are here to prevent compiler warnings + case ResultWas::Unknown: + case ResultWas::FailureBit: + case ResultWas::Exception: + printResultType("** internal error **"_sr); + break; + } + } + + private: + static Colour::Code dimColour() { return Colour::FileName; } + + void printSourceInfo() const { + Colour colourGuard(dimColour()); + stream << result.getSourceInfo() << ':'; + } + + void printResultType(StringRef passOrFail) const { + if (!passOrFail.empty()) { + stream << passOrFail << ' ' << counter << " -"; + } + } + + void printIssue(StringRef 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; + }; + + } // End anonymous namespace + + TAPReporter::~TAPReporter() {} + + void TAPReporter::noMatchingTestCases(std::string const& spec) { + stream << "# No test cases matched '" << spec << "'\n"; + } + + bool TAPReporter::assertionEnded(AssertionStats const& _assertionStats) { + ++counter; + + stream << "# " << currentTestCaseInfo->name << '\n'; + TapAssertionPrinter printer(stream, _assertionStats, counter); + printer.print(); + + stream << '\n' << std::flush; + return true; + } + + void TAPReporter::testRunEnded(TestRunStats const& _testRunStats) { + stream << "1.." << _testRunStats.totals.assertions.total(); + if (_testRunStats.totals.testCases.total() == 0) { + stream << " # Skipped: No tests ran."; + } + stream << "\n\n" << std::flush; + StreamingReporterBase::testRunEnded(_testRunStats); + } + + + + +} // end namespace Catch diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_tap.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_tap.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d8d3e9a4e1caa4e336b2809c0c1f91d723190173 --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_tap.hpp @@ -0,0 +1,42 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_REPORTER_TAP_HPP_INCLUDED +#define CATCH_REPORTER_TAP_HPP_INCLUDED + +#include <catch2/reporters/catch_reporter_streaming_base.hpp> + +namespace Catch { + + struct TAPReporter : StreamingReporterBase { + + TAPReporter( ReporterConfig const& config ): + StreamingReporterBase( config ) { + m_preferences.shouldReportAllAssertions = true; + } + ~TAPReporter() override; + + static std::string getDescription() { + using namespace std::string_literals; + return "Reports test results in TAP format, suitable for test harnesses"s; + } + + void noMatchingTestCases(std::string const& spec) override; + + void assertionStarting( AssertionInfo const& ) override {} + + bool assertionEnded(AssertionStats const& _assertionStats) override; + + void testRunEnded(TestRunStats const& _testRunStats) override; + + private: + std::size_t counter = 0; + }; + +} // end namespace Catch + +#endif // CATCH_REPORTER_TAP_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_teamcity.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_teamcity.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3a417bd48c9598f72dea5fe5ab553a90f556dc93 --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_teamcity.cpp @@ -0,0 +1,177 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/reporters/catch_reporter_teamcity.hpp> + +#include <catch2/reporters/catch_reporter_helpers.hpp> +#include <catch2/internal/catch_string_manip.hpp> +#include <catch2/internal/catch_enforce.hpp> +#include <catch2/internal/catch_textflow.hpp> +#include <catch2/catch_test_case_info.hpp> + +#include <cassert> + +namespace Catch { + + namespace { + // if string has a : in first line will set indent to follow it on + // subsequent lines + 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 << TextFlow::Column(_string) + .indent(indent + i) + .initialIndent(indent) << '\n'; + } + + 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; + } + } // end anonymous namespace + + + TeamCityReporter::~TeamCityReporter() {} + + void TeamCityReporter::testGroupStarting(GroupInfo const& groupInfo) { + StreamingReporterBase::testGroupStarting(groupInfo); + stream << "##teamcity[testSuiteStarted name='" + << escape(groupInfo.name) << "']\n"; + } + + void TeamCityReporter::testGroupEnded(TestGroupStats const& testGroupStats) { + StreamingReporterBase::testGroupEnded(testGroupStats); + stream << "##teamcity[testSuiteFinished name='" + << escape(testGroupStats.groupInfo.name) << "']\n"; + } + + bool TeamCityReporter::assertionEnded(AssertionStats const& assertionStats) { + 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: + CATCH_ERROR("Internal error in TeamCity reporter"); + // These cases are here to prevent compiler warnings + case ResultWas::Unknown: + case ResultWas::FailureBit: + case ResultWas::Exception: + CATCH_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 TeamCityReporter::testCaseStarting(TestCaseInfo const& testInfo) { + m_testTimer.start(); + StreamingReporterBase::testCaseStarting(testInfo); + stream << "##teamcity[testStarted name='" + << escape(testInfo.name) << "']\n"; + stream.flush(); + } + + void TeamCityReporter::testCaseEnded(TestCaseStats const& testCaseStats) { + StreamingReporterBase::testCaseEnded(testCaseStats); + auto const& testCaseInfo = *testCaseStats.testInfo; + if (!testCaseStats.stdOut.empty()) + stream << "##teamcity[testStdOut name='" + << escape(testCaseInfo.name) + << "' out='" << escape(testCaseStats.stdOut) << "']\n"; + if (!testCaseStats.stdErr.empty()) + stream << "##teamcity[testStdErr name='" + << escape(testCaseInfo.name) + << "' out='" << escape(testCaseStats.stdErr) << "']\n"; + stream << "##teamcity[testFinished name='" + << escape(testCaseInfo.name) << "' duration='" + << m_testTimer.getElapsedMilliseconds() << "']\n"; + stream.flush(); + } + + void TeamCityReporter::printSectionHeader(std::ostream& os) { + assert(!m_sectionStack.empty()); + + if (m_sectionStack.size() > 1) { + os << lineOfChars('-') << '\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 << lineOfChars('-') << '\n'; + } + + SourceLineInfo lineInfo = m_sectionStack.front().lineInfo; + + os << lineInfo << '\n'; + os << lineOfChars('.') << "\n\n"; + } + +} // end namespace Catch diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_teamcity.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_teamcity.hpp new file mode 100644 index 0000000000000000000000000000000000000000..300a1e9329765c09244db0b18081f77a5306ae28 --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_teamcity.hpp @@ -0,0 +1,72 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_REPORTER_TEAMCITY_HPP_INCLUDED +#define CATCH_REPORTER_TEAMCITY_HPP_INCLUDED + +#include <catch2/reporters/catch_reporter_streaming_base.hpp> +#include <catch2/catch_timer.hpp> + +#include <cstring> + +#ifdef __clang__ +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wpadded" +#endif + +namespace Catch { + + struct TeamCityReporter : StreamingReporterBase { + TeamCityReporter( ReporterConfig const& _config ) + : StreamingReporterBase( _config ) + { + m_preferences.shouldRedirectStdOut = true; + } + + ~TeamCityReporter() override; + + static std::string getDescription() { + using namespace std::string_literals; + return "Reports test results as TeamCity service messages"s; + } + + void skipTest( TestCaseInfo const& /* testInfo */ ) override {} + + void noMatchingTestCases( std::string const& /* spec */ ) override {} + + void testGroupStarting(GroupInfo const& groupInfo) override; + void testGroupEnded(TestGroupStats const& testGroupStats) override; + + + void assertionStarting(AssertionInfo const&) override {} + + bool assertionEnded(AssertionStats const& assertionStats) override; + + void sectionStarting(SectionInfo const& sectionInfo) override { + m_headerPrintedForThisSection = false; + StreamingReporterBase::sectionStarting( sectionInfo ); + } + + void testCaseStarting(TestCaseInfo const& testInfo) override; + + void testCaseEnded(TestCaseStats const& testCaseStats) override; + + private: + void printSectionHeader(std::ostream& os); + + private: + bool m_headerPrintedForThisSection = false; + Timer m_testTimer; + }; + +} // end namespace Catch + +#ifdef __clang__ +# pragma clang diagnostic pop +#endif + +#endif // CATCH_REPORTER_TEAMCITY_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_xml.cpp b/packages/Catch2/src/catch2/reporters/catch_reporter_xml.cpp new file mode 100644 index 0000000000000000000000000000000000000000..273a9689dc35c11b53c4506b2bb856436b00715c --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_xml.cpp @@ -0,0 +1,333 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#include <catch2/reporters/catch_reporter_xml.hpp> + +#include <catch2/reporters/catch_reporter_helpers.hpp> +#include <catch2/interfaces/catch_interfaces_config.hpp> +#include <catch2/catch_test_spec.hpp> +#include <catch2/internal/catch_string_manip.hpp> +#include <catch2/internal/catch_list.hpp> +#include <catch2/catch_test_case_info.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_preferences.shouldRedirectStdOut = true; + m_preferences.shouldReportAllAssertions = 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() ); + if (m_config->testSpec().hasFilters()) + m_xml.writeAttribute( "filters", serializeFilters( m_config->getTestsOrTags() ) ); + if( m_config->rngSeed() != 0 ) + m_xml.scopedElement( "Randomness" ) + .writeAttribute( "seed", m_config->rngSeed() ); + } + + 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( "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 ) ); + 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 ), XmlFormatting::Newline ); + if( !testCaseStats.stdErr.empty() ) + m_xml.scopedElement( "StdErr" ).writeText( trim( testCaseStats.stdErr ), XmlFormatting::Newline ); + + 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.scopedElement( "OverallResultsCases") + .writeAttribute( "successes", testGroupStats.totals.testCases.passed ) + .writeAttribute( "failures", testGroupStats.totals.testCases.failed ) + .writeAttribute( "expectedFailures", testGroupStats.totals.testCases.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.scopedElement( "OverallResultsCases") + .writeAttribute( "successes", testRunStats.totals.testCases.passed ) + .writeAttribute( "failures", testRunStats.totals.testCases.failed ) + .writeAttribute( "expectedFailures", testRunStats.totals.testCases.failedButOk ); + m_xml.endElement(); + } + + void XmlReporter::benchmarkPreparing(std::string const& name) { + m_xml.startElement("BenchmarkResults") + .writeAttribute("name", name); + } + + void XmlReporter::benchmarkStarting(BenchmarkInfo const &info) { + m_xml.writeAttribute("samples", info.samples) + .writeAttribute("resamples", info.resamples) + .writeAttribute("iterations", info.iterations) + .writeAttribute("clockResolution", info.clockResolution) + .writeAttribute("estimatedDuration", info.estimatedDuration) + .writeComment("All values in nano seconds"); + } + + void XmlReporter::benchmarkEnded(BenchmarkStats<> const& benchmarkStats) { + m_xml.startElement("mean") + .writeAttribute("value", benchmarkStats.mean.point.count()) + .writeAttribute("lowerBound", benchmarkStats.mean.lower_bound.count()) + .writeAttribute("upperBound", benchmarkStats.mean.upper_bound.count()) + .writeAttribute("ci", benchmarkStats.mean.confidence_interval); + m_xml.endElement(); + m_xml.startElement("standardDeviation") + .writeAttribute("value", benchmarkStats.standardDeviation.point.count()) + .writeAttribute("lowerBound", benchmarkStats.standardDeviation.lower_bound.count()) + .writeAttribute("upperBound", benchmarkStats.standardDeviation.upper_bound.count()) + .writeAttribute("ci", benchmarkStats.standardDeviation.confidence_interval); + m_xml.endElement(); + m_xml.startElement("outliers") + .writeAttribute("variance", benchmarkStats.outlierVariance) + .writeAttribute("lowMild", benchmarkStats.outliers.low_mild) + .writeAttribute("lowSevere", benchmarkStats.outliers.low_severe) + .writeAttribute("highMild", benchmarkStats.outliers.high_mild) + .writeAttribute("highSevere", benchmarkStats.outliers.high_severe); + m_xml.endElement(); + m_xml.endElement(); + } + + void XmlReporter::benchmarkFailed(std::string const &error) { + m_xml.scopedElement("failed"). + writeAttribute("message", error); + m_xml.endElement(); + } + + void XmlReporter::listReporters(std::vector<ReporterDescription> const& descriptions) { + auto outerTag = m_xml.scopedElement("AvailableReporters"); + for (auto const& reporter : descriptions) { + auto inner = m_xml.scopedElement("Reporter"); + m_xml.startElement("Name", XmlFormatting::Indent) + .writeText(reporter.name, XmlFormatting::None) + .endElement(XmlFormatting::Newline); + m_xml.startElement("Description", XmlFormatting::Indent) + .writeText(reporter.description, XmlFormatting::None) + .endElement(XmlFormatting::Newline); + } + } + + void XmlReporter::listTests(std::vector<TestCaseHandle> const& tests) { + auto outerTag = m_xml.scopedElement("MatchingTests"); + for (auto const& test : tests) { + auto innerTag = m_xml.scopedElement("TestCase"); + auto const& testInfo = test.getTestCaseInfo(); + m_xml.startElement("Name", XmlFormatting::Indent) + .writeText(testInfo.name, XmlFormatting::None) + .endElement(XmlFormatting::Newline); + m_xml.startElement("ClassName", XmlFormatting::Indent) + .writeText(testInfo.className, XmlFormatting::None) + .endElement(XmlFormatting::Newline); + m_xml.startElement("Tags", XmlFormatting::Indent) + .writeText(testInfo.tagsAsString(), XmlFormatting::None) + .endElement(XmlFormatting::Newline); + + auto sourceTag = m_xml.scopedElement("SourceInfo"); + m_xml.startElement("File", XmlFormatting::Indent) + .writeText(testInfo.lineInfo.file, XmlFormatting::None) + .endElement(XmlFormatting::Newline); + m_xml.startElement("Line", XmlFormatting::Indent) + .writeText(std::to_string(testInfo.lineInfo.line), XmlFormatting::None) + .endElement(XmlFormatting::Newline); + } + } + + void XmlReporter::listTags(std::vector<TagInfo> const& tags) { + auto outerTag = m_xml.scopedElement("TagsFromMatchingTests"); + for (auto const& tag : tags) { + auto innerTag = m_xml.scopedElement("Tag"); + m_xml.startElement("Count", XmlFormatting::Indent) + .writeText(std::to_string(tag.count), XmlFormatting::None) + .endElement(XmlFormatting::Newline); + auto aliasTag = m_xml.scopedElement("Aliases"); + for (auto const& alias : tag.spellings) { + m_xml.startElement("Alias", XmlFormatting::Indent) + .writeText(static_cast<std::string>(alias), XmlFormatting::None) + .endElement(XmlFormatting::Newline); + } + } + } + +} // end namespace Catch + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif diff --git a/packages/Catch2/src/catch2/reporters/catch_reporter_xml.hpp b/packages/Catch2/src/catch2/reporters/catch_reporter_xml.hpp new file mode 100644 index 0000000000000000000000000000000000000000..dbcaaa93221a8ae8c04b3e2d14d40ff4fa2380e3 --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporter_xml.hpp @@ -0,0 +1,71 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_REPORTER_XML_HPP_INCLUDED +#define CATCH_REPORTER_XML_HPP_INCLUDED + +#include <catch2/reporters/catch_reporter_streaming_base.hpp> + +#include <catch2/internal/catch_xmlwriter.hpp> +#include <catch2/catch_timer.hpp> + + +namespace Catch { + class XmlReporter : public StreamingReporterBase { + 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; + + void benchmarkPreparing(std::string const& name) override; + void benchmarkStarting(BenchmarkInfo const&) override; + void benchmarkEnded(BenchmarkStats<> const&) override; + void benchmarkFailed(std::string const&) override; + + void listReporters(std::vector<ReporterDescription> const& descriptions) override; + void listTests(std::vector<TestCaseHandle> const& tests) override; + void listTags(std::vector<TagInfo> const& tags) override; + + private: + Timer m_testCaseTimer; + XmlWriter m_xml; + int m_sectionDepth = 0; + }; + +} // end namespace Catch + +#endif // CATCH_REPORTER_XML_HPP_INCLUDED diff --git a/packages/Catch2/src/catch2/reporters/catch_reporters_all.hpp b/packages/Catch2/src/catch2/reporters/catch_reporters_all.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bf29c6fe28235950e0995474a4a8d412a79994f5 --- /dev/null +++ b/packages/Catch2/src/catch2/reporters/catch_reporters_all.hpp @@ -0,0 +1,38 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +/** \file + * This is a convenience header for Catch2's Reporter support. It includes + * **all** of Catch2 headers related to reporters, including all reporters. + * + * Generally the Catch2 users should use specific includes they need, + * but this header can be used instead for ease-of-experimentation, or + * just plain convenience, at the cost of (significantly) increased + * compilation times. + * + * When a new header (reporter) is added to either the `reporter` folder, + * or to the corresponding internal subfolder, it should be added here. + */ + +#ifndef CATCH_REPORTERS_ALL_HPP_INCLUDED +#define CATCH_REPORTERS_ALL_HPP_INCLUDED + +#include <catch2/reporters/catch_reporter_automake.hpp> +#include <catch2/reporters/catch_reporter_compact.hpp> +#include <catch2/reporters/catch_reporter_console.hpp> +#include <catch2/reporters/catch_reporter_cumulative_base.hpp> +#include <catch2/reporters/catch_reporter_event_listener.hpp> +#include <catch2/reporters/catch_reporter_helpers.hpp> +#include <catch2/reporters/catch_reporter_junit.hpp> +#include <catch2/reporters/catch_reporter_listening.hpp> +#include <catch2/reporters/catch_reporter_sonarqube.hpp> +#include <catch2/reporters/catch_reporter_streaming_base.hpp> +#include <catch2/reporters/catch_reporter_tap.hpp> +#include <catch2/reporters/catch_reporter_teamcity.hpp> +#include <catch2/reporters/catch_reporter_xml.hpp> + +#endif // CATCH_REPORTERS_ALL_HPP_INCLUDED diff --git a/packages/Catch2/tests/CMakeLists.txt b/packages/Catch2/tests/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..f8bdb3b4d05978beb03b853e2ab88ca4b766b1a8 --- /dev/null +++ b/packages/Catch2/tests/CMakeLists.txt @@ -0,0 +1,265 @@ +include(MiscFunctions) + +#### +# Temporary workaround for VS toolset changes in 2017 +# We need to disable <UseFullPaths> property, but CMake doesn't support it +# until 3.13 (not yet released) +#### +if (MSVC) +configure_file(${CATCH_DIR}/tools/misc/SelfTest.vcxproj.user + ${CMAKE_BINARY_DIR}/tests + COPYONLY) +endif(MSVC) #Temporary workaround + + +# define the sources of the self test +# Please keep these ordered alphabetically +set(TEST_SOURCES + ${SELF_TEST_DIR}/TestRegistrations.cpp + ${SELF_TEST_DIR}/IntrospectiveTests/Clara.tests.cpp + ${SELF_TEST_DIR}/IntrospectiveTests/CmdLine.tests.cpp + ${SELF_TEST_DIR}/IntrospectiveTests/Details.tests.cpp + ${SELF_TEST_DIR}/IntrospectiveTests/GeneratorsImpl.tests.cpp + ${SELF_TEST_DIR}/IntrospectiveTests/InternalBenchmark.tests.cpp + ${SELF_TEST_DIR}/IntrospectiveTests/PartTracker.tests.cpp + ${SELF_TEST_DIR}/IntrospectiveTests/RandomNumberGeneration.tests.cpp + ${SELF_TEST_DIR}/IntrospectiveTests/Reporters.tests.cpp + ${SELF_TEST_DIR}/IntrospectiveTests/Tag.tests.cpp + ${SELF_TEST_DIR}/IntrospectiveTests/String.tests.cpp + ${SELF_TEST_DIR}/IntrospectiveTests/StringManip.tests.cpp + ${SELF_TEST_DIR}/IntrospectiveTests/Xml.tests.cpp + ${SELF_TEST_DIR}/IntrospectiveTests/ToString.tests.cpp + ${SELF_TEST_DIR}/IntrospectiveTests/UniquePtr.tests.cpp + ${SELF_TEST_DIR}/TimingTests/Sleep.tests.cpp + ${SELF_TEST_DIR}/UsageTests/Approx.tests.cpp + ${SELF_TEST_DIR}/UsageTests/BDD.tests.cpp + ${SELF_TEST_DIR}/UsageTests/Benchmark.tests.cpp + ${SELF_TEST_DIR}/UsageTests/Class.tests.cpp + ${SELF_TEST_DIR}/UsageTests/Compilation.tests.cpp + ${SELF_TEST_DIR}/UsageTests/Condition.tests.cpp + ${SELF_TEST_DIR}/UsageTests/Decomposition.tests.cpp + ${SELF_TEST_DIR}/UsageTests/EnumToString.tests.cpp + ${SELF_TEST_DIR}/UsageTests/Exception.tests.cpp + ${SELF_TEST_DIR}/UsageTests/Generators.tests.cpp + ${SELF_TEST_DIR}/UsageTests/Message.tests.cpp + ${SELF_TEST_DIR}/UsageTests/Misc.tests.cpp + ${SELF_TEST_DIR}/UsageTests/ToStringByte.tests.cpp + ${SELF_TEST_DIR}/UsageTests/ToStringChrono.tests.cpp + ${SELF_TEST_DIR}/UsageTests/ToStringGeneral.tests.cpp + ${SELF_TEST_DIR}/UsageTests/ToStringOptional.tests.cpp + ${SELF_TEST_DIR}/UsageTests/ToStringPair.tests.cpp + ${SELF_TEST_DIR}/UsageTests/ToStringTuple.tests.cpp + ${SELF_TEST_DIR}/UsageTests/ToStringVariant.tests.cpp + ${SELF_TEST_DIR}/UsageTests/ToStringVector.tests.cpp + ${SELF_TEST_DIR}/UsageTests/ToStringWhich.tests.cpp + ${SELF_TEST_DIR}/UsageTests/Tricky.tests.cpp + ${SELF_TEST_DIR}/UsageTests/VariadicMacros.tests.cpp + ${SELF_TEST_DIR}/UsageTests/MatchersRanges.tests.cpp + ${SELF_TEST_DIR}/UsageTests/Matchers.tests.cpp + ) + + +# Specify the headers, too, so CLion recognises them as project files +set(HEADERS + ${TOP_LEVEL_HEADERS} + ${EXTERNAL_HEADERS} + ${INTERNAL_HEADERS} + ${REPORTER_HEADERS} + ${BENCHMARK_HEADERS} + ${BENCHMARK_SOURCES} +) + +# Provide some groupings for IDEs +#SOURCE_GROUP("benchmark" FILES ${BENCHMARK_HEADERS} ${BENCHMARK_SOURCES}) +#SOURCE_GROUP("Tests" FILES ${TEST_SOURCES}) + +include(CTest) + +add_executable(SelfTest ${TEST_SOURCES}) +target_link_libraries(SelfTest PRIVATE Catch2WithMain) + +if (CATCH_ENABLE_COVERAGE) + set(ENABLE_COVERAGE ON CACHE BOOL "Enable coverage build." FORCE) + find_package(codecov) + add_coverage(SelfTest) + list(APPEND LCOV_REMOVE_PATTERNS "'/usr/*'") + coverage_evaluate() +endif() + +# configure unit tests via CTest +add_test(NAME RunTests COMMAND $<TARGET_FILE:SelfTest> --order rand --rng-seed time) +set_tests_properties(RunTests PROPERTIES + FAIL_REGULAR_EXPRESSION "Filters:" + COST 60 +) + +# Because CTest does not allow us to check both return code _and_ expected +# output in one test, we run these commands twice. First time we check +# the output, the second time we check the exit code. +add_test(NAME List::Tests::Output COMMAND $<TARGET_FILE:SelfTest> --list-tests --verbosity high) +set_tests_properties(List::Tests::Output PROPERTIES + PASS_REGULAR_EXPRESSION "[0-9]+ test cases" + FAIL_REGULAR_EXPRESSION "Hidden Test" +) +# This should be equivalent to the old --list-test-names-only and be usable +# with --input-file. +add_test(NAME List::Tests::Quiet COMMAND $<TARGET_FILE:SelfTest> --list-tests --verbosity quiet) +# Sadly we cannot ask for start-of-line and end-of-line in a ctest regex, +# so we fail if we see space/tab at the start... +set_tests_properties(List::Tests::Quiet PROPERTIES + PASS_REGULAR_EXPRESSION "\"#1905 -- test spec parser properly clears internal state between compound tests\"[\r\n]" + FAIL_REGULAR_EXPRESSION "[ \t]\"#1905 -- test spec parser properly clears internal state between compound tests\"" +) +add_test(NAME List::Tests::ExitCode COMMAND $<TARGET_FILE:SelfTest> --list-tests --verbosity high) +add_test(NAME List::Tests::XmlOutput COMMAND $<TARGET_FILE:SelfTest> --list-tests --verbosity high -r xml) +set_tests_properties(List::Tests::XmlOutput PROPERTIES + PASS_REGULAR_EXPRESSION "<Line>[0-9]+</Line>" + FAIL_REGULAR_EXPRESSION "[0-9]+ test cases" +) + +add_test(NAME List::Tags::Output COMMAND $<TARGET_FILE:SelfTest> --list-tags) +set_tests_properties(List::Tags::Output PROPERTIES + PASS_REGULAR_EXPRESSION "[0-9]+ tags" + FAIL_REGULAR_EXPRESSION "\\[\\.\\]") +add_test(NAME List::Tags::ExitCode COMMAND $<TARGET_FILE:SelfTest> --list-tags) +add_test(NAME List::Tags::XmlOutput COMMAND $<TARGET_FILE:SelfTest> --list-tags -r xml) +set_tests_properties(List::Tags::XmlOutput PROPERTIES + PASS_REGULAR_EXPRESSION "<Count>18</Count>" + FAIL_REGULAR_EXPRESSION "[0-9]+ tags" +) + + +add_test(NAME List::Reporters::Output COMMAND $<TARGET_FILE:SelfTest> --list-reporters) +set_tests_properties(List::Reporters::Output PROPERTIES PASS_REGULAR_EXPRESSION "Available reporters:") +add_test(NAME List::Reporters::ExitCode COMMAND $<TARGET_FILE:SelfTest> --list-reporters) +add_test(NAME List::Reporters::XmlOutput COMMAND $<TARGET_FILE:SelfTest> --list-reporters -r xml) +set_tests_properties(List::Reporters::XmlOutput PROPERTIES + PASS_REGULAR_EXPRESSION "<Name>compact</Name>" + FAIL_REGULAR_EXPRESSION "Available reporters:" +) + + + +add_test(NAME NoAssertions COMMAND $<TARGET_FILE:SelfTest> -w NoAssertions "An empty test with no assertions") +set_tests_properties(NoAssertions PROPERTIES PASS_REGULAR_EXPRESSION "No assertions in test case") + +add_test(NAME NoTest COMMAND $<TARGET_FILE:SelfTest> Tracker, "___nonexistent_test___") +set_tests_properties(NoTest PROPERTIES + PASS_REGULAR_EXPRESSION "No test cases matched '___nonexistent_test___'" + FAIL_REGULAR_EXPRESSION "No tests ran" +) + +add_test(NAME WarnAboutNoTests COMMAND ${CMAKE_COMMAND} -P ${SELF_TEST_DIR}/WarnAboutNoTests.cmake $<TARGET_FILE:SelfTest>) + +add_test(NAME UnmatchedOutputFilter COMMAND $<TARGET_FILE:SelfTest> [this-tag-does-not-exist] -w NoTests) +set_tests_properties(UnmatchedOutputFilter + PROPERTIES + PASS_REGULAR_EXPRESSION "No test cases matched '\\[this-tag-does-not-exist\\]'" +) + +add_test(NAME FilteredSection-1 COMMAND $<TARGET_FILE:SelfTest> \#1394 -c RunSection) +set_tests_properties(FilteredSection-1 PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran") +add_test(NAME FilteredSection-2 COMMAND $<TARGET_FILE:SelfTest> \#1394\ nested -c NestedRunSection -c s1) +set_tests_properties(FilteredSection-2 PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran") + +add_test( + NAME + FilteredSection::GeneratorsDontCauseInfiniteLoop-1 + COMMAND + $<TARGET_FILE:SelfTest> "#2025: original repro" -c "fov_0" +) +set_tests_properties(FilteredSection::GeneratorsDontCauseInfiniteLoop-1 + PROPERTIES + PASS_REGULAR_EXPRESSION "inside with fov: 0" # This should happen + FAIL_REGULAR_EXPRESSION "inside with fov: 1" # This would mean there was no filtering +) + +# GENERATE between filtered sections (both are selected) +add_test( + NAME + FilteredSection::GeneratorsDontCauseInfiniteLoop-2 + COMMAND + $<TARGET_FILE:SelfTest> "#2025: same-level sections" + -c "A" + -c "B" +) +set_tests_properties(FilteredSection::GeneratorsDontCauseInfiniteLoop-2 + PROPERTIES + PASS_REGULAR_EXPRESSION "All tests passed \\(4 assertions in 1 test case\\)" +) + +# AppVeyor has a Python 2.7 in path, but doesn't have .py files as autorunnable +add_test(NAME ApprovalTests COMMAND ${PYTHON_EXECUTABLE} ${CATCH_DIR}/tools/scripts/approvalTests.py $<TARGET_FILE:SelfTest>) +set_tests_properties(ApprovalTests + PROPERTIES + FAIL_REGULAR_EXPRESSION "Results differed" + COST 120 # We know that this is either the most, or second most, + # expensive test in the test suite, so we give it high estimate for CI runs +) + +add_test(NAME RegressionCheck-1670 COMMAND $<TARGET_FILE:SelfTest> "#1670 regression check" -c A -r compact) +set_tests_properties(RegressionCheck-1670 PROPERTIES PASS_REGULAR_EXPRESSION "Passed 1 test case with 2 assertions.") + +add_test(NAME VersionCheck COMMAND $<TARGET_FILE:SelfTest> -h) +set_tests_properties(VersionCheck PROPERTIES PASS_REGULAR_EXPRESSION "Catch v${PROJECT_VERSION}") + +add_test(NAME LibIdentityTest COMMAND $<TARGET_FILE:SelfTest> --libidentify) +set_tests_properties(LibIdentityTest PROPERTIES PASS_REGULAR_EXPRESSION "description: A Catch2 test executable") + +add_test(NAME FilenameAsTagsTest COMMAND $<TARGET_FILE:SelfTest> -\# --list-tags) +set_tests_properties(FilenameAsTagsTest PROPERTIES PASS_REGULAR_EXPRESSION "\\[#Approx.tests\\]") + +# Check that the filename tags can also be matched against (#2064) +add_test(NAME FilenameAsTagsMatching COMMAND $<TARGET_FILE:SelfTest> -\# --list-tags [\#Approx.tests]) +set_tests_properties(FilenameAsTagsMatching + PROPERTIES + PASS_REGULAR_EXPRESSION "\\[#Approx.tests\\]" + # Avoids false positives by looking for start of line (newline) before the 0 + FAIL_REGULAR_EXPRESSION "[\r\n]0 tag" +) + +add_test(NAME EscapeSpecialCharactersInTestNames COMMAND $<TARGET_FILE:SelfTest> "Test with special\\, characters \"in name") +set_tests_properties(EscapeSpecialCharactersInTestNames PROPERTIES PASS_REGULAR_EXPRESSION "1 assertion in 1 test case") + +add_test(NAME NegativeSpecNoHiddenTests COMMAND $<TARGET_FILE:SelfTest> --list-tests ~[approval]) +set_tests_properties(NegativeSpecNoHiddenTests PROPERTIES FAIL_REGULAR_EXPRESSION "\\[\\.\\]") + +add_test(NAME TestsInFile::SimpleSpecs COMMAND $<TARGET_FILE:SelfTest> "-f ${SELF_TEST_DIR}/Misc/plain-old-tests.input") +set_tests_properties(TestsInFile::SimpleSpecs PROPERTIES PASS_REGULAR_EXPRESSION "6 assertions in 2 test cases") + +add_test(NAME TestsInFile::EscapeSpecialCharacters COMMAND $<TARGET_FILE:SelfTest> "-f ${SELF_TEST_DIR}/Misc/special-characters-in-file.input") +set_tests_properties(TestsInFile::EscapeSpecialCharacters PROPERTIES PASS_REGULAR_EXPRESSION "1 assertion in 1 test case") + +# CTest does not allow us to create an AND of required regular expressions, +# so we have to split the test into 2 parts and look for parts of the expected +# output separately. +add_test(NAME TestsInFile::InvalidTestNames-1 COMMAND $<TARGET_FILE:SelfTest> "-f ${SELF_TEST_DIR}/Misc/invalid-test-names.input") +set_tests_properties(TestsInFile::InvalidTestNames-1 PROPERTIES PASS_REGULAR_EXPRESSION "Invalid Filter: \"Test with special, characters in \\\\\" name\"") + +add_test(NAME TestsInFile::InvalidTestNames-2 COMMAND $<TARGET_FILE:SelfTest> "-f ${SELF_TEST_DIR}/Misc/invalid-test-names.input") +set_tests_properties(TestsInFile::InvalidTestNames-2 PROPERTIES PASS_REGULAR_EXPRESSION "No tests ran") + +add_test(NAME TagAlias COMMAND $<TARGET_FILE:SelfTest> [@tricky] --list-tests) +set_tests_properties(TagAlias PROPERTIES + PASS_REGULAR_EXPRESSION "[0-9]+ matching test cases" + FAIL_REGULAR_EXPRESSION "0 matching test cases" +) + +add_test(NAME RandomTestOrdering COMMAND ${PYTHON_EXECUTABLE} + ${CATCH_DIR}/tests/TestScripts/testRandomOrder.py $<TARGET_FILE:SelfTest>) + +add_test(NAME CheckConvenienceHeaders + COMMAND + ${PYTHON_EXECUTABLE} ${CATCH_DIR}/tools/scripts/checkConvenienceHeaders.py +) + +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() + +list(APPEND CATCH_WARNING_TARGETS SelfTest) +set(CATCH_WARNING_TARGETS ${CATCH_WARNING_TARGETS} PARENT_SCOPE) diff --git a/packages/Catch2/tests/ExtraTests/CMakeLists.txt b/packages/Catch2/tests/ExtraTests/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..62319b380b9ecb4a5b9b33c3e2fab3f38a79b44d --- /dev/null +++ b/packages/Catch2/tests/ExtraTests/CMakeLists.txt @@ -0,0 +1,226 @@ +# +# Build extra tests. +# + +cmake_minimum_required( VERSION 3.5 ) + +project( Catch2ExtraTests LANGUAGES CXX ) + +message( STATUS "Extra tests included" ) + +# The MinDuration reporting tests do not need separate compilation, but +# they have non-trivial execution time, so they are categorized as +# extra tests, so that they are run less. +add_test(NAME MinDuration::SimpleThreshold COMMAND $<TARGET_FILE:SelfTest> --min-duration 0.245 [min_duration_test]) +set_tests_properties( + MinDuration::SimpleThreshold + PROPERTIES + PASS_REGULAR_EXPRESSION "s: sleep_for_250ms" + FAIL_REGULAR_EXPRESSION "sleep_for_100ms" + RUN_SERIAL ON # The test is timing sensitive, so we want to run it + # serially to avoid false positives on oversubscribed machines +) + +# -d yes overrides the threshold, so we should see the faster test even +# with a ridiculous high min duration threshold +add_test(NAME MinDuration::DurationOverrideYes COMMAND $<TARGET_FILE:SelfTest> --min-duration 1.0 -d yes [min_duration_test]) +set_tests_properties( + MinDuration::DurationOverrideYes + PROPERTIES + PASS_REGULAR_EXPRESSION "s: sleep_for_100ms" +) + +# -d no overrides the threshold, so we should never see any tests even +# with ridiculously low min duration threshold +add_test(NAME MinDuration::DurationOverrideNo COMMAND $<TARGET_FILE:SelfTest> --min-duration 0.0001 -d no [min_duration_test]) +set_tests_properties( + MinDuration::DurationOverrideNo + PROPERTIES + FAIL_REGULAR_EXPRESSION "sleep_for_250ms" +) + + +# ------------ end of duration reporting tests + +# define folders used: +set( TESTS_DIR ${CATCH_DIR}/tests/ExtraTests ) + +add_executable(PrefixedMacros ${TESTS_DIR}/X01-PrefixedMacros.cpp) +target_compile_definitions( PrefixedMacros PRIVATE CATCH_CONFIG_PREFIX_ALL CATCH_CONFIG_RUNTIME_STATIC_REQUIRE ) +# Macro configuration does not touch the compiled parts, so we can link +# it against the main library +target_link_libraries( PrefixedMacros Catch2WithMain ) + +add_test(NAME CATCH_CONFIG_PREFIX_ALL COMMAND PrefixedMacros -s) +set_tests_properties( + CATCH_CONFIG_PREFIX_ALL + PROPERTIES + PASS_REGULAR_EXPRESSION "CATCH_" + FAIL_REGULAR_EXPRESSION + # The spaces are important -> They disambiguate between CATCH_REQUIRE + # and REQUIRE without prefix. + " REQUIRE; REQUIRE_FALSE; REQUIRE_THROWS; REQUIRE_THROWS_AS; REQUIRE_THROWS_WITH; REQUIRE_THROWS_MATCHES; REQUIRE_NOTHROW; CHECK; CHECK_FALSE; CHECKED_IF; CHECKED_ELSE; CHECK_NOFAIL; CHECK_THROWS; CHECK_THROWS_AS; CHECK_THROWS_WITH; CHECK_THROWS_MATCHES; CHECK_NOTHROW; REQUIRE_THAT; CHECK_THAT" +) + + +add_executable(DisabledMacros ${TESTS_DIR}/X02-DisabledMacros.cpp) +target_compile_definitions( DisabledMacros PRIVATE CATCH_CONFIG_DISABLE ) +# Macro configuration does not touch the compiled parts, so we can link +# it against the main library +target_link_libraries( DisabledMacros Catch2WithMain ) + +add_test(NAME CATCH_CONFIG_DISABLE-1 COMMAND DisabledMacros -s) +set_tests_properties( + CATCH_CONFIG_DISABLE-1 + PROPERTIES + PASS_REGULAR_EXPRESSION "No tests ran" + FAIL_REGULAR_EXPRESSION "This should not happen" +) +add_test(NAME CATCH_CONFIG_DISABLE-2 COMMAND DisabledMacros --list-tests) +set_tests_properties( + CATCH_CONFIG_DISABLE-2 + PROPERTIES + PASS_REGULAR_EXPRESSION "0 test cases" +) + +add_executable( DisabledExceptions-DefaultHandler ${TESTS_DIR}/X03-DisabledExceptions-DefaultHandler.cpp ) +add_executable( DisabledExceptions-CustomHandler ${TESTS_DIR}/X04-DisabledExceptions-CustomHandler.cpp ) + +foreach(target DisabledExceptions-DefaultHandler DisabledExceptions-CustomHandler) + target_compile_options( ${target} + PUBLIC + $<$<CXX_COMPILER_ID:MSVC>:/EHs-c-;/D_HAS_EXCEPTIONS=0> + $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:AppleClang>>:-fno-exceptions> + ) + target_link_libraries(${target} Catch2_buildall_interface) +endforeach() +target_compile_definitions( DisabledExceptions-CustomHandler PUBLIC CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER ) + + +add_test(NAME CATCH_CONFIG_DISABLE_EXCEPTIONS-1 COMMAND DisabledExceptions-DefaultHandler "Tests that run") +set_tests_properties( + CATCH_CONFIG_DISABLE_EXCEPTIONS-1 + PROPERTIES + PASS_REGULAR_EXPRESSION "assertions: 4 \| 2 passed \| 2 failed" + FAIL_REGULAR_EXPRESSION "abort;terminate;fatal" +) + + +# The default handler on Windows leads to the just-in-time debugger firing, +# which makes this test unsuitable for CI and headless runs, as it opens +# up an interactive dialog. +if (NOT WIN32) + add_test(NAME CATCH_CONFIG_DISABLE_EXCEPTIONS-2 COMMAND DisabledExceptions-DefaultHandler "Tests that abort") + set_tests_properties( + CATCH_CONFIG_DISABLE_EXCEPTIONS-2 + PROPERTIES + PASS_REGULAR_EXPRESSION "Catch will terminate" + ) +endif(NOT WIN32) + + +add_test(NAME CATCH_CONFIG_DISABLE_EXCEPTIONS-3 COMMAND DisabledExceptions-CustomHandler "Tests that run") +set_tests_properties( + CATCH_CONFIG_DISABLE_EXCEPTIONS-3 + PROPERTIES + PASS_REGULAR_EXPRESSION "assertions: 4 \| 2 passed \| 2 failed" + FAIL_REGULAR_EXPRESSION "====== CUSTOM HANDLER ======" +) + +add_test(NAME CATCH_CONFIG_DISABLE_EXCEPTIONS-4 COMMAND DisabledExceptions-CustomHandler "Tests that abort") +set_tests_properties( + CATCH_CONFIG_DISABLE_EXCEPTIONS-4 + PROPERTIES + PASS_REGULAR_EXPRESSION "====== CUSTOM HANDLER ======" +) + + + +add_executable(FallbackStringifier ${TESTS_DIR}/X10-FallbackStringifier.cpp) +target_compile_definitions( FallbackStringifier PRIVATE CATCH_CONFIG_FALLBACK_STRINGIFIER=fallbackStringifier ) +target_link_libraries( FallbackStringifier Catch2WithMain ) + +add_test(NAME FallbackStringifier COMMAND FallbackStringifier -r compact -s) +set_tests_properties( + FallbackStringifier + PROPERTIES + PASS_REGULAR_EXPRESSION "foo{} for: { !!! }" +) + + +add_executable(DisableStringification ${TESTS_DIR}/X11-DisableStringification.cpp) +target_compile_definitions( DisableStringification PRIVATE CATCH_CONFIG_DISABLE_STRINGIFICATION ) +target_link_libraries(DisableStringification Catch2WithMain) +add_test(NAME CATCH_CONFIG_DISABLE_STRINGIFICATION COMMAND DisableStringification -r compact -s) +set_tests_properties( + CATCH_CONFIG_DISABLE_STRINGIFICATION + PROPERTIES + PASS_REGULAR_EXPRESSION "Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION" + FAIL_REGULAR_EXPRESSION "Hidden{} == Hidden{}" +) + + +# This test touches windows.h, so it should only be compiled under msvc +if (MSVC) + # This test fails if it does not compile and succeeds otherwise + add_executable(WindowsHeader ${TESTS_DIR}/X90-WindowsHeaderInclusion.cpp) + set_property( TARGET WindowsHeader PROPERTY CXX_STANDARD 14 ) + set_property( TARGET WindowsHeader PROPERTY CXX_STANDARD_REQUIRED ON ) + set_property( TARGET WindowsHeader PROPERTY CXX_EXTENSIONS OFF ) + target_link_libraries( WindowsHeader Catch2WithMain ) + add_test(NAME WindowsHeader COMMAND WindowsHeader -r compact) + list(APPEND CATCH_WARNING_TARGETS ${EXTRA_TEST_BINARIES} WindowsHeader) +endif() + +#add_executable(DebugBreakMacros ${TESTS_DIR}/X12-CustomDebugBreakMacro.cpp) +#target_link_libraries(DebugBreakMacros Catch2) +#add_test(NAME DebugBreakMacros COMMAND DebugBreakMacros --break) +#set_tests_properties( +# DebugBreakMacros +# PROPERTIES +# PASS_REGULAR_EXPRESSION "Pretty please, break into debugger" +#) + +set( EXTRA_TEST_BINARIES + PrefixedMacros + DisabledMacros + DisabledExceptions-DefaultHandler + DisabledExceptions-CustomHandler + FallbackStringifier + DisableStringification +# DebugBreakMacros +) + +# Shared config +foreach( test ${EXTRA_TEST_BINARIES} ) + set_property( TARGET ${test} PROPERTY CXX_STANDARD 14 ) + set_property( TARGET ${test} PROPERTY CXX_STANDARD_REQUIRED ON ) + set_property( TARGET ${test} PROPERTY CXX_EXTENSIONS OFF ) +endforeach() + +# Notice that we are modifying EXTRA_TEST_BINARIES destructively, do not +# use it after this point! +list(FILTER EXTRA_TEST_BINARIES EXCLUDE REGEX "DisabledExceptions.*") +list(APPEND CATCH_WARNING_TARGETS ${EXTRA_TEST_BINARIES}) +set(CATCH_WARNING_TARGETS ${CATCH_WARNING_TARGETS} PARENT_SCOPE) + + +# This sets up a one-off executable that compiles against the amalgamated +# files, and then runs it for a super simple check that the amalgamated +# files are usable. +add_executable(AmalgamatedTestCompilation + ${TESTS_DIR}/X91-AmalgamatedCatch.cpp + ${CATCH_DIR}/extras/catch_amalgamated.hpp + ${CATCH_DIR}/extras/catch_amalgamated.cpp +) +target_include_directories(AmalgamatedTestCompilation PRIVATE ${CATCH_DIR}/extras) +set_property( TARGET AmalgamatedTestCompilation PROPERTY CXX_STANDARD 14 ) +set_property( TARGET AmalgamatedTestCompilation PROPERTY CXX_STANDARD_REQUIRED ON ) +set_property( TARGET AmalgamatedTestCompilation PROPERTY CXX_EXTENSIONS OFF ) + +add_test(NAME AmalgamatedFileTest COMMAND AmalgamatedTestCompilation) +set_tests_properties( + AmalgamatedFileTest + PROPERTIES + PASS_REGULAR_EXPRESSION "All tests passed \\(14 assertions in 3 test cases\\)" +) diff --git a/packages/Catch2/tests/ExtraTests/ToDo.txt b/packages/Catch2/tests/ExtraTests/ToDo.txt new file mode 100644 index 0000000000000000000000000000000000000000..a2ed36b245cc9d7aaff40d9202bcd9f6d88ff89f --- /dev/null +++ b/packages/Catch2/tests/ExtraTests/ToDo.txt @@ -0,0 +1,10 @@ +Configuration options that are left default and thus are not properly tested +yet: + + 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_POSIX_SIGNALS // Enable handling POSIX signals + CATCH_CONFIG_WINDOWS_CRTDBG // Enable leak checking using Windows's CRT Debug Heap + CATCH_CONFIG_DEFAULT_REPORTER + CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS diff --git a/packages/Catch2/tests/ExtraTests/X01-PrefixedMacros.cpp b/packages/Catch2/tests/ExtraTests/X01-PrefixedMacros.cpp new file mode 100644 index 0000000000000000000000000000000000000000..43452d7669335d9d63ff147ab7cca9fdb60d558a --- /dev/null +++ b/packages/Catch2/tests/ExtraTests/X01-PrefixedMacros.cpp @@ -0,0 +1,83 @@ +// X01-DisableStringification.cpp +// Test that Catch's prefixed macros compile and run properly. +// This won't provide full coverage, but it might be worth checking +// the other branch as well + +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_predicate.hpp> +#include <catch2/matchers/catch_matchers_string.hpp> + +#include <type_traits> +#include <stdexcept> + +namespace { + [[noreturn]] + void this_throws() { + throw std::runtime_error("Some msg"); + } + void this_doesnt_throw() {} +} + +CATCH_TEST_CASE("PrefixedMacros") { + using namespace Catch::Matchers; + + CATCH_REQUIRE( 1 == 1 ); + CATCH_REQUIRE_FALSE( 1 != 1 ); + + CATCH_REQUIRE_THROWS(this_throws()); + CATCH_REQUIRE_THROWS_AS(this_throws(), std::runtime_error); + CATCH_REQUIRE_THROWS_WITH(this_throws(), "Some msg"); + CATCH_REQUIRE_THROWS_MATCHES(this_throws(), std::runtime_error, Predicate<std::runtime_error>([](std::runtime_error const&) { return true; })); + CATCH_REQUIRE_NOTHROW(this_doesnt_throw()); + + CATCH_CHECK( 1 == 1 ); + CATCH_CHECK_FALSE( 1 != 1 ); + CATCH_CHECKED_IF( 1 == 1 ) { + CATCH_SUCCEED("don't care"); + } CATCH_CHECKED_ELSE ( 1 == 1 ) { + CATCH_SUCCEED("don't care"); + } + + CATCH_CHECK_NOFAIL(1 == 2); + + CATCH_CHECK_THROWS(this_throws()); + CATCH_CHECK_THROWS_AS(this_throws(), std::runtime_error); + CATCH_CHECK_THROWS_WITH(this_throws(), "Some msg"); + CATCH_CHECK_THROWS_MATCHES(this_throws(), std::runtime_error, Predicate<std::runtime_error>([](std::runtime_error const&) { return true; })); + CATCH_CHECK_NOTHROW(this_doesnt_throw()); + + CATCH_REQUIRE_THAT("abcd", Equals("abcd")); + CATCH_CHECK_THAT("bdef", Equals("bdef")); + + CATCH_INFO( "some info" ); + CATCH_UNSCOPED_INFO( "some info" ); + CATCH_WARN( "some warn" ); + CATCH_SECTION("some section") { + int i = 1; + CATCH_CAPTURE( i ); + CATCH_DYNAMIC_SECTION("Dynamic section: " << i) { + CATCH_FAIL_CHECK( "failure" ); + } + } + + CATCH_STATIC_REQUIRE( std::is_void<void>::value ); + CATCH_STATIC_REQUIRE_FALSE( std::is_void<int>::value ); + CATCH_FAIL(""); +} + +// Missing: + +// +// #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__ ) +// +// // "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 ) INTERNAL_CATCH_DYNAMIC_SECTION( " Given: " << desc ) +// #define CATCH_WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " When: " << desc ) +// #define CATCH_AND_WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( "And when: " << desc ) +// #define CATCH_THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " Then: " << desc ) +// #define CATCH_AND_THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And: " << desc ) +// diff --git a/packages/Catch2/tests/ExtraTests/X02-DisabledMacros.cpp b/packages/Catch2/tests/ExtraTests/X02-DisabledMacros.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c2d997c9ccf37452d0cf4a21fdaf61e7a68039d0 --- /dev/null +++ b/packages/Catch2/tests/ExtraTests/X02-DisabledMacros.cpp @@ -0,0 +1,39 @@ +// X02-DisabledMacros.cpp +// Test that CATCH_CONFIG_DISABLE turns off TEST_CASE autoregistration +// and expressions in assertion macros are not run. + +#include <catch2/catch_test_macros.hpp> + +#include <iostream> + +struct foo { + foo(){ + REQUIRE_NOTHROW( print() ); + } + void print() const { + std::cout << "This should not happen\n"; + } +}; + +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wglobal-constructors" +#endif +// Construct foo, but `foo::print` should not be run +foo f; + + +#if defined(__clang__) +// The test is unused since the registration is disabled +#pragma clang diagnostic ignored "-Wunused-function" +#endif + +// This test should not be run, because it won't be registered +TEST_CASE( "Disabled Macros" ) { + std::cout << "This should not happen\n"; + FAIL(); +} + +#if defined(__clang__) +#pragma clang diagnostic pop +#endif diff --git a/packages/Catch2/tests/ExtraTests/X03-DisabledExceptions-DefaultHandler.cpp b/packages/Catch2/tests/ExtraTests/X03-DisabledExceptions-DefaultHandler.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c981fa0bb9fdaabae48441ac92c00c049251c139 --- /dev/null +++ b/packages/Catch2/tests/ExtraTests/X03-DisabledExceptions-DefaultHandler.cpp @@ -0,0 +1,22 @@ +#include <catch2/catch_test_macros.hpp> + +TEST_CASE("Tests that run") { + // All of these should be run and be reported + CHECK(1 == 2); + CHECK(1 == 1); + CHECK(1 != 3); + CHECK(1 == 4); +} + + + +TEST_CASE("Tests that abort") { + // Avoid abort and other exceptional exits -- there is no way + // to tell CMake that abort is the desired outcome of a test. + std::set_terminate([](){exit(1);}); + REQUIRE(1 == 1); + REQUIRE(1 != 2); + REQUIRE(1 == 3); + // We should not get here, because the test above aborts + REQUIRE(1 != 4); +} diff --git a/packages/Catch2/tests/ExtraTests/X04-DisabledExceptions-CustomHandler.cpp b/packages/Catch2/tests/ExtraTests/X04-DisabledExceptions-CustomHandler.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ae698165e2103ec29b908b1f4ee2068fcd63854b --- /dev/null +++ b/packages/Catch2/tests/ExtraTests/X04-DisabledExceptions-CustomHandler.cpp @@ -0,0 +1,30 @@ +#include <catch2/catch_test_macros.hpp> + +namespace Catch { + [[noreturn]] + void throw_exception(std::exception const& e) { + Catch::cerr() << "====== CUSTOM HANDLER ====== run terminates because an exception was thrown.\n" + << "The message was: " << e.what() << '\n'; + // Avoid abort and other exceptional exits -- there is no way + // to tell CMake that abort is the desired outcome of a test. + exit(1); + } +} + +TEST_CASE("Tests that run") { + // All of these should be run and be reported + CHECK(1 == 2); + CHECK(1 == 1); + CHECK(1 != 3); + CHECK(1 == 4); +} + + + +TEST_CASE("Tests that abort") { + REQUIRE(1 == 1); + REQUIRE(1 != 2); + REQUIRE(1 == 3); + // We should not get here, because the test above aborts + REQUIRE(1 != 4); +} diff --git a/packages/Catch2/tests/ExtraTests/X10-FallbackStringifier.cpp b/packages/Catch2/tests/ExtraTests/X10-FallbackStringifier.cpp new file mode 100644 index 0000000000000000000000000000000000000000..af31047b4f730448deb9e35eb973c7d4632d5df1 --- /dev/null +++ b/packages/Catch2/tests/ExtraTests/X10-FallbackStringifier.cpp @@ -0,0 +1,22 @@ +// X10-FallbackStringifier.cpp +// Test that defining fallbackStringifier compiles + +#include <string> + +// A catch-all stringifier +template <typename T> +std::string fallbackStringifier(T const&) { + return "{ !!! }"; +} + +#include <catch2/catch_test_macros.hpp> + +struct foo { + explicit operator bool() const { + return true; + } +}; + +TEST_CASE("aa") { + REQUIRE(foo{}); +} diff --git a/packages/Catch2/tests/ExtraTests/X11-DisableStringification.cpp b/packages/Catch2/tests/ExtraTests/X11-DisableStringification.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b127d246a838074e8bf08c45cdc3b21bcaa3e573 --- /dev/null +++ b/packages/Catch2/tests/ExtraTests/X11-DisableStringification.cpp @@ -0,0 +1,17 @@ +// X11-DisableStringification.cpp +// Test that stringification of original expression can be disabled +// this is a workaround for VS 2017 issue with Raw String literal +// and preprocessor token pasting. In other words, hopefully this test +// will be deleted soon :-) + +#include <catch2/catch_test_macros.hpp> + +namespace { + struct Hidden {}; + + bool operator==(Hidden, Hidden) { return true; } +} + +TEST_CASE("DisableStringification") { + REQUIRE( Hidden{} == Hidden{} ); +} diff --git a/packages/Catch2/tests/ExtraTests/X12-CustomDebugBreakMacro.cpp b/packages/Catch2/tests/ExtraTests/X12-CustomDebugBreakMacro.cpp new file mode 100644 index 0000000000000000000000000000000000000000..25ab4a0ec85494ca6c106cb97feb829b481182e3 --- /dev/null +++ b/packages/Catch2/tests/ExtraTests/X12-CustomDebugBreakMacro.cpp @@ -0,0 +1,17 @@ +// X12-CustomDebugBreakMacro.cpp +// Test that user-defined `CATCH_BREAK_INTO_DEBUGGER` is respected and used. + +#include <iostream> + +void custom_debug_break() { + std::cerr << "Pretty please, break into debugger\n"; +} + +#define CATCH_BREAK_INTO_DEBUGGER() custom_debug_break() + +#define CATCH_CONFIG_MAIN +#include <catch2/catch.hpp> + +TEST_CASE("Failing test that breaks into debugger", "[macros]") { + REQUIRE(1 == 2); +} diff --git a/packages/Catch2/tests/ExtraTests/X90-WindowsHeaderInclusion.cpp b/packages/Catch2/tests/ExtraTests/X90-WindowsHeaderInclusion.cpp new file mode 100644 index 0000000000000000000000000000000000000000..307e877f21504d5df77e99f44f0b191eeb342ca8 --- /dev/null +++ b/packages/Catch2/tests/ExtraTests/X90-WindowsHeaderInclusion.cpp @@ -0,0 +1,11 @@ +// X90-WindowsHeaderInclusion.cpp +// Test that the Catch2 header compiles even after including windows.h +// without defining NOMINMAX first. As an FYI, if you do that, you are +// wrong. + +#include <windows.h> +#include <catch2/catch_test_macros.hpp> + +TEST_CASE("Catch2 did survive compilation with windows.h", "[compile-test]") { + SUCCEED(); +} diff --git a/packages/Catch2/tests/ExtraTests/X91-AmalgamatedCatch.cpp b/packages/Catch2/tests/ExtraTests/X91-AmalgamatedCatch.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e3b31f9b26285411ca68447669cb17f8bf61bbae --- /dev/null +++ b/packages/Catch2/tests/ExtraTests/X91-AmalgamatedCatch.cpp @@ -0,0 +1,31 @@ +/**\file + * + * This file serves as a simple compilation test against the amalgamated + * version of Catch2. + */ + +#include "catch_amalgamated.hpp" + +TEST_CASE("Just a dummy test") { + auto i = GENERATE(1, 2, 3); + SECTION("a") { + REQUIRE(1 != 4); + } + SECTION("b") { + CHECK(1 != 5); + } + REQUIRE_THAT(1, + Catch::Matchers::Predicate<int>([](int i) { + return i % 2 == 1; + })); +} + +TEMPLATE_TEST_CASE("Trivial template test case", "", char, short) { + STATIC_REQUIRE(sizeof(TestType) <= sizeof(int)); +} + +TEST_CASE("Benchmark test", "[!benchmark]") { + BENCHMARK("Allocation benchmark") { + return std::vector<int>(10); + }; +} diff --git a/packages/Catch2/tests/SelfTest/Baselines/automake.std.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/automake.std.approved.txt new file mode 100644 index 0000000000000000000000000000000000000000..057be069f4f8af948289418fdec49dcc049a55b9 --- /dev/null +++ b/packages/Catch2/tests/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 truncated +: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/packages/Catch2/tests/SelfTest/Baselines/automake.sw.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/automake.sw.approved.txt new file mode 100644 index 0000000000000000000000000000000000000000..983d97648460c4d43cb32b32b0150f6cedf0ca06 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/Baselines/automake.sw.approved.txt @@ -0,0 +1,364 @@ +:test-result: PASS # A test name that starts with a # +:test-result: PASS #1005: Comparing pointer to int and long (NULL can be either on various systems) +:test-result: PASS #1027: Bitfields can be captured +:test-result: PASS #1147 +:test-result: PASS #1175 - Hidden Test +:test-result: PASS #1238 +:test-result: PASS #1245 +:test-result: PASS #1319: Sections can have description (even if it is not saved +:test-result: PASS #1403 +:test-result: FAIL #1455 - INFO and WARN can start with a linebreak +This would not be caught previously +Nor would this +:test-result: FAIL #1514: stderr/stdout is not captured in tests aborted by an exception +:test-result: PASS #1548 +:test-result: PASS #1905 -- test spec parser properly clears internal state between compound tests +:test-result: PASS #1912 -- test spec parser handles escaping +:test-result: PASS #1913 - GENERATE inside a for loop should not keep recreating the generator +:test-result: PASS #1913 - GENERATEs can share a line +:test-result: PASS #1938 - GENERATE after a section +:test-result: PASS #1938 - Section followed by flat generate +:test-result: PASS #1938 - flat generate +:test-result: PASS #1938 - mixed sections and generates +:test-result: PASS #1938 - nested generate +:test-result: PASS #1954 - 7 arg template test case sig compiles - 1, 1, 1, 1, 1, 0, 0 +:test-result: PASS #1954 - 7 arg template test case sig compiles - 5, 1, 1, 1, 1, 0, 0 +:test-result: PASS #1954 - 7 arg template test case sig compiles - 5, 3, 1, 1, 1, 0, 0 +:test-result: XFAIL #748 - captures with unexpected exceptions +:test-result: PASS #809 +:test-result: PASS #833 +:test-result: XFAIL #835 -- errno should not be touched by Catch +:test-result: PASS #872 +:test-result: PASS #961 -- Dynamically created sections should all be reported +: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: PASS 3x3x3 ints +: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 TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<float> +:test-result: FAIL A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<int> +:test-result: FAIL A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<float> +:test-result: FAIL A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<int> +:test-result: PASS A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - Template_Foo<float> +:test-result: PASS A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - Template_Foo<int> +:test-result: PASS A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - std::vector<float> +:test-result: PASS A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - std::vector<int> +:test-result: FAIL A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<float, 6> +:test-result: FAIL A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<int, 2> +:test-result: FAIL A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<float, 6> +:test-result: FAIL A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<int, 2> +:test-result: PASS A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - Template_Foo_2<float,6> +:test-result: PASS A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - Template_Foo_2<int,2> +:test-result: PASS A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - std::array<float,6> +:test-result: PASS A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - std::array<int,2> +:test-result: FAIL A TEMPLATE_TEST_CASE_METHOD based test run that fails - double +:test-result: FAIL A TEMPLATE_TEST_CASE_METHOD based test run that fails - float +:test-result: FAIL A TEMPLATE_TEST_CASE_METHOD based test run that fails - int +:test-result: PASS A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - double +:test-result: PASS A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - float +:test-result: PASS A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - int +:test-result: FAIL A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 1 +:test-result: FAIL A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 3 +:test-result: FAIL A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 6 +:test-result: PASS A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 1 +:test-result: PASS A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 3 +:test-result: PASS A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6 +: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: PASS A Template product test case - Foo<float> +:test-result: PASS A Template product test case - Foo<int> +:test-result: PASS A Template product test case - std::vector<float> +:test-result: PASS A Template product test case - std::vector<int> +:test-result: PASS A Template product test case with array signature - Bar<float, 42> +:test-result: PASS A Template product test case with array signature - Bar<int, 9> +:test-result: PASS A Template product test case with array signature - std::array<float, 42> +:test-result: PASS A Template product test case with array signature - std::array<int, 9> +:test-result: PASS A comparison that uses literals instead of the normal constructor +: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 Absolute margin +:test-result: FAIL 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 Approx setters validate their arguments +:test-result: PASS Approx with exactly-representable margin +: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 Arbitrary predicate matcher +:test-result: PASS Assertion macros support bit operators and bool conversions +:test-result: PASS Assertions then sections +:test-result: PASS Basic use of the Contains range matcher +:test-result: PASS Basic use of the Empty range matcher +:test-result: PASS CAPTURE can deal with complex expressions +:test-result: PASS CAPTURE can deal with complex expressions involving commas +:test-result: PASS CAPTURE parses string and character constants +:test-result: PASS Capture and info messages +:test-result: PASS Character pretty printing +:test-result: PASS Clara::Arg supports single-arg parse the way Opt does +:test-result: PASS Combining MatchAllOfGeneric does not nest +:test-result: PASS Combining MatchAnyOfGeneric does not nest +:test-result: PASS Combining MatchNotOfGeneric does not nest +:test-result: PASS Combining concrete matchers does not use templated matchers +:test-result: PASS Combining only templated matchers +:test-result: PASS Combining templated and concrete matchers +:test-result: PASS Combining templated matchers +:test-result: PASS Commas in various macros are allowed +:test-result: PASS Comparing function pointers +:test-result: PASS Comparison ops +:test-result: PASS Comparison with explicitly convertible types +: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: PASS Composed generic matchers shortcircuit +:test-result: PASS Composed matchers shortcircuit +:test-result: FAIL Contains string matcher +:test-result: PASS Copy and then generate a range +: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 Default scale is invisible to comparison +:test-result: PASS Directly creating an EnumInfo +:test-result: FAIL EndsWith string matcher +:test-result: PASS Enums can quickly have stringification enabled using REGISTER_ENUM +:test-result: PASS Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM +:test-result: PASS Epsilon only applies to Approx's value +: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 as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified +:test-result: FAIL Exception matchers that fail +:test-result: PASS Exception matchers that succeed +:test-result: PASS Exception messages can be tested for +:test-result: PASS Exceptions matchers +: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: FAIL FAIL_CHECK does not abort the test +:test-result: PASS Factorials are computed +:test-result: PASS Floating point matchers: double +:test-result: PASS Floating point matchers: float +:test-result: PASS Generators -- adapters +:test-result: PASS Generators -- simple +:test-result: PASS Generators internals +:test-result: PASS Greater-than inequalities with different epsilons +:test-result: FAIL 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: FAIL INFO is reset for each loop +:test-result: XFAIL Inequality checks that should fail +:test-result: PASS Inequality checks that should succeed +:test-result: PASS Lambdas in assertions +:test-result: PASS Less-than inequalities with different epsilons +: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 Nested generators and captured variables +:test-result: FAIL Nice descriptive name +:test-result: FAIL Non-std exceptions can be translated +:test-result: PASS Objects that evaluated in boolean contexts can be checked +:test-result: PASS Optionally static assertions +:test-result: FAIL Ordering comparison checks that should fail +:test-result: PASS Ordering comparison checks that should succeed +:test-result: PASS Our PCG implementation provides expected results for known seeds +:test-result: FAIL Output from all sections is reported +:test-result: PASS Overloaded comma or address-of operators are not used +:test-result: PASS Parse test names and tags +:test-result: PASS Pointers can be compared to null +:test-result: PASS Precision of floating point stringification can be set +:test-result: PASS Predicate matcher can accept const char* +:test-result: PASS Process can be configured on command line +:test-result: PASS Product with differing arities - std::tuple<int, double, float> +:test-result: PASS Product with differing arities - std::tuple<int, double> +:test-result: PASS Product with differing arities - std::tuple<int> +:test-result: PASS Range type with sentinel +:test-result: FAIL Reconstruction should be based on stringification: #914 +:test-result: FAIL Regex string matcher +:test-result: PASS Regression test #1 +:test-result: PASS Reporter's write listings to provided stream +:test-result: PASS SUCCEED counts as a test pass +:test-result: PASS SUCCEED 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 +A string sent to stderr via clog +:test-result: FAIL Sends stuff to stdout and stderr +:test-result: PASS Some simple comparisons between doubles +Message from section one +Message from section two +:test-result: FAIL Standard output from all sections is reported +:test-result: FAIL StartsWith string matcher +:test-result: PASS Static arrays are convertible to string +:test-result: PASS String matchers +:test-result: PASS StringRef +:test-result: PASS StringRef at compilation time +:test-result: PASS Stringifying std::chrono::duration helpers +:test-result: PASS Stringifying std::chrono::duration with weird ratios +:test-result: PASS Stringifying std::chrono::time_point<system_clock> +:test-result: FAIL Tabs and newlines show in output +:test-result: PASS Tag alias can be registered against tag patterns +:test-result: PASS Template test case method with test types specified inside std::tuple - MyTypes - 0 +:test-result: PASS Template test case method with test types specified inside std::tuple - MyTypes - 1 +:test-result: PASS Template test case method with test types specified inside std::tuple - MyTypes - 2 +:test-result: PASS Template test case with test types specified inside non-copyable and non-movable std::tuple - NonCopyableAndNonMovableTypes - 0 +:test-result: PASS Template test case with test types specified inside non-copyable and non-movable std::tuple - NonCopyableAndNonMovableTypes - 1 +:test-result: PASS Template test case with test types specified inside non-default-constructible std::tuple - MyNonDefaultConstructibleTypes - 0 +:test-result: PASS Template test case with test types specified inside non-default-constructible std::tuple - MyNonDefaultConstructibleTypes - 1 +:test-result: PASS Template test case with test types specified inside std::tuple - MyTypes - 0 +:test-result: PASS Template test case with test types specified inside std::tuple - MyTypes - 1 +:test-result: PASS Template test case with test types specified inside std::tuple - MyTypes - 2 +:test-result: PASS TemplateTest: vectors can be sized and resized - float +:test-result: PASS TemplateTest: vectors can be sized and resized - int +:test-result: PASS TemplateTest: vectors can be sized and resized - std::string +:test-result: PASS TemplateTest: vectors can be sized and resized - std::tuple<int,float> +:test-result: PASS TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +:test-result: PASS TemplateTestSig: vectors can be sized and resized - float,4 +:test-result: PASS TemplateTestSig: vectors can be sized and resized - int,5 +:test-result: PASS TemplateTestSig: vectors can be sized and resized - std::string,15 +:test-result: PASS Test case with one argument +:test-result: PASS Test enum bit values +:test-result: PASS Test with special, characters "in name +:test-result: FAIL The NO_FAIL macro reports a failure but does not fail the test +:test-result: PASS The default listing implementation write to provided stream +:test-result: FAIL This test 'should' fail but doesn't +:test-result: FAIL Thrown string literals are translated +:test-result: PASS Tracker +:test-result: PASS Trim strings +:test-result: FAIL Unexpected exceptions can be translated +:test-result: PASS Upcasting special member functions +:test-result: PASS Usage of AllMatch range matcher +:test-result: PASS Usage of AnyMatch range matcher +:test-result: PASS Usage of NoneMatch range matcher +:test-result: PASS Usage of the SizeIs range matcher +:test-result: PASS Use a custom approx +:test-result: PASS Variadic macros +:test-result: PASS Vector Approx matcher +:test-result: FAIL Vector Approx matcher -- failing +:test-result: PASS Vector matchers +:test-result: FAIL Vector matchers that fail +: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: FAIL When unchecked exceptions are thrown, but caught, they do not affect the test +:test-result: FAIL Where the LHS is not a simple value +:test-result: FAIL 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 analyse no analysis +:test-result: PASS array<int, N> -> toString +:test-result: PASS atomic if +:test-result: PASS benchmark function call +: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 classify_outliers +:test-result: PASS comparisons between const int variables +:test-result: PASS comparisons between int variables +:test-result: PASS erfc_inv +:test-result: PASS estimate_clock_resolution +:test-result: PASS even more nested SECTION tests +:test-result: FAIL first tag +loose text artifact +:test-result: FAIL has printf +:test-result: FAIL just failure +:test-result: FAIL just failure after unscoped info +:test-result: FAIL just info +:test-result: FAIL just unscoped info +:test-result: PASS long long +:test-result: FAIL looped SECTION tests +:test-result: FAIL looped tests +:test-result: PASS make_unique reimplementation +:test-result: PASS mean +:test-result: PASS measure +:test-result: FAIL mix info, unscoped info and warning +:test-result: FAIL more nested SECTION tests +:test-result: PASS nested SECTION tests +:test-result: PASS non streamable - with conv. op +:test-result: PASS non-copyable objects +:test-result: PASS normal_cdf +:test-result: PASS normal_quantile +:test-result: PASS not allowed +:test-result: FAIL not prints unscoped info from previous failures +:test-result: PASS null strings +:test-result: PASS null_ptr +:test-result: PASS pair<pair<int,const char *,pair<std::string,int> > -> toString +:test-result: PASS parseEnums +:test-result: PASS pointer to class +:test-result: PASS print unscoped info if passing unscoped info is printed +:test-result: FAIL prints unscoped info on failure +:test-result: FAIL prints unscoped info only for the first assertion +:test-result: PASS random SECTION tests +:test-result: PASS replaceInPlace +:test-result: PASS resolution +:test-result: PASS run_for_at_least, chronometer +:test-result: PASS run_for_at_least, int +:test-result: FAIL second tag +:test-result: FAIL send a single char to INFO +:test-result: FAIL sends information to INFO +:test-result: PASS shortened hide tags are split apart +:test-result: PASS splitString +:test-result: FAIL stacks unscoped info in loops +:test-result: PASS std::map is convertible string +:test-result: PASS std::pair<int,const std::string> -> toString +:test-result: PASS std::pair<int,std::string> -> toString +:test-result: PASS std::set is convertible string +: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 stringify ranges +:test-result: PASS stringify( has_maker ) +:test-result: PASS stringify( has_maker_and_operator ) +:test-result: PASS stringify( has_neither ) +:test-result: PASS stringify( has_operator ) +:test-result: PASS stringify( has_template_operator ) +:test-result: PASS stringify( vectors<has_maker> ) +:test-result: PASS stringify( vectors<has_maker_and_operator> ) +:test-result: PASS stringify( vectors<has_operator> ) +:test-result: PASS strlen3 +:test-result: PASS tables +:test-result: FAIL thrown std::strings are translated +: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(enum class w/operator<<) +:test-result: PASS toString(enum class) +:test-result: PASS toString(enum w/operator<<) +:test-result: PASS toString(enum) +:test-result: PASS tuple<> +:test-result: PASS tuple<float,int> +:test-result: PASS tuple<int> +:test-result: PASS tuple<0,int,const char *> +:test-result: PASS tuple<string,string> +:test-result: PASS tuple<tuple<int>,tuple<>,float> +:test-result: PASS uniform samples +:test-result: PASS unique_ptr reimplementation: basic functionality +:test-result: PASS vec<vec<string,alloc>> -> toString +:test-result: PASS vector<bool> -> toString +:test-result: PASS vector<int,allocator> -> toString +:test-result: PASS vector<int> -> toString +:test-result: PASS vector<string> -> toString +:test-result: PASS vectors can be sized and resized +:test-result: PASS warmup +:test-result: PASS weighted_average_quantile +:test-result: PASS xmlentitycheck diff --git a/packages/Catch2/tests/SelfTest/Baselines/compact.sw.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/compact.sw.approved.txt new file mode 100644 index 0000000000000000000000000000000000000000..3b19a962d734709564684e6491a3ce42bbad944a --- /dev/null +++ b/packages/Catch2/tests/SelfTest/Baselines/compact.sw.approved.txt @@ -0,0 +1,2357 @@ +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: {?} >= {?} +Misc.tests.cpp:<line number>: passed: +Compilation.tests.cpp:<line number>: passed: std::memcmp(uarr, "123", sizeof(uarr)) == 0 for: 0 == 0 with 2 messages: 'uarr := "123"' and 'sarr := "456"' +Compilation.tests.cpp:<line number>: passed: std::memcmp(sarr, "456", sizeof(sarr)) == 0 for: 0 == 0 with 2 messages: 'uarr := "123"' and 'sarr := "456"' +Compilation.tests.cpp:<line number>: passed: +Compilation.tests.cpp:<line number>: passed: +Compilation.tests.cpp:<line number>: passed: h1 == h2 for: [1403 helper] == [1403 helper] +Message.tests.cpp:<line number>: warning: ' +This info message starts with a linebreak' with 1 message: ' +This warning message starts with a linebreak' +This would not be caught previously +Nor would this +Tricky.tests.cpp:<line number>: failed: explicitly with 1 message: '1514' +Compilation.tests.cpp:<line number>: passed: std::is_same<TypeList<int>, TypeList<int>>::value for: true +CmdLine.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase("spec . char")) for: true +CmdLine.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase("spec , char")) for: true +CmdLine.tests.cpp:<line number>: passed: !(spec.matches(*fakeTestCase(R"(spec \, char)"))) for: !false +CmdLine.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase(R"(spec {a} char)")) for: true +CmdLine.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase(R"(spec [a] char)")) for: true +CmdLine.tests.cpp:<line number>: passed: !(spec.matches(*fakeTestCase("differs but has similar tag", "[a]"))) for: !false +CmdLine.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase(R"(spec \ char)")) for: true +Generators.tests.cpp:<line number>: passed: counter < 7 for: 3 < 7 +Generators.tests.cpp:<line number>: passed: counter < 7 for: 6 < 7 +Generators.tests.cpp:<line number>: passed: i != j for: 1 != 3 +Generators.tests.cpp:<line number>: passed: i != j for: 1 != 4 +Generators.tests.cpp:<line number>: passed: i != j for: 2 != 3 +Generators.tests.cpp:<line number>: passed: i != j for: 2 != 4 +PartTracker.tests.cpp:<line number>: passed: with 1 message: 'A' +PartTracker.tests.cpp:<line number>: passed: m for: 1 +PartTracker.tests.cpp:<line number>: passed: m for: 2 +PartTracker.tests.cpp:<line number>: passed: m for: 3 +PartTracker.tests.cpp:<line number>: passed: 1 +PartTracker.tests.cpp:<line number>: passed: m for: 2 +PartTracker.tests.cpp:<line number>: passed: m for: 3 +PartTracker.tests.cpp:<line number>: passed: m for: 1 +PartTracker.tests.cpp:<line number>: passed: m for: 2 +PartTracker.tests.cpp:<line number>: passed: m for: 3 +PartTracker.tests.cpp:<line number>: passed: with 1 message: 'A' +PartTracker.tests.cpp:<line number>: passed: with 3 messages: 'i := 1' and 'j := 3' and 'k := 5' +PartTracker.tests.cpp:<line number>: passed: with 1 message: 'B' +PartTracker.tests.cpp:<line number>: passed: with 3 messages: 'i := 1' and 'j := 3' and 'k := 6' +PartTracker.tests.cpp:<line number>: passed: with 1 message: 'B' +PartTracker.tests.cpp:<line number>: passed: with 3 messages: 'i := 1' and 'j := 4' and 'k := 5' +PartTracker.tests.cpp:<line number>: passed: with 3 messages: 'i := 1' and 'j := 4' and 'k := 6' +PartTracker.tests.cpp:<line number>: passed: with 1 message: 'A' +PartTracker.tests.cpp:<line number>: passed: with 3 messages: 'i := 2' and 'j := 3' and 'k := 5' +PartTracker.tests.cpp:<line number>: passed: with 1 message: 'B' +PartTracker.tests.cpp:<line number>: passed: with 3 messages: 'i := 2' and 'j := 3' and 'k := 6' +PartTracker.tests.cpp:<line number>: passed: with 1 message: 'B' +PartTracker.tests.cpp:<line number>: passed: with 3 messages: 'i := 2' and 'j := 4' and 'k := 5' +PartTracker.tests.cpp:<line number>: passed: with 3 messages: 'i := 2' and 'j := 4' and 'k := 6' +PartTracker.tests.cpp:<line number>: passed: m for: 1 +PartTracker.tests.cpp:<line number>: passed: n for: 1 +PartTracker.tests.cpp:<line number>: passed: m for: 1 +PartTracker.tests.cpp:<line number>: passed: n for: 2 +PartTracker.tests.cpp:<line number>: passed: m for: 1 +PartTracker.tests.cpp:<line number>: passed: n for: 3 +PartTracker.tests.cpp:<line number>: passed: m for: 2 +PartTracker.tests.cpp:<line number>: passed: n for: 1 +PartTracker.tests.cpp:<line number>: passed: m for: 2 +PartTracker.tests.cpp:<line number>: passed: n for: 2 +PartTracker.tests.cpp:<line number>: passed: m for: 2 +PartTracker.tests.cpp:<line number>: passed: n for: 3 +PartTracker.tests.cpp:<line number>: passed: m for: 3 +PartTracker.tests.cpp:<line number>: passed: n for: 1 +PartTracker.tests.cpp:<line number>: passed: m for: 3 +PartTracker.tests.cpp:<line number>: passed: n for: 2 +PartTracker.tests.cpp:<line number>: passed: m for: 3 +PartTracker.tests.cpp:<line number>: passed: n for: 3 +Misc.tests.cpp:<line number>: passed: +Misc.tests.cpp:<line number>: passed: +Misc.tests.cpp:<line number>: passed: +Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'answer := 42' with 1 message: 'expected exception' +Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'answer := 42'; expression was: thisThrows() with 1 message: 'expected exception' +Exception.tests.cpp:<line number>: passed: thisThrows() with 1 message: 'answer := 42' +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::Matchers::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 +Generators.tests.cpp:<line number>: passed: x < y for: 1 < 4 +Generators.tests.cpp:<line number>: passed: y < z for: 4 < 7 +Generators.tests.cpp:<line number>: passed: x < z for: 1 < 7 +Generators.tests.cpp:<line number>: passed: x < y for: 1 < 4 +Generators.tests.cpp:<line number>: passed: y < z for: 4 < 8 +Generators.tests.cpp:<line number>: passed: x < z for: 1 < 8 +Generators.tests.cpp:<line number>: passed: x < y for: 1 < 4 +Generators.tests.cpp:<line number>: passed: y < z for: 4 < 9 +Generators.tests.cpp:<line number>: passed: x < z for: 1 < 9 +Generators.tests.cpp:<line number>: passed: x < y for: 1 < 5 +Generators.tests.cpp:<line number>: passed: y < z for: 5 < 7 +Generators.tests.cpp:<line number>: passed: x < z for: 1 < 7 +Generators.tests.cpp:<line number>: passed: x < y for: 1 < 5 +Generators.tests.cpp:<line number>: passed: y < z for: 5 < 8 +Generators.tests.cpp:<line number>: passed: x < z for: 1 < 8 +Generators.tests.cpp:<line number>: passed: x < y for: 1 < 5 +Generators.tests.cpp:<line number>: passed: y < z for: 5 < 9 +Generators.tests.cpp:<line number>: passed: x < z for: 1 < 9 +Generators.tests.cpp:<line number>: passed: x < y for: 1 < 6 +Generators.tests.cpp:<line number>: passed: y < z for: 6 < 7 +Generators.tests.cpp:<line number>: passed: x < z for: 1 < 7 +Generators.tests.cpp:<line number>: passed: x < y for: 1 < 6 +Generators.tests.cpp:<line number>: passed: y < z for: 6 < 8 +Generators.tests.cpp:<line number>: passed: x < z for: 1 < 8 +Generators.tests.cpp:<line number>: passed: x < y for: 1 < 6 +Generators.tests.cpp:<line number>: passed: y < z for: 6 < 9 +Generators.tests.cpp:<line number>: passed: x < z for: 1 < 9 +Generators.tests.cpp:<line number>: passed: x < y for: 2 < 4 +Generators.tests.cpp:<line number>: passed: y < z for: 4 < 7 +Generators.tests.cpp:<line number>: passed: x < z for: 2 < 7 +Generators.tests.cpp:<line number>: passed: x < y for: 2 < 4 +Generators.tests.cpp:<line number>: passed: y < z for: 4 < 8 +Generators.tests.cpp:<line number>: passed: x < z for: 2 < 8 +Generators.tests.cpp:<line number>: passed: x < y for: 2 < 4 +Generators.tests.cpp:<line number>: passed: y < z for: 4 < 9 +Generators.tests.cpp:<line number>: passed: x < z for: 2 < 9 +Generators.tests.cpp:<line number>: passed: x < y for: 2 < 5 +Generators.tests.cpp:<line number>: passed: y < z for: 5 < 7 +Generators.tests.cpp:<line number>: passed: x < z for: 2 < 7 +Generators.tests.cpp:<line number>: passed: x < y for: 2 < 5 +Generators.tests.cpp:<line number>: passed: y < z for: 5 < 8 +Generators.tests.cpp:<line number>: passed: x < z for: 2 < 8 +Generators.tests.cpp:<line number>: passed: x < y for: 2 < 5 +Generators.tests.cpp:<line number>: passed: y < z for: 5 < 9 +Generators.tests.cpp:<line number>: passed: x < z for: 2 < 9 +Generators.tests.cpp:<line number>: passed: x < y for: 2 < 6 +Generators.tests.cpp:<line number>: passed: y < z for: 6 < 7 +Generators.tests.cpp:<line number>: passed: x < z for: 2 < 7 +Generators.tests.cpp:<line number>: passed: x < y for: 2 < 6 +Generators.tests.cpp:<line number>: passed: y < z for: 6 < 8 +Generators.tests.cpp:<line number>: passed: x < z for: 2 < 8 +Generators.tests.cpp:<line number>: passed: x < y for: 2 < 6 +Generators.tests.cpp:<line number>: passed: y < z for: 6 < 9 +Generators.tests.cpp:<line number>: passed: x < z for: 2 < 9 +Generators.tests.cpp:<line number>: passed: x < y for: 3 < 4 +Generators.tests.cpp:<line number>: passed: y < z for: 4 < 7 +Generators.tests.cpp:<line number>: passed: x < z for: 3 < 7 +Generators.tests.cpp:<line number>: passed: x < y for: 3 < 4 +Generators.tests.cpp:<line number>: passed: y < z for: 4 < 8 +Generators.tests.cpp:<line number>: passed: x < z for: 3 < 8 +Generators.tests.cpp:<line number>: passed: x < y for: 3 < 4 +Generators.tests.cpp:<line number>: passed: y < z for: 4 < 9 +Generators.tests.cpp:<line number>: passed: x < z for: 3 < 9 +Generators.tests.cpp:<line number>: passed: x < y for: 3 < 5 +Generators.tests.cpp:<line number>: passed: y < z for: 5 < 7 +Generators.tests.cpp:<line number>: passed: x < z for: 3 < 7 +Generators.tests.cpp:<line number>: passed: x < y for: 3 < 5 +Generators.tests.cpp:<line number>: passed: y < z for: 5 < 8 +Generators.tests.cpp:<line number>: passed: x < z for: 3 < 8 +Generators.tests.cpp:<line number>: passed: x < y for: 3 < 5 +Generators.tests.cpp:<line number>: passed: y < z for: 5 < 9 +Generators.tests.cpp:<line number>: passed: x < z for: 3 < 9 +Generators.tests.cpp:<line number>: passed: x < y for: 3 < 6 +Generators.tests.cpp:<line number>: passed: y < z for: 6 < 7 +Generators.tests.cpp:<line number>: passed: x < z for: 3 < 7 +Generators.tests.cpp:<line number>: passed: x < y for: 3 < 6 +Generators.tests.cpp:<line number>: passed: y < z for: 6 < 8 +Generators.tests.cpp:<line number>: passed: x < z for: 3 < 8 +Generators.tests.cpp:<line number>: passed: x < y for: 3 < 6 +Generators.tests.cpp:<line number>: passed: y < z for: 6 < 9 +Generators.tests.cpp:<line number>: passed: x < z for: 3 < 9 +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: Template_Fixture_2<TestType>::m_a.size() == 1 for: 0 == 1 +Class.tests.cpp:<line number>: failed: Template_Fixture_2<TestType>::m_a.size() == 1 for: 0 == 1 +Class.tests.cpp:<line number>: failed: Template_Fixture_2<TestType>::m_a.size() == 1 for: 0 == 1 +Class.tests.cpp:<line number>: failed: Template_Fixture_2<TestType>::m_a.size() == 1 for: 0 == 1 +Class.tests.cpp:<line number>: passed: Template_Fixture_2<TestType>::m_a.size() == 0 for: 0 == 0 +Class.tests.cpp:<line number>: passed: Template_Fixture_2<TestType>::m_a.size() == 0 for: 0 == 0 +Class.tests.cpp:<line number>: passed: Template_Fixture_2<TestType>::m_a.size() == 0 for: 0 == 0 +Class.tests.cpp:<line number>: passed: Template_Fixture_2<TestType>::m_a.size() == 0 for: 0 == 0 +Class.tests.cpp:<line number>: failed: Template_Fixture_2<TestType>{}.m_a.size() < 2 for: 6 < 2 +Class.tests.cpp:<line number>: failed: Template_Fixture_2<TestType>{}.m_a.size() < 2 for: 2 < 2 +Class.tests.cpp:<line number>: failed: Template_Fixture_2<TestType>{}.m_a.size() < 2 for: 6 < 2 +Class.tests.cpp:<line number>: failed: Template_Fixture_2<TestType>{}.m_a.size() < 2 for: 2 < 2 +Class.tests.cpp:<line number>: passed: Template_Fixture_2<TestType>{}.m_a.size() >= 2 for: 6 >= 2 +Class.tests.cpp:<line number>: passed: Template_Fixture_2<TestType>{}.m_a.size() >= 2 for: 2 >= 2 +Class.tests.cpp:<line number>: passed: Template_Fixture_2<TestType>{}.m_a.size() >= 2 for: 6 >= 2 +Class.tests.cpp:<line number>: passed: Template_Fixture_2<TestType>{}.m_a.size() >= 2 for: 2 >= 2 +Class.tests.cpp:<line number>: failed: Template_Fixture<TestType>::m_a == 2 for: 1.0 == 2 +Class.tests.cpp:<line number>: failed: Template_Fixture<TestType>::m_a == 2 for: 1.0f == 2 +Class.tests.cpp:<line number>: failed: Template_Fixture<TestType>::m_a == 2 for: 1 == 2 +Class.tests.cpp:<line number>: passed: Template_Fixture<TestType>::m_a == 1 for: 1.0 == 1 +Class.tests.cpp:<line number>: passed: Template_Fixture<TestType>::m_a == 1 for: 1.0f == 1 +Class.tests.cpp:<line number>: passed: Template_Fixture<TestType>::m_a == 1 for: 1 == 1 +Class.tests.cpp:<line number>: failed: Nttp_Fixture<V>::value == 0 for: 1 == 0 +Class.tests.cpp:<line number>: failed: Nttp_Fixture<V>::value == 0 for: 3 == 0 +Class.tests.cpp:<line number>: failed: Nttp_Fixture<V>::value == 0 for: 6 == 0 +Class.tests.cpp:<line number>: passed: Nttp_Fixture<V>::value > 0 for: 1 > 0 +Class.tests.cpp:<line number>: passed: Nttp_Fixture<V>::value > 0 for: 3 > 0 +Class.tests.cpp:<line number>: passed: Nttp_Fixture<V>::value > 0 for: 6 > 0 +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: x.size() == 0 for: 0 == 0 +Misc.tests.cpp:<line number>: passed: x.size() == 0 for: 0 == 0 +Misc.tests.cpp:<line number>: passed: x.size() == 0 for: 0 == 0 +Misc.tests.cpp:<line number>: passed: x.size() == 0 for: 0 == 0 +Misc.tests.cpp:<line number>: passed: x.size() > 0 for: 42 > 0 +Misc.tests.cpp:<line number>: passed: x.size() > 0 for: 9 > 0 +Misc.tests.cpp:<line number>: passed: x.size() > 0 for: 42 > 0 +Misc.tests.cpp:<line number>: passed: x.size() > 0 for: 9 > 0 +Approx.tests.cpp:<line number>: passed: d == 1.23_a for: 1.23 == Approx( 1.23 ) +Approx.tests.cpp:<line number>: passed: d != 1.22_a for: 1.23 != Approx( 1.22 ) +Approx.tests.cpp:<line number>: passed: -d == -1.23_a for: -1.23 == Approx( -1.23 ) +Approx.tests.cpp:<line number>: passed: d == 1.2_a .epsilon(.1) for: 1.23 == Approx( 1.2 ) +Approx.tests.cpp:<line number>: passed: d != 1.2_a .epsilon(.001) for: 1.23 != Approx( 1.2 ) +Approx.tests.cpp:<line number>: passed: d == 1_a .epsilon(.3) for: 1.23 == Approx( 1.0 ) +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 ) +Matchers.tests.cpp:<line number>: passed: 1, Predicate<int>(alwaysTrue, "always true") for: 1 matches predicate: "always true" +Matchers.tests.cpp:<line number>: passed: 1, !Predicate<int>(alwaysFalse, "always false") for: 1 not matches predicate: "always false" +Matchers.tests.cpp:<line number>: passed: "Hello olleH", Predicate<std::string>( [] (std::string const& str) -> bool { return str.front() == str.back(); }, "First and last character should be equal") for: "Hello olleH" matches predicate: "First and last character should be equal" +Matchers.tests.cpp:<line number>: passed: "This wouldn't pass", !Predicate<std::string>( [] (std::string const& str) -> bool { return str.front() == str.back(); } ) for: "This wouldn't pass" not matches undescribed predicate +Compilation.tests.cpp:<line number>: passed: lhs | rhs for: Val: 1 | Val: 2 +Compilation.tests.cpp:<line number>: passed: !(lhs & rhs) for: !(Val: 1 & Val: 2) +Compilation.tests.cpp:<line number>: passed: HasBitOperators{ 1 } & HasBitOperators{ 1 } for: Val: 1 & Val: 1 +Compilation.tests.cpp:<line number>: passed: lhs ^ rhs for: Val: 1 ^ Val: 2 +Compilation.tests.cpp:<line number>: passed: !(lhs ^ lhs) for: !(Val: 1 ^ Val: 1) +Tricky.tests.cpp:<line number>: passed: true +Tricky.tests.cpp:<line number>: passed: true +Tricky.tests.cpp:<line number>: passed: true +Tricky.tests.cpp:<line number>: passed: true +Tricky.tests.cpp:<line number>: passed: true +Tricky.tests.cpp:<line number>: passed: true +MatchersRanges.tests.cpp:<line number>: passed: a, Contains(1) for: { 1, 2, 3 } contains element 1 +MatchersRanges.tests.cpp:<line number>: passed: b, Contains(1) for: { 0, 1, 2 } contains element 1 +MatchersRanges.tests.cpp:<line number>: passed: c, !Contains(1) for: { 4, 5, 6 } not contains element 1 +MatchersRanges.tests.cpp:<line number>: passed: a, Contains(0, close_enough) for: { 1, 2, 3 } contains element 0 +MatchersRanges.tests.cpp:<line number>: passed: b, Contains(0, close_enough) for: { 0, 1, 2 } contains element 0 +MatchersRanges.tests.cpp:<line number>: passed: c, !Contains(0, close_enough) for: { 4, 5, 6 } not contains element 0 +MatchersRanges.tests.cpp:<line number>: passed: a, Contains(4, [](auto&& lhs, size_t sz) { return lhs.size() == sz; }) for: { "abc", "abcd", "abcde" } contains element 4 +MatchersRanges.tests.cpp:<line number>: passed: in, Contains(1) for: { 1, 2, 3, 4, 5 } contains element 1 +MatchersRanges.tests.cpp:<line number>: passed: in, !Contains(8) for: { 1, 2, 3, 4, 5 } not contains element 8 +MatchersRanges.tests.cpp:<line number>: passed: in, Contains(MoveOnlyTestElement{ 2 }) for: { 1, 2, 3 } contains element 2 +MatchersRanges.tests.cpp:<line number>: passed: in, !Contains(MoveOnlyTestElement{ 9 }) for: { 1, 2, 3 } not contains element 9 +MatchersRanges.tests.cpp:<line number>: passed: in, Contains(Catch::Matchers::WithinAbs(0.5, 0.5)) for: { 1.0, 2.0, 3.0, 0.0 } contains element matching is within 0.5 of 0.5 +MatchersRanges.tests.cpp:<line number>: passed: empty_array, IsEmpty() for: { } is empty +MatchersRanges.tests.cpp:<line number>: passed: non_empty_array, !IsEmpty() for: { 0.0 } not is empty +MatchersRanges.tests.cpp:<line number>: passed: empty_vec, IsEmpty() for: { } is empty +MatchersRanges.tests.cpp:<line number>: passed: non_empty_vec, !IsEmpty() for: { 'a', 'b', 'c' } not is empty +MatchersRanges.tests.cpp:<line number>: passed: inner_lists_are_empty, !IsEmpty() for: { { } } not is empty +MatchersRanges.tests.cpp:<line number>: passed: inner_lists_are_empty.front(), IsEmpty() for: { } is empty +MatchersRanges.tests.cpp:<line number>: passed: has_empty{}, !IsEmpty() for: {?} not is empty +MatchersRanges.tests.cpp:<line number>: passed: unrelated::ADL_empty{}, IsEmpty() for: {?} is empty +Message.tests.cpp:<line number>: passed: with 7 messages: 'a := 1' and 'b := 2' and 'c := 3' and 'a + b := 3' and 'a+b := 3' and 'c > b := true' and 'a == 1 := true' +Message.tests.cpp:<line number>: passed: with 7 messages: 'std::vector<int>{1, 2, 3}[0, 1, 2] := 3' and 'std::vector<int>{1, 2, 3}[(0, 1)] := 2' and 'std::vector<int>{1, 2, 3}[0] := 1' and '(helper_1436<int, int>{12, -12}) := { 12, -12 }' and '(helper_1436<int, int>(-12, 12)) := { -12, 12 }' and '(1, 2) := 2' and '(2, 3) := 3' +Message.tests.cpp:<line number>: passed: with 11 messages: '("comma, in string", "escaped, \", ") := "escaped, ", "' and '"single quote in string,'," := "single quote in string,',"' and '"some escapes, \\,\\\\" := "some escapes, \,\\"' and '"some, ), unmatched, } prenheses {[<" := "some, ), unmatched, } prenheses {[<"' and ''"' := '"'' and ''\'' := '''' and '',' := ','' and ''}' := '}'' and '')' := ')'' and ''(' := '('' and ''{' := '{'' +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 +Clara.tests.cpp:<line number>: passed: name.empty() for: true +Clara.tests.cpp:<line number>: passed: name == "foo" for: "foo" == "foo" +Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype((MatcherA() && MatcherB()) && MatcherC()), Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC> >::value' +Matchers.tests.cpp:<line number>: passed: 1, (MatcherA() && MatcherB()) && MatcherC() for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) +Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype(MatcherA() && (MatcherB() && MatcherC())), Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC> >::value' +Matchers.tests.cpp:<line number>: passed: 1, MatcherA() && (MatcherB() && MatcherC()) for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) +Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype((MatcherA() && MatcherB()) && (MatcherC() && MatcherD())), Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC, MatcherD> >::value' +Matchers.tests.cpp:<line number>: passed: 1, (MatcherA() && MatcherB()) && (MatcherC() && MatcherD()) for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 and equals: true ) +Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype((MatcherA() || MatcherB()) || MatcherC()), Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC> >::value' +Matchers.tests.cpp:<line number>: passed: 1, (MatcherA() || MatcherB()) || MatcherC() for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) +Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype(MatcherA() || (MatcherB() || MatcherC())), Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC> >::value' +Matchers.tests.cpp:<line number>: passed: 1, MatcherA() || (MatcherB() || MatcherC()) for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) +Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype((MatcherA() || MatcherB()) || (MatcherC() || MatcherD())), Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC, MatcherD> >::value' +Matchers.tests.cpp:<line number>: passed: 1, (MatcherA() || MatcherB()) || (MatcherC() || MatcherD()) for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 or equals: true ) +Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype(!MatcherA()), Catch::Matchers::Detail::MatchNotOfGeneric<MatcherA> >::value' +Matchers.tests.cpp:<line number>: passed: 0, !MatcherA() for: 0 not equals: (int) 1 or (float) 1.0f +Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype(!!MatcherA()), MatcherA const& >::value' +Matchers.tests.cpp:<line number>: passed: 1, !!MatcherA() for: 1 equals: (int) 1 or (float) 1.0f +Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype(!!!MatcherA()), Catch::Matchers::Detail::MatchNotOfGeneric<MatcherA> >::value' +Matchers.tests.cpp:<line number>: passed: 0, !!!MatcherA() for: 0 not equals: (int) 1 or (float) 1.0f +Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype(!!!!MatcherA()), MatcherA const & >::value' +Matchers.tests.cpp:<line number>: passed: 1, !!!!MatcherA() for: 1 equals: (int) 1 or (float) 1.0f +Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype(StartsWith("foo") || (StartsWith("bar") && EndsWith("bar") && !EndsWith("foo"))), Catch::Matchers::Detail::MatchAnyOf<std::string> >::value' +Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype(MatcherA() || MatcherB()), Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB> >::value' +Matchers.tests.cpp:<line number>: passed: 1, MatcherA() || MatcherB() for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 ) +Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype(MatcherA() && MatcherB()), Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB> >::value' +Matchers.tests.cpp:<line number>: passed: 1, MatcherA() && MatcherB() for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 ) +Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype(MatcherA() || !MatcherB()), Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, Catch::Matchers::Detail::MatchNotOfGeneric<MatcherB>> >::value' +Matchers.tests.cpp:<line number>: passed: 1, MatcherA() || !MatcherB() for: 1 ( equals: (int) 1 or (float) 1.0f or not equals: (long long) 1 ) +Matchers.tests.cpp:<line number>: passed: vec, Predicate<std::vector<int>>([](auto const& v) { return std::all_of(v.begin(), v.end(), [](int elem) { return elem % 2 == 1; }); }, "All elements are odd") && !EqualsRange(a) for: { 1, 3, 5 } ( matches predicate: "All elements are odd" and not Equals: { 5, 3, 1 } ) +Matchers.tests.cpp:<line number>: passed: str, StartsWith("foo") && EqualsRange(arr) && EndsWith("bar") for: "foobar" ( starts with: "foo" and Equals: { 'f', 'o', 'o', 'b', 'a', 'r' } and ends with: "bar" ) +Matchers.tests.cpp:<line number>: passed: str, StartsWith("foo") && !EqualsRange(bad_arr) && EndsWith("bar") for: "foobar" ( starts with: "foo" and not Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } and ends with: "bar" ) +Matchers.tests.cpp:<line number>: passed: str, EqualsRange(arr) && StartsWith("foo") && EndsWith("bar") for: "foobar" ( Equals: { 'f', 'o', 'o', 'b', 'a', 'r' } and starts with: "foo" and ends with: "bar" ) +Matchers.tests.cpp:<line number>: passed: str, !EqualsRange(bad_arr) && StartsWith("foo") && EndsWith("bar") for: "foobar" ( not Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } and starts with: "foo" and ends with: "bar" ) +Matchers.tests.cpp:<line number>: passed: str, EqualsRange(bad_arr) || (StartsWith("foo") && EndsWith("bar")) for: "foobar" ( Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } or ( starts with: "foo" and ends with: "bar" ) ) +Matchers.tests.cpp:<line number>: passed: str, (StartsWith("foo") && EndsWith("bar")) || EqualsRange(bad_arr) for: "foobar" ( ( starts with: "foo" and ends with: "bar" ) or Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } ) +Matchers.tests.cpp:<line number>: passed: container, EqualsRange(a) || EqualsRange(b) || EqualsRange(c) for: { 1, 2, 3 } ( Equals: { 1, 2, 3 } or Equals: { 0, 1, 2 } or Equals: { 4, 5, 6 } ) +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> +RandomNumberGeneration.tests.cpp:<line number>: passed: SimplePcg32{} == SimplePcg32{} for: {?} == {?} +RandomNumberGeneration.tests.cpp:<line number>: passed: SimplePcg32{ 0 } != SimplePcg32{} for: {?} != {?} +RandomNumberGeneration.tests.cpp:<line number>: passed: !(SimplePcg32{ 1 } == SimplePcg32{ 2 }) for: !({?} == {?}) +RandomNumberGeneration.tests.cpp:<line number>: passed: !(SimplePcg32{ 1 } != SimplePcg32{ 1 }) for: !({?} != {?}) +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>: passed: !(matcher.match( 1 )) for: !false +Matchers.tests.cpp:<line number>: passed: first.matchCalled for: true +Matchers.tests.cpp:<line number>: passed: !second.matchCalled for: true +Matchers.tests.cpp:<line number>: passed: matcher.match(1) for: true +Matchers.tests.cpp:<line number>: passed: first.matchCalled for: true +Matchers.tests.cpp:<line number>: passed: !second.matchCalled for: true +Matchers.tests.cpp:<line number>: passed: !(matcher.match( 1 )) for: !false +Matchers.tests.cpp:<line number>: passed: first.matchCalled for: true +Matchers.tests.cpp:<line number>: passed: !second.matchCalled for: true +Matchers.tests.cpp:<line number>: passed: matcher.match( 1 ) for: true +Matchers.tests.cpp:<line number>: passed: first.matchCalled for: true +Matchers.tests.cpp:<line number>: passed: !second.matchCalled for: true +Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Contains("not there", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" contains: "not there" (case insensitive) +Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Contains("STRING") for: "this string contains 'abc' as a substring" contains: "STRING" +Generators.tests.cpp:<line number>: passed: elem % 2 == 1 for: 1 == 1 +Generators.tests.cpp:<line number>: passed: elem % 2 == 1 for: 1 == 1 +Generators.tests.cpp:<line number>: passed: elem % 2 == 1 for: 1 == 1 +Generators.tests.cpp:<line number>: passed: elem % 2 == 1 for: 1 == 1 +Generators.tests.cpp:<line number>: passed: elem % 2 == 1 for: 1 == 1 +Generators.tests.cpp:<line number>: passed: elem % 2 == 1 for: 1 == 1 +Generators.tests.cpp:<line number>: passed: elem % 2 == 1 for: 1 == 1 +Generators.tests.cpp:<line number>: passed: elem % 2 == 1 for: 1 == 1 +Generators.tests.cpp:<line number>: passed: elem % 2 == 1 for: 1 == 1 +Generators.tests.cpp:<line number>: passed: elem % 2 == 1 for: 1 == 1 +Generators.tests.cpp:<line number>: passed: elem % 2 == 1 for: 1 == 1 +Generators.tests.cpp:<line number>: passed: elem % 2 == 1 for: 1 == 1 +Generators.tests.cpp:<line number>: passed: call_count == 1 for: 1 == 1 +Generators.tests.cpp:<line number>: passed: make_data().size() == test_count for: 6 == 6 +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 ) +ToString.tests.cpp:<line number>: passed: enumInfo->lookup(0) == "Value1" for: Value1 == "Value1" +ToString.tests.cpp:<line number>: passed: enumInfo->lookup(1) == "Value2" for: Value2 == "Value2" +ToString.tests.cpp:<line number>: passed: enumInfo->lookup(3) == "{** unexpected enum value **}" for: {** unexpected enum value **} +== +"{** unexpected enum value **}" +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) +EnumToString.tests.cpp:<line number>: passed: stringify( EnumClass3::Value1 ) == "Value1" for: "Value1" == "Value1" +EnumToString.tests.cpp:<line number>: passed: stringify( EnumClass3::Value2 ) == "Value2" for: "Value2" == "Value2" +EnumToString.tests.cpp:<line number>: passed: stringify( EnumClass3::Value3 ) == "Value3" for: "Value3" == "Value3" +EnumToString.tests.cpp:<line number>: passed: stringify( EnumClass3::Value4 ) == "{** unexpected enum value **}" for: "{** unexpected enum value **}" +== +"{** unexpected enum value **}" +EnumToString.tests.cpp:<line number>: passed: stringify( ec3 ) == "Value2" for: "Value2" == "Value2" +EnumToString.tests.cpp:<line number>: passed: stringify( Bikeshed::Colours::Red ) == "Red" for: "Red" == "Red" +EnumToString.tests.cpp:<line number>: passed: stringify( Bikeshed::Colours::Blue ) == "Blue" for: "Blue" == "Blue" +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) +ToStringGeneral.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(WhatException{}) == "This exception has overridden what() method" for: "This exception has overridden what() method" +== +"This exception has overridden what() method" +ToStringGeneral.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(OperatorException{}) == "OperatorException" for: "OperatorException" == "OperatorException" +ToStringGeneral.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(StringMakerException{}) == "StringMakerException" for: "StringMakerException" +== +"StringMakerException" +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: throwsSpecialException(3), SpecialException, ExceptionMatcher{1} for: SpecialException::what special exception has value of 1 +Matchers.tests.cpp:<line number>: failed: throwsSpecialException(4), SpecialException, ExceptionMatcher{1} for: SpecialException::what special exception has value of 1 +Matchers.tests.cpp:<line number>: passed: throwsSpecialException(1), SpecialException, ExceptionMatcher{1} for: SpecialException::what special exception has value of 1 +Matchers.tests.cpp:<line number>: passed: throwsSpecialException(2), SpecialException, ExceptionMatcher{2} for: SpecialException::what 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) +Matchers.tests.cpp:<line number>: passed: throwsDerivedException(), DerivedException, Message("DerivedException::what") for: DerivedException::what exception message matches "DerivedException::what" +Matchers.tests.cpp:<line number>: passed: throwsDerivedException(), DerivedException, !Message("derivedexception::what") for: DerivedException::what not exception message matches "derivedexception::what" +Matchers.tests.cpp:<line number>: passed: throwsSpecialException(2), SpecialException, !Message("DerivedException::what") for: SpecialException::what not exception message matches "DerivedException::what" +Matchers.tests.cpp:<line number>: passed: throwsSpecialException(2), SpecialException, Message("SpecialException::what") for: SpecialException::what exception message matches "SpecialException::what" +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: 10., WithinRel(11.1, 0.1) for: 10.0 and 11.1 are within 10% of each other +Matchers.tests.cpp:<line number>: passed: 10., !WithinRel(11.2, 0.1) for: 10.0 not and 11.2 are within 10% of each other +Matchers.tests.cpp:<line number>: passed: 1., !WithinRel(0., 0.99) for: 1.0 not and 0 are within 99% of each other +Matchers.tests.cpp:<line number>: passed: -0., WithinRel(0.) for: -0.0 and 0 are within 2.22045e-12% of each other +Matchers.tests.cpp:<line number>: passed: v1, WithinRel(v2) for: 0.0 and 2.22507e-308 are within 2.22045e-12% of each other +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: 11., !WithinAbs(10., 0.5) for: 11.0 not is within 0.5 of 10.0 +Matchers.tests.cpp:<line number>: passed: 10., !WithinAbs(11., 0.5) for: 10.0 not is within 0.5 of 11.0 +Matchers.tests.cpp:<line number>: passed: -10., WithinAbs(-10., 0.5) for: -10.0 is within 0.5 of -10.0 +Matchers.tests.cpp:<line number>: passed: -10., WithinAbs(-9.6, 0.5) for: -10.0 is within 0.5 of -9.6 +Matchers.tests.cpp:<line number>: passed: 1., WithinULP(1., 0) for: 1.0 is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) +Matchers.tests.cpp:<line number>: passed: nextafter(1., 2.), WithinULP(1., 1) for: 1.0 is within 1 ULPs of 1.0000000000000000e+00 ([9.9999999999999989e-01, 1.0000000000000002e+00]) +Matchers.tests.cpp:<line number>: passed: 0., WithinULP(nextafter(0., 1.), 1) for: 0.0 is within 1 ULPs of 4.9406564584124654e-324 ([0.0000000000000000e+00, 9.8813129168249309e-324]) +Matchers.tests.cpp:<line number>: passed: 1., WithinULP(nextafter(1., 0.), 1) for: 1.0 is within 1 ULPs of 9.9999999999999989e-01 ([9.9999999999999978e-01, 1.0000000000000000e+00]) +Matchers.tests.cpp:<line number>: passed: 1., !WithinULP(nextafter(1., 2.), 0) for: 1.0 not is within 0 ULPs of 1.0000000000000002e+00 ([1.0000000000000002e+00, 1.0000000000000002e+00]) +Matchers.tests.cpp:<line number>: passed: 1., WithinULP(1., 0) for: 1.0 is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) +Matchers.tests.cpp:<line number>: passed: -0., WithinULP(0., 0) for: -0.0 is within 0 ULPs of 0.0000000000000000e+00 ([0.0000000000000000e+00, 0.0000000000000000e+00]) +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.0000000000000000e+00 ([1.9999999999999998e+00, 2.0000000000000004e+00]) ) +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.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) ) +Matchers.tests.cpp:<line number>: passed: 0.0001, WithinAbs(0., 0.001) || WithinRel(0., 0.1) for: 0.0001 ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) +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: WithinRel(1., 0.) +Matchers.tests.cpp:<line number>: passed: WithinRel(1., -0.2), std::domain_error +Matchers.tests.cpp:<line number>: passed: WithinRel(1., 1.), std::domain_error +Matchers.tests.cpp:<line number>: passed: 10.f, WithinRel(11.1f, 0.1f) for: 10.0f and 11.1 are within 10% of each other +Matchers.tests.cpp:<line number>: passed: 10.f, !WithinRel(11.2f, 0.1f) for: 10.0f not and 11.2 are within 10% of each other +Matchers.tests.cpp:<line number>: passed: 1.f, !WithinRel(0.f, 0.99f) for: 1.0f not and 0 are within 99% of each other +Matchers.tests.cpp:<line number>: passed: -0.f, WithinRel(0.f) for: -0.0f and 0 are within 0.00119209% of each other +Matchers.tests.cpp:<line number>: passed: v1, WithinRel(v2) for: 0.0f and 1.17549e-38 are within 0.00119209% of each other +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: 11.f, !WithinAbs(10.f, 0.5f) for: 11.0f not is within 0.5 of 10.0 +Matchers.tests.cpp:<line number>: passed: 10.f, !WithinAbs(11.f, 0.5f) for: 10.0f not is within 0.5 of 11.0 +Matchers.tests.cpp:<line number>: passed: -10.f, WithinAbs(-10.f, 0.5f) for: -10.0f is within 0.5 of -10.0 +Matchers.tests.cpp:<line number>: passed: -10.f, WithinAbs(-9.6f, 0.5f) for: -10.0f is within 0.5 of -9.6000003815 +Matchers.tests.cpp:<line number>: passed: 1.f, WithinULP(1.f, 0) for: 1.0f is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) +Matchers.tests.cpp:<line number>: passed: nextafter(1.f, 2.f), WithinULP(1.f, 1) for: 1.0f is within 1 ULPs of 1.00000000e+00f ([9.99999940e-01, 1.00000012e+00]) +Matchers.tests.cpp:<line number>: passed: 0.f, WithinULP(nextafter(0.f, 1.f), 1) for: 0.0f is within 1 ULPs of 1.40129846e-45f ([0.00000000e+00, 2.80259693e-45]) +Matchers.tests.cpp:<line number>: passed: 1.f, WithinULP(nextafter(1.f, 0.f), 1) for: 1.0f is within 1 ULPs of 9.99999940e-01f ([9.99999881e-01, 1.00000000e+00]) +Matchers.tests.cpp:<line number>: passed: 1.f, !WithinULP(nextafter(1.f, 2.f), 0) for: 1.0f not is within 0 ULPs of 1.00000012e+00f ([1.00000012e+00, 1.00000012e+00]) +Matchers.tests.cpp:<line number>: passed: 1.f, WithinULP(1.f, 0) for: 1.0f is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) +Matchers.tests.cpp:<line number>: passed: -0.f, WithinULP(0.f, 0) for: -0.0f is within 0 ULPs of 0.00000000e+00f ([0.00000000e+00, 0.00000000e+00]) +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.00000000e+00f ([9.99999940e-01, 1.00000012e+00]) ) +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.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) ) +Matchers.tests.cpp:<line number>: passed: 0.0001f, WithinAbs(0.f, 0.001f) || WithinRel(0.f, 0.1f) for: 0.0001f ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) +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, static_cast<uint64_t>(-1)), std::domain_error +Matchers.tests.cpp:<line number>: passed: WithinRel(1.f, 0.f) +Matchers.tests.cpp:<line number>: passed: WithinRel(1.f, -0.2f), std::domain_error +Matchers.tests.cpp:<line number>: passed: WithinRel(1.f, 1.f), std::domain_error +Generators.tests.cpp:<line number>: passed: i % 2 == 0 for: 0 == 0 +Generators.tests.cpp:<line number>: passed: i % 2 == 0 for: 0 == 0 +Generators.tests.cpp:<line number>: passed: i % 2 == 0 for: 0 == 0 +Generators.tests.cpp:<line number>: passed: filter([] (int) {return false; }, value(1)), Catch::GeneratorException +Generators.tests.cpp:<line number>: passed: i < 4 for: 1 < 4 +Generators.tests.cpp:<line number>: passed: i < 4 for: 2 < 4 +Generators.tests.cpp:<line number>: passed: i < 4 for: 3 < 4 +Generators.tests.cpp:<line number>: passed: i % 2 == 0 for: 0 == 0 +Generators.tests.cpp:<line number>: passed: i % 2 == 0 for: 0 == 0 +Generators.tests.cpp:<line number>: passed: i % 2 == 0 for: 0 == 0 +Generators.tests.cpp:<line number>: passed: i.size() == 1 for: 1 == 1 +Generators.tests.cpp:<line number>: passed: i.size() == 1 for: 1 == 1 +Generators.tests.cpp:<line number>: passed: i.size() == 1 for: 1 == 1 +Generators.tests.cpp:<line number>: passed: i.size() == 1 for: 1 == 1 +Generators.tests.cpp:<line number>: passed: i.size() == 1 for: 1 == 1 +Generators.tests.cpp:<line number>: passed: i.size() == 1 for: 1 == 1 +Generators.tests.cpp:<line number>: passed: j > 0 for: 1 > 0 +Generators.tests.cpp:<line number>: passed: j > 0 for: 2 > 0 +Generators.tests.cpp:<line number>: passed: j > 0 for: 3 > 0 +Generators.tests.cpp:<line number>: passed: j > 0 for: 1 > 0 +Generators.tests.cpp:<line number>: passed: j > 0 for: 2 > 0 +Generators.tests.cpp:<line number>: passed: j > 0 for: 3 > 0 +Generators.tests.cpp:<line number>: passed: chunk2.size() == 2 for: 2 == 2 +Generators.tests.cpp:<line number>: passed: chunk2.front() == chunk2.back() for: 1 == 1 +Generators.tests.cpp:<line number>: passed: chunk2.size() == 2 for: 2 == 2 +Generators.tests.cpp:<line number>: passed: chunk2.front() == chunk2.back() for: 2 == 2 +Generators.tests.cpp:<line number>: passed: chunk2.size() == 2 for: 2 == 2 +Generators.tests.cpp:<line number>: passed: chunk2.front() == chunk2.back() for: 3 == 3 +Generators.tests.cpp:<line number>: passed: chunk2.size() == 2 for: 2 == 2 +Generators.tests.cpp:<line number>: passed: chunk2.front() == chunk2.back() for: 1 == 1 +Generators.tests.cpp:<line number>: passed: chunk2.front() < 3 for: 1 < 3 +Generators.tests.cpp:<line number>: passed: chunk2.size() == 2 for: 2 == 2 +Generators.tests.cpp:<line number>: passed: chunk2.front() == chunk2.back() for: 2 == 2 +Generators.tests.cpp:<line number>: passed: chunk2.front() < 3 for: 2 < 3 +Generators.tests.cpp:<line number>: passed: chunk2.size() == 0 for: 0 == 0 +Generators.tests.cpp:<line number>: passed: chunk2.size() == 0 for: 0 == 0 +Generators.tests.cpp:<line number>: passed: chunk2.size() == 0 for: 0 == 0 +Generators.tests.cpp:<line number>: passed: chunk(2, value(1)), Catch::GeneratorException +Generators.tests.cpp:<line number>: passed: j < i for: -3 < 1 +Generators.tests.cpp:<line number>: passed: j < i for: -2 < 1 +Generators.tests.cpp:<line number>: passed: j < i for: -1 < 1 +Generators.tests.cpp:<line number>: passed: 4u * i > str.size() for: 4 > 1 +Generators.tests.cpp:<line number>: passed: 4u * i > str.size() for: 4 > 2 +Generators.tests.cpp:<line number>: passed: 4u * i > str.size() for: 4 > 3 +Generators.tests.cpp:<line number>: passed: j < i for: -3 < 2 +Generators.tests.cpp:<line number>: passed: j < i for: -2 < 2 +Generators.tests.cpp:<line number>: passed: j < i for: -1 < 2 +Generators.tests.cpp:<line number>: passed: 4u * i > str.size() for: 8 > 1 +Generators.tests.cpp:<line number>: passed: 4u * i > str.size() for: 8 > 2 +Generators.tests.cpp:<line number>: passed: 4u * i > str.size() for: 8 > 3 +Generators.tests.cpp:<line number>: passed: j < i for: -3 < 3 +Generators.tests.cpp:<line number>: passed: j < i for: -2 < 3 +Generators.tests.cpp:<line number>: passed: j < i for: -1 < 3 +Generators.tests.cpp:<line number>: passed: 4u * i > str.size() for: 12 > 1 +Generators.tests.cpp:<line number>: passed: 4u * i > str.size() for: 12 > 2 +Generators.tests.cpp:<line number>: passed: 4u * i > str.size() for: 12 > 3 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 123 for: 123 == 123 +GeneratorsImpl.tests.cpp:<line number>: passed: !(gen.next()) for: !false +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 1 for: 1 == 1 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 3 for: 3 == 3 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 5 for: 5 == 5 +GeneratorsImpl.tests.cpp:<line number>: passed: !(gen.next()) for: !false +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 1 for: 1 == 1 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 5 for: 5 == 5 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 2 for: 2 == 2 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 4 for: 4 == 4 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 0 for: 0 == 0 +GeneratorsImpl.tests.cpp:<line number>: passed: !(gen.next()) for: !false +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get().size() == 2 for: 2 == 2 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == "aa" for: "aa" == "aa" +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == "bb" for: "bb" == "bb" +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == "cc" for: "cc" == "cc" +GeneratorsImpl.tests.cpp:<line number>: passed: !(gen.next()) for: !false +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 1 for: 1 == 1 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 3 for: 3 == 3 +GeneratorsImpl.tests.cpp:<line number>: passed: !(gen.next()) for: !false +GeneratorsImpl.tests.cpp:<line number>: passed: filter([] (int) { return false; }, value(1)), Catch::GeneratorException +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 1 for: 1 == 1 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 2 for: 2 == 2 +GeneratorsImpl.tests.cpp:<line number>: passed: !(gen.next()) for: !false +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 1 for: 1 == 1 +GeneratorsImpl.tests.cpp:<line number>: passed: !(gen.next()) for: !false +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 2.0 for: 2.0 == 2.0 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 4.0 for: 4.0 == 4.0 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 6.0 for: 6.0 == 6.0 +GeneratorsImpl.tests.cpp:<line number>: passed: !(gen.next()) for: !false +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 2.0 for: 2.0 == 2.0 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 4.0 for: 4.0 == 4.0 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 6.0 for: 6.0 == 6.0 +GeneratorsImpl.tests.cpp:<line number>: passed: !(gen.next()) for: !false +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 3 for: 3 == 3 +GeneratorsImpl.tests.cpp:<line number>: passed: !(gen.next()) for: !false +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 1 for: 1 == 1 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 2 for: 2 == 2 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 3 for: 3 == 3 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 1 for: 1 == 1 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 2 for: 2 == 2 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 3 for: 3 == 3 +GeneratorsImpl.tests.cpp:<line number>: passed: !(gen.next()) for: !false +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == -2 for: -2 == -2 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == -1 for: -1 == -1 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 0 for: 0 == 0 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 1 for: 1 == 1 +GeneratorsImpl.tests.cpp:<line number>: passed: !(gen.next()) for: !false +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 2 for: 2 == 2 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 1 for: 1 == 1 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 0 for: 0 == 0 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == -1 for: -1 == -1 +GeneratorsImpl.tests.cpp:<line number>: passed: !(gen.next()) for: !false +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == -7 for: -7 == -7 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == -4 for: -4 == -4 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == -1 for: -1 == -1 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 2 for: 2 == 2 +GeneratorsImpl.tests.cpp:<line number>: passed: !(gen.next()) for: !false +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == -7 for: -7 == -7 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == -4 for: -4 == -4 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == -1 for: -1 == -1 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 2 for: 2 == 2 +GeneratorsImpl.tests.cpp:<line number>: passed: !(gen.next()) for: !false +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == -7 for: -7 == -7 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == -4 for: -4 == -4 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == -1 for: -1 == -1 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 2 for: 2 == 2 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 5 for: 5 == 5 +GeneratorsImpl.tests.cpp:<line number>: passed: !(gen.next()) for: !false +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: -1.0 == Approx( -1.0 ) with 1 message: 'Current expected value is -1' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is -1' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: -0.9 == Approx( -0.9 ) with 1 message: 'Current expected value is -0.9' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is -0.9' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: -0.8 == Approx( -0.8 ) with 1 message: 'Current expected value is -0.8' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is -0.8' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: -0.7 == Approx( -0.7 ) with 1 message: 'Current expected value is -0.7' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is -0.7' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: -0.6 == Approx( -0.6 ) with 1 message: 'Current expected value is -0.6' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is -0.6' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: -0.5 == Approx( -0.5 ) with 1 message: 'Current expected value is -0.5' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is -0.5' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: -0.4 == Approx( -0.4 ) with 1 message: 'Current expected value is -0.4' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is -0.4' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: -0.3 == Approx( -0.3 ) with 1 message: 'Current expected value is -0.3' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is -0.3' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: -0.2 == Approx( -0.2 ) with 1 message: 'Current expected value is -0.2' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is -0.2' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: -0.1 == Approx( -0.1 ) with 1 message: 'Current expected value is -0.1' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is -0.1' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: -0.0 == Approx( -0.0 ) with 1 message: 'Current expected value is -1.38778e-16' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is -1.38778e-16' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: 0.1 == Approx( 0.1 ) with 1 message: 'Current expected value is 0.1' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is 0.1' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: 0.2 == Approx( 0.2 ) with 1 message: 'Current expected value is 0.2' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is 0.2' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: 0.3 == Approx( 0.3 ) with 1 message: 'Current expected value is 0.3' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is 0.3' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: 0.4 == Approx( 0.4 ) with 1 message: 'Current expected value is 0.4' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is 0.4' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: 0.5 == Approx( 0.5 ) with 1 message: 'Current expected value is 0.5' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is 0.5' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: 0.6 == Approx( 0.6 ) with 1 message: 'Current expected value is 0.6' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is 0.6' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: 0.7 == Approx( 0.7 ) with 1 message: 'Current expected value is 0.7' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is 0.7' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: 0.8 == Approx( 0.8 ) with 1 message: 'Current expected value is 0.8' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is 0.8' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: 0.9 == Approx( 0.9 ) with 1 message: 'Current expected value is 0.9' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is 0.9' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx( rangeEnd ) for: 1.0 == Approx( 1.0 ) +GeneratorsImpl.tests.cpp:<line number>: passed: !(gen.next()) for: !false +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: -1.0 == Approx( -1.0 ) with 1 message: 'Current expected value is -1' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is -1' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: -0.7 == Approx( -0.7 ) with 1 message: 'Current expected value is -0.7' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is -0.7' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: -0.4 == Approx( -0.4 ) with 1 message: 'Current expected value is -0.4' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is -0.4' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: -0.1 == Approx( -0.1 ) with 1 message: 'Current expected value is -0.1' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is -0.1' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: 0.2 == Approx( 0.2 ) with 1 message: 'Current expected value is 0.2' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is 0.2' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: 0.5 == Approx( 0.5 ) with 1 message: 'Current expected value is 0.5' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is 0.5' +GeneratorsImpl.tests.cpp:<line number>: passed: !(gen.next()) for: !false +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: -1.0 == Approx( -1.0 ) with 1 message: 'Current expected value is -1' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is -1' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: -0.7 == Approx( -0.7 ) with 1 message: 'Current expected value is -0.7' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is -0.7' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: -0.4 == Approx( -0.4 ) with 1 message: 'Current expected value is -0.4' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is -0.4' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: -0.1 == Approx( -0.1 ) with 1 message: 'Current expected value is -0.1' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is -0.1' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: 0.2 == Approx( 0.2 ) with 1 message: 'Current expected value is 0.2' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is 0.2' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == Approx(expected) for: 0.5 == Approx( 0.5 ) with 1 message: 'Current expected value is 0.5' +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true with 1 message: 'Current expected value is 0.5' +GeneratorsImpl.tests.cpp:<line number>: passed: !(gen.next()) for: !false +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 5 for: 5 == 5 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 2 for: 2 == 2 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == -1 for: -1 == -1 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == -4 for: -4 == -4 +GeneratorsImpl.tests.cpp:<line number>: passed: !(gen.next()) for: !false +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 5 for: 5 == 5 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 2 for: 2 == 2 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == -1 for: -1 == -1 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == -4 for: -4 == -4 +GeneratorsImpl.tests.cpp:<line number>: passed: !(gen.next()) for: !false +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 5 for: 5 == 5 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == 2 for: 2 == 2 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == -1 for: -1 == -1 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == -4 for: -4 == -4 +GeneratorsImpl.tests.cpp:<line number>: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: gen.get() == -7 for: -7 == -7 +GeneratorsImpl.tests.cpp:<line number>: passed: !(gen.next()) for: !false +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 +Compilation.tests.cpp:<line number>: passed: []() { return true; }() for: true +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" +Generators.tests.cpp:<line number>: passed: values > -6 for: 3 > -6 +Generators.tests.cpp:<line number>: passed: values > -6 for: 4 > -6 +Generators.tests.cpp:<line number>: passed: values > -6 for: 5 > -6 +Generators.tests.cpp:<line number>: passed: values > -6 for: 6 > -6 +Generators.tests.cpp:<line number>: passed: values > -6 for: -5 > -6 +Generators.tests.cpp:<line number>: passed: values > -6 for: -4 > -6 +Generators.tests.cpp:<line number>: passed: values > -6 for: 90 > -6 +Generators.tests.cpp:<line number>: passed: values > -6 for: 91 > -6 +Generators.tests.cpp:<line number>: passed: values > -6 for: 92 > -6 +Generators.tests.cpp:<line number>: passed: values > -6 for: 93 > -6 +Generators.tests.cpp:<line number>: passed: values > -6 for: 94 > -6 +Generators.tests.cpp:<line number>: passed: values > -6 for: 95 > -6 +Generators.tests.cpp:<line number>: passed: values > -6 for: 96 > -6 +Generators.tests.cpp:<line number>: passed: values > -6 for: 97 > -6 +Generators.tests.cpp:<line number>: passed: values > -6 for: 98 > -6 +Generators.tests.cpp:<line number>: passed: values > -6 for: 99 > -6 +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: !{?} +Compilation.tests.cpp:<line number>: passed: with 1 message: 'std::is_void<void>::value' +Compilation.tests.cpp:<line number>: passed: with 1 message: '!(std::is_void<int>::value)' +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" +RandomNumberGeneration.tests.cpp:<line number>: passed: rng() == 0x<hex digits> for: 4242248763 (0x<hex digits>) +== +4242248763 (0x<hex digits>) +RandomNumberGeneration.tests.cpp:<line number>: passed: rng() == 0x<hex digits> for: 1867888929 (0x<hex digits>) +== +1867888929 (0x<hex digits>) +RandomNumberGeneration.tests.cpp:<line number>: passed: rng() == 0x<hex digits> for: 1276619030 (0x<hex digits>) +== +1276619030 (0x<hex digits>) +RandomNumberGeneration.tests.cpp:<line number>: passed: rng() == 0x<hex digits> for: 1911218783 (0x<hex digits>) +== +1911218783 (0x<hex digits>) +RandomNumberGeneration.tests.cpp:<line number>: passed: rng() == 0x<hex digits> for: 1827115164 (0x<hex digits>) +== +1827115164 (0x<hex digits>) +RandomNumberGeneration.tests.cpp:<line number>: passed: rng() == 0x<hex digits> for: 1472234645 (0x<hex digits>) +== +1472234645 (0x<hex digits>) +RandomNumberGeneration.tests.cpp:<line number>: passed: rng() == 0x<hex digits> for: 868832940 (0x<hex digits>) +== +868832940 (0x<hex digits>) +RandomNumberGeneration.tests.cpp:<line number>: passed: rng() == 0x<hex digits> for: 570883446 (0x<hex digits>) +== +570883446 (0x<hex digits>) +RandomNumberGeneration.tests.cpp:<line number>: passed: rng() == 0x<hex digits> for: 889299803 (0x<hex digits>) +== +889299803 (0x<hex digits>) +RandomNumberGeneration.tests.cpp:<line number>: passed: rng() == 0x<hex digits> for: 4261393167 (0x<hex digits>) +== +4261393167 (0x<hex digits>) +RandomNumberGeneration.tests.cpp:<line number>: passed: rng() == 0x<hex digits> for: 1472234645 (0x<hex digits>) +== +1472234645 (0x<hex digits>) +RandomNumberGeneration.tests.cpp:<line number>: passed: rng() == 0x<hex digits> for: 868832940 (0x<hex digits>) +== +868832940 (0x<hex digits>) +RandomNumberGeneration.tests.cpp:<line number>: passed: rng() == 0x<hex digits> for: 570883446 (0x<hex digits>) +== +570883446 (0x<hex digits>) +RandomNumberGeneration.tests.cpp:<line number>: passed: rng() == 0x<hex digits> for: 889299803 (0x<hex digits>) +== +889299803 (0x<hex digits>) +RandomNumberGeneration.tests.cpp:<line number>: passed: rng() == 0x<hex digits> for: 4261393167 (0x<hex digits>) +== +4261393167 (0x<hex digits>) +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' +Matchers.tests.cpp:<line number>: passed: (EvilMatcher(), EvilMatcher()), EvilCommaOperatorUsed +Matchers.tests.cpp:<line number>: passed: &EvilMatcher(), EvilAddressOfOperatorUsed +Matchers.tests.cpp:<line number>: passed: EvilMatcher() || (EvilMatcher() && !EvilMatcher()) +Matchers.tests.cpp:<line number>: passed: (EvilMatcher() && EvilMatcher()) || !EvilMatcher() +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 ) == 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 ) == 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 ) == 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 ) == 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 +CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( " aardvark " ) ) for: true +CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( " aardvark" ) ) for: true +CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( " aardvark " ) ) for: true +CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( "aardvark " ) ) for: true +CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( "aardvark" ) ) for: true +CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( " aardvark " ) ) for: true +CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( " aardvark" ) ) for: true +CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( " aardvark " ) ) for: true +CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( "aardvark " ) ) for: true +CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( "aardvark" ) ) for: true +CmdLine.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase("hidden and foo", "[.][foo]")) for: true +CmdLine.tests.cpp:<line number>: passed: !(spec.matches(*fakeTestCase("only foo", "[foo]"))) for: !false +CmdLine.tests.cpp:<line number>: passed: !(spec.matches(*fakeTestCase("hidden and foo", "[.][foo]"))) for: !false +CmdLine.tests.cpp:<line number>: passed: !(spec.matches(*fakeTestCase("only foo", "[foo]"))) for: !false +CmdLine.tests.cpp:<line number>: passed: !(spec.matches(*fakeTestCase("only hidden", "[.]"))) for: !false +CmdLine.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase("neither foo nor hidden", "[bar]")) for: true +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> +ToStringGeneral.tests.cpp:<line number>: passed: str1.size() == 3 + 5 for: 8 == 8 +ToStringGeneral.tests.cpp:<line number>: passed: str2.size() == 3 + 10 for: 13 == 13 +ToStringGeneral.tests.cpp:<line number>: passed: str1.size() == 2 + 5 for: 7 == 7 +ToStringGeneral.tests.cpp:<line number>: passed: str2.size() == 2 + 15 for: 17 == 17 +Matchers.tests.cpp:<line number>: passed: "foo", Predicate<const char*>([] (const char* const&) { return true; }) for: "foo" matches undescribed predicate +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.reporterName == "console" for: "console" == "console" +CmdLine.tests.cpp:<line number>: passed: !(cfg.hasTestFilters()) for: !false +CmdLine.tests.cpp:<line number>: passed: result for: {?} +CmdLine.tests.cpp:<line number>: passed: cfg.hasTestFilters() for: true +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.hasTestFilters() for: true +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.hasTestFilters() for: true +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.reporterName == "console" for: "console" == "console" +CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "-r", "xml"}) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.reporterName == "xml" for: "xml" == "xml" +CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--reporter", "junit"}) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.reporterName == "junit" for: "junit" == "junit" +CmdLine.tests.cpp:<line number>: passed: !(cli.parse({ "test", "-r", "xml", "-r", "junit" })) for: !{?} +CmdLine.tests.cpp:<line number>: passed: !result for: true +CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), Contains("Unrecognized reporter") for: "Unrecognized reporter, 'unsupported'. Check available with --list-reporters" contains: "Unrecognized reporter" +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", "--wait-for-keypress", std::get<0>(input)}) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.waitForKeypress == std::get<1>(input) for: 0 == 0 +CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.waitForKeypress == std::get<1>(input) for: 1 == 1 +CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.waitForKeypress == std::get<1>(input) for: 2 == 2 +CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.waitForKeypress == std::get<1>(input) for: 3 == 3 +CmdLine.tests.cpp:<line number>: passed: !result for: true +CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), Contains("never") && Contains("both") for: "keypress argument must be one of: never, start, exit or both. 'sometimes' not recognised" ( contains: "never" and contains: "both" ) +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" +CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "--benchmark-samples=200" }) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.benchmarkSamples == 200 for: 200 == 200 +CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "--benchmark-resamples=20000" }) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.benchmarkResamples == 20000 for: 20000 (0x<hex digits>) == 20000 (0x<hex digits>) +CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "--benchmark-confidence-interval=0.99" }) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.benchmarkConfidenceInterval == Catch::Approx(0.99) for: 0.99 == Approx( 0.99 ) +CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "--benchmark-no-analysis" }) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.benchmarkNoAnalysis for: true +CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "--benchmark-warmup-time=10" }) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.benchmarkWarmupTime == 10 for: 10 == 10 +Misc.tests.cpp:<line number>: passed: std::tuple_size<TestType>::value >= 1 for: 3 >= 1 +Misc.tests.cpp:<line number>: passed: std::tuple_size<TestType>::value >= 1 for: 2 >= 1 +Misc.tests.cpp:<line number>: passed: std::tuple_size<TestType>::value >= 1 for: 1 >= 1 +ToString.tests.cpp:<line number>: passed: Catch::Detail::stringify(UsesSentinel{}) == "{ }" for: "{ }" == "{ }" +Decomposition.tests.cpp:<line number>: failed: truthy(false) for: Hey, its truthy! +Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Matches("this STRING contains 'abc' as a substring") for: "this string contains 'abc' as a substring" matches "this STRING contains 'abc' as a substring" case sensitively +Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Matches("contains 'abc' as a substring") for: "this string contains 'abc' as a substring" matches "contains 'abc' as a substring" case sensitively +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 +Matchers.tests.cpp:<line number>: passed: actual, !UnorderedEquals(expected) for: { 'a', 'b' } not UnorderedEquals: { 'c', 'b' } +Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false +Reporters.tests.cpp:<line number>: passed: listingString, Contains("fakeTag"s) for: "All available tags: + 1 [fakeTag] +1 tag + +" contains: "fakeTag" with 1 message: 'Tested reporter: automake' +Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false +Reporters.tests.cpp:<line number>: passed: listingString, Contains("fake reporter"s) for: "Available reporters: + fake reporter: fake description + +" contains: "fake reporter" with 1 message: 'Tested reporter: automake' +Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false +Reporters.tests.cpp:<line number>: passed: listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) for: "All available test cases: + fake test name + [fakeTestTag] +1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: automake' +Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false +Reporters.tests.cpp:<line number>: passed: listingString, Contains("fakeTag"s) for: "All available tags: + 1 [fakeTag] +1 tag + +" contains: "fakeTag" with 1 message: 'Tested reporter: compact' +Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false +Reporters.tests.cpp:<line number>: passed: listingString, Contains("fake reporter"s) for: "Available reporters: + fake reporter: fake description + +" contains: "fake reporter" with 1 message: 'Tested reporter: compact' +Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false +Reporters.tests.cpp:<line number>: passed: listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) for: "All available test cases: + fake test name + [fakeTestTag] +1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: compact' +Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false +Reporters.tests.cpp:<line number>: passed: listingString, Contains("fakeTag"s) for: "All available tags: + 1 [fakeTag] +1 tag + +" contains: "fakeTag" with 1 message: 'Tested reporter: console' +Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false +Reporters.tests.cpp:<line number>: passed: listingString, Contains("fake reporter"s) for: "Available reporters: + fake reporter: fake description + +" contains: "fake reporter" with 1 message: 'Tested reporter: console' +Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false +Reporters.tests.cpp:<line number>: passed: listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) for: "All available test cases: + fake test name + [fakeTestTag] +1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: console' +Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false +Reporters.tests.cpp:<line number>: passed: listingString, Contains("fakeTag"s) for: "<?xml version="1.0" encoding="UTF-8"?> +All available tags: + 1 [fakeTag] +1 tag + +" contains: "fakeTag" with 1 message: 'Tested reporter: junit' +Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false +Reporters.tests.cpp:<line number>: passed: listingString, Contains("fake reporter"s) for: "<?xml version="1.0" encoding="UTF-8"?> +Available reporters: + fake reporter: fake description + +" contains: "fake reporter" with 1 message: 'Tested reporter: junit' +Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false +Reporters.tests.cpp:<line number>: passed: listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) for: "<?xml version="1.0" encoding="UTF-8"?> +All available test cases: + fake test name + [fakeTestTag] +1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: junit' +Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false +Reporters.tests.cpp:<line number>: passed: listingString, Contains("fakeTag"s) for: "<?xml version="1.0" encoding="UTF-8"?> +All available tags: + 1 [fakeTag] +1 tag + +" contains: "fakeTag" with 1 message: 'Tested reporter: sonarqube' +Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false +Reporters.tests.cpp:<line number>: passed: listingString, Contains("fake reporter"s) for: "<?xml version="1.0" encoding="UTF-8"?> +Available reporters: + fake reporter: fake description + +" contains: "fake reporter" with 1 message: 'Tested reporter: sonarqube' +Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false +Reporters.tests.cpp:<line number>: passed: listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) for: "<?xml version="1.0" encoding="UTF-8"?> +All available test cases: + fake test name + [fakeTestTag] +1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: sonarqube' +Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false +Reporters.tests.cpp:<line number>: passed: listingString, Contains("fakeTag"s) for: "All available tags: + 1 [fakeTag] +1 tag + +" contains: "fakeTag" with 1 message: 'Tested reporter: tap' +Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false +Reporters.tests.cpp:<line number>: passed: listingString, Contains("fake reporter"s) for: "Available reporters: + fake reporter: fake description + +" contains: "fake reporter" with 1 message: 'Tested reporter: tap' +Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false +Reporters.tests.cpp:<line number>: passed: listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) for: "All available test cases: + fake test name + [fakeTestTag] +1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: tap' +Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false +Reporters.tests.cpp:<line number>: passed: listingString, Contains("fakeTag"s) for: "All available tags: + 1 [fakeTag] +1 tag + +" contains: "fakeTag" with 1 message: 'Tested reporter: teamcity' +Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false +Reporters.tests.cpp:<line number>: passed: listingString, Contains("fake reporter"s) for: "Available reporters: + fake reporter: fake description + +" contains: "fake reporter" with 1 message: 'Tested reporter: teamcity' +Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false +Reporters.tests.cpp:<line number>: passed: listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) for: "All available test cases: + fake test name + [fakeTestTag] +1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: teamcity' +Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false +Reporters.tests.cpp:<line number>: passed: listingString, Contains("fakeTag"s) for: "<?xml version="1.0" encoding="UTF-8"?> +<TagsFromMatchingTests> + <Tag> + <Count>1</Count> + <Aliases> + <Alias>fakeTag</Alias> + </Aliases> + </Tag> +</TagsFromMatchingTests>" contains: "fakeTag" with 1 message: 'Tested reporter: xml' +Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false +Reporters.tests.cpp:<line number>: passed: listingString, Contains("fake reporter"s) for: "<?xml version="1.0" encoding="UTF-8"?> +<AvailableReporters> + <Reporter> + <Name>fake reporter</Name> + <Description>fake description</Description> + </Reporter> +</AvailableReporters>" contains: "fake reporter" with 1 message: 'Tested reporter: xml' +Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false +Reporters.tests.cpp:<line number>: passed: listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) for: "<?xml version="1.0" encoding="UTF-8"?> +<MatchingTests> + <TestCase> + <Name>fake test name</Name> + <ClassName/> + <Tags>[fakeTestTag]</Tags> + <SourceInfo> + <File>fake-file.cpp</File> + <Line>123456789</Line> + </SourceInfo> + </TestCase> +</MatchingTests>" ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: xml' +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: d == 1.23_a for: 1.23 == Approx( 1.23 ) +Approx.tests.cpp:<line number>: passed: d != 1.22_a for: 1.23 != Approx( 1.22 ) +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 +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: empty.isNullTerminated() for: true +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: s.isNullTerminated() for: true +String.tests.cpp:<line number>: passed: std::strcmp( rawChars, "hello" ) == 0 for: 0 == 0 +String.tests.cpp:<line number>: passed: s.c_str() +String.tests.cpp:<line number>: passed: s.c_str() == rawChars for: "hello" == "hello" +String.tests.cpp:<line number>: passed: s.data() == rawChars for: "hello" == "hello" +String.tests.cpp:<line number>: passed: original == "original" +String.tests.cpp:<line number>: passed: !(original.isNullTerminated()) for: !false +String.tests.cpp:<line number>: passed: original.c_str() +String.tests.cpp:<line number>: passed: original.data() +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::strncmp( ss.data(), "hello", 5 ) == 0 for: 0 == 0 +String.tests.cpp:<line number>: passed: ss == "hello" for: hello == "hello" +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.data() == s2.data() for: "hello world!" == "hello world!" +String.tests.cpp:<line number>: passed: s.data() == ss.data() for: "hello world!" == "hello world!" +String.tests.cpp:<line number>: passed: s.substr(s.size() + 1, 123).empty() for: true +String.tests.cpp:<line number>: passed: std::strcmp(ss.c_str(), "world!") == 0 for: 0 == 0 +String.tests.cpp:<line number>: passed: s.substr(1'000'000, 1).empty() for: true +String.tests.cpp:<line number>: passed: reinterpret_cast<char*>(buffer1) != reinterpret_cast<char*>(buffer2) for: "Hello" != "Hello" +String.tests.cpp:<line number>: passed: left == right for: Hello == Hello +String.tests.cpp:<line number>: passed: left != left.substr(0, 3) for: Hello != Hel +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: lhs == "some string += the stringref contents" for: "some string += the stringref contents" +== +"some string += the stringref contents" +String.tests.cpp:<line number>: passed: together == "abrakadabra" for: "abrakadabra" == "abrakadabra" +String.tests.cpp:<line number>: passed: with 1 message: 'empty.size() == 0' +String.tests.cpp:<line number>: passed: with 1 message: 'empty.begin() == empty.end()' +String.tests.cpp:<line number>: passed: with 1 message: 'stringref.size() == 3' +String.tests.cpp:<line number>: passed: with 1 message: 'stringref.isNullTerminated()' +String.tests.cpp:<line number>: passed: with 1 message: 'stringref.data() == abc' +String.tests.cpp:<line number>: passed: with 1 message: 'stringref.begin() == abc' +String.tests.cpp:<line number>: passed: with 1 message: 'stringref.begin() != stringref.end()' +String.tests.cpp:<line number>: passed: with 1 message: 'stringref.substr(10, 0).empty()' +String.tests.cpp:<line number>: passed: with 1 message: 'stringref.substr(2, 1).data() == abc + 2' +String.tests.cpp:<line number>: passed: with 1 message: 'stringref[1] == 'b'' +String.tests.cpp:<line number>: passed: with 1 message: 'shortened.size() == 2' +String.tests.cpp:<line number>: passed: with 1 message: 'shortened.data() == abc' +String.tests.cpp:<line number>: passed: with 1 message: 'shortened.begin() != shortened.end()' +String.tests.cpp:<line number>: passed: with 1 message: '!(shortened.isNullTerminated())' +String.tests.cpp:<line number>: passed: with 1 message: '!(shortened.substr(1, 3).isNullTerminated())' +String.tests.cpp:<line number>: passed: with 1 message: '!(sr1.empty())' +String.tests.cpp:<line number>: passed: with 1 message: 'sr1.size() == 3' +String.tests.cpp:<line number>: passed: with 1 message: 'sr1.isNullTerminated()' +String.tests.cpp:<line number>: passed: with 1 message: 'sr2.empty()' +String.tests.cpp:<line number>: passed: with 1 message: 'sr2.size() == 0' +String.tests.cpp:<line number>: passed: with 1 message: 'sr2.isNullTerminated()' +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; +} +" +Tag.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]" +Tag.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" +Tag.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" +Tag.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" +Tag.tests.cpp:<line number>: passed: registry.add( "[no ampersat]", "", Catch::SourceLineInfo( "file", 3 ) ) +Tag.tests.cpp:<line number>: passed: registry.add( "[the @ is not at the start]", "", Catch::SourceLineInfo( "file", 3 ) ) +Tag.tests.cpp:<line number>: passed: registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) ) +Tag.tests.cpp:<line number>: passed: registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) ) +Class.tests.cpp:<line number>: passed: Template_Fixture<TestType>::m_a == 1 for: 1 == 1 +Class.tests.cpp:<line number>: passed: Template_Fixture<TestType>::m_a == 1 for: 1 == 1 +Class.tests.cpp:<line number>: passed: Template_Fixture<TestType>::m_a == 1 for: 1.0 == 1 +Misc.tests.cpp:<line number>: passed: sizeof(TestType) > 0 for: 1 > 0 +Misc.tests.cpp:<line number>: passed: sizeof(TestType) > 0 for: 4 > 0 +Misc.tests.cpp:<line number>: passed: sizeof(TestType) > 0 for: 1 > 0 +Misc.tests.cpp:<line number>: passed: sizeof(TestType) > 0 for: 4 > 0 +Misc.tests.cpp:<line number>: passed: sizeof(TestType) > 0 for: 4 > 0 +Misc.tests.cpp:<line number>: passed: sizeof(TestType) > 0 for: 1 > 0 +Misc.tests.cpp:<line number>: passed: sizeof(TestType) > 0 for: 4 > 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() == 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: 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: 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: 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: v.size() == V for: 6 == 6 +Misc.tests.cpp:<line number>: passed: v.capacity() >= V for: 6 >= 6 +Misc.tests.cpp:<line number>: passed: v.size() == 2 * V for: 12 == 12 +Misc.tests.cpp:<line number>: passed: v.capacity() >= 2 * V for: 12 >= 12 +Misc.tests.cpp:<line number>: passed: v.size() == V for: 6 == 6 +Misc.tests.cpp:<line number>: passed: v.capacity() >= V for: 6 >= 6 +Misc.tests.cpp:<line number>: passed: v.size() == 0 for: 0 == 0 +Misc.tests.cpp:<line number>: passed: v.capacity() >= V for: 6 >= 6 +Misc.tests.cpp:<line number>: passed: v.capacity() == 0 for: 0 == 0 +Misc.tests.cpp:<line number>: passed: v.size() == V for: 6 == 6 +Misc.tests.cpp:<line number>: passed: v.capacity() >= V for: 6 >= 6 +Misc.tests.cpp:<line number>: passed: v.size() == V for: 6 == 6 +Misc.tests.cpp:<line number>: passed: v.capacity() >= 2 * V for: 12 >= 12 +Misc.tests.cpp:<line number>: passed: v.size() == V for: 6 == 6 +Misc.tests.cpp:<line number>: passed: v.capacity() >= V for: 6 >= 6 +Misc.tests.cpp:<line number>: passed: v.size() == V for: 6 == 6 +Misc.tests.cpp:<line number>: passed: v.capacity() >= V for: 6 >= 6 +Misc.tests.cpp:<line number>: passed: v.size() == V for: 4 == 4 +Misc.tests.cpp:<line number>: passed: v.capacity() >= V for: 4 >= 4 +Misc.tests.cpp:<line number>: passed: v.size() == 2 * V for: 8 == 8 +Misc.tests.cpp:<line number>: passed: v.capacity() >= 2 * V for: 8 >= 8 +Misc.tests.cpp:<line number>: passed: v.size() == V for: 4 == 4 +Misc.tests.cpp:<line number>: passed: v.capacity() >= V for: 4 >= 4 +Misc.tests.cpp:<line number>: passed: v.size() == 0 for: 0 == 0 +Misc.tests.cpp:<line number>: passed: v.capacity() >= V for: 4 >= 4 +Misc.tests.cpp:<line number>: passed: v.capacity() == 0 for: 0 == 0 +Misc.tests.cpp:<line number>: passed: v.size() == V for: 4 == 4 +Misc.tests.cpp:<line number>: passed: v.capacity() >= V for: 4 >= 4 +Misc.tests.cpp:<line number>: passed: v.size() == V for: 4 == 4 +Misc.tests.cpp:<line number>: passed: v.capacity() >= 2 * V for: 8 >= 8 +Misc.tests.cpp:<line number>: passed: v.size() == V for: 4 == 4 +Misc.tests.cpp:<line number>: passed: v.capacity() >= V for: 4 >= 4 +Misc.tests.cpp:<line number>: passed: v.size() == V for: 4 == 4 +Misc.tests.cpp:<line number>: passed: v.capacity() >= V for: 4 >= 4 +Misc.tests.cpp:<line number>: passed: v.size() == V for: 5 == 5 +Misc.tests.cpp:<line number>: passed: v.capacity() >= V for: 5 >= 5 +Misc.tests.cpp:<line number>: passed: v.size() == 2 * V for: 10 == 10 +Misc.tests.cpp:<line number>: passed: v.capacity() >= 2 * V for: 10 >= 10 +Misc.tests.cpp:<line number>: passed: v.size() == V for: 5 == 5 +Misc.tests.cpp:<line number>: passed: v.capacity() >= V for: 5 >= 5 +Misc.tests.cpp:<line number>: passed: v.size() == 0 for: 0 == 0 +Misc.tests.cpp:<line number>: passed: v.capacity() >= V for: 5 >= 5 +Misc.tests.cpp:<line number>: passed: v.capacity() == 0 for: 0 == 0 +Misc.tests.cpp:<line number>: passed: v.size() == V for: 5 == 5 +Misc.tests.cpp:<line number>: passed: v.capacity() >= V for: 5 >= 5 +Misc.tests.cpp:<line number>: passed: v.size() == V for: 5 == 5 +Misc.tests.cpp:<line number>: passed: v.capacity() >= 2 * V for: 10 >= 10 +Misc.tests.cpp:<line number>: passed: v.size() == V for: 5 == 5 +Misc.tests.cpp:<line number>: passed: v.capacity() >= V for: 5 >= 5 +Misc.tests.cpp:<line number>: passed: v.size() == V for: 5 == 5 +Misc.tests.cpp:<line number>: passed: v.capacity() >= V for: 5 >= 5 +Misc.tests.cpp:<line number>: passed: v.size() == V for: 15 == 15 +Misc.tests.cpp:<line number>: passed: v.capacity() >= V for: 15 >= 15 +Misc.tests.cpp:<line number>: passed: v.size() == 2 * V for: 30 == 30 +Misc.tests.cpp:<line number>: passed: v.capacity() >= 2 * V for: 30 >= 30 +Misc.tests.cpp:<line number>: passed: v.size() == V for: 15 == 15 +Misc.tests.cpp:<line number>: passed: v.capacity() >= V for: 15 >= 15 +Misc.tests.cpp:<line number>: passed: v.size() == 0 for: 0 == 0 +Misc.tests.cpp:<line number>: passed: v.capacity() >= V for: 15 >= 15 +Misc.tests.cpp:<line number>: passed: v.capacity() == 0 for: 0 == 0 +Misc.tests.cpp:<line number>: passed: v.size() == V for: 15 == 15 +Misc.tests.cpp:<line number>: passed: v.capacity() >= V for: 15 >= 15 +Misc.tests.cpp:<line number>: passed: v.size() == V for: 15 == 15 +Misc.tests.cpp:<line number>: passed: v.capacity() >= 2 * V for: 30 >= 30 +Misc.tests.cpp:<line number>: passed: v.size() == V for: 15 == 15 +Misc.tests.cpp:<line number>: passed: v.capacity() >= V for: 15 >= 15 +Misc.tests.cpp:<line number>: passed: v.size() == V for: 15 == 15 +Misc.tests.cpp:<line number>: passed: v.capacity() >= V for: 15 >= 15 +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 +CmdLine.tests.cpp:<line number>: passed: +Message.tests.cpp:<line number>: failed - but was ok: 1 == 2 +Reporters.tests.cpp:<line number>: passed: listingString, Contains("[fakeTag]"s) for: "All available tags: + 1 [fakeTag] +1 tag + +" contains: "[fakeTag]" +Reporters.tests.cpp:<line number>: passed: listingString, Contains("fake reporter"s) for: "Available reporters: + fake reporter: fake description + +" contains: "fake reporter" +Reporters.tests.cpp:<line number>: passed: listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) for: "All available test cases: + fake test name + [fakeTestTag] +1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) +Misc.tests.cpp:<line number>: passed: with 1 message: 'oops!' +Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'For some reason someone is throwing a string literal!' +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 +StringManip.tests.cpp:<line number>: passed: trim(std::string(no_whitespace)) == no_whitespace for: "There is no extra whitespace here" +== +"There is no extra whitespace here" +StringManip.tests.cpp:<line number>: passed: trim(std::string(leading_whitespace)) == no_whitespace for: "There is no extra whitespace here" +== +"There is no extra whitespace here" +StringManip.tests.cpp:<line number>: passed: trim(std::string(trailing_whitespace)) == no_whitespace for: "There is no extra whitespace here" +== +"There is no extra whitespace here" +StringManip.tests.cpp:<line number>: passed: trim(std::string(whitespace_at_both_ends)) == no_whitespace for: "There is no extra whitespace here" +== +"There is no extra whitespace here" +StringManip.tests.cpp:<line number>: passed: trim(StringRef(no_whitespace)) == StringRef(no_whitespace) for: There is no extra whitespace here +== +There is no extra whitespace here +StringManip.tests.cpp:<line number>: passed: trim(StringRef(leading_whitespace)) == StringRef(no_whitespace) for: There is no extra whitespace here +== +There is no extra whitespace here +StringManip.tests.cpp:<line number>: passed: trim(StringRef(trailing_whitespace)) == StringRef(no_whitespace) for: There is no extra whitespace here +== +There is no extra whitespace here +StringManip.tests.cpp:<line number>: passed: trim(StringRef(whitespace_at_both_ends)) == StringRef(no_whitespace) for: There is no extra whitespace here +== +There is no extra whitespace here +Exception.tests.cpp:<line number>: failed: unexpected exception with message: '3.14' +UniquePtr.tests.cpp:<line number>: passed: bptr->i == 3 for: 3 == 3 +UniquePtr.tests.cpp:<line number>: passed: bptr->i == 3 for: 3 == 3 +MatchersRanges.tests.cpp:<line number>: passed: data, AllMatch(SizeIs(5)) for: { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } all match has size == 5 +MatchersRanges.tests.cpp:<line number>: passed: data, !AllMatch(Contains(0) && Contains(1)) for: { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } not all match ( contains element 0 and contains element 1 ) +MatchersRanges.tests.cpp:<line number>: passed: needs_adl, AllMatch( Predicate<int>( []( int elem ) { return elem < 6; } ) ) for: { 1, 2, 3, 4, 5 } all match matches undescribed predicate +MatchersRanges.tests.cpp:<line number>: passed: mocked, allMatch for: { 1, 2, 3, 4, 5 } all match matches undescribed predicate +MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[1] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[2] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[3] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[4] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked, !allMatch for: { 1, 2, 3, 4, 5 } not all match matches undescribed predicate +MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[1] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[2] for: true +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.derefed[3]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.derefed[4]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: data, AnyMatch(SizeIs(5)) for: { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } any match has size == 5 +MatchersRanges.tests.cpp:<line number>: passed: data, !AnyMatch(Contains(0) && Contains(10)) for: { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } not any match ( contains element 0 and contains element 10 ) +MatchersRanges.tests.cpp:<line number>: passed: needs_adl, AnyMatch( Predicate<int>( []( int elem ) { return elem < 3; } ) ) for: { 1, 2, 3, 4, 5 } any match matches undescribed predicate +MatchersRanges.tests.cpp:<line number>: passed: mocked, !anyMatch for: { 1, 2, 3, 4, 5 } not any match matches undescribed predicate +MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[1] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[2] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[3] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[4] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked, anyMatch for: { 1, 2, 3, 4, 5 } any match matches undescribed predicate +MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.derefed[1]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.derefed[2]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.derefed[3]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.derefed[4]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: data, NoneMatch(SizeIs(6)) for: { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } none match has size == 6 +MatchersRanges.tests.cpp:<line number>: passed: data, !NoneMatch(Contains(0) && Contains(1)) for: { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } not none match ( contains element 0 and contains element 1 ) +MatchersRanges.tests.cpp:<line number>: passed: needs_adl, NoneMatch( Predicate<int>( []( int elem ) { return elem > 6; } ) ) for: { 1, 2, 3, 4, 5 } none match matches undescribed predicate +MatchersRanges.tests.cpp:<line number>: passed: mocked, noneMatch for: { 1, 2, 3, 4, 5 } none match matches undescribed predicate +MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[1] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[2] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[3] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[4] for: true +MatchersRanges.tests.cpp:<line number>: passed: mocked, !noneMatch for: { 1, 2, 3, 4, 5 } not none match matches undescribed predicate +MatchersRanges.tests.cpp:<line number>: passed: mocked.derefed[0] for: true +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.derefed[1]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.derefed[2]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.derefed[3]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: !(mocked.derefed[4]) for: !false +MatchersRanges.tests.cpp:<line number>: passed: empty_vec, SizeIs(0) for: { } has size == 0 +MatchersRanges.tests.cpp:<line number>: passed: empty_vec, !SizeIs(2) for: { } not has size == 2 +MatchersRanges.tests.cpp:<line number>: passed: empty_vec, SizeIs(Lt(2)) for: { } size matches is less than 2 +MatchersRanges.tests.cpp:<line number>: passed: arr, SizeIs(2) for: { 0, 0 } has size == 2 +MatchersRanges.tests.cpp:<line number>: passed: arr, SizeIs( Lt(3)) for: { 0, 0 } size matches is less than 3 +MatchersRanges.tests.cpp:<line number>: passed: arr, !SizeIs(!Lt(3)) for: { 0, 0 } not size matches not is less than 3 +MatchersRanges.tests.cpp:<line number>: passed: map, SizeIs(3) for: { {?}, {?}, {?} } has size == 3 +MatchersRanges.tests.cpp:<line number>: passed: unrelated::ADL_size{}, SizeIs(12) for: {?} has size == 12 +MatchersRanges.tests.cpp:<line number>: passed: has_size{}, SizeIs(13) for: {?} has size == 13 +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: empty, Approx(empty) for: { } is approx: { } +Matchers.tests.cpp:<line number>: passed: v1, Approx(v1) for: { 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 } +Matchers.tests.cpp:<line number>: passed: v1, Approx<double>({ 1., 2., 3. }) for: { 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 } +Matchers.tests.cpp:<line number>: passed: v1, !Approx(temp) for: { 1.0, 2.0, 3.0 } not is approx: { 1.0, 2.0, 3.0, 4.0 } +Matchers.tests.cpp:<line number>: passed: v1, !Approx(v2) for: { 1.0, 2.0, 3.0 } not is approx: { 1.5, 2.5, 3.5 } +Matchers.tests.cpp:<line number>: passed: v1, Approx(v2).margin(0.5) for: { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } +Matchers.tests.cpp:<line number>: passed: v1, Approx(v2).epsilon(0.5) for: { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } +Matchers.tests.cpp:<line number>: passed: v1, Approx(v2).epsilon(0.1).scale(500) for: { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } +Matchers.tests.cpp:<line number>: failed: empty, Approx(t1) for: { } is approx: { 1.0, 2.0 } +Matchers.tests.cpp:<line number>: failed: v1, Approx(v2) for: { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 } +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: v5, (VectorContains<int, CustomAllocator<int>>(2)) for: { 1, 2, 3 } Contains: 2 +Matchers.tests.cpp:<line number>: passed: v, Contains(v2) for: { 1, 2, 3 } Contains: { 1, 2 } +Matchers.tests.cpp:<line number>: passed: v, Contains<int>({ 1, 2 }) for: { 1, 2, 3 } Contains: { 1, 2 } +Matchers.tests.cpp:<line number>: passed: v5, (Contains<int, std::allocator<int>, CustomAllocator<int>>(v2)) for: { 1, 2, 3 } Contains: { 1, 2 } +Matchers.tests.cpp:<line number>: passed: v, Contains(v2) for: { 1, 2, 3 } Contains: { 1, 2, 3 } +Matchers.tests.cpp:<line number>: passed: v, Contains(empty) for: { 1, 2, 3 } Contains: { } +Matchers.tests.cpp:<line number>: passed: empty, Contains(empty) for: { } Contains: { } +Matchers.tests.cpp:<line number>: passed: v5, (Contains<int, std::allocator<int>, CustomAllocator<int>>(v2)) for: { 1, 2, 3 } Contains: { 1, 2, 3 } +Matchers.tests.cpp:<line number>: passed: v5, Contains(v6) for: { 1, 2, 3 } Contains: { 1, 2 } +Matchers.tests.cpp:<line number>: passed: v, VectorContains(1) && VectorContains(2) for: { 1, 2, 3 } ( Contains: 1 and Contains: 2 ) +Matchers.tests.cpp:<line number>: passed: v, Equals(v) for: { 1, 2, 3 } Equals: { 1, 2, 3 } +Matchers.tests.cpp:<line number>: passed: empty, Equals(empty) for: { } Equals: { } +Matchers.tests.cpp:<line number>: passed: v, Equals<int>({ 1, 2, 3 }) for: { 1, 2, 3 } Equals: { 1, 2, 3 } +Matchers.tests.cpp:<line number>: passed: v, Equals(v2) for: { 1, 2, 3 } Equals: { 1, 2, 3 } +Matchers.tests.cpp:<line number>: passed: v5, (Equals<int, std::allocator<int>, CustomAllocator<int>>(v2)) for: { 1, 2, 3 } Equals: { 1, 2, 3 } +Matchers.tests.cpp:<line number>: passed: v5, Equals(v6) for: { 1, 2, 3 } Equals: { 1, 2, 3 } +Matchers.tests.cpp:<line number>: passed: v, UnorderedEquals(v) for: { 1, 2, 3 } UnorderedEquals: { 1, 2, 3 } +Matchers.tests.cpp:<line number>: passed: v, UnorderedEquals<int>({ 3, 2, 1 }) for: { 1, 2, 3 } UnorderedEquals: { 3, 2, 1 } +Matchers.tests.cpp:<line number>: passed: empty, UnorderedEquals(empty) for: { } UnorderedEquals: { } +Matchers.tests.cpp:<line number>: passed: permuted, UnorderedEquals(v) for: { 1, 3, 2 } UnorderedEquals: { 1, 2, 3 } +Matchers.tests.cpp:<line number>: passed: permuted, UnorderedEquals(v) for: { 2, 3, 1 } UnorderedEquals: { 1, 2, 3 } +Matchers.tests.cpp:<line number>: passed: v5, (UnorderedEquals<int, std::allocator<int>, CustomAllocator<int>>(permuted)) for: { 1, 2, 3 } UnorderedEquals: { 2, 3, 1 } +Matchers.tests.cpp:<line number>: passed: v5_permuted, UnorderedEquals(v5) for: { 1, 3, 2 } 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]" +InternalBenchmark.tests.cpp:<line number>: passed: analysis.mean.point.count() == 23 for: 23.0 == 23 +InternalBenchmark.tests.cpp:<line number>: passed: analysis.mean.lower_bound.count() == 23 for: 23.0 == 23 +InternalBenchmark.tests.cpp:<line number>: passed: analysis.mean.upper_bound.count() == 23 for: 23.0 == 23 +InternalBenchmark.tests.cpp:<line number>: passed: analysis.standard_deviation.point.count() == 0 for: 0.0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: analysis.standard_deviation.lower_bound.count() == 0 for: 0.0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: analysis.standard_deviation.upper_bound.count() == 0 for: 0.0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: analysis.outliers.total() == 0 for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: analysis.outliers.low_mild == 0 for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: analysis.outliers.low_severe == 0 for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: analysis.outliers.high_mild == 0 for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: analysis.outliers.high_severe == 0 for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: analysis.outliers.samples_seen == 0 for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: analysis.outlier_variance == 0 for: 0.0 == 0 +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 +InternalBenchmark.tests.cpp:<line number>: passed: model.started == 1 for: 1 == 1 +InternalBenchmark.tests.cpp:<line number>: passed: model.finished == 0 for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: model.started == 1 for: 1 == 1 +InternalBenchmark.tests.cpp:<line number>: passed: model.finished == 1 for: 1 == 1 +InternalBenchmark.tests.cpp:<line number>: passed: called == 1 for: 1 == 1 +InternalBenchmark.tests.cpp:<line number>: passed: model.started == 0 for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: model.finished == 0 for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: model.started == 0 for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: model.finished == 0 for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: called == 1 for: 1 == 1 +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 +InternalBenchmark.tests.cpp:<line number>: passed: o.samples_seen == static_cast<int>(x.size()) for: 6 == 6 +InternalBenchmark.tests.cpp:<line number>: passed: o.low_severe == los for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: o.low_mild == lom for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: o.high_mild == him for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: o.high_severe == his for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: o.total() == los + lom + him + his for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: o.samples_seen == static_cast<int>(x.size()) for: 6 == 6 +InternalBenchmark.tests.cpp:<line number>: passed: o.low_severe == los for: 1 == 1 +InternalBenchmark.tests.cpp:<line number>: passed: o.low_mild == lom for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: o.high_mild == him for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: o.high_severe == his for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: o.total() == los + lom + him + his for: 1 == 1 +InternalBenchmark.tests.cpp:<line number>: passed: o.samples_seen == static_cast<int>(x.size()) for: 6 == 6 +InternalBenchmark.tests.cpp:<line number>: passed: o.low_severe == los for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: o.low_mild == lom for: 1 == 1 +InternalBenchmark.tests.cpp:<line number>: passed: o.high_mild == him for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: o.high_severe == his for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: o.total() == los + lom + him + his for: 1 == 1 +InternalBenchmark.tests.cpp:<line number>: passed: o.samples_seen == static_cast<int>(x.size()) for: 6 == 6 +InternalBenchmark.tests.cpp:<line number>: passed: o.low_severe == los for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: o.low_mild == lom for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: o.high_mild == him for: 1 == 1 +InternalBenchmark.tests.cpp:<line number>: passed: o.high_severe == his for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: o.total() == los + lom + him + his for: 1 == 1 +InternalBenchmark.tests.cpp:<line number>: passed: o.samples_seen == static_cast<int>(x.size()) for: 6 == 6 +InternalBenchmark.tests.cpp:<line number>: passed: o.low_severe == los for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: o.low_mild == lom for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: o.high_mild == him for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: o.high_severe == his for: 1 == 1 +InternalBenchmark.tests.cpp:<line number>: passed: o.total() == los + lom + him + his for: 1 == 1 +InternalBenchmark.tests.cpp:<line number>: passed: o.samples_seen == static_cast<int>(x.size()) for: 6 == 6 +InternalBenchmark.tests.cpp:<line number>: passed: o.low_severe == los for: 1 == 1 +InternalBenchmark.tests.cpp:<line number>: passed: o.low_mild == lom for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: o.high_mild == him for: 1 == 1 +InternalBenchmark.tests.cpp:<line number>: passed: o.high_severe == his for: 0 == 0 +InternalBenchmark.tests.cpp:<line number>: passed: o.total() == los + lom + him + his for: 2 == 2 +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 +InternalBenchmark.tests.cpp:<line number>: passed: erfc_inv(1.103560) == Approx(-0.09203687623843015) for: -0.0920368762 == Approx( -0.0920368762 ) +InternalBenchmark.tests.cpp:<line number>: passed: erfc_inv(1.067400) == Approx(-0.05980291115763361) for: -0.0598029112 == Approx( -0.0598029112 ) +InternalBenchmark.tests.cpp:<line number>: passed: erfc_inv(0.050000) == Approx(1.38590382434967796) for: 1.3859038243 == Approx( 1.3859038243 ) +InternalBenchmark.tests.cpp:<line number>: passed: res.mean.count() == rate for: 2000.0 == 2000 (0x<hex digits>) +InternalBenchmark.tests.cpp:<line number>: passed: res.outliers.total() == 0 for: 0 == 0 +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' +Message.tests.cpp:<line number>: failed: explicitly with 1 message: 'previous unscoped 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: b > a for: 1 > 1 +Misc.tests.cpp:<line number>: passed: b > a for: 2 > 1 +Misc.tests.cpp:<line number>: passed: b > a for: 3 > 1 +Misc.tests.cpp:<line number>: passed: b > a for: 4 > 1 +Misc.tests.cpp:<line number>: passed: b > a for: 5 > 1 +Misc.tests.cpp:<line number>: passed: b > a for: 6 > 1 +Misc.tests.cpp:<line number>: passed: b > a for: 7 > 1 +Misc.tests.cpp:<line number>: passed: b > a for: 8 > 1 +Misc.tests.cpp:<line number>: passed: b > a for: 9 > 1 +Misc.tests.cpp:<line number>: failed: ( fib[i] % 2 ) == 0 for: 1 == 0 with 1 message: 'Testing if fib[0] (1) is even' +Misc.tests.cpp:<line number>: failed: ( fib[i] % 2 ) == 0 for: 1 == 0 with 1 message: 'Testing if fib[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' +UniquePtr.tests.cpp:<line number>: passed: !(lval.has_moved) for: !false +UniquePtr.tests.cpp:<line number>: passed: rval.has_moved for: true +UniquePtr.tests.cpp:<line number>: passed: *ptr == std::tuple<int, double, int>{1, 2., 3} for: {?} == {?} +InternalBenchmark.tests.cpp:<line number>: passed: m == 19. for: 19.0 == 19.0 +InternalBenchmark.tests.cpp:<line number>: passed: x == 17 for: 17 == 17 +InternalBenchmark.tests.cpp:<line number>: passed: x == 23 for: 23 == 23 +InternalBenchmark.tests.cpp:<line number>: passed: r.elapsed.count() == 42 for: 42 == 42 +InternalBenchmark.tests.cpp:<line number>: passed: r.result == 23 for: 23 == 23 +InternalBenchmark.tests.cpp:<line number>: passed: r.iterations == 1 for: 1 == 1 +InternalBenchmark.tests.cpp:<line number>: passed: s.elapsed.count() == 69 for: 69 == 69 +InternalBenchmark.tests.cpp:<line number>: passed: s.result == 17 for: 17 == 17 +InternalBenchmark.tests.cpp:<line number>: passed: s.iterations == 1 for: 1 == 1 +Message.tests.cpp:<line number>: warning: 'info' with 2 messages: 'unscoped info' and 'and warn may mix' +Message.tests.cpp:<line number>: warning: 'info' with 2 messages: 'unscoped info' and 'they are not cleared after warnings' +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: {?} == {?} +InternalBenchmark.tests.cpp:<line number>: passed: normal_cdf(0.000000) == Approx(0.50000000000000000) for: 0.5 == Approx( 0.5 ) +InternalBenchmark.tests.cpp:<line number>: passed: normal_cdf(1.000000) == Approx(0.84134474606854293) for: 0.8413447461 == Approx( 0.8413447461 ) +InternalBenchmark.tests.cpp:<line number>: passed: normal_cdf(-1.000000) == Approx(0.15865525393145705) for: 0.1586552539 == Approx( 0.1586552539 ) +InternalBenchmark.tests.cpp:<line number>: passed: normal_cdf(2.809729) == Approx(0.99752083845315409) for: 0.9975208385 == Approx( 0.9975208385 ) +InternalBenchmark.tests.cpp:<line number>: passed: normal_cdf(-1.352570) == Approx(0.08809652095066035) for: 0.088096521 == Approx( 0.088096521 ) +InternalBenchmark.tests.cpp:<line number>: passed: normal_quantile(0.551780) == Approx(0.13015979861484198) for: 0.1301597986 == Approx( 0.1301597986 ) +InternalBenchmark.tests.cpp:<line number>: passed: normal_quantile(0.533700) == Approx(0.08457408802851875) for: 0.084574088 == Approx( 0.084574088 ) +InternalBenchmark.tests.cpp:<line number>: passed: normal_quantile(0.025000) == Approx(-1.95996398454005449) for: -1.9599639845 == Approx( -1.9599639845 ) +Misc.tests.cpp:<line number>: passed: +Message.tests.cpp:<line number>: passed: true with 1 message: 'this MAY be seen only for the FIRST assertion IF info is printed for passing assertions' +Message.tests.cpp:<line number>: passed: true with 1 message: 'this MAY be seen only for the SECOND assertion IF info is printed for passing assertions' +Message.tests.cpp:<line number>: failed: false with 1 message: 'this SHOULD be seen' +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 } }" +ToString.tests.cpp:<line number>: passed: parseEnums( "" ), Equals( std::vector<Catch::StringRef>{} ) for: { } Equals: { } +ToString.tests.cpp:<line number>: passed: parseEnums( "ClassName::EnumName::Value1" ), Equals(std::vector<Catch::StringRef>{"Value1"} ) for: { Value1 } Equals: { Value1 } +ToString.tests.cpp:<line number>: passed: parseEnums( "Value1" ), Equals( std::vector<Catch::StringRef>{"Value1"} ) for: { Value1 } Equals: { Value1 } +ToString.tests.cpp:<line number>: passed: parseEnums( "EnumName::Value1" ), Equals(std::vector<Catch::StringRef>{"Value1"} ) for: { Value1 } Equals: { Value1 } +ToString.tests.cpp:<line number>: passed: parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2"} ) for: { Value1, Value2 } Equals: { Value1, Value2 } +ToString.tests.cpp:<line number>: passed: parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2, ClassName::EnumName::Value3" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2", "Value3"} ) for: { Value1, Value2, Value3 } Equals: { Value1, Value2, Value3 } +ToString.tests.cpp:<line number>: passed: parseEnums( "ClassName::EnumName::Value1,ClassName::EnumName::Value2 , ClassName::EnumName::Value3" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2", "Value3"} ) for: { Value1, Value2, Value3 } Equals: { Value1, Value2, Value3 } +Tricky.tests.cpp:<line number>: passed: p == 0 for: 0 == 0 +Message.tests.cpp:<line number>: passed: true with 1 message: 'this MAY be seen IF info is printed for passing assertions' +Message.tests.cpp:<line number>: failed: false with 2 messages: 'this SHOULD be seen' and 'this SHOULD also be seen' +Message.tests.cpp:<line number>: failed: false with 1 message: 'this SHOULD be seen only ONCE' +Message.tests.cpp:<line number>: passed: true +Message.tests.cpp:<line number>: passed: true with 1 message: 'this MAY also be seen only ONCE IF info is printed for passing assertions' +Message.tests.cpp:<line number>: passed: true +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 +StringManip.tests.cpp:<line number>: passed: Catch::replaceInPlace(letters, "b", "z") for: true +StringManip.tests.cpp:<line number>: passed: letters == "azcdefcg" for: "azcdefcg" == "azcdefcg" +StringManip.tests.cpp:<line number>: passed: Catch::replaceInPlace(letters, "c", "z") for: true +StringManip.tests.cpp:<line number>: passed: letters == "abzdefzg" for: "abzdefzg" == "abzdefzg" +StringManip.tests.cpp:<line number>: passed: Catch::replaceInPlace(letters, "a", "z") for: true +StringManip.tests.cpp:<line number>: passed: letters == "zbcdefcg" for: "zbcdefcg" == "zbcdefcg" +StringManip.tests.cpp:<line number>: passed: Catch::replaceInPlace(letters, "g", "z") for: true +StringManip.tests.cpp:<line number>: passed: letters == "abcdefcz" for: "abcdefcz" == "abcdefcz" +StringManip.tests.cpp:<line number>: passed: Catch::replaceInPlace(letters, letters, "replaced") for: true +StringManip.tests.cpp:<line number>: passed: letters == "replaced" for: "replaced" == "replaced" +StringManip.tests.cpp:<line number>: passed: !(Catch::replaceInPlace(letters, "x", "z")) for: !false +StringManip.tests.cpp:<line number>: passed: letters == letters for: "abcdefcg" == "abcdefcg" +StringManip.tests.cpp:<line number>: passed: Catch::replaceInPlace(s, "'", "|'") for: true +StringManip.tests.cpp:<line number>: passed: s == "didn|'t" for: "didn|'t" == "didn|'t" +InternalBenchmark.tests.cpp:<line number>: passed: res.size() == count for: 10 == 10 +InternalBenchmark.tests.cpp:<line number>: passed: res[i] == rate for: 1000.0 == 1000 (0x<hex digits>) +InternalBenchmark.tests.cpp:<line number>: passed: res[i] == rate for: 1000.0 == 1000 (0x<hex digits>) +InternalBenchmark.tests.cpp:<line number>: passed: res[i] == rate for: 1000.0 == 1000 (0x<hex digits>) +InternalBenchmark.tests.cpp:<line number>: passed: res[i] == rate for: 1000.0 == 1000 (0x<hex digits>) +InternalBenchmark.tests.cpp:<line number>: passed: res[i] == rate for: 1000.0 == 1000 (0x<hex digits>) +InternalBenchmark.tests.cpp:<line number>: passed: res[i] == rate for: 1000.0 == 1000 (0x<hex digits>) +InternalBenchmark.tests.cpp:<line number>: passed: res[i] == rate for: 1000.0 == 1000 (0x<hex digits>) +InternalBenchmark.tests.cpp:<line number>: passed: res[i] == rate for: 1000.0 == 1000 (0x<hex digits>) +InternalBenchmark.tests.cpp:<line number>: passed: res[i] == rate for: 1000.0 == 1000 (0x<hex digits>) +InternalBenchmark.tests.cpp:<line number>: passed: meter.runs() >= old_runs for: 1 >= 1 +InternalBenchmark.tests.cpp:<line number>: passed: meter.runs() >= old_runs for: 2 >= 1 +InternalBenchmark.tests.cpp:<line number>: passed: meter.runs() >= old_runs for: 4 >= 2 +InternalBenchmark.tests.cpp:<line number>: passed: meter.runs() >= old_runs for: 8 >= 4 +InternalBenchmark.tests.cpp:<line number>: passed: meter.runs() >= old_runs for: 16 >= 8 +InternalBenchmark.tests.cpp:<line number>: passed: meter.runs() >= old_runs for: 32 >= 16 +InternalBenchmark.tests.cpp:<line number>: passed: meter.runs() >= old_runs for: 64 >= 32 +InternalBenchmark.tests.cpp:<line number>: passed: meter.runs() >= old_runs for: 128 >= 64 +InternalBenchmark.tests.cpp:<line number>: passed: Timing.elapsed >= time for: 128 ns >= 100 ns +InternalBenchmark.tests.cpp:<line number>: passed: Timing.result == Timing.iterations + 17 for: 145 == 145 +InternalBenchmark.tests.cpp:<line number>: passed: Timing.iterations >= time.count() for: 128 >= 100 +InternalBenchmark.tests.cpp:<line number>: passed: x >= old_x for: 1 >= 1 +InternalBenchmark.tests.cpp:<line number>: passed: x >= old_x for: 2 >= 1 +InternalBenchmark.tests.cpp:<line number>: passed: x >= old_x for: 4 >= 2 +InternalBenchmark.tests.cpp:<line number>: passed: x >= old_x for: 8 >= 4 +InternalBenchmark.tests.cpp:<line number>: passed: x >= old_x for: 16 >= 8 +InternalBenchmark.tests.cpp:<line number>: passed: x >= old_x for: 32 >= 16 +InternalBenchmark.tests.cpp:<line number>: passed: x >= old_x for: 64 >= 32 +InternalBenchmark.tests.cpp:<line number>: passed: x >= old_x for: 128 >= 64 +InternalBenchmark.tests.cpp:<line number>: passed: Timing.elapsed >= time for: 128 ns >= 100 ns +InternalBenchmark.tests.cpp:<line number>: passed: Timing.result == Timing.iterations + 17 for: 145 == 145 +InternalBenchmark.tests.cpp:<line number>: passed: Timing.iterations >= time.count() for: 128 >= 100 +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' +Tag.tests.cpp:<line number>: passed: tags, VectorContains("magic-tag"_catch_sr) && VectorContains("."_catch_sr) for: { ., magic-tag } ( Contains: magic-tag and Contains: . ) +StringManip.tests.cpp:<line number>: passed: splitStringRef("", ','), Equals(std::vector<StringRef>()) for: { } Equals: { } +StringManip.tests.cpp:<line number>: passed: splitStringRef("abc", ','), Equals(std::vector<StringRef>{"abc"}) for: { abc } Equals: { abc } +StringManip.tests.cpp:<line number>: passed: splitStringRef("abc,def", ','), Equals(std::vector<StringRef>{"abc", "def"}) for: { abc, def } Equals: { abc, def } +Message.tests.cpp:<line number>: failed: false with 4 messages: 'Count 1 to 3...' and '1' and '2' and '3' +Message.tests.cpp:<line number>: failed: false with 4 messages: 'Count 4 to 6...' and '4' and '5' and '6' +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(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( 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) == "{?}" for: "{?}" == "{?}" +ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( item ) == "operator<<( has_operator )" for: "operator<<( has_operator )" +== +"operator<<( has_operator )" +ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( item ) == "operator<<( has_template_operator )" for: "operator<<( has_template_operator )" +== +"operator<<( has_template_operator )" +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 ) }" +Generators.tests.cpp:<line number>: passed: data.str.size() == data.len for: 3 == 3 +Generators.tests.cpp:<line number>: passed: data.str.size() == data.len for: 3 == 3 +Generators.tests.cpp:<line number>: passed: data.str.size() == data.len for: 5 == 5 +Generators.tests.cpp:<line number>: passed: data.str.size() == data.len for: 4 == 4 +Generators.tests.cpp:<line number>: passed: strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) for: 5 == 5 +Generators.tests.cpp:<line number>: passed: strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) for: 6 == 6 +Generators.tests.cpp:<line number>: passed: strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) for: 5 == 5 +Generators.tests.cpp:<line number>: passed: strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) for: 6 == 6 +Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'Why would you throw a std::string?' +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"" +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 }" +InternalBenchmark.tests.cpp:<line number>: passed: e.point == 23 for: 23.0 == 23 +InternalBenchmark.tests.cpp:<line number>: passed: e.upper_bound == 23 for: 23.0 == 23 +InternalBenchmark.tests.cpp:<line number>: passed: e.lower_bound == 23 for: 23.0 == 23 +InternalBenchmark.tests.cpp:<line number>: passed: e.confidence_interval == 0.95 for: 0.95 == 0.95 +UniquePtr.tests.cpp:<line number>: passed: !(ptr) for: !{?} +UniquePtr.tests.cpp:<line number>: passed: ptr.get() == 0 for: 0 == 0 +UniquePtr.tests.cpp:<line number>: passed: ptr for: {?} +UniquePtr.tests.cpp:<line number>: passed: *ptr == 0 for: 0 == 0 +UniquePtr.tests.cpp:<line number>: passed: ptr.get() == naked_ptr for: 0x<hex digits> == 0x<hex digits> +UniquePtr.tests.cpp:<line number>: passed: !(ptr) for: !{?} +UniquePtr.tests.cpp:<line number>: passed: ptr.get() == 0 for: 0 == 0 +UniquePtr.tests.cpp:<line number>: passed: ptr for: {?} +UniquePtr.tests.cpp:<line number>: passed: *ptr == 0 for: 0 == 0 +UniquePtr.tests.cpp:<line number>: passed: ptr.get() == naked_ptr for: 0x<hex digits> == 0x<hex digits> +UniquePtr.tests.cpp:<line number>: passed: ptr for: {?} +UniquePtr.tests.cpp:<line number>: passed: ptr.get() != 0 for: 0x<hex digits> != 0 +UniquePtr.tests.cpp:<line number>: passed: *ptr == 2 for: 2 == 2 +UniquePtr.tests.cpp:<line number>: passed: !(ptr) for: !{?} +UniquePtr.tests.cpp:<line number>: passed: ptr.get() == 0 for: 0 == 0 +UniquePtr.tests.cpp:<line number>: passed: !(ptr1) for: !{?} +UniquePtr.tests.cpp:<line number>: passed: ptr2 for: {?} +UniquePtr.tests.cpp:<line number>: passed: *ptr2 == 1 for: 1 == 1 +UniquePtr.tests.cpp:<line number>: passed: !(ptr2) for: !{?} +UniquePtr.tests.cpp:<line number>: passed: ptr1 for: {?} +UniquePtr.tests.cpp:<line number>: passed: *ptr1 == 2 for: 2 == 2 +UniquePtr.tests.cpp:<line number>: passed: *ptr1 == 2 for: 2 == 2 +UniquePtr.tests.cpp:<line number>: passed: *ptr2 == 1 for: 1 == 1 +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 +InternalBenchmark.tests.cpp:<line number>: passed: (iterations * rate) > Catch::Benchmark::Detail::warmup_time.count() for: 160000000 (0x<hex digits>) > 100 +InternalBenchmark.tests.cpp:<line number>: passed: (end - start) > Catch::Benchmark::Detail::warmup_time for: 310016000 ns > 100 ms +InternalBenchmark.tests.cpp:<line number>: passed: q1 == 14.5 for: 14.5 == 14.5 +InternalBenchmark.tests.cpp:<line number>: passed: med == 18. for: 18.0 == 18.0 +InternalBenchmark.tests.cpp:<line number>: passed: q3 == 23. for: 23.0 == 23.0 +Misc.tests.cpp:<line number>: passed: +Misc.tests.cpp:<line number>: passed: +Failed 86 test cases, failed 148 assertions. + diff --git a/packages/Catch2/tests/SelfTest/Baselines/console.std.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/console.std.approved.txt new file mode 100644 index 0000000000000000000000000000000000000000..d781a60e316cc38de07ed386f0f6acb40c282ba7 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/Baselines/console.std.approved.txt @@ -0,0 +1,1385 @@ +Filters: ~[!nonportable]~[!benchmark]~[approvals] * + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +<exe-name> is a <version> host application. +Run with -? for options + +Randomness seeded to: 1 + +------------------------------------------------------------------------------- +#1455 - INFO and WARN can start with a linebreak +------------------------------------------------------------------------------- +Message.tests.cpp:<line number> +............................................................................... + +Message.tests.cpp:<line number>: warning: + +This warning message starts with a linebreak + +This would not be caught previously +Nor would this +------------------------------------------------------------------------------- +#1514: stderr/stdout is not captured in tests aborted by an exception +------------------------------------------------------------------------------- +Tricky.tests.cpp:<line number> +............................................................................... + +Tricky.tests.cpp:<line number>: FAILED: +explicitly with message: + 1514 + +------------------------------------------------------------------------------- +#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 TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo +<float> +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: FAILED: + REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) +with expansion: + 0 == 1 + +------------------------------------------------------------------------------- +A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo +<int> +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: FAILED: + REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) +with expansion: + 0 == 1 + +------------------------------------------------------------------------------- +A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector +<float> +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: FAILED: + REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) +with expansion: + 0 == 1 + +------------------------------------------------------------------------------- +A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector +<int> +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: FAILED: + REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) +with expansion: + 0 == 1 + +------------------------------------------------------------------------------- +A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - +Template_Foo_2<float, 6> +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: FAILED: + REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) +with expansion: + 6 < 2 + +------------------------------------------------------------------------------- +A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - +Template_Foo_2<int, 2> +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: FAILED: + REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) +with expansion: + 2 < 2 + +------------------------------------------------------------------------------- +A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array +<float, 6> +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: FAILED: + REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) +with expansion: + 6 < 2 + +------------------------------------------------------------------------------- +A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array +<int, 2> +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: FAILED: + REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) +with expansion: + 2 < 2 + +------------------------------------------------------------------------------- +A TEMPLATE_TEST_CASE_METHOD based test run that fails - double +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: FAILED: + REQUIRE( Template_Fixture<TestType>::m_a == 2 ) +with expansion: + 1.0 == 2 + +------------------------------------------------------------------------------- +A TEMPLATE_TEST_CASE_METHOD based test run that fails - float +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: FAILED: + REQUIRE( Template_Fixture<TestType>::m_a == 2 ) +with expansion: + 1.0f == 2 + +------------------------------------------------------------------------------- +A TEMPLATE_TEST_CASE_METHOD based test run that fails - int +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: FAILED: + REQUIRE( Template_Fixture<TestType>::m_a == 2 ) +with expansion: + 1 == 2 + +------------------------------------------------------------------------------- +A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 1 +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: FAILED: + REQUIRE( Nttp_Fixture<V>::value == 0 ) +with expansion: + 1 == 0 + +------------------------------------------------------------------------------- +A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 3 +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: FAILED: + REQUIRE( Nttp_Fixture<V>::value == 0 ) +with expansion: + 3 == 0 + +------------------------------------------------------------------------------- +A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 6 +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: FAILED: + REQUIRE( Nttp_Fixture<V>::value == 0 ) +with expansion: + 6 == 0 + +------------------------------------------------------------------------------- +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( throwsSpecialException(3), SpecialException, ExceptionMatcher{1} ) +with expansion: + SpecialException::what special exception has value of 1 + +Matchers.tests.cpp:<line number>: FAILED: + REQUIRE_THROWS_MATCHES( throwsSpecialException(4), SpecialException, ExceptionMatcher{1} ) +with expansion: + SpecialException::what 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; + } + " + +------------------------------------------------------------------------------- +Thrown string literals are translated +------------------------------------------------------------------------------- +Exception.tests.cpp:<line number> +............................................................................... + +Exception.tests.cpp:<line number>: FAILED: +due to unexpected exception with message: + For some reason someone is throwing a string literal! + +------------------------------------------------------------------------------- +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 Approx matcher -- failing + Empty and non empty vectors are not approx equal +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: FAILED: + CHECK_THAT( empty, Approx(t1) ) +with expansion: + { } is approx: { 1.0, 2.0 } + +------------------------------------------------------------------------------- +Vector Approx matcher -- failing + Just different vectors +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: FAILED: + CHECK_THAT( v1, Approx(v2) ) +with expansion: + { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 } + +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +just failure after unscoped info +------------------------------------------------------------------------------- +Message.tests.cpp:<line number> +............................................................................... + +Message.tests.cpp:<line number>: FAILED: +explicitly with message: + previous unscoped info SHOULD not be seen + +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 0 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: FAILED: + CHECK( b > a ) +with expansion: + 0 > 1 + +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 1 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: FAILED: + CHECK( b > a ) +with expansion: + 1 > 1 + +------------------------------------------------------------------------------- +looped tests +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +mix info, unscoped info and warning +------------------------------------------------------------------------------- +Message.tests.cpp:<line number> +............................................................................... + +Message.tests.cpp:<line number>: warning: + and warn may mix + +Message.tests.cpp:<line number>: warning: + they are not cleared after warnings + +------------------------------------------------------------------------------- +more nested SECTION tests + doesn't equal + equal +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: FAILED: + REQUIRE( a == b ) +with expansion: + 1 == 2 + +------------------------------------------------------------------------------- +not prints unscoped info from previous failures +------------------------------------------------------------------------------- +Message.tests.cpp:<line number> +............................................................................... + +Message.tests.cpp:<line number>: FAILED: + REQUIRE( false ) +with message: + this SHOULD be seen + +------------------------------------------------------------------------------- +prints unscoped info on failure +------------------------------------------------------------------------------- +Message.tests.cpp:<line number> +............................................................................... + +Message.tests.cpp:<line number>: FAILED: + REQUIRE( false ) +with messages: + this SHOULD be seen + this SHOULD also be seen + +------------------------------------------------------------------------------- +prints unscoped info only for the first assertion +------------------------------------------------------------------------------- +Message.tests.cpp:<line number> +............................................................................... + +Message.tests.cpp:<line number>: FAILED: + CHECK( false ) +with message: + this SHOULD be seen only ONCE + +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +stacks unscoped info in loops +------------------------------------------------------------------------------- +Message.tests.cpp:<line number> +............................................................................... + +Message.tests.cpp:<line number>: FAILED: + CHECK( false ) +with messages: + Count 1 to 3... + 1 + 2 + 3 + +Message.tests.cpp:<line number>: FAILED: + CHECK( false ) +with messages: + Count 4 to 6... + 4 + 5 + 6 + +------------------------------------------------------------------------------- +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" + +------------------------------------------------------------------------------- +thrown std::strings are translated +------------------------------------------------------------------------------- +Exception.tests.cpp:<line number> +............................................................................... + +Exception.tests.cpp:<line number>: FAILED: +due to unexpected exception with message: + Why would you throw a std::string? + +=============================================================================== +test cases: 356 | 282 passed | 70 failed | 4 failed as expected +assertions: 2088 | 1936 passed | 131 failed | 21 failed as expected + diff --git a/packages/Catch2/tests/SelfTest/Baselines/console.sw.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/console.sw.approved.txt new file mode 100644 index 0000000000000000000000000000000000000000..7066d5938ed8da7966b7430a1916b9ed0cc79455 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/Baselines/console.sw.approved.txt @@ -0,0 +1,16773 @@ +Filters: ~[!nonportable]~[!benchmark]~[approvals] * + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +<exe-name> is a <version> host application. +Run with -? for options + +Randomness seeded to: 1 + +------------------------------------------------------------------------------- +# 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: Bitfields can be captured +------------------------------------------------------------------------------- +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: + {?} >= {?} + +------------------------------------------------------------------------------- +#1175 - Hidden Test +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + +------------------------------------------------------------------------------- +#1238 +------------------------------------------------------------------------------- +Compilation.tests.cpp:<line number> +............................................................................... + +Compilation.tests.cpp:<line number>: PASSED: + REQUIRE( std::memcmp(uarr, "123", sizeof(uarr)) == 0 ) +with expansion: + 0 == 0 +with messages: + uarr := "123" + sarr := "456" + +Compilation.tests.cpp:<line number>: PASSED: + REQUIRE( std::memcmp(sarr, "456", sizeof(sarr)) == 0 ) +with expansion: + 0 == 0 +with messages: + uarr := "123" + sarr := "456" + +------------------------------------------------------------------------------- +#1245 +------------------------------------------------------------------------------- +Compilation.tests.cpp:<line number> +............................................................................... + +Compilation.tests.cpp:<line number>: PASSED: + +------------------------------------------------------------------------------- +#1319: Sections can have description (even if it is not saved + SectionName +------------------------------------------------------------------------------- +Compilation.tests.cpp:<line number> +............................................................................... + +Compilation.tests.cpp:<line number>: PASSED: + +------------------------------------------------------------------------------- +#1403 +------------------------------------------------------------------------------- +Compilation.tests.cpp:<line number> +............................................................................... + +Compilation.tests.cpp:<line number>: PASSED: + REQUIRE( h1 == h2 ) +with expansion: + [1403 helper] == [1403 helper] + +------------------------------------------------------------------------------- +#1455 - INFO and WARN can start with a linebreak +------------------------------------------------------------------------------- +Message.tests.cpp:<line number> +............................................................................... + +Message.tests.cpp:<line number>: warning: + +This info message starts with a linebreak + +This warning message starts with a linebreak + + +No assertions in test case '#1455 - INFO and WARN can start with a linebreak' + +This would not be caught previously +Nor would this +------------------------------------------------------------------------------- +#1514: stderr/stdout is not captured in tests aborted by an exception +------------------------------------------------------------------------------- +Tricky.tests.cpp:<line number> +............................................................................... + +Tricky.tests.cpp:<line number>: FAILED: +explicitly with message: + 1514 + +------------------------------------------------------------------------------- +#1548 +------------------------------------------------------------------------------- +Compilation.tests.cpp:<line number> +............................................................................... + +Compilation.tests.cpp:<line number>: PASSED: + REQUIRE( std::is_same<TypeList<int>, TypeList<int>>::value ) +with expansion: + true + +------------------------------------------------------------------------------- +#1905 -- test spec parser properly clears internal state between compound tests +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( spec.matches(*fakeTestCase("spec . char")) ) +with expansion: + true + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( spec.matches(*fakeTestCase("spec , char")) ) +with expansion: + true + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( spec.matches(*fakeTestCase(R"(spec \, char)")) ) +with expansion: + !false + +------------------------------------------------------------------------------- +#1912 -- test spec parser handles escaping + Various parentheses +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( spec.matches(*fakeTestCase(R"(spec {a} char)")) ) +with expansion: + true + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( spec.matches(*fakeTestCase(R"(spec [a] char)")) ) +with expansion: + true + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( spec.matches(*fakeTestCase("differs but has similar tag", "[a]")) ) +with expansion: + !false + +------------------------------------------------------------------------------- +#1912 -- test spec parser handles escaping + backslash in test name +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( spec.matches(*fakeTestCase(R"(spec \ char)")) ) +with expansion: + true + +------------------------------------------------------------------------------- +#1913 - GENERATE inside a for loop should not keep recreating the generator +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( counter < 7 ) +with expansion: + 3 < 7 + +------------------------------------------------------------------------------- +#1913 - GENERATE inside a for loop should not keep recreating the generator +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( counter < 7 ) +with expansion: + 6 < 7 + +------------------------------------------------------------------------------- +#1913 - GENERATEs can share a line +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( i != j ) +with expansion: + 1 != 3 + +------------------------------------------------------------------------------- +#1913 - GENERATEs can share a line +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( i != j ) +with expansion: + 1 != 4 + +------------------------------------------------------------------------------- +#1913 - GENERATEs can share a line +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( i != j ) +with expansion: + 2 != 3 + +------------------------------------------------------------------------------- +#1913 - GENERATEs can share a line +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( i != j ) +with expansion: + 2 != 4 + +------------------------------------------------------------------------------- +#1938 - GENERATE after a section + A +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with message: + A + +------------------------------------------------------------------------------- +#1938 - GENERATE after a section + B +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 1 + +------------------------------------------------------------------------------- +#1938 - GENERATE after a section + B +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 2 + +------------------------------------------------------------------------------- +#1938 - GENERATE after a section + B +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 3 + +------------------------------------------------------------------------------- +#1938 - Section followed by flat generate + A +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( 1 ) + +------------------------------------------------------------------------------- +#1938 - Section followed by flat generate +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 2 + +------------------------------------------------------------------------------- +#1938 - Section followed by flat generate +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 3 + +------------------------------------------------------------------------------- +#1938 - flat generate +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 1 + +------------------------------------------------------------------------------- +#1938 - flat generate +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 2 + +------------------------------------------------------------------------------- +#1938 - flat generate +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 3 + +------------------------------------------------------------------------------- +#1938 - mixed sections and generates + A +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with message: + A + +------------------------------------------------------------------------------- +#1938 - mixed sections and generates +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with messages: + i := 1 + j := 3 + k := 5 + +------------------------------------------------------------------------------- +#1938 - mixed sections and generates + B +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with message: + B + +------------------------------------------------------------------------------- +#1938 - mixed sections and generates +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with messages: + i := 1 + j := 3 + k := 6 + +------------------------------------------------------------------------------- +#1938 - mixed sections and generates + B +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with message: + B + +------------------------------------------------------------------------------- +#1938 - mixed sections and generates +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with messages: + i := 1 + j := 4 + k := 5 + +------------------------------------------------------------------------------- +#1938 - mixed sections and generates +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with messages: + i := 1 + j := 4 + k := 6 + +------------------------------------------------------------------------------- +#1938 - mixed sections and generates + A +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with message: + A + +------------------------------------------------------------------------------- +#1938 - mixed sections and generates +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with messages: + i := 2 + j := 3 + k := 5 + +------------------------------------------------------------------------------- +#1938 - mixed sections and generates + B +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with message: + B + +------------------------------------------------------------------------------- +#1938 - mixed sections and generates +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with messages: + i := 2 + j := 3 + k := 6 + +------------------------------------------------------------------------------- +#1938 - mixed sections and generates + B +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with message: + B + +------------------------------------------------------------------------------- +#1938 - mixed sections and generates +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with messages: + i := 2 + j := 4 + k := 5 + +------------------------------------------------------------------------------- +#1938 - mixed sections and generates +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with messages: + i := 2 + j := 4 + k := 6 + +------------------------------------------------------------------------------- +#1938 - nested generate +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 1 + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( n ) +with expansion: + 1 + +------------------------------------------------------------------------------- +#1938 - nested generate +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 1 + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( n ) +with expansion: + 2 + +------------------------------------------------------------------------------- +#1938 - nested generate +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 1 + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( n ) +with expansion: + 3 + +------------------------------------------------------------------------------- +#1938 - nested generate +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 2 + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( n ) +with expansion: + 1 + +------------------------------------------------------------------------------- +#1938 - nested generate +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 2 + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( n ) +with expansion: + 2 + +------------------------------------------------------------------------------- +#1938 - nested generate +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 2 + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( n ) +with expansion: + 3 + +------------------------------------------------------------------------------- +#1938 - nested generate +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 3 + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( n ) +with expansion: + 1 + +------------------------------------------------------------------------------- +#1938 - nested generate +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 3 + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( n ) +with expansion: + 2 + +------------------------------------------------------------------------------- +#1938 - nested generate +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 3 + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( n ) +with expansion: + 3 + +------------------------------------------------------------------------------- +#1954 - 7 arg template test case sig compiles - 1, 1, 1, 1, 1, 0, 0 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + +------------------------------------------------------------------------------- +#1954 - 7 arg template test case sig compiles - 5, 1, 1, 1, 1, 0, 0 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + +------------------------------------------------------------------------------- +#1954 - 7 arg template test case sig compiles - 5, 3, 1, 1, 1, 0, 0 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + +------------------------------------------------------------------------------- +#748 - captures with unexpected exceptions + outside assertions +------------------------------------------------------------------------------- +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::Matchers::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 + +------------------------------------------------------------------------------- +3x3x3 ints +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + CHECK( x < y ) +with expansion: + 1 < 4 + +Generators.tests.cpp:<line number>: PASSED: + CHECK( y < z ) +with expansion: + 4 < 7 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( x < z ) +with expansion: + 1 < 7 + +------------------------------------------------------------------------------- +3x3x3 ints +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + CHECK( x < y ) +with expansion: + 1 < 4 + +Generators.tests.cpp:<line number>: PASSED: + CHECK( y < z ) +with expansion: + 4 < 8 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( x < z ) +with expansion: + 1 < 8 + +------------------------------------------------------------------------------- +3x3x3 ints +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + CHECK( x < y ) +with expansion: + 1 < 4 + +Generators.tests.cpp:<line number>: PASSED: + CHECK( y < z ) +with expansion: + 4 < 9 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( x < z ) +with expansion: + 1 < 9 + +------------------------------------------------------------------------------- +3x3x3 ints +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + CHECK( x < y ) +with expansion: + 1 < 5 + +Generators.tests.cpp:<line number>: PASSED: + CHECK( y < z ) +with expansion: + 5 < 7 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( x < z ) +with expansion: + 1 < 7 + +------------------------------------------------------------------------------- +3x3x3 ints +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + CHECK( x < y ) +with expansion: + 1 < 5 + +Generators.tests.cpp:<line number>: PASSED: + CHECK( y < z ) +with expansion: + 5 < 8 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( x < z ) +with expansion: + 1 < 8 + +------------------------------------------------------------------------------- +3x3x3 ints +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + CHECK( x < y ) +with expansion: + 1 < 5 + +Generators.tests.cpp:<line number>: PASSED: + CHECK( y < z ) +with expansion: + 5 < 9 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( x < z ) +with expansion: + 1 < 9 + +------------------------------------------------------------------------------- +3x3x3 ints +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + CHECK( x < y ) +with expansion: + 1 < 6 + +Generators.tests.cpp:<line number>: PASSED: + CHECK( y < z ) +with expansion: + 6 < 7 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( x < z ) +with expansion: + 1 < 7 + +------------------------------------------------------------------------------- +3x3x3 ints +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + CHECK( x < y ) +with expansion: + 1 < 6 + +Generators.tests.cpp:<line number>: PASSED: + CHECK( y < z ) +with expansion: + 6 < 8 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( x < z ) +with expansion: + 1 < 8 + +------------------------------------------------------------------------------- +3x3x3 ints +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + CHECK( x < y ) +with expansion: + 1 < 6 + +Generators.tests.cpp:<line number>: PASSED: + CHECK( y < z ) +with expansion: + 6 < 9 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( x < z ) +with expansion: + 1 < 9 + +------------------------------------------------------------------------------- +3x3x3 ints +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + CHECK( x < y ) +with expansion: + 2 < 4 + +Generators.tests.cpp:<line number>: PASSED: + CHECK( y < z ) +with expansion: + 4 < 7 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( x < z ) +with expansion: + 2 < 7 + +------------------------------------------------------------------------------- +3x3x3 ints +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + CHECK( x < y ) +with expansion: + 2 < 4 + +Generators.tests.cpp:<line number>: PASSED: + CHECK( y < z ) +with expansion: + 4 < 8 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( x < z ) +with expansion: + 2 < 8 + +------------------------------------------------------------------------------- +3x3x3 ints +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + CHECK( x < y ) +with expansion: + 2 < 4 + +Generators.tests.cpp:<line number>: PASSED: + CHECK( y < z ) +with expansion: + 4 < 9 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( x < z ) +with expansion: + 2 < 9 + +------------------------------------------------------------------------------- +3x3x3 ints +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + CHECK( x < y ) +with expansion: + 2 < 5 + +Generators.tests.cpp:<line number>: PASSED: + CHECK( y < z ) +with expansion: + 5 < 7 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( x < z ) +with expansion: + 2 < 7 + +------------------------------------------------------------------------------- +3x3x3 ints +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + CHECK( x < y ) +with expansion: + 2 < 5 + +Generators.tests.cpp:<line number>: PASSED: + CHECK( y < z ) +with expansion: + 5 < 8 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( x < z ) +with expansion: + 2 < 8 + +------------------------------------------------------------------------------- +3x3x3 ints +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + CHECK( x < y ) +with expansion: + 2 < 5 + +Generators.tests.cpp:<line number>: PASSED: + CHECK( y < z ) +with expansion: + 5 < 9 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( x < z ) +with expansion: + 2 < 9 + +------------------------------------------------------------------------------- +3x3x3 ints +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + CHECK( x < y ) +with expansion: + 2 < 6 + +Generators.tests.cpp:<line number>: PASSED: + CHECK( y < z ) +with expansion: + 6 < 7 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( x < z ) +with expansion: + 2 < 7 + +------------------------------------------------------------------------------- +3x3x3 ints +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + CHECK( x < y ) +with expansion: + 2 < 6 + +Generators.tests.cpp:<line number>: PASSED: + CHECK( y < z ) +with expansion: + 6 < 8 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( x < z ) +with expansion: + 2 < 8 + +------------------------------------------------------------------------------- +3x3x3 ints +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + CHECK( x < y ) +with expansion: + 2 < 6 + +Generators.tests.cpp:<line number>: PASSED: + CHECK( y < z ) +with expansion: + 6 < 9 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( x < z ) +with expansion: + 2 < 9 + +------------------------------------------------------------------------------- +3x3x3 ints +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + CHECK( x < y ) +with expansion: + 3 < 4 + +Generators.tests.cpp:<line number>: PASSED: + CHECK( y < z ) +with expansion: + 4 < 7 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( x < z ) +with expansion: + 3 < 7 + +------------------------------------------------------------------------------- +3x3x3 ints +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + CHECK( x < y ) +with expansion: + 3 < 4 + +Generators.tests.cpp:<line number>: PASSED: + CHECK( y < z ) +with expansion: + 4 < 8 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( x < z ) +with expansion: + 3 < 8 + +------------------------------------------------------------------------------- +3x3x3 ints +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + CHECK( x < y ) +with expansion: + 3 < 4 + +Generators.tests.cpp:<line number>: PASSED: + CHECK( y < z ) +with expansion: + 4 < 9 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( x < z ) +with expansion: + 3 < 9 + +------------------------------------------------------------------------------- +3x3x3 ints +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + CHECK( x < y ) +with expansion: + 3 < 5 + +Generators.tests.cpp:<line number>: PASSED: + CHECK( y < z ) +with expansion: + 5 < 7 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( x < z ) +with expansion: + 3 < 7 + +------------------------------------------------------------------------------- +3x3x3 ints +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + CHECK( x < y ) +with expansion: + 3 < 5 + +Generators.tests.cpp:<line number>: PASSED: + CHECK( y < z ) +with expansion: + 5 < 8 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( x < z ) +with expansion: + 3 < 8 + +------------------------------------------------------------------------------- +3x3x3 ints +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + CHECK( x < y ) +with expansion: + 3 < 5 + +Generators.tests.cpp:<line number>: PASSED: + CHECK( y < z ) +with expansion: + 5 < 9 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( x < z ) +with expansion: + 3 < 9 + +------------------------------------------------------------------------------- +3x3x3 ints +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + CHECK( x < y ) +with expansion: + 3 < 6 + +Generators.tests.cpp:<line number>: PASSED: + CHECK( y < z ) +with expansion: + 6 < 7 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( x < z ) +with expansion: + 3 < 7 + +------------------------------------------------------------------------------- +3x3x3 ints +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + CHECK( x < y ) +with expansion: + 3 < 6 + +Generators.tests.cpp:<line number>: PASSED: + CHECK( y < z ) +with expansion: + 6 < 8 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( x < z ) +with expansion: + 3 < 8 + +------------------------------------------------------------------------------- +3x3x3 ints +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + CHECK( x < y ) +with expansion: + 3 < 6 + +Generators.tests.cpp:<line number>: PASSED: + CHECK( y < z ) +with expansion: + 6 < 9 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( x < z ) +with expansion: + 3 < 9 + +------------------------------------------------------------------------------- +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 TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo +<float> +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: FAILED: + REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) +with expansion: + 0 == 1 + +------------------------------------------------------------------------------- +A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo +<int> +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: FAILED: + REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) +with expansion: + 0 == 1 + +------------------------------------------------------------------------------- +A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector +<float> +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: FAILED: + REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) +with expansion: + 0 == 1 + +------------------------------------------------------------------------------- +A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector +<int> +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: FAILED: + REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) +with expansion: + 0 == 1 + +------------------------------------------------------------------------------- +A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - Template_Foo +<float> +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: PASSED: + REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - Template_Foo +<int> +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: PASSED: + REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - std::vector +<float> +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: PASSED: + REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - std::vector +<int> +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: PASSED: + REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - +Template_Foo_2<float, 6> +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: FAILED: + REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) +with expansion: + 6 < 2 + +------------------------------------------------------------------------------- +A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - +Template_Foo_2<int, 2> +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: FAILED: + REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) +with expansion: + 2 < 2 + +------------------------------------------------------------------------------- +A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array +<float, 6> +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: FAILED: + REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) +with expansion: + 6 < 2 + +------------------------------------------------------------------------------- +A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array +<int, 2> +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: FAILED: + REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) +with expansion: + 2 < 2 + +------------------------------------------------------------------------------- +A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - +Template_Foo_2<float,6> +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: PASSED: + REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() >= 2 ) +with expansion: + 6 >= 2 + +------------------------------------------------------------------------------- +A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - +Template_Foo_2<int,2> +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: PASSED: + REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() >= 2 ) +with expansion: + 2 >= 2 + +------------------------------------------------------------------------------- +A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - std:: +array<float,6> +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: PASSED: + REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() >= 2 ) +with expansion: + 6 >= 2 + +------------------------------------------------------------------------------- +A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - std:: +array<int,2> +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: PASSED: + REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() >= 2 ) +with expansion: + 2 >= 2 + +------------------------------------------------------------------------------- +A TEMPLATE_TEST_CASE_METHOD based test run that fails - double +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: FAILED: + REQUIRE( Template_Fixture<TestType>::m_a == 2 ) +with expansion: + 1.0 == 2 + +------------------------------------------------------------------------------- +A TEMPLATE_TEST_CASE_METHOD based test run that fails - float +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: FAILED: + REQUIRE( Template_Fixture<TestType>::m_a == 2 ) +with expansion: + 1.0f == 2 + +------------------------------------------------------------------------------- +A TEMPLATE_TEST_CASE_METHOD based test run that fails - int +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: FAILED: + REQUIRE( Template_Fixture<TestType>::m_a == 2 ) +with expansion: + 1 == 2 + +------------------------------------------------------------------------------- +A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - double +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: PASSED: + REQUIRE( Template_Fixture<TestType>::m_a == 1 ) +with expansion: + 1.0 == 1 + +------------------------------------------------------------------------------- +A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - float +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: PASSED: + REQUIRE( Template_Fixture<TestType>::m_a == 1 ) +with expansion: + 1.0f == 1 + +------------------------------------------------------------------------------- +A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - int +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: PASSED: + REQUIRE( Template_Fixture<TestType>::m_a == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 1 +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: FAILED: + REQUIRE( Nttp_Fixture<V>::value == 0 ) +with expansion: + 1 == 0 + +------------------------------------------------------------------------------- +A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 3 +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: FAILED: + REQUIRE( Nttp_Fixture<V>::value == 0 ) +with expansion: + 3 == 0 + +------------------------------------------------------------------------------- +A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 6 +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: FAILED: + REQUIRE( Nttp_Fixture<V>::value == 0 ) +with expansion: + 6 == 0 + +------------------------------------------------------------------------------- +A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 1 +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: PASSED: + REQUIRE( Nttp_Fixture<V>::value > 0 ) +with expansion: + 1 > 0 + +------------------------------------------------------------------------------- +A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 3 +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: PASSED: + REQUIRE( Nttp_Fixture<V>::value > 0 ) +with expansion: + 3 > 0 + +------------------------------------------------------------------------------- +A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6 +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: PASSED: + REQUIRE( Nttp_Fixture<V>::value > 0 ) +with expansion: + 6 > 0 + +------------------------------------------------------------------------------- +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 Template product test case - Foo<float> +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( x.size() == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +A Template product test case - Foo<int> +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( x.size() == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +A Template product test case - std::vector<float> +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( x.size() == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +A Template product test case - std::vector<int> +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( x.size() == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +A Template product test case with array signature - Bar<float, 42> +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( x.size() > 0 ) +with expansion: + 42 > 0 + +------------------------------------------------------------------------------- +A Template product test case with array signature - Bar<int, 9> +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( x.size() > 0 ) +with expansion: + 9 > 0 + +------------------------------------------------------------------------------- +A Template product test case with array signature - std::array<float, 42> +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( x.size() > 0 ) +with expansion: + 42 > 0 + +------------------------------------------------------------------------------- +A Template product test case with array signature - std::array<int, 9> +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( x.size() > 0 ) +with expansion: + 9 > 0 + +------------------------------------------------------------------------------- +A comparison that uses literals instead of the normal constructor +------------------------------------------------------------------------------- +Approx.tests.cpp:<line number> +............................................................................... + +Approx.tests.cpp:<line number>: PASSED: + REQUIRE( d == 1.23_a ) +with expansion: + 1.23 == Approx( 1.23 ) + +Approx.tests.cpp:<line number>: PASSED: + REQUIRE( d != 1.22_a ) +with expansion: + 1.23 != Approx( 1.22 ) + +Approx.tests.cpp:<line number>: PASSED: + REQUIRE( -d == -1.23_a ) +with expansion: + -1.23 == Approx( -1.23 ) + +Approx.tests.cpp:<line number>: PASSED: + REQUIRE( d == 1.2_a .epsilon(.1) ) +with expansion: + 1.23 == Approx( 1.2 ) + +Approx.tests.cpp:<line number>: PASSED: + REQUIRE( d != 1.2_a .epsilon(.001) ) +with expansion: + 1.23 != Approx( 1.2 ) + +Approx.tests.cpp:<line number>: PASSED: + REQUIRE( d == 1_a .epsilon(.3) ) +with expansion: + 1.23 == Approx( 1.0 ) + +------------------------------------------------------------------------------- +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 ) + +------------------------------------------------------------------------------- +Arbitrary predicate matcher + Function pointer +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1, Predicate<int>(alwaysTrue, "always true") ) +with expansion: + 1 matches predicate: "always true" + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1, !Predicate<int>(alwaysFalse, "always false") ) +with expansion: + 1 not matches predicate: "always false" + +------------------------------------------------------------------------------- +Arbitrary predicate matcher + Lambdas + different type +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( "Hello olleH", Predicate<std::string>( [] (std::string const& str) -> bool { return str.front() == str.back(); }, "First and last character should be equal") ) +with expansion: + "Hello olleH" matches predicate: "First and last character should be equal" + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( "This wouldn't pass", !Predicate<std::string>( [] (std::string const& str) -> bool { return str.front() == str.back(); } ) ) +with expansion: + "This wouldn't pass" not matches undescribed predicate + +------------------------------------------------------------------------------- +Assertion macros support bit operators and bool conversions +------------------------------------------------------------------------------- +Compilation.tests.cpp:<line number> +............................................................................... + +Compilation.tests.cpp:<line number>: PASSED: + REQUIRE( lhs | rhs ) +with expansion: + Val: 1 | Val: 2 + +Compilation.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( lhs & rhs ) +with expansion: + !(Val: 1 & Val: 2) + +Compilation.tests.cpp:<line number>: PASSED: + REQUIRE( HasBitOperators{ 1 } & HasBitOperators{ 1 } ) +with expansion: + Val: 1 & Val: 1 + +Compilation.tests.cpp:<line number>: PASSED: + REQUIRE( lhs ^ rhs ) +with expansion: + Val: 1 ^ Val: 2 + +Compilation.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( lhs ^ lhs ) +with expansion: + !(Val: 1 ^ Val: 1) + +------------------------------------------------------------------------------- +Assertions then sections +------------------------------------------------------------------------------- +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 ) + +------------------------------------------------------------------------------- +Basic use of the Contains range matcher + Different argument ranges, same element type, default comparison +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( a, Contains(1) ) +with expansion: + { 1, 2, 3 } contains element 1 + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( b, Contains(1) ) +with expansion: + { 0, 1, 2 } contains element 1 + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( c, !Contains(1) ) +with expansion: + { 4, 5, 6 } not contains element 1 + +------------------------------------------------------------------------------- +Basic use of the Contains range matcher + Different argument ranges, same element type, custom comparison +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( a, Contains(0, close_enough) ) +with expansion: + { 1, 2, 3 } contains element 0 + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( b, Contains(0, close_enough) ) +with expansion: + { 0, 1, 2 } contains element 0 + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( c, !Contains(0, close_enough) ) +with expansion: + { 4, 5, 6 } not contains element 0 + +------------------------------------------------------------------------------- +Basic use of the Contains range matcher + Different element type, custom comparisons +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( a, Contains(4, [](auto&& lhs, size_t sz) { return lhs.size() == sz; }) ) +with expansion: + { "abc", "abcd", "abcde" } contains element 4 + +------------------------------------------------------------------------------- +Basic use of the Contains range matcher + Can handle type that requires ADL-found free function begin and end +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( in, Contains(1) ) +with expansion: + { 1, 2, 3, 4, 5 } contains element 1 + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( in, !Contains(8) ) +with expansion: + { 1, 2, 3, 4, 5 } not contains element 8 + +------------------------------------------------------------------------------- +Basic use of the Contains range matcher + Initialization with move only types +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( in, Contains(MoveOnlyTestElement{ 2 }) ) +with expansion: + { 1, 2, 3 } contains element 2 + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( in, !Contains(MoveOnlyTestElement{ 9 }) ) +with expansion: + { 1, 2, 3 } not contains element 9 + +------------------------------------------------------------------------------- +Basic use of the Contains range matcher + Matching using matcher +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( in, Contains(Catch::Matchers::WithinAbs(0.5, 0.5)) ) +with expansion: + { 1.0, 2.0, 3.0, 0.0 } contains element matching is within 0.5 of 0.5 + +------------------------------------------------------------------------------- +Basic use of the Empty range matcher + Simple, std-provided containers +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( empty_array, IsEmpty() ) +with expansion: + { } is empty + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( non_empty_array, !IsEmpty() ) +with expansion: + { 0.0 } not is empty + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( empty_vec, IsEmpty() ) +with expansion: + { } is empty + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( non_empty_vec, !IsEmpty() ) +with expansion: + { 'a', 'b', 'c' } not is empty + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( inner_lists_are_empty, !IsEmpty() ) +with expansion: + { { } } not is empty + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( inner_lists_are_empty.front(), IsEmpty() ) +with expansion: + { } is empty + +------------------------------------------------------------------------------- +Basic use of the Empty range matcher + Type with empty +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( has_empty{}, !IsEmpty() ) +with expansion: + {?} not is empty + +------------------------------------------------------------------------------- +Basic use of the Empty range matcher + Type requires ADL found empty free function +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( unrelated::ADL_empty{}, IsEmpty() ) +with expansion: + {?} is empty + +------------------------------------------------------------------------------- +CAPTURE can deal with complex expressions +------------------------------------------------------------------------------- +Message.tests.cpp:<line number> +............................................................................... + +Message.tests.cpp:<line number>: PASSED: +with messages: + a := 1 + b := 2 + c := 3 + a + b := 3 + a+b := 3 + c > b := true + a == 1 := true + +------------------------------------------------------------------------------- +CAPTURE can deal with complex expressions involving commas +------------------------------------------------------------------------------- +Message.tests.cpp:<line number> +............................................................................... + +Message.tests.cpp:<line number>: PASSED: +with messages: + std::vector<int>{1, 2, 3}[0, 1, 2] := 3 + std::vector<int>{1, 2, 3}[(0, 1)] := 2 + std::vector<int>{1, 2, 3}[0] := 1 + (helper_1436<int, int>{12, -12}) := { 12, -12 } + (helper_1436<int, int>(-12, 12)) := { -12, 12 } + (1, 2) := 2 + (2, 3) := 3 + +------------------------------------------------------------------------------- +CAPTURE parses string and character constants +------------------------------------------------------------------------------- +Message.tests.cpp:<line number> +............................................................................... + +Message.tests.cpp:<line number>: PASSED: +with messages: + ("comma, in string", "escaped, \", ") := "escaped, ", " + "single quote in string,'," := "single quote in string,'," + "some escapes, \\,\\\\" := "some escapes, \,\\" + "some, ), unmatched, } prenheses {[<" := "some, ), unmatched, } prenheses {[ + <" + '"' := '"' + '\'' := ''' + ',' := ',' + '}' := '}' + ')' := ')' + '(' := '(' + '{' := '{' + +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +Clara::Arg supports single-arg parse the way Opt does +------------------------------------------------------------------------------- +Clara.tests.cpp:<line number> +............................................................................... + +Clara.tests.cpp:<line number>: PASSED: + CHECK( name.empty() ) +with expansion: + true + +Clara.tests.cpp:<line number>: PASSED: + REQUIRE( name == "foo" ) +with expansion: + "foo" == "foo" + +------------------------------------------------------------------------------- +Combining MatchAllOfGeneric does not nest +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: +with message: + std::is_same< decltype((MatcherA() && MatcherB()) && MatcherC()), Catch:: + Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC> >::value + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1, (MatcherA() && MatcherB()) && MatcherC() ) +with expansion: + 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) + 1 ) + +Matchers.tests.cpp:<line number>: PASSED: +with message: + std::is_same< decltype(MatcherA() && (MatcherB() && MatcherC())), Catch:: + Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC> >::value + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1, MatcherA() && (MatcherB() && MatcherC()) ) +with expansion: + 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) + 1 ) + +Matchers.tests.cpp:<line number>: PASSED: +with message: + std::is_same< decltype((MatcherA() && MatcherB()) && (MatcherC() && MatcherD + ())), Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, + MatcherC, MatcherD> >::value + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1, (MatcherA() && MatcherB()) && (MatcherC() && MatcherD()) ) +with expansion: + 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) + 1 and equals: true ) + +------------------------------------------------------------------------------- +Combining MatchAnyOfGeneric does not nest +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: +with message: + std::is_same< decltype((MatcherA() || MatcherB()) || MatcherC()), Catch:: + Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC> >::value + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1, (MatcherA() || MatcherB()) || MatcherC() ) +with expansion: + 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 + ) + +Matchers.tests.cpp:<line number>: PASSED: +with message: + std::is_same< decltype(MatcherA() || (MatcherB() || MatcherC())), Catch:: + Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC> >::value + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1, MatcherA() || (MatcherB() || MatcherC()) ) +with expansion: + 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 + ) + +Matchers.tests.cpp:<line number>: PASSED: +with message: + std::is_same< decltype((MatcherA() || MatcherB()) || (MatcherC() || MatcherD + ())), Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, + MatcherC, MatcherD> >::value + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1, (MatcherA() || MatcherB()) || (MatcherC() || MatcherD()) ) +with expansion: + 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 + or equals: true ) + +------------------------------------------------------------------------------- +Combining MatchNotOfGeneric does not nest +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: +with message: + std::is_same< decltype(!MatcherA()), Catch::Matchers::Detail:: + MatchNotOfGeneric<MatcherA> >::value + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 0, !MatcherA() ) +with expansion: + 0 not equals: (int) 1 or (float) 1.0f + +Matchers.tests.cpp:<line number>: PASSED: +with message: + std::is_same< decltype(!!MatcherA()), MatcherA const& >::value + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1, !!MatcherA() ) +with expansion: + 1 equals: (int) 1 or (float) 1.0f + +Matchers.tests.cpp:<line number>: PASSED: +with message: + std::is_same< decltype(!!!MatcherA()), Catch::Matchers::Detail:: + MatchNotOfGeneric<MatcherA> >::value + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 0, !!!MatcherA() ) +with expansion: + 0 not equals: (int) 1 or (float) 1.0f + +Matchers.tests.cpp:<line number>: PASSED: +with message: + std::is_same< decltype(!!!!MatcherA()), MatcherA const & >::value + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1, !!!!MatcherA() ) +with expansion: + 1 equals: (int) 1 or (float) 1.0f + +------------------------------------------------------------------------------- +Combining concrete matchers does not use templated matchers +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: +with message: + std::is_same< decltype(StartsWith("foo") || (StartsWith("bar") && EndsWith + ("bar") && !EndsWith("foo"))), Catch::Matchers::Detail::MatchAnyOf<std:: + string> >::value + +------------------------------------------------------------------------------- +Combining only templated matchers +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: +with message: + std::is_same< decltype(MatcherA() || MatcherB()), Catch::Matchers::Detail:: + MatchAnyOfGeneric<MatcherA, MatcherB> >::value + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1, MatcherA() || MatcherB() ) +with expansion: + 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 ) + +Matchers.tests.cpp:<line number>: PASSED: +with message: + std::is_same< decltype(MatcherA() && MatcherB()), Catch::Matchers::Detail:: + MatchAllOfGeneric<MatcherA, MatcherB> >::value + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1, MatcherA() && MatcherB() ) +with expansion: + 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 ) + +Matchers.tests.cpp:<line number>: PASSED: +with message: + std::is_same< decltype(MatcherA() || !MatcherB()), Catch::Matchers::Detail:: + MatchAnyOfGeneric<MatcherA, Catch::Matchers::Detail::MatchNotOfGeneric + <MatcherB>> >::value + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1, MatcherA() || !MatcherB() ) +with expansion: + 1 ( equals: (int) 1 or (float) 1.0f or not equals: (long long) 1 ) + +------------------------------------------------------------------------------- +Combining templated and concrete matchers +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( vec, Predicate<std::vector<int>>([](auto const& v) { return std::all_of(v.begin(), v.end(), [](int elem) { return elem % 2 == 1; }); }, "All elements are odd") && !EqualsRange(a) ) +with expansion: + { 1, 3, 5 } ( matches predicate: "All elements are odd" and not Equals: { 5, + 3, 1 } ) + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( str, StartsWith("foo") && EqualsRange(arr) && EndsWith("bar") ) +with expansion: + "foobar" ( starts with: "foo" and Equals: { 'f', 'o', 'o', 'b', 'a', 'r' } + and ends with: "bar" ) + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( str, StartsWith("foo") && !EqualsRange(bad_arr) && EndsWith("bar") ) +with expansion: + "foobar" ( starts with: "foo" and not Equals: { 'o', 'o', 'f', 'b', 'a', 'r' + } and ends with: "bar" ) + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( str, EqualsRange(arr) && StartsWith("foo") && EndsWith("bar") ) +with expansion: + "foobar" ( Equals: { 'f', 'o', 'o', 'b', 'a', 'r' } and starts with: "foo" + and ends with: "bar" ) + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( str, !EqualsRange(bad_arr) && StartsWith("foo") && EndsWith("bar") ) +with expansion: + "foobar" ( not Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } and starts with: + "foo" and ends with: "bar" ) + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( str, EqualsRange(bad_arr) || (StartsWith("foo") && EndsWith("bar")) ) +with expansion: + "foobar" ( Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } or ( starts with: "foo" + and ends with: "bar" ) ) + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( str, (StartsWith("foo") && EndsWith("bar")) || EqualsRange(bad_arr) ) +with expansion: + "foobar" ( ( starts with: "foo" and ends with: "bar" ) or Equals: { 'o', 'o', + 'f', 'b', 'a', 'r' } ) + +------------------------------------------------------------------------------- +Combining templated matchers +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( container, EqualsRange(a) || EqualsRange(b) || EqualsRange(c) ) +with expansion: + { 1, 2, 3 } ( Equals: { 1, 2, 3 } or Equals: { 0, 1, 2 } or Equals: { 4, 5, 6 + } ) + +------------------------------------------------------------------------------- +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 ops +------------------------------------------------------------------------------- +RandomNumberGeneration.tests.cpp:<line number> +............................................................................... + +RandomNumberGeneration.tests.cpp:<line number>: PASSED: + REQUIRE( SimplePcg32{} == SimplePcg32{} ) +with expansion: + {?} == {?} + +RandomNumberGeneration.tests.cpp:<line number>: PASSED: + REQUIRE( SimplePcg32{ 0 } != SimplePcg32{} ) +with expansion: + {?} != {?} + +RandomNumberGeneration.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( SimplePcg32{ 1 } == SimplePcg32{ 2 } ) +with expansion: + !({?} == {?}) + +RandomNumberGeneration.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( SimplePcg32{ 1 } != SimplePcg32{ 1 } ) +with expansion: + !({?} != {?}) + +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +Composed generic matchers shortcircuit + MatchAllOf +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_FALSE( matcher.match( 1 ) ) +with expansion: + !false + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE( first.matchCalled ) +with expansion: + true + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE( !second.matchCalled ) +with expansion: + true + +------------------------------------------------------------------------------- +Composed generic matchers shortcircuit + MatchAnyOf +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + CHECK( matcher.match(1) ) +with expansion: + true + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE( first.matchCalled ) +with expansion: + true + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE( !second.matchCalled ) +with expansion: + true + +------------------------------------------------------------------------------- +Composed matchers shortcircuit + MatchAllOf +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_FALSE( matcher.match( 1 ) ) +with expansion: + !false + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE( first.matchCalled ) +with expansion: + true + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE( !second.matchCalled ) +with expansion: + true + +------------------------------------------------------------------------------- +Composed matchers shortcircuit + MatchAnyOf +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + CHECK( matcher.match( 1 ) ) +with expansion: + true + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE( first.matchCalled ) +with expansion: + true + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE( !second.matchCalled ) +with expansion: + true + +------------------------------------------------------------------------------- +Contains string matcher +------------------------------------------------------------------------------- +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" + +------------------------------------------------------------------------------- +Copy and then generate a range + from var and iterators +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( elem % 2 == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +Copy and then generate a range + from var and iterators +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( elem % 2 == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +Copy and then generate a range + from var and iterators +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( elem % 2 == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +Copy and then generate a range + from var and iterators +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( elem % 2 == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +Copy and then generate a range + from var and iterators +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( elem % 2 == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +Copy and then generate a range + from var and iterators +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( elem % 2 == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +Copy and then generate a range + From a temporary container +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( elem % 2 == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +Copy and then generate a range + From a temporary container +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( elem % 2 == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +Copy and then generate a range + From a temporary container +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( elem % 2 == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +Copy and then generate a range + From a temporary container +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( elem % 2 == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +Copy and then generate a range + From a temporary container +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( elem % 2 == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +Copy and then generate a range + From a temporary container +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( elem % 2 == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +Copy and then generate a range + Final validation +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( call_count == 1 ) +with expansion: + 1 == 1 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( make_data().size() == test_count ) +with expansion: + 6 == 6 + +------------------------------------------------------------------------------- +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 ) + +------------------------------------------------------------------------------- +Directly creating an EnumInfo +------------------------------------------------------------------------------- +ToString.tests.cpp:<line number> +............................................................................... + +ToString.tests.cpp:<line number>: PASSED: + CHECK( enumInfo->lookup(0) == "Value1" ) +with expansion: + Value1 == "Value1" + +ToString.tests.cpp:<line number>: PASSED: + CHECK( enumInfo->lookup(1) == "Value2" ) +with expansion: + Value2 == "Value2" + +ToString.tests.cpp:<line number>: PASSED: + CHECK( enumInfo->lookup(3) == "{** unexpected enum value **}" ) +with expansion: + {** unexpected enum value **} + == + "{** unexpected enum value **}" + +------------------------------------------------------------------------------- +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) + +------------------------------------------------------------------------------- +Enums can quickly have stringification enabled using REGISTER_ENUM +------------------------------------------------------------------------------- +EnumToString.tests.cpp:<line number> +............................................................................... + +EnumToString.tests.cpp:<line number>: PASSED: + REQUIRE( stringify( EnumClass3::Value1 ) == "Value1" ) +with expansion: + "Value1" == "Value1" + +EnumToString.tests.cpp:<line number>: PASSED: + REQUIRE( stringify( EnumClass3::Value2 ) == "Value2" ) +with expansion: + "Value2" == "Value2" + +EnumToString.tests.cpp:<line number>: PASSED: + REQUIRE( stringify( EnumClass3::Value3 ) == "Value3" ) +with expansion: + "Value3" == "Value3" + +EnumToString.tests.cpp:<line number>: PASSED: + REQUIRE( stringify( EnumClass3::Value4 ) == "{** unexpected enum value **}" ) +with expansion: + "{** unexpected enum value **}" + == + "{** unexpected enum value **}" + +EnumToString.tests.cpp:<line number>: PASSED: + REQUIRE( stringify( ec3 ) == "Value2" ) +with expansion: + "Value2" == "Value2" + +------------------------------------------------------------------------------- +Enums in namespaces can quickly have stringification enabled using +REGISTER_ENUM +------------------------------------------------------------------------------- +EnumToString.tests.cpp:<line number> +............................................................................... + +EnumToString.tests.cpp:<line number>: PASSED: + REQUIRE( stringify( Bikeshed::Colours::Red ) == "Red" ) +with expansion: + "Red" == "Red" + +EnumToString.tests.cpp:<line number>: PASSED: + REQUIRE( stringify( Bikeshed::Colours::Blue ) == "Blue" ) +with expansion: + "Blue" == "Blue" + +------------------------------------------------------------------------------- +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 as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified +------------------------------------------------------------------------------- +ToStringGeneral.tests.cpp:<line number> +............................................................................... + +ToStringGeneral.tests.cpp:<line number>: PASSED: + REQUIRE( ::Catch::Detail::stringify(WhatException{}) == "This exception has overridden what() method" ) +with expansion: + "This exception has overridden what() method" + == + "This exception has overridden what() method" + +ToStringGeneral.tests.cpp:<line number>: PASSED: + REQUIRE( ::Catch::Detail::stringify(OperatorException{}) == "OperatorException" ) +with expansion: + "OperatorException" == "OperatorException" + +ToStringGeneral.tests.cpp:<line number>: PASSED: + REQUIRE( ::Catch::Detail::stringify(StringMakerException{}) == "StringMakerException" ) +with expansion: + "StringMakerException" + == + "StringMakerException" + +------------------------------------------------------------------------------- +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( throwsSpecialException(3), SpecialException, ExceptionMatcher{1} ) +with expansion: + SpecialException::what special exception has value of 1 + +Matchers.tests.cpp:<line number>: FAILED: + REQUIRE_THROWS_MATCHES( throwsSpecialException(4), SpecialException, ExceptionMatcher{1} ) +with expansion: + SpecialException::what special exception has value of 1 + +------------------------------------------------------------------------------- +Exception matchers that succeed +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_THROWS_MATCHES( throwsSpecialException(1), SpecialException, ExceptionMatcher{1} ) +with expansion: + SpecialException::what special exception has value of 1 + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_MATCHES( throwsSpecialException(2), SpecialException, ExceptionMatcher{2} ) +with expansion: + SpecialException::what 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) + +------------------------------------------------------------------------------- +Exceptions matchers +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_MATCHES( throwsDerivedException(), DerivedException, Message("DerivedException::what") ) +with expansion: + DerivedException::what exception message matches "DerivedException::what" + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_MATCHES( throwsDerivedException(), DerivedException, !Message("derivedexception::what") ) +with expansion: + DerivedException::what not exception message matches "derivedexception::what" + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_MATCHES( throwsSpecialException(2), SpecialException, !Message("DerivedException::what") ) +with expansion: + SpecialException::what not exception message matches "DerivedException::what" + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_MATCHES( throwsSpecialException(2), SpecialException, Message("SpecialException::what") ) +with expansion: + SpecialException::what exception message matches "SpecialException::what" + +------------------------------------------------------------------------------- +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 + Relative +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 10., WithinRel(11.1, 0.1) ) +with expansion: + 10.0 and 11.1 are within 10% of each other + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 10., !WithinRel(11.2, 0.1) ) +with expansion: + 10.0 not and 11.2 are within 10% of each other + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1., !WithinRel(0., 0.99) ) +with expansion: + 1.0 not and 0 are within 99% of each other + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( -0., WithinRel(0.) ) +with expansion: + -0.0 and 0 are within 2.22045e-12% of each other + +------------------------------------------------------------------------------- +Floating point matchers: double + Relative + Some subnormal values +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( v1, WithinRel(v2) ) +with expansion: + 0.0 and 2.22507e-308 are within 2.22045e-12% of each other + +------------------------------------------------------------------------------- +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( 11., !WithinAbs(10., 0.5) ) +with expansion: + 11.0 not is within 0.5 of 10.0 + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 10., !WithinAbs(11., 0.5) ) +with expansion: + 10.0 not is within 0.5 of 11.0 + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( -10., WithinAbs(-10., 0.5) ) +with expansion: + -10.0 is within 0.5 of -10.0 + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( -10., WithinAbs(-9.6, 0.5) ) +with expansion: + -10.0 is within 0.5 of -9.6 + +------------------------------------------------------------------------------- +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.0000000000000000e+00 ([1.0000000000000000e+00, 1. + 0000000000000000e+00]) + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( nextafter(1., 2.), WithinULP(1., 1) ) +with expansion: + 1.0 is within 1 ULPs of 1.0000000000000000e+00 ([9.9999999999999989e-01, 1. + 0000000000000002e+00]) + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 0., WithinULP(nextafter(0., 1.), 1) ) +with expansion: + 0.0 is within 1 ULPs of 4.9406564584124654e-324 ([0.0000000000000000e+00, 9. + 8813129168249309e-324]) + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1., WithinULP(nextafter(1., 0.), 1) ) +with expansion: + 1.0 is within 1 ULPs of 9.9999999999999989e-01 ([9.9999999999999978e-01, 1. + 0000000000000000e+00]) + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1., !WithinULP(nextafter(1., 2.), 0) ) +with expansion: + 1.0 not is within 0 ULPs of 1.0000000000000002e+00 ([1.0000000000000002e+00, + 1.0000000000000002e+00]) + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1., WithinULP(1., 0) ) +with expansion: + 1.0 is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1. + 0000000000000000e+00]) + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( -0., WithinULP(0., 0) ) +with expansion: + -0.0 is within 0 ULPs of 0.0000000000000000e+00 ([0.0000000000000000e+00, 0. + 0000000000000000e+00]) + +------------------------------------------------------------------------------- +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.0000000000000000e+00 ([1. + 9999999999999998e+00, 2.0000000000000004e+00]) ) + +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.0000000000000000e+00 ([1. + 0000000000000000e+00, 1.0000000000000000e+00]) ) + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 0.0001, WithinAbs(0., 0.001) || WithinRel(0., 0.1) ) +with expansion: + 0.0001 ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) + +------------------------------------------------------------------------------- +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_NOTHROW( WithinRel(1., 0.) ) + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_AS( WithinRel(1., -0.2), std::domain_error ) + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_AS( WithinRel(1., 1.), std::domain_error ) + +------------------------------------------------------------------------------- +Floating point matchers: float + Relative +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 10.f, WithinRel(11.1f, 0.1f) ) +with expansion: + 10.0f and 11.1 are within 10% of each other + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 10.f, !WithinRel(11.2f, 0.1f) ) +with expansion: + 10.0f not and 11.2 are within 10% of each other + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1.f, !WithinRel(0.f, 0.99f) ) +with expansion: + 1.0f not and 0 are within 99% of each other + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( -0.f, WithinRel(0.f) ) +with expansion: + -0.0f and 0 are within 0.00119209% of each other + +------------------------------------------------------------------------------- +Floating point matchers: float + Relative + Some subnormal values +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( v1, WithinRel(v2) ) +with expansion: + 0.0f and 1.17549e-38 are within 0.00119209% of each other + +------------------------------------------------------------------------------- +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( 11.f, !WithinAbs(10.f, 0.5f) ) +with expansion: + 11.0f not is within 0.5 of 10.0 + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 10.f, !WithinAbs(11.f, 0.5f) ) +with expansion: + 10.0f not is within 0.5 of 11.0 + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( -10.f, WithinAbs(-10.f, 0.5f) ) +with expansion: + -10.0f is within 0.5 of -10.0 + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( -10.f, WithinAbs(-9.6f, 0.5f) ) +with expansion: + -10.0f is within 0.5 of -9.6000003815 + +------------------------------------------------------------------------------- +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.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( nextafter(1.f, 2.f), WithinULP(1.f, 1) ) +with expansion: + 1.0f is within 1 ULPs of 1.00000000e+00f ([9.99999940e-01, 1.00000012e+00]) + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 0.f, WithinULP(nextafter(0.f, 1.f), 1) ) +with expansion: + 0.0f is within 1 ULPs of 1.40129846e-45f ([0.00000000e+00, 2.80259693e-45]) + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1.f, WithinULP(nextafter(1.f, 0.f), 1) ) +with expansion: + 1.0f is within 1 ULPs of 9.99999940e-01f ([9.99999881e-01, 1.00000000e+00]) + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1.f, !WithinULP(nextafter(1.f, 2.f), 0) ) +with expansion: + 1.0f not is within 0 ULPs of 1.00000012e+00f ([1.00000012e+00, 1.00000012e+ + 00]) + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1.f, WithinULP(1.f, 0) ) +with expansion: + 1.0f is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( -0.f, WithinULP(0.f, 0) ) +with expansion: + -0.0f is within 0 ULPs of 0.00000000e+00f ([0.00000000e+00, 0.00000000e+00]) + +------------------------------------------------------------------------------- +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.00000000e+00f ([9. + 99999940e-01, 1.00000012e+00]) ) + +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.00000000e+00f ([1. + 00000000e+00, 1.00000000e+00]) ) + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 0.0001f, WithinAbs(0.f, 0.001f) || WithinRel(0.f, 0.1f) ) +with expansion: + 0.0001f ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) + +------------------------------------------------------------------------------- +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, static_cast<uint64_t>(-1)), std::domain_error ) + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_NOTHROW( WithinRel(1.f, 0.f) ) + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_AS( WithinRel(1.f, -0.2f), std::domain_error ) + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_AS( WithinRel(1.f, 1.f), std::domain_error ) + +------------------------------------------------------------------------------- +Generators -- adapters + Filtering by predicate + Basic usage +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( i % 2 == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +Generators -- adapters + Filtering by predicate + Basic usage +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( i % 2 == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +Generators -- adapters + Filtering by predicate + Basic usage +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( i % 2 == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +Generators -- adapters + Filtering by predicate + Throws if there are no matching values +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_AS( filter([] (int) {return false; }, value(1)), Catch::GeneratorException ) + +------------------------------------------------------------------------------- +Generators -- adapters + Shortening a range +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( i < 4 ) +with expansion: + 1 < 4 + +------------------------------------------------------------------------------- +Generators -- adapters + Shortening a range +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( i < 4 ) +with expansion: + 2 < 4 + +------------------------------------------------------------------------------- +Generators -- adapters + Shortening a range +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( i < 4 ) +with expansion: + 3 < 4 + +------------------------------------------------------------------------------- +Generators -- adapters + Transforming elements + Same type +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( i % 2 == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +Generators -- adapters + Transforming elements + Same type +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( i % 2 == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +Generators -- adapters + Transforming elements + Same type +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( i % 2 == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +Generators -- adapters + Transforming elements + Different type +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( i.size() == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +Generators -- adapters + Transforming elements + Different type +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( i.size() == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +Generators -- adapters + Transforming elements + Different type +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( i.size() == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +Generators -- adapters + Transforming elements + Different deduced type +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( i.size() == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +Generators -- adapters + Transforming elements + Different deduced type +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( i.size() == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +Generators -- adapters + Transforming elements + Different deduced type +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( i.size() == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +Generators -- adapters + Repeating a generator +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( j > 0 ) +with expansion: + 1 > 0 + +------------------------------------------------------------------------------- +Generators -- adapters + Repeating a generator +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( j > 0 ) +with expansion: + 2 > 0 + +------------------------------------------------------------------------------- +Generators -- adapters + Repeating a generator +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( j > 0 ) +with expansion: + 3 > 0 + +------------------------------------------------------------------------------- +Generators -- adapters + Repeating a generator +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( j > 0 ) +with expansion: + 1 > 0 + +------------------------------------------------------------------------------- +Generators -- adapters + Repeating a generator +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( j > 0 ) +with expansion: + 2 > 0 + +------------------------------------------------------------------------------- +Generators -- adapters + Repeating a generator +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( j > 0 ) +with expansion: + 3 > 0 + +------------------------------------------------------------------------------- +Generators -- adapters + Chunking a generator into sized pieces + Number of elements in source is divisible by chunk size +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( chunk2.size() == 2 ) +with expansion: + 2 == 2 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( chunk2.front() == chunk2.back() ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +Generators -- adapters + Chunking a generator into sized pieces + Number of elements in source is divisible by chunk size +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( chunk2.size() == 2 ) +with expansion: + 2 == 2 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( chunk2.front() == chunk2.back() ) +with expansion: + 2 == 2 + +------------------------------------------------------------------------------- +Generators -- adapters + Chunking a generator into sized pieces + Number of elements in source is divisible by chunk size +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( chunk2.size() == 2 ) +with expansion: + 2 == 2 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( chunk2.front() == chunk2.back() ) +with expansion: + 3 == 3 + +------------------------------------------------------------------------------- +Generators -- adapters + Chunking a generator into sized pieces + Number of elements in source is not divisible by chunk size +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( chunk2.size() == 2 ) +with expansion: + 2 == 2 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( chunk2.front() == chunk2.back() ) +with expansion: + 1 == 1 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( chunk2.front() < 3 ) +with expansion: + 1 < 3 + +------------------------------------------------------------------------------- +Generators -- adapters + Chunking a generator into sized pieces + Number of elements in source is not divisible by chunk size +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( chunk2.size() == 2 ) +with expansion: + 2 == 2 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( chunk2.front() == chunk2.back() ) +with expansion: + 2 == 2 + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( chunk2.front() < 3 ) +with expansion: + 2 < 3 + +------------------------------------------------------------------------------- +Generators -- adapters + Chunking a generator into sized pieces + Chunk size of zero +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( chunk2.size() == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +Generators -- adapters + Chunking a generator into sized pieces + Chunk size of zero +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( chunk2.size() == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +Generators -- adapters + Chunking a generator into sized pieces + Chunk size of zero +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( chunk2.size() == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +Generators -- adapters + Chunking a generator into sized pieces + Throws on too small generators +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_AS( chunk(2, value(1)), Catch::GeneratorException ) + +------------------------------------------------------------------------------- +Generators -- simple + one +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( j < i ) +with expansion: + -3 < 1 + +------------------------------------------------------------------------------- +Generators -- simple + one +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( j < i ) +with expansion: + -2 < 1 + +------------------------------------------------------------------------------- +Generators -- simple + one +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( j < i ) +with expansion: + -1 < 1 + +------------------------------------------------------------------------------- +Generators -- simple + two +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( 4u * i > str.size() ) +with expansion: + 4 > 1 + +------------------------------------------------------------------------------- +Generators -- simple + two +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( 4u * i > str.size() ) +with expansion: + 4 > 2 + +------------------------------------------------------------------------------- +Generators -- simple + two +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( 4u * i > str.size() ) +with expansion: + 4 > 3 + +------------------------------------------------------------------------------- +Generators -- simple + one +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( j < i ) +with expansion: + -3 < 2 + +------------------------------------------------------------------------------- +Generators -- simple + one +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( j < i ) +with expansion: + -2 < 2 + +------------------------------------------------------------------------------- +Generators -- simple + one +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( j < i ) +with expansion: + -1 < 2 + +------------------------------------------------------------------------------- +Generators -- simple + two +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( 4u * i > str.size() ) +with expansion: + 8 > 1 + +------------------------------------------------------------------------------- +Generators -- simple + two +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( 4u * i > str.size() ) +with expansion: + 8 > 2 + +------------------------------------------------------------------------------- +Generators -- simple + two +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( 4u * i > str.size() ) +with expansion: + 8 > 3 + +------------------------------------------------------------------------------- +Generators -- simple + one +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( j < i ) +with expansion: + -3 < 3 + +------------------------------------------------------------------------------- +Generators -- simple + one +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( j < i ) +with expansion: + -2 < 3 + +------------------------------------------------------------------------------- +Generators -- simple + one +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( j < i ) +with expansion: + -1 < 3 + +------------------------------------------------------------------------------- +Generators -- simple + two +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( 4u * i > str.size() ) +with expansion: + 12 > 1 + +------------------------------------------------------------------------------- +Generators -- simple + two +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( 4u * i > str.size() ) +with expansion: + 12 > 2 + +------------------------------------------------------------------------------- +Generators -- simple + two +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( 4u * i > str.size() ) +with expansion: + 12 > 3 + +------------------------------------------------------------------------------- +Generators internals + Single value +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 123 ) +with expansion: + 123 == 123 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( gen.next() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Generators internals + Preset values +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 1 ) +with expansion: + 1 == 1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 3 ) +with expansion: + 3 == 3 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 5 ) +with expansion: + 5 == 5 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( gen.next() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Generators internals + Generator combinator +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 1 ) +with expansion: + 1 == 1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 5 ) +with expansion: + 5 == 5 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 2 ) +with expansion: + 2 == 2 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 4 ) +with expansion: + 4 == 4 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 0 ) +with expansion: + 0 == 0 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( gen.next() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Generators internals + Explicitly typed generator sequence +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get().size() == 2 ) +with expansion: + 2 == 2 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == "aa" ) +with expansion: + "aa" == "aa" + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == "bb" ) +with expansion: + "bb" == "bb" + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == "cc" ) +with expansion: + "cc" == "cc" + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( gen.next() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Generators internals + Filter generator +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 1 ) +with expansion: + 1 == 1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 3 ) +with expansion: + 3 == 3 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( gen.next() ) +with expansion: + !false + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_AS( filter([] (int) { return false; }, value(1)), Catch::GeneratorException ) + +------------------------------------------------------------------------------- +Generators internals + Take generator + Take less +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 1 ) +with expansion: + 1 == 1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 2 ) +with expansion: + 2 == 2 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( gen.next() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Generators internals + Take generator + Take more +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 1 ) +with expansion: + 1 == 1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( gen.next() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Generators internals + Map with explicit return type +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 2.0 ) +with expansion: + 2.0 == 2.0 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 4.0 ) +with expansion: + 4.0 == 4.0 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 6.0 ) +with expansion: + 6.0 == 6.0 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( gen.next() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Generators internals + Map with deduced return type +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 2.0 ) +with expansion: + 2.0 == 2.0 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 4.0 ) +with expansion: + 4.0 == 4.0 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 6.0 ) +with expansion: + 6.0 == 6.0 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( gen.next() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Generators internals + Repeat + Singular repeat +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 3 ) +with expansion: + 3 == 3 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( gen.next() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Generators internals + Repeat + Actual repeat +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 1 ) +with expansion: + 1 == 1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 2 ) +with expansion: + 2 == 2 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 3 ) +with expansion: + 3 == 3 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 1 ) +with expansion: + 1 == 1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 2 ) +with expansion: + 2 == 2 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 3 ) +with expansion: + 3 == 3 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( gen.next() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Generators internals + Range + Positive auto step + Integer +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == -2 ) +with expansion: + -2 == -2 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == -1 ) +with expansion: + -1 == -1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 0 ) +with expansion: + 0 == 0 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 1 ) +with expansion: + 1 == 1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( gen.next() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Generators internals + Range + Negative auto step + Integer +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 2 ) +with expansion: + 2 == 2 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 1 ) +with expansion: + 1 == 1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 0 ) +with expansion: + 0 == 0 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == -1 ) +with expansion: + -1 == -1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( gen.next() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Generators internals + Range + Positive manual step + Integer + Exact +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == -7 ) +with expansion: + -7 == -7 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == -4 ) +with expansion: + -4 == -4 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == -1 ) +with expansion: + -1 == -1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 2 ) +with expansion: + 2 == 2 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( gen.next() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Generators internals + Range + Positive manual step + Integer + Slightly over end +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == -7 ) +with expansion: + -7 == -7 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == -4 ) +with expansion: + -4 == -4 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == -1 ) +with expansion: + -1 == -1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 2 ) +with expansion: + 2 == 2 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( gen.next() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Generators internals + Range + Positive manual step + Integer + Slightly under end +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == -7 ) +with expansion: + -7 == -7 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == -4 ) +with expansion: + -4 == -4 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == -1 ) +with expansion: + -1 == -1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 2 ) +with expansion: + 2 == 2 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 5 ) +with expansion: + 5 == 5 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( gen.next() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Generators internals + Range + Positive manual step + Floating Point + Exact +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + -1.0 == Approx( -1.0 ) +with message: + Current expected value is -1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is -1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + -0.9 == Approx( -0.9 ) +with message: + Current expected value is -0.9 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is -0.9 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + -0.8 == Approx( -0.8 ) +with message: + Current expected value is -0.8 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is -0.8 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + -0.7 == Approx( -0.7 ) +with message: + Current expected value is -0.7 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is -0.7 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + -0.6 == Approx( -0.6 ) +with message: + Current expected value is -0.6 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is -0.6 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + -0.5 == Approx( -0.5 ) +with message: + Current expected value is -0.5 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is -0.5 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + -0.4 == Approx( -0.4 ) +with message: + Current expected value is -0.4 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is -0.4 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + -0.3 == Approx( -0.3 ) +with message: + Current expected value is -0.3 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is -0.3 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + -0.2 == Approx( -0.2 ) +with message: + Current expected value is -0.2 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is -0.2 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + -0.1 == Approx( -0.1 ) +with message: + Current expected value is -0.1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is -0.1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + -0.0 == Approx( -0.0 ) +with message: + Current expected value is -1.38778e-16 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is -1.38778e-16 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + 0.1 == Approx( 0.1 ) +with message: + Current expected value is 0.1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is 0.1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + 0.2 == Approx( 0.2 ) +with message: + Current expected value is 0.2 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is 0.2 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + 0.3 == Approx( 0.3 ) +with message: + Current expected value is 0.3 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is 0.3 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + 0.4 == Approx( 0.4 ) +with message: + Current expected value is 0.4 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is 0.4 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + 0.5 == Approx( 0.5 ) +with message: + Current expected value is 0.5 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is 0.5 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + 0.6 == Approx( 0.6 ) +with message: + Current expected value is 0.6 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is 0.6 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + 0.7 == Approx( 0.7 ) +with message: + Current expected value is 0.7 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is 0.7 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + 0.8 == Approx( 0.8 ) +with message: + Current expected value is 0.8 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is 0.8 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + 0.9 == Approx( 0.9 ) +with message: + Current expected value is 0.9 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is 0.9 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx( rangeEnd ) ) +with expansion: + 1.0 == Approx( 1.0 ) + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( gen.next() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Generators internals + Range + Positive manual step + Floating Point + Slightly over end +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + -1.0 == Approx( -1.0 ) +with message: + Current expected value is -1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is -1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + -0.7 == Approx( -0.7 ) +with message: + Current expected value is -0.7 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is -0.7 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + -0.4 == Approx( -0.4 ) +with message: + Current expected value is -0.4 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is -0.4 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + -0.1 == Approx( -0.1 ) +with message: + Current expected value is -0.1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is -0.1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + 0.2 == Approx( 0.2 ) +with message: + Current expected value is 0.2 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is 0.2 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + 0.5 == Approx( 0.5 ) +with message: + Current expected value is 0.5 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is 0.5 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( gen.next() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Generators internals + Range + Positive manual step + Floating Point + Slightly under end +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + -1.0 == Approx( -1.0 ) +with message: + Current expected value is -1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is -1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + -0.7 == Approx( -0.7 ) +with message: + Current expected value is -0.7 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is -0.7 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + -0.4 == Approx( -0.4 ) +with message: + Current expected value is -0.4 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is -0.4 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + -0.1 == Approx( -0.1 ) +with message: + Current expected value is -0.1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is -0.1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + 0.2 == Approx( 0.2 ) +with message: + Current expected value is 0.2 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is 0.2 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == Approx(expected) ) +with expansion: + 0.5 == Approx( 0.5 ) +with message: + Current expected value is 0.5 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true +with message: + Current expected value is 0.5 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( gen.next() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Generators internals + Range + Negative manual step + Integer + Exact +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 5 ) +with expansion: + 5 == 5 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 2 ) +with expansion: + 2 == 2 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == -1 ) +with expansion: + -1 == -1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == -4 ) +with expansion: + -4 == -4 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( gen.next() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Generators internals + Range + Negative manual step + Integer + Slightly over end +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 5 ) +with expansion: + 5 == 5 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 2 ) +with expansion: + 2 == 2 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == -1 ) +with expansion: + -1 == -1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == -4 ) +with expansion: + -4 == -4 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( gen.next() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Generators internals + Range + Negative manual step + Integer + Slightly under end +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 5 ) +with expansion: + 5 == 5 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == 2 ) +with expansion: + 2 == 2 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == -1 ) +with expansion: + -1 == -1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == -4 ) +with expansion: + -4 == -4 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( gen.get() == -7 ) +with expansion: + -7 == -7 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( gen.next() ) +with expansion: + !false + +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +Lambdas in assertions +------------------------------------------------------------------------------- +Compilation.tests.cpp:<line number> +............................................................................... + +Compilation.tests.cpp:<line number>: PASSED: + REQUIRE( []() { return true; }() ) +with expansion: + true + +------------------------------------------------------------------------------- +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" + +------------------------------------------------------------------------------- +Nested generators and captured variables +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( values > -6 ) +with expansion: + 3 > -6 + +------------------------------------------------------------------------------- +Nested generators and captured variables +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( values > -6 ) +with expansion: + 4 > -6 + +------------------------------------------------------------------------------- +Nested generators and captured variables +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( values > -6 ) +with expansion: + 5 > -6 + +------------------------------------------------------------------------------- +Nested generators and captured variables +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( values > -6 ) +with expansion: + 6 > -6 + +------------------------------------------------------------------------------- +Nested generators and captured variables +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( values > -6 ) +with expansion: + -5 > -6 + +------------------------------------------------------------------------------- +Nested generators and captured variables +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( values > -6 ) +with expansion: + -4 > -6 + +------------------------------------------------------------------------------- +Nested generators and captured variables +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( values > -6 ) +with expansion: + 90 > -6 + +------------------------------------------------------------------------------- +Nested generators and captured variables +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( values > -6 ) +with expansion: + 91 > -6 + +------------------------------------------------------------------------------- +Nested generators and captured variables +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( values > -6 ) +with expansion: + 92 > -6 + +------------------------------------------------------------------------------- +Nested generators and captured variables +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( values > -6 ) +with expansion: + 93 > -6 + +------------------------------------------------------------------------------- +Nested generators and captured variables +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( values > -6 ) +with expansion: + 94 > -6 + +------------------------------------------------------------------------------- +Nested generators and captured variables +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( values > -6 ) +with expansion: + 95 > -6 + +------------------------------------------------------------------------------- +Nested generators and captured variables +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( values > -6 ) +with expansion: + 96 > -6 + +------------------------------------------------------------------------------- +Nested generators and captured variables +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( values > -6 ) +with expansion: + 97 > -6 + +------------------------------------------------------------------------------- +Nested generators and captured variables +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( values > -6 ) +with expansion: + 98 > -6 + +------------------------------------------------------------------------------- +Nested generators and captured variables +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( values > -6 ) +with expansion: + 99 > -6 + +------------------------------------------------------------------------------- +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: + !{?} + +------------------------------------------------------------------------------- +Optionally static assertions +------------------------------------------------------------------------------- +Compilation.tests.cpp:<line number> +............................................................................... + +Compilation.tests.cpp:<line number>: PASSED: +with message: + std::is_void<void>::value + +Compilation.tests.cpp:<line number>: PASSED: +with message: + !(std::is_void<int>::value) + +------------------------------------------------------------------------------- +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" + +------------------------------------------------------------------------------- +Our PCG implementation provides expected results for known seeds + Default seeded +------------------------------------------------------------------------------- +RandomNumberGeneration.tests.cpp:<line number> +............................................................................... + +RandomNumberGeneration.tests.cpp:<line number>: PASSED: + REQUIRE( rng() == 0x<hex digits> ) +with expansion: + 4242248763 (0x<hex digits>) + == + 4242248763 (0x<hex digits>) + +RandomNumberGeneration.tests.cpp:<line number>: PASSED: + REQUIRE( rng() == 0x<hex digits> ) +with expansion: + 1867888929 (0x<hex digits>) + == + 1867888929 (0x<hex digits>) + +RandomNumberGeneration.tests.cpp:<line number>: PASSED: + REQUIRE( rng() == 0x<hex digits> ) +with expansion: + 1276619030 (0x<hex digits>) + == + 1276619030 (0x<hex digits>) + +RandomNumberGeneration.tests.cpp:<line number>: PASSED: + REQUIRE( rng() == 0x<hex digits> ) +with expansion: + 1911218783 (0x<hex digits>) + == + 1911218783 (0x<hex digits>) + +RandomNumberGeneration.tests.cpp:<line number>: PASSED: + REQUIRE( rng() == 0x<hex digits> ) +with expansion: + 1827115164 (0x<hex digits>) + == + 1827115164 (0x<hex digits>) + +------------------------------------------------------------------------------- +Our PCG implementation provides expected results for known seeds + Specific seed +------------------------------------------------------------------------------- +RandomNumberGeneration.tests.cpp:<line number> +............................................................................... + +RandomNumberGeneration.tests.cpp:<line number>: PASSED: + REQUIRE( rng() == 0x<hex digits> ) +with expansion: + 1472234645 (0x<hex digits>) + == + 1472234645 (0x<hex digits>) + +RandomNumberGeneration.tests.cpp:<line number>: PASSED: + REQUIRE( rng() == 0x<hex digits> ) +with expansion: + 868832940 (0x<hex digits>) + == + 868832940 (0x<hex digits>) + +RandomNumberGeneration.tests.cpp:<line number>: PASSED: + REQUIRE( rng() == 0x<hex digits> ) +with expansion: + 570883446 (0x<hex digits>) + == + 570883446 (0x<hex digits>) + +RandomNumberGeneration.tests.cpp:<line number>: PASSED: + REQUIRE( rng() == 0x<hex digits> ) +with expansion: + 889299803 (0x<hex digits>) + == + 889299803 (0x<hex digits>) + +RandomNumberGeneration.tests.cpp:<line number>: PASSED: + REQUIRE( rng() == 0x<hex digits> ) +with expansion: + 4261393167 (0x<hex digits>) + == + 4261393167 (0x<hex digits>) + +RandomNumberGeneration.tests.cpp:<line number>: PASSED: + REQUIRE( rng() == 0x<hex digits> ) +with expansion: + 1472234645 (0x<hex digits>) + == + 1472234645 (0x<hex digits>) + +RandomNumberGeneration.tests.cpp:<line number>: PASSED: + REQUIRE( rng() == 0x<hex digits> ) +with expansion: + 868832940 (0x<hex digits>) + == + 868832940 (0x<hex digits>) + +RandomNumberGeneration.tests.cpp:<line number>: PASSED: + REQUIRE( rng() == 0x<hex digits> ) +with expansion: + 570883446 (0x<hex digits>) + == + 570883446 (0x<hex digits>) + +RandomNumberGeneration.tests.cpp:<line number>: PASSED: + REQUIRE( rng() == 0x<hex digits> ) +with expansion: + 889299803 (0x<hex digits>) + == + 889299803 (0x<hex digits>) + +RandomNumberGeneration.tests.cpp:<line number>: PASSED: + REQUIRE( rng() == 0x<hex digits> ) +with expansion: + 4261393167 (0x<hex digits>) + == + 4261393167 (0x<hex digits>) + +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +Overloaded comma or address-of operators are not used +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_AS( (EvilMatcher(), EvilMatcher()), EvilCommaOperatorUsed ) + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS_AS( &EvilMatcher(), EvilAddressOfOperatorUsed ) + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_NOTHROW( EvilMatcher() || (EvilMatcher() && !EvilMatcher()) ) + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_NOTHROW( (EvilMatcher() && EvilMatcher()) || !EvilMatcher() ) + +------------------------------------------------------------------------------- +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 ) == false ) +with expansion: + false == false + +------------------------------------------------------------------------------- +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 ) == 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 + 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 + +------------------------------------------------------------------------------- +Parse test names and tags + Leading and trailing spaces in test spec +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) ) +with expansion: + true + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( spec.matches( *fakeTestCase( " aardvark" ) ) ) +with expansion: + true + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) ) +with expansion: + true + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( spec.matches( *fakeTestCase( "aardvark " ) ) ) +with expansion: + true + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( spec.matches( *fakeTestCase( "aardvark" ) ) ) +with expansion: + true + +------------------------------------------------------------------------------- +Parse test names and tags + Leading and trailing spaces in test name +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) ) +with expansion: + true + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( spec.matches( *fakeTestCase( " aardvark" ) ) ) +with expansion: + true + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) ) +with expansion: + true + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( spec.matches( *fakeTestCase( "aardvark " ) ) ) +with expansion: + true + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( spec.matches( *fakeTestCase( "aardvark" ) ) ) +with expansion: + true + +------------------------------------------------------------------------------- +Parse test names and tags + Shortened hide tags are split apart when parsing +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( spec.matches(*fakeTestCase("hidden and foo", "[.][foo]")) ) +with expansion: + true + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK_FALSE( spec.matches(*fakeTestCase("only foo", "[foo]")) ) +with expansion: + !false + +------------------------------------------------------------------------------- +Parse test names and tags + Shortened hide tags also properly handle exclusion +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK_FALSE( spec.matches(*fakeTestCase("hidden and foo", "[.][foo]")) ) +with expansion: + !false + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK_FALSE( spec.matches(*fakeTestCase("only foo", "[foo]")) ) +with expansion: + !false + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK_FALSE( spec.matches(*fakeTestCase("only hidden", "[.]")) ) +with expansion: + !false + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( spec.matches(*fakeTestCase("neither foo nor hidden", "[bar]")) ) +with expansion: + true + +------------------------------------------------------------------------------- +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> + +------------------------------------------------------------------------------- +Precision of floating point stringification can be set + Floats +------------------------------------------------------------------------------- +ToStringGeneral.tests.cpp:<line number> +............................................................................... + +ToStringGeneral.tests.cpp:<line number>: PASSED: + CHECK( str1.size() == 3 + 5 ) +with expansion: + 8 == 8 + +ToStringGeneral.tests.cpp:<line number>: PASSED: + REQUIRE( str2.size() == 3 + 10 ) +with expansion: + 13 == 13 + +------------------------------------------------------------------------------- +Precision of floating point stringification can be set + Double +------------------------------------------------------------------------------- +ToStringGeneral.tests.cpp:<line number> +............................................................................... + +ToStringGeneral.tests.cpp:<line number>: PASSED: + CHECK( str1.size() == 2 + 5 ) +with expansion: + 7 == 7 + +ToStringGeneral.tests.cpp:<line number>: PASSED: + REQUIRE( str2.size() == 2 + 15 ) +with expansion: + 17 == 17 + +------------------------------------------------------------------------------- +Predicate matcher can accept const char* +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( "foo", Predicate<const char*>([] (const char* const&) { return true; }) ) +with expansion: + "foo" matches undescribed predicate + +------------------------------------------------------------------------------- +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.reporterName == "console" ) +with expansion: + "console" == "console" + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK_FALSE( cfg.hasTestFilters() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Process can be configured on command line + test lists + Specify one test case using +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( result ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( cfg.hasTestFilters() ) +with expansion: + true + +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.hasTestFilters() ) +with expansion: + true + +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.hasTestFilters() ) +with expansion: + true + +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.reporterName == "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.reporterName == "xml" ) +with expansion: + "xml" == "xml" + +------------------------------------------------------------------------------- +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.reporterName == "junit" ) +with expansion: + "junit" == "junit" + +------------------------------------------------------------------------------- +Process can be configured on command line + reporter + Only one reporter is accepted +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( cli.parse({ "test", "-r", "xml", "-r", "junit" }) ) +with expansion: + !{?} + +------------------------------------------------------------------------------- +Process can be configured on command line + reporter + must match one of the available ones +------------------------------------------------------------------------------- +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("Unrecognized reporter") ) +with expansion: + "Unrecognized reporter, 'unsupported'. Check available with --list-reporters" + contains: "Unrecognized reporter" + +------------------------------------------------------------------------------- +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 + abort + wait-for-keypress + Accepted options +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.waitForKeypress == std::get<1>(input) ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +Process can be configured on command line + abort + wait-for-keypress + Accepted options +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.waitForKeypress == std::get<1>(input) ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +Process can be configured on command line + abort + wait-for-keypress + Accepted options +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.waitForKeypress == std::get<1>(input) ) +with expansion: + 2 == 2 + +------------------------------------------------------------------------------- +Process can be configured on command line + abort + wait-for-keypress + Accepted options +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.waitForKeypress == std::get<1>(input) ) +with expansion: + 3 == 3 + +------------------------------------------------------------------------------- +Process can be configured on command line + abort + wait-for-keypress + invalid options are reported +------------------------------------------------------------------------------- +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("never") && Contains("both") ) +with expansion: + "keypress argument must be one of: never, start, exit or both. 'sometimes' + not recognised" ( contains: "never" and contains: "both" ) + +------------------------------------------------------------------------------- +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" + +------------------------------------------------------------------------------- +Process can be configured on command line + Benchmark options + samples +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cli.parse({ "test", "--benchmark-samples=200" }) ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.benchmarkSamples == 200 ) +with expansion: + 200 == 200 + +------------------------------------------------------------------------------- +Process can be configured on command line + Benchmark options + resamples +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cli.parse({ "test", "--benchmark-resamples=20000" }) ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.benchmarkResamples == 20000 ) +with expansion: + 20000 (0x<hex digits>) == 20000 (0x<hex digits>) + +------------------------------------------------------------------------------- +Process can be configured on command line + Benchmark options + confidence-interval +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cli.parse({ "test", "--benchmark-confidence-interval=0.99" }) ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.benchmarkConfidenceInterval == Catch::Approx(0.99) ) +with expansion: + 0.99 == Approx( 0.99 ) + +------------------------------------------------------------------------------- +Process can be configured on command line + Benchmark options + no-analysis +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cli.parse({ "test", "--benchmark-no-analysis" }) ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.benchmarkNoAnalysis ) +with expansion: + true + +------------------------------------------------------------------------------- +Process can be configured on command line + Benchmark options + warmup-time +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + CHECK( cli.parse({ "test", "--benchmark-warmup-time=10" }) ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.benchmarkWarmupTime == 10 ) +with expansion: + 10 == 10 + +------------------------------------------------------------------------------- +Product with differing arities - std::tuple<int, double, float> +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( std::tuple_size<TestType>::value >= 1 ) +with expansion: + 3 >= 1 + +------------------------------------------------------------------------------- +Product with differing arities - std::tuple<int, double> +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( std::tuple_size<TestType>::value >= 1 ) +with expansion: + 2 >= 1 + +------------------------------------------------------------------------------- +Product with differing arities - std::tuple<int> +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( std::tuple_size<TestType>::value >= 1 ) +with expansion: + 1 >= 1 + +------------------------------------------------------------------------------- +Range type with sentinel +------------------------------------------------------------------------------- +ToString.tests.cpp:<line number> +............................................................................... + +ToString.tests.cpp:<line number>: PASSED: + CHECK( Catch::Detail::stringify(UsesSentinel{}) == "{ }" ) +with expansion: + "{ }" == "{ }" + +------------------------------------------------------------------------------- +Reconstruction should be based on stringification: #914 +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +Regression test #1 +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_THAT( actual, !UnorderedEquals(expected) ) +with expansion: + { 'a', 'b' } not UnorderedEquals: { 'c', 'b' } + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( factories.empty() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream + automake reporter lists tags +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, Contains("fakeTag"s) ) +with expansion: + "All available tags: + 1 [fakeTag] + 1 tag + +" contains: "fakeTag" +with message: + Tested reporter: automake + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( factories.empty() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream + automake reporter lists reporters +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, Contains("fake reporter"s) ) +with expansion: + "Available reporters: + fake reporter: fake description + +" contains: "fake reporter" +with message: + Tested reporter: automake + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( factories.empty() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream + automake reporter lists tests +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) ) +with expansion: + "All available test cases: + fake test name + [fakeTestTag] + 1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) +with message: + Tested reporter: automake + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( factories.empty() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream + compact reporter lists tags +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, Contains("fakeTag"s) ) +with expansion: + "All available tags: + 1 [fakeTag] + 1 tag + +" contains: "fakeTag" +with message: + Tested reporter: compact + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( factories.empty() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream + compact reporter lists reporters +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, Contains("fake reporter"s) ) +with expansion: + "Available reporters: + fake reporter: fake description + +" contains: "fake reporter" +with message: + Tested reporter: compact + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( factories.empty() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream + compact reporter lists tests +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) ) +with expansion: + "All available test cases: + fake test name + [fakeTestTag] + 1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) +with message: + Tested reporter: compact + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( factories.empty() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream + console reporter lists tags +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, Contains("fakeTag"s) ) +with expansion: + "All available tags: + 1 [fakeTag] + 1 tag + +" contains: "fakeTag" +with message: + Tested reporter: console + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( factories.empty() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream + console reporter lists reporters +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, Contains("fake reporter"s) ) +with expansion: + "Available reporters: + fake reporter: fake description + +" contains: "fake reporter" +with message: + Tested reporter: console + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( factories.empty() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream + console reporter lists tests +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) ) +with expansion: + "All available test cases: + fake test name + [fakeTestTag] + 1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) +with message: + Tested reporter: console + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( factories.empty() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream + junit reporter lists tags +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, Contains("fakeTag"s) ) +with expansion: + "<?xml version="1.0" encoding="UTF-8"?> + All available tags: + 1 [fakeTag] + 1 tag + +" contains: "fakeTag" +with message: + Tested reporter: junit + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( factories.empty() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream + junit reporter lists reporters +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, Contains("fake reporter"s) ) +with expansion: + "<?xml version="1.0" encoding="UTF-8"?> + Available reporters: + fake reporter: fake description + +" contains: "fake reporter" +with message: + Tested reporter: junit + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( factories.empty() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream + junit reporter lists tests +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) ) +with expansion: + "<?xml version="1.0" encoding="UTF-8"?> + All available test cases: + fake test name + [fakeTestTag] + 1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) +with message: + Tested reporter: junit + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( factories.empty() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream + sonarqube reporter lists tags +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, Contains("fakeTag"s) ) +with expansion: + "<?xml version="1.0" encoding="UTF-8"?> + All available tags: + 1 [fakeTag] + 1 tag + +" contains: "fakeTag" +with message: + Tested reporter: sonarqube + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( factories.empty() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream + sonarqube reporter lists reporters +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, Contains("fake reporter"s) ) +with expansion: + "<?xml version="1.0" encoding="UTF-8"?> + Available reporters: + fake reporter: fake description + +" contains: "fake reporter" +with message: + Tested reporter: sonarqube + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( factories.empty() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream + sonarqube reporter lists tests +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) ) +with expansion: + "<?xml version="1.0" encoding="UTF-8"?> + All available test cases: + fake test name + [fakeTestTag] + 1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) +with message: + Tested reporter: sonarqube + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( factories.empty() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream + tap reporter lists tags +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, Contains("fakeTag"s) ) +with expansion: + "All available tags: + 1 [fakeTag] + 1 tag + +" contains: "fakeTag" +with message: + Tested reporter: tap + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( factories.empty() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream + tap reporter lists reporters +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, Contains("fake reporter"s) ) +with expansion: + "Available reporters: + fake reporter: fake description + +" contains: "fake reporter" +with message: + Tested reporter: tap + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( factories.empty() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream + tap reporter lists tests +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) ) +with expansion: + "All available test cases: + fake test name + [fakeTestTag] + 1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) +with message: + Tested reporter: tap + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( factories.empty() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream + teamcity reporter lists tags +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, Contains("fakeTag"s) ) +with expansion: + "All available tags: + 1 [fakeTag] + 1 tag + +" contains: "fakeTag" +with message: + Tested reporter: teamcity + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( factories.empty() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream + teamcity reporter lists reporters +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, Contains("fake reporter"s) ) +with expansion: + "Available reporters: + fake reporter: fake description + +" contains: "fake reporter" +with message: + Tested reporter: teamcity + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( factories.empty() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream + teamcity reporter lists tests +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) ) +with expansion: + "All available test cases: + fake test name + [fakeTestTag] + 1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) +with message: + Tested reporter: teamcity + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( factories.empty() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream + xml reporter lists tags +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, Contains("fakeTag"s) ) +with expansion: + "<?xml version="1.0" encoding="UTF-8"?> + <TagsFromMatchingTests> + <Tag> + <Count>1</Count> + <Aliases> + <Alias>fakeTag</Alias> + </Aliases> + </Tag> + </TagsFromMatchingTests>" contains: "fakeTag" +with message: + Tested reporter: xml + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( factories.empty() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream + xml reporter lists reporters +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, Contains("fake reporter"s) ) +with expansion: + "<?xml version="1.0" encoding="UTF-8"?> + <AvailableReporters> + <Reporter> + <Name>fake reporter</Name> + <Description>fake description</Description> + </Reporter> + </AvailableReporters>" contains: "fake reporter" +with message: + Tested reporter: xml + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( factories.empty() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Reporter's write listings to provided stream + xml reporter lists tests +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) ) +with expansion: + "<?xml version="1.0" encoding="UTF-8"?> + <MatchingTests> + <TestCase> + <Name>fake test name</Name> + <ClassName/> + <Tags>[fakeTestTag]</Tags> + <SourceInfo> + <File>fake-file.cpp</File> + <Line>123456789</Line> + </SourceInfo> + </TestCase> + </MatchingTests>" ( contains: "fake test name" and contains: "fakeTestTag" ) +with message: + Tested reporter: xml + +------------------------------------------------------------------------------- +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 + And given: And some assumption + 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 + And given: And some assumption + 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( d == 1.23_a ) +with expansion: + 1.23 == Approx( 1.23 ) + +Approx.tests.cpp:<line number>: PASSED: + REQUIRE( d != 1.22_a ) +with expansion: + 1.23 != Approx( 1.22 ) + +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 + +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) + +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( empty.isNullTerminated() ) +with expansion: + true + +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( s.isNullTerminated() ) +with expansion: + true + +String.tests.cpp:<line number>: PASSED: + REQUIRE( std::strcmp( rawChars, "hello" ) == 0 ) +with expansion: + 0 == 0 + +String.tests.cpp:<line number>: PASSED: + REQUIRE_NOTHROW( s.c_str() ) + +String.tests.cpp:<line number>: PASSED: + REQUIRE( s.c_str() == rawChars ) +with expansion: + "hello" == "hello" + +String.tests.cpp:<line number>: PASSED: + REQUIRE( s.data() == rawChars ) +with expansion: + "hello" == "hello" + +------------------------------------------------------------------------------- +StringRef + From sub-string +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... + +String.tests.cpp:<line number>: PASSED: + REQUIRE( original == "original" ) + +String.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( original.isNullTerminated() ) +with expansion: + !false + +String.tests.cpp:<line number>: PASSED: + REQUIRE_THROWS( original.c_str() ) + +String.tests.cpp:<line number>: PASSED: + REQUIRE_NOTHROW( original.data() ) + +------------------------------------------------------------------------------- +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::strncmp( ss.data(), "hello", 5 ) == 0 ) +with expansion: + 0 == 0 + +String.tests.cpp:<line number>: PASSED: + REQUIRE( ss == "hello" ) +with expansion: + hello == "hello" + +------------------------------------------------------------------------------- +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.data() == s2.data() ) +with expansion: + "hello world!" == "hello world!" + +------------------------------------------------------------------------------- +StringRef + Substrings + Pointer values of substring refs should also match +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... + +String.tests.cpp:<line number>: PASSED: + REQUIRE( s.data() == ss.data() ) +with expansion: + "hello world!" == "hello world!" + +------------------------------------------------------------------------------- +StringRef + Substrings + Past the end substring +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... + +String.tests.cpp:<line number>: PASSED: + REQUIRE( s.substr(s.size() + 1, 123).empty() ) +with expansion: + true + +------------------------------------------------------------------------------- +StringRef + Substrings + Substring off the end are trimmed +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... + +String.tests.cpp:<line number>: PASSED: + REQUIRE( std::strcmp(ss.c_str(), "world!") == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +StringRef + Substrings + substring start after the end is empty +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... + +String.tests.cpp:<line number>: PASSED: + REQUIRE( s.substr(1'000'000, 1).empty() ) +with expansion: + true + +------------------------------------------------------------------------------- +StringRef + Comparisons are deep +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... + +String.tests.cpp:<line number>: PASSED: + CHECK( reinterpret_cast<char*>(buffer1) != reinterpret_cast<char*>(buffer2) ) +with expansion: + "Hello" != "Hello" + +String.tests.cpp:<line number>: PASSED: + REQUIRE( left == right ) +with expansion: + Hello == Hello + +String.tests.cpp:<line number>: PASSED: + REQUIRE( left != left.substr(0, 3) ) +with expansion: + Hello != Hel + +------------------------------------------------------------------------------- +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 + 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 + +------------------------------------------------------------------------------- +StringRef + std::string += StringRef +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... + +String.tests.cpp:<line number>: PASSED: + REQUIRE( lhs == "some string += the stringref contents" ) +with expansion: + "some string += the stringref contents" + == + "some string += the stringref contents" + +------------------------------------------------------------------------------- +StringRef + StringRef + StringRef +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... + +String.tests.cpp:<line number>: PASSED: + REQUIRE( together == "abrakadabra" ) +with expansion: + "abrakadabra" == "abrakadabra" + +------------------------------------------------------------------------------- +StringRef at compilation time + Simple constructors +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... + +String.tests.cpp:<line number>: PASSED: +with message: + empty.size() == 0 + +String.tests.cpp:<line number>: PASSED: +with message: + empty.begin() == empty.end() + +String.tests.cpp:<line number>: PASSED: +with message: + stringref.size() == 3 + +String.tests.cpp:<line number>: PASSED: +with message: + stringref.isNullTerminated() + +String.tests.cpp:<line number>: PASSED: +with message: + stringref.data() == abc + +String.tests.cpp:<line number>: PASSED: +with message: + stringref.begin() == abc + +String.tests.cpp:<line number>: PASSED: +with message: + stringref.begin() != stringref.end() + +String.tests.cpp:<line number>: PASSED: +with message: + stringref.substr(10, 0).empty() + +String.tests.cpp:<line number>: PASSED: +with message: + stringref.substr(2, 1).data() == abc + 2 + +String.tests.cpp:<line number>: PASSED: +with message: + stringref[1] == 'b' + +String.tests.cpp:<line number>: PASSED: +with message: + shortened.size() == 2 + +String.tests.cpp:<line number>: PASSED: +with message: + shortened.data() == abc + +String.tests.cpp:<line number>: PASSED: +with message: + shortened.begin() != shortened.end() + +String.tests.cpp:<line number>: PASSED: +with message: + !(shortened.isNullTerminated()) + +String.tests.cpp:<line number>: PASSED: +with message: + !(shortened.substr(1, 3).isNullTerminated()) + +------------------------------------------------------------------------------- +StringRef at compilation time + UDL construction +------------------------------------------------------------------------------- +String.tests.cpp:<line number> +............................................................................... + +String.tests.cpp:<line number>: PASSED: +with message: + !(sr1.empty()) + +String.tests.cpp:<line number>: PASSED: +with message: + sr1.size() == 3 + +String.tests.cpp:<line number>: PASSED: +with message: + sr1.isNullTerminated() + +String.tests.cpp:<line number>: PASSED: +with message: + sr2.empty() + +String.tests.cpp:<line number>: PASSED: +with message: + sr2.size() == 0 + +String.tests.cpp:<line number>: PASSED: +with message: + sr2.isNullTerminated() + +------------------------------------------------------------------------------- +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 +------------------------------------------------------------------------------- +Tag.tests.cpp:<line number> +............................................................................... + +Tag.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]" + +Tag.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" + +Tag.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" + +Tag.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] +------------------------------------------------------------------------------- +Tag.tests.cpp:<line number> +............................................................................... + +Tag.tests.cpp:<line number>: PASSED: + CHECK_THROWS( registry.add( "[no ampersat]", "", Catch::SourceLineInfo( "file", 3 ) ) ) + +Tag.tests.cpp:<line number>: PASSED: + CHECK_THROWS( registry.add( "[the @ is not at the start]", "", Catch::SourceLineInfo( "file", 3 ) ) ) + +Tag.tests.cpp:<line number>: PASSED: + CHECK_THROWS( registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) ) ) + +Tag.tests.cpp:<line number>: PASSED: + CHECK_THROWS( registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) ) ) + +------------------------------------------------------------------------------- +Template test case method with test types specified inside std::tuple - MyTypes +- 0 +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: PASSED: + REQUIRE( Template_Fixture<TestType>::m_a == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +Template test case method with test types specified inside std::tuple - MyTypes +- 1 +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: PASSED: + REQUIRE( Template_Fixture<TestType>::m_a == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +Template test case method with test types specified inside std::tuple - MyTypes +- 2 +------------------------------------------------------------------------------- +Class.tests.cpp:<line number> +............................................................................... + +Class.tests.cpp:<line number>: PASSED: + REQUIRE( Template_Fixture<TestType>::m_a == 1 ) +with expansion: + 1.0 == 1 + +------------------------------------------------------------------------------- +Template test case with test types specified inside non-copyable and non- +movable std::tuple - NonCopyableAndNonMovableTypes - 0 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( sizeof(TestType) > 0 ) +with expansion: + 1 > 0 + +------------------------------------------------------------------------------- +Template test case with test types specified inside non-copyable and non- +movable std::tuple - NonCopyableAndNonMovableTypes - 1 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( sizeof(TestType) > 0 ) +with expansion: + 4 > 0 + +------------------------------------------------------------------------------- +Template test case with test types specified inside non-default-constructible +std::tuple - MyNonDefaultConstructibleTypes - 0 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( sizeof(TestType) > 0 ) +with expansion: + 1 > 0 + +------------------------------------------------------------------------------- +Template test case with test types specified inside non-default-constructible +std::tuple - MyNonDefaultConstructibleTypes - 1 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( sizeof(TestType) > 0 ) +with expansion: + 4 > 0 + +------------------------------------------------------------------------------- +Template test case with test types specified inside std::tuple - MyTypes - 0 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( sizeof(TestType) > 0 ) +with expansion: + 4 > 0 + +------------------------------------------------------------------------------- +Template test case with test types specified inside std::tuple - MyTypes - 1 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( sizeof(TestType) > 0 ) +with expansion: + 1 > 0 + +------------------------------------------------------------------------------- +Template test case with test types specified inside std::tuple - MyTypes - 2 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( sizeof(TestType) > 0 ) +with expansion: + 4 > 0 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - float +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - float + 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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - float +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - float + 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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - float + 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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - float +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - float + 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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - float +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - float + 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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - int +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - int + 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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - int +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - int + 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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - int + 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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - int +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - int + 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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - int +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - int + 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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - std::string +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - std::string + 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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - std::string +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - std::string + 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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - std::string + 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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - std::string +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - std::string + 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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - std::string +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - std::string + 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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - std::tuple<int,float> +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - std::tuple<int,float> + 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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - std::tuple<int,float> +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - std::tuple<int,float> + 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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - std::tuple<int,float> + 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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - std::tuple<int,float> +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - std::tuple<int,float> + 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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - std::tuple<int,float> +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +TemplateTest: vectors can be sized and resized - std::tuple<int,float> + 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 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == V ) +with expansion: + 6 == 6 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= V ) +with expansion: + 6 >= 6 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 + resizing bigger changes size and capacity +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == 2 * V ) +with expansion: + 12 == 12 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 2 * V ) +with expansion: + 12 >= 12 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == V ) +with expansion: + 6 == 6 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= V ) +with expansion: + 6 >= 6 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 + 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() >= V ) +with expansion: + 6 >= 6 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 + 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 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == V ) +with expansion: + 6 == 6 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= V ) +with expansion: + 6 >= 6 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 + reserving bigger changes capacity but not size +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == V ) +with expansion: + 6 == 6 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 2 * V ) +with expansion: + 12 >= 12 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == V ) +with expansion: + 6 == 6 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= V ) +with expansion: + 6 >= 6 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 + reserving smaller does not change size or capacity +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == V ) +with expansion: + 6 == 6 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= V ) +with expansion: + 6 >= 6 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - float,4 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == V ) +with expansion: + 4 == 4 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= V ) +with expansion: + 4 >= 4 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - float,4 + resizing bigger changes size and capacity +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == 2 * V ) +with expansion: + 8 == 8 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 2 * V ) +with expansion: + 8 >= 8 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - float,4 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == V ) +with expansion: + 4 == 4 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= V ) +with expansion: + 4 >= 4 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - float,4 + 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() >= V ) +with expansion: + 4 >= 4 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - float,4 + 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 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - float,4 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == V ) +with expansion: + 4 == 4 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= V ) +with expansion: + 4 >= 4 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - float,4 + reserving bigger changes capacity but not size +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == V ) +with expansion: + 4 == 4 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 2 * V ) +with expansion: + 8 >= 8 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - float,4 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == V ) +with expansion: + 4 == 4 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= V ) +with expansion: + 4 >= 4 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - float,4 + reserving smaller does not change size or capacity +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == V ) +with expansion: + 4 == 4 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= V ) +with expansion: + 4 >= 4 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - int,5 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == V ) +with expansion: + 5 == 5 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= V ) +with expansion: + 5 >= 5 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - int,5 + resizing bigger changes size and capacity +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == 2 * V ) +with expansion: + 10 == 10 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 2 * V ) +with expansion: + 10 >= 10 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - int,5 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == V ) +with expansion: + 5 == 5 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= V ) +with expansion: + 5 >= 5 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - int,5 + 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() >= V ) +with expansion: + 5 >= 5 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - int,5 + 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 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - int,5 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == V ) +with expansion: + 5 == 5 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= V ) +with expansion: + 5 >= 5 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - int,5 + reserving bigger changes capacity but not size +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == V ) +with expansion: + 5 == 5 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 2 * V ) +with expansion: + 10 >= 10 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - int,5 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == V ) +with expansion: + 5 == 5 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= V ) +with expansion: + 5 >= 5 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - int,5 + reserving smaller does not change size or capacity +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == V ) +with expansion: + 5 == 5 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= V ) +with expansion: + 5 >= 5 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - std::string,15 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == V ) +with expansion: + 15 == 15 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= V ) +with expansion: + 15 >= 15 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - std::string,15 + resizing bigger changes size and capacity +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == 2 * V ) +with expansion: + 30 == 30 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 2 * V ) +with expansion: + 30 >= 30 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - std::string,15 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == V ) +with expansion: + 15 == 15 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= V ) +with expansion: + 15 >= 15 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - std::string,15 + 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() >= V ) +with expansion: + 15 >= 15 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - std::string,15 + 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 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - std::string,15 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == V ) +with expansion: + 15 == 15 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= V ) +with expansion: + 15 >= 15 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - std::string,15 + reserving bigger changes capacity but not size +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == V ) +with expansion: + 15 == 15 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= 2 * V ) +with expansion: + 30 >= 30 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - std::string,15 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == V ) +with expansion: + 15 == 15 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= V ) +with expansion: + 15 >= 15 + +------------------------------------------------------------------------------- +TemplateTestSig: vectors can be sized and resized - std::string,15 + reserving smaller does not change size or capacity +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.size() == V ) +with expansion: + 15 == 15 + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( v.capacity() >= V ) +with expansion: + 15 >= 15 + +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +Test with special, characters "in name +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + +------------------------------------------------------------------------------- +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' + +------------------------------------------------------------------------------- +The default listing implementation write to provided stream + Listing tags +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, Contains("[fakeTag]"s) ) +with expansion: + "All available tags: + 1 [fakeTag] + 1 tag + +" contains: "[fakeTag]" + +------------------------------------------------------------------------------- +The default listing implementation write to provided stream + Listing reporters +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, Contains("fake reporter"s) ) +with expansion: + "Available reporters: + fake reporter: fake description + +" contains: "fake reporter" + +------------------------------------------------------------------------------- +The default listing implementation write to provided stream + Listing tests +------------------------------------------------------------------------------- +Reporters.tests.cpp:<line number> +............................................................................... + +Reporters.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) ) +with expansion: + "All available test cases: + fake test name + [fakeTestTag] + 1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) + +------------------------------------------------------------------------------- +This test 'should' fail but doesn't +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: +with message: + oops! + +------------------------------------------------------------------------------- +Thrown string literals are translated +------------------------------------------------------------------------------- +Exception.tests.cpp:<line number> +............................................................................... + +Exception.tests.cpp:<line number>: FAILED: +due to unexpected exception with message: + For some reason someone is throwing a string literal! + +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +Trim strings +------------------------------------------------------------------------------- +StringManip.tests.cpp:<line number> +............................................................................... + +StringManip.tests.cpp:<line number>: PASSED: + REQUIRE( trim(std::string(no_whitespace)) == no_whitespace ) +with expansion: + "There is no extra whitespace here" + == + "There is no extra whitespace here" + +StringManip.tests.cpp:<line number>: PASSED: + REQUIRE( trim(std::string(leading_whitespace)) == no_whitespace ) +with expansion: + "There is no extra whitespace here" + == + "There is no extra whitespace here" + +StringManip.tests.cpp:<line number>: PASSED: + REQUIRE( trim(std::string(trailing_whitespace)) == no_whitespace ) +with expansion: + "There is no extra whitespace here" + == + "There is no extra whitespace here" + +StringManip.tests.cpp:<line number>: PASSED: + REQUIRE( trim(std::string(whitespace_at_both_ends)) == no_whitespace ) +with expansion: + "There is no extra whitespace here" + == + "There is no extra whitespace here" + +StringManip.tests.cpp:<line number>: PASSED: + REQUIRE( trim(StringRef(no_whitespace)) == StringRef(no_whitespace) ) +with expansion: + There is no extra whitespace here + == + There is no extra whitespace here + +StringManip.tests.cpp:<line number>: PASSED: + REQUIRE( trim(StringRef(leading_whitespace)) == StringRef(no_whitespace) ) +with expansion: + There is no extra whitespace here + == + There is no extra whitespace here + +StringManip.tests.cpp:<line number>: PASSED: + REQUIRE( trim(StringRef(trailing_whitespace)) == StringRef(no_whitespace) ) +with expansion: + There is no extra whitespace here + == + There is no extra whitespace here + +StringManip.tests.cpp:<line number>: PASSED: + REQUIRE( trim(StringRef(whitespace_at_both_ends)) == StringRef(no_whitespace) ) +with expansion: + There is no extra whitespace here + == + There is no extra whitespace here + +------------------------------------------------------------------------------- +Unexpected exceptions can be translated +------------------------------------------------------------------------------- +Exception.tests.cpp:<line number> +............................................................................... + +Exception.tests.cpp:<line number>: FAILED: +due to unexpected exception with message: + 3.14 + +------------------------------------------------------------------------------- +Upcasting special member functions + Move constructor +------------------------------------------------------------------------------- +UniquePtr.tests.cpp:<line number> +............................................................................... + +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE( bptr->i == 3 ) +with expansion: + 3 == 3 + +------------------------------------------------------------------------------- +Upcasting special member functions + move assignment +------------------------------------------------------------------------------- +UniquePtr.tests.cpp:<line number> +............................................................................... + +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE( bptr->i == 3 ) +with expansion: + 3 == 3 + +------------------------------------------------------------------------------- +Usage of AllMatch range matcher + Basic usage +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, AllMatch(SizeIs(5)) ) +with expansion: + { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 + }, { 1, 0, 0, -1, 5 } } all match has size == 5 + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !AllMatch(Contains(0) && Contains(1)) ) +with expansion: + { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 + }, { 1, 0, 0, -1, 5 } } not all match ( contains element 0 and contains + element 1 ) + +------------------------------------------------------------------------------- +Usage of AllMatch range matcher + Type requires ADL found begin and end +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( needs_adl, AllMatch( Predicate<int>( []( int elem ) { return elem < 6; } ) ) ) +with expansion: + { 1, 2, 3, 4, 5 } all match matches undescribed predicate + +------------------------------------------------------------------------------- +Usage of AllMatch range matcher + Shortcircuiting + All are read +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( mocked, allMatch ) +with expansion: + { 1, 2, 3, 4, 5 } all match matches undescribed predicate + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.derefed[0] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.derefed[1] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.derefed[2] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.derefed[3] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.derefed[4] ) +with expansion: + true + +------------------------------------------------------------------------------- +Usage of AllMatch range matcher + Shortcircuiting + Short-circuited +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( mocked, !allMatch ) +with expansion: + { 1, 2, 3, 4, 5 } not all match matches undescribed predicate + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.derefed[0] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.derefed[1] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.derefed[2] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.derefed[3] ) +with expansion: + !false + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.derefed[4] ) +with expansion: + !false + +------------------------------------------------------------------------------- +Usage of AnyMatch range matcher + Basic usage +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, AnyMatch(SizeIs(5)) ) +with expansion: + { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 + }, { 1, 0, 0, -1, 5 } } any match has size == 5 + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !AnyMatch(Contains(0) && Contains(10)) ) +with expansion: + { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 + }, { 1, 0, 0, -1, 5 } } not any match ( contains element 0 and contains + element 10 ) + +------------------------------------------------------------------------------- +Usage of AnyMatch range matcher + Type requires ADL found begin and end +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( needs_adl, AnyMatch( Predicate<int>( []( int elem ) { return elem < 3; } ) ) ) +with expansion: + { 1, 2, 3, 4, 5 } any match matches undescribed predicate + +------------------------------------------------------------------------------- +Usage of AnyMatch range matcher + Shortcircuiting + All are read +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( mocked, !anyMatch ) +with expansion: + { 1, 2, 3, 4, 5 } not any match matches undescribed predicate + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.derefed[0] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.derefed[1] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.derefed[2] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.derefed[3] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.derefed[4] ) +with expansion: + true + +------------------------------------------------------------------------------- +Usage of AnyMatch range matcher + Shortcircuiting + Short-circuited +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( mocked, anyMatch ) +with expansion: + { 1, 2, 3, 4, 5 } any match matches undescribed predicate + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.derefed[0] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.derefed[1] ) +with expansion: + !false + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.derefed[2] ) +with expansion: + !false + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.derefed[3] ) +with expansion: + !false + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.derefed[4] ) +with expansion: + !false + +------------------------------------------------------------------------------- +Usage of NoneMatch range matcher + Basic usage +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, NoneMatch(SizeIs(6)) ) +with expansion: + { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 + }, { 1, 0, 0, -1, 5 } } none match has size == 6 + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( data, !NoneMatch(Contains(0) && Contains(1)) ) +with expansion: + { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 + }, { 1, 0, 0, -1, 5 } } not none match ( contains element 0 and contains + element 1 ) + +------------------------------------------------------------------------------- +Usage of NoneMatch range matcher + Type requires ADL found begin and end +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( needs_adl, NoneMatch( Predicate<int>( []( int elem ) { return elem > 6; } ) ) ) +with expansion: + { 1, 2, 3, 4, 5 } none match matches undescribed predicate + +------------------------------------------------------------------------------- +Usage of NoneMatch range matcher + Shortcircuiting + All are read +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( mocked, noneMatch ) +with expansion: + { 1, 2, 3, 4, 5 } none match matches undescribed predicate + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.derefed[0] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.derefed[1] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.derefed[2] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.derefed[3] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.derefed[4] ) +with expansion: + true + +------------------------------------------------------------------------------- +Usage of NoneMatch range matcher + Shortcircuiting + Short-circuited +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( mocked, !noneMatch ) +with expansion: + { 1, 2, 3, 4, 5 } not none match matches undescribed predicate + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE( mocked.derefed[0] ) +with expansion: + true + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.derefed[1] ) +with expansion: + !false + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.derefed[2] ) +with expansion: + !false + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.derefed[3] ) +with expansion: + !false + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( mocked.derefed[4] ) +with expansion: + !false + +------------------------------------------------------------------------------- +Usage of the SizeIs range matcher + Some with stdlib containers +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( empty_vec, SizeIs(0) ) +with expansion: + { } has size == 0 + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( empty_vec, !SizeIs(2) ) +with expansion: + { } not has size == 2 + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( empty_vec, SizeIs(Lt(2)) ) +with expansion: + { } size matches is less than 2 + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( arr, SizeIs(2) ) +with expansion: + { 0, 0 } has size == 2 + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( arr, SizeIs( Lt(3)) ) +with expansion: + { 0, 0 } size matches is less than 3 + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( arr, !SizeIs(!Lt(3)) ) +with expansion: + { 0, 0 } not size matches not is less than 3 + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( map, SizeIs(3) ) +with expansion: + { {?}, {?}, {?} } has size == 3 + +------------------------------------------------------------------------------- +Usage of the SizeIs range matcher + Type requires ADL found size free function +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( unrelated::ADL_size{}, SizeIs(12) ) +with expansion: + {?} has size == 12 + +------------------------------------------------------------------------------- +Usage of the SizeIs range matcher + Type has size member +------------------------------------------------------------------------------- +MatchersRanges.tests.cpp:<line number> +............................................................................... + +MatchersRanges.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( has_size{}, SizeIs(13) ) +with expansion: + {?} has size == 13 + +------------------------------------------------------------------------------- +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 Approx matcher + Empty vector is roughly equal to an empty vector +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( empty, Approx(empty) ) +with expansion: + { } is approx: { } + +------------------------------------------------------------------------------- +Vector Approx matcher + Vectors with elements + A vector is approx equal to itself +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( v1, Approx(v1) ) +with expansion: + { 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 } + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( v1, Approx<double>({ 1., 2., 3. }) ) +with expansion: + { 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 } + +------------------------------------------------------------------------------- +Vector Approx matcher + Vectors with elements + Different length +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( v1, !Approx(temp) ) +with expansion: + { 1.0, 2.0, 3.0 } not is approx: { 1.0, 2.0, 3.0, 4.0 } + +------------------------------------------------------------------------------- +Vector Approx matcher + Vectors with elements + Same length, different elements +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( v1, !Approx(v2) ) +with expansion: + { 1.0, 2.0, 3.0 } not is approx: { 1.5, 2.5, 3.5 } + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( v1, Approx(v2).margin(0.5) ) +with expansion: + { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( v1, Approx(v2).epsilon(0.5) ) +with expansion: + { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( v1, Approx(v2).epsilon(0.1).scale(500) ) +with expansion: + { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } + +------------------------------------------------------------------------------- +Vector Approx matcher -- failing + Empty and non empty vectors are not approx equal +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: FAILED: + CHECK_THAT( empty, Approx(t1) ) +with expansion: + { } is approx: { 1.0, 2.0 } + +------------------------------------------------------------------------------- +Vector Approx matcher -- failing + Just different vectors +------------------------------------------------------------------------------- +Matchers.tests.cpp:<line number> +............................................................................... + +Matchers.tests.cpp:<line number>: FAILED: + CHECK_THAT( v1, Approx(v2) ) +with expansion: + { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 } + +------------------------------------------------------------------------------- +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 + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_THAT( v5, (VectorContains<int, CustomAllocator<int>>(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<int>({ 1, 2 }) ) +with expansion: + { 1, 2, 3 } Contains: { 1, 2 } + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_THAT( v5, (Contains<int, std::allocator<int>, CustomAllocator<int>>(v2)) ) +with expansion: + { 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: { } + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_THAT( v5, (Contains<int, std::allocator<int>, CustomAllocator<int>>(v2)) ) +with expansion: + { 1, 2, 3 } Contains: { 1, 2, 3 } + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_THAT( v5, Contains(v6) ) +with expansion: + { 1, 2, 3 } Contains: { 1, 2 } + +------------------------------------------------------------------------------- +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<int>({ 1, 2, 3 }) ) +with expansion: + { 1, 2, 3 } Equals: { 1, 2, 3 } + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_THAT( v, Equals(v2) ) +with expansion: + { 1, 2, 3 } Equals: { 1, 2, 3 } + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_THAT( v5, (Equals<int, std::allocator<int>, CustomAllocator<int>>(v2)) ) +with expansion: + { 1, 2, 3 } Equals: { 1, 2, 3 } + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_THAT( v5, Equals(v6) ) +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( v, UnorderedEquals<int>({ 3, 2, 1 }) ) +with expansion: + { 1, 2, 3 } UnorderedEquals: { 3, 2, 1 } + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_THAT( empty, UnorderedEquals(empty) ) +with expansion: + { } 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 } + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_THAT( v5, (UnorderedEquals<int, std::allocator<int>, CustomAllocator<int>>(permuted)) ) +with expansion: + { 1, 2, 3 } UnorderedEquals: { 2, 3, 1 } + +Matchers.tests.cpp:<line number>: PASSED: + CHECK_THAT( v5_permuted, UnorderedEquals(v5) ) +with expansion: + { 1, 3, 2 } 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]" + +------------------------------------------------------------------------------- +analyse no analysis +------------------------------------------------------------------------------- +InternalBenchmark.tests.cpp:<line number> +............................................................................... + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( analysis.mean.point.count() == 23 ) +with expansion: + 23.0 == 23 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( analysis.mean.lower_bound.count() == 23 ) +with expansion: + 23.0 == 23 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( analysis.mean.upper_bound.count() == 23 ) +with expansion: + 23.0 == 23 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( analysis.standard_deviation.point.count() == 0 ) +with expansion: + 0.0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( analysis.standard_deviation.lower_bound.count() == 0 ) +with expansion: + 0.0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( analysis.standard_deviation.upper_bound.count() == 0 ) +with expansion: + 0.0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( analysis.outliers.total() == 0 ) +with expansion: + 0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( analysis.outliers.low_mild == 0 ) +with expansion: + 0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( analysis.outliers.low_severe == 0 ) +with expansion: + 0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( analysis.outliers.high_mild == 0 ) +with expansion: + 0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( analysis.outliers.high_severe == 0 ) +with expansion: + 0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( analysis.outliers.samples_seen == 0 ) +with expansion: + 0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( analysis.outlier_variance == 0 ) +with expansion: + 0.0 == 0 + +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +benchmark function call + without chronometer +------------------------------------------------------------------------------- +InternalBenchmark.tests.cpp:<line number> +............................................................................... + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( model.started == 1 ) +with expansion: + 1 == 1 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( model.finished == 0 ) +with expansion: + 0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( model.started == 1 ) +with expansion: + 1 == 1 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( model.finished == 1 ) +with expansion: + 1 == 1 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( called == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +benchmark function call + with chronometer +------------------------------------------------------------------------------- +InternalBenchmark.tests.cpp:<line number> +............................................................................... + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( model.started == 0 ) +with expansion: + 0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( model.finished == 0 ) +with expansion: + 0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( model.started == 0 ) +with expansion: + 0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( model.finished == 0 ) +with expansion: + 0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( called == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +classify_outliers + none +------------------------------------------------------------------------------- +InternalBenchmark.tests.cpp:<line number> +............................................................................... + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.samples_seen == static_cast<int>(x.size()) ) +with expansion: + 6 == 6 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.low_severe == los ) +with expansion: + 0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.low_mild == lom ) +with expansion: + 0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.high_mild == him ) +with expansion: + 0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.high_severe == his ) +with expansion: + 0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.total() == los + lom + him + his ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +classify_outliers + low severe +------------------------------------------------------------------------------- +InternalBenchmark.tests.cpp:<line number> +............................................................................... + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.samples_seen == static_cast<int>(x.size()) ) +with expansion: + 6 == 6 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.low_severe == los ) +with expansion: + 1 == 1 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.low_mild == lom ) +with expansion: + 0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.high_mild == him ) +with expansion: + 0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.high_severe == his ) +with expansion: + 0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.total() == los + lom + him + his ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +classify_outliers + low mild +------------------------------------------------------------------------------- +InternalBenchmark.tests.cpp:<line number> +............................................................................... + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.samples_seen == static_cast<int>(x.size()) ) +with expansion: + 6 == 6 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.low_severe == los ) +with expansion: + 0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.low_mild == lom ) +with expansion: + 1 == 1 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.high_mild == him ) +with expansion: + 0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.high_severe == his ) +with expansion: + 0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.total() == los + lom + him + his ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +classify_outliers + high mild +------------------------------------------------------------------------------- +InternalBenchmark.tests.cpp:<line number> +............................................................................... + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.samples_seen == static_cast<int>(x.size()) ) +with expansion: + 6 == 6 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.low_severe == los ) +with expansion: + 0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.low_mild == lom ) +with expansion: + 0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.high_mild == him ) +with expansion: + 1 == 1 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.high_severe == his ) +with expansion: + 0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.total() == los + lom + him + his ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +classify_outliers + high severe +------------------------------------------------------------------------------- +InternalBenchmark.tests.cpp:<line number> +............................................................................... + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.samples_seen == static_cast<int>(x.size()) ) +with expansion: + 6 == 6 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.low_severe == los ) +with expansion: + 0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.low_mild == lom ) +with expansion: + 0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.high_mild == him ) +with expansion: + 0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.high_severe == his ) +with expansion: + 1 == 1 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.total() == los + lom + him + his ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +classify_outliers + mixed +------------------------------------------------------------------------------- +InternalBenchmark.tests.cpp:<line number> +............................................................................... + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.samples_seen == static_cast<int>(x.size()) ) +with expansion: + 6 == 6 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.low_severe == los ) +with expansion: + 1 == 1 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.low_mild == lom ) +with expansion: + 0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.high_mild == him ) +with expansion: + 1 == 1 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.high_severe == his ) +with expansion: + 0 == 0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( o.total() == los + lom + him + his ) +with expansion: + 2 == 2 + +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +erfc_inv +------------------------------------------------------------------------------- +InternalBenchmark.tests.cpp:<line number> +............................................................................... + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( erfc_inv(1.103560) == Approx(-0.09203687623843015) ) +with expansion: + -0.0920368762 == Approx( -0.0920368762 ) + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( erfc_inv(1.067400) == Approx(-0.05980291115763361) ) +with expansion: + -0.0598029112 == Approx( -0.0598029112 ) + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( erfc_inv(0.050000) == Approx(1.38590382434967796) ) +with expansion: + 1.3859038243 == Approx( 1.3859038243 ) + +------------------------------------------------------------------------------- +estimate_clock_resolution +------------------------------------------------------------------------------- +InternalBenchmark.tests.cpp:<line number> +............................................................................... + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( res.mean.count() == rate ) +with expansion: + 2000.0 == 2000 (0x<hex digits>) + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( res.outliers.total() == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +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 failure after unscoped info +------------------------------------------------------------------------------- +Message.tests.cpp:<line number> +............................................................................... + +Message.tests.cpp:<line number>: FAILED: +explicitly with message: + previous unscoped info SHOULD not be seen + +------------------------------------------------------------------------------- +just info +------------------------------------------------------------------------------- +Message.tests.cpp:<line number> +............................................................................... + + +No assertions in test case 'just info' + +------------------------------------------------------------------------------- +just unscoped info +------------------------------------------------------------------------------- +Message.tests.cpp:<line number> +............................................................................... + + +No assertions in test case 'just unscoped 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 + b is currently: 0 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: FAILED: + CHECK( b > a ) +with expansion: + 0 > 1 + +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 1 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: FAILED: + CHECK( b > a ) +with expansion: + 1 > 1 + +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 2 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + CHECK( b > a ) +with expansion: + 2 > 1 + +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 3 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + CHECK( b > a ) +with expansion: + 3 > 1 + +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 4 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + CHECK( b > a ) +with expansion: + 4 > 1 + +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 5 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + CHECK( b > a ) +with expansion: + 5 > 1 + +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 6 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + CHECK( b > a ) +with expansion: + 6 > 1 + +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 7 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + CHECK( b > a ) +with expansion: + 7 > 1 + +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 8 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + CHECK( b > a ) +with expansion: + 8 > 1 + +------------------------------------------------------------------------------- +looped SECTION tests + b is currently: 9 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + CHECK( b > a ) +with expansion: + 9 > 1 + +------------------------------------------------------------------------------- +looped tests +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +make_unique reimplementation + From lvalue copies +------------------------------------------------------------------------------- +UniquePtr.tests.cpp:<line number> +............................................................................... + +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( lval.has_moved ) +with expansion: + !false + +------------------------------------------------------------------------------- +make_unique reimplementation + From rvalue moves +------------------------------------------------------------------------------- +UniquePtr.tests.cpp:<line number> +............................................................................... + +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE( rval.has_moved ) +with expansion: + true + +------------------------------------------------------------------------------- +make_unique reimplementation + Variadic constructor +------------------------------------------------------------------------------- +UniquePtr.tests.cpp:<line number> +............................................................................... + +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE( *ptr == std::tuple<int, double, int>{1, 2., 3} ) +with expansion: + {?} == {?} + +------------------------------------------------------------------------------- +mean +------------------------------------------------------------------------------- +InternalBenchmark.tests.cpp:<line number> +............................................................................... + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( m == 19. ) +with expansion: + 19.0 == 19.0 + +------------------------------------------------------------------------------- +measure +------------------------------------------------------------------------------- +InternalBenchmark.tests.cpp:<line number> +............................................................................... + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( x == 17 ) +with expansion: + 17 == 17 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( x == 23 ) +with expansion: + 23 == 23 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( r.elapsed.count() == 42 ) +with expansion: + 42 == 42 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( r.result == 23 ) +with expansion: + 23 == 23 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( r.iterations == 1 ) +with expansion: + 1 == 1 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( s.elapsed.count() == 69 ) +with expansion: + 69 == 69 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( s.result == 17 ) +with expansion: + 17 == 17 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( s.iterations == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +mix info, unscoped info and warning +------------------------------------------------------------------------------- +Message.tests.cpp:<line number> +............................................................................... + +Message.tests.cpp:<line number>: warning: + info + unscoped info + and warn may mix + +Message.tests.cpp:<line number>: warning: + info + unscoped info + they are not cleared after warnings + + +No assertions in test case 'mix info, unscoped info and warning' + +------------------------------------------------------------------------------- +more nested SECTION tests + doesn't equal + equal +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: FAILED: + REQUIRE( a == b ) +with expansion: + 1 == 2 + +------------------------------------------------------------------------------- +more nested SECTION tests + doesn't equal + not equal +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( a != b ) +with expansion: + 1 != 2 + +------------------------------------------------------------------------------- +more nested SECTION tests + doesn't equal + less than +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( a < b ) +with expansion: + 1 < 2 + +------------------------------------------------------------------------------- +nested SECTION tests + doesn't equal +------------------------------------------------------------------------------- +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 + doesn't equal + not equal +------------------------------------------------------------------------------- +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: + {?} == {?} + +------------------------------------------------------------------------------- +normal_cdf +------------------------------------------------------------------------------- +InternalBenchmark.tests.cpp:<line number> +............................................................................... + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( normal_cdf(0.000000) == Approx(0.50000000000000000) ) +with expansion: + 0.5 == Approx( 0.5 ) + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( normal_cdf(1.000000) == Approx(0.84134474606854293) ) +with expansion: + 0.8413447461 == Approx( 0.8413447461 ) + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( normal_cdf(-1.000000) == Approx(0.15865525393145705) ) +with expansion: + 0.1586552539 == Approx( 0.1586552539 ) + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( normal_cdf(2.809729) == Approx(0.99752083845315409) ) +with expansion: + 0.9975208385 == Approx( 0.9975208385 ) + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( normal_cdf(-1.352570) == Approx(0.08809652095066035) ) +with expansion: + 0.088096521 == Approx( 0.088096521 ) + +------------------------------------------------------------------------------- +normal_quantile +------------------------------------------------------------------------------- +InternalBenchmark.tests.cpp:<line number> +............................................................................... + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( normal_quantile(0.551780) == Approx(0.13015979861484198) ) +with expansion: + 0.1301597986 == Approx( 0.1301597986 ) + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( normal_quantile(0.533700) == Approx(0.08457408802851875) ) +with expansion: + 0.084574088 == Approx( 0.084574088 ) + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( normal_quantile(0.025000) == Approx(-1.95996398454005449) ) +with expansion: + -1.9599639845 == Approx( -1.9599639845 ) + +------------------------------------------------------------------------------- +not allowed +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + +------------------------------------------------------------------------------- +not prints unscoped info from previous failures +------------------------------------------------------------------------------- +Message.tests.cpp:<line number> +............................................................................... + +Message.tests.cpp:<line number>: PASSED: + REQUIRE( true ) +with message: + this MAY be seen only for the FIRST assertion IF info is printed for passing + assertions + +Message.tests.cpp:<line number>: PASSED: + REQUIRE( true ) +with message: + this MAY be seen only for the SECOND assertion IF info is printed for passing + assertions + +Message.tests.cpp:<line number>: FAILED: + REQUIRE( false ) +with message: + this SHOULD be seen + +------------------------------------------------------------------------------- +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 } }" + +------------------------------------------------------------------------------- +parseEnums + No enums +------------------------------------------------------------------------------- +ToString.tests.cpp:<line number> +............................................................................... + +ToString.tests.cpp:<line number>: PASSED: + CHECK_THAT( parseEnums( "" ), Equals( std::vector<Catch::StringRef>{} ) ) +with expansion: + { } Equals: { } + +------------------------------------------------------------------------------- +parseEnums + One enum value +------------------------------------------------------------------------------- +ToString.tests.cpp:<line number> +............................................................................... + +ToString.tests.cpp:<line number>: PASSED: + CHECK_THAT( parseEnums( "ClassName::EnumName::Value1" ), Equals(std::vector<Catch::StringRef>{"Value1"} ) ) +with expansion: + { Value1 } Equals: { Value1 } + +ToString.tests.cpp:<line number>: PASSED: + CHECK_THAT( parseEnums( "Value1" ), Equals( std::vector<Catch::StringRef>{"Value1"} ) ) +with expansion: + { Value1 } Equals: { Value1 } + +ToString.tests.cpp:<line number>: PASSED: + CHECK_THAT( parseEnums( "EnumName::Value1" ), Equals(std::vector<Catch::StringRef>{"Value1"} ) ) +with expansion: + { Value1 } Equals: { Value1 } + +------------------------------------------------------------------------------- +parseEnums + Multiple enum values +------------------------------------------------------------------------------- +ToString.tests.cpp:<line number> +............................................................................... + +ToString.tests.cpp:<line number>: PASSED: + CHECK_THAT( parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2"} ) ) +with expansion: + { Value1, Value2 } Equals: { Value1, Value2 } + +ToString.tests.cpp:<line number>: PASSED: + CHECK_THAT( parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2, ClassName::EnumName::Value3" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2", "Value3"} ) ) +with expansion: + { Value1, Value2, Value3 } Equals: { Value1, Value2, Value3 } + +ToString.tests.cpp:<line number>: PASSED: + CHECK_THAT( parseEnums( "ClassName::EnumName::Value1,ClassName::EnumName::Value2 , ClassName::EnumName::Value3" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2", "Value3"} ) ) +with expansion: + { Value1, Value2, Value3 } Equals: { Value1, Value2, Value3 } + +------------------------------------------------------------------------------- +pointer to class +------------------------------------------------------------------------------- +Tricky.tests.cpp:<line number> +............................................................................... + +Tricky.tests.cpp:<line number>: PASSED: + REQUIRE( p == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +print unscoped info if passing unscoped info is printed +------------------------------------------------------------------------------- +Message.tests.cpp:<line number> +............................................................................... + +Message.tests.cpp:<line number>: PASSED: + REQUIRE( true ) +with message: + this MAY be seen IF info is printed for passing assertions + +------------------------------------------------------------------------------- +prints unscoped info on failure +------------------------------------------------------------------------------- +Message.tests.cpp:<line number> +............................................................................... + +Message.tests.cpp:<line number>: FAILED: + REQUIRE( false ) +with messages: + this SHOULD be seen + this SHOULD also be seen + +------------------------------------------------------------------------------- +prints unscoped info only for the first assertion +------------------------------------------------------------------------------- +Message.tests.cpp:<line number> +............................................................................... + +Message.tests.cpp:<line number>: FAILED: + CHECK( false ) +with message: + this SHOULD be seen only ONCE + +Message.tests.cpp:<line number>: PASSED: + CHECK( true ) + +Message.tests.cpp:<line number>: PASSED: + CHECK( true ) +with message: + this MAY also be seen only ONCE IF info is printed for passing assertions + +Message.tests.cpp:<line number>: PASSED: + CHECK( true ) + +------------------------------------------------------------------------------- +random SECTION tests + doesn't equal +------------------------------------------------------------------------------- +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 + not equal +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + REQUIRE( a != b ) +with expansion: + 1 != 2 + +------------------------------------------------------------------------------- +replaceInPlace + replace single char +------------------------------------------------------------------------------- +StringManip.tests.cpp:<line number> +............................................................................... + +StringManip.tests.cpp:<line number>: PASSED: + CHECK( Catch::replaceInPlace(letters, "b", "z") ) +with expansion: + true + +StringManip.tests.cpp:<line number>: PASSED: + CHECK( letters == "azcdefcg" ) +with expansion: + "azcdefcg" == "azcdefcg" + +------------------------------------------------------------------------------- +replaceInPlace + replace two chars +------------------------------------------------------------------------------- +StringManip.tests.cpp:<line number> +............................................................................... + +StringManip.tests.cpp:<line number>: PASSED: + CHECK( Catch::replaceInPlace(letters, "c", "z") ) +with expansion: + true + +StringManip.tests.cpp:<line number>: PASSED: + CHECK( letters == "abzdefzg" ) +with expansion: + "abzdefzg" == "abzdefzg" + +------------------------------------------------------------------------------- +replaceInPlace + replace first char +------------------------------------------------------------------------------- +StringManip.tests.cpp:<line number> +............................................................................... + +StringManip.tests.cpp:<line number>: PASSED: + CHECK( Catch::replaceInPlace(letters, "a", "z") ) +with expansion: + true + +StringManip.tests.cpp:<line number>: PASSED: + CHECK( letters == "zbcdefcg" ) +with expansion: + "zbcdefcg" == "zbcdefcg" + +------------------------------------------------------------------------------- +replaceInPlace + replace last char +------------------------------------------------------------------------------- +StringManip.tests.cpp:<line number> +............................................................................... + +StringManip.tests.cpp:<line number>: PASSED: + CHECK( Catch::replaceInPlace(letters, "g", "z") ) +with expansion: + true + +StringManip.tests.cpp:<line number>: PASSED: + CHECK( letters == "abcdefcz" ) +with expansion: + "abcdefcz" == "abcdefcz" + +------------------------------------------------------------------------------- +replaceInPlace + replace all chars +------------------------------------------------------------------------------- +StringManip.tests.cpp:<line number> +............................................................................... + +StringManip.tests.cpp:<line number>: PASSED: + CHECK( Catch::replaceInPlace(letters, letters, "replaced") ) +with expansion: + true + +StringManip.tests.cpp:<line number>: PASSED: + CHECK( letters == "replaced" ) +with expansion: + "replaced" == "replaced" + +------------------------------------------------------------------------------- +replaceInPlace + replace no chars +------------------------------------------------------------------------------- +StringManip.tests.cpp:<line number> +............................................................................... + +StringManip.tests.cpp:<line number>: PASSED: + CHECK_FALSE( Catch::replaceInPlace(letters, "x", "z") ) +with expansion: + !false + +StringManip.tests.cpp:<line number>: PASSED: + CHECK( letters == letters ) +with expansion: + "abcdefcg" == "abcdefcg" + +------------------------------------------------------------------------------- +replaceInPlace + escape ' +------------------------------------------------------------------------------- +StringManip.tests.cpp:<line number> +............................................................................... + +StringManip.tests.cpp:<line number>: PASSED: + CHECK( Catch::replaceInPlace(s, "'", "|'") ) +with expansion: + true + +StringManip.tests.cpp:<line number>: PASSED: + CHECK( s == "didn|'t" ) +with expansion: + "didn|'t" == "didn|'t" + +------------------------------------------------------------------------------- +resolution +------------------------------------------------------------------------------- +InternalBenchmark.tests.cpp:<line number> +............................................................................... + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( res.size() == count ) +with expansion: + 10 == 10 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( res[i] == rate ) +with expansion: + 1000.0 == 1000 (0x<hex digits>) + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( res[i] == rate ) +with expansion: + 1000.0 == 1000 (0x<hex digits>) + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( res[i] == rate ) +with expansion: + 1000.0 == 1000 (0x<hex digits>) + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( res[i] == rate ) +with expansion: + 1000.0 == 1000 (0x<hex digits>) + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( res[i] == rate ) +with expansion: + 1000.0 == 1000 (0x<hex digits>) + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( res[i] == rate ) +with expansion: + 1000.0 == 1000 (0x<hex digits>) + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( res[i] == rate ) +with expansion: + 1000.0 == 1000 (0x<hex digits>) + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( res[i] == rate ) +with expansion: + 1000.0 == 1000 (0x<hex digits>) + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( res[i] == rate ) +with expansion: + 1000.0 == 1000 (0x<hex digits>) + +------------------------------------------------------------------------------- +run_for_at_least, chronometer +------------------------------------------------------------------------------- +InternalBenchmark.tests.cpp:<line number> +............................................................................... + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( meter.runs() >= old_runs ) +with expansion: + 1 >= 1 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( meter.runs() >= old_runs ) +with expansion: + 2 >= 1 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( meter.runs() >= old_runs ) +with expansion: + 4 >= 2 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( meter.runs() >= old_runs ) +with expansion: + 8 >= 4 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( meter.runs() >= old_runs ) +with expansion: + 16 >= 8 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( meter.runs() >= old_runs ) +with expansion: + 32 >= 16 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( meter.runs() >= old_runs ) +with expansion: + 64 >= 32 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( meter.runs() >= old_runs ) +with expansion: + 128 >= 64 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( Timing.elapsed >= time ) +with expansion: + 128 ns >= 100 ns + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( Timing.result == Timing.iterations + 17 ) +with expansion: + 145 == 145 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( Timing.iterations >= time.count() ) +with expansion: + 128 >= 100 + +------------------------------------------------------------------------------- +run_for_at_least, int +------------------------------------------------------------------------------- +InternalBenchmark.tests.cpp:<line number> +............................................................................... + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( x >= old_x ) +with expansion: + 1 >= 1 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( x >= old_x ) +with expansion: + 2 >= 1 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( x >= old_x ) +with expansion: + 4 >= 2 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( x >= old_x ) +with expansion: + 8 >= 4 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( x >= old_x ) +with expansion: + 16 >= 8 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( x >= old_x ) +with expansion: + 32 >= 16 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( x >= old_x ) +with expansion: + 64 >= 32 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( x >= old_x ) +with expansion: + 128 >= 64 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( Timing.elapsed >= time ) +with expansion: + 128 ns >= 100 ns + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( Timing.result == Timing.iterations + 17 ) +with expansion: + 145 == 145 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( Timing.iterations >= time.count() ) +with expansion: + 128 >= 100 + +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +shortened hide tags are split apart +------------------------------------------------------------------------------- +Tag.tests.cpp:<line number> +............................................................................... + +Tag.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( tags, VectorContains("magic-tag"_catch_sr) && VectorContains("."_catch_sr) ) +with expansion: + { ., magic-tag } ( Contains: magic-tag and Contains: . ) + +------------------------------------------------------------------------------- +splitString +------------------------------------------------------------------------------- +StringManip.tests.cpp:<line number> +............................................................................... + +StringManip.tests.cpp:<line number>: PASSED: + CHECK_THAT( splitStringRef("", ','), Equals(std::vector<StringRef>()) ) +with expansion: + { } Equals: { } + +StringManip.tests.cpp:<line number>: PASSED: + CHECK_THAT( splitStringRef("abc", ','), Equals(std::vector<StringRef>{"abc"}) ) +with expansion: + { abc } Equals: { abc } + +StringManip.tests.cpp:<line number>: PASSED: + CHECK_THAT( splitStringRef("abc,def", ','), Equals(std::vector<StringRef>{"abc", "def"}) ) +with expansion: + { abc, def } Equals: { abc, def } + +------------------------------------------------------------------------------- +stacks unscoped info in loops +------------------------------------------------------------------------------- +Message.tests.cpp:<line number> +............................................................................... + +Message.tests.cpp:<line number>: FAILED: + CHECK( false ) +with messages: + Count 1 to 3... + 1 + 2 + 3 + +Message.tests.cpp:<line number>: FAILED: + CHECK( false ) +with messages: + Count 4 to 6... + 4 + 5 + 6 + +------------------------------------------------------------------------------- +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 ranges +------------------------------------------------------------------------------- +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: + "{?}" == "{?}" + +------------------------------------------------------------------------------- +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_operator ) +------------------------------------------------------------------------------- +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_neither ) +------------------------------------------------------------------------------- +ToStringWhich.tests.cpp:<line number> +............................................................................... + +ToStringWhich.tests.cpp:<line number>: PASSED: + REQUIRE( ::Catch::Detail::stringify(item) == "{?}" ) +with expansion: + "{?}" == "{?}" + +------------------------------------------------------------------------------- +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 )" + +------------------------------------------------------------------------------- +stringify( has_template_operator ) +------------------------------------------------------------------------------- +ToStringWhich.tests.cpp:<line number> +............................................................................... + +ToStringWhich.tests.cpp:<line number>: PASSED: + REQUIRE( ::Catch::Detail::stringify( item ) == "operator<<( has_template_operator )" ) +with expansion: + "operator<<( has_template_operator )" + == + "operator<<( has_template_operator )" + +------------------------------------------------------------------------------- +stringify( 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> }" + +------------------------------------------------------------------------------- +stringify( 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> }" + +------------------------------------------------------------------------------- +stringify( 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 ) }" + +------------------------------------------------------------------------------- +strlen3 +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( data.str.size() == data.len ) +with expansion: + 3 == 3 + +------------------------------------------------------------------------------- +strlen3 +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( data.str.size() == data.len ) +with expansion: + 3 == 3 + +------------------------------------------------------------------------------- +strlen3 +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( data.str.size() == data.len ) +with expansion: + 5 == 5 + +------------------------------------------------------------------------------- +strlen3 +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( data.str.size() == data.len ) +with expansion: + 4 == 4 + +------------------------------------------------------------------------------- +tables +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) ) +with expansion: + 5 == 5 + +------------------------------------------------------------------------------- +tables +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) ) +with expansion: + 6 == 6 + +------------------------------------------------------------------------------- +tables +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) ) +with expansion: + 5 == 5 + +------------------------------------------------------------------------------- +tables +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) ) +with expansion: + 6 == 6 + +------------------------------------------------------------------------------- +thrown std::strings are translated +------------------------------------------------------------------------------- +Exception.tests.cpp:<line number> +............................................................................... + +Exception.tests.cpp:<line number>: FAILED: +due to unexpected exception with message: + Why would you throw a std::string? + +------------------------------------------------------------------------------- +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(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 }" + +------------------------------------------------------------------------------- +uniform samples +------------------------------------------------------------------------------- +InternalBenchmark.tests.cpp:<line number> +............................................................................... + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( e.point == 23 ) +with expansion: + 23.0 == 23 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( e.upper_bound == 23 ) +with expansion: + 23.0 == 23 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( e.lower_bound == 23 ) +with expansion: + 23.0 == 23 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + CHECK( e.confidence_interval == 0.95 ) +with expansion: + 0.95 == 0.95 + +------------------------------------------------------------------------------- +unique_ptr reimplementation: basic functionality + Default constructed unique_ptr is empty +------------------------------------------------------------------------------- +UniquePtr.tests.cpp:<line number> +............................................................................... + +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( ptr ) +with expansion: + !{?} + +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE( ptr.get() == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +unique_ptr reimplementation: basic functionality + Take ownership of allocation +------------------------------------------------------------------------------- +UniquePtr.tests.cpp:<line number> +............................................................................... + +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE( ptr ) +with expansion: + {?} + +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE( *ptr == 0 ) +with expansion: + 0 == 0 + +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE( ptr.get() == naked_ptr ) +with expansion: + 0x<hex digits> == 0x<hex digits> + +------------------------------------------------------------------------------- +unique_ptr reimplementation: basic functionality + Take ownership of allocation + Plain reset deallocates +------------------------------------------------------------------------------- +UniquePtr.tests.cpp:<line number> +............................................................................... + +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( ptr ) +with expansion: + !{?} + +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE( ptr.get() == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +unique_ptr reimplementation: basic functionality + Take ownership of allocation +------------------------------------------------------------------------------- +UniquePtr.tests.cpp:<line number> +............................................................................... + +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE( ptr ) +with expansion: + {?} + +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE( *ptr == 0 ) +with expansion: + 0 == 0 + +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE( ptr.get() == naked_ptr ) +with expansion: + 0x<hex digits> == 0x<hex digits> + +------------------------------------------------------------------------------- +unique_ptr reimplementation: basic functionality + Take ownership of allocation + Reset replaces ownership +------------------------------------------------------------------------------- +UniquePtr.tests.cpp:<line number> +............................................................................... + +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE( ptr ) +with expansion: + {?} + +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE( ptr.get() != 0 ) +with expansion: + 0x<hex digits> != 0 + +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE( *ptr == 2 ) +with expansion: + 2 == 2 + +------------------------------------------------------------------------------- +unique_ptr reimplementation: basic functionality + Release releases ownership +------------------------------------------------------------------------------- +UniquePtr.tests.cpp:<line number> +............................................................................... + +UniquePtr.tests.cpp:<line number>: PASSED: + CHECK_FALSE( ptr ) +with expansion: + !{?} + +UniquePtr.tests.cpp:<line number>: PASSED: + CHECK( ptr.get() == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +unique_ptr reimplementation: basic functionality + Move constructor +------------------------------------------------------------------------------- +UniquePtr.tests.cpp:<line number> +............................................................................... + +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( ptr1 ) +with expansion: + !{?} + +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE( ptr2 ) +with expansion: + {?} + +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE( *ptr2 == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +unique_ptr reimplementation: basic functionality + Move assignment +------------------------------------------------------------------------------- +UniquePtr.tests.cpp:<line number> +............................................................................... + +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( ptr2 ) +with expansion: + !{?} + +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE( ptr1 ) +with expansion: + {?} + +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE( *ptr1 == 2 ) +with expansion: + 2 == 2 + +------------------------------------------------------------------------------- +unique_ptr reimplementation: basic functionality + free swap +------------------------------------------------------------------------------- +UniquePtr.tests.cpp:<line number> +............................................................................... + +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE( *ptr1 == 2 ) +with expansion: + 2 == 2 + +UniquePtr.tests.cpp:<line number>: PASSED: + REQUIRE( *ptr2 == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +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 + +------------------------------------------------------------------------------- +warmup +------------------------------------------------------------------------------- +InternalBenchmark.tests.cpp:<line number> +............................................................................... + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( (iterations * rate) > Catch::Benchmark::Detail::warmup_time.count() ) +with expansion: + 160000000 (0x<hex digits>) > 100 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( (end - start) > Catch::Benchmark::Detail::warmup_time ) +with expansion: + 310016000 ns > 100 ms + +------------------------------------------------------------------------------- +weighted_average_quantile +------------------------------------------------------------------------------- +InternalBenchmark.tests.cpp:<line number> +............................................................................... + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( q1 == 14.5 ) +with expansion: + 14.5 == 14.5 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( med == 18. ) +with expansion: + 18.0 == 18.0 + +InternalBenchmark.tests.cpp:<line number>: PASSED: + REQUIRE( q3 == 23. ) +with expansion: + 23.0 == 23.0 + +------------------------------------------------------------------------------- +xmlentitycheck + embedded xml: <test>it should be possible to embed xml characters, such as <, + " or &, or even whole <xml>documents</xml> within an attribute + </test> +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + +------------------------------------------------------------------------------- +xmlentitycheck + encoded chars: these should all be encoded: &&&"""<<<&"<<&" +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + +=============================================================================== +test cases: 356 | 266 passed | 86 failed | 4 failed as expected +assertions: 2105 | 1936 passed | 148 failed | 21 failed as expected + diff --git a/packages/Catch2/tests/SelfTest/Baselines/console.swa4.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/console.swa4.approved.txt new file mode 100644 index 0000000000000000000000000000000000000000..ee504415a897eb84252b9621733d341d64ac32e3 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/Baselines/console.swa4.approved.txt @@ -0,0 +1,929 @@ +Filters: ~[!nonportable]~[!benchmark]~[approvals] * + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +<exe-name> is a <version> host application. +Run with -? for options + +Randomness seeded to: 1 + +------------------------------------------------------------------------------- +# 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: Bitfields can be captured +------------------------------------------------------------------------------- +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: + {?} >= {?} + +------------------------------------------------------------------------------- +#1175 - Hidden Test +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + +------------------------------------------------------------------------------- +#1238 +------------------------------------------------------------------------------- +Compilation.tests.cpp:<line number> +............................................................................... + +Compilation.tests.cpp:<line number>: PASSED: + REQUIRE( std::memcmp(uarr, "123", sizeof(uarr)) == 0 ) +with expansion: + 0 == 0 +with messages: + uarr := "123" + sarr := "456" + +Compilation.tests.cpp:<line number>: PASSED: + REQUIRE( std::memcmp(sarr, "456", sizeof(sarr)) == 0 ) +with expansion: + 0 == 0 +with messages: + uarr := "123" + sarr := "456" + +------------------------------------------------------------------------------- +#1245 +------------------------------------------------------------------------------- +Compilation.tests.cpp:<line number> +............................................................................... + +Compilation.tests.cpp:<line number>: PASSED: + +------------------------------------------------------------------------------- +#1319: Sections can have description (even if it is not saved + SectionName +------------------------------------------------------------------------------- +Compilation.tests.cpp:<line number> +............................................................................... + +Compilation.tests.cpp:<line number>: PASSED: + +------------------------------------------------------------------------------- +#1403 +------------------------------------------------------------------------------- +Compilation.tests.cpp:<line number> +............................................................................... + +Compilation.tests.cpp:<line number>: PASSED: + REQUIRE( h1 == h2 ) +with expansion: + [1403 helper] == [1403 helper] + +------------------------------------------------------------------------------- +#1455 - INFO and WARN can start with a linebreak +------------------------------------------------------------------------------- +Message.tests.cpp:<line number> +............................................................................... + +Message.tests.cpp:<line number>: warning: + +This info message starts with a linebreak + +This warning message starts with a linebreak + + +No assertions in test case '#1455 - INFO and WARN can start with a linebreak' + +This would not be caught previously +Nor would this +------------------------------------------------------------------------------- +#1514: stderr/stdout is not captured in tests aborted by an exception +------------------------------------------------------------------------------- +Tricky.tests.cpp:<line number> +............................................................................... + +Tricky.tests.cpp:<line number>: FAILED: +explicitly with message: + 1514 + +------------------------------------------------------------------------------- +#1548 +------------------------------------------------------------------------------- +Compilation.tests.cpp:<line number> +............................................................................... + +Compilation.tests.cpp:<line number>: PASSED: + REQUIRE( std::is_same<TypeList<int>, TypeList<int>>::value ) +with expansion: + true + +------------------------------------------------------------------------------- +#1905 -- test spec parser properly clears internal state between compound tests +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( spec.matches(*fakeTestCase("spec . char")) ) +with expansion: + true + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( spec.matches(*fakeTestCase("spec , char")) ) +with expansion: + true + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( spec.matches(*fakeTestCase(R"(spec \, char)")) ) +with expansion: + !false + +------------------------------------------------------------------------------- +#1912 -- test spec parser handles escaping + Various parentheses +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( spec.matches(*fakeTestCase(R"(spec {a} char)")) ) +with expansion: + true + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( spec.matches(*fakeTestCase(R"(spec [a] char)")) ) +with expansion: + true + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( spec.matches(*fakeTestCase("differs but has similar tag", "[a]")) ) +with expansion: + !false + +------------------------------------------------------------------------------- +#1912 -- test spec parser handles escaping + backslash in test name +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( spec.matches(*fakeTestCase(R"(spec \ char)")) ) +with expansion: + true + +------------------------------------------------------------------------------- +#1913 - GENERATE inside a for loop should not keep recreating the generator +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( counter < 7 ) +with expansion: + 3 < 7 + +------------------------------------------------------------------------------- +#1913 - GENERATE inside a for loop should not keep recreating the generator +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( counter < 7 ) +with expansion: + 6 < 7 + +------------------------------------------------------------------------------- +#1913 - GENERATEs can share a line +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( i != j ) +with expansion: + 1 != 3 + +------------------------------------------------------------------------------- +#1913 - GENERATEs can share a line +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( i != j ) +with expansion: + 1 != 4 + +------------------------------------------------------------------------------- +#1913 - GENERATEs can share a line +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( i != j ) +with expansion: + 2 != 3 + +------------------------------------------------------------------------------- +#1913 - GENERATEs can share a line +------------------------------------------------------------------------------- +Generators.tests.cpp:<line number> +............................................................................... + +Generators.tests.cpp:<line number>: PASSED: + REQUIRE( i != j ) +with expansion: + 2 != 4 + +------------------------------------------------------------------------------- +#1938 - GENERATE after a section + A +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with message: + A + +------------------------------------------------------------------------------- +#1938 - GENERATE after a section + B +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 1 + +------------------------------------------------------------------------------- +#1938 - GENERATE after a section + B +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 2 + +------------------------------------------------------------------------------- +#1938 - GENERATE after a section + B +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 3 + +------------------------------------------------------------------------------- +#1938 - Section followed by flat generate + A +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( 1 ) + +------------------------------------------------------------------------------- +#1938 - Section followed by flat generate +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 2 + +------------------------------------------------------------------------------- +#1938 - Section followed by flat generate +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 3 + +------------------------------------------------------------------------------- +#1938 - flat generate +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 1 + +------------------------------------------------------------------------------- +#1938 - flat generate +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 2 + +------------------------------------------------------------------------------- +#1938 - flat generate +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 3 + +------------------------------------------------------------------------------- +#1938 - mixed sections and generates + A +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with message: + A + +------------------------------------------------------------------------------- +#1938 - mixed sections and generates +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with messages: + i := 1 + j := 3 + k := 5 + +------------------------------------------------------------------------------- +#1938 - mixed sections and generates + B +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with message: + B + +------------------------------------------------------------------------------- +#1938 - mixed sections and generates +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with messages: + i := 1 + j := 3 + k := 6 + +------------------------------------------------------------------------------- +#1938 - mixed sections and generates + B +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with message: + B + +------------------------------------------------------------------------------- +#1938 - mixed sections and generates +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with messages: + i := 1 + j := 4 + k := 5 + +------------------------------------------------------------------------------- +#1938 - mixed sections and generates +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with messages: + i := 1 + j := 4 + k := 6 + +------------------------------------------------------------------------------- +#1938 - mixed sections and generates + A +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with message: + A + +------------------------------------------------------------------------------- +#1938 - mixed sections and generates +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with messages: + i := 2 + j := 3 + k := 5 + +------------------------------------------------------------------------------- +#1938 - mixed sections and generates + B +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with message: + B + +------------------------------------------------------------------------------- +#1938 - mixed sections and generates +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with messages: + i := 2 + j := 3 + k := 6 + +------------------------------------------------------------------------------- +#1938 - mixed sections and generates + B +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with message: + B + +------------------------------------------------------------------------------- +#1938 - mixed sections and generates +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with messages: + i := 2 + j := 4 + k := 5 + +------------------------------------------------------------------------------- +#1938 - mixed sections and generates +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: +with messages: + i := 2 + j := 4 + k := 6 + +------------------------------------------------------------------------------- +#1938 - nested generate +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 1 + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( n ) +with expansion: + 1 + +------------------------------------------------------------------------------- +#1938 - nested generate +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 1 + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( n ) +with expansion: + 2 + +------------------------------------------------------------------------------- +#1938 - nested generate +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 1 + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( n ) +with expansion: + 3 + +------------------------------------------------------------------------------- +#1938 - nested generate +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 2 + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( n ) +with expansion: + 1 + +------------------------------------------------------------------------------- +#1938 - nested generate +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 2 + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( n ) +with expansion: + 2 + +------------------------------------------------------------------------------- +#1938 - nested generate +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 2 + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( n ) +with expansion: + 3 + +------------------------------------------------------------------------------- +#1938 - nested generate +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 3 + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( n ) +with expansion: + 1 + +------------------------------------------------------------------------------- +#1938 - nested generate +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 3 + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( n ) +with expansion: + 2 + +------------------------------------------------------------------------------- +#1938 - nested generate +------------------------------------------------------------------------------- +PartTracker.tests.cpp:<line number> +............................................................................... + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( m ) +with expansion: + 3 + +PartTracker.tests.cpp:<line number>: PASSED: + REQUIRE( n ) +with expansion: + 3 + +------------------------------------------------------------------------------- +#1954 - 7 arg template test case sig compiles - 1, 1, 1, 1, 1, 0, 0 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + +------------------------------------------------------------------------------- +#1954 - 7 arg template test case sig compiles - 5, 1, 1, 1, 1, 0, 0 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + +------------------------------------------------------------------------------- +#1954 - 7 arg template test case sig compiles - 5, 3, 1, 1, 1, 0, 0 +------------------------------------------------------------------------------- +Misc.tests.cpp:<line number> +............................................................................... + +Misc.tests.cpp:<line number>: PASSED: + +------------------------------------------------------------------------------- +#748 - captures with unexpected exceptions + outside assertions +------------------------------------------------------------------------------- +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::Matchers::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 ) + +=============================================================================== +test cases: 31 | 26 passed | 3 failed | 2 failed as expected +assertions: 99 | 92 passed | 4 failed | 3 failed as expected + diff --git a/packages/Catch2/tests/SelfTest/Baselines/junit.sw.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/junit.sw.approved.txt new file mode 100644 index 0000000000000000000000000000000000000000..5206ed2d18e12081a39a7ddc24e037407d48bcdd --- /dev/null +++ b/packages/Catch2/tests/SelfTest/Baselines/junit.sw.approved.txt @@ -0,0 +1,1838 @@ +<?xml version="1.0" encoding="UTF-8"?> +<testsuitesloose text artifact +> + <testsuite name="<exe-name>" errors="17" failures="132" tests="2106" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> + <properties> + <property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/> + <property name="random-seed" value="1"/> + </properties> + <testcase classname="<exe-name>.global" name="# A test name that starts with a #" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#1005: Comparing pointer to int and long (NULL can be either on various systems)" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#1027: Bitfields can be captured" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#1147" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#1175 - Hidden Test" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#1238" time="{duration}" status="run"/> + <testcase classname="<exe-name>.(Fixture_1245<int, int>)" name="#1245" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#1319: Sections can have description (even if it is not saved/SectionName" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#1403" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#1455 - INFO and WARN can start with a linebreak" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#1514: stderr/stdout is not captured in tests aborted by an exception" time="{duration}" status="run"> + <failure type="FAIL"> +FAILED: +1514 +Tricky.tests.cpp:<line number> + </failure> + <system-out> +This would not be caught previously + </system-out> + <system-err> +Nor would this + </system-err> + </testcase> + <testcase classname="<exe-name>.global" name="#1548" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#1905 -- test spec parser properly clears internal state between compound tests" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#1912 -- test spec parser handles escaping/Various parentheses" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#1912 -- test spec parser handles escaping/backslash in test name" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#1913 - GENERATE inside a for loop should not keep recreating the generator" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#1913 - GENERATEs can share a line" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#1938 - GENERATE after a section/A" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#1938 - GENERATE after a section/B" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#1938 - Section followed by flat generate" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#1938 - Section followed by flat generate/A" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#1938 - flat generate" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#1938 - mixed sections and generates" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#1938 - mixed sections and generates/A" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#1938 - mixed sections and generates/B" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#1938 - nested generate" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#1954 - 7 arg template test case sig compiles - 1, 1, 1, 1, 1, 0, 0" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#1954 - 7 arg template test case sig compiles - 5, 1, 1, 1, 1, 0, 0" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#1954 - 7 arg template test case sig compiles - 5, 3, 1, 1, 1, 0, 0" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#748 - captures with unexpected exceptions/outside assertions" time="{duration}" status="run"> + <error type="TEST_CASE"> +FAILED: +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}" status="run"> + <error message="thisThrows()" type="REQUIRE_NOTHROW"> +FAILED: + REQUIRE_NOTHROW( thisThrows() ) +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}" status="run"/> + <testcase classname="<exe-name>.global" name="#809" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#833" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#835 -- errno should not be touched by Catch" time="{duration}" status="run"> + <failure message="f() == 0" type="CHECK"> +FAILED: + CHECK( f() == 0 ) +with expansion: + 1 == 0 +Misc.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="#872" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#961 -- Dynamically created sections should all be reported/Looped section 0" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#961 -- Dynamically created sections should all be reported/Looped section 1" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#961 -- Dynamically created sections should all be reported/Looped section 2" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#961 -- Dynamically created sections should all be reported/Looped section 3" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="#961 -- Dynamically created sections should all be reported/Looped section 4" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="'Not' checks that should fail" time="{duration}" status="run"> + <failure message="false != false" type="CHECK"> +FAILED: + CHECK( false != false ) +Condition.tests.cpp:<line number> + </failure> + <failure message="true != true" type="CHECK"> +FAILED: + CHECK( true != true ) +Condition.tests.cpp:<line number> + </failure> + <failure message="!true" type="CHECK"> +FAILED: + CHECK( !true ) +with expansion: + false +Condition.tests.cpp:<line number> + </failure> + <failure message="!(true)" type="CHECK_FALSE"> +FAILED: + CHECK_FALSE( true ) +with expansion: + !true +Condition.tests.cpp:<line number> + </failure> + <failure message="!trueValue" type="CHECK"> +FAILED: + CHECK( !trueValue ) +with expansion: + false +Condition.tests.cpp:<line number> + </failure> + <failure message="!(trueValue)" type="CHECK_FALSE"> +FAILED: + CHECK_FALSE( trueValue ) +with expansion: + !true +Condition.tests.cpp:<line number> + </failure> + <failure message="!(1 == 1)" type="CHECK"> +FAILED: + CHECK( !(1 == 1) ) +with expansion: + false +Condition.tests.cpp:<line number> + </failure> + <failure message="!(1 == 1)" type="CHECK_FALSE"> +FAILED: + CHECK_FALSE( 1 == 1 ) +Condition.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="'Not' checks that should succeed" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="(unimplemented) static bools can be evaluated/compare to true" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="(unimplemented) static bools can be evaluated/compare to false" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="(unimplemented) static bools can be evaluated/negation" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="(unimplemented) static bools can be evaluated/double negation" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="(unimplemented) static bools can be evaluated/direct" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="3x3x3 ints" time="{duration}" status="run"/> + <testcase classname="<exe-name>.TestClass" name="A METHOD_AS_TEST_CASE based test run that fails" time="{duration}" status="run"> + <failure message="s == "world"" type="REQUIRE"> +FAILED: + REQUIRE( s == "world" ) +with expansion: + "hello" == "world" +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}" status="run"/> + <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<float>" time="{duration}" status="run"> + <failure message="Template_Fixture_2<TestType>::m_a.size() == 1" type="REQUIRE"> +FAILED: + REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) +with expansion: + 0 == 1 +Class.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<int>" time="{duration}" status="run"> + <failure message="Template_Fixture_2<TestType>::m_a.size() == 1" type="REQUIRE"> +FAILED: + REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) +with expansion: + 0 == 1 +Class.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<float>" time="{duration}" status="run"> + <failure message="Template_Fixture_2<TestType>::m_a.size() == 1" type="REQUIRE"> +FAILED: + REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) +with expansion: + 0 == 1 +Class.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<int>" time="{duration}" status="run"> + <failure message="Template_Fixture_2<TestType>::m_a.size() == 1" type="REQUIRE"> +FAILED: + REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) +with expansion: + 0 == 1 +Class.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - Template_Foo<float>" time="{duration}" status="run"/> + <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - Template_Foo<int>" time="{duration}" status="run"/> + <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - std::vector<float>" time="{duration}" status="run"/> + <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - std::vector<int>" time="{duration}" status="run"/> + <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<float, 6>" time="{duration}" status="run"> + <failure message="Template_Fixture_2<TestType>{}.m_a.size() < 2" type="REQUIRE"> +FAILED: + REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) +with expansion: + 6 < 2 +Class.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<int, 2>" time="{duration}" status="run"> + <failure message="Template_Fixture_2<TestType>{}.m_a.size() < 2" type="REQUIRE"> +FAILED: + REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) +with expansion: + 2 < 2 +Class.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<float, 6>" time="{duration}" status="run"> + <failure message="Template_Fixture_2<TestType>{}.m_a.size() < 2" type="REQUIRE"> +FAILED: + REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) +with expansion: + 6 < 2 +Class.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<int, 2>" time="{duration}" status="run"> + <failure message="Template_Fixture_2<TestType>{}.m_a.size() < 2" type="REQUIRE"> +FAILED: + REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) +with expansion: + 2 < 2 +Class.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - Template_Foo_2<float,6>" time="{duration}" status="run"/> + <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - Template_Foo_2<int,2>" time="{duration}" status="run"/> + <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - std::array<float,6>" time="{duration}" status="run"/> + <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - std::array<int,2>" time="{duration}" status="run"/> + <testcase classname="<exe-name>.Template_Fixture" name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - double" time="{duration}" status="run"> + <failure message="Template_Fixture<TestType>::m_a == 2" type="REQUIRE"> +FAILED: + REQUIRE( Template_Fixture<TestType>::m_a == 2 ) +with expansion: + 1.0 == 2 +Class.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.Template_Fixture" name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - float" time="{duration}" status="run"> + <failure message="Template_Fixture<TestType>::m_a == 2" type="REQUIRE"> +FAILED: + REQUIRE( Template_Fixture<TestType>::m_a == 2 ) +with expansion: + 1.0f == 2 +Class.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.Template_Fixture" name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - int" time="{duration}" status="run"> + <failure message="Template_Fixture<TestType>::m_a == 2" type="REQUIRE"> +FAILED: + REQUIRE( Template_Fixture<TestType>::m_a == 2 ) +with expansion: + 1 == 2 +Class.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.Template_Fixture" name="A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - double" time="{duration}" status="run"/> + <testcase classname="<exe-name>.Template_Fixture" name="A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - float" time="{duration}" status="run"/> + <testcase classname="<exe-name>.Template_Fixture" name="A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - int" time="{duration}" status="run"/> + <testcase classname="<exe-name>.Nttp_Fixture" name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 1" time="{duration}" status="run"> + <failure message="Nttp_Fixture<V>::value == 0" type="REQUIRE"> +FAILED: + REQUIRE( Nttp_Fixture<V>::value == 0 ) +with expansion: + 1 == 0 +Class.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.Nttp_Fixture" name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 3" time="{duration}" status="run"> + <failure message="Nttp_Fixture<V>::value == 0" type="REQUIRE"> +FAILED: + REQUIRE( Nttp_Fixture<V>::value == 0 ) +with expansion: + 3 == 0 +Class.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.Nttp_Fixture" name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 6" time="{duration}" status="run"> + <failure message="Nttp_Fixture<V>::value == 0" type="REQUIRE"> +FAILED: + REQUIRE( Nttp_Fixture<V>::value == 0 ) +with expansion: + 6 == 0 +Class.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.Nttp_Fixture" name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 1" time="{duration}" status="run"/> + <testcase classname="<exe-name>.Nttp_Fixture" name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 3" time="{duration}" status="run"/> + <testcase classname="<exe-name>.Nttp_Fixture" name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6" time="{duration}" status="run"/> + <testcase classname="<exe-name>.Fixture" name="A TEST_CASE_METHOD based test run that fails" time="{duration}" status="run"> + <failure message="m_a == 2" type="REQUIRE"> +FAILED: + REQUIRE( m_a == 2 ) +with expansion: + 1 == 2 +Class.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.Fixture" name="A TEST_CASE_METHOD based test run that succeeds" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="A Template product test case - Foo<float>" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="A Template product test case - Foo<int>" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="A Template product test case - std::vector<float>" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="A Template product test case - std::vector<int>" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="A Template product test case with array signature - Bar<float, 42>" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="A Template product test case with array signature - Bar<int, 9>" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="A Template product test case with array signature - std::array<float, 42>" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="A Template product test case with array signature - std::array<int, 9>" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="A comparison that uses literals instead of the normal constructor" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="A couple of nested sections followed by a failure" time="{duration}" status="run"> + <failure type="FAIL"> +FAILED: +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}" status="run"/> + <testcase classname="<exe-name>.global" name="A failing expression with a non streamable type is still captured" time="{duration}" status="run"> + <failure message="&o1 == &o2" type="CHECK"> +FAILED: + CHECK( &o1 == &o2 ) +with expansion: + 0x<hex digits> == 0x<hex digits> +Tricky.tests.cpp:<line number> + </failure> + <failure message="o1 == o2" type="CHECK"> +FAILED: + CHECK( o1 == o2 ) +with expansion: + {?} == {?} +Tricky.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="Absolute margin" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="An expression with side-effects should only be evaluated once" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="An unchecked exception reports the line of the last assertion" time="{duration}" status="run"> + <error message="{Unknown expression after the reported line}"> +FAILED: + {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}" status="run"/> + <testcase classname="<exe-name>.global" name="Approx setters validate their arguments" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Approx with exactly-representable margin" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Approximate PI" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Approximate comparisons with different epsilons" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Approximate comparisons with floats" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Approximate comparisons with ints" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Approximate comparisons with mixed numeric types" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Arbitrary predicate matcher/Function pointer" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Arbitrary predicate matcher/Lambdas + different type" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Assertion macros support bit operators and bool conversions" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Assertions then sections" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Assertions then sections/A section" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Assertions then sections/A section/Another section" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Assertions then sections/A section/Another other section" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Basic use of the Contains range matcher/Different argument ranges, same element type, default comparison" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Basic use of the Contains range matcher/Different argument ranges, same element type, custom comparison" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Basic use of the Contains range matcher/Different element type, custom comparisons" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Basic use of the Contains range matcher/Can handle type that requires ADL-found free function begin and end" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Basic use of the Contains range matcher/Initialization with move only types" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Basic use of the Contains range matcher/Matching using matcher" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Basic use of the Empty range matcher/Simple, std-provided containers" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Basic use of the Empty range matcher/Type with empty" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Basic use of the Empty range matcher/Type requires ADL found empty free function" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="CAPTURE can deal with complex expressions" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="CAPTURE can deal with complex expressions involving commas" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="CAPTURE parses string and character constants" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Capture and info messages/Capture should stringify like assertions" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Capture and info messages/Info should NOT stringify the way assertions do" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Character pretty printing/Specifically escaped" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Character pretty printing/General chars" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Character pretty printing/Low ASCII" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Clara::Arg supports single-arg parse the way Opt does" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Combining MatchAllOfGeneric does not nest" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Combining MatchAnyOfGeneric does not nest" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Combining MatchNotOfGeneric does not nest" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Combining concrete matchers does not use templated matchers" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Combining only templated matchers" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Combining templated and concrete matchers" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Combining templated matchers" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Commas in various macros are allowed" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Comparing function pointers" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Comparison ops" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Comparison with explicitly convertible types" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Comparisons between ints where one side is computed" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Comparisons between unsigned ints and negative signed ints match c++ standard behaviour" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Comparisons with int literals don't warn when mixing signed/ unsigned" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Composed generic matchers shortcircuit/MatchAllOf" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Composed generic matchers shortcircuit/MatchAnyOf" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Composed matchers shortcircuit/MatchAllOf" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Composed matchers shortcircuit/MatchAnyOf" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Contains string matcher" time="{duration}" status="run"> + <failure message="testStringForMatching(), Contains("not there", Catch::CaseSensitive::No)" type="CHECK_THAT"> +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> + </failure> + <failure message="testStringForMatching(), Contains("STRING")" type="CHECK_THAT"> +FAILED: + CHECK_THAT( testStringForMatching(), Contains("STRING") ) +with expansion: + "this string contains 'abc' as a substring" contains: "STRING" +Matchers.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="Copy and then generate a range/from var and iterators" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Copy and then generate a range/From a temporary container" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Copy and then generate a range/Final validation" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Custom exceptions can be translated when testing for nothrow" time="{duration}" status="run"> + <error message="throwCustom()" type="REQUIRE_NOTHROW"> +FAILED: + REQUIRE_NOTHROW( throwCustom() ) +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}" status="run"> + <error message="throwCustom(), std::exception" type="REQUIRE_THROWS_AS"> +FAILED: + REQUIRE_THROWS_AS( throwCustom(), std::exception ) +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}" status="run"> + <error type="TEST_CASE"> +FAILED: +custom std exception +Exception.tests.cpp:<line number> + </error> + </testcase> + <testcase classname="<exe-name>.global" name="Default scale is invisible to comparison" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Directly creating an EnumInfo" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="EndsWith string matcher" time="{duration}" status="run"> + <failure message="testStringForMatching(), EndsWith("Substring")" type="CHECK_THAT"> +FAILED: + CHECK_THAT( testStringForMatching(), EndsWith("Substring") ) +with expansion: + "this string contains 'abc' as a substring" ends with: "Substring" +Matchers.tests.cpp:<line number> + </failure> + <failure message="testStringForMatching(), EndsWith("this", Catch::CaseSensitive::No)" type="CHECK_THAT"> +FAILED: + CHECK_THAT( testStringForMatching(), EndsWith("this", Catch::CaseSensitive::No) ) +with expansion: + "this string contains 'abc' as a substring" ends with: "this" (case + insensitive) +Matchers.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="Enums can quickly have stringification enabled using REGISTER_ENUM" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Epsilon only applies to Approx's value" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Equality checks that should fail" time="{duration}" status="run"> + <failure message="data.int_seven == 6" type="CHECK"> +FAILED: + CHECK( data.int_seven == 6 ) +with expansion: + 7 == 6 +Condition.tests.cpp:<line number> + </failure> + <failure message="data.int_seven == 8" type="CHECK"> +FAILED: + CHECK( data.int_seven == 8 ) +with expansion: + 7 == 8 +Condition.tests.cpp:<line number> + </failure> + <failure message="data.int_seven == 0" type="CHECK"> +FAILED: + CHECK( data.int_seven == 0 ) +with expansion: + 7 == 0 +Condition.tests.cpp:<line number> + </failure> + <failure message="data.float_nine_point_one == Approx( 9.11f )" type="CHECK"> +FAILED: + CHECK( data.float_nine_point_one == Approx( 9.11f ) ) +with expansion: + 9.1f == Approx( 9.1099996567 ) +Condition.tests.cpp:<line number> + </failure> + <failure message="data.float_nine_point_one == Approx( 9.0f )" type="CHECK"> +FAILED: + CHECK( data.float_nine_point_one == Approx( 9.0f ) ) +with expansion: + 9.1f == Approx( 9.0 ) +Condition.tests.cpp:<line number> + </failure> + <failure message="data.float_nine_point_one == Approx( 1 )" type="CHECK"> +FAILED: + CHECK( data.float_nine_point_one == Approx( 1 ) ) +with expansion: + 9.1f == Approx( 1.0 ) +Condition.tests.cpp:<line number> + </failure> + <failure message="data.float_nine_point_one == Approx( 0 )" type="CHECK"> +FAILED: + CHECK( data.float_nine_point_one == Approx( 0 ) ) +with expansion: + 9.1f == Approx( 0.0 ) +Condition.tests.cpp:<line number> + </failure> + <failure message="data.double_pi == Approx( 3.1415 )" type="CHECK"> +FAILED: + CHECK( data.double_pi == Approx( 3.1415 ) ) +with expansion: + 3.1415926535 == Approx( 3.1415 ) +Condition.tests.cpp:<line number> + </failure> + <failure message="data.str_hello == "goodbye"" type="CHECK"> +FAILED: + CHECK( data.str_hello == "goodbye" ) +with expansion: + "hello" == "goodbye" +Condition.tests.cpp:<line number> + </failure> + <failure message="data.str_hello == "hell"" type="CHECK"> +FAILED: + CHECK( data.str_hello == "hell" ) +with expansion: + "hello" == "hell" +Condition.tests.cpp:<line number> + </failure> + <failure message="data.str_hello == "hello1"" type="CHECK"> +FAILED: + CHECK( data.str_hello == "hello1" ) +with expansion: + "hello" == "hello1" +Condition.tests.cpp:<line number> + </failure> + <failure message="data.str_hello.size() == 6" type="CHECK"> +FAILED: + CHECK( data.str_hello.size() == 6 ) +with expansion: + 5 == 6 +Condition.tests.cpp:<line number> + </failure> + <failure message="x == Approx( 1.301 )" type="CHECK"> +FAILED: + CHECK( x == Approx( 1.301 ) ) +with expansion: + 1.3 == Approx( 1.301 ) +Condition.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="Equality checks that should succeed" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Equals" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Equals string matcher" time="{duration}" status="run"> + <failure message="testStringForMatching(), Equals("this string contains 'ABC' as a substring")" type="CHECK_THAT"> +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> + </failure> + <failure message="testStringForMatching(), Equals("something else", Catch::CaseSensitive::No)" type="CHECK_THAT"> +FAILED: + CHECK_THAT( testStringForMatching(), Equals("something else", Catch::CaseSensitive::No) ) +with expansion: + "this string contains 'abc' as a substring" equals: "something else" (case + insensitive) +Matchers.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="Exception as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Exception matchers that fail/No exception" time="{duration}" status="run"> + <failure message="doesNotThrow(), SpecialException, ExceptionMatcher{1}" type="CHECK_THROWS_MATCHES"> +FAILED: + CHECK_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{1} ) +Matchers.tests.cpp:<line number> + </failure> + <failure message="doesNotThrow(), SpecialException, ExceptionMatcher{1}" type="REQUIRE_THROWS_MATCHES"> +FAILED: + REQUIRE_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{1} ) +Matchers.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="Exception matchers that fail/Type mismatch" time="{duration}" status="run"> + <error message="throwsAsInt(1), SpecialException, ExceptionMatcher{1}" type="CHECK_THROWS_MATCHES"> +FAILED: + CHECK_THROWS_MATCHES( throwsAsInt(1), SpecialException, ExceptionMatcher{1} ) +Unknown exception +Matchers.tests.cpp:<line number> + </error> + <error message="throwsAsInt(1), SpecialException, ExceptionMatcher{1}" type="REQUIRE_THROWS_MATCHES"> +FAILED: + REQUIRE_THROWS_MATCHES( throwsAsInt(1), SpecialException, ExceptionMatcher{1} ) +Unknown exception +Matchers.tests.cpp:<line number> + </error> + </testcase> + <testcase classname="<exe-name>.global" name="Exception matchers that fail/Contents are wrong" time="{duration}" status="run"> + <failure message="throwsSpecialException(3), SpecialException, ExceptionMatcher{1}" type="CHECK_THROWS_MATCHES"> +FAILED: + CHECK_THROWS_MATCHES( throwsSpecialException(3), SpecialException, ExceptionMatcher{1} ) +with expansion: + SpecialException::what special exception has value of 1 +Matchers.tests.cpp:<line number> + </failure> + <failure message="throwsSpecialException(4), SpecialException, ExceptionMatcher{1}" type="REQUIRE_THROWS_MATCHES"> +FAILED: + REQUIRE_THROWS_MATCHES( throwsSpecialException(4), SpecialException, ExceptionMatcher{1} ) +with expansion: + SpecialException::what special exception has value of 1 +Matchers.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="Exception matchers that succeed" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Exception messages can be tested for/exact match" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Exception messages can be tested for/different case" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Exception messages can be tested for/wildcarded" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Exceptions matchers" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Expected exceptions that don't throw or unexpected exceptions fail the test" time="{duration}" status="run"> + <error message="thisThrows(), std::string" type="CHECK_THROWS_AS"> +FAILED: + CHECK_THROWS_AS( thisThrows(), std::string ) +expected exception +Exception.tests.cpp:<line number> + </error> + <failure message="thisDoesntThrow(), std::domain_error" type="CHECK_THROWS_AS"> +FAILED: + CHECK_THROWS_AS( thisDoesntThrow(), std::domain_error ) +Exception.tests.cpp:<line number> + </failure> + <error message="thisThrows()" type="CHECK_NOTHROW"> +FAILED: + CHECK_NOTHROW( thisThrows() ) +expected exception +Exception.tests.cpp:<line number> + </error> + </testcase> + <testcase classname="<exe-name>.global" name="FAIL aborts the test" time="{duration}" status="run"> + <failure type="FAIL"> +FAILED: +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}" status="run"> + <failure type="FAIL"> +FAILED: +Message.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="FAIL_CHECK does not abort the test" time="{duration}" status="run"> + <failure type="FAIL_CHECK"> +FAILED: +This is a failure +Message.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="Factorials are computed" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Floating point matchers: double/Relative" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Floating point matchers: double/Relative/Some subnormal values" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Floating point matchers: double/Margin" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Floating point matchers: double/ULPs" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Floating point matchers: double/Composed" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Floating point matchers: double/Constructor validation" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Floating point matchers: float/Relative" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Floating point matchers: float/Relative/Some subnormal values" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Floating point matchers: float/Margin" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Floating point matchers: float/ULPs" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Floating point matchers: float/Composed" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Floating point matchers: float/Constructor validation" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators -- adapters/Filtering by predicate/Basic usage" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators -- adapters/Filtering by predicate/Throws if there are no matching values" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators -- adapters/Shortening a range" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators -- adapters/Transforming elements/Same type" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators -- adapters/Transforming elements/Different type" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators -- adapters/Transforming elements/Different deduced type" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators -- adapters/Repeating a generator" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators -- adapters/Chunking a generator into sized pieces/Number of elements in source is divisible by chunk size" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators -- adapters/Chunking a generator into sized pieces/Number of elements in source is not divisible by chunk size" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators -- adapters/Chunking a generator into sized pieces/Chunk size of zero" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators -- adapters/Chunking a generator into sized pieces/Throws on too small generators" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators -- simple/one" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators -- simple/two" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators internals/Single value" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators internals/Preset values" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators internals/Generator combinator" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators internals/Explicitly typed generator sequence" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators internals/Filter generator" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators internals/Take generator/Take less" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators internals/Take generator/Take more" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators internals/Map with explicit return type" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators internals/Map with deduced return type" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators internals/Repeat/Singular repeat" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators internals/Repeat/Actual repeat" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators internals/Range/Positive auto step/Integer" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators internals/Range/Negative auto step/Integer" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators internals/Range/Positive manual step/Integer/Exact" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators internals/Range/Positive manual step/Integer/Slightly over end" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators internals/Range/Positive manual step/Integer/Slightly under end" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators internals/Range/Positive manual step/Floating Point/Exact" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators internals/Range/Positive manual step/Floating Point/Slightly over end" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators internals/Range/Positive manual step/Floating Point/Slightly under end" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators internals/Range/Negative manual step/Integer/Exact" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators internals/Range/Negative manual step/Integer/Slightly over end" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Generators internals/Range/Negative manual step/Integer/Slightly under end" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Greater-than inequalities with different epsilons" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="INFO and WARN do not abort tests" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="INFO gets logged on failure" time="{duration}" status="run"> + <failure message="a == 1" type="REQUIRE"> +FAILED: + REQUIRE( a == 1 ) +with expansion: + 2 == 1 +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}" status="run"> + <failure message="a == 1" type="CHECK"> +FAILED: + CHECK( a == 1 ) +with expansion: + 2 == 1 +this message may be logged later +this message should be logged +Message.tests.cpp:<line number> + </failure> + <failure message="a == 0" type="CHECK"> +FAILED: + CHECK( a == 0 ) +with expansion: + 2 == 0 +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}" status="run"> + <failure message="i < 10" type="REQUIRE"> +FAILED: + REQUIRE( i < 10 ) +with expansion: + 10 < 10 +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}" status="run"> + <failure message="data.int_seven != 7" type="CHECK"> +FAILED: + CHECK( data.int_seven != 7 ) +with expansion: + 7 != 7 +Condition.tests.cpp:<line number> + </failure> + <failure message="data.float_nine_point_one != Approx( 9.1f )" type="CHECK"> +FAILED: + CHECK( data.float_nine_point_one != Approx( 9.1f ) ) +with expansion: + 9.1f != Approx( 9.1000003815 ) +Condition.tests.cpp:<line number> + </failure> + <failure message="data.double_pi != Approx( 3.1415926535 )" type="CHECK"> +FAILED: + CHECK( data.double_pi != Approx( 3.1415926535 ) ) +with expansion: + 3.1415926535 != Approx( 3.1415926535 ) +Condition.tests.cpp:<line number> + </failure> + <failure message="data.str_hello != "hello"" type="CHECK"> +FAILED: + CHECK( data.str_hello != "hello" ) +with expansion: + "hello" != "hello" +Condition.tests.cpp:<line number> + </failure> + <failure message="data.str_hello.size() != 5" type="CHECK"> +FAILED: + CHECK( data.str_hello.size() != 5 ) +with expansion: + 5 != 5 +Condition.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="Inequality checks that should succeed" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Lambdas in assertions" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Less-than inequalities with different epsilons" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="ManuallyRegistered" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Matchers can be (AllOf) composed with the && operator" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Matchers can be (AnyOf) composed with the || operator" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Matchers can be composed with both && and ||" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Matchers can be composed with both && and || - failing" time="{duration}" status="run"> + <failure message="testStringForMatching(), (Contains("string") || Contains("different")) && Contains("random")" type="CHECK_THAT"> +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.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="Matchers can be negated (Not) with the ! operator" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Matchers can be negated (Not) with the ! operator - failing" time="{duration}" status="run"> + <failure message="testStringForMatching(), !Contains("substring")" type="CHECK_THAT"> +FAILED: + CHECK_THAT( testStringForMatching(), !Contains("substring") ) +with expansion: + "this string contains 'abc' as a substring" not contains: "substring" +Matchers.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="Mismatching exception messages failing the test" time="{duration}" status="run"> + <failure message="thisThrows(), "should fail"" type="REQUIRE_THROWS_WITH"> +FAILED: + REQUIRE_THROWS_WITH( thisThrows(), "should fail" ) +with expansion: + "expected exception" equals: "should fail" +Exception.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="Nested generators and captured variables" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Nice descriptive name" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Non-std exceptions can be translated" time="{duration}" status="run"> + <error type="TEST_CASE"> +FAILED: +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}" status="run"/> + <testcase classname="<exe-name>.global" name="Optionally static assertions" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Ordering comparison checks that should fail" time="{duration}" status="run"> + <failure message="data.int_seven > 7" type="CHECK"> +FAILED: + CHECK( data.int_seven > 7 ) +with expansion: + 7 > 7 +Condition.tests.cpp:<line number> + </failure> + <failure message="data.int_seven < 7" type="CHECK"> +FAILED: + CHECK( data.int_seven < 7 ) +with expansion: + 7 < 7 +Condition.tests.cpp:<line number> + </failure> + <failure message="data.int_seven > 8" type="CHECK"> +FAILED: + CHECK( data.int_seven > 8 ) +with expansion: + 7 > 8 +Condition.tests.cpp:<line number> + </failure> + <failure message="data.int_seven < 6" type="CHECK"> +FAILED: + CHECK( data.int_seven < 6 ) +with expansion: + 7 < 6 +Condition.tests.cpp:<line number> + </failure> + <failure message="data.int_seven < 0" type="CHECK"> +FAILED: + CHECK( data.int_seven < 0 ) +with expansion: + 7 < 0 +Condition.tests.cpp:<line number> + </failure> + <failure message="data.int_seven < -1" type="CHECK"> +FAILED: + CHECK( data.int_seven < -1 ) +with expansion: + 7 < -1 +Condition.tests.cpp:<line number> + </failure> + <failure message="data.int_seven >= 8" type="CHECK"> +FAILED: + CHECK( data.int_seven >= 8 ) +with expansion: + 7 >= 8 +Condition.tests.cpp:<line number> + </failure> + <failure message="data.int_seven <= 6" type="CHECK"> +FAILED: + CHECK( data.int_seven <= 6 ) +with expansion: + 7 <= 6 +Condition.tests.cpp:<line number> + </failure> + <failure message="data.float_nine_point_one < 9" type="CHECK"> +FAILED: + CHECK( data.float_nine_point_one < 9 ) +with expansion: + 9.1f < 9 +Condition.tests.cpp:<line number> + </failure> + <failure message="data.float_nine_point_one > 10" type="CHECK"> +FAILED: + CHECK( data.float_nine_point_one > 10 ) +with expansion: + 9.1f > 10 +Condition.tests.cpp:<line number> + </failure> + <failure message="data.float_nine_point_one > 9.2" type="CHECK"> +FAILED: + CHECK( data.float_nine_point_one > 9.2 ) +with expansion: + 9.1f > 9.2 +Condition.tests.cpp:<line number> + </failure> + <failure message="data.str_hello > "hello"" type="CHECK"> +FAILED: + CHECK( data.str_hello > "hello" ) +with expansion: + "hello" > "hello" +Condition.tests.cpp:<line number> + </failure> + <failure message="data.str_hello < "hello"" type="CHECK"> +FAILED: + CHECK( data.str_hello < "hello" ) +with expansion: + "hello" < "hello" +Condition.tests.cpp:<line number> + </failure> + <failure message="data.str_hello > "hellp"" type="CHECK"> +FAILED: + CHECK( data.str_hello > "hellp" ) +with expansion: + "hello" > "hellp" +Condition.tests.cpp:<line number> + </failure> + <failure message="data.str_hello > "z"" type="CHECK"> +FAILED: + CHECK( data.str_hello > "z" ) +with expansion: + "hello" > "z" +Condition.tests.cpp:<line number> + </failure> + <failure message="data.str_hello < "hellm"" type="CHECK"> +FAILED: + CHECK( data.str_hello < "hellm" ) +with expansion: + "hello" < "hellm" +Condition.tests.cpp:<line number> + </failure> + <failure message="data.str_hello < "a"" type="CHECK"> +FAILED: + CHECK( data.str_hello < "a" ) +with expansion: + "hello" < "a" +Condition.tests.cpp:<line number> + </failure> + <failure message="data.str_hello >= "z"" type="CHECK"> +FAILED: + CHECK( data.str_hello >= "z" ) +with expansion: + "hello" >= "z" +Condition.tests.cpp:<line number> + </failure> + <failure message="data.str_hello <= "a"" type="CHECK"> +FAILED: + CHECK( data.str_hello <= "a" ) +with expansion: + "hello" <= "a" +Condition.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="Ordering comparison checks that should succeed" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Our PCG implementation provides expected results for known seeds/Default seeded" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Our PCG implementation provides expected results for known seeds/Specific seed" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Output from all sections is reported/one" time="{duration}" status="run"> + <failure type="FAIL"> +FAILED: +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}" status="run"> + <failure type="FAIL"> +FAILED: +Message from section two +Message.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="Overloaded comma or address-of operators are not used" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/Empty test spec should have no filters" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/Test spec from empty string should have no filters" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/Test spec from just a comma should have no filters" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/Test spec from name should have one filter" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/Test spec from quoted name should have one filter" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/Test spec from name should have one filter" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/Wildcard at the start" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/Wildcard at the end" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/Wildcard at both ends" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/Redundant wildcard at the start" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/Redundant wildcard at the end" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/Redundant wildcard at both ends" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/Wildcard at both ends, redundant at start" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/Just wildcard" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/Single tag" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/Single tag, two matches" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/Two tags" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/Two tags, spare separated" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/Wildcarded name and tag" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/Single tag exclusion" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/One tag exclusion and one tag inclusion" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/One tag exclusion and one wldcarded name inclusion" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/One tag exclusion, using exclude:, and one wldcarded name inclusion" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/name exclusion" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/wildcarded name exclusion" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/wildcarded name exclusion with tag inclusion" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/wildcarded name exclusion, using exclude:, with tag inclusion" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/two wildcarded names" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/empty tag" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/empty quoted name" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/quoted string followed by tag exclusion" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/Leading and trailing spaces in test spec" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/Leading and trailing spaces in test name" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/Shortened hide tags are split apart when parsing" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parse test names and tags/Shortened hide tags also properly handle exclusion" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Pointers can be compared to null" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Precision of floating point stringification can be set/Floats" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Precision of floating point stringification can be set/Double" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Predicate matcher can accept const char*" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/empty args don't cause a crash" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/default - no arguments" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/test lists/Specify one test case using" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/test lists/Specify one test case exclusion using exclude:" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/test lists/Specify one test case exclusion using ~" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/-r/console" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/-r/xml" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/--reporter/junit" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/Only one reporter is accepted" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/must match one of the available ones" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/debugger/-b" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/debugger/--break" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/abort/-a aborts after first failure" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/abort/-x 2 aborts after two failures" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/abort/-x must be numeric" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/abort/wait-for-keypress/Accepted options" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/abort/wait-for-keypress/invalid options are reported" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/nothrow/-e" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/nothrow/--nothrow" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/output filename/-o filename" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/output filename/--out" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/combinations/Single character flags can be combined" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/use-colour/without option" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/use-colour/auto" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/use-colour/yes" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/use-colour/no" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/use-colour/error" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/Benchmark options/samples" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/Benchmark options/resamples" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/Benchmark options/confidence-interval" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/Benchmark options/no-analysis" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Process can be configured on command line/Benchmark options/warmup-time" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Product with differing arities - std::tuple<int, double, float>" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Product with differing arities - std::tuple<int, double>" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Product with differing arities - std::tuple<int>" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Range type with sentinel" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Reconstruction should be based on stringification: #914" time="{duration}" status="run"> + <failure message="truthy(false)" type="CHECK"> +FAILED: + CHECK( truthy(false) ) +with expansion: + Hey, its truthy! +Decomposition.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="Regex string matcher" time="{duration}" status="run"> + <failure message="testStringForMatching(), Matches("this STRING contains 'abc' as a substring")" type="CHECK_THAT"> +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> + </failure> + <failure message="testStringForMatching(), Matches("contains 'abc' as a substring")" type="CHECK_THAT"> +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> + </failure> + <failure message="testStringForMatching(), Matches("this string contains 'abc' as a")" type="CHECK_THAT"> +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 +Matchers.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="Regression test #1" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/automake reporter lists tags" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/automake reporter lists reporters" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/automake reporter lists tests" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/compact reporter lists tags" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/compact reporter lists reporters" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/compact reporter lists tests" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/console reporter lists tags" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/console reporter lists reporters" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/console reporter lists tests" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/junit reporter lists tags" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/junit reporter lists reporters" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/junit reporter lists tests" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/sonarqube reporter lists tags" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/sonarqube reporter lists reporters" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/sonarqube reporter lists tests" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/tap reporter lists tags" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/tap reporter lists reporters" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/tap reporter lists tests" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/teamcity reporter lists tags" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/teamcity reporter lists reporters" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/teamcity reporter lists tests" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/xml reporter lists tags" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/xml reporter lists reporters" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/xml reporter lists tests" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="SUCCEED counts as a test pass" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="SUCCEED does not require an argument" time="{duration}" status="run"/> + <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}" status="run"/> + <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}" status="run"/> + <testcase classname="<exe-name>.global" name="Scenario: Do that thing with the thing/Given: This stuff exists/And given: And some assumption/When: I do this/Then: it should do this" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Scenario: Do that thing with the thing/Given: This stuff exists/And given: And some assumption/When: I do this/Then: it should do this/And: do that" time="{duration}" status="run"/> + <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}" status="run"/> + <testcase classname="<exe-name>.global" name="Scenario: Vector resizing affects size and capacity/Given: an empty vector" time="{duration}" status="run"/> + <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}" status="run"/> + <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}" status="run"/> + <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}" status="run"/> + <testcase classname="<exe-name>.global" name="Sends stuff to stdout and stderr" time="{duration}" status="run"> + <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}" status="run"/> + <testcase classname="<exe-name>.global" name="Standard output from all sections is reported/two" time="{duration}" status="run"> + <system-out> +Message from section one +Message from section two + </system-out> + </testcase> + <testcase classname="<exe-name>.global" name="StartsWith string matcher" time="{duration}" status="run"> + <failure message="testStringForMatching(), StartsWith("This String")" type="CHECK_THAT"> +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> + </failure> + <failure message="testStringForMatching(), StartsWith("string", Catch::CaseSensitive::No)" type="CHECK_THAT"> +FAILED: + CHECK_THAT( testStringForMatching(), StartsWith("string", Catch::CaseSensitive::No) ) +with expansion: + "this string contains 'abc' as a substring" starts with: "string" (case + insensitive) +Matchers.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="Static arrays are convertible to string/Single item" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Static arrays are convertible to string/Multiple" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Static arrays are convertible to string/Non-trivial inner items" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="String matchers" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="StringRef/Empty string" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="StringRef/From string literal" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="StringRef/From sub-string" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="StringRef/Substrings/zero-based substring" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="StringRef/Substrings/non-zero-based substring" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="StringRef/Substrings/Pointer values of full refs should match" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="StringRef/Substrings/Pointer values of substring refs should also match" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="StringRef/Substrings/Past the end substring" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="StringRef/Substrings/Substring off the end are trimmed" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="StringRef/Substrings/substring start after the end is empty" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="StringRef/Comparisons are deep" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="StringRef/from std::string/implicitly constructed" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="StringRef/from std::string/explicitly constructed" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="StringRef/from std::string/assigned" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="StringRef/to std::string/explicitly constructed" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="StringRef/to std::string/assigned" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="StringRef/std::string += StringRef" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="StringRef/StringRef + StringRef" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="StringRef at compilation time/Simple constructors" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="StringRef at compilation time/UDL construction" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Stringifying std::chrono::duration helpers" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Stringifying std::chrono::duration with weird ratios" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Stringifying std::chrono::time_point<system_clock>" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Tabs and newlines show in output" time="{duration}" status="run"> + <failure message="s1 == s2" type="CHECK"> +FAILED: + CHECK( s1 == s2 ) +with expansion: + "if ($b == 10) { + $a = 20; + }" + == + "if ($b == 10) { + $a = 20; + } + " +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}" status="run"/> + <testcase classname="<exe-name>.global" name="Tag alias can be registered against tag patterns/Tag aliases must be of the form [@name]" time="{duration}" status="run"/> + <testcase classname="<exe-name>.Template_Fixture" name="Template test case method with test types specified inside std::tuple - MyTypes - 0" time="{duration}" status="run"/> + <testcase classname="<exe-name>.Template_Fixture" name="Template test case method with test types specified inside std::tuple - MyTypes - 1" time="{duration}" status="run"/> + <testcase classname="<exe-name>.Template_Fixture" name="Template test case method with test types specified inside std::tuple - MyTypes - 2" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Template test case with test types specified inside non-copyable and non-movable std::tuple - NonCopyableAndNonMovableTypes - 0" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Template test case with test types specified inside non-copyable and non-movable std::tuple - NonCopyableAndNonMovableTypes - 1" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Template test case with test types specified inside non-default-constructible std::tuple - MyNonDefaultConstructibleTypes - 0" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Template test case with test types specified inside non-default-constructible std::tuple - MyNonDefaultConstructibleTypes - 1" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Template test case with test types specified inside std::tuple - MyTypes - 0" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Template test case with test types specified inside std::tuple - MyTypes - 1" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Template test case with test types specified inside std::tuple - MyTypes - 2" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - float" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - float/resizing bigger changes size and capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - float/resizing smaller changes size but not capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - float/resizing smaller changes size but not capacity/We can use the 'swap trick' to reset the capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - float/reserving bigger changes capacity but not size" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - float/reserving smaller does not change size or capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - int" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - int/resizing bigger changes size and capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - int/resizing smaller changes size but not capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - int/resizing smaller changes size but not capacity/We can use the 'swap trick' to reset the capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - int/reserving bigger changes capacity but not size" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - int/reserving smaller does not change size or capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - std::string" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - std::string/resizing bigger changes size and capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - std::string/resizing smaller changes size but not capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - std::string/resizing smaller changes size but not capacity/We can use the 'swap trick' to reset the capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - std::string/reserving bigger changes capacity but not size" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - std::string/reserving smaller does not change size or capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - std::tuple<int,float>" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - std::tuple<int,float>/resizing bigger changes size and capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - std::tuple<int,float>/resizing smaller changes size but not capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - std::tuple<int,float>/resizing smaller changes size but not capacity/We can use the 'swap trick' to reset the capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - std::tuple<int,float>/reserving bigger changes capacity but not size" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTest: vectors can be sized and resized - std::tuple<int,float>/reserving smaller does not change size or capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6/resizing bigger changes size and capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6/resizing smaller changes size but not capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6/resizing smaller changes size but not capacity/We can use the 'swap trick' to reset the capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6/reserving bigger changes capacity but not size" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6/reserving smaller does not change size or capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTestSig: vectors can be sized and resized - float,4" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTestSig: vectors can be sized and resized - float,4/resizing bigger changes size and capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTestSig: vectors can be sized and resized - float,4/resizing smaller changes size but not capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTestSig: vectors can be sized and resized - float,4/resizing smaller changes size but not capacity/We can use the 'swap trick' to reset the capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTestSig: vectors can be sized and resized - float,4/reserving bigger changes capacity but not size" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTestSig: vectors can be sized and resized - float,4/reserving smaller does not change size or capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTestSig: vectors can be sized and resized - int,5" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTestSig: vectors can be sized and resized - int,5/resizing bigger changes size and capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTestSig: vectors can be sized and resized - int,5/resizing smaller changes size but not capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTestSig: vectors can be sized and resized - int,5/resizing smaller changes size but not capacity/We can use the 'swap trick' to reset the capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTestSig: vectors can be sized and resized - int,5/reserving bigger changes capacity but not size" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTestSig: vectors can be sized and resized - int,5/reserving smaller does not change size or capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTestSig: vectors can be sized and resized - std::string,15" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTestSig: vectors can be sized and resized - std::string,15/resizing bigger changes size and capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTestSig: vectors can be sized and resized - std::string,15/resizing smaller changes size but not capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTestSig: vectors can be sized and resized - std::string,15/resizing smaller changes size but not capacity/We can use the 'swap trick' to reset the capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTestSig: vectors can be sized and resized - std::string,15/reserving bigger changes capacity but not size" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="TemplateTestSig: vectors can be sized and resized - std::string,15/reserving smaller does not change size or capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Test case with one argument" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Test enum bit values" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Test with special, characters "in name" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="The NO_FAIL macro reports a failure but does not fail the test" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="The default listing implementation write to provided stream/Listing tags" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="The default listing implementation write to provided stream/Listing reporters" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="The default listing implementation write to provided stream/Listing tests" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="This test 'should' fail but doesn't" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Thrown string literals are translated" time="{duration}" status="run"> + <error type="TEST_CASE"> +FAILED: +For some reason someone is throwing a string literal! +Exception.tests.cpp:<line number> + </error> + </testcase> + <testcase classname="<exe-name>.global" name="Tracker" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Tracker/successfully close one section" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Tracker/fail one section" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Tracker/fail one section/re-enter after failed section" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Tracker/fail one section/re-enter after failed section and find next section" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Tracker/successfully close one section, then find another" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Tracker/successfully close one section, then find another/Re-enter - skips S1 and enters S2" time="{duration}" status="run"/> + <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}" status="run"/> + <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}" status="run"/> + <testcase classname="<exe-name>.global" name="Tracker/open a nested section" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Trim strings" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Unexpected exceptions can be translated" time="{duration}" status="run"> + <error type="TEST_CASE"> +FAILED: +3.14 +Exception.tests.cpp:<line number> + </error> + </testcase> + <testcase classname="<exe-name>.global" name="Upcasting special member functions/Move constructor" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Upcasting special member functions/move assignment" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AllMatch range matcher/Basic usage" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AllMatch range matcher/Type requires ADL found begin and end" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AllMatch range matcher/Shortcircuiting/All are read" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AllMatch range matcher/Shortcircuiting/Short-circuited" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AnyMatch range matcher/Basic usage" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AnyMatch range matcher/Type requires ADL found begin and end" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AnyMatch range matcher/Shortcircuiting/All are read" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of AnyMatch range matcher/Shortcircuiting/Short-circuited" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of NoneMatch range matcher/Basic usage" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of NoneMatch range matcher/Type requires ADL found begin and end" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of NoneMatch range matcher/Shortcircuiting/All are read" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of NoneMatch range matcher/Shortcircuiting/Short-circuited" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of the SizeIs range matcher/Some with stdlib containers" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of the SizeIs range matcher/Type requires ADL found size free function" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Usage of the SizeIs range matcher/Type has size member" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Use a custom approx" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Variadic macros/Section with one argument" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Vector Approx matcher/Empty vector is roughly equal to an empty vector" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Vector Approx matcher/Vectors with elements/A vector is approx equal to itself" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Vector Approx matcher/Vectors with elements/Different length" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Vector Approx matcher/Vectors with elements/Same length, different elements" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Vector Approx matcher -- failing/Empty and non empty vectors are not approx equal" time="{duration}" status="run"> + <failure message="empty, Approx(t1)" type="CHECK_THAT"> +FAILED: + CHECK_THAT( empty, Approx(t1) ) +with expansion: + { } is approx: { 1.0, 2.0 } +Matchers.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="Vector Approx matcher -- failing/Just different vectors" time="{duration}" status="run"> + <failure message="v1, Approx(v2)" type="CHECK_THAT"> +FAILED: + CHECK_THAT( v1, Approx(v2) ) +with expansion: + { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 } +Matchers.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="Vector matchers/Contains (element)" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Vector matchers/Contains (vector)" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Vector matchers/Contains (element), composed" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Vector matchers/Equals" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Vector matchers/UnorderedEquals" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Vector matchers that fail/Contains (element)" time="{duration}" status="run"> + <failure message="v, VectorContains(-1)" type="CHECK_THAT"> +FAILED: + CHECK_THAT( v, VectorContains(-1) ) +with expansion: + { 1, 2, 3 } Contains: -1 +Matchers.tests.cpp:<line number> + </failure> + <failure message="empty, VectorContains(1)" type="CHECK_THAT"> +FAILED: + CHECK_THAT( empty, VectorContains(1) ) +with expansion: + { } Contains: 1 +Matchers.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="Vector matchers that fail/Contains (vector)" time="{duration}" status="run"> + <failure message="empty, Contains(v)" type="CHECK_THAT"> +FAILED: + CHECK_THAT( empty, Contains(v) ) +with expansion: + { } Contains: { 1, 2, 3 } +Matchers.tests.cpp:<line number> + </failure> + <failure message="v, Contains(v2)" type="CHECK_THAT"> +FAILED: + CHECK_THAT( v, Contains(v2) ) +with expansion: + { 1, 2, 3 } Contains: { 1, 2, 4 } +Matchers.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="Vector matchers that fail/Equals" time="{duration}" status="run"> + <failure message="v, Equals(v2)" type="CHECK_THAT"> +FAILED: + CHECK_THAT( v, Equals(v2) ) +with expansion: + { 1, 2, 3 } Equals: { 1, 2 } +Matchers.tests.cpp:<line number> + </failure> + <failure message="v2, Equals(v)" type="CHECK_THAT"> +FAILED: + CHECK_THAT( v2, Equals(v) ) +with expansion: + { 1, 2 } Equals: { 1, 2, 3 } +Matchers.tests.cpp:<line number> + </failure> + <failure message="empty, Equals(v)" type="CHECK_THAT"> +FAILED: + CHECK_THAT( empty, Equals(v) ) +with expansion: + { } Equals: { 1, 2, 3 } +Matchers.tests.cpp:<line number> + </failure> + <failure message="v, Equals(empty)" type="CHECK_THAT"> +FAILED: + CHECK_THAT( v, Equals(empty) ) +with expansion: + { 1, 2, 3 } Equals: { } +Matchers.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="Vector matchers that fail/UnorderedEquals" time="{duration}" status="run"> + <failure message="v, UnorderedEquals(empty)" type="CHECK_THAT"> +FAILED: + CHECK_THAT( v, UnorderedEquals(empty) ) +with expansion: + { 1, 2, 3 } UnorderedEquals: { } +Matchers.tests.cpp:<line number> + </failure> + <failure message="empty, UnorderedEquals(v)" type="CHECK_THAT"> +FAILED: + CHECK_THAT( empty, UnorderedEquals(v) ) +with expansion: + { } UnorderedEquals: { 1, 2, 3 } +Matchers.tests.cpp:<line number> + </failure> + <failure message="permuted, UnorderedEquals(v)" type="CHECK_THAT"> +FAILED: + CHECK_THAT( permuted, UnorderedEquals(v) ) +with expansion: + { 1, 3 } UnorderedEquals: { 1, 2, 3 } +Matchers.tests.cpp:<line number> + </failure> + <failure message="permuted, UnorderedEquals(v)" type="CHECK_THAT"> +FAILED: + CHECK_THAT( permuted, UnorderedEquals(v) ) +with expansion: + { 3, 1 } UnorderedEquals: { 1, 2, 3 } +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}" status="run"/> + <testcase classname="<exe-name>.global" name="When unchecked exceptions are thrown directly they are always failures" time="{duration}" status="run"> + <error type="TEST_CASE"> +FAILED: +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}" status="run"> + <error message="thisThrows() == 0" type="CHECK"> +FAILED: + CHECK( thisThrows() == 0 ) +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}" status="run"> + <error message="thisThrows() == 0" type="REQUIRE"> +FAILED: + REQUIRE( thisThrows() == 0 ) +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}" status="run"> + <error message="thisThrows() == 0" type="CHECK"> +FAILED: + CHECK( thisThrows() == 0 ) +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}" status="run"> + <error type="TEST_CASE"> +FAILED: +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}" status="run"/> + <testcase classname="<exe-name>.global" name="Where there is more to the expression after the RHS" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="X/level/0/a" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="X/level/0/b" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="X/level/1/a" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="X/level/1/b" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="XmlEncode/normal string" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="XmlEncode/empty string" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="XmlEncode/string with ampersand" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="XmlEncode/string with less-than" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="XmlEncode/string with greater-than" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="XmlEncode/string with quotes" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="XmlEncode/string with control char (1)" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="XmlEncode/string with control char (x7F)" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="analyse no analysis" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="array<int, N> -> toString" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="atomic if" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="benchmark function call/without chronometer" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="benchmark function call/with chronometer" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="boolean member" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="checkedElse" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="checkedElse, failing" time="{duration}" status="run"> + <failure message="flag" type="CHECKED_ELSE"> +FAILED: + CHECKED_ELSE( flag ) +with expansion: + false +Misc.tests.cpp:<line number> + </failure> + <failure message="testCheckedElse( false )" type="REQUIRE"> +FAILED: + REQUIRE( testCheckedElse( false ) ) +with expansion: + false +Misc.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="checkedIf" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="checkedIf, failing" time="{duration}" status="run"> + <failure message="flag" type="CHECKED_IF"> +FAILED: + CHECKED_IF( flag ) +with expansion: + false +Misc.tests.cpp:<line number> + </failure> + <failure message="testCheckedIf( false )" type="REQUIRE"> +FAILED: + REQUIRE( testCheckedIf( false ) ) +with expansion: + false +Misc.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="classify_outliers/none" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="classify_outliers/low severe" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="classify_outliers/low mild" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="classify_outliers/high mild" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="classify_outliers/high severe" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="classify_outliers/mixed" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="comparisons between const int variables" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="comparisons between int variables" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="erfc_inv" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="estimate_clock_resolution" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="even more nested SECTION tests/c/d (leaf)" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="even more nested SECTION tests/c/e (leaf)" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="even more nested SECTION tests/f (leaf)" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="just failure" time="{duration}" status="run"> + <failure type="FAIL"> +FAILED: +Previous info should not be seen +Message.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="just failure after unscoped info" time="{duration}" status="run"> + <failure type="FAIL"> +FAILED: +previous unscoped info SHOULD not be seen +Message.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="long long" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 0" time="{duration}" status="run"> + <failure message="b > a" type="CHECK"> +FAILED: + CHECK( b > a ) +with expansion: + 0 > 1 +Misc.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 1" time="{duration}" status="run"> + <failure message="b > a" type="CHECK"> +FAILED: + CHECK( b > a ) +with expansion: + 1 > 1 +Misc.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 2" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 3" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 4" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 5" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 6" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 7" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 8" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="looped SECTION tests/b is currently: 9" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="looped tests" time="{duration}" status="run"> + <failure message="( fib[i] % 2 ) == 0" type="CHECK"> +FAILED: + CHECK( ( fib[i] % 2 ) == 0 ) +with expansion: + 1 == 0 +Testing if fib[0] (1) is even +Misc.tests.cpp:<line number> + </failure> + <failure message="( fib[i] % 2 ) == 0" type="CHECK"> +FAILED: + CHECK( ( fib[i] % 2 ) == 0 ) +with expansion: + 1 == 0 +Testing if fib[1] (1) is even +Misc.tests.cpp:<line number> + </failure> + <failure message="( fib[i] % 2 ) == 0" type="CHECK"> +FAILED: + CHECK( ( fib[i] % 2 ) == 0 ) +with expansion: + 1 == 0 +Testing if fib[3] (3) is even +Misc.tests.cpp:<line number> + </failure> + <failure message="( fib[i] % 2 ) == 0" type="CHECK"> +FAILED: + CHECK( ( fib[i] % 2 ) == 0 ) +with expansion: + 1 == 0 +Testing if fib[4] (5) is even +Misc.tests.cpp:<line number> + </failure> + <failure message="( fib[i] % 2 ) == 0" type="CHECK"> +FAILED: + CHECK( ( fib[i] % 2 ) == 0 ) +with expansion: + 1 == 0 +Testing if fib[6] (13) is even +Misc.tests.cpp:<line number> + </failure> + <failure message="( fib[i] % 2 ) == 0" type="CHECK"> +FAILED: + CHECK( ( fib[i] % 2 ) == 0 ) +with expansion: + 1 == 0 +Testing if fib[7] (21) is even +Misc.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="make_unique reimplementation/From lvalue copies" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="make_unique reimplementation/From rvalue moves" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="make_unique reimplementation/Variadic constructor" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="mean" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="measure" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="mix info, unscoped info and warning" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="more nested SECTION tests/equal/doesn't equal" time="{duration}" status="run"> + <failure message="a == b" type="REQUIRE"> +FAILED: + REQUIRE( a == b ) +with expansion: + 1 == 2 +Misc.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="more nested SECTION tests/doesn't equal/not equal" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="more nested SECTION tests/doesn't equal/less than" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="nested SECTION tests/doesn't equal" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="nested SECTION tests/doesn't equal/not equal" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="non streamable - with conv. op" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="non-copyable objects" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="normal_cdf" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="normal_quantile" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="not allowed" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="not prints unscoped info from previous failures" time="{duration}" status="run"> + <failure message="false" type="REQUIRE"> +FAILED: + REQUIRE( false ) +this SHOULD be seen +Message.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="null strings" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="null_ptr" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="pair<pair<int,const char *,pair<std::string,int> > -> toString" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="parseEnums/No enums" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="parseEnums/One enum value" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="parseEnums/Multiple enum values" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="pointer to class" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="print unscoped info if passing unscoped info is printed" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="prints unscoped info on failure" time="{duration}" status="run"> + <failure message="false" type="REQUIRE"> +FAILED: + REQUIRE( false ) +this SHOULD be seen +this SHOULD also be seen +Message.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="prints unscoped info only for the first assertion" time="{duration}" status="run"> + <failure message="false" type="CHECK"> +FAILED: + CHECK( false ) +this SHOULD be seen only ONCE +Message.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="random SECTION tests/doesn't equal" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="random SECTION tests/not equal" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="replaceInPlace/replace single char" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="replaceInPlace/replace two chars" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="replaceInPlace/replace first char" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="replaceInPlace/replace last char" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="replaceInPlace/replace all chars" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="replaceInPlace/replace no chars" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="replaceInPlace/escape '" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="resolution" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="run_for_at_least, chronometer" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="run_for_at_least, int" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="send a single char to INFO" time="{duration}" status="run"> + <failure message="false" type="REQUIRE"> +FAILED: + REQUIRE( false ) +3 +Misc.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="sends information to INFO" time="{duration}" status="run"> + <failure message="false" type="REQUIRE"> +FAILED: + REQUIRE( false ) +hi +i := 7 +Message.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="shortened hide tags are split apart" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="splitString" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="stacks unscoped info in loops" time="{duration}" status="run"> + <failure message="false" type="CHECK"> +FAILED: + CHECK( false ) +Count 1 to 3... +1 +2 +3 +Message.tests.cpp:<line number> + </failure> + <failure message="false" type="CHECK"> +FAILED: + CHECK( false ) +Count 4 to 6... +4 +5 +6 +Message.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="std::map is convertible string/empty" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="std::map is convertible string/single item" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="std::map is convertible string/several items" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="std::pair<int,const std::string> -> toString" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="std::pair<int,std::string> -> toString" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="std::set is convertible string/empty" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="std::set is convertible string/single item" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="std::set is convertible string/several items" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="std::vector<std::pair<std::string,int> > -> toString" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="string literals of different sizes can be compared" time="{duration}" status="run"> + <failure message="std::string( "first" ) == "second"" type="REQUIRE"> +FAILED: + REQUIRE( std::string( "first" ) == "second" ) +with expansion: + "first" == "second" +Tricky.tests.cpp:<line number> + </failure> + </testcase> + <testcase classname="<exe-name>.global" name="stringify ranges" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="stringify( has_maker )" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="stringify( has_maker_and_operator )" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="stringify( has_neither )" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="stringify( has_operator )" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="stringify( has_template_operator )" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="stringify( vectors<has_maker> )" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="stringify( vectors<has_maker_and_operator> )" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="stringify( vectors<has_operator> )" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="strlen3" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="tables" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="thrown std::strings are translated" time="{duration}" status="run"> + <error type="TEST_CASE"> +FAILED: +Why would you throw a std::string? +Exception.tests.cpp:<line number> + </error> + </testcase> + <testcase classname="<exe-name>.global" name="toString on const wchar_t const pointer returns the string contents" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="toString on const wchar_t pointer returns the string contents" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="toString on wchar_t const pointer returns the string contents" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="toString on wchar_t returns the string contents" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="toString(enum class w/operator<<)" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="toString(enum class)" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="toString(enum w/operator<<)" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="toString(enum)" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="tuple<>" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="tuple<float,int>" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="tuple<int>" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="tuple<0,int,const char *>" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="tuple<string,string>" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="tuple<tuple<int>,tuple<>,float>" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="uniform samples" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="unique_ptr reimplementation: basic functionality/Default constructed unique_ptr is empty" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="unique_ptr reimplementation: basic functionality/Take ownership of allocation" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="unique_ptr reimplementation: basic functionality/Take ownership of allocation/Plain reset deallocates" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="unique_ptr reimplementation: basic functionality/Take ownership of allocation/Reset replaces ownership" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="unique_ptr reimplementation: basic functionality/Release releases ownership" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="unique_ptr reimplementation: basic functionality/Move constructor" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="unique_ptr reimplementation: basic functionality/Move assignment" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="unique_ptr reimplementation: basic functionality/free swap" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="vec<vec<string,alloc>> -> toString" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="vector<bool> -> toString" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="vector<int,allocator> -> toString" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="vector<int> -> toString" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="vector<string> -> toString" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="vectors can be sized and resized" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="vectors can be sized and resized/resizing bigger changes size and capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="vectors can be sized and resized/resizing smaller changes size but not capacity" time="{duration}" status="run"/> + <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}" status="run"/> + <testcase classname="<exe-name>.global" name="vectors can be sized and resized/reserving bigger changes capacity but not size" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="vectors can be sized and resized/reserving smaller does not change size or capacity" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="warmup" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="weighted_average_quantile" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="xmlentitycheck/embedded xml: <test>it should be possible to embed xml characters, such as <, " or &, or even whole <xml>documents</xml> within an attribute</test>" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="xmlentitycheck/encoded chars: these should all be encoded: &&&"""<<<&"<<&"" time="{duration}" status="run"/> + <system-out> +This would not be caught previously +A string sent directly to stdout +Message from section one +Message from section two + </system-out> + <system-err> +Nor would this +A string sent directly to stderr +A string sent to stderr via clog + </system-err> + </testsuite> +</testsuites> diff --git a/packages/Catch2/tests/SelfTest/Baselines/sonarqube.sw.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/sonarqube.sw.approved.txt new file mode 100644 index 0000000000000000000000000000000000000000..1f0cc5dad55d613eaec25b9c634eab82a854ef73 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/Baselines/sonarqube.sw.approved.txt @@ -0,0 +1,1861 @@ +<?xml version="1.0" encoding="UTF-8"?> +<testExecutions version="1"loose text artifact +> + <file path="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp"> + <testCase name="Clara::Arg supports single-arg parse the way Opt does" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp"> + <testCase name="#1905 -- test spec parser properly clears internal state between compound tests" duration="{duration}"/> + <testCase name="#1912 -- test spec parser handles escaping/Various parentheses" duration="{duration}"/> + <testCase name="#1912 -- test spec parser handles escaping/backslash in test name" duration="{duration}"/> + <testCase name="Parse test names and tags/Empty test spec should have no filters" duration="{duration}"/> + <testCase name="Parse test names and tags/Test spec from empty string should have no filters" duration="{duration}"/> + <testCase name="Parse test names and tags/Test spec from just a comma should have no filters" duration="{duration}"/> + <testCase name="Parse test names and tags/Test spec from name should have one filter" duration="{duration}"/> + <testCase name="Parse test names and tags/Test spec from quoted name should have one filter" duration="{duration}"/> + <testCase name="Parse test names and tags/Test spec from name should have one filter" duration="{duration}"/> + <testCase name="Parse test names and tags/Wildcard at the start" duration="{duration}"/> + <testCase name="Parse test names and tags/Wildcard at the end" duration="{duration}"/> + <testCase name="Parse test names and tags/Wildcard at both ends" duration="{duration}"/> + <testCase name="Parse test names and tags/Redundant wildcard at the start" duration="{duration}"/> + <testCase name="Parse test names and tags/Redundant wildcard at the end" duration="{duration}"/> + <testCase name="Parse test names and tags/Redundant wildcard at both ends" duration="{duration}"/> + <testCase name="Parse test names and tags/Wildcard at both ends, redundant at start" duration="{duration}"/> + <testCase name="Parse test names and tags/Just wildcard" duration="{duration}"/> + <testCase name="Parse test names and tags/Single tag" duration="{duration}"/> + <testCase name="Parse test names and tags/Single tag, two matches" duration="{duration}"/> + <testCase name="Parse test names and tags/Two tags" duration="{duration}"/> + <testCase name="Parse test names and tags/Two tags, spare separated" duration="{duration}"/> + <testCase name="Parse test names and tags/Wildcarded name and tag" duration="{duration}"/> + <testCase name="Parse test names and tags/Single tag exclusion" duration="{duration}"/> + <testCase name="Parse test names and tags/One tag exclusion and one tag inclusion" duration="{duration}"/> + <testCase name="Parse test names and tags/One tag exclusion and one wldcarded name inclusion" duration="{duration}"/> + <testCase name="Parse test names and tags/One tag exclusion, using exclude:, and one wldcarded name inclusion" duration="{duration}"/> + <testCase name="Parse test names and tags/name exclusion" duration="{duration}"/> + <testCase name="Parse test names and tags/wildcarded name exclusion" duration="{duration}"/> + <testCase name="Parse test names and tags/wildcarded name exclusion with tag inclusion" duration="{duration}"/> + <testCase name="Parse test names and tags/wildcarded name exclusion, using exclude:, with tag inclusion" duration="{duration}"/> + <testCase name="Parse test names and tags/two wildcarded names" duration="{duration}"/> + <testCase name="Parse test names and tags/empty tag" duration="{duration}"/> + <testCase name="Parse test names and tags/empty quoted name" duration="{duration}"/> + <testCase name="Parse test names and tags/quoted string followed by tag exclusion" duration="{duration}"/> + <testCase name="Parse test names and tags/Leading and trailing spaces in test spec" duration="{duration}"/> + <testCase name="Parse test names and tags/Leading and trailing spaces in test name" duration="{duration}"/> + <testCase name="Parse test names and tags/Shortened hide tags are split apart when parsing" duration="{duration}"/> + <testCase name="Parse test names and tags/Shortened hide tags also properly handle exclusion" duration="{duration}"/> + <testCase name="Process can be configured on command line/empty args don't cause a crash" duration="{duration}"/> + <testCase name="Process can be configured on command line/default - no arguments" duration="{duration}"/> + <testCase name="Process can be configured on command line/test lists/Specify one test case using" duration="{duration}"/> + <testCase name="Process can be configured on command line/test lists/Specify one test case exclusion using exclude:" duration="{duration}"/> + <testCase name="Process can be configured on command line/test lists/Specify one test case exclusion using ~" duration="{duration}"/> + <testCase name="Process can be configured on command line/reporter/-r/console" duration="{duration}"/> + <testCase name="Process can be configured on command line/reporter/-r/xml" duration="{duration}"/> + <testCase name="Process can be configured on command line/reporter/--reporter/junit" duration="{duration}"/> + <testCase name="Process can be configured on command line/reporter/Only one reporter is accepted" duration="{duration}"/> + <testCase name="Process can be configured on command line/reporter/must match one of the available ones" duration="{duration}"/> + <testCase name="Process can be configured on command line/debugger/-b" duration="{duration}"/> + <testCase name="Process can be configured on command line/debugger/--break" duration="{duration}"/> + <testCase name="Process can be configured on command line/abort/-a aborts after first failure" duration="{duration}"/> + <testCase name="Process can be configured on command line/abort/-x 2 aborts after two failures" duration="{duration}"/> + <testCase name="Process can be configured on command line/abort/-x must be numeric" duration="{duration}"/> + <testCase name="Process can be configured on command line/abort/wait-for-keypress/Accepted options" duration="{duration}"/> + <testCase name="Process can be configured on command line/abort/wait-for-keypress/invalid options are reported" duration="{duration}"/> + <testCase name="Process can be configured on command line/nothrow/-e" duration="{duration}"/> + <testCase name="Process can be configured on command line/nothrow/--nothrow" duration="{duration}"/> + <testCase name="Process can be configured on command line/output filename/-o filename" duration="{duration}"/> + <testCase name="Process can be configured on command line/output filename/--out" duration="{duration}"/> + <testCase name="Process can be configured on command line/combinations/Single character flags can be combined" duration="{duration}"/> + <testCase name="Process can be configured on command line/use-colour/without option" duration="{duration}"/> + <testCase name="Process can be configured on command line/use-colour/auto" duration="{duration}"/> + <testCase name="Process can be configured on command line/use-colour/yes" duration="{duration}"/> + <testCase name="Process can be configured on command line/use-colour/no" duration="{duration}"/> + <testCase name="Process can be configured on command line/use-colour/error" duration="{duration}"/> + <testCase name="Process can be configured on command line/Benchmark options/samples" duration="{duration}"/> + <testCase name="Process can be configured on command line/Benchmark options/resamples" duration="{duration}"/> + <testCase name="Process can be configured on command line/Benchmark options/confidence-interval" duration="{duration}"/> + <testCase name="Process can be configured on command line/Benchmark options/no-analysis" duration="{duration}"/> + <testCase name="Process can be configured on command line/Benchmark options/warmup-time" duration="{duration}"/> + <testCase name="Test with special, characters "in name" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp"> + <testCase name="Generators internals/Single value" duration="{duration}"/> + <testCase name="Generators internals/Preset values" duration="{duration}"/> + <testCase name="Generators internals/Generator combinator" duration="{duration}"/> + <testCase name="Generators internals/Explicitly typed generator sequence" duration="{duration}"/> + <testCase name="Generators internals/Filter generator" duration="{duration}"/> + <testCase name="Generators internals/Take generator/Take less" duration="{duration}"/> + <testCase name="Generators internals/Take generator/Take more" duration="{duration}"/> + <testCase name="Generators internals/Map with explicit return type" duration="{duration}"/> + <testCase name="Generators internals/Map with deduced return type" duration="{duration}"/> + <testCase name="Generators internals/Repeat/Singular repeat" duration="{duration}"/> + <testCase name="Generators internals/Repeat/Actual repeat" duration="{duration}"/> + <testCase name="Generators internals/Range/Positive auto step/Integer" duration="{duration}"/> + <testCase name="Generators internals/Range/Negative auto step/Integer" duration="{duration}"/> + <testCase name="Generators internals/Range/Positive manual step/Integer/Exact" duration="{duration}"/> + <testCase name="Generators internals/Range/Positive manual step/Integer/Slightly over end" duration="{duration}"/> + <testCase name="Generators internals/Range/Positive manual step/Integer/Slightly under end" duration="{duration}"/> + <testCase name="Generators internals/Range/Positive manual step/Floating Point/Exact" duration="{duration}"/> + <testCase name="Generators internals/Range/Positive manual step/Floating Point/Slightly over end" duration="{duration}"/> + <testCase name="Generators internals/Range/Positive manual step/Floating Point/Slightly under end" duration="{duration}"/> + <testCase name="Generators internals/Range/Negative manual step/Integer/Exact" duration="{duration}"/> + <testCase name="Generators internals/Range/Negative manual step/Integer/Slightly over end" duration="{duration}"/> + <testCase name="Generators internals/Range/Negative manual step/Integer/Slightly under end" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp"> + <testCase name="analyse no analysis" duration="{duration}"/> + <testCase name="benchmark function call/without chronometer" duration="{duration}"/> + <testCase name="benchmark function call/with chronometer" duration="{duration}"/> + <testCase name="classify_outliers/none" duration="{duration}"/> + <testCase name="classify_outliers/low severe" duration="{duration}"/> + <testCase name="classify_outliers/low mild" duration="{duration}"/> + <testCase name="classify_outliers/high mild" duration="{duration}"/> + <testCase name="classify_outliers/high severe" duration="{duration}"/> + <testCase name="classify_outliers/mixed" duration="{duration}"/> + <testCase name="erfc_inv" duration="{duration}"/> + <testCase name="estimate_clock_resolution" duration="{duration}"/> + <testCase name="mean" duration="{duration}"/> + <testCase name="measure" duration="{duration}"/> + <testCase name="normal_cdf" duration="{duration}"/> + <testCase name="normal_quantile" duration="{duration}"/> + <testCase name="resolution" duration="{duration}"/> + <testCase name="run_for_at_least, chronometer" duration="{duration}"/> + <testCase name="run_for_at_least, int" duration="{duration}"/> + <testCase name="uniform samples" duration="{duration}"/> + <testCase name="warmup" duration="{duration}"/> + <testCase name="weighted_average_quantile" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp"> + <testCase name="#1938 - GENERATE after a section/A" duration="{duration}"/> + <testCase name="#1938 - GENERATE after a section/B" duration="{duration}"/> + <testCase name="#1938 - Section followed by flat generate" duration="{duration}"/> + <testCase name="#1938 - Section followed by flat generate/A" duration="{duration}"/> + <testCase name="#1938 - flat generate" duration="{duration}"/> + <testCase name="#1938 - mixed sections and generates" duration="{duration}"/> + <testCase name="#1938 - mixed sections and generates/A" duration="{duration}"/> + <testCase name="#1938 - mixed sections and generates/B" duration="{duration}"/> + <testCase name="#1938 - nested generate" duration="{duration}"/> + <testCase name="Tracker" duration="{duration}"/> + <testCase name="Tracker/successfully close one section" duration="{duration}"/> + <testCase name="Tracker/fail one section" duration="{duration}"/> + <testCase name="Tracker/fail one section/re-enter after failed section" duration="{duration}"/> + <testCase name="Tracker/fail one section/re-enter after failed section and find next section" duration="{duration}"/> + <testCase name="Tracker/successfully close one section, then find another" duration="{duration}"/> + <testCase name="Tracker/successfully close one section, then find another/Re-enter - skips S1 and enters S2" duration="{duration}"/> + <testCase name="Tracker/successfully close one section, then find another/Re-enter - skips S1 and enters S2/Successfully close S2" duration="{duration}"/> + <testCase name="Tracker/successfully close one section, then find another/Re-enter - skips S1 and enters S2/fail S2" duration="{duration}"/> + <testCase name="Tracker/open a nested section" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp"> + <testCase name="Comparison ops" duration="{duration}"/> + <testCase name="Our PCG implementation provides expected results for known seeds/Default seeded" duration="{duration}"/> + <testCase name="Our PCG implementation provides expected results for known seeds/Specific seed" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp"> + <testCase name="Reporter's write listings to provided stream" duration="{duration}"/> + <testCase name="Reporter's write listings to provided stream/automake reporter lists tags" duration="{duration}"/> + <testCase name="Reporter's write listings to provided stream/automake reporter lists reporters" duration="{duration}"/> + <testCase name="Reporter's write listings to provided stream/automake reporter lists tests" duration="{duration}"/> + <testCase name="Reporter's write listings to provided stream/compact reporter lists tags" duration="{duration}"/> + <testCase name="Reporter's write listings to provided stream/compact reporter lists reporters" duration="{duration}"/> + <testCase name="Reporter's write listings to provided stream/compact reporter lists tests" duration="{duration}"/> + <testCase name="Reporter's write listings to provided stream/console reporter lists tags" duration="{duration}"/> + <testCase name="Reporter's write listings to provided stream/console reporter lists reporters" duration="{duration}"/> + <testCase name="Reporter's write listings to provided stream/console reporter lists tests" duration="{duration}"/> + <testCase name="Reporter's write listings to provided stream/junit reporter lists tags" duration="{duration}"/> + <testCase name="Reporter's write listings to provided stream/junit reporter lists reporters" duration="{duration}"/> + <testCase name="Reporter's write listings to provided stream/junit reporter lists tests" duration="{duration}"/> + <testCase name="Reporter's write listings to provided stream/sonarqube reporter lists tags" duration="{duration}"/> + <testCase name="Reporter's write listings to provided stream/sonarqube reporter lists reporters" duration="{duration}"/> + <testCase name="Reporter's write listings to provided stream/sonarqube reporter lists tests" duration="{duration}"/> + <testCase name="Reporter's write listings to provided stream/tap reporter lists tags" duration="{duration}"/> + <testCase name="Reporter's write listings to provided stream/tap reporter lists reporters" duration="{duration}"/> + <testCase name="Reporter's write listings to provided stream/tap reporter lists tests" duration="{duration}"/> + <testCase name="Reporter's write listings to provided stream/teamcity reporter lists tags" duration="{duration}"/> + <testCase name="Reporter's write listings to provided stream/teamcity reporter lists reporters" duration="{duration}"/> + <testCase name="Reporter's write listings to provided stream/teamcity reporter lists tests" duration="{duration}"/> + <testCase name="Reporter's write listings to provided stream/xml reporter lists tags" duration="{duration}"/> + <testCase name="Reporter's write listings to provided stream/xml reporter lists reporters" duration="{duration}"/> + <testCase name="Reporter's write listings to provided stream/xml reporter lists tests" duration="{duration}"/> + <testCase name="The default listing implementation write to provided stream/Listing tags" duration="{duration}"/> + <testCase name="The default listing implementation write to provided stream/Listing reporters" duration="{duration}"/> + <testCase name="The default listing implementation write to provided stream/Listing tests" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/IntrospectiveTests/String.tests.cpp"> + <testCase name="StringRef/Empty string" duration="{duration}"/> + <testCase name="StringRef/From string literal" duration="{duration}"/> + <testCase name="StringRef/From sub-string" duration="{duration}"/> + <testCase name="StringRef/Substrings/zero-based substring" duration="{duration}"/> + <testCase name="StringRef/Substrings/non-zero-based substring" duration="{duration}"/> + <testCase name="StringRef/Substrings/Pointer values of full refs should match" duration="{duration}"/> + <testCase name="StringRef/Substrings/Pointer values of substring refs should also match" duration="{duration}"/> + <testCase name="StringRef/Substrings/Past the end substring" duration="{duration}"/> + <testCase name="StringRef/Substrings/Substring off the end are trimmed" duration="{duration}"/> + <testCase name="StringRef/Substrings/substring start after the end is empty" duration="{duration}"/> + <testCase name="StringRef/Comparisons are deep" duration="{duration}"/> + <testCase name="StringRef/from std::string/implicitly constructed" duration="{duration}"/> + <testCase name="StringRef/from std::string/explicitly constructed" duration="{duration}"/> + <testCase name="StringRef/from std::string/assigned" duration="{duration}"/> + <testCase name="StringRef/to std::string/explicitly constructed" duration="{duration}"/> + <testCase name="StringRef/to std::string/assigned" duration="{duration}"/> + <testCase name="StringRef/std::string += StringRef" duration="{duration}"/> + <testCase name="StringRef/StringRef + StringRef" duration="{duration}"/> + <testCase name="StringRef at compilation time/Simple constructors" duration="{duration}"/> + <testCase name="StringRef at compilation time/UDL construction" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp"> + <testCase name="Trim strings" duration="{duration}"/> + <testCase name="replaceInPlace/replace single char" duration="{duration}"/> + <testCase name="replaceInPlace/replace two chars" duration="{duration}"/> + <testCase name="replaceInPlace/replace first char" duration="{duration}"/> + <testCase name="replaceInPlace/replace last char" duration="{duration}"/> + <testCase name="replaceInPlace/replace all chars" duration="{duration}"/> + <testCase name="replaceInPlace/replace no chars" duration="{duration}"/> + <testCase name="replaceInPlace/escape '" duration="{duration}"/> + <testCase name="splitString" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp"> + <testCase name="Tag alias can be registered against tag patterns/The same tag alias can only be registered once" duration="{duration}"/> + <testCase name="Tag alias can be registered against tag patterns/Tag aliases must be of the form [@name]" duration="{duration}"/> + <testCase name="shortened hide tags are split apart" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp"> + <testCase name="Directly creating an EnumInfo" duration="{duration}"/> + <testCase name="Range type with sentinel" duration="{duration}"/> + <testCase name="parseEnums/No enums" duration="{duration}"/> + <testCase name="parseEnums/One enum value" duration="{duration}"/> + <testCase name="parseEnums/Multiple enum values" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp"> + <testCase name="Upcasting special member functions/Move constructor" duration="{duration}"/> + <testCase name="Upcasting special member functions/move assignment" duration="{duration}"/> + <testCase name="make_unique reimplementation/From lvalue copies" duration="{duration}"/> + <testCase name="make_unique reimplementation/From rvalue moves" duration="{duration}"/> + <testCase name="make_unique reimplementation/Variadic constructor" duration="{duration}"/> + <testCase name="unique_ptr reimplementation: basic functionality/Default constructed unique_ptr is empty" duration="{duration}"/> + <testCase name="unique_ptr reimplementation: basic functionality/Take ownership of allocation" duration="{duration}"/> + <testCase name="unique_ptr reimplementation: basic functionality/Take ownership of allocation/Plain reset deallocates" duration="{duration}"/> + <testCase name="unique_ptr reimplementation: basic functionality/Take ownership of allocation/Reset replaces ownership" duration="{duration}"/> + <testCase name="unique_ptr reimplementation: basic functionality/Release releases ownership" duration="{duration}"/> + <testCase name="unique_ptr reimplementation: basic functionality/Move constructor" duration="{duration}"/> + <testCase name="unique_ptr reimplementation: basic functionality/Move assignment" duration="{duration}"/> + <testCase name="unique_ptr reimplementation: basic functionality/free swap" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp"> + <testCase name="XmlEncode/normal string" duration="{duration}"/> + <testCase name="XmlEncode/empty string" duration="{duration}"/> + <testCase name="XmlEncode/string with ampersand" duration="{duration}"/> + <testCase name="XmlEncode/string with less-than" duration="{duration}"/> + <testCase name="XmlEncode/string with greater-than" duration="{duration}"/> + <testCase name="XmlEncode/string with quotes" duration="{duration}"/> + <testCase name="XmlEncode/string with control char (1)" duration="{duration}"/> + <testCase name="XmlEncode/string with control char (x7F)" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/UsageTests/Approx.tests.cpp"> + <testCase name="A comparison that uses literals instead of the normal constructor" duration="{duration}"/> + <testCase name="Absolute margin" duration="{duration}"/> + <testCase name="Approx setters validate their arguments" duration="{duration}"/> + <testCase name="Approx with exactly-representable margin" duration="{duration}"/> + <testCase name="Approximate PI" duration="{duration}"/> + <testCase name="Approximate comparisons with different epsilons" duration="{duration}"/> + <testCase name="Approximate comparisons with floats" duration="{duration}"/> + <testCase name="Approximate comparisons with ints" duration="{duration}"/> + <testCase name="Approximate comparisons with mixed numeric types" duration="{duration}"/> + <testCase name="Comparison with explicitly convertible types" duration="{duration}"/> + <testCase name="Default scale is invisible to comparison" duration="{duration}"/> + <testCase name="Epsilon only applies to Approx's value" duration="{duration}"/> + <testCase name="Greater-than inequalities with different epsilons" duration="{duration}"/> + <testCase name="Less-than inequalities with different epsilons" duration="{duration}"/> + <testCase name="Some simple comparisons between doubles" duration="{duration}"/> + <testCase name="Use a custom approx" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/UsageTests/BDD.tests.cpp"> + <testCase name="Scenario: BDD tests requiring Fixtures to provide commonly-accessed data or methods/Given: No operations precede me" duration="{duration}"/> + <testCase 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" duration="{duration}"/> + <testCase name="Scenario: Do that thing with the thing/Given: This stuff exists/And given: And some assumption/When: I do this/Then: it should do this" duration="{duration}"/> + <testCase name="Scenario: Do that thing with the thing/Given: This stuff exists/And given: And some assumption/When: I do this/Then: it should do this/And: do that" duration="{duration}"/> + <testCase 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" duration="{duration}"/> + <testCase name="Scenario: Vector resizing affects size and capacity/Given: an empty vector" duration="{duration}"/> + <testCase name="Scenario: Vector resizing affects size and capacity/Given: an empty vector/When: it is made larger/Then: the size and capacity go up" duration="{duration}"/> + <testCase 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" duration="{duration}"/> + <testCase 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" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/UsageTests/Class.tests.cpp"> + <testCase name="A METHOD_AS_TEST_CASE based test run that fails" duration="{duration}"> + <failure message="REQUIRE(s == "world")"> +FAILED: + REQUIRE( s == "world" ) +with expansion: + "hello" == "world" +Class.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="A METHOD_AS_TEST_CASE based test run that succeeds" duration="{duration}"/> + <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<float>" duration="{duration}"> + <failure message="REQUIRE(Template_Fixture_2<TestType>::m_a.size() == 1)"> +FAILED: + REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) +with expansion: + 0 == 1 +Class.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<int>" duration="{duration}"> + <failure message="REQUIRE(Template_Fixture_2<TestType>::m_a.size() == 1)"> +FAILED: + REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) +with expansion: + 0 == 1 +Class.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<float>" duration="{duration}"> + <failure message="REQUIRE(Template_Fixture_2<TestType>::m_a.size() == 1)"> +FAILED: + REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) +with expansion: + 0 == 1 +Class.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<int>" duration="{duration}"> + <failure message="REQUIRE(Template_Fixture_2<TestType>::m_a.size() == 1)"> +FAILED: + REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) +with expansion: + 0 == 1 +Class.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - Template_Foo<float>" duration="{duration}"/> + <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - Template_Foo<int>" duration="{duration}"/> + <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - std::vector<float>" duration="{duration}"/> + <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - std::vector<int>" duration="{duration}"/> + <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<float, 6>" duration="{duration}"> + <failure message="REQUIRE(Template_Fixture_2<TestType>{}.m_a.size() < 2)"> +FAILED: + REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) +with expansion: + 6 < 2 +Class.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<int, 2>" duration="{duration}"> + <failure message="REQUIRE(Template_Fixture_2<TestType>{}.m_a.size() < 2)"> +FAILED: + REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) +with expansion: + 2 < 2 +Class.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<float, 6>" duration="{duration}"> + <failure message="REQUIRE(Template_Fixture_2<TestType>{}.m_a.size() < 2)"> +FAILED: + REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) +with expansion: + 6 < 2 +Class.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<int, 2>" duration="{duration}"> + <failure message="REQUIRE(Template_Fixture_2<TestType>{}.m_a.size() < 2)"> +FAILED: + REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 ) +with expansion: + 2 < 2 +Class.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - Template_Foo_2<float,6>" duration="{duration}"/> + <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - Template_Foo_2<int,2>" duration="{duration}"/> + <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - std::array<float,6>" duration="{duration}"/> + <testCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - std::array<int,2>" duration="{duration}"/> + <testCase name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - double" duration="{duration}"> + <failure message="REQUIRE(Template_Fixture<TestType>::m_a == 2)"> +FAILED: + REQUIRE( Template_Fixture<TestType>::m_a == 2 ) +with expansion: + 1.0 == 2 +Class.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - float" duration="{duration}"> + <failure message="REQUIRE(Template_Fixture<TestType>::m_a == 2)"> +FAILED: + REQUIRE( Template_Fixture<TestType>::m_a == 2 ) +with expansion: + 1.0f == 2 +Class.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - int" duration="{duration}"> + <failure message="REQUIRE(Template_Fixture<TestType>::m_a == 2)"> +FAILED: + REQUIRE( Template_Fixture<TestType>::m_a == 2 ) +with expansion: + 1 == 2 +Class.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - double" duration="{duration}"/> + <testCase name="A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - float" duration="{duration}"/> + <testCase name="A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - int" duration="{duration}"/> + <testCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 1" duration="{duration}"> + <failure message="REQUIRE(Nttp_Fixture<V>::value == 0)"> +FAILED: + REQUIRE( Nttp_Fixture<V>::value == 0 ) +with expansion: + 1 == 0 +Class.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 3" duration="{duration}"> + <failure message="REQUIRE(Nttp_Fixture<V>::value == 0)"> +FAILED: + REQUIRE( Nttp_Fixture<V>::value == 0 ) +with expansion: + 3 == 0 +Class.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 6" duration="{duration}"> + <failure message="REQUIRE(Nttp_Fixture<V>::value == 0)"> +FAILED: + REQUIRE( Nttp_Fixture<V>::value == 0 ) +with expansion: + 6 == 0 +Class.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 1" duration="{duration}"/> + <testCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 3" duration="{duration}"/> + <testCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6" duration="{duration}"/> + <testCase name="A TEST_CASE_METHOD based test run that fails" duration="{duration}"> + <failure message="REQUIRE(m_a == 2)"> +FAILED: + REQUIRE( m_a == 2 ) +with expansion: + 1 == 2 +Class.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="A TEST_CASE_METHOD based test run that succeeds" duration="{duration}"/> + <testCase name="Template test case method with test types specified inside std::tuple - MyTypes - 0" duration="{duration}"/> + <testCase name="Template test case method with test types specified inside std::tuple - MyTypes - 1" duration="{duration}"/> + <testCase name="Template test case method with test types specified inside std::tuple - MyTypes - 2" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/UsageTests/Compilation.tests.cpp"> + <testCase name="#1027: Bitfields can be captured" duration="{duration}"/> + <testCase name="#1147" duration="{duration}"/> + <testCase name="#1238" duration="{duration}"/> + <testCase name="#1245" duration="{duration}"/> + <testCase name="#1319: Sections can have description (even if it is not saved/SectionName" duration="{duration}"/> + <testCase name="#1403" duration="{duration}"/> + <testCase name="#1548" duration="{duration}"/> + <testCase name="#809" duration="{duration}"/> + <testCase name="#833" duration="{duration}"/> + <testCase name="#872" duration="{duration}"/> + <testCase name="Assertion macros support bit operators and bool conversions" duration="{duration}"/> + <testCase name="Lambdas in assertions" duration="{duration}"/> + <testCase name="Optionally static assertions" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/UsageTests/Condition.tests.cpp"> + <testCase name="'Not' checks that should fail" duration="{duration}"> + <failure message="CHECK(false != false)"> +FAILED: + CHECK( false != false ) +Condition.tests.cpp:<line number> + </failure> + <failure message="CHECK(true != true)"> +FAILED: + CHECK( true != true ) +Condition.tests.cpp:<line number> + </failure> + <failure message="CHECK(!true)"> +FAILED: + CHECK( !true ) +with expansion: + false +Condition.tests.cpp:<line number> + </failure> + <failure message="CHECK_FALSE(!(true))"> +FAILED: + CHECK_FALSE( true ) +with expansion: + !true +Condition.tests.cpp:<line number> + </failure> + <failure message="CHECK(!trueValue)"> +FAILED: + CHECK( !trueValue ) +with expansion: + false +Condition.tests.cpp:<line number> + </failure> + <failure message="CHECK_FALSE(!(trueValue))"> +FAILED: + CHECK_FALSE( trueValue ) +with expansion: + !true +Condition.tests.cpp:<line number> + </failure> + <failure message="CHECK(!(1 == 1))"> +FAILED: + CHECK( !(1 == 1) ) +with expansion: + false +Condition.tests.cpp:<line number> + </failure> + <failure message="CHECK_FALSE(!(1 == 1))"> +FAILED: + CHECK_FALSE( 1 == 1 ) +Condition.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="'Not' checks that should succeed" duration="{duration}"/> + <testCase name="Comparisons between ints where one side is computed" duration="{duration}"/> + <testCase name="Comparisons between unsigned ints and negative signed ints match c++ standard behaviour" duration="{duration}"/> + <testCase name="Comparisons with int literals don't warn when mixing signed/ unsigned" duration="{duration}"/> + <testCase name="Equality checks that should fail" duration="{duration}"> + <skipped message="CHECK(data.int_seven == 6)"> +FAILED: + CHECK( data.int_seven == 6 ) +with expansion: + 7 == 6 +Condition.tests.cpp:<line number> + </skipped> + <skipped message="CHECK(data.int_seven == 8)"> +FAILED: + CHECK( data.int_seven == 8 ) +with expansion: + 7 == 8 +Condition.tests.cpp:<line number> + </skipped> + <skipped message="CHECK(data.int_seven == 0)"> +FAILED: + CHECK( data.int_seven == 0 ) +with expansion: + 7 == 0 +Condition.tests.cpp:<line number> + </skipped> + <skipped message="CHECK(data.float_nine_point_one == Approx( 9.11f ))"> +FAILED: + CHECK( data.float_nine_point_one == Approx( 9.11f ) ) +with expansion: + 9.1f == Approx( 9.1099996567 ) +Condition.tests.cpp:<line number> + </skipped> + <skipped message="CHECK(data.float_nine_point_one == Approx( 9.0f ))"> +FAILED: + CHECK( data.float_nine_point_one == Approx( 9.0f ) ) +with expansion: + 9.1f == Approx( 9.0 ) +Condition.tests.cpp:<line number> + </skipped> + <skipped message="CHECK(data.float_nine_point_one == Approx( 1 ))"> +FAILED: + CHECK( data.float_nine_point_one == Approx( 1 ) ) +with expansion: + 9.1f == Approx( 1.0 ) +Condition.tests.cpp:<line number> + </skipped> + <skipped message="CHECK(data.float_nine_point_one == Approx( 0 ))"> +FAILED: + CHECK( data.float_nine_point_one == Approx( 0 ) ) +with expansion: + 9.1f == Approx( 0.0 ) +Condition.tests.cpp:<line number> + </skipped> + <skipped message="CHECK(data.double_pi == Approx( 3.1415 ))"> +FAILED: + CHECK( data.double_pi == Approx( 3.1415 ) ) +with expansion: + 3.1415926535 == Approx( 3.1415 ) +Condition.tests.cpp:<line number> + </skipped> + <skipped message="CHECK(data.str_hello == "goodbye")"> +FAILED: + CHECK( data.str_hello == "goodbye" ) +with expansion: + "hello" == "goodbye" +Condition.tests.cpp:<line number> + </skipped> + <skipped message="CHECK(data.str_hello == "hell")"> +FAILED: + CHECK( data.str_hello == "hell" ) +with expansion: + "hello" == "hell" +Condition.tests.cpp:<line number> + </skipped> + <skipped message="CHECK(data.str_hello == "hello1")"> +FAILED: + CHECK( data.str_hello == "hello1" ) +with expansion: + "hello" == "hello1" +Condition.tests.cpp:<line number> + </skipped> + <skipped message="CHECK(data.str_hello.size() == 6)"> +FAILED: + CHECK( data.str_hello.size() == 6 ) +with expansion: + 5 == 6 +Condition.tests.cpp:<line number> + </skipped> + <skipped message="CHECK(x == Approx( 1.301 ))"> +FAILED: + CHECK( x == Approx( 1.301 ) ) +with expansion: + 1.3 == Approx( 1.301 ) +Condition.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="Equality checks that should succeed" duration="{duration}"/> + <testCase name="Inequality checks that should fail" duration="{duration}"> + <skipped message="CHECK(data.int_seven != 7)"> +FAILED: + CHECK( data.int_seven != 7 ) +with expansion: + 7 != 7 +Condition.tests.cpp:<line number> + </skipped> + <skipped message="CHECK(data.float_nine_point_one != Approx( 9.1f ))"> +FAILED: + CHECK( data.float_nine_point_one != Approx( 9.1f ) ) +with expansion: + 9.1f != Approx( 9.1000003815 ) +Condition.tests.cpp:<line number> + </skipped> + <skipped message="CHECK(data.double_pi != Approx( 3.1415926535 ))"> +FAILED: + CHECK( data.double_pi != Approx( 3.1415926535 ) ) +with expansion: + 3.1415926535 != Approx( 3.1415926535 ) +Condition.tests.cpp:<line number> + </skipped> + <skipped message="CHECK(data.str_hello != "hello")"> +FAILED: + CHECK( data.str_hello != "hello" ) +with expansion: + "hello" != "hello" +Condition.tests.cpp:<line number> + </skipped> + <skipped message="CHECK(data.str_hello.size() != 5)"> +FAILED: + CHECK( data.str_hello.size() != 5 ) +with expansion: + 5 != 5 +Condition.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="Inequality checks that should succeed" duration="{duration}"/> + <testCase name="Ordering comparison checks that should fail" duration="{duration}"> + <failure message="CHECK(data.int_seven > 7)"> +FAILED: + CHECK( data.int_seven > 7 ) +with expansion: + 7 > 7 +Condition.tests.cpp:<line number> + </failure> + <failure message="CHECK(data.int_seven < 7)"> +FAILED: + CHECK( data.int_seven < 7 ) +with expansion: + 7 < 7 +Condition.tests.cpp:<line number> + </failure> + <failure message="CHECK(data.int_seven > 8)"> +FAILED: + CHECK( data.int_seven > 8 ) +with expansion: + 7 > 8 +Condition.tests.cpp:<line number> + </failure> + <failure message="CHECK(data.int_seven < 6)"> +FAILED: + CHECK( data.int_seven < 6 ) +with expansion: + 7 < 6 +Condition.tests.cpp:<line number> + </failure> + <failure message="CHECK(data.int_seven < 0)"> +FAILED: + CHECK( data.int_seven < 0 ) +with expansion: + 7 < 0 +Condition.tests.cpp:<line number> + </failure> + <failure message="CHECK(data.int_seven < -1)"> +FAILED: + CHECK( data.int_seven < -1 ) +with expansion: + 7 < -1 +Condition.tests.cpp:<line number> + </failure> + <failure message="CHECK(data.int_seven >= 8)"> +FAILED: + CHECK( data.int_seven >= 8 ) +with expansion: + 7 >= 8 +Condition.tests.cpp:<line number> + </failure> + <failure message="CHECK(data.int_seven <= 6)"> +FAILED: + CHECK( data.int_seven <= 6 ) +with expansion: + 7 <= 6 +Condition.tests.cpp:<line number> + </failure> + <failure message="CHECK(data.float_nine_point_one < 9)"> +FAILED: + CHECK( data.float_nine_point_one < 9 ) +with expansion: + 9.1f < 9 +Condition.tests.cpp:<line number> + </failure> + <failure message="CHECK(data.float_nine_point_one > 10)"> +FAILED: + CHECK( data.float_nine_point_one > 10 ) +with expansion: + 9.1f > 10 +Condition.tests.cpp:<line number> + </failure> + <failure message="CHECK(data.float_nine_point_one > 9.2)"> +FAILED: + CHECK( data.float_nine_point_one > 9.2 ) +with expansion: + 9.1f > 9.2 +Condition.tests.cpp:<line number> + </failure> + <failure message="CHECK(data.str_hello > "hello")"> +FAILED: + CHECK( data.str_hello > "hello" ) +with expansion: + "hello" > "hello" +Condition.tests.cpp:<line number> + </failure> + <failure message="CHECK(data.str_hello < "hello")"> +FAILED: + CHECK( data.str_hello < "hello" ) +with expansion: + "hello" < "hello" +Condition.tests.cpp:<line number> + </failure> + <failure message="CHECK(data.str_hello > "hellp")"> +FAILED: + CHECK( data.str_hello > "hellp" ) +with expansion: + "hello" > "hellp" +Condition.tests.cpp:<line number> + </failure> + <failure message="CHECK(data.str_hello > "z")"> +FAILED: + CHECK( data.str_hello > "z" ) +with expansion: + "hello" > "z" +Condition.tests.cpp:<line number> + </failure> + <failure message="CHECK(data.str_hello < "hellm")"> +FAILED: + CHECK( data.str_hello < "hellm" ) +with expansion: + "hello" < "hellm" +Condition.tests.cpp:<line number> + </failure> + <failure message="CHECK(data.str_hello < "a")"> +FAILED: + CHECK( data.str_hello < "a" ) +with expansion: + "hello" < "a" +Condition.tests.cpp:<line number> + </failure> + <failure message="CHECK(data.str_hello >= "z")"> +FAILED: + CHECK( data.str_hello >= "z" ) +with expansion: + "hello" >= "z" +Condition.tests.cpp:<line number> + </failure> + <failure message="CHECK(data.str_hello <= "a")"> +FAILED: + CHECK( data.str_hello <= "a" ) +with expansion: + "hello" <= "a" +Condition.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="Ordering comparison checks that should succeed" duration="{duration}"/> + <testCase name="Pointers can be compared to null" duration="{duration}"/> + <testCase name="comparisons between const int variables" duration="{duration}"/> + <testCase name="comparisons between int variables" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/UsageTests/Decomposition.tests.cpp"> + <testCase name="#1005: Comparing pointer to int and long (NULL can be either on various systems)" duration="{duration}"/> + <testCase name="Reconstruction should be based on stringification: #914" duration="{duration}"> + <failure message="CHECK(truthy(false))"> +FAILED: + CHECK( truthy(false) ) +with expansion: + Hey, its truthy! +Decomposition.tests.cpp:<line number> + </failure> + </testCase> + </file> + <file path="tests/<exe-name>/UsageTests/EnumToString.tests.cpp"> + <testCase name="Enums can quickly have stringification enabled using REGISTER_ENUM" duration="{duration}"/> + <testCase name="Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM" duration="{duration}"/> + <testCase name="toString(enum class w/operator<<)" duration="{duration}"/> + <testCase name="toString(enum class)" duration="{duration}"/> + <testCase name="toString(enum w/operator<<)" duration="{duration}"/> + <testCase name="toString(enum)" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/UsageTests/Exception.tests.cpp"> + <testCase name="#748 - captures with unexpected exceptions/outside assertions" duration="{duration}"> + <skipped message="TEST_CASE()"> +FAILED: +expected exception +answer := 42 +Exception.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="#748 - captures with unexpected exceptions/inside REQUIRE_NOTHROW" duration="{duration}"> + <skipped message="REQUIRE_NOTHROW(thisThrows())"> +FAILED: + REQUIRE_NOTHROW( thisThrows() ) +expected exception +answer := 42 +Exception.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="#748 - captures with unexpected exceptions/inside REQUIRE_THROWS" duration="{duration}"/> + <testCase name="An unchecked exception reports the line of the last assertion" duration="{duration}"> + <error message="({Unknown expression after the reported line})"> +FAILED: + {Unknown expression after the reported line} +unexpected exception +Exception.tests.cpp:<line number> + </error> + </testCase> + <testCase name="Custom exceptions can be translated when testing for nothrow" duration="{duration}"> + <error message="REQUIRE_NOTHROW(throwCustom())"> +FAILED: + REQUIRE_NOTHROW( throwCustom() ) +custom exception - not std +Exception.tests.cpp:<line number> + </error> + </testCase> + <testCase name="Custom exceptions can be translated when testing for throwing as something else" duration="{duration}"> + <error message="REQUIRE_THROWS_AS(throwCustom(), std::exception)"> +FAILED: + REQUIRE_THROWS_AS( throwCustom(), std::exception ) +custom exception - not std +Exception.tests.cpp:<line number> + </error> + </testCase> + <testCase name="Custom std-exceptions can be custom translated" duration="{duration}"> + <error message="TEST_CASE()"> +FAILED: +custom std exception +Exception.tests.cpp:<line number> + </error> + </testCase> + <testCase name="Exception messages can be tested for/exact match" duration="{duration}"/> + <testCase name="Exception messages can be tested for/different case" duration="{duration}"/> + <testCase name="Exception messages can be tested for/wildcarded" duration="{duration}"/> + <testCase name="Expected exceptions that don't throw or unexpected exceptions fail the test" duration="{duration}"> + <error message="CHECK_THROWS_AS(thisThrows(), std::string)"> +FAILED: + CHECK_THROWS_AS( thisThrows(), std::string ) +expected exception +Exception.tests.cpp:<line number> + </error> + <failure message="CHECK_THROWS_AS(thisDoesntThrow(), std::domain_error)"> +FAILED: + CHECK_THROWS_AS( thisDoesntThrow(), std::domain_error ) +Exception.tests.cpp:<line number> + </failure> + <error message="CHECK_NOTHROW(thisThrows())"> +FAILED: + CHECK_NOTHROW( thisThrows() ) +expected exception +Exception.tests.cpp:<line number> + </error> + </testCase> + <testCase name="Mismatching exception messages failing the test" duration="{duration}"> + <failure message="REQUIRE_THROWS_WITH(thisThrows(), "should fail")"> +FAILED: + REQUIRE_THROWS_WITH( thisThrows(), "should fail" ) +with expansion: + "expected exception" equals: "should fail" +Exception.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="Non-std exceptions can be translated" duration="{duration}"> + <error message="TEST_CASE()"> +FAILED: +custom exception +Exception.tests.cpp:<line number> + </error> + </testCase> + <testCase name="Thrown string literals are translated" duration="{duration}"> + <error message="TEST_CASE()"> +FAILED: +For some reason someone is throwing a string literal! +Exception.tests.cpp:<line number> + </error> + </testCase> + <testCase name="Unexpected exceptions can be translated" duration="{duration}"> + <error message="TEST_CASE()"> +FAILED: +3.14 +Exception.tests.cpp:<line number> + </error> + </testCase> + <testCase name="When checked exceptions are thrown they can be expected or unexpected" duration="{duration}"/> + <testCase name="When unchecked exceptions are thrown directly they are always failures" duration="{duration}"> + <error message="TEST_CASE()"> +FAILED: +unexpected exception +Exception.tests.cpp:<line number> + </error> + </testCase> + <testCase name="When unchecked exceptions are thrown during a CHECK the test should continue" duration="{duration}"> + <error message="CHECK(thisThrows() == 0)"> +FAILED: + CHECK( thisThrows() == 0 ) +expected exception +Exception.tests.cpp:<line number> + </error> + </testCase> + <testCase name="When unchecked exceptions are thrown during a REQUIRE the test should abort fail" duration="{duration}"> + <error message="REQUIRE(thisThrows() == 0)"> +FAILED: + REQUIRE( thisThrows() == 0 ) +expected exception +Exception.tests.cpp:<line number> + </error> + </testCase> + <testCase name="When unchecked exceptions are thrown from functions they are always failures" duration="{duration}"> + <error message="CHECK(thisThrows() == 0)"> +FAILED: + CHECK( thisThrows() == 0 ) +expected exception +Exception.tests.cpp:<line number> + </error> + </testCase> + <testCase name="When unchecked exceptions are thrown from sections they are always failures/section name" duration="{duration}"> + <error message="TEST_CASE()"> +FAILED: +unexpected exception +Exception.tests.cpp:<line number> + </error> + </testCase> + <testCase name="thrown std::strings are translated" duration="{duration}"> + <error message="TEST_CASE()"> +FAILED: +Why would you throw a std::string? +Exception.tests.cpp:<line number> + </error> + </testCase> + </file> + <file path="tests/<exe-name>/UsageTests/Generators.tests.cpp"> + <testCase name="#1913 - GENERATE inside a for loop should not keep recreating the generator" duration="{duration}"/> + <testCase name="#1913 - GENERATEs can share a line" duration="{duration}"/> + <testCase name="3x3x3 ints" duration="{duration}"/> + <testCase name="Copy and then generate a range/from var and iterators" duration="{duration}"/> + <testCase name="Copy and then generate a range/From a temporary container" duration="{duration}"/> + <testCase name="Copy and then generate a range/Final validation" duration="{duration}"/> + <testCase name="Generators -- adapters/Filtering by predicate/Basic usage" duration="{duration}"/> + <testCase name="Generators -- adapters/Filtering by predicate/Throws if there are no matching values" duration="{duration}"/> + <testCase name="Generators -- adapters/Shortening a range" duration="{duration}"/> + <testCase name="Generators -- adapters/Transforming elements/Same type" duration="{duration}"/> + <testCase name="Generators -- adapters/Transforming elements/Different type" duration="{duration}"/> + <testCase name="Generators -- adapters/Transforming elements/Different deduced type" duration="{duration}"/> + <testCase name="Generators -- adapters/Repeating a generator" duration="{duration}"/> + <testCase name="Generators -- adapters/Chunking a generator into sized pieces/Number of elements in source is divisible by chunk size" duration="{duration}"/> + <testCase name="Generators -- adapters/Chunking a generator into sized pieces/Number of elements in source is not divisible by chunk size" duration="{duration}"/> + <testCase name="Generators -- adapters/Chunking a generator into sized pieces/Chunk size of zero" duration="{duration}"/> + <testCase name="Generators -- adapters/Chunking a generator into sized pieces/Throws on too small generators" duration="{duration}"/> + <testCase name="Generators -- simple/one" duration="{duration}"/> + <testCase name="Generators -- simple/two" duration="{duration}"/> + <testCase name="Nested generators and captured variables" duration="{duration}"/> + <testCase name="strlen3" duration="{duration}"/> + <testCase name="tables" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/UsageTests/Matchers.tests.cpp"> + <testCase name="Arbitrary predicate matcher/Function pointer" duration="{duration}"/> + <testCase name="Arbitrary predicate matcher/Lambdas + different type" duration="{duration}"/> + <testCase name="Combining MatchAllOfGeneric does not nest" duration="{duration}"/> + <testCase name="Combining MatchAnyOfGeneric does not nest" duration="{duration}"/> + <testCase name="Combining MatchNotOfGeneric does not nest" duration="{duration}"/> + <testCase name="Combining concrete matchers does not use templated matchers" duration="{duration}"/> + <testCase name="Combining only templated matchers" duration="{duration}"/> + <testCase name="Combining templated and concrete matchers" duration="{duration}"/> + <testCase name="Combining templated matchers" duration="{duration}"/> + <testCase name="Composed generic matchers shortcircuit/MatchAllOf" duration="{duration}"/> + <testCase name="Composed generic matchers shortcircuit/MatchAnyOf" duration="{duration}"/> + <testCase name="Composed matchers shortcircuit/MatchAllOf" duration="{duration}"/> + <testCase name="Composed matchers shortcircuit/MatchAnyOf" duration="{duration}"/> + <testCase name="Contains string matcher" duration="{duration}"> + <failure message="CHECK_THAT(testStringForMatching(), Contains("not there", Catch::CaseSensitive::No))"> +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> + </failure> + <failure message="CHECK_THAT(testStringForMatching(), Contains("STRING"))"> +FAILED: + CHECK_THAT( testStringForMatching(), Contains("STRING") ) +with expansion: + "this string contains 'abc' as a substring" contains: "STRING" +Matchers.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="EndsWith string matcher" duration="{duration}"> + <failure message="CHECK_THAT(testStringForMatching(), EndsWith("Substring"))"> +FAILED: + CHECK_THAT( testStringForMatching(), EndsWith("Substring") ) +with expansion: + "this string contains 'abc' as a substring" ends with: "Substring" +Matchers.tests.cpp:<line number> + </failure> + <failure message="CHECK_THAT(testStringForMatching(), EndsWith("this", Catch::CaseSensitive::No))"> +FAILED: + CHECK_THAT( testStringForMatching(), EndsWith("this", Catch::CaseSensitive::No) ) +with expansion: + "this string contains 'abc' as a substring" ends with: "this" (case insensitive) +Matchers.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="Equals" duration="{duration}"/> + <testCase name="Equals string matcher" duration="{duration}"> + <failure message="CHECK_THAT(testStringForMatching(), Equals("this string contains 'ABC' as a substring"))"> +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> + </failure> + <failure message="CHECK_THAT(testStringForMatching(), Equals("something else", Catch::CaseSensitive::No))"> +FAILED: + CHECK_THAT( testStringForMatching(), Equals("something else", Catch::CaseSensitive::No) ) +with expansion: + "this string contains 'abc' as a substring" equals: "something else" (case insensitive) +Matchers.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="Exception matchers that fail/No exception" duration="{duration}"> + <failure message="CHECK_THROWS_MATCHES(doesNotThrow(), SpecialException, ExceptionMatcher{1})"> +FAILED: + CHECK_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{1} ) +Matchers.tests.cpp:<line number> + </failure> + <failure message="REQUIRE_THROWS_MATCHES(doesNotThrow(), SpecialException, ExceptionMatcher{1})"> +FAILED: + REQUIRE_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{1} ) +Matchers.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="Exception matchers that fail/Type mismatch" duration="{duration}"> + <error message="CHECK_THROWS_MATCHES(throwsAsInt(1), SpecialException, ExceptionMatcher{1})"> +FAILED: + CHECK_THROWS_MATCHES( throwsAsInt(1), SpecialException, ExceptionMatcher{1} ) +Unknown exception +Matchers.tests.cpp:<line number> + </error> + <error message="REQUIRE_THROWS_MATCHES(throwsAsInt(1), SpecialException, ExceptionMatcher{1})"> +FAILED: + REQUIRE_THROWS_MATCHES( throwsAsInt(1), SpecialException, ExceptionMatcher{1} ) +Unknown exception +Matchers.tests.cpp:<line number> + </error> + </testCase> + <testCase name="Exception matchers that fail/Contents are wrong" duration="{duration}"> + <failure message="CHECK_THROWS_MATCHES(throwsSpecialException(3), SpecialException, ExceptionMatcher{1})"> +FAILED: + CHECK_THROWS_MATCHES( throwsSpecialException(3), SpecialException, ExceptionMatcher{1} ) +with expansion: + SpecialException::what special exception has value of 1 +Matchers.tests.cpp:<line number> + </failure> + <failure message="REQUIRE_THROWS_MATCHES(throwsSpecialException(4), SpecialException, ExceptionMatcher{1})"> +FAILED: + REQUIRE_THROWS_MATCHES( throwsSpecialException(4), SpecialException, ExceptionMatcher{1} ) +with expansion: + SpecialException::what special exception has value of 1 +Matchers.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="Exception matchers that succeed" duration="{duration}"/> + <testCase name="Exceptions matchers" duration="{duration}"/> + <testCase name="Floating point matchers: double/Relative" duration="{duration}"/> + <testCase name="Floating point matchers: double/Relative/Some subnormal values" duration="{duration}"/> + <testCase name="Floating point matchers: double/Margin" duration="{duration}"/> + <testCase name="Floating point matchers: double/ULPs" duration="{duration}"/> + <testCase name="Floating point matchers: double/Composed" duration="{duration}"/> + <testCase name="Floating point matchers: double/Constructor validation" duration="{duration}"/> + <testCase name="Floating point matchers: float/Relative" duration="{duration}"/> + <testCase name="Floating point matchers: float/Relative/Some subnormal values" duration="{duration}"/> + <testCase name="Floating point matchers: float/Margin" duration="{duration}"/> + <testCase name="Floating point matchers: float/ULPs" duration="{duration}"/> + <testCase name="Floating point matchers: float/Composed" duration="{duration}"/> + <testCase name="Floating point matchers: float/Constructor validation" duration="{duration}"/> + <testCase name="Matchers can be (AllOf) composed with the && operator" duration="{duration}"/> + <testCase name="Matchers can be (AnyOf) composed with the || operator" duration="{duration}"/> + <testCase name="Matchers can be composed with both && and ||" duration="{duration}"/> + <testCase name="Matchers can be composed with both && and || - failing" duration="{duration}"> + <failure message="CHECK_THAT(testStringForMatching(), (Contains("string") || Contains("different")) && Contains("random"))"> +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.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="Matchers can be negated (Not) with the ! operator" duration="{duration}"/> + <testCase name="Matchers can be negated (Not) with the ! operator - failing" duration="{duration}"> + <failure message="CHECK_THAT(testStringForMatching(), !Contains("substring"))"> +FAILED: + CHECK_THAT( testStringForMatching(), !Contains("substring") ) +with expansion: + "this string contains 'abc' as a substring" not contains: "substring" +Matchers.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="Overloaded comma or address-of operators are not used" duration="{duration}"/> + <testCase name="Predicate matcher can accept const char*" duration="{duration}"/> + <testCase name="Regex string matcher" duration="{duration}"> + <failure message="CHECK_THAT(testStringForMatching(), Matches("this STRING contains 'abc' as a substring"))"> +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> + </failure> + <failure message="CHECK_THAT(testStringForMatching(), Matches("contains 'abc' as a substring"))"> +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> + </failure> + <failure message="CHECK_THAT(testStringForMatching(), Matches("this string contains 'abc' as a"))"> +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 +Matchers.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="Regression test #1" duration="{duration}"/> + <testCase name="StartsWith string matcher" duration="{duration}"> + <failure message="CHECK_THAT(testStringForMatching(), StartsWith("This String"))"> +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> + </failure> + <failure message="CHECK_THAT(testStringForMatching(), StartsWith("string", Catch::CaseSensitive::No))"> +FAILED: + CHECK_THAT( testStringForMatching(), StartsWith("string", Catch::CaseSensitive::No) ) +with expansion: + "this string contains 'abc' as a substring" starts with: "string" (case insensitive) +Matchers.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="String matchers" duration="{duration}"/> + <testCase name="Vector Approx matcher/Empty vector is roughly equal to an empty vector" duration="{duration}"/> + <testCase name="Vector Approx matcher/Vectors with elements/A vector is approx equal to itself" duration="{duration}"/> + <testCase name="Vector Approx matcher/Vectors with elements/Different length" duration="{duration}"/> + <testCase name="Vector Approx matcher/Vectors with elements/Same length, different elements" duration="{duration}"/> + <testCase name="Vector Approx matcher -- failing/Empty and non empty vectors are not approx equal" duration="{duration}"> + <failure message="CHECK_THAT(empty, Approx(t1))"> +FAILED: + CHECK_THAT( empty, Approx(t1) ) +with expansion: + { } is approx: { 1.0, 2.0 } +Matchers.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="Vector Approx matcher -- failing/Just different vectors" duration="{duration}"> + <failure message="CHECK_THAT(v1, Approx(v2))"> +FAILED: + CHECK_THAT( v1, Approx(v2) ) +with expansion: + { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 } +Matchers.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="Vector matchers/Contains (element)" duration="{duration}"/> + <testCase name="Vector matchers/Contains (vector)" duration="{duration}"/> + <testCase name="Vector matchers/Contains (element), composed" duration="{duration}"/> + <testCase name="Vector matchers/Equals" duration="{duration}"/> + <testCase name="Vector matchers/UnorderedEquals" duration="{duration}"/> + <testCase name="Vector matchers that fail/Contains (element)" duration="{duration}"> + <failure message="CHECK_THAT(v, VectorContains(-1))"> +FAILED: + CHECK_THAT( v, VectorContains(-1) ) +with expansion: + { 1, 2, 3 } Contains: -1 +Matchers.tests.cpp:<line number> + </failure> + <failure message="CHECK_THAT(empty, VectorContains(1))"> +FAILED: + CHECK_THAT( empty, VectorContains(1) ) +with expansion: + { } Contains: 1 +Matchers.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="Vector matchers that fail/Contains (vector)" duration="{duration}"> + <failure message="CHECK_THAT(empty, Contains(v))"> +FAILED: + CHECK_THAT( empty, Contains(v) ) +with expansion: + { } Contains: { 1, 2, 3 } +Matchers.tests.cpp:<line number> + </failure> + <failure message="CHECK_THAT(v, Contains(v2))"> +FAILED: + CHECK_THAT( v, Contains(v2) ) +with expansion: + { 1, 2, 3 } Contains: { 1, 2, 4 } +Matchers.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="Vector matchers that fail/Equals" duration="{duration}"> + <failure message="CHECK_THAT(v, Equals(v2))"> +FAILED: + CHECK_THAT( v, Equals(v2) ) +with expansion: + { 1, 2, 3 } Equals: { 1, 2 } +Matchers.tests.cpp:<line number> + </failure> + <failure message="CHECK_THAT(v2, Equals(v))"> +FAILED: + CHECK_THAT( v2, Equals(v) ) +with expansion: + { 1, 2 } Equals: { 1, 2, 3 } +Matchers.tests.cpp:<line number> + </failure> + <failure message="CHECK_THAT(empty, Equals(v))"> +FAILED: + CHECK_THAT( empty, Equals(v) ) +with expansion: + { } Equals: { 1, 2, 3 } +Matchers.tests.cpp:<line number> + </failure> + <failure message="CHECK_THAT(v, Equals(empty))"> +FAILED: + CHECK_THAT( v, Equals(empty) ) +with expansion: + { 1, 2, 3 } Equals: { } +Matchers.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="Vector matchers that fail/UnorderedEquals" duration="{duration}"> + <failure message="CHECK_THAT(v, UnorderedEquals(empty))"> +FAILED: + CHECK_THAT( v, UnorderedEquals(empty) ) +with expansion: + { 1, 2, 3 } UnorderedEquals: { } +Matchers.tests.cpp:<line number> + </failure> + <failure message="CHECK_THAT(empty, UnorderedEquals(v))"> +FAILED: + CHECK_THAT( empty, UnorderedEquals(v) ) +with expansion: + { } UnorderedEquals: { 1, 2, 3 } +Matchers.tests.cpp:<line number> + </failure> + <failure message="CHECK_THAT(permuted, UnorderedEquals(v))"> +FAILED: + CHECK_THAT( permuted, UnorderedEquals(v) ) +with expansion: + { 1, 3 } UnorderedEquals: { 1, 2, 3 } +Matchers.tests.cpp:<line number> + </failure> + <failure message="CHECK_THAT(permuted, UnorderedEquals(v))"> +FAILED: + CHECK_THAT( permuted, UnorderedEquals(v) ) +with expansion: + { 3, 1 } UnorderedEquals: { 1, 2, 3 } +Matchers.tests.cpp:<line number> + </failure> + </testCase> + </file> + <file path="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp"> + <testCase name="Basic use of the Contains range matcher/Different argument ranges, same element type, default comparison" duration="{duration}"/> + <testCase name="Basic use of the Contains range matcher/Different argument ranges, same element type, custom comparison" duration="{duration}"/> + <testCase name="Basic use of the Contains range matcher/Different element type, custom comparisons" duration="{duration}"/> + <testCase name="Basic use of the Contains range matcher/Can handle type that requires ADL-found free function begin and end" duration="{duration}"/> + <testCase name="Basic use of the Contains range matcher/Initialization with move only types" duration="{duration}"/> + <testCase name="Basic use of the Contains range matcher/Matching using matcher" duration="{duration}"/> + <testCase name="Basic use of the Empty range matcher/Simple, std-provided containers" duration="{duration}"/> + <testCase name="Basic use of the Empty range matcher/Type with empty" duration="{duration}"/> + <testCase name="Basic use of the Empty range matcher/Type requires ADL found empty free function" duration="{duration}"/> + <testCase name="Usage of AllMatch range matcher/Basic usage" duration="{duration}"/> + <testCase name="Usage of AllMatch range matcher/Type requires ADL found begin and end" duration="{duration}"/> + <testCase name="Usage of AllMatch range matcher/Shortcircuiting/All are read" duration="{duration}"/> + <testCase name="Usage of AllMatch range matcher/Shortcircuiting/Short-circuited" duration="{duration}"/> + <testCase name="Usage of AnyMatch range matcher/Basic usage" duration="{duration}"/> + <testCase name="Usage of AnyMatch range matcher/Type requires ADL found begin and end" duration="{duration}"/> + <testCase name="Usage of AnyMatch range matcher/Shortcircuiting/All are read" duration="{duration}"/> + <testCase name="Usage of AnyMatch range matcher/Shortcircuiting/Short-circuited" duration="{duration}"/> + <testCase name="Usage of NoneMatch range matcher/Basic usage" duration="{duration}"/> + <testCase name="Usage of NoneMatch range matcher/Type requires ADL found begin and end" duration="{duration}"/> + <testCase name="Usage of NoneMatch range matcher/Shortcircuiting/All are read" duration="{duration}"/> + <testCase name="Usage of NoneMatch range matcher/Shortcircuiting/Short-circuited" duration="{duration}"/> + <testCase name="Usage of the SizeIs range matcher/Some with stdlib containers" duration="{duration}"/> + <testCase name="Usage of the SizeIs range matcher/Type requires ADL found size free function" duration="{duration}"/> + <testCase name="Usage of the SizeIs range matcher/Type has size member" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/UsageTests/Message.tests.cpp"> + <testCase name="#1455 - INFO and WARN can start with a linebreak" duration="{duration}"/> + <testCase name="CAPTURE can deal with complex expressions" duration="{duration}"/> + <testCase name="CAPTURE can deal with complex expressions involving commas" duration="{duration}"/> + <testCase name="CAPTURE parses string and character constants" duration="{duration}"/> + <testCase name="FAIL aborts the test" duration="{duration}"> + <failure message="FAIL()"> +FAILED: +This is a failure +Message.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="FAIL does not require an argument" duration="{duration}"> + <failure message="FAIL()"> +FAILED: +Message.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="FAIL_CHECK does not abort the test" duration="{duration}"> + <failure message="FAIL_CHECK()"> +FAILED: +This is a failure +Message.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="INFO and WARN do not abort tests" duration="{duration}"/> + <testCase name="INFO gets logged on failure" duration="{duration}"> + <failure message="REQUIRE(a == 1)"> +FAILED: + REQUIRE( a == 1 ) +with expansion: + 2 == 1 +this message should be logged +so should this +Message.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="INFO gets logged on failure, even if captured before successful assertions" duration="{duration}"> + <failure message="CHECK(a == 1)"> +FAILED: + CHECK( a == 1 ) +with expansion: + 2 == 1 +this message may be logged later +this message should be logged +Message.tests.cpp:<line number> + </failure> + <failure message="CHECK(a == 0)"> +FAILED: + CHECK( a == 0 ) +with expansion: + 2 == 0 +this message may be logged later +this message should be logged +and this, but later +Message.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="INFO is reset for each loop" duration="{duration}"> + <failure message="REQUIRE(i < 10)"> +FAILED: + REQUIRE( i < 10 ) +with expansion: + 10 < 10 +current counter 10 +i := 10 +Message.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="Output from all sections is reported/one" duration="{duration}"> + <failure message="FAIL()"> +FAILED: +Message from section one +Message.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="Output from all sections is reported/two" duration="{duration}"> + <failure message="FAIL()"> +FAILED: +Message from section two +Message.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="SUCCEED counts as a test pass" duration="{duration}"/> + <testCase name="SUCCEED does not require an argument" duration="{duration}"/> + <testCase name="Standard output from all sections is reported/two" duration="{duration}"/> + <testCase name="The NO_FAIL macro reports a failure but does not fail the test" duration="{duration}"/> + <testCase name="just failure" duration="{duration}"> + <failure message="FAIL()"> +FAILED: +Previous info should not be seen +Message.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="just failure after unscoped info" duration="{duration}"> + <failure message="FAIL()"> +FAILED: +previous unscoped info SHOULD not be seen +Message.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="mix info, unscoped info and warning" duration="{duration}"/> + <testCase name="not prints unscoped info from previous failures" duration="{duration}"> + <failure message="REQUIRE(false)"> +FAILED: + REQUIRE( false ) +this SHOULD be seen +Message.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="print unscoped info if passing unscoped info is printed" duration="{duration}"/> + <testCase name="prints unscoped info on failure" duration="{duration}"> + <failure message="REQUIRE(false)"> +FAILED: + REQUIRE( false ) +this SHOULD be seen +this SHOULD also be seen +Message.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="prints unscoped info only for the first assertion" duration="{duration}"> + <failure message="CHECK(false)"> +FAILED: + CHECK( false ) +this SHOULD be seen only ONCE +Message.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="sends information to INFO" duration="{duration}"> + <failure message="REQUIRE(false)"> +FAILED: + REQUIRE( false ) +hi +i := 7 +Message.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="stacks unscoped info in loops" duration="{duration}"> + <failure message="CHECK(false)"> +FAILED: + CHECK( false ) +Count 1 to 3... +1 +2 +3 +Message.tests.cpp:<line number> + </failure> + <failure message="CHECK(false)"> +FAILED: + CHECK( false ) +Count 4 to 6... +4 +5 +6 +Message.tests.cpp:<line number> + </failure> + </testCase> + </file> + <file path="tests/<exe-name>/UsageTests/Misc.tests.cpp"> + <testCase name="# A test name that starts with a #" duration="{duration}"/> + <testCase name="#1175 - Hidden Test" duration="{duration}"/> + <testCase name="#1954 - 7 arg template test case sig compiles - 1, 1, 1, 1, 1, 0, 0" duration="{duration}"/> + <testCase name="#1954 - 7 arg template test case sig compiles - 5, 1, 1, 1, 1, 0, 0" duration="{duration}"/> + <testCase name="#1954 - 7 arg template test case sig compiles - 5, 3, 1, 1, 1, 0, 0" duration="{duration}"/> + <testCase name="#835 -- errno should not be touched by Catch" duration="{duration}"> + <skipped message="CHECK(f() == 0)"> +FAILED: + CHECK( f() == 0 ) +with expansion: + 1 == 0 +Misc.tests.cpp:<line number> + </skipped> + </testCase> + <testCase name="#961 -- Dynamically created sections should all be reported/Looped section 0" duration="{duration}"/> + <testCase name="#961 -- Dynamically created sections should all be reported/Looped section 1" duration="{duration}"/> + <testCase name="#961 -- Dynamically created sections should all be reported/Looped section 2" duration="{duration}"/> + <testCase name="#961 -- Dynamically created sections should all be reported/Looped section 3" duration="{duration}"/> + <testCase name="#961 -- Dynamically created sections should all be reported/Looped section 4" duration="{duration}"/> + <testCase name="A Template product test case - Foo<float>" duration="{duration}"/> + <testCase name="A Template product test case - Foo<int>" duration="{duration}"/> + <testCase name="A Template product test case - std::vector<float>" duration="{duration}"/> + <testCase name="A Template product test case - std::vector<int>" duration="{duration}"/> + <testCase name="A Template product test case with array signature - Bar<float, 42>" duration="{duration}"/> + <testCase name="A Template product test case with array signature - Bar<int, 9>" duration="{duration}"/> + <testCase name="A Template product test case with array signature - std::array<float, 42>" duration="{duration}"/> + <testCase name="A Template product test case with array signature - std::array<int, 9>" duration="{duration}"/> + <testCase name="A couple of nested sections followed by a failure" duration="{duration}"> + <failure message="FAIL()"> +FAILED: +to infinity and beyond +Misc.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="A couple of nested sections followed by a failure/Outer/Inner" duration="{duration}"/> + <testCase name="Factorials are computed" duration="{duration}"/> + <testCase name="ManuallyRegistered" duration="{duration}"/> + <testCase name="Nice descriptive name" duration="{duration}"/> + <testCase name="Product with differing arities - std::tuple<int, double, float>" duration="{duration}"/> + <testCase name="Product with differing arities - std::tuple<int, double>" duration="{duration}"/> + <testCase name="Product with differing arities - std::tuple<int>" duration="{duration}"/> + <testCase name="Sends stuff to stdout and stderr" duration="{duration}"/> + <testCase name="Tabs and newlines show in output" duration="{duration}"> + <failure message="CHECK(s1 == s2)"> +FAILED: + CHECK( s1 == s2 ) +with expansion: + "if ($b == 10) { + $a = 20; +}" +== +"if ($b == 10) { + $a = 20; +} +" +Misc.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="Template test case with test types specified inside non-copyable and non-movable std::tuple - NonCopyableAndNonMovableTypes - 0" duration="{duration}"/> + <testCase name="Template test case with test types specified inside non-copyable and non-movable std::tuple - NonCopyableAndNonMovableTypes - 1" duration="{duration}"/> + <testCase name="Template test case with test types specified inside non-default-constructible std::tuple - MyNonDefaultConstructibleTypes - 0" duration="{duration}"/> + <testCase name="Template test case with test types specified inside non-default-constructible std::tuple - MyNonDefaultConstructibleTypes - 1" duration="{duration}"/> + <testCase name="Template test case with test types specified inside std::tuple - MyTypes - 0" duration="{duration}"/> + <testCase name="Template test case with test types specified inside std::tuple - MyTypes - 1" duration="{duration}"/> + <testCase name="Template test case with test types specified inside std::tuple - MyTypes - 2" duration="{duration}"/> + <testCase name="TemplateTest: vectors can be sized and resized - float" duration="{duration}"/> + <testCase name="TemplateTest: vectors can be sized and resized - float/resizing bigger changes size and capacity" duration="{duration}"/> + <testCase name="TemplateTest: vectors can be sized and resized - float/resizing smaller changes size but not capacity" duration="{duration}"/> + <testCase name="TemplateTest: vectors can be sized and resized - float/resizing smaller changes size but not capacity/We can use the 'swap trick' to reset the capacity" duration="{duration}"/> + <testCase name="TemplateTest: vectors can be sized and resized - float/reserving bigger changes capacity but not size" duration="{duration}"/> + <testCase name="TemplateTest: vectors can be sized and resized - float/reserving smaller does not change size or capacity" duration="{duration}"/> + <testCase name="TemplateTest: vectors can be sized and resized - int" duration="{duration}"/> + <testCase name="TemplateTest: vectors can be sized and resized - int/resizing bigger changes size and capacity" duration="{duration}"/> + <testCase name="TemplateTest: vectors can be sized and resized - int/resizing smaller changes size but not capacity" duration="{duration}"/> + <testCase name="TemplateTest: vectors can be sized and resized - int/resizing smaller changes size but not capacity/We can use the 'swap trick' to reset the capacity" duration="{duration}"/> + <testCase name="TemplateTest: vectors can be sized and resized - int/reserving bigger changes capacity but not size" duration="{duration}"/> + <testCase name="TemplateTest: vectors can be sized and resized - int/reserving smaller does not change size or capacity" duration="{duration}"/> + <testCase name="TemplateTest: vectors can be sized and resized - std::string" duration="{duration}"/> + <testCase name="TemplateTest: vectors can be sized and resized - std::string/resizing bigger changes size and capacity" duration="{duration}"/> + <testCase name="TemplateTest: vectors can be sized and resized - std::string/resizing smaller changes size but not capacity" duration="{duration}"/> + <testCase name="TemplateTest: vectors can be sized and resized - std::string/resizing smaller changes size but not capacity/We can use the 'swap trick' to reset the capacity" duration="{duration}"/> + <testCase name="TemplateTest: vectors can be sized and resized - std::string/reserving bigger changes capacity but not size" duration="{duration}"/> + <testCase name="TemplateTest: vectors can be sized and resized - std::string/reserving smaller does not change size or capacity" duration="{duration}"/> + <testCase name="TemplateTest: vectors can be sized and resized - std::tuple<int,float>" duration="{duration}"/> + <testCase name="TemplateTest: vectors can be sized and resized - std::tuple<int,float>/resizing bigger changes size and capacity" duration="{duration}"/> + <testCase name="TemplateTest: vectors can be sized and resized - std::tuple<int,float>/resizing smaller changes size but not capacity" duration="{duration}"/> + <testCase name="TemplateTest: vectors can be sized and resized - std::tuple<int,float>/resizing smaller changes size but not capacity/We can use the 'swap trick' to reset the capacity" duration="{duration}"/> + <testCase name="TemplateTest: vectors can be sized and resized - std::tuple<int,float>/reserving bigger changes capacity but not size" duration="{duration}"/> + <testCase name="TemplateTest: vectors can be sized and resized - std::tuple<int,float>/reserving smaller does not change size or capacity" duration="{duration}"/> + <testCase name="TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6" duration="{duration}"/> + <testCase name="TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6/resizing bigger changes size and capacity" duration="{duration}"/> + <testCase name="TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6/resizing smaller changes size but not capacity" duration="{duration}"/> + <testCase name="TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6/resizing smaller changes size but not capacity/We can use the 'swap trick' to reset the capacity" duration="{duration}"/> + <testCase name="TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6/reserving bigger changes capacity but not size" duration="{duration}"/> + <testCase name="TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6/reserving smaller does not change size or capacity" duration="{duration}"/> + <testCase name="TemplateTestSig: vectors can be sized and resized - float,4" duration="{duration}"/> + <testCase name="TemplateTestSig: vectors can be sized and resized - float,4/resizing bigger changes size and capacity" duration="{duration}"/> + <testCase name="TemplateTestSig: vectors can be sized and resized - float,4/resizing smaller changes size but not capacity" duration="{duration}"/> + <testCase name="TemplateTestSig: vectors can be sized and resized - float,4/resizing smaller changes size but not capacity/We can use the 'swap trick' to reset the capacity" duration="{duration}"/> + <testCase name="TemplateTestSig: vectors can be sized and resized - float,4/reserving bigger changes capacity but not size" duration="{duration}"/> + <testCase name="TemplateTestSig: vectors can be sized and resized - float,4/reserving smaller does not change size or capacity" duration="{duration}"/> + <testCase name="TemplateTestSig: vectors can be sized and resized - int,5" duration="{duration}"/> + <testCase name="TemplateTestSig: vectors can be sized and resized - int,5/resizing bigger changes size and capacity" duration="{duration}"/> + <testCase name="TemplateTestSig: vectors can be sized and resized - int,5/resizing smaller changes size but not capacity" duration="{duration}"/> + <testCase name="TemplateTestSig: vectors can be sized and resized - int,5/resizing smaller changes size but not capacity/We can use the 'swap trick' to reset the capacity" duration="{duration}"/> + <testCase name="TemplateTestSig: vectors can be sized and resized - int,5/reserving bigger changes capacity but not size" duration="{duration}"/> + <testCase name="TemplateTestSig: vectors can be sized and resized - int,5/reserving smaller does not change size or capacity" duration="{duration}"/> + <testCase name="TemplateTestSig: vectors can be sized and resized - std::string,15" duration="{duration}"/> + <testCase name="TemplateTestSig: vectors can be sized and resized - std::string,15/resizing bigger changes size and capacity" duration="{duration}"/> + <testCase name="TemplateTestSig: vectors can be sized and resized - std::string,15/resizing smaller changes size but not capacity" duration="{duration}"/> + <testCase name="TemplateTestSig: vectors can be sized and resized - std::string,15/resizing smaller changes size but not capacity/We can use the 'swap trick' to reset the capacity" duration="{duration}"/> + <testCase name="TemplateTestSig: vectors can be sized and resized - std::string,15/reserving bigger changes capacity but not size" duration="{duration}"/> + <testCase name="TemplateTestSig: vectors can be sized and resized - std::string,15/reserving smaller does not change size or capacity" duration="{duration}"/> + <testCase name="This test 'should' fail but doesn't" duration="{duration}"/> + <testCase name="atomic if" duration="{duration}"/> + <testCase name="checkedElse" duration="{duration}"/> + <testCase name="checkedElse, failing" duration="{duration}"> + <failure message="CHECKED_ELSE(flag)"> +FAILED: + CHECKED_ELSE( flag ) +with expansion: + false +Misc.tests.cpp:<line number> + </failure> + <failure message="REQUIRE(testCheckedElse( false ))"> +FAILED: + REQUIRE( testCheckedElse( false ) ) +with expansion: + false +Misc.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="checkedIf" duration="{duration}"/> + <testCase name="checkedIf, failing" duration="{duration}"> + <failure message="CHECKED_IF(flag)"> +FAILED: + CHECKED_IF( flag ) +with expansion: + false +Misc.tests.cpp:<line number> + </failure> + <failure message="REQUIRE(testCheckedIf( false ))"> +FAILED: + REQUIRE( testCheckedIf( false ) ) +with expansion: + false +Misc.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="even more nested SECTION tests/c/d (leaf)" duration="{duration}"/> + <testCase name="even more nested SECTION tests/c/e (leaf)" duration="{duration}"/> + <testCase name="even more nested SECTION tests/f (leaf)" duration="{duration}"/> + <testCase name="long long" duration="{duration}"/> + <testCase name="looped SECTION tests/b is currently: 0" duration="{duration}"> + <failure message="CHECK(b > a)"> +FAILED: + CHECK( b > a ) +with expansion: + 0 > 1 +Misc.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="looped SECTION tests/b is currently: 1" duration="{duration}"> + <failure message="CHECK(b > a)"> +FAILED: + CHECK( b > a ) +with expansion: + 1 > 1 +Misc.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="looped SECTION tests/b is currently: 2" duration="{duration}"/> + <testCase name="looped SECTION tests/b is currently: 3" duration="{duration}"/> + <testCase name="looped SECTION tests/b is currently: 4" duration="{duration}"/> + <testCase name="looped SECTION tests/b is currently: 5" duration="{duration}"/> + <testCase name="looped SECTION tests/b is currently: 6" duration="{duration}"/> + <testCase name="looped SECTION tests/b is currently: 7" duration="{duration}"/> + <testCase name="looped SECTION tests/b is currently: 8" duration="{duration}"/> + <testCase name="looped SECTION tests/b is currently: 9" duration="{duration}"/> + <testCase name="looped tests" duration="{duration}"> + <failure message="CHECK(( fib[i] % 2 ) == 0)"> +FAILED: + CHECK( ( fib[i] % 2 ) == 0 ) +with expansion: + 1 == 0 +Testing if fib[0] (1) is even +Misc.tests.cpp:<line number> + </failure> + <failure message="CHECK(( fib[i] % 2 ) == 0)"> +FAILED: + CHECK( ( fib[i] % 2 ) == 0 ) +with expansion: + 1 == 0 +Testing if fib[1] (1) is even +Misc.tests.cpp:<line number> + </failure> + <failure message="CHECK(( fib[i] % 2 ) == 0)"> +FAILED: + CHECK( ( fib[i] % 2 ) == 0 ) +with expansion: + 1 == 0 +Testing if fib[3] (3) is even +Misc.tests.cpp:<line number> + </failure> + <failure message="CHECK(( fib[i] % 2 ) == 0)"> +FAILED: + CHECK( ( fib[i] % 2 ) == 0 ) +with expansion: + 1 == 0 +Testing if fib[4] (5) is even +Misc.tests.cpp:<line number> + </failure> + <failure message="CHECK(( fib[i] % 2 ) == 0)"> +FAILED: + CHECK( ( fib[i] % 2 ) == 0 ) +with expansion: + 1 == 0 +Testing if fib[6] (13) is even +Misc.tests.cpp:<line number> + </failure> + <failure message="CHECK(( fib[i] % 2 ) == 0)"> +FAILED: + CHECK( ( fib[i] % 2 ) == 0 ) +with expansion: + 1 == 0 +Testing if fib[7] (21) is even +Misc.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="more nested SECTION tests/equal/doesn't equal" duration="{duration}"> + <failure message="REQUIRE(a == b)"> +FAILED: + REQUIRE( a == b ) +with expansion: + 1 == 2 +Misc.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="more nested SECTION tests/doesn't equal/not equal" duration="{duration}"/> + <testCase name="more nested SECTION tests/doesn't equal/less than" duration="{duration}"/> + <testCase name="nested SECTION tests/doesn't equal" duration="{duration}"/> + <testCase name="nested SECTION tests/doesn't equal/not equal" duration="{duration}"/> + <testCase name="not allowed" duration="{duration}"/> + <testCase name="null strings" duration="{duration}"/> + <testCase name="random SECTION tests/doesn't equal" duration="{duration}"/> + <testCase name="random SECTION tests/not equal" duration="{duration}"/> + <testCase name="send a single char to INFO" duration="{duration}"> + <failure message="REQUIRE(false)"> +FAILED: + REQUIRE( false ) +3 +Misc.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="toString on const wchar_t const pointer returns the string contents" duration="{duration}"/> + <testCase name="toString on const wchar_t pointer returns the string contents" duration="{duration}"/> + <testCase name="toString on wchar_t const pointer returns the string contents" duration="{duration}"/> + <testCase name="toString on wchar_t returns the string contents" duration="{duration}"/> + <testCase name="vectors can be sized and resized" duration="{duration}"/> + <testCase name="vectors can be sized and resized/resizing bigger changes size and capacity" duration="{duration}"/> + <testCase name="vectors can be sized and resized/resizing smaller changes size but not capacity" duration="{duration}"/> + <testCase name="vectors can be sized and resized/resizing smaller changes size but not capacity/We can use the 'swap trick' to reset the capacity" duration="{duration}"/> + <testCase name="vectors can be sized and resized/reserving bigger changes capacity but not size" duration="{duration}"/> + <testCase name="vectors can be sized and resized/reserving smaller does not change size or capacity" duration="{duration}"/> + <testCase name="xmlentitycheck/embedded xml: <test>it should be possible to embed xml characters, such as <, " or &, or even whole <xml>documents</xml> within an attribute</test>" duration="{duration}"/> + <testCase name="xmlentitycheck/encoded chars: these should all be encoded: &&&"""<<<&"<<&"" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/UsageTests/ToStringChrono.tests.cpp"> + <testCase name="Stringifying std::chrono::duration helpers" duration="{duration}"/> + <testCase name="Stringifying std::chrono::duration with weird ratios" duration="{duration}"/> + <testCase name="Stringifying std::chrono::time_point<system_clock>" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp"> + <testCase name="Capture and info messages/Capture should stringify like assertions" duration="{duration}"/> + <testCase name="Capture and info messages/Info should NOT stringify the way assertions do" duration="{duration}"/> + <testCase name="Character pretty printing/Specifically escaped" duration="{duration}"/> + <testCase name="Character pretty printing/General chars" duration="{duration}"/> + <testCase name="Character pretty printing/Low ASCII" duration="{duration}"/> + <testCase name="Exception as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified" duration="{duration}"/> + <testCase name="Precision of floating point stringification can be set/Floats" duration="{duration}"/> + <testCase name="Precision of floating point stringification can be set/Double" duration="{duration}"/> + <testCase name="Static arrays are convertible to string/Single item" duration="{duration}"/> + <testCase name="Static arrays are convertible to string/Multiple" duration="{duration}"/> + <testCase name="Static arrays are convertible to string/Non-trivial inner items" duration="{duration}"/> + <testCase name="std::map is convertible string/empty" duration="{duration}"/> + <testCase name="std::map is convertible string/single item" duration="{duration}"/> + <testCase name="std::map is convertible string/several items" duration="{duration}"/> + <testCase name="std::set is convertible string/empty" duration="{duration}"/> + <testCase name="std::set is convertible string/single item" duration="{duration}"/> + <testCase name="std::set is convertible string/several items" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/UsageTests/ToStringPair.tests.cpp"> + <testCase name="pair<pair<int,const char *,pair<std::string,int> > -> toString" duration="{duration}"/> + <testCase name="std::pair<int,const std::string> -> toString" duration="{duration}"/> + <testCase name="std::pair<int,std::string> -> toString" duration="{duration}"/> + <testCase name="std::vector<std::pair<std::string,int> > -> toString" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/UsageTests/ToStringTuple.tests.cpp"> + <testCase name="tuple<>" duration="{duration}"/> + <testCase name="tuple<float,int>" duration="{duration}"/> + <testCase name="tuple<int>" duration="{duration}"/> + <testCase name="tuple<0,int,const char *>" duration="{duration}"/> + <testCase name="tuple<string,string>" duration="{duration}"/> + <testCase name="tuple<tuple<int>,tuple<>,float>" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp"> + <testCase name="array<int, N> -> toString" duration="{duration}"/> + <testCase name="vec<vec<string,alloc>> -> toString" duration="{duration}"/> + <testCase name="vector<bool> -> toString" duration="{duration}"/> + <testCase name="vector<int,allocator> -> toString" duration="{duration}"/> + <testCase name="vector<int> -> toString" duration="{duration}"/> + <testCase name="vector<string> -> toString" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp"> + <testCase name="stringify ranges" duration="{duration}"/> + <testCase name="stringify( has_maker )" duration="{duration}"/> + <testCase name="stringify( has_maker_and_operator )" duration="{duration}"/> + <testCase name="stringify( has_neither )" duration="{duration}"/> + <testCase name="stringify( has_operator )" duration="{duration}"/> + <testCase name="stringify( has_template_operator )" duration="{duration}"/> + <testCase name="stringify( vectors<has_maker> )" duration="{duration}"/> + <testCase name="stringify( vectors<has_maker_and_operator> )" duration="{duration}"/> + <testCase name="stringify( vectors<has_operator> )" duration="{duration}"/> + </file> + <file path="tests/<exe-name>/UsageTests/Tricky.tests.cpp"> + <testCase name="#1514: stderr/stdout is not captured in tests aborted by an exception" duration="{duration}"> + <failure message="FAIL()"> +FAILED: +1514 +Tricky.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="(unimplemented) static bools can be evaluated/compare to true" duration="{duration}"/> + <testCase name="(unimplemented) static bools can be evaluated/compare to false" duration="{duration}"/> + <testCase name="(unimplemented) static bools can be evaluated/negation" duration="{duration}"/> + <testCase name="(unimplemented) static bools can be evaluated/double negation" duration="{duration}"/> + <testCase name="(unimplemented) static bools can be evaluated/direct" duration="{duration}"/> + <testCase name="A failing expression with a non streamable type is still captured" duration="{duration}"> + <failure message="CHECK(&o1 == &o2)"> +FAILED: + CHECK( &o1 == &o2 ) +with expansion: + 0x<hex digits> == 0x<hex digits> +Tricky.tests.cpp:<line number> + </failure> + <failure message="CHECK(o1 == o2)"> +FAILED: + CHECK( o1 == o2 ) +with expansion: + {?} == {?} +Tricky.tests.cpp:<line number> + </failure> + </testCase> + <testCase name="An expression with side-effects should only be evaluated once" duration="{duration}"/> + <testCase name="Assertions then sections" duration="{duration}"/> + <testCase name="Assertions then sections/A section" duration="{duration}"/> + <testCase name="Assertions then sections/A section/Another section" duration="{duration}"/> + <testCase name="Assertions then sections/A section/Another other section" duration="{duration}"/> + <testCase name="Commas in various macros are allowed" duration="{duration}"/> + <testCase name="Comparing function pointers" duration="{duration}"/> + <testCase name="Objects that evaluated in boolean contexts can be checked" duration="{duration}"/> + <testCase name="Test enum bit values" duration="{duration}"/> + <testCase name="Where the LHS is not a simple value" duration="{duration}"/> + <testCase name="Where there is more to the expression after the RHS" duration="{duration}"/> + <testCase name="X/level/0/a" duration="{duration}"/> + <testCase name="X/level/0/b" duration="{duration}"/> + <testCase name="X/level/1/a" duration="{duration}"/> + <testCase name="X/level/1/b" duration="{duration}"/> + <testCase name="boolean member" duration="{duration}"/> + <testCase name="non streamable - with conv. op" duration="{duration}"/> + <testCase name="non-copyable objects" duration="{duration}"/> + <testCase name="null_ptr" duration="{duration}"/> + <testCase name="pointer to class" duration="{duration}"/> + <testCase name="string literals of different sizes can be compared" duration="{duration}"> + <failure message="REQUIRE(std::string( "first" ) == "second")"> +FAILED: + REQUIRE( std::string( "first" ) == "second" ) +with expansion: + "first" == "second" +Tricky.tests.cpp:<line number> + </failure> + </testCase> + </file> + <file path="tests/<exe-name>/UsageTests/VariadicMacros.tests.cpp"> + <testCase name="Anonymous test case 1" duration="{duration}"/> + <testCase name="Test case with one argument" duration="{duration}"/> + <testCase name="Variadic macros/Section with one argument" duration="{duration}"/> + </file> +</testExecutions> diff --git a/packages/Catch2/tests/SelfTest/Baselines/tap.sw.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/tap.sw.approved.txt new file mode 100644 index 0000000000000000000000000000000000000000..edf6d1ed9517ed4aff1e95760065b455c70c9222 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/Baselines/tap.sw.approved.txt @@ -0,0 +1,4206 @@ +# # A test name that starts with a # +ok {test-number} - with 1 message: 'yay' +# #1005: Comparing pointer to int and long (NULL can be either on various systems) +ok {test-number} - fptr == 0 for: 0 == 0 +# #1005: Comparing pointer to int and long (NULL can be either on various systems) +ok {test-number} - fptr == 0l for: 0 == 0 +# #1027: Bitfields can be captured +ok {test-number} - y.v == 0 for: 0 == 0 +# #1027: Bitfields can be captured +ok {test-number} - 0 == y.v for: 0 == 0 +# #1147 +ok {test-number} - t1 == t2 for: {?} == {?} +# #1147 +ok {test-number} - t1 != t2 for: {?} != {?} +# #1147 +ok {test-number} - t1 < t2 for: {?} < {?} +# #1147 +ok {test-number} - t1 > t2 for: {?} > {?} +# #1147 +ok {test-number} - t1 <= t2 for: {?} <= {?} +# #1147 +ok {test-number} - t1 >= t2 for: {?} >= {?} +# #1175 - Hidden Test +ok {test-number} - +# #1238 +ok {test-number} - std::memcmp(uarr, "123", sizeof(uarr)) == 0 for: 0 == 0 with 2 messages: 'uarr := "123"' and 'sarr := "456"' +# #1238 +ok {test-number} - std::memcmp(sarr, "456", sizeof(sarr)) == 0 for: 0 == 0 with 2 messages: 'uarr := "123"' and 'sarr := "456"' +# #1245 +ok {test-number} - +# #1319: Sections can have description (even if it is not saved +ok {test-number} - +# #1403 +ok {test-number} - h1 == h2 for: [1403 helper] == [1403 helper] +# #1455 - INFO and WARN can start with a linebreak +warning {test-number} - ' +This info message starts with a linebreak' with 1 message: ' +This warning message starts with a linebreak' +This would not be caught previously +Nor would this +# #1514: stderr/stdout is not captured in tests aborted by an exception +not ok {test-number} - explicitly with 1 message: '1514' +# #1548 +ok {test-number} - std::is_same<TypeList<int>, TypeList<int>>::value for: true +# #1905 -- test spec parser properly clears internal state between compound tests +ok {test-number} - spec.matches(*fakeTestCase("spec . char")) for: true +# #1905 -- test spec parser properly clears internal state between compound tests +ok {test-number} - spec.matches(*fakeTestCase("spec , char")) for: true +# #1905 -- test spec parser properly clears internal state between compound tests +ok {test-number} - !(spec.matches(*fakeTestCase(R"(spec \, char)"))) for: !false +# #1912 -- test spec parser handles escaping +ok {test-number} - spec.matches(*fakeTestCase(R"(spec {a} char)")) for: true +# #1912 -- test spec parser handles escaping +ok {test-number} - spec.matches(*fakeTestCase(R"(spec [a] char)")) for: true +# #1912 -- test spec parser handles escaping +ok {test-number} - !(spec.matches(*fakeTestCase("differs but has similar tag", "[a]"))) for: !false +# #1912 -- test spec parser handles escaping +ok {test-number} - spec.matches(*fakeTestCase(R"(spec \ char)")) for: true +# #1913 - GENERATE inside a for loop should not keep recreating the generator +ok {test-number} - counter < 7 for: 3 < 7 +# #1913 - GENERATE inside a for loop should not keep recreating the generator +ok {test-number} - counter < 7 for: 6 < 7 +# #1913 - GENERATEs can share a line +ok {test-number} - i != j for: 1 != 3 +# #1913 - GENERATEs can share a line +ok {test-number} - i != j for: 1 != 4 +# #1913 - GENERATEs can share a line +ok {test-number} - i != j for: 2 != 3 +# #1913 - GENERATEs can share a line +ok {test-number} - i != j for: 2 != 4 +# #1938 - GENERATE after a section +ok {test-number} - with 1 message: 'A' +# #1938 - GENERATE after a section +ok {test-number} - m for: 1 +# #1938 - GENERATE after a section +ok {test-number} - m for: 2 +# #1938 - GENERATE after a section +ok {test-number} - m for: 3 +# #1938 - Section followed by flat generate +ok {test-number} - 1 +# #1938 - Section followed by flat generate +ok {test-number} - m for: 2 +# #1938 - Section followed by flat generate +ok {test-number} - m for: 3 +# #1938 - flat generate +ok {test-number} - m for: 1 +# #1938 - flat generate +ok {test-number} - m for: 2 +# #1938 - flat generate +ok {test-number} - m for: 3 +# #1938 - mixed sections and generates +ok {test-number} - with 1 message: 'A' +# #1938 - mixed sections and generates +ok {test-number} - with 3 messages: 'i := 1' and 'j := 3' and 'k := 5' +# #1938 - mixed sections and generates +ok {test-number} - with 1 message: 'B' +# #1938 - mixed sections and generates +ok {test-number} - with 3 messages: 'i := 1' and 'j := 3' and 'k := 6' +# #1938 - mixed sections and generates +ok {test-number} - with 1 message: 'B' +# #1938 - mixed sections and generates +ok {test-number} - with 3 messages: 'i := 1' and 'j := 4' and 'k := 5' +# #1938 - mixed sections and generates +ok {test-number} - with 3 messages: 'i := 1' and 'j := 4' and 'k := 6' +# #1938 - mixed sections and generates +ok {test-number} - with 1 message: 'A' +# #1938 - mixed sections and generates +ok {test-number} - with 3 messages: 'i := 2' and 'j := 3' and 'k := 5' +# #1938 - mixed sections and generates +ok {test-number} - with 1 message: 'B' +# #1938 - mixed sections and generates +ok {test-number} - with 3 messages: 'i := 2' and 'j := 3' and 'k := 6' +# #1938 - mixed sections and generates +ok {test-number} - with 1 message: 'B' +# #1938 - mixed sections and generates +ok {test-number} - with 3 messages: 'i := 2' and 'j := 4' and 'k := 5' +# #1938 - mixed sections and generates +ok {test-number} - with 3 messages: 'i := 2' and 'j := 4' and 'k := 6' +# #1938 - nested generate +ok {test-number} - m for: 1 +# #1938 - nested generate +ok {test-number} - n for: 1 +# #1938 - nested generate +ok {test-number} - m for: 1 +# #1938 - nested generate +ok {test-number} - n for: 2 +# #1938 - nested generate +ok {test-number} - m for: 1 +# #1938 - nested generate +ok {test-number} - n for: 3 +# #1938 - nested generate +ok {test-number} - m for: 2 +# #1938 - nested generate +ok {test-number} - n for: 1 +# #1938 - nested generate +ok {test-number} - m for: 2 +# #1938 - nested generate +ok {test-number} - n for: 2 +# #1938 - nested generate +ok {test-number} - m for: 2 +# #1938 - nested generate +ok {test-number} - n for: 3 +# #1938 - nested generate +ok {test-number} - m for: 3 +# #1938 - nested generate +ok {test-number} - n for: 1 +# #1938 - nested generate +ok {test-number} - m for: 3 +# #1938 - nested generate +ok {test-number} - n for: 2 +# #1938 - nested generate +ok {test-number} - m for: 3 +# #1938 - nested generate +ok {test-number} - n for: 3 +# #1954 - 7 arg template test case sig compiles - 1, 1, 1, 1, 1, 0, 0 +ok {test-number} - +# #1954 - 7 arg template test case sig compiles - 5, 1, 1, 1, 1, 0, 0 +ok {test-number} - +# #1954 - 7 arg template test case sig compiles - 5, 3, 1, 1, 1, 0, 0 +ok {test-number} - +# #748 - captures with unexpected exceptions +not ok {test-number} - unexpected exception with message: 'answer := 42' with 1 message: 'expected exception' +# #748 - captures with unexpected exceptions +not ok {test-number} - unexpected exception with message: 'answer := 42'; expression was: thisThrows() with 1 message: 'expected exception' +# #748 - captures with unexpected exceptions +ok {test-number} - thisThrows() with 1 message: 'answer := 42' +# #809 +ok {test-number} - 42 == f for: 42 == {?} +# #833 +ok {test-number} - a == t for: 3 == 3 +# #833 +ok {test-number} - a == t for: 3 == 3 +# #833 +ok {test-number} - throws_int(true) +# #833 +ok {test-number} - throws_int(true), int +# #833 +ok {test-number} - throws_int(false) +# #833 +ok {test-number} - "aaa", Catch::Matchers::EndsWith("aaa") for: "aaa" ends with: "aaa" +# #833 +ok {test-number} - templated_tests<int>(3) for: true +# #835 -- errno should not be touched by Catch +not ok {test-number} - f() == 0 for: 1 == 0 +# #835 -- errno should not be touched by Catch +ok {test-number} - errno == 1 for: 1 == 1 +# #872 +ok {test-number} - x == 4 for: {?} == 4 with 1 message: 'dummy := 0' +# #961 -- Dynamically created sections should all be reported +ok {test-number} - with 1 message: 'Everything is OK' +# #961 -- Dynamically created sections should all be reported +ok {test-number} - with 1 message: 'Everything is OK' +# #961 -- Dynamically created sections should all be reported +ok {test-number} - with 1 message: 'Everything is OK' +# #961 -- Dynamically created sections should all be reported +ok {test-number} - with 1 message: 'Everything is OK' +# #961 -- Dynamically created sections should all be reported +ok {test-number} - with 1 message: 'Everything is OK' +# 'Not' checks that should fail +not ok {test-number} - false != false +# 'Not' checks that should fail +not ok {test-number} - true != true +# 'Not' checks that should fail +not ok {test-number} - !true for: false +# 'Not' checks that should fail +not ok {test-number} - !(true) for: !true +# 'Not' checks that should fail +not ok {test-number} - !trueValue for: false +# 'Not' checks that should fail +not ok {test-number} - !(trueValue) for: !true +# 'Not' checks that should fail +not ok {test-number} - !(1 == 1) for: false +# 'Not' checks that should fail +not ok {test-number} - !(1 == 1) +# 'Not' checks that should succeed +ok {test-number} - false == false +# 'Not' checks that should succeed +ok {test-number} - true == true +# 'Not' checks that should succeed +ok {test-number} - !false for: true +# 'Not' checks that should succeed +ok {test-number} - !(false) for: !false +# 'Not' checks that should succeed +ok {test-number} - !falseValue for: true +# 'Not' checks that should succeed +ok {test-number} - !(falseValue) for: !false +# 'Not' checks that should succeed +ok {test-number} - !(1 == 2) for: true +# 'Not' checks that should succeed +ok {test-number} - !(1 == 2) +# (unimplemented) static bools can be evaluated +ok {test-number} - is_true<true>::value == true for: true == true +# (unimplemented) static bools can be evaluated +ok {test-number} - true == is_true<true>::value for: true == true +# (unimplemented) static bools can be evaluated +ok {test-number} - is_true<false>::value == false for: false == false +# (unimplemented) static bools can be evaluated +ok {test-number} - false == is_true<false>::value for: false == false +# (unimplemented) static bools can be evaluated +ok {test-number} - !is_true<false>::value for: true +# (unimplemented) static bools can be evaluated +ok {test-number} - !!is_true<true>::value for: true +# (unimplemented) static bools can be evaluated +ok {test-number} - is_true<true>::value for: true +# (unimplemented) static bools can be evaluated +ok {test-number} - !(is_true<false>::value) for: !false +# 3x3x3 ints +ok {test-number} - x < y for: 1 < 4 +# 3x3x3 ints +ok {test-number} - y < z for: 4 < 7 +# 3x3x3 ints +ok {test-number} - x < z for: 1 < 7 +# 3x3x3 ints +ok {test-number} - x < y for: 1 < 4 +# 3x3x3 ints +ok {test-number} - y < z for: 4 < 8 +# 3x3x3 ints +ok {test-number} - x < z for: 1 < 8 +# 3x3x3 ints +ok {test-number} - x < y for: 1 < 4 +# 3x3x3 ints +ok {test-number} - y < z for: 4 < 9 +# 3x3x3 ints +ok {test-number} - x < z for: 1 < 9 +# 3x3x3 ints +ok {test-number} - x < y for: 1 < 5 +# 3x3x3 ints +ok {test-number} - y < z for: 5 < 7 +# 3x3x3 ints +ok {test-number} - x < z for: 1 < 7 +# 3x3x3 ints +ok {test-number} - x < y for: 1 < 5 +# 3x3x3 ints +ok {test-number} - y < z for: 5 < 8 +# 3x3x3 ints +ok {test-number} - x < z for: 1 < 8 +# 3x3x3 ints +ok {test-number} - x < y for: 1 < 5 +# 3x3x3 ints +ok {test-number} - y < z for: 5 < 9 +# 3x3x3 ints +ok {test-number} - x < z for: 1 < 9 +# 3x3x3 ints +ok {test-number} - x < y for: 1 < 6 +# 3x3x3 ints +ok {test-number} - y < z for: 6 < 7 +# 3x3x3 ints +ok {test-number} - x < z for: 1 < 7 +# 3x3x3 ints +ok {test-number} - x < y for: 1 < 6 +# 3x3x3 ints +ok {test-number} - y < z for: 6 < 8 +# 3x3x3 ints +ok {test-number} - x < z for: 1 < 8 +# 3x3x3 ints +ok {test-number} - x < y for: 1 < 6 +# 3x3x3 ints +ok {test-number} - y < z for: 6 < 9 +# 3x3x3 ints +ok {test-number} - x < z for: 1 < 9 +# 3x3x3 ints +ok {test-number} - x < y for: 2 < 4 +# 3x3x3 ints +ok {test-number} - y < z for: 4 < 7 +# 3x3x3 ints +ok {test-number} - x < z for: 2 < 7 +# 3x3x3 ints +ok {test-number} - x < y for: 2 < 4 +# 3x3x3 ints +ok {test-number} - y < z for: 4 < 8 +# 3x3x3 ints +ok {test-number} - x < z for: 2 < 8 +# 3x3x3 ints +ok {test-number} - x < y for: 2 < 4 +# 3x3x3 ints +ok {test-number} - y < z for: 4 < 9 +# 3x3x3 ints +ok {test-number} - x < z for: 2 < 9 +# 3x3x3 ints +ok {test-number} - x < y for: 2 < 5 +# 3x3x3 ints +ok {test-number} - y < z for: 5 < 7 +# 3x3x3 ints +ok {test-number} - x < z for: 2 < 7 +# 3x3x3 ints +ok {test-number} - x < y for: 2 < 5 +# 3x3x3 ints +ok {test-number} - y < z for: 5 < 8 +# 3x3x3 ints +ok {test-number} - x < z for: 2 < 8 +# 3x3x3 ints +ok {test-number} - x < y for: 2 < 5 +# 3x3x3 ints +ok {test-number} - y < z for: 5 < 9 +# 3x3x3 ints +ok {test-number} - x < z for: 2 < 9 +# 3x3x3 ints +ok {test-number} - x < y for: 2 < 6 +# 3x3x3 ints +ok {test-number} - y < z for: 6 < 7 +# 3x3x3 ints +ok {test-number} - x < z for: 2 < 7 +# 3x3x3 ints +ok {test-number} - x < y for: 2 < 6 +# 3x3x3 ints +ok {test-number} - y < z for: 6 < 8 +# 3x3x3 ints +ok {test-number} - x < z for: 2 < 8 +# 3x3x3 ints +ok {test-number} - x < y for: 2 < 6 +# 3x3x3 ints +ok {test-number} - y < z for: 6 < 9 +# 3x3x3 ints +ok {test-number} - x < z for: 2 < 9 +# 3x3x3 ints +ok {test-number} - x < y for: 3 < 4 +# 3x3x3 ints +ok {test-number} - y < z for: 4 < 7 +# 3x3x3 ints +ok {test-number} - x < z for: 3 < 7 +# 3x3x3 ints +ok {test-number} - x < y for: 3 < 4 +# 3x3x3 ints +ok {test-number} - y < z for: 4 < 8 +# 3x3x3 ints +ok {test-number} - x < z for: 3 < 8 +# 3x3x3 ints +ok {test-number} - x < y for: 3 < 4 +# 3x3x3 ints +ok {test-number} - y < z for: 4 < 9 +# 3x3x3 ints +ok {test-number} - x < z for: 3 < 9 +# 3x3x3 ints +ok {test-number} - x < y for: 3 < 5 +# 3x3x3 ints +ok {test-number} - y < z for: 5 < 7 +# 3x3x3 ints +ok {test-number} - x < z for: 3 < 7 +# 3x3x3 ints +ok {test-number} - x < y for: 3 < 5 +# 3x3x3 ints +ok {test-number} - y < z for: 5 < 8 +# 3x3x3 ints +ok {test-number} - x < z for: 3 < 8 +# 3x3x3 ints +ok {test-number} - x < y for: 3 < 5 +# 3x3x3 ints +ok {test-number} - y < z for: 5 < 9 +# 3x3x3 ints +ok {test-number} - x < z for: 3 < 9 +# 3x3x3 ints +ok {test-number} - x < y for: 3 < 6 +# 3x3x3 ints +ok {test-number} - y < z for: 6 < 7 +# 3x3x3 ints +ok {test-number} - x < z for: 3 < 7 +# 3x3x3 ints +ok {test-number} - x < y for: 3 < 6 +# 3x3x3 ints +ok {test-number} - y < z for: 6 < 8 +# 3x3x3 ints +ok {test-number} - x < z for: 3 < 8 +# 3x3x3 ints +ok {test-number} - x < y for: 3 < 6 +# 3x3x3 ints +ok {test-number} - y < z for: 6 < 9 +# 3x3x3 ints +ok {test-number} - x < z for: 3 < 9 +# A METHOD_AS_TEST_CASE based test run that fails +not ok {test-number} - s == "world" for: "hello" == "world" +# A METHOD_AS_TEST_CASE based test run that succeeds +ok {test-number} - s == "hello" for: "hello" == "hello" +# A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<float> +not ok {test-number} - Template_Fixture_2<TestType>::m_a.size() == 1 for: 0 == 1 +# A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<int> +not ok {test-number} - Template_Fixture_2<TestType>::m_a.size() == 1 for: 0 == 1 +# A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<float> +not ok {test-number} - Template_Fixture_2<TestType>::m_a.size() == 1 for: 0 == 1 +# A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<int> +not ok {test-number} - Template_Fixture_2<TestType>::m_a.size() == 1 for: 0 == 1 +# A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - Template_Foo<float> +ok {test-number} - Template_Fixture_2<TestType>::m_a.size() == 0 for: 0 == 0 +# A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - Template_Foo<int> +ok {test-number} - Template_Fixture_2<TestType>::m_a.size() == 0 for: 0 == 0 +# A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - std::vector<float> +ok {test-number} - Template_Fixture_2<TestType>::m_a.size() == 0 for: 0 == 0 +# A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - std::vector<int> +ok {test-number} - Template_Fixture_2<TestType>::m_a.size() == 0 for: 0 == 0 +# A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<float, 6> +not ok {test-number} - Template_Fixture_2<TestType>{}.m_a.size() < 2 for: 6 < 2 +# A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<int, 2> +not ok {test-number} - Template_Fixture_2<TestType>{}.m_a.size() < 2 for: 2 < 2 +# A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<float, 6> +not ok {test-number} - Template_Fixture_2<TestType>{}.m_a.size() < 2 for: 6 < 2 +# A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<int, 2> +not ok {test-number} - Template_Fixture_2<TestType>{}.m_a.size() < 2 for: 2 < 2 +# A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - Template_Foo_2<float,6> +ok {test-number} - Template_Fixture_2<TestType>{}.m_a.size() >= 2 for: 6 >= 2 +# A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - Template_Foo_2<int,2> +ok {test-number} - Template_Fixture_2<TestType>{}.m_a.size() >= 2 for: 2 >= 2 +# A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - std::array<float,6> +ok {test-number} - Template_Fixture_2<TestType>{}.m_a.size() >= 2 for: 6 >= 2 +# A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - std::array<int,2> +ok {test-number} - Template_Fixture_2<TestType>{}.m_a.size() >= 2 for: 2 >= 2 +# A TEMPLATE_TEST_CASE_METHOD based test run that fails - double +not ok {test-number} - Template_Fixture<TestType>::m_a == 2 for: 1.0 == 2 +# A TEMPLATE_TEST_CASE_METHOD based test run that fails - float +not ok {test-number} - Template_Fixture<TestType>::m_a == 2 for: 1.0f == 2 +# A TEMPLATE_TEST_CASE_METHOD based test run that fails - int +not ok {test-number} - Template_Fixture<TestType>::m_a == 2 for: 1 == 2 +# A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - double +ok {test-number} - Template_Fixture<TestType>::m_a == 1 for: 1.0 == 1 +# A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - float +ok {test-number} - Template_Fixture<TestType>::m_a == 1 for: 1.0f == 1 +# A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - int +ok {test-number} - Template_Fixture<TestType>::m_a == 1 for: 1 == 1 +# A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 1 +not ok {test-number} - Nttp_Fixture<V>::value == 0 for: 1 == 0 +# A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 3 +not ok {test-number} - Nttp_Fixture<V>::value == 0 for: 3 == 0 +# A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 6 +not ok {test-number} - Nttp_Fixture<V>::value == 0 for: 6 == 0 +# A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 1 +ok {test-number} - Nttp_Fixture<V>::value > 0 for: 1 > 0 +# A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 3 +ok {test-number} - Nttp_Fixture<V>::value > 0 for: 3 > 0 +# A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6 +ok {test-number} - Nttp_Fixture<V>::value > 0 for: 6 > 0 +# A TEST_CASE_METHOD based test run that fails +not ok {test-number} - m_a == 2 for: 1 == 2 +# A TEST_CASE_METHOD based test run that succeeds +ok {test-number} - m_a == 1 for: 1 == 1 +# A Template product test case - Foo<float> +ok {test-number} - x.size() == 0 for: 0 == 0 +# A Template product test case - Foo<int> +ok {test-number} - x.size() == 0 for: 0 == 0 +# A Template product test case - std::vector<float> +ok {test-number} - x.size() == 0 for: 0 == 0 +# A Template product test case - std::vector<int> +ok {test-number} - x.size() == 0 for: 0 == 0 +# A Template product test case with array signature - Bar<float, 42> +ok {test-number} - x.size() > 0 for: 42 > 0 +# A Template product test case with array signature - Bar<int, 9> +ok {test-number} - x.size() > 0 for: 9 > 0 +# A Template product test case with array signature - std::array<float, 42> +ok {test-number} - x.size() > 0 for: 42 > 0 +# A Template product test case with array signature - std::array<int, 9> +ok {test-number} - x.size() > 0 for: 9 > 0 +# A comparison that uses literals instead of the normal constructor +ok {test-number} - d == 1.23_a for: 1.23 == Approx( 1.23 ) +# A comparison that uses literals instead of the normal constructor +ok {test-number} - d != 1.22_a for: 1.23 != Approx( 1.22 ) +# A comparison that uses literals instead of the normal constructor +ok {test-number} - -d == -1.23_a for: -1.23 == Approx( -1.23 ) +# A comparison that uses literals instead of the normal constructor +ok {test-number} - d == 1.2_a .epsilon(.1) for: 1.23 == Approx( 1.2 ) +# A comparison that uses literals instead of the normal constructor +ok {test-number} - d != 1.2_a .epsilon(.001) for: 1.23 != Approx( 1.2 ) +# A comparison that uses literals instead of the normal constructor +ok {test-number} - d == 1_a .epsilon(.3) for: 1.23 == Approx( 1.0 ) +# A couple of nested sections followed by a failure +ok {test-number} - with 1 message: 'that's not flying - that's failing in style' +# A couple of nested sections followed by a failure +not ok {test-number} - explicitly with 1 message: 'to infinity and beyond' +# A failing expression with a non streamable type is still captured +not ok {test-number} - &o1 == &o2 for: 0x<hex digits> == 0x<hex digits> +# A failing expression with a non streamable type is still captured +not ok {test-number} - o1 == o2 for: {?} == {?} +# Absolute margin +ok {test-number} - 104.0 != Approx(100.0) for: 104.0 != Approx( 100.0 ) +# Absolute margin +ok {test-number} - 104.0 == Approx(100.0).margin(5) for: 104.0 == Approx( 100.0 ) +# Absolute margin +ok {test-number} - 104.0 == Approx(100.0).margin(4) for: 104.0 == Approx( 100.0 ) +# Absolute margin +ok {test-number} - 104.0 != Approx(100.0).margin(3) for: 104.0 != Approx( 100.0 ) +# Absolute margin +ok {test-number} - 100.3 != Approx(100.0) for: 100.3 != Approx( 100.0 ) +# Absolute margin +ok {test-number} - 100.3 == Approx(100.0).margin(0.5) for: 100.3 == Approx( 100.0 ) +# An expression with side-effects should only be evaluated once +ok {test-number} - i++ == 7 for: 7 == 7 +# An expression with side-effects should only be evaluated once +ok {test-number} - i++ == 8 for: 8 == 8 +# An unchecked exception reports the line of the last assertion +ok {test-number} - 1 == 1 +# An unchecked exception reports the line of the last assertion +not ok {test-number} - unexpected exception with message: 'unexpected exception'; expression was: {Unknown expression after the reported line} +# Anonymous test case 1 +ok {test-number} - with 1 message: 'anonymous test case' +# Approx setters validate their arguments +ok {test-number} - Approx(0).margin(0) +# Approx setters validate their arguments +ok {test-number} - Approx(0).margin(1234656) +# Approx setters validate their arguments +ok {test-number} - Approx(0).margin(-2), std::domain_error +# Approx setters validate their arguments +ok {test-number} - Approx(0).epsilon(0) +# Approx setters validate their arguments +ok {test-number} - Approx(0).epsilon(1) +# Approx setters validate their arguments +ok {test-number} - Approx(0).epsilon(-0.001), std::domain_error +# Approx setters validate their arguments +ok {test-number} - Approx(0).epsilon(1.0001), std::domain_error +# Approx with exactly-representable margin +ok {test-number} - 0.25f == Approx(0.0f).margin(0.25f) for: 0.25f == Approx( 0.0 ) +# Approx with exactly-representable margin +ok {test-number} - 0.0f == Approx(0.25f).margin(0.25f) for: 0.0f == Approx( 0.25 ) +# Approx with exactly-representable margin +ok {test-number} - 0.5f == Approx(0.25f).margin(0.25f) for: 0.5f == Approx( 0.25 ) +# Approx with exactly-representable margin +ok {test-number} - 245.0f == Approx(245.25f).margin(0.25f) for: 245.0f == Approx( 245.25 ) +# Approx with exactly-representable margin +ok {test-number} - 245.5f == Approx(245.25f).margin(0.25f) for: 245.5f == Approx( 245.25 ) +# Approximate PI +ok {test-number} - divide( 22, 7 ) == Approx( 3.141 ).epsilon( 0.001 ) for: 3.1428571429 == Approx( 3.141 ) +# Approximate PI +ok {test-number} - divide( 22, 7 ) != Approx( 3.141 ).epsilon( 0.0001 ) for: 3.1428571429 != Approx( 3.141 ) +# Approximate comparisons with different epsilons +ok {test-number} - d != Approx( 1.231 ) for: 1.23 != Approx( 1.231 ) +# Approximate comparisons with different epsilons +ok {test-number} - d == Approx( 1.231 ).epsilon( 0.1 ) for: 1.23 == Approx( 1.231 ) +# Approximate comparisons with floats +ok {test-number} - 1.23f == Approx( 1.23f ) for: 1.23f == Approx( 1.2300000191 ) +# Approximate comparisons with floats +ok {test-number} - 0.0f == Approx( 0.0f ) for: 0.0f == Approx( 0.0 ) +# Approximate comparisons with ints +ok {test-number} - 1 == Approx( 1 ) for: 1 == Approx( 1.0 ) +# Approximate comparisons with ints +ok {test-number} - 0 == Approx( 0 ) for: 0 == Approx( 0.0 ) +# Approximate comparisons with mixed numeric types +ok {test-number} - 1.0f == Approx( 1 ) for: 1.0f == Approx( 1.0 ) +# Approximate comparisons with mixed numeric types +ok {test-number} - 0 == Approx( dZero) for: 0 == Approx( 0.0 ) +# Approximate comparisons with mixed numeric types +ok {test-number} - 0 == Approx( dSmall ).margin( 0.001 ) for: 0 == Approx( 0.00001 ) +# Approximate comparisons with mixed numeric types +ok {test-number} - 1.234f == Approx( dMedium ) for: 1.234f == Approx( 1.234 ) +# Approximate comparisons with mixed numeric types +ok {test-number} - dMedium == Approx( 1.234f ) for: 1.234 == Approx( 1.2339999676 ) +# Arbitrary predicate matcher +ok {test-number} - 1, Predicate<int>(alwaysTrue, "always true") for: 1 matches predicate: "always true" +# Arbitrary predicate matcher +ok {test-number} - 1, !Predicate<int>(alwaysFalse, "always false") for: 1 not matches predicate: "always false" +# Arbitrary predicate matcher +ok {test-number} - "Hello olleH", Predicate<std::string>( [] (std::string const& str) -> bool { return str.front() == str.back(); }, "First and last character should be equal") for: "Hello olleH" matches predicate: "First and last character should be equal" +# Arbitrary predicate matcher +ok {test-number} - "This wouldn't pass", !Predicate<std::string>( [] (std::string const& str) -> bool { return str.front() == str.back(); } ) for: "This wouldn't pass" not matches undescribed predicate +# Assertion macros support bit operators and bool conversions +ok {test-number} - lhs | rhs for: Val: 1 | Val: 2 +# Assertion macros support bit operators and bool conversions +ok {test-number} - !(lhs & rhs) for: !(Val: 1 & Val: 2) +# Assertion macros support bit operators and bool conversions +ok {test-number} - HasBitOperators{ 1 } & HasBitOperators{ 1 } for: Val: 1 & Val: 1 +# Assertion macros support bit operators and bool conversions +ok {test-number} - lhs ^ rhs for: Val: 1 ^ Val: 2 +# Assertion macros support bit operators and bool conversions +ok {test-number} - !(lhs ^ lhs) for: !(Val: 1 ^ Val: 1) +# Assertions then sections +ok {test-number} - true +# Assertions then sections +ok {test-number} - true +# Assertions then sections +ok {test-number} - true +# Assertions then sections +ok {test-number} - true +# Assertions then sections +ok {test-number} - true +# Assertions then sections +ok {test-number} - true +# Basic use of the Contains range matcher +ok {test-number} - a, Contains(1) for: { 1, 2, 3 } contains element 1 +# Basic use of the Contains range matcher +ok {test-number} - b, Contains(1) for: { 0, 1, 2 } contains element 1 +# Basic use of the Contains range matcher +ok {test-number} - c, !Contains(1) for: { 4, 5, 6 } not contains element 1 +# Basic use of the Contains range matcher +ok {test-number} - a, Contains(0, close_enough) for: { 1, 2, 3 } contains element 0 +# Basic use of the Contains range matcher +ok {test-number} - b, Contains(0, close_enough) for: { 0, 1, 2 } contains element 0 +# Basic use of the Contains range matcher +ok {test-number} - c, !Contains(0, close_enough) for: { 4, 5, 6 } not contains element 0 +# Basic use of the Contains range matcher +ok {test-number} - a, Contains(4, [](auto&& lhs, size_t sz) { return lhs.size() == sz; }) for: { "abc", "abcd", "abcde" } contains element 4 +# Basic use of the Contains range matcher +ok {test-number} - in, Contains(1) for: { 1, 2, 3, 4, 5 } contains element 1 +# Basic use of the Contains range matcher +ok {test-number} - in, !Contains(8) for: { 1, 2, 3, 4, 5 } not contains element 8 +# Basic use of the Contains range matcher +ok {test-number} - in, Contains(MoveOnlyTestElement{ 2 }) for: { 1, 2, 3 } contains element 2 +# Basic use of the Contains range matcher +ok {test-number} - in, !Contains(MoveOnlyTestElement{ 9 }) for: { 1, 2, 3 } not contains element 9 +# Basic use of the Contains range matcher +ok {test-number} - in, Contains(Catch::Matchers::WithinAbs(0.5, 0.5)) for: { 1.0, 2.0, 3.0, 0.0 } contains element matching is within 0.5 of 0.5 +# Basic use of the Empty range matcher +ok {test-number} - empty_array, IsEmpty() for: { } is empty +# Basic use of the Empty range matcher +ok {test-number} - non_empty_array, !IsEmpty() for: { 0.0 } not is empty +# Basic use of the Empty range matcher +ok {test-number} - empty_vec, IsEmpty() for: { } is empty +# Basic use of the Empty range matcher +ok {test-number} - non_empty_vec, !IsEmpty() for: { 'a', 'b', 'c' } not is empty +# Basic use of the Empty range matcher +ok {test-number} - inner_lists_are_empty, !IsEmpty() for: { { } } not is empty +# Basic use of the Empty range matcher +ok {test-number} - inner_lists_are_empty.front(), IsEmpty() for: { } is empty +# Basic use of the Empty range matcher +ok {test-number} - has_empty{}, !IsEmpty() for: {?} not is empty +# Basic use of the Empty range matcher +ok {test-number} - unrelated::ADL_empty{}, IsEmpty() for: {?} is empty +# CAPTURE can deal with complex expressions +ok {test-number} - with 7 messages: 'a := 1' and 'b := 2' and 'c := 3' and 'a + b := 3' and 'a+b := 3' and 'c > b := true' and 'a == 1 := true' +# CAPTURE can deal with complex expressions involving commas +ok {test-number} - with 7 messages: 'std::vector<int>{1, 2, 3}[0, 1, 2] := 3' and 'std::vector<int>{1, 2, 3}[(0, 1)] := 2' and 'std::vector<int>{1, 2, 3}[0] := 1' and '(helper_1436<int, int>{12, -12}) := { 12, -12 }' and '(helper_1436<int, int>(-12, 12)) := { -12, 12 }' and '(1, 2) := 2' and '(2, 3) := 3' +# CAPTURE parses string and character constants +ok {test-number} - with 11 messages: '("comma, in string", "escaped, \", ") := "escaped, ", "' and '"single quote in string,'," := "single quote in string,',"' and '"some escapes, \\,\\\\" := "some escapes, \,\\"' and '"some, ), unmatched, } prenheses {[<" := "some, ), unmatched, } prenheses {[<"' and ''"' := '"'' and ''\'' := '''' and '',' := ','' and ''}' := '}'' and '')' := ')'' and ''(' := '('' and ''{' := '{'' +# Capture and info messages +ok {test-number} - true with 1 message: 'i := 2' +# Capture and info messages +ok {test-number} - true with 1 message: '3' +# Character pretty printing +ok {test-number} - tab == '\t' for: '\t' == '\t' +# Character pretty printing +ok {test-number} - newline == '\n' for: '\n' == '\n' +# Character pretty printing +ok {test-number} - carr_return == '\r' for: '\r' == '\r' +# Character pretty printing +ok {test-number} - form_feed == '\f' for: '\f' == '\f' +# Character pretty printing +ok {test-number} - space == ' ' for: ' ' == ' ' +# Character pretty printing +ok {test-number} - c == chars[i] for: 'a' == 'a' +# Character pretty printing +ok {test-number} - c == chars[i] for: 'z' == 'z' +# Character pretty printing +ok {test-number} - c == chars[i] for: 'A' == 'A' +# Character pretty printing +ok {test-number} - c == chars[i] for: 'Z' == 'Z' +# Character pretty printing +ok {test-number} - null_terminator == '\0' for: 0 == 0 +# Character pretty printing +ok {test-number} - c == i for: 2 == 2 +# Character pretty printing +ok {test-number} - c == i for: 3 == 3 +# Character pretty printing +ok {test-number} - c == i for: 4 == 4 +# Character pretty printing +ok {test-number} - c == i for: 5 == 5 +# Clara::Arg supports single-arg parse the way Opt does +ok {test-number} - name.empty() for: true +# Clara::Arg supports single-arg parse the way Opt does +ok {test-number} - name == "foo" for: "foo" == "foo" +# Combining MatchAllOfGeneric does not nest +ok {test-number} - with 1 message: 'std::is_same< decltype((MatcherA() && MatcherB()) && MatcherC()), Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC> >::value' +# Combining MatchAllOfGeneric does not nest +ok {test-number} - 1, (MatcherA() && MatcherB()) && MatcherC() for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) +# Combining MatchAllOfGeneric does not nest +ok {test-number} - with 1 message: 'std::is_same< decltype(MatcherA() && (MatcherB() && MatcherC())), Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC> >::value' +# Combining MatchAllOfGeneric does not nest +ok {test-number} - 1, MatcherA() && (MatcherB() && MatcherC()) for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) +# Combining MatchAllOfGeneric does not nest +ok {test-number} - with 1 message: 'std::is_same< decltype((MatcherA() && MatcherB()) && (MatcherC() && MatcherD())), Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC, MatcherD> >::value' +# Combining MatchAllOfGeneric does not nest +ok {test-number} - 1, (MatcherA() && MatcherB()) && (MatcherC() && MatcherD()) for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 and equals: true ) +# Combining MatchAnyOfGeneric does not nest +ok {test-number} - with 1 message: 'std::is_same< decltype((MatcherA() || MatcherB()) || MatcherC()), Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC> >::value' +# Combining MatchAnyOfGeneric does not nest +ok {test-number} - 1, (MatcherA() || MatcherB()) || MatcherC() for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) +# Combining MatchAnyOfGeneric does not nest +ok {test-number} - with 1 message: 'std::is_same< decltype(MatcherA() || (MatcherB() || MatcherC())), Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC> >::value' +# Combining MatchAnyOfGeneric does not nest +ok {test-number} - 1, MatcherA() || (MatcherB() || MatcherC()) for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) +# Combining MatchAnyOfGeneric does not nest +ok {test-number} - with 1 message: 'std::is_same< decltype((MatcherA() || MatcherB()) || (MatcherC() || MatcherD())), Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC, MatcherD> >::value' +# Combining MatchAnyOfGeneric does not nest +ok {test-number} - 1, (MatcherA() || MatcherB()) || (MatcherC() || MatcherD()) for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 or equals: true ) +# Combining MatchNotOfGeneric does not nest +ok {test-number} - with 1 message: 'std::is_same< decltype(!MatcherA()), Catch::Matchers::Detail::MatchNotOfGeneric<MatcherA> >::value' +# Combining MatchNotOfGeneric does not nest +ok {test-number} - 0, !MatcherA() for: 0 not equals: (int) 1 or (float) 1.0f +# Combining MatchNotOfGeneric does not nest +ok {test-number} - with 1 message: 'std::is_same< decltype(!!MatcherA()), MatcherA const& >::value' +# Combining MatchNotOfGeneric does not nest +ok {test-number} - 1, !!MatcherA() for: 1 equals: (int) 1 or (float) 1.0f +# Combining MatchNotOfGeneric does not nest +ok {test-number} - with 1 message: 'std::is_same< decltype(!!!MatcherA()), Catch::Matchers::Detail::MatchNotOfGeneric<MatcherA> >::value' +# Combining MatchNotOfGeneric does not nest +ok {test-number} - 0, !!!MatcherA() for: 0 not equals: (int) 1 or (float) 1.0f +# Combining MatchNotOfGeneric does not nest +ok {test-number} - with 1 message: 'std::is_same< decltype(!!!!MatcherA()), MatcherA const & >::value' +# Combining MatchNotOfGeneric does not nest +ok {test-number} - 1, !!!!MatcherA() for: 1 equals: (int) 1 or (float) 1.0f +# Combining concrete matchers does not use templated matchers +ok {test-number} - with 1 message: 'std::is_same< decltype(StartsWith("foo") || (StartsWith("bar") && EndsWith("bar") && !EndsWith("foo"))), Catch::Matchers::Detail::MatchAnyOf<std::string> >::value' +# Combining only templated matchers +ok {test-number} - with 1 message: 'std::is_same< decltype(MatcherA() || MatcherB()), Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB> >::value' +# Combining only templated matchers +ok {test-number} - 1, MatcherA() || MatcherB() for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 ) +# Combining only templated matchers +ok {test-number} - with 1 message: 'std::is_same< decltype(MatcherA() && MatcherB()), Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB> >::value' +# Combining only templated matchers +ok {test-number} - 1, MatcherA() && MatcherB() for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 ) +# Combining only templated matchers +ok {test-number} - with 1 message: 'std::is_same< decltype(MatcherA() || !MatcherB()), Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, Catch::Matchers::Detail::MatchNotOfGeneric<MatcherB>> >::value' +# Combining only templated matchers +ok {test-number} - 1, MatcherA() || !MatcherB() for: 1 ( equals: (int) 1 or (float) 1.0f or not equals: (long long) 1 ) +# Combining templated and concrete matchers +ok {test-number} - vec, Predicate<std::vector<int>>([](auto const& v) { return std::all_of(v.begin(), v.end(), [](int elem) { return elem % 2 == 1; }); }, "All elements are odd") && !EqualsRange(a) for: { 1, 3, 5 } ( matches predicate: "All elements are odd" and not Equals: { 5, 3, 1 } ) +# Combining templated and concrete matchers +ok {test-number} - str, StartsWith("foo") && EqualsRange(arr) && EndsWith("bar") for: "foobar" ( starts with: "foo" and Equals: { 'f', 'o', 'o', 'b', 'a', 'r' } and ends with: "bar" ) +# Combining templated and concrete matchers +ok {test-number} - str, StartsWith("foo") && !EqualsRange(bad_arr) && EndsWith("bar") for: "foobar" ( starts with: "foo" and not Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } and ends with: "bar" ) +# Combining templated and concrete matchers +ok {test-number} - str, EqualsRange(arr) && StartsWith("foo") && EndsWith("bar") for: "foobar" ( Equals: { 'f', 'o', 'o', 'b', 'a', 'r' } and starts with: "foo" and ends with: "bar" ) +# Combining templated and concrete matchers +ok {test-number} - str, !EqualsRange(bad_arr) && StartsWith("foo") && EndsWith("bar") for: "foobar" ( not Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } and starts with: "foo" and ends with: "bar" ) +# Combining templated and concrete matchers +ok {test-number} - str, EqualsRange(bad_arr) || (StartsWith("foo") && EndsWith("bar")) for: "foobar" ( Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } or ( starts with: "foo" and ends with: "bar" ) ) +# Combining templated and concrete matchers +ok {test-number} - str, (StartsWith("foo") && EndsWith("bar")) || EqualsRange(bad_arr) for: "foobar" ( ( starts with: "foo" and ends with: "bar" ) or Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } ) +# Combining templated matchers +ok {test-number} - container, EqualsRange(a) || EqualsRange(b) || EqualsRange(c) for: { 1, 2, 3 } ( Equals: { 1, 2, 3 } or Equals: { 0, 1, 2 } or Equals: { 4, 5, 6 } ) +# Commas in various macros are allowed +ok {test-number} - std::vector<constructor_throws>{constructor_throws{}, constructor_throws{}} +# Commas in various macros are allowed +ok {test-number} - std::vector<constructor_throws>{constructor_throws{}, constructor_throws{}} +# Commas in various macros are allowed +ok {test-number} - std::vector<int>{1, 2, 3} == std::vector<int>{1, 2, 3} +# Commas in various macros are allowed +ok {test-number} - std::vector<int>{1, 2, 3} == std::vector<int>{1, 2, 3} +# Commas in various macros are allowed +ok {test-number} - std::vector<int>{1, 2} == std::vector<int>{1, 2} for: { 1, 2 } == { 1, 2 } +# Commas in various macros are allowed +ok {test-number} - std::vector<int>{1, 2} == std::vector<int>{1, 2} for: { 1, 2 } == { 1, 2 } +# Commas in various macros are allowed +ok {test-number} - !(std::vector<int>{1, 2} == std::vector<int>{1, 2, 3}) for: !({ 1, 2 } == { 1, 2, 3 }) +# Commas in various macros are allowed +ok {test-number} - !(std::vector<int>{1, 2} == std::vector<int>{1, 2, 3}) for: !({ 1, 2 } == { 1, 2, 3 }) +# Commas in various macros are allowed +ok {test-number} - std::vector<int>{1, 2} == std::vector<int>{1, 2} for: { 1, 2 } == { 1, 2 } +# Commas in various macros are allowed +ok {test-number} - std::vector<int>{1, 2} == std::vector<int>{1, 2} for: { 1, 2 } == { 1, 2 } +# Commas in various macros are allowed +ok {test-number} - true +# Commas in various macros are allowed +ok {test-number} - std::vector<int>{1, 2} == std::vector<int>{1, 2} for: { 1, 2 } == { 1, 2 } +# Comparing function pointers +ok {test-number} - a for: 0x<hex digits> +# Comparing function pointers +ok {test-number} - a == &foo for: 0x<hex digits> == 0x<hex digits> +# Comparison ops +ok {test-number} - SimplePcg32{} == SimplePcg32{} for: {?} == {?} +# Comparison ops +ok {test-number} - SimplePcg32{ 0 } != SimplePcg32{} for: {?} != {?} +# Comparison ops +ok {test-number} - !(SimplePcg32{ 1 } == SimplePcg32{ 2 }) for: !({?} == {?}) +# Comparison ops +ok {test-number} - !(SimplePcg32{ 1 } != SimplePcg32{ 1 }) for: !({?} != {?}) +# Comparison with explicitly convertible types +ok {test-number} - td == Approx(10.0) for: StrongDoubleTypedef(10) == Approx( 10.0 ) +# Comparison with explicitly convertible types +ok {test-number} - Approx(10.0) == td for: Approx( 10.0 ) == StrongDoubleTypedef(10) +# Comparison with explicitly convertible types +ok {test-number} - td != Approx(11.0) for: StrongDoubleTypedef(10) != Approx( 11.0 ) +# Comparison with explicitly convertible types +ok {test-number} - Approx(11.0) != td for: Approx( 11.0 ) != StrongDoubleTypedef(10) +# Comparison with explicitly convertible types +ok {test-number} - td <= Approx(10.0) for: StrongDoubleTypedef(10) <= Approx( 10.0 ) +# Comparison with explicitly convertible types +ok {test-number} - td <= Approx(11.0) for: StrongDoubleTypedef(10) <= Approx( 11.0 ) +# Comparison with explicitly convertible types +ok {test-number} - Approx(10.0) <= td for: Approx( 10.0 ) <= StrongDoubleTypedef(10) +# Comparison with explicitly convertible types +ok {test-number} - Approx(9.0) <= td for: Approx( 9.0 ) <= StrongDoubleTypedef(10) +# Comparison with explicitly convertible types +ok {test-number} - td >= Approx(9.0) for: StrongDoubleTypedef(10) >= Approx( 9.0 ) +# Comparison with explicitly convertible types +ok {test-number} - td >= Approx(td) for: StrongDoubleTypedef(10) >= Approx( 10.0 ) +# Comparison with explicitly convertible types +ok {test-number} - Approx(td) >= td for: Approx( 10.0 ) >= StrongDoubleTypedef(10) +# Comparison with explicitly convertible types +ok {test-number} - Approx(11.0) >= td for: Approx( 11.0 ) >= StrongDoubleTypedef(10) +# Comparisons between ints where one side is computed +ok {test-number} - 54 == 6*9 for: 54 == 54 +# Comparisons between unsigned ints and negative signed ints match c++ standard behaviour +ok {test-number} - ( -1 > 2u ) for: true +# Comparisons between unsigned ints and negative signed ints match c++ standard behaviour +ok {test-number} - -1 > 2u for: -1 > 2 +# Comparisons between unsigned ints and negative signed ints match c++ standard behaviour +ok {test-number} - ( 2u < -1 ) for: true +# Comparisons between unsigned ints and negative signed ints match c++ standard behaviour +ok {test-number} - 2u < -1 for: 2 < -1 +# Comparisons between unsigned ints and negative signed ints match c++ standard behaviour +ok {test-number} - ( minInt > 2u ) for: true +# Comparisons between unsigned ints and negative signed ints match c++ standard behaviour +ok {test-number} - minInt > 2u for: -2147483648 > 2 +# Comparisons with int literals don't warn when mixing signed/ unsigned +ok {test-number} - i == 1 for: 1 == 1 +# Comparisons with int literals don't warn when mixing signed/ unsigned +ok {test-number} - ui == 2 for: 2 == 2 +# Comparisons with int literals don't warn when mixing signed/ unsigned +ok {test-number} - l == 3 for: 3 == 3 +# Comparisons with int literals don't warn when mixing signed/ unsigned +ok {test-number} - ul == 4 for: 4 == 4 +# Comparisons with int literals don't warn when mixing signed/ unsigned +ok {test-number} - c == 5 for: 5 == 5 +# Comparisons with int literals don't warn when mixing signed/ unsigned +ok {test-number} - uc == 6 for: 6 == 6 +# Comparisons with int literals don't warn when mixing signed/ unsigned +ok {test-number} - 1 == i for: 1 == 1 +# Comparisons with int literals don't warn when mixing signed/ unsigned +ok {test-number} - 2 == ui for: 2 == 2 +# Comparisons with int literals don't warn when mixing signed/ unsigned +ok {test-number} - 3 == l for: 3 == 3 +# Comparisons with int literals don't warn when mixing signed/ unsigned +ok {test-number} - 4 == ul for: 4 == 4 +# Comparisons with int literals don't warn when mixing signed/ unsigned +ok {test-number} - 5 == c for: 5 == 5 +# Comparisons with int literals don't warn when mixing signed/ unsigned +ok {test-number} - 6 == uc for: 6 == 6 +# Comparisons with int literals don't warn when mixing signed/ unsigned +ok {test-number} - (std::numeric_limits<uint32_t>::max)() > ul for: 4294967295 (0x<hex digits>) > 4 +# Composed generic matchers shortcircuit +ok {test-number} - !(matcher.match( 1 )) for: !false +# Composed generic matchers shortcircuit +ok {test-number} - first.matchCalled for: true +# Composed generic matchers shortcircuit +ok {test-number} - !second.matchCalled for: true +# Composed generic matchers shortcircuit +ok {test-number} - matcher.match(1) for: true +# Composed generic matchers shortcircuit +ok {test-number} - first.matchCalled for: true +# Composed generic matchers shortcircuit +ok {test-number} - !second.matchCalled for: true +# Composed matchers shortcircuit +ok {test-number} - !(matcher.match( 1 )) for: !false +# Composed matchers shortcircuit +ok {test-number} - first.matchCalled for: true +# Composed matchers shortcircuit +ok {test-number} - !second.matchCalled for: true +# Composed matchers shortcircuit +ok {test-number} - matcher.match( 1 ) for: true +# Composed matchers shortcircuit +ok {test-number} - first.matchCalled for: true +# Composed matchers shortcircuit +ok {test-number} - !second.matchCalled for: true +# Contains string matcher +not ok {test-number} - testStringForMatching(), Contains("not there", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" contains: "not there" (case insensitive) +# Contains string matcher +not ok {test-number} - testStringForMatching(), Contains("STRING") for: "this string contains 'abc' as a substring" contains: "STRING" +# Copy and then generate a range +ok {test-number} - elem % 2 == 1 for: 1 == 1 +# Copy and then generate a range +ok {test-number} - elem % 2 == 1 for: 1 == 1 +# Copy and then generate a range +ok {test-number} - elem % 2 == 1 for: 1 == 1 +# Copy and then generate a range +ok {test-number} - elem % 2 == 1 for: 1 == 1 +# Copy and then generate a range +ok {test-number} - elem % 2 == 1 for: 1 == 1 +# Copy and then generate a range +ok {test-number} - elem % 2 == 1 for: 1 == 1 +# Copy and then generate a range +ok {test-number} - elem % 2 == 1 for: 1 == 1 +# Copy and then generate a range +ok {test-number} - elem % 2 == 1 for: 1 == 1 +# Copy and then generate a range +ok {test-number} - elem % 2 == 1 for: 1 == 1 +# Copy and then generate a range +ok {test-number} - elem % 2 == 1 for: 1 == 1 +# Copy and then generate a range +ok {test-number} - elem % 2 == 1 for: 1 == 1 +# Copy and then generate a range +ok {test-number} - elem % 2 == 1 for: 1 == 1 +# Copy and then generate a range +ok {test-number} - call_count == 1 for: 1 == 1 +# Copy and then generate a range +ok {test-number} - make_data().size() == test_count for: 6 == 6 +# Custom exceptions can be translated when testing for nothrow +not ok {test-number} - unexpected exception with message: 'custom exception - not std'; expression was: throwCustom() +# Custom exceptions can be translated when testing for throwing as something else +not ok {test-number} - unexpected exception with message: 'custom exception - not std'; expression was: throwCustom(), std::exception +# Custom std-exceptions can be custom translated +not ok {test-number} - unexpected exception with message: 'custom std exception' +# Default scale is invisible to comparison +ok {test-number} - 101.000001 != Approx(100).epsilon(0.01) for: 101.000001 != Approx( 100.0 ) +# Default scale is invisible to comparison +ok {test-number} - std::pow(10, -5) != Approx(std::pow(10, -7)) for: 0.00001 != Approx( 0.0000001 ) +# Directly creating an EnumInfo +ok {test-number} - enumInfo->lookup(0) == "Value1" for: Value1 == "Value1" +# Directly creating an EnumInfo +ok {test-number} - enumInfo->lookup(1) == "Value2" for: Value2 == "Value2" +# Directly creating an EnumInfo +ok {test-number} - enumInfo->lookup(3) == "{** unexpected enum value **}" for: {** unexpected enum value **} == "{** unexpected enum value **}" +# EndsWith string matcher +not ok {test-number} - testStringForMatching(), EndsWith("Substring") for: "this string contains 'abc' as a substring" ends with: "Substring" +# EndsWith string matcher +not ok {test-number} - testStringForMatching(), EndsWith("this", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" ends with: "this" (case insensitive) +# Enums can quickly have stringification enabled using REGISTER_ENUM +ok {test-number} - stringify( EnumClass3::Value1 ) == "Value1" for: "Value1" == "Value1" +# Enums can quickly have stringification enabled using REGISTER_ENUM +ok {test-number} - stringify( EnumClass3::Value2 ) == "Value2" for: "Value2" == "Value2" +# Enums can quickly have stringification enabled using REGISTER_ENUM +ok {test-number} - stringify( EnumClass3::Value3 ) == "Value3" for: "Value3" == "Value3" +# Enums can quickly have stringification enabled using REGISTER_ENUM +ok {test-number} - stringify( EnumClass3::Value4 ) == "{** unexpected enum value **}" for: "{** unexpected enum value **}" == "{** unexpected enum value **}" +# Enums can quickly have stringification enabled using REGISTER_ENUM +ok {test-number} - stringify( ec3 ) == "Value2" for: "Value2" == "Value2" +# Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM +ok {test-number} - stringify( Bikeshed::Colours::Red ) == "Red" for: "Red" == "Red" +# Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM +ok {test-number} - stringify( Bikeshed::Colours::Blue ) == "Blue" for: "Blue" == "Blue" +# Epsilon only applies to Approx's value +ok {test-number} - 101.01 != Approx(100).epsilon(0.01) for: 101.01 != Approx( 100.0 ) +# Equality checks that should fail +not ok {test-number} - data.int_seven == 6 for: 7 == 6 +# Equality checks that should fail +not ok {test-number} - data.int_seven == 8 for: 7 == 8 +# Equality checks that should fail +not ok {test-number} - data.int_seven == 0 for: 7 == 0 +# Equality checks that should fail +not ok {test-number} - data.float_nine_point_one == Approx( 9.11f ) for: 9.1f == Approx( 9.1099996567 ) +# Equality checks that should fail +not ok {test-number} - data.float_nine_point_one == Approx( 9.0f ) for: 9.1f == Approx( 9.0 ) +# Equality checks that should fail +not ok {test-number} - data.float_nine_point_one == Approx( 1 ) for: 9.1f == Approx( 1.0 ) +# Equality checks that should fail +not ok {test-number} - data.float_nine_point_one == Approx( 0 ) for: 9.1f == Approx( 0.0 ) +# Equality checks that should fail +not ok {test-number} - data.double_pi == Approx( 3.1415 ) for: 3.1415926535 == Approx( 3.1415 ) +# Equality checks that should fail +not ok {test-number} - data.str_hello == "goodbye" for: "hello" == "goodbye" +# Equality checks that should fail +not ok {test-number} - data.str_hello == "hell" for: "hello" == "hell" +# Equality checks that should fail +not ok {test-number} - data.str_hello == "hello1" for: "hello" == "hello1" +# Equality checks that should fail +not ok {test-number} - data.str_hello.size() == 6 for: 5 == 6 +# Equality checks that should fail +not ok {test-number} - x == Approx( 1.301 ) for: 1.3 == Approx( 1.301 ) +# Equality checks that should succeed +ok {test-number} - data.int_seven == 7 for: 7 == 7 +# Equality checks that should succeed +ok {test-number} - data.float_nine_point_one == Approx( 9.1f ) for: 9.1f == Approx( 9.1000003815 ) +# Equality checks that should succeed +ok {test-number} - data.double_pi == Approx( 3.1415926535 ) for: 3.1415926535 == Approx( 3.1415926535 ) +# Equality checks that should succeed +ok {test-number} - data.str_hello == "hello" for: "hello" == "hello" +# Equality checks that should succeed +ok {test-number} - "hello" == data.str_hello for: "hello" == "hello" +# Equality checks that should succeed +ok {test-number} - data.str_hello.size() == 5 for: 5 == 5 +# Equality checks that should succeed +ok {test-number} - x == Approx( 1.3 ) for: 1.3 == Approx( 1.3 ) +# Equals +ok {test-number} - 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" +# Equals +ok {test-number} - 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) +# Equals string matcher +not ok {test-number} - 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" +# Equals string matcher +not ok {test-number} - testStringForMatching(), Equals("something else", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" equals: "something else" (case insensitive) +# Exception as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified +ok {test-number} - ::Catch::Detail::stringify(WhatException{}) == "This exception has overridden what() method" for: "This exception has overridden what() method" == "This exception has overridden what() method" +# Exception as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified +ok {test-number} - ::Catch::Detail::stringify(OperatorException{}) == "OperatorException" for: "OperatorException" == "OperatorException" +# Exception as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified +ok {test-number} - ::Catch::Detail::stringify(StringMakerException{}) == "StringMakerException" for: "StringMakerException" == "StringMakerException" +# Exception matchers that fail +not ok {test-number} - expected exception, got none; expression was: doesNotThrow(), SpecialException, ExceptionMatcher{1} +# Exception matchers that fail +not ok {test-number} - expected exception, got none; expression was: doesNotThrow(), SpecialException, ExceptionMatcher{1} +# Exception matchers that fail +not ok {test-number} - unexpected exception with message: 'Unknown exception'; expression was: throwsAsInt(1), SpecialException, ExceptionMatcher{1} +# Exception matchers that fail +not ok {test-number} - unexpected exception with message: 'Unknown exception'; expression was: throwsAsInt(1), SpecialException, ExceptionMatcher{1} +# Exception matchers that fail +not ok {test-number} - throwsSpecialException(3), SpecialException, ExceptionMatcher{1} for: SpecialException::what special exception has value of 1 +# Exception matchers that fail +not ok {test-number} - throwsSpecialException(4), SpecialException, ExceptionMatcher{1} for: SpecialException::what special exception has value of 1 +# Exception matchers that succeed +ok {test-number} - throwsSpecialException(1), SpecialException, ExceptionMatcher{1} for: SpecialException::what special exception has value of 1 +# Exception matchers that succeed +ok {test-number} - throwsSpecialException(2), SpecialException, ExceptionMatcher{2} for: SpecialException::what special exception has value of 2 +# Exception messages can be tested for +ok {test-number} - thisThrows(), "expected exception" for: "expected exception" equals: "expected exception" +# Exception messages can be tested for +ok {test-number} - thisThrows(), Equals( "expecteD Exception", Catch::CaseSensitive::No ) for: "expected exception" equals: "expected exception" (case insensitive) +# Exception messages can be tested for +ok {test-number} - thisThrows(), StartsWith( "expected" ) for: "expected exception" starts with: "expected" +# Exception messages can be tested for +ok {test-number} - thisThrows(), EndsWith( "exception" ) for: "expected exception" ends with: "exception" +# Exception messages can be tested for +ok {test-number} - thisThrows(), Contains( "except" ) for: "expected exception" contains: "except" +# Exception messages can be tested for +ok {test-number} - thisThrows(), Contains( "exCept", Catch::CaseSensitive::No ) for: "expected exception" contains: "except" (case insensitive) +# Exceptions matchers +ok {test-number} - throwsDerivedException(), DerivedException, Message("DerivedException::what") for: DerivedException::what exception message matches "DerivedException::what" +# Exceptions matchers +ok {test-number} - throwsDerivedException(), DerivedException, !Message("derivedexception::what") for: DerivedException::what not exception message matches "derivedexception::what" +# Exceptions matchers +ok {test-number} - throwsSpecialException(2), SpecialException, !Message("DerivedException::what") for: SpecialException::what not exception message matches "DerivedException::what" +# Exceptions matchers +ok {test-number} - throwsSpecialException(2), SpecialException, Message("SpecialException::what") for: SpecialException::what exception message matches "SpecialException::what" +# Expected exceptions that don't throw or unexpected exceptions fail the test +not ok {test-number} - unexpected exception with message: 'expected exception'; expression was: thisThrows(), std::string +# Expected exceptions that don't throw or unexpected exceptions fail the test +not ok {test-number} - expected exception, got none; expression was: thisDoesntThrow(), std::domain_error +# Expected exceptions that don't throw or unexpected exceptions fail the test +not ok {test-number} - unexpected exception with message: 'expected exception'; expression was: thisThrows() +# FAIL aborts the test +not ok {test-number} - explicitly with 1 message: 'This is a failure' +# FAIL does not require an argument +not ok {test-number} - explicitly +# FAIL_CHECK does not abort the test +not ok {test-number} - explicitly with 1 message: 'This is a failure' +# FAIL_CHECK does not abort the test +warning {test-number} - 'This message appears in the output' +# Factorials are computed +ok {test-number} - Factorial(0) == 1 for: 1 == 1 +# Factorials are computed +ok {test-number} - Factorial(1) == 1 for: 1 == 1 +# Factorials are computed +ok {test-number} - Factorial(2) == 2 for: 2 == 2 +# Factorials are computed +ok {test-number} - Factorial(3) == 6 for: 6 == 6 +# Factorials are computed +ok {test-number} - Factorial(10) == 3628800 for: 3628800 (0x<hex digits>) == 3628800 (0x<hex digits>) +# Floating point matchers: double +ok {test-number} - 10., WithinRel(11.1, 0.1) for: 10.0 and 11.1 are within 10% of each other +# Floating point matchers: double +ok {test-number} - 10., !WithinRel(11.2, 0.1) for: 10.0 not and 11.2 are within 10% of each other +# Floating point matchers: double +ok {test-number} - 1., !WithinRel(0., 0.99) for: 1.0 not and 0 are within 99% of each other +# Floating point matchers: double +ok {test-number} - -0., WithinRel(0.) for: -0.0 and 0 are within 2.22045e-12% of each other +# Floating point matchers: double +ok {test-number} - v1, WithinRel(v2) for: 0.0 and 2.22507e-308 are within 2.22045e-12% of each other +# Floating point matchers: double +ok {test-number} - 1., WithinAbs(1., 0) for: 1.0 is within 0.0 of 1.0 +# Floating point matchers: double +ok {test-number} - 0., WithinAbs(1., 1) for: 0.0 is within 1.0 of 1.0 +# Floating point matchers: double +ok {test-number} - 0., !WithinAbs(1., 0.99) for: 0.0 not is within 0.99 of 1.0 +# Floating point matchers: double +ok {test-number} - 0., !WithinAbs(1., 0.99) for: 0.0 not is within 0.99 of 1.0 +# Floating point matchers: double +ok {test-number} - 11., !WithinAbs(10., 0.5) for: 11.0 not is within 0.5 of 10.0 +# Floating point matchers: double +ok {test-number} - 10., !WithinAbs(11., 0.5) for: 10.0 not is within 0.5 of 11.0 +# Floating point matchers: double +ok {test-number} - -10., WithinAbs(-10., 0.5) for: -10.0 is within 0.5 of -10.0 +# Floating point matchers: double +ok {test-number} - -10., WithinAbs(-9.6, 0.5) for: -10.0 is within 0.5 of -9.6 +# Floating point matchers: double +ok {test-number} - 1., WithinULP(1., 0) for: 1.0 is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) +# Floating point matchers: double +ok {test-number} - nextafter(1., 2.), WithinULP(1., 1) for: 1.0 is within 1 ULPs of 1.0000000000000000e+00 ([9.9999999999999989e-01, 1.0000000000000002e+00]) +# Floating point matchers: double +ok {test-number} - 0., WithinULP(nextafter(0., 1.), 1) for: 0.0 is within 1 ULPs of 4.9406564584124654e-324 ([0.0000000000000000e+00, 9.8813129168249309e-324]) +# Floating point matchers: double +ok {test-number} - 1., WithinULP(nextafter(1., 0.), 1) for: 1.0 is within 1 ULPs of 9.9999999999999989e-01 ([9.9999999999999978e-01, 1.0000000000000000e+00]) +# Floating point matchers: double +ok {test-number} - 1., !WithinULP(nextafter(1., 2.), 0) for: 1.0 not is within 0 ULPs of 1.0000000000000002e+00 ([1.0000000000000002e+00, 1.0000000000000002e+00]) +# Floating point matchers: double +ok {test-number} - 1., WithinULP(1., 0) for: 1.0 is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) +# Floating point matchers: double +ok {test-number} - -0., WithinULP(0., 0) for: -0.0 is within 0 ULPs of 0.0000000000000000e+00 ([0.0000000000000000e+00, 0.0000000000000000e+00]) +# Floating point matchers: double +ok {test-number} - 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.0000000000000000e+00 ([1.9999999999999998e+00, 2.0000000000000004e+00]) ) +# Floating point matchers: double +ok {test-number} - 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.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) ) +# Floating point matchers: double +ok {test-number} - 0.0001, WithinAbs(0., 0.001) || WithinRel(0., 0.1) for: 0.0001 ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) +# Floating point matchers: double +ok {test-number} - WithinAbs(1., 0.) +# Floating point matchers: double +ok {test-number} - WithinAbs(1., -1.), std::domain_error +# Floating point matchers: double +ok {test-number} - WithinULP(1., 0) +# Floating point matchers: double +ok {test-number} - WithinRel(1., 0.) +# Floating point matchers: double +ok {test-number} - WithinRel(1., -0.2), std::domain_error +# Floating point matchers: double +ok {test-number} - WithinRel(1., 1.), std::domain_error +# Floating point matchers: float +ok {test-number} - 10.f, WithinRel(11.1f, 0.1f) for: 10.0f and 11.1 are within 10% of each other +# Floating point matchers: float +ok {test-number} - 10.f, !WithinRel(11.2f, 0.1f) for: 10.0f not and 11.2 are within 10% of each other +# Floating point matchers: float +ok {test-number} - 1.f, !WithinRel(0.f, 0.99f) for: 1.0f not and 0 are within 99% of each other +# Floating point matchers: float +ok {test-number} - -0.f, WithinRel(0.f) for: -0.0f and 0 are within 0.00119209% of each other +# Floating point matchers: float +ok {test-number} - v1, WithinRel(v2) for: 0.0f and 1.17549e-38 are within 0.00119209% of each other +# Floating point matchers: float +ok {test-number} - 1.f, WithinAbs(1.f, 0) for: 1.0f is within 0.0 of 1.0 +# Floating point matchers: float +ok {test-number} - 0.f, WithinAbs(1.f, 1) for: 0.0f is within 1.0 of 1.0 +# Floating point matchers: float +ok {test-number} - 0.f, !WithinAbs(1.f, 0.99f) for: 0.0f not is within 0.9900000095 of 1.0 +# Floating point matchers: float +ok {test-number} - 0.f, !WithinAbs(1.f, 0.99f) for: 0.0f not is within 0.9900000095 of 1.0 +# Floating point matchers: float +ok {test-number} - 0.f, WithinAbs(-0.f, 0) for: 0.0f is within 0.0 of -0.0 +# Floating point matchers: float +ok {test-number} - 11.f, !WithinAbs(10.f, 0.5f) for: 11.0f not is within 0.5 of 10.0 +# Floating point matchers: float +ok {test-number} - 10.f, !WithinAbs(11.f, 0.5f) for: 10.0f not is within 0.5 of 11.0 +# Floating point matchers: float +ok {test-number} - -10.f, WithinAbs(-10.f, 0.5f) for: -10.0f is within 0.5 of -10.0 +# Floating point matchers: float +ok {test-number} - -10.f, WithinAbs(-9.6f, 0.5f) for: -10.0f is within 0.5 of -9.6000003815 +# Floating point matchers: float +ok {test-number} - 1.f, WithinULP(1.f, 0) for: 1.0f is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) +# Floating point matchers: float +ok {test-number} - nextafter(1.f, 2.f), WithinULP(1.f, 1) for: 1.0f is within 1 ULPs of 1.00000000e+00f ([9.99999940e-01, 1.00000012e+00]) +# Floating point matchers: float +ok {test-number} - 0.f, WithinULP(nextafter(0.f, 1.f), 1) for: 0.0f is within 1 ULPs of 1.40129846e-45f ([0.00000000e+00, 2.80259693e-45]) +# Floating point matchers: float +ok {test-number} - 1.f, WithinULP(nextafter(1.f, 0.f), 1) for: 1.0f is within 1 ULPs of 9.99999940e-01f ([9.99999881e-01, 1.00000000e+00]) +# Floating point matchers: float +ok {test-number} - 1.f, !WithinULP(nextafter(1.f, 2.f), 0) for: 1.0f not is within 0 ULPs of 1.00000012e+00f ([1.00000012e+00, 1.00000012e+00]) +# Floating point matchers: float +ok {test-number} - 1.f, WithinULP(1.f, 0) for: 1.0f is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) +# Floating point matchers: float +ok {test-number} - -0.f, WithinULP(0.f, 0) for: -0.0f is within 0 ULPs of 0.00000000e+00f ([0.00000000e+00, 0.00000000e+00]) +# Floating point matchers: float +ok {test-number} - 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.00000000e+00f ([9.99999940e-01, 1.00000012e+00]) ) +# Floating point matchers: float +ok {test-number} - 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.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) ) +# Floating point matchers: float +ok {test-number} - 0.0001f, WithinAbs(0.f, 0.001f) || WithinRel(0.f, 0.1f) for: 0.0001f ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) +# Floating point matchers: float +ok {test-number} - WithinAbs(1.f, 0.f) +# Floating point matchers: float +ok {test-number} - WithinAbs(1.f, -1.f), std::domain_error +# Floating point matchers: float +ok {test-number} - WithinULP(1.f, 0) +# Floating point matchers: float +ok {test-number} - WithinULP(1.f, static_cast<uint64_t>(-1)), std::domain_error +# Floating point matchers: float +ok {test-number} - WithinRel(1.f, 0.f) +# Floating point matchers: float +ok {test-number} - WithinRel(1.f, -0.2f), std::domain_error +# Floating point matchers: float +ok {test-number} - WithinRel(1.f, 1.f), std::domain_error +# Generators -- adapters +ok {test-number} - i % 2 == 0 for: 0 == 0 +# Generators -- adapters +ok {test-number} - i % 2 == 0 for: 0 == 0 +# Generators -- adapters +ok {test-number} - i % 2 == 0 for: 0 == 0 +# Generators -- adapters +ok {test-number} - filter([] (int) {return false; }, value(1)), Catch::GeneratorException +# Generators -- adapters +ok {test-number} - i < 4 for: 1 < 4 +# Generators -- adapters +ok {test-number} - i < 4 for: 2 < 4 +# Generators -- adapters +ok {test-number} - i < 4 for: 3 < 4 +# Generators -- adapters +ok {test-number} - i % 2 == 0 for: 0 == 0 +# Generators -- adapters +ok {test-number} - i % 2 == 0 for: 0 == 0 +# Generators -- adapters +ok {test-number} - i % 2 == 0 for: 0 == 0 +# Generators -- adapters +ok {test-number} - i.size() == 1 for: 1 == 1 +# Generators -- adapters +ok {test-number} - i.size() == 1 for: 1 == 1 +# Generators -- adapters +ok {test-number} - i.size() == 1 for: 1 == 1 +# Generators -- adapters +ok {test-number} - i.size() == 1 for: 1 == 1 +# Generators -- adapters +ok {test-number} - i.size() == 1 for: 1 == 1 +# Generators -- adapters +ok {test-number} - i.size() == 1 for: 1 == 1 +# Generators -- adapters +ok {test-number} - j > 0 for: 1 > 0 +# Generators -- adapters +ok {test-number} - j > 0 for: 2 > 0 +# Generators -- adapters +ok {test-number} - j > 0 for: 3 > 0 +# Generators -- adapters +ok {test-number} - j > 0 for: 1 > 0 +# Generators -- adapters +ok {test-number} - j > 0 for: 2 > 0 +# Generators -- adapters +ok {test-number} - j > 0 for: 3 > 0 +# Generators -- adapters +ok {test-number} - chunk2.size() == 2 for: 2 == 2 +# Generators -- adapters +ok {test-number} - chunk2.front() == chunk2.back() for: 1 == 1 +# Generators -- adapters +ok {test-number} - chunk2.size() == 2 for: 2 == 2 +# Generators -- adapters +ok {test-number} - chunk2.front() == chunk2.back() for: 2 == 2 +# Generators -- adapters +ok {test-number} - chunk2.size() == 2 for: 2 == 2 +# Generators -- adapters +ok {test-number} - chunk2.front() == chunk2.back() for: 3 == 3 +# Generators -- adapters +ok {test-number} - chunk2.size() == 2 for: 2 == 2 +# Generators -- adapters +ok {test-number} - chunk2.front() == chunk2.back() for: 1 == 1 +# Generators -- adapters +ok {test-number} - chunk2.front() < 3 for: 1 < 3 +# Generators -- adapters +ok {test-number} - chunk2.size() == 2 for: 2 == 2 +# Generators -- adapters +ok {test-number} - chunk2.front() == chunk2.back() for: 2 == 2 +# Generators -- adapters +ok {test-number} - chunk2.front() < 3 for: 2 < 3 +# Generators -- adapters +ok {test-number} - chunk2.size() == 0 for: 0 == 0 +# Generators -- adapters +ok {test-number} - chunk2.size() == 0 for: 0 == 0 +# Generators -- adapters +ok {test-number} - chunk2.size() == 0 for: 0 == 0 +# Generators -- adapters +ok {test-number} - chunk(2, value(1)), Catch::GeneratorException +# Generators -- simple +ok {test-number} - j < i for: -3 < 1 +# Generators -- simple +ok {test-number} - j < i for: -2 < 1 +# Generators -- simple +ok {test-number} - j < i for: -1 < 1 +# Generators -- simple +ok {test-number} - 4u * i > str.size() for: 4 > 1 +# Generators -- simple +ok {test-number} - 4u * i > str.size() for: 4 > 2 +# Generators -- simple +ok {test-number} - 4u * i > str.size() for: 4 > 3 +# Generators -- simple +ok {test-number} - j < i for: -3 < 2 +# Generators -- simple +ok {test-number} - j < i for: -2 < 2 +# Generators -- simple +ok {test-number} - j < i for: -1 < 2 +# Generators -- simple +ok {test-number} - 4u * i > str.size() for: 8 > 1 +# Generators -- simple +ok {test-number} - 4u * i > str.size() for: 8 > 2 +# Generators -- simple +ok {test-number} - 4u * i > str.size() for: 8 > 3 +# Generators -- simple +ok {test-number} - j < i for: -3 < 3 +# Generators -- simple +ok {test-number} - j < i for: -2 < 3 +# Generators -- simple +ok {test-number} - j < i for: -1 < 3 +# Generators -- simple +ok {test-number} - 4u * i > str.size() for: 12 > 1 +# Generators -- simple +ok {test-number} - 4u * i > str.size() for: 12 > 2 +# Generators -- simple +ok {test-number} - 4u * i > str.size() for: 12 > 3 +# Generators internals +ok {test-number} - gen.get() == 123 for: 123 == 123 +# Generators internals +ok {test-number} - !(gen.next()) for: !false +# Generators internals +ok {test-number} - gen.get() == 1 for: 1 == 1 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == 3 for: 3 == 3 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == 5 for: 5 == 5 +# Generators internals +ok {test-number} - !(gen.next()) for: !false +# Generators internals +ok {test-number} - gen.get() == 1 for: 1 == 1 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == 5 for: 5 == 5 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == 2 for: 2 == 2 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == 4 for: 4 == 4 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == 0 for: 0 == 0 +# Generators internals +ok {test-number} - !(gen.next()) for: !false +# Generators internals +ok {test-number} - gen.get().size() == 2 for: 2 == 2 +# Generators internals +ok {test-number} - gen.get() == "aa" for: "aa" == "aa" +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == "bb" for: "bb" == "bb" +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == "cc" for: "cc" == "cc" +# Generators internals +ok {test-number} - !(gen.next()) for: !false +# Generators internals +ok {test-number} - gen.get() == 1 for: 1 == 1 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == 3 for: 3 == 3 +# Generators internals +ok {test-number} - !(gen.next()) for: !false +# Generators internals +ok {test-number} - filter([] (int) { return false; }, value(1)), Catch::GeneratorException +# Generators internals +ok {test-number} - gen.get() == 1 for: 1 == 1 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == 2 for: 2 == 2 +# Generators internals +ok {test-number} - !(gen.next()) for: !false +# Generators internals +ok {test-number} - gen.get() == 1 for: 1 == 1 +# Generators internals +ok {test-number} - !(gen.next()) for: !false +# Generators internals +ok {test-number} - gen.get() == 2.0 for: 2.0 == 2.0 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == 4.0 for: 4.0 == 4.0 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == 6.0 for: 6.0 == 6.0 +# Generators internals +ok {test-number} - !(gen.next()) for: !false +# Generators internals +ok {test-number} - gen.get() == 2.0 for: 2.0 == 2.0 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == 4.0 for: 4.0 == 4.0 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == 6.0 for: 6.0 == 6.0 +# Generators internals +ok {test-number} - !(gen.next()) for: !false +# Generators internals +ok {test-number} - gen.get() == 3 for: 3 == 3 +# Generators internals +ok {test-number} - !(gen.next()) for: !false +# Generators internals +ok {test-number} - gen.get() == 1 for: 1 == 1 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == 2 for: 2 == 2 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == 3 for: 3 == 3 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == 1 for: 1 == 1 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == 2 for: 2 == 2 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == 3 for: 3 == 3 +# Generators internals +ok {test-number} - !(gen.next()) for: !false +# Generators internals +ok {test-number} - gen.get() == -2 for: -2 == -2 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == -1 for: -1 == -1 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == 0 for: 0 == 0 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == 1 for: 1 == 1 +# Generators internals +ok {test-number} - !(gen.next()) for: !false +# Generators internals +ok {test-number} - gen.get() == 2 for: 2 == 2 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == 1 for: 1 == 1 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == 0 for: 0 == 0 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == -1 for: -1 == -1 +# Generators internals +ok {test-number} - !(gen.next()) for: !false +# Generators internals +ok {test-number} - gen.get() == -7 for: -7 == -7 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == -4 for: -4 == -4 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == -1 for: -1 == -1 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == 2 for: 2 == 2 +# Generators internals +ok {test-number} - !(gen.next()) for: !false +# Generators internals +ok {test-number} - gen.get() == -7 for: -7 == -7 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == -4 for: -4 == -4 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == -1 for: -1 == -1 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == 2 for: 2 == 2 +# Generators internals +ok {test-number} - !(gen.next()) for: !false +# Generators internals +ok {test-number} - gen.get() == -7 for: -7 == -7 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == -4 for: -4 == -4 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == -1 for: -1 == -1 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == 2 for: 2 == 2 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == 5 for: 5 == 5 +# Generators internals +ok {test-number} - !(gen.next()) for: !false +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: -1.0 == Approx( -1.0 ) with 1 message: 'Current expected value is -1' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is -1' +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: -0.9 == Approx( -0.9 ) with 1 message: 'Current expected value is -0.9' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is -0.9' +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: -0.8 == Approx( -0.8 ) with 1 message: 'Current expected value is -0.8' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is -0.8' +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: -0.7 == Approx( -0.7 ) with 1 message: 'Current expected value is -0.7' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is -0.7' +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: -0.6 == Approx( -0.6 ) with 1 message: 'Current expected value is -0.6' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is -0.6' +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: -0.5 == Approx( -0.5 ) with 1 message: 'Current expected value is -0.5' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is -0.5' +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: -0.4 == Approx( -0.4 ) with 1 message: 'Current expected value is -0.4' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is -0.4' +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: -0.3 == Approx( -0.3 ) with 1 message: 'Current expected value is -0.3' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is -0.3' +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: -0.2 == Approx( -0.2 ) with 1 message: 'Current expected value is -0.2' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is -0.2' +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: -0.1 == Approx( -0.1 ) with 1 message: 'Current expected value is -0.1' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is -0.1' +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: -0.0 == Approx( -0.0 ) with 1 message: 'Current expected value is -1.38778e-16' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is -1.38778e-16' +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: 0.1 == Approx( 0.1 ) with 1 message: 'Current expected value is 0.1' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is 0.1' +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: 0.2 == Approx( 0.2 ) with 1 message: 'Current expected value is 0.2' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is 0.2' +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: 0.3 == Approx( 0.3 ) with 1 message: 'Current expected value is 0.3' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is 0.3' +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: 0.4 == Approx( 0.4 ) with 1 message: 'Current expected value is 0.4' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is 0.4' +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: 0.5 == Approx( 0.5 ) with 1 message: 'Current expected value is 0.5' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is 0.5' +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: 0.6 == Approx( 0.6 ) with 1 message: 'Current expected value is 0.6' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is 0.6' +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: 0.7 == Approx( 0.7 ) with 1 message: 'Current expected value is 0.7' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is 0.7' +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: 0.8 == Approx( 0.8 ) with 1 message: 'Current expected value is 0.8' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is 0.8' +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: 0.9 == Approx( 0.9 ) with 1 message: 'Current expected value is 0.9' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is 0.9' +# Generators internals +ok {test-number} - gen.get() == Approx( rangeEnd ) for: 1.0 == Approx( 1.0 ) +# Generators internals +ok {test-number} - !(gen.next()) for: !false +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: -1.0 == Approx( -1.0 ) with 1 message: 'Current expected value is -1' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is -1' +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: -0.7 == Approx( -0.7 ) with 1 message: 'Current expected value is -0.7' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is -0.7' +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: -0.4 == Approx( -0.4 ) with 1 message: 'Current expected value is -0.4' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is -0.4' +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: -0.1 == Approx( -0.1 ) with 1 message: 'Current expected value is -0.1' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is -0.1' +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: 0.2 == Approx( 0.2 ) with 1 message: 'Current expected value is 0.2' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is 0.2' +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: 0.5 == Approx( 0.5 ) with 1 message: 'Current expected value is 0.5' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is 0.5' +# Generators internals +ok {test-number} - !(gen.next()) for: !false +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: -1.0 == Approx( -1.0 ) with 1 message: 'Current expected value is -1' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is -1' +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: -0.7 == Approx( -0.7 ) with 1 message: 'Current expected value is -0.7' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is -0.7' +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: -0.4 == Approx( -0.4 ) with 1 message: 'Current expected value is -0.4' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is -0.4' +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: -0.1 == Approx( -0.1 ) with 1 message: 'Current expected value is -0.1' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is -0.1' +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: 0.2 == Approx( 0.2 ) with 1 message: 'Current expected value is 0.2' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is 0.2' +# Generators internals +ok {test-number} - gen.get() == Approx(expected) for: 0.5 == Approx( 0.5 ) with 1 message: 'Current expected value is 0.5' +# Generators internals +ok {test-number} - gen.next() for: true with 1 message: 'Current expected value is 0.5' +# Generators internals +ok {test-number} - !(gen.next()) for: !false +# Generators internals +ok {test-number} - gen.get() == 5 for: 5 == 5 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == 2 for: 2 == 2 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == -1 for: -1 == -1 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == -4 for: -4 == -4 +# Generators internals +ok {test-number} - !(gen.next()) for: !false +# Generators internals +ok {test-number} - gen.get() == 5 for: 5 == 5 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == 2 for: 2 == 2 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == -1 for: -1 == -1 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == -4 for: -4 == -4 +# Generators internals +ok {test-number} - !(gen.next()) for: !false +# Generators internals +ok {test-number} - gen.get() == 5 for: 5 == 5 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == 2 for: 2 == 2 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == -1 for: -1 == -1 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == -4 for: -4 == -4 +# Generators internals +ok {test-number} - gen.next() for: true +# Generators internals +ok {test-number} - gen.get() == -7 for: -7 == -7 +# Generators internals +ok {test-number} - !(gen.next()) for: !false +# Greater-than inequalities with different epsilons +ok {test-number} - d >= Approx( 1.22 ) for: 1.23 >= Approx( 1.22 ) +# Greater-than inequalities with different epsilons +ok {test-number} - d >= Approx( 1.23 ) for: 1.23 >= Approx( 1.23 ) +# Greater-than inequalities with different epsilons +ok {test-number} - !(d >= Approx( 1.24 )) for: !(1.23 >= Approx( 1.24 )) +# Greater-than inequalities with different epsilons +ok {test-number} - d >= Approx( 1.24 ).epsilon(0.1) for: 1.23 >= Approx( 1.24 ) +# INFO and WARN do not abort tests +warning {test-number} - 'this is a message' with 1 message: 'this is a warning' +# INFO gets logged on failure +not ok {test-number} - a == 1 for: 2 == 1 with 2 messages: 'this message should be logged' and 'so should this' +# INFO gets logged on failure, even if captured before successful assertions +ok {test-number} - a == 2 for: 2 == 2 with 1 message: 'this message may be logged later' +# INFO gets logged on failure, even if captured before successful assertions +not ok {test-number} - a == 1 for: 2 == 1 with 2 messages: 'this message may be logged later' and 'this message should be logged' +# INFO gets logged on failure, even if captured before successful assertions +not ok {test-number} - 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' +# INFO gets logged on failure, even if captured before successful assertions +ok {test-number} - 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' +# INFO is reset for each loop +ok {test-number} - i < 10 for: 0 < 10 with 2 messages: 'current counter 0' and 'i := 0' +# INFO is reset for each loop +ok {test-number} - i < 10 for: 1 < 10 with 2 messages: 'current counter 1' and 'i := 1' +# INFO is reset for each loop +ok {test-number} - i < 10 for: 2 < 10 with 2 messages: 'current counter 2' and 'i := 2' +# INFO is reset for each loop +ok {test-number} - i < 10 for: 3 < 10 with 2 messages: 'current counter 3' and 'i := 3' +# INFO is reset for each loop +ok {test-number} - i < 10 for: 4 < 10 with 2 messages: 'current counter 4' and 'i := 4' +# INFO is reset for each loop +ok {test-number} - i < 10 for: 5 < 10 with 2 messages: 'current counter 5' and 'i := 5' +# INFO is reset for each loop +ok {test-number} - i < 10 for: 6 < 10 with 2 messages: 'current counter 6' and 'i := 6' +# INFO is reset for each loop +ok {test-number} - i < 10 for: 7 < 10 with 2 messages: 'current counter 7' and 'i := 7' +# INFO is reset for each loop +ok {test-number} - i < 10 for: 8 < 10 with 2 messages: 'current counter 8' and 'i := 8' +# INFO is reset for each loop +ok {test-number} - i < 10 for: 9 < 10 with 2 messages: 'current counter 9' and 'i := 9' +# INFO is reset for each loop +not ok {test-number} - i < 10 for: 10 < 10 with 2 messages: 'current counter 10' and 'i := 10' +# Inequality checks that should fail +not ok {test-number} - data.int_seven != 7 for: 7 != 7 +# Inequality checks that should fail +not ok {test-number} - data.float_nine_point_one != Approx( 9.1f ) for: 9.1f != Approx( 9.1000003815 ) +# Inequality checks that should fail +not ok {test-number} - data.double_pi != Approx( 3.1415926535 ) for: 3.1415926535 != Approx( 3.1415926535 ) +# Inequality checks that should fail +not ok {test-number} - data.str_hello != "hello" for: "hello" != "hello" +# Inequality checks that should fail +not ok {test-number} - data.str_hello.size() != 5 for: 5 != 5 +# Inequality checks that should succeed +ok {test-number} - data.int_seven != 6 for: 7 != 6 +# Inequality checks that should succeed +ok {test-number} - data.int_seven != 8 for: 7 != 8 +# Inequality checks that should succeed +ok {test-number} - data.float_nine_point_one != Approx( 9.11f ) for: 9.1f != Approx( 9.1099996567 ) +# Inequality checks that should succeed +ok {test-number} - data.float_nine_point_one != Approx( 9.0f ) for: 9.1f != Approx( 9.0 ) +# Inequality checks that should succeed +ok {test-number} - data.float_nine_point_one != Approx( 1 ) for: 9.1f != Approx( 1.0 ) +# Inequality checks that should succeed +ok {test-number} - data.float_nine_point_one != Approx( 0 ) for: 9.1f != Approx( 0.0 ) +# Inequality checks that should succeed +ok {test-number} - data.double_pi != Approx( 3.1415 ) for: 3.1415926535 != Approx( 3.1415 ) +# Inequality checks that should succeed +ok {test-number} - data.str_hello != "goodbye" for: "hello" != "goodbye" +# Inequality checks that should succeed +ok {test-number} - data.str_hello != "hell" for: "hello" != "hell" +# Inequality checks that should succeed +ok {test-number} - data.str_hello != "hello1" for: "hello" != "hello1" +# Inequality checks that should succeed +ok {test-number} - data.str_hello.size() != 6 for: 5 != 6 +# Lambdas in assertions +ok {test-number} - []() { return true; }() for: true +# Less-than inequalities with different epsilons +ok {test-number} - d <= Approx( 1.24 ) for: 1.23 <= Approx( 1.24 ) +# Less-than inequalities with different epsilons +ok {test-number} - d <= Approx( 1.23 ) for: 1.23 <= Approx( 1.23 ) +# Less-than inequalities with different epsilons +ok {test-number} - !(d <= Approx( 1.22 )) for: !(1.23 <= Approx( 1.22 )) +# Less-than inequalities with different epsilons +ok {test-number} - d <= Approx( 1.22 ).epsilon(0.1) for: 1.23 <= Approx( 1.22 ) +# ManuallyRegistered +ok {test-number} - with 1 message: 'was called' +# Matchers can be (AllOf) composed with the && operator +ok {test-number} - 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 can be (AnyOf) composed with the || operator +ok {test-number} - testStringForMatching(), Contains("string") || Contains("different") || Contains("random") for: "this string contains 'abc' as a substring" ( contains: "string" or contains: "different" or contains: "random" ) +# Matchers can be (AnyOf) composed with the || operator +ok {test-number} - 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 can be composed with both && and || +ok {test-number} - testStringForMatching(), (Contains("string") || Contains("different")) && Contains("substring") for: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "substring" ) +# Matchers can be composed with both && and || - failing +not ok {test-number} - testStringForMatching(), (Contains("string") || Contains("different")) && Contains("random") for: "this string contains 'abc' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" ) +# Matchers can be negated (Not) with the ! operator +ok {test-number} - testStringForMatching(), !Contains("different") for: "this string contains 'abc' as a substring" not contains: "different" +# Matchers can be negated (Not) with the ! operator - failing +not ok {test-number} - testStringForMatching(), !Contains("substring") for: "this string contains 'abc' as a substring" not contains: "substring" +# Mismatching exception messages failing the test +ok {test-number} - thisThrows(), "expected exception" for: "expected exception" equals: "expected exception" +# Mismatching exception messages failing the test +not ok {test-number} - thisThrows(), "should fail" for: "expected exception" equals: "should fail" +# Nested generators and captured variables +ok {test-number} - values > -6 for: 3 > -6 +# Nested generators and captured variables +ok {test-number} - values > -6 for: 4 > -6 +# Nested generators and captured variables +ok {test-number} - values > -6 for: 5 > -6 +# Nested generators and captured variables +ok {test-number} - values > -6 for: 6 > -6 +# Nested generators and captured variables +ok {test-number} - values > -6 for: -5 > -6 +# Nested generators and captured variables +ok {test-number} - values > -6 for: -4 > -6 +# Nested generators and captured variables +ok {test-number} - values > -6 for: 90 > -6 +# Nested generators and captured variables +ok {test-number} - values > -6 for: 91 > -6 +# Nested generators and captured variables +ok {test-number} - values > -6 for: 92 > -6 +# Nested generators and captured variables +ok {test-number} - values > -6 for: 93 > -6 +# Nested generators and captured variables +ok {test-number} - values > -6 for: 94 > -6 +# Nested generators and captured variables +ok {test-number} - values > -6 for: 95 > -6 +# Nested generators and captured variables +ok {test-number} - values > -6 for: 96 > -6 +# Nested generators and captured variables +ok {test-number} - values > -6 for: 97 > -6 +# Nested generators and captured variables +ok {test-number} - values > -6 for: 98 > -6 +# Nested generators and captured variables +ok {test-number} - values > -6 for: 99 > -6 +# Nice descriptive name +warning {test-number} - 'This one ran' +# Non-std exceptions can be translated +not ok {test-number} - unexpected exception with message: 'custom exception' +# Objects that evaluated in boolean contexts can be checked +ok {test-number} - True for: {?} +# Objects that evaluated in boolean contexts can be checked +ok {test-number} - !False for: true +# Objects that evaluated in boolean contexts can be checked +ok {test-number} - !(False) for: !{?} +# Optionally static assertions +ok {test-number} - with 1 message: 'std::is_void<void>::value' +# Optionally static assertions +ok {test-number} - with 1 message: '!(std::is_void<int>::value)' +# Ordering comparison checks that should fail +not ok {test-number} - data.int_seven > 7 for: 7 > 7 +# Ordering comparison checks that should fail +not ok {test-number} - data.int_seven < 7 for: 7 < 7 +# Ordering comparison checks that should fail +not ok {test-number} - data.int_seven > 8 for: 7 > 8 +# Ordering comparison checks that should fail +not ok {test-number} - data.int_seven < 6 for: 7 < 6 +# Ordering comparison checks that should fail +not ok {test-number} - data.int_seven < 0 for: 7 < 0 +# Ordering comparison checks that should fail +not ok {test-number} - data.int_seven < -1 for: 7 < -1 +# Ordering comparison checks that should fail +not ok {test-number} - data.int_seven >= 8 for: 7 >= 8 +# Ordering comparison checks that should fail +not ok {test-number} - data.int_seven <= 6 for: 7 <= 6 +# Ordering comparison checks that should fail +not ok {test-number} - data.float_nine_point_one < 9 for: 9.1f < 9 +# Ordering comparison checks that should fail +not ok {test-number} - data.float_nine_point_one > 10 for: 9.1f > 10 +# Ordering comparison checks that should fail +not ok {test-number} - data.float_nine_point_one > 9.2 for: 9.1f > 9.2 +# Ordering comparison checks that should fail +not ok {test-number} - data.str_hello > "hello" for: "hello" > "hello" +# Ordering comparison checks that should fail +not ok {test-number} - data.str_hello < "hello" for: "hello" < "hello" +# Ordering comparison checks that should fail +not ok {test-number} - data.str_hello > "hellp" for: "hello" > "hellp" +# Ordering comparison checks that should fail +not ok {test-number} - data.str_hello > "z" for: "hello" > "z" +# Ordering comparison checks that should fail +not ok {test-number} - data.str_hello < "hellm" for: "hello" < "hellm" +# Ordering comparison checks that should fail +not ok {test-number} - data.str_hello < "a" for: "hello" < "a" +# Ordering comparison checks that should fail +not ok {test-number} - data.str_hello >= "z" for: "hello" >= "z" +# Ordering comparison checks that should fail +not ok {test-number} - data.str_hello <= "a" for: "hello" <= "a" +# Ordering comparison checks that should succeed +ok {test-number} - data.int_seven < 8 for: 7 < 8 +# Ordering comparison checks that should succeed +ok {test-number} - data.int_seven > 6 for: 7 > 6 +# Ordering comparison checks that should succeed +ok {test-number} - data.int_seven > 0 for: 7 > 0 +# Ordering comparison checks that should succeed +ok {test-number} - data.int_seven > -1 for: 7 > -1 +# Ordering comparison checks that should succeed +ok {test-number} - data.int_seven >= 7 for: 7 >= 7 +# Ordering comparison checks that should succeed +ok {test-number} - data.int_seven >= 6 for: 7 >= 6 +# Ordering comparison checks that should succeed +ok {test-number} - data.int_seven <= 7 for: 7 <= 7 +# Ordering comparison checks that should succeed +ok {test-number} - data.int_seven <= 8 for: 7 <= 8 +# Ordering comparison checks that should succeed +ok {test-number} - data.float_nine_point_one > 9 for: 9.1f > 9 +# Ordering comparison checks that should succeed +ok {test-number} - data.float_nine_point_one < 10 for: 9.1f < 10 +# Ordering comparison checks that should succeed +ok {test-number} - data.float_nine_point_one < 9.2 for: 9.1f < 9.2 +# Ordering comparison checks that should succeed +ok {test-number} - data.str_hello <= "hello" for: "hello" <= "hello" +# Ordering comparison checks that should succeed +ok {test-number} - data.str_hello >= "hello" for: "hello" >= "hello" +# Ordering comparison checks that should succeed +ok {test-number} - data.str_hello < "hellp" for: "hello" < "hellp" +# Ordering comparison checks that should succeed +ok {test-number} - data.str_hello < "zebra" for: "hello" < "zebra" +# Ordering comparison checks that should succeed +ok {test-number} - data.str_hello > "hellm" for: "hello" > "hellm" +# Ordering comparison checks that should succeed +ok {test-number} - data.str_hello > "a" for: "hello" > "a" +# Our PCG implementation provides expected results for known seeds +ok {test-number} - rng() == 0x<hex digits> for: 4242248763 (0x<hex digits>) == 4242248763 (0x<hex digits>) +# Our PCG implementation provides expected results for known seeds +ok {test-number} - rng() == 0x<hex digits> for: 1867888929 (0x<hex digits>) == 1867888929 (0x<hex digits>) +# Our PCG implementation provides expected results for known seeds +ok {test-number} - rng() == 0x<hex digits> for: 1276619030 (0x<hex digits>) == 1276619030 (0x<hex digits>) +# Our PCG implementation provides expected results for known seeds +ok {test-number} - rng() == 0x<hex digits> for: 1911218783 (0x<hex digits>) == 1911218783 (0x<hex digits>) +# Our PCG implementation provides expected results for known seeds +ok {test-number} - rng() == 0x<hex digits> for: 1827115164 (0x<hex digits>) == 1827115164 (0x<hex digits>) +# Our PCG implementation provides expected results for known seeds +ok {test-number} - rng() == 0x<hex digits> for: 1472234645 (0x<hex digits>) == 1472234645 (0x<hex digits>) +# Our PCG implementation provides expected results for known seeds +ok {test-number} - rng() == 0x<hex digits> for: 868832940 (0x<hex digits>) == 868832940 (0x<hex digits>) +# Our PCG implementation provides expected results for known seeds +ok {test-number} - rng() == 0x<hex digits> for: 570883446 (0x<hex digits>) == 570883446 (0x<hex digits>) +# Our PCG implementation provides expected results for known seeds +ok {test-number} - rng() == 0x<hex digits> for: 889299803 (0x<hex digits>) == 889299803 (0x<hex digits>) +# Our PCG implementation provides expected results for known seeds +ok {test-number} - rng() == 0x<hex digits> for: 4261393167 (0x<hex digits>) == 4261393167 (0x<hex digits>) +# Our PCG implementation provides expected results for known seeds +ok {test-number} - rng() == 0x<hex digits> for: 1472234645 (0x<hex digits>) == 1472234645 (0x<hex digits>) +# Our PCG implementation provides expected results for known seeds +ok {test-number} - rng() == 0x<hex digits> for: 868832940 (0x<hex digits>) == 868832940 (0x<hex digits>) +# Our PCG implementation provides expected results for known seeds +ok {test-number} - rng() == 0x<hex digits> for: 570883446 (0x<hex digits>) == 570883446 (0x<hex digits>) +# Our PCG implementation provides expected results for known seeds +ok {test-number} - rng() == 0x<hex digits> for: 889299803 (0x<hex digits>) == 889299803 (0x<hex digits>) +# Our PCG implementation provides expected results for known seeds +ok {test-number} - rng() == 0x<hex digits> for: 4261393167 (0x<hex digits>) == 4261393167 (0x<hex digits>) +# Output from all sections is reported +not ok {test-number} - explicitly with 1 message: 'Message from section one' +# Output from all sections is reported +not ok {test-number} - explicitly with 1 message: 'Message from section two' +# Overloaded comma or address-of operators are not used +ok {test-number} - (EvilMatcher(), EvilMatcher()), EvilCommaOperatorUsed +# Overloaded comma or address-of operators are not used +ok {test-number} - &EvilMatcher(), EvilAddressOfOperatorUsed +# Overloaded comma or address-of operators are not used +ok {test-number} - EvilMatcher() || (EvilMatcher() && !EvilMatcher()) +# Overloaded comma or address-of operators are not used +ok {test-number} - (EvilMatcher() && EvilMatcher()) || !EvilMatcher() +# Parse test names and tags +ok {test-number} - spec.hasFilters() == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.hasFilters() == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.hasFilters() == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.hasFilters() == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.hasFilters() == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.hasFilters() == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcC ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.hasFilters() == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcC ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcD ) == false for: false == false +# Parse test names and tags +ok {test-number} - parseTestSpec( "*a" ).matches( *tcA ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.hasFilters() == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcC ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcD ) == false for: false == false +# Parse test names and tags +ok {test-number} - parseTestSpec( "a*" ).matches( *tcA ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.hasFilters() == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcC ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcD ) == true for: true == true +# Parse test names and tags +ok {test-number} - parseTestSpec( "*a*" ).matches( *tcA ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.hasFilters() == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.hasFilters() == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.hasFilters() == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.hasFilters() == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcC ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcD ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.hasFilters() == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcC ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcD ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.hasFilters() == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcC ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.hasFilters() == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcC ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.hasFilters() == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcC ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.hasFilters() == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcC ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.hasFilters() == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcC ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcD ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.hasFilters() == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcC ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.hasFilters() == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcC ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.hasFilters() == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcC ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcD ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.hasFilters() == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcC ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcD ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.hasFilters() == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcC ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcD ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.hasFilters() == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcC ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcD ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.hasFilters() == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcC ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcD ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.hasFilters() == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcC ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcD ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.hasFilters() == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcC ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcD ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.hasFilters() == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcC ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcD ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.hasFilters() == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcC ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcD ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.hasFilters() == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *tcA ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcB ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcC ) == false for: false == false +# Parse test names and tags +ok {test-number} - spec.matches( *tcD ) == true for: true == true +# Parse test names and tags +ok {test-number} - spec.matches( *fakeTestCase( " aardvark " ) ) for: true +# Parse test names and tags +ok {test-number} - spec.matches( *fakeTestCase( " aardvark" ) ) for: true +# Parse test names and tags +ok {test-number} - spec.matches( *fakeTestCase( " aardvark " ) ) for: true +# Parse test names and tags +ok {test-number} - spec.matches( *fakeTestCase( "aardvark " ) ) for: true +# Parse test names and tags +ok {test-number} - spec.matches( *fakeTestCase( "aardvark" ) ) for: true +# Parse test names and tags +ok {test-number} - spec.matches( *fakeTestCase( " aardvark " ) ) for: true +# Parse test names and tags +ok {test-number} - spec.matches( *fakeTestCase( " aardvark" ) ) for: true +# Parse test names and tags +ok {test-number} - spec.matches( *fakeTestCase( " aardvark " ) ) for: true +# Parse test names and tags +ok {test-number} - spec.matches( *fakeTestCase( "aardvark " ) ) for: true +# Parse test names and tags +ok {test-number} - spec.matches( *fakeTestCase( "aardvark" ) ) for: true +# Parse test names and tags +ok {test-number} - spec.matches(*fakeTestCase("hidden and foo", "[.][foo]")) for: true +# Parse test names and tags +ok {test-number} - !(spec.matches(*fakeTestCase("only foo", "[foo]"))) for: !false +# Parse test names and tags +ok {test-number} - !(spec.matches(*fakeTestCase("hidden and foo", "[.][foo]"))) for: !false +# Parse test names and tags +ok {test-number} - !(spec.matches(*fakeTestCase("only foo", "[foo]"))) for: !false +# Parse test names and tags +ok {test-number} - !(spec.matches(*fakeTestCase("only hidden", "[.]"))) for: !false +# Parse test names and tags +ok {test-number} - spec.matches(*fakeTestCase("neither foo nor hidden", "[bar]")) for: true +# Pointers can be compared to null +ok {test-number} - p == 0 for: 0 == 0 +# Pointers can be compared to null +ok {test-number} - p == pNULL for: 0 == 0 +# Pointers can be compared to null +ok {test-number} - p != 0 for: 0x<hex digits> != 0 +# Pointers can be compared to null +ok {test-number} - cp != 0 for: 0x<hex digits> != 0 +# Pointers can be compared to null +ok {test-number} - cpc != 0 for: 0x<hex digits> != 0 +# Pointers can be compared to null +ok {test-number} - returnsNull() == 0 for: {null string} == 0 +# Pointers can be compared to null +ok {test-number} - returnsConstNull() == 0 for: {null string} == 0 +# Pointers can be compared to null +ok {test-number} - 0 != p for: 0 != 0x<hex digits> +# Precision of floating point stringification can be set +ok {test-number} - str1.size() == 3 + 5 for: 8 == 8 +# Precision of floating point stringification can be set +ok {test-number} - str2.size() == 3 + 10 for: 13 == 13 +# Precision of floating point stringification can be set +ok {test-number} - str1.size() == 2 + 5 for: 7 == 7 +# Precision of floating point stringification can be set +ok {test-number} - str2.size() == 2 + 15 for: 17 == 17 +# Predicate matcher can accept const char* +ok {test-number} - "foo", Predicate<const char*>([] (const char* const&) { return true; }) for: "foo" matches undescribed predicate +# Process can be configured on command line +ok {test-number} - result for: {?} +# Process can be configured on command line +ok {test-number} - config.processName == "" for: "" == "" +# Process can be configured on command line +ok {test-number} - result for: {?} +# Process can be configured on command line +ok {test-number} - config.processName == "test" for: "test" == "test" +# Process can be configured on command line +ok {test-number} - config.shouldDebugBreak == false for: false == false +# Process can be configured on command line +ok {test-number} - config.abortAfter == -1 for: -1 == -1 +# Process can be configured on command line +ok {test-number} - config.noThrow == false for: false == false +# Process can be configured on command line +ok {test-number} - config.reporterName == "console" for: "console" == "console" +# Process can be configured on command line +ok {test-number} - !(cfg.hasTestFilters()) for: !false +# Process can be configured on command line +ok {test-number} - result for: {?} +# Process can be configured on command line +ok {test-number} - cfg.hasTestFilters() for: true +# Process can be configured on command line +ok {test-number} - cfg.testSpec().matches(*fakeTestCase("notIncluded")) == false for: false == false +# Process can be configured on command line +ok {test-number} - cfg.testSpec().matches(*fakeTestCase("test1")) for: true +# Process can be configured on command line +ok {test-number} - result for: {?} +# Process can be configured on command line +ok {test-number} - cfg.hasTestFilters() for: true +# Process can be configured on command line +ok {test-number} - cfg.testSpec().matches(*fakeTestCase("test1")) == false for: false == false +# Process can be configured on command line +ok {test-number} - cfg.testSpec().matches(*fakeTestCase("alwaysIncluded")) for: true +# Process can be configured on command line +ok {test-number} - result for: {?} +# Process can be configured on command line +ok {test-number} - cfg.hasTestFilters() for: true +# Process can be configured on command line +ok {test-number} - cfg.testSpec().matches(*fakeTestCase("test1")) == false for: false == false +# Process can be configured on command line +ok {test-number} - cfg.testSpec().matches(*fakeTestCase("alwaysIncluded")) for: true +# Process can be configured on command line +ok {test-number} - cli.parse({"test", "-r", "console"}) for: {?} +# Process can be configured on command line +ok {test-number} - config.reporterName == "console" for: "console" == "console" +# Process can be configured on command line +ok {test-number} - cli.parse({"test", "-r", "xml"}) for: {?} +# Process can be configured on command line +ok {test-number} - config.reporterName == "xml" for: "xml" == "xml" +# Process can be configured on command line +ok {test-number} - cli.parse({"test", "--reporter", "junit"}) for: {?} +# Process can be configured on command line +ok {test-number} - config.reporterName == "junit" for: "junit" == "junit" +# Process can be configured on command line +ok {test-number} - !(cli.parse({ "test", "-r", "xml", "-r", "junit" })) for: !{?} +# Process can be configured on command line +ok {test-number} - !result for: true +# Process can be configured on command line +ok {test-number} - result.errorMessage(), Contains("Unrecognized reporter") for: "Unrecognized reporter, 'unsupported'. Check available with --list-reporters" contains: "Unrecognized reporter" +# Process can be configured on command line +ok {test-number} - cli.parse({"test", "-b"}) for: {?} +# Process can be configured on command line +ok {test-number} - config.shouldDebugBreak == true for: true == true +# Process can be configured on command line +ok {test-number} - cli.parse({"test", "--break"}) for: {?} +# Process can be configured on command line +ok {test-number} - config.shouldDebugBreak for: true +# Process can be configured on command line +ok {test-number} - cli.parse({"test", "-a"}) for: {?} +# Process can be configured on command line +ok {test-number} - config.abortAfter == 1 for: 1 == 1 +# Process can be configured on command line +ok {test-number} - cli.parse({"test", "-x", "2"}) for: {?} +# Process can be configured on command line +ok {test-number} - config.abortAfter == 2 for: 2 == 2 +# Process can be configured on command line +ok {test-number} - !result for: true +# Process can be configured on command line +ok {test-number} - result.errorMessage(), Contains("convert") && Contains("oops") for: "Unable to convert 'oops' to destination type" ( contains: "convert" and contains: "oops" ) +# Process can be configured on command line +ok {test-number} - cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) for: {?} +# Process can be configured on command line +ok {test-number} - config.waitForKeypress == std::get<1>(input) for: 0 == 0 +# Process can be configured on command line +ok {test-number} - cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) for: {?} +# Process can be configured on command line +ok {test-number} - config.waitForKeypress == std::get<1>(input) for: 1 == 1 +# Process can be configured on command line +ok {test-number} - cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) for: {?} +# Process can be configured on command line +ok {test-number} - config.waitForKeypress == std::get<1>(input) for: 2 == 2 +# Process can be configured on command line +ok {test-number} - cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) for: {?} +# Process can be configured on command line +ok {test-number} - config.waitForKeypress == std::get<1>(input) for: 3 == 3 +# Process can be configured on command line +ok {test-number} - !result for: true +# Process can be configured on command line +ok {test-number} - result.errorMessage(), Contains("never") && Contains("both") for: "keypress argument must be one of: never, start, exit or both. 'sometimes' not recognised" ( contains: "never" and contains: "both" ) +# Process can be configured on command line +ok {test-number} - cli.parse({"test", "-e"}) for: {?} +# Process can be configured on command line +ok {test-number} - config.noThrow for: true +# Process can be configured on command line +ok {test-number} - cli.parse({"test", "--nothrow"}) for: {?} +# Process can be configured on command line +ok {test-number} - config.noThrow for: true +# Process can be configured on command line +ok {test-number} - cli.parse({"test", "-o", "filename.ext"}) for: {?} +# Process can be configured on command line +ok {test-number} - config.outputFilename == "filename.ext" for: "filename.ext" == "filename.ext" +# Process can be configured on command line +ok {test-number} - cli.parse({"test", "--out", "filename.ext"}) for: {?} +# Process can be configured on command line +ok {test-number} - config.outputFilename == "filename.ext" for: "filename.ext" == "filename.ext" +# Process can be configured on command line +ok {test-number} - cli.parse({"test", "-abe"}) for: {?} +# Process can be configured on command line +ok {test-number} - config.abortAfter == 1 for: 1 == 1 +# Process can be configured on command line +ok {test-number} - config.shouldDebugBreak for: true +# Process can be configured on command line +ok {test-number} - config.noThrow == true for: true == true +# Process can be configured on command line +ok {test-number} - cli.parse({"test"}) for: {?} +# Process can be configured on command line +ok {test-number} - config.useColour == UseColour::Auto for: 0 == 0 +# Process can be configured on command line +ok {test-number} - cli.parse({"test", "--use-colour", "auto"}) for: {?} +# Process can be configured on command line +ok {test-number} - config.useColour == UseColour::Auto for: 0 == 0 +# Process can be configured on command line +ok {test-number} - cli.parse({"test", "--use-colour", "yes"}) for: {?} +# Process can be configured on command line +ok {test-number} - config.useColour == UseColour::Yes for: 1 == 1 +# Process can be configured on command line +ok {test-number} - cli.parse({"test", "--use-colour", "no"}) for: {?} +# Process can be configured on command line +ok {test-number} - config.useColour == UseColour::No for: 2 == 2 +# Process can be configured on command line +ok {test-number} - !result for: true +# Process can be configured on command line +ok {test-number} - 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" +# Process can be configured on command line +ok {test-number} - cli.parse({ "test", "--benchmark-samples=200" }) for: {?} +# Process can be configured on command line +ok {test-number} - config.benchmarkSamples == 200 for: 200 == 200 +# Process can be configured on command line +ok {test-number} - cli.parse({ "test", "--benchmark-resamples=20000" }) for: {?} +# Process can be configured on command line +ok {test-number} - config.benchmarkResamples == 20000 for: 20000 (0x<hex digits>) == 20000 (0x<hex digits>) +# Process can be configured on command line +ok {test-number} - cli.parse({ "test", "--benchmark-confidence-interval=0.99" }) for: {?} +# Process can be configured on command line +ok {test-number} - config.benchmarkConfidenceInterval == Catch::Approx(0.99) for: 0.99 == Approx( 0.99 ) +# Process can be configured on command line +ok {test-number} - cli.parse({ "test", "--benchmark-no-analysis" }) for: {?} +# Process can be configured on command line +ok {test-number} - config.benchmarkNoAnalysis for: true +# Process can be configured on command line +ok {test-number} - cli.parse({ "test", "--benchmark-warmup-time=10" }) for: {?} +# Process can be configured on command line +ok {test-number} - config.benchmarkWarmupTime == 10 for: 10 == 10 +# Product with differing arities - std::tuple<int, double, float> +ok {test-number} - std::tuple_size<TestType>::value >= 1 for: 3 >= 1 +# Product with differing arities - std::tuple<int, double> +ok {test-number} - std::tuple_size<TestType>::value >= 1 for: 2 >= 1 +# Product with differing arities - std::tuple<int> +ok {test-number} - std::tuple_size<TestType>::value >= 1 for: 1 >= 1 +# Range type with sentinel +ok {test-number} - Catch::Detail::stringify(UsesSentinel{}) == "{ }" for: "{ }" == "{ }" +# Reconstruction should be based on stringification: #914 +not ok {test-number} - truthy(false) for: Hey, its truthy! +# Regex string matcher +not ok {test-number} - 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 +# Regex string matcher +not ok {test-number} - testStringForMatching(), Matches("contains 'abc' as a substring") for: "this string contains 'abc' as a substring" matches "contains 'abc' as a substring" case sensitively +# Regex string matcher +not ok {test-number} - 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 +# Regression test #1 +ok {test-number} - actual, !UnorderedEquals(expected) for: { 'a', 'b' } not UnorderedEquals: { 'c', 'b' } +# Reporter's write listings to provided stream +ok {test-number} - !(factories.empty()) for: !false +# Reporter's write listings to provided stream +ok {test-number} - listingString, Contains("fakeTag"s) for: "All available tags: 1 [fakeTag] 1 tag " contains: "fakeTag" with 1 message: 'Tested reporter: automake' +# Reporter's write listings to provided stream +ok {test-number} - !(factories.empty()) for: !false +# Reporter's write listings to provided stream +ok {test-number} - listingString, Contains("fake reporter"s) for: "Available reporters: fake reporter: fake description " contains: "fake reporter" with 1 message: 'Tested reporter: automake' +# Reporter's write listings to provided stream +ok {test-number} - !(factories.empty()) for: !false +# Reporter's write listings to provided stream +ok {test-number} - listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) for: "All available test cases: fake test name [fakeTestTag] 1 test case " ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: automake' +# Reporter's write listings to provided stream +ok {test-number} - !(factories.empty()) for: !false +# Reporter's write listings to provided stream +ok {test-number} - listingString, Contains("fakeTag"s) for: "All available tags: 1 [fakeTag] 1 tag " contains: "fakeTag" with 1 message: 'Tested reporter: compact' +# Reporter's write listings to provided stream +ok {test-number} - !(factories.empty()) for: !false +# Reporter's write listings to provided stream +ok {test-number} - listingString, Contains("fake reporter"s) for: "Available reporters: fake reporter: fake description " contains: "fake reporter" with 1 message: 'Tested reporter: compact' +# Reporter's write listings to provided stream +ok {test-number} - !(factories.empty()) for: !false +# Reporter's write listings to provided stream +ok {test-number} - listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) for: "All available test cases: fake test name [fakeTestTag] 1 test case " ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: compact' +# Reporter's write listings to provided stream +ok {test-number} - !(factories.empty()) for: !false +# Reporter's write listings to provided stream +ok {test-number} - listingString, Contains("fakeTag"s) for: "All available tags: 1 [fakeTag] 1 tag " contains: "fakeTag" with 1 message: 'Tested reporter: console' +# Reporter's write listings to provided stream +ok {test-number} - !(factories.empty()) for: !false +# Reporter's write listings to provided stream +ok {test-number} - listingString, Contains("fake reporter"s) for: "Available reporters: fake reporter: fake description " contains: "fake reporter" with 1 message: 'Tested reporter: console' +# Reporter's write listings to provided stream +ok {test-number} - !(factories.empty()) for: !false +# Reporter's write listings to provided stream +ok {test-number} - listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) for: "All available test cases: fake test name [fakeTestTag] 1 test case " ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: console' +# Reporter's write listings to provided stream +ok {test-number} - !(factories.empty()) for: !false +# Reporter's write listings to provided stream +ok {test-number} - listingString, Contains("fakeTag"s) for: "<?xml version="1.0" encoding="UTF-8"?> All available tags: 1 [fakeTag] 1 tag " contains: "fakeTag" with 1 message: 'Tested reporter: junit' +# Reporter's write listings to provided stream +ok {test-number} - !(factories.empty()) for: !false +# Reporter's write listings to provided stream +ok {test-number} - listingString, Contains("fake reporter"s) for: "<?xml version="1.0" encoding="UTF-8"?> Available reporters: fake reporter: fake description " contains: "fake reporter" with 1 message: 'Tested reporter: junit' +# Reporter's write listings to provided stream +ok {test-number} - !(factories.empty()) for: !false +# Reporter's write listings to provided stream +ok {test-number} - listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) for: "<?xml version="1.0" encoding="UTF-8"?> All available test cases: fake test name [fakeTestTag] 1 test case " ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: junit' +# Reporter's write listings to provided stream +ok {test-number} - !(factories.empty()) for: !false +# Reporter's write listings to provided stream +ok {test-number} - listingString, Contains("fakeTag"s) for: "<?xml version="1.0" encoding="UTF-8"?> All available tags: 1 [fakeTag] 1 tag " contains: "fakeTag" with 1 message: 'Tested reporter: sonarqube' +# Reporter's write listings to provided stream +ok {test-number} - !(factories.empty()) for: !false +# Reporter's write listings to provided stream +ok {test-number} - listingString, Contains("fake reporter"s) for: "<?xml version="1.0" encoding="UTF-8"?> Available reporters: fake reporter: fake description " contains: "fake reporter" with 1 message: 'Tested reporter: sonarqube' +# Reporter's write listings to provided stream +ok {test-number} - !(factories.empty()) for: !false +# Reporter's write listings to provided stream +ok {test-number} - listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) for: "<?xml version="1.0" encoding="UTF-8"?> All available test cases: fake test name [fakeTestTag] 1 test case " ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: sonarqube' +# Reporter's write listings to provided stream +ok {test-number} - !(factories.empty()) for: !false +# Reporter's write listings to provided stream +ok {test-number} - listingString, Contains("fakeTag"s) for: "All available tags: 1 [fakeTag] 1 tag " contains: "fakeTag" with 1 message: 'Tested reporter: tap' +# Reporter's write listings to provided stream +ok {test-number} - !(factories.empty()) for: !false +# Reporter's write listings to provided stream +ok {test-number} - listingString, Contains("fake reporter"s) for: "Available reporters: fake reporter: fake description " contains: "fake reporter" with 1 message: 'Tested reporter: tap' +# Reporter's write listings to provided stream +ok {test-number} - !(factories.empty()) for: !false +# Reporter's write listings to provided stream +ok {test-number} - listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) for: "All available test cases: fake test name [fakeTestTag] 1 test case " ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: tap' +# Reporter's write listings to provided stream +ok {test-number} - !(factories.empty()) for: !false +# Reporter's write listings to provided stream +ok {test-number} - listingString, Contains("fakeTag"s) for: "All available tags: 1 [fakeTag] 1 tag " contains: "fakeTag" with 1 message: 'Tested reporter: teamcity' +# Reporter's write listings to provided stream +ok {test-number} - !(factories.empty()) for: !false +# Reporter's write listings to provided stream +ok {test-number} - listingString, Contains("fake reporter"s) for: "Available reporters: fake reporter: fake description " contains: "fake reporter" with 1 message: 'Tested reporter: teamcity' +# Reporter's write listings to provided stream +ok {test-number} - !(factories.empty()) for: !false +# Reporter's write listings to provided stream +ok {test-number} - listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) for: "All available test cases: fake test name [fakeTestTag] 1 test case " ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: teamcity' +# Reporter's write listings to provided stream +ok {test-number} - !(factories.empty()) for: !false +# Reporter's write listings to provided stream +ok {test-number} - listingString, Contains("fakeTag"s) for: "<?xml version="1.0" encoding="UTF-8"?> <TagsFromMatchingTests> <Tag> <Count>1</Count> <Aliases> <Alias>fakeTag</Alias> </Aliases> </Tag> </TagsFromMatchingTests>" contains: "fakeTag" with 1 message: 'Tested reporter: xml' +# Reporter's write listings to provided stream +ok {test-number} - !(factories.empty()) for: !false +# Reporter's write listings to provided stream +ok {test-number} - listingString, Contains("fake reporter"s) for: "<?xml version="1.0" encoding="UTF-8"?> <AvailableReporters> <Reporter> <Name>fake reporter</Name> <Description>fake description</Description> </Reporter> </AvailableReporters>" contains: "fake reporter" with 1 message: 'Tested reporter: xml' +# Reporter's write listings to provided stream +ok {test-number} - !(factories.empty()) for: !false +# Reporter's write listings to provided stream +ok {test-number} - listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) for: "<?xml version="1.0" encoding="UTF-8"?> <MatchingTests> <TestCase> <Name>fake test name</Name> <ClassName/> <Tags>[fakeTestTag]</Tags> <SourceInfo> <File>fake-file.cpp</File> <Line>123456789</Line> </SourceInfo> </TestCase> </MatchingTests>" ( contains: "fake test name" and contains: "fakeTestTag" ) with 1 message: 'Tested reporter: xml' +# SUCCEED counts as a test pass +ok {test-number} - with 1 message: 'this is a success' +# SUCCEED does not require an argument +ok {test-number} - +# Scenario: BDD tests requiring Fixtures to provide commonly-accessed data or methods +ok {test-number} - before == 0 for: 0 == 0 +# Scenario: BDD tests requiring Fixtures to provide commonly-accessed data or methods +ok {test-number} - after > before for: 1 > 0 +# Scenario: Do that thing with the thing +ok {test-number} - itDoesThis() for: true +# Scenario: Do that thing with the thing +ok {test-number} - itDoesThat() for: true +# Scenario: This is a really long scenario name to see how the list command deals with wrapping +ok {test-number} - with 1 message: 'boo!' +# Scenario: Vector resizing affects size and capacity +ok {test-number} - v.size() == 0 for: 0 == 0 +# Scenario: Vector resizing affects size and capacity +ok {test-number} - v.size() == 10 for: 10 == 10 +# Scenario: Vector resizing affects size and capacity +ok {test-number} - v.capacity() >= 10 for: 10 >= 10 +# Scenario: Vector resizing affects size and capacity +ok {test-number} - v.size() == 5 for: 5 == 5 +# Scenario: Vector resizing affects size and capacity +ok {test-number} - v.capacity() >= 10 for: 10 >= 10 +# Scenario: Vector resizing affects size and capacity +ok {test-number} - v.size() == 0 for: 0 == 0 +# Scenario: Vector resizing affects size and capacity +ok {test-number} - v.capacity() >= 10 for: 10 >= 10 +# Scenario: Vector resizing affects size and capacity +ok {test-number} - 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 +# Some simple comparisons between doubles +ok {test-number} - d == Approx( 1.23 ) for: 1.23 == Approx( 1.23 ) +# Some simple comparisons between doubles +ok {test-number} - d != Approx( 1.22 ) for: 1.23 != Approx( 1.22 ) +# Some simple comparisons between doubles +ok {test-number} - d != Approx( 1.24 ) for: 1.23 != Approx( 1.24 ) +# Some simple comparisons between doubles +ok {test-number} - d == 1.23_a for: 1.23 == Approx( 1.23 ) +# Some simple comparisons between doubles +ok {test-number} - d != 1.22_a for: 1.23 != Approx( 1.22 ) +# Some simple comparisons between doubles +ok {test-number} - Approx( d ) == 1.23 for: Approx( 1.23 ) == 1.23 +# Some simple comparisons between doubles +ok {test-number} - Approx( d ) != 1.22 for: Approx( 1.23 ) != 1.22 +# Some simple comparisons between doubles +ok {test-number} - Approx( d ) != 1.24 for: Approx( 1.23 ) != 1.24 +Message from section one +Message from section two +# StartsWith string matcher +not ok {test-number} - testStringForMatching(), StartsWith("This String") for: "this string contains 'abc' as a substring" starts with: "This String" +# StartsWith string matcher +not ok {test-number} - testStringForMatching(), StartsWith("string", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" starts with: "string" (case insensitive) +# Static arrays are convertible to string +ok {test-number} - Catch::Detail::stringify(singular) == "{ 1 }" for: "{ 1 }" == "{ 1 }" +# Static arrays are convertible to string +ok {test-number} - Catch::Detail::stringify(arr) == "{ 3, 2, 1 }" for: "{ 3, 2, 1 }" == "{ 3, 2, 1 }" +# Static arrays are convertible to string +ok {test-number} - 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" } }" +# String matchers +ok {test-number} - testStringForMatching(), Contains("string") for: "this string contains 'abc' as a substring" contains: "string" +# String matchers +ok {test-number} - testStringForMatching(), Contains("string", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" contains: "string" (case insensitive) +# String matchers +ok {test-number} - testStringForMatching(), Contains("abc") for: "this string contains 'abc' as a substring" contains: "abc" +# String matchers +ok {test-number} - testStringForMatching(), Contains("aBC", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" contains: "abc" (case insensitive) +# String matchers +ok {test-number} - testStringForMatching(), StartsWith("this") for: "this string contains 'abc' as a substring" starts with: "this" +# String matchers +ok {test-number} - testStringForMatching(), StartsWith("THIS", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" starts with: "this" (case insensitive) +# String matchers +ok {test-number} - testStringForMatching(), EndsWith("substring") for: "this string contains 'abc' as a substring" ends with: "substring" +# String matchers +ok {test-number} - testStringForMatching(), EndsWith(" SuBsTrInG", Catch::CaseSensitive::No) for: "this string contains 'abc' as a substring" ends with: " substring" (case insensitive) +# StringRef +ok {test-number} - empty.empty() for: true +# StringRef +ok {test-number} - empty.size() == 0 for: 0 == 0 +# StringRef +ok {test-number} - empty.isNullTerminated() for: true +# StringRef +ok {test-number} - std::strcmp( empty.c_str(), "" ) == 0 for: 0 == 0 +# StringRef +ok {test-number} - s.empty() == false for: false == false +# StringRef +ok {test-number} - s.size() == 5 for: 5 == 5 +# StringRef +ok {test-number} - s.isNullTerminated() for: true +# StringRef +ok {test-number} - std::strcmp( rawChars, "hello" ) == 0 for: 0 == 0 +# StringRef +ok {test-number} - s.c_str() +# StringRef +ok {test-number} - s.c_str() == rawChars for: "hello" == "hello" +# StringRef +ok {test-number} - s.data() == rawChars for: "hello" == "hello" +# StringRef +ok {test-number} - original == "original" +# StringRef +ok {test-number} - !(original.isNullTerminated()) for: !false +# StringRef +ok {test-number} - original.c_str() +# StringRef +ok {test-number} - original.data() +# StringRef +ok {test-number} - ss.empty() == false for: false == false +# StringRef +ok {test-number} - ss.size() == 5 for: 5 == 5 +# StringRef +ok {test-number} - std::strncmp( ss.data(), "hello", 5 ) == 0 for: 0 == 0 +# StringRef +ok {test-number} - ss == "hello" for: hello == "hello" +# StringRef +ok {test-number} - ss.size() == 6 for: 6 == 6 +# StringRef +ok {test-number} - std::strcmp( ss.c_str(), "world!" ) == 0 for: 0 == 0 +# StringRef +ok {test-number} - s.data() == s2.data() for: "hello world!" == "hello world!" +# StringRef +ok {test-number} - s.data() == ss.data() for: "hello world!" == "hello world!" +# StringRef +ok {test-number} - s.substr(s.size() + 1, 123).empty() for: true +# StringRef +ok {test-number} - std::strcmp(ss.c_str(), "world!") == 0 for: 0 == 0 +# StringRef +ok {test-number} - s.substr(1'000'000, 1).empty() for: true +# StringRef +ok {test-number} - reinterpret_cast<char*>(buffer1) != reinterpret_cast<char*>(buffer2) for: "Hello" != "Hello" +# StringRef +ok {test-number} - left == right for: Hello == Hello +# StringRef +ok {test-number} - left != left.substr(0, 3) for: Hello != Hel +# StringRef +ok {test-number} - sr == "a standard string" for: a standard string == "a standard string" +# StringRef +ok {test-number} - sr.size() == stdStr.size() for: 17 == 17 +# StringRef +ok {test-number} - sr == "a standard string" for: a standard string == "a standard string" +# StringRef +ok {test-number} - sr.size() == stdStr.size() for: 17 == 17 +# StringRef +ok {test-number} - sr == "a standard string" for: a standard string == "a standard string" +# StringRef +ok {test-number} - sr.size() == stdStr.size() for: 17 == 17 +# StringRef +ok {test-number} - stdStr == "a stringref" for: "a stringref" == "a stringref" +# StringRef +ok {test-number} - stdStr.size() == sr.size() for: 11 == 11 +# StringRef +ok {test-number} - stdStr == "a stringref" for: "a stringref" == "a stringref" +# StringRef +ok {test-number} - stdStr.size() == sr.size() for: 11 == 11 +# StringRef +ok {test-number} - lhs == "some string += the stringref contents" for: "some string += the stringref contents" == "some string += the stringref contents" +# StringRef +ok {test-number} - together == "abrakadabra" for: "abrakadabra" == "abrakadabra" +# StringRef at compilation time +ok {test-number} - with 1 message: 'empty.size() == 0' +# StringRef at compilation time +ok {test-number} - with 1 message: 'empty.begin() == empty.end()' +# StringRef at compilation time +ok {test-number} - with 1 message: 'stringref.size() == 3' +# StringRef at compilation time +ok {test-number} - with 1 message: 'stringref.isNullTerminated()' +# StringRef at compilation time +ok {test-number} - with 1 message: 'stringref.data() == abc' +# StringRef at compilation time +ok {test-number} - with 1 message: 'stringref.begin() == abc' +# StringRef at compilation time +ok {test-number} - with 1 message: 'stringref.begin() != stringref.end()' +# StringRef at compilation time +ok {test-number} - with 1 message: 'stringref.substr(10, 0).empty()' +# StringRef at compilation time +ok {test-number} - with 1 message: 'stringref.substr(2, 1).data() == abc + 2' +# StringRef at compilation time +ok {test-number} - with 1 message: 'stringref[1] == 'b'' +# StringRef at compilation time +ok {test-number} - with 1 message: 'shortened.size() == 2' +# StringRef at compilation time +ok {test-number} - with 1 message: 'shortened.data() == abc' +# StringRef at compilation time +ok {test-number} - with 1 message: 'shortened.begin() != shortened.end()' +# StringRef at compilation time +ok {test-number} - with 1 message: '!(shortened.isNullTerminated())' +# StringRef at compilation time +ok {test-number} - with 1 message: '!(shortened.substr(1, 3).isNullTerminated())' +# StringRef at compilation time +ok {test-number} - with 1 message: '!(sr1.empty())' +# StringRef at compilation time +ok {test-number} - with 1 message: 'sr1.size() == 3' +# StringRef at compilation time +ok {test-number} - with 1 message: 'sr1.isNullTerminated()' +# StringRef at compilation time +ok {test-number} - with 1 message: 'sr2.empty()' +# StringRef at compilation time +ok {test-number} - with 1 message: 'sr2.size() == 0' +# StringRef at compilation time +ok {test-number} - with 1 message: 'sr2.isNullTerminated()' +# Stringifying std::chrono::duration helpers +ok {test-number} - minute == seconds for: 1 m == 60 s +# Stringifying std::chrono::duration helpers +ok {test-number} - hour != seconds for: 1 h != 60 s +# Stringifying std::chrono::duration helpers +ok {test-number} - micro != milli for: 1 us != 1 ms +# Stringifying std::chrono::duration helpers +ok {test-number} - nano != micro for: 1 ns != 1 us +# Stringifying std::chrono::duration with weird ratios +ok {test-number} - half_minute != femto_second for: 1 [30/1]s != 1 fs +# Stringifying std::chrono::duration with weird ratios +ok {test-number} - pico_second != atto_second for: 1 ps != 1 as +# Stringifying std::chrono::time_point<system_clock> +ok {test-number} - now != later for: {iso8601-timestamp} != {iso8601-timestamp} +# Tabs and newlines show in output +not ok {test-number} - s1 == s2 for: "if ($b == 10) { $a = 20; }" == "if ($b == 10) { $a = 20; } " +# Tag alias can be registered against tag patterns +ok {test-number} - what, Contains( "[@zzz]" ) for: "error: tag alias, '[@zzz]' already registered. First seen at: file:2 Redefined at: file:10" contains: "[@zzz]" +# Tag alias can be registered against tag patterns +ok {test-number} - what, Contains( "file" ) for: "error: tag alias, '[@zzz]' already registered. First seen at: file:2 Redefined at: file:10" contains: "file" +# Tag alias can be registered against tag patterns +ok {test-number} - what, Contains( "2" ) for: "error: tag alias, '[@zzz]' already registered. First seen at: file:2 Redefined at: file:10" contains: "2" +# Tag alias can be registered against tag patterns +ok {test-number} - what, Contains( "10" ) for: "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 +ok {test-number} - registry.add( "[no ampersat]", "", Catch::SourceLineInfo( "file", 3 ) ) +# Tag alias can be registered against tag patterns +ok {test-number} - registry.add( "[the @ is not at the start]", "", Catch::SourceLineInfo( "file", 3 ) ) +# Tag alias can be registered against tag patterns +ok {test-number} - registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) ) +# Tag alias can be registered against tag patterns +ok {test-number} - registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) ) +# Template test case method with test types specified inside std::tuple - MyTypes - 0 +ok {test-number} - Template_Fixture<TestType>::m_a == 1 for: 1 == 1 +# Template test case method with test types specified inside std::tuple - MyTypes - 1 +ok {test-number} - Template_Fixture<TestType>::m_a == 1 for: 1 == 1 +# Template test case method with test types specified inside std::tuple - MyTypes - 2 +ok {test-number} - Template_Fixture<TestType>::m_a == 1 for: 1.0 == 1 +# Template test case with test types specified inside non-copyable and non-movable std::tuple - NonCopyableAndNonMovableTypes - 0 +ok {test-number} - sizeof(TestType) > 0 for: 1 > 0 +# Template test case with test types specified inside non-copyable and non-movable std::tuple - NonCopyableAndNonMovableTypes - 1 +ok {test-number} - sizeof(TestType) > 0 for: 4 > 0 +# Template test case with test types specified inside non-default-constructible std::tuple - MyNonDefaultConstructibleTypes - 0 +ok {test-number} - sizeof(TestType) > 0 for: 1 > 0 +# Template test case with test types specified inside non-default-constructible std::tuple - MyNonDefaultConstructibleTypes - 1 +ok {test-number} - sizeof(TestType) > 0 for: 4 > 0 +# Template test case with test types specified inside std::tuple - MyTypes - 0 +ok {test-number} - sizeof(TestType) > 0 for: 4 > 0 +# Template test case with test types specified inside std::tuple - MyTypes - 1 +ok {test-number} - sizeof(TestType) > 0 for: 1 > 0 +# Template test case with test types specified inside std::tuple - MyTypes - 2 +ok {test-number} - sizeof(TestType) > 0 for: 4 > 0 +# TemplateTest: vectors can be sized and resized - float +ok {test-number} - v.size() == 5 for: 5 == 5 +# TemplateTest: vectors can be sized and resized - float +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# TemplateTest: vectors can be sized and resized - float +ok {test-number} - v.size() == 10 for: 10 == 10 +# TemplateTest: vectors can be sized and resized - float +ok {test-number} - v.capacity() >= 10 for: 10 >= 10 +# TemplateTest: vectors can be sized and resized - float +ok {test-number} - v.size() == 5 for: 5 == 5 +# TemplateTest: vectors can be sized and resized - float +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# TemplateTest: vectors can be sized and resized - float +ok {test-number} - v.size() == 0 for: 0 == 0 +# TemplateTest: vectors can be sized and resized - float +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# TemplateTest: vectors can be sized and resized - float +ok {test-number} - v.capacity() == 0 for: 0 == 0 +# TemplateTest: vectors can be sized and resized - float +ok {test-number} - v.size() == 5 for: 5 == 5 +# TemplateTest: vectors can be sized and resized - float +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# TemplateTest: vectors can be sized and resized - float +ok {test-number} - v.size() == 5 for: 5 == 5 +# TemplateTest: vectors can be sized and resized - float +ok {test-number} - v.capacity() >= 10 for: 10 >= 10 +# TemplateTest: vectors can be sized and resized - float +ok {test-number} - v.size() == 5 for: 5 == 5 +# TemplateTest: vectors can be sized and resized - float +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# TemplateTest: vectors can be sized and resized - float +ok {test-number} - v.size() == 5 for: 5 == 5 +# TemplateTest: vectors can be sized and resized - float +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# TemplateTest: vectors can be sized and resized - int +ok {test-number} - v.size() == 5 for: 5 == 5 +# TemplateTest: vectors can be sized and resized - int +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# TemplateTest: vectors can be sized and resized - int +ok {test-number} - v.size() == 10 for: 10 == 10 +# TemplateTest: vectors can be sized and resized - int +ok {test-number} - v.capacity() >= 10 for: 10 >= 10 +# TemplateTest: vectors can be sized and resized - int +ok {test-number} - v.size() == 5 for: 5 == 5 +# TemplateTest: vectors can be sized and resized - int +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# TemplateTest: vectors can be sized and resized - int +ok {test-number} - v.size() == 0 for: 0 == 0 +# TemplateTest: vectors can be sized and resized - int +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# TemplateTest: vectors can be sized and resized - int +ok {test-number} - v.capacity() == 0 for: 0 == 0 +# TemplateTest: vectors can be sized and resized - int +ok {test-number} - v.size() == 5 for: 5 == 5 +# TemplateTest: vectors can be sized and resized - int +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# TemplateTest: vectors can be sized and resized - int +ok {test-number} - v.size() == 5 for: 5 == 5 +# TemplateTest: vectors can be sized and resized - int +ok {test-number} - v.capacity() >= 10 for: 10 >= 10 +# TemplateTest: vectors can be sized and resized - int +ok {test-number} - v.size() == 5 for: 5 == 5 +# TemplateTest: vectors can be sized and resized - int +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# TemplateTest: vectors can be sized and resized - int +ok {test-number} - v.size() == 5 for: 5 == 5 +# TemplateTest: vectors can be sized and resized - int +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# TemplateTest: vectors can be sized and resized - std::string +ok {test-number} - v.size() == 5 for: 5 == 5 +# TemplateTest: vectors can be sized and resized - std::string +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# TemplateTest: vectors can be sized and resized - std::string +ok {test-number} - v.size() == 10 for: 10 == 10 +# TemplateTest: vectors can be sized and resized - std::string +ok {test-number} - v.capacity() >= 10 for: 10 >= 10 +# TemplateTest: vectors can be sized and resized - std::string +ok {test-number} - v.size() == 5 for: 5 == 5 +# TemplateTest: vectors can be sized and resized - std::string +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# TemplateTest: vectors can be sized and resized - std::string +ok {test-number} - v.size() == 0 for: 0 == 0 +# TemplateTest: vectors can be sized and resized - std::string +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# TemplateTest: vectors can be sized and resized - std::string +ok {test-number} - v.capacity() == 0 for: 0 == 0 +# TemplateTest: vectors can be sized and resized - std::string +ok {test-number} - v.size() == 5 for: 5 == 5 +# TemplateTest: vectors can be sized and resized - std::string +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# TemplateTest: vectors can be sized and resized - std::string +ok {test-number} - v.size() == 5 for: 5 == 5 +# TemplateTest: vectors can be sized and resized - std::string +ok {test-number} - v.capacity() >= 10 for: 10 >= 10 +# TemplateTest: vectors can be sized and resized - std::string +ok {test-number} - v.size() == 5 for: 5 == 5 +# TemplateTest: vectors can be sized and resized - std::string +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# TemplateTest: vectors can be sized and resized - std::string +ok {test-number} - v.size() == 5 for: 5 == 5 +# TemplateTest: vectors can be sized and resized - std::string +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# TemplateTest: vectors can be sized and resized - std::tuple<int,float> +ok {test-number} - v.size() == 5 for: 5 == 5 +# TemplateTest: vectors can be sized and resized - std::tuple<int,float> +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# TemplateTest: vectors can be sized and resized - std::tuple<int,float> +ok {test-number} - v.size() == 10 for: 10 == 10 +# TemplateTest: vectors can be sized and resized - std::tuple<int,float> +ok {test-number} - v.capacity() >= 10 for: 10 >= 10 +# TemplateTest: vectors can be sized and resized - std::tuple<int,float> +ok {test-number} - v.size() == 5 for: 5 == 5 +# TemplateTest: vectors can be sized and resized - std::tuple<int,float> +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# TemplateTest: vectors can be sized and resized - std::tuple<int,float> +ok {test-number} - v.size() == 0 for: 0 == 0 +# TemplateTest: vectors can be sized and resized - std::tuple<int,float> +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# TemplateTest: vectors can be sized and resized - std::tuple<int,float> +ok {test-number} - v.capacity() == 0 for: 0 == 0 +# TemplateTest: vectors can be sized and resized - std::tuple<int,float> +ok {test-number} - v.size() == 5 for: 5 == 5 +# TemplateTest: vectors can be sized and resized - std::tuple<int,float> +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# TemplateTest: vectors can be sized and resized - std::tuple<int,float> +ok {test-number} - v.size() == 5 for: 5 == 5 +# TemplateTest: vectors can be sized and resized - std::tuple<int,float> +ok {test-number} - v.capacity() >= 10 for: 10 >= 10 +# TemplateTest: vectors can be sized and resized - std::tuple<int,float> +ok {test-number} - v.size() == 5 for: 5 == 5 +# TemplateTest: vectors can be sized and resized - std::tuple<int,float> +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# TemplateTest: vectors can be sized and resized - std::tuple<int,float> +ok {test-number} - v.size() == 5 for: 5 == 5 +# TemplateTest: vectors can be sized and resized - std::tuple<int,float> +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +ok {test-number} - v.size() == V for: 6 == 6 +# TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +ok {test-number} - v.capacity() >= V for: 6 >= 6 +# TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +ok {test-number} - v.size() == 2 * V for: 12 == 12 +# TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +ok {test-number} - v.capacity() >= 2 * V for: 12 >= 12 +# TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +ok {test-number} - v.size() == V for: 6 == 6 +# TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +ok {test-number} - v.capacity() >= V for: 6 >= 6 +# TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +ok {test-number} - v.size() == 0 for: 0 == 0 +# TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +ok {test-number} - v.capacity() >= V for: 6 >= 6 +# TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +ok {test-number} - v.capacity() == 0 for: 0 == 0 +# TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +ok {test-number} - v.size() == V for: 6 == 6 +# TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +ok {test-number} - v.capacity() >= V for: 6 >= 6 +# TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +ok {test-number} - v.size() == V for: 6 == 6 +# TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +ok {test-number} - v.capacity() >= 2 * V for: 12 >= 12 +# TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +ok {test-number} - v.size() == V for: 6 == 6 +# TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +ok {test-number} - v.capacity() >= V for: 6 >= 6 +# TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +ok {test-number} - v.size() == V for: 6 == 6 +# TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6 +ok {test-number} - v.capacity() >= V for: 6 >= 6 +# TemplateTestSig: vectors can be sized and resized - float,4 +ok {test-number} - v.size() == V for: 4 == 4 +# TemplateTestSig: vectors can be sized and resized - float,4 +ok {test-number} - v.capacity() >= V for: 4 >= 4 +# TemplateTestSig: vectors can be sized and resized - float,4 +ok {test-number} - v.size() == 2 * V for: 8 == 8 +# TemplateTestSig: vectors can be sized and resized - float,4 +ok {test-number} - v.capacity() >= 2 * V for: 8 >= 8 +# TemplateTestSig: vectors can be sized and resized - float,4 +ok {test-number} - v.size() == V for: 4 == 4 +# TemplateTestSig: vectors can be sized and resized - float,4 +ok {test-number} - v.capacity() >= V for: 4 >= 4 +# TemplateTestSig: vectors can be sized and resized - float,4 +ok {test-number} - v.size() == 0 for: 0 == 0 +# TemplateTestSig: vectors can be sized and resized - float,4 +ok {test-number} - v.capacity() >= V for: 4 >= 4 +# TemplateTestSig: vectors can be sized and resized - float,4 +ok {test-number} - v.capacity() == 0 for: 0 == 0 +# TemplateTestSig: vectors can be sized and resized - float,4 +ok {test-number} - v.size() == V for: 4 == 4 +# TemplateTestSig: vectors can be sized and resized - float,4 +ok {test-number} - v.capacity() >= V for: 4 >= 4 +# TemplateTestSig: vectors can be sized and resized - float,4 +ok {test-number} - v.size() == V for: 4 == 4 +# TemplateTestSig: vectors can be sized and resized - float,4 +ok {test-number} - v.capacity() >= 2 * V for: 8 >= 8 +# TemplateTestSig: vectors can be sized and resized - float,4 +ok {test-number} - v.size() == V for: 4 == 4 +# TemplateTestSig: vectors can be sized and resized - float,4 +ok {test-number} - v.capacity() >= V for: 4 >= 4 +# TemplateTestSig: vectors can be sized and resized - float,4 +ok {test-number} - v.size() == V for: 4 == 4 +# TemplateTestSig: vectors can be sized and resized - float,4 +ok {test-number} - v.capacity() >= V for: 4 >= 4 +# TemplateTestSig: vectors can be sized and resized - int,5 +ok {test-number} - v.size() == V for: 5 == 5 +# TemplateTestSig: vectors can be sized and resized - int,5 +ok {test-number} - v.capacity() >= V for: 5 >= 5 +# TemplateTestSig: vectors can be sized and resized - int,5 +ok {test-number} - v.size() == 2 * V for: 10 == 10 +# TemplateTestSig: vectors can be sized and resized - int,5 +ok {test-number} - v.capacity() >= 2 * V for: 10 >= 10 +# TemplateTestSig: vectors can be sized and resized - int,5 +ok {test-number} - v.size() == V for: 5 == 5 +# TemplateTestSig: vectors can be sized and resized - int,5 +ok {test-number} - v.capacity() >= V for: 5 >= 5 +# TemplateTestSig: vectors can be sized and resized - int,5 +ok {test-number} - v.size() == 0 for: 0 == 0 +# TemplateTestSig: vectors can be sized and resized - int,5 +ok {test-number} - v.capacity() >= V for: 5 >= 5 +# TemplateTestSig: vectors can be sized and resized - int,5 +ok {test-number} - v.capacity() == 0 for: 0 == 0 +# TemplateTestSig: vectors can be sized and resized - int,5 +ok {test-number} - v.size() == V for: 5 == 5 +# TemplateTestSig: vectors can be sized and resized - int,5 +ok {test-number} - v.capacity() >= V for: 5 >= 5 +# TemplateTestSig: vectors can be sized and resized - int,5 +ok {test-number} - v.size() == V for: 5 == 5 +# TemplateTestSig: vectors can be sized and resized - int,5 +ok {test-number} - v.capacity() >= 2 * V for: 10 >= 10 +# TemplateTestSig: vectors can be sized and resized - int,5 +ok {test-number} - v.size() == V for: 5 == 5 +# TemplateTestSig: vectors can be sized and resized - int,5 +ok {test-number} - v.capacity() >= V for: 5 >= 5 +# TemplateTestSig: vectors can be sized and resized - int,5 +ok {test-number} - v.size() == V for: 5 == 5 +# TemplateTestSig: vectors can be sized and resized - int,5 +ok {test-number} - v.capacity() >= V for: 5 >= 5 +# TemplateTestSig: vectors can be sized and resized - std::string,15 +ok {test-number} - v.size() == V for: 15 == 15 +# TemplateTestSig: vectors can be sized and resized - std::string,15 +ok {test-number} - v.capacity() >= V for: 15 >= 15 +# TemplateTestSig: vectors can be sized and resized - std::string,15 +ok {test-number} - v.size() == 2 * V for: 30 == 30 +# TemplateTestSig: vectors can be sized and resized - std::string,15 +ok {test-number} - v.capacity() >= 2 * V for: 30 >= 30 +# TemplateTestSig: vectors can be sized and resized - std::string,15 +ok {test-number} - v.size() == V for: 15 == 15 +# TemplateTestSig: vectors can be sized and resized - std::string,15 +ok {test-number} - v.capacity() >= V for: 15 >= 15 +# TemplateTestSig: vectors can be sized and resized - std::string,15 +ok {test-number} - v.size() == 0 for: 0 == 0 +# TemplateTestSig: vectors can be sized and resized - std::string,15 +ok {test-number} - v.capacity() >= V for: 15 >= 15 +# TemplateTestSig: vectors can be sized and resized - std::string,15 +ok {test-number} - v.capacity() == 0 for: 0 == 0 +# TemplateTestSig: vectors can be sized and resized - std::string,15 +ok {test-number} - v.size() == V for: 15 == 15 +# TemplateTestSig: vectors can be sized and resized - std::string,15 +ok {test-number} - v.capacity() >= V for: 15 >= 15 +# TemplateTestSig: vectors can be sized and resized - std::string,15 +ok {test-number} - v.size() == V for: 15 == 15 +# TemplateTestSig: vectors can be sized and resized - std::string,15 +ok {test-number} - v.capacity() >= 2 * V for: 30 >= 30 +# TemplateTestSig: vectors can be sized and resized - std::string,15 +ok {test-number} - v.size() == V for: 15 == 15 +# TemplateTestSig: vectors can be sized and resized - std::string,15 +ok {test-number} - v.capacity() >= V for: 15 >= 15 +# TemplateTestSig: vectors can be sized and resized - std::string,15 +ok {test-number} - v.size() == V for: 15 == 15 +# TemplateTestSig: vectors can be sized and resized - std::string,15 +ok {test-number} - v.capacity() >= V for: 15 >= 15 +# Test case with one argument +ok {test-number} - with 1 message: 'no assertions' +# Test enum bit values +ok {test-number} - 0x<hex digits> == bit30and31 for: 3221225472 (0x<hex digits>) == 3221225472 +# Test with special, characters "in name +ok {test-number} - +# The NO_FAIL macro reports a failure but does not fail the test +ok {test-number} - 1 == 2 # TODO +# The default listing implementation write to provided stream +ok {test-number} - listingString, Contains("[fakeTag]"s) for: "All available tags: 1 [fakeTag] 1 tag " contains: "[fakeTag]" +# The default listing implementation write to provided stream +ok {test-number} - listingString, Contains("fake reporter"s) for: "Available reporters: fake reporter: fake description " contains: "fake reporter" +# The default listing implementation write to provided stream +ok {test-number} - listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) for: "All available test cases: fake test name [fakeTestTag] 1 test case " ( contains: "fake test name" and contains: "fakeTestTag" ) +# This test 'should' fail but doesn't +ok {test-number} - with 1 message: 'oops!' +# Thrown string literals are translated +not ok {test-number} - unexpected exception with message: 'For some reason someone is throwing a string literal!' +# Tracker +ok {test-number} - testCase.isOpen() for: true +# Tracker +ok {test-number} - s1.isOpen() for: true +# Tracker +ok {test-number} - s1.isSuccessfullyCompleted() for: true +# Tracker +ok {test-number} - testCase.isComplete() == false for: false == false +# Tracker +ok {test-number} - ctx.completedCycle() for: true +# Tracker +ok {test-number} - testCase.isSuccessfullyCompleted() for: true +# Tracker +ok {test-number} - testCase.isOpen() for: true +# Tracker +ok {test-number} - s1.isOpen() for: true +# Tracker +ok {test-number} - s1.isComplete() for: true +# Tracker +ok {test-number} - s1.isSuccessfullyCompleted() == false for: false == false +# Tracker +ok {test-number} - testCase.isComplete() == false for: false == false +# Tracker +ok {test-number} - ctx.completedCycle() for: true +# Tracker +ok {test-number} - testCase.isSuccessfullyCompleted() == false for: false == false +# Tracker +ok {test-number} - testCase2.isOpen() for: true +# Tracker +ok {test-number} - s1b.isOpen() == false for: false == false +# Tracker +ok {test-number} - ctx.completedCycle() for: true +# Tracker +ok {test-number} - testCase.isComplete() for: true +# Tracker +ok {test-number} - testCase.isSuccessfullyCompleted() for: true +# Tracker +ok {test-number} - testCase.isOpen() for: true +# Tracker +ok {test-number} - s1.isOpen() for: true +# Tracker +ok {test-number} - s1.isComplete() for: true +# Tracker +ok {test-number} - s1.isSuccessfullyCompleted() == false for: false == false +# Tracker +ok {test-number} - testCase.isComplete() == false for: false == false +# Tracker +ok {test-number} - ctx.completedCycle() for: true +# Tracker +ok {test-number} - testCase.isSuccessfullyCompleted() == false for: false == false +# Tracker +ok {test-number} - testCase2.isOpen() for: true +# Tracker +ok {test-number} - s1b.isOpen() == false for: false == false +# Tracker +ok {test-number} - s2.isOpen() for: true +# Tracker +ok {test-number} - ctx.completedCycle() for: true +# Tracker +ok {test-number} - testCase.isComplete() for: true +# Tracker +ok {test-number} - testCase.isSuccessfullyCompleted() for: true +# Tracker +ok {test-number} - testCase.isOpen() for: true +# Tracker +ok {test-number} - s1.isOpen() for: true +# Tracker +ok {test-number} - s2.isOpen() == false for: false == false +# Tracker +ok {test-number} - testCase.isComplete() == false for: false == false +# Tracker +ok {test-number} - testCase2.isOpen() for: true +# Tracker +ok {test-number} - s1b.isOpen() == false for: false == false +# Tracker +ok {test-number} - s2b.isOpen() for: true +# Tracker +ok {test-number} - ctx.completedCycle() == false for: false == false +# Tracker +ok {test-number} - ctx.completedCycle() for: true +# Tracker +ok {test-number} - s2b.isSuccessfullyCompleted() for: true +# Tracker +ok {test-number} - testCase2.isComplete() == false for: false == false +# Tracker +ok {test-number} - testCase2.isSuccessfullyCompleted() for: true +# Tracker +ok {test-number} - testCase.isOpen() for: true +# Tracker +ok {test-number} - s1.isOpen() for: true +# Tracker +ok {test-number} - s2.isOpen() == false for: false == false +# Tracker +ok {test-number} - testCase.isComplete() == false for: false == false +# Tracker +ok {test-number} - testCase2.isOpen() for: true +# Tracker +ok {test-number} - s1b.isOpen() == false for: false == false +# Tracker +ok {test-number} - s2b.isOpen() for: true +# Tracker +ok {test-number} - ctx.completedCycle() == false for: false == false +# Tracker +ok {test-number} - ctx.completedCycle() for: true +# Tracker +ok {test-number} - s2b.isComplete() for: true +# Tracker +ok {test-number} - s2b.isSuccessfullyCompleted() == false for: false == false +# Tracker +ok {test-number} - testCase2.isSuccessfullyCompleted() == false for: false == false +# Tracker +ok {test-number} - testCase3.isOpen() for: true +# Tracker +ok {test-number} - s1c.isOpen() == false for: false == false +# Tracker +ok {test-number} - s2c.isOpen() == false for: false == false +# Tracker +ok {test-number} - testCase3.isSuccessfullyCompleted() for: true +# Tracker +ok {test-number} - testCase.isOpen() for: true +# Tracker +ok {test-number} - s1.isOpen() for: true +# Tracker +ok {test-number} - s2.isOpen() for: true +# Tracker +ok {test-number} - s2.isComplete() for: true +# Tracker +ok {test-number} - s1.isComplete() == false for: false == false +# Tracker +ok {test-number} - s1.isComplete() for: true +# Tracker +ok {test-number} - testCase.isComplete() == false for: false == false +# Tracker +ok {test-number} - testCase.isComplete() for: true +# Trim strings +ok {test-number} - trim(std::string(no_whitespace)) == no_whitespace for: "There is no extra whitespace here" == "There is no extra whitespace here" +# Trim strings +ok {test-number} - trim(std::string(leading_whitespace)) == no_whitespace for: "There is no extra whitespace here" == "There is no extra whitespace here" +# Trim strings +ok {test-number} - trim(std::string(trailing_whitespace)) == no_whitespace for: "There is no extra whitespace here" == "There is no extra whitespace here" +# Trim strings +ok {test-number} - trim(std::string(whitespace_at_both_ends)) == no_whitespace for: "There is no extra whitespace here" == "There is no extra whitespace here" +# Trim strings +ok {test-number} - trim(StringRef(no_whitespace)) == StringRef(no_whitespace) for: There is no extra whitespace here == There is no extra whitespace here +# Trim strings +ok {test-number} - trim(StringRef(leading_whitespace)) == StringRef(no_whitespace) for: There is no extra whitespace here == There is no extra whitespace here +# Trim strings +ok {test-number} - trim(StringRef(trailing_whitespace)) == StringRef(no_whitespace) for: There is no extra whitespace here == There is no extra whitespace here +# Trim strings +ok {test-number} - trim(StringRef(whitespace_at_both_ends)) == StringRef(no_whitespace) for: There is no extra whitespace here == There is no extra whitespace here +# Unexpected exceptions can be translated +not ok {test-number} - unexpected exception with message: '3.14' +# Upcasting special member functions +ok {test-number} - bptr->i == 3 for: 3 == 3 +# Upcasting special member functions +ok {test-number} - bptr->i == 3 for: 3 == 3 +# Usage of AllMatch range matcher +ok {test-number} - data, AllMatch(SizeIs(5)) for: { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } all match has size == 5 +# Usage of AllMatch range matcher +ok {test-number} - data, !AllMatch(Contains(0) && Contains(1)) for: { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } not all match ( contains element 0 and contains element 1 ) +# Usage of AllMatch range matcher +ok {test-number} - needs_adl, AllMatch( Predicate<int>( []( int elem ) { return elem < 6; } ) ) for: { 1, 2, 3, 4, 5 } all match matches undescribed predicate +# Usage of AllMatch range matcher +ok {test-number} - mocked, allMatch for: { 1, 2, 3, 4, 5 } all match matches undescribed predicate +# Usage of AllMatch range matcher +ok {test-number} - mocked.derefed[0] for: true +# Usage of AllMatch range matcher +ok {test-number} - mocked.derefed[1] for: true +# Usage of AllMatch range matcher +ok {test-number} - mocked.derefed[2] for: true +# Usage of AllMatch range matcher +ok {test-number} - mocked.derefed[3] for: true +# Usage of AllMatch range matcher +ok {test-number} - mocked.derefed[4] for: true +# Usage of AllMatch range matcher +ok {test-number} - mocked, !allMatch for: { 1, 2, 3, 4, 5 } not all match matches undescribed predicate +# Usage of AllMatch range matcher +ok {test-number} - mocked.derefed[0] for: true +# Usage of AllMatch range matcher +ok {test-number} - mocked.derefed[1] for: true +# Usage of AllMatch range matcher +ok {test-number} - mocked.derefed[2] for: true +# Usage of AllMatch range matcher +ok {test-number} - !(mocked.derefed[3]) for: !false +# Usage of AllMatch range matcher +ok {test-number} - !(mocked.derefed[4]) for: !false +# Usage of AnyMatch range matcher +ok {test-number} - data, AnyMatch(SizeIs(5)) for: { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } any match has size == 5 +# Usage of AnyMatch range matcher +ok {test-number} - data, !AnyMatch(Contains(0) && Contains(10)) for: { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } not any match ( contains element 0 and contains element 10 ) +# Usage of AnyMatch range matcher +ok {test-number} - needs_adl, AnyMatch( Predicate<int>( []( int elem ) { return elem < 3; } ) ) for: { 1, 2, 3, 4, 5 } any match matches undescribed predicate +# Usage of AnyMatch range matcher +ok {test-number} - mocked, !anyMatch for: { 1, 2, 3, 4, 5 } not any match matches undescribed predicate +# Usage of AnyMatch range matcher +ok {test-number} - mocked.derefed[0] for: true +# Usage of AnyMatch range matcher +ok {test-number} - mocked.derefed[1] for: true +# Usage of AnyMatch range matcher +ok {test-number} - mocked.derefed[2] for: true +# Usage of AnyMatch range matcher +ok {test-number} - mocked.derefed[3] for: true +# Usage of AnyMatch range matcher +ok {test-number} - mocked.derefed[4] for: true +# Usage of AnyMatch range matcher +ok {test-number} - mocked, anyMatch for: { 1, 2, 3, 4, 5 } any match matches undescribed predicate +# Usage of AnyMatch range matcher +ok {test-number} - mocked.derefed[0] for: true +# Usage of AnyMatch range matcher +ok {test-number} - !(mocked.derefed[1]) for: !false +# Usage of AnyMatch range matcher +ok {test-number} - !(mocked.derefed[2]) for: !false +# Usage of AnyMatch range matcher +ok {test-number} - !(mocked.derefed[3]) for: !false +# Usage of AnyMatch range matcher +ok {test-number} - !(mocked.derefed[4]) for: !false +# Usage of NoneMatch range matcher +ok {test-number} - data, NoneMatch(SizeIs(6)) for: { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } none match has size == 6 +# Usage of NoneMatch range matcher +ok {test-number} - data, !NoneMatch(Contains(0) && Contains(1)) for: { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } not none match ( contains element 0 and contains element 1 ) +# Usage of NoneMatch range matcher +ok {test-number} - needs_adl, NoneMatch( Predicate<int>( []( int elem ) { return elem > 6; } ) ) for: { 1, 2, 3, 4, 5 } none match matches undescribed predicate +# Usage of NoneMatch range matcher +ok {test-number} - mocked, noneMatch for: { 1, 2, 3, 4, 5 } none match matches undescribed predicate +# Usage of NoneMatch range matcher +ok {test-number} - mocked.derefed[0] for: true +# Usage of NoneMatch range matcher +ok {test-number} - mocked.derefed[1] for: true +# Usage of NoneMatch range matcher +ok {test-number} - mocked.derefed[2] for: true +# Usage of NoneMatch range matcher +ok {test-number} - mocked.derefed[3] for: true +# Usage of NoneMatch range matcher +ok {test-number} - mocked.derefed[4] for: true +# Usage of NoneMatch range matcher +ok {test-number} - mocked, !noneMatch for: { 1, 2, 3, 4, 5 } not none match matches undescribed predicate +# Usage of NoneMatch range matcher +ok {test-number} - mocked.derefed[0] for: true +# Usage of NoneMatch range matcher +ok {test-number} - !(mocked.derefed[1]) for: !false +# Usage of NoneMatch range matcher +ok {test-number} - !(mocked.derefed[2]) for: !false +# Usage of NoneMatch range matcher +ok {test-number} - !(mocked.derefed[3]) for: !false +# Usage of NoneMatch range matcher +ok {test-number} - !(mocked.derefed[4]) for: !false +# Usage of the SizeIs range matcher +ok {test-number} - empty_vec, SizeIs(0) for: { } has size == 0 +# Usage of the SizeIs range matcher +ok {test-number} - empty_vec, !SizeIs(2) for: { } not has size == 2 +# Usage of the SizeIs range matcher +ok {test-number} - empty_vec, SizeIs(Lt(2)) for: { } size matches is less than 2 +# Usage of the SizeIs range matcher +ok {test-number} - arr, SizeIs(2) for: { 0, 0 } has size == 2 +# Usage of the SizeIs range matcher +ok {test-number} - arr, SizeIs( Lt(3)) for: { 0, 0 } size matches is less than 3 +# Usage of the SizeIs range matcher +ok {test-number} - arr, !SizeIs(!Lt(3)) for: { 0, 0 } not size matches not is less than 3 +# Usage of the SizeIs range matcher +ok {test-number} - map, SizeIs(3) for: { {?}, {?}, {?} } has size == 3 +# Usage of the SizeIs range matcher +ok {test-number} - unrelated::ADL_size{}, SizeIs(12) for: {?} has size == 12 +# Usage of the SizeIs range matcher +ok {test-number} - has_size{}, SizeIs(13) for: {?} has size == 13 +# Use a custom approx +ok {test-number} - d == approx( 1.23 ) for: 1.23 == Approx( 1.23 ) +# Use a custom approx +ok {test-number} - d == approx( 1.22 ) for: 1.23 == Approx( 1.22 ) +# Use a custom approx +ok {test-number} - d == approx( 1.24 ) for: 1.23 == Approx( 1.24 ) +# Use a custom approx +ok {test-number} - d != approx( 1.25 ) for: 1.23 != Approx( 1.25 ) +# Use a custom approx +ok {test-number} - approx( d ) == 1.23 for: Approx( 1.23 ) == 1.23 +# Use a custom approx +ok {test-number} - approx( d ) == 1.22 for: Approx( 1.23 ) == 1.22 +# Use a custom approx +ok {test-number} - approx( d ) == 1.24 for: Approx( 1.23 ) == 1.24 +# Use a custom approx +ok {test-number} - approx( d ) != 1.25 for: Approx( 1.23 ) != 1.25 +# Variadic macros +ok {test-number} - with 1 message: 'no assertions' +# Vector Approx matcher +ok {test-number} - empty, Approx(empty) for: { } is approx: { } +# Vector Approx matcher +ok {test-number} - v1, Approx(v1) for: { 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 } +# Vector Approx matcher +ok {test-number} - v1, Approx<double>({ 1., 2., 3. }) for: { 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 } +# Vector Approx matcher +ok {test-number} - v1, !Approx(temp) for: { 1.0, 2.0, 3.0 } not is approx: { 1.0, 2.0, 3.0, 4.0 } +# Vector Approx matcher +ok {test-number} - v1, !Approx(v2) for: { 1.0, 2.0, 3.0 } not is approx: { 1.5, 2.5, 3.5 } +# Vector Approx matcher +ok {test-number} - v1, Approx(v2).margin(0.5) for: { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } +# Vector Approx matcher +ok {test-number} - v1, Approx(v2).epsilon(0.5) for: { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } +# Vector Approx matcher +ok {test-number} - v1, Approx(v2).epsilon(0.1).scale(500) for: { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } +# Vector Approx matcher -- failing +not ok {test-number} - empty, Approx(t1) for: { } is approx: { 1.0, 2.0 } +# Vector Approx matcher -- failing +not ok {test-number} - v1, Approx(v2) for: { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 } +# Vector matchers +ok {test-number} - v, VectorContains(1) for: { 1, 2, 3 } Contains: 1 +# Vector matchers +ok {test-number} - v, VectorContains(2) for: { 1, 2, 3 } Contains: 2 +# Vector matchers +ok {test-number} - v5, (VectorContains<int, CustomAllocator<int>>(2)) for: { 1, 2, 3 } Contains: 2 +# Vector matchers +ok {test-number} - v, Contains(v2) for: { 1, 2, 3 } Contains: { 1, 2 } +# Vector matchers +ok {test-number} - v, Contains<int>({ 1, 2 }) for: { 1, 2, 3 } Contains: { 1, 2 } +# Vector matchers +ok {test-number} - v5, (Contains<int, std::allocator<int>, CustomAllocator<int>>(v2)) for: { 1, 2, 3 } Contains: { 1, 2 } +# Vector matchers +ok {test-number} - v, Contains(v2) for: { 1, 2, 3 } Contains: { 1, 2, 3 } +# Vector matchers +ok {test-number} - v, Contains(empty) for: { 1, 2, 3 } Contains: { } +# Vector matchers +ok {test-number} - empty, Contains(empty) for: { } Contains: { } +# Vector matchers +ok {test-number} - v5, (Contains<int, std::allocator<int>, CustomAllocator<int>>(v2)) for: { 1, 2, 3 } Contains: { 1, 2, 3 } +# Vector matchers +ok {test-number} - v5, Contains(v6) for: { 1, 2, 3 } Contains: { 1, 2 } +# Vector matchers +ok {test-number} - v, VectorContains(1) && VectorContains(2) for: { 1, 2, 3 } ( Contains: 1 and Contains: 2 ) +# Vector matchers +ok {test-number} - v, Equals(v) for: { 1, 2, 3 } Equals: { 1, 2, 3 } +# Vector matchers +ok {test-number} - empty, Equals(empty) for: { } Equals: { } +# Vector matchers +ok {test-number} - v, Equals<int>({ 1, 2, 3 }) for: { 1, 2, 3 } Equals: { 1, 2, 3 } +# Vector matchers +ok {test-number} - v, Equals(v2) for: { 1, 2, 3 } Equals: { 1, 2, 3 } +# Vector matchers +ok {test-number} - v5, (Equals<int, std::allocator<int>, CustomAllocator<int>>(v2)) for: { 1, 2, 3 } Equals: { 1, 2, 3 } +# Vector matchers +ok {test-number} - v5, Equals(v6) for: { 1, 2, 3 } Equals: { 1, 2, 3 } +# Vector matchers +ok {test-number} - v, UnorderedEquals(v) for: { 1, 2, 3 } UnorderedEquals: { 1, 2, 3 } +# Vector matchers +ok {test-number} - v, UnorderedEquals<int>({ 3, 2, 1 }) for: { 1, 2, 3 } UnorderedEquals: { 3, 2, 1 } +# Vector matchers +ok {test-number} - empty, UnorderedEquals(empty) for: { } UnorderedEquals: { } +# Vector matchers +ok {test-number} - permuted, UnorderedEquals(v) for: { 1, 3, 2 } UnorderedEquals: { 1, 2, 3 } +# Vector matchers +ok {test-number} - permuted, UnorderedEquals(v) for: { 2, 3, 1 } UnorderedEquals: { 1, 2, 3 } +# Vector matchers +ok {test-number} - v5, (UnorderedEquals<int, std::allocator<int>, CustomAllocator<int>>(permuted)) for: { 1, 2, 3 } UnorderedEquals: { 2, 3, 1 } +# Vector matchers +ok {test-number} - v5_permuted, UnorderedEquals(v5) for: { 1, 3, 2 } UnorderedEquals: { 1, 2, 3 } +# Vector matchers that fail +not ok {test-number} - v, VectorContains(-1) for: { 1, 2, 3 } Contains: -1 +# Vector matchers that fail +not ok {test-number} - empty, VectorContains(1) for: { } Contains: 1 +# Vector matchers that fail +not ok {test-number} - empty, Contains(v) for: { } Contains: { 1, 2, 3 } +# Vector matchers that fail +not ok {test-number} - v, Contains(v2) for: { 1, 2, 3 } Contains: { 1, 2, 4 } +# Vector matchers that fail +not ok {test-number} - v, Equals(v2) for: { 1, 2, 3 } Equals: { 1, 2 } +# Vector matchers that fail +not ok {test-number} - v2, Equals(v) for: { 1, 2 } Equals: { 1, 2, 3 } +# Vector matchers that fail +not ok {test-number} - empty, Equals(v) for: { } Equals: { 1, 2, 3 } +# Vector matchers that fail +not ok {test-number} - v, Equals(empty) for: { 1, 2, 3 } Equals: { } +# Vector matchers that fail +not ok {test-number} - v, UnorderedEquals(empty) for: { 1, 2, 3 } UnorderedEquals: { } +# Vector matchers that fail +not ok {test-number} - empty, UnorderedEquals(v) for: { } UnorderedEquals: { 1, 2, 3 } +# Vector matchers that fail +not ok {test-number} - permuted, UnorderedEquals(v) for: { 1, 3 } UnorderedEquals: { 1, 2, 3 } +# Vector matchers that fail +not ok {test-number} - permuted, UnorderedEquals(v) for: { 3, 1 } UnorderedEquals: { 1, 2, 3 } +# When checked exceptions are thrown they can be expected or unexpected +ok {test-number} - thisThrows(), std::domain_error +# When checked exceptions are thrown they can be expected or unexpected +ok {test-number} - thisDoesntThrow() +# When checked exceptions are thrown they can be expected or unexpected +ok {test-number} - thisThrows() +# When unchecked exceptions are thrown directly they are always failures +not ok {test-number} - unexpected exception with message: 'unexpected exception' +# When unchecked exceptions are thrown during a CHECK the test should continue +not ok {test-number} - unexpected exception with message: 'expected exception'; expression was: thisThrows() == 0 +# When unchecked exceptions are thrown during a REQUIRE the test should abort fail +not ok {test-number} - unexpected exception with message: 'expected exception'; expression was: thisThrows() == 0 +# When unchecked exceptions are thrown from functions they are always failures +not ok {test-number} - unexpected exception with message: 'expected exception'; expression was: thisThrows() == 0 +# When unchecked exceptions are thrown from sections they are always failures +not ok {test-number} - unexpected exception with message: 'unexpected exception' +# Where the LHS is not a simple value +warning {test-number} - '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 +warning {test-number} - 'Uncomment the code in this test to check that it gives a sensible compiler error' +# X/level/0/a +ok {test-number} - +# X/level/0/b +ok {test-number} - +# X/level/1/a +ok {test-number} - +# X/level/1/b +ok {test-number} - +# XmlEncode +ok {test-number} - encode( "normal string" ) == "normal string" for: "normal string" == "normal string" +# XmlEncode +ok {test-number} - encode( "" ) == "" for: "" == "" +# XmlEncode +ok {test-number} - encode( "smith & jones" ) == "smith & jones" for: "smith & jones" == "smith & jones" +# XmlEncode +ok {test-number} - encode( "smith < jones" ) == "smith < jones" for: "smith < jones" == "smith < jones" +# XmlEncode +ok {test-number} - encode( "smith > jones" ) == "smith > jones" for: "smith > jones" == "smith > jones" +# XmlEncode +ok {test-number} - encode( "smith ]]> jones" ) == "smith ]]> jones" for: "smith ]]> jones" == "smith ]]> jones" +# XmlEncode +ok {test-number} - encode( stringWithQuotes ) == stringWithQuotes for: "don't "quote" me on that" == "don't "quote" me on that" +# XmlEncode +ok {test-number} - encode( stringWithQuotes, Catch::XmlEncode::ForAttributes ) == "don't "quote" me on that" for: "don't "quote" me on that" == "don't "quote" me on that" +# XmlEncode +ok {test-number} - encode( "[\x01]" ) == "[\\x01]" for: "[\x01]" == "[\x01]" +# XmlEncode +ok {test-number} - encode( "[\x7F]" ) == "[\\x7F]" for: "[\x7F]" == "[\x7F]" +# analyse no analysis +ok {test-number} - analysis.mean.point.count() == 23 for: 23.0 == 23 +# analyse no analysis +ok {test-number} - analysis.mean.lower_bound.count() == 23 for: 23.0 == 23 +# analyse no analysis +ok {test-number} - analysis.mean.upper_bound.count() == 23 for: 23.0 == 23 +# analyse no analysis +ok {test-number} - analysis.standard_deviation.point.count() == 0 for: 0.0 == 0 +# analyse no analysis +ok {test-number} - analysis.standard_deviation.lower_bound.count() == 0 for: 0.0 == 0 +# analyse no analysis +ok {test-number} - analysis.standard_deviation.upper_bound.count() == 0 for: 0.0 == 0 +# analyse no analysis +ok {test-number} - analysis.outliers.total() == 0 for: 0 == 0 +# analyse no analysis +ok {test-number} - analysis.outliers.low_mild == 0 for: 0 == 0 +# analyse no analysis +ok {test-number} - analysis.outliers.low_severe == 0 for: 0 == 0 +# analyse no analysis +ok {test-number} - analysis.outliers.high_mild == 0 for: 0 == 0 +# analyse no analysis +ok {test-number} - analysis.outliers.high_severe == 0 for: 0 == 0 +# analyse no analysis +ok {test-number} - analysis.outliers.samples_seen == 0 for: 0 == 0 +# analyse no analysis +ok {test-number} - analysis.outlier_variance == 0 for: 0.0 == 0 +# array<int, N> -> toString +ok {test-number} - Catch::Detail::stringify( empty ) == "{ }" for: "{ }" == "{ }" +# array<int, N> -> toString +ok {test-number} - Catch::Detail::stringify( oneValue ) == "{ 42 }" for: "{ 42 }" == "{ 42 }" +# array<int, N> -> toString +ok {test-number} - Catch::Detail::stringify( twoValues ) == "{ 42, 250 }" for: "{ 42, 250 }" == "{ 42, 250 }" +# atomic if +ok {test-number} - x == 0 for: 0 == 0 +# benchmark function call +ok {test-number} - model.started == 1 for: 1 == 1 +# benchmark function call +ok {test-number} - model.finished == 0 for: 0 == 0 +# benchmark function call +ok {test-number} - model.started == 1 for: 1 == 1 +# benchmark function call +ok {test-number} - model.finished == 1 for: 1 == 1 +# benchmark function call +ok {test-number} - called == 1 for: 1 == 1 +# benchmark function call +ok {test-number} - model.started == 0 for: 0 == 0 +# benchmark function call +ok {test-number} - model.finished == 0 for: 0 == 0 +# benchmark function call +ok {test-number} - model.started == 0 for: 0 == 0 +# benchmark function call +ok {test-number} - model.finished == 0 for: 0 == 0 +# benchmark function call +ok {test-number} - called == 1 for: 1 == 1 +# boolean member +ok {test-number} - obj.prop != 0 for: 0x<hex digits> != 0 +# checkedElse +ok {test-number} - flag for: true +# checkedElse +ok {test-number} - testCheckedElse( true ) for: true +# checkedElse, failing +not ok {test-number} - flag for: false +# checkedElse, failing +not ok {test-number} - testCheckedElse( false ) for: false +# checkedIf +ok {test-number} - flag for: true +# checkedIf +ok {test-number} - testCheckedIf( true ) for: true +# checkedIf, failing +not ok {test-number} - flag for: false +# checkedIf, failing +not ok {test-number} - testCheckedIf( false ) for: false +# classify_outliers +ok {test-number} - o.samples_seen == static_cast<int>(x.size()) for: 6 == 6 +# classify_outliers +ok {test-number} - o.low_severe == los for: 0 == 0 +# classify_outliers +ok {test-number} - o.low_mild == lom for: 0 == 0 +# classify_outliers +ok {test-number} - o.high_mild == him for: 0 == 0 +# classify_outliers +ok {test-number} - o.high_severe == his for: 0 == 0 +# classify_outliers +ok {test-number} - o.total() == los + lom + him + his for: 0 == 0 +# classify_outliers +ok {test-number} - o.samples_seen == static_cast<int>(x.size()) for: 6 == 6 +# classify_outliers +ok {test-number} - o.low_severe == los for: 1 == 1 +# classify_outliers +ok {test-number} - o.low_mild == lom for: 0 == 0 +# classify_outliers +ok {test-number} - o.high_mild == him for: 0 == 0 +# classify_outliers +ok {test-number} - o.high_severe == his for: 0 == 0 +# classify_outliers +ok {test-number} - o.total() == los + lom + him + his for: 1 == 1 +# classify_outliers +ok {test-number} - o.samples_seen == static_cast<int>(x.size()) for: 6 == 6 +# classify_outliers +ok {test-number} - o.low_severe == los for: 0 == 0 +# classify_outliers +ok {test-number} - o.low_mild == lom for: 1 == 1 +# classify_outliers +ok {test-number} - o.high_mild == him for: 0 == 0 +# classify_outliers +ok {test-number} - o.high_severe == his for: 0 == 0 +# classify_outliers +ok {test-number} - o.total() == los + lom + him + his for: 1 == 1 +# classify_outliers +ok {test-number} - o.samples_seen == static_cast<int>(x.size()) for: 6 == 6 +# classify_outliers +ok {test-number} - o.low_severe == los for: 0 == 0 +# classify_outliers +ok {test-number} - o.low_mild == lom for: 0 == 0 +# classify_outliers +ok {test-number} - o.high_mild == him for: 1 == 1 +# classify_outliers +ok {test-number} - o.high_severe == his for: 0 == 0 +# classify_outliers +ok {test-number} - o.total() == los + lom + him + his for: 1 == 1 +# classify_outliers +ok {test-number} - o.samples_seen == static_cast<int>(x.size()) for: 6 == 6 +# classify_outliers +ok {test-number} - o.low_severe == los for: 0 == 0 +# classify_outliers +ok {test-number} - o.low_mild == lom for: 0 == 0 +# classify_outliers +ok {test-number} - o.high_mild == him for: 0 == 0 +# classify_outliers +ok {test-number} - o.high_severe == his for: 1 == 1 +# classify_outliers +ok {test-number} - o.total() == los + lom + him + his for: 1 == 1 +# classify_outliers +ok {test-number} - o.samples_seen == static_cast<int>(x.size()) for: 6 == 6 +# classify_outliers +ok {test-number} - o.low_severe == los for: 1 == 1 +# classify_outliers +ok {test-number} - o.low_mild == lom for: 0 == 0 +# classify_outliers +ok {test-number} - o.high_mild == him for: 1 == 1 +# classify_outliers +ok {test-number} - o.high_severe == his for: 0 == 0 +# classify_outliers +ok {test-number} - o.total() == los + lom + him + his for: 2 == 2 +# comparisons between const int variables +ok {test-number} - unsigned_char_var == 1 for: 1 == 1 +# comparisons between const int variables +ok {test-number} - unsigned_short_var == 1 for: 1 == 1 +# comparisons between const int variables +ok {test-number} - unsigned_int_var == 1 for: 1 == 1 +# comparisons between const int variables +ok {test-number} - unsigned_long_var == 1 for: 1 == 1 +# comparisons between int variables +ok {test-number} - long_var == unsigned_char_var for: 1 == 1 +# comparisons between int variables +ok {test-number} - long_var == unsigned_short_var for: 1 == 1 +# comparisons between int variables +ok {test-number} - long_var == unsigned_int_var for: 1 == 1 +# comparisons between int variables +ok {test-number} - long_var == unsigned_long_var for: 1 == 1 +# erfc_inv +ok {test-number} - erfc_inv(1.103560) == Approx(-0.09203687623843015) for: -0.0920368762 == Approx( -0.0920368762 ) +# erfc_inv +ok {test-number} - erfc_inv(1.067400) == Approx(-0.05980291115763361) for: -0.0598029112 == Approx( -0.0598029112 ) +# erfc_inv +ok {test-number} - erfc_inv(0.050000) == Approx(1.38590382434967796) for: 1.3859038243 == Approx( 1.3859038243 ) +# estimate_clock_resolution +ok {test-number} - res.mean.count() == rate for: 2000.0 == 2000 (0x<hex digits>) +# estimate_clock_resolution +ok {test-number} - res.outliers.total() == 0 for: 0 == 0 +# even more nested SECTION tests +ok {test-number} - +# even more nested SECTION tests +ok {test-number} - +# even more nested SECTION tests +ok {test-number} - +loose text artifact +# just failure +not ok {test-number} - explicitly with 1 message: 'Previous info should not be seen' +# just failure after unscoped info +not ok {test-number} - explicitly with 1 message: 'previous unscoped info SHOULD not be seen' +# long long +ok {test-number} - l == std::numeric_limits<long long>::max() for: 9223372036854775807 (0x<hex digits>) == 9223372036854775807 (0x<hex digits>) +# looped SECTION tests +not ok {test-number} - b > a for: 0 > 1 +# looped SECTION tests +not ok {test-number} - b > a for: 1 > 1 +# looped SECTION tests +ok {test-number} - b > a for: 2 > 1 +# looped SECTION tests +ok {test-number} - b > a for: 3 > 1 +# looped SECTION tests +ok {test-number} - b > a for: 4 > 1 +# looped SECTION tests +ok {test-number} - b > a for: 5 > 1 +# looped SECTION tests +ok {test-number} - b > a for: 6 > 1 +# looped SECTION tests +ok {test-number} - b > a for: 7 > 1 +# looped SECTION tests +ok {test-number} - b > a for: 8 > 1 +# looped SECTION tests +ok {test-number} - b > a for: 9 > 1 +# looped tests +not ok {test-number} - ( fib[i] % 2 ) == 0 for: 1 == 0 with 1 message: 'Testing if fib[0] (1) is even' +# looped tests +not ok {test-number} - ( fib[i] % 2 ) == 0 for: 1 == 0 with 1 message: 'Testing if fib[1] (1) is even' +# looped tests +ok {test-number} - ( fib[i] % 2 ) == 0 for: 0 == 0 with 1 message: 'Testing if fib[2] (2) is even' +# looped tests +not ok {test-number} - ( fib[i] % 2 ) == 0 for: 1 == 0 with 1 message: 'Testing if fib[3] (3) is even' +# looped tests +not ok {test-number} - ( fib[i] % 2 ) == 0 for: 1 == 0 with 1 message: 'Testing if fib[4] (5) is even' +# looped tests +ok {test-number} - ( fib[i] % 2 ) == 0 for: 0 == 0 with 1 message: 'Testing if fib[5] (8) is even' +# looped tests +not ok {test-number} - ( fib[i] % 2 ) == 0 for: 1 == 0 with 1 message: 'Testing if fib[6] (13) is even' +# looped tests +not ok {test-number} - ( fib[i] % 2 ) == 0 for: 1 == 0 with 1 message: 'Testing if fib[7] (21) is even' +# make_unique reimplementation +ok {test-number} - !(lval.has_moved) for: !false +# make_unique reimplementation +ok {test-number} - rval.has_moved for: true +# make_unique reimplementation +ok {test-number} - *ptr == std::tuple<int, double, int>{1, 2., 3} for: {?} == {?} +# mean +ok {test-number} - m == 19. for: 19.0 == 19.0 +# measure +ok {test-number} - x == 17 for: 17 == 17 +# measure +ok {test-number} - x == 23 for: 23 == 23 +# measure +ok {test-number} - r.elapsed.count() == 42 for: 42 == 42 +# measure +ok {test-number} - r.result == 23 for: 23 == 23 +# measure +ok {test-number} - r.iterations == 1 for: 1 == 1 +# measure +ok {test-number} - s.elapsed.count() == 69 for: 69 == 69 +# measure +ok {test-number} - s.result == 17 for: 17 == 17 +# measure +ok {test-number} - s.iterations == 1 for: 1 == 1 +# mix info, unscoped info and warning +warning {test-number} - 'info' with 2 messages: 'unscoped info' and 'and warn may mix' +# mix info, unscoped info and warning +warning {test-number} - 'info' with 2 messages: 'unscoped info' and 'they are not cleared after warnings' +# more nested SECTION tests +not ok {test-number} - a == b for: 1 == 2 +# more nested SECTION tests +ok {test-number} - a != b for: 1 != 2 +# more nested SECTION tests +ok {test-number} - a < b for: 1 < 2 +# nested SECTION tests +ok {test-number} - a != b for: 1 != 2 +# nested SECTION tests +ok {test-number} - b != a for: 2 != 1 +# nested SECTION tests +ok {test-number} - a != b for: 1 != 2 +# non streamable - with conv. op +ok {test-number} - s == "7" for: "7" == "7" +# non-copyable objects +ok {test-number} - ti == typeid(int) for: {?} == {?} +# normal_cdf +ok {test-number} - normal_cdf(0.000000) == Approx(0.50000000000000000) for: 0.5 == Approx( 0.5 ) +# normal_cdf +ok {test-number} - normal_cdf(1.000000) == Approx(0.84134474606854293) for: 0.8413447461 == Approx( 0.8413447461 ) +# normal_cdf +ok {test-number} - normal_cdf(-1.000000) == Approx(0.15865525393145705) for: 0.1586552539 == Approx( 0.1586552539 ) +# normal_cdf +ok {test-number} - normal_cdf(2.809729) == Approx(0.99752083845315409) for: 0.9975208385 == Approx( 0.9975208385 ) +# normal_cdf +ok {test-number} - normal_cdf(-1.352570) == Approx(0.08809652095066035) for: 0.088096521 == Approx( 0.088096521 ) +# normal_quantile +ok {test-number} - normal_quantile(0.551780) == Approx(0.13015979861484198) for: 0.1301597986 == Approx( 0.1301597986 ) +# normal_quantile +ok {test-number} - normal_quantile(0.533700) == Approx(0.08457408802851875) for: 0.084574088 == Approx( 0.084574088 ) +# normal_quantile +ok {test-number} - normal_quantile(0.025000) == Approx(-1.95996398454005449) for: -1.9599639845 == Approx( -1.9599639845 ) +# not allowed +ok {test-number} - +# not prints unscoped info from previous failures +ok {test-number} - true with 1 message: 'this MAY be seen only for the FIRST assertion IF info is printed for passing assertions' +# not prints unscoped info from previous failures +ok {test-number} - true with 1 message: 'this MAY be seen only for the SECOND assertion IF info is printed for passing assertions' +# not prints unscoped info from previous failures +not ok {test-number} - false with 1 message: 'this SHOULD be seen' +# null strings +ok {test-number} - makeString( false ) != static_cast<char*>(0) for: "valid string" != {null string} +# null strings +ok {test-number} - makeString( true ) == static_cast<char*>(0) for: {null string} == {null string} +# null_ptr +ok {test-number} - ptr.get() == 0 for: 0 == 0 +# pair<pair<int,const char *,pair<std::string,int> > -> toString +ok {test-number} - ::Catch::Detail::stringify( pair ) == "{ { 42, \"Arthur\" }, { \"Ford\", 24 } }" for: "{ { 42, "Arthur" }, { "Ford", 24 } }" == "{ { 42, "Arthur" }, { "Ford", 24 } }" +# parseEnums +ok {test-number} - parseEnums( "" ), Equals( std::vector<Catch::StringRef>{} ) for: { } Equals: { } +# parseEnums +ok {test-number} - parseEnums( "ClassName::EnumName::Value1" ), Equals(std::vector<Catch::StringRef>{"Value1"} ) for: { Value1 } Equals: { Value1 } +# parseEnums +ok {test-number} - parseEnums( "Value1" ), Equals( std::vector<Catch::StringRef>{"Value1"} ) for: { Value1 } Equals: { Value1 } +# parseEnums +ok {test-number} - parseEnums( "EnumName::Value1" ), Equals(std::vector<Catch::StringRef>{"Value1"} ) for: { Value1 } Equals: { Value1 } +# parseEnums +ok {test-number} - parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2"} ) for: { Value1, Value2 } Equals: { Value1, Value2 } +# parseEnums +ok {test-number} - parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2, ClassName::EnumName::Value3" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2", "Value3"} ) for: { Value1, Value2, Value3 } Equals: { Value1, Value2, Value3 } +# parseEnums +ok {test-number} - parseEnums( "ClassName::EnumName::Value1,ClassName::EnumName::Value2 , ClassName::EnumName::Value3" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2", "Value3"} ) for: { Value1, Value2, Value3 } Equals: { Value1, Value2, Value3 } +# pointer to class +ok {test-number} - p == 0 for: 0 == 0 +# print unscoped info if passing unscoped info is printed +ok {test-number} - true with 1 message: 'this MAY be seen IF info is printed for passing assertions' +# prints unscoped info on failure +not ok {test-number} - false with 2 messages: 'this SHOULD be seen' and 'this SHOULD also be seen' +# prints unscoped info only for the first assertion +not ok {test-number} - false with 1 message: 'this SHOULD be seen only ONCE' +# prints unscoped info only for the first assertion +ok {test-number} - true +# prints unscoped info only for the first assertion +ok {test-number} - true with 1 message: 'this MAY also be seen only ONCE IF info is printed for passing assertions' +# prints unscoped info only for the first assertion +ok {test-number} - true +# random SECTION tests +ok {test-number} - a != b for: 1 != 2 +# random SECTION tests +ok {test-number} - b != a for: 2 != 1 +# random SECTION tests +ok {test-number} - a != b for: 1 != 2 +# replaceInPlace +ok {test-number} - Catch::replaceInPlace(letters, "b", "z") for: true +# replaceInPlace +ok {test-number} - letters == "azcdefcg" for: "azcdefcg" == "azcdefcg" +# replaceInPlace +ok {test-number} - Catch::replaceInPlace(letters, "c", "z") for: true +# replaceInPlace +ok {test-number} - letters == "abzdefzg" for: "abzdefzg" == "abzdefzg" +# replaceInPlace +ok {test-number} - Catch::replaceInPlace(letters, "a", "z") for: true +# replaceInPlace +ok {test-number} - letters == "zbcdefcg" for: "zbcdefcg" == "zbcdefcg" +# replaceInPlace +ok {test-number} - Catch::replaceInPlace(letters, "g", "z") for: true +# replaceInPlace +ok {test-number} - letters == "abcdefcz" for: "abcdefcz" == "abcdefcz" +# replaceInPlace +ok {test-number} - Catch::replaceInPlace(letters, letters, "replaced") for: true +# replaceInPlace +ok {test-number} - letters == "replaced" for: "replaced" == "replaced" +# replaceInPlace +ok {test-number} - !(Catch::replaceInPlace(letters, "x", "z")) for: !false +# replaceInPlace +ok {test-number} - letters == letters for: "abcdefcg" == "abcdefcg" +# replaceInPlace +ok {test-number} - Catch::replaceInPlace(s, "'", "|'") for: true +# replaceInPlace +ok {test-number} - s == "didn|'t" for: "didn|'t" == "didn|'t" +# resolution +ok {test-number} - res.size() == count for: 10 == 10 +# resolution +ok {test-number} - res[i] == rate for: 1000.0 == 1000 (0x<hex digits>) +# resolution +ok {test-number} - res[i] == rate for: 1000.0 == 1000 (0x<hex digits>) +# resolution +ok {test-number} - res[i] == rate for: 1000.0 == 1000 (0x<hex digits>) +# resolution +ok {test-number} - res[i] == rate for: 1000.0 == 1000 (0x<hex digits>) +# resolution +ok {test-number} - res[i] == rate for: 1000.0 == 1000 (0x<hex digits>) +# resolution +ok {test-number} - res[i] == rate for: 1000.0 == 1000 (0x<hex digits>) +# resolution +ok {test-number} - res[i] == rate for: 1000.0 == 1000 (0x<hex digits>) +# resolution +ok {test-number} - res[i] == rate for: 1000.0 == 1000 (0x<hex digits>) +# resolution +ok {test-number} - res[i] == rate for: 1000.0 == 1000 (0x<hex digits>) +# run_for_at_least, chronometer +ok {test-number} - meter.runs() >= old_runs for: 1 >= 1 +# run_for_at_least, chronometer +ok {test-number} - meter.runs() >= old_runs for: 2 >= 1 +# run_for_at_least, chronometer +ok {test-number} - meter.runs() >= old_runs for: 4 >= 2 +# run_for_at_least, chronometer +ok {test-number} - meter.runs() >= old_runs for: 8 >= 4 +# run_for_at_least, chronometer +ok {test-number} - meter.runs() >= old_runs for: 16 >= 8 +# run_for_at_least, chronometer +ok {test-number} - meter.runs() >= old_runs for: 32 >= 16 +# run_for_at_least, chronometer +ok {test-number} - meter.runs() >= old_runs for: 64 >= 32 +# run_for_at_least, chronometer +ok {test-number} - meter.runs() >= old_runs for: 128 >= 64 +# run_for_at_least, chronometer +ok {test-number} - Timing.elapsed >= time for: 128 ns >= 100 ns +# run_for_at_least, chronometer +ok {test-number} - Timing.result == Timing.iterations + 17 for: 145 == 145 +# run_for_at_least, chronometer +ok {test-number} - Timing.iterations >= time.count() for: 128 >= 100 +# run_for_at_least, int +ok {test-number} - x >= old_x for: 1 >= 1 +# run_for_at_least, int +ok {test-number} - x >= old_x for: 2 >= 1 +# run_for_at_least, int +ok {test-number} - x >= old_x for: 4 >= 2 +# run_for_at_least, int +ok {test-number} - x >= old_x for: 8 >= 4 +# run_for_at_least, int +ok {test-number} - x >= old_x for: 16 >= 8 +# run_for_at_least, int +ok {test-number} - x >= old_x for: 32 >= 16 +# run_for_at_least, int +ok {test-number} - x >= old_x for: 64 >= 32 +# run_for_at_least, int +ok {test-number} - x >= old_x for: 128 >= 64 +# run_for_at_least, int +ok {test-number} - Timing.elapsed >= time for: 128 ns >= 100 ns +# run_for_at_least, int +ok {test-number} - Timing.result == Timing.iterations + 17 for: 145 == 145 +# run_for_at_least, int +ok {test-number} - Timing.iterations >= time.count() for: 128 >= 100 +# send a single char to INFO +not ok {test-number} - false with 1 message: '3' +# sends information to INFO +not ok {test-number} - false with 2 messages: 'hi' and 'i := 7' +# shortened hide tags are split apart +ok {test-number} - tags, VectorContains("magic-tag"_catch_sr) && VectorContains("."_catch_sr) for: { ., magic-tag } ( Contains: magic-tag and Contains: . ) +# splitString +ok {test-number} - splitStringRef("", ','), Equals(std::vector<StringRef>()) for: { } Equals: { } +# splitString +ok {test-number} - splitStringRef("abc", ','), Equals(std::vector<StringRef>{"abc"}) for: { abc } Equals: { abc } +# splitString +ok {test-number} - splitStringRef("abc,def", ','), Equals(std::vector<StringRef>{"abc", "def"}) for: { abc, def } Equals: { abc, def } +# stacks unscoped info in loops +not ok {test-number} - false with 4 messages: 'Count 1 to 3...' and '1' and '2' and '3' +# stacks unscoped info in loops +not ok {test-number} - false with 4 messages: 'Count 4 to 6...' and '4' and '5' and '6' +# std::map is convertible string +ok {test-number} - Catch::Detail::stringify( emptyMap ) == "{ }" for: "{ }" == "{ }" +# std::map is convertible string +ok {test-number} - Catch::Detail::stringify( map ) == "{ { \"one\", 1 } }" for: "{ { "one", 1 } }" == "{ { "one", 1 } }" +# std::map is convertible string +ok {test-number} - Catch::Detail::stringify( map ) == "{ { \"abc\", 1 }, { \"def\", 2 }, { \"ghi\", 3 } }" for: "{ { "abc", 1 }, { "def", 2 }, { "ghi", 3 } }" == "{ { "abc", 1 }, { "def", 2 }, { "ghi", 3 } }" +# std::pair<int,const std::string> -> toString +ok {test-number} - ::Catch::Detail::stringify(value) == "{ 34, \"xyzzy\" }" for: "{ 34, "xyzzy" }" == "{ 34, "xyzzy" }" +# std::pair<int,std::string> -> toString +ok {test-number} - ::Catch::Detail::stringify( value ) == "{ 34, \"xyzzy\" }" for: "{ 34, "xyzzy" }" == "{ 34, "xyzzy" }" +# std::set is convertible string +ok {test-number} - Catch::Detail::stringify( emptySet ) == "{ }" for: "{ }" == "{ }" +# std::set is convertible string +ok {test-number} - Catch::Detail::stringify( set ) == "{ \"one\" }" for: "{ "one" }" == "{ "one" }" +# std::set is convertible string +ok {test-number} - Catch::Detail::stringify( set ) == "{ \"abc\", \"def\", \"ghi\" }" for: "{ "abc", "def", "ghi" }" == "{ "abc", "def", "ghi" }" +# std::vector<std::pair<std::string,int> > -> toString +ok {test-number} - ::Catch::Detail::stringify( pr ) == "{ { \"green\", 55 } }" for: "{ { "green", 55 } }" == "{ { "green", 55 } }" +# string literals of different sizes can be compared +not ok {test-number} - std::string( "first" ) == "second" for: "first" == "second" +# stringify ranges +ok {test-number} - ::Catch::Detail::stringify(streamable_range{}) == "op<<(streamable_range)" for: "op<<(streamable_range)" == "op<<(streamable_range)" +# stringify ranges +ok {test-number} - ::Catch::Detail::stringify(stringmaker_range{}) == "stringmaker(streamable_range)" for: "stringmaker(streamable_range)" == "stringmaker(streamable_range)" +# stringify ranges +ok {test-number} - ::Catch::Detail::stringify(just_range{}) == "{ 1, 2, 3, 4 }" for: "{ 1, 2, 3, 4 }" == "{ 1, 2, 3, 4 }" +# stringify ranges +ok {test-number} - ::Catch::Detail::stringify(disabled_range{}) == "{?}" for: "{?}" == "{?}" +# stringify( has_maker ) +ok {test-number} - ::Catch::Detail::stringify( item ) == "StringMaker<has_maker>" for: "StringMaker<has_maker>" == "StringMaker<has_maker>" +# stringify( has_maker_and_operator ) +ok {test-number} - ::Catch::Detail::stringify( item ) == "StringMaker<has_maker_and_operator>" for: "StringMaker<has_maker_and_operator>" == "StringMaker<has_maker_and_operator>" +# stringify( has_neither ) +ok {test-number} - ::Catch::Detail::stringify(item) == "{?}" for: "{?}" == "{?}" +# stringify( has_operator ) +ok {test-number} - ::Catch::Detail::stringify( item ) == "operator<<( has_operator )" for: "operator<<( has_operator )" == "operator<<( has_operator )" +# stringify( has_template_operator ) +ok {test-number} - ::Catch::Detail::stringify( item ) == "operator<<( has_template_operator )" for: "operator<<( has_template_operator )" == "operator<<( has_template_operator )" +# stringify( vectors<has_maker> ) +ok {test-number} - ::Catch::Detail::stringify( v ) == "{ StringMaker<has_maker> }" for: "{ StringMaker<has_maker> }" == "{ StringMaker<has_maker> }" +# stringify( vectors<has_maker_and_operator> ) +ok {test-number} - ::Catch::Detail::stringify( v ) == "{ StringMaker<has_maker_and_operator> }" for: "{ StringMaker<has_maker_and_operator> }" == "{ StringMaker<has_maker_and_operator> }" +# stringify( vectors<has_operator> ) +ok {test-number} - ::Catch::Detail::stringify( v ) == "{ operator<<( has_operator ) }" for: "{ operator<<( has_operator ) }" == "{ operator<<( has_operator ) }" +# strlen3 +ok {test-number} - data.str.size() == data.len for: 3 == 3 +# strlen3 +ok {test-number} - data.str.size() == data.len for: 3 == 3 +# strlen3 +ok {test-number} - data.str.size() == data.len for: 5 == 5 +# strlen3 +ok {test-number} - data.str.size() == data.len for: 4 == 4 +# tables +ok {test-number} - strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) for: 5 == 5 +# tables +ok {test-number} - strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) for: 6 == 6 +# tables +ok {test-number} - strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) for: 5 == 5 +# tables +ok {test-number} - strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) for: 6 == 6 +# thrown std::strings are translated +not ok {test-number} - unexpected exception with message: 'Why would you throw a std::string?' +# toString on const wchar_t const pointer returns the string contents +ok {test-number} - result == "\"wide load\"" for: ""wide load"" == ""wide load"" +# toString on const wchar_t pointer returns the string contents +ok {test-number} - result == "\"wide load\"" for: ""wide load"" == ""wide load"" +# toString on wchar_t const pointer returns the string contents +ok {test-number} - result == "\"wide load\"" for: ""wide load"" == ""wide load"" +# toString on wchar_t returns the string contents +ok {test-number} - result == "\"wide load\"" for: ""wide load"" == ""wide load"" +# toString(enum class w/operator<<) +ok {test-number} - ::Catch::Detail::stringify(e0) == "E2/V0" for: "E2/V0" == "E2/V0" +# toString(enum class w/operator<<) +ok {test-number} - ::Catch::Detail::stringify(e1) == "E2/V1" for: "E2/V1" == "E2/V1" +# toString(enum class w/operator<<) +ok {test-number} - ::Catch::Detail::stringify(e3) == "Unknown enum value 10" for: "Unknown enum value 10" == "Unknown enum value 10" +# toString(enum class) +ok {test-number} - ::Catch::Detail::stringify(e0) == "0" for: "0" == "0" +# toString(enum class) +ok {test-number} - ::Catch::Detail::stringify(e1) == "1" for: "1" == "1" +# toString(enum w/operator<<) +ok {test-number} - ::Catch::Detail::stringify(e0) == "E2{0}" for: "E2{0}" == "E2{0}" +# toString(enum w/operator<<) +ok {test-number} - ::Catch::Detail::stringify(e1) == "E2{1}" for: "E2{1}" == "E2{1}" +# toString(enum) +ok {test-number} - ::Catch::Detail::stringify(e0) == "0" for: "0" == "0" +# toString(enum) +ok {test-number} - ::Catch::Detail::stringify(e1) == "1" for: "1" == "1" +# tuple<> +ok {test-number} - "{ }" == ::Catch::Detail::stringify(type{}) for: "{ }" == "{ }" +# tuple<> +ok {test-number} - "{ }" == ::Catch::Detail::stringify(value) for: "{ }" == "{ }" +# tuple<float,int> +ok {test-number} - "1.2f" == ::Catch::Detail::stringify(float(1.2)) for: "1.2f" == "1.2f" +# tuple<float,int> +ok {test-number} - "{ 1.2f, 0 }" == ::Catch::Detail::stringify(type{1.2f,0}) for: "{ 1.2f, 0 }" == "{ 1.2f, 0 }" +# tuple<int> +ok {test-number} - "{ 0 }" == ::Catch::Detail::stringify(type{0}) for: "{ 0 }" == "{ 0 }" +# tuple<0,int,const char *> +ok {test-number} - "{ 0, 42, \"Catch me\" }" == ::Catch::Detail::stringify(value) for: "{ 0, 42, "Catch me" }" == "{ 0, 42, "Catch me" }" +# tuple<string,string> +ok {test-number} - "{ \"hello\", \"world\" }" == ::Catch::Detail::stringify(type{"hello","world"}) for: "{ "hello", "world" }" == "{ "hello", "world" }" +# tuple<tuple<int>,tuple<>,float> +ok {test-number} - "{ { 42 }, { }, 1.2f }" == ::Catch::Detail::stringify(value) for: "{ { 42 }, { }, 1.2f }" == "{ { 42 }, { }, 1.2f }" +# uniform samples +ok {test-number} - e.point == 23 for: 23.0 == 23 +# uniform samples +ok {test-number} - e.upper_bound == 23 for: 23.0 == 23 +# uniform samples +ok {test-number} - e.lower_bound == 23 for: 23.0 == 23 +# uniform samples +ok {test-number} - e.confidence_interval == 0.95 for: 0.95 == 0.95 +# unique_ptr reimplementation: basic functionality +ok {test-number} - !(ptr) for: !{?} +# unique_ptr reimplementation: basic functionality +ok {test-number} - ptr.get() == 0 for: 0 == 0 +# unique_ptr reimplementation: basic functionality +ok {test-number} - ptr for: {?} +# unique_ptr reimplementation: basic functionality +ok {test-number} - *ptr == 0 for: 0 == 0 +# unique_ptr reimplementation: basic functionality +ok {test-number} - ptr.get() == naked_ptr for: 0x<hex digits> == 0x<hex digits> +# unique_ptr reimplementation: basic functionality +ok {test-number} - !(ptr) for: !{?} +# unique_ptr reimplementation: basic functionality +ok {test-number} - ptr.get() == 0 for: 0 == 0 +# unique_ptr reimplementation: basic functionality +ok {test-number} - ptr for: {?} +# unique_ptr reimplementation: basic functionality +ok {test-number} - *ptr == 0 for: 0 == 0 +# unique_ptr reimplementation: basic functionality +ok {test-number} - ptr.get() == naked_ptr for: 0x<hex digits> == 0x<hex digits> +# unique_ptr reimplementation: basic functionality +ok {test-number} - ptr for: {?} +# unique_ptr reimplementation: basic functionality +ok {test-number} - ptr.get() != 0 for: 0x<hex digits> != 0 +# unique_ptr reimplementation: basic functionality +ok {test-number} - *ptr == 2 for: 2 == 2 +# unique_ptr reimplementation: basic functionality +ok {test-number} - !(ptr) for: !{?} +# unique_ptr reimplementation: basic functionality +ok {test-number} - ptr.get() == 0 for: 0 == 0 +# unique_ptr reimplementation: basic functionality +ok {test-number} - !(ptr1) for: !{?} +# unique_ptr reimplementation: basic functionality +ok {test-number} - ptr2 for: {?} +# unique_ptr reimplementation: basic functionality +ok {test-number} - *ptr2 == 1 for: 1 == 1 +# unique_ptr reimplementation: basic functionality +ok {test-number} - !(ptr2) for: !{?} +# unique_ptr reimplementation: basic functionality +ok {test-number} - ptr1 for: {?} +# unique_ptr reimplementation: basic functionality +ok {test-number} - *ptr1 == 2 for: 2 == 2 +# unique_ptr reimplementation: basic functionality +ok {test-number} - *ptr1 == 2 for: 2 == 2 +# unique_ptr reimplementation: basic functionality +ok {test-number} - *ptr2 == 1 for: 1 == 1 +# vec<vec<string,alloc>> -> toString +ok {test-number} - ::Catch::Detail::stringify(v) == "{ }" for: "{ }" == "{ }" +# vec<vec<string,alloc>> -> toString +ok {test-number} - ::Catch::Detail::stringify(v) == "{ { \"hello\" }, { \"world\" } }" for: "{ { "hello" }, { "world" } }" == "{ { "hello" }, { "world" } }" +# vector<bool> -> toString +ok {test-number} - ::Catch::Detail::stringify(bools) == "{ }" for: "{ }" == "{ }" +# vector<bool> -> toString +ok {test-number} - ::Catch::Detail::stringify(bools) == "{ true }" for: "{ true }" == "{ true }" +# vector<bool> -> toString +ok {test-number} - ::Catch::Detail::stringify(bools) == "{ true, false }" for: "{ true, false }" == "{ true, false }" +# vector<int,allocator> -> toString +ok {test-number} - ::Catch::Detail::stringify(vv) == "{ }" for: "{ }" == "{ }" +# vector<int,allocator> -> toString +ok {test-number} - ::Catch::Detail::stringify(vv) == "{ 42 }" for: "{ 42 }" == "{ 42 }" +# vector<int,allocator> -> toString +ok {test-number} - ::Catch::Detail::stringify(vv) == "{ 42, 250 }" for: "{ 42, 250 }" == "{ 42, 250 }" +# vector<int> -> toString +ok {test-number} - ::Catch::Detail::stringify(vv) == "{ }" for: "{ }" == "{ }" +# vector<int> -> toString +ok {test-number} - ::Catch::Detail::stringify(vv) == "{ 42 }" for: "{ 42 }" == "{ 42 }" +# vector<int> -> toString +ok {test-number} - ::Catch::Detail::stringify(vv) == "{ 42, 250 }" for: "{ 42, 250 }" == "{ 42, 250 }" +# vector<string> -> toString +ok {test-number} - ::Catch::Detail::stringify(vv) == "{ }" for: "{ }" == "{ }" +# vector<string> -> toString +ok {test-number} - ::Catch::Detail::stringify(vv) == "{ \"hello\" }" for: "{ "hello" }" == "{ "hello" }" +# vector<string> -> toString +ok {test-number} - ::Catch::Detail::stringify(vv) == "{ \"hello\", \"world\" }" for: "{ "hello", "world" }" == "{ "hello", "world" }" +# vectors can be sized and resized +ok {test-number} - v.size() == 5 for: 5 == 5 +# vectors can be sized and resized +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# vectors can be sized and resized +ok {test-number} - v.size() == 10 for: 10 == 10 +# vectors can be sized and resized +ok {test-number} - v.capacity() >= 10 for: 10 >= 10 +# vectors can be sized and resized +ok {test-number} - v.size() == 5 for: 5 == 5 +# vectors can be sized and resized +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# vectors can be sized and resized +ok {test-number} - v.size() == 0 for: 0 == 0 +# vectors can be sized and resized +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# vectors can be sized and resized +ok {test-number} - v.capacity() == 0 for: 0 == 0 +# vectors can be sized and resized +ok {test-number} - v.size() == 5 for: 5 == 5 +# vectors can be sized and resized +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# vectors can be sized and resized +ok {test-number} - v.size() == 5 for: 5 == 5 +# vectors can be sized and resized +ok {test-number} - v.capacity() >= 10 for: 10 >= 10 +# vectors can be sized and resized +ok {test-number} - v.size() == 5 for: 5 == 5 +# vectors can be sized and resized +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# vectors can be sized and resized +ok {test-number} - v.size() == 5 for: 5 == 5 +# vectors can be sized and resized +ok {test-number} - v.capacity() >= 5 for: 5 >= 5 +# warmup +ok {test-number} - (iterations * rate) > Catch::Benchmark::Detail::warmup_time.count() for: 160000000 (0x<hex digits>) > 100 +# warmup +ok {test-number} - (end - start) > Catch::Benchmark::Detail::warmup_time for: 310016000 ns > 100 ms +# weighted_average_quantile +ok {test-number} - q1 == 14.5 for: 14.5 == 14.5 +# weighted_average_quantile +ok {test-number} - med == 18. for: 18.0 == 18.0 +# weighted_average_quantile +ok {test-number} - q3 == 23. for: 23.0 == 23.0 +# xmlentitycheck +ok {test-number} - +# xmlentitycheck +ok {test-number} - +1..2105 + diff --git a/packages/Catch2/tests/SelfTest/Baselines/teamcity.sw.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/teamcity.sw.approved.txt new file mode 100644 index 0000000000000000000000000000000000000000..e64c984fb111c5e359fee2e29d9f93347fa02284 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/Baselines/teamcity.sw.approved.txt @@ -0,0 +1,872 @@ +##teamcity[testSuiteStarted name='<exe-name>'] +##teamcity[testStarted name='# A test name that starts with a #'] +##teamcity[testFinished name='# A test name that starts with a #' duration="{duration}"] +##teamcity[testStarted name='#1005: Comparing pointer to int and long (NULL can be either on various systems)'] +##teamcity[testFinished name='#1005: Comparing pointer to int and long (NULL can be either on various systems)' duration="{duration}"] +##teamcity[testStarted name='#1027: Bitfields can be captured'] +##teamcity[testFinished name='#1027: Bitfields can be captured' duration="{duration}"] +##teamcity[testStarted name='#1147'] +##teamcity[testFinished name='#1147' duration="{duration}"] +##teamcity[testStarted name='#1175 - Hidden Test'] +##teamcity[testFinished name='#1175 - Hidden Test' duration="{duration}"] +##teamcity[testStarted name='#1238'] +##teamcity[testFinished name='#1238' duration="{duration}"] +##teamcity[testStarted name='#1245'] +##teamcity[testFinished name='#1245' duration="{duration}"] +##teamcity[testStarted name='#1319: Sections can have description (even if it is not saved'] +##teamcity[testFinished name='#1319: Sections can have description (even if it is not saved' duration="{duration}"] +##teamcity[testStarted name='#1403'] +##teamcity[testFinished name='#1403' duration="{duration}"] +##teamcity[testStarted name='#1455 - INFO and WARN can start with a linebreak'] +##teamcity[testFinished name='#1455 - INFO and WARN can start with a linebreak' duration="{duration}"] +##teamcity[testStarted name='#1514: stderr/stdout is not captured in tests aborted by an exception'] +Tricky.tests.cpp:<line number>|nexplicit failure with message:|n "1514"'] +##teamcity[testStdOut name='#1514: stderr/stdout is not captured in tests aborted by an exception' out='This would not be caught previously|n'] +##teamcity[testStdErr name='#1514: stderr/stdout is not captured in tests aborted by an exception' out='Nor would this|n'] +##teamcity[testFinished name='#1514: stderr/stdout is not captured in tests aborted by an exception' duration="{duration}"] +##teamcity[testStarted name='#1548'] +##teamcity[testFinished name='#1548' duration="{duration}"] +##teamcity[testStarted name='#1905 -- test spec parser properly clears internal state between compound tests'] +##teamcity[testFinished name='#1905 -- test spec parser properly clears internal state between compound tests' duration="{duration}"] +##teamcity[testStarted name='#1912 -- test spec parser handles escaping'] +##teamcity[testFinished name='#1912 -- test spec parser handles escaping' duration="{duration}"] +##teamcity[testStarted name='#1913 - GENERATE inside a for loop should not keep recreating the generator'] +##teamcity[testFinished name='#1913 - GENERATE inside a for loop should not keep recreating the generator' duration="{duration}"] +##teamcity[testStarted name='#1913 - GENERATEs can share a line'] +##teamcity[testFinished name='#1913 - GENERATEs can share a line' duration="{duration}"] +##teamcity[testStarted name='#1938 - GENERATE after a section'] +##teamcity[testFinished name='#1938 - GENERATE after a section' duration="{duration}"] +##teamcity[testStarted name='#1938 - Section followed by flat generate'] +##teamcity[testFinished name='#1938 - Section followed by flat generate' duration="{duration}"] +##teamcity[testStarted name='#1938 - flat generate'] +##teamcity[testFinished name='#1938 - flat generate' duration="{duration}"] +##teamcity[testStarted name='#1938 - mixed sections and generates'] +##teamcity[testFinished name='#1938 - mixed sections and generates' duration="{duration}"] +##teamcity[testStarted name='#1938 - nested generate'] +##teamcity[testFinished name='#1938 - nested generate' duration="{duration}"] +##teamcity[testStarted name='#1954 - 7 arg template test case sig compiles - 1, 1, 1, 1, 1, 0, 0'] +##teamcity[testFinished name='#1954 - 7 arg template test case sig compiles - 1, 1, 1, 1, 1, 0, 0' duration="{duration}"] +##teamcity[testStarted name='#1954 - 7 arg template test case sig compiles - 5, 1, 1, 1, 1, 0, 0'] +##teamcity[testFinished name='#1954 - 7 arg template test case sig compiles - 5, 1, 1, 1, 1, 0, 0' duration="{duration}"] +##teamcity[testStarted name='#1954 - 7 arg template test case sig compiles - 5, 3, 1, 1, 1, 0, 0'] +##teamcity[testFinished name='#1954 - 7 arg template test case sig compiles - 5, 3, 1, 1, 1, 0, 0' duration="{duration}"] +##teamcity[testStarted name='#748 - captures with unexpected exceptions'] +Exception.tests.cpp:<line number>|nunexpected exception with messages:|n "answer := 42"|n "expected exception"- failure ignore as test marked as |'ok to fail|'|n'] +Exception.tests.cpp:<line number>|nunexpected exception with messages:|n "answer := 42"|n "expected exception"|n REQUIRE_NOTHROW( thisThrows() )|nwith expansion:|n thisThrows()|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testFinished name='#748 - captures with unexpected exceptions' duration="{duration}"] +##teamcity[testStarted name='#809'] +##teamcity[testFinished name='#809' duration="{duration}"] +##teamcity[testStarted name='#833'] +##teamcity[testFinished name='#833' duration="{duration}"] +##teamcity[testStarted name='#835 -- errno should not be touched by Catch'] +Misc.tests.cpp:<line number>|nexpression failed|n CHECK( f() == 0 )|nwith expansion:|n 1 == 0|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testFinished name='#835 -- errno should not be touched by Catch' duration="{duration}"] +##teamcity[testStarted name='#872'] +##teamcity[testFinished name='#872' duration="{duration}"] +##teamcity[testStarted name='#961 -- Dynamically created sections should all be reported'] +##teamcity[testFinished name='#961 -- Dynamically created sections should all be reported' duration="{duration}"] +##teamcity[testStarted name='|'Not|' checks that should fail'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( false != false )|nwith expansion:|n false != false|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( true != true )|nwith expansion:|n true != true|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( !true )|nwith expansion:|n false|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK_FALSE( true )|nwith expansion:|n !true|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( !trueValue )|nwith expansion:|n false|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK_FALSE( trueValue )|nwith expansion:|n !true|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( !(1 == 1) )|nwith expansion:|n false|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK_FALSE( 1 == 1 )|nwith expansion:|n !(1 == 1)|n'] +##teamcity[testFinished name='|'Not|' checks that should fail' duration="{duration}"] +##teamcity[testStarted name='|'Not|' checks that should succeed'] +##teamcity[testFinished name='|'Not|' checks that should succeed' duration="{duration}"] +##teamcity[testStarted name='(unimplemented) static bools can be evaluated'] +##teamcity[testFinished name='(unimplemented) static bools can be evaluated' duration="{duration}"] +##teamcity[testStarted name='3x3x3 ints'] +##teamcity[testFinished name='3x3x3 ints' duration="{duration}"] +##teamcity[testStarted name='A METHOD_AS_TEST_CASE based test run that fails'] +Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( s == "world" )|nwith expansion:|n "hello" == "world"|n'] +##teamcity[testFinished name='A METHOD_AS_TEST_CASE based test run that fails' duration="{duration}"] +##teamcity[testStarted name='A METHOD_AS_TEST_CASE based test run that succeeds'] +##teamcity[testFinished name='A METHOD_AS_TEST_CASE based test run that succeeds' duration="{duration}"] +##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<float>'] +Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 )|nwith expansion:|n 0 == 1|n'] +##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<float>' duration="{duration}"] +##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<int>'] +Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 )|nwith expansion:|n 0 == 1|n'] +##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<int>' duration="{duration}"] +##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<float>'] +Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 )|nwith expansion:|n 0 == 1|n'] +##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<float>' duration="{duration}"] +##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<int>'] +Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 )|nwith expansion:|n 0 == 1|n'] +##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<int>' duration="{duration}"] +##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - Template_Foo<float>'] +##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - Template_Foo<float>' duration="{duration}"] +##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - Template_Foo<int>'] +##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - Template_Foo<int>' duration="{duration}"] +##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - std::vector<float>'] +##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - std::vector<float>' duration="{duration}"] +##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - std::vector<int>'] +##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - std::vector<int>' duration="{duration}"] +##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<float, 6>'] +Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 )|nwith expansion:|n 6 < 2|n'] +##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<float, 6>' duration="{duration}"] +##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<int, 2>'] +Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 )|nwith expansion:|n 2 < 2|n'] +##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<int, 2>' duration="{duration}"] +##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<float, 6>'] +Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 )|nwith expansion:|n 6 < 2|n'] +##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<float, 6>' duration="{duration}"] +##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<int, 2>'] +Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture_2<TestType>{}.m_a.size() < 2 )|nwith expansion:|n 2 < 2|n'] +##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<int, 2>' duration="{duration}"] +##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - Template_Foo_2<float,6>'] +##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - Template_Foo_2<float,6>' duration="{duration}"] +##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - Template_Foo_2<int,2>'] +##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - Template_Foo_2<int,2>' duration="{duration}"] +##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - std::array<float,6>'] +##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - std::array<float,6>' duration="{duration}"] +##teamcity[testStarted name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - std::array<int,2>'] +##teamcity[testFinished name='A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - std::array<int,2>' duration="{duration}"] +##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD based test run that fails - double'] +Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture<TestType>::m_a == 2 )|nwith expansion:|n 1.0 == 2|n'] +##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD based test run that fails - double' duration="{duration}"] +##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD based test run that fails - float'] +Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture<TestType>::m_a == 2 )|nwith expansion:|n 1.0f == 2|n'] +##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD based test run that fails - float' duration="{duration}"] +##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD based test run that fails - int'] +Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Template_Fixture<TestType>::m_a == 2 )|nwith expansion:|n 1 == 2|n'] +##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD based test run that fails - int' duration="{duration}"] +##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - double'] +##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - double' duration="{duration}"] +##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - float'] +##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - float' duration="{duration}"] +##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - int'] +##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - int' duration="{duration}"] +##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 1'] +Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Nttp_Fixture<V>::value == 0 )|nwith expansion:|n 1 == 0|n'] +##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 1' duration="{duration}"] +##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 3'] +Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Nttp_Fixture<V>::value == 0 )|nwith expansion:|n 3 == 0|n'] +##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 3' duration="{duration}"] +##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 6'] +Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( Nttp_Fixture<V>::value == 0 )|nwith expansion:|n 6 == 0|n'] +##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 6' duration="{duration}"] +##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 1'] +##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 1' duration="{duration}"] +##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 3'] +##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 3' duration="{duration}"] +##teamcity[testStarted name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6'] +##teamcity[testFinished name='A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6' duration="{duration}"] +##teamcity[testStarted name='A TEST_CASE_METHOD based test run that fails'] +Class.tests.cpp:<line number>|nexpression failed|n REQUIRE( m_a == 2 )|nwith expansion:|n 1 == 2|n'] +##teamcity[testFinished name='A TEST_CASE_METHOD based test run that fails' duration="{duration}"] +##teamcity[testStarted name='A TEST_CASE_METHOD based test run that succeeds'] +##teamcity[testFinished name='A TEST_CASE_METHOD based test run that succeeds' duration="{duration}"] +##teamcity[testStarted name='A Template product test case - Foo<float>'] +##teamcity[testFinished name='A Template product test case - Foo<float>' duration="{duration}"] +##teamcity[testStarted name='A Template product test case - Foo<int>'] +##teamcity[testFinished name='A Template product test case - Foo<int>' duration="{duration}"] +##teamcity[testStarted name='A Template product test case - std::vector<float>'] +##teamcity[testFinished name='A Template product test case - std::vector<float>' duration="{duration}"] +##teamcity[testStarted name='A Template product test case - std::vector<int>'] +##teamcity[testFinished name='A Template product test case - std::vector<int>' duration="{duration}"] +##teamcity[testStarted name='A Template product test case with array signature - Bar<float, 42>'] +##teamcity[testFinished name='A Template product test case with array signature - Bar<float, 42>' duration="{duration}"] +##teamcity[testStarted name='A Template product test case with array signature - Bar<int, 9>'] +##teamcity[testFinished name='A Template product test case with array signature - Bar<int, 9>' duration="{duration}"] +##teamcity[testStarted name='A Template product test case with array signature - std::array<float, 42>'] +##teamcity[testFinished name='A Template product test case with array signature - std::array<float, 42>' duration="{duration}"] +##teamcity[testStarted name='A Template product test case with array signature - std::array<int, 9>'] +##teamcity[testFinished name='A Template product test case with array signature - std::array<int, 9>' duration="{duration}"] +##teamcity[testStarted name='A comparison that uses literals instead of the normal constructor'] +##teamcity[testFinished name='A comparison that uses literals instead of the normal constructor' duration="{duration}"] +##teamcity[testStarted name='A couple of nested sections followed by a failure'] +Misc.tests.cpp:<line number>|nexplicit failure with message:|n "to infinity and beyond"'] +##teamcity[testFinished name='A couple of nested sections followed by a failure' duration="{duration}"] +##teamcity[testStarted name='A failing expression with a non streamable type is still captured'] +Tricky.tests.cpp:<line number>|nexpression failed|n CHECK( &o1 == &o2 )|nwith expansion:|n 0x<hex digits> == 0x<hex digits>|n'] +Tricky.tests.cpp:<line number>|nexpression failed|n CHECK( o1 == o2 )|nwith expansion:|n {?} == {?}|n'] +##teamcity[testFinished name='A failing expression with a non streamable type is still captured' duration="{duration}"] +##teamcity[testStarted name='Absolute margin'] +##teamcity[testFinished name='Absolute margin' duration="{duration}"] +##teamcity[testStarted name='An empty test with no assertions'] +##teamcity[testFinished name='An empty test with no assertions' duration="{duration}"] +##teamcity[testStarted name='An expression with side-effects should only be evaluated once'] +##teamcity[testFinished name='An expression with side-effects should only be evaluated once' duration="{duration}"] +##teamcity[testStarted name='An unchecked exception reports the line of the last assertion'] +Exception.tests.cpp:<line number>|nunexpected exception with message:|n "unexpected exception"|n {Unknown expression after the reported line}|nwith expansion:|n {Unknown expression after the reported line}|n'] +##teamcity[testFinished name='An unchecked exception reports the line of the last assertion' duration="{duration}"] +##teamcity[testStarted name='Anonymous test case 1'] +##teamcity[testFinished name='Anonymous test case 1' duration="{duration}"] +##teamcity[testStarted name='Approx setters validate their arguments'] +##teamcity[testFinished name='Approx setters validate their arguments' duration="{duration}"] +##teamcity[testStarted name='Approx with exactly-representable margin'] +##teamcity[testFinished name='Approx with exactly-representable margin' duration="{duration}"] +##teamcity[testStarted name='Approximate PI'] +##teamcity[testFinished name='Approximate PI' duration="{duration}"] +##teamcity[testStarted name='Approximate comparisons with different epsilons'] +##teamcity[testFinished name='Approximate comparisons with different epsilons' duration="{duration}"] +##teamcity[testStarted name='Approximate comparisons with floats'] +##teamcity[testFinished name='Approximate comparisons with floats' duration="{duration}"] +##teamcity[testStarted name='Approximate comparisons with ints'] +##teamcity[testFinished name='Approximate comparisons with ints' duration="{duration}"] +##teamcity[testStarted name='Approximate comparisons with mixed numeric types'] +##teamcity[testFinished name='Approximate comparisons with mixed numeric types' duration="{duration}"] +##teamcity[testStarted name='Arbitrary predicate matcher'] +##teamcity[testFinished name='Arbitrary predicate matcher' duration="{duration}"] +##teamcity[testStarted name='Assertion macros support bit operators and bool conversions'] +##teamcity[testFinished name='Assertion macros support bit operators and bool conversions' duration="{duration}"] +##teamcity[testStarted name='Assertions then sections'] +##teamcity[testFinished name='Assertions then sections' duration="{duration}"] +##teamcity[testStarted name='Basic use of the Contains range matcher'] +##teamcity[testFinished name='Basic use of the Contains range matcher' duration="{duration}"] +##teamcity[testStarted name='Basic use of the Empty range matcher'] +##teamcity[testFinished name='Basic use of the Empty range matcher' duration="{duration}"] +##teamcity[testStarted name='CAPTURE can deal with complex expressions'] +##teamcity[testFinished name='CAPTURE can deal with complex expressions' duration="{duration}"] +##teamcity[testStarted name='CAPTURE can deal with complex expressions involving commas'] +##teamcity[testFinished name='CAPTURE can deal with complex expressions involving commas' duration="{duration}"] +##teamcity[testStarted name='CAPTURE parses string and character constants'] +##teamcity[testFinished name='CAPTURE parses string and character constants' duration="{duration}"] +##teamcity[testStarted name='Capture and info messages'] +##teamcity[testFinished name='Capture and info messages' duration="{duration}"] +##teamcity[testStarted name='Character pretty printing'] +##teamcity[testFinished name='Character pretty printing' duration="{duration}"] +##teamcity[testStarted name='Clara::Arg supports single-arg parse the way Opt does'] +##teamcity[testFinished name='Clara::Arg supports single-arg parse the way Opt does' duration="{duration}"] +##teamcity[testStarted name='Combining MatchAllOfGeneric does not nest'] +##teamcity[testFinished name='Combining MatchAllOfGeneric does not nest' duration="{duration}"] +##teamcity[testStarted name='Combining MatchAnyOfGeneric does not nest'] +##teamcity[testFinished name='Combining MatchAnyOfGeneric does not nest' duration="{duration}"] +##teamcity[testStarted name='Combining MatchNotOfGeneric does not nest'] +##teamcity[testFinished name='Combining MatchNotOfGeneric does not nest' duration="{duration}"] +##teamcity[testStarted name='Combining concrete matchers does not use templated matchers'] +##teamcity[testFinished name='Combining concrete matchers does not use templated matchers' duration="{duration}"] +##teamcity[testStarted name='Combining only templated matchers'] +##teamcity[testFinished name='Combining only templated matchers' duration="{duration}"] +##teamcity[testStarted name='Combining templated and concrete matchers'] +##teamcity[testFinished name='Combining templated and concrete matchers' duration="{duration}"] +##teamcity[testStarted name='Combining templated matchers'] +##teamcity[testFinished name='Combining templated matchers' duration="{duration}"] +##teamcity[testStarted name='Commas in various macros are allowed'] +##teamcity[testFinished name='Commas in various macros are allowed' duration="{duration}"] +##teamcity[testStarted name='Comparing function pointers'] +##teamcity[testFinished name='Comparing function pointers' duration="{duration}"] +##teamcity[testStarted name='Comparison ops'] +##teamcity[testFinished name='Comparison ops' duration="{duration}"] +##teamcity[testStarted name='Comparison with explicitly convertible types'] +##teamcity[testFinished name='Comparison with explicitly convertible types' duration="{duration}"] +##teamcity[testStarted name='Comparisons between ints where one side is computed'] +##teamcity[testFinished name='Comparisons between ints where one side is computed' duration="{duration}"] +##teamcity[testStarted name='Comparisons between unsigned ints and negative signed ints match c++ standard behaviour'] +##teamcity[testFinished name='Comparisons between unsigned ints and negative signed ints match c++ standard behaviour' duration="{duration}"] +##teamcity[testStarted name='Comparisons with int literals don|'t warn when mixing signed/ unsigned'] +##teamcity[testFinished name='Comparisons with int literals don|'t warn when mixing signed/ unsigned' duration="{duration}"] +##teamcity[testStarted name='Composed generic matchers shortcircuit'] +##teamcity[testFinished name='Composed generic matchers shortcircuit' duration="{duration}"] +##teamcity[testStarted name='Composed matchers shortcircuit'] +##teamcity[testFinished name='Composed matchers shortcircuit' duration="{duration}"] +##teamcity[testStarted name='Contains string matcher'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), Contains("not there", Catch::CaseSensitive::No) )|nwith expansion:|n "this string contains |'abc|' as a substring" contains: "not there" (case insensitive)|n'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), Contains("STRING") )|nwith expansion:|n "this string contains |'abc|' as a substring" contains: "STRING"|n'] +##teamcity[testFinished name='Contains string matcher' duration="{duration}"] +##teamcity[testStarted name='Copy and then generate a range'] +##teamcity[testFinished name='Copy and then generate a range' duration="{duration}"] +##teamcity[testStarted name='Custom exceptions can be translated when testing for nothrow'] +Exception.tests.cpp:<line number>|nunexpected exception with message:|n "custom exception - not std"|n REQUIRE_NOTHROW( throwCustom() )|nwith expansion:|n throwCustom()|n'] +##teamcity[testFinished name='Custom exceptions can be translated when testing for nothrow' duration="{duration}"] +##teamcity[testStarted name='Custom exceptions can be translated when testing for throwing as something else'] +Exception.tests.cpp:<line number>|nunexpected exception with message:|n "custom exception - not std"|n REQUIRE_THROWS_AS( throwCustom(), std::exception )|nwith expansion:|n throwCustom(), std::exception|n'] +##teamcity[testFinished name='Custom exceptions can be translated when testing for throwing as something else' duration="{duration}"] +##teamcity[testStarted name='Custom std-exceptions can be custom translated'] +Exception.tests.cpp:<line number>|nunexpected exception with message:|n "custom std exception"'] +##teamcity[testFinished name='Custom std-exceptions can be custom translated' duration="{duration}"] +##teamcity[testStarted name='Default scale is invisible to comparison'] +##teamcity[testFinished name='Default scale is invisible to comparison' duration="{duration}"] +##teamcity[testStarted name='Directly creating an EnumInfo'] +##teamcity[testFinished name='Directly creating an EnumInfo' duration="{duration}"] +##teamcity[testStarted name='EndsWith string matcher'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), EndsWith("Substring") )|nwith expansion:|n "this string contains |'abc|' as a substring" ends with: "Substring"|n'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), EndsWith("this", Catch::CaseSensitive::No) )|nwith expansion:|n "this string contains |'abc|' as a substring" ends with: "this" (case insensitive)|n'] +##teamcity[testFinished name='EndsWith string matcher' duration="{duration}"] +##teamcity[testStarted name='Enums can quickly have stringification enabled using REGISTER_ENUM'] +##teamcity[testFinished name='Enums can quickly have stringification enabled using REGISTER_ENUM' duration="{duration}"] +##teamcity[testStarted name='Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM'] +##teamcity[testFinished name='Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM' duration="{duration}"] +##teamcity[testStarted name='Epsilon only applies to Approx|'s value'] +##teamcity[testFinished name='Epsilon only applies to Approx|'s value' duration="{duration}"] +##teamcity[testStarted name='Equality checks that should fail'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven == 6 )|nwith expansion:|n 7 == 6|n- failure ignore as test marked as |'ok to fail|'|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven == 8 )|nwith expansion:|n 7 == 8|n- failure ignore as test marked as |'ok to fail|'|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven == 0 )|nwith expansion:|n 7 == 0|n- failure ignore as test marked as |'ok to fail|'|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one == Approx( 9.11f ) )|nwith expansion:|n 9.1f == Approx( 9.1099996567 )|n- failure ignore as test marked as |'ok to fail|'|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one == Approx( 9.0f ) )|nwith expansion:|n 9.1f == Approx( 9.0 )|n- failure ignore as test marked as |'ok to fail|'|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one == Approx( 1 ) )|nwith expansion:|n 9.1f == Approx( 1.0 )|n- failure ignore as test marked as |'ok to fail|'|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one == Approx( 0 ) )|nwith expansion:|n 9.1f == Approx( 0.0 )|n- failure ignore as test marked as |'ok to fail|'|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.double_pi == Approx( 3.1415 ) )|nwith expansion:|n 3.1415926535 == Approx( 3.1415 )|n- failure ignore as test marked as |'ok to fail|'|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello == "goodbye" )|nwith expansion:|n "hello" == "goodbye"|n- failure ignore as test marked as |'ok to fail|'|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello == "hell" )|nwith expansion:|n "hello" == "hell"|n- failure ignore as test marked as |'ok to fail|'|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello == "hello1" )|nwith expansion:|n "hello" == "hello1"|n- failure ignore as test marked as |'ok to fail|'|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello.size() == 6 )|nwith expansion:|n 5 == 6|n- failure ignore as test marked as |'ok to fail|'|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( x == Approx( 1.301 ) )|nwith expansion:|n 1.3 == Approx( 1.301 )|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testFinished name='Equality checks that should fail' duration="{duration}"] +##teamcity[testStarted name='Equality checks that should succeed'] +##teamcity[testFinished name='Equality checks that should succeed' duration="{duration}"] +##teamcity[testStarted name='Equals'] +##teamcity[testFinished name='Equals' duration="{duration}"] +##teamcity[testStarted name='Equals string matcher'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), Equals("this string contains |'ABC|' as a substring") )|nwith expansion:|n "this string contains |'abc|' as a substring" equals: "this string contains |'ABC|' as a substring"|n'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), Equals("something else", Catch::CaseSensitive::No) )|nwith expansion:|n "this string contains |'abc|' as a substring" equals: "something else" (case insensitive)|n'] +##teamcity[testFinished name='Equals string matcher' duration="{duration}"] +##teamcity[testStarted name='Exception as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified'] +##teamcity[testFinished name='Exception as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified' duration="{duration}"] +##teamcity[testStarted name='Exception matchers that fail'] +Matchers.tests.cpp:<line number>|nno exception was thrown where one was expected|n CHECK_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{1} )|nwith expansion:|n doesNotThrow(), SpecialException, ExceptionMatcher{1}|n'] +Matchers.tests.cpp:<line number>|nno exception was thrown where one was expected|n REQUIRE_THROWS_MATCHES( doesNotThrow(), SpecialException, ExceptionMatcher{1} )|nwith expansion:|n doesNotThrow(), SpecialException, ExceptionMatcher{1}|n'] +Matchers.tests.cpp:<line number>|nunexpected exception with message:|n "Unknown exception"|n CHECK_THROWS_MATCHES( throwsAsInt(1), SpecialException, ExceptionMatcher{1} )|nwith expansion:|n throwsAsInt(1), SpecialException, ExceptionMatcher{1}|n'] +Matchers.tests.cpp:<line number>|nunexpected exception with message:|n "Unknown exception"|n REQUIRE_THROWS_MATCHES( throwsAsInt(1), SpecialException, ExceptionMatcher{1} )|nwith expansion:|n throwsAsInt(1), SpecialException, ExceptionMatcher{1}|n'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THROWS_MATCHES( throwsSpecialException(3), SpecialException, ExceptionMatcher{1} )|nwith expansion:|n SpecialException::what special exception has value of 1|n'] +Matchers.tests.cpp:<line number>|nexpression failed|n REQUIRE_THROWS_MATCHES( throwsSpecialException(4), SpecialException, ExceptionMatcher{1} )|nwith expansion:|n SpecialException::what special exception has value of 1|n'] +##teamcity[testFinished name='Exception matchers that fail' duration="{duration}"] +##teamcity[testStarted name='Exception matchers that succeed'] +##teamcity[testFinished name='Exception matchers that succeed' duration="{duration}"] +##teamcity[testStarted name='Exception messages can be tested for'] +##teamcity[testFinished name='Exception messages can be tested for' duration="{duration}"] +##teamcity[testStarted name='Exceptions matchers'] +##teamcity[testFinished name='Exceptions matchers' duration="{duration}"] +##teamcity[testStarted name='Expected exceptions that don|'t throw or unexpected exceptions fail the test'] +Exception.tests.cpp:<line number>|nunexpected exception with message:|n "expected exception"|n CHECK_THROWS_AS( thisThrows(), std::string )|nwith expansion:|n thisThrows(), std::string|n'] +Exception.tests.cpp:<line number>|nno exception was thrown where one was expected|n CHECK_THROWS_AS( thisDoesntThrow(), std::domain_error )|nwith expansion:|n thisDoesntThrow(), std::domain_error|n'] +Exception.tests.cpp:<line number>|nunexpected exception with message:|n "expected exception"|n CHECK_NOTHROW( thisThrows() )|nwith expansion:|n thisThrows()|n'] +##teamcity[testFinished name='Expected exceptions that don|'t throw or unexpected exceptions fail the test' duration="{duration}"] +##teamcity[testStarted name='FAIL aborts the test'] +Message.tests.cpp:<line number>|nexplicit failure with message:|n "This is a failure"'] +##teamcity[testFinished name='FAIL aborts the test' duration="{duration}"] +##teamcity[testStarted name='FAIL does not require an argument'] +Message.tests.cpp:<line number>|nexplicit failure'] +##teamcity[testFinished name='FAIL does not require an argument' duration="{duration}"] +##teamcity[testStarted name='FAIL_CHECK does not abort the test'] +Message.tests.cpp:<line number>|nexplicit failure with message:|n "This is a failure"'] +##teamcity[testFinished name='FAIL_CHECK does not abort the test' duration="{duration}"] +##teamcity[testStarted name='Factorials are computed'] +##teamcity[testFinished name='Factorials are computed' duration="{duration}"] +##teamcity[testStarted name='Floating point matchers: double'] +##teamcity[testFinished name='Floating point matchers: double' duration="{duration}"] +##teamcity[testStarted name='Floating point matchers: float'] +##teamcity[testFinished name='Floating point matchers: float' duration="{duration}"] +##teamcity[testStarted name='Generators -- adapters'] +##teamcity[testFinished name='Generators -- adapters' duration="{duration}"] +##teamcity[testStarted name='Generators -- simple'] +##teamcity[testFinished name='Generators -- simple' duration="{duration}"] +##teamcity[testStarted name='Generators internals'] +##teamcity[testFinished name='Generators internals' duration="{duration}"] +##teamcity[testStarted name='Greater-than inequalities with different epsilons'] +##teamcity[testFinished name='Greater-than inequalities with different epsilons' duration="{duration}"] +##teamcity[testStarted name='INFO and WARN do not abort tests'] +##teamcity[testFinished name='INFO and WARN do not abort tests' duration="{duration}"] +##teamcity[testStarted name='INFO gets logged on failure'] +Message.tests.cpp:<line number>|nexpression failed with messages:|n "this message should be logged"|n "so should this"|n REQUIRE( a == 1 )|nwith expansion:|n 2 == 1|n'] +##teamcity[testFinished name='INFO gets logged on failure' duration="{duration}"] +##teamcity[testStarted name='INFO gets logged on failure, even if captured before successful assertions'] +Message.tests.cpp:<line number>|nexpression failed with messages:|n "this message may be logged later"|n "this message should be logged"|n CHECK( a == 1 )|nwith expansion:|n 2 == 1|n'] +Message.tests.cpp:<line number>|nexpression failed with messages:|n "this message may be logged later"|n "this message should be logged"|n "and this, but later"|n CHECK( a == 0 )|nwith expansion:|n 2 == 0|n'] +##teamcity[testFinished name='INFO gets logged on failure, even if captured before successful assertions' duration="{duration}"] +##teamcity[testStarted name='INFO is reset for each loop'] +Message.tests.cpp:<line number>|nexpression failed with messages:|n "current counter 10"|n "i := 10"|n REQUIRE( i < 10 )|nwith expansion:|n 10 < 10|n'] +##teamcity[testFinished name='INFO is reset for each loop' duration="{duration}"] +##teamcity[testStarted name='Inequality checks that should fail'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven != 7 )|nwith expansion:|n 7 != 7|n- failure ignore as test marked as |'ok to fail|'|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one != Approx( 9.1f ) )|nwith expansion:|n 9.1f != Approx( 9.1000003815 )|n- failure ignore as test marked as |'ok to fail|'|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.double_pi != Approx( 3.1415926535 ) )|nwith expansion:|n 3.1415926535 != Approx( 3.1415926535 )|n- failure ignore as test marked as |'ok to fail|'|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello != "hello" )|nwith expansion:|n "hello" != "hello"|n- failure ignore as test marked as |'ok to fail|'|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello.size() != 5 )|nwith expansion:|n 5 != 5|n- failure ignore as test marked as |'ok to fail|'|n'] +##teamcity[testFinished name='Inequality checks that should fail' duration="{duration}"] +##teamcity[testStarted name='Inequality checks that should succeed'] +##teamcity[testFinished name='Inequality checks that should succeed' duration="{duration}"] +##teamcity[testStarted name='Lambdas in assertions'] +##teamcity[testFinished name='Lambdas in assertions' duration="{duration}"] +##teamcity[testStarted name='Less-than inequalities with different epsilons'] +##teamcity[testFinished name='Less-than inequalities with different epsilons' duration="{duration}"] +##teamcity[testStarted name='ManuallyRegistered'] +##teamcity[testFinished name='ManuallyRegistered' duration="{duration}"] +##teamcity[testStarted name='Matchers can be (AllOf) composed with the && operator'] +##teamcity[testFinished name='Matchers can be (AllOf) composed with the && operator' duration="{duration}"] +##teamcity[testStarted name='Matchers can be (AnyOf) composed with the |||| operator'] +##teamcity[testFinished name='Matchers can be (AnyOf) composed with the |||| operator' duration="{duration}"] +##teamcity[testStarted name='Matchers can be composed with both && and ||||'] +##teamcity[testFinished name='Matchers can be composed with both && and ||||' duration="{duration}"] +##teamcity[testStarted name='Matchers can be composed with both && and |||| - failing'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), (Contains("string") |||| Contains("different")) && Contains("random") )|nwith expansion:|n "this string contains |'abc|' as a substring" ( ( contains: "string" or contains: "different" ) and contains: "random" )|n'] +##teamcity[testFinished name='Matchers can be composed with both && and |||| - failing' duration="{duration}"] +##teamcity[testStarted name='Matchers can be negated (Not) with the ! operator'] +##teamcity[testFinished name='Matchers can be negated (Not) with the ! operator' duration="{duration}"] +##teamcity[testStarted name='Matchers can be negated (Not) with the ! operator - failing'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), !Contains("substring") )|nwith expansion:|n "this string contains |'abc|' as a substring" not contains: "substring"|n'] +##teamcity[testFinished name='Matchers can be negated (Not) with the ! operator - failing' duration="{duration}"] +##teamcity[testStarted name='Mismatching exception messages failing the test'] +Exception.tests.cpp:<line number>|nexpression failed|n REQUIRE_THROWS_WITH( thisThrows(), "should fail" )|nwith expansion:|n "expected exception" equals: "should fail"|n'] +##teamcity[testFinished name='Mismatching exception messages failing the test' duration="{duration}"] +##teamcity[testStarted name='Nested generators and captured variables'] +##teamcity[testFinished name='Nested generators and captured variables' duration="{duration}"] +##teamcity[testStarted name='Nice descriptive name'] +##teamcity[testFinished name='Nice descriptive name' duration="{duration}"] +##teamcity[testStarted name='Non-std exceptions can be translated'] +Exception.tests.cpp:<line number>|nunexpected exception with message:|n "custom exception"'] +##teamcity[testFinished name='Non-std exceptions can be translated' duration="{duration}"] +##teamcity[testStarted name='Objects that evaluated in boolean contexts can be checked'] +##teamcity[testFinished name='Objects that evaluated in boolean contexts can be checked' duration="{duration}"] +##teamcity[testStarted name='Optionally static assertions'] +##teamcity[testFinished name='Optionally static assertions' duration="{duration}"] +##teamcity[testStarted name='Ordering comparison checks that should fail'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven > 7 )|nwith expansion:|n 7 > 7|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven < 7 )|nwith expansion:|n 7 < 7|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven > 8 )|nwith expansion:|n 7 > 8|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven < 6 )|nwith expansion:|n 7 < 6|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven < 0 )|nwith expansion:|n 7 < 0|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven < -1 )|nwith expansion:|n 7 < -1|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven >= 8 )|nwith expansion:|n 7 >= 8|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.int_seven <= 6 )|nwith expansion:|n 7 <= 6|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one < 9 )|nwith expansion:|n 9.1f < 9|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one > 10 )|nwith expansion:|n 9.1f > 10|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.float_nine_point_one > 9.2 )|nwith expansion:|n 9.1f > 9.2|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello > "hello" )|nwith expansion:|n "hello" > "hello"|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello < "hello" )|nwith expansion:|n "hello" < "hello"|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello > "hellp" )|nwith expansion:|n "hello" > "hellp"|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello > "z" )|nwith expansion:|n "hello" > "z"|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello < "hellm" )|nwith expansion:|n "hello" < "hellm"|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello < "a" )|nwith expansion:|n "hello" < "a"|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello >= "z" )|nwith expansion:|n "hello" >= "z"|n'] +Condition.tests.cpp:<line number>|nexpression failed|n CHECK( data.str_hello <= "a" )|nwith expansion:|n "hello" <= "a"|n'] +##teamcity[testFinished name='Ordering comparison checks that should fail' duration="{duration}"] +##teamcity[testStarted name='Ordering comparison checks that should succeed'] +##teamcity[testFinished name='Ordering comparison checks that should succeed' duration="{duration}"] +##teamcity[testStarted name='Our PCG implementation provides expected results for known seeds'] +##teamcity[testFinished name='Our PCG implementation provides expected results for known seeds' duration="{duration}"] +##teamcity[testStarted name='Output from all sections is reported'] +Message.tests.cpp:<line number>|nexplicit failure with message:|n "Message from section one"'] +Message.tests.cpp:<line number>|nexplicit failure with message:|n "Message from section two"'] +##teamcity[testFinished name='Output from all sections is reported' duration="{duration}"] +##teamcity[testStarted name='Overloaded comma or address-of operators are not used'] +##teamcity[testFinished name='Overloaded comma or address-of operators are not used' duration="{duration}"] +##teamcity[testStarted name='Parse test names and tags'] +##teamcity[testFinished name='Parse test names and tags' duration="{duration}"] +##teamcity[testStarted name='Pointers can be compared to null'] +##teamcity[testFinished name='Pointers can be compared to null' duration="{duration}"] +##teamcity[testStarted name='Precision of floating point stringification can be set'] +##teamcity[testFinished name='Precision of floating point stringification can be set' duration="{duration}"] +##teamcity[testStarted name='Predicate matcher can accept const char*'] +##teamcity[testFinished name='Predicate matcher can accept const char*' duration="{duration}"] +##teamcity[testStarted name='Process can be configured on command line'] +##teamcity[testFinished name='Process can be configured on command line' duration="{duration}"] +##teamcity[testStarted name='Product with differing arities - std::tuple<int, double, float>'] +##teamcity[testFinished name='Product with differing arities - std::tuple<int, double, float>' duration="{duration}"] +##teamcity[testStarted name='Product with differing arities - std::tuple<int, double>'] +##teamcity[testFinished name='Product with differing arities - std::tuple<int, double>' duration="{duration}"] +##teamcity[testStarted name='Product with differing arities - std::tuple<int>'] +##teamcity[testFinished name='Product with differing arities - std::tuple<int>' duration="{duration}"] +##teamcity[testStarted name='Range type with sentinel'] +##teamcity[testFinished name='Range type with sentinel' duration="{duration}"] +##teamcity[testStarted name='Reconstruction should be based on stringification: #914'] +Decomposition.tests.cpp:<line number>|nexpression failed|n CHECK( truthy(false) )|nwith expansion:|n Hey, its truthy!|n'] +##teamcity[testFinished name='Reconstruction should be based on stringification: #914' duration="{duration}"] +##teamcity[testStarted name='Regex string matcher'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), Matches("this STRING contains |'abc|' as a substring") )|nwith expansion:|n "this string contains |'abc|' as a substring" matches "this STRING contains |'abc|' as a substring" case sensitively|n'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), Matches("contains |'abc|' as a substring") )|nwith expansion:|n "this string contains |'abc|' as a substring" matches "contains |'abc|' as a substring" case sensitively|n'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), Matches("this string contains |'abc|' as a") )|nwith expansion:|n "this string contains |'abc|' as a substring" matches "this string contains |'abc|' as a" case sensitively|n'] +##teamcity[testFinished name='Regex string matcher' duration="{duration}"] +##teamcity[testStarted name='Regression test #1'] +##teamcity[testFinished name='Regression test #1' duration="{duration}"] +##teamcity[testStarted name='Reporter|'s write listings to provided stream'] +##teamcity[testFinished name='Reporter|'s write listings to provided stream' duration="{duration}"] +##teamcity[testStarted name='SUCCEED counts as a test pass'] +##teamcity[testFinished name='SUCCEED counts as a test pass' duration="{duration}"] +##teamcity[testStarted name='SUCCEED does not require an argument'] +##teamcity[testFinished name='SUCCEED does not require an argument' duration="{duration}"] +##teamcity[testStarted name='Scenario: BDD tests requiring Fixtures to provide commonly-accessed data or methods'] +##teamcity[testFinished name='Scenario: BDD tests requiring Fixtures to provide commonly-accessed data or methods' duration="{duration}"] +##teamcity[testStarted name='Scenario: Do that thing with the thing'] +##teamcity[testFinished name='Scenario: Do that thing with the thing' duration="{duration}"] +##teamcity[testStarted name='Scenario: This is a really long scenario name to see how the list command deals with wrapping'] +##teamcity[testFinished name='Scenario: This is a really long scenario name to see how the list command deals with wrapping' duration="{duration}"] +##teamcity[testStarted name='Scenario: Vector resizing affects size and capacity'] +##teamcity[testFinished name='Scenario: Vector resizing affects size and capacity' duration="{duration}"] +##teamcity[testStarted name='Sends stuff to stdout and stderr'] +##teamcity[testStdOut name='Sends stuff to stdout and stderr' out='A string sent directly to stdout|n'] +##teamcity[testStdErr name='Sends stuff to stdout and stderr' out='A string sent directly to stderr|nA string sent to stderr via clog|n'] +##teamcity[testFinished name='Sends stuff to stdout and stderr' duration="{duration}"] +##teamcity[testStarted name='Some simple comparisons between doubles'] +##teamcity[testFinished name='Some simple comparisons between doubles' duration="{duration}"] +##teamcity[testStarted name='Standard output from all sections is reported'] +##teamcity[testStdOut name='Standard output from all sections is reported' out='Message from section one|nMessage from section two|n'] +##teamcity[testFinished name='Standard output from all sections is reported' duration="{duration}"] +##teamcity[testStarted name='StartsWith string matcher'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), StartsWith("This String") )|nwith expansion:|n "this string contains |'abc|' as a substring" starts with: "This String"|n'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), StartsWith("string", Catch::CaseSensitive::No) )|nwith expansion:|n "this string contains |'abc|' as a substring" starts with: "string" (case insensitive)|n'] +##teamcity[testFinished name='StartsWith string matcher' duration="{duration}"] +##teamcity[testStarted name='Static arrays are convertible to string'] +##teamcity[testFinished name='Static arrays are convertible to string' duration="{duration}"] +##teamcity[testStarted name='String matchers'] +##teamcity[testFinished name='String matchers' duration="{duration}"] +##teamcity[testStarted name='StringRef'] +##teamcity[testFinished name='StringRef' duration="{duration}"] +##teamcity[testStarted name='StringRef at compilation time'] +##teamcity[testFinished name='StringRef at compilation time' duration="{duration}"] +##teamcity[testStarted name='Stringifying std::chrono::duration helpers'] +##teamcity[testFinished name='Stringifying std::chrono::duration helpers' duration="{duration}"] +##teamcity[testStarted name='Stringifying std::chrono::duration with weird ratios'] +##teamcity[testFinished name='Stringifying std::chrono::duration with weird ratios' duration="{duration}"] +##teamcity[testStarted name='Stringifying std::chrono::time_point<system_clock>'] +##teamcity[testFinished name='Stringifying std::chrono::time_point<system_clock>' duration="{duration}"] +##teamcity[testStarted name='Tabs and newlines show in output'] +Misc.tests.cpp:<line number>|nexpression failed|n CHECK( s1 == s2 )|nwith expansion:|n "if ($b == 10) {|n $a = 20;|n}"|n==|n"if ($b == 10) {|n $a = 20;|n}|n"|n'] +##teamcity[testFinished name='Tabs and newlines show in output' duration="{duration}"] +##teamcity[testStarted name='Tag alias can be registered against tag patterns'] +##teamcity[testFinished name='Tag alias can be registered against tag patterns' duration="{duration}"] +##teamcity[testStarted name='Template test case method with test types specified inside std::tuple - MyTypes - 0'] +##teamcity[testFinished name='Template test case method with test types specified inside std::tuple - MyTypes - 0' duration="{duration}"] +##teamcity[testStarted name='Template test case method with test types specified inside std::tuple - MyTypes - 1'] +##teamcity[testFinished name='Template test case method with test types specified inside std::tuple - MyTypes - 1' duration="{duration}"] +##teamcity[testStarted name='Template test case method with test types specified inside std::tuple - MyTypes - 2'] +##teamcity[testFinished name='Template test case method with test types specified inside std::tuple - MyTypes - 2' duration="{duration}"] +##teamcity[testStarted name='Template test case with test types specified inside non-copyable and non-movable std::tuple - NonCopyableAndNonMovableTypes - 0'] +##teamcity[testFinished name='Template test case with test types specified inside non-copyable and non-movable std::tuple - NonCopyableAndNonMovableTypes - 0' duration="{duration}"] +##teamcity[testStarted name='Template test case with test types specified inside non-copyable and non-movable std::tuple - NonCopyableAndNonMovableTypes - 1'] +##teamcity[testFinished name='Template test case with test types specified inside non-copyable and non-movable std::tuple - NonCopyableAndNonMovableTypes - 1' duration="{duration}"] +##teamcity[testStarted name='Template test case with test types specified inside non-default-constructible std::tuple - MyNonDefaultConstructibleTypes - 0'] +##teamcity[testFinished name='Template test case with test types specified inside non-default-constructible std::tuple - MyNonDefaultConstructibleTypes - 0' duration="{duration}"] +##teamcity[testStarted name='Template test case with test types specified inside non-default-constructible std::tuple - MyNonDefaultConstructibleTypes - 1'] +##teamcity[testFinished name='Template test case with test types specified inside non-default-constructible std::tuple - MyNonDefaultConstructibleTypes - 1' duration="{duration}"] +##teamcity[testStarted name='Template test case with test types specified inside std::tuple - MyTypes - 0'] +##teamcity[testFinished name='Template test case with test types specified inside std::tuple - MyTypes - 0' duration="{duration}"] +##teamcity[testStarted name='Template test case with test types specified inside std::tuple - MyTypes - 1'] +##teamcity[testFinished name='Template test case with test types specified inside std::tuple - MyTypes - 1' duration="{duration}"] +##teamcity[testStarted name='Template test case with test types specified inside std::tuple - MyTypes - 2'] +##teamcity[testFinished name='Template test case with test types specified inside std::tuple - MyTypes - 2' duration="{duration}"] +##teamcity[testStarted name='TemplateTest: vectors can be sized and resized - float'] +##teamcity[testFinished name='TemplateTest: vectors can be sized and resized - float' duration="{duration}"] +##teamcity[testStarted name='TemplateTest: vectors can be sized and resized - int'] +##teamcity[testFinished name='TemplateTest: vectors can be sized and resized - int' duration="{duration}"] +##teamcity[testStarted name='TemplateTest: vectors can be sized and resized - std::string'] +##teamcity[testFinished name='TemplateTest: vectors can be sized and resized - std::string' duration="{duration}"] +##teamcity[testStarted name='TemplateTest: vectors can be sized and resized - std::tuple<int,float>'] +##teamcity[testFinished name='TemplateTest: vectors can be sized and resized - std::tuple<int,float>' duration="{duration}"] +##teamcity[testStarted name='TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6'] +##teamcity[testFinished name='TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6' duration="{duration}"] +##teamcity[testStarted name='TemplateTestSig: vectors can be sized and resized - float,4'] +##teamcity[testFinished name='TemplateTestSig: vectors can be sized and resized - float,4' duration="{duration}"] +##teamcity[testStarted name='TemplateTestSig: vectors can be sized and resized - int,5'] +##teamcity[testFinished name='TemplateTestSig: vectors can be sized and resized - int,5' duration="{duration}"] +##teamcity[testStarted name='TemplateTestSig: vectors can be sized and resized - std::string,15'] +##teamcity[testFinished name='TemplateTestSig: vectors can be sized and resized - std::string,15' duration="{duration}"] +##teamcity[testStarted name='Test case with one argument'] +##teamcity[testFinished name='Test case with one argument' duration="{duration}"] +##teamcity[testStarted name='Test enum bit values'] +##teamcity[testFinished name='Test enum bit values' duration="{duration}"] +##teamcity[testStarted name='Test with special, characters "in name'] +##teamcity[testFinished name='Test with special, characters "in name' duration="{duration}"] +##teamcity[testStarted name='The NO_FAIL macro reports a failure but does not fail the test'] +##teamcity[testFinished name='The NO_FAIL macro reports a failure but does not fail the test' duration="{duration}"] +##teamcity[testStarted name='The default listing implementation write to provided stream'] +##teamcity[testFinished name='The default listing implementation write to provided stream' duration="{duration}"] +##teamcity[testStarted name='This test |'should|' fail but doesn|'t'] +##teamcity[testFinished name='This test |'should|' fail but doesn|'t' duration="{duration}"] +##teamcity[testStarted name='Thrown string literals are translated'] +Exception.tests.cpp:<line number>|nunexpected exception with message:|n "For some reason someone is throwing a string literal!"'] +##teamcity[testFinished name='Thrown string literals are translated' duration="{duration}"] +##teamcity[testStarted name='Tracker'] +##teamcity[testFinished name='Tracker' duration="{duration}"] +##teamcity[testStarted name='Trim strings'] +##teamcity[testFinished name='Trim strings' duration="{duration}"] +##teamcity[testStarted name='Unexpected exceptions can be translated'] +Exception.tests.cpp:<line number>|nunexpected exception with message:|n "3.14"'] +##teamcity[testFinished name='Unexpected exceptions can be translated' duration="{duration}"] +##teamcity[testStarted name='Upcasting special member functions'] +##teamcity[testFinished name='Upcasting special member functions' duration="{duration}"] +##teamcity[testStarted name='Usage of AllMatch range matcher'] +##teamcity[testFinished name='Usage of AllMatch range matcher' duration="{duration}"] +##teamcity[testStarted name='Usage of AnyMatch range matcher'] +##teamcity[testFinished name='Usage of AnyMatch range matcher' duration="{duration}"] +##teamcity[testStarted name='Usage of NoneMatch range matcher'] +##teamcity[testFinished name='Usage of NoneMatch range matcher' duration="{duration}"] +##teamcity[testStarted name='Usage of the SizeIs range matcher'] +##teamcity[testFinished name='Usage of the SizeIs range matcher' duration="{duration}"] +##teamcity[testStarted name='Use a custom approx'] +##teamcity[testFinished name='Use a custom approx' duration="{duration}"] +##teamcity[testStarted name='Variadic macros'] +##teamcity[testFinished name='Variadic macros' duration="{duration}"] +##teamcity[testStarted name='Vector Approx matcher'] +##teamcity[testFinished name='Vector Approx matcher' duration="{duration}"] +##teamcity[testStarted name='Vector Approx matcher -- failing'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( empty, Approx(t1) )|nwith expansion:|n { } is approx: { 1.0, 2.0 }|n'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v1, Approx(v2) )|nwith expansion:|n { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 }|n'] +##teamcity[testFinished name='Vector Approx matcher -- failing' duration="{duration}"] +##teamcity[testStarted name='Vector matchers'] +##teamcity[testFinished name='Vector matchers' duration="{duration}"] +##teamcity[testStarted name='Vector matchers that fail'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v, VectorContains(-1) )|nwith expansion:|n { 1, 2, 3 } Contains: -1|n'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( empty, VectorContains(1) )|nwith expansion:|n { } Contains: 1|n'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( empty, Contains(v) )|nwith expansion:|n { } Contains: { 1, 2, 3 }|n'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v, Contains(v2) )|nwith expansion:|n { 1, 2, 3 } Contains: { 1, 2, 4 }|n'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v, Equals(v2) )|nwith expansion:|n { 1, 2, 3 } Equals: { 1, 2 }|n'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v2, Equals(v) )|nwith expansion:|n { 1, 2 } Equals: { 1, 2, 3 }|n'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( empty, Equals(v) )|nwith expansion:|n { } Equals: { 1, 2, 3 }|n'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v, Equals(empty) )|nwith expansion:|n { 1, 2, 3 } Equals: { }|n'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( v, UnorderedEquals(empty) )|nwith expansion:|n { 1, 2, 3 } UnorderedEquals: { }|n'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( empty, UnorderedEquals(v) )|nwith expansion:|n { } UnorderedEquals: { 1, 2, 3 }|n'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( permuted, UnorderedEquals(v) )|nwith expansion:|n { 1, 3 } UnorderedEquals: { 1, 2, 3 }|n'] +Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( permuted, UnorderedEquals(v) )|nwith expansion:|n { 3, 1 } UnorderedEquals: { 1, 2, 3 }|n'] +##teamcity[testFinished name='Vector matchers that fail' duration="{duration}"] +##teamcity[testStarted name='When checked exceptions are thrown they can be expected or unexpected'] +##teamcity[testFinished name='When checked exceptions are thrown they can be expected or unexpected' duration="{duration}"] +##teamcity[testStarted name='When unchecked exceptions are thrown directly they are always failures'] +Exception.tests.cpp:<line number>|nunexpected exception with message:|n "unexpected exception"'] +##teamcity[testFinished name='When unchecked exceptions are thrown directly they are always failures' duration="{duration}"] +##teamcity[testStarted name='When unchecked exceptions are thrown during a CHECK the test should continue'] +Exception.tests.cpp:<line number>|nunexpected exception with message:|n "expected exception"|n CHECK( thisThrows() == 0 )|nwith expansion:|n thisThrows() == 0|n'] +##teamcity[testFinished name='When unchecked exceptions are thrown during a CHECK the test should continue' duration="{duration}"] +##teamcity[testStarted name='When unchecked exceptions are thrown during a REQUIRE the test should abort fail'] +Exception.tests.cpp:<line number>|nunexpected exception with message:|n "expected exception"|n REQUIRE( thisThrows() == 0 )|nwith expansion:|n thisThrows() == 0|n'] +##teamcity[testFinished name='When unchecked exceptions are thrown during a REQUIRE the test should abort fail' duration="{duration}"] +##teamcity[testStarted name='When unchecked exceptions are thrown from functions they are always failures'] +Exception.tests.cpp:<line number>|nunexpected exception with message:|n "expected exception"|n CHECK( thisThrows() == 0 )|nwith expansion:|n thisThrows() == 0|n'] +##teamcity[testFinished name='When unchecked exceptions are thrown from functions they are always failures' duration="{duration}"] +##teamcity[testStarted name='When unchecked exceptions are thrown from sections they are always failures'] +Exception.tests.cpp:<line number>|nunexpected exception with message:|n "unexpected exception"'] +##teamcity[testFinished name='When unchecked exceptions are thrown from sections they are always failures' duration="{duration}"] +##teamcity[testStarted name='When unchecked exceptions are thrown, but caught, they do not affect the test'] +##teamcity[testFinished name='When unchecked exceptions are thrown, but caught, they do not affect the test' duration="{duration}"] +##teamcity[testStarted name='Where the LHS is not a simple value'] +##teamcity[testFinished name='Where the LHS is not a simple value' duration="{duration}"] +##teamcity[testStarted name='Where there is more to the expression after the RHS'] +##teamcity[testFinished name='Where there is more to the expression after the RHS' duration="{duration}"] +##teamcity[testStarted name='X/level/0/a'] +##teamcity[testFinished name='X/level/0/a' duration="{duration}"] +##teamcity[testStarted name='X/level/0/b'] +##teamcity[testFinished name='X/level/0/b' duration="{duration}"] +##teamcity[testStarted name='X/level/1/a'] +##teamcity[testFinished name='X/level/1/a' duration="{duration}"] +##teamcity[testStarted name='X/level/1/b'] +##teamcity[testFinished name='X/level/1/b' duration="{duration}"] +##teamcity[testStarted name='XmlEncode'] +##teamcity[testFinished name='XmlEncode' duration="{duration}"] +##teamcity[testStarted name='analyse no analysis'] +##teamcity[testFinished name='analyse no analysis' duration="{duration}"] +##teamcity[testStarted name='array<int, N> -> toString'] +##teamcity[testFinished name='array<int, N> -> toString' duration="{duration}"] +##teamcity[testStarted name='atomic if'] +##teamcity[testFinished name='atomic if' duration="{duration}"] +##teamcity[testStarted name='benchmark function call'] +##teamcity[testFinished name='benchmark function call' duration="{duration}"] +##teamcity[testStarted name='boolean member'] +##teamcity[testFinished name='boolean member' duration="{duration}"] +##teamcity[testStarted name='checkedElse'] +##teamcity[testFinished name='checkedElse' duration="{duration}"] +##teamcity[testStarted name='checkedElse, failing'] +Misc.tests.cpp:<line number>|nexpression failed|n CHECKED_ELSE( flag )|nwith expansion:|n false|n'] +Misc.tests.cpp:<line number>|nexpression failed|n REQUIRE( testCheckedElse( false ) )|nwith expansion:|n false|n'] +##teamcity[testFinished name='checkedElse, failing' duration="{duration}"] +##teamcity[testStarted name='checkedIf'] +##teamcity[testFinished name='checkedIf' duration="{duration}"] +##teamcity[testStarted name='checkedIf, failing'] +Misc.tests.cpp:<line number>|nexpression failed|n CHECKED_IF( flag )|nwith expansion:|n false|n'] +Misc.tests.cpp:<line number>|nexpression failed|n REQUIRE( testCheckedIf( false ) )|nwith expansion:|n false|n'] +##teamcity[testFinished name='checkedIf, failing' duration="{duration}"] +##teamcity[testStarted name='classify_outliers'] +##teamcity[testFinished name='classify_outliers' duration="{duration}"] +##teamcity[testStarted name='comparisons between const int variables'] +##teamcity[testFinished name='comparisons between const int variables' duration="{duration}"] +##teamcity[testStarted name='comparisons between int variables'] +##teamcity[testFinished name='comparisons between int variables' duration="{duration}"] +##teamcity[testStarted name='erfc_inv'] +##teamcity[testFinished name='erfc_inv' duration="{duration}"] +##teamcity[testStarted name='estimate_clock_resolution'] +##teamcity[testFinished name='estimate_clock_resolution' duration="{duration}"] +##teamcity[testStarted name='even more nested SECTION tests'] +##teamcity[testFinished name='even more nested SECTION tests' duration="{duration}"] +##teamcity[testStarted name='first tag'] +##teamcity[testFinished name='first tag' duration="{duration}"] +##teamcity[testStarted name='has printf'] +loose text artifact +##teamcity[testFinished name='has printf' duration="{duration}"] +##teamcity[testStarted name='just failure'] +Message.tests.cpp:<line number>|nexplicit failure with message:|n "Previous info should not be seen"'] +##teamcity[testFinished name='just failure' duration="{duration}"] +##teamcity[testStarted name='just failure after unscoped info'] +Message.tests.cpp:<line number>|nexplicit failure with message:|n "previous unscoped info SHOULD not be seen"'] +##teamcity[testFinished name='just failure after unscoped info' duration="{duration}"] +##teamcity[testStarted name='just info'] +##teamcity[testFinished name='just info' duration="{duration}"] +##teamcity[testStarted name='just unscoped info'] +##teamcity[testFinished name='just unscoped info' duration="{duration}"] +##teamcity[testStarted name='long long'] +##teamcity[testFinished name='long long' duration="{duration}"] +##teamcity[testStarted name='looped SECTION tests'] +Misc.tests.cpp:<line number>|nexpression failed|n CHECK( b > a )|nwith expansion:|n 0 > 1|n'] +Misc.tests.cpp:<line number>|nexpression failed|n CHECK( b > a )|nwith expansion:|n 1 > 1|n'] +##teamcity[testFinished name='looped SECTION tests' duration="{duration}"] +##teamcity[testStarted name='looped tests'] +Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[0|] (1) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] +Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[1|] (1) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] +Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[3|] (3) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] +Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[4|] (5) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] +Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[6|] (13) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] +Misc.tests.cpp:<line number>|nexpression failed with message:|n "Testing if fib|[7|] (21) is even"|n CHECK( ( fib|[i|] % 2 ) == 0 )|nwith expansion:|n 1 == 0|n'] +##teamcity[testFinished name='looped tests' duration="{duration}"] +##teamcity[testStarted name='make_unique reimplementation'] +##teamcity[testFinished name='make_unique reimplementation' duration="{duration}"] +##teamcity[testStarted name='mean'] +##teamcity[testFinished name='mean' duration="{duration}"] +##teamcity[testStarted name='measure'] +##teamcity[testFinished name='measure' duration="{duration}"] +##teamcity[testStarted name='mix info, unscoped info and warning'] +##teamcity[testFinished name='mix info, unscoped info and warning' duration="{duration}"] +##teamcity[testStarted name='more nested SECTION tests'] +Misc.tests.cpp:<line number>|nexpression failed|n REQUIRE( a == b )|nwith expansion:|n 1 == 2|n'] +##teamcity[testFinished name='more nested SECTION tests' duration="{duration}"] +##teamcity[testStarted name='nested SECTION tests'] +##teamcity[testFinished name='nested SECTION tests' duration="{duration}"] +##teamcity[testStarted name='non streamable - with conv. op'] +##teamcity[testFinished name='non streamable - with conv. op' duration="{duration}"] +##teamcity[testStarted name='non-copyable objects'] +##teamcity[testFinished name='non-copyable objects' duration="{duration}"] +##teamcity[testStarted name='normal_cdf'] +##teamcity[testFinished name='normal_cdf' duration="{duration}"] +##teamcity[testStarted name='normal_quantile'] +##teamcity[testFinished name='normal_quantile' duration="{duration}"] +##teamcity[testStarted name='not allowed'] +##teamcity[testFinished name='not allowed' duration="{duration}"] +##teamcity[testStarted name='not prints unscoped info from previous failures'] +Message.tests.cpp:<line number>|nexpression failed with message:|n "this SHOULD be seen"|n REQUIRE( false )|nwith expansion:|n false|n'] +##teamcity[testFinished name='not prints unscoped info from previous failures' duration="{duration}"] +##teamcity[testStarted name='null strings'] +##teamcity[testFinished name='null strings' duration="{duration}"] +##teamcity[testStarted name='null_ptr'] +##teamcity[testFinished name='null_ptr' duration="{duration}"] +##teamcity[testStarted name='pair<pair<int,const char *,pair<std::string,int> > -> toString'] +##teamcity[testFinished name='pair<pair<int,const char *,pair<std::string,int> > -> toString' duration="{duration}"] +##teamcity[testStarted name='parseEnums'] +##teamcity[testFinished name='parseEnums' duration="{duration}"] +##teamcity[testStarted name='pointer to class'] +##teamcity[testFinished name='pointer to class' duration="{duration}"] +##teamcity[testStarted name='print unscoped info if passing unscoped info is printed'] +##teamcity[testFinished name='print unscoped info if passing unscoped info is printed' duration="{duration}"] +##teamcity[testStarted name='prints unscoped info on failure'] +Message.tests.cpp:<line number>|nexpression failed with messages:|n "this SHOULD be seen"|n "this SHOULD also be seen"|n REQUIRE( false )|nwith expansion:|n false|n'] +##teamcity[testFinished name='prints unscoped info on failure' duration="{duration}"] +##teamcity[testStarted name='prints unscoped info only for the first assertion'] +Message.tests.cpp:<line number>|nexpression failed with message:|n "this SHOULD be seen only ONCE"|n CHECK( false )|nwith expansion:|n false|n'] +##teamcity[testFinished name='prints unscoped info only for the first assertion' duration="{duration}"] +##teamcity[testStarted name='random SECTION tests'] +##teamcity[testFinished name='random SECTION tests' duration="{duration}"] +##teamcity[testStarted name='replaceInPlace'] +##teamcity[testFinished name='replaceInPlace' duration="{duration}"] +##teamcity[testStarted name='resolution'] +##teamcity[testFinished name='resolution' duration="{duration}"] +##teamcity[testStarted name='run_for_at_least, chronometer'] +##teamcity[testFinished name='run_for_at_least, chronometer' duration="{duration}"] +##teamcity[testStarted name='run_for_at_least, int'] +##teamcity[testFinished name='run_for_at_least, int' duration="{duration}"] +##teamcity[testStarted name='second tag'] +##teamcity[testFinished name='second tag' duration="{duration}"] +##teamcity[testStarted name='send a single char to INFO'] +Misc.tests.cpp:<line number>|nexpression failed with message:|n "3"|n REQUIRE( false )|nwith expansion:|n false|n'] +##teamcity[testFinished name='send a single char to INFO' duration="{duration}"] +##teamcity[testStarted name='sends information to INFO'] +Message.tests.cpp:<line number>|nexpression failed with messages:|n "hi"|n "i := 7"|n REQUIRE( false )|nwith expansion:|n false|n'] +##teamcity[testFinished name='sends information to INFO' duration="{duration}"] +##teamcity[testStarted name='shortened hide tags are split apart'] +##teamcity[testFinished name='shortened hide tags are split apart' duration="{duration}"] +##teamcity[testStarted name='splitString'] +##teamcity[testFinished name='splitString' duration="{duration}"] +##teamcity[testStarted name='stacks unscoped info in loops'] +Message.tests.cpp:<line number>|nexpression failed with messages:|n "Count 1 to 3..."|n "1"|n "2"|n "3"|n CHECK( false )|nwith expansion:|n false|n'] +Message.tests.cpp:<line number>|nexpression failed with messages:|n "Count 4 to 6..."|n "4"|n "5"|n "6"|n CHECK( false )|nwith expansion:|n false|n'] +##teamcity[testFinished name='stacks unscoped info in loops' duration="{duration}"] +##teamcity[testStarted name='std::map is convertible string'] +##teamcity[testFinished name='std::map is convertible string' duration="{duration}"] +##teamcity[testStarted name='std::pair<int,const std::string> -> toString'] +##teamcity[testFinished name='std::pair<int,const std::string> -> toString' duration="{duration}"] +##teamcity[testStarted name='std::pair<int,std::string> -> toString'] +##teamcity[testFinished name='std::pair<int,std::string> -> toString' duration="{duration}"] +##teamcity[testStarted name='std::set is convertible string'] +##teamcity[testFinished name='std::set is convertible string' duration="{duration}"] +##teamcity[testStarted name='std::vector<std::pair<std::string,int> > -> toString'] +##teamcity[testFinished name='std::vector<std::pair<std::string,int> > -> toString' duration="{duration}"] +##teamcity[testStarted name='string literals of different sizes can be compared'] +Tricky.tests.cpp:<line number>|nexpression failed|n REQUIRE( std::string( "first" ) == "second" )|nwith expansion:|n "first" == "second"|n'] +##teamcity[testFinished name='string literals of different sizes can be compared' duration="{duration}"] +##teamcity[testStarted name='stringify ranges'] +##teamcity[testFinished name='stringify ranges' duration="{duration}"] +##teamcity[testStarted name='stringify( has_maker )'] +##teamcity[testFinished name='stringify( has_maker )' duration="{duration}"] +##teamcity[testStarted name='stringify( has_maker_and_operator )'] +##teamcity[testFinished name='stringify( has_maker_and_operator )' duration="{duration}"] +##teamcity[testStarted name='stringify( has_neither )'] +##teamcity[testFinished name='stringify( has_neither )' duration="{duration}"] +##teamcity[testStarted name='stringify( has_operator )'] +##teamcity[testFinished name='stringify( has_operator )' duration="{duration}"] +##teamcity[testStarted name='stringify( has_template_operator )'] +##teamcity[testFinished name='stringify( has_template_operator )' duration="{duration}"] +##teamcity[testStarted name='stringify( vectors<has_maker> )'] +##teamcity[testFinished name='stringify( vectors<has_maker> )' duration="{duration}"] +##teamcity[testStarted name='stringify( vectors<has_maker_and_operator> )'] +##teamcity[testFinished name='stringify( vectors<has_maker_and_operator> )' duration="{duration}"] +##teamcity[testStarted name='stringify( vectors<has_operator> )'] +##teamcity[testFinished name='stringify( vectors<has_operator> )' duration="{duration}"] +##teamcity[testStarted name='strlen3'] +##teamcity[testFinished name='strlen3' duration="{duration}"] +##teamcity[testStarted name='tables'] +##teamcity[testFinished name='tables' duration="{duration}"] +##teamcity[testStarted name='thrown std::strings are translated'] +Exception.tests.cpp:<line number>|nunexpected exception with message:|n "Why would you throw a std::string?"'] +##teamcity[testFinished name='thrown std::strings are translated' duration="{duration}"] +##teamcity[testStarted name='toString on const wchar_t const pointer returns the string contents'] +##teamcity[testFinished name='toString on const wchar_t const pointer returns the string contents' duration="{duration}"] +##teamcity[testStarted name='toString on const wchar_t pointer returns the string contents'] +##teamcity[testFinished name='toString on const wchar_t pointer returns the string contents' duration="{duration}"] +##teamcity[testStarted name='toString on wchar_t const pointer returns the string contents'] +##teamcity[testFinished name='toString on wchar_t const pointer returns the string contents' duration="{duration}"] +##teamcity[testStarted name='toString on wchar_t returns the string contents'] +##teamcity[testFinished name='toString on wchar_t returns the string contents' duration="{duration}"] +##teamcity[testStarted name='toString(enum class w/operator<<)'] +##teamcity[testFinished name='toString(enum class w/operator<<)' duration="{duration}"] +##teamcity[testStarted name='toString(enum class)'] +##teamcity[testFinished name='toString(enum class)' duration="{duration}"] +##teamcity[testStarted name='toString(enum w/operator<<)'] +##teamcity[testFinished name='toString(enum w/operator<<)' duration="{duration}"] +##teamcity[testStarted name='toString(enum)'] +##teamcity[testFinished name='toString(enum)' duration="{duration}"] +##teamcity[testStarted name='tuple<>'] +##teamcity[testFinished name='tuple<>' duration="{duration}"] +##teamcity[testStarted name='tuple<float,int>'] +##teamcity[testFinished name='tuple<float,int>' duration="{duration}"] +##teamcity[testStarted name='tuple<int>'] +##teamcity[testFinished name='tuple<int>' duration="{duration}"] +##teamcity[testStarted name='tuple<0,int,const char *>'] +##teamcity[testFinished name='tuple<0,int,const char *>' duration="{duration}"] +##teamcity[testStarted name='tuple<string,string>'] +##teamcity[testFinished name='tuple<string,string>' duration="{duration}"] +##teamcity[testStarted name='tuple<tuple<int>,tuple<>,float>'] +##teamcity[testFinished name='tuple<tuple<int>,tuple<>,float>' duration="{duration}"] +##teamcity[testStarted name='uniform samples'] +##teamcity[testFinished name='uniform samples' duration="{duration}"] +##teamcity[testStarted name='unique_ptr reimplementation: basic functionality'] +##teamcity[testFinished name='unique_ptr reimplementation: basic functionality' duration="{duration}"] +##teamcity[testStarted name='vec<vec<string,alloc>> -> toString'] +##teamcity[testFinished name='vec<vec<string,alloc>> -> toString' duration="{duration}"] +##teamcity[testStarted name='vector<bool> -> toString'] +##teamcity[testFinished name='vector<bool> -> toString' duration="{duration}"] +##teamcity[testStarted name='vector<int,allocator> -> toString'] +##teamcity[testFinished name='vector<int,allocator> -> toString' duration="{duration}"] +##teamcity[testStarted name='vector<int> -> toString'] +##teamcity[testFinished name='vector<int> -> toString' duration="{duration}"] +##teamcity[testStarted name='vector<string> -> toString'] +##teamcity[testFinished name='vector<string> -> toString' duration="{duration}"] +##teamcity[testStarted name='vectors can be sized and resized'] +##teamcity[testFinished name='vectors can be sized and resized' duration="{duration}"] +##teamcity[testStarted name='warmup'] +##teamcity[testFinished name='warmup' duration="{duration}"] +##teamcity[testStarted name='weighted_average_quantile'] +##teamcity[testFinished name='weighted_average_quantile' duration="{duration}"] +##teamcity[testStarted name='xmlentitycheck'] +##teamcity[testFinished name='xmlentitycheck' duration="{duration}"] +##teamcity[testSuiteFinished name='<exe-name>'] diff --git a/packages/Catch2/tests/SelfTest/Baselines/xml.sw.approved.txt b/packages/Catch2/tests/SelfTest/Baselines/xml.sw.approved.txt new file mode 100644 index 0000000000000000000000000000000000000000..ceaa32bcb8df86d901dbe890b1f283e5ad962dcc --- /dev/null +++ b/packages/Catch2/tests/SelfTest/Baselines/xml.sw.approved.txt @@ -0,0 +1,19723 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Catch name="<exe-name>" filters="~[!nonportable]~[!benchmark]~[approvals] *"> + <Randomness seed="1"/> + <Group name="<exe-name>"> + <TestCase name="# A test name that starts with a #" filename="tests/<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="tests/<exe-name>/UsageTests/Decomposition.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Decomposition.tests.cpp" > + <Original> + fptr == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Decomposition.tests.cpp" > + <Original> + fptr == 0l + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="#1027: Bitfields can be captured" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Original> + y.v == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Original> + 0 == y.v + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="#1147" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Original> + t1 == t2 + </Original> + <Expanded> + {?} == {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Original> + t1 != t2 + </Original> + <Expanded> + {?} != {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Original> + t1 < t2 + </Original> + <Expanded> + {?} < {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Original> + t1 > t2 + </Original> + <Expanded> + {?} > {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Original> + t1 <= t2 + </Original> + <Expanded> + {?} <= {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Original> + t1 >= t2 + </Original> + <Expanded> + {?} >= {?} + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="#1175 - Hidden Test" tags="[.]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <OverallResult success="true"/> + </TestCase> + <TestCase name="#1238" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Info> + uarr := "123" + </Info> + <Info> + sarr := "456" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Original> + std::memcmp(uarr, "123", sizeof(uarr)) == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Info> + uarr := "123" + </Info> + <Info> + sarr := "456" + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Original> + std::memcmp(sarr, "456", sizeof(sarr)) == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="#1245" tags="[compilation]" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <OverallResult success="true"/> + </TestCase> + <TestCase name="#1319: Sections can have description (even if it is not saved" tags="[compilation]" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Section name="SectionName" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="#1403" tags="[compilation]" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Original> + h1 == h2 + </Original> + <Expanded> + [1403 helper] == [1403 helper] + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="#1455 - INFO and WARN can start with a linebreak" tags="[.][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Info> + +This info message starts with a linebreak + </Info> + <Warning> + +This warning message starts with a linebreak + </Warning> + <OverallResult success="false"/> + </TestCase> + <TestCase name="#1514: stderr/stdout is not captured in tests aborted by an exception" tags="[.][output-capture][regression]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Failure filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + 1514 + </Failure> + <OverallResult success="false"> + <StdOut> +This would not be caught previously + </StdOut> + <StdErr> +Nor would this + </StdErr> + </OverallResult> + </TestCase> + <TestCase name="#1548" tags="[compilation]" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Original> + std::is_same<TypeList<int>, TypeList<int>>::value + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="#1905 -- test spec parser properly clears internal state between compound tests" tags="[command-line][test-spec]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches(*fakeTestCase("spec . char")) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches(*fakeTestCase("spec , char")) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + !(spec.matches(*fakeTestCase(R"(spec \, char)"))) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="#1912 -- test spec parser handles escaping" tags="[command-line][test-spec]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="Various parentheses" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches(*fakeTestCase(R"(spec {a} char)")) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches(*fakeTestCase(R"(spec [a] char)")) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + !(spec.matches(*fakeTestCase("differs but has similar tag", "[a]"))) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="3" failures="0" expectedFailures="0"/> + </Section> + <Section name="backslash in test name" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches(*fakeTestCase(R"(spec \ char)")) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="#1913 - GENERATE inside a for loop should not keep recreating the generator" tags="[generators][regression]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + counter < 7 + </Original> + <Expanded> + 3 < 7 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + counter < 7 + </Original> + <Expanded> + 6 < 7 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="#1913 - GENERATEs can share a line" tags="[generators][regression]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + i != j + </Original> + <Expanded> + 1 != 3 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + i != j + </Original> + <Expanded> + 1 != 4 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + i != j + </Original> + <Expanded> + 2 != 3 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + i != j + </Original> + <Expanded> + 2 != 4 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="#1938 - GENERATE after a section" tags="[.][generators][regression]" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Section name="A" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="B" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + m + </Original> + <Expanded> + 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="B" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + m + </Original> + <Expanded> + 2 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="B" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + m + </Original> + <Expanded> + 3 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="#1938 - Section followed by flat generate" tags="[.][generators][regression]" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Section name="A" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + 1 + </Original> + <Expanded> + 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + m + </Original> + <Expanded> + 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + m + </Original> + <Expanded> + 3 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="#1938 - flat generate" tags="[.][generators][regression]" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + m + </Original> + <Expanded> + 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + m + </Original> + <Expanded> + 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + m + </Original> + <Expanded> + 3 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="#1938 - mixed sections and generates" tags="[.][generators][regression]" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Section name="A" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Info> + i := 1 + </Info> + <Info> + j := 3 + </Info> + <Info> + k := 5 + </Info> + <Section name="B" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Info> + i := 1 + </Info> + <Info> + j := 3 + </Info> + <Info> + k := 6 + </Info> + <Section name="B" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Info> + i := 1 + </Info> + <Info> + j := 4 + </Info> + <Info> + k := 5 + </Info> + <Info> + i := 1 + </Info> + <Info> + j := 4 + </Info> + <Info> + k := 6 + </Info> + <Section name="A" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Info> + i := 2 + </Info> + <Info> + j := 3 + </Info> + <Info> + k := 5 + </Info> + <Section name="B" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Info> + i := 2 + </Info> + <Info> + j := 3 + </Info> + <Info> + k := 6 + </Info> + <Section name="B" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Info> + i := 2 + </Info> + <Info> + j := 4 + </Info> + <Info> + k := 5 + </Info> + <Info> + i := 2 + </Info> + <Info> + j := 4 + </Info> + <Info> + k := 6 + </Info> + <OverallResult success="true"/> + </TestCase> + <TestCase name="#1938 - nested generate" tags="[.][generators][regression]" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + m + </Original> + <Expanded> + 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + n + </Original> + <Expanded> + 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + m + </Original> + <Expanded> + 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + n + </Original> + <Expanded> + 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + m + </Original> + <Expanded> + 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + n + </Original> + <Expanded> + 3 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + m + </Original> + <Expanded> + 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + n + </Original> + <Expanded> + 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + m + </Original> + <Expanded> + 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + n + </Original> + <Expanded> + 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + m + </Original> + <Expanded> + 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + n + </Original> + <Expanded> + 3 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + m + </Original> + <Expanded> + 3 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + n + </Original> + <Expanded> + 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + m + </Original> + <Expanded> + 3 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + n + </Original> + <Expanded> + 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + m + </Original> + <Expanded> + 3 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + n + </Original> + <Expanded> + 3 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="#1954 - 7 arg template test case sig compiles - 1, 1, 1, 1, 1, 0, 0" tags="[.][compilation][regression]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <OverallResult success="true"/> + </TestCase> + <TestCase name="#1954 - 7 arg template test case sig compiles - 5, 1, 1, 1, 1, 0, 0" tags="[.][compilation][regression]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <OverallResult success="true"/> + </TestCase> + <TestCase name="#1954 - 7 arg template test case sig compiles - 5, 3, 1, 1, 1, 0, 0" tags="[.][compilation][regression]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <OverallResult success="true"/> + </TestCase> + <TestCase name="#748 - captures with unexpected exceptions" tags="[!shouldfail][!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Section name="outside assertions" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Info> + answer := 42 + </Info> + <Exception filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + expected exception + </Exception> + <OverallResults successes="0" failures="0" expectedFailures="1"/> + </Section> + <Section name="inside REQUIRE_NOTHROW" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Info> + answer := 42 + </Info> + <Expression success="false" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Original> + thisThrows() + </Original> + <Expanded> + thisThrows() + </Expanded> + <Exception filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + expected exception + </Exception> + </Expression> + <OverallResults successes="0" failures="0" expectedFailures="1"/> + </Section> + <Section name="inside REQUIRE_THROWS" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Info> + answer := 42 + </Info> + <Expression success="true" type="REQUIRE_THROWS" filename="tests/<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="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Original> + 42 == f + </Original> + <Expanded> + 42 == {?} + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="#833" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Original> + a == t + </Original> + <Expanded> + 3 == 3 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Original> + a == t + </Original> + <Expanded> + 3 == 3 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THROWS" filename="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Original> + throws_int(false) + </Original> + <Expanded> + throws_int(false) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Original> + "aaa", Catch::Matchers::EndsWith("aaa") + </Original> + <Expanded> + "aaa" ends with: "aaa" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + f() == 0 + </Original> + <Expanded> + 1 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + errno == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="#872" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Info> + dummy := 0 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Section name="Looped section 0" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Looped section 1" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Looped section 2" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Looped section 3" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Looped section 4" filename="tests/<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="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + false != false + </Original> + <Expanded> + false != false + </Expanded> + </Expression> + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + true != true + </Original> + <Expanded> + true != true + </Expanded> + </Expression> + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + !true + </Original> + <Expanded> + false + </Expanded> + </Expression> + <Expression success="false" type="CHECK_FALSE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + !(true) + </Original> + <Expanded> + !true + </Expanded> + </Expression> + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + !trueValue + </Original> + <Expanded> + false + </Expanded> + </Expression> + <Expression success="false" type="CHECK_FALSE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + !(trueValue) + </Original> + <Expanded> + !true + </Expanded> + </Expression> + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + !(1 == 1) + </Original> + <Expanded> + false + </Expanded> + </Expression> + <Expression success="false" type="CHECK_FALSE" filename="tests/<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="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + false == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + true == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + !false + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + !(false) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + !falseValue + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + !(falseValue) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + !(1 == 2) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<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="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Section name="compare to true" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Original> + is_true<true>::value == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Original> + is_true<false>::value == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Original> + is_true<true>::value + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<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="3x3x3 ints" tags="[generators]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < y + </Original> + <Expanded> + 1 < 4 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + y < z + </Original> + <Expanded> + 4 < 7 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < z + </Original> + <Expanded> + 1 < 7 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < y + </Original> + <Expanded> + 1 < 4 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + y < z + </Original> + <Expanded> + 4 < 8 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < z + </Original> + <Expanded> + 1 < 8 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < y + </Original> + <Expanded> + 1 < 4 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + y < z + </Original> + <Expanded> + 4 < 9 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < z + </Original> + <Expanded> + 1 < 9 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < y + </Original> + <Expanded> + 1 < 5 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + y < z + </Original> + <Expanded> + 5 < 7 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < z + </Original> + <Expanded> + 1 < 7 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < y + </Original> + <Expanded> + 1 < 5 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + y < z + </Original> + <Expanded> + 5 < 8 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < z + </Original> + <Expanded> + 1 < 8 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < y + </Original> + <Expanded> + 1 < 5 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + y < z + </Original> + <Expanded> + 5 < 9 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < z + </Original> + <Expanded> + 1 < 9 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < y + </Original> + <Expanded> + 1 < 6 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + y < z + </Original> + <Expanded> + 6 < 7 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < z + </Original> + <Expanded> + 1 < 7 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < y + </Original> + <Expanded> + 1 < 6 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + y < z + </Original> + <Expanded> + 6 < 8 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < z + </Original> + <Expanded> + 1 < 8 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < y + </Original> + <Expanded> + 1 < 6 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + y < z + </Original> + <Expanded> + 6 < 9 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < z + </Original> + <Expanded> + 1 < 9 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < y + </Original> + <Expanded> + 2 < 4 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + y < z + </Original> + <Expanded> + 4 < 7 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < z + </Original> + <Expanded> + 2 < 7 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < y + </Original> + <Expanded> + 2 < 4 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + y < z + </Original> + <Expanded> + 4 < 8 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < z + </Original> + <Expanded> + 2 < 8 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < y + </Original> + <Expanded> + 2 < 4 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + y < z + </Original> + <Expanded> + 4 < 9 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < z + </Original> + <Expanded> + 2 < 9 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < y + </Original> + <Expanded> + 2 < 5 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + y < z + </Original> + <Expanded> + 5 < 7 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < z + </Original> + <Expanded> + 2 < 7 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < y + </Original> + <Expanded> + 2 < 5 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + y < z + </Original> + <Expanded> + 5 < 8 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < z + </Original> + <Expanded> + 2 < 8 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < y + </Original> + <Expanded> + 2 < 5 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + y < z + </Original> + <Expanded> + 5 < 9 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < z + </Original> + <Expanded> + 2 < 9 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < y + </Original> + <Expanded> + 2 < 6 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + y < z + </Original> + <Expanded> + 6 < 7 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < z + </Original> + <Expanded> + 2 < 7 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < y + </Original> + <Expanded> + 2 < 6 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + y < z + </Original> + <Expanded> + 6 < 8 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < z + </Original> + <Expanded> + 2 < 8 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < y + </Original> + <Expanded> + 2 < 6 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + y < z + </Original> + <Expanded> + 6 < 9 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < z + </Original> + <Expanded> + 2 < 9 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < y + </Original> + <Expanded> + 3 < 4 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + y < z + </Original> + <Expanded> + 4 < 7 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < z + </Original> + <Expanded> + 3 < 7 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < y + </Original> + <Expanded> + 3 < 4 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + y < z + </Original> + <Expanded> + 4 < 8 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < z + </Original> + <Expanded> + 3 < 8 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < y + </Original> + <Expanded> + 3 < 4 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + y < z + </Original> + <Expanded> + 4 < 9 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < z + </Original> + <Expanded> + 3 < 9 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < y + </Original> + <Expanded> + 3 < 5 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + y < z + </Original> + <Expanded> + 5 < 7 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < z + </Original> + <Expanded> + 3 < 7 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < y + </Original> + <Expanded> + 3 < 5 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + y < z + </Original> + <Expanded> + 5 < 8 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < z + </Original> + <Expanded> + 3 < 8 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < y + </Original> + <Expanded> + 3 < 5 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + y < z + </Original> + <Expanded> + 5 < 9 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < z + </Original> + <Expanded> + 3 < 9 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < y + </Original> + <Expanded> + 3 < 6 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + y < z + </Original> + <Expanded> + 6 < 7 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < z + </Original> + <Expanded> + 3 < 7 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < y + </Original> + <Expanded> + 3 < 6 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + y < z + </Original> + <Expanded> + 6 < 8 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < z + </Original> + <Expanded> + 3 < 8 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < y + </Original> + <Expanded> + 3 < 6 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + y < z + </Original> + <Expanded> + 6 < 9 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + x < z + </Original> + <Expanded> + 3 < 9 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="A METHOD_AS_TEST_CASE based test run that fails" tags="[.][class][failing]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="false" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + s == "hello" + </Original> + <Expanded> + "hello" == "hello" + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<float>" tags="[.][class][failing][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Template_Fixture_2<TestType>::m_a.size() == 1 + </Original> + <Expanded> + 0 == 1 + </Expanded> + </Expression> + <OverallResult success="false"/> + </TestCase> + <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - Template_Foo<int>" tags="[.][class][failing][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Template_Fixture_2<TestType>::m_a.size() == 1 + </Original> + <Expanded> + 0 == 1 + </Expanded> + </Expression> + <OverallResult success="false"/> + </TestCase> + <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<float>" tags="[.][class][failing][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Template_Fixture_2<TestType>::m_a.size() == 1 + </Original> + <Expanded> + 0 == 1 + </Expanded> + </Expression> + <OverallResult success="false"/> + </TestCase> + <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - std::vector<int>" tags="[.][class][failing][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Template_Fixture_2<TestType>::m_a.size() == 1 + </Original> + <Expanded> + 0 == 1 + </Expanded> + </Expression> + <OverallResult success="false"/> + </TestCase> + <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - Template_Foo<float>" tags="[class][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Template_Fixture_2<TestType>::m_a.size() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - Template_Foo<int>" tags="[class][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Template_Fixture_2<TestType>::m_a.size() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - std::vector<float>" tags="[class][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Template_Fixture_2<TestType>::m_a.size() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - std::vector<int>" tags="[class][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Template_Fixture_2<TestType>::m_a.size() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<float, 6>" tags="[.][class][failing][nttp][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Template_Fixture_2<TestType>{}.m_a.size() < 2 + </Original> + <Expanded> + 6 < 2 + </Expanded> + </Expression> + <OverallResult success="false"/> + </TestCase> + <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - Template_Foo_2<int, 2>" tags="[.][class][failing][nttp][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Template_Fixture_2<TestType>{}.m_a.size() < 2 + </Original> + <Expanded> + 2 < 2 + </Expanded> + </Expression> + <OverallResult success="false"/> + </TestCase> + <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<float, 6>" tags="[.][class][failing][nttp][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Template_Fixture_2<TestType>{}.m_a.size() < 2 + </Original> + <Expanded> + 6 < 2 + </Expanded> + </Expression> + <OverallResult success="false"/> + </TestCase> + <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails - std::array<int, 2>" tags="[.][class][failing][nttp][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Template_Fixture_2<TestType>{}.m_a.size() < 2 + </Original> + <Expanded> + 2 < 2 + </Expanded> + </Expression> + <OverallResult success="false"/> + </TestCase> + <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - Template_Foo_2<float,6>" tags="[class][nttp][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Template_Fixture_2<TestType>{}.m_a.size() >= 2 + </Original> + <Expanded> + 6 >= 2 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - Template_Foo_2<int,2>" tags="[class][nttp][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Template_Fixture_2<TestType>{}.m_a.size() >= 2 + </Original> + <Expanded> + 2 >= 2 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - std::array<float,6>" tags="[class][nttp][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Template_Fixture_2<TestType>{}.m_a.size() >= 2 + </Original> + <Expanded> + 6 >= 2 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds - std::array<int,2>" tags="[class][nttp][product][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Template_Fixture_2<TestType>{}.m_a.size() >= 2 + </Original> + <Expanded> + 2 >= 2 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - double" tags="[.][class][failing][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Template_Fixture<TestType>::m_a == 2 + </Original> + <Expanded> + 1.0 == 2 + </Expanded> + </Expression> + <OverallResult success="false"/> + </TestCase> + <TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - float" tags="[.][class][failing][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Template_Fixture<TestType>::m_a == 2 + </Original> + <Expanded> + 1.0f == 2 + </Expanded> + </Expression> + <OverallResult success="false"/> + </TestCase> + <TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - int" tags="[.][class][failing][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Template_Fixture<TestType>::m_a == 2 + </Original> + <Expanded> + 1 == 2 + </Expanded> + </Expression> + <OverallResult success="false"/> + </TestCase> + <TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - double" tags="[class][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Template_Fixture<TestType>::m_a == 1 + </Original> + <Expanded> + 1.0 == 1 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - float" tags="[class][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Template_Fixture<TestType>::m_a == 1 + </Original> + <Expanded> + 1.0f == 1 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that succeeds - int" tags="[class][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Template_Fixture<TestType>::m_a == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 1" tags="[.][class][failing][nttp][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Nttp_Fixture<V>::value == 0 + </Original> + <Expanded> + 1 == 0 + </Expanded> + </Expression> + <OverallResult success="false"/> + </TestCase> + <TestCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 3" tags="[.][class][failing][nttp][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Nttp_Fixture<V>::value == 0 + </Original> + <Expanded> + 3 == 0 + </Expanded> + </Expression> + <OverallResult success="false"/> + </TestCase> + <TestCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails - 6" tags="[.][class][failing][nttp][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Nttp_Fixture<V>::value == 0 + </Original> + <Expanded> + 6 == 0 + </Expanded> + </Expression> + <OverallResult success="false"/> + </TestCase> + <TestCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 1" tags="[class][nttp][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Nttp_Fixture<V>::value > 0 + </Original> + <Expanded> + 1 > 0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 3" tags="[class][nttp][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Nttp_Fixture<V>::value > 0 + </Original> + <Expanded> + 3 > 0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds - 6" tags="[class][nttp][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Nttp_Fixture<V>::value > 0 + </Original> + <Expanded> + 6 > 0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="A TEST_CASE_METHOD based test run that fails" tags="[.][class][failing]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="false" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + m_a == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="A Template product test case - Foo<float>" tags="[product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + x.size() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="A Template product test case - Foo<int>" tags="[product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + x.size() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="A Template product test case - std::vector<float>" tags="[product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + x.size() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="A Template product test case - std::vector<int>" tags="[product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + x.size() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="A Template product test case with array signature - Bar<float, 42>" tags="[nttp][product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + x.size() > 0 + </Original> + <Expanded> + 42 > 0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="A Template product test case with array signature - Bar<int, 9>" tags="[nttp][product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + x.size() > 0 + </Original> + <Expanded> + 9 > 0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="A Template product test case with array signature - std::array<float, 42>" tags="[nttp][product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + x.size() > 0 + </Original> + <Expanded> + 42 > 0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="A Template product test case with array signature - std::array<int, 9>" tags="[nttp][product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + x.size() > 0 + </Original> + <Expanded> + 9 > 0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="A comparison that uses literals instead of the normal constructor" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > + <Original> + d == 1.23_a + </Original> + <Expanded> + 1.23 == Approx( 1.23 ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > + <Original> + d != 1.22_a + </Original> + <Expanded> + 1.23 != Approx( 1.22 ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > + <Original> + -d == -1.23_a + </Original> + <Expanded> + -1.23 == Approx( -1.23 ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > + <Original> + d == 1.2_a .epsilon(.1) + </Original> + <Expanded> + 1.23 == Approx( 1.2 ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > + <Original> + d != 1.2_a .epsilon(.001) + </Original> + <Expanded> + 1.23 != Approx( 1.2 ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > + <Original> + d == 1_a .epsilon(.3) + </Original> + <Expanded> + 1.23 == Approx( 1.0 ) + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="A couple of nested sections followed by a failure" tags="[.][failing]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Section name="Outer" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Section name="Inner" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Failure filename="tests/<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="[.][failing][Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Expression success="false" type="CHECK" filename="tests/<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="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Original> + o1 == o2 + </Original> + <Expanded> + {?} == {?} + </Expanded> + </Expression> + <OverallResult success="false"/> + </TestCase> + <TestCase name="Absolute margin" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Original> + i++ == 7 + </Original> + <Expanded> + 7 == 7 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Original> + 1 == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="false" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Original> + {Unknown expression after the reported line} + </Original> + <Expanded> + {Unknown expression after the reported line} + </Expanded> + <Exception filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + unexpected exception + </Exception> + </Expression> + <OverallResult success="false"/> + </TestCase> + <TestCase name="Anonymous test case 1" filename="tests/<exe-name>/UsageTests/VariadicMacros.tests.cpp" > + <OverallResult success="true"/> + </TestCase> + <TestCase name="Approx setters validate their arguments" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > + <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Approx.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Approx.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Approx.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Approx.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Approx.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > + <Original> + 1 == Approx( 1 ) + </Original> + <Expanded> + 1 == Approx( 1.0 ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Approx.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Approx.tests.cpp" > + <Original> + 0 == Approx( dZero) + </Original> + <Expanded> + 0 == Approx( 0.0 ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<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="tests/<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="Arbitrary predicate matcher" tags="[generic][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Section name="Function pointer" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1, Predicate<int>(alwaysTrue, "always true") + </Original> + <Expanded> + 1 matches predicate: "always true" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1, !Predicate<int>(alwaysFalse, "always false") + </Original> + <Expanded> + 1 not matches predicate: "always false" + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Lambdas + different type" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + "Hello olleH", Predicate<std::string>( [] (std::string const& str) -> bool { return str.front() == str.back(); }, "First and last character should be equal") + </Original> + <Expanded> + "Hello olleH" matches predicate: "First and last character should be equal" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + "This wouldn't pass", !Predicate<std::string>( [] (std::string const& str) -> bool { return str.front() == str.back(); } ) + </Original> + <Expanded> + "This wouldn't pass" not matches undescribed predicate + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Assertion macros support bit operators and bool conversions" tags="[bitops][compilation]" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Original> + lhs | rhs + </Original> + <Expanded> + Val: 1 | Val: 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Original> + !(lhs & rhs) + </Original> + <Expanded> + !(Val: 1 & Val: 2) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Original> + HasBitOperators{ 1 } & HasBitOperators{ 1 } + </Original> + <Expanded> + Val: 1 & Val: 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Original> + lhs ^ rhs + </Original> + <Expanded> + Val: 1 ^ Val: 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Original> + !(lhs ^ lhs) + </Original> + <Expanded> + !(Val: 1 ^ Val: 1) + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Assertions then sections" tags="[Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Original> + true + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Section name="A section" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Original> + true + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Section name="Another section" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Original> + true + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Section name="A section" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Original> + true + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Section name="Another other section" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="Basic use of the Contains range matcher" tags="[contains][matchers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Different argument ranges, same element type, default comparison" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + a, Contains(1) + </Original> + <Expanded> + { 1, 2, 3 } contains element 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + b, Contains(1) + </Original> + <Expanded> + { 0, 1, 2 } contains element 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + c, !Contains(1) + </Original> + <Expanded> + { 4, 5, 6 } not contains element 1 + </Expanded> + </Expression> + <OverallResults successes="3" failures="0" expectedFailures="0"/> + </Section> + <Section name="Different argument ranges, same element type, custom comparison" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + a, Contains(0, close_enough) + </Original> + <Expanded> + { 1, 2, 3 } contains element 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + b, Contains(0, close_enough) + </Original> + <Expanded> + { 0, 1, 2 } contains element 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + c, !Contains(0, close_enough) + </Original> + <Expanded> + { 4, 5, 6 } not contains element 0 + </Expanded> + </Expression> + <OverallResults successes="3" failures="0" expectedFailures="0"/> + </Section> + <Section name="Different element type, custom comparisons" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + a, Contains(4, [](auto&& lhs, size_t sz) { return lhs.size() == sz; }) + </Original> + <Expanded> + { "abc", "abcd", "abcde" } contains element 4 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Can handle type that requires ADL-found free function begin and end" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + in, Contains(1) + </Original> + <Expanded> + { 1, 2, 3, 4, 5 } contains element 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + in, !Contains(8) + </Original> + <Expanded> + { 1, 2, 3, 4, 5 } not contains element 8 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Initialization with move only types" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + in, Contains(MoveOnlyTestElement{ 2 }) + </Original> + <Expanded> + { 1, 2, 3 } contains element 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + in, !Contains(MoveOnlyTestElement{ 9 }) + </Original> + <Expanded> + { 1, 2, 3 } not contains element 9 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Matching using matcher" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + in, Contains(Catch::Matchers::WithinAbs(0.5, 0.5)) + </Original> + <Expanded> + { 1.0, 2.0, 3.0, 0.0 } contains element matching is within 0.5 of 0.5 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Basic use of the Empty range matcher" tags="[empty][matchers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Simple, std-provided containers" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + empty_array, IsEmpty() + </Original> + <Expanded> + { } is empty + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + non_empty_array, !IsEmpty() + </Original> + <Expanded> + { 0.0 } not is empty + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + empty_vec, IsEmpty() + </Original> + <Expanded> + { } is empty + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + non_empty_vec, !IsEmpty() + </Original> + <Expanded> + { 'a', 'b', 'c' } not is empty + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + inner_lists_are_empty, !IsEmpty() + </Original> + <Expanded> + { { } } not is empty + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + inner_lists_are_empty.front(), IsEmpty() + </Original> + <Expanded> + { } is empty + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <Section name="Type with empty" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + has_empty{}, !IsEmpty() + </Original> + <Expanded> + {?} not is empty + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Type requires ADL found empty free function" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + unrelated::ADL_empty{}, IsEmpty() + </Original> + <Expanded> + {?} is empty + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="CAPTURE can deal with complex expressions" tags="[capture][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Info> + a := 1 + </Info> + <Info> + b := 2 + </Info> + <Info> + c := 3 + </Info> + <Info> + a + b := 3 + </Info> + <Info> + a+b := 3 + </Info> + <Info> + c > b := true + </Info> + <Info> + a == 1 := true + </Info> + <OverallResult success="true"/> + </TestCase> + <TestCase name="CAPTURE can deal with complex expressions involving commas" tags="[capture][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Info> + std::vector<int>{1, 2, 3}[0, 1, 2] := 3 + </Info> + <Info> + std::vector<int>{1, 2, 3}[(0, 1)] := 2 + </Info> + <Info> + std::vector<int>{1, 2, 3}[0] := 1 + </Info> + <Info> + (helper_1436<int, int>{12, -12}) := { 12, -12 } + </Info> + <Info> + (helper_1436<int, int>(-12, 12)) := { -12, 12 } + </Info> + <Info> + (1, 2) := 2 + </Info> + <Info> + (2, 3) := 3 + </Info> + <OverallResult success="true"/> + </TestCase> + <TestCase name="CAPTURE parses string and character constants" tags="[capture][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Info> + ("comma, in string", "escaped, \", ") := "escaped, ", " + </Info> + <Info> + "single quote in string,'," := "single quote in string,'," + </Info> + <Info> + "some escapes, \\,\\\\" := "some escapes, \,\\" + </Info> + <Info> + "some, ), unmatched, } prenheses {[<" := "some, ), unmatched, } prenheses {[<" + </Info> + <Info> + '"' := '"' + </Info> + <Info> + '\'' := ''' + </Info> + <Info> + ',' := ',' + </Info> + <Info> + '}' := '}' + </Info> + <Info> + ')' := ')' + </Info> + <Info> + '(' := '(' + </Info> + <Info> + '{' := '{' + </Info> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Capture and info messages" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Section name="Capture should stringify like assertions" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Info> + i := 2 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Info> + 3 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Section name="Specifically escaped" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Original> + tab == '\t' + </Original> + <Expanded> + '\t' == '\t' + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Original> + newline == '\n' + </Original> + <Expanded> + '\n' == '\n' + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Original> + carr_return == '\r' + </Original> + <Expanded> + '\r' == '\r' + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Original> + space == ' ' + </Original> + <Expanded> + ' ' == ' ' + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Original> + c == chars[i] + </Original> + <Expanded> + 'a' == 'a' + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Original> + c == chars[i] + </Original> + <Expanded> + 'z' == 'z' + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Original> + c == chars[i] + </Original> + <Expanded> + 'A' == 'A' + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Original> + null_terminator == '\0' + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Original> + c == i + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Original> + c == i + </Original> + <Expanded> + 3 == 3 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Original> + c == i + </Original> + <Expanded> + 4 == 4 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="Clara::Arg supports single-arg parse the way Opt does" tags="[arg][clara][compilation]" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > + <Original> + name.empty() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Clara.tests.cpp" > + <Original> + name == "foo" + </Original> + <Expanded> + "foo" == "foo" + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Combining MatchAllOfGeneric does not nest" tags="[matchers][templated]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1, (MatcherA() && MatcherB()) && MatcherC() + </Original> + <Expanded> + 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1, MatcherA() && (MatcherB() && MatcherC()) + </Original> + <Expanded> + 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1, (MatcherA() && MatcherB()) && (MatcherC() && MatcherD()) + </Original> + <Expanded> + 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 and equals: true ) + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Combining MatchAnyOfGeneric does not nest" tags="[matchers][templated]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1, (MatcherA() || MatcherB()) || MatcherC() + </Original> + <Expanded> + 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1, MatcherA() || (MatcherB() || MatcherC()) + </Original> + <Expanded> + 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1, (MatcherA() || MatcherB()) || (MatcherC() || MatcherD()) + </Original> + <Expanded> + 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 or equals: true ) + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Combining MatchNotOfGeneric does not nest" tags="[matchers][templated]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 0, !MatcherA() + </Original> + <Expanded> + 0 not equals: (int) 1 or (float) 1.0f + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1, !!MatcherA() + </Original> + <Expanded> + 1 equals: (int) 1 or (float) 1.0f + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 0, !!!MatcherA() + </Original> + <Expanded> + 0 not equals: (int) 1 or (float) 1.0f + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1, !!!!MatcherA() + </Original> + <Expanded> + 1 equals: (int) 1 or (float) 1.0f + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Combining concrete matchers does not use templated matchers" tags="[matchers][templated]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <OverallResult success="true"/> + </TestCase> + <TestCase name="Combining only templated matchers" tags="[matchers][templated]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1, MatcherA() || MatcherB() + </Original> + <Expanded> + 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1, MatcherA() && MatcherB() + </Original> + <Expanded> + 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1, MatcherA() || !MatcherB() + </Original> + <Expanded> + 1 ( equals: (int) 1 or (float) 1.0f or not equals: (long long) 1 ) + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Combining templated and concrete matchers" tags="[matchers][templated]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + vec, Predicate<std::vector<int>>([](auto const& v) { return std::all_of(v.begin(), v.end(), [](int elem) { return elem % 2 == 1; }); }, "All elements are odd") && !EqualsRange(a) + </Original> + <Expanded> + { 1, 3, 5 } ( matches predicate: "All elements are odd" and not Equals: { 5, 3, 1 } ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + str, StartsWith("foo") && EqualsRange(arr) && EndsWith("bar") + </Original> + <Expanded> + "foobar" ( starts with: "foo" and Equals: { 'f', 'o', 'o', 'b', 'a', 'r' } and ends with: "bar" ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + str, StartsWith("foo") && !EqualsRange(bad_arr) && EndsWith("bar") + </Original> + <Expanded> + "foobar" ( starts with: "foo" and not Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } and ends with: "bar" ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + str, EqualsRange(arr) && StartsWith("foo") && EndsWith("bar") + </Original> + <Expanded> + "foobar" ( Equals: { 'f', 'o', 'o', 'b', 'a', 'r' } and starts with: "foo" and ends with: "bar" ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + str, !EqualsRange(bad_arr) && StartsWith("foo") && EndsWith("bar") + </Original> + <Expanded> + "foobar" ( not Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } and starts with: "foo" and ends with: "bar" ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + str, EqualsRange(bad_arr) || (StartsWith("foo") && EndsWith("bar")) + </Original> + <Expanded> + "foobar" ( Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } or ( starts with: "foo" and ends with: "bar" ) ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + str, (StartsWith("foo") && EndsWith("bar")) || EqualsRange(bad_arr) + </Original> + <Expanded> + "foobar" ( ( starts with: "foo" and ends with: "bar" ) or Equals: { 'o', 'o', 'f', 'b', 'a', 'r' } ) + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Combining templated matchers" tags="[matchers][templated]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + container, EqualsRange(a) || EqualsRange(b) || EqualsRange(c) + </Original> + <Expanded> + { 1, 2, 3 } ( Equals: { 1, 2, 3 } or Equals: { 0, 1, 2 } or Equals: { 4, 5, 6 } ) + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Commas in various macros are allowed" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Expression success="true" type="REQUIRE_THROWS" filename="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Original> + true + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="CHECKED_ELSE" filename="tests/<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="[function pointer][Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Original> + a + </Original> + <Expanded> + 0x<hex digits> + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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 ops" tags="[rng]" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Original> + SimplePcg32{} == SimplePcg32{} + </Original> + <Expanded> + {?} == {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Original> + SimplePcg32{ 0 } != SimplePcg32{} + </Original> + <Expanded> + {?} != {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Original> + !(SimplePcg32{ 1 } == SimplePcg32{ 2 }) + </Original> + <Expanded> + !({?} == {?}) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Original> + !(SimplePcg32{ 1 } != SimplePcg32{ 1 }) + </Original> + <Expanded> + !({?} != {?}) + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Comparison with explicitly convertible types" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + ( -1 > 2u ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + -1 > 2u + </Original> + <Expanded> + -1 > 2 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + ( 2u < -1 ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + 2u < -1 + </Original> + <Expanded> + 2 < -1 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + ( minInt > 2u ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + i == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + ui == 2 + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + l == 3 + </Original> + <Expanded> + 3 == 3 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + ul == 4 + </Original> + <Expanded> + 4 == 4 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + c == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + uc == 6 + </Original> + <Expanded> + 6 == 6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + 1 == i + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + 2 == ui + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + 3 == l + </Original> + <Expanded> + 3 == 3 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + 4 == ul + </Original> + <Expanded> + 4 == 4 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + 5 == c + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + 6 == uc + </Original> + <Expanded> + 6 == 6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="Composed generic matchers shortcircuit" tags="[composed][generic][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Section name="MatchAllOf" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + !(matcher.match( 1 )) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + first.matchCalled + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + !second.matchCalled + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResults successes="3" failures="0" expectedFailures="0"/> + </Section> + <Section name="MatchAnyOf" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + matcher.match(1) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + first.matchCalled + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + !second.matchCalled + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResults successes="3" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Composed matchers shortcircuit" tags="[composed][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Section name="MatchAllOf" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + !(matcher.match( 1 )) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + first.matchCalled + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + !second.matchCalled + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResults successes="3" failures="0" expectedFailures="0"/> + </Section> + <Section name="MatchAnyOf" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + matcher.match( 1 ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + first.matchCalled + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + !second.matchCalled + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResults successes="3" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Contains string matcher" tags="[.][failing][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="false" type="CHECK_THAT" filename="tests/<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="tests/<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="Copy and then generate a range" tags="[generators]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Section name="from var and iterators" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + elem % 2 == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="from var and iterators" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + elem % 2 == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="from var and iterators" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + elem % 2 == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="from var and iterators" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + elem % 2 == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="from var and iterators" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + elem % 2 == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="from var and iterators" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + elem % 2 == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="From a temporary container" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + elem % 2 == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="From a temporary container" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + elem % 2 == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="From a temporary container" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + elem % 2 == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="From a temporary container" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + elem % 2 == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="From a temporary container" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + elem % 2 == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="From a temporary container" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + elem % 2 == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Final validation" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + call_count == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + make_data().size() == test_count + </Original> + <Expanded> + 6 == 6 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Custom exceptions can be translated when testing for nothrow" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Expression success="false" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Original> + throwCustom() + </Original> + <Expanded> + throwCustom() + </Expanded> + <Exception filename="tests/<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="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Expression success="false" type="REQUIRE_THROWS_AS" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Original> + throwCustom(), std::exception + </Original> + <Expanded> + throwCustom(), std::exception + </Expanded> + <Exception filename="tests/<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="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Exception filename="tests/<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="tests/<exe-name>/UsageTests/Approx.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<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="Directly creating an EnumInfo" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > + <Original> + enumInfo->lookup(0) == "Value1" + </Original> + <Expanded> + Value1 == "Value1" + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > + <Original> + enumInfo->lookup(1) == "Value2" + </Original> + <Expanded> + Value2 == "Value2" + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > + <Original> + enumInfo->lookup(3) == "{** unexpected enum value **}" + </Original> + <Expanded> + {** unexpected enum value **} +== +"{** unexpected enum value **}" + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="EndsWith string matcher" tags="[.][failing][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="false" type="CHECK_THAT" filename="tests/<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="tests/<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="Enums can quickly have stringification enabled using REGISTER_ENUM" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > + <Original> + stringify( EnumClass3::Value1 ) == "Value1" + </Original> + <Expanded> + "Value1" == "Value1" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > + <Original> + stringify( EnumClass3::Value2 ) == "Value2" + </Original> + <Expanded> + "Value2" == "Value2" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > + <Original> + stringify( EnumClass3::Value3 ) == "Value3" + </Original> + <Expanded> + "Value3" == "Value3" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > + <Original> + stringify( EnumClass3::Value4 ) == "{** unexpected enum value **}" + </Original> + <Expanded> + "{** unexpected enum value **}" +== +"{** unexpected enum value **}" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > + <Original> + stringify( ec3 ) == "Value2" + </Original> + <Expanded> + "Value2" == "Value2" + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > + <Original> + stringify( Bikeshed::Colours::Red ) == "Red" + </Original> + <Expanded> + "Red" == "Red" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > + <Original> + stringify( Bikeshed::Colours::Blue ) == "Blue" + </Original> + <Expanded> + "Blue" == "Blue" + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Epsilon only applies to Approx's value" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.int_seven == 6 + </Original> + <Expanded> + 7 == 6 + </Expanded> + </Expression> + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.int_seven == 8 + </Original> + <Expanded> + 7 == 8 + </Expanded> + </Expression> + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.int_seven == 0 + </Original> + <Expanded> + 7 == 0 + </Expanded> + </Expression> + <Expression success="false" type="CHECK" filename="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.str_hello == "goodbye" + </Original> + <Expanded> + "hello" == "goodbye" + </Expanded> + </Expression> + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.str_hello == "hell" + </Original> + <Expanded> + "hello" == "hell" + </Expanded> + </Expression> + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.str_hello == "hello1" + </Original> + <Expanded> + "hello" == "hello1" + </Expanded> + </Expression> + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.str_hello.size() == 6 + </Original> + <Expanded> + 5 == 6 + </Expanded> + </Expression> + <Expression success="false" type="CHECK" filename="tests/<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="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.int_seven == 7 + </Original> + <Expanded> + 7 == 7 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.str_hello == "hello" + </Original> + <Expanded> + "hello" == "hello" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + "hello" == data.str_hello + </Original> + <Expanded> + "hello" == "hello" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.str_hello.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="false" type="CHECK_THAT" filename="tests/<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="tests/<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 as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified" tags="[exception][toString]" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Original> + ::Catch::Detail::stringify(WhatException{}) == "This exception has overridden what() method" + </Original> + <Expanded> + "This exception has overridden what() method" +== +"This exception has overridden what() method" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Original> + ::Catch::Detail::stringify(OperatorException{}) == "OperatorException" + </Original> + <Expanded> + "OperatorException" == "OperatorException" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Original> + ::Catch::Detail::stringify(StringMakerException{}) == "StringMakerException" + </Original> + <Expanded> + "StringMakerException" +== +"StringMakerException" + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Exception matchers that fail" tags="[!throws][.][exceptions][failing][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Section name="No exception" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="false" type="CHECK_THROWS_MATCHES" filename="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="false" type="CHECK_THROWS_MATCHES" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + throwsAsInt(1), SpecialException, ExceptionMatcher{1} + </Original> + <Expanded> + throwsAsInt(1), SpecialException, ExceptionMatcher{1} + </Expanded> + <Exception filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + Unknown exception + </Exception> + </Expression> + <Expression success="false" type="REQUIRE_THROWS_MATCHES" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + throwsAsInt(1), SpecialException, ExceptionMatcher{1} + </Original> + <Expanded> + throwsAsInt(1), SpecialException, ExceptionMatcher{1} + </Expanded> + <Exception filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + Unknown exception + </Exception> + </Expression> + <OverallResults successes="0" failures="2" expectedFailures="0"/> + </Section> + <Section name="Contents are wrong" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="false" type="CHECK_THROWS_MATCHES" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + throwsSpecialException(3), SpecialException, ExceptionMatcher{1} + </Original> + <Expanded> + SpecialException::what special exception has value of 1 + </Expanded> + </Expression> + <Expression success="false" type="REQUIRE_THROWS_MATCHES" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + throwsSpecialException(4), SpecialException, ExceptionMatcher{1} + </Original> + <Expanded> + SpecialException::what 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="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="CHECK_THROWS_MATCHES" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + throwsSpecialException(1), SpecialException, ExceptionMatcher{1} + </Original> + <Expanded> + SpecialException::what special exception has value of 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THROWS_MATCHES" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + throwsSpecialException(2), SpecialException, ExceptionMatcher{2} + </Original> + <Expanded> + SpecialException::what special exception has value of 2 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Exception messages can be tested for" tags="[!throws]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Section name="exact match" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Expression success="true" type="REQUIRE_THROWS_WITH" filename="tests/<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="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Expression success="true" type="REQUIRE_THROWS_WITH" filename="tests/<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="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Expression success="true" type="REQUIRE_THROWS_WITH" filename="tests/<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="tests/<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="tests/<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="tests/<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="Exceptions matchers" tags="[!throws][exceptions][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THROWS_MATCHES" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + throwsDerivedException(), DerivedException, Message("DerivedException::what") + </Original> + <Expanded> + DerivedException::what exception message matches "DerivedException::what" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THROWS_MATCHES" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + throwsDerivedException(), DerivedException, !Message("derivedexception::what") + </Original> + <Expanded> + DerivedException::what not exception message matches "derivedexception::what" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THROWS_MATCHES" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + throwsSpecialException(2), SpecialException, !Message("DerivedException::what") + </Original> + <Expanded> + SpecialException::what not exception message matches "DerivedException::what" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THROWS_MATCHES" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + throwsSpecialException(2), SpecialException, Message("SpecialException::what") + </Original> + <Expanded> + SpecialException::what exception message matches "SpecialException::what" + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Expected exceptions that don't throw or unexpected exceptions fail the test" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Expression success="false" type="CHECK_THROWS_AS" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Original> + thisThrows(), std::string + </Original> + <Expanded> + thisThrows(), std::string + </Expanded> + <Exception filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + expected exception + </Exception> + </Expression> + <Expression success="false" type="CHECK_THROWS_AS" filename="tests/<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="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Original> + thisThrows() + </Original> + <Expanded> + thisThrows() + </Expanded> + <Exception filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + expected exception + </Exception> + </Expression> + <OverallResult success="false"/> + </TestCase> + <TestCase name="FAIL aborts the test" tags="[.][failing][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Failure filename="tests/<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="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Failure filename="tests/<exe-name>/UsageTests/Message.tests.cpp" /> + <OverallResult success="false"/> + </TestCase> + <TestCase name="FAIL_CHECK does not abort the test" tags="[.][failing][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Failure filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + Factorial(0) == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + Factorial(1) == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + Factorial(2) == 2 + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + Factorial(3) == 6 + </Original> + <Expanded> + 6 == 6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Section name="Relative" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 10., WithinRel(11.1, 0.1) + </Original> + <Expanded> + 10.0 and 11.1 are within 10% of each other + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 10., !WithinRel(11.2, 0.1) + </Original> + <Expanded> + 10.0 not and 11.2 are within 10% of each other + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1., !WithinRel(0., 0.99) + </Original> + <Expanded> + 1.0 not and 0 are within 99% of each other + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + -0., WithinRel(0.) + </Original> + <Expanded> + -0.0 and 0 are within 2.22045e-12% of each other + </Expanded> + </Expression> + <Section name="Some subnormal values" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + v1, WithinRel(v2) + </Original> + <Expanded> + 0.0 and 2.22507e-308 are within 2.22045e-12% of each other + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="5" failures="0" expectedFailures="0"/> + </Section> + <Section name="Margin" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<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="tests/<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="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 11., !WithinAbs(10., 0.5) + </Original> + <Expanded> + 11.0 not is within 0.5 of 10.0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 10., !WithinAbs(11., 0.5) + </Original> + <Expanded> + 10.0 not is within 0.5 of 11.0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + -10., WithinAbs(-10., 0.5) + </Original> + <Expanded> + -10.0 is within 0.5 of -10.0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + -10., WithinAbs(-9.6, 0.5) + </Original> + <Expanded> + -10.0 is within 0.5 of -9.6 + </Expanded> + </Expression> + <OverallResults successes="8" failures="0" expectedFailures="0"/> + </Section> + <Section name="ULPs" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1., WithinULP(1., 0) + </Original> + <Expanded> + 1.0 is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + nextafter(1., 2.), WithinULP(1., 1) + </Original> + <Expanded> + 1.0 is within 1 ULPs of 1.0000000000000000e+00 ([9.9999999999999989e-01, 1.0000000000000002e+00]) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 0., WithinULP(nextafter(0., 1.), 1) + </Original> + <Expanded> + 0.0 is within 1 ULPs of 4.9406564584124654e-324 ([0.0000000000000000e+00, 9.8813129168249309e-324]) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1., WithinULP(nextafter(1., 0.), 1) + </Original> + <Expanded> + 1.0 is within 1 ULPs of 9.9999999999999989e-01 ([9.9999999999999978e-01, 1.0000000000000000e+00]) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1., !WithinULP(nextafter(1., 2.), 0) + </Original> + <Expanded> + 1.0 not is within 0 ULPs of 1.0000000000000002e+00 ([1.0000000000000002e+00, 1.0000000000000002e+00]) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1., WithinULP(1., 0) + </Original> + <Expanded> + 1.0 is within 0 ULPs of 1.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + -0., WithinULP(0., 0) + </Original> + <Expanded> + -0.0 is within 0 ULPs of 0.0000000000000000e+00 ([0.0000000000000000e+00, 0.0000000000000000e+00]) + </Expanded> + </Expression> + <OverallResults successes="7" failures="0" expectedFailures="0"/> + </Section> + <Section name="Composed" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<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.0000000000000000e+00 ([1.9999999999999998e+00, 2.0000000000000004e+00]) ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<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.0000000000000000e+00 ([1.0000000000000000e+00, 1.0000000000000000e+00]) ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 0.0001, WithinAbs(0., 0.001) || WithinRel(0., 0.1) + </Original> + <Expanded> + 0.0001 ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) + </Expanded> + </Expression> + <OverallResults successes="3" failures="0" expectedFailures="0"/> + </Section> + <Section name="Constructor validation" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + WithinULP(1., 0) + </Original> + <Expanded> + WithinULP(1., 0) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + WithinRel(1., 0.) + </Original> + <Expanded> + WithinRel(1., 0.) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THROWS_AS" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + WithinRel(1., -0.2), std::domain_error + </Original> + <Expanded> + WithinRel(1., -0.2), std::domain_error + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THROWS_AS" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + WithinRel(1., 1.), std::domain_error + </Original> + <Expanded> + WithinRel(1., 1.), std::domain_error + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Floating point matchers: float" tags="[floating-point][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Section name="Relative" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 10.f, WithinRel(11.1f, 0.1f) + </Original> + <Expanded> + 10.0f and 11.1 are within 10% of each other + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 10.f, !WithinRel(11.2f, 0.1f) + </Original> + <Expanded> + 10.0f not and 11.2 are within 10% of each other + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1.f, !WithinRel(0.f, 0.99f) + </Original> + <Expanded> + 1.0f not and 0 are within 99% of each other + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + -0.f, WithinRel(0.f) + </Original> + <Expanded> + -0.0f and 0 are within 0.00119209% of each other + </Expanded> + </Expression> + <Section name="Some subnormal values" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + v1, WithinRel(v2) + </Original> + <Expanded> + 0.0f and 1.17549e-38 are within 0.00119209% of each other + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="5" failures="0" expectedFailures="0"/> + </Section> + <Section name="Margin" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 11.f, !WithinAbs(10.f, 0.5f) + </Original> + <Expanded> + 11.0f not is within 0.5 of 10.0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 10.f, !WithinAbs(11.f, 0.5f) + </Original> + <Expanded> + 10.0f not is within 0.5 of 11.0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + -10.f, WithinAbs(-10.f, 0.5f) + </Original> + <Expanded> + -10.0f is within 0.5 of -10.0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + -10.f, WithinAbs(-9.6f, 0.5f) + </Original> + <Expanded> + -10.0f is within 0.5 of -9.6000003815 + </Expanded> + </Expression> + <OverallResults successes="9" failures="0" expectedFailures="0"/> + </Section> + <Section name="ULPs" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1.f, WithinULP(1.f, 0) + </Original> + <Expanded> + 1.0f is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + nextafter(1.f, 2.f), WithinULP(1.f, 1) + </Original> + <Expanded> + 1.0f is within 1 ULPs of 1.00000000e+00f ([9.99999940e-01, 1.00000012e+00]) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 0.f, WithinULP(nextafter(0.f, 1.f), 1) + </Original> + <Expanded> + 0.0f is within 1 ULPs of 1.40129846e-45f ([0.00000000e+00, 2.80259693e-45]) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1.f, WithinULP(nextafter(1.f, 0.f), 1) + </Original> + <Expanded> + 1.0f is within 1 ULPs of 9.99999940e-01f ([9.99999881e-01, 1.00000000e+00]) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1.f, !WithinULP(nextafter(1.f, 2.f), 0) + </Original> + <Expanded> + 1.0f not is within 0 ULPs of 1.00000012e+00f ([1.00000012e+00, 1.00000012e+00]) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1.f, WithinULP(1.f, 0) + </Original> + <Expanded> + 1.0f is within 0 ULPs of 1.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + -0.f, WithinULP(0.f, 0) + </Original> + <Expanded> + -0.0f is within 0 ULPs of 0.00000000e+00f ([0.00000000e+00, 0.00000000e+00]) + </Expanded> + </Expression> + <OverallResults successes="7" failures="0" expectedFailures="0"/> + </Section> + <Section name="Composed" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<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.00000000e+00f ([9.99999940e-01, 1.00000012e+00]) ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<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.00000000e+00f ([1.00000000e+00, 1.00000000e+00]) ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 0.0001f, WithinAbs(0.f, 0.001f) || WithinRel(0.f, 0.1f) + </Original> + <Expanded> + 0.0001f ( is within 0.001 of 0.0 or and 0 are within 10% of each other ) + </Expanded> + </Expression> + <OverallResults successes="3" failures="0" expectedFailures="0"/> + </Section> + <Section name="Constructor validation" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<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="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + WithinULP(1.f, static_cast<uint64_t>(-1)), std::domain_error + </Original> + <Expanded> + WithinULP(1.f, static_cast<uint64_t>(-1)), std::domain_error + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + WithinRel(1.f, 0.f) + </Original> + <Expanded> + WithinRel(1.f, 0.f) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THROWS_AS" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + WithinRel(1.f, -0.2f), std::domain_error + </Original> + <Expanded> + WithinRel(1.f, -0.2f), std::domain_error + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THROWS_AS" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + WithinRel(1.f, 1.f), std::domain_error + </Original> + <Expanded> + WithinRel(1.f, 1.f), std::domain_error + </Expanded> + </Expression> + <OverallResults successes="7" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Generators -- adapters" tags="[generators][generic]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Section name="Filtering by predicate" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + i % 2 == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Filtering by predicate" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + i % 2 == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Filtering by predicate" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + i % 2 == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Filtering by predicate" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Section name="Throws if there are no matching values" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE_THROWS_AS" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + filter([] (int) {return false; }, value(1)), Catch::GeneratorException + </Original> + <Expanded> + filter([] (int) {return false; }, value(1)), Catch::GeneratorException + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Shortening a range" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + i < 4 + </Original> + <Expanded> + 1 < 4 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Shortening a range" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + i < 4 + </Original> + <Expanded> + 2 < 4 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Shortening a range" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + i < 4 + </Original> + <Expanded> + 3 < 4 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Transforming elements" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Section name="Same type" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + i % 2 == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Transforming elements" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Section name="Same type" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + i % 2 == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Transforming elements" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Section name="Same type" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + i % 2 == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Transforming elements" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Section name="Different type" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + i.size() == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Transforming elements" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Section name="Different type" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + i.size() == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Transforming elements" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Section name="Different type" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + i.size() == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Transforming elements" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Section name="Different deduced type" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + i.size() == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Transforming elements" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Section name="Different deduced type" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + i.size() == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Transforming elements" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Section name="Different deduced type" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + i.size() == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Repeating a generator" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + j > 0 + </Original> + <Expanded> + 1 > 0 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Repeating a generator" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + j > 0 + </Original> + <Expanded> + 2 > 0 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Repeating a generator" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + j > 0 + </Original> + <Expanded> + 3 > 0 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Repeating a generator" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + j > 0 + </Original> + <Expanded> + 1 > 0 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Repeating a generator" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + j > 0 + </Original> + <Expanded> + 2 > 0 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Repeating a generator" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + j > 0 + </Original> + <Expanded> + 3 > 0 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Chunking a generator into sized pieces" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Section name="Number of elements in source is divisible by chunk size" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + chunk2.size() == 2 + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + chunk2.front() == chunk2.back() + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Chunking a generator into sized pieces" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Section name="Number of elements in source is divisible by chunk size" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + chunk2.size() == 2 + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + chunk2.front() == chunk2.back() + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Chunking a generator into sized pieces" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Section name="Number of elements in source is divisible by chunk size" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + chunk2.size() == 2 + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + chunk2.front() == chunk2.back() + </Original> + <Expanded> + 3 == 3 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Chunking a generator into sized pieces" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Section name="Number of elements in source is not divisible by chunk size" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + chunk2.size() == 2 + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + chunk2.front() == chunk2.back() + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + chunk2.front() < 3 + </Original> + <Expanded> + 1 < 3 + </Expanded> + </Expression> + <OverallResults successes="3" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="3" failures="0" expectedFailures="0"/> + </Section> + <Section name="Chunking a generator into sized pieces" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Section name="Number of elements in source is not divisible by chunk size" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + chunk2.size() == 2 + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + chunk2.front() == chunk2.back() + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + chunk2.front() < 3 + </Original> + <Expanded> + 2 < 3 + </Expanded> + </Expression> + <OverallResults successes="3" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="3" failures="0" expectedFailures="0"/> + </Section> + <Section name="Chunking a generator into sized pieces" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Section name="Chunk size of zero" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + chunk2.size() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Chunking a generator into sized pieces" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Section name="Chunk size of zero" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + chunk2.size() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Chunking a generator into sized pieces" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Section name="Chunk size of zero" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + chunk2.size() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Chunking a generator into sized pieces" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Section name="Throws on too small generators" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE_THROWS_AS" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + chunk(2, value(1)), Catch::GeneratorException + </Original> + <Expanded> + chunk(2, value(1)), Catch::GeneratorException + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Generators -- simple" tags="[generators]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Section name="one" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + j < i + </Original> + <Expanded> + -3 < 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="one" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + j < i + </Original> + <Expanded> + -2 < 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="one" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + j < i + </Original> + <Expanded> + -1 < 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="two" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + 4u * i > str.size() + </Original> + <Expanded> + 4 > 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="two" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + 4u * i > str.size() + </Original> + <Expanded> + 4 > 2 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="two" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + 4u * i > str.size() + </Original> + <Expanded> + 4 > 3 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="one" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + j < i + </Original> + <Expanded> + -3 < 2 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="one" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + j < i + </Original> + <Expanded> + -2 < 2 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="one" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + j < i + </Original> + <Expanded> + -1 < 2 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="two" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + 4u * i > str.size() + </Original> + <Expanded> + 8 > 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="two" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + 4u * i > str.size() + </Original> + <Expanded> + 8 > 2 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="two" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + 4u * i > str.size() + </Original> + <Expanded> + 8 > 3 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="one" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + j < i + </Original> + <Expanded> + -3 < 3 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="one" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + j < i + </Original> + <Expanded> + -2 < 3 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="one" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + j < i + </Original> + <Expanded> + -1 < 3 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="two" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + 4u * i > str.size() + </Original> + <Expanded> + 12 > 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="two" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + 4u * i > str.size() + </Original> + <Expanded> + 12 > 2 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="two" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + 4u * i > str.size() + </Original> + <Expanded> + 12 > 3 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Generators internals" tags="[generators][internals]" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Single value" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 123 + </Original> + <Expanded> + 123 == 123 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + !(gen.next()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Preset values" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 3 + </Original> + <Expanded> + 3 == 3 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + !(gen.next()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <Section name="Generator combinator" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 2 + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 4 + </Original> + <Expanded> + 4 == 4 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + !(gen.next()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="10" failures="0" expectedFailures="0"/> + </Section> + <Section name="Explicitly typed generator sequence" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get().size() == 2 + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == "aa" + </Original> + <Expanded> + "aa" == "aa" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == "bb" + </Original> + <Expanded> + "bb" == "bb" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == "cc" + </Original> + <Expanded> + "cc" == "cc" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + !(gen.next()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="7" failures="0" expectedFailures="0"/> + </Section> + <Section name="Filter generator" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 3 + </Original> + <Expanded> + 3 == 3 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + !(gen.next()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THROWS_AS" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + filter([] (int) { return false; }, value(1)), Catch::GeneratorException + </Original> + <Expanded> + filter([] (int) { return false; }, value(1)), Catch::GeneratorException + </Expanded> + </Expression> + <OverallResults successes="5" failures="0" expectedFailures="0"/> + </Section> + <Section name="Take generator" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Take less" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 2 + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + !(gen.next()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="4" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="4" failures="0" expectedFailures="0"/> + </Section> + <Section name="Take generator" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Take more" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + !(gen.next()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Map with explicit return type" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 2.0 + </Original> + <Expanded> + 2.0 == 2.0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 4.0 + </Original> + <Expanded> + 4.0 == 4.0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 6.0 + </Original> + <Expanded> + 6.0 == 6.0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + !(gen.next()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <Section name="Map with deduced return type" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 2.0 + </Original> + <Expanded> + 2.0 == 2.0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 4.0 + </Original> + <Expanded> + 4.0 == 4.0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 6.0 + </Original> + <Expanded> + 6.0 == 6.0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + !(gen.next()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <Section name="Repeat" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Singular repeat" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 3 + </Original> + <Expanded> + 3 == 3 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + !(gen.next()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Repeat" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Actual repeat" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 2 + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 3 + </Original> + <Expanded> + 3 == 3 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 2 + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 3 + </Original> + <Expanded> + 3 == 3 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + !(gen.next()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="12" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="12" failures="0" expectedFailures="0"/> + </Section> + <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Positive auto step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Integer" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == -2 + </Original> + <Expanded> + -2 == -2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == -1 + </Original> + <Expanded> + -1 == -1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + !(gen.next()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="8" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="8" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="8" failures="0" expectedFailures="0"/> + </Section> + <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Negative auto step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Integer" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 2 + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == -1 + </Original> + <Expanded> + -1 == -1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + !(gen.next()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="8" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="8" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="8" failures="0" expectedFailures="0"/> + </Section> + <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Positive manual step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Integer" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Exact" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == -7 + </Original> + <Expanded> + -7 == -7 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == -4 + </Original> + <Expanded> + -4 == -4 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == -1 + </Original> + <Expanded> + -1 == -1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 2 + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + !(gen.next()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="8" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="8" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="8" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="8" failures="0" expectedFailures="0"/> + </Section> + <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Positive manual step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Integer" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Slightly over end" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == -7 + </Original> + <Expanded> + -7 == -7 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == -4 + </Original> + <Expanded> + -4 == -4 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == -1 + </Original> + <Expanded> + -1 == -1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 2 + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + !(gen.next()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="8" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="8" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="8" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="8" failures="0" expectedFailures="0"/> + </Section> + <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Positive manual step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Integer" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Slightly under end" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == -7 + </Original> + <Expanded> + -7 == -7 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == -4 + </Original> + <Expanded> + -4 == -4 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == -1 + </Original> + <Expanded> + -1 == -1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 2 + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + !(gen.next()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="10" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="10" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="10" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="10" failures="0" expectedFailures="0"/> + </Section> + <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Positive manual step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Floating Point" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Exact" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Info> + Current expected value is -1 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + -1.0 == Approx( -1.0 ) + </Expanded> + </Expression> + <Info> + Current expected value is -1 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + Current expected value is -0.9 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + -0.9 == Approx( -0.9 ) + </Expanded> + </Expression> + <Info> + Current expected value is -0.9 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + Current expected value is -0.8 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + -0.8 == Approx( -0.8 ) + </Expanded> + </Expression> + <Info> + Current expected value is -0.8 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + Current expected value is -0.7 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + -0.7 == Approx( -0.7 ) + </Expanded> + </Expression> + <Info> + Current expected value is -0.7 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + Current expected value is -0.6 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + -0.6 == Approx( -0.6 ) + </Expanded> + </Expression> + <Info> + Current expected value is -0.6 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + Current expected value is -0.5 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + -0.5 == Approx( -0.5 ) + </Expanded> + </Expression> + <Info> + Current expected value is -0.5 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + Current expected value is -0.4 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + -0.4 == Approx( -0.4 ) + </Expanded> + </Expression> + <Info> + Current expected value is -0.4 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + Current expected value is -0.3 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + -0.3 == Approx( -0.3 ) + </Expanded> + </Expression> + <Info> + Current expected value is -0.3 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + Current expected value is -0.2 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + -0.2 == Approx( -0.2 ) + </Expanded> + </Expression> + <Info> + Current expected value is -0.2 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + Current expected value is -0.1 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + -0.1 == Approx( -0.1 ) + </Expanded> + </Expression> + <Info> + Current expected value is -0.1 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + Current expected value is -1.38778e-16 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + -0.0 == Approx( -0.0 ) + </Expanded> + </Expression> + <Info> + Current expected value is -1.38778e-16 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + Current expected value is 0.1 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + 0.1 == Approx( 0.1 ) + </Expanded> + </Expression> + <Info> + Current expected value is 0.1 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + Current expected value is 0.2 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + 0.2 == Approx( 0.2 ) + </Expanded> + </Expression> + <Info> + Current expected value is 0.2 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + Current expected value is 0.3 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + 0.3 == Approx( 0.3 ) + </Expanded> + </Expression> + <Info> + Current expected value is 0.3 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + Current expected value is 0.4 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + 0.4 == Approx( 0.4 ) + </Expanded> + </Expression> + <Info> + Current expected value is 0.4 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + Current expected value is 0.5 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + 0.5 == Approx( 0.5 ) + </Expanded> + </Expression> + <Info> + Current expected value is 0.5 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + Current expected value is 0.6 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + 0.6 == Approx( 0.6 ) + </Expanded> + </Expression> + <Info> + Current expected value is 0.6 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + Current expected value is 0.7 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + 0.7 == Approx( 0.7 ) + </Expanded> + </Expression> + <Info> + Current expected value is 0.7 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + Current expected value is 0.8 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + 0.8 == Approx( 0.8 ) + </Expanded> + </Expression> + <Info> + Current expected value is 0.8 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + Current expected value is 0.9 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + 0.9 == Approx( 0.9 ) + </Expanded> + </Expression> + <Info> + Current expected value is 0.9 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx( rangeEnd ) + </Original> + <Expanded> + 1.0 == Approx( 1.0 ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + !(gen.next()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="42" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="42" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="42" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="42" failures="0" expectedFailures="0"/> + </Section> + <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Positive manual step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Floating Point" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Slightly over end" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Info> + Current expected value is -1 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + -1.0 == Approx( -1.0 ) + </Expanded> + </Expression> + <Info> + Current expected value is -1 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + Current expected value is -0.7 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + -0.7 == Approx( -0.7 ) + </Expanded> + </Expression> + <Info> + Current expected value is -0.7 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + Current expected value is -0.4 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + -0.4 == Approx( -0.4 ) + </Expanded> + </Expression> + <Info> + Current expected value is -0.4 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + Current expected value is -0.1 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + -0.1 == Approx( -0.1 ) + </Expanded> + </Expression> + <Info> + Current expected value is -0.1 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + Current expected value is 0.2 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + 0.2 == Approx( 0.2 ) + </Expanded> + </Expression> + <Info> + Current expected value is 0.2 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + Current expected value is 0.5 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + 0.5 == Approx( 0.5 ) + </Expanded> + </Expression> + <Info> + Current expected value is 0.5 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + !(gen.next()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="13" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="13" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="13" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="13" failures="0" expectedFailures="0"/> + </Section> + <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Positive manual step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Floating Point" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Slightly under end" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Info> + Current expected value is -1 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + -1.0 == Approx( -1.0 ) + </Expanded> + </Expression> + <Info> + Current expected value is -1 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + Current expected value is -0.7 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + -0.7 == Approx( -0.7 ) + </Expanded> + </Expression> + <Info> + Current expected value is -0.7 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + Current expected value is -0.4 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + -0.4 == Approx( -0.4 ) + </Expanded> + </Expression> + <Info> + Current expected value is -0.4 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + Current expected value is -0.1 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + -0.1 == Approx( -0.1 ) + </Expanded> + </Expression> + <Info> + Current expected value is -0.1 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + Current expected value is 0.2 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + 0.2 == Approx( 0.2 ) + </Expanded> + </Expression> + <Info> + Current expected value is 0.2 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + Current expected value is 0.5 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == Approx(expected) + </Original> + <Expanded> + 0.5 == Approx( 0.5 ) + </Expanded> + </Expression> + <Info> + Current expected value is 0.5 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + !(gen.next()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="13" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="13" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="13" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="13" failures="0" expectedFailures="0"/> + </Section> + <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Negative manual step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Integer" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Exact" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 2 + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == -1 + </Original> + <Expanded> + -1 == -1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == -4 + </Original> + <Expanded> + -4 == -4 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + !(gen.next()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="8" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="8" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="8" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="8" failures="0" expectedFailures="0"/> + </Section> + <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Negative manual step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Integer" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Slightly over end" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 2 + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == -1 + </Original> + <Expanded> + -1 == -1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == -4 + </Original> + <Expanded> + -4 == -4 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + !(gen.next()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="8" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="8" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="8" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="8" failures="0" expectedFailures="0"/> + </Section> + <Section name="Range" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Negative manual step" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Integer" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="Slightly under end" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == 2 + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == -1 + </Original> + <Expanded> + -1 == -1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == -4 + </Original> + <Expanded> + -4 == -4 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.next() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + gen.get() == -7 + </Original> + <Expanded> + -7 == -7 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + !(gen.next()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="10" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="10" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="10" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="10" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Greater-than inequalities with different epsilons" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Info> + this message should be logged + </Info> + <Info> + so should this + </Info> + <Expression success="false" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Info> + this message may be logged later + </Info> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<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="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Info> + current counter 0 + </Info> + <Info> + i := 0 + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.int_seven != 7 + </Original> + <Expanded> + 7 != 7 + </Expanded> + </Expression> + <Expression success="false" type="CHECK" filename="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.str_hello != "hello" + </Original> + <Expanded> + "hello" != "hello" + </Expanded> + </Expression> + <Expression success="false" type="CHECK" filename="tests/<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="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.int_seven != 6 + </Original> + <Expanded> + 7 != 6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.int_seven != 8 + </Original> + <Expanded> + 7 != 8 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.str_hello != "goodbye" + </Original> + <Expanded> + "hello" != "goodbye" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.str_hello != "hell" + </Original> + <Expanded> + "hello" != "hell" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.str_hello != "hello1" + </Original> + <Expanded> + "hello" != "hello1" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.str_hello.size() != 6 + </Original> + <Expanded> + 5 != 6 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Lambdas in assertions" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <Original> + []() { return true; }() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Less-than inequalities with different epsilons" tags="[Approx]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<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="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<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="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="false" type="CHECK_THAT" filename="tests/<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="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<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="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="false" type="CHECK_THAT" filename="tests/<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="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Expression success="true" type="REQUIRE_THROWS_WITH" filename="tests/<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="tests/<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="Nested generators and captured variables" tags="[generators]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + values > -6 + </Original> + <Expanded> + 3 > -6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + values > -6 + </Original> + <Expanded> + 4 > -6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + values > -6 + </Original> + <Expanded> + 5 > -6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + values > -6 + </Original> + <Expanded> + 6 > -6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + values > -6 + </Original> + <Expanded> + -5 > -6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + values > -6 + </Original> + <Expanded> + -4 > -6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + values > -6 + </Original> + <Expanded> + 90 > -6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + values > -6 + </Original> + <Expanded> + 91 > -6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + values > -6 + </Original> + <Expanded> + 92 > -6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + values > -6 + </Original> + <Expanded> + 93 > -6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + values > -6 + </Original> + <Expanded> + 94 > -6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + values > -6 + </Original> + <Expanded> + 95 > -6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + values > -6 + </Original> + <Expanded> + 96 > -6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + values > -6 + </Original> + <Expanded> + 97 > -6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + values > -6 + </Original> + <Expanded> + 98 > -6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + values > -6 + </Original> + <Expanded> + 99 > -6 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Nice descriptive name" tags="[.][tag1][tag2][tag3]" filename="tests/<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="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Exception filename="tests/<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="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Original> + True + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Original> + !False + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Original> + !(False) + </Original> + <Expanded> + !{?} + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Optionally static assertions" tags="[compilation]" filename="tests/<exe-name>/UsageTests/Compilation.tests.cpp" > + <OverallResult success="true"/> + </TestCase> + <TestCase name="Ordering comparison checks that should fail" tags="[.][failing]" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.int_seven > 7 + </Original> + <Expanded> + 7 > 7 + </Expanded> + </Expression> + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.int_seven < 7 + </Original> + <Expanded> + 7 < 7 + </Expanded> + </Expression> + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.int_seven > 8 + </Original> + <Expanded> + 7 > 8 + </Expanded> + </Expression> + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.int_seven < 6 + </Original> + <Expanded> + 7 < 6 + </Expanded> + </Expression> + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.int_seven < 0 + </Original> + <Expanded> + 7 < 0 + </Expanded> + </Expression> + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.int_seven < -1 + </Original> + <Expanded> + 7 < -1 + </Expanded> + </Expression> + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.int_seven >= 8 + </Original> + <Expanded> + 7 >= 8 + </Expanded> + </Expression> + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.int_seven <= 6 + </Original> + <Expanded> + 7 <= 6 + </Expanded> + </Expression> + <Expression success="false" type="CHECK" filename="tests/<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="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.str_hello > "hello" + </Original> + <Expanded> + "hello" > "hello" + </Expanded> + </Expression> + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.str_hello < "hello" + </Original> + <Expanded> + "hello" < "hello" + </Expanded> + </Expression> + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.str_hello > "hellp" + </Original> + <Expanded> + "hello" > "hellp" + </Expanded> + </Expression> + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.str_hello > "z" + </Original> + <Expanded> + "hello" > "z" + </Expanded> + </Expression> + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.str_hello < "hellm" + </Original> + <Expanded> + "hello" < "hellm" + </Expanded> + </Expression> + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.str_hello < "a" + </Original> + <Expanded> + "hello" < "a" + </Expanded> + </Expression> + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.str_hello >= "z" + </Original> + <Expanded> + "hello" >= "z" + </Expanded> + </Expression> + <Expression success="false" type="CHECK" filename="tests/<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="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.int_seven < 8 + </Original> + <Expanded> + 7 < 8 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.int_seven > 6 + </Original> + <Expanded> + 7 > 6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.int_seven > 0 + </Original> + <Expanded> + 7 > 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.int_seven > -1 + </Original> + <Expanded> + 7 > -1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.int_seven >= 7 + </Original> + <Expanded> + 7 >= 7 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.int_seven >= 6 + </Original> + <Expanded> + 7 >= 6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.int_seven <= 7 + </Original> + <Expanded> + 7 <= 7 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.int_seven <= 8 + </Original> + <Expanded> + 7 <= 8 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.str_hello <= "hello" + </Original> + <Expanded> + "hello" <= "hello" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.str_hello >= "hello" + </Original> + <Expanded> + "hello" >= "hello" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.str_hello < "hellp" + </Original> + <Expanded> + "hello" < "hellp" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.str_hello < "zebra" + </Original> + <Expanded> + "hello" < "zebra" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.str_hello > "hellm" + </Original> + <Expanded> + "hello" > "hellm" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + data.str_hello > "a" + </Original> + <Expanded> + "hello" > "a" + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Our PCG implementation provides expected results for known seeds" tags="[rng]" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Section name="Default seeded" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Original> + rng() == 0x<hex digits> + </Original> + <Expanded> + 4242248763 (0x<hex digits>) +== +4242248763 (0x<hex digits>) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Original> + rng() == 0x<hex digits> + </Original> + <Expanded> + 1867888929 (0x<hex digits>) +== +1867888929 (0x<hex digits>) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Original> + rng() == 0x<hex digits> + </Original> + <Expanded> + 1276619030 (0x<hex digits>) +== +1276619030 (0x<hex digits>) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Original> + rng() == 0x<hex digits> + </Original> + <Expanded> + 1911218783 (0x<hex digits>) +== +1911218783 (0x<hex digits>) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Original> + rng() == 0x<hex digits> + </Original> + <Expanded> + 1827115164 (0x<hex digits>) +== +1827115164 (0x<hex digits>) + </Expanded> + </Expression> + <OverallResults successes="5" failures="0" expectedFailures="0"/> + </Section> + <Section name="Specific seed" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Original> + rng() == 0x<hex digits> + </Original> + <Expanded> + 1472234645 (0x<hex digits>) +== +1472234645 (0x<hex digits>) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Original> + rng() == 0x<hex digits> + </Original> + <Expanded> + 868832940 (0x<hex digits>) +== +868832940 (0x<hex digits>) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Original> + rng() == 0x<hex digits> + </Original> + <Expanded> + 570883446 (0x<hex digits>) +== +570883446 (0x<hex digits>) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Original> + rng() == 0x<hex digits> + </Original> + <Expanded> + 889299803 (0x<hex digits>) +== +889299803 (0x<hex digits>) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Original> + rng() == 0x<hex digits> + </Original> + <Expanded> + 4261393167 (0x<hex digits>) +== +4261393167 (0x<hex digits>) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Original> + rng() == 0x<hex digits> + </Original> + <Expanded> + 1472234645 (0x<hex digits>) +== +1472234645 (0x<hex digits>) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Original> + rng() == 0x<hex digits> + </Original> + <Expanded> + 868832940 (0x<hex digits>) +== +868832940 (0x<hex digits>) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Original> + rng() == 0x<hex digits> + </Original> + <Expanded> + 570883446 (0x<hex digits>) +== +570883446 (0x<hex digits>) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Original> + rng() == 0x<hex digits> + </Original> + <Expanded> + 889299803 (0x<hex digits>) +== +889299803 (0x<hex digits>) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/RandomNumberGeneration.tests.cpp" > + <Original> + rng() == 0x<hex digits> + </Original> + <Expanded> + 4261393167 (0x<hex digits>) +== +4261393167 (0x<hex digits>) + </Expanded> + </Expression> + <OverallResults successes="10" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Output from all sections is reported" tags="[.][failing][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Section name="one" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Failure filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + Message from section one + </Failure> + <OverallResults successes="0" failures="1" expectedFailures="0"/> + </Section> + <Section name="two" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Failure filename="tests/<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="Overloaded comma or address-of operators are not used" tags="[matchers][templated]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THROWS_AS" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + (EvilMatcher(), EvilMatcher()), EvilCommaOperatorUsed + </Original> + <Expanded> + (EvilMatcher(), EvilMatcher()), EvilCommaOperatorUsed + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THROWS_AS" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + &EvilMatcher(), EvilAddressOfOperatorUsed + </Original> + <Expanded> + &EvilMatcher(), EvilAddressOfOperatorUsed + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + EvilMatcher() || (EvilMatcher() && !EvilMatcher()) + </Original> + <Expanded> + EvilMatcher() || (EvilMatcher() && !EvilMatcher()) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + (EvilMatcher() && EvilMatcher()) || !EvilMatcher() + </Original> + <Expanded> + (EvilMatcher() && EvilMatcher()) || !EvilMatcher() + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Parse test names and tags" tags="[command-line][test-spec]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="Empty test spec should have no filters" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcB ) == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcB ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcC ) == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcD ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcB ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcC ) == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcD ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcB ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcC ) == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcD ) == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcB ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcC ) == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcB ) == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcC ) == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcB ) == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcB ) == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcB ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcB ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcB ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcC ) == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcB ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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 tag inclusion" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcB ) == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcB ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcC ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcB ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcC ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcB ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcC ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcB ) == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcC ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcB ) == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcC ) == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcB ) == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcC ) == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcB ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcC ) == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcB ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcC ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcB ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcC ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.hasFilters() == true + </Original> + <Expanded> + true == true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcA ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcB ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *tcC ) == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="Leading and trailing spaces in test spec" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *fakeTestCase( " aardvark " ) ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *fakeTestCase( " aardvark" ) ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *fakeTestCase( " aardvark " ) ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *fakeTestCase( "aardvark " ) ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *fakeTestCase( "aardvark" ) ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResults successes="5" failures="0" expectedFailures="0"/> + </Section> + <Section name="Leading and trailing spaces in test name" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *fakeTestCase( " aardvark " ) ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *fakeTestCase( " aardvark" ) ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *fakeTestCase( " aardvark " ) ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *fakeTestCase( "aardvark " ) ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches( *fakeTestCase( "aardvark" ) ) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResults successes="5" failures="0" expectedFailures="0"/> + </Section> + <Section name="Shortened hide tags are split apart when parsing" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches(*fakeTestCase("hidden and foo", "[.][foo]")) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + !(spec.matches(*fakeTestCase("only foo", "[foo]"))) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Shortened hide tags also properly handle exclusion" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + !(spec.matches(*fakeTestCase("hidden and foo", "[.][foo]"))) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + !(spec.matches(*fakeTestCase("only foo", "[foo]"))) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + !(spec.matches(*fakeTestCase("only hidden", "[.]"))) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + spec.matches(*fakeTestCase("neither foo nor hidden", "[bar]")) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResults successes="4" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Pointers can be compared to null" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + p == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + p == pNULL + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + p != 0 + </Original> + <Expanded> + 0x<hex digits> != 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + cp != 0 + </Original> + <Expanded> + 0x<hex digits> != 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + cpc != 0 + </Original> + <Expanded> + 0x<hex digits> != 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + returnsNull() == 0 + </Original> + <Expanded> + {null string} == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + returnsConstNull() == 0 + </Original> + <Expanded> + {null string} == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + 0 != p + </Original> + <Expanded> + 0 != 0x<hex digits> + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Precision of floating point stringification can be set" tags="[floatingPoint][toString]" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Section name="Floats" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Original> + str1.size() == 3 + 5 + </Original> + <Expanded> + 8 == 8 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Original> + str2.size() == 3 + 10 + </Original> + <Expanded> + 13 == 13 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Double" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Original> + str1.size() == 2 + 5 + </Original> + <Expanded> + 7 == 7 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Original> + str2.size() == 2 + 15 + </Original> + <Expanded> + 17 == 17 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Predicate matcher can accept const char*" tags="[compilation][matchers]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + "foo", Predicate<const char*>([] (const char* const&) { return true; }) + </Original> + <Expanded> + "foo" matches undescribed predicate + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Process can be configured on command line" tags="[command-line][config]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="empty args don't cause a crash" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + result + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + result + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.processName == "test" + </Original> + <Expanded> + "test" == "test" + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.shouldDebugBreak == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.abortAfter == -1 + </Original> + <Expanded> + -1 == -1 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.noThrow == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.reporterName == "console" + </Original> + <Expanded> + "console" == "console" + </Expanded> + </Expression> + <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + !(cfg.hasTestFilters()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="7" failures="0" expectedFailures="0"/> + </Section> + <Section name="test lists" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="Specify one test case using" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + result + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cfg.hasTestFilters() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cfg.testSpec().matches(*fakeTestCase("test1")) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResults successes="4" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="4" failures="0" expectedFailures="0"/> + </Section> + <Section name="test lists" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="Specify one test case exclusion using exclude:" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + result + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cfg.hasTestFilters() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cfg.testSpec().matches(*fakeTestCase("alwaysIncluded")) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResults successes="4" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="4" failures="0" expectedFailures="0"/> + </Section> + <Section name="test lists" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="Specify one test case exclusion using ~" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + result + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cfg.hasTestFilters() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cfg.testSpec().matches(*fakeTestCase("alwaysIncluded")) + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResults successes="4" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="4" failures="0" expectedFailures="0"/> + </Section> + <Section name="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="-r/console" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse({"test", "-r", "console"}) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.reporterName == "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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="-r/xml" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse({"test", "-r", "xml"}) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.reporterName == "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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="--reporter/junit" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse({"test", "--reporter", "junit"}) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.reporterName == "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="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="Only one reporter is accepted" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + !(cli.parse({ "test", "-r", "xml", "-r", "junit" })) + </Original> + <Expanded> + !{?} + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="reporter" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="must match one of the available ones" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + !result + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + result.errorMessage(), Contains("Unrecognized reporter") + </Original> + <Expanded> + "Unrecognized reporter, 'unsupported'. Check available with --list-reporters" contains: "Unrecognized reporter" + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="debugger" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="-b" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse({"test", "-b"}) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="--break" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse({"test", "--break"}) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="-a aborts after first failure" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse({"test", "-a"}) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="-x 2 aborts after two failures" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse({"test", "-x", "2"}) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="-x must be numeric" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + !result + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<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="abort" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="wait-for-keypress" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="Accepted options" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.waitForKeypress == std::get<1>(input) + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="abort" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="wait-for-keypress" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="Accepted options" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.waitForKeypress == std::get<1>(input) + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="abort" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="wait-for-keypress" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="Accepted options" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.waitForKeypress == std::get<1>(input) + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="abort" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="wait-for-keypress" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="Accepted options" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.waitForKeypress == std::get<1>(input) + </Original> + <Expanded> + 3 == 3 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="abort" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="wait-for-keypress" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="invalid options are reported" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + !result + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + result.errorMessage(), Contains("never") && Contains("both") + </Original> + <Expanded> + "keypress argument must be one of: never, start, exit or both. 'sometimes' not recognised" ( contains: "never" and contains: "both" ) + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="nothrow" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="-e" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse({"test", "-e"}) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="--nothrow" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse({"test", "--nothrow"}) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="-o filename" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse({"test", "-o", "filename.ext"}) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="--out" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse({"test", "--out", "filename.ext"}) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="Single character flags can be combined" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse({"test", "-abe"}) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.abortAfter == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.shouldDebugBreak + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="without option" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse({"test"}) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="auto" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse({"test", "--use-colour", "auto"}) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="yes" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse({"test", "--use-colour", "yes"}) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="no" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse({"test", "--use-colour", "no"}) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="error" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + !result + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<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> + <Section name="Benchmark options" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="samples" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse({ "test", "--benchmark-samples=200" }) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.benchmarkSamples == 200 + </Original> + <Expanded> + 200 == 200 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Benchmark options" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="resamples" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse({ "test", "--benchmark-resamples=20000" }) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.benchmarkResamples == 20000 + </Original> + <Expanded> + 20000 (0x<hex digits>) == 20000 (0x<hex digits>) + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Benchmark options" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="confidence-interval" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse({ "test", "--benchmark-confidence-interval=0.99" }) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.benchmarkConfidenceInterval == Catch::Approx(0.99) + </Original> + <Expanded> + 0.99 == Approx( 0.99 ) + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Benchmark options" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="no-analysis" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse({ "test", "--benchmark-no-analysis" }) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.benchmarkNoAnalysis + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Benchmark options" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="warmup-time" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse({ "test", "--benchmark-warmup-time=10" }) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.benchmarkWarmupTime == 10 + </Original> + <Expanded> + 10 == 10 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Product with differing arities - std::tuple<int, double, float>" tags="[product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + std::tuple_size<TestType>::value >= 1 + </Original> + <Expanded> + 3 >= 1 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Product with differing arities - std::tuple<int, double>" tags="[product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + std::tuple_size<TestType>::value >= 1 + </Original> + <Expanded> + 2 >= 1 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Product with differing arities - std::tuple<int>" tags="[product][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + std::tuple_size<TestType>::value >= 1 + </Original> + <Expanded> + 1 >= 1 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Range type with sentinel" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > + <Original> + Catch::Detail::stringify(UsesSentinel{}) == "{ }" + </Original> + <Expanded> + "{ }" == "{ }" + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Reconstruction should be based on stringification: #914" tags="[.][Decomposition][failing]" filename="tests/<exe-name>/UsageTests/Decomposition.tests.cpp" > + <Expression success="false" type="CHECK" filename="tests/<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="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="false" type="CHECK_THAT" filename="tests/<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="tests/<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="tests/<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="Regression test #1" tags="[matchers][vector]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + actual, !UnorderedEquals(expected) + </Original> + <Expanded> + { 'a', 'b' } not UnorderedEquals: { 'c', 'b' } + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Reporter's write listings to provided stream" tags="[reporters]" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + !(factories.empty()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Section name="automake reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Info> + Tested reporter: automake + </Info> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + listingString, Contains("fakeTag"s) + </Original> + <Expanded> + "All available tags: + 1 [fakeTag] +1 tag + +" contains: "fakeTag" + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + !(factories.empty()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Section name="automake reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Info> + Tested reporter: automake + </Info> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + listingString, Contains("fake reporter"s) + </Original> + <Expanded> + "Available reporters: + fake reporter: fake description + +" contains: "fake reporter" + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + !(factories.empty()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Section name="automake reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Info> + Tested reporter: automake + </Info> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) + </Original> + <Expanded> + "All available test cases: + fake test name + [fakeTestTag] +1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + !(factories.empty()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Section name="compact reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Info> + Tested reporter: compact + </Info> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + listingString, Contains("fakeTag"s) + </Original> + <Expanded> + "All available tags: + 1 [fakeTag] +1 tag + +" contains: "fakeTag" + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + !(factories.empty()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Section name="compact reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Info> + Tested reporter: compact + </Info> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + listingString, Contains("fake reporter"s) + </Original> + <Expanded> + "Available reporters: + fake reporter: fake description + +" contains: "fake reporter" + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + !(factories.empty()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Section name="compact reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Info> + Tested reporter: compact + </Info> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) + </Original> + <Expanded> + "All available test cases: + fake test name + [fakeTestTag] +1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + !(factories.empty()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Section name="console reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Info> + Tested reporter: console + </Info> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + listingString, Contains("fakeTag"s) + </Original> + <Expanded> + "All available tags: + 1 [fakeTag] +1 tag + +" contains: "fakeTag" + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + !(factories.empty()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Section name="console reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Info> + Tested reporter: console + </Info> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + listingString, Contains("fake reporter"s) + </Original> + <Expanded> + "Available reporters: + fake reporter: fake description + +" contains: "fake reporter" + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + !(factories.empty()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Section name="console reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Info> + Tested reporter: console + </Info> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) + </Original> + <Expanded> + "All available test cases: + fake test name + [fakeTestTag] +1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + !(factories.empty()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Section name="junit reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Info> + Tested reporter: junit + </Info> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + listingString, Contains("fakeTag"s) + </Original> + <Expanded> + "<?xml version="1.0" encoding="UTF-8"?> +All available tags: + 1 [fakeTag] +1 tag + +" contains: "fakeTag" + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + !(factories.empty()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Section name="junit reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Info> + Tested reporter: junit + </Info> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + listingString, Contains("fake reporter"s) + </Original> + <Expanded> + "<?xml version="1.0" encoding="UTF-8"?> +Available reporters: + fake reporter: fake description + +" contains: "fake reporter" + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + !(factories.empty()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Section name="junit reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Info> + Tested reporter: junit + </Info> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) + </Original> + <Expanded> + "<?xml version="1.0" encoding="UTF-8"?> +All available test cases: + fake test name + [fakeTestTag] +1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + !(factories.empty()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Section name="sonarqube reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Info> + Tested reporter: sonarqube + </Info> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + listingString, Contains("fakeTag"s) + </Original> + <Expanded> + "<?xml version="1.0" encoding="UTF-8"?> +All available tags: + 1 [fakeTag] +1 tag + +" contains: "fakeTag" + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + !(factories.empty()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Section name="sonarqube reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Info> + Tested reporter: sonarqube + </Info> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + listingString, Contains("fake reporter"s) + </Original> + <Expanded> + "<?xml version="1.0" encoding="UTF-8"?> +Available reporters: + fake reporter: fake description + +" contains: "fake reporter" + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + !(factories.empty()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Section name="sonarqube reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Info> + Tested reporter: sonarqube + </Info> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) + </Original> + <Expanded> + "<?xml version="1.0" encoding="UTF-8"?> +All available test cases: + fake test name + [fakeTestTag] +1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + !(factories.empty()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Section name="tap reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Info> + Tested reporter: tap + </Info> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + listingString, Contains("fakeTag"s) + </Original> + <Expanded> + "All available tags: + 1 [fakeTag] +1 tag + +" contains: "fakeTag" + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + !(factories.empty()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Section name="tap reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Info> + Tested reporter: tap + </Info> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + listingString, Contains("fake reporter"s) + </Original> + <Expanded> + "Available reporters: + fake reporter: fake description + +" contains: "fake reporter" + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + !(factories.empty()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Section name="tap reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Info> + Tested reporter: tap + </Info> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) + </Original> + <Expanded> + "All available test cases: + fake test name + [fakeTestTag] +1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + !(factories.empty()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Section name="teamcity reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Info> + Tested reporter: teamcity + </Info> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + listingString, Contains("fakeTag"s) + </Original> + <Expanded> + "All available tags: + 1 [fakeTag] +1 tag + +" contains: "fakeTag" + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + !(factories.empty()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Section name="teamcity reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Info> + Tested reporter: teamcity + </Info> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + listingString, Contains("fake reporter"s) + </Original> + <Expanded> + "Available reporters: + fake reporter: fake description + +" contains: "fake reporter" + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + !(factories.empty()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Section name="teamcity reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Info> + Tested reporter: teamcity + </Info> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) + </Original> + <Expanded> + "All available test cases: + fake test name + [fakeTestTag] +1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + !(factories.empty()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Section name="xml reporter lists tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Info> + Tested reporter: xml + </Info> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + listingString, Contains("fakeTag"s) + </Original> + <Expanded> + "<?xml version="1.0" encoding="UTF-8"?> +<TagsFromMatchingTests> + <Tag> + <Count>1</Count> + <Aliases> + <Alias>fakeTag</Alias> + </Aliases> + </Tag> +</TagsFromMatchingTests>" contains: "fakeTag" + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + !(factories.empty()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Section name="xml reporter lists reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Info> + Tested reporter: xml + </Info> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + listingString, Contains("fake reporter"s) + </Original> + <Expanded> + "<?xml version="1.0" encoding="UTF-8"?> +<AvailableReporters> + <Reporter> + <Name>fake reporter</Name> + <Description>fake description</Description> + </Reporter> +</AvailableReporters>" contains: "fake reporter" + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + !(factories.empty()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Section name="xml reporter lists tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Info> + Tested reporter: xml + </Info> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) + </Original> + <Expanded> + "<?xml version="1.0" encoding="UTF-8"?> +<MatchingTests> + <TestCase> + <Name>fake test name</Name> + <ClassName/> + <Tags>[fakeTestTag]</Tags> + <SourceInfo> + <File>fake-file.cpp</File> + <Line>123456789</Line> + </SourceInfo> + </TestCase> +</MatchingTests>" ( contains: "fake test name" and contains: "fakeTestTag" ) + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="SUCCEED counts as a test pass" tags="[messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <OverallResult success="true"/> + </TestCase> + <TestCase name="SUCCEED does not require an argument" tags="[.][messages]" filename="tests/<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="tests/<exe-name>/UsageTests/BDD.tests.cpp" > + <Section name="Given: No operations precede me" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > + <Original> + before == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Section name="When: We get the count" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > + <Section name="Then: Subsequently values are higher" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/BDD.tests.cpp" > + <Section name="Given: This stuff exists" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > + <Section name="And given: And some assumption" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > + <Section name="When: I do this" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > + <Section name="Then: it should do this" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > + <Original> + itDoesThis() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Section name="And: do that" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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> + <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="tests/<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="tests/<exe-name>/UsageTests/BDD.tests.cpp" > + <Section name="When: The test headers are printed as part of the normal running of the scenario" filename="tests/<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="tests/<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="tests/<exe-name>/UsageTests/BDD.tests.cpp" > + <Section name="Given: an empty vector" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > + <Original> + v.size() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Section name="When: it is made larger" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > + <Section name="Then: the size and capacity go up" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > + <Original> + v.size() == 10 + </Original> + <Expanded> + 10 == 10 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/BDD.tests.cpp" > + <Section name="Then: the size goes down but the capacity stays the same" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/BDD.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > + <Original> + v.size() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Section name="When: we reserve more space" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > + <Section name="Then: The capacity is increased but the size remains the same" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/BDD.tests.cpp" > + <Original> + v.capacity() >= 10 + </Original> + <Expanded> + 10 >= 10 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Approx.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Approx.tests.cpp" > + <Original> + d == 1.23_a + </Original> + <Expanded> + 1.23 == Approx( 1.23 ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > + <Original> + d != 1.22_a + </Original> + <Expanded> + 1.23 != Approx( 1.22 ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Approx.tests.cpp" > + <Original> + Approx( d ) != 1.24 + </Original> + <Expanded> + Approx( 1.23 ) != 1.24 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Standard output from all sections is reported" tags="[.][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Section name="one" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <OverallResults successes="0" failures="1" expectedFailures="0"/> + </Section> + <Section name="two" filename="tests/<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="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="false" type="CHECK_THAT" filename="tests/<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="tests/<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="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Section name="Single item" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="[StringRef][Strings]" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Section name="Empty string" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + empty.empty() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + empty.size() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + empty.isNullTerminated() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + std::strcmp( empty.c_str(), "" ) == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResults successes="4" failures="0" expectedFailures="0"/> + </Section> + <Section name="From string literal" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + s.empty() == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + s.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + s.isNullTerminated() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + std::strcmp( rawChars, "hello" ) == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + s.c_str() + </Original> + <Expanded> + s.c_str() + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + s.c_str() == rawChars + </Original> + <Expanded> + "hello" == "hello" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + s.data() == rawChars + </Original> + <Expanded> + "hello" == "hello" + </Expanded> + </Expression> + <OverallResults successes="7" failures="0" expectedFailures="0"/> + </Section> + <Section name="From sub-string" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + original == "original" + </Original> + <Expanded> + original == "original" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + !(original.isNullTerminated()) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + original.c_str() + </Original> + <Expanded> + original.c_str() + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + original.data() + </Original> + <Expanded> + original.data() + </Expanded> + </Expression> + <OverallResults successes="4" failures="0" expectedFailures="0"/> + </Section> + <Section name="Substrings" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Section name="zero-based substring" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + ss.empty() == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + ss.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + std::strncmp( ss.data(), "hello", 5 ) == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Section name="non-zero-based substring" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + ss.size() == 6 + </Original> + <Expanded> + 6 == 6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Section name="Pointer values of full refs should match" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + s.data() == s2.data() + </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="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Section name="Pointer values of substring refs should also match" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + s.data() == ss.data() + </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="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Section name="Past the end substring" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + s.substr(s.size() + 1, 123).empty() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Substrings" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Section name="Substring off the end are trimmed" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + std::strcmp(ss.c_str(), "world!") == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Substrings" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Section name="substring start after the end is empty" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + s.substr(1'000'000, 1).empty() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Comparisons are deep" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + reinterpret_cast<char*>(buffer1) != reinterpret_cast<char*>(buffer2) + </Original> + <Expanded> + "Hello" != "Hello" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + left == right + </Original> + <Expanded> + Hello == Hello + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + left != left.substr(0, 3) + </Original> + <Expanded> + Hello != Hel + </Expanded> + </Expression> + <OverallResults successes="3" failures="0" expectedFailures="0"/> + </Section> + <Section name="from std::string" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Section name="implicitly constructed" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<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="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Section name="explicitly constructed" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<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="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Section name="assigned" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<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="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Section name="explicitly constructed" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + stdStr == "a stringref" + </Original> + <Expanded> + "a stringref" == "a stringref" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Section name="assigned" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + stdStr == "a stringref" + </Original> + <Expanded> + "a stringref" == "a stringref" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="std::string += StringRef" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + lhs == "some string += the stringref contents" + </Original> + <Expanded> + "some string += the stringref contents" +== +"some string += the stringref contents" + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="StringRef + StringRef" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Original> + together == "abrakadabra" + </Original> + <Expanded> + "abrakadabra" == "abrakadabra" + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="StringRef at compilation time" tags="[constexpr][StringRef][Strings]" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <Section name="Simple constructors" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <OverallResults successes="15" failures="0" expectedFailures="0"/> + </Section> + <Section name="UDL construction" filename="tests/<exe-name>/IntrospectiveTests/String.tests.cpp" > + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Stringifying std::chrono::duration helpers" tags="[chrono][toString]" filename="tests/<exe-name>/UsageTests/ToStringChrono.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringChrono.tests.cpp" > + <Original> + minute == seconds + </Original> + <Expanded> + 1 m == 60 s + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringChrono.tests.cpp" > + <Original> + hour != seconds + </Original> + <Expanded> + 1 h != 60 s + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringChrono.tests.cpp" > + <Original> + micro != milli + </Original> + <Expanded> + 1 us != 1 ms + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/ToStringChrono.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<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="tests/<exe-name>/UsageTests/ToStringChrono.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="false" type="CHECK" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Section name="The same tag alias can only be registered once" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/IntrospectiveTests/Tag.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="tests/<exe-name>/IntrospectiveTests/Tag.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="tests/<exe-name>/IntrospectiveTests/Tag.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="tests/<exe-name>/IntrospectiveTests/Tag.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="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Expression success="true" type="CHECK_THROWS" filename="tests/<exe-name>/IntrospectiveTests/Tag.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="tests/<exe-name>/IntrospectiveTests/Tag.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="tests/<exe-name>/IntrospectiveTests/Tag.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="tests/<exe-name>/IntrospectiveTests/Tag.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="Template test case method with test types specified inside std::tuple - MyTypes - 0" tags="[class][list][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Template_Fixture<TestType>::m_a == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Template test case method with test types specified inside std::tuple - MyTypes - 1" tags="[class][list][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Template_Fixture<TestType>::m_a == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Template test case method with test types specified inside std::tuple - MyTypes - 2" tags="[class][list][template]" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Class.tests.cpp" > + <Original> + Template_Fixture<TestType>::m_a == 1 + </Original> + <Expanded> + 1.0 == 1 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Template test case with test types specified inside non-copyable and non-movable std::tuple - NonCopyableAndNonMovableTypes - 0" tags="[list][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + sizeof(TestType) > 0 + </Original> + <Expanded> + 1 > 0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Template test case with test types specified inside non-copyable and non-movable std::tuple - NonCopyableAndNonMovableTypes - 1" tags="[list][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + sizeof(TestType) > 0 + </Original> + <Expanded> + 4 > 0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Template test case with test types specified inside non-default-constructible std::tuple - MyNonDefaultConstructibleTypes - 0" tags="[list][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + sizeof(TestType) > 0 + </Original> + <Expanded> + 1 > 0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Template test case with test types specified inside non-default-constructible std::tuple - MyNonDefaultConstructibleTypes - 1" tags="[list][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + sizeof(TestType) > 0 + </Original> + <Expanded> + 4 > 0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Template test case with test types specified inside std::tuple - MyTypes - 0" tags="[list][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + sizeof(TestType) > 0 + </Original> + <Expanded> + 4 > 0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Template test case with test types specified inside std::tuple - MyTypes - 1" tags="[list][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + sizeof(TestType) > 0 + </Original> + <Expanded> + 1 > 0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Template test case with test types specified inside std::tuple - MyTypes - 2" tags="[list][template]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + sizeof(TestType) > 0 + </Original> + <Expanded> + 4 > 0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="TemplateTest: vectors can be sized and resized - float" tags="[template][vector]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 10 + </Original> + <Expanded> + 10 == 10 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="TemplateTest: vectors can be sized and resized - int" tags="[template][vector]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 10 + </Original> + <Expanded> + 10 == 10 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="TemplateTest: vectors can be sized and resized - std::string" tags="[template][vector]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 10 + </Original> + <Expanded> + 10 == 10 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="TemplateTest: vectors can be sized and resized - std::tuple<int,float>" tags="[template][vector]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 10 + </Original> + <Expanded> + 10 == 10 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="TemplateTestSig: vectors can be sized and resized - (std::tuple<int, float>), 6" tags="[nttp][template][vector]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == V + </Original> + <Expanded> + 6 == 6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= V + </Original> + <Expanded> + 6 >= 6 + </Expanded> + </Expression> + <Section name="resizing bigger changes size and capacity" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 2 * V + </Original> + <Expanded> + 12 == 12 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= 2 * V + </Original> + <Expanded> + 12 >= 12 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == V + </Original> + <Expanded> + 6 == 6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= V + </Original> + <Expanded> + 6 >= 6 + </Expanded> + </Expression> + <Section name="resizing smaller changes size but not capacity" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= V + </Original> + <Expanded> + 6 >= 6 + </Expanded> + </Expression> + <Section name="We can use the 'swap trick' to reset the capacity" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == V + </Original> + <Expanded> + 6 == 6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= V + </Original> + <Expanded> + 6 >= 6 + </Expanded> + </Expression> + <Section name="reserving bigger changes capacity but not size" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == V + </Original> + <Expanded> + 6 == 6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= 2 * V + </Original> + <Expanded> + 12 >= 12 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == V + </Original> + <Expanded> + 6 == 6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= V + </Original> + <Expanded> + 6 >= 6 + </Expanded> + </Expression> + <Section name="reserving smaller does not change size or capacity" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == V + </Original> + <Expanded> + 6 == 6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= V + </Original> + <Expanded> + 6 >= 6 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="TemplateTestSig: vectors can be sized and resized - float,4" tags="[nttp][template][vector]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == V + </Original> + <Expanded> + 4 == 4 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= V + </Original> + <Expanded> + 4 >= 4 + </Expanded> + </Expression> + <Section name="resizing bigger changes size and capacity" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 2 * V + </Original> + <Expanded> + 8 == 8 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= 2 * V + </Original> + <Expanded> + 8 >= 8 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == V + </Original> + <Expanded> + 4 == 4 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= V + </Original> + <Expanded> + 4 >= 4 + </Expanded> + </Expression> + <Section name="resizing smaller changes size but not capacity" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= V + </Original> + <Expanded> + 4 >= 4 + </Expanded> + </Expression> + <Section name="We can use the 'swap trick' to reset the capacity" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == V + </Original> + <Expanded> + 4 == 4 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= V + </Original> + <Expanded> + 4 >= 4 + </Expanded> + </Expression> + <Section name="reserving bigger changes capacity but not size" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == V + </Original> + <Expanded> + 4 == 4 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= 2 * V + </Original> + <Expanded> + 8 >= 8 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == V + </Original> + <Expanded> + 4 == 4 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= V + </Original> + <Expanded> + 4 >= 4 + </Expanded> + </Expression> + <Section name="reserving smaller does not change size or capacity" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == V + </Original> + <Expanded> + 4 == 4 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= V + </Original> + <Expanded> + 4 >= 4 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="TemplateTestSig: vectors can be sized and resized - int,5" tags="[nttp][template][vector]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == V + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= V + </Original> + <Expanded> + 5 >= 5 + </Expanded> + </Expression> + <Section name="resizing bigger changes size and capacity" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 2 * V + </Original> + <Expanded> + 10 == 10 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= 2 * V + </Original> + <Expanded> + 10 >= 10 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == V + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= V + </Original> + <Expanded> + 5 >= 5 + </Expanded> + </Expression> + <Section name="resizing smaller changes size but not capacity" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= V + </Original> + <Expanded> + 5 >= 5 + </Expanded> + </Expression> + <Section name="We can use the 'swap trick' to reset the capacity" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == V + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= V + </Original> + <Expanded> + 5 >= 5 + </Expanded> + </Expression> + <Section name="reserving bigger changes capacity but not size" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == V + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= 2 * V + </Original> + <Expanded> + 10 >= 10 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == V + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= V + </Original> + <Expanded> + 5 >= 5 + </Expanded> + </Expression> + <Section name="reserving smaller does not change size or capacity" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == V + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= V + </Original> + <Expanded> + 5 >= 5 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="TemplateTestSig: vectors can be sized and resized - std::string,15" tags="[nttp][template][vector]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == V + </Original> + <Expanded> + 15 == 15 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= V + </Original> + <Expanded> + 15 >= 15 + </Expanded> + </Expression> + <Section name="resizing bigger changes size and capacity" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 2 * V + </Original> + <Expanded> + 30 == 30 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= 2 * V + </Original> + <Expanded> + 30 >= 30 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == V + </Original> + <Expanded> + 15 == 15 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= V + </Original> + <Expanded> + 15 >= 15 + </Expanded> + </Expression> + <Section name="resizing smaller changes size but not capacity" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= V + </Original> + <Expanded> + 15 >= 15 + </Expanded> + </Expression> + <Section name="We can use the 'swap trick' to reset the capacity" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == V + </Original> + <Expanded> + 15 == 15 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= V + </Original> + <Expanded> + 15 >= 15 + </Expanded> + </Expression> + <Section name="reserving bigger changes capacity but not size" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == V + </Original> + <Expanded> + 15 == 15 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= 2 * V + </Original> + <Expanded> + 30 >= 30 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == V + </Original> + <Expanded> + 15 == 15 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= V + </Original> + <Expanded> + 15 >= 15 + </Expanded> + </Expression> + <Section name="reserving smaller does not change size or capacity" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == V + </Original> + <Expanded> + 15 == 15 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.capacity() >= V + </Original> + <Expanded> + 15 >= 15 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Test case with one argument" filename="tests/<exe-name>/UsageTests/VariadicMacros.tests.cpp" > + <OverallResult success="true"/> + </TestCase> + <TestCase name="Test enum bit values" tags="[Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="Test with special, characters "in name" tags="[cli][regression]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <OverallResult success="true"/> + </TestCase> + <TestCase name="The NO_FAIL macro reports a failure but does not fail the test" tags="[messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Expression success="false" type="CHECK_NOFAIL" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Original> + 1 == 2 + </Original> + <Expanded> + 1 == 2 + </Expanded> + </Expression> + <OverallResult success="false"/> + </TestCase> + <TestCase name="The default listing implementation write to provided stream" tags="[reporter-helpers][reporters]" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Section name="Listing tags" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + listingString, Contains("[fakeTag]"s) + </Original> + <Expanded> + "All available tags: + 1 [fakeTag] +1 tag + +" contains: "[fakeTag]" + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Listing reporters" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + listingString, Contains("fake reporter"s) + </Original> + <Expanded> + "Available reporters: + fake reporter: fake description + +" contains: "fake reporter" + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Listing tests" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" > + <Original> + listingString, Contains( "fake test name"s ) && Contains( "fakeTestTag"s ) + </Original> + <Expanded> + "All available test cases: + fake test name + [fakeTestTag] +1 test case + +" ( contains: "fake test name" and contains: "fakeTestTag" ) + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="This test 'should' fail but doesn't" tags="[!shouldfail][.][failing]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <OverallResult success="false"/> + </TestCase> + <TestCase name="Thrown string literals are translated" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Exception filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + For some reason someone is throwing a string literal! + </Exception> + <OverallResult success="false"/> + </TestCase> + <TestCase name="Tracker" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + testCase.isOpen() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + s1.isOpen() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Section name="successfully close one section" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + s1.isSuccessfullyCompleted() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + testCase.isComplete() == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + ctx.completedCycle() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + testCase.isOpen() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + s1.isOpen() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Section name="fail one section" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + s1.isComplete() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + s1.isSuccessfullyCompleted() == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + testCase.isComplete() == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + ctx.completedCycle() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + testCase.isSuccessfullyCompleted() == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Section name="re-enter after failed section" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + testCase2.isOpen() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + s1b.isOpen() == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + ctx.completedCycle() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + testCase.isComplete() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + testCase.isOpen() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + s1.isOpen() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Section name="fail one section" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + s1.isComplete() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + s1.isSuccessfullyCompleted() == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + testCase.isComplete() == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + ctx.completedCycle() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + testCase2.isOpen() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + s1b.isOpen() == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + s2.isOpen() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + ctx.completedCycle() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + testCase.isComplete() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + testCase.isOpen() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + s1.isOpen() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Section name="successfully close one section, then find another" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + s2.isOpen() == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + testCase2.isOpen() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + s1b.isOpen() == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + s2b.isOpen() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + ctx.completedCycle() == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Section name="Successfully close S2" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + ctx.completedCycle() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + s2b.isSuccessfullyCompleted() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + testCase2.isComplete() == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + testCase.isOpen() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + s1.isOpen() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Section name="successfully close one section, then find another" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + s2.isOpen() == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + testCase2.isOpen() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + s1b.isOpen() == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + s2b.isOpen() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + ctx.completedCycle() == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Section name="fail S2" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + ctx.completedCycle() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + s2b.isComplete() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + s2b.isSuccessfullyCompleted() == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + testCase2.isSuccessfullyCompleted() == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + testCase3.isOpen() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + s1c.isOpen() == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + s2c.isOpen() == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + testCase.isOpen() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + s1.isOpen() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Section name="open a nested section" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + s2.isOpen() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + s2.isComplete() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + s1.isComplete() == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + s1.isComplete() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + testCase.isComplete() == false + </Original> + <Expanded> + false == false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > + <Original> + testCase.isComplete() + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Trim strings" tags="[string-manip]" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Original> + trim(std::string(no_whitespace)) == no_whitespace + </Original> + <Expanded> + "There is no extra whitespace here" +== +"There is no extra whitespace here" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Original> + trim(std::string(leading_whitespace)) == no_whitespace + </Original> + <Expanded> + "There is no extra whitespace here" +== +"There is no extra whitespace here" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Original> + trim(std::string(trailing_whitespace)) == no_whitespace + </Original> + <Expanded> + "There is no extra whitespace here" +== +"There is no extra whitespace here" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Original> + trim(std::string(whitespace_at_both_ends)) == no_whitespace + </Original> + <Expanded> + "There is no extra whitespace here" +== +"There is no extra whitespace here" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Original> + trim(StringRef(no_whitespace)) == StringRef(no_whitespace) + </Original> + <Expanded> + There is no extra whitespace here +== +There is no extra whitespace here + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Original> + trim(StringRef(leading_whitespace)) == StringRef(no_whitespace) + </Original> + <Expanded> + There is no extra whitespace here +== +There is no extra whitespace here + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Original> + trim(StringRef(trailing_whitespace)) == StringRef(no_whitespace) + </Original> + <Expanded> + There is no extra whitespace here +== +There is no extra whitespace here + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Original> + trim(StringRef(whitespace_at_both_ends)) == StringRef(no_whitespace) + </Original> + <Expanded> + There is no extra whitespace here +== +There is no extra whitespace here + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Unexpected exceptions can be translated" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Exception filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + 3.14 + </Exception> + <OverallResult success="false"/> + </TestCase> + <TestCase name="Upcasting special member functions" tags="[internals][unique-ptr]" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Section name="Move constructor" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Original> + bptr->i == 3 + </Original> + <Expanded> + 3 == 3 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="move assignment" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Original> + bptr->i == 3 + </Original> + <Expanded> + 3 == 3 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Usage of AllMatch range matcher" tags="[matchers][quantifiers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, AllMatch(SizeIs(5)) + </Original> + <Expanded> + { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } all match has size == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, !AllMatch(Contains(0) && Contains(1)) + </Original> + <Expanded> + { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } not all match ( contains element 0 and contains element 1 ) + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Type requires ADL found begin and end" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + needs_adl, AllMatch( Predicate<int>( []( int elem ) { return elem < 6; } ) ) + </Original> + <Expanded> + { 1, 2, 3, 4, 5 } all match matches undescribed predicate + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All are read" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked, allMatch + </Original> + <Expanded> + { 1, 2, 3, 4, 5 } all match matches undescribed predicate + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.derefed[0] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.derefed[1] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.derefed[2] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.derefed[3] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.derefed[4] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Short-circuited" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked, !allMatch + </Original> + <Expanded> + { 1, 2, 3, 4, 5 } not all match matches undescribed predicate + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.derefed[0] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.derefed[1] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.derefed[2] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.derefed[3]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.derefed[4]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Usage of AnyMatch range matcher" tags="[matchers][quantifiers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, AnyMatch(SizeIs(5)) + </Original> + <Expanded> + { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } any match has size == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, !AnyMatch(Contains(0) && Contains(10)) + </Original> + <Expanded> + { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } not any match ( contains element 0 and contains element 10 ) + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Type requires ADL found begin and end" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + needs_adl, AnyMatch( Predicate<int>( []( int elem ) { return elem < 3; } ) ) + </Original> + <Expanded> + { 1, 2, 3, 4, 5 } any match matches undescribed predicate + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All are read" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked, !anyMatch + </Original> + <Expanded> + { 1, 2, 3, 4, 5 } not any match matches undescribed predicate + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.derefed[0] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.derefed[1] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.derefed[2] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.derefed[3] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.derefed[4] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Short-circuited" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked, anyMatch + </Original> + <Expanded> + { 1, 2, 3, 4, 5 } any match matches undescribed predicate + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.derefed[0] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.derefed[1]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.derefed[2]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.derefed[3]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.derefed[4]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Usage of NoneMatch range matcher" tags="[matchers][quantifiers][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Basic usage" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, NoneMatch(SizeIs(6)) + </Original> + <Expanded> + { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } none match has size == 6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + data, !NoneMatch(Contains(0) && Contains(1)) + </Original> + <Expanded> + { { 0, 1, 2, 3, 5 }, { 4, -3, -2, 5, 0 }, { 0, 0, 0, 5, 0 }, { 0, -5, 0, 5, 0 }, { 1, 0, 0, -1, 5 } } not none match ( contains element 0 and contains element 1 ) + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Type requires ADL found begin and end" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + needs_adl, NoneMatch( Predicate<int>( []( int elem ) { return elem > 6; } ) ) + </Original> + <Expanded> + { 1, 2, 3, 4, 5 } none match matches undescribed predicate + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="All are read" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked, noneMatch + </Original> + <Expanded> + { 1, 2, 3, 4, 5 } none match matches undescribed predicate + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.derefed[0] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.derefed[1] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.derefed[2] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.derefed[3] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.derefed[4] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <Section name="Shortcircuiting" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Short-circuited" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked, !noneMatch + </Original> + <Expanded> + { 1, 2, 3, 4, 5 } not none match matches undescribed predicate + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + mocked.derefed[0] + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.derefed[1]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.derefed[2]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.derefed[3]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + !(mocked.derefed[4]) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Usage of the SizeIs range matcher" tags="[matchers][size][templated]" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Section name="Some with stdlib containers" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + empty_vec, SizeIs(0) + </Original> + <Expanded> + { } has size == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + empty_vec, !SizeIs(2) + </Original> + <Expanded> + { } not has size == 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + empty_vec, SizeIs(Lt(2)) + </Original> + <Expanded> + { } size matches is less than 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + arr, SizeIs(2) + </Original> + <Expanded> + { 0, 0 } has size == 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + arr, SizeIs( Lt(3)) + </Original> + <Expanded> + { 0, 0 } size matches is less than 3 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + arr, !SizeIs(!Lt(3)) + </Original> + <Expanded> + { 0, 0 } not size matches not is less than 3 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + map, SizeIs(3) + </Original> + <Expanded> + { {?}, {?}, {?} } has size == 3 + </Expanded> + </Expression> + <OverallResults successes="7" failures="0" expectedFailures="0"/> + </Section> + <Section name="Type requires ADL found size free function" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + unrelated::ADL_size{}, SizeIs(12) + </Original> + <Expanded> + {?} has size == 12 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Type has size member" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/MatchersRanges.tests.cpp" > + <Original> + has_size{}, SizeIs(13) + </Original> + <Expanded> + {?} has size == 13 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Use a custom approx" tags="[Approx][custom]" filename="tests/<exe-name>/UsageTests/Approx.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<exe-name>/UsageTests/VariadicMacros.tests.cpp" > + <Section name="Section with one argument" filename="tests/<exe-name>/UsageTests/VariadicMacros.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Vector Approx matcher" tags="[approx][matchers][vector]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Section name="Empty vector is roughly equal to an empty vector" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + empty, Approx(empty) + </Original> + <Expanded> + { } is approx: { } + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Vectors with elements" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Section name="A vector is approx equal to itself" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + v1, Approx(v1) + </Original> + <Expanded> + { 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 } + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + v1, Approx<double>({ 1., 2., 3. }) + </Original> + <Expanded> + { 1.0, 2.0, 3.0 } is approx: { 1.0, 2.0, 3.0 } + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Vectors with elements" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Section name="Different length" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + v1, !Approx(temp) + </Original> + <Expanded> + { 1.0, 2.0, 3.0 } not is approx: { 1.0, 2.0, 3.0, 4.0 } + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Vectors with elements" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Section name="Same length, different elements" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + v1, !Approx(v2) + </Original> + <Expanded> + { 1.0, 2.0, 3.0 } not is approx: { 1.5, 2.5, 3.5 } + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + v1, Approx(v2).margin(0.5) + </Original> + <Expanded> + { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + v1, Approx(v2).epsilon(0.5) + </Original> + <Expanded> + { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + v1, Approx(v2).epsilon(0.1).scale(500) + </Original> + <Expanded> + { 1.0, 2.0, 3.0 } is approx: { 1.5, 2.5, 3.5 } + </Expanded> + </Expression> + <OverallResults successes="4" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="4" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Vector Approx matcher -- failing" tags="[.][approx][failing][matchers][vector]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Section name="Empty and non empty vectors are not approx equal" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="false" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + empty, Approx(t1) + </Original> + <Expanded> + { } is approx: { 1.0, 2.0 } + </Expanded> + </Expression> + <OverallResults successes="0" failures="1" expectedFailures="0"/> + </Section> + <Section name="Just different vectors" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="false" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + v1, Approx(v2) + </Original> + <Expanded> + { 2.0, 4.0, 6.0 } is approx: { 1.0, 3.0, 5.0 } + </Expanded> + </Expression> + <OverallResults successes="0" failures="1" expectedFailures="0"/> + </Section> + <OverallResult success="false"/> + </TestCase> + <TestCase name="Vector matchers" tags="[matchers][vector]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Section name="Contains (element)" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<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="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + v, VectorContains(2) + </Original> + <Expanded> + { 1, 2, 3 } Contains: 2 + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + v5, (VectorContains<int, CustomAllocator<int>>(2)) + </Original> + <Expanded> + { 1, 2, 3 } Contains: 2 + </Expanded> + </Expression> + <OverallResults successes="3" failures="0" expectedFailures="0"/> + </Section> + <Section name="Contains (vector)" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<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="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + v, Contains<int>({ 1, 2 }) + </Original> + <Expanded> + { 1, 2, 3 } Contains: { 1, 2 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + v5, (Contains<int, std::allocator<int>, CustomAllocator<int>>(v2)) + </Original> + <Expanded> + { 1, 2, 3 } Contains: { 1, 2 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + empty, Contains(empty) + </Original> + <Expanded> + { } Contains: { } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + v5, (Contains<int, std::allocator<int>, CustomAllocator<int>>(v2)) + </Original> + <Expanded> + { 1, 2, 3 } Contains: { 1, 2, 3 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + v5, Contains(v6) + </Original> + <Expanded> + { 1, 2, 3 } Contains: { 1, 2 } + </Expanded> + </Expression> + <OverallResults successes="8" failures="0" expectedFailures="0"/> + </Section> + <Section name="Contains (element), composed" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<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="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<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="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + empty, Equals(empty) + </Original> + <Expanded> + { } Equals: { } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + v, Equals<int>({ 1, 2, 3 }) + </Original> + <Expanded> + { 1, 2, 3 } Equals: { 1, 2, 3 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + v, Equals(v2) + </Original> + <Expanded> + { 1, 2, 3 } Equals: { 1, 2, 3 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + v5, (Equals<int, std::allocator<int>, CustomAllocator<int>>(v2)) + </Original> + <Expanded> + { 1, 2, 3 } Equals: { 1, 2, 3 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + v5, Equals(v6) + </Original> + <Expanded> + { 1, 2, 3 } Equals: { 1, 2, 3 } + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <Section name="UnorderedEquals" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<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="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + v, UnorderedEquals<int>({ 3, 2, 1 }) + </Original> + <Expanded> + { 1, 2, 3 } UnorderedEquals: { 3, 2, 1 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + empty, UnorderedEquals(empty) + </Original> + <Expanded> + { } UnorderedEquals: { } + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<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="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + permuted, UnorderedEquals(v) + </Original> + <Expanded> + { 2, 3, 1 } UnorderedEquals: { 1, 2, 3 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + v5, (UnorderedEquals<int, std::allocator<int>, CustomAllocator<int>>(permuted)) + </Original> + <Expanded> + { 1, 2, 3 } UnorderedEquals: { 2, 3, 1 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + v5_permuted, UnorderedEquals(v5) + </Original> + <Expanded> + { 1, 3, 2 } UnorderedEquals: { 1, 2, 3 } + </Expanded> + </Expression> + <OverallResults successes="7" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="Vector matchers that fail" tags="[.][failing][matchers][vector]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Section name="Contains (element)" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="false" type="CHECK_THAT" filename="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="false" type="CHECK_THAT" filename="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="false" type="CHECK_THAT" filename="tests/<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="tests/<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="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Expression success="false" type="CHECK_THAT" filename="tests/<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="tests/<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="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Expression success="true" type="REQUIRE_THROWS_AS" filename="tests/<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="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Original> + thisDoesntThrow() + </Original> + <Expanded> + thisDoesntThrow() + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THROWS" filename="tests/<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="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Exception filename="tests/<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="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Original> + thisThrows() == 0 + </Original> + <Expanded> + thisThrows() == 0 + </Expanded> + <Exception filename="tests/<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="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Original> + thisThrows() == 0 + </Original> + <Expanded> + thisThrows() == 0 + </Expanded> + <Exception filename="tests/<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="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Original> + thisThrows() == 0 + </Original> + <Expanded> + thisThrows() == 0 + </Expanded> + <Exception filename="tests/<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="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Section name="section name" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Exception filename="tests/<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="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <OverallResult success="false"/> + </TestCase> + <TestCase name="Where the LHS is not a simple value" tags="[.][failing][Tricky]" filename="tests/<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="[.][failing][Tricky]" filename="tests/<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="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <OverallResult success="true"/> + </TestCase> + <TestCase name="X/level/0/b" tags="[fizz][Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <OverallResult success="true"/> + </TestCase> + <TestCase name="X/level/1/a" tags="[Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <OverallResult success="true"/> + </TestCase> + <TestCase name="X/level/1/b" tags="[Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <OverallResult success="true"/> + </TestCase> + <TestCase name="XmlEncode" tags="[XML]" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > + <Section name="normal string" filename="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<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="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<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="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/IntrospectiveTests/Xml.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="analyse no analysis" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + analysis.mean.point.count() == 23 + </Original> + <Expanded> + 23.0 == 23 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + analysis.mean.lower_bound.count() == 23 + </Original> + <Expanded> + 23.0 == 23 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + analysis.mean.upper_bound.count() == 23 + </Original> + <Expanded> + 23.0 == 23 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + analysis.standard_deviation.point.count() == 0 + </Original> + <Expanded> + 0.0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + analysis.standard_deviation.lower_bound.count() == 0 + </Original> + <Expanded> + 0.0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + analysis.standard_deviation.upper_bound.count() == 0 + </Original> + <Expanded> + 0.0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + analysis.outliers.total() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + analysis.outliers.low_mild == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + analysis.outliers.low_severe == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + analysis.outliers.high_mild == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + analysis.outliers.high_severe == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + analysis.outliers.samples_seen == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + analysis.outlier_variance == 0 + </Original> + <Expanded> + 0.0 == 0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="array<int, N> -> toString" tags="[array][containers][toString]" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > + <Original> + Catch::Detail::stringify( empty ) == "{ }" + </Original> + <Expanded> + "{ }" == "{ }" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > + <Original> + Catch::Detail::stringify( oneValue ) == "{ 42 }" + </Original> + <Expanded> + "{ 42 }" == "{ 42 }" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + x == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="benchmark function call" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Section name="without chronometer" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + model.started == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + model.finished == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + model.started == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + model.finished == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + called == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="5" failures="0" expectedFailures="0"/> + </Section> + <Section name="with chronometer" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + model.started == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + model.finished == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + model.started == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + model.finished == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + called == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="5" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="boolean member" tags="[Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="CHECKED_ELSE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + flag + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="false" type="CHECKED_ELSE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + flag + </Original> + <Expanded> + false + </Expanded> + </Expression> + <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + testCheckedElse( false ) + </Original> + <Expanded> + false + </Expanded> + </Expression> + <OverallResult success="false"/> + </TestCase> + <TestCase name="checkedIf" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="CHECKED_IF" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + flag + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="false" type="CHECKED_IF" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + flag + </Original> + <Expanded> + false + </Expanded> + </Expression> + <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + testCheckedIf( false ) + </Original> + <Expanded> + false + </Expanded> + </Expression> + <OverallResult success="false"/> + </TestCase> + <TestCase name="classify_outliers" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Section name="none" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.samples_seen == static_cast<int>(x.size()) + </Original> + <Expanded> + 6 == 6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.low_severe == los + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.low_mild == lom + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.high_mild == him + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.high_severe == his + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.total() == los + lom + him + his + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <Section name="low severe" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.samples_seen == static_cast<int>(x.size()) + </Original> + <Expanded> + 6 == 6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.low_severe == los + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.low_mild == lom + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.high_mild == him + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.high_severe == his + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.total() == los + lom + him + his + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <Section name="low mild" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.samples_seen == static_cast<int>(x.size()) + </Original> + <Expanded> + 6 == 6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.low_severe == los + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.low_mild == lom + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.high_mild == him + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.high_severe == his + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.total() == los + lom + him + his + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <Section name="high mild" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.samples_seen == static_cast<int>(x.size()) + </Original> + <Expanded> + 6 == 6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.low_severe == los + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.low_mild == lom + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.high_mild == him + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.high_severe == his + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.total() == los + lom + him + his + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <Section name="high severe" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.samples_seen == static_cast<int>(x.size()) + </Original> + <Expanded> + 6 == 6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.low_severe == los + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.low_mild == lom + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.high_mild == him + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.high_severe == his + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.total() == los + lom + him + his + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <Section name="mixed" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.samples_seen == static_cast<int>(x.size()) + </Original> + <Expanded> + 6 == 6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.low_severe == los + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.low_mild == lom + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.high_mild == him + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.high_severe == his + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + o.total() == los + lom + him + his + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="comparisons between const int variables" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + unsigned_char_var == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + unsigned_short_var == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + unsigned_int_var == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + long_var == unsigned_char_var + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + long_var == unsigned_short_var + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + long_var == unsigned_int_var + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > + <Original> + long_var == unsigned_long_var + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="erfc_inv" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + erfc_inv(1.103560) == Approx(-0.09203687623843015) + </Original> + <Expanded> + -0.0920368762 == Approx( -0.0920368762 ) + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + erfc_inv(1.067400) == Approx(-0.05980291115763361) + </Original> + <Expanded> + -0.0598029112 == Approx( -0.0598029112 ) + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + erfc_inv(0.050000) == Approx(1.38590382434967796) + </Original> + <Expanded> + 1.3859038243 == Approx( 1.3859038243 ) + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="estimate_clock_resolution" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + res.mean.count() == rate + </Original> + <Expanded> + 2000.0 == 2000 (0x<hex digits>) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + res.outliers.total() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="even more nested SECTION tests" tags="[sections]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Section name="c" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Section name="d (leaf)" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Section name="e (leaf)" filename="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <OverallResult success="false"/> + </TestCase> + <TestCase name="has printf" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > +loose text artifact + <OverallResult success="false"/> + </TestCase> + <TestCase name="just failure" tags="[.][fail][isolated info][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Failure filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + Previous info should not be seen + </Failure> + <OverallResult success="false"/> + </TestCase> + <TestCase name="just failure after unscoped info" tags="[.][failing][info][unscoped]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Failure filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + previous unscoped info SHOULD not be seen + </Failure> + <OverallResult success="false"/> + </TestCase> + <TestCase name="just info" tags="[info][isolated info][messages]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <OverallResult success="false"/> + </TestCase> + <TestCase name="just unscoped info" tags="[info][unscoped]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <OverallResult success="false"/> + </TestCase> + <TestCase name="long long" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Section name="b is currently: 0" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + b > a + </Original> + <Expanded> + 0 > 1 + </Expanded> + </Expression> + <OverallResults successes="0" failures="1" expectedFailures="0"/> + </Section> + <Section name="b is currently: 1" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + b > a + </Original> + <Expanded> + 1 > 1 + </Expanded> + </Expression> + <OverallResults successes="0" failures="1" expectedFailures="0"/> + </Section> + <Section name="b is currently: 2" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + b > a + </Original> + <Expanded> + 2 > 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="b is currently: 3" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + b > a + </Original> + <Expanded> + 3 > 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="b is currently: 4" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + b > a + </Original> + <Expanded> + 4 > 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="b is currently: 5" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + b > a + </Original> + <Expanded> + 5 > 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="b is currently: 6" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + b > a + </Original> + <Expanded> + 6 > 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="b is currently: 7" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + b > a + </Original> + <Expanded> + 7 > 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="b is currently: 8" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + b > a + </Original> + <Expanded> + 8 > 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="b is currently: 9" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + b > a + </Original> + <Expanded> + 9 > 1 + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="false"/> + </TestCase> + <TestCase name="looped tests" tags="[.][failing]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Info> + Testing if fib[0] (1) is even + </Info> + <Expression success="false" type="CHECK" filename="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + ( fib[i] % 2 ) == 0 + </Original> + <Expanded> + 1 == 0 + </Expanded> + </Expression> + <OverallResult success="false"/> + </TestCase> + <TestCase name="make_unique reimplementation" tags="[internals][unique-ptr]" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Section name="From lvalue copies" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Original> + !(lval.has_moved) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="From rvalue moves" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Original> + rval.has_moved + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Variadic constructor" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Original> + *ptr == std::tuple<int, double, int>{1, 2., 3} + </Original> + <Expanded> + {?} == {?} + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="mean" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + m == 19. + </Original> + <Expanded> + 19.0 == 19.0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="measure" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + x == 17 + </Original> + <Expanded> + 17 == 17 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + x == 23 + </Original> + <Expanded> + 23 == 23 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + r.elapsed.count() == 42 + </Original> + <Expanded> + 42 == 42 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + r.result == 23 + </Original> + <Expanded> + 23 == 23 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + r.iterations == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + s.elapsed.count() == 69 + </Original> + <Expanded> + 69 == 69 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + s.result == 17 + </Original> + <Expanded> + 17 == 17 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + s.iterations == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="mix info, unscoped info and warning" tags="[info][unscoped]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Info> + info + </Info> + <Info> + unscoped info + </Info> + <Warning> + and warn may mix + </Warning> + <Info> + info + </Info> + <Info> + unscoped info + </Info> + <Warning> + they are not cleared after warnings + </Warning> + <OverallResult success="false"/> + </TestCase> + <TestCase name="more nested SECTION tests" tags="[.][failing][sections]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Section name="doesn't equal" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Section name="equal" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="false" type="REQUIRE" filename="tests/<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="doesn't equal" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Section name="not equal" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="doesn't equal" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Section name="less than" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Section name="doesn't equal" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + a != b + </Original> + <Expanded> + 1 != 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + b != a + </Original> + <Expanded> + 2 != 1 + </Expanded> + </Expression> + <Section name="not equal" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Original> + ti == typeid(int) + </Original> + <Expanded> + {?} == {?} + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="normal_cdf" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + normal_cdf(0.000000) == Approx(0.50000000000000000) + </Original> + <Expanded> + 0.5 == Approx( 0.5 ) + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + normal_cdf(1.000000) == Approx(0.84134474606854293) + </Original> + <Expanded> + 0.8413447461 == Approx( 0.8413447461 ) + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + normal_cdf(-1.000000) == Approx(0.15865525393145705) + </Original> + <Expanded> + 0.1586552539 == Approx( 0.1586552539 ) + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + normal_cdf(2.809729) == Approx(0.99752083845315409) + </Original> + <Expanded> + 0.9975208385 == Approx( 0.9975208385 ) + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + normal_cdf(-1.352570) == Approx(0.08809652095066035) + </Original> + <Expanded> + 0.088096521 == Approx( 0.088096521 ) + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="normal_quantile" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + normal_quantile(0.551780) == Approx(0.13015979861484198) + </Original> + <Expanded> + 0.1301597986 == Approx( 0.1301597986 ) + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + normal_quantile(0.533700) == Approx(0.08457408802851875) + </Original> + <Expanded> + 0.084574088 == Approx( 0.084574088 ) + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + normal_quantile(0.025000) == Approx(-1.95996398454005449) + </Original> + <Expanded> + -1.9599639845 == Approx( -1.9599639845 ) + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="not allowed" tags="[!throws]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <OverallResult success="true"/> + </TestCase> + <TestCase name="not prints unscoped info from previous failures" tags="[.][failing][info][unscoped]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Info> + this MAY be seen only for the FIRST assertion IF info is printed for passing assertions + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Original> + true + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + this MAY be seen only for the SECOND assertion IF info is printed for passing assertions + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Original> + true + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + this SHOULD be seen + </Info> + <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Original> + false + </Original> + <Expanded> + false + </Expanded> + </Expression> + <OverallResult success="false"/> + </TestCase> + <TestCase name="null strings" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<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="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/ToStringPair.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="parseEnums" tags="[enums][Strings]" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > + <Section name="No enums" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > + <Original> + parseEnums( "" ), Equals( std::vector<Catch::StringRef>{} ) + </Original> + <Expanded> + { } Equals: { } + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="One enum value" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > + <Original> + parseEnums( "ClassName::EnumName::Value1" ), Equals(std::vector<Catch::StringRef>{"Value1"} ) + </Original> + <Expanded> + { Value1 } Equals: { Value1 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > + <Original> + parseEnums( "Value1" ), Equals( std::vector<Catch::StringRef>{"Value1"} ) + </Original> + <Expanded> + { Value1 } Equals: { Value1 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > + <Original> + parseEnums( "EnumName::Value1" ), Equals(std::vector<Catch::StringRef>{"Value1"} ) + </Original> + <Expanded> + { Value1 } Equals: { Value1 } + </Expanded> + </Expression> + <OverallResults successes="3" failures="0" expectedFailures="0"/> + </Section> + <Section name="Multiple enum values" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > + <Original> + parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2"} ) + </Original> + <Expanded> + { Value1, Value2 } Equals: { Value1, Value2 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > + <Original> + parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2, ClassName::EnumName::Value3" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2", "Value3"} ) + </Original> + <Expanded> + { Value1, Value2, Value3 } Equals: { Value1, Value2, Value3 } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp" > + <Original> + parseEnums( "ClassName::EnumName::Value1,ClassName::EnumName::Value2 , ClassName::EnumName::Value3" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2", "Value3"} ) + </Original> + <Expanded> + { Value1, Value2, Value3 } Equals: { Value1, Value2, Value3 } + </Expanded> + </Expression> + <OverallResults successes="3" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="pointer to class" tags="[Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Original> + p == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="print unscoped info if passing unscoped info is printed" tags="[info][unscoped]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Info> + this MAY be seen IF info is printed for passing assertions + </Info> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Original> + true + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="prints unscoped info on failure" tags="[.][failing][info][unscoped]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Info> + this SHOULD be seen + </Info> + <Info> + this SHOULD also be seen + </Info> + <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Original> + false + </Original> + <Expanded> + false + </Expanded> + </Expression> + <OverallResult success="false"/> + </TestCase> + <TestCase name="prints unscoped info only for the first assertion" tags="[.][failing][info][unscoped]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Info> + this SHOULD be seen only ONCE + </Info> + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Original> + false + </Original> + <Expanded> + false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Original> + true + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Info> + this MAY also be seen only ONCE IF info is printed for passing assertions + </Info> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Original> + true + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Original> + true + </Original> + <Expanded> + true + </Expanded> + </Expression> + <OverallResult success="false"/> + </TestCase> + <TestCase name="random SECTION tests" tags="[.][failing][sections]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Section name="doesn't equal" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + a != b + </Original> + <Expanded> + 1 != 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="not equal" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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" tags="[string-manip]" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Section name="replace single char" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Original> + Catch::replaceInPlace(letters, "b", "z") + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/StringManip.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="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Original> + Catch::replaceInPlace(letters, "c", "z") + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/StringManip.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="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Original> + Catch::replaceInPlace(letters, "a", "z") + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/StringManip.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="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Original> + Catch::replaceInPlace(letters, "g", "z") + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/StringManip.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="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Original> + Catch::replaceInPlace(letters, letters, "replaced") + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/StringManip.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="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Original> + !(Catch::replaceInPlace(letters, "x", "z")) + </Original> + <Expanded> + !false + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Original> + letters == letters + </Original> + <Expanded> + "abcdefcg" == "abcdefcg" + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="escape '" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Original> + Catch::replaceInPlace(s, "'", "|'") + </Original> + <Expanded> + true + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/StringManip.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="resolution" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + res.size() == count + </Original> + <Expanded> + 10 == 10 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + res[i] == rate + </Original> + <Expanded> + 1000.0 == 1000 (0x<hex digits>) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + res[i] == rate + </Original> + <Expanded> + 1000.0 == 1000 (0x<hex digits>) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + res[i] == rate + </Original> + <Expanded> + 1000.0 == 1000 (0x<hex digits>) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + res[i] == rate + </Original> + <Expanded> + 1000.0 == 1000 (0x<hex digits>) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + res[i] == rate + </Original> + <Expanded> + 1000.0 == 1000 (0x<hex digits>) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + res[i] == rate + </Original> + <Expanded> + 1000.0 == 1000 (0x<hex digits>) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + res[i] == rate + </Original> + <Expanded> + 1000.0 == 1000 (0x<hex digits>) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + res[i] == rate + </Original> + <Expanded> + 1000.0 == 1000 (0x<hex digits>) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + res[i] == rate + </Original> + <Expanded> + 1000.0 == 1000 (0x<hex digits>) + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="run_for_at_least, chronometer" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + meter.runs() >= old_runs + </Original> + <Expanded> + 1 >= 1 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + meter.runs() >= old_runs + </Original> + <Expanded> + 2 >= 1 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + meter.runs() >= old_runs + </Original> + <Expanded> + 4 >= 2 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + meter.runs() >= old_runs + </Original> + <Expanded> + 8 >= 4 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + meter.runs() >= old_runs + </Original> + <Expanded> + 16 >= 8 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + meter.runs() >= old_runs + </Original> + <Expanded> + 32 >= 16 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + meter.runs() >= old_runs + </Original> + <Expanded> + 64 >= 32 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + meter.runs() >= old_runs + </Original> + <Expanded> + 128 >= 64 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + Timing.elapsed >= time + </Original> + <Expanded> + 128 ns >= 100 ns + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + Timing.result == Timing.iterations + 17 + </Original> + <Expanded> + 145 == 145 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + Timing.iterations >= time.count() + </Original> + <Expanded> + 128 >= 100 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="run_for_at_least, int" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + x >= old_x + </Original> + <Expanded> + 1 >= 1 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + x >= old_x + </Original> + <Expanded> + 2 >= 1 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + x >= old_x + </Original> + <Expanded> + 4 >= 2 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + x >= old_x + </Original> + <Expanded> + 8 >= 4 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + x >= old_x + </Original> + <Expanded> + 16 >= 8 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + x >= old_x + </Original> + <Expanded> + 32 >= 16 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + x >= old_x + </Original> + <Expanded> + 64 >= 32 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + x >= old_x + </Original> + <Expanded> + 128 >= 64 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + Timing.elapsed >= time + </Original> + <Expanded> + 128 ns >= 100 ns + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + Timing.result == Timing.iterations + 17 + </Original> + <Expanded> + 145 == 145 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + Timing.iterations >= time.count() + </Original> + <Expanded> + 128 >= 100 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="second tag" tags="[tag2]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <OverallResult success="false"/> + </TestCase> + <TestCase name="send a single char to INFO" tags="[.][failing]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Info> + 3 + </Info> + <Expression success="false" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Info> + hi + </Info> + <Info> + i := 7 + </Info> + <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Original> + false + </Original> + <Expanded> + false + </Expanded> + </Expression> + <OverallResult success="false"/> + </TestCase> + <TestCase name="shortened hide tags are split apart" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" > + <Original> + tags, VectorContains("magic-tag"_catch_sr) && VectorContains("."_catch_sr) + </Original> + <Expanded> + { ., magic-tag } ( Contains: magic-tag and Contains: . ) + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="splitString" tags="[string-manip]" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Original> + splitStringRef("", ','), Equals(std::vector<StringRef>()) + </Original> + <Expanded> + { } Equals: { } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Original> + splitStringRef("abc", ','), Equals(std::vector<StringRef>{"abc"}) + </Original> + <Expanded> + { abc } Equals: { abc } + </Expanded> + </Expression> + <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/IntrospectiveTests/StringManip.tests.cpp" > + <Original> + splitStringRef("abc,def", ','), Equals(std::vector<StringRef>{"abc", "def"}) + </Original> + <Expanded> + { abc, def } Equals: { abc, def } + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="stacks unscoped info in loops" tags="[.][failing][info][unscoped]" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Info> + Count 1 to 3... + </Info> + <Info> + 1 + </Info> + <Info> + 2 + </Info> + <Info> + 3 + </Info> + <Expression success="false" type="CHECK" filename="tests/<exe-name>/UsageTests/Message.tests.cpp" > + <Original> + false + </Original> + <Expanded> + false + </Expanded> + </Expression> + <Info> + Count 4 to 6... + </Info> + <Info> + 4 + </Info> + <Info> + 5 + </Info> + <Info> + 6 + </Info> + <Expression success="false" type="CHECK" filename="tests/<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="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Section name="empty" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/ToStringPair.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/ToStringPair.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Section name="empty" filename="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/ToStringGeneral.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/ToStringPair.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="[.][failing][Tricky]" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Expression success="false" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Tricky.tests.cpp" > + <Original> + std::string( "first" ) == "second" + </Original> + <Expanded> + "first" == "second" + </Expanded> + </Expression> + <OverallResult success="false"/> + </TestCase> + <TestCase name="stringify ranges" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<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="tests/<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="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > + <Original> + ::Catch::Detail::stringify(disabled_range{}) == "{?}" + </Original> + <Expanded> + "{?}" == "{?}" + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="stringify( has_maker )" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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_operator )" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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_neither )" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > + <Original> + ::Catch::Detail::stringify(item) == "{?}" + </Original> + <Expanded> + "{?}" == "{?}" + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="stringify( has_operator )" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="stringify( has_template_operator )" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > + <Original> + ::Catch::Detail::stringify( item ) == "operator<<( has_template_operator )" + </Original> + <Expanded> + "operator<<( has_template_operator )" +== +"operator<<( has_template_operator )" + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="stringify( vectors<has_maker> )" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="stringify( vectors<has_maker_and_operator> )" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="stringify( vectors<has_operator> )" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="strlen3" tags="[generators]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + data.str.size() == data.len + </Original> + <Expanded> + 3 == 3 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + data.str.size() == data.len + </Original> + <Expanded> + 3 == 3 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + data.str.size() == data.len + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + data.str.size() == data.len + </Original> + <Expanded> + 4 == 4 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="tables" tags="[generators]" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) + </Original> + <Expanded> + 6 == 6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Generators.tests.cpp" > + <Original> + strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) + </Original> + <Expanded> + 6 == 6 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="thrown std::strings are translated" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + <Exception filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" > + Why would you throw a std::string? + </Exception> + <OverallResult success="false"/> + </TestCase> + <TestCase name="toString on const wchar_t const pointer returns the string contents" tags="[toString]" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<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(enum class w/operator<<)" tags="[enum][enumClass][toString]" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<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="tests/<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="tests/<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="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > + <Original> + ::Catch::Detail::stringify(e0) == "0" + </Original> + <Expanded> + "0" == "0" + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<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="tests/<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="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" > + <Original> + ::Catch::Detail::stringify(e0) == "0" + </Original> + <Expanded> + "0" == "0" + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/UsageTests/ToStringTuple.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/UsageTests/ToStringTuple.tests.cpp" > + <Original> + "{ }" == ::Catch::Detail::stringify(type{}) + </Original> + <Expanded> + "{ }" == "{ }" + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/UsageTests/ToStringTuple.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<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="tests/<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="tests/<exe-name>/UsageTests/ToStringTuple.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/UsageTests/ToStringTuple.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/UsageTests/ToStringTuple.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<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="tests/<exe-name>/UsageTests/ToStringTuple.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<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="uniform samples" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + e.point == 23 + </Original> + <Expanded> + 23.0 == 23 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + e.upper_bound == 23 + </Original> + <Expanded> + 23.0 == 23 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + e.lower_bound == 23 + </Original> + <Expanded> + 23.0 == 23 + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + e.confidence_interval == 0.95 + </Original> + <Expanded> + 0.95 == 0.95 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="unique_ptr reimplementation: basic functionality" tags="[internals][unique-ptr]" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Section name="Default constructed unique_ptr is empty" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Original> + !(ptr) + </Original> + <Expanded> + !{?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Original> + ptr.get() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Take ownership of allocation" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Original> + ptr + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Original> + *ptr == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Original> + ptr.get() == naked_ptr + </Original> + <Expanded> + 0x<hex digits> == 0x<hex digits> + </Expanded> + </Expression> + <Section name="Plain reset deallocates" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Original> + !(ptr) + </Original> + <Expanded> + !{?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Original> + ptr.get() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="5" failures="0" expectedFailures="0"/> + </Section> + <Section name="Take ownership of allocation" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Original> + ptr + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Original> + *ptr == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Original> + ptr.get() == naked_ptr + </Original> + <Expanded> + 0x<hex digits> == 0x<hex digits> + </Expanded> + </Expression> + <Section name="Reset replaces ownership" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Original> + ptr + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Original> + ptr.get() != 0 + </Original> + <Expanded> + 0x<hex digits> != 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Original> + *ptr == 2 + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <OverallResults successes="3" failures="0" expectedFailures="0"/> + </Section> + <OverallResults successes="6" failures="0" expectedFailures="0"/> + </Section> + <Section name="Release releases ownership" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Original> + !(ptr) + </Original> + <Expanded> + !{?} + </Expanded> + </Expression> + <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Original> + ptr.get() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="Move constructor" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Original> + !(ptr1) + </Original> + <Expanded> + !{?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Original> + ptr2 + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Original> + *ptr2 == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="3" failures="0" expectedFailures="0"/> + </Section> + <Section name="Move assignment" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Original> + !(ptr2) + </Original> + <Expanded> + !{?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Original> + ptr1 + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Original> + *ptr1 == 2 + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <OverallResults successes="3" failures="0" expectedFailures="0"/> + </Section> + <Section name="free swap" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Original> + *ptr1 == 2 + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/UniquePtr.tests.cpp" > + <Original> + *ptr2 == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <TestCase name="vec<vec<string,alloc>> -> toString" tags="[toString][vector,allocator]" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > + <Original> + ::Catch::Detail::stringify(v) == "{ }" + </Original> + <Expanded> + "{ }" == "{ }" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > + <Original> + ::Catch::Detail::stringify(bools) == "{ }" + </Original> + <Expanded> + "{ }" == "{ }" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > + <Original> + ::Catch::Detail::stringify(bools) == "{ true }" + </Original> + <Expanded> + "{ true }" == "{ true }" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > + <Original> + ::Catch::Detail::stringify(vv) == "{ }" + </Original> + <Expanded> + "{ }" == "{ }" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > + <Original> + ::Catch::Detail::stringify(vv) == "{ 42 }" + </Original> + <Expanded> + "{ 42 }" == "{ 42 }" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > + <Original> + ::Catch::Detail::stringify(vv) == "{ }" + </Original> + <Expanded> + "{ }" == "{ }" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > + <Original> + ::Catch::Detail::stringify(vv) == "{ 42 }" + </Original> + <Expanded> + "{ 42 }" == "{ 42 }" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > + <Original> + ::Catch::Detail::stringify(vv) == "{ }" + </Original> + <Expanded> + "{ }" == "{ }" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringVector.tests.cpp" > + <Original> + ::Catch::Detail::stringify(vv) == "{ \"hello\" }" + </Original> + <Expanded> + "{ "hello" }" == "{ "hello" }" + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 10 + </Original> + <Expanded> + 10 == 10 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Original> + v.size() == 5 + </Original> + <Expanded> + 5 == 5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<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="warmup" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + (iterations * rate) > Catch::Benchmark::Detail::warmup_time.count() + </Original> + <Expanded> + 160000000 (0x<hex digits>) > 100 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + (end - start) > Catch::Benchmark::Detail::warmup_time + </Original> + <Expanded> + 310016000 ns > 100 ms + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="weighted_average_quantile" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + q1 == 14.5 + </Original> + <Expanded> + 14.5 == 14.5 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + med == 18. + </Original> + <Expanded> + 18.0 == 18.0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" > + <Original> + q3 == 23. + </Original> + <Expanded> + 23.0 == 23.0 + </Expanded> + </Expression> + <OverallResult success="true"/> + </TestCase> + <TestCase name="xmlentitycheck" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <Section name="embedded xml: <test>it should be possible to embed xml characters, such as <, " or &, or even whole <xml>documents</xml> within an attribute</test>" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="encoded chars: these should all be encoded: &&&"""<<<&"<<&"" filename="tests/<exe-name>/UsageTests/Misc.tests.cpp" > + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> + <OverallResults successes="1936" failures="149" expectedFailures="21"/> + <OverallResultsCases successes="266" failures="86" expectedFailures="4"/> + </Group> + <OverallResults successes="1936" failures="148" expectedFailures="21"/> + <OverallResultsCases successes="266" failures="86" expectedFailures="4"/> +</Catch> diff --git a/packages/Catch2/tests/SelfTest/CompileTimePerfTests/10.tests.cpp b/packages/Catch2/tests/SelfTest/CompileTimePerfTests/10.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..01cd072d9fbd307f749290f1b0a33d6564c5e348 --- /dev/null +++ b/packages/Catch2/tests/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/packages/Catch2/tests/SelfTest/CompileTimePerfTests/100.tests.cpp b/packages/Catch2/tests/SelfTest/CompileTimePerfTests/100.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e03ca838284c64d6e5bcc572c4a97d75699080ed --- /dev/null +++ b/packages/Catch2/tests/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/packages/Catch2/tests/SelfTest/CompileTimePerfTests/All.tests.cpp b/packages/Catch2/tests/SelfTest/CompileTimePerfTests/All.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2b6a1029141d1772766271b2f1ae22b83941a57e --- /dev/null +++ b/packages/Catch2/tests/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/packages/Catch2/tests/SelfTest/IntrospectiveTests/Clara.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Clara.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1259e7ffe5dadc614fffe103911f5a730e7861a1 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Clara.tests.cpp @@ -0,0 +1,22 @@ +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +#include <catch2/catch_test_macros.hpp> +#include <catch2/internal/catch_clara.hpp> + + +#include <string> + +TEST_CASE("Clara::Arg supports single-arg parse the way Opt does", "[clara][arg][compilation]") { + std::string name; + auto p = Catch::Clara::Arg(name, "just one arg"); + + CHECK(name.empty()); + + p.parse( Catch::Clara::Args{ "UnitTest", "foo" } ); + REQUIRE(name == "foo"); +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e8bf6e5f67a0f227ed00c40947c370e45d476d3e --- /dev/null +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp @@ -0,0 +1,577 @@ +/* + * 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 <catch2/catch_approx.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_string.hpp> +#include <catch2/internal/catch_test_spec_parser.hpp> +#include <catch2/catch_test_case_info.hpp> +#include <catch2/catch_config.hpp> +#include <catch2/internal/catch_commandline.hpp> +#include <catch2/generators/catch_generators.hpp> + +#ifdef __clang__ +# pragma clang diagnostic ignored "-Wc++98-compat" +#endif + +namespace { + auto fakeTestCase(const char* name, const char* desc = "") { return Catch::makeTestCaseInfo("", { name, desc }, CATCH_INTERNAL_LINEINFO); } +} + +TEST_CASE( "Parse test names and tags", "[command-line][test-spec]" ) { + + using Catch::parseTestSpec; + using Catch::TestSpec; + + auto tcA = fakeTestCase( "a" ); + auto tcB = fakeTestCase( "b", "[one][x]" ); + auto tcC = fakeTestCase( "longer name with spaces", "[two][three][.][x]" ); + auto 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 ) == false ); + } + 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 ) == false ); + 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 ); + } + SECTION( "Leading and trailing spaces in test spec" ) { + TestSpec spec = parseTestSpec( "\" aardvark \"" ); + CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) ); + CHECK( spec.matches( *fakeTestCase( " aardvark" ) ) ); + CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) ); + CHECK( spec.matches( *fakeTestCase( "aardvark " ) ) ); + CHECK( spec.matches( *fakeTestCase( "aardvark" ) ) ); + + } + SECTION( "Leading and trailing spaces in test name" ) { + TestSpec spec = parseTestSpec( "aardvark" ); + CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) ); + CHECK( spec.matches( *fakeTestCase( " aardvark" ) ) ); + CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) ); + CHECK( spec.matches( *fakeTestCase( "aardvark " ) ) ); + CHECK( spec.matches( *fakeTestCase( "aardvark" ) ) ); + } + SECTION("Shortened hide tags are split apart when parsing") { + TestSpec spec = parseTestSpec("[.foo]"); + CHECK(spec.matches(*fakeTestCase("hidden and foo", "[.][foo]"))); + CHECK_FALSE(spec.matches(*fakeTestCase("only foo", "[foo]"))); + } + SECTION("Shortened hide tags also properly handle exclusion") { + TestSpec spec = parseTestSpec("~[.foo]"); + CHECK_FALSE(spec.matches(*fakeTestCase("hidden and foo", "[.][foo]"))); + CHECK_FALSE(spec.matches(*fakeTestCase("only foo", "[foo]"))); + CHECK_FALSE(spec.matches(*fakeTestCase("only hidden", "[.]"))); + CHECK(spec.matches(*fakeTestCase("neither foo nor hidden", "[bar]"))); + } +} + +TEST_CASE("#1905 -- test spec parser properly clears internal state between compound tests", "[command-line][test-spec]") { + using Catch::parseTestSpec; + using Catch::TestSpec; + // We ask for one of 2 different tests and the latter one of them has a , in name that needs escaping + TestSpec spec = parseTestSpec(R"("spec . char","spec \, char")"); + + REQUIRE(spec.matches(*fakeTestCase("spec . char"))); + REQUIRE(spec.matches(*fakeTestCase("spec , char"))); + REQUIRE_FALSE(spec.matches(*fakeTestCase(R"(spec \, char)"))); +} + +TEST_CASE("#1912 -- test spec parser handles escaping", "[command-line][test-spec]") { + using Catch::parseTestSpec; + using Catch::TestSpec; + + SECTION("Various parentheses") { + TestSpec spec = parseTestSpec(R"(spec {a} char,spec \[a] char)"); + + REQUIRE(spec.matches(*fakeTestCase(R"(spec {a} char)"))); + REQUIRE(spec.matches(*fakeTestCase(R"(spec [a] char)"))); + REQUIRE_FALSE(spec.matches(*fakeTestCase("differs but has similar tag", "[a]"))); + } + SECTION("backslash in test name") { + TestSpec spec = parseTestSpec(R"(spec \\ char)"); + + REQUIRE(spec.matches(*fakeTestCase(R"(spec \ char)"))); + } +} + +TEST_CASE( "Process can be configured on command line", "[config][command-line]" ) { + + using namespace Catch::Matchers; + + 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.reporterName == "console"); + + Catch::Config cfg(config); + CHECK_FALSE(cfg.hasTestFilters()); + } + + SECTION("test lists") { + SECTION("Specify one test case using") { + auto result = cli.parse({"test", "test1"}); + CHECK(result); + + Catch::Config cfg(config); + REQUIRE(cfg.hasTestFilters()); + 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.hasTestFilters()); + 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.hasTestFilters()); + 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.reporterName == "console"); + } + SECTION("-r/xml") { + CHECK(cli.parse({"test", "-r", "xml"})); + + REQUIRE(config.reporterName == "xml"); + } + SECTION("--reporter/junit") { + CHECK(cli.parse({"test", "--reporter", "junit"})); + + REQUIRE(config.reporterName == "junit"); + } + SECTION("Only one reporter is accepted") { + REQUIRE_FALSE(cli.parse({ "test", "-r", "xml", "-r", "junit" })); + } + SECTION("must match one of the available ones") { + auto result = cli.parse({"test", "--reporter", "unsupported"}); + CHECK(!result); + + REQUIRE_THAT(result.errorMessage(), Contains("Unrecognized reporter")); + } + } + + 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); + REQUIRE_THAT(result.errorMessage(), Contains("convert") && Contains("oops")); + } + + SECTION("wait-for-keypress") { + SECTION("Accepted options") { + using tuple_type = std::tuple<char const*, Catch::WaitForKeypress::When>; + auto input = GENERATE(table<char const*, Catch::WaitForKeypress::When>({ + tuple_type{"never", Catch::WaitForKeypress::Never}, + tuple_type{"start", Catch::WaitForKeypress::BeforeStart}, + tuple_type{"exit", Catch::WaitForKeypress::BeforeExit}, + tuple_type{"both", Catch::WaitForKeypress::BeforeStartAndExit}, + })); + CHECK(cli.parse({"test", "--wait-for-keypress", std::get<0>(input)})); + + REQUIRE(config.waitForKeypress == std::get<1>(input)); + } + + SECTION("invalid options are reported") { + auto result = cli.parse({"test", "--wait-for-keypress", "sometimes"}); + CHECK(!result); + +#ifndef CATCH_CONFIG_DISABLE_MATCHERS + REQUIRE_THAT(result.errorMessage(), Contains("never") && Contains("both")); +#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 ); + CHECK_THAT( result.errorMessage(), Contains( "colour mode must be one of" ) ); + } + } + + SECTION("Benchmark options") { + SECTION("samples") { + CHECK(cli.parse({ "test", "--benchmark-samples=200" })); + + REQUIRE(config.benchmarkSamples == 200); + } + + SECTION("resamples") { + CHECK(cli.parse({ "test", "--benchmark-resamples=20000" })); + + REQUIRE(config.benchmarkResamples == 20000); + } + + SECTION("confidence-interval") { + CHECK(cli.parse({ "test", "--benchmark-confidence-interval=0.99" })); + + REQUIRE(config.benchmarkConfidenceInterval == Catch::Approx(0.99)); + } + + SECTION("no-analysis") { + CHECK(cli.parse({ "test", "--benchmark-no-analysis" })); + + REQUIRE(config.benchmarkNoAnalysis); + } + + SECTION("warmup-time") { + CHECK(cli.parse({ "test", "--benchmark-warmup-time=10" })); + + REQUIRE(config.benchmarkWarmupTime == 10); + } + } +} + +TEST_CASE("Test with special, characters \"in name", "[cli][regression]") { + // This test case succeeds if we can invoke it from the CLI + SUCCEED(); +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Details.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Details.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bddb0d5b5f9d9cd89a70ee4ccd4b78f0df9df995 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Details.tests.cpp @@ -0,0 +1,24 @@ +/* + * 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 <catch2/catch_test_macros.hpp> +#include <catch2/internal/catch_enforce.hpp> + +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4702) // unreachable code in the macro expansions +#endif + +TEST_CASE("Check that our error handling macros throw the right exceptions", "[!throws][internals][approvals]") { + REQUIRE_THROWS_AS(CATCH_INTERNAL_ERROR(""), std::logic_error); + REQUIRE_THROWS_AS(CATCH_ERROR(""), std::domain_error); + REQUIRE_THROWS_AS(CATCH_RUNTIME_ERROR(""), std::runtime_error); + REQUIRE_THROWS_AS([](){CATCH_ENFORCE(false, "");}(), std::domain_error); + REQUIRE_NOTHROW([](){CATCH_ENFORCE(true, "");}()); +} + +#if defined(_MSC_VER) +#pragma warning(pop) // unreachable code in the macro expansions +#endif diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..848bb1d9e0803981d2f4c78e91578f6f8264a332 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp @@ -0,0 +1,390 @@ +#include <catch2/catch_approx.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generator_exception.hpp> +#include <catch2/generators/catch_generators_adapters.hpp> +#include <catch2/generators/catch_generators_random.hpp> +#include <catch2/generators/catch_generators_range.hpp> + +// Tests of generator implementation details +TEST_CASE("Generators internals", "[generators][internals]") { + using namespace Catch::Generators; + + SECTION("Single value") { + auto gen = value(123); + REQUIRE(gen.get() == 123); + REQUIRE_FALSE(gen.next()); + } + SECTION("Preset values") { + auto gen = values({ 1, 3, 5 }); + REQUIRE(gen.get() == 1); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 3); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 5); + REQUIRE_FALSE(gen.next()); + } + SECTION("Generator combinator") { + auto gen = makeGenerators(1, 5, values({ 2, 4 }), 0); + REQUIRE(gen.get() == 1); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 5); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 2); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 4); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 0); + REQUIRE_FALSE(gen.next()); + } + SECTION("Explicitly typed generator sequence") { + auto gen = makeGenerators(as<std::string>{}, "aa", "bb", "cc"); + // This just checks that the type is std::string: + REQUIRE(gen.get().size() == 2); + // Iterate over the generator + REQUIRE(gen.get() == "aa"); + REQUIRE(gen.next()); + REQUIRE(gen.get() == "bb"); + REQUIRE(gen.next()); + REQUIRE(gen.get() == "cc"); + REQUIRE_FALSE(gen.next()); + } + SECTION("Filter generator") { + // Normal usage + auto gen = filter([] (int i) { return i != 2; }, values({ 2, 1, 2, 3, 2, 2 })); + REQUIRE(gen.get() == 1); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 3); + REQUIRE_FALSE(gen.next()); + + // Completely filtered-out generator should throw on construction + REQUIRE_THROWS_AS(filter([] (int) { return false; }, value(1)), Catch::GeneratorException); + } + SECTION("Take generator") { + SECTION("Take less") { + auto gen = take(2, values({ 1, 2, 3 })); + REQUIRE(gen.get() == 1); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 2); + REQUIRE_FALSE(gen.next()); + } + SECTION("Take more") { + auto gen = take(2, value(1)); + REQUIRE(gen.get() == 1); + REQUIRE_FALSE(gen.next()); + } + } + SECTION("Map with explicit return type") { + auto gen = map<double>([] (int i) {return 2.0 * i; }, values({ 1, 2, 3 })); + REQUIRE(gen.get() == 2.0); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 4.0); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 6.0); + REQUIRE_FALSE(gen.next()); + } + SECTION("Map with deduced return type") { + auto gen = map([] (int i) {return 2.0 * i; }, values({ 1, 2, 3 })); + REQUIRE(gen.get() == 2.0); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 4.0); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 6.0); + REQUIRE_FALSE(gen.next()); + } + SECTION("Repeat") { + SECTION("Singular repeat") { + auto gen = repeat(1, value(3)); + REQUIRE(gen.get() == 3); + REQUIRE_FALSE(gen.next()); + } + SECTION("Actual repeat") { + auto gen = repeat(2, values({ 1, 2, 3 })); + REQUIRE(gen.get() == 1); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 2); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 3); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 1); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 2); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 3); + REQUIRE_FALSE(gen.next()); + } + } + SECTION("Range") { + SECTION("Positive auto step") { + SECTION("Integer") { + auto gen = range(-2, 2); + REQUIRE(gen.get() == -2); + REQUIRE(gen.next()); + REQUIRE(gen.get() == -1); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 0); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 1); + REQUIRE_FALSE(gen.next()); + } + } + SECTION("Negative auto step") { + SECTION("Integer") { + auto gen = range(2, -2); + REQUIRE(gen.get() == 2); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 1); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 0); + REQUIRE(gen.next()); + REQUIRE(gen.get() == -1); + REQUIRE_FALSE(gen.next()); + } + } + SECTION("Positive manual step") { + SECTION("Integer") { + SECTION("Exact") { + auto gen = range(-7, 5, 3); + REQUIRE(gen.get() == -7); + REQUIRE(gen.next()); + REQUIRE(gen.get() == -4); + REQUIRE(gen.next()); + REQUIRE(gen.get() == -1); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 2); + REQUIRE_FALSE(gen.next()); + } + SECTION("Slightly over end") { + auto gen = range(-7, 4, 3); + REQUIRE(gen.get() == -7); + REQUIRE(gen.next()); + REQUIRE(gen.get() == -4); + REQUIRE(gen.next()); + REQUIRE(gen.get() == -1); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 2); + REQUIRE_FALSE(gen.next()); + } + SECTION("Slightly under end") { + auto gen = range(-7, 6, 3); + REQUIRE(gen.get() == -7); + REQUIRE(gen.next()); + REQUIRE(gen.get() == -4); + REQUIRE(gen.next()); + REQUIRE(gen.get() == -1); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 2); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 5); + REQUIRE_FALSE(gen.next()); + } + } + + SECTION("Floating Point") { + using Catch::Approx; + SECTION("Exact") { + const auto rangeStart = -1.; + const auto rangeEnd = 1.; + const auto step = .1; + + auto gen = range(rangeStart, rangeEnd, step); + auto expected = rangeStart; + while( (rangeEnd - expected) > step ) { + INFO( "Current expected value is " << expected ); + REQUIRE(gen.get() == Approx(expected)); + REQUIRE(gen.next()); + + expected += step; + } + REQUIRE(gen.get() == Approx( rangeEnd ) ); + REQUIRE_FALSE(gen.next()); + } + SECTION("Slightly over end") { + const auto rangeStart = -1.; + const auto rangeEnd = 1.; + const auto step = .3; + + auto gen = range(rangeStart, rangeEnd, step); + auto expected = rangeStart; + while( (rangeEnd - expected) > step ) { + INFO( "Current expected value is " << expected ); + REQUIRE(gen.get() == Approx(expected)); + REQUIRE(gen.next()); + + expected += step; + } + REQUIRE_FALSE(gen.next()); + } + SECTION("Slightly under end") { + const auto rangeStart = -1.; + const auto rangeEnd = .9; + const auto step = .3; + + auto gen = range(rangeStart, rangeEnd, step); + auto expected = rangeStart; + while( (rangeEnd - expected) > step ) { + INFO( "Current expected value is " << expected ); + REQUIRE(gen.get() == Approx(expected)); + REQUIRE(gen.next()); + + expected += step; + } + REQUIRE_FALSE(gen.next()); + } + } + } + SECTION("Negative manual step") { + SECTION("Integer") { + SECTION("Exact") { + auto gen = range(5, -7, -3); + REQUIRE(gen.get() == 5); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 2); + REQUIRE(gen.next()); + REQUIRE(gen.get() == -1); + REQUIRE(gen.next()); + REQUIRE(gen.get() == -4); + REQUIRE_FALSE(gen.next()); + } + SECTION("Slightly over end") { + auto gen = range(5, -6, -3); + REQUIRE(gen.get() == 5); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 2); + REQUIRE(gen.next()); + REQUIRE(gen.get() == -1); + REQUIRE(gen.next()); + REQUIRE(gen.get() == -4); + REQUIRE_FALSE(gen.next()); + } + SECTION("Slightly under end") { + auto gen = range(5, -8, -3); + REQUIRE(gen.get() == 5); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 2); + REQUIRE(gen.next()); + REQUIRE(gen.get() == -1); + REQUIRE(gen.next()); + REQUIRE(gen.get() == -4); + REQUIRE(gen.next()); + REQUIRE(gen.get() == -7); + REQUIRE_FALSE(gen.next()); + } + } + } + } + +} + + +// todo: uncopyable type used in a generator +// idea: uncopyable tag type for a stupid generator + +namespace { +struct non_copyable { + non_copyable() = default; + non_copyable(non_copyable const&) = delete; + non_copyable& operator=(non_copyable const&) = delete; + int value = -1; +}; + +// This class shows how to implement a simple generator for Catch tests +class TestGen : public Catch::Generators::IGenerator<int> { + int current_number; +public: + + TestGen(non_copyable const& nc): + current_number(nc.value) {} + + int const& get() const override; + bool next() override { + return false; + } +}; + +// Avoids -Wweak-vtables +int const& TestGen::get() const { + return current_number; +} + +} + +TEST_CASE("GENERATE capture macros", "[generators][internals][approvals]") { + auto value = GENERATE(take(10, random(0, 10))); + + non_copyable nc; nc.value = value; + // neither `GENERATE_COPY` nor plain `GENERATE` would compile here + auto value2 = GENERATE_REF(Catch::Generators::GeneratorWrapper<int>(Catch::Detail::make_unique<TestGen>(nc))); + REQUIRE(value == value2); +} + +TEST_CASE("#1809 - GENERATE_COPY and SingleValueGenerator does not compile", "[generators][compilation][approvals]") { + // Verify Issue #1809 fix, only needs to compile. + auto a = GENERATE_COPY(1, 2); + (void)a; + auto b = GENERATE_COPY(as<long>{}, 1, 2); + (void)b; + int i = 1; + int j = 2; + auto c = GENERATE_COPY(i, j); + (void)c; + auto d = GENERATE_COPY(as<long>{}, i, j); + (void)d; + SUCCEED(); +} + +TEST_CASE("Multiple random generators in one test case output different values", "[generators][internals][approvals]") { + SECTION("Integer") { + auto random1 = Catch::Generators::random(0, 1000); + auto random2 = Catch::Generators::random(0, 1000); + size_t same = 0; + for (size_t i = 0; i < 1000; ++i) { + same += random1.get() == random2.get(); + random1.next(); random2.next(); + } + // Because the previous low bound failed CI couple of times, + // we use a very high threshold of 20% before failure is reported. + REQUIRE(same < 200); + } + SECTION("Float") { + auto random1 = Catch::Generators::random(0., 1000.); + auto random2 = Catch::Generators::random(0., 1000.); + size_t same = 0; + for (size_t i = 0; i < 1000; ++i) { + same += random1.get() == random2.get(); + random1.next(); random2.next(); + } + // Because the previous low bound failed CI couple of times, + // we use a very high threshold of 20% before failure is reported. + REQUIRE(same < 200); + } +} + +TEST_CASE("#2040 - infinite compilation recursion in GENERATE with MSVC", "[generators][compilation][approvals]") { + int x = 42; + auto test = GENERATE_COPY(1, x, 2 * x); + CHECK(test < 100); +} + +namespace { + static bool always_true(int) { + return true; + } + + static bool is_even(int n) { + return n % 2 == 0; + } + + static bool is_multiple_of_3(int n) { + return n % 3 == 0; + } +} + +TEST_CASE("GENERATE handles function (pointers)", "[generators][compilation][approvals]") { + auto f = GENERATE(always_true, is_even, is_multiple_of_3); + REQUIRE(f(6)); +} + +TEST_CASE("GENERATE decays arrays", "[generators][compilation][approvals]") { + auto str = GENERATE("abc", "def", "gh"); + STATIC_REQUIRE(std::is_same<decltype(str), const char*>::value); +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/InternalBenchmark.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/InternalBenchmark.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0a3895a854c4bb5a6e71872af5421c87ea333b70 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/InternalBenchmark.tests.cpp @@ -0,0 +1,414 @@ +/* + * Created by Joachim on 16/04/2019. + * Adapted from donated nonius code. + * + * 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 <catch2/catch_test_macros.hpp> +#include <catch2/catch_approx.hpp> +#include <catch2/catch_config.hpp> +#include <catch2/benchmark/catch_benchmark.hpp> +#include <catch2/benchmark/catch_chronometer.hpp> +#include <catch2/benchmark/detail/catch_analyse.hpp> +#include <catch2/benchmark/detail/catch_benchmark_function.hpp> +#include <catch2/benchmark/detail/catch_estimate_clock.hpp> + +namespace { + struct manual_clock { + public: + using duration = std::chrono::nanoseconds; + using time_point = std::chrono::time_point<manual_clock, duration>; + using rep = duration::rep; + using period = duration::period; + enum { is_steady = true }; + + static time_point now() { + return time_point(duration(tick())); + } + + static void advance(int ticks = 1) { + tick() += ticks; + } + + private: + static rep& tick() { + static rep the_tick = 0; + return the_tick; + } + }; + + struct counting_clock { + public: + using duration = std::chrono::nanoseconds; + using time_point = std::chrono::time_point<counting_clock, duration>; + using rep = duration::rep; + using period = duration::period; + enum { is_steady = true }; + + static time_point now() { + static rep ticks = 0; + return time_point(duration(ticks += rate())); + } + + static void set_rate(rep new_rate) { rate() = new_rate; } + + private: + static rep& rate() { + static rep the_rate = 1; + return the_rate; + } + }; + + struct TestChronometerModel : Catch::Benchmark::Detail::ChronometerConcept { + int started = 0; + int finished = 0; + + void start() override { ++started; } + void finish() override { ++finished; } + }; +} // namespace + +TEST_CASE("warmup", "[benchmark]") { + auto rate = 1000; + counting_clock::set_rate(rate); + + auto start = counting_clock::now(); + auto iterations = Catch::Benchmark::Detail::warmup<counting_clock>(); + auto end = counting_clock::now(); + + REQUIRE((iterations * rate) > Catch::Benchmark::Detail::warmup_time.count()); + REQUIRE((end - start) > Catch::Benchmark::Detail::warmup_time); +} + +TEST_CASE("resolution", "[benchmark]") { + auto rate = 1000; + counting_clock::set_rate(rate); + + size_t count = 10; + auto res = Catch::Benchmark::Detail::resolution<counting_clock>(static_cast<int>(count)); + + REQUIRE(res.size() == count); + + for (size_t i = 1; i < count; ++i) { + REQUIRE(res[i] == rate); + } +} + +TEST_CASE("estimate_clock_resolution", "[benchmark]") { + auto rate = 2'000; + counting_clock::set_rate(rate); + + int iters = 160'000; + auto res = Catch::Benchmark::Detail::estimate_clock_resolution<counting_clock>(iters); + + REQUIRE(res.mean.count() == rate); + REQUIRE(res.outliers.total() == 0); +} + +TEST_CASE("benchmark function call", "[benchmark]") { + SECTION("without chronometer") { + auto called = 0; + auto model = TestChronometerModel{}; + auto meter = Catch::Benchmark::Chronometer{ model, 1 }; + auto fn = Catch::Benchmark::Detail::BenchmarkFunction{ [&] { + CHECK(model.started == 1); + CHECK(model.finished == 0); + ++called; + } }; + + fn(meter); + + CHECK(model.started == 1); + CHECK(model.finished == 1); + CHECK(called == 1); + } + + SECTION("with chronometer") { + auto called = 0; + auto model = TestChronometerModel{}; + auto meter = Catch::Benchmark::Chronometer{ model, 1 }; + auto fn = Catch::Benchmark::Detail::BenchmarkFunction{ [&](Catch::Benchmark::Chronometer) { + CHECK(model.started == 0); + CHECK(model.finished == 0); + ++called; + } }; + + fn(meter); + + CHECK(model.started == 0); + CHECK(model.finished == 0); + CHECK(called == 1); + } +} + +TEST_CASE("uniform samples", "[benchmark]") { + std::vector<double> samples(100); + std::fill(samples.begin(), samples.end(), 23); + + using it = std::vector<double>::iterator; + auto e = Catch::Benchmark::Detail::bootstrap(0.95, samples.begin(), samples.end(), samples, [](it a, it b) { + auto sum = std::accumulate(a, b, 0.); + return sum / (b - a); + }); + CHECK(e.point == 23); + CHECK(e.upper_bound == 23); + CHECK(e.lower_bound == 23); + CHECK(e.confidence_interval == 0.95); +} + + +TEST_CASE("normal_cdf", "[benchmark]") { + using Catch::Benchmark::Detail::normal_cdf; + using Catch::Approx; + CHECK(normal_cdf(0.000000) == Approx(0.50000000000000000)); + CHECK(normal_cdf(1.000000) == Approx(0.84134474606854293)); + CHECK(normal_cdf(-1.000000) == Approx(0.15865525393145705)); + CHECK(normal_cdf(2.809729) == Approx(0.99752083845315409)); + CHECK(normal_cdf(-1.352570) == Approx(0.08809652095066035)); +} + +TEST_CASE("erfc_inv", "[benchmark]") { + using Catch::Benchmark::Detail::erfc_inv; + using Catch::Approx; + CHECK(erfc_inv(1.103560) == Approx(-0.09203687623843015)); + CHECK(erfc_inv(1.067400) == Approx(-0.05980291115763361)); + CHECK(erfc_inv(0.050000) == Approx(1.38590382434967796)); +} + +TEST_CASE("normal_quantile", "[benchmark]") { + using Catch::Benchmark::Detail::normal_quantile; + using Catch::Approx; + CHECK(normal_quantile(0.551780) == Approx(0.13015979861484198)); + CHECK(normal_quantile(0.533700) == Approx(0.08457408802851875)); + CHECK(normal_quantile(0.025000) == Approx(-1.95996398454005449)); +} + + +TEST_CASE("mean", "[benchmark]") { + std::vector<double> x{ 10., 20., 14., 16., 30., 24. }; + + auto m = Catch::Benchmark::Detail::mean(x.begin(), x.end()); + + REQUIRE(m == 19.); +} + +TEST_CASE("weighted_average_quantile", "[benchmark]") { + std::vector<double> x{ 10., 20., 14., 16., 30., 24. }; + + auto q1 = Catch::Benchmark::Detail::weighted_average_quantile(1, 4, x.begin(), x.end()); + auto med = Catch::Benchmark::Detail::weighted_average_quantile(1, 2, x.begin(), x.end()); + auto q3 = Catch::Benchmark::Detail::weighted_average_quantile(3, 4, x.begin(), x.end()); + + REQUIRE(q1 == 14.5); + REQUIRE(med == 18.); + REQUIRE(q3 == 23.); +} + +TEST_CASE("classify_outliers", "[benchmark]") { + auto require_outliers = [](Catch::Benchmark::OutlierClassification o, int los, int lom, int him, int his) { + REQUIRE(o.low_severe == los); + REQUIRE(o.low_mild == lom); + REQUIRE(o.high_mild == him); + REQUIRE(o.high_severe == his); + REQUIRE(o.total() == los + lom + him + his); + }; + + SECTION("none") { + std::vector<double> x{ 10., 20., 14., 16., 30., 24. }; + + auto o = Catch::Benchmark::Detail::classify_outliers(x.begin(), x.end()); + + REQUIRE(o.samples_seen == static_cast<int>(x.size())); + require_outliers(o, 0, 0, 0, 0); + } + SECTION("low severe") { + std::vector<double> x{ -12., 20., 14., 16., 30., 24. }; + + auto o = Catch::Benchmark::Detail::classify_outliers(x.begin(), x.end()); + + REQUIRE(o.samples_seen == static_cast<int>(x.size())); + require_outliers(o, 1, 0, 0, 0); + } + SECTION("low mild") { + std::vector<double> x{ 1., 20., 14., 16., 30., 24. }; + + auto o = Catch::Benchmark::Detail::classify_outliers(x.begin(), x.end()); + + REQUIRE(o.samples_seen == static_cast<int>(x.size())); + require_outliers(o, 0, 1, 0, 0); + } + SECTION("high mild") { + std::vector<double> x{ 10., 20., 14., 16., 36., 24. }; + + auto o = Catch::Benchmark::Detail::classify_outliers(x.begin(), x.end()); + + REQUIRE(o.samples_seen == static_cast<int>(x.size())); + require_outliers(o, 0, 0, 1, 0); + } + SECTION("high severe") { + std::vector<double> x{ 10., 20., 14., 16., 49., 24. }; + + auto o = Catch::Benchmark::Detail::classify_outliers(x.begin(), x.end()); + + REQUIRE(o.samples_seen == static_cast<int>(x.size())); + require_outliers(o, 0, 0, 0, 1); + } + SECTION("mixed") { + std::vector<double> x{ -20., 20., 14., 16., 39., 24. }; + + auto o = Catch::Benchmark::Detail::classify_outliers(x.begin(), x.end()); + + REQUIRE(o.samples_seen == static_cast<int>(x.size())); + require_outliers(o, 1, 0, 1, 0); + } +} + +TEST_CASE("analyse", "[approvals][benchmark]") { + Catch::ConfigData data{}; + data.benchmarkConfidenceInterval = 0.95; + data.benchmarkNoAnalysis = false; + data.benchmarkResamples = 1000; + data.benchmarkSamples = 99; + Catch::Config config{data}; + + using Duration = Catch::Benchmark::FloatDuration<Catch::Benchmark::default_clock>; + + Catch::Benchmark::Environment<Duration> env; + std::vector<Duration> samples(99); + for (size_t i = 0; i < samples.size(); ++i) { + samples[i] = Duration(23 + (i % 3 - 1)); + } + + auto analysis = Catch::Benchmark::Detail::analyse(config, env, samples.begin(), samples.end()); + CHECK(analysis.mean.point.count() == 23); + CHECK(analysis.mean.lower_bound.count() < 23); + CHECK(analysis.mean.lower_bound.count() > 22); + CHECK(analysis.mean.upper_bound.count() > 23); + CHECK(analysis.mean.upper_bound.count() < 24); + + CHECK(analysis.standard_deviation.point.count() > 0.5); + CHECK(analysis.standard_deviation.point.count() < 1); + CHECK(analysis.standard_deviation.lower_bound.count() > 0.5); + CHECK(analysis.standard_deviation.lower_bound.count() < 1); + CHECK(analysis.standard_deviation.upper_bound.count() > 0.5); + CHECK(analysis.standard_deviation.upper_bound.count() < 1); + + CHECK(analysis.outliers.total() == 0); + CHECK(analysis.outliers.low_mild == 0); + CHECK(analysis.outliers.low_severe == 0); + CHECK(analysis.outliers.high_mild == 0); + CHECK(analysis.outliers.high_severe == 0); + CHECK(analysis.outliers.samples_seen == static_cast<int>(samples.size())); + + CHECK(analysis.outlier_variance < 0.5); + CHECK(analysis.outlier_variance > 0); +} + +TEST_CASE("analyse no analysis", "[benchmark]") { + Catch::ConfigData data{}; + data.benchmarkConfidenceInterval = 0.95; + data.benchmarkNoAnalysis = true; + data.benchmarkResamples = 1000; + data.benchmarkSamples = 99; + Catch::Config config{ data }; + + using Duration = Catch::Benchmark::FloatDuration<Catch::Benchmark::default_clock>; + + Catch::Benchmark::Environment<Duration> env; + std::vector<Duration> samples(99); + for (size_t i = 0; i < samples.size(); ++i) { + samples[i] = Duration(23 + (i % 3 - 1)); + } + + auto analysis = Catch::Benchmark::Detail::analyse(config, env, samples.begin(), samples.end()); + CHECK(analysis.mean.point.count() == 23); + CHECK(analysis.mean.lower_bound.count() == 23); + CHECK(analysis.mean.upper_bound.count() == 23); + + CHECK(analysis.standard_deviation.point.count() == 0); + CHECK(analysis.standard_deviation.lower_bound.count() == 0); + CHECK(analysis.standard_deviation.upper_bound.count() == 0); + + CHECK(analysis.outliers.total() == 0); + CHECK(analysis.outliers.low_mild == 0); + CHECK(analysis.outliers.low_severe == 0); + CHECK(analysis.outliers.high_mild == 0); + CHECK(analysis.outliers.high_severe == 0); + CHECK(analysis.outliers.samples_seen == 0); + + CHECK(analysis.outlier_variance == 0); +} + +TEST_CASE("run_for_at_least, int", "[benchmark]") { + manual_clock::duration time(100); + + int old_x = 1; + auto Timing = Catch::Benchmark::Detail::run_for_at_least<manual_clock>(time, 1, [&old_x](int x) -> int { + CHECK(x >= old_x); + manual_clock::advance(x); + old_x = x; + return x + 17; + }); + + REQUIRE(Timing.elapsed >= time); + REQUIRE(Timing.result == Timing.iterations + 17); + REQUIRE(Timing.iterations >= time.count()); +} + +TEST_CASE("run_for_at_least, chronometer", "[benchmark]") { + manual_clock::duration time(100); + + int old_runs = 1; + auto Timing = Catch::Benchmark::Detail::run_for_at_least<manual_clock>(time, 1, [&old_runs](Catch::Benchmark::Chronometer meter) -> int { + CHECK(meter.runs() >= old_runs); + manual_clock::advance(100); + meter.measure([] { + manual_clock::advance(1); + }); + old_runs = meter.runs(); + return meter.runs() + 17; + }); + + REQUIRE(Timing.elapsed >= time); + REQUIRE(Timing.result == Timing.iterations + 17); + REQUIRE(Timing.iterations >= time.count()); +} + + +TEST_CASE("measure", "[benchmark]") { + auto r = Catch::Benchmark::Detail::measure<manual_clock>([](int x) -> int { + CHECK(x == 17); + manual_clock::advance(42); + return 23; + }, 17); + auto s = Catch::Benchmark::Detail::measure<manual_clock>([](int x) -> int { + CHECK(x == 23); + manual_clock::advance(69); + return 17; + }, 23); + + CHECK(r.elapsed.count() == 42); + CHECK(r.result == 23); + CHECK(r.iterations == 1); + + CHECK(s.elapsed.count() == 69); + CHECK(s.result == 17); + CHECK(s.iterations == 1); +} + +TEST_CASE("run benchmark", "[benchmark][approvals]") { + counting_clock::set_rate(1000); + auto start = counting_clock::now(); + + Catch::Benchmark::Benchmark bench{ "Test Benchmark", [](Catch::Benchmark::Chronometer meter) { + counting_clock::set_rate(100000); + meter.measure([] { return counting_clock::now(); }); + } }; + + bench.run<counting_clock>(); + auto end = counting_clock::now(); + + CHECK((end - start).count() == 2867251000); +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/PartTracker.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/PartTracker.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c56adc5e92f5b3aa0e0a3c246fe1d80792f52a92 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/PartTracker.tests.cpp @@ -0,0 +1,251 @@ +/* + * 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 <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generators.hpp> +#include <catch2/internal/catch_test_case_tracker.hpp> + + +using namespace Catch; + +namespace { +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() ); + } +} + +static bool previouslyRun = false; +static bool previouslyRunNested = false; + +TEST_CASE( "#1394", "[.][approvals][tracker]" ) { + // -- Don't re-run after specified section is done + REQUIRE(previouslyRun == false); + + SECTION( "RunSection" ) { + previouslyRun = true; + } + SECTION( "SkipSection" ) { + // cause an error if this section is called because it shouldn't be + REQUIRE(1 == 0); + } +} + +TEST_CASE( "#1394 nested", "[.][approvals][tracker]" ) { + REQUIRE(previouslyRunNested == false); + + SECTION( "NestedRunSection" ) { + SECTION( "s1" ) { + previouslyRunNested = true; + } + } + SECTION( "NestedSkipSection" ) { + // cause an error if this section is called because it shouldn't be + REQUIRE(1 == 0); + } +} + +// Selecting a "not last" section inside a test case via -c "section" would +// previously only run the first subsection, instead of running all of them. +// This allows us to check that `"#1670 regression check" -c A` leads to +// 2 successful assertions. +TEST_CASE("#1670 regression check", "[.approvals][tracker]") { + SECTION("A") { + SECTION("1") SUCCEED(); + SECTION("2") SUCCEED(); + } + SECTION("B") { + SECTION("1") SUCCEED(); + SECTION("2") SUCCEED(); + } +} + +// #1938 required a rework on how generator tracking works, so that `GENERATE` +// supports being sandwiched between two `SECTION`s. The following tests check +// various other scenarios through checking output in approval tests. +TEST_CASE("#1938 - GENERATE after a section", "[.][regression][generators]") { + SECTION("A") { + SUCCEED("A"); + } + auto m = GENERATE(1, 2, 3); + SECTION("B") { + REQUIRE(m); + } +} + +TEST_CASE("#1938 - flat generate", "[.][regression][generators]") { + auto m = GENERATE(1, 2, 3); + REQUIRE(m); +} + +TEST_CASE("#1938 - nested generate", "[.][regression][generators]") { + auto m = GENERATE(1, 2, 3); + auto n = GENERATE(1, 2, 3); + REQUIRE(m); + REQUIRE(n); +} + +TEST_CASE("#1938 - mixed sections and generates", "[.][regression][generators]") { + auto i = GENERATE(1, 2); + SECTION("A") { + SUCCEED("A"); + } + auto j = GENERATE(3, 4); + SECTION("B") { + SUCCEED("B"); + } + auto k = GENERATE(5, 6); + CAPTURE(i, j, k); + SUCCEED(); +} + +TEST_CASE("#1938 - Section followed by flat generate", "[.][regression][generators]") { + SECTION("A") { + REQUIRE(1); + } + auto m = GENERATE(2, 3); + REQUIRE(m); +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/RandomNumberGeneration.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/RandomNumberGeneration.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3d388c66d8ebe51bce2dbca8047c506dded07e71 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/RandomNumberGeneration.tests.cpp @@ -0,0 +1,42 @@ +/* + * 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 <catch2/catch_test_macros.hpp> +#include <catch2/internal/catch_random_number_generator.hpp> + +TEST_CASE("Our PCG implementation provides expected results for known seeds", "[rng]") { + Catch::SimplePcg32 rng; + SECTION("Default seeded") { + REQUIRE(rng() == 0xfcdb943b); + REQUIRE(rng() == 0x6f55b921); + REQUIRE(rng() == 0x4c17a916); + REQUIRE(rng() == 0x71eae25f); + REQUIRE(rng() == 0x6ce7909c); + } + SECTION("Specific seed") { + rng.seed(0xabcd1234); + REQUIRE(rng() == 0x57c08495); + REQUIRE(rng() == 0x33c956ac); + REQUIRE(rng() == 0x2206fd76); + REQUIRE(rng() == 0x3501a35b); + REQUIRE(rng() == 0xfdffb30f); + + // Also check repeated output after reseeding + rng.seed(0xabcd1234); + REQUIRE(rng() == 0x57c08495); + REQUIRE(rng() == 0x33c956ac); + REQUIRE(rng() == 0x2206fd76); + REQUIRE(rng() == 0x3501a35b); + REQUIRE(rng() == 0xfdffb30f); + } +} + +TEST_CASE("Comparison ops", "[rng]") { + using Catch::SimplePcg32; + REQUIRE(SimplePcg32{} == SimplePcg32{}); + REQUIRE(SimplePcg32{ 0 } != SimplePcg32{}); + REQUIRE_FALSE(SimplePcg32{ 1 } == SimplePcg32{ 2 }); + REQUIRE_FALSE(SimplePcg32{ 1 } != SimplePcg32{ 1 }); +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c5c97998b84d969a9e9a3eab6f397293c090cbc9 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp @@ -0,0 +1,109 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +#include <catch2/catch_test_macros.hpp> + +#include <catch2/catch_test_case_info.hpp> +#include <catch2/catch_config.hpp> +#include <catch2/interfaces/catch_interfaces_reporter.hpp> +#include <catch2/interfaces/catch_interfaces_reporter_factory.hpp> +#include <catch2/interfaces/catch_interfaces_reporter_registry.hpp> +#include <catch2/internal/catch_list.hpp> +#include <catch2/matchers/catch_matchers_string.hpp> +#include <catch2/reporters/catch_reporter_helpers.hpp> + +#include <sstream> + +TEST_CASE( "The default listing implementation write to provided stream", + "[reporters][reporter-helpers]" ) { + using Catch::Matchers::Contains; + using namespace std::string_literals; + + std::stringstream sstream; + SECTION( "Listing tags" ) { + std::vector<Catch::TagInfo> tags(1); + tags[0].add("fakeTag"_catch_sr); + Catch::defaultListTags(sstream, tags, false); + + auto listingString = sstream.str(); + REQUIRE_THAT(listingString, Contains("[fakeTag]"s)); + } + SECTION( "Listing reporters" ) { + std::vector<Catch::ReporterDescription> reporters( + { { "fake reporter", "fake description" } } ); + Catch::defaultListReporters(sstream, reporters, Catch::Verbosity::Normal); + + auto listingString = sstream.str(); + REQUIRE_THAT(listingString, Contains("fake reporter"s)); + } + SECTION( "Listing tests" ) { + Catch::TestCaseInfo fakeInfo{ + ""s, + { "fake test name"_catch_sr, "[fakeTestTag]"_catch_sr }, + { "fake-file.cpp", 123456789 } }; + std::vector<Catch::TestCaseHandle> tests({ {&fakeInfo, nullptr} }); + Catch::defaultListTests(sstream, tests, false, Catch::Verbosity::Normal); + + auto listingString = sstream.str(); + REQUIRE_THAT( listingString, + Contains( "fake test name"s ) && + Contains( "fakeTestTag"s ) ); + } +} + +TEST_CASE( "Reporter's write listings to provided stream", "[reporters]" ) { + using Catch::Matchers::Contains; + using namespace std::string_literals; + + auto const& factories = Catch::getRegistryHub().getReporterRegistry().getFactories(); + // If there are no reporters, the test would pass falsely + // while there is something obviously broken + REQUIRE_FALSE(factories.empty()); + + for (auto const& factory : factories) { + INFO("Tested reporter: " << factory.first); + std::stringstream sstream; + + Catch::ConfigData config_data; + Catch::Config config( config_data ); + Catch::ReporterConfig rep_config( &config, sstream ); + auto reporter = factory.second->create( rep_config ); + + DYNAMIC_SECTION( factory.first << " reporter lists tags" ) { + std::vector<Catch::TagInfo> tags(1); + tags[0].add("fakeTag"_catch_sr); + reporter->listTags(tags); + + auto listingString = sstream.str(); + REQUIRE_THAT(listingString, Contains("fakeTag"s)); + } + + DYNAMIC_SECTION( factory.first << " reporter lists reporters" ) { + std::vector<Catch::ReporterDescription> reporters( + { { "fake reporter", "fake description" } } ); + reporter->listReporters(reporters); + + auto listingString = sstream.str(); + REQUIRE_THAT(listingString, Contains("fake reporter"s)); + } + + DYNAMIC_SECTION( factory.first << " reporter lists tests" ) { + Catch::TestCaseInfo fakeInfo{ + ""s, + { "fake test name"_catch_sr, "[fakeTestTag]"_catch_sr }, + { "fake-file.cpp", 123456789 } }; + std::vector<Catch::TestCaseHandle> tests({ {&fakeInfo, nullptr} }); + reporter->listTests(tests); + + auto listingString = sstream.str(); + REQUIRE_THAT( listingString, + Contains( "fake test name"s ) && + Contains( "fakeTestTag"s ) ); + } + } +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/String.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/String.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..dbc8190b3706d3c073e17f42e287650674344d46 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/String.tests.cpp @@ -0,0 +1,178 @@ +#include <catch2/catch_test_macros.hpp> +#include <catch2/internal/catch_stringref.hpp> + +#include <cstring> + +TEST_CASE( "StringRef", "[Strings][StringRef]" ) { + using Catch::StringRef; + + SECTION( "Empty string" ) { + StringRef empty; + REQUIRE( empty.empty() ); + REQUIRE( empty.size() == 0 ); + REQUIRE( empty.isNullTerminated() ); + REQUIRE( std::strcmp( empty.c_str(), "" ) == 0 ); + } + + SECTION( "From string literal" ) { + StringRef s = "hello"; + REQUIRE( s.empty() == false ); + REQUIRE( s.size() == 5 ); + REQUIRE( s.isNullTerminated() ); + + auto rawChars = s.data(); + REQUIRE( std::strcmp( rawChars, "hello" ) == 0 ); + + REQUIRE_NOTHROW(s.c_str()); + REQUIRE(s.c_str() == rawChars); + REQUIRE(s.data() == rawChars); + } + SECTION( "From sub-string" ) { + StringRef original = StringRef( "original string" ).substr(0, 8); + REQUIRE( original == "original" ); + + REQUIRE_FALSE(original.isNullTerminated()); + REQUIRE_THROWS(original.c_str()); + REQUIRE_NOTHROW(original.data()); + } + + + 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::strncmp( ss.data(), "hello", 5 ) == 0 ); + REQUIRE( ss == "hello" ); + } + + 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.data() == s2.data() ); + } + + SECTION( "Pointer values of substring refs should also match" ) { + REQUIRE( s.data() == ss.data() ); + } + + SECTION("Past the end substring") { + REQUIRE(s.substr(s.size() + 1, 123).empty()); + } + + SECTION("Substring off the end are trimmed") { + ss = s.substr(6, 123); + REQUIRE(std::strcmp(ss.c_str(), "world!") == 0); + } + SECTION("substring start after the end is empty") { + REQUIRE(s.substr(1'000'000, 1).empty()); + } + } + + SECTION( "Comparisons are deep" ) { + char buffer1[] = "Hello"; + char buffer2[] = "Hello"; + CHECK(reinterpret_cast<char*>(buffer1) != reinterpret_cast<char*>(buffer2)); + + StringRef left(buffer1), right(buffer2); + REQUIRE( left == right ); + REQUIRE(left != left.substr(0, 3)); + } + + 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( "explicitly constructed" ) { + std::string stdStr( sr ); + REQUIRE( stdStr == "a stringref" ); + REQUIRE( stdStr.size() == sr.size() ); + } + SECTION( "assigned" ) { + std::string stdStr; + stdStr = static_cast<std::string>(sr); + REQUIRE( stdStr == "a stringref" ); + REQUIRE( stdStr.size() == sr.size() ); + } + } + + SECTION("std::string += StringRef") { + StringRef sr = "the stringref contents"; + std::string lhs("some string += "); + lhs += sr; + REQUIRE(lhs == "some string += the stringref contents"); + } + SECTION("StringRef + StringRef") { + StringRef sr1 = "abraka", sr2 = "dabra"; + std::string together = sr1 + sr2; + REQUIRE(together == "abrakadabra"); + } +} + +TEST_CASE("StringRef at compilation time", "[Strings][StringRef][constexpr]") { + using Catch::StringRef; + SECTION("Simple constructors") { + constexpr StringRef empty{}; + STATIC_REQUIRE(empty.size() == 0); + STATIC_REQUIRE(empty.begin() == empty.end()); + + constexpr char const* const abc = "abc"; + + constexpr StringRef stringref(abc, 3); + STATIC_REQUIRE(stringref.size() == 3); + STATIC_REQUIRE(stringref.isNullTerminated()); + STATIC_REQUIRE(stringref.data() == abc); + STATIC_REQUIRE(stringref.begin() == abc); + STATIC_REQUIRE(stringref.begin() != stringref.end()); + STATIC_REQUIRE(stringref.substr(10, 0).empty()); + STATIC_REQUIRE(stringref.substr(2, 1).data() == abc + 2); + STATIC_REQUIRE(stringref[1] == 'b'); + + + constexpr StringRef shortened(abc, 2); + STATIC_REQUIRE(shortened.size() == 2); + STATIC_REQUIRE(shortened.data() == abc); + STATIC_REQUIRE(shortened.begin() != shortened.end()); + STATIC_REQUIRE_FALSE(shortened.isNullTerminated()); + STATIC_REQUIRE_FALSE(shortened.substr(1, 3).isNullTerminated()); + } + SECTION("UDL construction") { + constexpr auto sr1 = "abc"_catch_sr; + STATIC_REQUIRE_FALSE(sr1.empty()); + STATIC_REQUIRE(sr1.size() == 3); + STATIC_REQUIRE(sr1.isNullTerminated()); + + using Catch::operator"" _sr; + constexpr auto sr2 = ""_sr; + STATIC_REQUIRE(sr2.empty()); + STATIC_REQUIRE(sr2.size() == 0); + STATIC_REQUIRE(sr2.isNullTerminated()); + } +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/StringManip.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/StringManip.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d78567ca60556a511467c7f5ef9fd2eef0ad6fbd --- /dev/null +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/StringManip.tests.cpp @@ -0,0 +1,67 @@ +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_vector.hpp> +#include <catch2/internal/catch_string_manip.hpp> + +static const char * const no_whitespace = "There is no extra whitespace here"; +static const char * const leading_whitespace = " \r \t\n There is no extra whitespace here"; +static const char * const trailing_whitespace = "There is no extra whitespace here \t \n \r "; +static const char * const whitespace_at_both_ends = " \r\n \t There is no extra whitespace here \t\t\t \n"; + +TEST_CASE("Trim strings", "[string-manip]") { + using Catch::trim; using Catch::StringRef; + static_assert(std::is_same<std::string, decltype(trim(std::string{}))>::value, "Trimming std::string should return std::string"); + static_assert(std::is_same<StringRef, decltype(trim(StringRef{}))>::value, "Trimming StringRef should return StringRef"); + + REQUIRE(trim(std::string(no_whitespace)) == no_whitespace); + REQUIRE(trim(std::string(leading_whitespace)) == no_whitespace); + REQUIRE(trim(std::string(trailing_whitespace)) == no_whitespace); + REQUIRE(trim(std::string(whitespace_at_both_ends)) == no_whitespace); + + REQUIRE(trim(StringRef(no_whitespace)) == StringRef(no_whitespace)); + REQUIRE(trim(StringRef(leading_whitespace)) == StringRef(no_whitespace)); + REQUIRE(trim(StringRef(trailing_whitespace)) == StringRef(no_whitespace)); + REQUIRE(trim(StringRef(whitespace_at_both_ends)) == StringRef(no_whitespace)); +} + +TEST_CASE("replaceInPlace", "[string-manip]") { + 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"); + } +} + +TEST_CASE("splitString", "[string-manip]") { + using namespace Catch::Matchers; + using Catch::splitStringRef; + using Catch::StringRef; + + CHECK_THAT(splitStringRef("", ','), Equals(std::vector<StringRef>())); + CHECK_THAT(splitStringRef("abc", ','), Equals(std::vector<StringRef>{"abc"})); + CHECK_THAT(splitStringRef("abc,def", ','), Equals(std::vector<StringRef>{"abc", "def"})); +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Tag.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Tag.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..15d37c98b67c9929fe95a75ccca0506886f55b4b --- /dev/null +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Tag.tests.cpp @@ -0,0 +1,52 @@ +/* + * 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 <catch2/matchers/catch_matchers_string.hpp> +#include <catch2/matchers/catch_matchers_vector.hpp> +#include <catch2/internal/catch_tag_alias_registry.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/catch_test_case_info.hpp> + +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 ) { + 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" ) ); + } + } + + 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 ) ) ); + } +} + +TEST_CASE("shortened hide tags are split apart") { + using Catch::StringRef; + using Catch::Matchers::VectorContains; + auto testcase = Catch::makeTestCaseInfo("", {"fake test name", "[.magic-tag]"}, CATCH_INTERNAL_LINEINFO); + // Transform ... + std::vector<StringRef> tags; + for (auto const& tag : testcase->tags) { + tags.push_back(tag.original); + } + REQUIRE_THAT(tags, VectorContains("magic-tag"_catch_sr) && VectorContains("."_catch_sr)); +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/ToString.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/ToString.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..47dfdd37f6ae9c1a71e17df297a66b59df2991d6 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/ToString.tests.cpp @@ -0,0 +1,53 @@ +#include <catch2/internal/catch_enum_values_registry.hpp> +#include <catch2/matchers/catch_matchers_vector.hpp> +#include <catch2/catch_test_macros.hpp> + +enum class EnumClass3 { Value1, Value2, Value3, Value4 }; + +struct UsesSentinel { + using const_iterator = int const*; + using const_sentinel = std::nullptr_t; + + const_iterator begin() const { return nullptr; } + const_iterator end() const { return nullptr; } +}; + +TEST_CASE( "parseEnums", "[Strings][enums]" ) { + using namespace Catch::Matchers; + using Catch::Detail::parseEnums; + + SECTION( "No enums" ) + CHECK_THAT( parseEnums( "" ), Equals( std::vector<Catch::StringRef>{} ) ); + + SECTION( "One enum value" ) { + CHECK_THAT( parseEnums( "ClassName::EnumName::Value1" ), + Equals(std::vector<Catch::StringRef>{"Value1"} ) ); + CHECK_THAT( parseEnums( "Value1" ), + Equals( std::vector<Catch::StringRef>{"Value1"} ) ); + CHECK_THAT( parseEnums( "EnumName::Value1" ), + Equals(std::vector<Catch::StringRef>{"Value1"} ) ); + } + + SECTION( "Multiple enum values" ) { + CHECK_THAT( parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2" ), + Equals( std::vector<Catch::StringRef>{"Value1", "Value2"} ) ); + CHECK_THAT( parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2, ClassName::EnumName::Value3" ), + Equals( std::vector<Catch::StringRef>{"Value1", "Value2", "Value3"} ) ); + CHECK_THAT( parseEnums( "ClassName::EnumName::Value1,ClassName::EnumName::Value2 , ClassName::EnumName::Value3" ), + Equals( std::vector<Catch::StringRef>{"Value1", "Value2", "Value3"} ) ); + } +} + +TEST_CASE( "Directly creating an EnumInfo" ) { + + using namespace Catch::Detail; + auto enumInfo = makeEnumInfo( "EnumName", "EnumName::Value1, EnumName::Value2", {0, 1} ); + + CHECK( enumInfo->lookup(0) == "Value1" ); + CHECK( enumInfo->lookup(1) == "Value2" ); + CHECK( enumInfo->lookup(3) == "{** unexpected enum value **}" ); +} + +TEST_CASE("Range type with sentinel") { + CHECK( Catch::Detail::stringify(UsesSentinel{}) == "{ }" ); +} \ No newline at end of file diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/UniquePtr.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/UniquePtr.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d461232de0a695d440d6e311aaf50818bcd2085c --- /dev/null +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/UniquePtr.tests.cpp @@ -0,0 +1,133 @@ +#include <catch2/catch_test_macros.hpp> +#include <catch2/internal/catch_unique_ptr.hpp> + +#include <tuple> + +namespace { + struct unique_ptr_test_helper { + bool dummy = false; + }; +} // end unnamed namespace + +TEST_CASE("unique_ptr reimplementation: basic functionality", "[internals][unique-ptr]") { + using Catch::Detail::unique_ptr; + SECTION("Default constructed unique_ptr is empty") { + unique_ptr<int> ptr; + REQUIRE_FALSE(ptr); + REQUIRE(ptr.get() == nullptr); + } + SECTION("Take ownership of allocation") { + auto naked_ptr = new int{ 0 }; + unique_ptr<int> ptr(naked_ptr); + REQUIRE(ptr); + REQUIRE(*ptr == 0); + REQUIRE(ptr.get() == naked_ptr); + SECTION("Plain reset deallocates") { + ptr.reset(); // this makes naked_ptr dangling! + REQUIRE_FALSE(ptr); + REQUIRE(ptr.get() == nullptr); + } + SECTION("Reset replaces ownership") { + ptr.reset(new int{ 2 }); + REQUIRE(ptr); + REQUIRE(ptr.get() != nullptr); + REQUIRE(*ptr == 2); + } + } + SECTION("Release releases ownership") { + auto naked_ptr = new int{ 1 }; + unique_ptr<int> ptr(naked_ptr); + ptr.release(); + CHECK_FALSE(ptr); + CHECK(ptr.get() == nullptr); + delete naked_ptr; + } + SECTION("Move constructor") { + unique_ptr<int> ptr1(new int{ 1 }); + auto ptr2(std::move(ptr1)); + REQUIRE_FALSE(ptr1); + REQUIRE(ptr2); + REQUIRE(*ptr2 == 1); + } + SECTION("Move assignment") { + unique_ptr<int> ptr1(new int{ 1 }), ptr2(new int{ 2 }); + ptr1 = std::move(ptr2); + REQUIRE_FALSE(ptr2); + REQUIRE(ptr1); + REQUIRE(*ptr1 == 2); + } + SECTION("free swap") { + unique_ptr<int> ptr1(new int{ 1 }), ptr2(new int{ 2 }); + swap(ptr1, ptr2); + REQUIRE(*ptr1 == 2); + REQUIRE(*ptr2 == 1); + } +} + + +namespace { + struct base { + int i; + base(int i_) :i(i_) {} + }; + struct derived : base { using base::base; }; + struct unrelated {}; + +} // end unnamed namespace + +static_assert( std::is_constructible<Catch::Detail::unique_ptr<base>, + Catch::Detail::unique_ptr<derived>>::value, "Upcasting is supported"); +static_assert(!std::is_constructible<Catch::Detail::unique_ptr<derived>, + Catch::Detail::unique_ptr<base>>::value, "Downcasting is not supported"); +static_assert(!std::is_constructible<Catch::Detail::unique_ptr<base>, + Catch::Detail::unique_ptr<unrelated>>::value, "Cannot just convert one ptr type to another"); + +TEST_CASE("Upcasting special member functions", "[internals][unique-ptr]") { + using Catch::Detail::unique_ptr; + + unique_ptr<derived> dptr(new derived{3}); + SECTION("Move constructor") { + unique_ptr<base> bptr(std::move(dptr)); + REQUIRE(bptr->i == 3); + } + SECTION("move assignment") { + unique_ptr<base> bptr(new base{ 1 }); + bptr = std::move(dptr); + REQUIRE(bptr->i == 3); + } +} + +namespace { + struct move_detector { + bool has_moved = false; + move_detector() = default; + move_detector(move_detector const& rhs) = default; + move_detector& operator=(move_detector const& rhs) = default; + + move_detector(move_detector&& rhs) noexcept { + rhs.has_moved = true; + } + move_detector& operator=(move_detector&& rhs) noexcept { + rhs.has_moved = true; + return *this; + } + }; +} // end unnamed namespace + +TEST_CASE("make_unique reimplementation", "[internals][unique-ptr]") { + using Catch::Detail::make_unique; + SECTION("From lvalue copies") { + move_detector lval; + auto ptr = make_unique<move_detector>(lval); + REQUIRE_FALSE(lval.has_moved); + } + SECTION("From rvalue moves") { + move_detector rval; + auto ptr = make_unique<move_detector>(std::move(rval)); + REQUIRE(rval.has_moved); + } + SECTION("Variadic constructor") { + auto ptr = make_unique<std::tuple<int, double, int>>(1, 2., 3); + REQUIRE(*ptr == std::tuple<int, double, int>{1, 2., 3}); + } +} diff --git a/packages/Catch2/tests/SelfTest/IntrospectiveTests/Xml.tests.cpp b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Xml.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2d375a22918a69097a3a24df6eda569a18a00bb3 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/IntrospectiveTests/Xml.tests.cpp @@ -0,0 +1,114 @@ +#include <catch2/catch_test_macros.hpp> +#include <catch2/internal/catch_xmlwriter.hpp> + +#include <catch2/internal/catch_stream.hpp> + +static std::string encode( std::string const& str, Catch::XmlEncode::ForWhat forWhat = Catch::XmlEncode::ForTextNodes ) { + Catch::ReusableStringStream oss; + oss << Catch::XmlEncode( str, forWhat ); + return oss.str(); +} + +TEST_CASE( "XmlEncode", "[XML]" ) { + 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]" ); + } +} + +// Thanks to Peter Bindels (dascandy) for some of the tests +TEST_CASE("XmlEncode: UTF-8", "[XML][UTF-8][approvals]") { +#define ESC(lit) reinterpret_cast<const char*>(lit) + SECTION("Valid utf-8 strings") { + CHECK(encode(ESC(u8"Here be 👾")) == ESC(u8"Here be 👾")); + CHECK(encode(ESC(u8"šš")) == ESC(u8"šš")); + + CHECK(encode("\xDF\xBF") == "\xDF\xBF"); // 0x7FF + CHECK(encode("\xE0\xA0\x80") == "\xE0\xA0\x80"); // 0x800 + CHECK(encode("\xED\x9F\xBF") == "\xED\x9F\xBF"); // 0xD7FF + CHECK(encode("\xEE\x80\x80") == "\xEE\x80\x80"); // 0xE000 + CHECK(encode("\xEF\xBF\xBF") == "\xEF\xBF\xBF"); // 0xFFFF + CHECK(encode("\xF0\x90\x80\x80") == "\xF0\x90\x80\x80"); // 0x10000 + CHECK(encode("\xF4\x8F\xBF\xBF") == "\xF4\x8F\xBF\xBF"); // 0x10FFFF + } + SECTION("Invalid utf-8 strings") { + SECTION("Various broken strings") { + CHECK(encode(ESC("Here \xFF be \xF0\x9F\x91\xBE")) == ESC(u8"Here \\xFF be 👾")); + CHECK(encode("\xFF") == "\\xFF"); + CHECK(encode("\xC5\xC5\xA0") == ESC(u8"\\xC5Š")); + CHECK(encode("\xF4\x90\x80\x80") == ESC(u8"\\xF4\\x90\\x80\\x80")); // 0x110000 -- out of unicode range + } + + SECTION("Overlong encodings") { + CHECK(encode("\xC0\x80") == "\\xC0\\x80"); // \0 + CHECK(encode("\xF0\x80\x80\x80") == "\\xF0\\x80\\x80\\x80"); // Super-over-long \0 + CHECK(encode("\xC1\xBF") == "\\xC1\\xBF"); // ASCII char as UTF-8 (0x7F) + CHECK(encode("\xE0\x9F\xBF") == "\\xE0\\x9F\\xBF"); // 0x7FF + CHECK(encode("\xF0\x8F\xBF\xBF") == "\\xF0\\x8F\\xBF\\xBF"); // 0xFFFF + } + + // Note that we actually don't modify surrogate pairs, as we do not do strict checking + SECTION("Surrogate pairs") { + CHECK(encode("\xED\xA0\x80") == "\xED\xA0\x80"); // Invalid surrogate half 0xD800 + CHECK(encode("\xED\xAF\xBF") == "\xED\xAF\xBF"); // Invalid surrogate half 0xDBFF + CHECK(encode("\xED\xB0\x80") == "\xED\xB0\x80"); // Invalid surrogate half 0xDC00 + CHECK(encode("\xED\xBF\xBF") == "\xED\xBF\xBF"); // Invalid surrogate half 0xDFFF + } + + SECTION("Invalid start byte") { + CHECK(encode("\x80") == "\\x80"); + CHECK(encode("\x81") == "\\x81"); + CHECK(encode("\xBC") == "\\xBC"); + CHECK(encode("\xBF") == "\\xBF"); + // Out of range + CHECK(encode("\xF5\x80\x80\x80") == "\\xF5\\x80\\x80\\x80"); + CHECK(encode("\xF6\x80\x80\x80") == "\\xF6\\x80\\x80\\x80"); + CHECK(encode("\xF7\x80\x80\x80") == "\\xF7\\x80\\x80\\x80"); + } + + SECTION("Missing continuation byte(s)") { + // Missing first continuation byte + CHECK(encode("\xDE") == "\\xDE"); + CHECK(encode("\xDF") == "\\xDF"); + CHECK(encode("\xE0") == "\\xE0"); + CHECK(encode("\xEF") == "\\xEF"); + CHECK(encode("\xF0") == "\\xF0"); + CHECK(encode("\xF4") == "\\xF4"); + + // Missing second continuation byte + CHECK(encode("\xE0\x80") == "\\xE0\\x80"); + CHECK(encode("\xE0\xBF") == "\\xE0\\xBF"); + CHECK(encode("\xE1\x80") == "\\xE1\\x80"); + CHECK(encode("\xF0\x80") == "\\xF0\\x80"); + CHECK(encode("\xF4\x80") == "\\xF4\\x80"); + + // Missing third continuation byte + CHECK(encode("\xF0\x80\x80") == "\\xF0\\x80\\x80"); + CHECK(encode("\xF4\x80\x80") == "\\xF4\\x80\\x80"); + } + } +#undef ESC +} diff --git a/packages/Catch2/tests/SelfTest/Misc/invalid-test-names.input b/packages/Catch2/tests/SelfTest/Misc/invalid-test-names.input new file mode 100644 index 0000000000000000000000000000000000000000..e2bc88ece12ff0f60015fcf19a8ec697b71f3236 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/Misc/invalid-test-names.input @@ -0,0 +1 @@ +Test with special, characters in \" name diff --git a/packages/Catch2/tests/SelfTest/Misc/plain-old-tests.input b/packages/Catch2/tests/SelfTest/Misc/plain-old-tests.input new file mode 100644 index 0000000000000000000000000000000000000000..ae6d9f1b7f7479b60a5b41471dc68b80ea03b596 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/Misc/plain-old-tests.input @@ -0,0 +1,2 @@ +random SECTION tests +nested SECTION tests diff --git a/packages/Catch2/tests/SelfTest/Misc/special-characters-in-file.input b/packages/Catch2/tests/SelfTest/Misc/special-characters-in-file.input new file mode 100644 index 0000000000000000000000000000000000000000..b68a6bfda0619ed2928c78b5febdb151e0e5e318 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/Misc/special-characters-in-file.input @@ -0,0 +1 @@ +Test with special\, characters \"in name diff --git a/packages/Catch2/tests/SelfTest/TestRegistrations.cpp b/packages/Catch2/tests/SelfTest/TestRegistrations.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cb8376bdb51f399e79f3d7861e0d250c1d4e130e --- /dev/null +++ b/packages/Catch2/tests/SelfTest/TestRegistrations.cpp @@ -0,0 +1,26 @@ +/* + * 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 <catch2/catch_tag_alias_autoregistrar.hpp> +#include <catch2/reporters/catch_reporter_event_listener.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::EventListenerBase { + using EventListenerBase::EventListenerBase; +}; + +#include <catch2/catch_reporter_registrars.hpp> + +CATCH_REGISTER_LISTENER( TestListener ) diff --git a/packages/Catch2/tests/SelfTest/TimingTests/Sleep.tests.cpp b/packages/Catch2/tests/SelfTest/TimingTests/Sleep.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d8b958beda5b317be89a426fa2f663b5b6266875 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/TimingTests/Sleep.tests.cpp @@ -0,0 +1,23 @@ +/* + * 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 <catch2/catch_test_macros.hpp> + +#include <chrono> +#include <thread> + +TEST_CASE( "sleep_for_100ms", "[.min_duration_test][approvals]" ) +{ + std::this_thread::sleep_for( std::chrono::milliseconds( 100 ) ); + CHECK( true ); +} + +TEST_CASE( "sleep_for_250ms", "[.min_duration_test][approvals]" ) +{ + std::this_thread::sleep_for( std::chrono::milliseconds( 250 ) ); + CHECK( true ); +} diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Approx.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Approx.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f0d8919c4f132ebfc7f52efb9c8fa86ac7f96e7b --- /dev/null +++ b/packages/Catch2/tests/SelfTest/UsageTests/Approx.tests.cpp @@ -0,0 +1,218 @@ +/* + * 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 <catch2/catch_test_macros.hpp> +#include <catch2/catch_approx.hpp> + +#include <cmath> + +using Catch::Approx; + +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 + +using namespace Catch::literals; + +/////////////////////////////////////////////////////////////////////////////// +TEST_CASE( "A comparison that uses literals instead of the normal constructor", "[Approx]" ) { + double d = 1.23; + + REQUIRE( d == 1.23_a ); + REQUIRE( d != 1.22_a ); + REQUIRE( -d == -1.23_a ); + + REQUIRE( d == 1.2_a .epsilon(.1) ); + REQUIRE( d != 1.2_a .epsilon(.001) ); + REQUIRE( d == 1_a .epsilon(.3) ); +} + +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( d == 1.23_a ); + REQUIRE( d != 1.22_a ); + + REQUIRE( Approx( d ) == 1.23 ); + REQUIRE( Approx( d ) != 1.22 ); + REQUIRE( Approx( d ) != 1.24 ); +} + +/////////////////////////////////////////////////////////////////////////////// +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][approvals]") { + REQUIRE(INFINITY == Approx(INFINITY)); + REQUIRE(-INFINITY != Approx(INFINITY)); + REQUIRE(1 != Approx(INFINITY)); + REQUIRE(INFINITY != Approx(1)); + 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/packages/Catch2/tests/SelfTest/UsageTests/BDD.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/BDD.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..131340fa1906c1de8f634a60a69a1175568f8a71 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/UsageTests/BDD.tests.cpp @@ -0,0 +1,107 @@ +/* + * 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 <catch2/catch_test_macros.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 + AND_GIVEN("And some assumption") { + // Validate assumption + 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/packages/Catch2/tests/SelfTest/UsageTests/Benchmark.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Benchmark.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b2d41cf231ddd23e799f7a4a9ff4e18bcc27bf8f --- /dev/null +++ b/packages/Catch2/tests/SelfTest/UsageTests/Benchmark.tests.cpp @@ -0,0 +1,145 @@ +#include <catch2/catch_test_macros.hpp> +#include <catch2/benchmark/catch_benchmark.hpp> +#include <catch2/benchmark/catch_constructor.hpp> +#include <catch2/generators/catch_generators_range.hpp> + +#include <map> + +namespace { + std::uint64_t Fibonacci(std::uint64_t number) { + return number < 2 ? 1 : Fibonacci(number - 1) + Fibonacci(number - 2); + } +} + +TEST_CASE("Benchmark Fibonacci", "[!benchmark]") { + CHECK(Fibonacci(0) == 1); + // some more asserts.. + CHECK(Fibonacci(5) == 8); + // some more asserts.. + + BENCHMARK("Fibonacci 20") { + return Fibonacci(20); + }; + + BENCHMARK("Fibonacci 25") { + return Fibonacci(25); + }; + + BENCHMARK("Fibonacci 30") { + return Fibonacci(30); + }; + + BENCHMARK("Fibonacci 35") { + return Fibonacci(35); + }; +} + +TEST_CASE("Benchmark containers", "[!benchmark]") { + static const int size = 100; + + std::vector<int> v; + std::map<int, int> m; + + SECTION("without generator") { + BENCHMARK("Load up a vector") { + v = std::vector<int>(); + for (int i = 0; i < size; ++i) + v.push_back(i); + }; + REQUIRE(v.size() == size); + + // test optimizer control + BENCHMARK("Add up a vector's content") { + uint64_t add = 0; + for (int i = 0; i < size; ++i) + add += v[i]; + return add; + }; + + 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); + + BENCHMARK("Resized vector") { + v = std::vector<int>(); + v.resize(size); + for (int i = 0; i < size; ++i) + v[i] = 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); + + SECTION("XYZ") { + + BENCHMARK_ADVANCED("Load up vector with chronometer")(Catch::Benchmark::Chronometer meter) { + std::vector<int> k; + meter.measure([&](int idx) { + k = std::vector<int>(); + for (int i = 0; i < size; ++i) + k.push_back(idx); + }); + REQUIRE(k.size() == size); + }; + + int runs = 0; + BENCHMARK("Fill vector indexed", benchmarkIndex) { + v = std::vector<int>(); + v.resize(size); + for (int i = 0; i < size; ++i) + v[i] = benchmarkIndex; + runs = benchmarkIndex; + }; + + for (size_t i = 0; i < v.size(); ++i) { + REQUIRE(v[i] == runs); + } + } + } + + SECTION("with generator") { + auto generated = GENERATE(range(0, 10)); + BENCHMARK("Fill vector generated") { + v = std::vector<int>(); + v.resize(size); + for (int i = 0; i < size; ++i) + v[i] = generated; + }; + for (size_t i = 0; i < v.size(); ++i) { + REQUIRE(v[i] == generated); + } + } + + SECTION("construct and destroy example") { + BENCHMARK_ADVANCED("construct")(Catch::Benchmark::Chronometer meter) { + std::vector<Catch::Benchmark::storage_for<std::string>> storage(meter.runs()); + meter.measure([&](int i) { storage[i].construct("thing"); }); + }; + + BENCHMARK_ADVANCED("destroy")(Catch::Benchmark::Chronometer meter) { + std::vector<Catch::Benchmark::destructable_object<std::string>> storage(meter.runs()); + for(auto&& o : storage) + o.construct("thing"); + meter.measure([&](int i) { storage[i].destruct(); }); + }; + } +} diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Class.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Class.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b6009e0b7cbe369aa8a5539ec8306472624f5886 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/UsageTests/Class.tests.cpp @@ -0,0 +1,135 @@ +/* + * 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 <catch2/catch_test_macros.hpp> +#include <catch2/catch_template_test_macros.hpp> +#include <array> + +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; +}; + +template< typename T > +struct Template_Fixture { + Template_Fixture(): m_a(1) {} + + T m_a; +}; + +template<typename T> +struct Template_Fixture_2 { + Template_Fixture_2() {} + + T m_a; +}; + +template< typename T> +struct Template_Foo { + size_t size() { return 0; } +}; + +template< typename T, size_t V> +struct Template_Foo_2 { + size_t size() { return V; } +}; + +template <int V> +struct Nttp_Fixture{ + int value = V; +}; +#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 ); +} + +TEMPLATE_TEST_CASE_METHOD(Template_Fixture, "A TEMPLATE_TEST_CASE_METHOD based test run that succeeds", "[class][template]", int, float, double) { + REQUIRE( Template_Fixture<TestType>::m_a == 1 ); +} + +TEMPLATE_TEST_CASE_METHOD_SIG(Nttp_Fixture, "A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds", "[class][template][nttp]",((int V), V), 1, 3, 6) { + REQUIRE(Nttp_Fixture<V>::value > 0); +} + +TEMPLATE_PRODUCT_TEST_CASE_METHOD(Template_Fixture_2, "A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds","[class][template][product]",(std::vector,Template_Foo),(int,float)) +{ + REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 0 ); +} + +TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG(Template_Fixture_2, "A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds", "[class][template][product][nttp]", ((typename T, size_t S), T, S),(std::array, Template_Foo_2), ((int,2), (float,6))) +{ + REQUIRE(Template_Fixture_2<TestType>{}.m_a.size() >= 2); +} + +using MyTypes = std::tuple<int, char, double>; +TEMPLATE_LIST_TEST_CASE_METHOD(Template_Fixture, "Template test case method with test types specified inside std::tuple", "[class][template][list]", MyTypes) +{ + REQUIRE( Template_Fixture<TestType>::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 ); + } + + TEMPLATE_TEST_CASE_METHOD(Template_Fixture,"A TEMPLATE_TEST_CASE_METHOD based test run that fails", "[.][class][template][failing]", int, float, double) + { + REQUIRE( Template_Fixture<TestType>::m_a == 2 ); + } + + TEMPLATE_TEST_CASE_METHOD_SIG(Nttp_Fixture, "A TEMPLATE_TEST_CASE_METHOD_SIG based test run that fails", "[.][class][template][nttp][failing]", ((int V), V), 1, 3, 6) { + REQUIRE(Nttp_Fixture<V>::value == 0); + } + + TEMPLATE_PRODUCT_TEST_CASE_METHOD(Template_Fixture_2, "A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails","[.][class][template][product][failing]",(std::vector,Template_Foo),(int,float)) + { + REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ); + } + + TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG(Template_Fixture_2, "A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that fails", "[.][class][template][product][nttp][failing]", ((typename T, size_t S), T, S), (std::array, Template_Foo_2), ((int, 2), (float, 6))) + { + REQUIRE(Template_Fixture_2<TestType>{}.m_a.size() < 2); + } +} + + + +}} // namespace ClassTests diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Compilation.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Compilation.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0f339cb8d472e61faf40f89c2cf1b84807884fdf --- /dev/null +++ b/packages/Catch2/tests/SelfTest/UsageTests/Compilation.tests.cpp @@ -0,0 +1,261 @@ +/* + * 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 <type_traits> + +// Setup for #1403 -- look for global overloads of operator << for classes +// in a different namespace. +#include <ostream> + +namespace foo { + struct helper_1403 { + bool operator==(helper_1403) const { return true; } + }; +} + +namespace bar { + template <typename... Ts> + struct TypeList {}; +} + +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-Wmissing-declarations" +#endif +std::ostream& operator<<(std::ostream& out, foo::helper_1403 const&) { + return out << "[1403 helper]"; +} +/////////////////////////////// + +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_string.hpp> + +#include <cstring> + +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; + } + + 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)); + REQUIRE_THAT("aaa", Catch::Matchers::EndsWith("aaa")); + 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 + + template <typename, typename> + struct Fixture_1245 {}; + +#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: Bitfields can be captured") { + struct Y { + uint32_t v : 1; + }; + 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); + } + + // unsigned array + TEST_CASE("#1238") { + unsigned char uarr[] = "123"; + CAPTURE(uarr); + signed char sarr[] = "456"; + CAPTURE(sarr); + + REQUIRE(std::memcmp(uarr, "123", sizeof(uarr)) == 0); + REQUIRE(std::memcmp(sarr, "456", sizeof(sarr)) == 0); + } + + TEST_CASE_METHOD((Fixture_1245<int, int>), "#1245", "[compilation]") { + SUCCEED(); + } + + TEST_CASE("#1403", "[compilation]") { + ::foo::helper_1403 h1, h2; + REQUIRE(h1 == h2); + } + + TEST_CASE("Optionally static assertions", "[compilation]") { + STATIC_REQUIRE( std::is_void<void>::value ); + STATIC_REQUIRE_FALSE( std::is_void<int>::value ); + } + + TEST_CASE("#1548", "[compilation]") { + using namespace bar; + REQUIRE(std::is_same<TypeList<int>, TypeList<int>>::value); + } + + // #925 + using signal_t = void (*) (void*); + + struct TestClass { + signal_t testMethod_uponComplete_arg = nullptr; + }; + + namespace utility { + inline static void synchronizing_callback( void * ) { } + } + +#if defined (_MSC_VER) +#pragma warning(push) +// The function pointer comparison below triggers warning because of +// calling conventions +#pragma warning(disable:4244) +#endif + TEST_CASE("#925: comparing function pointer to function address failed to compile", "[!nonportable]" ) { + TestClass test; + REQUIRE(utility::synchronizing_callback != test.testMethod_uponComplete_arg); + } +#if defined (_MSC_VER) +#pragma warning(pop) +#endif + + TEST_CASE("#1319: Sections can have description (even if it is not saved", "[compilation]") { + SECTION("SectionName", "This is a long form section description") { + SUCCEED(); + } + } + + TEST_CASE("Lambdas in assertions") { + REQUIRE([]() { return true; }()); + } + +}} // namespace CompilationTests + +namespace { + struct HasBitOperators { + int value; + + friend HasBitOperators operator| (HasBitOperators lhs, HasBitOperators rhs) { + return { lhs.value | rhs.value }; + } + friend HasBitOperators operator& (HasBitOperators lhs, HasBitOperators rhs) { + return { lhs.value & rhs.value }; + } + friend HasBitOperators operator^ (HasBitOperators lhs, HasBitOperators rhs) { + return { lhs.value ^ rhs.value }; + } + explicit operator bool() const { + return !!value; + } + + friend std::ostream& operator<<(std::ostream& out, HasBitOperators val) { + out << "Val: " << val.value; + return out; + } + }; +} + +TEST_CASE("Assertion macros support bit operators and bool conversions", "[compilation][bitops]") { + HasBitOperators lhs{ 1 }, rhs{ 2 }; + REQUIRE(lhs | rhs); + REQUIRE_FALSE(lhs & rhs); + REQUIRE(HasBitOperators{ 1 } & HasBitOperators{ 1 }); + REQUIRE(lhs ^ rhs); + REQUIRE_FALSE(lhs ^ lhs); +} + diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Condition.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Condition.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7c6a1d73ef073f118032065d919b9160e4bec217 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/UsageTests/Condition.tests.cpp @@ -0,0 +1,334 @@ +/* + * 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 <catch2/catch_approx.hpp> +#include <catch2/catch_test_macros.hpp> + +using Catch::Approx; + +#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/packages/Catch2/tests/SelfTest/UsageTests/Decomposition.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Decomposition.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..15feefc266d0adb95c0307f8435598716e1ceef6 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/UsageTests/Decomposition.tests.cpp @@ -0,0 +1,36 @@ +/* + * 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> + +namespace { + +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; +} + +} // end anonymous namespace + +#include <catch2/catch_test_macros.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/packages/Catch2/tests/SelfTest/UsageTests/EnumToString.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/EnumToString.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2a6731cb1d57772e3b12b951767c4744003eaac1 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/UsageTests/EnumToString.tests.cpp @@ -0,0 +1,100 @@ +#include <catch2/catch_test_macros.hpp> +#include <catch2/internal/catch_enum_values_registry.hpp> + + +namespace { +// Enum without user-provided stream operator +enum Enum1 { Enum1Value0, Enum1Value1 }; + +// 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) << "}"; +} +} // end anonymous namespace + +TEST_CASE( "toString(enum)", "[toString][enum]" ) { + Enum1 e0 = Enum1Value0; + CHECK( ::Catch::Detail::stringify(e0) == "0" ); + Enum1 e1 = Enum1Value1; + CHECK( ::Catch::Detail::stringify(e1) == "1" ); +} + +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 +namespace { +enum class EnumClass1 { EnumClass1Value0, EnumClass1Value1 }; + +// Enum class with user-provided stream operator +enum class EnumClass2 { 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 ); + } +} + +} // end anonymous namespace + +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" ); +} + + +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" ); + + auto e3 = static_cast<EnumClass2>(10); + CHECK( ::Catch::Detail::stringify(e3) == "Unknown enum value 10" ); +} + +enum class EnumClass3 { Value1, Value2, Value3, Value4 }; + +CATCH_REGISTER_ENUM( EnumClass3, EnumClass3::Value1, EnumClass3::Value2, EnumClass3::Value3 ) + + +TEST_CASE( "Enums can quickly have stringification enabled using REGISTER_ENUM" ) { + using Catch::Detail::stringify; + REQUIRE( stringify( EnumClass3::Value1 ) == "Value1" ); + REQUIRE( stringify( EnumClass3::Value2 ) == "Value2" ); + REQUIRE( stringify( EnumClass3::Value3 ) == "Value3" ); + REQUIRE( stringify( EnumClass3::Value4 ) == "{** unexpected enum value **}" ); + + EnumClass3 ec3 = EnumClass3 ::Value2; + REQUIRE( stringify( ec3 ) == "Value2" ); +} + +namespace Bikeshed { + enum class Colours { Red, Green, Blue }; +} + +// Important!: This macro must appear at top level scope - not inside a namespace +// You can fully qualify the names, or use a using if you prefer +CATCH_REGISTER_ENUM( Bikeshed::Colours, + Bikeshed::Colours::Red, + Bikeshed::Colours::Green, + Bikeshed::Colours::Blue ) + +TEST_CASE( "Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM" ) { + using Catch::Detail::stringify; + REQUIRE( stringify( Bikeshed::Colours::Red ) == "Red" ); + REQUIRE( stringify( Bikeshed::Colours::Blue ) == "Blue" ); +} diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Exception.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Exception.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1f6b4fa263c30fa01a6be1351d373f59df380844 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/UsageTests/Exception.tests.cpp @@ -0,0 +1,205 @@ +/* + * 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 <catch2/catch_test_macros.hpp> +#include <catch2/catch_translate_exception.hpp> +#include <catch2/matchers/catch_matchers_string.hpp> + +#include <string> +#include <stdexcept> + +#ifdef _MSC_VER +#pragma warning(disable:4702) // Unreachable code -- unconditional throws and so on +#endif +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wweak-vtables" +#pragma clang diagnostic ignored "-Wmissing-noreturn" +#pragma clang diagnostic ignored "-Wunreachable-code" +#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 const& ex ) { + return ex.getMessage(); +} + +CATCH_TRANSLATE_EXCEPTION( CustomStdException const& ex ) { + return ex.getMessage(); +} + +CATCH_TRANSLATE_EXCEPTION( double const& 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 ); +} + +TEST_CASE("Thrown string literals are translated", "[.][failing][!throws]") { + throw "For some reason someone is throwing a string literal!"; +} + +TEST_CASE("thrown std::strings are translated", "[.][failing][!throws]") { + throw std::string{ "Why would you throw a std::string?" }; +} + + +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 ) ); + } +} + +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/packages/Catch2/tests/SelfTest/UsageTests/Generators.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Generators.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..acfef8a9bff366a63007f029d61d197b3520f31e --- /dev/null +++ b/packages/Catch2/tests/SelfTest/UsageTests/Generators.tests.cpp @@ -0,0 +1,276 @@ +#include <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generator_exception.hpp> +#include <catch2/generators/catch_generators_adapters.hpp> +#include <catch2/generators/catch_generators_random.hpp> +#include <catch2/generators/catch_generators_range.hpp> + +#include <cstring> + + +// Generators and sections can be nested freely +TEST_CASE("Generators -- simple", "[generators]") { + auto i = GENERATE(1, 2, 3); + SECTION("one") { + auto j = GENERATE(values({ -3, -2, -1 })); + REQUIRE(j < i); + } + + SECTION("two") { + // You can also explicitly set type for generators via Catch::Generators::as + auto str = GENERATE(as<std::string>{}, "a", "bb", "ccc"); + REQUIRE(4u * i > str.size()); + } +} + +// You can create a cartesian-product of generators by creating multiple ones +TEST_CASE("3x3x3 ints", "[generators]") { + auto x = GENERATE(1, 2, 3); + auto y = GENERATE(4, 5, 6); + auto z = GENERATE(7, 8, 9); + // These assertions will be run 27 times (3x3x3) + CHECK(x < y); + CHECK(y < z); + REQUIRE(x < z); +} + +// You can also create data tuples +TEST_CASE("tables", "[generators]") { + // Note that this will not compile with libstdc++ older than libstdc++6 + // See https://stackoverflow.com/questions/12436586/tuple-vector-and-initializer-list + // for possible workarounds + // auto data = GENERATE(table<char const*, int>({ + // {"first", 5}, + // {"second", 6}, + // {"third", 5}, + // {"etc...", 6} + // })); + + // Workaround for the libstdc++ bug mentioned above + using tuple_type = std::tuple<char const*, int>; + auto data = GENERATE(table<char const*, int>({ + tuple_type{"first", 5}, + tuple_type{"second", 6}, + tuple_type{"third", 5}, + tuple_type{"etc...", 6} + })); + + REQUIRE(strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data))); +} + + +#ifdef __cpp_structured_bindings + +// Structured bindings make the table utility much nicer to use +TEST_CASE( "strlen2", "[approvals][generators]" ) { + auto [test_input, expected] = GENERATE( table<std::string, size_t>({ + {"one", 3}, + {"two", 3}, + {"three", 5}, + {"four", 4} + })); + + REQUIRE( test_input.size() == expected ); +} +#endif + + +// An alternate way of doing data tables without structured bindings +struct Data { std::string str; size_t len; }; + +TEST_CASE( "strlen3", "[generators]" ) { + auto data = GENERATE( values<Data>({ + {"one", 3}, + {"two", 3}, + {"three", 5}, + {"four", 4} + })); + + REQUIRE( data.str.size() == data.len ); +} + + + +#ifdef __cpp_structured_bindings + +// Based on example from https://docs.cucumber.io/gherkin/reference/#scenario-outline +// (thanks to https://github.com/catchorg/Catch2/issues/850#issuecomment-399504851) + +// Note that GIVEN, WHEN, and THEN now forward onto DYNAMIC_SECTION instead of SECTION. +// DYNAMIC_SECTION takes its name as a stringstream-style expression, so can be formatted using +// variables in scope - such as the generated variables here. This reads quite nicely in the +// test name output (the full scenario description). + +static auto eatCucumbers( int start, int eat ) -> int { return start-eat; } + +SCENARIO("Eating cucumbers", "[generators][approvals]") { + + auto [start, eat, left] = GENERATE( table<int,int,int> ({ + { 12, 5, 7 }, + { 20, 5, 15 } + })); + + GIVEN( "there are " << start << " cucumbers" ) + WHEN( "I eat " << eat << " cucumbers" ) + THEN( "I should have " << left << " cucumbers" ) { + REQUIRE( eatCucumbers( start, eat ) == left ); + } +} +#endif + +// There are also some generic generator manipulators +TEST_CASE("Generators -- adapters", "[generators][generic]") { + // TODO: This won't work yet, introduce GENERATE_VAR? + //auto numbers = Catch::Generators::values({ 1, 2, 3, 4, 5, 6 }); + SECTION("Filtering by predicate") { + SECTION("Basic usage") { + // This filters out all odd (false) numbers, giving [2, 4, 6] + auto i = GENERATE(filter([] (int val) { return val % 2 == 0; }, values({ 1, 2, 3, 4, 5, 6 }))); + REQUIRE(i % 2 == 0); + } + SECTION("Throws if there are no matching values") { + using namespace Catch::Generators; + REQUIRE_THROWS_AS(filter([] (int) {return false; }, value(1)), Catch::GeneratorException); + } + } + SECTION("Shortening a range") { + // This takes the first 3 elements from the values, giving back [1, 2, 3] + auto i = GENERATE(take(3, values({ 1, 2, 3, 4, 5, 6 }))); + REQUIRE(i < 4); + } + SECTION("Transforming elements") { + SECTION("Same type") { + // This doubles values [1, 2, 3] into [2, 4, 6] + auto i = GENERATE(map([] (int val) { return val * 2; }, values({ 1, 2, 3 }))); + REQUIRE(i % 2 == 0); + } + SECTION("Different type") { + // This takes a generator that returns ints and maps them into strings + auto i = GENERATE(map<std::string>([] (int val) { return std::to_string(val); }, values({ 1, 2, 3 }))); + REQUIRE(i.size() == 1); + } + SECTION("Different deduced type") { + // This takes a generator that returns ints and maps them into strings + auto i = GENERATE(map([] (int val) { return std::to_string(val); }, values({ 1, 2, 3 }))); + REQUIRE(i.size() == 1); + } + } + SECTION("Repeating a generator") { + // This will return values [1, 2, 3, 1, 2, 3] + auto j = GENERATE(repeat(2, values({ 1, 2, 3 }))); + REQUIRE(j > 0); + } + SECTION("Chunking a generator into sized pieces") { + SECTION("Number of elements in source is divisible by chunk size") { + auto chunk2 = GENERATE(chunk(2, values({ 1, 1, 2, 2, 3, 3 }))); + REQUIRE(chunk2.size() == 2); + REQUIRE(chunk2.front() == chunk2.back()); + } + SECTION("Number of elements in source is not divisible by chunk size") { + auto chunk2 = GENERATE(chunk(2, values({ 1, 1, 2, 2, 3 }))); + REQUIRE(chunk2.size() == 2); + REQUIRE(chunk2.front() == chunk2.back()); + REQUIRE(chunk2.front() < 3); + } + SECTION("Chunk size of zero") { + auto chunk2 = GENERATE(take(3, chunk(0, value(1)))); + REQUIRE(chunk2.size() == 0); + } + SECTION("Throws on too small generators") { + using namespace Catch::Generators; + REQUIRE_THROWS_AS(chunk(2, value(1)), Catch::GeneratorException); + } + } +} + +// Note that because of the non-reproducibility of distributions, +// anything involving the random generators cannot be part of approvals +TEST_CASE("Random generator", "[generators][approvals]") { + SECTION("Infer int from integral arguments") { + auto val = GENERATE(take(4, random(0, 1))); + STATIC_REQUIRE(std::is_same<decltype(val), int>::value); + REQUIRE(0 <= val); + REQUIRE(val <= 1); + } + SECTION("Infer double from double arguments") { + auto val = GENERATE(take(4, random(0., 1.))); + STATIC_REQUIRE(std::is_same<decltype(val), double>::value); + REQUIRE(0. <= val); + REQUIRE(val < 1); + } +} + + +TEST_CASE("Nested generators and captured variables", "[generators]") { + // Workaround for old libstdc++ + using record = std::tuple<int, int>; + // Set up 3 ranges to generate numbers from + auto extent = GENERATE(table<int, int>({ + record{3, 7}, + record{-5, -3}, + record{90, 100} + })); + + auto from = std::get<0>(extent); + auto to = std::get<1>(extent); + + auto values = GENERATE_COPY(range(from, to)); + REQUIRE(values > -6); +} + +namespace { + size_t call_count = 0; + size_t test_count = 0; + std::vector<int> make_data() { + return { 1, 3, 5, 7, 9, 11 }; + } + std::vector<int> make_data_counted() { + ++call_count; + return make_data(); + } +} + +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wexit-time-destructors" +#endif + +TEST_CASE("Copy and then generate a range", "[generators]") { + SECTION("from var and iterators") { + static auto data = make_data(); + + // It is important to notice that a generator is only initialized + // **once** per run. What this means is that modifying data will not + // modify the underlying generator. + auto elem = GENERATE_REF(from_range(data.begin(), data.end())); + REQUIRE(elem % 2 == 1); + } + SECTION("From a temporary container") { + auto elem = GENERATE(from_range(make_data_counted())); + ++test_count; + REQUIRE(elem % 2 == 1); + } + SECTION("Final validation") { + REQUIRE(call_count == 1); + REQUIRE(make_data().size() == test_count); + } +} + +TEST_CASE("#1913 - GENERATE inside a for loop should not keep recreating the generator", "[regression][generators]") { + static int counter = 0; + for (int i = 0; i < 3; ++i) { + int _ = GENERATE(1, 2); + (void)_; + ++counter; + } + // There should be at most 6 (3 * 2) counter increments + REQUIRE(counter < 7); +} + +TEST_CASE("#1913 - GENERATEs can share a line", "[regression][generators]") { + int i = GENERATE(1, 2); int j = GENERATE(3, 4); + REQUIRE(i != j); +} + +#if defined(__clang__) +#pragma clang diagnostic pop +#endif diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Matchers.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Matchers.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..935434344d22f70e507a297ece25640a648e833f --- /dev/null +++ b/packages/Catch2/tests/SelfTest/UsageTests/Matchers.tests.cpp @@ -0,0 +1,1031 @@ +/* + * 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 <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_exception.hpp> +#include <catch2/matchers/catch_matchers_floating_point.hpp> +#include <catch2/matchers/catch_matchers_predicate.hpp> +#include <catch2/matchers/catch_matchers_string.hpp> +#include <catch2/matchers/catch_matchers_vector.hpp> +#include <catch2/matchers/catch_matchers_templated.hpp> + +#include <algorithm> +#include <cmath> +#include <list> +#include <sstream> + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wweak-vtables" +#pragma clang diagnostic ignored "-Wpadded" +#endif + +namespace { namespace MatchersTests { + +#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"; + } + + inline bool alwaysTrue(int) { return true; } + inline bool alwaysFalse(int) { return false; } + + +#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_) {} + + char const* what() const noexcept override { + return "SpecialException::what"; + } + + int i; + }; + + struct DerivedException : std::exception { + char const* what() const noexcept override { + return "DerivedException::what"; + } + }; + + void doesNotThrow() {} + + [[noreturn]] + void throwsSpecialException(int i) { + throw SpecialException{i}; + } + + [[noreturn]] + void throwsAsInt(int i) { + throw i; + } + + [[noreturn]] + void throwsDerivedException() { + throw DerivedException{}; + } + + class ExceptionMatcher : public Catch::Matchers::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; + +#ifdef __DJGPP__ + float nextafter(float from, float to) + { + return ::nextafterf(from, to); + } + + double nextafter(double from, double to) + { + return ::nextafter(from, to); + } +#else + using std::nextafter; +#endif + + 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)))) + +// DJGPP meets the above condition but <regex> does not work properly anyway +#ifndef __DJGPP__ + 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 + +#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")); + } + + template<typename T> + struct CustomAllocator : private std::allocator<T> + { + using size_type = size_t; + using difference_type = ptrdiff_t; + using pointer = T*; + using const_pointer = const T*; + using reference = T&; + using const_reference = const T&; + using value_type = T; + + template<typename U> + struct rebind + { using other = CustomAllocator<U>; }; + + using propagate_on_container_move_assignment = std::true_type; + using is_always_equal = std::true_type; + + CustomAllocator() = default; + + CustomAllocator(const CustomAllocator& other) + : std::allocator<T>(other) { } + + template<typename U> + CustomAllocator(const CustomAllocator<U>&) { } + + ~CustomAllocator() = default; + + using std::allocator<T>::address; + using std::allocator<T>::allocate; + using std::allocator<T>::construct; + using std::allocator<T>::deallocate; + using std::allocator<T>::max_size; + using std::allocator<T>::destroy; + }; + + 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<double> v3; + v3.push_back(1); + v3.push_back(2); + v3.push_back(3); + + std::vector<double> v4; + v4.push_back(1 + 1e-8); + v4.push_back(2 + 1e-8); + v4.push_back(3 + 1e-8); + + std::vector<int, CustomAllocator<int>> v5; + v5.push_back(1); + v5.push_back(2); + v5.push_back(3); + + std::vector<int, CustomAllocator<int>> v6; + v6.push_back(1); + v6.push_back(2); + + std::vector<int> empty; + + SECTION("Contains (element)") { + CHECK_THAT(v, VectorContains(1)); + CHECK_THAT(v, VectorContains(2)); + CHECK_THAT(v5, (VectorContains<int, CustomAllocator<int>>(2))); + } + SECTION("Contains (vector)") { + CHECK_THAT(v, Contains(v2)); + CHECK_THAT(v, Contains<int>({ 1, 2 })); + CHECK_THAT(v5, (Contains<int, std::allocator<int>, CustomAllocator<int>>(v2))); + + v2.push_back(3); // now exactly matches + CHECK_THAT(v, Contains(v2)); + + CHECK_THAT(v, Contains(empty)); + CHECK_THAT(empty, Contains(empty)); + + CHECK_THAT(v5, (Contains<int, std::allocator<int>, CustomAllocator<int>>(v2))); + CHECK_THAT(v5, Contains(v6)); + } + 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 + CHECK_THAT(v, Equals<int>({ 1, 2, 3 })); + v2.push_back(3); + CHECK_THAT(v, Equals(v2)); + + CHECK_THAT(v5, (Equals<int, std::allocator<int>, CustomAllocator<int>>(v2))); + + v6.push_back(3); + CHECK_THAT(v5, Equals(v6)); + } + SECTION("UnorderedEquals") { + CHECK_THAT(v, UnorderedEquals(v)); + CHECK_THAT(v, UnorderedEquals<int>({ 3, 2, 1 })); + 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)); + + CHECK_THAT(v5, (UnorderedEquals<int, std::allocator<int>, CustomAllocator<int>>(permuted))); + + auto v5_permuted = v5; + std::next_permutation(begin(v5_permuted), end(v5_permuted)); + CHECK_THAT(v5_permuted, UnorderedEquals(v5)); + } + } + + 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<double> v3; + v3.push_back(1); + v3.push_back(2); + v3.push_back(3); + + std::vector<double> v4; + v4.push_back(1.1); + v4.push_back(2.1); + v4.push_back(3.1); + + 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(throwsSpecialException(1), SpecialException, ExceptionMatcher{1}); + REQUIRE_THROWS_MATCHES(throwsSpecialException(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(throwsSpecialException(3), SpecialException, ExceptionMatcher{1}); + REQUIRE_THROWS_MATCHES(throwsSpecialException(4), SpecialException, ExceptionMatcher{1}); + } + } + + TEST_CASE("Floating point matchers: float", "[matchers][floating-point]") { + SECTION("Relative") { + REQUIRE_THAT(10.f, WithinRel(11.1f, 0.1f)); + REQUIRE_THAT(10.f, !WithinRel(11.2f, 0.1f)); + REQUIRE_THAT( 1.f, !WithinRel(0.f, 0.99f)); + REQUIRE_THAT(-0.f, WithinRel(0.f)); + SECTION("Some subnormal values") { + auto v1 = std::numeric_limits<float>::min(); + auto v2 = v1; + for (int i = 0; i < 5; ++i) { + v2 = std::nextafter(v1, 0.f); + } + REQUIRE_THAT(v1, WithinRel(v2)); + } + } + 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(11.f, !WithinAbs(10.f, 0.5f)); + REQUIRE_THAT(10.f, !WithinAbs(11.f, 0.5f)); + REQUIRE_THAT(-10.f, WithinAbs(-10.f, 0.5f)); + REQUIRE_THAT(-10.f, WithinAbs(-9.6f, 0.5f)); + } + SECTION("ULPs") { + REQUIRE_THAT(1.f, WithinULP(1.f, 0)); + + REQUIRE_THAT(nextafter(1.f, 2.f), WithinULP(1.f, 1)); + REQUIRE_THAT(0.f, WithinULP(nextafter(0.f, 1.f), 1)); + REQUIRE_THAT(1.f, WithinULP(nextafter(1.f, 0.f), 1)); + REQUIRE_THAT(1.f, !WithinULP(nextafter(1.f, 2.f), 0)); + + REQUIRE_THAT(1.f, WithinULP(1.f, 0)); + REQUIRE_THAT(-0.f, WithinULP(0.f, 0)); + } + 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(0.0001f, WithinAbs(0.f, 0.001f) || WithinRel(0.f, 0.1f)); + } + 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, static_cast<uint64_t>(-1)), std::domain_error); + + REQUIRE_NOTHROW(WithinRel(1.f, 0.f)); + REQUIRE_THROWS_AS(WithinRel(1.f, -0.2f), std::domain_error); + REQUIRE_THROWS_AS(WithinRel(1.f, 1.f), std::domain_error); + } + } + + TEST_CASE("Floating point matchers: double", "[matchers][floating-point]") { + SECTION("Relative") { + REQUIRE_THAT(10., WithinRel(11.1, 0.1)); + REQUIRE_THAT(10., !WithinRel(11.2, 0.1)); + REQUIRE_THAT(1., !WithinRel(0., 0.99)); + REQUIRE_THAT(-0., WithinRel(0.)); + SECTION("Some subnormal values") { + auto v1 = std::numeric_limits<double>::min(); + auto v2 = v1; + for (int i = 0; i < 5; ++i) { + v2 = std::nextafter(v1, 0); + } + REQUIRE_THAT(v1, WithinRel(v2)); + } + } + 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(11., !WithinAbs(10., 0.5)); + REQUIRE_THAT(10., !WithinAbs(11., 0.5)); + REQUIRE_THAT(-10., WithinAbs(-10., 0.5)); + REQUIRE_THAT(-10., WithinAbs(-9.6, 0.5)); + } + SECTION("ULPs") { + REQUIRE_THAT(1., WithinULP(1., 0)); + + REQUIRE_THAT(nextafter(1., 2.), WithinULP(1., 1)); + REQUIRE_THAT(0., WithinULP(nextafter(0., 1.), 1)); + REQUIRE_THAT(1., WithinULP(nextafter(1., 0.), 1)); + REQUIRE_THAT(1., !WithinULP(nextafter(1., 2.), 0)); + + REQUIRE_THAT(1., WithinULP(1., 0)); + REQUIRE_THAT(-0., WithinULP(0., 0)); + } + SECTION("Composed") { + REQUIRE_THAT(1., WithinAbs(1., 0.5) || WithinULP(2., 1)); + REQUIRE_THAT(1., WithinAbs(2., 0.5) || WithinULP(1., 0)); + REQUIRE_THAT(0.0001, WithinAbs(0., 0.001) || WithinRel(0., 0.1)); + } + SECTION("Constructor validation") { + REQUIRE_NOTHROW(WithinAbs(1., 0.)); + REQUIRE_THROWS_AS(WithinAbs(1., -1.), std::domain_error); + + REQUIRE_NOTHROW(WithinULP(1., 0)); + + REQUIRE_NOTHROW(WithinRel(1., 0.)); + REQUIRE_THROWS_AS(WithinRel(1., -0.2), std::domain_error); + REQUIRE_THROWS_AS(WithinRel(1., 1.), std::domain_error); + } + } + + TEST_CASE("Floating point matchers that are problematic in approvals", "[approvals][matchers][floating-point]") { + REQUIRE_THAT(NAN, !WithinAbs(NAN, 0)); + REQUIRE_THAT(NAN, !(WithinAbs(NAN, 100) || WithinULP(NAN, 123))); + REQUIRE_THAT(NAN, !WithinULP(NAN, 123)); + REQUIRE_THAT(INFINITY, WithinRel(INFINITY)); + REQUIRE_THAT(-INFINITY, !WithinRel(INFINITY)); + REQUIRE_THAT(1., !WithinRel(INFINITY)); + REQUIRE_THAT(INFINITY, !WithinRel(1.)); + REQUIRE_THAT(NAN, !WithinRel(NAN)); + REQUIRE_THAT(1., !WithinRel(NAN)); + REQUIRE_THAT(NAN, !WithinRel(1.)); + } + + TEST_CASE("Arbitrary predicate matcher", "[matchers][generic]") { + SECTION("Function pointer") { + REQUIRE_THAT(1, Predicate<int>(alwaysTrue, "always true")); + REQUIRE_THAT(1, !Predicate<int>(alwaysFalse, "always false")); + } + SECTION("Lambdas + different type") { + REQUIRE_THAT("Hello olleH", + Predicate<std::string>( + [] (std::string const& str) -> bool { return str.front() == str.back(); }, + "First and last character should be equal") + ); + + REQUIRE_THAT("This wouldn't pass", + !Predicate<std::string>( + [] (std::string const& str) -> bool { return str.front() == str.back(); } + ) + ); + } + } + + TEST_CASE("Regression test #1", "[matchers][vector]") { + // At some point, UnorderedEqualsMatcher skipped + // mismatched prefixed before doing the comparison itself + std::vector<char> actual = { 'a', 'b' }; + std::vector<char> expected = { 'c', 'b' }; + + CHECK_THAT(actual, !UnorderedEquals(expected)); + } + + TEST_CASE("Predicate matcher can accept const char*", "[matchers][compilation]") { + REQUIRE_THAT("foo", Predicate<const char*>([] (const char* const&) { return true; })); + } + + TEST_CASE("Vector Approx matcher", "[matchers][approx][vector]") { + using Catch::Matchers::Approx; + SECTION("Empty vector is roughly equal to an empty vector") { + std::vector<double> empty; + REQUIRE_THAT(empty, Approx(empty)); + } + SECTION("Vectors with elements") { + std::vector<double> v1({1., 2., 3.}); + SECTION("A vector is approx equal to itself") { + REQUIRE_THAT(v1, Approx(v1)); + REQUIRE_THAT(v1, Approx<double>({ 1., 2., 3. })); + } + std::vector<double> v2({1.5, 2.5, 3.5}); + SECTION("Different length") { + auto temp(v1); + temp.push_back(4); + REQUIRE_THAT(v1, !Approx(temp)); + } + SECTION("Same length, different elements") { + REQUIRE_THAT(v1, !Approx(v2)); + REQUIRE_THAT(v1, Approx(v2).margin(0.5)); + REQUIRE_THAT(v1, Approx(v2).epsilon(0.5)); + REQUIRE_THAT(v1, Approx(v2).epsilon(0.1).scale(500)); + } + } + } + + TEST_CASE("Vector Approx matcher -- failing", "[matchers][approx][vector][.failing]") { + using Catch::Matchers::Approx; + SECTION("Empty and non empty vectors are not approx equal") { + std::vector<double> empty, t1({1, 2}); + CHECK_THAT(empty, Approx(t1)); + } + SECTION("Just different vectors") { + std::vector<double> v1({2., 4., 6.}), v2({1., 3., 5.}); + CHECK_THAT(v1, Approx(v2)); + } + } + + TEST_CASE("Exceptions matchers", "[matchers][exceptions][!throws]") { + REQUIRE_THROWS_MATCHES(throwsDerivedException(), DerivedException, Message("DerivedException::what")); + REQUIRE_THROWS_MATCHES(throwsDerivedException(), DerivedException, !Message("derivedexception::what")); + REQUIRE_THROWS_MATCHES(throwsSpecialException(2), SpecialException, !Message("DerivedException::what")); + REQUIRE_THROWS_MATCHES(throwsSpecialException(2), SpecialException, Message("SpecialException::what")); + } + + struct CheckedTestingMatcher : Catch::Matchers::MatcherBase<int> { + mutable bool matchCalled = false; + bool matchSucceeds = false; + + bool match(int const&) const override { + matchCalled = true; + return matchSucceeds; + } + std::string describe() const override { + return "CheckedTestingMatcher set to " + (matchSucceeds ? std::string("succeed") : std::string("fail")); + } + }; + + TEST_CASE("Composed matchers shortcircuit", "[matchers][composed]") { + // Check that if first returns false, second is not touched + CheckedTestingMatcher first, second; + SECTION("MatchAllOf") { + first.matchSucceeds = false; + + Detail::MatchAllOf<int> matcher = + Detail::MatchAllOf<int>{} && first && second; + CHECK_FALSE( matcher.match( 1 ) ); + + // These two assertions are the important ones + REQUIRE(first.matchCalled); + REQUIRE(!second.matchCalled); + } + // Check that if first returns true, second is not touched + SECTION("MatchAnyOf") { + first.matchSucceeds = true; + + Detail::MatchAnyOf<int> matcher = + Detail::MatchAnyOf<int>{} || first || second; + CHECK( matcher.match( 1 ) ); + + // These two assertions are the important ones + REQUIRE(first.matchCalled); + REQUIRE(!second.matchCalled); + } + } + + struct CheckedTestingGenericMatcher : Catch::Matchers::MatcherGenericBase { + mutable bool matchCalled = false; + bool matchSucceeds = false; + + bool match(int const&) const { + matchCalled = true; + return matchSucceeds; + } + std::string describe() const override { + return "CheckedTestingGenericMatcher set to " + (matchSucceeds ? std::string("succeed") : std::string("fail")); + } + }; + + TEST_CASE("Composed generic matchers shortcircuit", "[matchers][composed][generic]") { + // Check that if first returns false, second is not touched + CheckedTestingGenericMatcher first, second; + SECTION("MatchAllOf") { + first.matchSucceeds = false; + + Detail::MatchAllOfGeneric<CheckedTestingGenericMatcher, + CheckedTestingGenericMatcher> + matcher{ first, second }; + + CHECK_FALSE( matcher.match( 1 ) ); + + // These two assertions are the important ones + REQUIRE(first.matchCalled); + REQUIRE(!second.matchCalled); + } + // Check that if first returns true, second is not touched + SECTION("MatchAnyOf") { + first.matchSucceeds = true; + + Detail::MatchAnyOfGeneric<CheckedTestingGenericMatcher, + CheckedTestingGenericMatcher> + matcher{ first, second }; + CHECK(matcher.match(1)); + + // These two assertions are the important ones + REQUIRE(first.matchCalled); + REQUIRE(!second.matchCalled); + } + } + + + template<typename Range> + struct EqualsRangeMatcher : Catch::Matchers::MatcherGenericBase { + + EqualsRangeMatcher(Range const& range) : m_range{ range } {} + + template<typename OtherRange> + bool match(OtherRange const& other) const { + using std::begin; + using std::end; + + return std::equal(begin(m_range), end(m_range), begin(other), end(other)); + } + + std::string describe() const override { + return "Equals: " + Catch::rangeToString(m_range); + } + + private: + Range const& m_range; + }; + + template<typename Range> + auto EqualsRange(const Range& range) -> EqualsRangeMatcher<Range> { + return EqualsRangeMatcher<Range>{range}; + } + + TEST_CASE("Combining templated matchers", "[matchers][templated]") { + std::array<int, 3> container{{ 1,2,3 }}; + + std::array<int, 3> a{{ 1,2,3 }}; + std::vector<int> b{ 0,1,2 }; + std::list<int> c{ 4,5,6 }; + + REQUIRE_THAT(container, EqualsRange(a) || EqualsRange(b) || EqualsRange(c)); + } + + TEST_CASE("Combining templated and concrete matchers", "[matchers][templated]") { + std::vector<int> vec{ 1, 3, 5 }; + + std::array<int, 3> a{{ 5, 3, 1 }}; + + REQUIRE_THAT(vec, + Predicate<std::vector<int>>([](auto const& v) { + return std::all_of(v.begin(), v.end(), [](int elem) { + return elem % 2 == 1; + }); + }, "All elements are odd") && + !EqualsRange(a)); + + const std::string str = "foobar"; + const std::array<char, 6> arr{{ 'f', 'o', 'o', 'b', 'a', 'r' }}; + const std::array<char, 6> bad_arr{{ 'o', 'o', 'f', 'b', 'a', 'r' }}; + + using Catch::Matchers::StartsWith; + using Catch::Matchers::EndsWith; + + REQUIRE_THAT(str, StartsWith("foo") && EqualsRange(arr) && EndsWith("bar")); + REQUIRE_THAT(str, StartsWith("foo") && !EqualsRange(bad_arr) && EndsWith("bar")); + + REQUIRE_THAT(str, EqualsRange(arr) && StartsWith("foo") && EndsWith("bar")); + REQUIRE_THAT(str, !EqualsRange(bad_arr) && StartsWith("foo") && EndsWith("bar")); + + REQUIRE_THAT(str, EqualsRange(bad_arr) || (StartsWith("foo") && EndsWith("bar"))); + REQUIRE_THAT(str, (StartsWith("foo") && EndsWith("bar")) || EqualsRange(bad_arr)); + } + + TEST_CASE("Combining concrete matchers does not use templated matchers", "[matchers][templated]") { + using Catch::Matchers::StartsWith; + using Catch::Matchers::EndsWith; + + STATIC_REQUIRE(std::is_same< + decltype(StartsWith("foo") || (StartsWith("bar") && EndsWith("bar") && !EndsWith("foo"))), + Catch::Matchers::Detail::MatchAnyOf<std::string> + >::value); + } + + struct MatcherA : Catch::Matchers::MatcherGenericBase { + std::string describe() const override { return "equals: (int) 1 or (float) 1.0f"; } + bool match(int i) const { return i == 1; } + bool match(float f) const { return f == 1.0f; } + }; + + struct MatcherB : Catch::Matchers::MatcherGenericBase { + std::string describe() const override { return "equals: (long long) 1"; } + bool match(long long l) const { return l == 1ll; } + }; + + struct MatcherC : Catch::Matchers::MatcherGenericBase { + std::string describe() const override { return "equals: (T) 1"; } + template<typename T> + bool match(T t) const { return t == T{1}; } + }; + + struct MatcherD : Catch::Matchers::MatcherGenericBase { + std::string describe() const override { return "equals: true"; } + bool match(bool b) const { return b == true; } + }; + + TEST_CASE("Combining only templated matchers", "[matchers][templated]") { + STATIC_REQUIRE(std::is_same< + decltype(MatcherA() || MatcherB()), + Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB> + >::value); + + REQUIRE_THAT(1, MatcherA() || MatcherB()); + + STATIC_REQUIRE(std::is_same< + decltype(MatcherA() && MatcherB()), + Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB> + >::value); + + REQUIRE_THAT(1, MatcherA() && MatcherB()); + + STATIC_REQUIRE(std::is_same< + decltype(MatcherA() || !MatcherB()), + Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, Catch::Matchers::Detail::MatchNotOfGeneric<MatcherB>> + >::value); + + REQUIRE_THAT(1, MatcherA() || !MatcherB()); + } + + TEST_CASE("Combining MatchAnyOfGeneric does not nest", "[matchers][templated]") { + // MatchAnyOfGeneric LHS + some matcher RHS + STATIC_REQUIRE(std::is_same< + decltype((MatcherA() || MatcherB()) || MatcherC()), + Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC> + >::value); + + REQUIRE_THAT(1, (MatcherA() || MatcherB()) || MatcherC()); + + // some matcher LHS + MatchAnyOfGeneric RHS + STATIC_REQUIRE(std::is_same< + decltype(MatcherA() || (MatcherB() || MatcherC())), + Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC> + >::value); + + REQUIRE_THAT(1, MatcherA() || (MatcherB() || MatcherC())); + + + // MatchAnyOfGeneric LHS + MatchAnyOfGeneric RHS + STATIC_REQUIRE(std::is_same< + decltype((MatcherA() || MatcherB()) || (MatcherC() || MatcherD())), + Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC, MatcherD> + >::value); + + REQUIRE_THAT(1, (MatcherA() || MatcherB()) || (MatcherC() || MatcherD())); + } + + TEST_CASE("Combining MatchAllOfGeneric does not nest", "[matchers][templated]") { + // MatchAllOfGeneric lhs + some matcher RHS + STATIC_REQUIRE(std::is_same< + decltype((MatcherA() && MatcherB()) && MatcherC()), + Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC> + >::value); + + REQUIRE_THAT(1, (MatcherA() && MatcherB()) && MatcherC()); + + // some matcher LHS + MatchAllOfGeneric RSH + STATIC_REQUIRE(std::is_same< + decltype(MatcherA() && (MatcherB() && MatcherC())), + Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC> + >::value); + + REQUIRE_THAT(1, MatcherA() && (MatcherB() && MatcherC())); + + + // MatchAllOfGeneric LHS + MatchAllOfGeneric RHS + STATIC_REQUIRE(std::is_same< + decltype((MatcherA() && MatcherB()) && (MatcherC() && MatcherD())), + Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC, MatcherD> + >::value); + + REQUIRE_THAT(1, (MatcherA() && MatcherB()) && (MatcherC() && MatcherD())); + } + + TEST_CASE("Combining MatchNotOfGeneric does not nest", "[matchers][templated]") { + STATIC_REQUIRE(std::is_same< + decltype(!MatcherA()), + Catch::Matchers::Detail::MatchNotOfGeneric<MatcherA> + >::value); + + REQUIRE_THAT(0, !MatcherA()); + + STATIC_REQUIRE(std::is_same< + decltype(!!MatcherA()), + MatcherA const& + >::value); + + REQUIRE_THAT(1, !!MatcherA()); + + STATIC_REQUIRE(std::is_same< + decltype(!!!MatcherA()), + Catch::Matchers::Detail::MatchNotOfGeneric<MatcherA> + >::value); + + REQUIRE_THAT(0, !!!MatcherA()); + + STATIC_REQUIRE(std::is_same< + decltype(!!!!MatcherA()), + MatcherA const & + >::value); + + REQUIRE_THAT(1, !!!!MatcherA()); + } + + struct EvilAddressOfOperatorUsed : std::exception { + EvilAddressOfOperatorUsed() {} + const char* what() const noexcept override { + return "overloaded address-of operator of matcher was used instead of std::addressof"; + } + }; + + struct EvilCommaOperatorUsed : std::exception { + EvilCommaOperatorUsed() {} + const char* what() const noexcept override { + return "overloaded comma operator of matcher was used"; + } + }; + + struct EvilMatcher : Catch::Matchers::MatcherGenericBase { + std::string describe() const override { + return "equals: 45"; + } + + bool match(int i) const { + return i == 45; + } + + EvilMatcher const* operator& () const { + throw EvilAddressOfOperatorUsed(); + } + + int operator,(EvilMatcher const&) const { + throw EvilCommaOperatorUsed(); + } + }; + + TEST_CASE("Overloaded comma or address-of operators are not used", "[matchers][templated]") { + REQUIRE_THROWS_AS((EvilMatcher(), EvilMatcher()), EvilCommaOperatorUsed); + REQUIRE_THROWS_AS(&EvilMatcher(), EvilAddressOfOperatorUsed); + REQUIRE_NOTHROW(EvilMatcher() || (EvilMatcher() && !EvilMatcher())); + REQUIRE_NOTHROW((EvilMatcher() && EvilMatcher()) || !EvilMatcher()); + } + + struct ImmovableMatcher : Catch::Matchers::MatcherGenericBase { + ImmovableMatcher() = default; + ImmovableMatcher(ImmovableMatcher const&) = delete; + ImmovableMatcher(ImmovableMatcher &&) = delete; + ImmovableMatcher& operator=(ImmovableMatcher const&) = delete; + ImmovableMatcher& operator=(ImmovableMatcher &&) = delete; + + std::string describe() const override { + return "always false"; + } + + template<typename T> + bool match(T&&) const { + return false; + } + }; + + struct MatcherWasMovedOrCopied : std::exception { + MatcherWasMovedOrCopied() {} + const char* what() const noexcept override { + return "attempted to copy or move a matcher"; + } + }; + + struct ThrowOnCopyOrMoveMatcher : Catch::Matchers::MatcherGenericBase { + ThrowOnCopyOrMoveMatcher() = default; + [[noreturn]] + ThrowOnCopyOrMoveMatcher(ThrowOnCopyOrMoveMatcher const&): Catch::Matchers::MatcherGenericBase() { + throw MatcherWasMovedOrCopied(); + } + [[noreturn]] + ThrowOnCopyOrMoveMatcher(ThrowOnCopyOrMoveMatcher &&): Catch::Matchers::MatcherGenericBase() { + throw MatcherWasMovedOrCopied(); + } + ThrowOnCopyOrMoveMatcher& operator=(ThrowOnCopyOrMoveMatcher const&) { + throw MatcherWasMovedOrCopied(); + } + ThrowOnCopyOrMoveMatcher& operator=(ThrowOnCopyOrMoveMatcher &&) { + throw MatcherWasMovedOrCopied(); + } + + std::string describe() const override { + return "always false"; + } + + template<typename T> + bool match(T&&) const { + return false; + } + }; + + TEST_CASE("Matchers are not moved or copied", "[matchers][templated][approvals]") { + REQUIRE_NOTHROW((ThrowOnCopyOrMoveMatcher() && ThrowOnCopyOrMoveMatcher()) || !ThrowOnCopyOrMoveMatcher()); + } + + TEST_CASE("Immovable matchers can be used", "[matchers][templated][approvals]") { + REQUIRE_THAT(123, (ImmovableMatcher() && ImmovableMatcher()) || !ImmovableMatcher()); + } + + struct ReferencingMatcher : Catch::Matchers::MatcherGenericBase { + std::string describe() const override { + return "takes reference"; + } + bool match(int& i) const { + return i == 22; + } + }; + + TEST_CASE("Matchers can take references", "[matchers][templated][approvals]") { + REQUIRE_THAT(22, ReferencingMatcher{}); + } + +} } // namespace MatchersTests + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif diff --git a/packages/Catch2/tests/SelfTest/UsageTests/MatchersRanges.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/MatchersRanges.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..912b5cdb63aabec303edd6150b28e70b22551309 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/UsageTests/MatchersRanges.tests.cpp @@ -0,0 +1,545 @@ +// 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 <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_container_properties.hpp> +#include <catch2/matchers/catch_matchers_contains.hpp> +#include <catch2/matchers/catch_matchers_floating_point.hpp> +#include <catch2/matchers/catch_matchers_quantifiers.hpp> +#include <catch2/matchers/catch_matchers_predicate.hpp> +#include <catch2/matchers/catch_matchers_string.hpp> + +#include <array> +#include <cmath> +#include <list> +#include <map> +#include <vector> + +namespace { +namespace unrelated { + class needs_ADL_begin { + std::array<int, 5> elements{ {1, 2, 3, 4, 5} }; + public: + using iterator = std::array<int, 5>::iterator; + using const_iterator = std::array<int, 5>::const_iterator; + + const_iterator Begin() const { return elements.begin(); } + const_iterator End() const { return elements.end(); } + + friend const_iterator begin(needs_ADL_begin const& lhs) { + return lhs.Begin(); + } + friend const_iterator end(needs_ADL_begin const& rhs) { + return rhs.End(); + } + }; +} // end unrelated namespace + +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wunused-function" +#endif + +class has_different_begin_end_types { + std::array<int, 5> elements{ {1, 2, 3, 4, 5} }; + + // Different type for the "end" iterator + struct iterator_end {}; + // Just a fake forward iterator, that only compares to a different + // type (so we can test two-type ranges). + struct iterator { + int const* start; + int const* end; + + using iterator_category = std::forward_iterator_tag; + using difference_type = std::ptrdiff_t; + using value_type = int; + using reference = int const&; + using pointer = int const*; + + + friend bool operator==( iterator iter, iterator_end ) { + return iter.start == iter.end; + } + friend bool operator!=( iterator iter, iterator_end ) { + return iter.start != iter.end; + } + iterator& operator++() { + ++start; + return *this; + } + iterator operator++(int) { + auto tmp(*this); + ++start; + return tmp; + } + reference operator*() const { + return *start; + } + pointer operator->() const { + return start; + } + }; + + +public: + iterator begin() const { + return { elements.data(), elements.data() + elements.size() }; + } + + iterator_end end() const { + return {}; + } +}; + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif + + +struct with_mocked_iterator_access { + static constexpr size_t data_size = 5; + std::array<int, data_size> elements{ {1, 2, 3, 4, 5} }; + std::array<bool, data_size> touched{}; + std::array<bool, data_size> derefed{}; + + // We want to check which elements were touched when iterating, so + // we can check whether iterator-using code traverses range correctly + struct iterator { + with_mocked_iterator_access* m_origin; + size_t m_origin_idx; + + using iterator_category = std::forward_iterator_tag; + using difference_type = std::ptrdiff_t; + using value_type = int; + using reference = int const&; + using pointer = int const*; + + friend bool operator==(iterator lhs, iterator rhs) { + return lhs.m_origin == rhs.m_origin + && lhs.m_origin_idx == rhs.m_origin_idx; + } + friend bool operator!=(iterator lhs, iterator rhs) { + return !(lhs == rhs); + } + iterator& operator++() { + ++m_origin_idx; + assert(m_origin_idx < data_size + 1 && "Outside of valid alloc"); + if (m_origin_idx < data_size) { + m_origin->touched[m_origin_idx] = true; + } + return *this; + } + iterator operator++(int) { + auto tmp(*this); + ++(*this); + return tmp; + } + reference operator*() const { + assert(m_origin_idx < data_size && "Attempted to deref invalid position"); + m_origin->derefed[m_origin_idx] = true; + return m_origin->elements[m_origin_idx]; + } + pointer operator->() const { + assert(m_origin_idx < data_size && "Attempted to deref invalid position"); + return &m_origin->elements[m_origin_idx]; + } + + }; + + iterator begin() const { + // Const-cast away to avoid overcomplicating the iterators + // We should actually fix this over time + return { const_cast<with_mocked_iterator_access*>(this), 0 }; + } + iterator end() const { + return { const_cast<with_mocked_iterator_access*>(this), data_size }; + } + +}; + +} // end anon namespace + +namespace Catch { + template <> + struct StringMaker<with_mocked_iterator_access> { + static std::string convert(with_mocked_iterator_access const& access) { + // We have to avoid the type's iterators, because we check + // their use in tests + return ::Catch::Detail::stringify(access.elements); + } + }; +} + +struct MoveOnlyTestElement { + int num = 0; + MoveOnlyTestElement(int n) :num(n) {} + + MoveOnlyTestElement(MoveOnlyTestElement&& rhs) = default; + MoveOnlyTestElement& operator=(MoveOnlyTestElement&& rhs) = default; + + friend bool operator==(MoveOnlyTestElement const& lhs, MoveOnlyTestElement const& rhs) { + return lhs.num == rhs.num; + } + + friend std::ostream& operator<<(std::ostream& out, MoveOnlyTestElement const& elem) { + out << elem.num; + return out; + } +}; + +TEST_CASE("Basic use of the Contains range matcher", "[matchers][templated][contains]") { + using Catch::Matchers::Contains; + + SECTION("Different argument ranges, same element type, default comparison") { + std::array<int, 3> a{ { 1,2,3 } }; + std::vector<int> b{ 0,1,2 }; + std::list<int> c{ 4,5,6 }; + + // A contains 1 + REQUIRE_THAT(a, Contains(1)); + // B contains 1 + REQUIRE_THAT(b, Contains(1)); + // C does not contain 1 + REQUIRE_THAT(c, !Contains(1)); + } + + SECTION("Different argument ranges, same element type, custom comparison") { + std::array<int, 3> a{ { 1,2,3 } }; + std::vector<int> b{ 0,1,2 }; + std::list<int> c{ 4,5,6 }; + + auto close_enough = [](int lhs, int rhs) { return std::abs(lhs - rhs) <= 1; }; + + // A contains 1, which is "close enough" to 0 + REQUIRE_THAT(a, Contains(0, close_enough)); + // B contains 0 directly + REQUIRE_THAT(b, Contains(0, close_enough)); + // C does not contain anything "close enough" to 0 + REQUIRE_THAT(c, !Contains(0, close_enough)); + } + + SECTION("Different element type, custom comparisons") { + std::array<std::string, 3> a{ { "abc", "abcd" , "abcde" } }; + + REQUIRE_THAT(a, Contains(4, [](auto&& lhs, size_t sz) { + return lhs.size() == sz; + })); + } + + SECTION("Can handle type that requires ADL-found free function begin and end") { + unrelated::needs_ADL_begin in; + + REQUIRE_THAT(in, Contains(1)); + REQUIRE_THAT(in, !Contains(8)); + } + + SECTION("Initialization with move only types") { + std::array<MoveOnlyTestElement, 3> in{ { MoveOnlyTestElement{ 1 }, MoveOnlyTestElement{ 2 }, MoveOnlyTestElement{ 3 } } }; + + REQUIRE_THAT(in, Contains(MoveOnlyTestElement{ 2 })); + REQUIRE_THAT(in, !Contains(MoveOnlyTestElement{ 9 })); + } + + SECTION("Matching using matcher") { + std::array<double, 4> in{ {1, 2, 3} }; + + REQUIRE_THAT(in, Contains(Catch::Matchers::WithinAbs(0.5, 0.5))); + } +} + +namespace { + + struct has_empty { + bool empty() const { return false; } + }; + +namespace unrelated { + struct ADL_empty { + bool Empty() const { return true; } + + friend bool empty(ADL_empty e) { + return e.Empty(); + } + }; + +} // end namespace unrelated +} // end unnamed namespace + +TEST_CASE("Basic use of the Empty range matcher", "[matchers][templated][empty]") { + using Catch::Matchers::IsEmpty; + SECTION("Simple, std-provided containers") { + std::array<int, 0> empty_array{}; + std::array<double, 1> non_empty_array{}; + REQUIRE_THAT(empty_array, IsEmpty()); + REQUIRE_THAT(non_empty_array, !IsEmpty()); + + std::vector<std::string> empty_vec; + std::vector<char> non_empty_vec{ 'a', 'b', 'c' }; + REQUIRE_THAT(empty_vec, IsEmpty()); + REQUIRE_THAT(non_empty_vec, !IsEmpty()); + + std::list<std::list<std::list<int>>> inner_lists_are_empty; + inner_lists_are_empty.push_back({}); + REQUIRE_THAT(inner_lists_are_empty, !IsEmpty()); + REQUIRE_THAT(inner_lists_are_empty.front(), IsEmpty()); + } + SECTION("Type with empty") { + REQUIRE_THAT(has_empty{}, !IsEmpty()); + } + SECTION("Type requires ADL found empty free function") { + REQUIRE_THAT(unrelated::ADL_empty{}, IsEmpty()); + } +} + +namespace { + class LessThanMatcher final : public Catch::Matchers::MatcherBase<size_t> { + size_t m_target; + public: + explicit LessThanMatcher(size_t target): + m_target(target) + {} + + bool match(size_t const& size) const override { + return size < m_target; + } + + std::string describe() const override { + return "is less than " + std::to_string(m_target); + } + }; + + LessThanMatcher Lt(size_t sz) { + return LessThanMatcher{ sz }; + } + + namespace unrelated { + struct ADL_size { + size_t sz() const { + return 12; + } + friend size_t size(ADL_size s) { + return s.sz(); + } + }; + } // end namespace unrelated + + struct has_size { + size_t size() const { + return 13; + } + }; + +} // end unnamed namespace + +TEST_CASE("Usage of the SizeIs range matcher", "[matchers][templated][size]") { + using Catch::Matchers::SizeIs; + SECTION("Some with stdlib containers") { + std::vector<int> empty_vec; + REQUIRE_THAT(empty_vec, SizeIs(0)); + REQUIRE_THAT(empty_vec, !SizeIs(2)); + REQUIRE_THAT(empty_vec, SizeIs(Lt(2))); + + std::array<int, 2> arr{}; + REQUIRE_THAT(arr, SizeIs(2)); + REQUIRE_THAT(arr, SizeIs( Lt(3))); + REQUIRE_THAT(arr, !SizeIs(!Lt(3))); + + std::map<int, int> map{ {1, 1}, {2, 2}, {3, 3} }; + REQUIRE_THAT(map, SizeIs(3)); + } + SECTION("Type requires ADL found size free function") { + REQUIRE_THAT(unrelated::ADL_size{}, SizeIs(12)); + } + SECTION("Type has size member") { + REQUIRE_THAT(has_size{}, SizeIs(13)); + } +} + + +TEST_CASE("Usage of AllMatch range matcher", "[matchers][templated][quantifiers]") { + using Catch::Matchers::AllMatch; + using Catch::Matchers::Predicate; + + SECTION("Basic usage") { + using Catch::Matchers::Contains; + using Catch::Matchers::SizeIs; + + std::array<std::array<int, 5>, 5> data{{ + {{ 0, 1, 2, 3, 5 }}, + {{ 4,-3,-2, 5, 0 }}, + {{ 0, 0, 0, 5, 0 }}, + {{ 0,-5, 0, 5, 0 }}, + {{ 1, 0, 0,-1, 5 }} + }}; + + REQUIRE_THAT(data, AllMatch(SizeIs(5))); + REQUIRE_THAT(data, !AllMatch(Contains(0) && Contains(1))); + } + + SECTION("Type requires ADL found begin and end") { + unrelated::needs_ADL_begin needs_adl; + REQUIRE_THAT( needs_adl, AllMatch( Predicate<int>( []( int elem ) { + return elem < 6; + } ) ) ); + } + + SECTION("Shortcircuiting") { + with_mocked_iterator_access mocked; + SECTION("All are read") { + auto allMatch = AllMatch(Predicate<int>([](int elem) { + return elem < 10; + })); + REQUIRE_THAT(mocked, allMatch); + REQUIRE(mocked.derefed[0]); + REQUIRE(mocked.derefed[1]); + REQUIRE(mocked.derefed[2]); + REQUIRE(mocked.derefed[3]); + REQUIRE(mocked.derefed[4]); + } + SECTION("Short-circuited") { + auto allMatch = AllMatch(Predicate<int>([](int elem) { + return elem < 3; + })); + REQUIRE_THAT(mocked, !allMatch); + REQUIRE(mocked.derefed[0]); + REQUIRE(mocked.derefed[1]); + REQUIRE(mocked.derefed[2]); + REQUIRE_FALSE(mocked.derefed[3]); + REQUIRE_FALSE(mocked.derefed[4]); + } + } +} + +TEST_CASE("Usage of AnyMatch range matcher", "[matchers][templated][quantifiers]") { + using Catch::Matchers::AnyMatch; + using Catch::Matchers::Predicate; + + SECTION("Basic usage") { + using Catch::Matchers::Contains; + using Catch::Matchers::SizeIs; + + std::array<std::array<int, 5>, 5> data{ { + {{ 0, 1, 2, 3, 5 }}, + {{ 4,-3,-2, 5, 0 }}, + {{ 0, 0, 0, 5, 0 }}, + {{ 0,-5, 0, 5, 0 }}, + {{ 1, 0, 0,-1, 5 }} + } }; + + REQUIRE_THAT(data, AnyMatch(SizeIs(5))); + REQUIRE_THAT(data, !AnyMatch(Contains(0) && Contains(10))); + } + + SECTION("Type requires ADL found begin and end") { + unrelated::needs_ADL_begin needs_adl; + REQUIRE_THAT( needs_adl, AnyMatch( Predicate<int>( []( int elem ) { + return elem < 3; + } ) ) ); + } + + SECTION("Shortcircuiting") { + with_mocked_iterator_access mocked; + SECTION("All are read") { + auto anyMatch = AnyMatch( + Predicate<int>( []( int elem ) { return elem > 10; } ) ); + REQUIRE_THAT( mocked, !anyMatch ); + REQUIRE( mocked.derefed[0] ); + REQUIRE( mocked.derefed[1] ); + REQUIRE( mocked.derefed[2] ); + REQUIRE( mocked.derefed[3] ); + REQUIRE( mocked.derefed[4] ); + } + SECTION("Short-circuited") { + auto anyMatch = AnyMatch( + Predicate<int>( []( int elem ) { return elem < 3; } ) ); + REQUIRE_THAT( mocked, anyMatch ); + REQUIRE( mocked.derefed[0] ); + REQUIRE_FALSE( mocked.derefed[1] ); + REQUIRE_FALSE( mocked.derefed[2] ); + REQUIRE_FALSE( mocked.derefed[3] ); + REQUIRE_FALSE( mocked.derefed[4] ); + } + } +} + +TEST_CASE("Usage of NoneMatch range matcher", "[matchers][templated][quantifiers]") { + using Catch::Matchers::NoneMatch; + using Catch::Matchers::Predicate; + + SECTION("Basic usage") { + using Catch::Matchers::Contains; + using Catch::Matchers::SizeIs; + + std::array<std::array<int, 5>, 5> data{ { + {{ 0, 1, 2, 3, 5 }}, + {{ 4,-3,-2, 5, 0 }}, + {{ 0, 0, 0, 5, 0 }}, + {{ 0,-5, 0, 5, 0 }}, + {{ 1, 0, 0,-1, 5 }} + } }; + + REQUIRE_THAT(data, NoneMatch(SizeIs(6))); + REQUIRE_THAT(data, !NoneMatch(Contains(0) && Contains(1))); + } + + SECTION( "Type requires ADL found begin and end" ) { + unrelated::needs_ADL_begin needs_adl; + REQUIRE_THAT( needs_adl, NoneMatch( Predicate<int>( []( int elem ) { + return elem > 6; + } ) ) ); + } + + SECTION("Shortcircuiting") { + with_mocked_iterator_access mocked; + SECTION("All are read") { + auto noneMatch = NoneMatch( + Predicate<int>([](int elem) { return elem > 10; })); + REQUIRE_THAT(mocked, noneMatch); + REQUIRE(mocked.derefed[0]); + REQUIRE(mocked.derefed[1]); + REQUIRE(mocked.derefed[2]); + REQUIRE(mocked.derefed[3]); + REQUIRE(mocked.derefed[4]); + } + SECTION("Short-circuited") { + auto noneMatch = NoneMatch( + Predicate<int>([](int elem) { return elem < 3; })); + REQUIRE_THAT(mocked, !noneMatch); + REQUIRE(mocked.derefed[0]); + REQUIRE_FALSE(mocked.derefed[1]); + REQUIRE_FALSE(mocked.derefed[2]); + REQUIRE_FALSE(mocked.derefed[3]); + REQUIRE_FALSE(mocked.derefed[4]); + } + } +} + + +// This is a C++17 extension, and GCC refuses to compile such code +// unless it is set to C++17 or later +#if defined(CATCH_CPP17_OR_GREATER) + +TEST_CASE( "The quantifier range matchers support types with different types returned from begin and end", + "[matchers][templated][quantifiers][approvals]" ) { + using Catch::Matchers::AllMatch; + using Catch::Matchers::AnyMatch; + using Catch::Matchers::NoneMatch; + + using Catch::Matchers::Predicate; + + has_different_begin_end_types diff_types; + REQUIRE_THAT( diff_types, !AllMatch( Predicate<int>( []( int elem ) { + return elem < 3; + } ) ) ); + + REQUIRE_THAT( diff_types, AnyMatch( Predicate<int>( []( int elem ) { + return elem < 2; + } ) ) ); + + REQUIRE_THAT( diff_types, !NoneMatch( Predicate<int>( []( int elem ) { + return elem < 3; + } ) ) ); +} + +#endif diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Message.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Message.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a30c2e9edfb94496ee536c017b18fc25ba913600 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/UsageTests/Message.tests.cpp @@ -0,0 +1,266 @@ +/* + * 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 <catch2/catch_test_macros.hpp> +#include <iostream> + +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( "#1455 - INFO and WARN can start with a linebreak", "[messages][.]" ) { + // Previously these would be hidden from the console reporter output, + // because it would fail at properly reflowing the text + INFO( "\nThis info message starts with a linebreak" ); + WARN( "\nThis warning message starts with a linebreak" ); +} + +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 ) ); +} + +template <typename T> +static void unscoped_info( T msg ) { + UNSCOPED_INFO( msg ); +} + +TEST_CASE( "just unscoped info", "[unscoped][info]" ) { + unscoped_info( "this should NOT be seen" ); + unscoped_info( "this also should NOT be seen" ); +} + +TEST_CASE( "just failure after unscoped info", "[failing][.][unscoped][info]" ) { + FAIL( "previous unscoped info SHOULD not be seen" ); +} + +TEST_CASE( "print unscoped info if passing unscoped info is printed", "[unscoped][info]" ) { + unscoped_info( "this MAY be seen IF info is printed for passing assertions" ); + REQUIRE( true ); +} + +TEST_CASE( "prints unscoped info on failure", "[failing][.][unscoped][info]" ) { + unscoped_info( "this SHOULD be seen" ); + unscoped_info( "this SHOULD also be seen" ); + REQUIRE( false ); + unscoped_info( "but this should NOT be seen" ); +} + +TEST_CASE( "not prints unscoped info from previous failures", "[failing][.][unscoped][info]" ) { + unscoped_info( "this MAY be seen only for the FIRST assertion IF info is printed for passing assertions" ); + REQUIRE( true ); + unscoped_info( "this MAY be seen only for the SECOND assertion IF info is printed for passing assertions" ); + REQUIRE( true ); + unscoped_info( "this SHOULD be seen" ); + REQUIRE( false ); +} + +TEST_CASE( "prints unscoped info only for the first assertion", "[failing][.][unscoped][info]" ) { + unscoped_info( "this SHOULD be seen only ONCE" ); + CHECK( false ); + CHECK( true ); + unscoped_info( "this MAY also be seen only ONCE IF info is printed for passing assertions" ); + CHECK( true ); + CHECK( true ); +} + +TEST_CASE( "stacks unscoped info in loops", "[failing][.][unscoped][info]" ) { + UNSCOPED_INFO("Count 1 to 3..."); + for (int i = 1; i <= 3; i++) { + unscoped_info(i); + } + CHECK( false ); + + UNSCOPED_INFO("Count 4 to 6..."); + for (int i = 4; i <= 6; i++) { + unscoped_info(i); + } + CHECK( false ); +} + +TEST_CASE( "mix info, unscoped info and warning", "[unscoped][info]" ) { + INFO("info"); + unscoped_info("unscoped info"); + WARN("and warn may mix"); + WARN("they are not cleared after warnings"); +} + +TEST_CASE( "CAPTURE can deal with complex expressions", "[messages][capture]" ) { + int a = 1; + int b = 2; + int c = 3; + CAPTURE( a, b, c, a + b, a+b, c > b, a == 1 ); + SUCCEED(); +} + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-value" // In (1, 2), the "1" is unused ... +#endif +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-value" // All the comma operators are side-effect free +#endif +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:4709) // comma in indexing operator +#endif + +template <typename T1, typename T2> +struct helper_1436 { + helper_1436(T1 t1_, T2 t2_): + t1{ t1_ }, + t2{ t2_ } + {} + T1 t1; + T2 t2; +}; + +template <typename T1, typename T2> +std::ostream& operator<<(std::ostream& out, helper_1436<T1, T2> const& helper) { + out << "{ " << helper.t1 << ", " << helper.t2 << " }"; + return out; +} + +TEST_CASE("CAPTURE can deal with complex expressions involving commas", "[messages][capture]") { + CAPTURE(std::vector<int>{1, 2, 3}[0, 1, 2], + std::vector<int>{1, 2, 3}[(0, 1)], + std::vector<int>{1, 2, 3}[0]); + CAPTURE((helper_1436<int, int>{12, -12}), + (helper_1436<int, int>(-12, 12))); + CAPTURE( (1, 2), (2, 3) ); + SUCCEED(); +} + +TEST_CASE("CAPTURE parses string and character constants", "[messages][capture]") { + CAPTURE(("comma, in string", "escaped, \", "), "single quote in string,',", "some escapes, \\,\\\\"); + CAPTURE("some, ), unmatched, } prenheses {[<"); + CAPTURE('"', '\'', ',', '}', ')', '(', '{'); + SUCCEED(); +} + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif +#ifdef _MSC_VER +#pragma warning(pop) +#endif diff --git a/packages/Catch2/tests/SelfTest/UsageTests/Misc.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Misc.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..277723a8b71f1621c852f862dd22672450b9836c --- /dev/null +++ b/packages/Catch2/tests/SelfTest/UsageTests/Misc.tests.cpp @@ -0,0 +1,492 @@ +/* + * 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 <catch2/catch_test_macros.hpp> +#include <catch2/catch_template_test_macros.hpp> +#include <catch2/internal/catch_config_wchar.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 <array> +#include <tuple> + +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_START_WARNINGS_SUPPRESSION +CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS +static AutoTestReg autoTestReg; +CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION + +template<typename T> +struct Foo { + size_t size() { return 0; } +}; + +template<typename T, size_t S> +struct Bar { + size_t size() { return S; } +}; +#endif + +TEST_CASE( "random SECTION tests", "[.][sections][failing]" ) { + int a = 1; + int b = 2; + + SECTION( "doesn't equal" ) { + REQUIRE( a != b ); + REQUIRE( b != a ); + } + + SECTION( "not equal" ) { + REQUIRE( a != b); + } +} + +TEST_CASE( "nested SECTION tests", "[.][sections][failing]" ) { + int a = 1; + int b = 2; + + SECTION( "doesn't equal" ) { + REQUIRE( a != b ); + REQUIRE( b != a ); + + SECTION( "not equal" ) { + REQUIRE( a != b); + } + } +} + +TEST_CASE( "more nested SECTION tests", "[sections][failing][.]" ) { + int a = 1; + int b = 2; + + SECTION( "doesn't equal" ) { + SECTION( "equal" ) { + REQUIRE( a == b ); + } + + SECTION( "not equal" ) { + REQUIRE( a != b ); + } + SECTION( "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 ) { + DYNAMIC_SECTION( "b is currently: " << b ) { + 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 ); + } +} + +TEMPLATE_TEST_CASE( "TemplateTest: vectors can be sized and resized", "[vector][template]", int, float, std::string, (std::tuple<int,float>) ) { + + std::vector<TestType> 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<TestType> 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 ); + } +} + +TEMPLATE_TEST_CASE_SIG("TemplateTestSig: vectors can be sized and resized", "[vector][template][nttp]", ((typename TestType, int V), TestType, V), (int,5), (float,4), (std::string,15), ((std::tuple<int, float>), 6)) { + + std::vector<TestType> v(V); + + REQUIRE(v.size() == V); + REQUIRE(v.capacity() >= V); + + SECTION("resizing bigger changes size and capacity") { + v.resize(2 * V); + + REQUIRE(v.size() == 2 * V); + REQUIRE(v.capacity() >= 2 * V); + } + SECTION("resizing smaller changes size but not capacity") { + v.resize(0); + + REQUIRE(v.size() == 0); + REQUIRE(v.capacity() >= V); + + SECTION("We can use the 'swap trick' to reset the capacity") { + std::vector<TestType> empty; + empty.swap(v); + + REQUIRE(v.capacity() == 0); + } + } + SECTION("reserving bigger changes capacity but not size") { + v.reserve(2 * V); + + REQUIRE(v.size() == V); + REQUIRE(v.capacity() >= 2 * V); + } + SECTION("reserving smaller does not change size or capacity") { + v.reserve(0); + + REQUIRE(v.size() == V); + REQUIRE(v.capacity() >= V); + } +} + +TEMPLATE_PRODUCT_TEST_CASE("A Template product test case", "[template][product]", (std::vector, Foo), (int, float)) { + TestType x; + REQUIRE(x.size() == 0); +} + +TEMPLATE_PRODUCT_TEST_CASE_SIG("A Template product test case with array signature", "[template][product][nttp]", ((typename T, size_t S), T, S), (std::array, Bar), ((int, 9), (float, 42))) { + TestType x; + REQUIRE(x.size() > 0); +} + +TEMPLATE_PRODUCT_TEST_CASE("Product with differing arities", "[template][product]", std::tuple, (int, (int, double), (int, double, float))) { + REQUIRE(std::tuple_size<TestType>::value >= 1); +} + +using MyTypes = std::tuple<int, char, float>; +TEMPLATE_LIST_TEST_CASE("Template test case with test types specified inside std::tuple", "[template][list]", MyTypes) +{ + REQUIRE(sizeof(TestType) > 0); +} + +struct NonDefaultConstructibleType { + NonDefaultConstructibleType() = delete; +}; + +using MyNonDefaultConstructibleTypes = std::tuple<NonDefaultConstructibleType, float>; +TEMPLATE_LIST_TEST_CASE("Template test case with test types specified inside non-default-constructible std::tuple", "[template][list]", MyNonDefaultConstructibleTypes) +{ + REQUIRE(sizeof(TestType) > 0); +} + +struct NonCopyableAndNonMovableType { + NonCopyableAndNonMovableType() = default; + + NonCopyableAndNonMovableType(NonCopyableAndNonMovableType const &) = delete; + NonCopyableAndNonMovableType(NonCopyableAndNonMovableType &&) = delete; + auto operator=(NonCopyableAndNonMovableType const &) -> NonCopyableAndNonMovableType & = delete; + auto operator=(NonCopyableAndNonMovableType &&) -> NonCopyableAndNonMovableType & = delete; +}; + +using NonCopyableAndNonMovableTypes = std::tuple<NonCopyableAndNonMovableType, float>; +TEMPLATE_LIST_TEST_CASE("Template test case with test types specified inside non-copyable and non-movable std::tuple", "[template][list]", NonCopyableAndNonMovableTypes) +{ + REQUIRE(sizeof(TestType) > 0); +} + +// 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 ); +} + + +#if defined(CATCH_CONFIG_WCHAR) +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*>( 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\"" ); +} +#endif // CATCH_CONFIG_WCHAR + +TEST_CASE( "long long" ) { + long long l = std::numeric_limits<long long>::max(); + + REQUIRE( l == std::numeric_limits<long long>::max() ); +} + +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" ); + } + } +} + +TEST_CASE( "#1175 - Hidden Test", "[.]" ) { + // Just for checking that hidden test is not listed by default + SUCCEED(); +} + +TEMPLATE_TEST_CASE_SIG("#1954 - 7 arg template test case sig compiles", "[regression][.compilation]", + ((int Tnx, int Tnu, int Tny, int Tph, int Tch, int Tineq, int Teq), Tnx, Tnu, Tny, Tph, Tch, Tineq, Teq), + (1, 1, 1, 1, 1, 0, 0), (5, 1, 1, 1, 1, 0, 0), (5, 3, 1, 1, 1, 0, 0)) { + SUCCEED(); +} + +}} // namespace MiscTests diff --git a/packages/Catch2/tests/SelfTest/UsageTests/ToStringByte.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/ToStringByte.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ceb94e22f8fc556e3cb1ba1b473e9b3f6a3dd61d --- /dev/null +++ b/packages/Catch2/tests/SelfTest/UsageTests/ToStringByte.tests.cpp @@ -0,0 +1,15 @@ +#include <catch2/catch_test_macros.hpp> + +#if defined(CATCH_CONFIG_CPP17_BYTE) + +TEST_CASE( "std::byte -> toString", "[toString][byte][approvals]" ) { + using type = std::byte; + REQUIRE( "0" == ::Catch::Detail::stringify( type{ 0 } ) ); +} + +TEST_CASE( "std::vector<std::byte> -> toString", "[toString][byte][approvals]" ) { + using type = std::vector<std::byte>; + REQUIRE( "{ 0, 1, 2 }" == ::Catch::Detail::stringify( type{ std::byte{0}, std::byte{1}, std::byte{2} } ) ); +} + +#endif // CATCH_INTERNAL_CONFIG_CPP17_BYTE diff --git a/packages/Catch2/tests/SelfTest/UsageTests/ToStringChrono.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/ToStringChrono.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..27a3dc3d31e49503ee06c7d03aac6ea2b233d268 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/UsageTests/ToStringChrono.tests.cpp @@ -0,0 +1,43 @@ +#include <catch2/catch_test_macros.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/packages/Catch2/tests/SelfTest/UsageTests/ToStringGeneral.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/ToStringGeneral.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c738b32c5413be14437c07badaa78d637fc15a37 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/UsageTests/ToStringGeneral.tests.cpp @@ -0,0 +1,208 @@ +/* + * 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 <catch2/catch_test_macros.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" } })"); + } +} + +#ifdef CATCH_CONFIG_CPP17_STRING_VIEW + +TEST_CASE("String views are stringified like other strings", "[toString][approvals]") { + std::string_view view{"abc"}; + CHECK(Catch::Detail::stringify(view) == R"("abc")"); + + std::string_view arr[] { view }; + CHECK(Catch::Detail::stringify(arr) == R"({ "abc" })"); +} + +#endif + +TEST_CASE("Precision of floating point stringification can be set", "[toString][floatingPoint]") { + SECTION("Floats") { + using sm = Catch::StringMaker<float>; + const auto oldPrecision = sm::precision; + + const float testFloat = 1.12345678901234567899f; + auto str1 = sm::convert(testFloat); + sm::precision = 5; + // "1." prefix = 2 chars, f suffix is another char + CHECK(str1.size() == 3 + 5); + + sm::precision = 10; + auto str2 = sm::convert(testFloat); + REQUIRE(str2.size() == 3 + 10); + sm::precision = oldPrecision; + } + SECTION("Double") { + using sm = Catch::StringMaker<double>; + const auto oldPrecision = sm::precision; + + const double testDouble = 1.123456789012345678901234567899; + sm::precision = 5; + auto str1 = sm::convert(testDouble); + // "1." prefix = 2 chars + CHECK(str1.size() == 2 + 5); + + sm::precision = 15; + auto str2 = sm::convert(testDouble); + REQUIRE(str2.size() == 2 + 15); + + sm::precision = oldPrecision; + } +} + +namespace { + +struct WhatException : std::exception { + char const* what() const noexcept override { + return "This exception has overridden what() method"; + } + ~WhatException() override; +}; + +struct OperatorException : std::exception { + ~OperatorException() override; +}; + +std::ostream& operator<<(std::ostream& out, OperatorException const&) { + out << "OperatorException"; + return out; +} + +struct StringMakerException : std::exception { + ~StringMakerException() override; +}; + +} // end anonymous namespace + +namespace Catch { +template <> +struct StringMaker<StringMakerException> { + static std::string convert(StringMakerException const&) { + return "StringMakerException"; + } +}; +} + +// Avoid -Wweak-tables +WhatException::~WhatException() = default; +OperatorException::~OperatorException() = default; +StringMakerException::~StringMakerException() = default; + + + + +TEST_CASE("Exception as a value (e.g. in REQUIRE_THROWS_MATCHES) can be stringified", "[toString][exception]") { + REQUIRE(::Catch::Detail::stringify(WhatException{}) == "This exception has overridden what() method"); + REQUIRE(::Catch::Detail::stringify(OperatorException{}) == "OperatorException"); + REQUIRE(::Catch::Detail::stringify(StringMakerException{}) == "StringMakerException"); +} diff --git a/packages/Catch2/tests/SelfTest/UsageTests/ToStringOptional.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/ToStringOptional.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2b7ac3eca1fe912db8b669adeec6e4cec087e9de --- /dev/null +++ b/packages/Catch2/tests/SelfTest/UsageTests/ToStringOptional.tests.cpp @@ -0,0 +1,23 @@ +#define CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER +#include <catch2/catch_test_macros.hpp> + +#if defined(CATCH_CONFIG_CPP17_OPTIONAL) + +TEST_CASE( "std::optional<int> -> toString", "[toString][optional][approvals]" ) { + using type = std::optional<int>; + REQUIRE( "{ }" == ::Catch::Detail::stringify( type{} ) ); + REQUIRE( "0" == ::Catch::Detail::stringify( type{ 0 } ) ); +} + +TEST_CASE( "std::optional<std::string> -> toString", "[toString][optional][approvals]" ) { + using type = std::optional<std::string>; + REQUIRE( "{ }" == ::Catch::Detail::stringify( type{} ) ); + REQUIRE( "\"abc\"" == ::Catch::Detail::stringify( type{ "abc" } ) ); +} + +TEST_CASE( "std::vector<std::optional<int> > -> toString", "[toString][optional][approvals]" ) { + using type = std::vector<std::optional<int> >; + REQUIRE( "{ 0, { }, 2 }" == ::Catch::Detail::stringify( type{ 0, {}, 2 } ) ); +} + +#endif // CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL diff --git a/packages/Catch2/tests/SelfTest/UsageTests/ToStringPair.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/ToStringPair.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3b8608aa4ce1247d7338ed3fa58d7129ae7ad9f2 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/UsageTests/ToStringPair.tests.cpp @@ -0,0 +1,30 @@ +#define CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER +#include <catch2/catch_test_macros.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/packages/Catch2/tests/SelfTest/UsageTests/ToStringTuple.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/ToStringTuple.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1d1a7ab0d7d536f14f1bc3546af4572d75c663f6 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/UsageTests/ToStringTuple.tests.cpp @@ -0,0 +1,47 @@ +#define CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER +#include <catch2/catch_test_macros.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/packages/Catch2/tests/SelfTest/UsageTests/ToStringVariant.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/ToStringVariant.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..de9748cde0e63d3cfaa4c02f90c9c17c5fef62b2 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/UsageTests/ToStringVariant.tests.cpp @@ -0,0 +1,91 @@ +#define CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER +#include <catch2/catch_test_macros.hpp> + +#if defined(CATCH_CONFIG_CPP17_VARIANT) + +#include <string> +#include <variant> + +// We need 2 types with non-trivial copies/moves +struct MyType1 { + MyType1() = default; + [[noreturn]] MyType1(MyType1 const&) { throw 1; } + MyType1& operator=(MyType1 const&) { throw 3; } +}; +struct MyType2 { + MyType2() = default; + [[noreturn]] MyType2(MyType2 const&) { throw 2; } + MyType2& operator=(MyType2 const&) { throw 4; } +}; + +TEST_CASE( "variant<std::monostate>", "[toString][variant][approvals]") +{ + using type = std::variant<std::monostate>; + CHECK( "{ }" == ::Catch::Detail::stringify(type{}) ); + type value {}; + CHECK( "{ }" == ::Catch::Detail::stringify(value) ); + CHECK( "{ }" == ::Catch::Detail::stringify(std::get<0>(value)) ); +} + +TEST_CASE( "variant<int>", "[toString][variant][approvals]") +{ + using type = std::variant<int>; + CHECK( "0" == ::Catch::Detail::stringify(type{0}) ); +} + +TEST_CASE( "variant<float, int>", "[toString][variant][approvals]") +{ + using type = std::variant<float, int>; + CHECK( "0.5f" == ::Catch::Detail::stringify(type{0.5f}) ); + CHECK( "0" == ::Catch::Detail::stringify(type{0}) ); +} + +TEST_CASE( "variant -- valueless-by-exception", "[toString][variant][approvals]" ) { + using type = std::variant<MyType1, MyType2>; + + type value; + REQUIRE_THROWS_AS(value.emplace<MyType2>(MyType2{}), int); + REQUIRE(value.valueless_by_exception()); + CHECK("{valueless variant}" == ::Catch::Detail::stringify(value)); +} + + +TEST_CASE( "variant<string, int>", "[toString][variant][approvals]") +{ + using type = std::variant<std::string, int>; + CHECK( "\"foo\"" == ::Catch::Detail::stringify(type{"foo"}) ); + CHECK( "0" == ::Catch::Detail::stringify(type{0}) ); +} + +TEST_CASE( "variant<variant<float, int>, string>", "[toString][variant][approvals]") +{ + using inner = std::variant<MyType1, float, int>; + using type = std::variant<inner, std::string>; + CHECK( "0.5f" == ::Catch::Detail::stringify(type{0.5f}) ); + CHECK( "0" == ::Catch::Detail::stringify(type{0}) ); + CHECK( "\"foo\"" == ::Catch::Detail::stringify(type{"foo"}) ); + + SECTION("valueless nested variant") { + type value = inner{0.5f}; + REQUIRE( std::holds_alternative<inner>(value) ); + REQUIRE( std::holds_alternative<float>(std::get<inner>(value)) ); + + REQUIRE_THROWS_AS( std::get<0>(value).emplace<MyType1>(MyType1{}), int ); + + // outer variant is still valid and contains inner + REQUIRE( std::holds_alternative<inner>(value) ); + // inner variant is valueless + REQUIRE( std::get<inner>(value).valueless_by_exception() ); + CHECK( "{valueless variant}" == ::Catch::Detail::stringify(value) ); + } +} + +TEST_CASE( "variant<nullptr,int,const char *>", "[toString][variant][approvals]" ) +{ + using type = std::variant<std::nullptr_t,int,const char *>; + CHECK( "nullptr" == ::Catch::Detail::stringify(type{nullptr}) ); + CHECK( "42" == ::Catch::Detail::stringify(type{42}) ); + CHECK( "\"Catch me\"" == ::Catch::Detail::stringify(type{"Catch me"}) ); +} + +#endif // CATCH_INTERNAL_CONFIG_CPP17_VARIANT diff --git a/packages/Catch2/tests/SelfTest/UsageTests/ToStringVector.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/ToStringVector.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..96c676725dcd16238e82e5d251d5cfc1e3ef8077 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/UsageTests/ToStringVector.tests.cpp @@ -0,0 +1,86 @@ +#include <catch2/catch_test_macros.hpp> +#include <vector> +#include <array> + +// vector +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.emplace_back( "hello" ); + REQUIRE( ::Catch::Detail::stringify(vv) == "{ \"hello\" }" ); + vv.emplace_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 }" ); +} diff --git a/packages/Catch2/tests/SelfTest/UsageTests/ToStringWhich.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/ToStringWhich.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7af8cc5b82fc8064735ef6252d551a8e4a3b3ac0 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/UsageTests/ToStringWhich.tests.cpp @@ -0,0 +1,183 @@ +/* + * Demonstrate which version of toString/StringMaker is being used + * for various types + */ + +#include <catch2/catch_test_macros.hpp> + + + +#if defined(__GNUC__) +// This has to be left enabled until end of the TU, because the GCC +// frontend reports operator<<(std::ostream& os, const has_maker_and_operator&) +// as unused anyway +# pragma GCC diagnostic ignored "-Wunused-function" +#endif + +namespace { + +struct has_operator { }; +struct has_maker {}; +struct has_maker_and_operator {}; +struct has_neither {}; +struct has_template_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; +} + +template <typename StreamT> +StreamT& operator<<(StreamT& os, const has_template_operator&) { + os << "operator<<( has_template_operator )"; + return os; +} + +} // end anonymous namespace + +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_operator )", "[toString]" ) { + has_maker_and_operator item; + REQUIRE( ::Catch::Detail::stringify( item ) == "StringMaker<has_maker_and_operator>" ); +} + +TEST_CASE("stringify( has_neither )", "[toString]") { + has_neither item; + REQUIRE( ::Catch::Detail::stringify(item) == "{?}" ); +} + +// Call the templated operator +TEST_CASE( "stringify( has_template_operator )", "[toString]" ) { + has_template_operator item; + REQUIRE( ::Catch::Detail::stringify( item ) == "operator<<( has_template_operator )" ); +} + + +// Vectors... + +TEST_CASE( "stringify( vectors<has_operator> )", "[toString]" ) { + std::vector<has_operator> v(1); + REQUIRE( ::Catch::Detail::stringify( v ) == "{ operator<<( has_operator ) }" ); +} + +TEST_CASE( "stringify( vectors<has_maker> )", "[toString]" ) { + std::vector<has_maker> v(1); + REQUIRE( ::Catch::Detail::stringify( v ) == "{ StringMaker<has_maker> }" ); +} + +TEST_CASE( "stringify( vectors<has_maker_and_operator> )", "[toString]" ) { + std::vector<has_maker_and_operator> v(1); + REQUIRE( ::Catch::Detail::stringify( v ) == "{ StringMaker<has_maker_and_operator> }" ); +} + +namespace { + +// Range-based conversion should only be used if other possibilities fail +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 {}; } +}; + +} // end anonymous namespace + +namespace Catch { +template <> +struct StringMaker<stringmaker_range> { + static std::string convert(stringmaker_range const&) { + return "stringmaker(streamable_range)"; + } +}; +} + +namespace { + +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 {}; } +}; + +} // end anonymous namespace + +namespace Catch { +template <> +struct is_range<disabled_range> { + static const bool value = false; +}; +} + +TEST_CASE("stringify ranges", "[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/packages/Catch2/tests/SelfTest/UsageTests/Tricky.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/Tricky.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..eed763f2087b1c07f30d607adfca2ef1c827371b --- /dev/null +++ b/packages/Catch2/tests/SelfTest/UsageTests/Tricky.tests.cpp @@ -0,0 +1,428 @@ +/* + * 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 <catch2/catch_test_macros.hpp> +#include <catch2/generators/catch_generators.hpp> +#include <catch2/generators/catch_generators_range.hpp> + +#include <cstdio> +#include <sstream> +#include <iostream> + +/////////////////////////////////////////////////////////////////////////////// +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 + ( + "Implicit conversions are supported inside assertion macros", + "[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 = 0; + 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( "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) ); +} + +TEST_CASE("#1514: stderr/stdout is not captured in tests aborted by an exception", "[output-capture][regression][.]") { + std::cout << "This would not be caught previously\n" << std::flush; + std::clog << "Nor would this\n" << std::flush; + // FAIL aborts the test by throwing a Catch exception + FAIL("1514"); +} + + +TEST_CASE( "#2025: -c shouldn't cause infinite loop", "[sections][generators][regression][.approvals]" ) { + SECTION( "Check cursor from buffer offset" ) { + auto bufPos = GENERATE_REF( range( 0, 44 ) ); + WHEN( "Buffer position is " << bufPos ) { REQUIRE( 1 == 1 ); } + } +} + +TEST_CASE("#2025: original repro", "[sections][generators][regression][.approvals]") { + auto fov = GENERATE(true, false); + DYNAMIC_SECTION("fov_" << fov) { + std::cout << "inside with fov: " << fov << '\n'; + } +} + +TEST_CASE("#2025: same-level sections", "[sections][generators][regression][.approvals]") { + SECTION("A") { + SUCCEED(); + } + auto i = GENERATE(1, 2, 3); + SECTION("B") { + REQUIRE(i < 4); + } +} diff --git a/packages/Catch2/tests/SelfTest/UsageTests/VariadicMacros.tests.cpp b/packages/Catch2/tests/SelfTest/UsageTests/VariadicMacros.tests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c8754deecb2a5da4f3a3b8eb487b170a5b1e1b77 --- /dev/null +++ b/packages/Catch2/tests/SelfTest/UsageTests/VariadicMacros.tests.cpp @@ -0,0 +1,26 @@ +/* + * 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 <catch2/catch_test_macros.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/packages/Catch2/tests/SelfTest/WarnAboutNoTests.cmake b/packages/Catch2/tests/SelfTest/WarnAboutNoTests.cmake new file mode 100644 index 0000000000000000000000000000000000000000..4637e3f3c7f788368633a8a667fbd4f5a88161ff --- /dev/null +++ b/packages/Catch2/tests/SelfTest/WarnAboutNoTests.cmake @@ -0,0 +1,19 @@ +# Workaround for a peculiarity where CTest disregards the return code from a +# test command if a PASS_REGULAR_EXPRESSION is also set +execute_process( + COMMAND ${CMAKE_ARGV3} -w NoTests "___nonexistent_test___" + RESULT_VARIABLE ret + OUTPUT_VARIABLE out +) + +message("${out}") + +if(NOT ${ret} MATCHES "^[0-9]+$") + message(FATAL_ERROR "${ret}") +endif() + +if(${ret} EQUAL 0) + message(FATAL_ERROR "Expected nonzero return code") +elseif(${out} MATCHES "Helper failed with") + message(FATAL_ERROR "Helper failed") +endif() diff --git a/packages/Catch2/tests/TestScripts/testRandomOrder.py b/packages/Catch2/tests/TestScripts/testRandomOrder.py new file mode 100755 index 0000000000000000000000000000000000000000..e7d7eca19a1154d39ada84b3de10b96b25cea973 --- /dev/null +++ b/packages/Catch2/tests/TestScripts/testRandomOrder.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 + +""" +This test script verifies that the random ordering of tests inside +Catch2 is invariant in regards to subsetting. This is done by running +the binary 3 times, once with all tests selected, and twice with smaller +subsets of tests selected, and verifying that the selected tests are in +the same relative order. +""" + +import subprocess +import sys +import random +import xml.etree.ElementTree as ET + +def list_tests(self_test_exe, tags, rng_seed): + cmd = [self_test_exe, '--reporter', 'xml', '--list-tests', '--order', 'rand', + '--rng-seed', str(rng_seed)] + tags_arg = ','.join('[{}]~[.]'.format(t) for t in tags) + if tags_arg: + cmd.append(tags_arg) + process = subprocess.Popen( + cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout, stderr = process.communicate() + if stderr: + raise RuntimeError("Unexpected error output:\n" + process.stderr) + + root = ET.fromstring(stdout) + result = [elem.text for elem in root.findall('./TestCase/Name')] + + if len(result) < 2: + raise RuntimeError("Unexpectedly few tests listed (got {})".format( + len(result))) + return result + +def check_is_sublist_of(shorter, longer): + assert len(shorter) < len(longer) + assert len(set(longer)) == len(longer) + + indexes_in_longer = {s: i for i, s in enumerate(longer)} + for s1, s2 in zip(shorter, shorter[1:]): + assert indexes_in_longer[s1] < indexes_in_longer[s2], ( + '{} comes before {} in longer list.\n' + 'Longer: {}\nShorter: {}'.format(s2, s1, longer, shorter)) + +def main(): + self_test_exe, = sys.argv[1:] + + # We want a random seed for the test, but want to avoid 0, + # because it has special meaning + seed = random.randint(1, 2 ** 32 - 1) + + list_one_tag = list_tests(self_test_exe, ['generators'], seed) + list_two_tags = list_tests(self_test_exe, ['generators', 'matchers'], seed) + list_all = list_tests(self_test_exe, [], seed) + + # First, verify that restricting to a subset yields the same order + check_is_sublist_of(list_two_tags, list_all) + check_is_sublist_of(list_one_tag, list_two_tags) + +if __name__ == '__main__': + sys.exit(main()) diff --git a/packages/Catch2/third_party/clara.hpp b/packages/Catch2/third_party/clara.hpp new file mode 100644 index 0000000000000000000000000000000000000000..eb4c7275b103eb0638ad40c204766d445f1f175f --- /dev/null +++ b/packages/Catch2/third_party/clara.hpp @@ -0,0 +1,1267 @@ +// 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.5 + +#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 + +#ifndef CLARA_CONFIG_OPTIONAL_TYPE +#ifdef __has_include +#if __has_include(<optional>) && __cplusplus >= 201703L +#include <optional> +#define CLARA_CONFIG_OPTIONAL_TYPE std::optional +#endif +#endif +#endif + + +// ----------- #included from clara_textflow.hpp ----------- + +// TextFlowCpp +// +// A single-header library for wrapping and laying out basic text, by Phil Nash +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// 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; + if (line()[m_pos] == '\n') { + ++m_end; + } + 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: + using difference_type = std::ptrdiff_t; + using value_type = std::string; + using pointer = value_type*; + using reference = value_type&; + using iterator_category = std::forward_iterator_tag; + + 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 ); + return addIndentAndSuffix(line().substr(m_pos, m_len)); + } + + 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: + using difference_type = std::ptrdiff_t; + using value_type = std::string; + using pointer = value_type*; + using reference = value_type&; + using iterator_category = std::forward_iterator_tag; + + 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; + } +}} + +#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 const* const* argv ) + : m_exeName(argv[0]), + m_args(argv + 1, argv + argc) {} + + 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 { + + // Errors shouldn't reach this point, but if they do + // the actual error message will be in m_errorMessage + assert( m_type != ResultBase::LogicError ); + assert( m_type != ResultBase::RuntimeError ); + if( m_type != ResultBase::Ok ) + std::abort(); + } + + 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(), []( unsigned 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 ); + } +#ifdef CLARA_CONFIG_OPTIONAL_TYPE + template<typename T> + inline auto convertInto( std::string const &source, CLARA_CONFIG_OPTIONAL_TYPE<T>& target ) -> ParserResult { + T temp; + auto result = convertInto( source, temp ); + if( result ) + target = std::move(temp); + return result; + } +#endif // CLARA_CONFIG_OPTIONAL_TYPE + + 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; } + virtual auto isFlag() 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; + virtual auto isFlag() const -> bool { return true; } + }; + + 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( !m_ref->isFlag() ); + 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( m_ref->isFlag() ) { + auto flagRef = static_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 { + 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 diff --git a/packages/Catch2/tools/misc/CMakeLists.txt b/packages/Catch2/tools/misc/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..bf80846cdc6484050d02486946e4a66cd976c404 --- /dev/null +++ b/packages/Catch2/tools/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/packages/Catch2/tools/misc/SelfTest.vcxproj.user b/packages/Catch2/tools/misc/SelfTest.vcxproj.user new file mode 100644 index 0000000000000000000000000000000000000000..ffffc575138a1edf2c57d8a664c282d307538782 --- /dev/null +++ b/packages/Catch2/tools/misc/SelfTest.vcxproj.user @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <UseFullPaths>false</UseFullPaths> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <UseFullPaths>false</UseFullPaths> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <UseFullPaths>false</UseFullPaths> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <UseFullPaths>false</UseFullPaths> + </ClCompile> + </ItemDefinitionGroup> +</Project> diff --git a/packages/Catch2/tools/misc/appveyorBuildConfigurationScript.bat b/packages/Catch2/tools/misc/appveyorBuildConfigurationScript.bat new file mode 100644 index 0000000000000000000000000000000000000000..9ebd6ae0d81780592a5ab42a9833cc9308c8f0e4 --- /dev/null +++ b/packages/Catch2/tools/misc/appveyorBuildConfigurationScript.bat @@ -0,0 +1,21 @@ +SETLOCAL EnableDelayedExpansion + +@REM # Possibilities: +@REM # Debug build + coverage +@REM # Debug build + examples +@REM # Debug build + --- +@REM # Release build +if "%CONFIGURATION%"=="Debug" ( + if "%coverage%"=="1" ( + @REM # coverage needs to build the special helper as well as the main + cmake -Htools/misc -Bbuild-misc -A%PLATFORM% || exit /b !ERRORLEVEL! + cmake --build build-misc || exit /b !ERRORLEVEL! + cmake -H. -BBuild -A%PLATFORM% -DCATCH_TEST_USE_WMAIN=%wmain% -DMEMORYCHECK_COMMAND=build-misc\Debug\CoverageHelper.exe -DMEMORYCHECK_COMMAND_OPTIONS=--sep-- -DMEMORYCHECK_TYPE=Valgrind -DCATCH_BUILD_EXAMPLES=%examples% -DCATCH_BUILD_EXTRA_TESTS=%examples% -DCATCH_DEVELOPMENT_BUILD=ON || exit /b !ERRORLEVEL! + ) else ( + @REM # We know that coverage is 0 + cmake -H. -BBuild -A%PLATFORM% -DCATCH_TEST_USE_WMAIN=%wmain% -DCATCH_BUILD_EXAMPLES=%examples% -DCATCH_BUILD_EXTRA_TESTS=%examples% -DCATCH_DEVELOPMENT_BUILD=ON || exit /b !ERRORLEVEL! + ) +) +if "%CONFIGURATION%"=="Release" ( + cmake -H. -BBuild -A%PLATFORM% -DCATCH_TEST_USE_WMAIN=%wmain% -DCATCH_DEVELOPMENT_BUILD=ON || exit /b !ERRORLEVEL! +) diff --git a/packages/Catch2/tools/misc/appveyorMergeCoverageScript.py b/packages/Catch2/tools/misc/appveyorMergeCoverageScript.py new file mode 100644 index 0000000000000000000000000000000000000000..7cf408d24ec2b9ebd2bd61258d28d523c3392da9 --- /dev/null +++ b/packages/Catch2/tools/misc/appveyorMergeCoverageScript.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python2 + +import glob +import subprocess + +if __name__ == '__main__': + cov_files = list(glob.glob('tests/cov-report*.bin')) + base_cmd = ['OpenCppCoverage', '--quiet', '--export_type=cobertura:cobertura.xml'] + ['--input_coverage={}'.format(f) for f in cov_files] + subprocess.check_call(base_cmd) diff --git a/packages/Catch2/tools/misc/appveyorTestRunScript.bat b/packages/Catch2/tools/misc/appveyorTestRunScript.bat new file mode 100644 index 0000000000000000000000000000000000000000..c491d50760393a4057e3685d77204dbc491e2a40 --- /dev/null +++ b/packages/Catch2/tools/misc/appveyorTestRunScript.bat @@ -0,0 +1,15 @@ +SETLOCAL EnableDelayedExpansion + +cd Build +if "%CONFIGURATION%"=="Debug" ( + if "%coverage%"=="1" ( + ctest -j 2 -C %CONFIGURATION% -D ExperimentalMemCheck || exit /b !ERRORLEVEL! + python ..\tools\misc\appveyorMergeCoverageScript.py || exit /b !ERRORLEVEL! + codecov --root .. --no-color --disable gcov -f cobertura.xml -t %CODECOV_TOKEN% || exit /b !ERRORLEVEL! + ) else ( + ctest -j 2 -C %CONFIGURATION% || exit /b !ERRORLEVEL! + ) +) +if "%CONFIGURATION%"=="Release" ( + ctest -j 2 -C %CONFIGURATION% || exit /b !ERRORLEVEL! +) diff --git a/packages/Catch2/tools/misc/coverage-helper.cpp b/packages/Catch2/tools/misc/coverage-helper.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9e7a8ca4fd4b456889b93dec7b5196a7c8e9b295 --- /dev/null +++ b/packages/Catch2/tools/misc/coverage-helper.cpp @@ -0,0 +1,142 @@ +#include <algorithm> +#include <array> +#include <cassert> +#include <fstream> +#include <iostream> +#include <memory> +#include <numeric> +#include <regex> +#include <string> +#include <vector> + +std::string escape_arg(const std::string& arg) { + if (arg.empty() == false && + arg.find_first_of(" \t\n\v\"") == arg.npos) { + return arg; + } + + std::string escaped; + escaped.push_back('"'); + for (auto it = arg.begin(); ; ++it) { + int num_backslashes = 0; + + while (it != arg.end() && *it == '\\') { + ++it; + ++num_backslashes; + } + + if (it == arg.end()) { + escaped.append(num_backslashes * 2, '\\'); + break; + } else if (*it == '"') { + escaped.append((num_backslashes + 1) * 2, '\\'); + escaped.push_back('"'); + escaped.push_back(*it); + } else { + escaped.append(num_backslashes, '\\'); + escaped.push_back(*it); + } + } + escaped.push_back('"'); + + return escaped; +} + + +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; +} + +int exec_cmd(std::string const& cmd, int log_num, std::string const& path) { + std::array<char, 128> buffer; + + // cmd has already been escaped outside this function. + auto real_cmd = "OpenCppCoverage --export_type binary:cov-report" + std::to_string(log_num) + + ".bin --quiet " + "--sources " + escape_arg(path) + "\\src" + " --cover_children -- " + cmd; + std::cout << "=== Marker ===: Cmd: " << real_cmd << '\n'; + auto pipe = _popen(real_cmd.c_str(), "r"); + + if (!pipe) { + throw std::runtime_error("popen() failed!"); + } + while (!feof(pipe)) { + if (fgets(buffer.data(), 128, pipe) != nullptr) { + std::cout << buffer.data(); + } + } + + auto ret = _pclose(pipe); + if (ret == -1) { + throw std::runtime_error("underlying error in pclose()"); + } + + return ret; +} + +// 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 + ' ' + escape_arg(rhs); + }); + + try { + return exec_cmd(cmdline, num, windowsify_path(catch_path(args[0]))); + } catch (std::exception const& ex) { + std::cerr << "Helper failed with: '" << ex.what() << "'\n"; + return 12; + } +} diff --git a/packages/Catch2/tools/misc/installOpenCppCoverage.ps1 b/packages/Catch2/tools/misc/installOpenCppCoverage.ps1 new file mode 100644 index 0000000000000000000000000000000000000000..215fe20e91b6374c953a4484a5bf2bd4bdd4082b --- /dev/null +++ b/packages/Catch2/tools/misc/installOpenCppCoverage.ps1 @@ -0,0 +1,19 @@ +# Downloads are done from the official github release page links +$downloadUrl = "https://github.com/OpenCppCoverage/OpenCppCoverage/releases/download/release-0.9.9.0/OpenCppCoverageSetup-x64-0.9.9.0.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/packages/Catch2/tools/scripts/approvalTests.py b/packages/Catch2/tools/scripts/approvalTests.py new file mode 100755 index 0000000000000000000000000000000000000000..73e9b832394edf95eaa465316ca43f450f34f619 --- /dev/null +++ b/packages/Catch2/tools/scripts/approvalTests.py @@ -0,0 +1,218 @@ +#!/usr/bin/env python3 + +from __future__ import print_function + +import io +import os +import sys +import subprocess +import re +import difflib + +import scriptCommon +from scriptCommon import catchPath + +if os.name == 'nt': + # Enable console colours on windows + os.system('') + +rootPath = os.path.join(catchPath, 'tests/SelfTest/Baselines') + +langFilenameParser = re.compile(r'(.+\.[ch]pp)') +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]*"') +sonarqubeDurationParser = re.compile(r''' duration=["'][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]+(-\w*\.[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\s*\(\)\) + | + \(\*__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) + +# The weird OR is there to always have at least empty string for group 1 +tapTestNumParser = re.compile(r'^((?:not ok)|(?:ok)|(?:warning)|(?:info)) (\d+) -') + +if len(sys.argv) == 2: + cmdPath = sys.argv[1] +else: + cmdPath = os.path.join(catchPath, scriptCommon.getBuildExecutable()) + +overallResult = 0 + + +def diffFiles(fileA, fileB): + with io.open(fileA, 'r', encoding='utf-8', errors='surrogateescape') as file: + aLines = [line.rstrip() for line in file.readlines()] + with io.open(fileB, 'r', encoding='utf-8', errors='surrogateescape') 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 normalizeFilepath(line): + if catchPath in line: + # make paths relative to Catch root + line = line.replace(catchPath + os.sep, '') + + m = langFilenameParser.match(line) + if m: + filepath = m.group(0) + # go from \ in windows paths to / + filepath = filepath.replace('\\', '/') + # remove start of relative path + filepath = filepath.replace('../', '') + line = line[:m.start()] + filepath + line[m.end():] + + return line + +def filterLine(line, isCompact): + line = normalizeFilepath(line) + + # 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) + + if isCompact: + line = line.replace(': FAILED', ': failed') + line = line.replace(': PASSED', ': passed') + + # strip out the test order number in TAP to avoid massive diffs for every change + line = tapTestNumParser.sub("\g<1> {test-number} -", 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 = sonarqubeDurationParser.sub(' duration="{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 = io.open(rawResultsPath, 'r', encoding='utf-8', errors='surrogateescape') + filteredFile = io.open(filteredResultsPath, 'w', encoding='utf-8', errors='surrogateescape') + for line in rawFile: + filteredFile.write(filterLine(line, 'compact' in baseName).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) + + +## special cases first: +# Standard console reporter +approve("console.std", ["~[!nonportable]~[!benchmark]~[approvals] *", "--order", "lex", "--rng-seed", "1"]) +# 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", "--rng-seed", "1"]) + +## Common reporter checks: include passes, warn about No Assertions +reporters = ('console', 'junit', 'xml', 'compact', 'sonarqube', 'tap', 'teamcity', 'automake') +for reporter in reporters: + filename = '{}.sw'.format(reporter) + common_args = ["~[!nonportable]~[!benchmark]~[approvals] *", "-s", "-w", "NoAssertions", "--order", "lex", "--rng-seed", "1"] + reporter_args = ['-r', reporter] + approve(filename, common_args + reporter_args) + + +if overallResult != 0: + print("If these differences are expected, run approve.py to approve new baselines.") +exit(overallResult) diff --git a/packages/Catch2/tools/scripts/approve.py b/packages/Catch2/tools/scripts/approve.py new file mode 100755 index 0000000000000000000000000000000000000000..997b8c710b4739e11aca30ef812f15461492b01a --- /dev/null +++ b/packages/Catch2/tools/scripts/approve.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 + +from __future__ import print_function + +import os +import sys +import shutil +import glob +from scriptCommon import catchPath + +rootPath = os.path.join( catchPath, 'tests/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 files: + for unapprovedFile in files: + approveFile( unapprovedFile.replace( "unapproved.txt", "approved.txt" ), unapprovedFile ) +else: + print( "no files to approve" ) diff --git a/packages/Catch2/tools/scripts/benchmarkCompile.py b/packages/Catch2/tools/scripts/benchmarkCompile.py new file mode 100755 index 0000000000000000000000000000000000000000..34113b9e12115c628b3df6150cf8e899c61b7067 --- /dev/null +++ b/packages/Catch2/tools/scripts/benchmarkCompile.py @@ -0,0 +1,148 @@ +#!/usr/bin/env python3 + +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/packages/Catch2/tools/scripts/benchmarkRunner.py b/packages/Catch2/tools/scripts/benchmarkRunner.py new file mode 100755 index 0000000000000000000000000000000000000000..dc753cf005005add8613d9bd549a2291a96a9001 --- /dev/null +++ b/packages/Catch2/tools/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/packages/Catch2/tools/scripts/buildAndTest.sh b/packages/Catch2/tools/scripts/buildAndTest.sh new file mode 100755 index 0000000000000000000000000000000000000000..b343acad4d0af2b74cd75ca7d3ef062601c97686 --- /dev/null +++ b/packages/Catch2/tools/scripts/buildAndTest.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env sh + +# Start at the root of the Catch project directory, for example: +# cd Catch2 + +# begin-snippet: catch2-build-and-test +# 1. Regenerate the amalgamated distribution +./tools/scripts/generateAmalgamatedFiles.py + +# 2. Configure the full test build +cmake -Bdebug-build -H. -DCMAKE_BUILD_TYPE=Debug -DCATCH_BUILD_EXAMPLES=ON -DCATCH_BUILD_EXTRA_TESTS=ON -DCATCH_DEVELOPMENT_BUILD=ON + +# 3. Run the actual build +cmake --build debug-build + +# 4. Run the tests using CTest +cd debug-build +ctest -j 4 --output-on-failure -C Debug +# end-snippet diff --git a/packages/Catch2/tools/scripts/checkConvenienceHeaders.py b/packages/Catch2/tools/scripts/checkConvenienceHeaders.py new file mode 100755 index 0000000000000000000000000000000000000000..054d3bd97840024a76360bb5a9bf055972875296 --- /dev/null +++ b/packages/Catch2/tools/scripts/checkConvenienceHeaders.py @@ -0,0 +1,150 @@ +#!/usr/bin/env python3 + +""" +Checks that all of the "catch_foo_all.hpp" headers include all subheaders. + +The logic is simple: given a folder, e.g. `catch2/matchers`, then the +ccorresponding header is called `catch_matchers_all.hpp` and contains +* all headers in `catch2/matchers`, +* all headers in `catch2/matchers/{internal, detail}`, +* all convenience catch_matchers_*_all.hpp headers from any non-internal subfolders + +The top level header is called `catch_all.hpp`. +""" + +internal_dirs = ['detail', 'internal'] + +from scriptCommon import catchPath +from glob import glob +from pprint import pprint +import os +import re + +def normalized_path(path): + """Replaces \ in paths on Windows with /""" + return path.replace('\\', '/') + +def normalized_paths(paths): + """Replaces \ with / in every path""" + return [normalized_path(path) for path in paths] + +source_path = catchPath + '/src/catch2' +source_path = normalized_path(source_path) +include_parser = re.compile(r'#include <(catch2/.+\.hpp)>') + +errors_found = False + +def headers_in_folder(folder): + return glob(folder + '/*.hpp') + +def folders_in_folder(folder): + return [x for x in os.scandir(folder) if x.is_dir()] + +def collated_includes(folder): + base = headers_in_folder(folder) + for subfolder in folders_in_folder(folder): + if subfolder.name in internal_dirs: + base.extend(headers_in_folder(subfolder.path)) + else: + base.append(subfolder.path + '/catch_{}_all.hpp'.format(subfolder.name)) + return normalized_paths(sorted(base)) + +def includes_from_file(header): + includes = [] + with open(header, 'r', encoding = 'utf-8') as file: + for line in file: + if not line.startswith('#include'): + continue + match = include_parser.match(line) + if match: + includes.append(match.group(1)) + return normalized_paths(includes) + +def normalize_includes(includes): + """Returns """ + return [include[len(catchPath)+5:] for include in includes] + +def get_duplicates(xs): + seen = set() + duplicated = [] + for x in xs: + if x in seen: + duplicated.append(x) + seen.add(x) + return duplicated + +def verify_convenience_header(folder): + """ + Performs the actual checking of convenience header for specific folder. + Checks that + 1) The header even exists + 2) That all includes in the header are sorted + 3) That there are no duplicated includes + 4) That all includes that should be in the header are actually present in the header + 5) That there are no superfluous includes that should not be in the header + """ + global errors_found + + path = normalized_path(folder.path) + + assert path.startswith(source_path), '{} does not start with {}'.format(path, source_path) + stripped_path = path[len(source_path) + 1:] + path_pieces = stripped_path.split('/') + + if path == source_path: + header_name = 'catch_all.hpp' + else: + header_name = 'catch_{}_all.hpp'.format('_'.join(path_pieces)) + + # 1) Does it exist? + full_path = path + '/' + header_name + if not os.path.isfile(full_path): + errors_found = True + print('Missing convenience header: {}'.format(full_path)) + return + file_incs = includes_from_file(path + '/' + header_name) + # 2) Are the includes are sorted? + if sorted(file_incs) != file_incs: + errors_found = True + print("'{}': Includes are not in sorted order!".format(header_name)) + + # 3) Are there no duplicates? + duplicated = get_duplicates(file_incs) + for duplicate in duplicated: + errors_found = True + print("'{}': Duplicated include: '{}'".format(header_name, duplicate)) + + target_includes = normalize_includes(collated_includes(path)) + # Avoid requiring the convenience header to include itself + target_includes = [x for x in target_includes if header_name not in x] + # 4) Are all required headers present? + file_incs_set = set(file_incs) + for include in target_includes: + if include not in file_incs_set: + errors_found = True + print("'{}': missing include '{}'".format(header_name, include)) + + # 5) Are there any superfluous headers? + desired_set = set(target_includes) + for include in file_incs: + if include not in desired_set: + errors_found = True + print("'{}': superfluous include '{}'".format(header_name, include)) + + + +def walk_source_folders(current): + verify_convenience_header(current) + for folder in folders_in_folder(current.path): + fname = folder.name + if fname not in internal_dirs: + walk_source_folders(folder) + +# This is an ugly hack because we cannot instantiate DirEntry manually +base_dir = [x for x in os.scandir(catchPath + '/src') if x.name == 'catch2'] +walk_source_folders(base_dir[0]) + +# Propagate error "code" upwards +if not errors_found: + print('Everything ok') +exit(errors_found) diff --git a/packages/Catch2/tools/scripts/checkDuplicateFilenames.py b/packages/Catch2/tools/scripts/checkDuplicateFilenames.py new file mode 100755 index 0000000000000000000000000000000000000000..b46a2b4b29d502a29c996eb435f46a34e70062e3 --- /dev/null +++ b/packages/Catch2/tools/scripts/checkDuplicateFilenames.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 + +import os +import sys + +files_set = set() + +for root, dir, files in os.walk("src/catch2"): + for file in files: + if file not in files_set: + files_set.add(file) + else: + print("File %s is duplicate" % file) + sys.exit(1) diff --git a/packages/Catch2/tools/scripts/checkLicense.py b/packages/Catch2/tools/scripts/checkLicense.py new file mode 100755 index 0000000000000000000000000000000000000000..3c2a14f40336b0316fcc86eafba211adefe037ef --- /dev/null +++ b/packages/Catch2/tools/scripts/checkLicense.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 +import os +import sys + + +def get_license(): + with open("src/catch2/catch_all.hpp", "r") as f: + license = f.readlines()[0:7] + + return license + + +def check_license(license): + failed = 0 + base_dir = "src/catch2/" + + # The _ represents the list of directories in base_dir + for root, _, files in os.walk(base_dir): + for file in files: + with open(root + "/" + file, "r") as f: + file_license = f.readlines()[0:7] + + if file_license != license: + print("File %s does not have license" % file) + failed = 1 + + return failed + + +license = get_license() +status = check_license(license) +sys.exit(status) diff --git a/packages/Catch2/tools/scripts/developBuild.py b/packages/Catch2/tools/scripts/developBuild.py new file mode 100755 index 0000000000000000000000000000000000000000..9252c7d63860c3cf2de341c0d029dfaf18d63efe --- /dev/null +++ b/packages/Catch2/tools/scripts/developBuild.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python3 + +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/packages/Catch2/tools/scripts/embed.py b/packages/Catch2/tools/scripts/embed.py new file mode 100644 index 0000000000000000000000000000000000000000..6675703314476b88a198b4c59c947e91b45c9ec8 --- /dev/null +++ b/packages/Catch2/tools/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.items(): + 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 originalNs in self.outerNamespace: + 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 originalNs in self.outerNamespace: + 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/packages/Catch2/tools/scripts/embedClara.py b/packages/Catch2/tools/scripts/embedClara.py new file mode 100755 index 0000000000000000000000000000000000000000..d8c1520a919b7958936abdb2171d1f8788d3f133 --- /dev/null +++ b/packages/Catch2/tools/scripts/embedClara.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python3 + +# 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/packages/Catch2/tools/scripts/extractFeaturesFromReleaseNotes.py b/packages/Catch2/tools/scripts/extractFeaturesFromReleaseNotes.py new file mode 100644 index 0000000000000000000000000000000000000000..11f4955c0b4be262460e83f0a138684883eb9512 --- /dev/null +++ b/packages/Catch2/tools/scripts/extractFeaturesFromReleaseNotes.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python3 + +# +# extractFeaturesFromReleaseNotes.py +# +# Read the release notes - docs/release-notes.md - and generate text +# for pasting in to individual documentation pages, to indicate which +# versions recent features were released in. +# +# Using the output of the file is easier than manually constructing +# the text to paste in to documentation pages. +# +# One way to use this: +# - run this script, saving the output to some temporary file +# - diff this output with the actual release notes page +# - the differences are Markdown text that can be pasted in to the +# appropriate documentation pages in the docs/ directory. +# - each release also has a github link to show which documentation files +# were changed in it. +# This can be helpful to see which documentation pages +# to add the 'Introduced in Catch ...' snippets to the relevant pages. +# + +from __future__ import print_function + +import re + + +def create_introduced_in_text(version, bug_number = None): + """Generate text to paste in to documentation file""" + if bug_number: + return '> [Introduced](https://github.com/catchorg/Catch2/issues/%s) in Catch %s.' % (bug_number, version) + else: + # Use this text for changes that don't have issue numbers + return '> Introduced in Catch %s.' % version + + +def link_to_changes_in_release(release, releases): + """ + Markdown text for a hyperlink showing all edits in a release, or empty string + + :param release: A release version, as a string + :param releases: A container of releases, in descending order - newest to oldest + :return: Markdown text for a hyperlink showing the differences between the give release and the prior one, + or empty string, if the previous release is not known + """ + + if release == releases[-1]: + # This is the earliest release we know about + return '' + index = releases.index(release) + previous_release = releases[index + 1] + return '\n[Changes in %s](https://github.com/catchorg/Catch2/compare/v%s...v%s)' % (release, previous_release, release) + + +def write_recent_release_notes_with_introduced_text(): + current_version = None + release_toc_regex = r'\[(\d.\d.\d)\]\(#\d+\)<br>' + issue_number_regex = r'#[0-9]+' + releases = [] + with open('../docs/release-notes.md') as release_notes: + for line in release_notes: + line = line[:-1] + print(line) + + # Extract version number from table of contents + match = re.search(release_toc_regex, line) + if match: + release_name = match.group(1) + releases.append(release_name) + + if line.startswith('## '): + # It's a section with version number + current_version = line.replace('## ', '') + + # We decided not to add released-date info for older versions + if current_version == 'Older versions': + break + + print(create_introduced_in_text(current_version)) + print(link_to_changes_in_release(current_version, releases)) + + # Not yet found a version number, so to avoid picking up hyperlinks to + # version numbers in the index, keep going + if not current_version: + continue + + for bug_link in re.findall(issue_number_regex, line): + bug_number = bug_link.replace('#', '') + print(create_introduced_in_text(current_version, bug_number)) + + +if __name__ == '__main__': + write_recent_release_notes_with_introduced_text() diff --git a/packages/Catch2/tools/scripts/fixWhitespace.py b/packages/Catch2/tools/scripts/fixWhitespace.py new file mode 100755 index 0000000000000000000000000000000000000000..4591c1c444f5352c330cfcc12e34c0db9ccb91d0 --- /dev/null +++ b/packages/Catch2/tools/scripts/fixWhitespace.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 + +from __future__ import print_function +import os +from scriptCommon import catchPath + +def isSourceFile( path ): + return path.endswith( ".cpp" ) or path.endswith( ".h" ) or path.endswith( ".hpp" ) + +def fixAllFilesInDir( dir ): + changedFiles = 0 + for f in os.listdir( dir ): + path = os.path.join( dir,f ) + if os.path.isfile( path ): + if isSourceFile( path ): + if fixFile( path ): + changedFiles += 1 + else: + fixAllFilesInDir( path ) + return changedFiles + +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 ) + return True + return False + +changedFiles = fixAllFilesInDir(catchPath) +if changedFiles > 0: + print( "Fixed " + str(changedFiles) + " file(s)" ) +else: + print( "No trailing whitespace found" ) diff --git a/packages/Catch2/tools/scripts/generateAmalgamatedFiles.py b/packages/Catch2/tools/scripts/generateAmalgamatedFiles.py new file mode 100755 index 0000000000000000000000000000000000000000..eb96d2a949e50ee05e792c493b63487f97823e6b --- /dev/null +++ b/packages/Catch2/tools/scripts/generateAmalgamatedFiles.py @@ -0,0 +1,119 @@ +#!/usr/bin/env python3 + +import os +import re +import datetime + +from scriptCommon import catchPath +from releaseCommon import Version + +root_path = os.path.join(catchPath, 'src') +starting_header = os.path.join(root_path, 'catch2', 'catch_all.hpp') +output_header = os.path.join(catchPath, 'extras', 'catch_amalgamated.hpp') +output_cpp = os.path.join(catchPath, 'extras', 'catch_amalgamated.cpp') + +# These are the copyright comments in each file, we want to ignore them +copyright_lines = [ +'// Copyright Catch2 Authors\n', +'// Distributed under the Boost Software License, Version 1.0.\n', +'// (See accompanying file LICENSE_1_0.txt or copy at\n', +'// https://www.boost.org/LICENSE_1_0.txt)\n', +'// SPDX-License-Identifier: BSL-1.0\n', +] + +# The header of the amalgamated file: copyright information + explanation +# what this file is. +file_header = '''\ +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +// Catch v{version_string} +// Generated: {generation_time} +// ---------------------------------------------------------- +// This file is an amalgamation of multiple different files. +// You probably shouldn't edit it directly. +// ---------------------------------------------------------- +''' + +# Returns file header with proper version string and generation time +def formatted_file_header(version): + return file_header.format(version_string=version.getVersionString(), + generation_time=datetime.datetime.now()) + +# Which headers were already concatenated (and thus should not be +# processed again) +concatenated_headers = set() + +internal_include_parser = re.compile(r'\s*#include <(catch2/.*)>.*') + +def concatenate_file(out, filename: str, expand_headers: bool) -> int: + # Gathers statistics on how many headers were expanded + concatenated = 1 + with open(filename, mode='r', encoding='utf-8') as input: + for line in input: + if line in copyright_lines: + continue + m = internal_include_parser.match(line) + # anything that isn't a Catch2 header can just be copied to + # the resulting file + if not m: + out.write(line) + continue + + # TBD: We can also strip out include guards from our own + # headers, but it wasn't worth the time at the time of writing + # this script. + + # We do not want to expand headers for the cpp file + # amalgamation but neither do we want to copy them to output + if not expand_headers: + continue + + next_header = m.group(1) + # We have to avoid re-expanding the same header over and + # over again, or the header will end up with couple + # hundred thousands lines (~300k as of preview3 :-) ) + if next_header in concatenated_headers: + continue + concatenated_headers.add(next_header) + concatenated += concatenate_file(out, os.path.join(root_path, next_header), expand_headers) + + return concatenated + + +def generate_header(): + with open(output_header, mode='w', encoding='utf-8') as header: + header.write(formatted_file_header(Version())) + header.write('#ifndef CATCH_AMALGAMATED_HPP_INCLUDED\n') + header.write('#define CATCH_AMALGAMATED_HPP_INCLUDED\n') + print('Concatenated {} headers'.format(concatenate_file(header, starting_header, True))) + header.write('#endif // CATCH_AMALGAMATED_HPP_INCLUDED\n') + +def generate_cpp(): + from glob import glob + cpp_files = sorted(glob(os.path.join(root_path, 'catch2', '**/*.cpp'), recursive=True)) + with open(output_cpp, mode='w', encoding='utf-8') as cpp: + cpp.write(formatted_file_header(Version())) + cpp.write('\n#include "catch_amalgamated.hpp"\n') + for file in cpp_files: + concatenate_file(cpp, file, False) + print('Concatenated {} cpp files'.format(len(cpp_files))) + + +generate_header() +generate_cpp() + + +# Notes: +# * For .cpp files, internal includes have to be stripped and rewritten +# * for .hpp files, internal includes have to be resolved and included +# * The .cpp file needs to start with `#include "catch_amalgamated.hpp" +# * include guards can be left/stripped, doesn't matter +# * *.cpp files should be included sorted, to minimize diffs between versions +# * *.hpp files should also be somehow sorted -> use catch_all.hpp as the +# * entrypoint +# * allow disabling main in the .cpp amalgamation diff --git a/packages/Catch2/tools/scripts/majorRelease.py b/packages/Catch2/tools/scripts/majorRelease.py new file mode 100755 index 0000000000000000000000000000000000000000..e9e285a898b967d041ee86e78290a843c97819df --- /dev/null +++ b/packages/Catch2/tools/scripts/majorRelease.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python3 + +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/packages/Catch2/tools/scripts/minorRelease.py b/packages/Catch2/tools/scripts/minorRelease.py new file mode 100755 index 0000000000000000000000000000000000000000..2b57c2eab59075b62b8cee604dc32e8299a8f559 --- /dev/null +++ b/packages/Catch2/tools/scripts/minorRelease.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python3 + +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/packages/Catch2/tools/scripts/patchRelease.py b/packages/Catch2/tools/scripts/patchRelease.py new file mode 100755 index 0000000000000000000000000000000000000000..d20db714c4341875bfed8a8a63e1e726f44668bb --- /dev/null +++ b/packages/Catch2/tools/scripts/patchRelease.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python3 + +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/packages/Catch2/tools/scripts/releaseCommon.py b/packages/Catch2/tools/scripts/releaseCommon.py new file mode 100644 index 0000000000000000000000000000000000000000..6226bdc067cdc773255ce52057f37e06a7787bd9 --- /dev/null +++ b/packages/Catch2/tools/scripts/releaseCommon.py @@ -0,0 +1,166 @@ +from __future__ import print_function + +import os +import sys +import re +import string +import glob +import fnmatch + +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, 'src/catch2' ) +versionPath = os.path.join( rootPath, "catch_version.cpp" ) +definePath = os.path.join(rootPath, 'catch_version_macros.hpp') +readmePath = os.path.join( catchPath, "README.md" ) +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 updateCmakeFile(version): + with open(cmakePath, 'rb') as file: + lines = file.readlines() + replacementRegex = re.compile(b'project\\(Catch2 LANGUAGES CXX VERSION \\d+\\.\\d+\\.\\d+\\)') + replacement = 'project(Catch2 LANGUAGES CXX VERSION {0})'.format(version.getVersionString()).encode('ascii') + with open(cmakePath, 'wb') as file: + for line in lines: + file.write(replacementRegex.sub(replacement, line)) + + +def updateVersionDefine(version): + # First member of the tuple is the compiled regex object, the second is replacement if it matches + replacementRegexes = [(re.compile(b'#define CATCH_VERSION_MAJOR \\d+'),'#define CATCH_VERSION_MAJOR {}'.format(version.majorVersion).encode('ascii')), + (re.compile(b'#define CATCH_VERSION_MINOR \\d+'),'#define CATCH_VERSION_MINOR {}'.format(version.minorVersion).encode('ascii')), + (re.compile(b'#define CATCH_VERSION_PATCH \\d+'),'#define CATCH_VERSION_PATCH {}'.format(version.patchNumber).encode('ascii')), + ] + with open(definePath, 'rb') as file: + lines = file.readlines() + with open(definePath, 'wb') as file: + for line in lines: + for replacement in replacementRegexes: + line = replacement[0].sub(replacement[1], line) + file.write(line) + + +def updateVersionPlaceholder(filename, version): + with open(filename, 'rb') as file: + lines = file.readlines() + placeholderRegex = re.compile(b' in Catch X.Y.Z') + replacement = ' in Catch {}.{}.{}'.format(version.majorVersion, version.minorVersion, version.patchNumber).encode('ascii') + with open(filename, 'wb') as file: + for line in lines: + file.write(placeholderRegex.sub(replacement, line)) + + +def updateDocumentationVersionPlaceholders(version): + print('Updating version placeholder in documentation') + docsPath = os.path.join(catchPath, 'docs/') + for basePath, _, files in os.walk(docsPath): + for file in files: + if fnmatch.fnmatch(file, "*.md") and "contributing.md" != file: + updateVersionPlaceholder(os.path.join(basePath, file), version) + + +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', 'sonarqube'): + # sourceFile = os.path.join(catchPath, 'include/reporters/catch_reporter_{}.hpp'.format(rep)) + # destFile = os.path.join(catchPath, 'single_include', 'catch2', 'catch_reporter_{}.hpp'.format(rep)) + # shutil.copyfile(sourceFile, destFile) + + # updateReadmeFile(version) + updateCmakeFile(version) + updateDocumentationVersionPlaceholders(version) diff --git a/packages/Catch2/tools/scripts/releaseNotes.py b/packages/Catch2/tools/scripts/releaseNotes.py new file mode 100755 index 0000000000000000000000000000000000000000..7f580e9839be556952b3fceaa726820e3c8a979e --- /dev/null +++ b/packages/Catch2/tools/scripts/releaseNotes.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python3 + +from __future__ import print_function + +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() ) + 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/packages/Catch2/tools/scripts/scriptCommon.py b/packages/Catch2/tools/scripts/scriptCommon.py new file mode 100644 index 0000000000000000000000000000000000000000..a6930063a9b8bba9cb81526a388abaa4f39986a0 --- /dev/null +++ b/packages/Catch2/tools/scripts/scriptCommon.py @@ -0,0 +1,31 @@ +import os +import sys +import subprocess + + +catchPath = os.path.dirname(os.path.dirname(os.path.realpath( os.path.dirname(sys.argv[0])))) + +def getBuildExecutable(): + if os.name == 'nt': + dir = os.environ.get('CATCH_DEV_OUT_DIR', "cmake-build-debug/projects/SelfTest.exe") + return dir + else: + dir = os.environ.get('CATCH_DEV_OUT_DIR', "cmake-build-debug/projects/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(): + break + if out != '': + if out == '\n': + lines.append( line ) + line = "" + else: + line = line + out + return lines diff --git a/packages/Catch2/tools/scripts/updateDocumentSnippets.py b/packages/Catch2/tools/scripts/updateDocumentSnippets.py new file mode 100755 index 0000000000000000000000000000000000000000..a070eea8642cc78efed74d0d51a50c23764dde65 --- /dev/null +++ b/packages/Catch2/tools/scripts/updateDocumentSnippets.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 + +from scriptCommon import catchPath +import os +import subprocess + +# --------------------------------------------------- +# Update code examples +# --------------------------------------------------- +# For info on mdsnippets, see https://github.com/SimonCropp/MarkdownSnippets + +# install dotnet SDK from http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409 +# Then install MarkdownSnippets.Tool with +# dotnet tool install -g MarkdownSnippets.Tool +# To update: +# dotnet tool update -g MarkdownSnippets.Tool +# To uninstall (e.g. to downgrade to a lower version) +# dotnet tool uninstall -g MarkdownSnippets.Tool + +os.chdir(catchPath) + +subprocess.run('dotnet tool update -g MarkdownSnippets.Tool --version 21.2.0', shell=True, check=True) +subprocess.run('mdsnippets', shell=True, check=True) diff --git a/packages/Catch2/tools/scripts/updateDocumentToC.py b/packages/Catch2/tools/scripts/updateDocumentToC.py new file mode 100755 index 0000000000000000000000000000000000000000..41b48752cf68ded013ebabee38d489a229607c3c --- /dev/null +++ b/packages/Catch2/tools/scripts/updateDocumentToC.py @@ -0,0 +1,449 @@ +#!/usr/bin/env python3 + +# +# 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 + +import argparse +import glob +import os +import re +import sys + +from scriptCommon import catchPath + +# Configuration: + +minTocEntries = 4 + +headingExcludeDefault = [1,3,4,5] # use level 2 headers for at default +headingExcludeRelease = [1,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() + + # GitHub's sluggification works in an interesting way + # 1) '+', '/', '(', ')' and so on are just removed + # 2) spaces are converted into '-' directly + # 3) multiple -- are not collapsed + + dashified = '' + for c in stripped_wspace: + if c in VALIDS: + dashified += c.lower() + elif c.isspace(): + dashified += '-' + else: + # Unknown symbols are just removed + continue + + 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 represents 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 (default: 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 [{default}]'.format(default=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 args.Input 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/packages/Catch2/tools/scripts/updateWandbox.py b/packages/Catch2/tools/scripts/updateWandbox.py new file mode 100644 index 0000000000000000000000000000000000000000..3668da52a5f70f2119ab93495bf8e1caa2d819b4 --- /dev/null +++ b/packages/Catch2/tools/scripts/updateWandbox.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python3 + +import json +import os +import urllib.request +import urllib.parse + + +from scriptCommon import catchPath + +def upload(options): +# request_blah = urllib.request.Request('https:// + + request = urllib.request.Request('https://melpon.org/wandbox/api/compile.json', method='POST') + json_bytes = json.dumps(options).encode('utf-8') + request.add_header('Content-Type', 'application/json; charset=utf-8') + request.add_header('Content-Length', len(json_bytes)) + response = urllib.request.urlopen(request, json_bytes) + return json.loads(response.read().decode('utf-8')) + +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', 'catch2', 'catch.hpp')).read() + }], + 'options': 'c++11,cpp-no-pedantic,boost-nothing', + 'compiler-option-raw': '-DCATCH_CONFIG_FAST_COMPILE', + 'save': True + }) + + if 'url' in response and 'compiler_error' not in response: + return True, response['url'] + else: + return False, response diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 5ae8aeef954932a6051be1f6f916d20dbad2b9f3..b2c9f5015a442538ec23f8d421fb07fa93153480 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -148,9 +148,6 @@ target_link_libraries (mpi_unit_tests enable_testing() -#parse catch tests -ParseAndAddCatchTests(unit_tests) - if(${PUGS_HAS_MPI}) set(MPIEXEC_OPTION_FLAGS --oversubscribe) if (NOT "$ENV{GITLAB_CI}" STREQUAL "") @@ -158,5 +155,3 @@ if(${PUGS_HAS_MPI}) endif() set(OptionalCatchTestLauncher ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 3 ${MPIEXEC_OPTION_FLAGS} --path ${PUGS_BINARY_DIR}) endif() -ParseAndAddCatchTests(mpi_unit_tests) -unset(OptionalCatchTestLauncher) diff --git a/tests/mpi_test_main.cpp b/tests/mpi_test_main.cpp index 44162aba3edce0e992b7f37e6df6cca1040b3291..68736ebe3c04ff1c171be3a96dcaca4fea58c17b 100644 --- a/tests/mpi_test_main.cpp +++ b/tests/mpi_test_main.cpp @@ -1,5 +1,4 @@ -#define CATCH_CONFIG_RUNNER -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <Kokkos_Core.hpp> @@ -39,7 +38,7 @@ main(int argc, char* argv[]) if (result == 0) { const auto& config = session.config(); - if (config.listReporters() or config.listTags() or config.listTestNamesOnly() or config.listTests()) { + if (config.listReporters() or config.listTags() or config.listTests()) { if (parallel::rank() == 0) { session.run(); } diff --git a/tests/test_ASTBuilder.cpp b/tests/test_ASTBuilder.cpp index 75f41a36d1c5c4e737070d89a4500051e0a4a037..387e84b75b359b1cd4f95dd594f798e56b02208c 100644 --- a/tests/test_ASTBuilder.cpp +++ b/tests/test_ASTBuilder.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/utils/ASTPrinter.hpp> diff --git a/tests/test_ASTDotPrinter.cpp b/tests/test_ASTDotPrinter.cpp index 9f11198bce541c2831312ab2d121af2c37fb9ad7..7081821e6635432d71ad7d18cd5b2fa5883e613e 100644 --- a/tests/test_ASTDotPrinter.cpp +++ b/tests/test_ASTDotPrinter.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/utils/ASTDotPrinter.hpp> diff --git a/tests/test_ASTModulesImporter.cpp b/tests/test_ASTModulesImporter.cpp index ca0962c6182b8c5127c7ba74d3fe06a403fb67b6..6d98d31fb33628873fb73369213351128dd6e71a 100644 --- a/tests/test_ASTModulesImporter.cpp +++ b/tests/test_ASTModulesImporter.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTModulesImporter.hpp> diff --git a/tests/test_ASTNode.cpp b/tests/test_ASTNode.cpp index 00f1e108488b14435ecbcbbde474bb2641cba01a..bb4b07f9b1d8a2022a0b5961b7e76ac80922f1b9 100644 --- a/tests/test_ASTNode.cpp +++ b/tests/test_ASTNode.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/PEGGrammar.hpp> #include <language/ast/ASTNode.hpp> diff --git a/tests/test_ASTNodeAffectationExpressionBuilder.cpp b/tests/test_ASTNodeAffectationExpressionBuilder.cpp index 5a6bd835b5ee47d4628aa5081fdc50d2b57f2be3..b155ab61473f320be06b499e70cc4a32a269ce6f 100644 --- a/tests/test_ASTNodeAffectationExpressionBuilder.cpp +++ b/tests/test_ASTNodeAffectationExpressionBuilder.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTNodeAffectationExpressionBuilder.hpp> diff --git a/tests/test_ASTNodeArraySubscriptExpressionBuilder.cpp b/tests/test_ASTNodeArraySubscriptExpressionBuilder.cpp index 29bffa7bc5e7ca5ecbddcfc6401e97f58569d26b..19b8d5a55457511c4e24bd5fba5db1abce2ce328 100644 --- a/tests/test_ASTNodeArraySubscriptExpressionBuilder.cpp +++ b/tests/test_ASTNodeArraySubscriptExpressionBuilder.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTNode.hpp> #include <language/ast/ASTNodeArraySubscriptExpressionBuilder.hpp> diff --git a/tests/test_ASTNodeBinaryOperatorExpressionBuilder.cpp b/tests/test_ASTNodeBinaryOperatorExpressionBuilder.cpp index f5a0ef7e2aefbbd8772effe8123be8a6503a72f9..d9b5d245624eaba1ebb14e1e7869ac89e58b28b9 100644 --- a/tests/test_ASTNodeBinaryOperatorExpressionBuilder.cpp +++ b/tests/test_ASTNodeBinaryOperatorExpressionBuilder.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTNodeBinaryOperatorExpressionBuilder.hpp> diff --git a/tests/test_ASTNodeBuiltinFunctionExpressionBuilder.cpp b/tests/test_ASTNodeBuiltinFunctionExpressionBuilder.cpp index b55ab6775600f5fc31caafa396c8df2f59b370ae..a313d7c92577b33892c4128b4d5d88ec8c6daebc 100644 --- a/tests/test_ASTNodeBuiltinFunctionExpressionBuilder.cpp +++ b/tests/test_ASTNodeBuiltinFunctionExpressionBuilder.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTModulesImporter.hpp> @@ -9,6 +10,7 @@ #include <language/ast/ASTNodeTypeCleaner.hpp> #include <language/ast/ASTSymbolTableBuilder.hpp> #include <language/utils/ASTPrinter.hpp> +#include <stdexcept> #include <utils/Demangle.hpp> #include <test_BuiltinFunctionRegister.hpp> @@ -42,23 +44,23 @@ REQUIRE(ast_output.str() == expected_output); \ } -#define CHECK_AST_THROWS_WITH(data, expected_error) \ - { \ - static_assert(std::is_same_v<std::decay_t<decltype(data)>, std::string_view>); \ - static_assert((std::is_same_v<std::decay_t<decltype(expected_error)>, std::string_view>) or \ - (std::is_same_v<std::decay_t<decltype(expected_error)>, std::string>)); \ - \ - TAO_PEGTL_NAMESPACE::string_input input{data, "test.pgs"}; \ - auto ast = ASTBuilder::build(input); \ - \ - test_only::test_BuiltinFunctionRegister{*ast}; \ - \ - ASTSymbolTableBuilder{*ast}; \ - ASTNodeDataTypeBuilder{*ast}; \ - \ - ASTNodeTypeCleaner<language::var_declaration>{*ast}; \ - ASTNodeTypeCleaner<language::fct_declaration>{*ast}; \ - REQUIRE_THROWS_WITH(ASTNodeExpressionBuilder{*ast}, Catch::Matchers::Contains(expected_error)); \ +#define CHECK_AST_THROWS_WITH(data, expected_error) \ + { \ + static_assert(std::is_same_v<std::decay_t<decltype(data)>, std::string_view>); \ + static_assert((std::is_same_v<std::decay_t<decltype(expected_error)>, std::string_view>) or \ + (std::is_same_v<std::decay_t<decltype(expected_error)>, std::string>)); \ + \ + TAO_PEGTL_NAMESPACE::string_input input{data, "test.pgs"}; \ + auto ast = ASTBuilder::build(input); \ + \ + test_only::test_BuiltinFunctionRegister{*ast}; \ + \ + ASTSymbolTableBuilder{*ast}; \ + ASTNodeDataTypeBuilder{*ast}; \ + \ + ASTNodeTypeCleaner<language::var_declaration>{*ast}; \ + ASTNodeTypeCleaner<language::fct_declaration>{*ast}; \ + REQUIRE_THROWS_WITH(ASTNodeExpressionBuilder{*ast}, expected_error); \ } // clazy:excludeall=non-pod-global-static @@ -1656,7 +1658,7 @@ fidToR(f); std::string_view data = R"( BtoR(true, false); )"; - CHECK_AST_THROWS_WITH(data, std::string{"bad number of arguments:"}); + CHECK_AST_THROWS_WITH(data, std::string{"bad number of arguments: expecting 1, provided 2"}); } SECTION("bad number of arguments 2") @@ -1664,7 +1666,7 @@ BtoR(true, false); std::string_view data = R"( RRtoB(3); )"; - CHECK_AST_THROWS_WITH(data, std::string{"bad number of arguments:"}); + CHECK_AST_THROWS_WITH(data, std::string{"bad number of arguments: expecting 2, provided 1"}); } SECTION("invalid argument type") diff --git a/tests/test_ASTNodeDataType.cpp b/tests/test_ASTNodeDataType.cpp index 843a4b9daaf18e694b3121c5898f1eff4fb06a32..1f2b2a2bffe4113ac8a01feb7ee9839f29b3bc6e 100644 --- a/tests/test_ASTNodeDataType.cpp +++ b/tests/test_ASTNodeDataType.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/PEGGrammar.hpp> #include <language/ast/ASTNode.hpp> diff --git a/tests/test_ASTNodeDataTypeBuilder.cpp b/tests/test_ASTNodeDataTypeBuilder.cpp index 3de0130da3de2c911267d3467aa024af07ef8977..b8ce32c92b15e4560251811528b59a69ea48f0e7 100644 --- a/tests/test_ASTNodeDataTypeBuilder.cpp +++ b/tests/test_ASTNodeDataTypeBuilder.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTNodeDataTypeBuilder.hpp> diff --git a/tests/test_ASTNodeDataTypeChecker.cpp b/tests/test_ASTNodeDataTypeChecker.cpp index 4343f3eee060b8763807e49ae555f5ea49de707d..4c8dc8cf03e475b97bd91a1422e55a909dede2b7 100644 --- a/tests/test_ASTNodeDataTypeChecker.cpp +++ b/tests/test_ASTNodeDataTypeChecker.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTNodeDataTypeBuilder.hpp> diff --git a/tests/test_ASTNodeDataTypeFlattener.cpp b/tests/test_ASTNodeDataTypeFlattener.cpp index ef9431655399cf0f1c45cdeb1a75a13680888adb..c49613ca827ed265e3e338a5639a7edfa862823c 100644 --- a/tests/test_ASTNodeDataTypeFlattener.cpp +++ b/tests/test_ASTNodeDataTypeFlattener.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTNodeDataTypeBuilder.hpp> diff --git a/tests/test_ASTNodeDeclarationToAffectationConverter.cpp b/tests/test_ASTNodeDeclarationToAffectationConverter.cpp index eb101857969a66da20ca82cf1d91d11969825a44..c102d5f6599f40a390bdb7b67004f3786624540f 100644 --- a/tests/test_ASTNodeDeclarationToAffectationConverter.cpp +++ b/tests/test_ASTNodeDeclarationToAffectationConverter.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTNodeDataTypeBuilder.hpp> diff --git a/tests/test_ASTNodeEmptyBlockCleaner.cpp b/tests/test_ASTNodeEmptyBlockCleaner.cpp index e1aa381509aff202a76722905528bff983336409..e9a7c4a5e9b786f9c9e4ba6fe34504f320bb5472 100644 --- a/tests/test_ASTNodeEmptyBlockCleaner.cpp +++ b/tests/test_ASTNodeEmptyBlockCleaner.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTNodeDataTypeBuilder.hpp> diff --git a/tests/test_ASTNodeExpressionBuilder.cpp b/tests/test_ASTNodeExpressionBuilder.cpp index 999a6e63672dfccd60c50b78062c2754c7b96bcf..11eb9f16177612f0c150a9b9f363fc219578c9cf 100644 --- a/tests/test_ASTNodeExpressionBuilder.cpp +++ b/tests/test_ASTNodeExpressionBuilder.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTNodeDataTypeBuilder.hpp> diff --git a/tests/test_ASTNodeFunctionEvaluationExpressionBuilder.cpp b/tests/test_ASTNodeFunctionEvaluationExpressionBuilder.cpp index 63cecd79b7865b197c42b5a7f5762e8a12c4200b..6fbb82cf81db5c9ae7b78d30d17a01864a3e5d57 100644 --- a/tests/test_ASTNodeFunctionEvaluationExpressionBuilder.cpp +++ b/tests/test_ASTNodeFunctionEvaluationExpressionBuilder.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTModulesImporter.hpp> diff --git a/tests/test_ASTNodeFunctionExpressionBuilder.cpp b/tests/test_ASTNodeFunctionExpressionBuilder.cpp index 9a762ed5ea7b83ab81d1155163b22c89a8ef572b..a8c2e0f15525c78dfd9e35df0672761d3df3b1f0 100644 --- a/tests/test_ASTNodeFunctionExpressionBuilder.cpp +++ b/tests/test_ASTNodeFunctionExpressionBuilder.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTModulesImporter.hpp> diff --git a/tests/test_ASTNodeIncDecExpressionBuilder.cpp b/tests/test_ASTNodeIncDecExpressionBuilder.cpp index da5e049555f7e581416682eac30ceac91b0c41ef..88d1518fcad3511bba5cb6d426f752f72dd5c912 100644 --- a/tests/test_ASTNodeIncDecExpressionBuilder.cpp +++ b/tests/test_ASTNodeIncDecExpressionBuilder.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTNodeDataTypeBuilder.hpp> diff --git a/tests/test_ASTNodeJumpPlacementChecker.cpp b/tests/test_ASTNodeJumpPlacementChecker.cpp index d3a5a3c59b47c4a220c701e9eaa7cd498f29eb8b..f69a09ac43565f90a0e42c71f8e9f38cd18c401f 100644 --- a/tests/test_ASTNodeJumpPlacementChecker.cpp +++ b/tests/test_ASTNodeJumpPlacementChecker.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTNodeDataTypeBuilder.hpp> diff --git a/tests/test_ASTNodeListAffectationExpressionBuilder.cpp b/tests/test_ASTNodeListAffectationExpressionBuilder.cpp index 78c0a2c0baadc4d016199e56d88c370f082cfe17..bcb8942e785f3ad9f5320a4ab321986736ae6b97 100644 --- a/tests/test_ASTNodeListAffectationExpressionBuilder.cpp +++ b/tests/test_ASTNodeListAffectationExpressionBuilder.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTNodeDataTypeBuilder.hpp> diff --git a/tests/test_ASTNodeListProcessor.cpp b/tests/test_ASTNodeListProcessor.cpp index 946ec382cee6b25989a8f8ca9cfbc303cce8149e..934eb58912179a90158df2c3885a923ba7cf736c 100644 --- a/tests/test_ASTNodeListProcessor.cpp +++ b/tests/test_ASTNodeListProcessor.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTNodeDataTypeBuilder.hpp> diff --git a/tests/test_ASTNodeNaturalConversionChecker.cpp b/tests/test_ASTNodeNaturalConversionChecker.cpp index 0e91a0b7dbba39c486b008cae05188af463e4a64..d03541e6c96c63b70a220ee94f50a858614eab5b 100644 --- a/tests/test_ASTNodeNaturalConversionChecker.cpp +++ b/tests/test_ASTNodeNaturalConversionChecker.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/PEGGrammar.hpp> #include <language/ast/ASTNode.hpp> diff --git a/tests/test_ASTNodeTypeCleaner.cpp b/tests/test_ASTNodeTypeCleaner.cpp index 4f7adfcf162bb57a54b3c1d9c9a03d339969e654..e2ae69b4695d785745dce55a5dc1bf617b980773 100644 --- a/tests/test_ASTNodeTypeCleaner.cpp +++ b/tests/test_ASTNodeTypeCleaner.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTNodeDataTypeBuilder.hpp> diff --git a/tests/test_ASTNodeUnaryOperatorExpressionBuilder.cpp b/tests/test_ASTNodeUnaryOperatorExpressionBuilder.cpp index 08fa22a71def33bceca5255b7dbc8064a1dd47b4..ae51cf9a0d77b642f7e3b9f6cdcd1c00d59c492a 100644 --- a/tests/test_ASTNodeUnaryOperatorExpressionBuilder.cpp +++ b/tests/test_ASTNodeUnaryOperatorExpressionBuilder.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTNodeDataTypeBuilder.hpp> diff --git a/tests/test_ASTPrinter.cpp b/tests/test_ASTPrinter.cpp index 31ee8cac5e7cd193f3cda7ccca925388d26d4e99..87072e631f8920d9885f4d996b9611e23daf4e10 100644 --- a/tests/test_ASTPrinter.cpp +++ b/tests/test_ASTPrinter.cpp @@ -1,5 +1,6 @@ // -*- coding: utf-8 -*- -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/utils/ASTPrinter.hpp> diff --git a/tests/test_ASTSymbolInitializationChecker.cpp b/tests/test_ASTSymbolInitializationChecker.cpp index 1d104da14d53ce4918ecd33405ee1a6658d737ac..d0475ee8cf53875436ac8c8f8e12c1a8a1c60d2f 100644 --- a/tests/test_ASTSymbolInitializationChecker.cpp +++ b/tests/test_ASTSymbolInitializationChecker.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTSymbolInitializationChecker.hpp> diff --git a/tests/test_ASTSymbolTableBuilder.cpp b/tests/test_ASTSymbolTableBuilder.cpp index fa0d31824eed8a3ddb0dcea45497ad5f5c580889..581bd1fae668aef70e17544393f7632fe564e1fc 100644 --- a/tests/test_ASTSymbolTableBuilder.cpp +++ b/tests/test_ASTSymbolTableBuilder.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTSymbolTableBuilder.hpp> diff --git a/tests/test_AffectationProcessor.cpp b/tests/test_AffectationProcessor.cpp index 8319410a2217814c7a3fd2c4d7fc08bfbb249ced..f64af713bdd5e45ddec46b50869b7fb035b8a0f3 100644 --- a/tests/test_AffectationProcessor.cpp +++ b/tests/test_AffectationProcessor.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTNodeAffectationExpressionBuilder.hpp> diff --git a/tests/test_AffectationToStringProcessor.cpp b/tests/test_AffectationToStringProcessor.cpp index 46593b24802e5400b43f81c94974109e6e030f3a..a793a5cd82a6bd53d7e45369e5e9ebae9044745c 100644 --- a/tests/test_AffectationToStringProcessor.cpp +++ b/tests/test_AffectationToStringProcessor.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTNodeAffectationExpressionBuilder.hpp> diff --git a/tests/test_AffectationToTupleProcessor.cpp b/tests/test_AffectationToTupleProcessor.cpp index 61e95338e03d09ec2ed479e8a4ac27d157dac43f..df2de1d07c100154a9728a1c68197121fd18f4dd 100644 --- a/tests/test_AffectationToTupleProcessor.cpp +++ b/tests/test_AffectationToTupleProcessor.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTNodeAffectationExpressionBuilder.hpp> diff --git a/tests/test_Array.cpp b/tests/test_Array.cpp index 0071da34de3f6c5ae3173cb282a5a995462b47c5..ac61be590dbfafe8bee60a216eb3ba01819b6279 100644 --- a/tests/test_Array.cpp +++ b/tests/test_Array.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <utils/Array.hpp> #include <utils/PugsAssert.hpp> diff --git a/tests/test_ArraySubscriptProcessor.cpp b/tests/test_ArraySubscriptProcessor.cpp index ab08a1d6ed2b69493e8bb06bf5d7bb2a7f9321c4..cac519c63447a307864a1a8940dfbf3427388317 100644 --- a/tests/test_ArraySubscriptProcessor.cpp +++ b/tests/test_ArraySubscriptProcessor.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTModulesImporter.hpp> diff --git a/tests/test_ArrayUtils.cpp b/tests/test_ArrayUtils.cpp index fd34c4e00d34d0e83e60633effc7fe86bb78c048..79df610d909873a84328b59403ec861269b4f8b3 100644 --- a/tests/test_ArrayUtils.cpp +++ b/tests/test_ArrayUtils.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <utils/Array.hpp> #include <utils/ArrayUtils.hpp> diff --git a/tests/test_BiCGStab.cpp b/tests/test_BiCGStab.cpp index 49a6955be4ae1da7c45e036977a3036be0ccf6d3..ac6b547a82d532e0edf2e5c57d68c41ae97afeee 100644 --- a/tests/test_BiCGStab.cpp +++ b/tests/test_BiCGStab.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <algebra/BiCGStab.hpp> #include <algebra/CRSMatrix.hpp> diff --git a/tests/test_BinaryExpressionProcessor_arithmetic.cpp b/tests/test_BinaryExpressionProcessor_arithmetic.cpp index 6b3f3bb07597b9d2f6704c117cc02ff6d02743a6..2c91674b2fd300bb59ef4faae100c4ea0423df33 100644 --- a/tests/test_BinaryExpressionProcessor_arithmetic.cpp +++ b/tests/test_BinaryExpressionProcessor_arithmetic.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <test_BinaryExpressionProcessor_utils.hpp> diff --git a/tests/test_BinaryExpressionProcessor_comparison.cpp b/tests/test_BinaryExpressionProcessor_comparison.cpp index c74d73f919f557fc992812848e9eb7a9afa1fd31..149486f7ee4eb683b8c2d528e0834f531f59bc4c 100644 --- a/tests/test_BinaryExpressionProcessor_comparison.cpp +++ b/tests/test_BinaryExpressionProcessor_comparison.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <test_BinaryExpressionProcessor_utils.hpp> diff --git a/tests/test_BinaryExpressionProcessor_equality.cpp b/tests/test_BinaryExpressionProcessor_equality.cpp index c7d526b97939bb64998bc6d8b961a2a042999de4..5a79bc206a2a41f3ac23ab0c8e28f619521acb02 100644 --- a/tests/test_BinaryExpressionProcessor_equality.cpp +++ b/tests/test_BinaryExpressionProcessor_equality.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <test_BinaryExpressionProcessor_utils.hpp> diff --git a/tests/test_BinaryExpressionProcessor_logic.cpp b/tests/test_BinaryExpressionProcessor_logic.cpp index a0d6c12e7cbef0e5e90dc1ed0ec6bb57a6a7d406..f88c259d7f7c8556813503ac4908a2d3e54ae53c 100644 --- a/tests/test_BinaryExpressionProcessor_logic.cpp +++ b/tests/test_BinaryExpressionProcessor_logic.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <test_BinaryExpressionProcessor_utils.hpp> diff --git a/tests/test_BreakProcessor.cpp b/tests/test_BreakProcessor.cpp index 6cefebec47eb216847f1115406a3456d3ea2d421..fd53c85f465b279bda0155fcbfd3786440da4058 100644 --- a/tests/test_BreakProcessor.cpp +++ b/tests/test_BreakProcessor.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/node_processor/BreakProcessor.hpp> diff --git a/tests/test_BuildInfo.cpp b/tests/test_BuildInfo.cpp index b63d0eb9b22beab6d810b806284d6fc85f3c0df9..3713ef9d39ca5e74fcc62b47816cc51e1dbd41fd 100644 --- a/tests/test_BuildInfo.cpp +++ b/tests/test_BuildInfo.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <utils/BuildInfo.hpp> #include <utils/pugs_build_info.hpp> diff --git a/tests/test_BuiltinFunctionEmbedder.cpp b/tests/test_BuiltinFunctionEmbedder.cpp index b00a9649b6cf8a5f3b57c27d9d63e74ad5ed68b6..2651c0e94659c1bbffc0bd47e6ab946cce18e3c9 100644 --- a/tests/test_BuiltinFunctionEmbedder.cpp +++ b/tests/test_BuiltinFunctionEmbedder.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/utils/BuiltinFunctionEmbedder.hpp> diff --git a/tests/test_BuiltinFunctionEmbedderTable.cpp b/tests/test_BuiltinFunctionEmbedderTable.cpp index 5cc254f190a07c6162053ea522627ac0eeb49586..e0787552686a0d15672967ff43d58a53df20a7a7 100644 --- a/tests/test_BuiltinFunctionEmbedderTable.cpp +++ b/tests/test_BuiltinFunctionEmbedderTable.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/utils/BuiltinFunctionEmbedder.hpp> #include <language/utils/EmbedderTable.hpp> diff --git a/tests/test_BuiltinFunctionProcessor.cpp b/tests/test_BuiltinFunctionProcessor.cpp index a00ce26465f395fc8396ee087f828c64ac9a6128..e1b9bb4ed39c39aea07d9d289d8808e8c5a54851 100644 --- a/tests/test_BuiltinFunctionProcessor.cpp +++ b/tests/test_BuiltinFunctionProcessor.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_predicate.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTModulesImporter.hpp> @@ -11,41 +12,39 @@ #include <test_BuiltinFunctionRegister.hpp> -#define CHECK_BUILTIN_FUNCTION_EVALUATION_RESULT(data, variable_name, expected_value) \ - { \ - TAO_PEGTL_NAMESPACE::string_input input{data, "test.pgs"}; \ - auto ast = ASTBuilder::build(input); \ - \ - ASTModulesImporter{*ast}; \ - ASTNodeTypeCleaner<language::import_instruction>{*ast}; \ - \ - ASTSymbolTableBuilder{*ast}; \ - ASTNodeDataTypeBuilder{*ast}; \ - \ - ASTNodeDeclarationToAffectationConverter{*ast}; \ - ASTNodeTypeCleaner<language::var_declaration>{*ast}; \ - ASTNodeTypeCleaner<language::fct_declaration>{*ast}; \ - \ - ASTNodeExpressionBuilder{*ast}; \ - ExecutionPolicy exec_policy; \ - ast->execute(exec_policy); \ - \ - auto symbol_table = ast->m_symbol_table; \ - \ - using namespace TAO_PEGTL_NAMESPACE; \ - position use_position{internal::iterator{"fixture"}, "fixture"}; \ - use_position.byte = 10000; \ - auto [symbol, found] = symbol_table->find(variable_name, use_position); \ - \ - using namespace Catch::Matchers; \ - \ - REQUIRE_THAT(found, Predicate<bool>([](bool found) -> bool { return found; }, \ - std::string{"Cannot find symbol '"} + variable_name + "'")); \ - \ - auto attributes = symbol->attributes(); \ - auto value = std::get<decltype(expected_value)>(attributes.value()); \ - \ - REQUIRE(value == expected_value); \ +#define CHECK_BUILTIN_FUNCTION_EVALUATION_RESULT(data, variable_name, expected_value) \ + { \ + TAO_PEGTL_NAMESPACE::string_input input{data, "test.pgs"}; \ + auto ast = ASTBuilder::build(input); \ + \ + ASTModulesImporter{*ast}; \ + ASTNodeTypeCleaner<language::import_instruction>{*ast}; \ + \ + ASTSymbolTableBuilder{*ast}; \ + ASTNodeDataTypeBuilder{*ast}; \ + \ + ASTNodeDeclarationToAffectationConverter{*ast}; \ + ASTNodeTypeCleaner<language::var_declaration>{*ast}; \ + ASTNodeTypeCleaner<language::fct_declaration>{*ast}; \ + \ + ASTNodeExpressionBuilder{*ast}; \ + ExecutionPolicy exec_policy; \ + ast->execute(exec_policy); \ + \ + auto symbol_table = ast->m_symbol_table; \ + \ + using namespace TAO_PEGTL_NAMESPACE; \ + position use_position{internal::iterator{"fixture"}, "fixture"}; \ + use_position.byte = 10000; \ + auto [symbol, found] = symbol_table->find(variable_name, use_position); \ + \ + REQUIRE_THAT(found, Catch::Matchers::Predicate<bool>([](bool found) -> bool { return found; }, \ + std::string{"Cannot find symbol '"} + variable_name + "'")); \ + \ + auto attributes = symbol->attributes(); \ + auto value = std::get<decltype(expected_value)>(attributes.value()); \ + \ + REQUIRE(value == expected_value); \ } #define CHECK_AST_THROWS_WITH(data, expected_error) \ @@ -67,8 +66,8 @@ \ ASTNodeExpressionBuilder{*ast}; \ ExecutionPolicy exec_policy; \ - \ - REQUIRE_THROWS_WITH(ast->execute(exec_policy), Catch::Matchers::Contains(expected_error)); \ + using namespace Catch::Matchers; \ + REQUIRE_THROWS_WITH(ast->execute(exec_policy), expected_error); \ } // clazy:excludeall=non-pod-global-static @@ -296,7 +295,7 @@ let z:Z, z = round(-1.2); runtimeError(); )"; - std::string error = "runtime error"; + std::string error = "error: runtime error"; CHECK_AST_THROWS_WITH(data, error); } diff --git a/tests/test_CG.cpp b/tests/test_CG.cpp index 75ab83063b9c19121e598ec68a5260ce95b02ae8..00751efb3ccbdf5fe86da3a242c0b6dad92b097b 100644 --- a/tests/test_CG.cpp +++ b/tests/test_CG.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <algebra/CG.hpp> #include <algebra/CRSMatrix.hpp> diff --git a/tests/test_CRSGraph.cpp b/tests/test_CRSGraph.cpp index 5c2fc7f287249468886f557d30bbb5740216f114..d3652549c505667dee92cef7b886ad509d1a2ce2 100644 --- a/tests/test_CRSGraph.cpp +++ b/tests/test_CRSGraph.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <utils/CRSGraph.hpp> diff --git a/tests/test_CRSMatrix.cpp b/tests/test_CRSMatrix.cpp index 6c8584796b8c71991941870c723cc23617c0c2ac..0f748fb37971fefb53cdc881d7452607c6dd3e6e 100644 --- a/tests/test_CRSMatrix.cpp +++ b/tests/test_CRSMatrix.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <algebra/CRSMatrix.hpp> diff --git a/tests/test_CastArray.cpp b/tests/test_CastArray.cpp index 6a014045cfaf19a039dcaf0be97edaa81bea8522..d1c9cad2c1f7d2d39dad4e8fba8764d9b0bd6c2c 100644 --- a/tests/test_CastArray.cpp +++ b/tests/test_CastArray.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <utils/ArrayUtils.hpp> #include <utils/CastArray.hpp> diff --git a/tests/test_ConcatExpressionProcessor.cpp b/tests/test_ConcatExpressionProcessor.cpp index 74257b45f086cd93c868f3022be8c380e8cb1d12..eaa0f76f245ae0f14394396a6593f9118a2e879d 100644 --- a/tests/test_ConcatExpressionProcessor.cpp +++ b/tests/test_ConcatExpressionProcessor.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTNodeAffectationExpressionBuilder.hpp> diff --git a/tests/test_ConsoleManager.cpp b/tests/test_ConsoleManager.cpp index 4387d7042065df80406ba3ba1c06ba44ec3f9e97..68559e449a746cf901dca8820d1bf5b4ebd82172 100644 --- a/tests/test_ConsoleManager.cpp +++ b/tests/test_ConsoleManager.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <utils/ConsoleManager.hpp> diff --git a/tests/test_ContinueProcessor.cpp b/tests/test_ContinueProcessor.cpp index 0d4348b4558eaba1e7503601c4ee67bcbfa9ab00..bc3e1eb701aaa792d6c6a52249852cc57ccb49c7 100644 --- a/tests/test_ContinueProcessor.cpp +++ b/tests/test_ContinueProcessor.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/node_processor/ContinueProcessor.hpp> diff --git a/tests/test_DataVariant.cpp b/tests/test_DataVariant.cpp index 92ca82b9aeb7ee68c9698f973ce48d457fd27696..0db6af9b2fbe55081a8dc43d359a189cae4f5d5a 100644 --- a/tests/test_DataVariant.cpp +++ b/tests/test_DataVariant.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/utils/DataVariant.hpp> diff --git a/tests/test_Demangle.cpp b/tests/test_Demangle.cpp index a3489fd2d629fe835e3ce247a8ac8008bb06ff9d..d6574f17d1f6a457f2a975ef801b09f95ee331b6 100644 --- a/tests/test_Demangle.cpp +++ b/tests/test_Demangle.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <utils/Demangle.hpp> diff --git a/tests/test_DoWhileProcessor.cpp b/tests/test_DoWhileProcessor.cpp index 453859d83b8a7290ac738e7cb425cf8848ed622b..ccb056399c665a683c1f71cf1e4a224962fb4876 100644 --- a/tests/test_DoWhileProcessor.cpp +++ b/tests/test_DoWhileProcessor.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTNodeAffectationExpressionBuilder.hpp> diff --git a/tests/test_EmbeddedData.cpp b/tests/test_EmbeddedData.cpp index 63ca0d42705bed2cbe85e1697f32e443e20303e9..2f3c46741d4d3811e4c55000053bfa732b0150db 100644 --- a/tests/test_EmbeddedData.cpp +++ b/tests/test_EmbeddedData.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/utils/DataHandler.hpp> #include <language/utils/EmbeddedData.hpp> diff --git a/tests/test_EscapedString.cpp b/tests/test_EscapedString.cpp index 3dca01496813ca51e6b52afd1be3c446bc7df54b..c209a812a3edfd600760de7d021011182fc0e832 100644 --- a/tests/test_EscapedString.cpp +++ b/tests/test_EscapedString.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <utils/EscapedString.hpp> diff --git a/tests/test_Exceptions.cpp b/tests/test_Exceptions.cpp index 25b181ae165aef26cd25942cc52741a2606b50ac..739046f44aa8349364ce16f074dc05d0a0a886eb 100644 --- a/tests/test_Exceptions.cpp +++ b/tests/test_Exceptions.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <utils/Exceptions.hpp> diff --git a/tests/test_ExecutionPolicy.cpp b/tests/test_ExecutionPolicy.cpp index b293a64689492f7a85df579d0ac2af5df65a83f1..090d2867158cb8698a9966844afa84445b4db0be 100644 --- a/tests/test_ExecutionPolicy.cpp +++ b/tests/test_ExecutionPolicy.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/node_processor/ExecutionPolicy.hpp> diff --git a/tests/test_FakeProcessor.cpp b/tests/test_FakeProcessor.cpp index cd5031db5049eac005ee921a45253ca833935b1a..1ccf26752d57c443c8663ef1649dbe975c8ebc16 100644 --- a/tests/test_FakeProcessor.cpp +++ b/tests/test_FakeProcessor.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/node_processor/FakeProcessor.hpp> #include <utils/Demangle.hpp> diff --git a/tests/test_ForProcessor.cpp b/tests/test_ForProcessor.cpp index 1a26d1b06d237469749db1b383dfcb1b6ad0c5ae..e3d8a634e29d80f6a1be0534660065b02a0a3f6f 100644 --- a/tests/test_ForProcessor.cpp +++ b/tests/test_ForProcessor.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTNodeAffectationExpressionBuilder.hpp> diff --git a/tests/test_FunctionArgumentConverter.cpp b/tests/test_FunctionArgumentConverter.cpp index b0a191fc5c2474a65c34c8c5e5b822b5046cb8a2..7befebe52d93fc7ba0e17b940dba88acaecfb306 100644 --- a/tests/test_FunctionArgumentConverter.cpp +++ b/tests/test_FunctionArgumentConverter.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/node_processor/FunctionArgumentConverter.hpp> #include <language/utils/SymbolTable.hpp> diff --git a/tests/test_FunctionProcessor.cpp b/tests/test_FunctionProcessor.cpp index dcfbdf25a715466fd53b23ea683859f55e9a08e1..5c72fd0d7b96a4919490b6707bde1bef03aa0b28 100644 --- a/tests/test_FunctionProcessor.cpp +++ b/tests/test_FunctionProcessor.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTModulesImporter.hpp> diff --git a/tests/test_FunctionSymbolId.cpp b/tests/test_FunctionSymbolId.cpp index 3213f86d1962d3d8726e20ce866d83d2b73f69b2..9cc8e6426b03b89a502a01621eb29794173c2f93 100644 --- a/tests/test_FunctionSymbolId.cpp +++ b/tests/test_FunctionSymbolId.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/utils/FunctionSymbolId.hpp> #include <language/utils/SymbolTable.hpp> diff --git a/tests/test_FunctionTable.cpp b/tests/test_FunctionTable.cpp index eae87ca79ac45e18da301fef72e1bd2fd35f90cf..b72656e80850139cbe047a6b3aacc5278a2d29fb 100644 --- a/tests/test_FunctionTable.cpp +++ b/tests/test_FunctionTable.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/utils/FunctionTable.hpp> diff --git a/tests/test_INodeProcessor.cpp b/tests/test_INodeProcessor.cpp index d1bbe63635edb9e1764656b2d7f55e76ffd0070f..109863804dbc6bb92ef4925c211f0e58873d66b0 100644 --- a/tests/test_INodeProcessor.cpp +++ b/tests/test_INodeProcessor.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/node_processor/FakeProcessor.hpp> #include <utils/Demangle.hpp> diff --git a/tests/test_IfProcessor.cpp b/tests/test_IfProcessor.cpp index 865c4ef1b7882b927dc3a5e68a940778b2f4ce71..9b9da7d4026b2e136279ef0d482384ddbfa34418 100644 --- a/tests/test_IfProcessor.cpp +++ b/tests/test_IfProcessor.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTNodeDataTypeBuilder.hpp> diff --git a/tests/test_IncDecExpressionProcessor.cpp b/tests/test_IncDecExpressionProcessor.cpp index d217bae1c5583b44db502a2fd58875c30dff403d..62e3d531facb5fe956f775b6dcad000ced5c625a 100644 --- a/tests/test_IncDecExpressionProcessor.cpp +++ b/tests/test_IncDecExpressionProcessor.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTNodeDataTypeBuilder.hpp> diff --git a/tests/test_ItemType.cpp b/tests/test_ItemType.cpp index 98e5d5d114dc336fae48da0552b45b7661f5de89..d560a7098ee0e2cec80a1efb64ab599df5ef67ec 100644 --- a/tests/test_ItemType.cpp +++ b/tests/test_ItemType.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <mesh/ItemType.hpp> #include <utils/PugsMacros.hpp> diff --git a/tests/test_LinearSolver.cpp b/tests/test_LinearSolver.cpp index f56bb59ed1d6b7df2e81d8e4076f0ee23bb27ec6..9ced9e9424a7d1c80a41cd9dd5a807476adea9d7 100644 --- a/tests/test_LinearSolver.cpp +++ b/tests/test_LinearSolver.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <utils/pugs_config.hpp> diff --git a/tests/test_LinearSolverOptions.cpp b/tests/test_LinearSolverOptions.cpp index 494c36760d7b48c6e40c569423a100fed669d0d6..3da7688892a736fe5f69c2adbab9c16cb6cd4fd9 100644 --- a/tests/test_LinearSolverOptions.cpp +++ b/tests/test_LinearSolverOptions.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <algebra/LinearSolverOptions.hpp> diff --git a/tests/test_ListAffectationProcessor.cpp b/tests/test_ListAffectationProcessor.cpp index eeb3aa57c08083c4f3f2999ac5318dd26b1a5a1f..f809884c3e660f16cc88f58c709040c58c96fe70 100644 --- a/tests/test_ListAffectationProcessor.cpp +++ b/tests/test_ListAffectationProcessor.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTNodeDataTypeBuilder.hpp> @@ -40,35 +41,6 @@ REQUIRE(value == expected_value); \ } -#define CHECK_AFFECTATION_THROWS(data) \ - { \ - TAO_PEGTL_NAMESPACE::string_input input{data, "test.pgs"}; \ - auto ast = ASTBuilder::build(input); \ - \ - ASTSymbolTableBuilder{*ast}; \ - ASTNodeDataTypeBuilder{*ast}; \ - \ - ASTNodeDeclarationToAffectationConverter{*ast}; \ - ASTNodeTypeCleaner<language::var_declaration>{*ast}; \ - \ - REQUIRE_THROWS(ASTNodeExpressionBuilder{*ast}, \ - Catch::Matchers::Contains("invalid operands to affectation expression")); \ - } - -#define CHECK_AFFECTATION_THROWS_WITH(data, error_message) \ - { \ - TAO_PEGTL_NAMESPACE::string_input input{data, "test.pgs"}; \ - auto ast = ASTBuilder::build(input); \ - \ - ASTSymbolTableBuilder{*ast}; \ - ASTNodeDataTypeBuilder{*ast}; \ - \ - ASTNodeDeclarationToAffectationConverter{*ast}; \ - ASTNodeTypeCleaner<language::var_declaration>{*ast}; \ - \ - REQUIRE_THROWS_WITH(ASTNodeExpressionBuilder{*ast}, error_message); \ - } - // clazy:excludeall=non-pod-global-static TEST_CASE("ListAffectationProcessor", "[language]") diff --git a/tests/test_MathModule.cpp b/tests/test_MathModule.cpp index 15cb845c48c90c525a06996a4065be8ff556c9c0..86696dfab3e574b5649c3670689e4c26cd664dbc 100644 --- a/tests/test_MathModule.cpp +++ b/tests/test_MathModule.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_approx.hpp> +#include <catch2/catch_test_macros.hpp> #include <language/modules/MathModule.hpp> #include <language/utils/BuiltinFunctionEmbedder.hpp> @@ -29,8 +30,7 @@ TEST_CASE("MathModule", "[language]") DataVariant result_variant = function_embedder.apply({arg_variant}); auto result = std::sqrt(arg); - - REQUIRE(std::get<decltype(result)>(result_variant) == Approx(result)); + REQUIRE(std::get<decltype(result)>(result_variant) == Catch::Approx(result)); } SECTION("abs") @@ -44,7 +44,7 @@ TEST_CASE("MathModule", "[language]") auto result = std::abs(arg); - REQUIRE(std::get<decltype(result)>(result_variant) == Approx(result)); + REQUIRE(std::get<decltype(result)>(result_variant) == Catch::Approx(result)); } { @@ -56,7 +56,7 @@ TEST_CASE("MathModule", "[language]") auto result = std::abs(arg); - REQUIRE(std::get<decltype(result)>(result_variant) == Approx(result)); + REQUIRE(std::get<decltype(result)>(result_variant) == Catch::Approx(result)); } } @@ -69,7 +69,7 @@ TEST_CASE("MathModule", "[language]") DataVariant result_variant = function_embedder.apply({arg_variant}); auto result = std::sin(arg); - REQUIRE(std::get<decltype(result)>(result_variant) == Approx(result)); + REQUIRE(std::get<decltype(result)>(result_variant) == Catch::Approx(result)); } SECTION("cos") @@ -81,7 +81,7 @@ TEST_CASE("MathModule", "[language]") DataVariant result_variant = function_embedder.apply({arg_variant}); auto result = std::cos(arg); - REQUIRE(std::get<decltype(result)>(result_variant) == Approx(result)); + REQUIRE(std::get<decltype(result)>(result_variant) == Catch::Approx(result)); } SECTION("tan") @@ -93,7 +93,7 @@ TEST_CASE("MathModule", "[language]") DataVariant result_variant = function_embedder.apply({arg_variant}); auto result = std::tan(arg); - REQUIRE(std::get<decltype(result)>(result_variant) == Approx(result)); + REQUIRE(std::get<decltype(result)>(result_variant) == Catch::Approx(result)); } SECTION("asin") @@ -105,7 +105,7 @@ TEST_CASE("MathModule", "[language]") DataVariant result_variant = function_embedder.apply({arg_variant}); auto result = std::asin(arg); - REQUIRE(std::get<decltype(result)>(result_variant) == Approx(result)); + REQUIRE(std::get<decltype(result)>(result_variant) == Catch::Approx(result)); } SECTION("acos") @@ -117,7 +117,7 @@ TEST_CASE("MathModule", "[language]") DataVariant result_variant = function_embedder.apply({arg_variant}); auto result = std::acos(arg); - REQUIRE(std::get<decltype(result)>(result_variant) == Approx(result)); + REQUIRE(std::get<decltype(result)>(result_variant) == Catch::Approx(result)); } SECTION("atan") @@ -129,7 +129,7 @@ TEST_CASE("MathModule", "[language]") DataVariant result_variant = function_embedder.apply({arg_variant}); auto result = std::atan(arg); - REQUIRE(std::get<decltype(result)>(result_variant) == Approx(result)); + REQUIRE(std::get<decltype(result)>(result_variant) == Catch::Approx(result)); } SECTION("sinh") @@ -144,7 +144,7 @@ TEST_CASE("MathModule", "[language]") DataVariant result_variant = function_embedder.apply({arg_variant}); auto result = std::sinh(arg); - REQUIRE(std::get<decltype(result)>(result_variant) == Approx(result)); + REQUIRE(std::get<decltype(result)>(result_variant) == Catch::Approx(result)); } SECTION("cosh") @@ -156,7 +156,7 @@ TEST_CASE("MathModule", "[language]") DataVariant result_variant = function_embedder.apply({arg_variant}); auto result = std::cosh(arg); - REQUIRE(std::get<decltype(result)>(result_variant) == Approx(result)); + REQUIRE(std::get<decltype(result)>(result_variant) == Catch::Approx(result)); } SECTION("tanh") @@ -168,7 +168,7 @@ TEST_CASE("MathModule", "[language]") DataVariant result_variant = function_embedder.apply({arg_variant}); auto result = std::tanh(arg); - REQUIRE(std::get<decltype(result)>(result_variant) == Approx(result)); + REQUIRE(std::get<decltype(result)>(result_variant) == Catch::Approx(result)); } SECTION("asinh") @@ -180,7 +180,7 @@ TEST_CASE("MathModule", "[language]") DataVariant result_variant = function_embedder.apply({arg_variant}); auto result = std::asinh(arg); - REQUIRE(std::get<decltype(result)>(result_variant) == Approx(result)); + REQUIRE(std::get<decltype(result)>(result_variant) == Catch::Approx(result)); } SECTION("acosh") @@ -195,7 +195,7 @@ TEST_CASE("MathModule", "[language]") DataVariant result_variant = function_embedder.apply({arg_variant}); auto result = std::acosh(arg); - REQUIRE(std::get<decltype(result)>(result_variant) == Approx(result)); + REQUIRE(std::get<decltype(result)>(result_variant) == Catch::Approx(result)); } SECTION("atanh") @@ -207,7 +207,7 @@ TEST_CASE("MathModule", "[language]") DataVariant result_variant = function_embedder.apply({arg_variant}); auto result = std::atanh(arg); - REQUIRE(std::get<decltype(result)>(result_variant) == Approx(result)); + REQUIRE(std::get<decltype(result)>(result_variant) == Catch::Approx(result)); } SECTION("exp") @@ -219,7 +219,7 @@ TEST_CASE("MathModule", "[language]") DataVariant result_variant = function_embedder.apply({arg_variant}); auto result = std::exp(arg); - REQUIRE(std::get<decltype(result)>(result_variant) == Approx(result)); + REQUIRE(std::get<decltype(result)>(result_variant) == Catch::Approx(result)); } SECTION("log") @@ -231,7 +231,7 @@ TEST_CASE("MathModule", "[language]") DataVariant result_variant = function_embedder.apply({arg_variant}); auto result = std::log(arg); - REQUIRE(std::get<decltype(result)>(result_variant) == Approx(result)); + REQUIRE(std::get<decltype(result)>(result_variant) == Catch::Approx(result)); } } @@ -319,7 +319,7 @@ TEST_CASE("MathModule", "[language]") DataVariant result_variant = function_embedder.apply({arg0_variant, arg1_variant}); auto result = std::pow(arg0, arg1); - REQUIRE(std::get<decltype(result)>(result_variant) == Approx(result)); + REQUIRE(std::get<decltype(result)>(result_variant) == Catch::Approx(result)); } } } diff --git a/tests/test_Messenger.cpp b/tests/test_Messenger.cpp index 022a5c07e4b16db81dc69ec236a1482d1138d6d1..22945c15e2e8ad244cdc25f27a40fdee7cba56f5 100644 --- a/tests/test_Messenger.cpp +++ b/tests/test_Messenger.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <utils/Array.hpp> #include <utils/Messenger.hpp> diff --git a/tests/test_NameProcessor.cpp b/tests/test_NameProcessor.cpp index c789420a2d971503dc1de477b987fc156b87ab6c..ac6b8174d6345e4be81fe5515bca14233fa8f1f4 100644 --- a/tests/test_NameProcessor.cpp +++ b/tests/test_NameProcessor.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTNodeDataTypeBuilder.hpp> diff --git a/tests/test_OStreamProcessor.cpp b/tests/test_OStreamProcessor.cpp index 8da0c8c0db17b418499403ce453030d084bb70e4..22213d64bcbb70adf6ea6fab93f82e641870da29 100644 --- a/tests/test_OStreamProcessor.cpp +++ b/tests/test_OStreamProcessor.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTNodeDataTypeBuilder.hpp> diff --git a/tests/test_ParseError.cpp b/tests/test_ParseError.cpp index 0fb8eb5dca61f1098592eafd1d84d51f2e953bc0..9555711966d2a37121d4afa223f193a3441455ad 100644 --- a/tests/test_ParseError.cpp +++ b/tests/test_ParseError.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/utils/ParseError.hpp> diff --git a/tests/test_Partitioner.cpp b/tests/test_Partitioner.cpp index 9af1fc6c6f24be33aa5363696f36cab5909e6e7d..78a427f6d31fd35f27519498a0382e681f3421c4 100644 --- a/tests/test_Partitioner.cpp +++ b/tests/test_Partitioner.cpp @@ -1,4 +1,4 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> #include <utils/Messenger.hpp> #include <utils/Partitioner.hpp> diff --git a/tests/test_PugsAssert.cpp b/tests/test_PugsAssert.cpp index a7fa737f8d2ce1e8ed75a5865fd0f73799e613f6..6a517a01a0d190ea17a0e6e412fe3f66b8114767 100644 --- a/tests/test_PugsAssert.cpp +++ b/tests/test_PugsAssert.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <utils/PugsAssert.hpp> diff --git a/tests/test_PugsFunctionAdapter.cpp b/tests/test_PugsFunctionAdapter.cpp index 14cc1def65f1e25940653f95e39cd09a2fc0285d..7d048738e6a20484dfe5f0431d7dab9bf3f3c5f2 100644 --- a/tests/test_PugsFunctionAdapter.cpp +++ b/tests/test_PugsFunctionAdapter.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/utils/PugsFunctionAdapter.hpp> diff --git a/tests/test_PugsUtils.cpp b/tests/test_PugsUtils.cpp index b966ae8f0c0bab490c9f7e3e4441ffdd329aeec1..f32e8014a76561a07aa3d70756641e0a9231238d 100644 --- a/tests/test_PugsUtils.cpp +++ b/tests/test_PugsUtils.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <utils/BuildInfo.hpp> #include <utils/PugsUtils.hpp> diff --git a/tests/test_RevisionInfo.cpp b/tests/test_RevisionInfo.cpp index 64c324c4d1eab11c763cd0cbd775370f7966bf9f..05c3ff2dd9917de036b95a557bfd64187978c06a 100644 --- a/tests/test_RevisionInfo.cpp +++ b/tests/test_RevisionInfo.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <utils/RevisionInfo.hpp> diff --git a/tests/test_SparseMatrixDescriptor.cpp b/tests/test_SparseMatrixDescriptor.cpp index 8616a41da0ff8a60857ef314c74e04becf6c651f..8bd0c37c5cc9e294462fc92a759980dbc7a4a336 100644 --- a/tests/test_SparseMatrixDescriptor.cpp +++ b/tests/test_SparseMatrixDescriptor.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <utils/PugsAssert.hpp> diff --git a/tests/test_SymbolTable.cpp b/tests/test_SymbolTable.cpp index fed694f752f4b87ce79a88ae97547800bb4d35c2..2be1a3d81a104e631894184eaf67f0d2d63d44d2 100644 --- a/tests/test_SymbolTable.cpp +++ b/tests/test_SymbolTable.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/utils/BuiltinFunctionEmbedder.hpp> #include <language/utils/SymbolTable.hpp> diff --git a/tests/test_Timer.cpp b/tests/test_Timer.cpp index bf85f15653eec2ba4bd6914873e6305cedaf4829..c615f9f3ee72e700c6cbf217800ea331b735f569 100644 --- a/tests/test_Timer.cpp +++ b/tests/test_Timer.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <utils/Timer.hpp> diff --git a/tests/test_TinyMatrix.cpp b/tests/test_TinyMatrix.cpp index ca5a12fbddb68e01324158c14ef42546b27ddec1..158512dbf67e80751c362c67385b454a1bd1e5c9 100644 --- a/tests/test_TinyMatrix.cpp +++ b/tests/test_TinyMatrix.cpp @@ -1,4 +1,6 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_approx.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <Kokkos_Core.hpp> @@ -164,7 +166,7 @@ TEST_CASE("TinyMatrix", "[algebra]") REQUIRE(det(TinyMatrix<3, int>(1, 1, 1, 1, 2, 1, 2, 1, 3)) == 1); REQUIRE(det(B) == -1444); REQUIRE(det(TinyMatrix<4, double>(1, 2.3, 7, -6.2, 3, 4, 9, 1, 4.1, 5, 2, -3, 2, 27, 3, 17.5)) == - Approx(6661.455).epsilon(1E-14)); + Catch::Approx(6661.455).epsilon(1E-14)); REQUIRE(det(TinyMatrix<4, double>(1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 2, 0, 0, 2, 2)) == 0); } @@ -173,32 +175,32 @@ TEST_CASE("TinyMatrix", "[algebra]") { { const TinyMatrix<1, double> A1(2); - REQUIRE(inverse(A1)(0, 0) == Approx(0.5).epsilon(1E-14)); + REQUIRE(inverse(A1)(0, 0) == Catch::Approx(0.5).epsilon(1E-14)); } { const TinyMatrix<2, double> A2(2, 3, 4, 1); const TinyMatrix<2, double> I = inverse(A2) * A2; - REQUIRE(I(0, 0) == Approx(1).epsilon(1E-14)); - REQUIRE(I(0, 1) == Approx(0).margin(1E-14)); - REQUIRE(I(1, 0) == Approx(0).margin(1E-14)); - REQUIRE(I(1, 1) == Approx(1).epsilon(1E-14)); + REQUIRE(I(0, 0) == Catch::Approx(1).epsilon(1E-14)); + REQUIRE(I(0, 1) == Catch::Approx(0).margin(1E-14)); + REQUIRE(I(1, 0) == Catch::Approx(0).margin(1E-14)); + REQUIRE(I(1, 1) == Catch::Approx(1).epsilon(1E-14)); } { const TinyMatrix<3, double> A3(2, 3, 1, 4, -1, 5, -2, 3, 4); const TinyMatrix<3, double> I = inverse(A3) * A3; - REQUIRE(I(0, 0) == Approx(1).epsilon(1E-14)); - REQUIRE(I(0, 1) == Approx(0).margin(1E-14)); - REQUIRE(I(0, 2) == Approx(0).margin(1E-14)); - REQUIRE(I(1, 0) == Approx(0).margin(1E-14)); - REQUIRE(I(1, 1) == Approx(1).epsilon(1E-14)); - REQUIRE(I(1, 2) == Approx(0).margin(1E-14)); - REQUIRE(I(2, 0) == Approx(0).margin(1E-14)); - REQUIRE(I(2, 1) == Approx(0).margin(1E-14)); - REQUIRE(I(2, 2) == Approx(1).epsilon(1E-14)); + REQUIRE(I(0, 0) == Catch::Approx(1).epsilon(1E-14)); + REQUIRE(I(0, 1) == Catch::Approx(0).margin(1E-14)); + REQUIRE(I(0, 2) == Catch::Approx(0).margin(1E-14)); + REQUIRE(I(1, 0) == Catch::Approx(0).margin(1E-14)); + REQUIRE(I(1, 1) == Catch::Approx(1).epsilon(1E-14)); + REQUIRE(I(1, 2) == Catch::Approx(0).margin(1E-14)); + REQUIRE(I(2, 0) == Catch::Approx(0).margin(1E-14)); + REQUIRE(I(2, 1) == Catch::Approx(0).margin(1E-14)); + REQUIRE(I(2, 2) == Catch::Approx(1).epsilon(1E-14)); } } diff --git a/tests/test_TinyVector.cpp b/tests/test_TinyVector.cpp index 20f1f68be22f35b67a38d13d70b95e3fad188e08..2775588af687aa274dbba5374af53a85cacce36a 100644 --- a/tests/test_TinyVector.cpp +++ b/tests/test_TinyVector.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_approx.hpp> +#include <catch2/catch_test_macros.hpp> #include <utils/PugsAssert.hpp> @@ -70,7 +71,7 @@ TEST_CASE("TinyVector", "[algebra]") z1 = zero; REQUIRE(((z1[0] == 0) and (z1[1] == 0) and (z1[2] == 0))); - REQUIRE(l2Norm(TinyVector<2, double>(3, 4)) == Approx(5).epsilon(1E-14)); + REQUIRE(l2Norm(TinyVector<2, double>(3, 4)) == Catch::Approx(5).epsilon(1E-14)); SECTION("checking for cross product") { diff --git a/tests/test_TupleToVectorProcessor.cpp b/tests/test_TupleToVectorProcessor.cpp index c11ac7db2fdd76fdbce738d2f9daf7fe3f920266..817e5c9ba54af0664a34045d5de528f80c59db4a 100644 --- a/tests/test_TupleToVectorProcessor.cpp +++ b/tests/test_TupleToVectorProcessor.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTModulesImporter.hpp> diff --git a/tests/test_UnaryExpressionProcessor.cpp b/tests/test_UnaryExpressionProcessor.cpp index 3f875b0bedd2164f1b354edac9483ce4ca528e77..84b3bc0c8da06d17dd429f7add7d72d036d17068 100644 --- a/tests/test_UnaryExpressionProcessor.cpp +++ b/tests/test_UnaryExpressionProcessor.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTNodeDataTypeBuilder.hpp> diff --git a/tests/test_Vector.cpp b/tests/test_Vector.cpp index b52ac45232af6750d99cd3770e16c7da50679231..d02481859e1c41c49509f973f09006ba50373cc3 100644 --- a/tests/test_Vector.cpp +++ b/tests/test_Vector.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <utils/PugsAssert.hpp> diff --git a/tests/test_WhileProcessor.cpp b/tests/test_WhileProcessor.cpp index ef4d04ae230d86a93555d3903698d3bf796205cd..33f1d9488a3007e8f1a4d2f8c9a733487c496d4b 100644 --- a/tests/test_WhileProcessor.cpp +++ b/tests/test_WhileProcessor.cpp @@ -1,4 +1,5 @@ -#include <catch2/catch.hpp> +#include <catch2/catch_test_macros.hpp> +#include <catch2/matchers/catch_matchers_all.hpp> #include <language/ast/ASTBuilder.hpp> #include <language/ast/ASTNodeAffectationExpressionBuilder.hpp> diff --git a/tests/test_main.cpp b/tests/test_main.cpp index b2703a5950eeabe8eea33ba61cab4fc2e2f9157a..ee1d0769b152c5b483214e0edc7d9313775cf416 100644 --- a/tests/test_main.cpp +++ b/tests/test_main.cpp @@ -1,5 +1,4 @@ -#define CATCH_CONFIG_RUNNER -#include <catch2/catch.hpp> +#include <catch2/catch_all.hpp> #include <Kokkos_Core.hpp> @@ -26,7 +25,7 @@ main(int argc, char* argv[]) if (result == 0) { const auto& config = session.config(); - if (config.listReporters() or config.listTags() or config.listTestNamesOnly() or config.listTests()) { + if (config.listReporters() or config.listTags() or config.listTests()) { result = session.run(); } else { // Disable outputs from tested classes to the standard output